diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-24 21:16:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-24 21:16:10 +0200 |
commit | 317b8cbd9374dafa0c8649e9db45cdee7b748fd2 (patch) | |
tree | d1de6034752d7cec56cdc1cdb598e87f6de68c7f | |
parent | Merge pull request #1856 from Hello71/issue1855 (diff) | |
parent | Merge branch 'master' into master (diff) | |
download | sway-317b8cbd9374dafa0c8649e9db45cdee7b748fd2.tar.gz sway-317b8cbd9374dafa0c8649e9db45cdee7b748fd2.tar.zst sway-317b8cbd9374dafa0c8649e9db45cdee7b748fd2.zip |
Merge pull request #1858 from emersion/master
Fix segfault when switching back to workspace with osu!
-rw-r--r-- | sway/desktop/xwayland.c | 11 | ||||
-rw-r--r-- | sway/input/seat.c | 30 |
2 files changed, 22 insertions, 19 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index cad9156d..63d9c66e 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -266,10 +266,13 @@ static void handle_request_configure(struct wl_listener *listener, void *data) { | |||
266 | struct wlr_xwayland_surface_configure_event *ev = data; | 266 | struct wlr_xwayland_surface_configure_event *ev = data; |
267 | struct sway_view *view = &xwayland_view->view; | 267 | struct sway_view *view = &xwayland_view->view; |
268 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | 268 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; |
269 | // TODO: floating windows are allowed to move around like this, but make | 269 | if (!xsurface->mapped) { |
270 | // sure tiling windows always stay in place. | 270 | wlr_xwayland_surface_configure(xsurface, ev->x, ev->y, |
271 | wlr_xwayland_surface_configure(xsurface, ev->x, ev->y, | 271 | ev->width, ev->height); |
272 | ev->width, ev->height); | 272 | return; |
273 | } | ||
274 | // TODO: Let floating views do whatever | ||
275 | configure(view, view->swayc->x, view->swayc->y, view->width, view->height); | ||
273 | } | 276 | } |
274 | 277 | ||
275 | static void handle_request_fullscreen(struct wl_listener *listener, void *data) { | 278 | static void handle_request_fullscreen(struct wl_listener *listener, void *data) { |
diff --git a/sway/input/seat.c b/sway/input/seat.c index d1fc62c4..e88bcfd1 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -476,10 +476,11 @@ void seat_set_focus_warp(struct sway_seat *seat, | |||
476 | // find new output's old workspace, which might have to be removed if empty | 476 | // find new output's old workspace, which might have to be removed if empty |
477 | struct sway_container *new_output_last_ws = NULL; | 477 | struct sway_container *new_output_last_ws = NULL; |
478 | if (last_output && new_output && last_output != new_output) { | 478 | if (last_output && new_output && last_output != new_output) { |
479 | new_output_last_ws = seat_get_focus_by_type(seat, new_output, C_WORKSPACE); | 479 | new_output_last_ws = |
480 | seat_get_focus_by_type(seat, new_output, C_WORKSPACE); | ||
480 | } | 481 | } |
481 | 482 | ||
482 | if (container) { | 483 | if (container && container->parent) { |
483 | struct sway_seat_container *seat_con = | 484 | struct sway_seat_container *seat_con = |
484 | seat_container_from_container(seat, container); | 485 | seat_container_from_container(seat, container); |
485 | if (seat_con == NULL) { | 486 | if (seat_con == NULL) { |
@@ -488,8 +489,7 @@ void seat_set_focus_warp(struct sway_seat *seat, | |||
488 | 489 | ||
489 | // put all the anscestors of this container on top of the focus stack | 490 | // put all the anscestors of this container on top of the focus stack |
490 | struct sway_seat_container *parent = | 491 | struct sway_seat_container *parent = |
491 | seat_container_from_container(seat, | 492 | seat_container_from_container(seat, container->parent); |
492 | seat_con->container->parent); | ||
493 | while (parent) { | 493 | while (parent) { |
494 | wl_list_remove(&parent->link); | 494 | wl_list_remove(&parent->link); |
495 | wl_list_insert(&seat->focus_stack, &parent->link); | 495 | wl_list_insert(&seat->focus_stack, &parent->link); |
@@ -516,24 +516,24 @@ void seat_set_focus_warp(struct sway_seat *seat, | |||
516 | // clean up unfocused empty workspace on new output | 516 | // clean up unfocused empty workspace on new output |
517 | if (new_output_last_ws) { | 517 | if (new_output_last_ws) { |
518 | if (!workspace_is_visible(new_output_last_ws) | 518 | if (!workspace_is_visible(new_output_last_ws) |
519 | && new_output_last_ws->children->length == 0) { | 519 | && new_output_last_ws->children->length == 0) { |
520 | if (last_workspace == new_output_last_ws) { | ||
521 | last_focus = NULL; | ||
522 | last_workspace = NULL; | ||
523 | } | ||
520 | container_destroy(new_output_last_ws); | 524 | container_destroy(new_output_last_ws); |
521 | } | 525 | } |
522 | } | 526 | } |
523 | 527 | ||
524 | if (last_focus) { | 528 | if (last_focus) { |
525 | struct sway_container *last_ws = last_focus; | 529 | if (last_workspace) { |
526 | if (last_ws && last_ws->type != C_WORKSPACE) { | 530 | ipc_event_workspace(last_workspace, container, "focus"); |
527 | last_ws = container_parent(last_ws, C_WORKSPACE); | 531 | if (!workspace_is_visible(last_workspace) |
528 | } | 532 | && last_workspace->children->length == 0) { |
529 | if (last_ws) { | 533 | if (last_workspace == last_focus) { |
530 | ipc_event_workspace(last_ws, container, "focus"); | ||
531 | if (!workspace_is_visible(last_ws) | ||
532 | && last_ws->children->length == 0) { | ||
533 | if (last_ws == last_focus) { | ||
534 | last_focus = NULL; | 534 | last_focus = NULL; |
535 | } | 535 | } |
536 | container_destroy(last_ws); | 536 | container_destroy(last_workspace); |
537 | } | 537 | } |
538 | } | 538 | } |
539 | 539 | ||