Skip to contentSkip to conversation

Bug fixes for libfakekey

PATCH New Jussi Kukkonen 1 participant 3 messages May 17, 2017

lore
Share & tools
lore
#0 lore raw

cover Bug fixes for libfakekey

A (slightly modified) old patch from bugzilla that fixes handling of fake shifted keypresses where the character is not in the keymap already, and a build script fix.

Thanks, Jussi

The following changes since commit e327ff049b8503af2dadffa84370a0860b9fb682:

src/Makefile.am: Fix compiles in out of tree build case (2013-03-08 11:52:39 +0000)

are available in the git repository at:

git://github.com/jku/libfakekey shifted-keysym-fix
https://github.com/jku/libfakekey/tree/shifted-keysym-fix

Jussi Kukkonen (2):
tests/Makefile.am: Add missing LIBS
Handle shifted keysyms that are not in keymap

 src/libfakekey.c  | 11 ++++++++++-
 tests/Makefile.am |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 tests/Makefile.am: Add missing LIBS

---
 tests/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/Makefile.am +1 -1
index 67ed38b..aac1dbd 100644
@@ -2,4 +2,4 @@ INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(FAKEKEY_CFLAGS)
 
 noinst_PROGRAMS=fakekey-test
 
-fakekey_test_LDADD=../src/libfakekey.la
\ No newline at end of file
+fakekey_test_LDADD=../src/libfakekey.la $(FAKEKEY_LIBS)
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/2 Handle shifted keysyms that are not in keymap

In reply to Jussi Kukkonen

This is based on a patch from Finn (at earthling.net):

"If my keymap is set to US and I use fakekey_press_keysym to send a Ó the character isn't already in my keymap so fakekey adds it but then sends ó instead. My patch now does the same check if a shift modifier is required that's done in the code path for keys that are already in the keymap."

---
 src/libfakekey.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
src/libfakekey.c +10 -1
index df650a4..edf3006 100644
@@ -357,7 +357,16 @@ fakekey_press_keysym(FakeKey *fk,
        * 
        * Probably better to try and grab the mapping notify *here* ?
        */
-  
+
+      if (XKeycodeToKeysym(fk->xdpy, code, 0) != keysym)
+        {
+          DBG("does not equal code for index 0, needs shift?\n");
+          /* TODO: Assumes 1st modifier is shifted  */
+          if (XKeycodeToKeysym(fk->xdpy, code, 1) == keysym)
+            flags |= FAKEKEYMOD_SHIFT; 	/* can get at it via shift */
+          else
+            DBG("attempted to add keycode to keymap but seem to have failed");
+        }
     }
 
   if (code != 0) 
Signature · 1 line
2.11.0