[hackers] [wmii] Fix binding of unknown keycodes || Kris Maglione

From: <hg_AT_suckless.org>
Date: Sun, 28 Dec 2008 21:21:57 +0000 (UTC)

changeset: 2425:a6d491229802
user: Kris Maglione <jg_AT_suckless.org>
date: Wed Dec 24 00:24:23 2008 -0500
files: cmd/click/main.c cmd/wmii/key.c
description:
Fix binding of unknown keycodes

diff -r 435ba8224d79 -r a6d491229802 cmd/click/main.c
--- a/cmd/click/main.c Sun Dec 14 18:35:28 2008 -0500
+++ b/cmd/click/main.c Wed Dec 24 00:24:23 2008 -0500
@@ -18,38 +18,18 @@
 
 static void
 click(Window *w, Point p) {
- Point rp, restore;
+ Rectangle r;
+ Point rp;
 
- restore = querypointer(&scr.root);
-
- rp = translate(w, &scr.root, p);
+ r = getwinrect(w);
+ rp = subpt(r.max, p);
 
         XTestFakeMotionEvent(display, 0, rp.x, rp.y, 0);
 
         XTestFakeButtonEvent(display, 1, true, 0);
         XTestFakeButtonEvent(display, 1, false, 0);
 
- rp = getwinrect(w).max;
- XTestFakeMotionEvent(display, 0, rp.x - 1, rp.y - 1, 0);
-
- return;
- XButtonEvent e = { 0, };
-
- e.root = scr.root.w;
- e.window = w->w;
- e.same_screen = true;
-
- e.x = p.x;
- e.y = p.y;
- e.x_root = rp.x;
- e.y_root = rp.y;
- e.button = 1; /* Hopefully ignored, except enough to do the trick. */
-
- e.type = ButtonPress;
- sendevent(w, true, ButtonPressMask, (XEvent*)&e);
- e.type = ButtonRelease;
- e.state = Button1Mask;
- sendevent(w, true, ButtonReleaseMask, (XEvent*)&e);
+ XTestFakeMotionEvent(display, 0, r.max.x, r.max.y, 0);
 }
 
 int
@@ -74,7 +54,7 @@
         if(argc)
                 usage();
 
- click(&win, Pt(0, 0));
+ click(&win, Pt(1, 1));
 
         XCloseDisplay(display);
         return 0;
diff -r 435ba8224d79 -r a6d491229802 cmd/wmii/key.c
--- a/cmd/wmii/key.c Sun Dec 14 18:35:28 2008 -0500
+++ b/cmd/wmii/key.c Wed Dec 24 00:24:23 2008 -0500
@@ -124,6 +124,8 @@
                         kstr = seq[i];
                 k->key = XKeysymToKeycode(display, XStringToKeysym(kstr));
                 k->mod = str2modmask(seq[i]);
+ if (k->key == NoSymbol)
+ return nil;
         }
         if(r) {
                 r->id = id++;
Received on Sun Dec 28 2008 - 21:21:57 UTC

This archive was generated by hypermail 2.2.0 : Sun Dec 28 2008 - 21:24:04 UTC