summaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 4e401008..10faf91d 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -17,6 +17,7 @@
17#include "sway/tree/view.h" 17#include "sway/tree/view.h"
18 18
19static const char *atom_map[ATOM_LAST] = { 19static const char *atom_map[ATOM_LAST] = {
20 "_NET_WM_WINDOW_TYPE_NORMAL",
20 "_NET_WM_WINDOW_TYPE_DIALOG", 21 "_NET_WM_WINDOW_TYPE_DIALOG",
21 "_NET_WM_WINDOW_TYPE_UTILITY", 22 "_NET_WM_WINDOW_TYPE_UTILITY",
22 "_NET_WM_WINDOW_TYPE_TOOLBAR", 23 "_NET_WM_WINDOW_TYPE_TOOLBAR",
@@ -217,7 +218,9 @@ static bool wants_floating(struct sway_view *view) {
217 struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface; 218 struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
218 struct sway_xwayland *xwayland = &server.xwayland; 219 struct sway_xwayland *xwayland = &server.xwayland;
219 220
220 // TODO: return true if the NET_WM_STATE is MODAL 221 if (surface->modal) {
222 return true;
223 }
221 224
222 for (size_t i = 0; i < surface->window_type_len; ++i) { 225 for (size_t i = 0; i < surface->window_type_len; ++i) {
223 xcb_atom_t type = surface->window_type[i]; 226 xcb_atom_t type = surface->window_type[i];
@@ -334,6 +337,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
334 wl_list_remove(&xwayland_view->request_fullscreen.link); 337 wl_list_remove(&xwayland_view->request_fullscreen.link);
335 wl_list_remove(&xwayland_view->request_move.link); 338 wl_list_remove(&xwayland_view->request_move.link);
336 wl_list_remove(&xwayland_view->request_resize.link); 339 wl_list_remove(&xwayland_view->request_resize.link);
340 wl_list_remove(&xwayland_view->request_activate.link);
337 wl_list_remove(&xwayland_view->set_title.link); 341 wl_list_remove(&xwayland_view->set_title.link);
338 wl_list_remove(&xwayland_view->set_class.link); 342 wl_list_remove(&xwayland_view->set_class.link);
339 wl_list_remove(&xwayland_view->set_window_type.link); 343 wl_list_remove(&xwayland_view->set_window_type.link);
@@ -460,6 +464,19 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
460 seat_begin_resize_floating(seat, view->swayc, seat->last_button, e->edges); 464 seat_begin_resize_floating(seat, view->swayc, seat->last_button, e->edges);
461} 465}
462 466
467static void handle_request_activate(struct wl_listener *listener, void *data) {
468 struct sway_xwayland_view *xwayland_view =
469 wl_container_of(listener, xwayland_view, request_activate);
470 struct sway_view *view = &xwayland_view->view;
471 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
472 if (!xsurface->mapped) {
473 return;
474 }
475 view_request_activate(view);
476
477 transaction_commit_dirty();
478}
479
463static void handle_set_title(struct wl_listener *listener, void *data) { 480static void handle_set_title(struct wl_listener *listener, void *data) {
464 struct sway_xwayland_view *xwayland_view = 481 struct sway_xwayland_view *xwayland_view =
465 wl_container_of(listener, xwayland_view, set_title); 482 wl_container_of(listener, xwayland_view, set_title);
@@ -552,6 +569,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
552 &xwayland_view->request_fullscreen); 569 &xwayland_view->request_fullscreen);
553 xwayland_view->request_fullscreen.notify = handle_request_fullscreen; 570 xwayland_view->request_fullscreen.notify = handle_request_fullscreen;
554 571
572 wl_signal_add(&xsurface->events.request_activate,
573 &xwayland_view->request_activate);
574 xwayland_view->request_activate.notify = handle_request_activate;
575
555 wl_signal_add(&xsurface->events.request_move, 576 wl_signal_add(&xsurface->events.request_move,
556 &xwayland_view->request_move); 577 &xwayland_view->request_move);
557 xwayland_view->request_move.notify = handle_request_move; 578 xwayland_view->request_move.notify = handle_request_move;