| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | #include "SDL_x11video.h" |
| | | #include "SDL_x11dyn.h" |
| | | #include "SDL_assert.h" |
| | | #include "SDL_x11messagebox.h" |
| | | |
| | | #include <X11/keysym.h> |
| | | #include <locale.h> |
| | |
| | | #define MIN_DIALOG_HEIGHT 100 /* Minimum dialog height */ |
| | | |
| | | static const char g_MessageBoxFontLatin1[] = "-*-*-medium-r-normal--0-120-*-*-p-0-iso8859-1"; |
| | | static const char g_MessageBoxFont[] = "-*-*-*-*-*-*-*-120-*-*-*-*-*-*"; |
| | | static const char g_MessageBoxFont[] = "-*-*-medium-r-normal--*-120-*-*-*-*-*-*"; |
| | | |
| | | static const SDL_MessageBoxColor g_default_colors[ SDL_MESSAGEBOX_COLOR_MAX ] = { |
| | | { 56, 54, 53 }, /* SDL_MESSAGEBOX_COLOR_BACKGROUND, */ |
| | |
| | | int x, y; |
| | | XSizeHints *sizehints; |
| | | XSetWindowAttributes wnd_attr; |
| | | Atom _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_NAME, UTF8_STRING; |
| | | Atom _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_NAME; |
| | | Display *display = data->display; |
| | | SDL_WindowData *windowdata = NULL; |
| | | const SDL_MessageBoxData *messageboxdata = data->messageboxdata; |
| | | char *title_locale = NULL; |
| | | |
| | | if ( messageboxdata->window ) { |
| | | SDL_DisplayData *displaydata = |
| | |
| | | |
| | | X11_XStoreName( display, data->window, messageboxdata->title ); |
| | | _NET_WM_NAME = X11_XInternAtom(display, "_NET_WM_NAME", False); |
| | | UTF8_STRING = X11_XInternAtom(display, "UTF8_STRING", False); |
| | | X11_XChangeProperty(display, data->window, _NET_WM_NAME, UTF8_STRING, 8, |
| | | PropModeReplace, (unsigned char *) messageboxdata->title, |
| | | strlen(messageboxdata->title) + 1 ); |
| | | |
| | | title_locale = SDL_iconv_utf8_locale(messageboxdata->title); |
| | | if (title_locale) { |
| | | XTextProperty titleprop; |
| | | Status status = X11_XStringListToTextProperty(&title_locale, 1, &titleprop); |
| | | SDL_free(title_locale); |
| | | if (status) { |
| | | X11_XSetTextProperty(display, data->window, &titleprop, XA_WM_NAME); |
| | | X11_XFree(titleprop.value); |
| | | } |
| | | } |
| | | |
| | | #ifdef X_HAVE_UTF8_STRING |
| | | if (SDL_X11_HAVE_UTF8) { |
| | | XTextProperty titleprop; |
| | | Status status = X11_Xutf8TextListToTextProperty(display, (char **) &messageboxdata->title, 1, |
| | | XUTF8StringStyle, &titleprop); |
| | | if (status == Success) { |
| | | X11_XSetTextProperty(display, data->window, &titleprop, |
| | | _NET_WM_NAME); |
| | | X11_XFree(titleprop.value); |
| | | } |
| | | } |
| | | #endif |
| | | |
| | | /* Let the window manager know this is a dialog box */ |
| | | _NET_WM_WINDOW_TYPE = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE", False); |