diff --git a/Cargo.lock b/Cargo.lock index 62a28f4..65cc27f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -831,9 +831,9 @@ dependencies = [ [[package]] name = "gbm" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f177420f6650dcd50042121adf7ff7ab265abdaf4862fe2624066e36e3a9ef34" +checksum = "313702b30cdeb83ddc72bc14dcee67803cd0ae2d12282ea06e368c25a900c844" dependencies = [ "bitflags 1.3.2", "drm", @@ -2053,7 +2053,7 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/Smithay/smithay?rev=1074914#1074914492783b25a4c2c49ce49a126d39994596" +source = "git+https://github.com/Smithay/smithay?rev=418190e#418190e4992ce642e6bac873307d4fc4fa9a1e89" dependencies = [ "appendlist", "ash", @@ -2128,7 +2128,7 @@ dependencies = [ [[package]] name = "smithay-drm-extras" version = "0.1.0" -source = "git+https://github.com/Smithay/smithay?rev=1074914#1074914492783b25a4c2c49ce49a126d39994596" +source = "git+https://github.com/Smithay/smithay?rev=418190e#418190e4992ce642e6bac873307d4fc4fa9a1e89" dependencies = [ "drm", "edid-rs", diff --git a/Cargo.toml b/Cargo.toml index ebc15eb..35042a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,8 +34,8 @@ repository.workspace = true keywords = ["wayland", "compositor", "smithay", "lua"] [dependencies] -smithay = { git = "https://github.com/Smithay/smithay", rev = "1074914", default-features = false, features = ["desktop", "wayland_frontend"] } -smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "1074914" } +smithay = { git = "https://github.com/Smithay/smithay", rev = "418190e", default-features = false, features = ["desktop", "wayland_frontend"] } +smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "418190e" } tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["env-filter", "registry"] } diff --git a/src/api.rs b/src/api.rs index 13c06cc..6bd1b88 100644 --- a/src/api.rs +++ b/src/api.rs @@ -1123,7 +1123,9 @@ impl window_service_server::WindowService for WindowService { let Some(window) = window_id.window(state) else { return }; match window { - WindowElement::Wayland(window) => window.toplevel().send_close(), + WindowElement::Wayland(window) => { + window.toplevel().expect("in wayland enum").send_close() + } WindowElement::X11(surface) => surface.close().expect("failed to close x11 win"), WindowElement::X11OverrideRedirect(_) => { tracing::warn!("tried to close override redirect window"); @@ -1431,7 +1433,7 @@ impl window_service_server::WindowService for WindowService { for window in state.space.elements() { if let WindowElement::Wayland(window) = window { - window.toplevel().send_configure(); + window.toplevel().expect("in wayland enum").send_configure(); } } diff --git a/src/backend/udev.rs b/src/backend/udev.rs index 8112493..89cdd5f 100644 --- a/src/backend/udev.rs +++ b/src/backend/udev.rs @@ -91,8 +91,12 @@ const SUPPORTED_FORMATS: &[Fourcc] = &[ const SUPPORTED_FORMATS_8BIT_ONLY: &[Fourcc] = &[Fourcc::Abgr8888, Fourcc::Argb8888]; /// A [`MultiRenderer`] that uses the [`GbmGlesBackend`]. -type UdevRenderer<'a, 'b> = - MultiRenderer<'a, 'a, 'b, GbmGlesBackend, GbmGlesBackend>; +type UdevRenderer<'a> = MultiRenderer< + 'a, + 'a, + GbmGlesBackend, + GbmGlesBackend, +>; /// Udev state attached to each [`Output`]. #[derive(Debug, PartialEq)] @@ -110,7 +114,7 @@ pub struct Udev { pub(super) dmabuf_state: Option<(DmabufState, DmabufGlobal)>, pub(super) primary_gpu: DrmNode, allocator: Option>>, - pub(super) gpu_manager: GpuManager>, + pub(super) gpu_manager: GpuManager>, backends: HashMap, pointer_images: Vec<(xcursor::parser::Image, TextureBuffer)>, pointer_element: PointerElement, @@ -226,10 +230,7 @@ impl BackendData for Udev { } fn early_import(&mut self, surface: &WlSurface) { - if let Err(err) = - self.gpu_manager - .early_import(Some(self.primary_gpu), self.primary_gpu, surface) - { + if let Err(err) = self.gpu_manager.early_import(self.primary_gpu, surface) { tracing::warn!("early buffer import failed: {}", err); } } @@ -556,7 +557,7 @@ enum DeviceAddError { fn get_surface_dmabuf_feedback( primary_gpu: DrmNode, render_node: DrmNode, - gpu_manager: &mut GpuManager>, + gpu_manager: &mut GpuManager>, composition: &GbmDrmCompositor, ) -> Option { let primary_formats = gpu_manager @@ -1210,18 +1211,8 @@ impl State { udev.gpu_manager.single_renderer(&render_node) } else { let format = surface.compositor.format(); - udev.gpu_manager.renderer( - &primary_gpu, - &render_node, - udev - .allocator - .as_mut() - // TODO: We could build some kind of `GLAllocator` using Renderbuffers in theory for this case. - // That would work for memcpy's of offscreen contents. - .expect("We need an allocator for multigpu systems") - .as_mut(), - format, - ) + udev.gpu_manager + .renderer(&primary_gpu, &render_node, format) } .expect("failed to create MultiRenderer"); @@ -1294,7 +1285,7 @@ fn render_surface_for_output<'a>( #[allow(clippy::too_many_arguments)] fn render_surface( surface: &mut RenderSurface, - renderer: &mut UdevRenderer<'_, '_>, + renderer: &mut UdevRenderer<'_>, output: &Output, space: &Space, diff --git a/src/focus.rs b/src/focus.rs index fd950b7..6ffcf3b 100644 --- a/src/focus.rs +++ b/src/focus.rs @@ -5,11 +5,12 @@ use smithay::{ input::{ keyboard::KeyboardTarget, pointer::{MotionEvent, PointerTarget}, + touch::{self, TouchTarget}, Seat, }, output::Output, reexports::wayland_server::{protocol::wl_surface::WlSurface, Resource}, - utils::{IsAlive, SERIAL_COUNTER}, + utils::{IsAlive, Serial, SERIAL_COUNTER}, wayland::seat::WaylandFocus, }; @@ -56,7 +57,7 @@ impl State { assert!(!win.is_x11_override_redirect()); if let WindowElement::Wayland(w) = win { - w.toplevel().send_configure(); + w.toplevel().expect("in wayland enum").send_configure(); } } @@ -140,9 +141,9 @@ impl TryFrom for WlSurface { impl PointerTarget for FocusTarget { fn frame(&self, seat: &Seat, data: &mut State) { match self { - FocusTarget::Window(window) => window.frame(seat, data), - FocusTarget::Popup(popup) => popup.wl_surface().frame(seat, data), - FocusTarget::LayerSurface(surf) => surf.frame(seat, data), + FocusTarget::Window(window) => PointerTarget::frame(window, seat, data), + FocusTarget::Popup(popup) => PointerTarget::frame(popup.wl_surface(), seat, data), + FocusTarget::LayerSurface(surf) => PointerTarget::frame(surf.wl_surface(), seat, data), } } @@ -152,7 +153,9 @@ impl PointerTarget for FocusTarget { FocusTarget::Popup(popup) => { PointerTarget::enter(popup.wl_surface(), seat, data, event); } - FocusTarget::LayerSurface(surf) => PointerTarget::enter(surf, seat, data, event), + FocusTarget::LayerSurface(surf) => { + PointerTarget::enter(surf.wl_surface(), seat, data, event) + } } } @@ -162,7 +165,9 @@ impl PointerTarget for FocusTarget { FocusTarget::Popup(popup) => { PointerTarget::motion(popup.wl_surface(), seat, data, event); } - FocusTarget::LayerSurface(surf) => PointerTarget::motion(surf, seat, data, event), + FocusTarget::LayerSurface(surf) => { + PointerTarget::motion(surf.wl_surface(), seat, data, event) + } } } @@ -180,7 +185,7 @@ impl PointerTarget for FocusTarget { PointerTarget::relative_motion(popup.wl_surface(), seat, data, event); } FocusTarget::LayerSurface(surf) => { - PointerTarget::relative_motion(surf, seat, data, event); + PointerTarget::relative_motion(surf.wl_surface(), seat, data, event); } } } @@ -196,7 +201,9 @@ impl PointerTarget for FocusTarget { FocusTarget::Popup(popup) => { PointerTarget::button(popup.wl_surface(), seat, data, event); } - FocusTarget::LayerSurface(surf) => PointerTarget::button(surf, seat, data, event), + FocusTarget::LayerSurface(surf) => { + PointerTarget::button(surf.wl_surface(), seat, data, event) + } } } @@ -209,23 +216,21 @@ impl PointerTarget for FocusTarget { match self { FocusTarget::Window(window) => PointerTarget::axis(window, seat, data, frame), FocusTarget::Popup(popup) => PointerTarget::axis(popup.wl_surface(), seat, data, frame), - FocusTarget::LayerSurface(surf) => PointerTarget::axis(surf, seat, data, frame), + FocusTarget::LayerSurface(surf) => { + PointerTarget::axis(surf.wl_surface(), seat, data, frame) + } } } - fn leave( - &self, - seat: &Seat, - data: &mut State, - serial: smithay::utils::Serial, - time: u32, - ) { + fn leave(&self, seat: &Seat, data: &mut State, serial: Serial, time: u32) { match self { FocusTarget::Window(window) => PointerTarget::leave(window, seat, data, serial, time), FocusTarget::Popup(popup) => { PointerTarget::leave(popup.wl_surface(), seat, data, serial, time); } - FocusTarget::LayerSurface(surf) => PointerTarget::leave(surf, seat, data, serial, time), + FocusTarget::LayerSurface(surf) => { + PointerTarget::leave(surf.wl_surface(), seat, data, serial, time) + } } } @@ -308,7 +313,7 @@ impl KeyboardTarget for FocusTarget { seat: &Seat, data: &mut State, keys: Vec>, - serial: smithay::utils::Serial, + serial: Serial, ) { match self { FocusTarget::Window(window) => KeyboardTarget::enter(window, seat, data, keys, serial), @@ -316,18 +321,20 @@ impl KeyboardTarget for FocusTarget { KeyboardTarget::enter(popup.wl_surface(), seat, data, keys, serial); } FocusTarget::LayerSurface(surf) => { - KeyboardTarget::enter(surf, seat, data, keys, serial); + KeyboardTarget::enter(surf.wl_surface(), seat, data, keys, serial); } } } - fn leave(&self, seat: &Seat, data: &mut State, serial: smithay::utils::Serial) { + fn leave(&self, seat: &Seat, data: &mut State, serial: Serial) { match self { FocusTarget::Window(window) => KeyboardTarget::leave(window, seat, data, serial), FocusTarget::Popup(popup) => { KeyboardTarget::leave(popup.wl_surface(), seat, data, serial); } - FocusTarget::LayerSurface(surf) => KeyboardTarget::leave(surf, seat, data, serial), + FocusTarget::LayerSurface(surf) => { + KeyboardTarget::leave(surf.wl_surface(), seat, data, serial) + } } } @@ -337,7 +344,7 @@ impl KeyboardTarget for FocusTarget { data: &mut State, key: smithay::input::keyboard::KeysymHandle<'_>, state: smithay::backend::input::KeyState, - serial: smithay::utils::Serial, + serial: Serial, time: u32, ) { match self { @@ -348,7 +355,7 @@ impl KeyboardTarget for FocusTarget { KeyboardTarget::key(popup.wl_surface(), seat, data, key, state, serial, time); } FocusTarget::LayerSurface(surf) => { - KeyboardTarget::key(surf, seat, data, key, state, serial, time); + KeyboardTarget::key(surf.wl_surface(), seat, data, key, state, serial, time); } } } @@ -358,7 +365,7 @@ impl KeyboardTarget for FocusTarget { seat: &Seat, data: &mut State, modifiers: smithay::input::keyboard::ModifiersState, - serial: smithay::utils::Serial, + serial: Serial, ) { match self { FocusTarget::Window(window) => { @@ -368,12 +375,54 @@ impl KeyboardTarget for FocusTarget { KeyboardTarget::modifiers(popup.wl_surface(), seat, data, modifiers, serial); } FocusTarget::LayerSurface(surf) => { - KeyboardTarget::modifiers(surf, seat, data, modifiers, serial); + KeyboardTarget::modifiers(surf.wl_surface(), seat, data, modifiers, serial); } } } } +impl TouchTarget for FocusTarget { + fn down(&self, seat: &Seat, data: &mut State, event: &touch::DownEvent, seq: Serial) { + todo!() + } + + fn up(&self, seat: &Seat, data: &mut State, event: &touch::UpEvent, seq: Serial) { + todo!() + } + + fn motion( + &self, + seat: &Seat, + data: &mut State, + event: &touch::MotionEvent, + seq: Serial, + ) { + todo!() + } + + fn frame(&self, seat: &Seat, data: &mut State, seq: Serial) { + todo!() + } + + fn cancel(&self, seat: &Seat, data: &mut State, seq: Serial) { + todo!() + } + + fn shape(&self, seat: &Seat, data: &mut State, event: &touch::ShapeEvent, seq: Serial) { + todo!() + } + + fn orientation( + &self, + seat: &Seat, + data: &mut State, + event: &touch::OrientationEvent, + seq: Serial, + ) { + todo!() + } +} + impl WaylandFocus for FocusTarget { fn wl_surface(&self) -> Option { match self { diff --git a/src/grab/resize_grab.rs b/src/grab/resize_grab.rs index f4b4f24..4e84321 100644 --- a/src/grab/resize_grab.rs +++ b/src/grab/resize_grab.rs @@ -160,7 +160,7 @@ impl PointerGrab for ResizeSurfaceGrab { match &self.window { WindowElement::Wayland(window) => { - let toplevel_surface = window.toplevel(); + let toplevel_surface = window.toplevel().expect("in wayland enum"); toplevel_surface.with_pending_state(|state| { state.states.set(xdg_toplevel::State::Resizing); @@ -210,7 +210,7 @@ impl PointerGrab for ResizeSurfaceGrab { match &self.window { WindowElement::Wayland(window) => { - let toplevel_surface = window.toplevel(); + let toplevel_surface = window.toplevel().expect("in wayland enum"); toplevel_surface.with_pending_state(|state| { state.states.unset(xdg_toplevel::State::Resizing); state.size = Some(self.last_window_size); @@ -459,11 +459,17 @@ pub fn resize_request_client( let initial_window_size = window.geometry().size; if let Some(WindowElement::Wayland(window)) = state.window_for_surface(surface) { - window.toplevel().with_pending_state(|state| { - state.states.set(xdg_toplevel::State::Resizing); - }); + window + .toplevel() + .expect("in wayland enum") + .with_pending_state(|state| { + state.states.set(xdg_toplevel::State::Resizing); + }); - window.toplevel().send_pending_configure(); + window + .toplevel() + .expect("in wayland enum") + .send_pending_configure(); } let grab = ResizeSurfaceGrab::start( @@ -507,11 +513,17 @@ pub fn resize_request_server( let initial_window_size = window.geometry().size; if let Some(WindowElement::Wayland(window)) = state.window_for_surface(surface) { - window.toplevel().with_pending_state(|state| { - state.states.set(xdg_toplevel::State::Resizing); - }); + window + .toplevel() + .expect("in wayland enum") + .with_pending_state(|state| { + state.states.set(xdg_toplevel::State::Resizing); + }); - window.toplevel().send_pending_configure(); + window + .toplevel() + .expect("in wayland enum") + .send_pending_configure(); } let start_data = smithay::input::pointer::GrabStartData { diff --git a/src/handlers.rs b/src/handlers.rs index cc3b819..a958c08 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -194,7 +194,7 @@ impl CompositorHandler for State { if !initial_configure_sent { tracing::debug!("Initial configure"); - window.toplevel().send_configure(); + window.toplevel().expect("in wayland enum").send_configure(); } } @@ -280,7 +280,7 @@ fn ensure_initial_configure(surface: &WlSurface, state: &mut State) { if !initial_configure_sent { tracing::debug!("Initial configure"); - window.toplevel().send_configure(); + window.toplevel().expect("in wayland enum").send_configure(); } } return; @@ -406,6 +406,7 @@ delegate_data_control!(State); impl SeatHandler for State { type KeyboardFocus = FocusTarget; type PointerFocus = FocusTarget; + type TouchFocus = FocusTarget; fn seat_state(&mut self) -> &mut SeatState { &mut self.seat_state diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index f2a02a5..5fe8309 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -41,7 +41,7 @@ impl XdgShellHandler for State { state.states.set(xdg_toplevel::State::TiledRight); }); - let window = WindowElement::Wayland(Window::new(surface.clone())); + let window = WindowElement::Wayland(Window::new_wayland_window(surface.clone())); self.new_windows.push(window); // if let (Some(output), _) | (None, Some(output)) = ( @@ -139,7 +139,7 @@ impl XdgShellHandler for State { self.space.raise_element(win, true); self.z_index_stack.set_focus(win.clone()); if let WindowElement::Wayland(win) = &win { - win.toplevel().send_configure(); + win.toplevel().expect("in wayland enum").send_configure(); } } self.seat diff --git a/src/handlers/xwayland.rs b/src/handlers/xwayland.rs index 310cfc9..4e5a4f5 100644 --- a/src/handlers/xwayland.rs +++ b/src/handlers/xwayland.rs @@ -179,7 +179,7 @@ impl XwmHandler for State { self.space.raise_element(win, true); self.z_index_stack.set_focus(win.clone()); if let WindowElement::Wayland(win) = &win { - win.toplevel().send_configure(); + win.toplevel().expect("in wayland enum").send_configure(); } } @@ -242,7 +242,7 @@ impl XwmHandler for State { self.space.raise_element(win, true); self.z_index_stack.set_focus(win.clone()); if let WindowElement::Wayland(win) = &win { - win.toplevel().send_configure(); + win.toplevel().expect("in wayland enum").send_configure(); } } diff --git a/src/input.rs b/src/input.rs index c6a1d5c..e40d2e4 100644 --- a/src/input.rs +++ b/src/input.rs @@ -358,7 +358,7 @@ impl State { for window in self.space.elements() { if let WindowElement::Wayland(window) = window { - window.toplevel().send_configure(); + window.toplevel().expect("in wayland enum").send_configure(); } } } else { @@ -368,7 +368,7 @@ impl State { for window in state.focus_stack.stack.iter() { window.set_activate(false); if let WindowElement::Wayland(window) = window { - window.toplevel().send_configure(); + window.toplevel().expect("in wayland enum").send_configure(); } } }); diff --git a/src/layout.rs b/src/layout.rs index ab16be6..5bacc9e 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -117,8 +117,9 @@ impl State { if win.with_state(|state| state.target_loc.is_some()) { match win { WindowElement::Wayland(wl_win) => { - let pending = - compositor::with_states(wl_win.toplevel().wl_surface(), |states| { + let pending = compositor::with_states( + wl_win.toplevel().expect("in wayland enum").wl_surface(), + |states| { states .data_map .get::() @@ -126,10 +127,14 @@ impl State { .lock() .expect("Failed to lock Mutex") .has_pending_changes() - }); + }, + ); if pending { - pending_wins.push((win.clone(), wl_win.toplevel().send_configure())) + pending_wins.push(( + win.clone(), + wl_win.toplevel().expect("in wayland enum").send_configure(), + )) } else { let loc = win.with_state(|state| state.target_loc.take()); if let Some(loc) = loc { diff --git a/src/render.rs b/src/render.rs index a6190e9..849aebd 100644 --- a/src/render.rs +++ b/src/render.rs @@ -310,6 +310,7 @@ where if let WindowElement::Wayland(window) = win { window .toplevel() + .expect("in wayland enum") .current_state() .states .contains(xdg_toplevel::State::Fullscreen) diff --git a/src/window.rs b/src/window.rs index c20f973..eeff825 100644 --- a/src/window.rs +++ b/src/window.rs @@ -193,9 +193,12 @@ impl WindowElement { pub fn change_geometry(&self, new_geo: Rectangle) { match self { WindowElement::Wayland(window) => { - window.toplevel().with_pending_state(|state| { - state.size = Some(new_geo.size); - }); + window + .toplevel() + .expect("in wayland enum") + .with_pending_state(|state| { + state.size = Some(new_geo.size); + }); } WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { // TODO: maybe move this check elsewhere idk @@ -217,8 +220,9 @@ impl WindowElement { pub fn class(&self) -> Option { match self { - WindowElement::Wayland(window) => { - compositor::with_states(window.toplevel().wl_surface(), |states| { + WindowElement::Wayland(window) => compositor::with_states( + window.toplevel().expect("in wayland enum").wl_surface(), + |states| { states .data_map .get::() @@ -227,8 +231,8 @@ impl WindowElement { .expect("Failed to lock Mutex") .app_id .clone() - }) - } + }, + ), WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { Some(surface.class()) } @@ -238,8 +242,9 @@ impl WindowElement { pub fn title(&self) -> Option { match self { - WindowElement::Wayland(window) => { - compositor::with_states(window.toplevel().wl_surface(), |states| { + WindowElement::Wayland(window) => compositor::with_states( + window.toplevel().expect("in wayland enum").wl_surface(), + |states| { states .data_map .get::() @@ -248,8 +253,8 @@ impl WindowElement { .expect("Failed to lock Mutex") .title .clone() - }) - } + }, + ), WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { Some(surface.title()) } @@ -335,7 +340,10 @@ impl WindowElement { impl PointerTarget for WindowElement { fn frame(&self, seat: &Seat, state: &mut State) { match self { - WindowElement::Wayland(window) => window.frame(seat, state), + WindowElement::Wayland(window) => window + .wl_surface() + .expect("in wayland enum") + .frame(seat, state), WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { surface.frame(seat, state) } @@ -346,7 +354,12 @@ impl PointerTarget for WindowElement { fn enter(&self, seat: &Seat, state: &mut State, event: &MotionEvent) { // TODO: ssd match self { - WindowElement::Wayland(window) => PointerTarget::enter(window, seat, state, event), + WindowElement::Wayland(window) => PointerTarget::enter( + &window.wl_surface().expect("in wayland enum"), + seat, + state, + event, + ), WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { PointerTarget::enter(surface, seat, state, event) } @@ -364,7 +377,12 @@ impl PointerTarget for WindowElement { fn motion(&self, seat: &Seat, state: &mut State, event: &MotionEvent) { // TODO: ssd match self { - WindowElement::Wayland(window) => PointerTarget::motion(window, seat, state, event), + WindowElement::Wayland(window) => PointerTarget::motion( + &window.wl_surface().expect("in wayland enum"), + seat, + state, + event, + ), WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { PointerTarget::motion(surface, seat, state, event) } @@ -381,7 +399,12 @@ impl PointerTarget for WindowElement { // TODO: ssd match self { WindowElement::Wayland(window) => { - PointerTarget::relative_motion(window, seat, state, event); + PointerTarget::relative_motion( + &window.wl_surface().expect("in wayland enum"), + seat, + state, + event, + ); } WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { PointerTarget::relative_motion(surface, seat, state, event); @@ -398,7 +421,12 @@ impl PointerTarget for WindowElement { ) { // TODO: ssd match self { - WindowElement::Wayland(window) => PointerTarget::button(window, seat, state, event), + WindowElement::Wayland(window) => PointerTarget::button( + &window.wl_surface().expect("in wayland enum"), + seat, + state, + event, + ), WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { PointerTarget::button(surface, seat, state, event) } @@ -409,7 +437,12 @@ impl PointerTarget for WindowElement { fn axis(&self, seat: &Seat, state: &mut State, frame: AxisFrame) { // TODO: ssd match self { - WindowElement::Wayland(window) => PointerTarget::axis(window, seat, state, frame), + WindowElement::Wayland(window) => PointerTarget::axis( + &window.wl_surface().expect("in wayland enum"), + seat, + state, + frame, + ), WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { PointerTarget::axis(surface, seat, state, frame) } @@ -421,7 +454,13 @@ impl PointerTarget for WindowElement { // TODO: ssd match self { WindowElement::Wayland(window) => { - PointerTarget::leave(window, seat, state, serial, time); + PointerTarget::leave( + &window.wl_surface().expect("in wayland enum"), + seat, + state, + serial, + time, + ); } WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { PointerTarget::leave(surface, seat, state, serial, time) @@ -520,7 +559,13 @@ impl KeyboardTarget for WindowElement { ) { match self { WindowElement::Wayland(window) => { - KeyboardTarget::enter(window, seat, state, keys, serial); + KeyboardTarget::enter( + &window.wl_surface().expect("in wayland enum"), + seat, + state, + keys, + serial, + ); } WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { KeyboardTarget::enter(surface, seat, state, keys, serial) @@ -531,7 +576,12 @@ impl KeyboardTarget for WindowElement { fn leave(&self, seat: &Seat, state: &mut State, serial: Serial) { match self { - WindowElement::Wayland(window) => KeyboardTarget::leave(window, seat, state, serial), + WindowElement::Wayland(window) => KeyboardTarget::leave( + &window.wl_surface().expect("in wayland enum"), + seat, + state, + serial, + ), WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { KeyboardTarget::leave(surface, seat, state, serial) } @@ -550,7 +600,15 @@ impl KeyboardTarget for WindowElement { ) { match self { WindowElement::Wayland(window) => { - KeyboardTarget::key(window, seat, state, key, key_state, serial, time); + KeyboardTarget::key( + &window.wl_surface().expect("in wayland enum"), + seat, + state, + key, + key_state, + serial, + time, + ); } WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { KeyboardTarget::key(surface, seat, state, key, key_state, serial, time); @@ -568,7 +626,13 @@ impl KeyboardTarget for WindowElement { ) { match self { WindowElement::Wayland(window) => { - KeyboardTarget::modifiers(window, seat, state, modifiers, serial); + KeyboardTarget::modifiers( + &window.wl_surface().expect("in wayland enum"), + seat, + state, + modifiers, + serial, + ); } WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => { KeyboardTarget::modifiers(surface, seat, state, modifiers, serial); diff --git a/src/window/window_state.rs b/src/window/window_state.rs index e9db349..6df4710 100644 --- a/src/window/window_state.rs +++ b/src/window/window_state.rs @@ -83,14 +83,17 @@ impl WindowElement { match self { WindowElement::Wayland(window) => { - window.toplevel().with_pending_state(|state| { - state.states.unset(xdg_toplevel::State::Maximized); - state.states.set(xdg_toplevel::State::Fullscreen); - state.states.set(xdg_toplevel::State::TiledTop); - state.states.set(xdg_toplevel::State::TiledLeft); - state.states.set(xdg_toplevel::State::TiledBottom); - state.states.set(xdg_toplevel::State::TiledRight); - }); + window + .toplevel() + .expect("in wayland enum") + .with_pending_state(|state| { + state.states.unset(xdg_toplevel::State::Maximized); + state.states.set(xdg_toplevel::State::Fullscreen); + state.states.set(xdg_toplevel::State::TiledTop); + state.states.set(xdg_toplevel::State::TiledLeft); + state.states.set(xdg_toplevel::State::TiledBottom); + state.states.set(xdg_toplevel::State::TiledRight); + }); } WindowElement::X11(surface) => { surface @@ -130,14 +133,17 @@ impl WindowElement { match self { WindowElement::Wayland(window) => { - window.toplevel().with_pending_state(|state| { - state.states.set(xdg_toplevel::State::Maximized); - state.states.unset(xdg_toplevel::State::Fullscreen); - state.states.set(xdg_toplevel::State::TiledTop); - state.states.set(xdg_toplevel::State::TiledLeft); - state.states.set(xdg_toplevel::State::TiledBottom); - state.states.set(xdg_toplevel::State::TiledRight); - }); + window + .toplevel() + .expect("in wayland enum") + .with_pending_state(|state| { + state.states.set(xdg_toplevel::State::Maximized); + state.states.unset(xdg_toplevel::State::Fullscreen); + state.states.set(xdg_toplevel::State::TiledTop); + state.states.set(xdg_toplevel::State::TiledLeft); + state.states.set(xdg_toplevel::State::TiledBottom); + state.states.set(xdg_toplevel::State::TiledRight); + }); } WindowElement::X11(surface) => { surface @@ -172,14 +178,17 @@ impl WindowElement { fn set_floating_states(&self) { match self { WindowElement::Wayland(window) => { - window.toplevel().with_pending_state(|state| { - state.states.unset(xdg_toplevel::State::Maximized); - state.states.unset(xdg_toplevel::State::Fullscreen); - state.states.unset(xdg_toplevel::State::TiledTop); - state.states.unset(xdg_toplevel::State::TiledLeft); - state.states.unset(xdg_toplevel::State::TiledBottom); - state.states.unset(xdg_toplevel::State::TiledRight); - }); + window + .toplevel() + .expect("in wayland enum") + .with_pending_state(|state| { + state.states.unset(xdg_toplevel::State::Maximized); + state.states.unset(xdg_toplevel::State::Fullscreen); + state.states.unset(xdg_toplevel::State::TiledTop); + state.states.unset(xdg_toplevel::State::TiledLeft); + state.states.unset(xdg_toplevel::State::TiledBottom); + state.states.unset(xdg_toplevel::State::TiledRight); + }); } WindowElement::X11(surface) => { surface @@ -199,14 +208,17 @@ impl WindowElement { fn set_tiled_states(&self) { match self { WindowElement::Wayland(window) => { - window.toplevel().with_pending_state(|state| { - state.states.unset(xdg_toplevel::State::Maximized); - state.states.unset(xdg_toplevel::State::Fullscreen); - state.states.set(xdg_toplevel::State::TiledTop); - state.states.set(xdg_toplevel::State::TiledLeft); - state.states.set(xdg_toplevel::State::TiledBottom); - state.states.set(xdg_toplevel::State::TiledRight); - }); + window + .toplevel() + .expect("in wayland enum") + .with_pending_state(|state| { + state.states.unset(xdg_toplevel::State::Maximized); + state.states.unset(xdg_toplevel::State::Fullscreen); + state.states.set(xdg_toplevel::State::TiledTop); + state.states.set(xdg_toplevel::State::TiledLeft); + state.states.set(xdg_toplevel::State::TiledBottom); + state.states.set(xdg_toplevel::State::TiledRight); + }); } WindowElement::X11(surface) => { surface