diff options
author | sabetts <sabetts> | 2001-06-01 19:14:28 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2001-06-01 19:14:28 +0000 |
commit | 366e07b927a7c54012d21819b6504fb06878fcc1 (patch) | |
tree | 6561edcf0744693db137e98e3e9baf7b821521b7 /src/actions.c | |
parent | 8161a84a50dde1a2af5707b25e2130ea2819470a (diff) | |
download | ratpoison-366e07b927a7c54012d21819b6504fb06878fcc1.zip |
iconic window map_request properly
Diffstat (limited to 'src/actions.c')
-rw-r--r-- | src/actions.c | 128 |
1 files changed, 90 insertions, 38 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); } |