aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 7c5dde53..e15a3341 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -5,6 +5,7 @@
5#include <wayland-server-core.h> 5#include <wayland-server-core.h>
6#include <wlr/types/wlr_output_layout.h> 6#include <wlr/types/wlr_output_layout.h>
7#include <wlr/types/wlr_output.h> 7#include <wlr/types/wlr_output.h>
8#include <wlr/types/wlr_xdg_activation_v1.h>
8#include <wlr/xwayland.h> 9#include <wlr/xwayland.h>
9#include <xcb/xcb_icccm.h> 10#include <xcb/xcb_icccm.h>
10#include "log.h" 11#include "log.h"
@@ -16,6 +17,7 @@
16#include "sway/output.h" 17#include "sway/output.h"
17#include "sway/tree/arrange.h" 18#include "sway/tree/arrange.h"
18#include "sway/tree/container.h" 19#include "sway/tree/container.h"
20#include "sway/server.h"
19#include "sway/tree/view.h" 21#include "sway/tree/view.h"
20#include "sway/tree/workspace.h" 22#include "sway/tree/workspace.h"
21 23
@@ -466,6 +468,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
466 wl_list_remove(&xwayland_view->set_title.link); 468 wl_list_remove(&xwayland_view->set_title.link);
467 wl_list_remove(&xwayland_view->set_class.link); 469 wl_list_remove(&xwayland_view->set_class.link);
468 wl_list_remove(&xwayland_view->set_role.link); 470 wl_list_remove(&xwayland_view->set_role.link);
471 wl_list_remove(&xwayland_view->set_startup_id.link);
469 wl_list_remove(&xwayland_view->set_window_type.link); 472 wl_list_remove(&xwayland_view->set_window_type.link);
470 wl_list_remove(&xwayland_view->set_hints.link); 473 wl_list_remove(&xwayland_view->set_hints.link);
471 wl_list_remove(&xwayland_view->set_decorations.link); 474 wl_list_remove(&xwayland_view->set_decorations.link);
@@ -666,6 +669,31 @@ static void handle_set_role(struct wl_listener *listener, void *data) {
666 view_execute_criteria(view); 669 view_execute_criteria(view);
667} 670}
668 671
672static void handle_set_startup_id(struct wl_listener *listener, void *data) {
673 struct sway_xwayland_view *xwayland_view =
674 wl_container_of(listener, xwayland_view, set_startup_id);
675 struct sway_view *view = &xwayland_view->view;
676 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
677 if (xsurface->startup_id == NULL) {
678 return;
679 }
680
681 struct wlr_xdg_activation_token_v1 *token =
682 wlr_xdg_activation_v1_find_token(
683 server.xdg_activation_v1, xsurface->startup_id);
684 if (token == NULL) {
685 // Tried to activate with an unknown or expired token
686 return;
687 }
688
689 struct launcher_ctx *ctx = token->data;
690 if (token->data == NULL) {
691 // TODO: support external launchers in X
692 return;
693 }
694 view_assign_ctx(view, ctx);
695}
696
669static void handle_set_window_type(struct wl_listener *listener, void *data) { 697static void handle_set_window_type(struct wl_listener *listener, void *data) {
670 struct sway_xwayland_view *xwayland_view = 698 struct sway_xwayland_view *xwayland_view =
671 wl_container_of(listener, xwayland_view, set_window_type); 699 wl_container_of(listener, xwayland_view, set_window_type);
@@ -751,6 +779,10 @@ struct sway_xwayland_view *create_xwayland_view(struct wlr_xwayland_surface *xsu
751 wl_signal_add(&xsurface->events.set_role, &xwayland_view->set_role); 779 wl_signal_add(&xsurface->events.set_role, &xwayland_view->set_role);
752 xwayland_view->set_role.notify = handle_set_role; 780 xwayland_view->set_role.notify = handle_set_role;
753 781
782 wl_signal_add(&xsurface->events.set_startup_id,
783 &xwayland_view->set_startup_id);
784 xwayland_view->set_startup_id.notify = handle_set_startup_id;
785
754 wl_signal_add(&xsurface->events.set_window_type, 786 wl_signal_add(&xsurface->events.set_window_type,
755 &xwayland_view->set_window_type); 787 &xwayland_view->set_window_type);
756 xwayland_view->set_window_type.notify = handle_set_window_type; 788 xwayland_view->set_window_type.notify = handle_set_window_type;