diff options
author | 2019-02-12 23:22:33 +0100 | |
---|---|---|
committer | 2019-02-12 23:22:33 +0100 | |
commit | c44794bedcad90991b1b665ec5253175e3ef437f (patch) | |
tree | 241c7e66f4fcb4d48377ee0a396039a70dacab34 | |
parent | Merge pull request #3667 from emersion/fix-meson-version (diff) | |
parent | Rebase cursor when a layer surface maps (diff) | |
download | sway-c44794bedcad90991b1b665ec5253175e3ef437f.tar.gz sway-c44794bedcad90991b1b665ec5253175e3ef437f.tar.zst sway-c44794bedcad90991b1b665ec5253175e3ef437f.zip |
Merge pull request #3665 from emersion/layer-map-rebase
Rebase cursor when a layer surface maps
-rw-r--r-- | include/sway/input/cursor.h | 1 | ||||
-rw-r--r-- | sway/desktop/layer_shell.c | 7 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 9 | ||||
-rw-r--r-- | sway/input/cursor.c | 13 |
4 files changed, 20 insertions, 10 deletions
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 072a56ca..98eb4679 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h | |||
@@ -72,6 +72,7 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat); | |||
72 | * This chooses a cursor icon and sends a motion event to the surface. | 72 | * This chooses a cursor icon and sends a motion event to the surface. |
73 | */ | 73 | */ |
74 | void cursor_rebase(struct sway_cursor *cursor); | 74 | void cursor_rebase(struct sway_cursor *cursor); |
75 | void cursor_rebase_all(void); | ||
75 | 76 | ||
76 | void cursor_handle_activity(struct sway_cursor *cursor); | 77 | void cursor_handle_activity(struct sway_cursor *cursor); |
77 | void cursor_unhide(struct sway_cursor *cursor); | 78 | void cursor_unhide(struct sway_cursor *cursor); |
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index de8db75d..0767247c 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -6,7 +6,9 @@ | |||
6 | #include <wlr/types/wlr_layer_shell_v1.h> | 6 | #include <wlr/types/wlr_layer_shell_v1.h> |
7 | #include <wlr/types/wlr_output_damage.h> | 7 | #include <wlr/types/wlr_output_damage.h> |
8 | #include <wlr/types/wlr_output.h> | 8 | #include <wlr/types/wlr_output.h> |
9 | #include "log.h" | ||
9 | #include "sway/desktop/transaction.h" | 10 | #include "sway/desktop/transaction.h" |
11 | #include "sway/input/cursor.h" | ||
10 | #include "sway/input/input-manager.h" | 12 | #include "sway/input/input-manager.h" |
11 | #include "sway/input/seat.h" | 13 | #include "sway/input/seat.h" |
12 | #include "sway/layers.h" | 14 | #include "sway/layers.h" |
@@ -14,7 +16,6 @@ | |||
14 | #include "sway/server.h" | 16 | #include "sway/server.h" |
15 | #include "sway/tree/arrange.h" | 17 | #include "sway/tree/arrange.h" |
16 | #include "sway/tree/workspace.h" | 18 | #include "sway/tree/workspace.h" |
17 | #include "log.h" | ||
18 | 19 | ||
19 | static void apply_exclusive(struct wlr_box *usable_area, | 20 | static void apply_exclusive(struct wlr_box *usable_area, |
20 | uint32_t anchor, int32_t exclusive, | 21 | uint32_t anchor, int32_t exclusive, |
@@ -302,6 +303,8 @@ static void unmap(struct sway_layer_surface *sway_layer) { | |||
302 | if (seat->focused_layer == sway_layer->layer_surface) { | 303 | if (seat->focused_layer == sway_layer->layer_surface) { |
303 | seat_set_focus_layer(seat, NULL); | 304 | seat_set_focus_layer(seat, NULL); |
304 | } | 305 | } |
306 | |||
307 | cursor_rebase_all(); | ||
305 | } | 308 | } |
306 | 309 | ||
307 | static void handle_destroy(struct wl_listener *listener, void *data) { | 310 | static void handle_destroy(struct wl_listener *listener, void *data) { |
@@ -321,7 +324,6 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
321 | struct sway_output *output = sway_layer->layer_surface->output->data; | 324 | struct sway_output *output = sway_layer->layer_surface->output->data; |
322 | if (output != NULL) { | 325 | if (output != NULL) { |
323 | arrange_layers(output); | 326 | arrange_layers(output); |
324 | arrange_output(output); | ||
325 | transaction_commit_dirty(); | 327 | transaction_commit_dirty(); |
326 | } | 328 | } |
327 | wl_list_remove(&sway_layer->output_destroy.link); | 329 | wl_list_remove(&sway_layer->output_destroy.link); |
@@ -339,6 +341,7 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
339 | // TODO: send enter to subsurfaces and popups | 341 | // TODO: send enter to subsurfaces and popups |
340 | wlr_surface_send_enter(sway_layer->layer_surface->surface, | 342 | wlr_surface_send_enter(sway_layer->layer_surface->surface, |
341 | sway_layer->layer_surface->output); | 343 | sway_layer->layer_surface->output); |
344 | cursor_rebase_all(); | ||
342 | } | 345 | } |
343 | 346 | ||
344 | static void handle_unmap(struct wl_listener *listener, void *data) { | 347 | static void handle_unmap(struct wl_listener *listener, void *data) { |
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index e0c3a5d1..4098ed22 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c | |||
@@ -314,14 +314,7 @@ static void transaction_apply(struct sway_transaction *transaction) { | |||
314 | node->instruction = NULL; | 314 | node->instruction = NULL; |
315 | } | 315 | } |
316 | 316 | ||
317 | if (root->outputs->length) { | 317 | cursor_rebase_all(); |
318 | struct sway_seat *seat; | ||
319 | wl_list_for_each(seat, &server.input->seats, link) { | ||
320 | if (!seat_doing_seatop(seat)) { | ||
321 | cursor_rebase(seat->cursor); | ||
322 | } | ||
323 | } | ||
324 | } | ||
325 | } | 318 | } |
326 | 319 | ||
327 | static void transaction_commit(struct sway_transaction *transaction); | 320 | static void transaction_commit(struct sway_transaction *transaction); |
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 1bf548db..263b6758 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -283,6 +283,19 @@ void cursor_rebase(struct sway_cursor *cursor) { | |||
283 | cursor_do_rebase(cursor, time_msec, cursor->previous.node, surface, sx, sy); | 283 | cursor_do_rebase(cursor, time_msec, cursor->previous.node, surface, sx, sy); |
284 | } | 284 | } |
285 | 285 | ||
286 | void cursor_rebase_all(void) { | ||
287 | if (!root->outputs->length) { | ||
288 | return; | ||
289 | } | ||
290 | |||
291 | struct sway_seat *seat; | ||
292 | wl_list_for_each(seat, &server.input->seats, link) { | ||
293 | if (!seat_doing_seatop(seat)) { | ||
294 | cursor_rebase(seat->cursor); | ||
295 | } | ||
296 | } | ||
297 | } | ||
298 | |||
286 | static int hide_notify(void *data) { | 299 | static int hide_notify(void *data) { |
287 | struct sway_cursor *cursor = data; | 300 | struct sway_cursor *cursor = data; |
288 | wlr_cursor_set_image(cursor->cursor, NULL, 0, 0, 0, 0, 0, 0); | 301 | wlr_cursor_set_image(cursor->cursor, NULL, 0, 0, 0, 0, 0, 0); |