aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-07-18 19:10:08 +0100
committerLibravatar emersion <contact@emersion.fr>2018-07-18 19:10:08 +0100
commitfb4eca5d56b65a3129a8c17b171167198e6d9d7c (patch)
tree0b4c58eced09853aa66ff321771550d94f16d184 /sway/desktop/xwayland.c
parentMerge pull request #2292 from emersion/update-cursor-on-focus (diff)
downloadsway-fb4eca5d56b65a3129a8c17b171167198e6d9d7c.tar.gz
sway-fb4eca5d56b65a3129a8c17b171167198e6d9d7c.tar.zst
sway-fb4eca5d56b65a3129a8c17b171167198e6d9d7c.zip
Handle xwayland override_redirect flag change
This fixes syncplay menus.
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c58
1 files changed, 33 insertions, 25 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 9df7977d..1ee3f660 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -69,7 +69,7 @@ static void unmanaged_handle_map(struct wl_listener *listener, void *data) {
69 surface->ly = xsurface->y; 69 surface->ly = xsurface->y;
70 desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, true); 70 desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, true);
71 71
72 if (!wlr_xwayland_surface_is_unmanaged(xsurface)) { 72 if (!xsurface->override_redirect) {
73 struct sway_seat *seat = input_manager_current_seat(input_manager); 73 struct sway_seat *seat = input_manager_current_seat(input_manager);
74 struct wlr_xwayland *xwayland = 74 struct wlr_xwayland *xwayland =
75 seat->input->server->xwayland.wlr_xwayland; 75 seat->input->server->xwayland.wlr_xwayland;
@@ -89,7 +89,7 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) {
89 wl_list_remove(&surface->link); 89 wl_list_remove(&surface->link);
90 wl_list_remove(&surface->commit.link); 90 wl_list_remove(&surface->commit.link);
91 91
92 if (!wlr_xwayland_surface_is_unmanaged(xsurface)) { 92 if (!xsurface->override_redirect) {
93 struct sway_seat *seat = input_manager_current_seat(input_manager); 93 struct sway_seat *seat = input_manager_current_seat(input_manager);
94 if (seat->wlr_seat->keyboard_state.focused_surface == 94 if (seat->wlr_seat->keyboard_state.focused_surface ==
95 xsurface->surface) { 95 xsurface->surface) {
@@ -303,6 +303,27 @@ static void handle_commit(struct wl_listener *listener, void *data) {
303 } 303 }
304} 304}
305 305
306static void handle_destroy(struct wl_listener *listener, void *data) {
307 struct sway_xwayland_view *xwayland_view =
308 wl_container_of(listener, xwayland_view, destroy);
309 struct sway_view *view = &xwayland_view->view;
310
311 if (view->surface) {
312 view_unmap(view);
313 wl_list_remove(&xwayland_view->commit.link);
314 }
315
316 wl_list_remove(&xwayland_view->destroy.link);
317 wl_list_remove(&xwayland_view->request_configure.link);
318 wl_list_remove(&xwayland_view->request_fullscreen.link);
319 wl_list_remove(&xwayland_view->set_title.link);
320 wl_list_remove(&xwayland_view->set_class.link);
321 wl_list_remove(&xwayland_view->set_window_type.link);
322 wl_list_remove(&xwayland_view->map.link);
323 wl_list_remove(&xwayland_view->unmap.link);
324 view_destroy(&xwayland_view->view);
325}
326
306static void handle_unmap(struct wl_listener *listener, void *data) { 327static void handle_unmap(struct wl_listener *listener, void *data) {
307 struct sway_xwayland_view *xwayland_view = 328 struct sway_xwayland_view *xwayland_view =
308 wl_container_of(listener, xwayland_view, unmap); 329 wl_container_of(listener, xwayland_view, unmap);
@@ -323,6 +344,15 @@ static void handle_map(struct wl_listener *listener, void *data) {
323 struct wlr_xwayland_surface *xsurface = data; 344 struct wlr_xwayland_surface *xsurface = data;
324 struct sway_view *view = &xwayland_view->view; 345 struct sway_view *view = &xwayland_view->view;
325 346
347 if (xsurface->override_redirect) {
348 // This window used not to have the override redirect flag and has it
349 // now. Switch to unmanaged.
350 handle_destroy(&xwayland_view->destroy, view);
351 struct sway_xwayland_unmanaged *unmanaged = create_unmanaged(xsurface);
352 unmanaged_handle_map(&unmanaged->map, xsurface);
353 return;
354 }
355
326 view->natural_width = xsurface->width; 356 view->natural_width = xsurface->width;
327 view->natural_height = xsurface->height; 357 view->natural_height = xsurface->height;
328 358
@@ -344,27 +374,6 @@ static void handle_map(struct wl_listener *listener, void *data) {
344 transaction_commit_dirty(); 374 transaction_commit_dirty();
345} 375}
346 376
347static void handle_destroy(struct wl_listener *listener, void *data) {
348 struct sway_xwayland_view *xwayland_view =
349 wl_container_of(listener, xwayland_view, destroy);
350 struct sway_view *view = &xwayland_view->view;
351
352 if (view->surface) {
353 view_unmap(view);
354 wl_list_remove(&xwayland_view->commit.link);
355 }
356
357 wl_list_remove(&xwayland_view->destroy.link);
358 wl_list_remove(&xwayland_view->request_configure.link);
359 wl_list_remove(&xwayland_view->request_fullscreen.link);
360 wl_list_remove(&xwayland_view->set_title.link);
361 wl_list_remove(&xwayland_view->set_class.link);
362 wl_list_remove(&xwayland_view->set_window_type.link);
363 wl_list_remove(&xwayland_view->map.link);
364 wl_list_remove(&xwayland_view->unmap.link);
365 view_destroy(&xwayland_view->view);
366}
367
368static void handle_request_configure(struct wl_listener *listener, void *data) { 377static void handle_request_configure(struct wl_listener *listener, void *data) {
369 struct sway_xwayland_view *xwayland_view = 378 struct sway_xwayland_view *xwayland_view =
370 wl_container_of(listener, xwayland_view, request_configure); 379 wl_container_of(listener, xwayland_view, request_configure);
@@ -445,8 +454,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
445 xwayland_surface); 454 xwayland_surface);
446 struct wlr_xwayland_surface *xsurface = data; 455 struct wlr_xwayland_surface *xsurface = data;
447 456
448 if (wlr_xwayland_surface_is_unmanaged(xsurface) || 457 if (xsurface->override_redirect) {
449 xsurface->override_redirect) {
450 wlr_log(WLR_DEBUG, "New xwayland unmanaged surface"); 458 wlr_log(WLR_DEBUG, "New xwayland unmanaged surface");
451 create_unmanaged(xsurface); 459 create_unmanaged(xsurface);
452 return; 460 return;