Fix bug that prevented fast inject from working correctly
This commit is contained in:
parent
5a7c6c4572
commit
6ddefd41bf
|
@ -311,7 +311,11 @@ void fast_send_string(const char * string) {
|
||||||
// and inject a key_release event so that they can be further registered.
|
// and inject a key_release event so that they can be further registered.
|
||||||
release_all_keys();
|
release_all_keys();
|
||||||
|
|
||||||
xdo_enter_text_window(xdo_context, CURRENTWINDOW, string, 1);
|
Window focused;
|
||||||
|
int revert_to;
|
||||||
|
XGetInputFocus(xdo_context->xdpy, &focused, &revert_to);
|
||||||
|
|
||||||
|
fast_enter_text_window(xdo_context, focused, string, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _fast_send_keycode_to_focused_window(int KeyCode, int32_t count) {
|
void _fast_send_keycode_to_focused_window(int KeyCode, int32_t count) {
|
||||||
|
|
|
@ -27,7 +27,6 @@ void fast_send_key(const xdo_t *xdo, Window window, charcodemap_t *key,
|
||||||
/* Properly ensure the modstate is set by finding a key
|
/* Properly ensure the modstate is set by finding a key
|
||||||
* that activates each bit in the modifier state */
|
* that activates each bit in the modifier state */
|
||||||
int mask = modstate | key->modmask;
|
int mask = modstate | key->modmask;
|
||||||
int use_xtest = 0;
|
|
||||||
|
|
||||||
/* Since key events have 'state' (shift, etc) in the event, we don't
|
/* Since key events have 'state' (shift, etc) in the event, we don't
|
||||||
* need to worry about key press ordering. */
|
* need to worry about key press ordering. */
|
||||||
|
@ -37,7 +36,7 @@ void fast_send_key(const xdo_t *xdo, Window window, charcodemap_t *key,
|
||||||
xk.keycode = key->code;
|
xk.keycode = key->code;
|
||||||
xk.state = mask | (key->group << 13);
|
xk.state = mask | (key->group << 13);
|
||||||
xk.type = (is_press ? KeyPress : KeyRelease);
|
xk.type = (is_press ? KeyPress : KeyRelease);
|
||||||
XSendEvent(xdo->xdpy, xk.window, True, KeyPressMask, (XEvent *)&xk);
|
XSendEvent(xdo->xdpy, xk.window, True, 0, (XEvent *)&xk);
|
||||||
|
|
||||||
/* Skipping the usleep if delay is 0 is much faster than calling usleep(0) */
|
/* Skipping the usleep if delay is 0 is much faster than calling usleep(0) */
|
||||||
XFlush(xdo->xdpy);
|
XFlush(xdo->xdpy);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user