aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/cursor.c12
-rw-r--r--sway/input/input-manager.c6
2 files changed, 8 insertions, 10 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 944e35aa..a2f11557 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -255,14 +255,12 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
wlr_layer_surface_from_wlr_surface(surface);
if (layer->current.keyboard_interactive) {
seat_set_focus_layer(cursor->seat, layer);
- return;
}
- }
- // Avoid moving keyboard focus from a surface that accepts it to one
- // that does not unless the change would move us to a new workspace.
- //
- // This prevents, for example, losing focus when clicking on swaybar.
- if (surface && cont && cont->type != C_VIEW) {
+ } else if (surface && cont && cont->type != C_VIEW) {
+ // Avoid moving keyboard focus from a surface that accepts it to one
+ // that does not unless the change would move us to a new workspace.
+ //
+ // This prevents, for example, losing focus when clicking on swaybar.
struct sway_container *new_ws = cont;
if (new_ws && new_ws->type != C_WORKSPACE) {
new_ws = container_parent(new_ws, C_WORKSPACE);
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index 29b47a7b..98f7d7cf 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -224,6 +224,9 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
input_manager_libinput_config_pointer(input_device);
}
+ wl_signal_add(&device->events.destroy, &input_device->device_destroy);
+ input_device->device_destroy.notify = handle_device_destroy;
+
struct sway_seat *seat = NULL;
if (!input_has_seat_configuration(input)) {
wlr_log(L_DEBUG, "no seat configuration, using default seat");
@@ -260,9 +263,6 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
"device '%s' is not configured on any seats",
input_device->identifier);
}
-
- wl_signal_add(&device->events.destroy, &input_device->device_destroy);
- input_device->device_destroy.notify = handle_device_destroy;
}
static void handle_inhibit_activate(struct wl_listener *listener, void *data) {