Skip to content

Commit c91f9f6

Browse files
committed
x11: #ifdef the XRandR path in the message box code
The runtime check isn't sufficient as the functions are undefined if built without XRandR.
1 parent 7490471 commit c91f9f6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/video/x11/SDL_x11messagebox.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,12 @@ static bool X11_MessageBoxCreateWindow(SDL_MessageBoxDataX11 *data)
425425
Display *display = data->display;
426426
SDL_WindowData *windowdata = NULL;
427427
const SDL_MessageBoxData *messageboxdata = data->messageboxdata;
428+
#ifdef SDL_VIDEO_DRIVER_X11_XRANDR
428429
#ifdef XRANDR_DISABLED_BY_DEFAULT
429430
const bool use_xrandr_by_default = false;
430431
#else
431432
const bool use_xrandr_by_default = true;
433+
#endif
432434
#endif
433435

434436
if (messageboxdata->window) {
@@ -502,12 +504,16 @@ static bool X11_MessageBoxCreateWindow(SDL_MessageBoxDataX11 *data)
502504
const SDL_DisplayData *dpydata = dpy->internal;
503505
x = dpydata->x + ((dpy->current_mode->w - data->dialog_width) / 2);
504506
y = dpydata->y + ((dpy->current_mode->h - data->dialog_height) / 3);
505-
} else if (SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XRANDR, use_xrandr_by_default)) {
507+
}
508+
#ifdef SDL_VIDEO_DRIVER_X11_XRANDR
509+
else if (SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XRANDR, use_xrandr_by_default)) {
506510
XRRScreenResources *screen = X11_XRRGetScreenResourcesCurrent(display, DefaultRootWindow(display));
507511
XRRCrtcInfo *crtc_info = X11_XRRGetCrtcInfo(display, screen, screen->crtcs[0]);
508512
x = (crtc_info->width - data->dialog_width) / 2;
509513
y = (crtc_info->height - data->dialog_height) / 3;
510-
} else {
514+
}
515+
#endif
516+
else {
511517
// oh well. This will misposition on a multi-head setup. Init first next time.
512518
x = (DisplayWidth(display, data->screen) - data->dialog_width) / 2;
513519
y = (DisplayHeight(display, data->screen) - data->dialog_height) / 3;

0 commit comments

Comments
 (0)