summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-06-01 19:14:28 +0000
committersabetts <sabetts>2001-06-01 19:14:28 +0000
commit366e07b927a7c54012d21819b6504fb06878fcc1 (patch)
tree6561edcf0744693db137e98e3e9baf7b821521b7
parent8161a84a50dde1a2af5707b25e2130ea2819470a (diff)
downloadratpoison-366e07b927a7c54012d21819b6504fb06878fcc1.zip
iconic window map_request properly
-rw-r--r--src/actions.c128
-rw-r--r--src/data.h4
-rw-r--r--src/events.c2
-rw-r--r--src/input.c12
4 files changed, 107 insertions, 39 deletions
diff --git a/src/actions.c b/src/actions.c
index 0c79a86..a26a314 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -21,6 +21,7 @@
#include <unistd.h>
#include <sys/wait.h>
#include <X11/keysym.h>
+#include <X11/extensions/XTest.h>
#include <string.h>
#include <time.h>
@@ -352,48 +353,99 @@ cmd_source (void *data)
void
cmd_generate (void *data)
{
- XEvent ev1, ev;
+ XEvent ev;
ev = *rp_current_event;
if (current_window() == NULL) return;
- PRINT_DEBUG ("type==%d\n", ev.xkey.type);
- PRINT_DEBUG ("serial==%ld\n", ev.xkey.serial);
- PRINT_DEBUG ("send_event==%d\n", ev.xkey.send_event);
- PRINT_DEBUG ("display=%p\n", ev.xkey.display);
- /* PRINT_DEBUG ("root==%x ???\n", ev.xkey.root); */
- /* PRINT_DEBUG ("window==%x ???\n", ev.xkey.window); */
- /* PRINT_DEBUG ("subwindow==%x ???\n", ev.xkey.subwindow); */
- PRINT_DEBUG ("time==%ld\n", ev.xkey.time);
- PRINT_DEBUG ("x==%d y==%d\n", ev.xkey.x, ev.xkey.y);
- PRINT_DEBUG ("x_root==%d y_root==%d\n", ev.xkey.x_root, ev.xkey.y_root);
- PRINT_DEBUG ("state==%d\n", ev.xkey.state);
- PRINT_DEBUG ("keycode==%d\n", ev.xkey.keycode);
- PRINT_DEBUG ("same_screen=%d\n", ev.xkey.same_screen);
-
- /* I am not sure which of the following fields I have to fill in or
- what to fill them in with (rcy) I wouldnt be suprised if this
- breaks in some cases. */
-
- ev1.xkey.type = KeyPress;
- /* ev1.xkey.serial = */
- /* ev1.xkey.send_event = */
- ev1.xkey.display = dpy;
- /* ev1.xkey.root = */
- ev1.xkey.window = current_window()->w;
- /* ev1.xkey.subwindow = */
- /* ev1.xkey.time = ev.xkey.time; */
- /* ev1.xkey.x == */
- /* ev1.xkey.y == */
- /* ev1.xkey.x_root == */
- /* ev1.xkey.y_root == */
-
- ev1.xkey.state = prefix_key.state;
- ev1.xkey.keycode = XKeysymToKeycode (dpy, prefix_key.sym);
-
- XSendEvent (dpy, current_window()->w, False, KeyPressMask, &ev1);
-
- /* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, 't'), True, 0); */
+ PRINT_DEBUG ("Generate\n");
+
+ XGrabServer (dpy);
+ ungrab_prefix_key (current_window()->w);
+
+/* ev.xkey.type = KeyPress; */
+/* ev.xkey.window = current_window()->w; */
+/* ev.xkey.state = prefix_key.state; */
+/* ev.xkey.keycode = XKeysymToKeycode (dpy, prefix_key.sym); */
+/* XSendEvent (dpy, current_window()->w, False, KeyPressMask, &ev); */
+
+ /* Release unwanted modifiers */
+/* if (rp_current_event->xkey.state & rp_modifier_info.meta_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.meta_sym), False, CurrentTime); */
+/* } */
+/* if (rp_current_event->xkey.state & rp_modifier_info.alt_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.alt_sym), False, CurrentTime); */
+/* } */
+/* if (rp_current_event->xkey.state & rp_modifier_info.hyper_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.hyper_sym), False, CurrentTime); */
+/* } */
+/* if (rp_current_event->xkey.state & rp_modifier_info.super_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.super_sym), False, CurrentTime); */
+/* } */
+
+ /* Press wanted modifiers */
+/* if (prefix_key.state & rp_modifier_info.meta_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.meta_sym), True, CurrentTime); */
+/* } */
+/* if (prefix_key.state & rp_modifier_info.alt_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.alt_sym), True, CurrentTime); */
+/* } */
+/* if (prefix_key.state & rp_modifier_info.hyper_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.hyper_sym), True, CurrentTime); */
+/* } */
+/* if (prefix_key.state & rp_modifier_info.super_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.super_sym), True, CurrentTime); */
+/* } */
+
+ XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, XK_k), True, CurrentTime);
+ XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, XK_k), False, CurrentTime);
+
+ /* Release wanted modifiers */
+/* if (prefix_key.state & rp_modifier_info.meta_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.meta_sym), False, CurrentTime); */
+/* } */
+/* if (prefix_key.state & rp_modifier_info.alt_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.alt_sym), False, CurrentTime); */
+/* } */
+/* if (prefix_key.state & rp_modifier_info.hyper_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.hyper_sym), False, CurrentTime); */
+/* } */
+/* if (prefix_key.state & rp_modifier_info.super_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.super_sym), False, CurrentTime); */
+/* } */
+
+ /* Restore modifier state */
+/* if (rp_current_event->xkey.state & rp_modifier_info.meta_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.meta_sym), True, CurrentTime); */
+/* } */
+/* if (rp_current_event->xkey.state & rp_modifier_info.alt_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.alt_sym), True, CurrentTime); */
+/* } */
+/* if (rp_current_event->xkey.state & rp_modifier_info.hyper_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.hyper_sym), True, CurrentTime); */
+/* } */
+/* if (rp_current_event->xkey.state & rp_modifier_info.super_mod_mask) */
+/* { */
+/* XTestFakeKeyEvent (dpy, XKeysymToKeycode (dpy, rp_modifier_info.super_sym), True, CurrentTime); */
+/* } */
+
+ grab_prefix_key (current_window()->w);
+ XUngrabServer (dpy);
XSync (dpy, False);
}
diff --git a/src/data.h b/src/data.h
index 4584b21..19b68ae 100644
--- a/src/data.h
+++ b/src/data.h
@@ -166,9 +166,13 @@ struct modifier_info
{
/* unsigned int mode_switch_mask; */
unsigned int meta_mod_mask;
+ KeySym meta_sym;
unsigned int alt_mod_mask;
+ KeySym alt_sym;
unsigned int super_mod_mask;
+ KeySym super_sym;
unsigned int hyper_mod_mask;
+ KeySym hyper_sym;
};
/* Keeps track of which mod mask each modifier is under. */
diff --git a/src/events.c b/src/events.c
index bb1ddbc..db5a41f 100644
--- a/src/events.c
+++ b/src/events.c
@@ -171,7 +171,7 @@ map_request (XEvent *ev)
break;
case IconicState:
PRINT_DEBUG ("Mapped iconic window\n");
- unhide_window (win);
+ set_active_window (win);
break;
}
}
diff --git a/src/input.c b/src/input.c
index 60f4624..01c0303 100644
--- a/src/input.c
+++ b/src/input.c
@@ -39,9 +39,13 @@ update_modifier_map ()
/* rp_modifier_info.mode_switch_mask = 0; */
rp_modifier_info.meta_mod_mask = 0;
+ rp_modifier_info.meta_sym = 0;
rp_modifier_info.alt_mod_mask = 0;
+ rp_modifier_info.alt_sym = 0;
rp_modifier_info.super_mod_mask = 0;
+ rp_modifier_info.super_sym = 0;
rp_modifier_info.hyper_mod_mask = 0;
+ rp_modifier_info.hyper_sym = 0;
mods = XGetModifierMapping (dpy);
@@ -56,6 +60,7 @@ update_modifier_map ()
{
case XK_Meta_L:
case XK_Meta_R:
+ rp_modifier_info.meta_sym = XKeycodeToKeysym(dpy, code, 0);
rp_modifier_info.meta_mod_mask |= modmasks[row - 3];
PRINT_DEBUG ("Found Meta on %d\n",
rp_modifier_info.meta_mod_mask);
@@ -63,6 +68,7 @@ update_modifier_map ()
case XK_Alt_L:
case XK_Alt_R:
+ rp_modifier_info.alt_sym = XKeycodeToKeysym(dpy, code, 0);
rp_modifier_info.alt_mod_mask |= modmasks[row - 3];
PRINT_DEBUG ("Found Alt on %d\n",
rp_modifier_info.alt_mod_mask);
@@ -70,6 +76,8 @@ update_modifier_map ()
case XK_Super_L:
case XK_Super_R:
+ rp_modifier_info.super_sym = XKeycodeToKeysym(dpy, code, 0);
+ rp_modifier_info.super_sym = XKeycodeToKeysym(dpy, code, 0);
rp_modifier_info.super_mod_mask |= modmasks[row - 3];
PRINT_DEBUG ("Found Super on %d\n",
rp_modifier_info.super_mod_mask);
@@ -77,6 +85,8 @@ update_modifier_map ()
case XK_Hyper_L:
case XK_Hyper_R:
+ rp_modifier_info.hyper_sym = XKeycodeToKeysym(dpy, code, 0);
+ rp_modifier_info.hyper_sym = XKeycodeToKeysym(dpy, code, 0);
rp_modifier_info.hyper_mod_mask |= modmasks[row - 3];
PRINT_DEBUG ("Found Hyper on %d\n",
rp_modifier_info.hyper_mod_mask);
@@ -98,7 +108,9 @@ update_modifier_map ()
if (! rp_modifier_info.meta_mod_mask)
{
rp_modifier_info.meta_mod_mask = rp_modifier_info.alt_mod_mask;
+ rp_modifier_info.meta_sym = rp_modifier_info.alt_sym;
rp_modifier_info.alt_mod_mask = 0;
+ rp_modifier_info.alt_sym = 0;
}
/* If some keys are both alt and meta,