diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-03-31 11:18:29 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-03-31 13:05:45 -0400 |
commit | b9d2983324c91f0a2805b1f10afcf2a929f939b4 (patch) | |
tree | 2a6346a760d051e01142770a16d6b92365ca01ce /sway/input/seat.c | |
parent | Implement focus_follows_mouse (diff) | |
download | sway-b9d2983324c91f0a2805b1f10afcf2a929f939b4.tar.gz sway-b9d2983324c91f0a2805b1f10afcf2a929f939b4.tar.zst sway-b9d2983324c91f0a2805b1f10afcf2a929f939b4.zip |
Fix interaction between warping and following
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index eab5cf40..4e7e018d 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -291,8 +291,8 @@ void sway_seat_configure_xcursor(struct sway_seat *seat) { | |||
291 | seat->cursor->cursor->y); | 291 | seat->cursor->cursor->y); |
292 | } | 292 | } |
293 | 293 | ||
294 | void sway_seat_set_focus(struct sway_seat *seat, | 294 | void _sway_seat_set_focus(struct sway_seat *seat, |
295 | struct sway_container *container) { | 295 | struct sway_container *container, bool warp) { |
296 | struct sway_container *last_focus = sway_seat_get_focus(seat); | 296 | struct sway_container *last_focus = sway_seat_get_focus(seat); |
297 | 297 | ||
298 | if (container && last_focus == container) { | 298 | if (container && last_focus == container) { |
@@ -349,7 +349,9 @@ void sway_seat_set_focus(struct sway_seat *seat, | |||
349 | if (new_output && new_output->type != C_OUTPUT) { | 349 | if (new_output && new_output->type != C_OUTPUT) { |
350 | new_output = container_parent(new_output, C_OUTPUT); | 350 | new_output = container_parent(new_output, C_OUTPUT); |
351 | } | 351 | } |
352 | if (new_output != last_output && config->mouse_warping) { | 352 | if (new_output && last_output && new_output != last_output |
353 | && config->mouse_warping && warp) { | ||
354 | wlr_log(L_DEBUG, "warpin the mouse baby"); | ||
353 | struct wlr_output *output = new_output->sway_output->wlr_output; | 355 | struct wlr_output *output = new_output->sway_output->wlr_output; |
354 | // TODO: Change container coords to layout coords | 356 | // TODO: Change container coords to layout coords |
355 | double x = container->x + output->lx + container->width / 2.0; | 357 | double x = container->x + output->lx + container->width / 2.0; |
@@ -367,6 +369,11 @@ void sway_seat_set_focus(struct sway_seat *seat, | |||
367 | seat->has_focus = (container != NULL); | 369 | seat->has_focus = (container != NULL); |
368 | } | 370 | } |
369 | 371 | ||
372 | void sway_seat_set_focus(struct sway_seat *seat, | ||
373 | struct sway_container *container) { | ||
374 | _sway_seat_set_focus(seat, container, true); | ||
375 | } | ||
376 | |||
370 | struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *container) { | 377 | struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *container) { |
371 | struct sway_seat_container *current = NULL; | 378 | struct sway_seat_container *current = NULL; |
372 | struct sway_container *parent = NULL; | 379 | struct sway_container *parent = NULL; |