check for X11_display when using SDL

SDL can be using another video driver
This commit is contained in:
Thomas Bernard 2018-07-20 12:06:45 +02:00
parent 146694d3c1
commit 6ec72f6b71
2 changed files with 12 additions and 0 deletions

View File

@ -437,6 +437,12 @@ bye:
GFX2_Log(GFX2_ERROR, "Failed to get X11 display and window\n");
return NULL;
}
if (X11_display == NULL)
{
char video_driver_name[32];
GFX2_Log(GFX2_WARNING, "X11 display is NULL. X11 is needed for Copy/Paste. SDL video driver is currently %s\n", SDL_VideoDriverName(video_driver_name, sizeof(video_driver_name)));
return NULL;
}
#endif
selection = XInternAtom(X11_display, "CLIPBOARD", False);
selection_owner = XGetSelectionOwner(X11_display, selection);

View File

@ -588,6 +588,12 @@ void Allow_drag_and_drop(int flag)
if (GFX2_Get_X11_Display_Window(&display, &window))
{
if (display == NULL)
{
if (flag)
GFX2_Log(GFX2_WARNING, "Drag&Drop with SDL needs the x11 video driver\n");
return;
}
XChangeProperty(display, window,
XInternAtom(display, "XdndAware", False),
XA_ATOM, 32, PropModeReplace, (unsigned char *)&version, 1);