diff -r c858be546e5a configure --- a/configure Tue Jan 21 16:28:53 2014 -0500 +++ b/configure Thu Jan 23 17:45:25 2014 +0200 @@ -824,6 +824,7 @@ with_x enable_x11_shared enable_video_x11_xcursor +enable_video_x11_xdbe enable_video_x11_xinerama enable_video_x11_xinput enable_video_x11_xrandr @@ -1544,6 +1545,7 @@ --enable-x11-shared dynamically load X11 support [[default=maybe]] --enable-video-x11-xcursor enable X11 Xcursor support [[default=yes]] + --enable-video-x11-xdbe enable X11 Xdbe support [[default=yes]] --enable-video-x11-xinerama enable X11 Xinerama support [[default=yes]] --enable-video-x11-xinput @@ -19826,6 +19828,30 @@ $as_echo "#define SDL_VIDEO_DRIVER_X11_XCURSOR 1" >>confdefs.h fi + # Check whether --enable-video-x11-xdbe was given. +if test "${enable_video_x11_xdbe+set}" = set; then : + enableval=$enable_video_x11_xdbe; +else + enable_video_x11_xdbe=yes +fi + + if test x$enable_video_x11_xdbe = xyes; then + ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xdbe.h" "ac_cv_header_X11_extensions_Xdbe_h" "#include + +" +if test "x$ac_cv_header_X11_extensions_Xdbe_h" = xyes; then : + have_dbe_h_hdr=yes +else + have_dbe_h_hdr=no +fi + + + if test x$have_dbe_h_hdr = xyes; then + +$as_echo "#define SDL_VIDEO_DRIVER_X11_XDBE 1" >>confdefs.h + + fi + fi # Check whether --enable-video-x11-xinerama was given. if test "${enable_video_x11_xinerama+set}" = set; then : enableval=$enable_video_x11_xinerama; diff -r c858be546e5a configure.in --- a/configure.in Tue Jan 21 16:28:53 2014 -0500 +++ b/configure.in Thu Jan 23 17:45:25 2014 +0200 @@ -1379,6 +1379,19 @@ if test x$definitely_enable_video_x11_xcursor = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ]) fi + AC_ARG_ENABLE(video-x11-xdbe, +AC_HELP_STRING([--enable-video-x11-xdbe], [enable X11 Xdbe support [[default=yes]]]), + , enable_video_x11_xdbe=yes) + if test x$enable_video_x11_xdbe = xyes; then + AC_CHECK_HEADER(X11/extensions/Xdbe.h, + have_dbe_h_hdr=yes, + have_dbe_h_hdr=no, + [#include + ]) + if test x$have_dbe_h_hdr = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDBE, 1, [ ]) + fi + fi AC_ARG_ENABLE(video-x11-xinerama, AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]), , enable_video_x11_xinerama=yes) diff -r c858be546e5a include/SDL_config.h.cmake --- a/include/SDL_config.h.cmake Tue Jan 21 16:28:53 2014 -0500 +++ b/include/SDL_config.h.cmake Thu Jan 23 17:45:25 2014 +0200 @@ -269,6 +269,7 @@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS @SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE @SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE@ #cmakedefine SDL_VIDEO_DRIVER_X11_XCURSOR @SDL_VIDEO_DRIVER_X11_XCURSOR@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XDBE @SDL_VIDEO_DRIVER_X11_XDBE@ #cmakedefine SDL_VIDEO_DRIVER_X11_XINERAMA @SDL_VIDEO_DRIVER_X11_XINERAMA@ #cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 @SDL_VIDEO_DRIVER_X11_XINPUT2@ #cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH @SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH@ diff -r c858be546e5a include/SDL_config.h.in --- a/include/SDL_config.h.in Tue Jan 21 16:28:53 2014 -0500 +++ b/include/SDL_config.h.in Thu Jan 23 17:45:25 2014 +0200 @@ -278,6 +278,7 @@ #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE #undef SDL_VIDEO_DRIVER_X11_XCURSOR +#undef SDL_VIDEO_DRIVER_X11_XDBE #undef SDL_VIDEO_DRIVER_X11_XINERAMA #undef SDL_VIDEO_DRIVER_X11_XINPUT2 #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH diff -r c858be546e5a include/SDL_config_macosx.h --- a/include/SDL_config_macosx.h Tue Jan 21 16:28:53 2014 -0500 +++ b/include/SDL_config_macosx.h Thu Jan 23 17:45:25 2014 +0200 @@ -136,6 +136,7 @@ #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" +#define SDL_VIDEO_DRIVER_X11_XDBE 1 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 #define SDL_VIDEO_DRIVER_X11_XRANDR 1 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 diff -r c858be546e5a premake/Linux/SDL_config_premake.h --- a/premake/Linux/SDL_config_premake.h Tue Jan 21 16:28:53 2014 -0500 +++ b/premake/Linux/SDL_config_premake.h Thu Jan 23 17:45:25 2014 +0200 @@ -230,6 +230,9 @@ #ifndef SDL_VIDEO_DRIVER_X11_XCURSOR #define SDL_VIDEO_DRIVER_X11_XCURSOR 1 #endif +#ifndef SDL_VIDEO_DRIVER_X11_XDBE +#define SDL_VIDEO_DRIVER_X11_XDBE 1 +#endif #ifndef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM #define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 #endif diff -r c858be546e5a premake/Xcode/Xcode3/SDL_config_premake.h --- a/premake/Xcode/Xcode3/SDL_config_premake.h Tue Jan 21 16:28:53 2014 -0500 +++ b/premake/Xcode/Xcode3/SDL_config_premake.h Thu Jan 23 17:45:25 2014 +0200 @@ -162,6 +162,7 @@ #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" +#define SDL_VIDEO_DRIVER_X11_XDBE 1 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 #define SDL_VIDEO_DRIVER_X11_XRANDR 1 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 diff -r c858be546e5a premake/Xcode/Xcode4/SDL_config_premake.h --- a/premake/Xcode/Xcode4/SDL_config_premake.h Tue Jan 21 16:28:53 2014 -0500 +++ b/premake/Xcode/Xcode4/SDL_config_premake.h Thu Jan 23 17:45:25 2014 +0200 @@ -162,6 +162,7 @@ #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" +#define SDL_VIDEO_DRIVER_X11_XDBE 1 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 #define SDL_VIDEO_DRIVER_X11_XRANDR 1 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 diff -r c858be546e5a premake/config/SDL_config_macosx.template.h --- a/premake/config/SDL_config_macosx.template.h Tue Jan 21 16:28:53 2014 -0500 +++ b/premake/config/SDL_config_macosx.template.h Thu Jan 23 17:45:25 2014 +0200 @@ -118,6 +118,7 @@ #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" +#define SDL_VIDEO_DRIVER_X11_XDBE 1 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 #define SDL_VIDEO_DRIVER_X11_XRANDR 1 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 diff -r c858be546e5a premake/projects/SDL2.lua --- a/premake/projects/SDL2.lua Tue Jan 21 16:28:53 2014 -0500 +++ b/premake/projects/SDL2.lua Thu Jan 23 17:45:25 2014 +0200 @@ -292,6 +292,7 @@ ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS"] = '"libXss.so"', ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE"] = '"libXxf86vm.so"', ["SDL_VIDEO_DRIVER_X11_XCURSOR"] = 1, + ["SDL_VIDEO_DRIVER_X11_XDBE"] = 1, ["SDL_VIDEO_DRIVER_X11_XINERAMA"] = 1, ["SDL_VIDEO_DRIVER_X11_XINPUT2"] = 1, ["SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH"] = 1, @@ -402,4 +403,4 @@ "$(SDKROOT)/UIKit.framework", "$(SDKROOT)/Foundation.framework", "$(SDKROOT)/CoreAudio.framework" - } \ No newline at end of file + } diff -r c858be546e5a src/video/x11/SDL_x11dyn.h --- a/src/video/x11/SDL_x11dyn.h Tue Jan 21 16:28:53 2014 -0500 +++ b/src/video/x11/SDL_x11dyn.h Thu Jan 23 17:45:25 2014 +0200 @@ -50,6 +50,9 @@ #if SDL_VIDEO_DRIVER_X11_XCURSOR #include #endif +#if SDL_VIDEO_DRIVER_X11_XDBE +#include +#endif #if SDL_VIDEO_DRIVER_X11_XINERAMA #include #endif diff -r c858be546e5a src/video/x11/SDL_x11messagebox.c --- a/src/video/x11/SDL_x11messagebox.c Tue Jan 21 16:28:53 2014 -0500 +++ b/src/video/x11/SDL_x11messagebox.c Thu Jan 23 17:45:25 2014 +0200 @@ -83,6 +83,10 @@ Display *display; int screen; Window window; +#if SDL_VIDEO_DRIVER_X11_XDBE + XdbeBackBuffer buf; + SDL_bool xdbe; /* Whether Xdbe is present or not */ +#endif long event_mask; Atom wm_protocols; Atom wm_delete_message; @@ -347,6 +351,12 @@ data->font_struct = NULL; } +#if SDL_VIDEO_DRIVER_X11_XDBE + if ( SDL_X11_HAVE_XDBE && data->xdbe ) { + X11_XdbeDeallocateBackBufferName(data->display, data->buf); + } +#endif + if ( data->display ) { if ( data->window != None ) { X11_XWithdrawWindow( data->display, data->window, data->screen ); @@ -437,6 +447,20 @@ } X11_XMapRaised( display, data->window ); + +#if SDL_VIDEO_DRIVER_X11_XDBE + /* Initialise a back buffer for double buffering */ + if (SDL_X11_HAVE_XDBE) { + int xdbe_major, xdbe_minor; + if (X11_XdbeQueryExtension(display, &xdbe_major, &xdbe_minor) != 0) { + data->xdbe = SDL_TRUE; + data->buf = X11_XdbeAllocateBackBufferName(display, data->window, XdbeUndefined); + } else { + data->xdbe = SDL_FALSE; + } + } +#endif + return 0; } @@ -445,9 +469,16 @@ X11_MessageBoxDraw( SDL_MessageBoxDataX11 *data, GC ctx ) { int i; - Window window = data->window; + Drawable window = data->window; Display *display = data->display; +#if SDL_VIDEO_DRIVER_X11_XDBE + if (SDL_X11_HAVE_XDBE && data->xdbe) { + window = data->buf; + X11_XdbeBeginIdiom(data->display); + } +#endif + X11_XSetForeground( display, ctx, data->color[ SDL_MESSAGEBOX_COLOR_BACKGROUND ] ); X11_XFillRectangle( display, window, ctx, 0, 0, data->dialog_width, data->dialog_height ); @@ -497,6 +528,16 @@ buttondata->text, buttondatax11->length ); } } + +#if SDL_VIDEO_DRIVER_X11_XDBE + if (SDL_X11_HAVE_XDBE && data->xdbe) { + XdbeSwapInfo swap_info; + swap_info.swap_window = data->window; + swap_info.swap_action = XdbeUndefined; + X11_XdbeSwapBuffers(data->display, &swap_info, 1); + X11_XdbeEndIdiom(data->display); + } +#endif } /* Loop and handle message box event messages until something kills it. */ @@ -560,7 +601,11 @@ case MotionNotify: if ( has_focus ) { /* Mouse moved... */ + int previndex = data->mouse_over_index; data->mouse_over_index = GetHitButtonIndex( data, e.xbutton.x, e.xbutton.y ); + if (data->mouse_over_index == previndex) { + draw = SDL_FALSE; + } } break; diff -r c858be546e5a src/video/x11/SDL_x11sym.h --- a/src/video/x11/SDL_x11sym.h Tue Jan 21 16:28:53 2014 -0500 +++ b/src/video/x11/SDL_x11sym.h Thu Jan 23 17:45:25 2014 +0200 @@ -230,6 +230,20 @@ SDL_X11_SYM(Cursor,XcursorImageLoadCursor,(Display *a,const XcursorImage *b),(a,b),return) #endif +/* Xdbe support */ +#if SDL_VIDEO_DRIVER_X11_XDBE +SDL_X11_MODULE(XDBE) +SDL_X11_SYM(Status,XdbeQueryExtension,(Display *dpy,int *major_version_return,int *minor_version_return),(dpy,major_version_return,minor_version_return),return) +SDL_X11_SYM(XdbeBackBuffer,XdbeAllocateBackBufferName,(Display *dpy,Window window,XdbeSwapAction swap_action),(dpy,window,swap_action),return) +SDL_X11_SYM(Status,XdbeDeallocateBackBufferName,(Display *dpy,XdbeBackBuffer buffer),(dpy,buffer),return) +SDL_X11_SYM(Status,XdbeSwapBuffers,(Display *dpy,XdbeSwapInfo *swap_info,int num_windows),(dpy,swap_info,num_windows),return) +SDL_X11_SYM(Status,XdbeBeginIdiom,(Display *dpy),(dpy),return) +SDL_X11_SYM(Status,XdbeEndIdiom,(Display *dpy),(dpy),return) +SDL_X11_SYM(XdbeScreenVisualInfo*,XdbeGetVisualInfo,(Display *dpy,Drawable *screen_specifiers,int *num_screens),(dpy,screen_specifiers,num_screens),return) +SDL_X11_SYM(void,XdbeFreeVisualInfo,(XdbeScreenVisualInfo *visual_info),(visual_info),) +SDL_X11_SYM(XdbeBackBufferAttributes*,XdbeGetBackBufferAttributes,(Display *dpy,XdbeBackBuffer buffer),(dpy,buffer),return) +#endif + /* Xinerama support */ #if SDL_VIDEO_DRIVER_X11_XINERAMA SDL_X11_MODULE(XINERAMA) diff -r c858be546e5a src/video/x11/SDL_x11video.h --- a/src/video/x11/SDL_x11video.h Tue Jan 21 16:28:53 2014 -0500 +++ b/src/video/x11/SDL_x11video.h Thu Jan 23 17:45:25 2014 +0200 @@ -34,6 +34,9 @@ #if SDL_VIDEO_DRIVER_X11_XCURSOR #include #endif +#if SDL_VIDEO_DRIVER_X11_XDBE +#include +#endif #if SDL_VIDEO_DRIVER_X11_XINERAMA #include #endif