diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 28 | ||||
| -rw-r--r-- | src/xterm.h | 5 |
2 files changed, 26 insertions, 7 deletions
diff --git a/src/xfns.c b/src/xfns.c index 9ef7cb980fe..0a4a09ef285 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -4262,8 +4262,19 @@ x_get_monitor_attributes_xrandr (struct x_display_info *dpyinfo) | |||
| 4262 | RROutput pxid = None; | 4262 | RROutput pxid = None; |
| 4263 | struct MonitorInfo *monitors; | 4263 | struct MonitorInfo *monitors; |
| 4264 | 4264 | ||
| 4265 | #ifdef HAVE_XRRGETSCREENRESOURCESCURRENT | 4265 | #define RANDR13_LIBRARY \ |
| 4266 | resources = XRRGetScreenResourcesCurrent (dpy, dpyinfo->root_window); | 4266 | (RANDR_MAJOR > 1 || (RANDR_MAJOR == 1 && RANDR_MINOR >= 3)) |
| 4267 | |||
| 4268 | #if RANDR13_LIBRARY | ||
| 4269 | /* Check if the display supports 1.3 too. */ | ||
| 4270 | bool randr13_avail = (dpyinfo->xrandr_major_version > 1 | ||
| 4271 | || (dpyinfo->xrandr_major_version == 1 | ||
| 4272 | && dpyinfo->xrandr_minor_version >= 3)); | ||
| 4273 | |||
| 4274 | if (randr13_avail) | ||
| 4275 | resources = XRRGetScreenResourcesCurrent (dpy, dpyinfo->root_window); | ||
| 4276 | else | ||
| 4277 | resources = XRRGetScreenResources (dpy, dpyinfo->root_window); | ||
| 4267 | #else | 4278 | #else |
| 4268 | resources = XRRGetScreenResources (dpy, dpyinfo->root_window); | 4279 | resources = XRRGetScreenResources (dpy, dpyinfo->root_window); |
| 4269 | #endif | 4280 | #endif |
| @@ -4276,8 +4287,9 @@ x_get_monitor_attributes_xrandr (struct x_display_info *dpyinfo) | |||
| 4276 | n_monitors = resources->noutput; | 4287 | n_monitors = resources->noutput; |
| 4277 | monitors = xzalloc (n_monitors * sizeof *monitors); | 4288 | monitors = xzalloc (n_monitors * sizeof *monitors); |
| 4278 | 4289 | ||
| 4279 | #ifdef HAVE_XRRGETOUTPUTPRIMARY | 4290 | #ifdef RANDR13_LIBRARY |
| 4280 | pxid = XRRGetOutputPrimary (dpy, dpyinfo->root_window); | 4291 | if (randr13_avail) |
| 4292 | pxid = XRRGetOutputPrimary (dpy, dpyinfo->root_window); | ||
| 4281 | #endif | 4293 | #endif |
| 4282 | 4294 | ||
| 4283 | for (i = 0; i < n_monitors; ++i) | 4295 | for (i = 0; i < n_monitors; ++i) |
| @@ -4360,9 +4372,11 @@ x_get_monitor_attributes (struct x_display_info *dpyinfo) | |||
| 4360 | xrr_ok = XRRQueryExtension (dpy, &xrr_event_base, &xrr_error_base); | 4372 | xrr_ok = XRRQueryExtension (dpy, &xrr_event_base, &xrr_error_base); |
| 4361 | if (xrr_ok) | 4373 | if (xrr_ok) |
| 4362 | { | 4374 | { |
| 4363 | int xrr_major, xrr_minor; | 4375 | XRRQueryVersion (dpy, &dpyinfo->xrandr_major_version, |
| 4364 | XRRQueryVersion (dpy, &xrr_major, &xrr_minor); | 4376 | &dpyinfo->xrandr_minor_version); |
| 4365 | xrr_ok = (xrr_major == 1 && xrr_minor >= 2) || xrr_major > 1; | 4377 | xrr_ok = ((dpyinfo->xrandr_major_version == 1 |
| 4378 | && dpyinfo->xrandr_minor_version >= 2) | ||
| 4379 | || dpyinfo->xrandr_major_version > 1); | ||
| 4366 | } | 4380 | } |
| 4367 | 4381 | ||
| 4368 | if (xrr_ok) | 4382 | if (xrr_ok) |
diff --git a/src/xterm.h b/src/xterm.h index 06cd2e75a8b..8e1fc788bc1 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -459,6 +459,11 @@ struct x_display_info | |||
| 459 | /* SM */ | 459 | /* SM */ |
| 460 | Atom Xatom_SM_CLIENT_ID; | 460 | Atom Xatom_SM_CLIENT_ID; |
| 461 | 461 | ||
| 462 | #ifdef HAVE_XRANDR | ||
| 463 | int xrandr_major_version; | ||
| 464 | int xrandr_minor_version; | ||
| 465 | #endif | ||
| 466 | |||
| 462 | #ifdef USE_CAIRO | 467 | #ifdef USE_CAIRO |
| 463 | XExtCodes *ext_codes; | 468 | XExtCodes *ext_codes; |
| 464 | #endif | 469 | #endif |