diff options
Diffstat (limited to 'Source/3rdParty/SDL2/src/video/x11')
9 files changed, 71 insertions, 35 deletions
diff --git a/Source/3rdParty/SDL2/src/video/x11/SDL_x11framebuffer.h b/Source/3rdParty/SDL2/src/video/x11/SDL_x11framebuffer.h index 61bb0c5..6a31788 100644 --- a/Source/3rdParty/SDL2/src/video/x11/SDL_x11framebuffer.h +++ b/Source/3rdParty/SDL2/src/video/x11/SDL_x11framebuffer.h @@ -18,6 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_x11framebuffer_h_ +#define SDL_x11framebuffer_h_ + #include "../../SDL_internal.h" @@ -28,4 +32,6 @@ extern int X11_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects); extern void X11_DestroyWindowFramebuffer(_THIS, SDL_Window * window); +#endif /* SDL_x11framebuffer_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/SDL2/src/video/x11/SDL_x11keyboard.c b/Source/3rdParty/SDL2/src/video/x11/SDL_x11keyboard.c index d667c7b..a57adf9 100644 --- a/Source/3rdParty/SDL2/src/video/x11/SDL_x11keyboard.c +++ b/Source/3rdParty/SDL2/src/video/x11/SDL_x11keyboard.c @@ -266,7 +266,7 @@ X11_InitKeyboard(_THIS) int best_distance; int best_index; int distance; - BOOL xkb_repeat = 0; + Bool xkb_repeat = 0; X11_XAutoRepeatOn(data->display); @@ -292,9 +292,7 @@ X11_InitKeyboard(_THIS) char *prev_locale = setlocale(LC_ALL, NULL); char *prev_xmods = X11_XSetLocaleModifiers(NULL); const char *new_xmods = ""; -#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H) const char *env_xmods = SDL_getenv("XMODIFIERS"); -#endif SDL_bool has_dbus_ime_support = SDL_FALSE; if (prev_locale) { @@ -309,16 +307,12 @@ X11_InitKeyboard(_THIS) when it is used via XIM which causes issues. Prevent this by forcing @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via the DBus implementation, which also has support for pre-editing. */ -#ifdef HAVE_IBUS_IBUS_H if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) { has_dbus_ime_support = SDL_TRUE; } -#endif -#ifdef HAVE_FCITX_FRONTEND_H if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) { has_dbus_ime_support = SDL_TRUE; } -#endif if (has_dbus_ime_support || !xkb_repeat) { new_xmods = "@im=none"; } diff --git a/Source/3rdParty/SDL2/src/video/x11/SDL_x11messagebox.c b/Source/3rdParty/SDL2/src/video/x11/SDL_x11messagebox.c index fe6ab19..70a472a 100644 --- a/Source/3rdParty/SDL2/src/video/x11/SDL_x11messagebox.c +++ b/Source/3rdParty/SDL2/src/video/x11/SDL_x11messagebox.c @@ -44,7 +44,6 @@ #endif #define MAX_BUTTONS 8 /* Maximum number of buttons supported */ -#define MAX_TEXT_LINES 32 /* Maximum number of text lines supported */ #define MIN_BUTTON_WIDTH 64 /* Minimum button width */ #define MIN_DIALOG_WIDTH 200 /* Minimum dialog width */ #define MIN_DIALOG_HEIGHT 100 /* Minimum dialog height */ @@ -101,7 +100,7 @@ typedef struct SDL_MessageBoxDataX11 int xtext, ytext; /* Text position to start drawing at. */ int numlines; /* Count of Text lines. */ int text_height; /* Height for text lines. */ - TextLineData linedata[ MAX_TEXT_LINES ]; + TextLineData *linedata; int *pbuttonid; /* Pointer to user return buttonid value. */ @@ -223,6 +222,18 @@ X11_MessageBoxInit( SDL_MessageBoxDataX11 *data, const SDL_MessageBoxData * mess return 0; } +static int +CountLinesOfText(const char *text) +{ + int retval = 0; + while (text && *text) { + const char *lf = SDL_strchr(text, '\n'); + retval++; /* even without an endline, this counts as a line. */ + text = lf ? lf + 1 : NULL; + } + return retval; +} + /* Calculate and initialize text and button locations. */ static int X11_MessageBoxInitPositions( SDL_MessageBoxDataX11 *data ) @@ -237,29 +248,35 @@ X11_MessageBoxInitPositions( SDL_MessageBoxDataX11 *data ) /* Go over text and break linefeeds into separate lines. */ if ( messageboxdata->message && messageboxdata->message[ 0 ] ) { const char *text = messageboxdata->message; - TextLineData *plinedata = data->linedata; + const int linecount = CountLinesOfText(text); + TextLineData *plinedata = (TextLineData *) SDL_malloc(sizeof (TextLineData) * linecount); - for ( i = 0; i < MAX_TEXT_LINES; i++, plinedata++ ) { - int height; - char *lf = SDL_strchr( ( char * )text, '\n' ); + if (!plinedata) { + return SDL_OutOfMemory(); + } - data->numlines++; + data->linedata = plinedata; + data->numlines = linecount; + + for ( i = 0; i < linecount; i++, plinedata++ ) { + const char *lf = SDL_strchr( text, '\n' ); + const int length = lf ? ( lf - text ) : SDL_strlen( text ); + int height; - /* Only grab length up to lf if it exists and isn't the last line. */ - plinedata->length = ( lf && ( i < MAX_TEXT_LINES - 1 ) ) ? ( lf - text ) : SDL_strlen( text ); plinedata->text = text; - GetTextWidthHeight( data, text, plinedata->length, &plinedata->width, &height ); + GetTextWidthHeight( data, text, length, &plinedata->width, &height ); /* Text and widths are the largest we've ever seen. */ data->text_height = IntMax( data->text_height, height ); text_width_max = IntMax( text_width_max, plinedata->width ); + plinedata->length = length; if (lf && (lf > text) && (lf[-1] == '\r')) { plinedata->length--; } - text += plinedata->length + 1; + text += length + 1; /* Break if there are no more linefeeds. */ if ( !lf ) @@ -369,6 +386,8 @@ X11_MessageBoxShutdown( SDL_MessageBoxDataX11 *data ) X11_XCloseDisplay( data->display ); data->display = NULL; } + + SDL_free(data->linedata); } /* Create and set up our X11 dialog box indow. */ diff --git a/Source/3rdParty/SDL2/src/video/x11/SDL_x11messagebox.h b/Source/3rdParty/SDL2/src/video/x11/SDL_x11messagebox.h index cab407b..6515983 100644 --- a/Source/3rdParty/SDL2/src/video/x11/SDL_x11messagebox.h +++ b/Source/3rdParty/SDL2/src/video/x11/SDL_x11messagebox.h @@ -19,10 +19,15 @@ 3. This notice may not be removed or altered from any source distribution. */ +#ifndef SDL_x11messagebox_h_ +#define SDL_x11messagebox_h_ + #if SDL_VIDEO_DRIVER_X11 extern int X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); #endif /* SDL_VIDEO_DRIVER_X11 */ +#endif /* SDL_x11messagebox_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/SDL2/src/video/x11/SDL_x11opengl.h b/Source/3rdParty/SDL2/src/video/x11/SDL_x11opengl.h index 1a26ea0..7331b71 100644 --- a/Source/3rdParty/SDL2/src/video/x11/SDL_x11opengl.h +++ b/Source/3rdParty/SDL2/src/video/x11/SDL_x11opengl.h @@ -38,14 +38,14 @@ struct SDL_GLDriverData SDL_bool HAS_GLX_ARB_create_context_robustness; SDL_bool HAS_GLX_ARB_create_context_no_error; - /* Max version of OpenGL ES context that can be created if the - implementation supports GLX_EXT_create_context_es2_profile. - major = minor = 0 when unsupported. - */ - struct { - int major; - int minor; - } es_profile_max_supported_version; + /* Max version of OpenGL ES context that can be created if the + implementation supports GLX_EXT_create_context_es2_profile. + major = minor = 0 when unsupported. + */ + struct { + int major; + int minor; + } es_profile_max_supported_version; Bool (*glXQueryExtension) (Display*,int*,int*); void *(*glXGetProcAddress) (const GLubyte*); diff --git a/Source/3rdParty/SDL2/src/video/x11/SDL_x11sym.h b/Source/3rdParty/SDL2/src/video/x11/SDL_x11sym.h index a07a030..6709992 100644 --- a/Source/3rdParty/SDL2/src/video/x11/SDL_x11sym.h +++ b/Source/3rdParty/SDL2/src/video/x11/SDL_x11sym.h @@ -45,7 +45,7 @@ SDL_X11_SYM(Pixmap,XCreateBitmapFromData,(Display *dpy,Drawable d,_Xconst char * SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return) SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return) SDL_X11_SYM(Cursor,XCreateFontCursor,(Display* a,unsigned int b),(a,b),return) -SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char** e),(a,b,c,d,e),return) +SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char** e),(a,b,c,d,e),return) SDL_X11_SYM(GC,XCreateGC,(Display* a,Drawable b,unsigned long c,XGCValues* d),(a,b,c,d),return) SDL_X11_SYM(XImage*,XCreateImage,(Display* a,Visual* b,unsigned int c,int d,int e,char* f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return) SDL_X11_SYM(Window,XCreateWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f,unsigned int g,int h,unsigned int i,Visual* j,unsigned long k,XSetWindowAttributes* l),(a,b,c,d,e,f,g,h,i,j,k,l),return) @@ -180,7 +180,7 @@ SDL_X11_SYM(Status,XkbGetUpdatedMap,(Display* a,unsigned int b,XkbDescPtr c),(a, SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b,c),return) SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) SDL_X11_SYM(void,XkbFreeKeyboard,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) -SDL_X11_SYM(BOOL,XkbSetDetectableAutoRepeat,(Display* a, BOOL b, BOOL* c),(a,b,c),return) +SDL_X11_SYM(Bool,XkbSetDetectableAutoRepeat,(Display* a, Bool b, Bool* c),(a,b,c),return) #endif #if NeedWidePrototypes @@ -201,7 +201,7 @@ SDL_X11_SYM(void,XUnsetICFocus,(XIC a),(a),) SDL_X11_SYM(XIM,XOpenIM,(Display* a,struct _XrmHashBucketRec* b,char* c,char* d),(a,b,c,d),return) SDL_X11_SYM(Status,XCloseIM,(XIM a),(a),return) SDL_X11_SYM(void,Xutf8DrawString,(Display *a, Drawable b, XFontSet c, GC d, int e, int f, _Xconst char *g, int h),(a,b,c,d,e,f,g,h),) -SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return) +SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return) SDL_X11_SYM(char*,XSetLocaleModifiers,(const char *a),(a),return) SDL_X11_SYM(char*,Xutf8ResetIC,(XIC a),(a),return) #endif diff --git a/Source/3rdParty/SDL2/src/video/x11/SDL_x11video.c b/Source/3rdParty/SDL2/src/video/x11/SDL_x11video.c index b8f8edf..b3b1a70 100644 --- a/Source/3rdParty/SDL2/src/video/x11/SDL_x11video.c +++ b/Source/3rdParty/SDL2/src/video/x11/SDL_x11video.c @@ -260,6 +260,7 @@ X11_CreateDevice(int devindex) device->DestroyWindowFramebuffer = X11_DestroyWindowFramebuffer; device->GetWindowWMInfo = X11_GetWindowWMInfo; device->SetWindowHitTest = X11_SetWindowHitTest; + device->AcceptDragAndDrop = X11_AcceptDragAndDrop; device->shape_driver.CreateShaper = X11_CreateShaper; device->shape_driver.SetWindowShape = X11_SetWindowShape; diff --git a/Source/3rdParty/SDL2/src/video/x11/SDL_x11window.c b/Source/3rdParty/SDL2/src/video/x11/SDL_x11window.c index be03aa6..0a254b0 100644 --- a/Source/3rdParty/SDL2/src/video/x11/SDL_x11window.c +++ b/Source/3rdParty/SDL2/src/video/x11/SDL_x11window.c @@ -390,7 +390,6 @@ X11_CreateWindow(_THIS, SDL_Window * window) const char *wintype_name = NULL; long compositor = 1; Atom _NET_WM_PID; - Atom XdndAware, xdnd_version = 5; long fevent = 0; #if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_EGL @@ -651,11 +650,6 @@ X11_CreateWindow(_THIS, SDL_Window * window) PropertyChangeMask | StructureNotifyMask | KeymapStateMask | fevent)); - XdndAware = X11_XInternAtom(display, "XdndAware", False); - X11_XChangeProperty(display, w, XdndAware, XA_ATOM, 32, - PropModeReplace, - (unsigned char*)&xdnd_version, 1); - X11_XFlush(display); return 0; @@ -1604,6 +1598,22 @@ X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) return 0; /* just succeed, the real work is done elsewhere. */ } +void +X11_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + Display *display = data->videodata->display; + Atom XdndAware = X11_XInternAtom(display, "XdndAware", False); + + if (accept) { + Atom xdnd_version = 5; + X11_XChangeProperty(display, data->xwindow, XdndAware, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&xdnd_version, 1); + } else { + X11_XDeleteProperty(display, data->xwindow, XdndAware); + } +} + #endif /* SDL_VIDEO_DRIVER_X11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Source/3rdParty/SDL2/src/video/x11/SDL_x11window.h b/Source/3rdParty/SDL2/src/video/x11/SDL_x11window.h index 7c4c6c5..6ee8016 100644 --- a/Source/3rdParty/SDL2/src/video/x11/SDL_x11window.h +++ b/Source/3rdParty/SDL2/src/video/x11/SDL_x11window.h @@ -104,6 +104,7 @@ extern void X11_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); extern int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); +extern void X11_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept); #endif /* SDL_x11window_h_ */ |