mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
parent
5f52d7c9d0
commit
83b60beba6
|
@ -4,6 +4,7 @@
|
||||||
- On Wayland, fix coordinates in touch events when scale factor isn't 1.
|
- On Wayland, fix coordinates in touch events when scale factor isn't 1.
|
||||||
- On Wayland, fix color from `close_button_icon_color` not applying.
|
- On Wayland, fix color from `close_button_icon_color` not applying.
|
||||||
- Ignore locale if unsupported by X11 backend
|
- Ignore locale if unsupported by X11 backend
|
||||||
|
- On Wayland, Add HiDPI cursor support
|
||||||
|
|
||||||
# 0.21.0 (2020-02-04)
|
# 0.21.0 (2020-02-04)
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ features = [
|
||||||
wayland-client = { version = "0.23.0", features = [ "dlopen", "egl", "cursor", "eventloop"] }
|
wayland-client = { version = "0.23.0", features = [ "dlopen", "egl", "cursor", "eventloop"] }
|
||||||
mio = "0.6"
|
mio = "0.6"
|
||||||
mio-extras = "2.0"
|
mio-extras = "2.0"
|
||||||
smithay-client-toolkit = "0.6"
|
smithay-client-toolkit = "^0.6.6"
|
||||||
x11-dl = "2.18.3"
|
x11-dl = "2.18.3"
|
||||||
percent-encoding = "2.0"
|
percent-encoding = "2.0"
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,7 @@ pub struct CursorManager {
|
||||||
locked_pointers: Vec<ZwpLockedPointerV1>,
|
locked_pointers: Vec<ZwpLockedPointerV1>,
|
||||||
cursor_visible: bool,
|
cursor_visible: bool,
|
||||||
current_cursor: CursorIcon,
|
current_cursor: CursorIcon,
|
||||||
|
scale_factor: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CursorManager {
|
impl CursorManager {
|
||||||
|
@ -101,6 +102,7 @@ impl CursorManager {
|
||||||
locked_pointers: Vec::new(),
|
locked_pointers: Vec::new(),
|
||||||
cursor_visible: true,
|
cursor_visible: true,
|
||||||
current_cursor: CursorIcon::default(),
|
current_cursor: CursorIcon::default(),
|
||||||
|
scale_factor: 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,6 +147,11 @@ impl CursorManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn update_scale_factor(&mut self, scale: u32) {
|
||||||
|
self.scale_factor = scale;
|
||||||
|
self.reload_cursor_style();
|
||||||
|
}
|
||||||
|
|
||||||
fn set_cursor_icon_impl(&mut self, cursor: CursorIcon) {
|
fn set_cursor_icon_impl(&mut self, cursor: CursorIcon) {
|
||||||
let cursor = match cursor {
|
let cursor = match cursor {
|
||||||
CursorIcon::Alias => "link",
|
CursorIcon::Alias => "link",
|
||||||
|
@ -193,7 +200,7 @@ impl CursorManager {
|
||||||
for pointer in self.pointers.iter() {
|
for pointer in self.pointers.iter() {
|
||||||
// Ignore erros, since we don't want to fail hard in case we can't find a proper cursor
|
// Ignore erros, since we don't want to fail hard in case we can't find a proper cursor
|
||||||
// in a given theme.
|
// in a given theme.
|
||||||
let _ = pointer.set_cursor(cursor, None);
|
let _ = pointer.set_cursor_with_scale(cursor, self.scale_factor, None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,6 +735,13 @@ impl<T> EventLoop<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(dpi) = window.new_dpi {
|
if let Some(dpi) = window.new_dpi {
|
||||||
|
// Update cursor scale factor
|
||||||
|
{
|
||||||
|
self.cursor_manager
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.update_scale_factor(dpi as u32);
|
||||||
|
};
|
||||||
let dpi = dpi as f64;
|
let dpi = dpi as f64;
|
||||||
let logical_size = LogicalSize::<f64>::from(*window.size);
|
let logical_size = LogicalSize::<f64>::from(*window.size);
|
||||||
let mut new_inner_size = logical_size.to_physical(dpi);
|
let mut new_inner_size = logical_size.to_physical(dpi);
|
||||||
|
@ -742,6 +756,8 @@ impl<T> EventLoop<T> {
|
||||||
|
|
||||||
let (w, h) = new_inner_size.to_logical::<u32>(dpi).into();
|
let (w, h) = new_inner_size.to_logical::<u32>(dpi).into();
|
||||||
frame.resize(w, h);
|
frame.resize(w, h);
|
||||||
|
// Refresh frame to rescale decorations
|
||||||
|
frame.refresh();
|
||||||
*window.size = (w, h);
|
*window.size = (w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue