Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/video/x11/SDL_x11messagebox.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ static void X11_OnMessageBoxScaleChange(SDL_ToolkitWindowX11 *window, void *data

static bool X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonID)
{
SDL_VideoDevice *video = SDL_GetVideoDevice();
SDL_Window *parent_window = NULL;
SDL_MessageBoxControlsX11 controls;
SDL_MessageBoxCallbackDataX11 data;
const SDL_MessageBoxColor *colorhints;
Expand All @@ -305,10 +307,14 @@ static bool X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int
}

/* Create window */
if (messageboxdata->window && SDL_strcmp(video->name, "x11") == 0) {
// Only use the window as a parent if it is from the X11 driver.
parent_window = messageboxdata->window;
}
#if SDL_FORK_MESSAGEBOX
controls.window = X11Toolkit_CreateWindowStruct(messageboxdata->window, NULL, SDL_TOOLKIT_WINDOW_MODE_X11_DIALOG, colorhints, true);
controls.window = X11Toolkit_CreateWindowStruct(parent_window, NULL, SDL_TOOLKIT_WINDOW_MODE_X11_DIALOG, colorhints, true);
#else
controls.window = X11Toolkit_CreateWindowStruct(messageboxdata->window, NULL, SDL_TOOLKIT_WINDOW_MODE_X11_DIALOG, colorhints, false);
controls.window = X11Toolkit_CreateWindowStruct(parent_window, NULL, SDL_TOOLKIT_WINDOW_MODE_X11_DIALOG, colorhints, false);
#endif
controls.window->cb_data = &controls;
controls.window->cb_on_scale_change = X11_OnMessageBoxScaleChange;
Expand Down
Loading