Permalink
Browse files

Add -W -Wall to compilation instruction and remove dead code

  • Loading branch information...
Renaud AUBIN
Renaud AUBIN committed Mar 10, 2012
1 parent 3665d93 commit f8c2777f6546072ba6bcd19c9d84e2bb0d25afa6
Showing with 9 additions and 8 deletions.
  1. +4 −3 README
  2. +5 −5 Space2Ctrl.cpp
View
7 README
@@ -3,16 +3,17 @@ When used alone, it behaves like the ordinary space bar on the key release event
Especially useful with Emacs.
compile with:
-g++ -o Space2Ctrl Space2Ctrl.cpp -L/usr/X11R6/lib -lX11 -lXtst
+g++ -o Space2Ctrl Space2Ctrl.cpp -W -Wall -L/usr/X11R6/lib -lX11 -lXtst
To install libx11:
in Ubuntu: sudo apt-get install libx11-dev
To install libXTst:
in Ubuntu: sudo apt-get install libxtst-dev
-Needs module XRecord installed. To install it, add line Load "record" to Section "Module" in /etc/X11/xorg.conf like this:
+Needs module XRecord installed. To install it, add line Load "record" to Section "Module" in
+/etc/X11/xorg.conf like this:
Section "Module"
- Load "record"
+ Load "record"
EndSection
View
@@ -1,15 +1,16 @@
/* Ripped shamelessly from: http://emg-2.blogspot.com/2008/01/xfree86xorg-keylogger.html
compile with:
- g++ -o Space2Ctrl Space2Ctrl.cpp -L/usr/X11R6/lib -lX11 -lXtst
+ g++ -o Space2Ctrl Space2Ctrl.cpp -W -Wall -L/usr/X11R6/lib -lX11 -lXtst
To install libx11:
in Ubuntu: sudo apt-get install libx11-dev
To install libXTst:
in Ubuntu: sudo apt-get install libxtst-dev
- Needs module XRecord installed. To install it, add line Load "record" to Section "Module" in /etc/X11/xorg.conf like this:
+ Needs module XRecord installed. To install it, add line Load "record" to Section "Module" in
+ /etc/X11/xorg.conf like this:
Section "Module"
Load "record"
@@ -105,7 +106,6 @@ class Space2Ctrl {
CallbackClosure *userData = (CallbackClosure *) priv;
XRecordDatum *data = (XRecordDatum *) hook->data;
static bool space_down = false;
- static bool ctrl_down = false;
static bool key_combo = false;
static struct timeval startWait, endWait;
@@ -121,7 +121,7 @@ class Space2Ctrl {
} else if ( (c == XKeysymToKeycode(userData->ctrlDisplay, XK_Control_L))
|| (c == XKeysymToKeycode(userData->ctrlDisplay, XK_Control_R)) ) {
- ctrl_down = true; // ctrl pressed
+ // ctrl pressed
if (space_down) { // space ctrl sequence
XTestFakeKeyEvent(userData->ctrlDisplay, 255, True, CurrentTime);
@@ -156,7 +156,7 @@ class Space2Ctrl {
key_combo = false;
} else if ( (c == XKeysymToKeycode(userData->ctrlDisplay, XK_Control_L))
|| (c == XKeysymToKeycode(userData->ctrlDisplay, XK_Control_R)) ) {
- ctrl_down = false; // ctrl release
+ // ctrl release
if (space_down)
key_combo = true;

0 comments on commit f8c2777

Please sign in to comment.