Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix height of function key row

  • Loading branch information...
commit c07e13a414558292e389179e5479f1ad97b1523f 1 parent 7a7bc40
Olaf Schulz authored

Showing 1 changed file with 86 additions and 24 deletions. Show diff stats Hide diff stats

  1. +86 24 src/key-overlay.vala
110 src/key-overlay.vala
@@ -293,23 +293,34 @@ namespace NeoLayoutViewer{
293 293 }
294 294
295 295 public void generateKeyevents() {
296   - HBox[] hboxes = {
297   - new HBox(false, 0),
298   - new HBox(false, 0),
299   - new HBox(false, 0),
300   - new HBox(false, 0),
301   - new HBox(false, 0)
  296 + HBox[] hboxes = {
  297 + new HBox(false, 0), // top row (1,2,3,…)
  298 + new HBox(false, 0), // upper row (x,v,l,…)
  299 + new HBox(false, 0), // home row (u,i,a,…)
  300 + new HBox(false, 0), // lower row (ü,ö,ä,…)
  301 + new HBox(false, 0), // space row
  302 + new HBox(false, 0) //function key row
302 303 };
303   - this.pack_start( hboxes[0], false, true, 0 );
304   - this.pack_start( hboxes[1], false, true, 0 );
305   - this.pack_start( hboxes[2], false, true, 0 );
306   - this.pack_start( hboxes[3], false, true, 0 );
307   - this.pack_start( hboxes[4], false, true, 0 );
  304 +
  305 + if( winMain.config.get("display_function_keys")!="0" ){
  306 + this.pack_start( hboxes[5], false, true, 0 );
  307 + }
  308 +
  309 + this.pack_start( hboxes[0], false, true, 0 );
  310 + this.pack_start( hboxes[1], false, true, 0 );
  311 + this.pack_start( hboxes[2], false, true, 0 );
  312 + this.pack_start( hboxes[3], false, true, 0 );
  313 + this.pack_start( hboxes[4], false, true, 0 );
308 314
309 315 double winWidthUnscaled = 1000.0;
310   - double winHeightUnscaled = 220.0;
311   - if( winMain.config.get("display_numpad")=="0" )
  316 + double winHeightUnscaled = 250.0;
  317 + if( winMain.config.get("display_function_keys")=="0" ){
  318 + winHeightUnscaled -= winMain.function_keys_height;
  319 + }
  320 + if( winMain.config.get("display_numpad")=="0" ){
312 321 winWidthUnscaled -= winMain.numpad_width;
  322 + }
  323 +
313 324 int width, height;
314 325 winMain.get_size2(out width, out height);
315 326
@@ -323,6 +334,48 @@ namespace NeoLayoutViewer{
323 334
324 335 //GLib.stdout.printf(@"$winWidthUnscaled , $width , $scaleX\n");
325 336
  337 + if( winMain.config.get("display_function_keys")!="0" ){
  338 + //esc
  339 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 9, false, winMain, hboxes[5], 0);
  340 + //free space
  341 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[5], 3);
  342 + // F1-F4
  343 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 67, false, winMain, hboxes[5], 0);
  344 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 68, false, winMain, hboxes[5], 0);
  345 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 69, false, winMain, hboxes[5], 0);
  346 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 70, false, winMain, hboxes[5], 0);
  347 + //free space
  348 + scaledBox(22.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[5], 3);
  349 + // F5-F8
  350 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 71, false, winMain, hboxes[5], 0);
  351 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 72, false, winMain, hboxes[5], 0);
  352 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 73, false, winMain, hboxes[5], 0);
  353 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 74, false, winMain, hboxes[5], 0);
  354 + //free space
  355 + scaledBox(22.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[5], 3);
  356 + // F9-F11
  357 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 75, false, winMain, hboxes[5], 0);
  358 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 76, false, winMain, hboxes[5], 0);
  359 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 95, false, winMain, hboxes[5], 0);
  360 + if( winMain.config.get("display_numpad")!="0" ){
  361 + //F12
  362 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 96, false, winMain, hboxes[5], 0);
  363 + //free space
  364 + scaledBox(22.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , -1 , false, winMain, hboxes[5], 3);
  365 + // print,scroll,break
  366 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 107, true, winMain, hboxes[5], 0);
  367 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 78, true, winMain, hboxes[5], 0);
  368 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 127, true, winMain, hboxes[5], 0);
  369 + }else{
  370 + //F12
  371 + scaledBox(44.0,30.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 96, true, winMain, hboxes[5], 0);
  372 + }
  373 +
  374 + //Reset right shift.
  375 + posXUnscaled = 0.0;
  376 + posX = 0;
  377 + }
  378 +
326 379 //++ Top row ++
327 380 scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 49, false, winMain, hboxes[0], 0);
328 381 scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 10, false, winMain, hboxes[0], 0);
@@ -400,8 +453,8 @@ namespace NeoLayoutViewer{
400 453 posXUnscaled = 0.0;
401 454 posX = 0;
402 455
403   - //++ End second row ++
404   - //++ third row ++
  456 + //++ End upper row ++
  457 + //++ home row ++
405 458 //left mod3
406 459 scaledBox(73.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 2/*37*/ , false, winMain, hboxes[2], 1);
407 460 scaledBox(44.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 38 , false, winMain, hboxes[2], 0);
@@ -436,8 +489,8 @@ namespace NeoLayoutViewer{
436 489 //Reset right shift.
437 490 posXUnscaled = 0.0;
438 491 posX = 0;
439   - //++ End third row ++
440   - //++ fourth row ++
  492 + //++ End home row ++
  493 + //++ lower row ++
441 494 //left shift
442 495 scaledBox(52.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 1/*50*/ , false, winMain, hboxes[3], 1);
443 496 //mod4
@@ -473,8 +526,8 @@ namespace NeoLayoutViewer{
473 526 //Reset right shift.
474 527 posXUnscaled = 0.0;
475 528 posX = 0;
476   - //++ End fourth row ++
477   - //++ fivth row ++
  529 + //++ End lower row ++
  530 + //++ last/space row ++
478 531 //left ctrl, 37
479 532 scaledBox(61.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 4/*37*/ , false, winMain, hboxes[4], 2);
480 533 //free space
@@ -508,7 +561,7 @@ namespace NeoLayoutViewer{
508 561 scaledBox(61.0,44.0,ref posXUnscaled, ref posYUnscaled, ref posX, ref posY, scaleX, scaleY , 4/*105*/ , false, winMain, hboxes[4], 2);
509 562 }
510 563
511   - //++ End fivth row ++
  564 + //++ End last/space row ++
512 565 }
513 566
514 567
@@ -577,6 +630,7 @@ namespace NeoLayoutViewer{
577 630 private NeoWindow winMain;
578 631 private int width;
579 632 private int height;
  633 + private Gtk.Image image;
580 634
581 635 /*
582 636 Die Reihenfolge der Zeichen in keysyms passt nicht
@@ -598,7 +652,7 @@ namespace NeoLayoutViewer{
598 652 flip = true;
599 653 }
600 654 */
601   - this.set_visible_window(false);
  655 + //this.set_visible_window(false);
602 656 }
603 657
604 658 public KeyEventBox(NeoWindow winMain, int width, int height , ref uint[] keysym){
@@ -610,11 +664,9 @@ namespace NeoLayoutViewer{
610 664
611 665 this.button_press_event.connect ((event) => {
612 666 uint ks = this.keysym[this.layer_permutation[winMain.ebene]-1];
613   - int modi = winMain.getActiveModifierMask({4,5});
  667 + int modi = winMain.getActiveModifierMask({4,5}); //ctrl+alt mask
614 668 if( ks < 1 ) return false;
615 669
616   - //GLib.stdout.printf(@"Capslock active: $( checkCapsLock() )\n");
617   -
618 670 keysend(ks,modi);
619 671 return false;
620 672 });
@@ -658,6 +710,16 @@ namespace NeoLayoutViewer{
658 710 winMain.redraw();
659 711 return false;
660 712 });
  713 +
  714 + // Image of pressed Button
  715 + Gdk.Pixbuf image_buffer = winMain.open_image_str("assets/neo2.0/tastatur_ctrl_left_2.png");
  716 + var w = image_buffer.width;
  717 + var h = image_buffer.height;
  718 + image_buffer = image_buffer.scale_simple(width, h*width/w,Gdk.InterpType.BILINEAR);
  719 +
  720 + this.image = new Gtk.Image();
  721 + this.image.set_from_pixbuf(image_buffer);
  722 + add(this.image);
661 723 }
662 724
663 725 public KeyEventBox.freeArea(NeoWindow winMain, int width, int height ){

0 comments on commit c07e13a

Please sign in to comment.
Something went wrong with that request. Please try again.