Compare commits

...

2 Commits

Author SHA1 Message Date
Simon McVittie
4441d8b0ad x11: Don't include XDestroyImage in the table of exported functions
When linking directly to libX11 as a hard dependency, we assign the
addresses of functions like XDestroyImage to function pointers like
X11_XDestroyImage. However, by default Xutils.h doesn't declare
XDestroyImage as a function: it only provides a macro which looks into
the XImage struct and calls a function pointer directly, similar to
a virtual method.

SDL_x11framebuffer.c was already relying on being able to call the macro
without explicitly linking to libX11, so do the same here.

Fixes: d14cbd7b "Introduce X11 toolkit and make message dialogs use it"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-09-03 09:22:38 -07:00
eafton
51052245d1 X11TK: Fix locale bug for non-dialog windows 2025-09-03 07:00:59 -07:00
2 changed files with 4 additions and 5 deletions

View File

@@ -105,7 +105,6 @@ SDL_X11_SYM(Status,XInitThreads,(void))
SDL_X11_SYM(int,XPeekEvent,(Display* a,XEvent* b))
SDL_X11_SYM(int,XPending,(Display* a))
SDL_X11_SYM(XImage*,XGetImage,(Display* a,Drawable b,int c, int d,unsigned int e,unsigned int f,unsigned long g,int h))
SDL_X11_SYM(void,XDestroyImage,(XImage *a))
SDL_X11_SYM(int,XPutImage,(Display* a,Drawable b,GC c,XImage* d,int e,int f,int g,int h,unsigned int i,unsigned int j))
SDL_X11_SYM(int,XQueryKeymap,(Display* a,char b[32]))
SDL_X11_SYM(Bool,XQueryPointer,(Display* a,Window b,Window* c,Window* d,int* e,int* f,int* g,int* h,unsigned int* i))

View File

@@ -444,7 +444,7 @@ SDL_ToolkitWindowX11 *X11Toolkit_CreateWindowStruct(SDL_Window *parent, SDL_Tool
window->tk_parent = tkparent;
#if SDL_SET_LOCALE
if (mode != SDL_TOOLKIT_WINDOW_MODE_X11_CHILD) {
if (mode == SDL_TOOLKIT_WINDOW_MODE_X11_DIALOG) {
window->origlocale = setlocale(LC_ALL, NULL);
if (window->origlocale) {
window->origlocale = SDL_strdup(window->origlocale);
@@ -981,10 +981,10 @@ static void X11Toolkit_DrawWindow(SDL_ToolkitWindowX11 *data) {
put_image = X11_XCreateImage(data->display, data->visual, data->vi.depth, ZPixmap, 0, put_surface->pixels, data->window_width, data->window_height, 32, put_surface->pitch);
X11_XPutImage(data->display, data->window, data->ctx, put_image, 0, 0, 0, 0, data->window_width, data->window_height);
X11_XDestroyImage(pixmap_image);
XDestroyImage(pixmap_image);
/* Needed because XDestroyImage results in a double-free otherwise */
put_image->data = NULL;
X11_XDestroyImage(put_image);
XDestroyImage(put_image);
SDL_DestroySurface(pixmap_surface);
SDL_DestroySurface(put_surface);
}
@@ -1707,7 +1707,7 @@ void X11Toolkit_DestroyWindow(SDL_ToolkitWindowX11 *data) {
}
#if SDL_SET_LOCALE
if (data->origlocale && (data->mode != SDL_TOOLKIT_WINDOW_MODE_X11_CHILD)) {
if (data->origlocale && (data->mode == SDL_TOOLKIT_WINDOW_MODE_X11_DIALOG)) {
(void)setlocale(LC_ALL, data->origlocale);
SDL_free(data->origlocale);
}