mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-04-06 07:15:42 -04:00
cage: add -x flag to disable XWayland at runtime
Allows disabling XWayland support at runtime even when the binary was built with it.
This commit is contained in:
parent
71a33b0443
commit
a94cdbec67
2 changed files with 44 additions and 28 deletions
19
cage.c
19
cage.c
|
|
@ -248,6 +248,9 @@ usage(FILE *file, const char *cage)
|
||||||
" -m last Use only the last connected output\n"
|
" -m last Use only the last connected output\n"
|
||||||
" -s\t Allow VT switching\n"
|
" -s\t Allow VT switching\n"
|
||||||
" -v\t Show the version number and exit\n"
|
" -v\t Show the version number and exit\n"
|
||||||
|
#if CAGE_HAS_XWAYLAND
|
||||||
|
" -x\t Disable XWayland\n"
|
||||||
|
#endif
|
||||||
"\n"
|
"\n"
|
||||||
" Use -- when you want to pass arguments to APPLICATION\n",
|
" Use -- when you want to pass arguments to APPLICATION\n",
|
||||||
cage);
|
cage);
|
||||||
|
|
@ -256,8 +259,12 @@ usage(FILE *file, const char *cage)
|
||||||
static bool
|
static bool
|
||||||
parse_args(struct cg_server *server, int argc, char *argv[])
|
parse_args(struct cg_server *server, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
#if CAGE_HAS_XWAYLAND
|
||||||
|
server->enable_xwayland = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "dDhm:sv")) != -1) {
|
while ((c = getopt(argc, argv, "dDhm:svx")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'd':
|
case 'd':
|
||||||
server->xdg_decoration = true;
|
server->xdg_decoration = true;
|
||||||
|
|
@ -281,6 +288,11 @@ parse_args(struct cg_server *server, int argc, char *argv[])
|
||||||
case 'v':
|
case 'v':
|
||||||
fprintf(stdout, "Cage version " CAGE_VERSION "\n");
|
fprintf(stdout, "Cage version " CAGE_VERSION "\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
|
#if CAGE_HAS_XWAYLAND
|
||||||
|
case 'x':
|
||||||
|
server->enable_xwayland = false;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
usage(stderr, argv[0]);
|
usage(stderr, argv[0]);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -561,7 +573,9 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
#if CAGE_HAS_XWAYLAND
|
#if CAGE_HAS_XWAYLAND
|
||||||
struct wlr_xcursor_manager *xcursor_manager = NULL;
|
struct wlr_xcursor_manager *xcursor_manager = NULL;
|
||||||
struct wlr_xwayland *xwayland = wlr_xwayland_create(server.wl_display, compositor, true);
|
struct wlr_xwayland *xwayland = NULL;
|
||||||
|
if (server.enable_xwayland) {
|
||||||
|
xwayland = wlr_xwayland_create(server.wl_display, compositor, true);
|
||||||
if (!xwayland) {
|
if (!xwayland) {
|
||||||
wlr_log(WLR_ERROR, "Cannot create XWayland server");
|
wlr_log(WLR_ERROR, "Cannot create XWayland server");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -592,6 +606,7 @@ main(int argc, char *argv[])
|
||||||
image->hotspot_y);
|
image->hotspot_y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *socket = wl_display_add_socket_auto(server.wl_display);
|
const char *socket = wl_display_add_socket_auto(server.wl_display);
|
||||||
|
|
|
||||||
1
server.h
1
server.h
|
|
@ -72,6 +72,7 @@ struct cg_server {
|
||||||
|
|
||||||
bool xdg_decoration;
|
bool xdg_decoration;
|
||||||
bool allow_vt_switch;
|
bool allow_vt_switch;
|
||||||
|
bool enable_xwayland;
|
||||||
bool return_app_code;
|
bool return_app_code;
|
||||||
bool terminated;
|
bool terminated;
|
||||||
enum wlr_log_importance log_level;
|
enum wlr_log_importance log_level;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue