diff --git a/winit-orbital/src/event_loop.rs b/winit-orbital/src/event_loop.rs index dbebd7f8..651560ee 100644 --- a/winit-orbital/src/event_loop.rs +++ b/winit-orbital/src/event_loop.rs @@ -1,6 +1,5 @@ use std::cell::Cell; use std::collections::VecDeque; -use std::os::raw::c_long; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex, mpsc}; use std::time::Instant; @@ -659,7 +658,7 @@ impl EventLoop { if let Some(duration) = instant.checked_duration_since(start) { time.tv_sec += duration.as_secs() as i64; - time.tv_nsec += duration.subsec_nanos() as c_long; + time.tv_nsec += duration.subsec_nanos() as i64; // Normalize timespec so tv_nsec is not greater than one second. while time.tv_nsec >= 1_000_000_000 { time.tv_sec += 1; diff --git a/winit-wayland/src/seat/touch/mod.rs b/winit-wayland/src/seat/touch/mod.rs index 3c0c04fc..f0c9bab0 100644 --- a/winit-wayland/src/seat/touch/mod.rs +++ b/winit-wayland/src/seat/touch/mod.rs @@ -19,7 +19,7 @@ impl TouchHandler for WinitState { _: &Connection, _: &QueueHandle, touch: &WlTouch, - serial: u32, + _: u32, _: u32, surface: WlSurface, id: i32, @@ -27,12 +27,7 @@ impl TouchHandler for WinitState { ) { let window_id = crate::make_wid(&surface); let scale_factor = match self.windows.get_mut().get(&window_id) { - Some(window) => { - let mut window = window.lock().unwrap(); - // Remember the serial so drag/resize requests can use it while the finger is down. - window.touch_down = Some((touch.seat().clone(), serial)); - window.scale_factor() - }, + Some(window) => window.lock().unwrap().scale_factor(), None => return, }; @@ -110,15 +105,8 @@ impl TouchHandler for WinitState { } let window_id = crate::make_wid(&touch_point.surface); - let still_touched = seat_state.touch_map.values().any(|p| p.surface == touch_point.surface); let scale_factor = match self.windows.get_mut().get(&window_id) { - Some(window) => { - let mut window = window.lock().unwrap(); - if !still_touched { - window.touch_down = None; - } - window.scale_factor() - }, + Some(window) => window.lock().unwrap().scale_factor(), None => return, }; @@ -205,11 +193,7 @@ impl TouchHandler for WinitState { for (id, touch_point) in seat_state.touch_map.drain() { let window_id = crate::make_wid(&touch_point.surface); let scale_factor = match self.windows.get_mut().get(&window_id) { - Some(window) => { - let mut window = window.lock().unwrap(); - window.touch_down = None; - window.scale_factor() - }, + Some(window) => window.lock().unwrap().scale_factor(), None => return, }; diff --git a/winit-wayland/src/window/state.rs b/winit-wayland/src/window/state.rs index 8e58bfc4..4c072cd9 100644 --- a/winit-wayland/src/window/state.rs +++ b/winit-wayland/src/window/state.rs @@ -69,9 +69,6 @@ pub struct WindowState { /// The pointers observed on the window. pub pointers: Vec>>, - /// The seat and serial of the touch currently down on the window, if any. - pub touch_down: Option<(WlSeat, u32)>, - selected_cursor: SelectedCursor, /// Whether the cursor is visible. @@ -227,7 +224,6 @@ impl WindowState { min_surface_size: MIN_WINDOW_SIZE, pointer_constraints, pointers: Default::default(), - touch_down: None, queue_handle: queue_handle.clone(), resizable: true, scale_factor: 1., @@ -418,11 +414,7 @@ impl WindowState { pub fn drag_resize_window(&self, direction: ResizeDirection) -> Result<(), RequestError> { let xdg_toplevel = self.window.xdg_toplevel(); - if let Some((seat, serial)) = &self.touch_down { - xdg_toplevel.resize(seat, *serial, resize_direction_to_xdg(direction)); - return Ok(()); - } - + // TODO(kchibisov) handle touch serials. self.apply_on_pointer(|_, data| { let serial = data.latest_button_serial(); let seat = data.seat(); @@ -435,11 +427,7 @@ impl WindowState { /// Start the window drag. pub fn drag_window(&self) -> Result<(), RequestError> { let xdg_toplevel = self.window.xdg_toplevel(); - if let Some((seat, serial)) = &self.touch_down { - xdg_toplevel._move(seat, *serial); - return Ok(()); - } - + // TODO(kchibisov) handle touch serials. self.apply_on_pointer(|_, data| { let serial = data.latest_button_serial(); let seat = data.seat(); @@ -928,11 +916,7 @@ impl WindowState { } pub fn show_window_menu(&self, position: LogicalPosition) { - if let Some((seat, serial)) = &self.touch_down { - self.window.show_window_menu(seat, *serial, position.into()); - return; - } - + // TODO(kchibisov) handle touch serials. self.apply_on_pointer(|_, data| { let serial = data.latest_button_serial(); let seat = data.seat();