From ad0416f9bda07c07c06ef458316d7b997a5f7d44 Mon Sep 17 00:00:00 2001 From: Hal Gentz Date: Sun, 24 Feb 2019 04:57:28 -0700 Subject: [PATCH 1/2] Use `XRRGetScreenResourcesCurrent` when avail. Signed-off-by: Hal Gentz --- src/platform/linux/x11/monitor.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/platform/linux/x11/monitor.rs b/src/platform/linux/x11/monitor.rs index d6309f637f..cf1f456c46 100644 --- a/src/platform/linux/x11/monitor.rs +++ b/src/platform/linux/x11/monitor.rs @@ -131,9 +131,14 @@ impl XConnection { fn query_monitor_list(&self) -> Vec { unsafe { let root = (self.xlib.XDefaultRootWindow)(self.display); - // WARNING: this function is supposedly very slow, on the order of hundreds of ms. - // Upon failure, `resources` will be null. - let resources = (self.xrandr.XRRGetScreenResources)(self.display, root); + let resources = if version_is_at_least(1, 3) { + (self.xrandr.XRRGetScreenResourcesCurrent)(self.display, root) + } else { + // WARNING: this function is supposedly very slow, on the order of hundreds of ms. + // Upon failure, `resources` will be null. + (self.xrandr.XRRGetScreenResources)(self.display, root) + }; + if resources.is_null() { panic!("[winit] `XRRGetScreenResources` returned NULL. That should only happen if the root window doesn't exist."); } From 3f6b344cc03f1b63df88c2bf931f8e63ff18a178 Mon Sep 17 00:00:00 2001 From: Hal Gentz Date: Tue, 5 Mar 2019 16:56:47 -0700 Subject: [PATCH 2/2] Changelog Signed-off-by: Hal Gentz --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e99674aef7..f6885b0e9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Unreleased +- On X11, we will use the faster `XRRGetScreenResourcesCurrent` function instead of `XRRGetScreenResources` when available. - On macOS, fix keycodes being incorrect when using a non-US keyboard layout. - On Wayland, fix `with_title()` not setting the windows title - On Wayland, add `set_wayland_theme()` to control client decoration color theme