mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
rcxml: s/csd/xdg_shell_server_side_deco
This commit is contained in:
parent
090e78b85a
commit
35ff6e5bb0
11 changed files with 27 additions and 21 deletions
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
<!-- labwc specific settings - additional to openbox -->
|
<!-- labwc specific settings - additional to openbox -->
|
||||||
<lab>
|
<lab>
|
||||||
<!-- Use client-side decorations for xdg-shell views -->
|
<!-- Use server-side decorations for xdg-shell views where CSD can be disabled -->
|
||||||
<csd>no</csd>
|
<xdg_shell_server_side_deco>yes</xdg_shell_server_side_deco>
|
||||||
|
|
||||||
<!-- See xkeyboard-config(7) for details on these keyboard settings -->
|
<!-- See xkeyboard-config(7) for details on these keyboard settings -->
|
||||||
<keyboard>
|
<keyboard>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
% labwc-config(5)
|
% labwc-config(5)
|
||||||
% Johan Malm
|
% Johan Malm
|
||||||
% 31 Aug, 2020
|
% 15 Sept, 2020
|
||||||
|
|
||||||
# NAME
|
# NAME
|
||||||
|
|
||||||
|
|
@ -22,15 +22,16 @@ be searched for in the following order:
|
||||||
Labwc specific settings which are not present in Openbox.
|
Labwc specific settings which are not present in Openbox.
|
||||||
|
|
||||||
<lab>
|
<lab>
|
||||||
<csd></csd>
|
<xdg_shell_server_side_deco></xdg_shell_server_side_deco>
|
||||||
<keyboard>
|
<keyboard>
|
||||||
<layout></layout>
|
<layout></layout>
|
||||||
</keyboard>
|
</keyboard>
|
||||||
</lab>
|
</lab>
|
||||||
|
|
||||||
`csd` (__boolean__; default no)
|
`xdg_shell_server_side_deco` (__boolean__; default yes)
|
||||||
|
|
||||||
: Use client-side decorations for xdg-shell views.
|
: Use server-side decorations for xdg-shell views where it is possible to
|
||||||
|
turn of CSD
|
||||||
|
|
||||||
`keyboard-layout` (__string__; not set by default)
|
`keyboard-layout` (__string__; not set by default)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include "common/buf.h"
|
#include "common/buf.h"
|
||||||
|
|
||||||
struct rcxml {
|
struct rcxml {
|
||||||
bool client_side_decorations;
|
bool xdg_shell_server_side_deco;
|
||||||
char *theme_name;
|
char *theme_name;
|
||||||
char *font_name_activewindow;
|
char *font_name_activewindow;
|
||||||
int font_size_activewindow;
|
int font_size_activewindow;
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ struct view {
|
||||||
|
|
||||||
int xdg_grab_offset;
|
int xdg_grab_offset;
|
||||||
|
|
||||||
bool show_server_side_deco;
|
bool server_side_deco;
|
||||||
|
|
||||||
struct wl_listener map;
|
struct wl_listener map;
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
|
|
|
||||||
|
|
@ -120,8 +120,8 @@ static void entry(xmlNode *node, char *nodename, char *content)
|
||||||
if (is_attribute && !strcmp(nodename, "place.font.theme"))
|
if (is_attribute && !strcmp(nodename, "place.font.theme"))
|
||||||
font_place = enum_font_place(content);
|
font_place = enum_font_place(content);
|
||||||
|
|
||||||
if (!strcmp(nodename, "csd.lab"))
|
if (!strcmp(nodename, "xdg_shell_server_side_deco.lab"))
|
||||||
rc.client_side_decorations = get_bool(content);
|
rc.xdg_shell_server_side_deco = get_bool(content);
|
||||||
else if (!strcmp(nodename, "layout.keyboard.lab"))
|
else if (!strcmp(nodename, "layout.keyboard.lab"))
|
||||||
setenv("XKB_DEFAULT_LAYOUT", content, 1);
|
setenv("XKB_DEFAULT_LAYOUT", content, 1);
|
||||||
else if (!strcmp(nodename, "name.theme"))
|
else if (!strcmp(nodename, "name.theme"))
|
||||||
|
|
@ -240,6 +240,12 @@ static void set_title_height(void)
|
||||||
rc.title_height = font_height(buf);
|
rc.title_height = font_height(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pre_processing(void)
|
||||||
|
{
|
||||||
|
rc.xdg_shell_server_side_deco = true;
|
||||||
|
rc.font_size_activewindow = 8;
|
||||||
|
}
|
||||||
|
|
||||||
static void post_processing(void)
|
static void post_processing(void)
|
||||||
{
|
{
|
||||||
if (!wl_list_length(&rc.keybinds)) {
|
if (!wl_list_length(&rc.keybinds)) {
|
||||||
|
|
@ -255,8 +261,6 @@ static void post_processing(void)
|
||||||
if (!rc.font_name_activewindow)
|
if (!rc.font_name_activewindow)
|
||||||
rc.font_name_activewindow = strdup("sans");
|
rc.font_name_activewindow = strdup("sans");
|
||||||
|
|
||||||
if (!rc.font_size_activewindow)
|
|
||||||
rc.font_size_activewindow = 8;
|
|
||||||
set_title_height();
|
set_title_height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -277,6 +281,7 @@ void rcxml_read(const char *filename)
|
||||||
|
|
||||||
rcxml_init();
|
rcxml_init();
|
||||||
wl_list_init(&rc.keybinds);
|
wl_list_init(&rc.keybinds);
|
||||||
|
pre_processing();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reading file into buffer before parsing makes it easier to write
|
* Reading file into buffer before parsing makes it easier to write
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ struct view *desktop_view_at(struct server *server, double lx, double ly,
|
||||||
continue;
|
continue;
|
||||||
if (_view_at(view, lx, ly, surface, sx, sy))
|
if (_view_at(view, lx, ly, surface, sx, sy))
|
||||||
return view;
|
return view;
|
||||||
if (!view->show_server_side_deco)
|
if (!view->server_side_deco)
|
||||||
continue;
|
continue;
|
||||||
*view_area = deco_at(view, lx, ly);
|
*view_area = deco_at(view, lx, ly);
|
||||||
if (*view_area != LAB_DECO_NONE)
|
if (*view_area != LAB_DECO_NONE)
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ static void render_icon(struct draw_data *d, struct wlr_box box,
|
||||||
|
|
||||||
static void render_decorations(struct wlr_output *output, struct view *view)
|
static void render_decorations(struct wlr_output *output, struct view *view)
|
||||||
{
|
{
|
||||||
if (!view->show_server_side_deco)
|
if (!view->server_side_deco)
|
||||||
return;
|
return;
|
||||||
struct draw_data ddata = {
|
struct draw_data ddata = {
|
||||||
.renderer = view->server->renderer,
|
.renderer = view->server->renderer,
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ void server_init(struct server *server)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
wlr_server_decoration_manager_set_default_mode(
|
wlr_server_decoration_manager_set_default_mode(
|
||||||
deco_mgr, !rc.client_side_decorations ?
|
deco_mgr, rc.xdg_shell_server_side_deco ?
|
||||||
WLR_SERVER_DECORATION_MANAGER_MODE_SERVER :
|
WLR_SERVER_DECORATION_MANAGER_MODE_SERVER :
|
||||||
WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT);
|
WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ static void xdg_deco_request_mode(struct wl_listener *listener, void *data)
|
||||||
struct xdg_deco *xdg_deco;
|
struct xdg_deco *xdg_deco;
|
||||||
xdg_deco = wl_container_of(listener, xdg_deco, request_mode);
|
xdg_deco = wl_container_of(listener, xdg_deco, request_mode);
|
||||||
enum wlr_xdg_toplevel_decoration_v1_mode mode;
|
enum wlr_xdg_toplevel_decoration_v1_mode mode;
|
||||||
if (!rc.client_side_decorations)
|
if (rc.xdg_shell_server_side_deco)
|
||||||
mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
|
mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
|
||||||
else
|
else
|
||||||
mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
|
mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
|
||||||
|
|
@ -50,7 +50,7 @@ void xdg_toplevel_decoration(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
static bool has_ssd(struct view *view)
|
static bool has_ssd(struct view *view)
|
||||||
{
|
{
|
||||||
if (rc.client_side_decorations)
|
if (!rc.xdg_shell_server_side_deco)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -147,8 +147,8 @@ static void xdg_toplevel_view_map(struct view *view)
|
||||||
view->mapped = true;
|
view->mapped = true;
|
||||||
view->surface = view->xdg_surface->surface;
|
view->surface = view->xdg_surface->surface;
|
||||||
if (!view->been_mapped) {
|
if (!view->been_mapped) {
|
||||||
view->show_server_side_deco = has_ssd(view);
|
view->server_side_deco = has_ssd(view);
|
||||||
if (view->show_server_side_deco) {
|
if (view->server_side_deco) {
|
||||||
view->margin = deco_max_extents(view);
|
view->margin = deco_max_extents(view);
|
||||||
} else {
|
} else {
|
||||||
view->margin = xdg_shell_border(view);
|
view->margin = xdg_shell_border(view);
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ static void map(struct view *view)
|
||||||
view->w = view->xwayland_surface->width;
|
view->w = view->xwayland_surface->width;
|
||||||
view->h = view->xwayland_surface->height;
|
view->h = view->xwayland_surface->height;
|
||||||
view->surface = view->xwayland_surface->surface;
|
view->surface = view->xwayland_surface->surface;
|
||||||
view->show_server_side_deco = want_deco(view);
|
view->server_side_deco = want_deco(view);
|
||||||
|
|
||||||
view->margin = deco_max_extents(view);
|
view->margin = deco_max_extents(view);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ int main(int argc, char **argv)
|
||||||
unlink(template);
|
unlink(template);
|
||||||
|
|
||||||
diag("Simple parse rc.xml");
|
diag("Simple parse rc.xml");
|
||||||
ok1(rc.client_side_decorations);
|
ok1(rc.xdg_shell_server_side_deco);
|
||||||
|
|
||||||
rcxml_finish();
|
rcxml_finish();
|
||||||
pango_cairo_font_map_set_default(NULL);
|
pango_cairo_font_map_set_default(NULL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue