xwayland: allow persistence

Closes: #1958.
This commit is contained in:
Andrew J. Hesford 2024-07-03 13:43:04 -04:00 committed by Consolatis
parent 370d62beda
commit 9153c22dab
5 changed files with 14 additions and 1 deletions

View file

@ -194,6 +194,13 @@ this is for compatibility with Openbox.
be used with labwc the preferred mode of the monitor is used instead. be used with labwc the preferred mode of the monitor is used instead.
Default is no. Default is no.
*<core><xwaylandPersistence>* [yes|no]
Keep XWayland alive even when no clients are connected, rather than
using a "lazy" policy that allows the server to launch on demand and die
when it is no longer needed. Default is no.
Note: changing this setting requires a restart of labwc.
## PLACEMENT ## PLACEMENT
*<placement><policy>* [center|automatic|cursor] *<placement><policy>* [center|automatic|cursor]

View file

@ -13,6 +13,7 @@
<adaptiveSync>no</adaptiveSync> <adaptiveSync>no</adaptiveSync>
<allowTearing>no</allowTearing> <allowTearing>no</allowTearing>
<reuseOutputMode>no</reuseOutputMode> <reuseOutputMode>no</reuseOutputMode>
<xwaylandPersistence>no</xwaylandPersistence>
</core> </core>
<placement> <placement>

View file

@ -55,6 +55,7 @@ struct rcxml {
bool allow_tearing; bool allow_tearing;
bool reuse_output_mode; bool reuse_output_mode;
enum view_placement_policy placement_policy; enum view_placement_policy placement_policy;
bool xwayland_persistence;
/* focus */ /* focus */
bool focus_follow_mouse; bool focus_follow_mouse;

View file

@ -899,6 +899,8 @@ entry(xmlNode *node, char *nodename, char *content)
if (rc.placement_policy == LAB_PLACE_INVALID) { if (rc.placement_policy == LAB_PLACE_INVALID) {
rc.placement_policy = LAB_PLACE_CENTER; rc.placement_policy = LAB_PLACE_CENTER;
} }
} else if (!strcasecmp(nodename, "xwaylandPersistence.core")) {
set_bool(content, &rc.xwayland_persistence);
} else if (!strcmp(nodename, "name.theme")) { } else if (!strcmp(nodename, "name.theme")) {
rc.theme_name = xstrdup(content); rc.theme_name = xstrdup(content);
} else if (!strcmp(nodename, "cornerradius.theme")) { } else if (!strcmp(nodename, "cornerradius.theme")) {

View file

@ -6,6 +6,7 @@
#include "common/array.h" #include "common/array.h"
#include "common/macros.h" #include "common/macros.h"
#include "common/mem.h" #include "common/mem.h"
#include "config/rcxml.h"
#include "labwc.h" #include "labwc.h"
#include "node.h" #include "node.h"
#include "ssd.h" #include "ssd.h"
@ -1052,7 +1053,8 @@ void
xwayland_server_init(struct server *server, struct wlr_compositor *compositor) xwayland_server_init(struct server *server, struct wlr_compositor *compositor)
{ {
server->xwayland = server->xwayland =
wlr_xwayland_create(server->wl_display, compositor, true); wlr_xwayland_create(server->wl_display,
compositor, /* lazy */ !rc.xwayland_persistence);
if (!server->xwayland) { if (!server->xwayland) {
wlr_log(WLR_ERROR, "cannot create xwayland server"); wlr_log(WLR_ERROR, "cannot create xwayland server");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);