From dae8a4c739523efb21709cab4ca4d34633aded6d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 24 Sep 2006 00:08:28 +0000 Subject: [PATCH] Fixed bug #278 Added the GFX_Display to the wminfo structure, contributed by Eric --- include/SDL_syswm.h | 6 +++++- src/video/x11/SDL_x11wm.c | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index e7f35139a..010dd1bcc 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -86,7 +86,8 @@ typedef struct SDL_SysWMinfo { Display *display; /* The X11 display */ Window window; /* The X11 display window */ /* These locking functions should be called around - any X11 functions using the display variable. + any X11 functions using the display variable, + but not the gfxdisplay variable. They lock the event thread, so should not be called around event functions or from event filters. */ @@ -96,6 +97,9 @@ typedef struct SDL_SysWMinfo { /* Introduced in SDL 1.0.2 */ Window fswindow; /* The X11 fullscreen window */ Window wmwindow; /* The X11 managed input window */ + + /* Introduced in SDL 1.2.12 */ + Display *gfxdisplay; /* The X11 display to which rendering is done */ } x11; } info; } SDL_SysWMinfo; diff --git a/src/video/x11/SDL_x11wm.c b/src/video/x11/SDL_x11wm.c index a50215cd3..d82a7a1d6 100644 --- a/src/video/x11/SDL_x11wm.c +++ b/src/video/x11/SDL_x11wm.c @@ -398,6 +398,8 @@ static void unlock_display(void) XSync(SDL_Display, False); SDL_Unlock_EventThread(); } + +#include int X11_GetWMInfo(_THIS, SDL_SysWMinfo *info) { if ( info->version.major <= SDL_MAJOR_VERSION ) { @@ -410,6 +412,14 @@ int X11_GetWMInfo(_THIS, SDL_SysWMinfo *info) info->info.x11.fswindow = FSwindow; info->info.x11.wmwindow = WMwindow; } + + + if ( SDL_VERSIONNUM(info->version.major, + info->version.minor, + info->version.patch) >= 1212 ) { + info->info.x11.gfxdisplay = GFX_Display; + } + info->info.x11.lock_func = lock_display; info->info.x11.unlock_func = unlock_display; return(1);