From 28645bbb94cd7448f7dba407a8fb6693f5dd670d Mon Sep 17 00:00:00 2001 From: mzuther Date: Wed, 20 Jan 2010 14:53:56 +0000 Subject: X11 driver: do not display key strokes that do not map to a button git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1090 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- drv_X11.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/drv_X11.c b/drv_X11.c index b9b7854..8b80b4b 100644 --- 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; -- cgit v1.2.3