mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-13 14:11:30 +11:00
Use XRRGetScreenResourcesCurrent
when avail. (#801)
* Use `XRRGetScreenResourcesCurrent` when avail. Signed-off-by: Hal Gentz <zegentzy@protonmail.com> * Changelog Signed-off-by: Hal Gentz <zegentzy@protonmail.com>
This commit is contained in:
parent
b682c3dfb5
commit
09182dc093
|
@ -37,6 +37,7 @@
|
|||
- `LoopDestroyed` is emitted when the `run` or `run_return` method is about to exit.
|
||||
- Rename `MonitorId` to `MonitorHandle`.
|
||||
- Removed `serde` implementations from `ControlFlow`.
|
||||
- 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
|
||||
|
|
|
@ -131,9 +131,14 @@ impl XConnection {
|
|||
fn query_monitor_list(&self) -> Vec<MonitorHandle> {
|
||||
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.");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue