diff --git a/hw/xwayland/man/Xwayland.man b/hw/xwayland/man/Xwayland.man index 02b333be9..9ecb65001 100644 --- a/hw/xwayland/man/Xwayland.man +++ b/hw/xwayland/man/Xwayland.man @@ -61,6 +61,15 @@ backend first, then fallback to the GBM backend if EGLStream is not supported by the Wayland server. Without this option, \fIXwayland\fP tries the GBM backend first, and fallback to EGLStream if GBM is not usable. .TP 8 +.B \-enable-ei-portal +Enable support for the XDG portal for input emulation. + +A Wayland compositor running nested should not use that command line +option with Xwayland. + +This option has no effect if the compositor doesn't support the relevant +XDG portal or if Xwayland was not compiled with EI and OEFFIS support. +.TP 8 .B \-fullscreen Set the Xwayland window fullscreen when running rootful. diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build index f2038ab7c..54529b64e 100644 --- a/hw/xwayland/meson.build +++ b/hw/xwayland/meson.build @@ -186,6 +186,7 @@ xwayland_vars = [ 'have_fullscreen=true', 'have_host_grab=true', 'have_decorate=' + have_libdecor.to_string(), + 'have_enable_ei_portal=' + build_ei_portal.to_string(), 'have_byteswappedclients=true', ] diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c index c00f976a8..cc14e0771 100644 --- a/hw/xwayland/xwayland-screen.c +++ b/hw/xwayland/xwayland-screen.c @@ -812,6 +812,13 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) use_fixed_size = 1; #else ErrorF("This build does not have libdecor support\n"); +#endif + } + else if (strcmp(argv[i], "-enable-ei-portal") == 0) { +#ifdef XWL_HAS_EI_PORTAL + xwl_screen->enable_ei_portal = 1; +#else + ErrorF("This build does not have XDG portal support\n"); #endif } } diff --git a/hw/xwayland/xwayland-screen.h b/hw/xwayland/xwayland-screen.h index 94033aabf..bd66dd681 100644 --- a/hw/xwayland/xwayland-screen.h +++ b/hw/xwayland/xwayland-screen.h @@ -67,6 +67,7 @@ struct xwl_screen { int host_grab; int has_grab; int decorate; + int enable_ei_portal; CreateScreenResourcesProcPtr CreateScreenResources; CloseScreenProcPtr CloseScreen; diff --git a/hw/xwayland/xwayland-xtest.c b/hw/xwayland/xwayland-xtest.c index 333013cea..74778ce8b 100644 --- a/hw/xwayland/xwayland-xtest.c +++ b/hw/xwayland/xwayland-xtest.c @@ -334,12 +334,14 @@ setup_ei_from_socket(struct xwl_ei_client *xwl_ei_client) static struct xwl_ei_client * setup_ei(ClientPtr client) { + ScreenPtr pScreen = screenInfo.screens[0]; struct xwl_ei_client *xwl_ei_client = NULL; + struct xwl_screen *xwl_screen = xwl_screen_get(pScreen); struct ei *ei = NULL; char buffer[PATH_MAX]; const char *cmdname; char *client_name = NULL; - bool status; + bool status = false; cmdname = GetClientCmdName(client); if (cmdname) { @@ -375,7 +377,8 @@ setup_ei(ClientPtr client) xorg_list_init(&xwl_ei_client->pending_emulated_events); xorg_list_init(&xwl_ei_client->abs_devices); - status = setup_oeffis(xwl_ei_client); + if (xwl_screen->enable_ei_portal) + status = setup_oeffis(xwl_ei_client); if (!status) status = setup_ei_from_socket(xwl_ei_client); diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c index 672dc3168..3f9c5c269 100644 --- a/hw/xwayland/xwayland.c +++ b/hw/xwayland/xwayland.c @@ -109,6 +109,9 @@ ddxUseMsg(void) #ifdef XWL_HAS_LIBDECOR ErrorF("-decorate add decorations to Xwayland when rootful\n"); #endif +#ifdef XWL_HAS_EI_PORTAL + ErrorF("-enable-ei-portal use the XDG portal for input emulation\n"); +#endif } static int init_fd = -1; @@ -246,6 +249,9 @@ ddxProcessArgument(int argc, char *argv[], int i) else if (strcmp(argv[i], "-decorate") == 0) { return 1; } + else if (strcmp(argv[i], "-enable-ei-portal") == 0) { + return 1; + } return 0; }