mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-03-30 04:50:39 +02:00
Merge branch 'xwayland-disable-indirect-glx' into 'main'
xwayland: Refuse to start with indirect GLX enabled See merge request xorg/xserver!1745
This commit is contained in:
commit
a42a6dc71d
3 changed files with 68 additions and 23 deletions
|
|
@ -864,6 +864,67 @@ xwl_screen_update_global_surface_scale(struct xwl_screen *xwl_screen)
|
|||
return (xwl_screen->global_surface_scale != old_scale);
|
||||
}
|
||||
|
||||
Bool
|
||||
xwl_screen_validate_options(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int width, height;
|
||||
Bool use_fixed_size = FALSE;
|
||||
Bool fullscreen = FALSE;
|
||||
Bool decorate = FALSE;
|
||||
Bool host_grab = FALSE;
|
||||
Bool rootless = FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-geometry") == 0) {
|
||||
sscanf(argv[i + 1], "%ix%i", &width, &height);
|
||||
if (width == 0 || height == 0) {
|
||||
ErrorF("Invalid argument, '-geometry %s'\n", argv[i + 1]);
|
||||
return FALSE;
|
||||
}
|
||||
use_fixed_size = TRUE;
|
||||
}
|
||||
else if (strcmp(argv[i], "-fullscreen") == 0) {
|
||||
fullscreen = TRUE;
|
||||
}
|
||||
else if (strcmp(argv[i], "-decorate") == 0) {
|
||||
decorate = TRUE;
|
||||
}
|
||||
else if (strcmp(argv[i], "-host-grab") == 0) {
|
||||
host_grab = TRUE;
|
||||
}
|
||||
else if (strcmp(argv[i], "-rootless") == 0) {
|
||||
rootless = TRUE;
|
||||
}
|
||||
else if (strcmp(argv[i], "+iglx") == 0) {
|
||||
ErrorF("Invalid argument, '+iglx' (indirect GLX context) is not supported\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (rootless && use_fixed_size) {
|
||||
ErrorF("Invalid argument, cannot set '-geometry' with '-rootless'\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (fullscreen && rootless) {
|
||||
ErrorF("Invalid argument, cannot set '-fullscreen' with '-rootless'\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (fullscreen && decorate) {
|
||||
ErrorF("Invalid argument, cannot use '-decorate' with '-fullscreen'\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (host_grab && rootless) {
|
||||
ErrorF("Invalid argument, cannot use '-host-grab' with '-rootless'\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
|
||||
{
|
||||
|
|
@ -934,7 +995,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
|
|||
else if (strncmp(argv[i + 1], "off", 3) == 0)
|
||||
xwl_screen->glamor = XWL_GLAMOR_NONE;
|
||||
else
|
||||
ErrorF("Xwayland glamor: unknown rendering API selected\n");
|
||||
ErrorF("glamor: ignoring unknown rendering API selected\n");
|
||||
}
|
||||
#endif
|
||||
else if (strcmp(argv[i], "-force-xrandr-emulation") == 0) {
|
||||
|
|
@ -942,10 +1003,6 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
|
|||
}
|
||||
else if (strcmp(argv[i], "-geometry") == 0) {
|
||||
sscanf(argv[i + 1], "%ix%i", &xwl_width, &xwl_height);
|
||||
if (xwl_width == 0 || xwl_height == 0) {
|
||||
ErrorF("invalid argument for -geometry %s\n", argv[i + 1]);
|
||||
return FALSE;
|
||||
}
|
||||
use_fixed_size = 1;
|
||||
}
|
||||
else if (strcmp(argv[i], "-fullscreen") == 0) {
|
||||
|
|
@ -986,9 +1043,6 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
|
|||
use_fixed_size = 1;
|
||||
xwl_screen->width = xwl_width;
|
||||
xwl_screen->height = xwl_height;
|
||||
} else if (use_fixed_size) {
|
||||
ErrorF("error, cannot set a geometry when running rootless\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
xwl_screen->display = wl_display_connect(NULL);
|
||||
|
|
@ -1039,26 +1093,11 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
|
|||
®istry_listener, xwl_screen);
|
||||
xwl_screen_roundtrip(xwl_screen);
|
||||
|
||||
if (xwl_screen->fullscreen && xwl_screen->rootless) {
|
||||
ErrorF("error, cannot set fullscreen when running rootless\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (xwl_screen->fullscreen && xwl_screen->decorate) {
|
||||
ErrorF("error, cannot use the decorate option when running fullscreen\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (xwl_screen->fullscreen && !xwl_screen_has_viewport_support(xwl_screen)) {
|
||||
ErrorF("missing viewport support in the compositor, ignoring fullscreen\n");
|
||||
xwl_screen->fullscreen = FALSE;
|
||||
}
|
||||
|
||||
if (xwl_screen->host_grab && xwl_screen->rootless) {
|
||||
ErrorF("error, cannot use host grab when running rootless\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!xwl_screen->rootless && !xwl_screen->xdg_wm_base) {
|
||||
ErrorF("missing XDG-WM-Base protocol\n");
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ int xwl_screen_get_width(struct xwl_screen *xwl_screen);
|
|||
int xwl_screen_get_height(struct xwl_screen *xwl_screen);
|
||||
|
||||
Bool xwl_close_screen(ScreenPtr screen);
|
||||
Bool xwl_screen_verify_command_line(int argc, char **argv);
|
||||
Bool xwl_screen_init(ScreenPtr pScreen, int argc, char **argv);
|
||||
void xwl_sync_events (struct xwl_screen *xwl_screen);
|
||||
void xwl_screen_roundtrip (struct xwl_screen *xwl_screen);
|
||||
|
|
@ -183,5 +184,6 @@ int xwl_screen_get_next_output_serial(struct xwl_screen * xwl_screen);
|
|||
void xwl_screen_lost_focus(struct xwl_screen *xwl_screen);
|
||||
Bool xwl_screen_update_global_surface_scale(struct xwl_screen *xwl_screen);
|
||||
Bool xwl_screen_should_use_fractional_scale(struct xwl_screen *xwl_screen);
|
||||
Bool xwl_screen_validate_options(int argc, char **argv);
|
||||
|
||||
#endif /* XWAYLAND_SCREEN_H */
|
||||
|
|
|
|||
|
|
@ -434,6 +434,10 @@ InitOutput(ScreenInfo * screen_info, int argc, char **argv)
|
|||
|
||||
wl_log_set_handler_client(xwl_log_handler);
|
||||
|
||||
if (!xwl_screen_validate_options(argc, argv)) {
|
||||
FatalError("Invalid command line arguments\n");
|
||||
}
|
||||
|
||||
if (AddScreen(xwl_screen_init, argc, argv) == -1) {
|
||||
FatalError("Couldn't add screen\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue