mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 09:51:29 +00:00
Merge pull request #1858 from emersion/master
Fix segfault when switching back to workspace with osu!
This commit is contained in:
commit
317b8cbd93
|
@ -266,10 +266,13 @@ static void handle_request_configure(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_xwayland_surface_configure_event *ev = data;
|
struct wlr_xwayland_surface_configure_event *ev = data;
|
||||||
struct sway_view *view = &xwayland_view->view;
|
struct sway_view *view = &xwayland_view->view;
|
||||||
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
||||||
// TODO: floating windows are allowed to move around like this, but make
|
if (!xsurface->mapped) {
|
||||||
// sure tiling windows always stay in place.
|
wlr_xwayland_surface_configure(xsurface, ev->x, ev->y,
|
||||||
wlr_xwayland_surface_configure(xsurface, ev->x, ev->y,
|
ev->width, ev->height);
|
||||||
ev->width, ev->height);
|
return;
|
||||||
|
}
|
||||||
|
// TODO: Let floating views do whatever
|
||||||
|
configure(view, view->swayc->x, view->swayc->y, view->width, view->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_request_fullscreen(struct wl_listener *listener, void *data) {
|
static void handle_request_fullscreen(struct wl_listener *listener, void *data) {
|
||||||
|
|
|
@ -476,10 +476,11 @@ void seat_set_focus_warp(struct sway_seat *seat,
|
||||||
// find new output's old workspace, which might have to be removed if empty
|
// find new output's old workspace, which might have to be removed if empty
|
||||||
struct sway_container *new_output_last_ws = NULL;
|
struct sway_container *new_output_last_ws = NULL;
|
||||||
if (last_output && new_output && last_output != new_output) {
|
if (last_output && new_output && last_output != new_output) {
|
||||||
new_output_last_ws = seat_get_focus_by_type(seat, new_output, C_WORKSPACE);
|
new_output_last_ws =
|
||||||
|
seat_get_focus_by_type(seat, new_output, C_WORKSPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (container) {
|
if (container && container->parent) {
|
||||||
struct sway_seat_container *seat_con =
|
struct sway_seat_container *seat_con =
|
||||||
seat_container_from_container(seat, container);
|
seat_container_from_container(seat, container);
|
||||||
if (seat_con == NULL) {
|
if (seat_con == NULL) {
|
||||||
|
@ -488,8 +489,7 @@ void seat_set_focus_warp(struct sway_seat *seat,
|
||||||
|
|
||||||
// put all the anscestors of this container on top of the focus stack
|
// put all the anscestors of this container on top of the focus stack
|
||||||
struct sway_seat_container *parent =
|
struct sway_seat_container *parent =
|
||||||
seat_container_from_container(seat,
|
seat_container_from_container(seat, container->parent);
|
||||||
seat_con->container->parent);
|
|
||||||
while (parent) {
|
while (parent) {
|
||||||
wl_list_remove(&parent->link);
|
wl_list_remove(&parent->link);
|
||||||
wl_list_insert(&seat->focus_stack, &parent->link);
|
wl_list_insert(&seat->focus_stack, &parent->link);
|
||||||
|
@ -516,24 +516,24 @@ void seat_set_focus_warp(struct sway_seat *seat,
|
||||||
// clean up unfocused empty workspace on new output
|
// clean up unfocused empty workspace on new output
|
||||||
if (new_output_last_ws) {
|
if (new_output_last_ws) {
|
||||||
if (!workspace_is_visible(new_output_last_ws)
|
if (!workspace_is_visible(new_output_last_ws)
|
||||||
&& new_output_last_ws->children->length == 0) {
|
&& new_output_last_ws->children->length == 0) {
|
||||||
|
if (last_workspace == new_output_last_ws) {
|
||||||
|
last_focus = NULL;
|
||||||
|
last_workspace = NULL;
|
||||||
|
}
|
||||||
container_destroy(new_output_last_ws);
|
container_destroy(new_output_last_ws);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_focus) {
|
if (last_focus) {
|
||||||
struct sway_container *last_ws = last_focus;
|
if (last_workspace) {
|
||||||
if (last_ws && last_ws->type != C_WORKSPACE) {
|
ipc_event_workspace(last_workspace, container, "focus");
|
||||||
last_ws = container_parent(last_ws, C_WORKSPACE);
|
if (!workspace_is_visible(last_workspace)
|
||||||
}
|
&& last_workspace->children->length == 0) {
|
||||||
if (last_ws) {
|
if (last_workspace == last_focus) {
|
||||||
ipc_event_workspace(last_ws, container, "focus");
|
|
||||||
if (!workspace_is_visible(last_ws)
|
|
||||||
&& last_ws->children->length == 0) {
|
|
||||||
if (last_ws == last_focus) {
|
|
||||||
last_focus = NULL;
|
last_focus = NULL;
|
||||||
}
|
}
|
||||||
container_destroy(last_ws);
|
container_destroy(last_workspace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue