Log failure reasons during early X11 and Wayland initialization
Log the reason for failure during initialization to the debug log to aid in troubleshooting.
This commit is contained in:
committed by
Ryan C. Gordon
parent
75c9b082ef
commit
5880b8a283
@@ -42,6 +42,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
|
|
||||||
#include <wayland-util.h>
|
#include <wayland-util.h>
|
||||||
@@ -548,10 +549,11 @@ static SDL_VideoDevice *Wayland_CreateDevice(bool require_preferred_protocols)
|
|||||||
SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER, NULL);
|
SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER, NULL);
|
||||||
bool display_is_external = !!display;
|
bool display_is_external = !!display;
|
||||||
|
|
||||||
// Are we trying to connect to or are currently in a Wayland session?
|
// Are we trying to connect to, or are currently in, a Wayland session?
|
||||||
if (!SDL_getenv("WAYLAND_DISPLAY")) {
|
if (!SDL_getenv("WAYLAND_DISPLAY")) {
|
||||||
const char *session = SDL_getenv("XDG_SESSION_TYPE");
|
const char *session = SDL_getenv("XDG_SESSION_TYPE");
|
||||||
if (session && SDL_strcasecmp(session, "wayland") != 0) {
|
if (session && SDL_strcasecmp(session, "wayland") != 0) {
|
||||||
|
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Wayland initialization failed: no Wayland session available");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -564,6 +566,7 @@ static SDL_VideoDevice *Wayland_CreateDevice(bool require_preferred_protocols)
|
|||||||
display = WAYLAND_wl_display_connect(NULL);
|
display = WAYLAND_wl_display_connect(NULL);
|
||||||
if (!display) {
|
if (!display) {
|
||||||
SDL_WAYLAND_UnloadSymbols();
|
SDL_WAYLAND_UnloadSymbols();
|
||||||
|
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Failed to connect to the Wayland display server: %s", strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -610,7 +613,7 @@ static SDL_VideoDevice *Wayland_CreateDevice(bool require_preferred_protocols)
|
|||||||
|
|
||||||
if (!display_is_external) {
|
if (!display_is_external) {
|
||||||
SDL_SetPointerProperty(SDL_GetGlobalProperties(),
|
SDL_SetPointerProperty(SDL_GetGlobalProperties(),
|
||||||
SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER, display);
|
SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER, display);
|
||||||
}
|
}
|
||||||
|
|
||||||
device->internal = data;
|
device->internal = data;
|
||||||
|
|||||||
@@ -107,6 +107,14 @@ static SDL_VideoDevice *X11_CreateDevice(void)
|
|||||||
|
|
||||||
if (!x11_display) {
|
if (!x11_display) {
|
||||||
SDL_X11_UnloadSymbols();
|
SDL_X11_UnloadSymbols();
|
||||||
|
|
||||||
|
const char *session = SDL_getenv("XDG_SESSION_TYPE");
|
||||||
|
if (session && SDL_strcasecmp(session, "wayland") == 0) {
|
||||||
|
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Failed to connect to the X11 (XWayland) display server");
|
||||||
|
} else {
|
||||||
|
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Failed to connect to the X11 display server");
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user