aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Pascal Pascher <aur@clouddrop.de>2018-07-24 22:16:06 +0200
committerLibravatar Pascal Pascher <aur@clouddrop.de>2018-07-24 22:16:06 +0200
commit24ad1c3983192b47345566fd876e26b45160d68e (patch)
treeb617f8d15cb20897b1c016fb67fab80d7245c66a /sway/tree/view.c
parentMerge pull request #2165 from swaywm/pid-workspaces (diff)
downloadsway-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/view.c')
-rw-r--r--sway/tree/view.c16
1 files changed, 14 insertions, 2 deletions
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
112uint32_t view_get_x11_window_id(struct sway_view *view) { 114uint32_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
119const char *view_get_window_role(struct sway_view *view) { 121const 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);