summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actions.c130
-rw-r--r--src/data.h4
-rw-r--r--src/input.c12
3 files changed, 38 insertions, 108 deletions
diff --git a/src/actions.c b/src/actions.c
index a26a314..6bf0d06 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -21,7 +21,6 @@
#include <unistd.h>
#include <sys/wait.h>
#include <X11/keysym.h>
-#include <X11/extensions/XTest.h>
#include <string.h>
#include <time.h>
@@ -353,99 +352,46 @@ cmd_source (void *data)
void
cmd_generate (void *data)
{
- XEvent ev;
+ XEvent ev1, ev;
ev = *rp_current_event;
- if (current_window() == NULL) return;
-
- 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);
+ 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); */
XSync (dpy, False);
}
diff --git a/src/data.h b/src/data.h
index 19b68ae..4584b21 100644
--- a/src/data.h
+++ b/src/data.h
@@ -166,13 +166,9 @@ 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/input.c b/src/input.c
index 01c0303..60f4624 100644
--- a/src/input.c
+++ b/src/input.c
@@ -39,13 +39,9 @@ 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);
@@ -60,7 +56,6 @@ 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);
@@ -68,7 +63,6 @@ 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);
@@ -76,8 +70,6 @@ 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);
@@ -85,8 +77,6 @@ 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);
@@ -108,9 +98,7 @@ 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,