aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-24 20:54:57 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-27 22:51:37 +1000
commit7b138e5ef0f679c9bb0078019d7c9c63fef36273 (patch)
tree2cdbeb394889065e0606a1fcbe38c1e99e25d260 /sway/desktop/xwayland.c
parentMerge pull request #2717 from ianyfan/tablet-config (diff)
downloadsway-7b138e5ef0f679c9bb0078019d7c9c63fef36273.tar.gz
sway-7b138e5ef0f679c9bb0078019d7c9c63fef36273.tar.zst
sway-7b138e5ef0f679c9bb0078019d7c9c63fef36273.zip
Add CSD to border modes
This replaces view.using_csd with a new border mode: B_CSD. This also removes sway_xdg_shell{_v6}_view.deco_mode and view->has_client_side_decorations as we can now get these from the border. You can use `border toggle` to cycle through the modes including CSD, or use `border csd` to set it directly. The client must support the xdg-decoration protocol, and the only client I know of that does is the example in wlroots. If the client switches from SSD to CSD without us expecting it (via the server-decoration protocol), we stash the previous border type into view.saved_border so we can restore it if the client returns to SSD. I haven't found a way to test this though.
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index a12ac854..f1205518 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -243,12 +243,14 @@ static bool wants_floating(struct sway_view *view) {
243 return false; 243 return false;
244} 244}
245 245
246static bool has_client_side_decorations(struct sway_view *view) { 246static void handle_set_decorations(struct wl_listener *listener, void *data) {
247 if (xwayland_view_from_view(view) == NULL) { 247 struct sway_xwayland_view *xwayland_view =
248 return false; 248 wl_container_of(listener, xwayland_view, set_decorations);
249 } 249 struct sway_view *view = &xwayland_view->view;
250 struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface; 250 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
251 return surface->decorations != WLR_XWAYLAND_SURFACE_DECORATIONS_ALL; 251
252 bool csd = xsurface->decorations != WLR_XWAYLAND_SURFACE_DECORATIONS_ALL;
253 view_set_csd_from_client(view, csd);
252} 254}
253 255
254static void _close(struct sway_view *view) { 256static void _close(struct sway_view *view) {
@@ -274,7 +276,6 @@ static const struct sway_view_impl view_impl = {
274 .set_tiled = set_tiled, 276 .set_tiled = set_tiled,
275 .set_fullscreen = set_fullscreen, 277 .set_fullscreen = set_fullscreen,
276 .wants_floating = wants_floating, 278 .wants_floating = wants_floating,
277 .has_client_side_decorations = has_client_side_decorations,
278 .close = _close, 279 .close = _close,
279 .destroy = destroy, 280 .destroy = destroy,
280}; 281};
@@ -343,6 +344,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
343 wl_list_remove(&xwayland_view->set_role.link); 344 wl_list_remove(&xwayland_view->set_role.link);
344 wl_list_remove(&xwayland_view->set_window_type.link); 345 wl_list_remove(&xwayland_view->set_window_type.link);
345 wl_list_remove(&xwayland_view->set_hints.link); 346 wl_list_remove(&xwayland_view->set_hints.link);
347 wl_list_remove(&xwayland_view->set_decorations.link);
346 wl_list_remove(&xwayland_view->map.link); 348 wl_list_remove(&xwayland_view->map.link);
347 wl_list_remove(&xwayland_view->unmap.link); 349 wl_list_remove(&xwayland_view->unmap.link);
348 view_begin_destroy(&xwayland_view->view); 350 view_begin_destroy(&xwayland_view->view);
@@ -613,6 +615,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
613 wl_signal_add(&xsurface->events.set_hints, &xwayland_view->set_hints); 615 wl_signal_add(&xsurface->events.set_hints, &xwayland_view->set_hints);
614 xwayland_view->set_hints.notify = handle_set_hints; 616 xwayland_view->set_hints.notify = handle_set_hints;
615 617
618 wl_signal_add(&xsurface->events.set_decorations,
619 &xwayland_view->set_decorations);
620 xwayland_view->set_decorations.notify = handle_set_decorations;
621
616 wl_signal_add(&xsurface->events.unmap, &xwayland_view->unmap); 622 wl_signal_add(&xsurface->events.unmap, &xwayland_view->unmap);
617 xwayland_view->unmap.notify = handle_unmap; 623 xwayland_view->unmap.notify = handle_unmap;
618 624