Skip to content

Instantly share code, notes, and snippets.

@mfoliveira
Created December 24, 2010 17:02
Show Gist options
  • Save mfoliveira/754395 to your computer and use it in GitHub Desktop.
Save mfoliveira/754395 to your computer and use it in GitHub Desktop.
Provide an option (--key-repeats/-r) for enabling key repeats in XButton actions (for EvRouter 0.4)
diff -Naur evrouter-0.4/src/action_xbutton.c evrouter-0.4/src.new/action_xbutton.c
--- evrouter-0.4/src/action_xbutton.c 2009-03-02 21:01:43.000000000 -0300
+++ evrouter-0.4/src.new/action_xbutton.c 2010-12-24 14:24:32.000000000 -0200
@@ -84,7 +84,11 @@
XTestFakeButtonEvent (d, r->action.xbutton.button, True, 0);
break;
- case 2: /* Ignore key repeats */
+ case 2: /* Key repeats */
+ if (key_repeats) {
+ XTestFakeButtonEvent (d, r->action.xbutton.button, False, 0);
+ XTestFakeButtonEvent (d, r->action.xbutton.button, True, 0);
+ }
break;
case 0: /* Key released */
diff -Naur evrouter-0.4/src/cmdline.c evrouter-0.4/src.new/cmdline.c
--- evrouter-0.4/src/cmdline.c 2009-03-02 21:01:43.000000000 -0300
+++ evrouter-0.4/src.new/cmdline.c 2010-12-24 14:38:33.000000000 -0200
@@ -61,6 +61,7 @@
int verbose = 0;
int foreground = 0;
int sepuku = 0;
+int key_repeats = 0;
int numdevs = 0;
char * devnames [MAX_EVDEV];
@@ -102,6 +103,8 @@
_("Kill the currently running evrouter daemon, then exit.")},
{ "verbose", 'v', NULL, 0,
_("Print more information (mostly for debugging)"), 0 },
+ { "key-repeats", 'r', NULL, 0,
+ _("Enable key repeats (for XButton actions)"), 0 },
{ NULL, 0, NULL, 0, NULL, 0 }
};
@@ -178,6 +181,10 @@
verbose++;
break;
+ case 'r':
+ key_repeats = 1;
+ break;
+
case ARGP_KEY_ARG:
if ((numdevs + 1) >= MAX_EVDEV) {
fprintf (stderr, "%s: too many devices listed (maximum %d)\n",
diff -Naur evrouter-0.4/src/cmdline.h evrouter-0.4/src.new/cmdline.h
--- evrouter-0.4/src/cmdline.h 2009-03-02 21:01:43.000000000 -0300
+++ evrouter-0.4/src.new/cmdline.h 2010-12-24 14:35:00.000000000 -0200
@@ -54,6 +54,7 @@
extern int verbose;
extern int foreground;
extern int sepuku;
+extern int key_repeats;
extern int numdevs;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment