diff options
author | Pascal Pascher <aur@clouddrop.de> | 2018-07-24 22:16:06 +0200 |
---|---|---|
committer | Pascal Pascher <aur@clouddrop.de> | 2018-07-24 22:16:06 +0200 |
commit | 24ad1c3983192b47345566fd876e26b45160d68e (patch) | |
tree | b617f8d15cb20897b1c016fb67fab80d7245c66a /sway/tree | |
parent | Merge pull request #2165 from swaywm/pid-workspaces (diff) | |
download | sway-24ad1c3983192b47345566fd876e26b45160d68e.tar.gz sway-24ad1c3983192b47345566fd876e26b45160d68e.tar.zst sway-24ad1c3983192b47345566fd876e26b45160d68e.zip |
Added meson option "enable_xwayland" (default: true) to enable/disable xwayland support
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/container.c | 2 | ||||
-rw-r--r-- | sway/tree/layout.c | 2 | ||||
-rw-r--r-- | sway/tree/view.c | 16 |
3 files changed, 18 insertions, 2 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 4f743c40..0a655db5 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -527,10 +527,12 @@ static struct sway_container *container_at_view(struct sway_container *swayc, | |||
527 | double _sx, _sy; | 527 | double _sx, _sy; |
528 | struct wlr_surface *_surface = NULL; | 528 | struct wlr_surface *_surface = NULL; |
529 | switch (sview->type) { | 529 | switch (sview->type) { |
530 | #ifdef HAVE_XWAYLAND | ||
530 | case SWAY_VIEW_XWAYLAND: | 531 | case SWAY_VIEW_XWAYLAND: |
531 | _surface = wlr_surface_surface_at(sview->surface, | 532 | _surface = wlr_surface_surface_at(sview->surface, |
532 | view_sx, view_sy, &_sx, &_sy); | 533 | view_sx, view_sy, &_sx, &_sy); |
533 | break; | 534 | break; |
535 | #endif | ||
534 | case SWAY_VIEW_XDG_SHELL_V6: | 536 | case SWAY_VIEW_XDG_SHELL_V6: |
535 | _surface = wlr_xdg_surface_v6_surface_at( | 537 | _surface = wlr_xdg_surface_v6_surface_at( |
536 | sview->wlr_xdg_surface_v6, | 538 | sview->wlr_xdg_surface_v6, |
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index a2be0ef3..91350c3f 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -39,7 +39,9 @@ void layout_init(void) { | |||
39 | root_container.sway_root = calloc(1, sizeof(*root_container.sway_root)); | 39 | root_container.sway_root = calloc(1, sizeof(*root_container.sway_root)); |
40 | root_container.sway_root->output_layout = wlr_output_layout_create(); | 40 | root_container.sway_root->output_layout = wlr_output_layout_create(); |
41 | wl_list_init(&root_container.sway_root->outputs); | 41 | wl_list_init(&root_container.sway_root->outputs); |
42 | #ifdef HAVE_XWAYLAND | ||
42 | wl_list_init(&root_container.sway_root->xwayland_unmanaged); | 43 | wl_list_init(&root_container.sway_root->xwayland_unmanaged); |
44 | #endif | ||
43 | wl_list_init(&root_container.sway_root->drag_icons); | 45 | wl_list_init(&root_container.sway_root->drag_icons); |
44 | wl_signal_init(&root_container.sway_root->events.new_container); | 46 | wl_signal_init(&root_container.sway_root->events.new_container); |
45 | root_container.sway_root->scratchpad = create_list(); | 47 | root_container.sway_root->scratchpad = create_list(); |
diff --git a/sway/tree/view.c b/sway/tree/view.c index a55c8a29..e99b938e 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -3,7 +3,9 @@ | |||
3 | #include <wayland-server.h> | 3 | #include <wayland-server.h> |
4 | #include <wlr/render/wlr_renderer.h> | 4 | #include <wlr/render/wlr_renderer.h> |
5 | #include <wlr/types/wlr_output_layout.h> | 5 | #include <wlr/types/wlr_output_layout.h> |
6 | #ifdef HAVE_XWAYLAND | ||
6 | #include <wlr/xwayland.h> | 7 | #include <wlr/xwayland.h> |
8 | #endif | ||
7 | #include "list.h" | 9 | #include "list.h" |
8 | #include "log.h" | 10 | #include "log.h" |
9 | #include "sway/criteria.h" | 11 | #include "sway/criteria.h" |
@@ -108,14 +110,14 @@ const char *view_get_instance(struct sway_view *view) { | |||
108 | } | 110 | } |
109 | return NULL; | 111 | return NULL; |
110 | } | 112 | } |
111 | 113 | #ifdef HAVE_XWAYLAND | |
112 | uint32_t view_get_x11_window_id(struct sway_view *view) { | 114 | uint32_t view_get_x11_window_id(struct sway_view *view) { |
113 | if (view->impl->get_int_prop) { | 115 | if (view->impl->get_int_prop) { |
114 | return view->impl->get_int_prop(view, VIEW_PROP_X11_WINDOW_ID); | 116 | return view->impl->get_int_prop(view, VIEW_PROP_X11_WINDOW_ID); |
115 | } | 117 | } |
116 | return 0; | 118 | return 0; |
117 | } | 119 | } |
118 | 120 | #endif | |
119 | const char *view_get_window_role(struct sway_view *view) { | 121 | const char *view_get_window_role(struct sway_view *view) { |
120 | if (view->impl->get_string_prop) { | 122 | if (view->impl->get_string_prop) { |
121 | return view->impl->get_string_prop(view, VIEW_PROP_WINDOW_ROLE); | 123 | return view->impl->get_string_prop(view, VIEW_PROP_WINDOW_ROLE); |
@@ -136,8 +138,10 @@ const char *view_get_shell(struct sway_view *view) { | |||
136 | return "xdg_shell_v6"; | 138 | return "xdg_shell_v6"; |
137 | case SWAY_VIEW_XDG_SHELL: | 139 | case SWAY_VIEW_XDG_SHELL: |
138 | return "xdg_shell"; | 140 | return "xdg_shell"; |
141 | #ifdef HAVE_XWAYLAND | ||
139 | case SWAY_VIEW_XWAYLAND: | 142 | case SWAY_VIEW_XWAYLAND: |
140 | return "xwayland"; | 143 | return "xwayland"; |
144 | #endif | ||
141 | } | 145 | } |
142 | return "unknown"; | 146 | return "unknown"; |
143 | } | 147 | } |
@@ -563,6 +567,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) { | |||
563 | } | 567 | } |
564 | 568 | ||
565 | pid_t pid; | 569 | pid_t pid; |
570 | #ifdef HAVE_XWAYLAND | ||
566 | if (view->type == SWAY_VIEW_XWAYLAND) { | 571 | if (view->type == SWAY_VIEW_XWAYLAND) { |
567 | struct wlr_xwayland_surface *surf = | 572 | struct wlr_xwayland_surface *surf = |
568 | wlr_xwayland_surface_from_wlr_surface(wlr_surface); | 573 | wlr_xwayland_surface_from_wlr_surface(wlr_surface); |
@@ -572,6 +577,11 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) { | |||
572 | wl_resource_get_client(wlr_surface->resource); | 577 | wl_resource_get_client(wlr_surface->resource); |
573 | wl_client_get_credentials(client, &pid, NULL, NULL); | 578 | wl_client_get_credentials(client, &pid, NULL, NULL); |
574 | } | 579 | } |
580 | #else | ||
581 | struct wl_client *client = | ||
582 | wl_resource_get_client(wlr_surface->resource); | ||
583 | wl_client_get_credentials(client, &pid, NULL, NULL); | ||
584 | #endif | ||
575 | 585 | ||
576 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 586 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
577 | struct sway_container *target_sibling = | 587 | struct sway_container *target_sibling = |
@@ -825,11 +835,13 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) { | |||
825 | wlr_xdg_surface_v6_from_wlr_surface(wlr_surface); | 835 | wlr_xdg_surface_v6_from_wlr_surface(wlr_surface); |
826 | return view_from_wlr_xdg_surface_v6(xdg_surface_v6); | 836 | return view_from_wlr_xdg_surface_v6(xdg_surface_v6); |
827 | } | 837 | } |
838 | #ifdef HAVE_XWAYLAND | ||
828 | if (wlr_surface_is_xwayland_surface(wlr_surface)) { | 839 | if (wlr_surface_is_xwayland_surface(wlr_surface)) { |
829 | struct wlr_xwayland_surface *xsurface = | 840 | struct wlr_xwayland_surface *xsurface = |
830 | wlr_xwayland_surface_from_wlr_surface(wlr_surface); | 841 | wlr_xwayland_surface_from_wlr_surface(wlr_surface); |
831 | return view_from_wlr_xwayland_surface(xsurface); | 842 | return view_from_wlr_xwayland_surface(xsurface); |
832 | } | 843 | } |
844 | #endif | ||
833 | if (wlr_surface_is_subsurface(wlr_surface)) { | 845 | if (wlr_surface_is_subsurface(wlr_surface)) { |
834 | struct wlr_subsurface *subsurface = | 846 | struct wlr_subsurface *subsurface = |
835 | wlr_subsurface_from_wlr_surface(wlr_surface); | 847 | wlr_subsurface_from_wlr_surface(wlr_surface); |