mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-04-07 08:21:27 -04:00
Merge a94cdbec67 into 94904c714d
This commit is contained in:
commit
d4f238ccc8
4 changed files with 51 additions and 29 deletions
71
cage.c
71
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;
|
||||||
|
|
@ -562,35 +574,38 @@ 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 (!xwayland) {
|
if (server.enable_xwayland) {
|
||||||
wlr_log(WLR_ERROR, "Cannot create XWayland server");
|
xwayland = wlr_xwayland_create(server.wl_display, compositor, true);
|
||||||
} else {
|
if (!xwayland) {
|
||||||
server.new_xwayland_surface.notify = handle_xwayland_surface_new;
|
wlr_log(WLR_ERROR, "Cannot create XWayland server");
|
||||||
wl_signal_add(&xwayland->events.new_surface, &server.new_xwayland_surface);
|
|
||||||
|
|
||||||
xcursor_manager = wlr_xcursor_manager_create(DEFAULT_XCURSOR, XCURSOR_SIZE);
|
|
||||||
if (!xcursor_manager) {
|
|
||||||
wlr_log(WLR_ERROR, "Cannot create XWayland XCursor manager");
|
|
||||||
ret = 1;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (setenv("DISPLAY", xwayland->display_name, true) < 0) {
|
|
||||||
wlr_log_errno(WLR_ERROR,
|
|
||||||
"Unable to set DISPLAY for XWayland. Clients may not be able to connect");
|
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_DEBUG, "XWayland is running on display %s", xwayland->display_name);
|
server.new_xwayland_surface.notify = handle_xwayland_surface_new;
|
||||||
}
|
wl_signal_add(&xwayland->events.new_surface, &server.new_xwayland_surface);
|
||||||
|
|
||||||
if (!wlr_xcursor_manager_load(xcursor_manager, 1)) {
|
xcursor_manager = wlr_xcursor_manager_create(DEFAULT_XCURSOR, XCURSOR_SIZE);
|
||||||
wlr_log(WLR_ERROR, "Cannot load XWayland XCursor theme");
|
if (!xcursor_manager) {
|
||||||
}
|
wlr_log(WLR_ERROR, "Cannot create XWayland XCursor manager");
|
||||||
struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(xcursor_manager, DEFAULT_XCURSOR, 1);
|
ret = 1;
|
||||||
if (xcursor) {
|
goto end;
|
||||||
struct wlr_xcursor_image *image = xcursor->images[0];
|
}
|
||||||
wlr_xwayland_set_cursor(xwayland, wlr_xcursor_image_get_buffer(image), image->hotspot_x,
|
|
||||||
image->hotspot_y);
|
if (setenv("DISPLAY", xwayland->display_name, true) < 0) {
|
||||||
|
wlr_log_errno(WLR_ERROR,
|
||||||
|
"Unable to set DISPLAY for XWayland. Clients may not be able to connect");
|
||||||
|
} else {
|
||||||
|
wlr_log(WLR_DEBUG, "XWayland is running on display %s", xwayland->display_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!wlr_xcursor_manager_load(xcursor_manager, 1)) {
|
||||||
|
wlr_log(WLR_ERROR, "Cannot load XWayland XCursor theme");
|
||||||
|
}
|
||||||
|
struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(xcursor_manager, DEFAULT_XCURSOR, 1);
|
||||||
|
if (xcursor) {
|
||||||
|
struct wlr_xcursor_image *image = xcursor->images[0];
|
||||||
|
wlr_xwayland_set_cursor(xwayland, wlr_xcursor_image_get_buffer(image), image->hotspot_x,
|
||||||
|
image->hotspot_y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,12 @@ wayland_server = dependency('wayland-server')
|
||||||
xkbcommon = dependency('xkbcommon')
|
xkbcommon = dependency('xkbcommon')
|
||||||
math = cc.find_library('m')
|
math = cc.find_library('m')
|
||||||
|
|
||||||
have_xwayland = wlroots.get_variable(pkgconfig: 'have_xwayland', internal: 'have_xwayland') == 'true'
|
xwayland_opt = get_option('xwayland')
|
||||||
|
_wlroots_has_xwayland = wlroots.get_variable(pkgconfig: 'have_xwayland', internal: 'have_xwayland') == 'true'
|
||||||
|
if xwayland_opt.enabled() and not _wlroots_has_xwayland
|
||||||
|
error('wlroots was built without XWayland support')
|
||||||
|
endif
|
||||||
|
have_xwayland = _wlroots_has_xwayland and not xwayland_opt.disabled()
|
||||||
|
|
||||||
version = '@0@'.format(meson.project_version())
|
version = '@0@'.format(meson.project_version())
|
||||||
git = find_program('git', native: true, required: false)
|
git = find_program('git', native: true, required: false)
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
|
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
|
||||||
|
option('xwayland', type: 'feature', value: 'auto', description: 'Enable XWayland support')
|
||||||
|
|
|
||||||
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