Fix gaps between some keys
authorThibaut Girka <thib@sitedethib.com>
Thu, 21 Jul 2011 18:47:57 +0200
changeset 16 5dd4f4c17192
parent 15 d3d4f1f4c1fd
child 17 2cb8af0a70ca
Fix gaps between some keys
Makefile
ui.c
--- a/Makefile	Thu Jul 21 18:33:15 2011 +0200
+++ b/Makefile	Thu Jul 21 18:47:57 2011 +0200
@@ -1,6 +1,6 @@
 REQUIRED_LIBS = cairo pangocairo x11 xkbfile xtst
 
-LDFLAGS = `pkg-config --libs $(REQUIRED_LIBS)` -g
+LDFLAGS = `pkg-config --libs $(REQUIRED_LIBS)`
 CFLAGS = `pkg-config --cflags $(REQUIRED_LIBS)` -Wall -O0 -g
 
 
--- a/ui.c	Thu Jul 21 18:33:15 2011 +0200
+++ b/ui.c	Thu Jul 21 18:47:57 2011 +0200
@@ -212,13 +212,16 @@
 {
     /* Recalculate effective x, y, width and height for each key */
     int i;
+    unsigned int maxx, maxy;
     for (i=0; i < ui->vkb->nb_keys; i++)
     {
         VirtualKey *vkey = ui->vkb->keys + i;
         vkey->effective_x = vkey->x * ui->width / ui->vkb->width;
         vkey->effective_y = vkey->y * ui->height / ui->vkb->height;
-        vkey->effective_width = vkey->width * ui->width / ui->vkb->width;
-        vkey->effective_height = vkey->height * ui->height / ui->vkb->height;
+        maxx = (vkey->x + vkey->width) * ui->width / ui->vkb->width;
+        maxy = (vkey->y + vkey->height) * ui->height / ui->vkb->height;
+        vkey->effective_width = maxx - vkey->effective_x;
+        vkey->effective_height = maxy - vkey->effective_y;
     }
 }