aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/output.c6
-rw-r--r--sway/desktop/xwayland.c12
-rw-r--r--sway/input/keyboard.c40
-rw-r--r--sway/sway.1.scd2
-rw-r--r--sway/tree/container.c6
5 files changed, 54 insertions, 12 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index d9ccb00d..6b2eb0c2 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -522,14 +522,10 @@ static void handle_transform(struct wl_listener *listener, void *data) {
transaction_commit_dirty();
}
-static void handle_scale_iterator(struct sway_container *view, void *data) {
- view_update_marks_textures(view->sway_view);
-}
-
static void handle_scale(struct wl_listener *listener, void *data) {
struct sway_output *output = wl_container_of(listener, output, scale);
arrange_layers(output);
- container_descendants(output->swayc, C_VIEW, handle_scale_iterator, NULL);
+ container_update_textures_recursive(output->swayc);
arrange_windows(output->swayc);
transaction_commit_dirty();
}
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 390ca580..398446f8 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -69,11 +69,13 @@ static void unmanaged_handle_map(struct wl_listener *listener, void *data) {
surface->ly = xsurface->y;
desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, true);
- struct sway_seat *seat = input_manager_current_seat(input_manager);
- struct wlr_xwayland *xwayland =
- seat->input->server->xwayland.wlr_xwayland;
- wlr_xwayland_set_seat(xwayland, seat->wlr_seat);
- seat_set_focus_surface(seat, xsurface->surface, false);
+ if (wlr_xwayland_or_surface_wants_focus(xsurface)) {
+ struct sway_seat *seat = input_manager_current_seat(input_manager);
+ struct wlr_xwayland *xwayland =
+ seat->input->server->xwayland.wlr_xwayland;
+ wlr_xwayland_set_seat(xwayland, seat->wlr_seat);
+ seat_set_focus_surface(seat, xsurface->surface, false);
+ }
}
static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) {
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c
index 8dc8239c..160ef10b 100644
--- a/sway/input/keyboard.c
+++ b/sway/input/keyboard.c
@@ -264,6 +264,7 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
}
// Identify and execute active pressed binding
+ struct sway_binding *next_repeat_binding = NULL;
if (event->state == WLR_KEY_PRESSED) {
struct sway_binding *binding_pressed = NULL;
get_active_binding(&keyboard->state_keycodes,
@@ -279,6 +280,21 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
if (binding_pressed) {
seat_execute_command(seat, binding_pressed);
handled = true;
+ next_repeat_binding = binding_pressed;
+ }
+ }
+
+ // Set up (or clear) keyboard repeat for a pressed binding
+ if (next_repeat_binding && wlr_device->keyboard->repeat_info.delay > 0) {
+ keyboard->repeat_binding = next_repeat_binding;
+ if (wl_event_source_timer_update(keyboard->key_repeat_source,
+ wlr_device->keyboard->repeat_info.delay) < 0) {
+ wlr_log(WLR_DEBUG, "failed to set key repeat timer");
+ }
+ } else if (keyboard->repeat_binding) {
+ keyboard->repeat_binding = NULL;
+ if (wl_event_source_timer_update(keyboard->key_repeat_source, 0) < 0) {
+ wlr_log(WLR_DEBUG, "failed to disarm key repeat timer");
}
}
@@ -303,6 +319,26 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
transaction_commit_dirty();
}
+static int handle_keyboard_repeat(void *data) {
+ struct sway_keyboard *keyboard = (struct sway_keyboard *)data;
+ struct wlr_keyboard *wlr_device =
+ keyboard->seat_device->input_device->wlr_device->keyboard;
+ if (keyboard->repeat_binding) {
+ if (wlr_device->repeat_info.rate > 0) {
+ // We queue the next event first, as the command might cancel it
+ if (wl_event_source_timer_update(keyboard->key_repeat_source,
+ 1000 / wlr_device->repeat_info.rate) < 0) {
+ wlr_log(WLR_DEBUG, "failed to update key repeat timer");
+ }
+ }
+
+ seat_execute_command(keyboard->seat_device->sway_seat,
+ keyboard->repeat_binding);
+ transaction_commit_dirty();
+ }
+ return 0;
+}
+
static void handle_keyboard_modifiers(struct wl_listener *listener,
void *data) {
struct sway_keyboard *keyboard =
@@ -328,6 +364,9 @@ struct sway_keyboard *sway_keyboard_create(struct sway_seat *seat,
wl_list_init(&keyboard->keyboard_key.link);
wl_list_init(&keyboard->keyboard_modifiers.link);
+ keyboard->key_repeat_source = wl_event_loop_add_timer(server.wl_event_loop,
+ handle_keyboard_repeat, keyboard);
+
return keyboard;
}
@@ -441,5 +480,6 @@ void sway_keyboard_destroy(struct sway_keyboard *keyboard) {
}
wl_list_remove(&keyboard->keyboard_key.link);
wl_list_remove(&keyboard->keyboard_modifiers.link);
+ wl_event_source_remove(keyboard->key_repeat_source);
free(keyboard);
}
diff --git a/sway/sway.1.scd b/sway/sway.1.scd
index 5b770cce..0c2ee974 100644
--- a/sway/sway.1.scd
+++ b/sway/sway.1.scd
@@ -92,4 +92,4 @@ source contributors. For more information about sway development, see
# SEE ALSO
-*sway*(5) *swaymsg*(1) *swaygrab*(1) *sway-input*(5) *sway-bar*(5)
+*sway*(5) *swaymsg*(1) *sway-input*(5) *sway-bar*(5)
diff --git a/sway/tree/container.c b/sway/tree/container.c
index b7442002..4e85021d 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -67,7 +67,7 @@ void container_create_notify(struct sway_container *container) {
}
}
-static void container_update_textures_recursive(struct sway_container *con) {
+void container_update_textures_recursive(struct sway_container *con) {
if (con->type == C_CONTAINER || con->type == C_VIEW) {
container_update_title_textures(con);
}
@@ -79,6 +79,10 @@ static void container_update_textures_recursive(struct sway_container *con) {
struct sway_container *child = con->children->items[i];
container_update_textures_recursive(child);
}
+
+ if (con->type == C_WORKSPACE) {
+ container_update_textures_recursive(con->sway_workspace->floating);
+ }
}
}