xwayland: Add an option to enable EI portal support
With EI support wired to XTEST, and oeffis being enabled unconditionally
means that Xwayland will always go through the XDG portal for XTEST when
supported.
While this the intended behavior for the general use case of Xwayland
running rootless on a desktop compositor, that breaks when Xwayland is
running on a nested compositor, because the portal is for the entire
session and not limited to the nested Wayland compositor.
Xwayland itself, as a regular Wayland client, has no way to tell that it
is running on a nested compositor.
So to keep backward compatibility with existing (and also common) use
cases such as nested compositors, best is to disable support for the XDG
portal by default, and add a new command line option "-enable-ei-portal"
for the Wayland compositors (who spawn Xwayland rootless) to explicitly
enable support for the input emulation XDG portal in Xwayland.
A Wayland compositor running nested should not use that command line
option with Xwayland.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Joshua Ashton <joshua@froggi.es>
Fixes: a1333342
- xwayland: Add XTEST support using EIS
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1586
See-also: https://gitlab.gnome.org/GNOME/mutter/-/issues/3047
This commit is contained in:
parent
287638db59
commit
cfcbb075c2
|
@ -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
|
by the Wayland server. Without this option, \fIXwayland\fP tries the GBM
|
||||||
backend first, and fallback to EGLStream if GBM is not usable.
|
backend first, and fallback to EGLStream if GBM is not usable.
|
||||||
.TP 8
|
.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
|
.B \-fullscreen
|
||||||
Set the Xwayland window fullscreen when running rootful.
|
Set the Xwayland window fullscreen when running rootful.
|
||||||
|
|
||||||
|
|
|
@ -186,6 +186,7 @@ xwayland_vars = [
|
||||||
'have_fullscreen=true',
|
'have_fullscreen=true',
|
||||||
'have_host_grab=true',
|
'have_host_grab=true',
|
||||||
'have_decorate=' + have_libdecor.to_string(),
|
'have_decorate=' + have_libdecor.to_string(),
|
||||||
|
'have_enable_ei_portal=' + build_ei_portal.to_string(),
|
||||||
'have_byteswappedclients=true',
|
'have_byteswappedclients=true',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -812,6 +812,13 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
|
||||||
use_fixed_size = 1;
|
use_fixed_size = 1;
|
||||||
#else
|
#else
|
||||||
ErrorF("This build does not have libdecor support\n");
|
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
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ struct xwl_screen {
|
||||||
int host_grab;
|
int host_grab;
|
||||||
int has_grab;
|
int has_grab;
|
||||||
int decorate;
|
int decorate;
|
||||||
|
int enable_ei_portal;
|
||||||
|
|
||||||
CreateScreenResourcesProcPtr CreateScreenResources;
|
CreateScreenResourcesProcPtr CreateScreenResources;
|
||||||
CloseScreenProcPtr CloseScreen;
|
CloseScreenProcPtr CloseScreen;
|
||||||
|
|
|
@ -334,12 +334,14 @@ setup_ei_from_socket(struct xwl_ei_client *xwl_ei_client)
|
||||||
static struct xwl_ei_client *
|
static struct xwl_ei_client *
|
||||||
setup_ei(ClientPtr client)
|
setup_ei(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
ScreenPtr pScreen = screenInfo.screens[0];
|
||||||
struct xwl_ei_client *xwl_ei_client = NULL;
|
struct xwl_ei_client *xwl_ei_client = NULL;
|
||||||
|
struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
|
||||||
struct ei *ei = NULL;
|
struct ei *ei = NULL;
|
||||||
char buffer[PATH_MAX];
|
char buffer[PATH_MAX];
|
||||||
const char *cmdname;
|
const char *cmdname;
|
||||||
char *client_name = NULL;
|
char *client_name = NULL;
|
||||||
bool status;
|
bool status = false;
|
||||||
|
|
||||||
cmdname = GetClientCmdName(client);
|
cmdname = GetClientCmdName(client);
|
||||||
if (cmdname) {
|
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->pending_emulated_events);
|
||||||
xorg_list_init(&xwl_ei_client->abs_devices);
|
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)
|
if (!status)
|
||||||
status = setup_ei_from_socket(xwl_ei_client);
|
status = setup_ei_from_socket(xwl_ei_client);
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,9 @@ ddxUseMsg(void)
|
||||||
#ifdef XWL_HAS_LIBDECOR
|
#ifdef XWL_HAS_LIBDECOR
|
||||||
ErrorF("-decorate add decorations to Xwayland when rootful\n");
|
ErrorF("-decorate add decorations to Xwayland when rootful\n");
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef XWL_HAS_EI_PORTAL
|
||||||
|
ErrorF("-enable-ei-portal use the XDG portal for input emulation\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_fd = -1;
|
static int init_fd = -1;
|
||||||
|
@ -246,6 +249,9 @@ ddxProcessArgument(int argc, char *argv[], int i)
|
||||||
else if (strcmp(argv[i], "-decorate") == 0) {
|
else if (strcmp(argv[i], "-decorate") == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(argv[i], "-enable-ei-portal") == 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue