]> git.webhop.me Git - lcd4linux.git/commitdiff
X11 driver: do not display key strokes that do not map to a button
authormzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Wed, 20 Jan 2010 14:53:56 +0000 (14:53 +0000)
committermzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Wed, 20 Jan 2010 14:53:56 +0000 (14:53 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1090 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

drv_X11.c

index b9b785431c30cb48ed094920f79677c157a044e8..8b80b4b68e143534a65e511fd1d19cc474c91a2c 100644 (file)
--- a/drv_X11.c
+++ b/drv_X11.c
@@ -406,14 +406,16 @@ static void drv_X11_timer( __attribute__ ((unused))
            btn = 0;
        }
        /* only register key press if button is defined on GUI */
-       if ((btn > 0) && (btn <= buttons)) {
-           debug("key for button %i pressed", btn);
-           drv_X11_color(BG_COL, 255);
-           XFillRectangle(dp, w, gc, xoffset + 1, yoffset + (btn - 1) * (btnheight + pgap) + 1, btnwidth - 1,
-                          btnheight - 2 - 1);
-           drv_generic_keypad_press(btn);
-       } else {
-           debug("key press for button %i ignored", btn);
+       if (btn > 0) {
+           if (btn <= buttons) {
+               debug("key for button %i pressed", btn);
+               drv_X11_color(BG_COL, 255);
+               XFillRectangle(dp, w, gc, xoffset + 1, yoffset + (btn - 1) * (btnheight + pgap) + 1, btnwidth - 1,
+                              btnheight - 2 - 1);
+               drv_generic_keypad_press(btn);
+           } else {
+               debug("key press for button %i ignored", btn);
+           }
        }
        break;
 
@@ -440,12 +442,14 @@ static void drv_X11_timer( __attribute__ ((unused))
            break;
        }
        /* only register key release if button is defined on GUI */
-       if ((btn > 0) && (btn <= buttons)) {
-           debug("key for button %i released", btn);
-           XClearArea(dp, w, xoffset, yoffset + (btn - 1) * (btnheight + pgap), btnwidth, btnheight - 2,
-                      1 /* true */ );
-       } else {
-           debug("key release for button %i ignored", btn);
+       if (btn > 0) {
+           if (btn <= buttons) {
+               debug("key for button %i released", btn);
+               XClearArea(dp, w, xoffset, yoffset + (btn - 1) * (btnheight + pgap), btnwidth, btnheight - 2,
+                          1 /* true */ );
+           } else {
+               debug("key release for button %i ignored", btn);
+           }
        }
        break;