mirror of
https://github.com/swaywm/sway.git
synced 2025-11-07 13:29:56 -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
|
|
@ -7,6 +7,17 @@
|
|||
#include "sway/tree/container.h"
|
||||
#include "sway/tree/view.h"
|
||||
|
||||
static void set_border(struct sway_view *view,
|
||||
enum sway_container_border new_border) {
|
||||
if (view->border == B_CSD && new_border != B_CSD) {
|
||||
view_set_csd_from_server(view, false);
|
||||
} else if (view->border != B_CSD && new_border == B_CSD) {
|
||||
view_set_csd_from_server(view, true);
|
||||
}
|
||||
view->saved_border = view->border;
|
||||
view->border = new_border;
|
||||
}
|
||||
|
||||
struct cmd_results *cmd_border(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "border", EXPECTED_AT_LEAST, 1))) {
|
||||
|
|
@ -21,13 +32,15 @@ struct cmd_results *cmd_border(int argc, char **argv) {
|
|||
struct sway_view *view = container->view;
|
||||
|
||||
if (strcmp(argv[0], "none") == 0) {
|
||||
view->border = B_NONE;
|
||||
set_border(view, B_NONE);
|
||||
} else if (strcmp(argv[0], "normal") == 0) {
|
||||
view->border = B_NORMAL;
|
||||
set_border(view, B_NORMAL);
|
||||
} else if (strcmp(argv[0], "pixel") == 0) {
|
||||
view->border = B_PIXEL;
|
||||
set_border(view, B_PIXEL);
|
||||
} else if (strcmp(argv[0], "csd") == 0) {
|
||||
set_border(view, B_CSD);
|
||||
} else if (strcmp(argv[0], "toggle") == 0) {
|
||||
view->border = (view->border + 1) % 3;
|
||||
set_border(view, (view->border + 1) % 4);
|
||||
} else {
|
||||
return cmd_results_new(CMD_INVALID, "border",
|
||||
"Expected 'border <none|normal|pixel|toggle>' "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue