mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-07 11:58:12 +00:00
Fixed crash if the X11 display doesn't have a resource manager property
This commit is contained in:
@@ -190,7 +190,7 @@ static float GetGlobalContentScale(SDL_VideoDevice *_this)
|
|||||||
{
|
{
|
||||||
SDL_VideoData *data = _this->driverdata;
|
SDL_VideoData *data = _this->driverdata;
|
||||||
Display *display = data->display;
|
Display *display = data->display;
|
||||||
char * resource_manager;
|
char *resource_manager;
|
||||||
XrmDatabase db;
|
XrmDatabase db;
|
||||||
XrmValue value;
|
XrmValue value;
|
||||||
char *type;
|
char *type;
|
||||||
@@ -198,6 +198,7 @@ static float GetGlobalContentScale(SDL_VideoDevice *_this)
|
|||||||
X11_XrmInitialize();
|
X11_XrmInitialize();
|
||||||
|
|
||||||
resource_manager = X11_XResourceManagerString(display);
|
resource_manager = X11_XResourceManagerString(display);
|
||||||
|
if (resource_manager) {
|
||||||
db = X11_XrmGetStringDatabase(resource_manager);
|
db = X11_XrmGetStringDatabase(resource_manager);
|
||||||
|
|
||||||
// Get the value of Xft.dpi from the Database
|
// Get the value of Xft.dpi from the Database
|
||||||
@@ -209,6 +210,7 @@ static float GetGlobalContentScale(SDL_VideoDevice *_this)
|
|||||||
}
|
}
|
||||||
X11_XrmDestroyDatabase(db);
|
X11_XrmDestroyDatabase(db);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If that failed, try the GDK_SCALE envvar... */
|
/* If that failed, try the GDK_SCALE envvar... */
|
||||||
if (scale_factor <= 0.0)
|
if (scale_factor <= 0.0)
|
||||||
|
Reference in New Issue
Block a user