superkb-devel Mailing List for Superkb
Status: Alpha
Brought to you by:
alvarezp
You can subscribe to this list here.
2010 |
Jan
(2) |
Feb
(1) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
|
Feb
(1) |
Mar
(2) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Octavio A. <alv...@al...> - 2011-05-04 02:27:03
|
From 3aba6270efdd7edeb76206ebade05f9990074850 Mon Sep 17 00:00:00 2001 From: Octavio Alvarez <alv...@al...> Date: Fri, 29 Apr 2011 19:27:34 -0700 Subject: [PATCH] Fixed wrong word in error message. We want the user to have their current keyboard layout whatever the system default might be. --- main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/main.c b/main.c index b2a0062..b6ee1c4 100755 --- a/main.c +++ b/main.c @@ -516,7 +516,7 @@ int main(int argc, char *argv[]) "X. Quitting.\n"); fprintf(stderr, "\nIf using GNOME you might want to try adding a " "keyboard layout and then\nremoving it, and making sure your " - "default layout is effectively selected as\ndefault.\n"); + "current layout is effectively selected as\ndefault.\n"); return EXIT_FAILURE; } -- Octavio. |
From: Octavio A. <alv...@al...> - 2011-03-24 15:46:24
|
Hi. I forgot to announce it here, but Superkb 0.22 was released on March 18th. For a user-friendly version of what's new and fixed, check the Wiki out: http://superkb.org/wiki/index.php?title=Superkb_0.22 The following is the developer-friendly (if there is such a thing) changelog: Eduardo A. Bustamante López <ebu...@du...> (2): Make sure KeyReleased keys are actually not pressed (Bug #432887). Change system() to execvp() for command execution. Eduardo Bustamante <ro...@du...> (1): Fix linking issue with Fedora Core 13. Octavio Alvarez <alv...@al...> (27): Push version to 0.21+git debug() is a frequently called function. Optimize Return as soon as possible from debug(). valgrind said initalization was taking much time. take out of the loop. Remove 6000+ unused calls (According to valgrind) take ferror() out of the loop. Not needed inside Fix some missing spaces in error messages. Workaround: X.org now reports version of server (10707000), instead of suite. Friendlier dlopen() error message for troubleshooting purposes. Fix the available values for drawkblib error message. Missing return provoked a crash on dlopen() failure. Make kbdesc a local variable in the drawkb libraries. Propagate kbdesc all the way in to drawkb_cairo_load_and_draw_icon(). Change all references from kbdesc to the new this->kbdesc. Remove the global kbdesc from drawkblib cairo. Show extended version information on startup. Raise window each time it gets mapped. Add USE_GRADIENTS option with default = 1 Pass the USE_GRADIENTS variable all the way to drawkblibs. Change shape background to gradients if enabled by user. Change kbwin background to gradient if enabled by user. Fix icon placement offset. Update drawkblib_xlib_create() definitions. Added debugging code to draw limits of labelbox and fullbox. Box and line width adjustments. Fixed background gradient to original intention. Push version to 0.22 |
From: Octavio A. <alv...@al...> - 2011-03-17 00:05:01
|
Hi. http://superkb.org/wiki/ The Superkb Wiki is back online. It had to be regenerated from scratch due to a mistake made by me while cleaning the database after the spam wave. No content was lost, but I decided not to reupload user pages. I reinstalled ConfirmEdit and revised its configuration, which was wrong in the past installation. Let's see how it goes this time. Thank you for your patience. -- Octavio. Twitter: @alvarezp2000 -- Identi.ca: @alvarezp |
From: Octavio A. <alv...@al...> - 2011-02-04 17:53:58
|
Hi. After many failed attempts to stop the new ongoing spamming wave, the Superkb Wiki will be put away until I can assure that a more effective mechanism is programmed. MediaWiki spam prevention mechanism are very lacky. It has to rely on extensions to reliably fight it. Unfortunately, these extensions are not ported to the newest versions of MediaWiki. We will probably need to develop our own extension, which will require some development time. This may make the Superkb Wiki be away for quite a time. I *really* don't want to use reCAPTCHA because they are becoming increasingly difficult to solve, being counter productive and sacrificing accessibility. There should be a better way. Help is appreciated. |
From: Octavio A. <alv...@al...> - 2010-12-11 08:19:59
|
On Fri, 10 Dec 2010 20:55:31 -0800, Eduardo A. Bustamante López <ebu...@du...> wrote: > The system() call disables the calling process until the command > is executed. This behavior generated a superkb child process > for each command executed. With execvp(), the child process is > replaced with the user's command. Nice patch, thank you very much. Applied and pushed to the public repo. |
From: Eduardo A. B. L. <ebu...@du...> - 2010-12-11 04:55:58
|
The system() call disables the calling process until the command is executed. This behavior generated a superkb child process for each command executed. With execvp(), the child process is replaced with the user's command. --- main.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 11f4dc6..6951c4f 100755 --- a/main.c +++ b/main.c @@ -279,6 +279,7 @@ int kbwin_init(Display * dpy) void __Superkb_Action(KeyCode keycode, unsigned int state) { unsigned int i; + char *argv[4] = { "sh", "-c", NULL, NULL }; for (i = 0; i < config->key_bindings_n; i++) { if (config->key_bindings[i].keycode == keycode && config->key_bindings[i].state == state) { @@ -295,8 +296,9 @@ void __Superkb_Action(KeyCode keycode, unsigned int state) system(cmdline); } } - system(config->key_bindings[i].action.command); - exit(EXIT_SUCCESS); + argv[2] = config->key_bindings[i].action.command; + execvp(*argv, argv); + exit(EXIT_FAILURE); } break; case AT_DOCUMENT: @@ -316,9 +318,10 @@ void __Superkb_Action(KeyCode keycode, unsigned int state) strcpy (cmdline, config->document_handler); strcat (cmdline, " "); strcat (cmdline, config->key_bindings[i].action.document); - system(cmdline); + argv[2] = cmdline; + execvp(*argv, argv); } - exit(EXIT_SUCCESS); + exit(EXIT_FAILURE); } break; case AT_FUNCTION: -- 1.7.2.3 |
From: Octavio A. <alv...@al...> - 2010-12-11 04:31:41
|
On Fri, 10 Dec 2010 20:05:45 -0800, Eduardo A. Bustamante López <ebu...@du...> wrote: > The system() call disables the calling process until the command > is executed. This behavior generated a superkb child process > for each command executed. With execvp(), the child process is > replaced with the user's command. Nice. I have some comments, though. > @@ -279,6 +279,10 @@ int kbwin_init(Display * dpy) > void __Superkb_Action(KeyCode keycode, unsigned int state) > { > unsigned int i; > + char *argv [4]; Drop the space between *argv and [4], please. > + argv[0] = "/bin/sh"; > + argv[1] = "-c"; > + argv[3] = NULL; You might want to try char *argv[4] = { "/bin/sh", "-c", NULL, NULL }; it may be easier to optimize by the compiler. Also, being execvp(), why not use just sh instead of /bin/sh? > - system(config->key_bindings[i].action.command); > + argv[2] = config->key_bindings[i].action.command; > + execvp(*argv, argv); > exit(EXIT_SUCCESS); We want exit(EXIT_FAILURE) here. "If any of the exec functions returns, an error will have occurred." > @@ -308,7 +314,8 @@ void __Superkb_Action(KeyCode keycode, unsigned int > state) > strcat (cmdline, " "); > strcat (cmdline, config->key_bindings[i].feedback_string); > strcat (cmdline, " &"); > - system(cmdline); > + argv[2] = cmdline; > + execvp(*argv, argv); > } > } > char *cmdline = malloc(strlen(config->document_handler) + > strlen(config->key_bindings[i].action.document) + 2); I'm not sure we want this. If you replace Superkb with the process for feedback_string, the execvp() below will never be reached. > @@ -316,7 +323,8 @@ void __Superkb_Action(KeyCode keycode, unsigned int > state) > strcpy (cmdline, config->document_handler); > strcat (cmdline, " "); > strcat (cmdline, config->key_bindings[i].action.document); > - system(cmdline); > + argv[2] = cmdline; > + execvp(*argv, argv); > } > exit(EXIT_SUCCESS); > } This one. We also want exit(EXIT_FAILURE) here. |
From: Eduardo A. B. L. <ebu...@du...> - 2010-12-11 04:06:08
|
The system() call disables the calling process until the command is executed. This behavior generated a superkb child process for each command executed. With execvp(), the child process is replaced with the user's command. --- main.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 11f4dc6..7da5100 100755 --- a/main.c +++ b/main.c @@ -279,6 +279,10 @@ int kbwin_init(Display * dpy) void __Superkb_Action(KeyCode keycode, unsigned int state) { unsigned int i; + char *argv [4]; + argv[0] = "/bin/sh"; + argv[1] = "-c"; + argv[3] = NULL; for (i = 0; i < config->key_bindings_n; i++) { if (config->key_bindings[i].keycode == keycode && config->key_bindings[i].state == state) { @@ -292,10 +296,12 @@ void __Superkb_Action(KeyCode keycode, unsigned int state) strcat (cmdline, " "); strcat (cmdline, config->key_bindings[i].feedback_string); strcat (cmdline, " &"); - system(cmdline); + argv[2] = cmdline; + execvp(*argv, argv); } } - system(config->key_bindings[i].action.command); + argv[2] = config->key_bindings[i].action.command; + execvp(*argv, argv); exit(EXIT_SUCCESS); } break; @@ -308,7 +314,8 @@ void __Superkb_Action(KeyCode keycode, unsigned int state) strcat (cmdline, " "); strcat (cmdline, config->key_bindings[i].feedback_string); strcat (cmdline, " &"); - system(cmdline); + argv[2] = cmdline; + execvp(*argv, argv); } } char *cmdline = malloc(strlen(config->document_handler) + strlen(config->key_bindings[i].action.document) + 2); @@ -316,7 +323,8 @@ void __Superkb_Action(KeyCode keycode, unsigned int state) strcpy (cmdline, config->document_handler); strcat (cmdline, " "); strcat (cmdline, config->key_bindings[i].action.document); - system(cmdline); + argv[2] = cmdline; + execvp(*argv, argv); } exit(EXIT_SUCCESS); } -- 1.7.2.3 |
From: Octavio A. <alv...@al...> - 2010-12-05 22:25:50
|
Hello! I have moved the Documentation Wiki to another server. It brings the following benefits: - An account is no longer needed to edit pages. - It will be easier to control its files and plugins. The migration is complete and all previous pages and history has been imported into the new server. The link for the new Wiki is http://superkb.org/wiki/ Cheers. -- Octavio. |
From: Octavio A. <alv...@al...> - 2010-12-05 10:32:02
|
On Sun, 05 Dec 2010 02:25:04 -0800, Eduardo A. Bustamante López <ebu...@du...> wrote: > Some KeyRelease events were generated by X's AutoRepeat, even if the key > wasn't actually released. Using XQueryKeymap we check the state of the > key. If it isn't a true KeyRelease the event is removed from the stack, > else it executes the action associated. Very nice. I picked up your patch as sent, except I formatted your commit message to 70 columns (it was all one big line). Thanks. -- Octavio. |
From: Eduardo A. B. L. <ebu...@du...> - 2010-12-05 10:25:21
|
Some KeyRelease events were generated by X's AutoRepeat, even if the key wasn't actually released. Using XQueryKeymap we check the state of the key. If it isn't a true KeyRelease the event is removed from the stack, else it executes the action associated. This solves bug described in https://bugs.launchpad.net/superkb/+bug/432887/ by Octavio Álvarez as: > When the bound key is held down before the Super key, Superkb will perform the associated action multiple times. > Apparently, this is because autorepeat is not getting disabled for the pressed down key. --- superkb.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/superkb.c b/superkb.c index 6c71b7b..bd058a6 100755 --- a/superkb.c +++ b/superkb.c @@ -200,6 +200,13 @@ void one_superkey_used_friendly_warning(int number, const char *keyname) { ); } +int key_is_pressed (Display *dpy, KeyCode keycode) +{ + char key_buffer [32]; + XQueryKeymap(dpy, key_buffer); + return ( (key_buffer[keycode >> 3] >> (keycode & 0x07)) & 0x01 ); +} + void superkb_start(superkb_p this) { @@ -514,6 +521,13 @@ void superkb_start(superkb_p this) int squashed_state = ev.xkey.state & this->state_mask; + if ( key_is_pressed (this->dpy, ev.xkey.keycode) ) { + /* Verifies that the key is indeed pressed and not just a + * KeyRelease generated X's AutoRepeat. + */ + remove_from_pressed_key_stack(ev.xkey.keycode, squashed_state); + continue; + } __Action(ev.xkey.keycode, squashed_state); debug(1, "[ac] Due to bound key release, executed action for key code = %d, name: %s\n", ev.xkey.keycode, -- 1.7.2.3 |
From: Octavio A. <alv...@al...> - 2010-12-05 10:02:12
|
On Sun, 05 Dec 2010 01:54:48 -0800, Eduardo A. Bustamante López <ebu...@du...> wrote: > This solves bug described in > https://bugs.launchpad.net/superkb/+bug/432887/. The patch is much, much better. Please include in the commit message enough information about *how* you fix the bug. Fixing the bug should be seen as a side effect of the patch, and not the other way around. A good commit short message is "Make sure KeyReleased keys are actually not pressed." For the commit body: By using XQueryKeymap we make sure the released keys are actually released. Otherwise, the KeyRelease event could actually by generated by AutoRepeat. This makes actions not to be launched more than once, which fixes bug #XXXXXXXX. Thank you. -- Octavio. |
From: Eduardo A. B. L. <ebu...@du...> - 2010-12-05 09:55:10
|
This solves bug described in https://bugs.launchpad.net/superkb/+bug/432887/. --- superkb.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/superkb.c b/superkb.c index 6c71b7b..bd058a6 100755 --- a/superkb.c +++ b/superkb.c @@ -200,6 +200,13 @@ void one_superkey_used_friendly_warning(int number, const char *keyname) { ); } +int key_is_pressed (Display *dpy, KeyCode keycode) +{ + char key_buffer [32]; + XQueryKeymap(dpy, key_buffer); + return ( (key_buffer[keycode >> 3] >> (keycode & 0x07)) & 0x01 ); +} + void superkb_start(superkb_p this) { @@ -514,6 +521,13 @@ void superkb_start(superkb_p this) int squashed_state = ev.xkey.state & this->state_mask; + if ( key_is_pressed (this->dpy, ev.xkey.keycode) ) { + /* Verifies that the key is indeed pressed and not just a + * KeyRelease generated X's AutoRepeat. + */ + remove_from_pressed_key_stack(ev.xkey.keycode, squashed_state); + continue; + } __Action(ev.xkey.keycode, squashed_state); debug(1, "[ac] Due to bound key release, executed action for key code = %d, name: %s\n", ev.xkey.keycode, -- 1.7.2.3 |
From: Octavio A. <alv...@al...> - 2010-12-05 06:33:05
|
On Sat, 04 Dec 2010 22:03:25 -0800, Eduardo A. Bustamante López <ebu...@du...> wrote: > This fixes the autorepeat bug detailed in: > - https://bugs.launchpad.net/superkb/+bug/432887/ Thank you very much! This is interesting. It needs some fixing, though. > @@ -200,6 +200,13 @@ void one_superkey_used_friendly_warning(int number, > const char *keyname) { > ); > } > +int key_is_released (Display *dpy, int keycode) This should not be int, but KeyCode. Also, please reverse this to key_is_pressed. An affirmative approach is much more legible. + XQueryKeymap(dpy, key_buffer); It's a nice idea to use this! > - debug(1, "[sk] Super key has been released, code: %d, name: %s.\n", > ev.xkey.keycode, > - XKeysymToString(XKeycodeToKeysym(this->dpy, ev.xkey.keycode, 0))); > - > - if (--super_was_active) { > - debug(2, "[sa] super_was_active decreased to %d, ignoring > release.\n", super_was_active); > - continue; > - } > - > - debug(2, "[sa] super_was_active decreased to %d, taking action.\n", > super_was_active); > - > - timerclear(&to[TO_DRAWKB]); > - timerclear(&to[TO_CONFIG]); > - (snipped) Please simplify the patch. Unfortunately, even if the logic requires this code to be now differently indented, try to find another way to do it without reindenting, as it is not straightforward to identify the actual changes. > + if ( key_is_released (this->dpy, ev.xkey.keycode) ) > + { > + debug(1, "[sk] Super key has been released, code: %d, name: > %s.\n", ev.xkey.keycode, > + XKeysymToString(XKeycodeToKeysym(this->dpy, ev.xkey.keycode, > 0))); You want to test for the key being *press* here. > @@ -507,23 +516,27 @@ void superkb_start(superkb_p this) > debug(2, "[kp] Pushed key and state to stack: %d, %d\n", > ev.xkey.keycode, squashed_state); > } else if ((ev.type == KeyRelease && !ignore_release && > super_was_active > 0)) { > + > + This extra space is unnecessary. > /* User might have asked for binding configuration, so ignore key > * release. That's what ignore_release is for. > */ > - timerclear(&to[TO_CONFIG]); > - > - int squashed_state = ev.xkey.state & this->state_mask; Again. Please work around reindenting. We will surely need a different patch to modularize this and avoid this limitation in the future. > + if ( key_is_released (this->dpy, ev.xkey.keycode) ) > + { > + __Action(ev.xkey.keycode, squashed_state); Yes, here we need to check for the key being not pressed. -- Octavio. |
From: Octavio A. <alv...@al...> - 2010-12-05 06:33:04
|
On Sat, 04 Dec 2010 21:37:00 -0800, Eduardo A. Bustamante López <ebu...@du...> wrote: > --- > INSTALL | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > I'm going to ignore this incomplete patchset. -- Octavio. |
From: Eduardo A. B. L. <ebu...@du...> - 2010-12-05 06:04:06
|
This fixes the autorepeat bug detailed in: - https://bugs.launchpad.net/superkb/+bug/432887/ --- superkb.c | 137 +++++++++++++++++++++++++++++++++--------------------------- 1 files changed, 75 insertions(+), 62 deletions(-) diff --git a/superkb.c b/superkb.c index 6c71b7b..3ffe5a9 100755 --- a/superkb.c +++ b/superkb.c @@ -200,6 +200,13 @@ void one_superkey_used_friendly_warning(int number, const char *keyname) { ); } +int key_is_released (Display *dpy, int keycode) +{ + char key_buffer [32]; + XQueryKeymap(dpy, key_buffer); + return (! (key_buffer[keycode >> 3] >> (keycode & 0x07)) & 0x01 ); +} + void superkb_start(superkb_p this) { @@ -438,61 +445,63 @@ void superkb_start(superkb_p this) } } else if (ev.type == KeyRelease) { - debug(1, "[sk] Super key has been released, code: %d, name: %s.\n", ev.xkey.keycode, - XKeysymToString(XKeycodeToKeysym(this->dpy, ev.xkey.keycode, 0))); - - if (--super_was_active) { - debug(2, "[sa] super_was_active decreased to %d, ignoring release.\n", super_was_active); - continue; - } - - debug(2, "[sa] super_was_active decreased to %d, taking action.\n", super_was_active); - - timerclear(&to[TO_DRAWKB]); - timerclear(&to[TO_CONFIG]); - - if (super_replay) { - /* Since Xlib only supports Replaying a key before getting the next keyboard event, - * we can't really use XAllowEvents() to replay the Super key in case the user - * asked to. So we try XSendEvent() with the Press from the saved event on KeyPress, - * and the Release we are currently using. - */ - event_save_for_replay.xkey.window = event_saved_window; - ev.xkey.window = event_saved_window; - event_save_for_replay.xkey.subwindow = 0; - ev.xkey.subwindow = 0; - - XSendEvent(this->dpy, event_saved_window, 1, KeyPressMask, &event_save_for_replay); - XSendEvent(this->dpy, event_saved_window, 1, KeyReleaseMask, &ev); - XSync(this->dpy, True); - debug(1, "[sr] Super key has been replayed\n"); - } - - /* Restore saved_autorepeat_mode. */ - XKeyboardControl xkbc; - /*xkbc.auto_repeat_mode = saved_autorepeat_mode; */ - xkbc.auto_repeat_mode = AutoRepeatModeOn; - XChangeKeyboardControl(this->dpy, KBAutoRepeatMode, &xkbc); - - debug(1, "[ar] AutoRepeat has been restored to: %d\n", saved_autorepeat_mode); - - XUngrabKeyboard(this->dpy, CurrentTime); - this->kbwin.unmap(this->dpy); - - for (x = 0; x < pressed_keys_n; x++) { - __Action(pressed_keys[x].keycode, pressed_keys[x].state); - - debug(1, "[ac] Due to Super key release, executed action for key code = %d, name: %s\n", pressed_keys[x].keycode, - XKeysymToString(XKeycodeToKeysym - (this->dpy, pressed_keys[x].keycode, 0))); - - } - + if ( key_is_released (this->dpy, ev.xkey.keycode) ) + { + debug(1, "[sk] Super key has been released, code: %d, name: %s.\n", ev.xkey.keycode, + XKeysymToString(XKeycodeToKeysym(this->dpy, ev.xkey.keycode, 0))); + + if (--super_was_active) { + debug(2, "[sa] super_was_active decreased to %d, ignoring release.\n", super_was_active); + continue; + } + + debug(2, "[sa] super_was_active decreased to %d, taking action.\n", super_was_active); + + timerclear(&to[TO_DRAWKB]); + timerclear(&to[TO_CONFIG]); + + if (super_replay) { + /* Since Xlib only supports Replaying a key before getting the next keyboard event, + * we can't really use XAllowEvents() to replay the Super key in case the user + * asked to. So we try XSendEvent() with the Press from the saved event on KeyPress, + * and the Release we are currently using. + */ + event_save_for_replay.xkey.window = event_saved_window; + ev.xkey.window = event_saved_window; + event_save_for_replay.xkey.subwindow = 0; + ev.xkey.subwindow = 0; + + XSendEvent(this->dpy, event_saved_window, 1, KeyPressMask, &event_save_for_replay); + XSendEvent(this->dpy, event_saved_window, 1, KeyReleaseMask, &ev); + XSync(this->dpy, True); + debug(1, "[sr] Super key has been replayed\n"); + } + + /* Restore saved_autorepeat_mode. */ + XKeyboardControl xkbc; + /*xkbc.auto_repeat_mode = saved_autorepeat_mode; */ + xkbc.auto_repeat_mode = AutoRepeatModeOn; + XChangeKeyboardControl(this->dpy, KBAutoRepeatMode, &xkbc); + + debug(1, "[ar] AutoRepeat has been restored to: %d\n", saved_autorepeat_mode); + + XUngrabKeyboard(this->dpy, CurrentTime); + this->kbwin.unmap(this->dpy); + + for (x = 0; x < pressed_keys_n; x++) { + + __Action(pressed_keys[x].keycode, pressed_keys[x].state); + + debug(1, "[ac] Due to Super key release, executed action for key code = %d, name: %s\n", pressed_keys[x].keycode, + XKeysymToString(XKeycodeToKeysym + (this->dpy, pressed_keys[x].keycode, 0))); + } + } clear_pressed_key_stack(); - debug(1, "---------------------------------------------\n"); - } + +} } else if (ev.type == KeyPress) { debug(1, "[kp] A non-Super key was pressed.\n"); super_replay = 0; @@ -507,23 +516,27 @@ void superkb_start(superkb_p this) debug(2, "[kp] Pushed key and state to stack: %d, %d\n", ev.xkey.keycode, squashed_state); } else if ((ev.type == KeyRelease && !ignore_release && super_was_active > 0)) { + + /* User might have asked for binding configuration, so ignore key * release. That's what ignore_release is for. */ - timerclear(&to[TO_CONFIG]); - - int squashed_state = ev.xkey.state & this->state_mask; + timerclear(&to[TO_CONFIG]); - __Action(ev.xkey.keycode, squashed_state); + int squashed_state = ev.xkey.state & this->state_mask; - debug(1, "[ac] Due to bound key release, executed action for key code = %d, name: %s\n", ev.xkey.keycode, - XKeysymToString(XKeycodeToKeysym - (this->dpy, ev.xkey.keycode, 0))); - debug(2, " ... and because super_was_active value was > 0: %d\n", super_was_active); + if ( key_is_released (this->dpy, ev.xkey.keycode) ) + { + __Action(ev.xkey.keycode, squashed_state); - remove_from_pressed_key_stack(ev.xkey.keycode, squashed_state); - debug(2, "[kp] Removed key and state to stack: %d, %d\n", ev.xkey.keycode, squashed_state); + debug(1, "[ac] Due to bound key release, executed action for key code = %d, name: %s\n", ev.xkey.keycode, + XKeysymToString(XKeycodeToKeysym + (this->dpy, ev.xkey.keycode, 0))); + debug(2, " ... and because super_was_active value was > 0: %d\n", super_was_active); + } + remove_from_pressed_key_stack(ev.xkey.keycode, squashed_state); + debug(2, "[kp] Removed key and state to stack: %d, %d\n", ev.xkey.keycode, squashed_state); } else { /* According to manual, this should not be necessary. */ /* XAllowEvents(this->dpy, ReplayKeyboard, CurrentTime); */ -- 1.7.2.3 |
From: Eduardo A. B. L. <ebu...@du...> - 2010-12-05 05:39:01
|
This fixes the autorepeat bug detailed in: - https://bugs.launchpad.net/superkb/+bug/432887/ --- superkb.c | 137 +++++++++++++++++++++++++++++++++--------------------------- 1 files changed, 75 insertions(+), 62 deletions(-) diff --git a/superkb.c b/superkb.c index 6c71b7b..3ffe5a9 100755 --- a/superkb.c +++ b/superkb.c @@ -200,6 +200,13 @@ void one_superkey_used_friendly_warning(int number, const char *keyname) { ); } +int key_is_released (Display *dpy, int keycode) +{ + char key_buffer [32]; + XQueryKeymap(dpy, key_buffer); + return (! (key_buffer[keycode >> 3] >> (keycode & 0x07)) & 0x01 ); +} + void superkb_start(superkb_p this) { @@ -438,61 +445,63 @@ void superkb_start(superkb_p this) } } else if (ev.type == KeyRelease) { - debug(1, "[sk] Super key has been released, code: %d, name: %s.\n", ev.xkey.keycode, - XKeysymToString(XKeycodeToKeysym(this->dpy, ev.xkey.keycode, 0))); - - if (--super_was_active) { - debug(2, "[sa] super_was_active decreased to %d, ignoring release.\n", super_was_active); - continue; - } - - debug(2, "[sa] super_was_active decreased to %d, taking action.\n", super_was_active); - - timerclear(&to[TO_DRAWKB]); - timerclear(&to[TO_CONFIG]); - - if (super_replay) { - /* Since Xlib only supports Replaying a key before getting the next keyboard event, - * we can't really use XAllowEvents() to replay the Super key in case the user - * asked to. So we try XSendEvent() with the Press from the saved event on KeyPress, - * and the Release we are currently using. - */ - event_save_for_replay.xkey.window = event_saved_window; - ev.xkey.window = event_saved_window; - event_save_for_replay.xkey.subwindow = 0; - ev.xkey.subwindow = 0; - - XSendEvent(this->dpy, event_saved_window, 1, KeyPressMask, &event_save_for_replay); - XSendEvent(this->dpy, event_saved_window, 1, KeyReleaseMask, &ev); - XSync(this->dpy, True); - debug(1, "[sr] Super key has been replayed\n"); - } - - /* Restore saved_autorepeat_mode. */ - XKeyboardControl xkbc; - /*xkbc.auto_repeat_mode = saved_autorepeat_mode; */ - xkbc.auto_repeat_mode = AutoRepeatModeOn; - XChangeKeyboardControl(this->dpy, KBAutoRepeatMode, &xkbc); - - debug(1, "[ar] AutoRepeat has been restored to: %d\n", saved_autorepeat_mode); - - XUngrabKeyboard(this->dpy, CurrentTime); - this->kbwin.unmap(this->dpy); - - for (x = 0; x < pressed_keys_n; x++) { - __Action(pressed_keys[x].keycode, pressed_keys[x].state); - - debug(1, "[ac] Due to Super key release, executed action for key code = %d, name: %s\n", pressed_keys[x].keycode, - XKeysymToString(XKeycodeToKeysym - (this->dpy, pressed_keys[x].keycode, 0))); - - } - + if ( key_is_released (this->dpy, ev.xkey.keycode) ) + { + debug(1, "[sk] Super key has been released, code: %d, name: %s.\n", ev.xkey.keycode, + XKeysymToString(XKeycodeToKeysym(this->dpy, ev.xkey.keycode, 0))); + + if (--super_was_active) { + debug(2, "[sa] super_was_active decreased to %d, ignoring release.\n", super_was_active); + continue; + } + + debug(2, "[sa] super_was_active decreased to %d, taking action.\n", super_was_active); + + timerclear(&to[TO_DRAWKB]); + timerclear(&to[TO_CONFIG]); + + if (super_replay) { + /* Since Xlib only supports Replaying a key before getting the next keyboard event, + * we can't really use XAllowEvents() to replay the Super key in case the user + * asked to. So we try XSendEvent() with the Press from the saved event on KeyPress, + * and the Release we are currently using. + */ + event_save_for_replay.xkey.window = event_saved_window; + ev.xkey.window = event_saved_window; + event_save_for_replay.xkey.subwindow = 0; + ev.xkey.subwindow = 0; + + XSendEvent(this->dpy, event_saved_window, 1, KeyPressMask, &event_save_for_replay); + XSendEvent(this->dpy, event_saved_window, 1, KeyReleaseMask, &ev); + XSync(this->dpy, True); + debug(1, "[sr] Super key has been replayed\n"); + } + + /* Restore saved_autorepeat_mode. */ + XKeyboardControl xkbc; + /*xkbc.auto_repeat_mode = saved_autorepeat_mode; */ + xkbc.auto_repeat_mode = AutoRepeatModeOn; + XChangeKeyboardControl(this->dpy, KBAutoRepeatMode, &xkbc); + + debug(1, "[ar] AutoRepeat has been restored to: %d\n", saved_autorepeat_mode); + + XUngrabKeyboard(this->dpy, CurrentTime); + this->kbwin.unmap(this->dpy); + + for (x = 0; x < pressed_keys_n; x++) { + + __Action(pressed_keys[x].keycode, pressed_keys[x].state); + + debug(1, "[ac] Due to Super key release, executed action for key code = %d, name: %s\n", pressed_keys[x].keycode, + XKeysymToString(XKeycodeToKeysym + (this->dpy, pressed_keys[x].keycode, 0))); + } + } clear_pressed_key_stack(); - debug(1, "---------------------------------------------\n"); - } + +} } else if (ev.type == KeyPress) { debug(1, "[kp] A non-Super key was pressed.\n"); super_replay = 0; @@ -507,23 +516,27 @@ void superkb_start(superkb_p this) debug(2, "[kp] Pushed key and state to stack: %d, %d\n", ev.xkey.keycode, squashed_state); } else if ((ev.type == KeyRelease && !ignore_release && super_was_active > 0)) { + + /* User might have asked for binding configuration, so ignore key * release. That's what ignore_release is for. */ - timerclear(&to[TO_CONFIG]); - - int squashed_state = ev.xkey.state & this->state_mask; + timerclear(&to[TO_CONFIG]); - __Action(ev.xkey.keycode, squashed_state); + int squashed_state = ev.xkey.state & this->state_mask; - debug(1, "[ac] Due to bound key release, executed action for key code = %d, name: %s\n", ev.xkey.keycode, - XKeysymToString(XKeycodeToKeysym - (this->dpy, ev.xkey.keycode, 0))); - debug(2, " ... and because super_was_active value was > 0: %d\n", super_was_active); + if ( key_is_released (this->dpy, ev.xkey.keycode) ) + { + __Action(ev.xkey.keycode, squashed_state); - remove_from_pressed_key_stack(ev.xkey.keycode, squashed_state); - debug(2, "[kp] Removed key and state to stack: %d, %d\n", ev.xkey.keycode, squashed_state); + debug(1, "[ac] Due to bound key release, executed action for key code = %d, name: %s\n", ev.xkey.keycode, + XKeysymToString(XKeycodeToKeysym + (this->dpy, ev.xkey.keycode, 0))); + debug(2, " ... and because super_was_active value was > 0: %d\n", super_was_active); + } + remove_from_pressed_key_stack(ev.xkey.keycode, squashed_state); + debug(2, "[kp] Removed key and state to stack: %d, %d\n", ev.xkey.keycode, squashed_state); } else { /* According to manual, this should not be necessary. */ /* XAllowEvents(this->dpy, ReplayKeyboard, CurrentTime); */ -- 1.7.2.3 |
From: Eduardo A. B. L. <ebu...@du...> - 2010-12-05 05:38:54
|
--- INSTALL | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/INSTALL b/INSTALL index 046d5a0..048142a 100755 --- a/INSTALL +++ b/INSTALL @@ -1,3 +1,7 @@ +============ +INSTALLATION +============ + To install, you should only need to: 1. "make". 2. As root, "make install". -- 1.7.2.3 |
From: Octavio A. <alv...@al...> - 2010-03-26 18:56:47
|
On Fri, 26 Mar 2010 11:43:53 -0700, david thompson <tho...@gm...> wrote: >> setxkbmap -geometry 'pc(pc104)' #Notice the single quotes! >> >> You need to issue killall superkb and run it again to make it >> see the change. >> > > Great! Works like a charm! Thanks... Glad to know! I'm "Replying to all" and carbon-copying to the mailing list so it gets archived as a working solution. |
From: Octavio A. <alv...@al...> - 2010-03-26 17:43:13
|
On Fri, 26 Mar 2010 07:07:31 -0700, david thompson <tho...@gm...> wrote: > superkb: Could not load keyboard geometry information. Quitting. > > The FAQ > (http://sourceforge.net/apps/mediawiki/superkb/index.php?title=FAQ#I_get_a_.22Could_not_load_keyboard_information_from_X.22_error) > indicates the steps one should take after encountering this message > if one is using the gnome or KDE desktops. What steps should one take > if neither desktop is being used? (In my case, I'm using the sawfish > window manager.) Are you using no desktop environment at all, just Sawfish as WM? If so, Sawfish doesn't handle keyboard geometry information itself. You will have to do it manually. Try issuing the following command in a terminal window (not as root): setxkbmap -geometry 'pc(pc104)' #Notice the single quotes! You need to issue killall superkb and run it again to make it see the change. Once you make it work, fix the setting according to your distribution instructions before loading Superkb. This is usually done in /etc/X11/xorg.conf as stated in http://www.x.org/releases/X11R7.5/doc/input/XKB-Config.html and remember that "setxkbmap -print" is your friend. (Oh, and make sure you are using latest version: 0.21) |
From: david t. <tho...@gm...> - 2010-03-26 14:07:39
|
superkb: Could not load keyboard geometry information. Quitting. The FAQ (http://sourceforge.net/apps/mediawiki/superkb/index.php?title=FAQ#I_get_a_.22Could_not_load_keyboard_information_from_X.22_error) indicates the steps one should take after encountering this message if one is using the gnome or KDE desktops. What steps should one take if neither desktop is being used? (In my case, I'm using the sawfish window manager.) Thanks for any suggestions, - Alan |
From: Octavio A. <alv...@al...> - 2010-03-07 23:34:45
|
Superkb is a graphical keyboard-based launching application with quick on-screen hints. Today we have released version 0.21. Among other things: * We don't depend on SIGCHLD being ignored anymore. (Fixes chromium-browser and Gwibber). * A friendly message is shown on the screen on Superkb successful launch (via the WELCOME_CMD option). * Feedback strings don't need to be requoted anymore. (via the new FEEDBACK_STRINGS_AUTOQUOTE option). * States (like Shift) can now be used. * Lots of work on code portability. * Lots of comments throughout the code. * Lots of usability and stabilitiy fixes. Shortlog summary: 59 Octavio Alvarez 1 Rubén Guerra Marín -- Octavio. |
From: Octavio A. <alv...@al...> - 2010-02-27 17:00:53
|
Last Sunday (Feb 21st) we had a Superkb bug hunting day. The participants were: * Martin Ibarra * Octavio Alvarez Among other things, Martin was particularly interested in the development of a GUI configuration tool for Superkb using GTK#/Mono. So Martin tried to install Superkb and use it in his laptop and we had some feedback. == BUGS FOUND == -- Bug when Super keys were already grabbed -- Superkb does not start when Super_L or Super_R is being used by another application. Superkb throws an error. Mic proposed checking if the Super keys were being used and throw a notification before launching. RESOLUTION: The proposed fix by Mic programmatically means to detect if the grabbing failed and throw a friendly error if so. Octavio has now committed a patch that implements the error handler for Xlib to be able to catch the error. The error is fatal if all configured Super keys fail to be grabbed. The error is non-fatal more than zero but not all configured Super keys fail to be grabbed. In both cases, appropriate recommendations should guide the user on how to fix the problem. Please review commits 6142e804d and 6062472 http://superkb.git.sourceforge.net/git/gitweb.cgi?p=superkb/superkb;a=commitdiff;h=6142e804d72f9e3cf776ad8e86e8485fb102afe1 http://superkb.git.sourceforge.net/git/gitweb.cgi?p=superkb/superkb;a=commitdiff;h=6062472ccf1562b8ed64d6df71ae6e825ddff03c -- AutoRepeat not being restored for Super keys on Ctrl+C -- Reported by Martin Ibarra: When Superkb is manually configured so gets triggered by a keys other than Super_L or Super_R, killing Superkb with CTRL+C doesn't restore the previous Autorepeat property. This occurred when Superkb was set to use "k". #Default value: # SUPERKEY1_STRING Super_L SUPERKEY1_STRING k #Default value: # SUPERKEY2_STRING Super_RI SUPERKEY2_CODE 0 RESOLUTION: This would happen also with Super_L and Super_R. Two commits were sent, one to properly save the Autorepeat state for the key and another to handle the SIGINT signal and actually using the saved values to restore the previous states appropriately before exiting. Please review commits 1e6616471a and f7b19f0fcd. http://superkb.git.sourceforge.net/git/gitweb.cgi?p=superkb/superkb;a=commitdiff;h=1e6616471a6993b674b962f3e258aae88d1f2195 http://superkb.git.sourceforge.net/git/gitweb.cgi?p=superkb/superkb;a=commitdiff;h=f7b19f0fcdfc975aaa5b685e6c0a5257cd930352 == REQUESTS FOR ENHANCEMENTS == -- Default configuration after 'make install' -- Requested by: Martin Ibarra. Currently, when installing Superkb using "make install" we don't get a default configuration. Even though ./sample-config contains some files that work as examples, it should be considered to use one of those in /etc/superkbrc or /etc/superkb/superkbrc so it is readily available for users in the system. This configuration file should include enough lines so that the user doesn't get an empty keyboard on first run. The following applications are proposed: xterm gnome-terminal rxvt konsole RESOLUTION: The idea is good. Will try to implement it in the "make install" part for users that compile Superkb themselves. It will contain the best possible of the available terminals in some key. This will be extended to other programs such as a calculator and a simple text editor. However, for packages, package maintainers should take care of this manually when generating packages. == AGREEMENTS == -- Superkb configuration tool interface by Martin Ibarra -- The configuration tool will be run using the following syntax: $0 key_name shift_state Example: superkb-config-tool-martin "l" 0 Parameters will be delimited by spaces. "shift_state" will be 0 for natural keys and 1 for Shift + key. |
From: Octavio A. <alv...@al...> - 2010-01-31 07:33:15
|
On Sat, 30 Jan 2010 22:54:21 -0800, Rubén Guerra Marín <rgu...@gm...> wrote: > - "(Please note: getting an 'BadAccess: attempt to access private > resource\n" > + "(Please note: getting a 'BadAccess: attempt to access private > resource\n" > "denied' error on 'X_GrabKey' means there is another program already Thanks, applied. |
From: Rubén G. M. <rgu...@gm...> - 2010-01-31 06:54:37
|
Signed-off-by: Rubén Guerra Marín <rgu...@gm...> --- main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/main.c b/main.c index b3be01f..c2c0d64 100755 --- a/main.c +++ b/main.c @@ -519,7 +519,7 @@ int main(int argc, char *argv[]) "\n" "Press and hold any of your configured Super keys to start using it.\n" "\n" - "(Please note: getting an 'BadAccess: attempt to access private resource\n" + "(Please note: getting a 'BadAccess: attempt to access private resource\n" "denied' error on 'X_GrabKey' means there is another program already using\n" "your configured Super key. If that happens, you should even change the key\n" "or try loading Superkb before the offending program.)\n\n\n" -- 1.6.3.3 |