diff options
author | mzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2010-04-18 11:47:58 +0000 |
---|---|---|
committer | mzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2010-04-18 11:47:58 +0000 |
commit | 299b4fb7dfccc166e5bbb34616b51da001ffb6d1 (patch) | |
tree | 5d9b82488eb41354f91391a16f8d3cba50edcead /drv_X11.c | |
parent | d1c03f054cf14908aa5fc1f7d3eba6d4dcb46994 (diff) | |
download | lcd4linux-299b4fb7dfccc166e5bbb34616b51da001ffb6d1.tar.gz |
X11 driver: correctly handle key releases
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1117 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'drv_X11.c')
-rw-r--r-- | drv_X11.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -201,9 +201,18 @@ static int drv_X11_brightness(int brightness) static int drv_X11_keypad(const int num) { - int val = WIDGET_KEY_PRESSED; + int val; + int new_num = num; + + if (new_num > 0) + val = WIDGET_KEY_PRESSED; + else { + /* negative values mark a key release */ + new_num = -num; + val = WIDGET_KEY_RELEASED; + } - switch (num) { + switch (new_num) { case 1: val += WIDGET_KEY_UP; break; @@ -447,6 +456,8 @@ static void drv_X11_timer( __attribute__ ((unused)) debug("key for button %i released", btn); XClearArea(dp, w, xoffset, yoffset + (btn - 1) * (btnheight + pgap), btnwidth, btnheight - 2, 1 /* true */ ); + /* negative values mark a key release */ + drv_generic_keypad_press(-btn); } else { debug("key release for button %i ignored", btn); } |