- while (event.subwindow)
- {
- event.window = event.subwindow;
- XQueryPointer(display, event.window, &event.root, &event.subwindow, &event.x_root, &event.y_root, &event.x, &event.y, &event.state);
- }
+ Window focus;
+ int revert;
+ XGetInputFocus(display, &focus, &revert);
+ if (focus == None)
+ return false;
+
+ int mod = 0;
+
+ if (modifiers & wxMOD_SHIFT)
+ mod |= ShiftMask;
+ //Mod1 is alt in the vast majority of cases
+ if (modifiers & wxMOD_ALT)
+ mod |= Mod1Mask;
+ if (modifiers & wxMOD_CMD)
+ mod |= ControlMask;
+
+ XKeyEvent event;
+ event.display = display;
+ event.window = focus;
+ event.root = DefaultRootWindow(event.display);
+ event.subwindow = None;
+ event.time = CurrentTime;
+ event.x = 1;
+ event.y = 1;
+ event.x_root = 1;
+ event.y_root = 1;
+ event.same_screen = True;
+ event.type = type;
+ event.state = mod;
+ event.keycode = xkeycode;