mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 14:51:30 +11:00
Wayland: Switched to using a reference to relative_pointer_manager_proxy when creating SeatData (#1179)
* Fixed relative_pointer not being set up when the "zwp_relative_pointer_manager_v1" callback comes after the "wl_seat" callback * Ran cargo fmt * Updated changelog * Improved CHANGELOG * Switched to using Rc<RefCell> instead of Arc<Mutex> since all accesses to the relative_pointer_manager_proxy will happen on the same thread. * Forgot to run cargo fmt
This commit is contained in:
parent
472eddcc1b
commit
7df040f451
|
@ -20,6 +20,7 @@
|
||||||
- On X11, return dummy monitor data to avoid panicking when no monitors exist.
|
- On X11, return dummy monitor data to avoid panicking when no monitors exist.
|
||||||
- On X11, prevent stealing input focus when creating a new window.
|
- On X11, prevent stealing input focus when creating a new window.
|
||||||
Only steal input focus when entering fullscreen mode.
|
Only steal input focus when entering fullscreen mode.
|
||||||
|
- On Wayland, fixed DeviceEvents for relative mouse movement is not always produced
|
||||||
|
|
||||||
# 0.20.0 Alpha 3 (2019-08-14)
|
# 0.20.0 Alpha 3 (2019-08-14)
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ impl<T: 'static> EventLoop<T> {
|
||||||
|
|
||||||
let mut seat_manager = SeatManager {
|
let mut seat_manager = SeatManager {
|
||||||
sink: sink.clone(),
|
sink: sink.clone(),
|
||||||
relative_pointer_manager_proxy: None,
|
relative_pointer_manager_proxy: Rc::new(RefCell::new(None)),
|
||||||
store: store.clone(),
|
store: store.clone(),
|
||||||
seats: seats.clone(),
|
seats: seats.clone(),
|
||||||
kbd_sender,
|
kbd_sender,
|
||||||
|
@ -164,13 +164,16 @@ impl<T: 'static> EventLoop<T> {
|
||||||
version,
|
version,
|
||||||
} => {
|
} => {
|
||||||
if interface == "zwp_relative_pointer_manager_v1" {
|
if interface == "zwp_relative_pointer_manager_v1" {
|
||||||
seat_manager.relative_pointer_manager_proxy = Some(
|
let relative_pointer_manager_proxy = registry
|
||||||
registry
|
.bind(version, id, move |pointer_manager| {
|
||||||
.bind(version, id, move |pointer_manager| {
|
pointer_manager.implement_closure(|_, _| (), ())
|
||||||
pointer_manager.implement_closure(|_, _| (), ())
|
})
|
||||||
})
|
.unwrap();
|
||||||
.unwrap(),
|
|
||||||
)
|
*seat_manager
|
||||||
|
.relative_pointer_manager_proxy
|
||||||
|
.try_borrow_mut()
|
||||||
|
.unwrap() = Some(relative_pointer_manager_proxy);
|
||||||
}
|
}
|
||||||
if interface == "wl_seat" {
|
if interface == "wl_seat" {
|
||||||
seat_manager.add_seat(id, version, registry)
|
seat_manager.add_seat(id, version, registry)
|
||||||
|
@ -493,7 +496,7 @@ struct SeatManager<T: 'static> {
|
||||||
store: Arc<Mutex<WindowStore>>,
|
store: Arc<Mutex<WindowStore>>,
|
||||||
seats: Arc<Mutex<Vec<(u32, wl_seat::WlSeat)>>>,
|
seats: Arc<Mutex<Vec<(u32, wl_seat::WlSeat)>>>,
|
||||||
kbd_sender: ::calloop::channel::Sender<(crate::event::WindowEvent, super::WindowId)>,
|
kbd_sender: ::calloop::channel::Sender<(crate::event::WindowEvent, super::WindowId)>,
|
||||||
relative_pointer_manager_proxy: Option<ZwpRelativePointerManagerV1>,
|
relative_pointer_manager_proxy: Rc<RefCell<Option<ZwpRelativePointerManagerV1>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: 'static> SeatManager<T> {
|
impl<T: 'static> SeatManager<T> {
|
||||||
|
@ -505,7 +508,7 @@ impl<T: 'static> SeatManager<T> {
|
||||||
store: self.store.clone(),
|
store: self.store.clone(),
|
||||||
pointer: None,
|
pointer: None,
|
||||||
relative_pointer: None,
|
relative_pointer: None,
|
||||||
relative_pointer_manager_proxy: self.relative_pointer_manager_proxy.as_ref().cloned(),
|
relative_pointer_manager_proxy: self.relative_pointer_manager_proxy.clone(),
|
||||||
keyboard: None,
|
keyboard: None,
|
||||||
touch: None,
|
touch: None,
|
||||||
kbd_sender: self.kbd_sender.clone(),
|
kbd_sender: self.kbd_sender.clone(),
|
||||||
|
@ -537,7 +540,7 @@ struct SeatData<T> {
|
||||||
kbd_sender: ::calloop::channel::Sender<(crate::event::WindowEvent, super::WindowId)>,
|
kbd_sender: ::calloop::channel::Sender<(crate::event::WindowEvent, super::WindowId)>,
|
||||||
pointer: Option<wl_pointer::WlPointer>,
|
pointer: Option<wl_pointer::WlPointer>,
|
||||||
relative_pointer: Option<ZwpRelativePointerV1>,
|
relative_pointer: Option<ZwpRelativePointerV1>,
|
||||||
relative_pointer_manager_proxy: Option<ZwpRelativePointerManagerV1>,
|
relative_pointer_manager_proxy: Rc<RefCell<Option<ZwpRelativePointerManagerV1>>>,
|
||||||
keyboard: Option<wl_keyboard::WlKeyboard>,
|
keyboard: Option<wl_keyboard::WlKeyboard>,
|
||||||
touch: Option<wl_touch::WlTouch>,
|
touch: Option<wl_touch::WlTouch>,
|
||||||
modifiers_tracker: Arc<Mutex<ModifiersState>>,
|
modifiers_tracker: Arc<Mutex<ModifiersState>>,
|
||||||
|
@ -557,17 +560,19 @@ impl<T: 'static> SeatData<T> {
|
||||||
self.modifiers_tracker.clone(),
|
self.modifiers_tracker.clone(),
|
||||||
));
|
));
|
||||||
|
|
||||||
self.relative_pointer =
|
self.relative_pointer = self
|
||||||
self.relative_pointer_manager_proxy
|
.relative_pointer_manager_proxy
|
||||||
.as_ref()
|
.try_borrow()
|
||||||
.and_then(|manager| {
|
.unwrap()
|
||||||
super::pointer::implement_relative_pointer(
|
.as_ref()
|
||||||
self.sink.clone(),
|
.and_then(|manager| {
|
||||||
self.pointer.as_ref().unwrap(),
|
super::pointer::implement_relative_pointer(
|
||||||
manager,
|
self.sink.clone(),
|
||||||
)
|
self.pointer.as_ref().unwrap(),
|
||||||
.ok()
|
manager,
|
||||||
})
|
)
|
||||||
|
.ok()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
// destroy pointer if applicable
|
// destroy pointer if applicable
|
||||||
if !capabilities.contains(wl_seat::Capability::Pointer) {
|
if !capabilities.contains(wl_seat::Capability::Pointer) {
|
||||||
|
|
Loading…
Reference in a new issue