mirror of
https://github.com/swaywm/sway.git
synced 2025-11-25 06:59:48 -05:00
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.
This commit is contained in:
parent
58af001517
commit
7b138e5ef0
18 changed files with 251 additions and 141 deletions
|
|
@ -175,15 +175,6 @@ static bool wants_floating(struct sway_view *view) {
|
|||
|| toplevel->parent;
|
||||
}
|
||||
|
||||
static bool has_client_side_decorations(struct sway_view *view) {
|
||||
struct sway_xdg_shell_view *xdg_shell_view =
|
||||
xdg_shell_view_from_view(view);
|
||||
if (xdg_shell_view == NULL) {
|
||||
return true;
|
||||
}
|
||||
return xdg_shell_view->deco_mode != WLR_SERVER_DECORATION_MANAGER_MODE_SERVER;
|
||||
}
|
||||
|
||||
static void for_each_surface(struct sway_view *view,
|
||||
wlr_surface_iterator_func_t iterator, void *user_data) {
|
||||
if (xdg_shell_view_from_view(view) == NULL) {
|
||||
|
|
@ -240,7 +231,6 @@ static const struct sway_view_impl view_impl = {
|
|||
.set_tiled = set_tiled,
|
||||
.set_fullscreen = set_fullscreen,
|
||||
.wants_floating = wants_floating,
|
||||
.has_client_side_decorations = has_client_side_decorations,
|
||||
.for_each_surface = for_each_surface,
|
||||
.for_each_popup = for_each_popup,
|
||||
.close = _close,
|
||||
|
|
@ -385,15 +375,13 @@ static void handle_map(struct wl_listener *listener, void *data) {
|
|||
view->natural_height = view->wlr_xdg_surface->surface->current.height;
|
||||
}
|
||||
|
||||
view_map(view, view->wlr_xdg_surface->surface);
|
||||
|
||||
struct sway_server_decoration *deco =
|
||||
decoration_from_surface(xdg_surface->surface);
|
||||
if (deco != NULL) {
|
||||
xdg_shell_view->deco_mode = deco->wlr_server_decoration->mode;
|
||||
} else {
|
||||
xdg_shell_view->deco_mode = WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT;
|
||||
}
|
||||
|
||||
view_map(view, view->wlr_xdg_surface->surface);
|
||||
bool csd = !deco || deco->wlr_server_decoration->mode ==
|
||||
WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT;
|
||||
view_set_csd_from_client(view, csd);
|
||||
|
||||
if (xdg_surface->toplevel->client_pending.fullscreen) {
|
||||
container_set_fullscreen(view->container, true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue