From fa13493ad539ff768f47932668c75d7c4513b0a5 Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Thu, 24 May 2018 16:05:12 +0200 Subject: [PATCH 1/2] rootston: Disable keyboard focus on inactive views After clicking on something non-interactive, the current view was getting deactivated, but still received keyboard events. roots_seat_set_focus now changes both together in this case. --- rootston/seat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rootston/seat.c b/rootston/seat.c index cbc7c961..b137ff11 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -798,6 +798,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { if (view == NULL) { seat->cursor->mode = ROOTS_CURSOR_PASSTHROUGH; + wlr_seat_keyboard_clear_focus(seat->seat); return; } From a94c56a828933d72b0529f81916292222ef152f0 Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Thu, 24 May 2018 16:10:29 +0200 Subject: [PATCH 2/2] rootston: Keep focus unchanged when non-focusable element clicked Before this change, a view would lose focus after clicking something that's not keyboard-interactive. This would lead to edge cases with layer-shell windows like input methods, which are pointer-only-interactive, but are not intended to change the state of any focus. --- rootston/cursor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rootston/cursor.c b/rootston/cursor.c index 55b145e2..1cf81704 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -273,7 +273,9 @@ static void roots_cursor_press_button(struct roots_cursor *cursor, } break; case WLR_BUTTON_PRESSED: - roots_seat_set_focus(seat, view); + if (view) { + roots_seat_set_focus(seat, view); + } if (surface && wlr_surface_is_layer_surface(surface)) { struct wlr_layer_surface *layer = wlr_layer_surface_from_wlr_surface(surface);