aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-29 21:11:41 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-29 21:11:41 +0000
commit6b9837056e7c590bab299ea44a642cc5b85e4173 (patch)
tree8eabc04ea81f6eb4f7c8d600cf9243a59cfdade5
parentsearch: update xcursor when starting and ending a search (diff)
input: keyboard_leave: reset focused *before* doing anything else
And update xcursor. This is necessary since we may still have mouse focus. But without keyboard focus, we don't display the 'text' xcursor.
-rw-r--r--input.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/input.c b/input.c
index 847a7fbe..07b9d551 100644
--- a/input.c
+++ b/input.c
@@ -147,21 +147,23 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
surface == NULL || /* Seen on Sway 1.2 */
wayl_terminal_from_surface(wayl, surface) == wayl->focused);
+ struct terminal *old_focused = wayl->focused;
+ wayl->focused = NULL;
+
stop_repeater(wayl, -1);
- if (wayl->focused != NULL) {
+ if (old_focused != NULL) {
/*
* Sway bug - under certain conditions we get a
* keyboard_leave() (and keyboard_key()) without first having
* received a keyboard_enter()
*/
- term_focus_out(wayl->focused);
+ term_focus_out(old_focused);
+ term_xcursor_update(old_focused);
} else {
LOG_WARN(
"compositor sent keyboard_leave event without a keyboard_enter "
"event: surface=%p", surface);
}
-
- wayl->focused = NULL;
}
static void