Upgrade Smithay (virtual_keyboard revert, clipboard destroy cleanup, xdg-shell v7)
Browse files at this commitf4dc10e0b415bee33a6f482cd5a298a25b184605Parent: b82d5277 changed files +7 -178
- Cargo.lock +2 -2
- src/handlers/mod.rs +2 -1
- src/input/backend_ext.rs +0 -7
- src/input/mod.rs +3 -29
- src/niri.rs +0 -6
- src/protocols/mod.rs +0 -1
- src/protocols/virtual_keyboard.rs +0 -132
Cargo.lockmodified+2 -2
| @@ -3475,7 +3475,7 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" | ||
| 3475 | 3475 | [[package]] |
| 3476 | 3476 | name = "smithay" |
| 3477 | 3477 | version = "0.7.0" |
| 3478 | -source = "git+https://github.com/Smithay/smithay.git#ae14fa12f6ee3fc4dd4c766ffb21848f991a6a18" | |
| 3478 | +source = "git+https://github.com/Smithay/smithay.git#f1d0d2c43e843233119af3dcf76d619e1afff4ee" | |
| 3479 | 3479 | dependencies = [ |
| 3480 | 3480 | "aliasable", |
| 3481 | 3481 | "appendlist", |
| @@ -3550,7 +3550,7 @@ dependencies = [ | ||
| 3550 | 3550 | [[package]] |
| 3551 | 3551 | name = "smithay-drm-extras" |
| 3552 | 3552 | version = "0.1.0" |
| 3553 | -source = "git+https://github.com/Smithay/smithay.git#ae14fa12f6ee3fc4dd4c766ffb21848f991a6a18" | |
| 3553 | +source = "git+https://github.com/Smithay/smithay.git#f1d0d2c43e843233119af3dcf76d619e1afff4ee" | |
| 3554 | 3554 | dependencies = [ |
| 3555 | 3555 | "drm", |
| 3556 | 3556 | "libdisplay-info", |
src/handlers/mod.rsmodified+2 -1
| @@ -68,7 +68,7 @@ use smithay::{ | ||
| 68 | 68 | delegate_pointer_gestures, delegate_presentation, delegate_primary_selection, |
| 69 | 69 | delegate_relative_pointer, delegate_seat, delegate_security_context, delegate_session_lock, |
| 70 | 70 | delegate_single_pixel_buffer, delegate_tablet_manager, delegate_text_input_manager, |
| 71 | - delegate_viewporter, delegate_xdg_activation, | |
| 71 | + delegate_viewporter, delegate_virtual_keyboard_manager, delegate_xdg_activation, | |
| 72 | 72 | }; |
| 73 | 73 | |
| 74 | 74 | pub use crate::handlers::xdg_shell::KdeDecorationsModeState; |
| @@ -279,6 +279,7 @@ impl KeyboardShortcutsInhibitHandler for State { | ||
| 279 | 279 | |
| 280 | 280 | delegate_input_method_manager!(State); |
| 281 | 281 | delegate_keyboard_shortcuts_inhibit!(State); |
| 282 | +delegate_virtual_keyboard_manager!(State); | |
| 282 | 283 | |
| 283 | 284 | impl SelectionHandler for State { |
| 284 | 285 | type SelectionUserData = Arc<[u8]>; |
src/input/backend_ext.rsmodified+0 -7
| @@ -4,7 +4,6 @@ use smithay::backend::winit::WinitVirtualDevice; | ||
| 4 | 4 | use smithay::output::Output; |
| 5 | 5 | |
| 6 | 6 | use crate::niri::State; |
| 7 | -use crate::protocols::virtual_keyboard::VirtualKeyboard; | |
| 8 | 7 | use crate::protocols::virtual_pointer::VirtualPointer; |
| 9 | 8 | |
| 10 | 9 | pub trait NiriInputBackend: input::InputBackend<Device = Self::NiriDevice> { |
| @@ -45,12 +44,6 @@ impl NiriInputDevice for WinitVirtualDevice { | ||
| 45 | 44 | } |
| 46 | 45 | } |
| 47 | 46 | |
| 48 | -impl NiriInputDevice for VirtualKeyboard { | |
| 49 | - fn output(&self, _: &State) -> Option<Output> { | |
| 50 | - None | |
| 51 | - } | |
| 52 | -} | |
| 53 | - | |
| 54 | 47 | impl NiriInputDevice for VirtualPointer { |
| 55 | 48 | fn output(&self, _: &State) -> Option<Output> { |
| 56 | 49 | self.output().cloned() |
src/input/mod.rsmodified+3 -29
| @@ -7,7 +7,7 @@ use std::time::Duration; | ||
| 7 | 7 | use calloop::timer::{TimeoutAction, Timer}; |
| 8 | 8 | use input::event::gesture::GestureEventCoordinates as _; |
| 9 | 9 | use niri_config::{ |
| 10 | - Action, Bind, Binds, Config, Key, ModKey, Modifiers, MruDirection, SwitchBinds, Trigger, Xkb, | |
| 10 | + Action, Bind, Binds, Config, Key, ModKey, Modifiers, MruDirection, SwitchBinds, Trigger, | |
| 11 | 11 | }; |
| 12 | 12 | use niri_ipc::LayoutSwitchTarget; |
| 13 | 13 | use smithay::backend::input::{ |
| @@ -48,7 +48,6 @@ use crate::dbus::freedesktop_a11y::KbMonBlock; | ||
| 48 | 48 | use crate::layout::scrolling::ScrollDirection; |
| 49 | 49 | use crate::layout::{ActivateWindow, LayoutElement as _}; |
| 50 | 50 | use crate::niri::{CastTarget, PointerVisibility, State}; |
| 51 | -use crate::protocols::virtual_keyboard::VirtualKeyboard; | |
| 52 | 51 | use crate::ui::mru::{WindowMru, WindowMruUi}; |
| 53 | 52 | use crate::ui::screenshot_ui::ScreenshotUi; |
| 54 | 53 | use crate::utils::spawning::{spawn, spawn_sh}; |
| @@ -361,36 +360,11 @@ impl State { | ||
| 361 | 360 | .is_some_and(KeyboardShortcutsInhibitor::is_active) |
| 362 | 361 | } |
| 363 | 362 | |
| 364 | - fn on_keyboard<I: InputBackend + 'static>( | |
| 363 | + fn on_keyboard<I: InputBackend>( | |
| 365 | 364 | &mut self, |
| 366 | 365 | event: I::KeyboardKeyEvent, |
| 367 | 366 | consumed_by_a11y: &mut bool, |
| 368 | - ) where | |
| 369 | - I::Device: 'static, | |
| 370 | - { | |
| 371 | - // Reset the keymap when handling a physical keyboard after a virtual one. | |
| 372 | - if self.niri.reset_keymap { | |
| 373 | - let device = event.device(); | |
| 374 | - let is_virtual_keyboard = (&device as &dyn Any) | |
| 375 | - .downcast_ref::<VirtualKeyboard>() | |
| 376 | - .is_some(); | |
| 377 | - if !is_virtual_keyboard { | |
| 378 | - self.niri.reset_keymap = false; | |
| 379 | - | |
| 380 | - let config = self.niri.config.borrow(); | |
| 381 | - let xkb_config = config.input.keyboard.xkb.clone(); | |
| 382 | - std::mem::drop(config); | |
| 383 | - | |
| 384 | - if xkb_config != Xkb::default() { | |
| 385 | - self.set_xkb_config(xkb_config.to_xkb_config()); | |
| 386 | - } else { | |
| 387 | - // Use locale1 settings if xkb config is unset. | |
| 388 | - let xkb = self.niri.xkb_from_locale1.clone().unwrap_or_default(); | |
| 389 | - self.set_xkb_config(xkb.to_xkb_config()); | |
| 390 | - } | |
| 391 | - } | |
| 392 | - } | |
| 393 | - | |
| 367 | + ) { | |
| 394 | 368 | let mod_key = self.backend.mod_key(&self.niri.config.borrow()); |
| 395 | 369 | |
| 396 | 370 | let serial = SERIAL_COUNTER.next_serial(); |
src/niri.rsmodified+0 -6
| @@ -331,11 +331,6 @@ pub struct Niri { | ||
| 331 | 331 | /// Most recent XKB settings from org.freedesktop.locale1. |
| 332 | 332 | pub xkb_from_locale1: Option<Xkb>, |
| 333 | 333 | |
| 334 | - /// Whether to reset the keymap on the next physical keyboard event. | |
| 335 | - /// | |
| 336 | - /// Set to true when handling virtual keyboard events which override the keymap. | |
| 337 | - pub reset_keymap: bool, | |
| 338 | - | |
| 339 | 334 | pub cursor_manager: CursorManager, |
| 340 | 335 | pub cursor_texture_cache: CursorTextureCache, |
| 341 | 336 | pub cursor_shape_manager_state: CursorShapeManagerState, |
| @@ -2510,7 +2505,6 @@ impl Niri { | ||
| 2510 | 2505 | is_fdo_idle_inhibited: Arc::new(AtomicBool::new(false)), |
| 2511 | 2506 | keyboard_shortcuts_inhibiting_surfaces: HashMap::new(), |
| 2512 | 2507 | xkb_from_locale1: None, |
| 2513 | - reset_keymap: false, | |
| 2514 | 2508 | cursor_manager, |
| 2515 | 2509 | cursor_texture_cache: Default::default(), |
| 2516 | 2510 | cursor_shape_manager_state, |
src/protocols/mod.rsmodified+0 -1
| @@ -4,7 +4,6 @@ pub mod gamma_control; | ||
| 4 | 4 | pub mod mutter_x11_interop; |
| 5 | 5 | pub mod output_management; |
| 6 | 6 | pub mod screencopy; |
| 7 | -pub mod virtual_keyboard; | |
| 8 | 7 | pub mod virtual_pointer; |
| 9 | 8 | |
| 10 | 9 | pub mod raw; |
src/protocols/virtual_keyboard.rsdeleted+0 -132
| @@ -1,132 +0,0 @@ | ||
| 1 | -use smithay::backend::input::{ | |
| 2 | - Device, DeviceCapability, Event, InputBackend, InputEvent, KeyState, KeyboardKeyEvent, Keycode, | |
| 3 | - UnusedEvent, | |
| 4 | -}; | |
| 5 | -use smithay::delegate_virtual_keyboard_manager; | |
| 6 | -use smithay::input::keyboard::xkb::ModMask; | |
| 7 | -use smithay::input::keyboard::KeyboardHandle; | |
| 8 | -use smithay::wayland::virtual_keyboard::VirtualKeyboardHandler; | |
| 9 | - | |
| 10 | -use crate::niri::State; | |
| 11 | - | |
| 12 | -pub struct VirtualKeyboardInputBackend; | |
| 13 | - | |
| 14 | -#[derive(Clone, Debug, Hash, Eq, PartialEq)] | |
| 15 | -pub struct VirtualKeyboard; | |
| 16 | - | |
| 17 | -impl Device for VirtualKeyboard { | |
| 18 | - fn id(&self) -> String { | |
| 19 | - String::from("virtual keyboard") | |
| 20 | - } | |
| 21 | - | |
| 22 | - fn name(&self) -> String { | |
| 23 | - String::from("virtual keyboard") | |
| 24 | - } | |
| 25 | - | |
| 26 | - fn has_capability(&self, capability: DeviceCapability) -> bool { | |
| 27 | - matches!(capability, DeviceCapability::Keyboard) | |
| 28 | - } | |
| 29 | - | |
| 30 | - fn usb_id(&self) -> Option<(u32, u32)> { | |
| 31 | - None | |
| 32 | - } | |
| 33 | - | |
| 34 | - fn syspath(&self) -> Option<std::path::PathBuf> { | |
| 35 | - None | |
| 36 | - } | |
| 37 | -} | |
| 38 | - | |
| 39 | -pub struct VirtualKeyboardKeyEvent { | |
| 40 | - pub keycode: Keycode, | |
| 41 | - pub state: KeyState, | |
| 42 | - pub time: u32, | |
| 43 | -} | |
| 44 | - | |
| 45 | -impl Event<VirtualKeyboardInputBackend> for VirtualKeyboardKeyEvent { | |
| 46 | - fn time(&self) -> u64 { | |
| 47 | - self.time as u64 * 1000 // millis to micros | |
| 48 | - } | |
| 49 | - | |
| 50 | - fn device(&self) -> VirtualKeyboard { | |
| 51 | - VirtualKeyboard | |
| 52 | - } | |
| 53 | -} | |
| 54 | - | |
| 55 | -impl KeyboardKeyEvent<VirtualKeyboardInputBackend> for VirtualKeyboardKeyEvent { | |
| 56 | - fn key_code(&self) -> Keycode { | |
| 57 | - self.keycode | |
| 58 | - } | |
| 59 | - | |
| 60 | - fn state(&self) -> KeyState { | |
| 61 | - self.state | |
| 62 | - } | |
| 63 | - | |
| 64 | - fn count(&self) -> u32 { | |
| 65 | - 0 // Not used by niri | |
| 66 | - } | |
| 67 | -} | |
| 68 | - | |
| 69 | -impl InputBackend for VirtualKeyboardInputBackend { | |
| 70 | - type Device = VirtualKeyboard; | |
| 71 | - | |
| 72 | - type KeyboardKeyEvent = VirtualKeyboardKeyEvent; | |
| 73 | - type PointerAxisEvent = UnusedEvent; | |
| 74 | - type PointerButtonEvent = UnusedEvent; | |
| 75 | - type PointerMotionEvent = UnusedEvent; | |
| 76 | - type PointerMotionAbsoluteEvent = UnusedEvent; | |
| 77 | - | |
| 78 | - type GestureSwipeBeginEvent = UnusedEvent; | |
| 79 | - type GestureSwipeUpdateEvent = UnusedEvent; | |
| 80 | - type GestureSwipeEndEvent = UnusedEvent; | |
| 81 | - type GesturePinchBeginEvent = UnusedEvent; | |
| 82 | - type GesturePinchUpdateEvent = UnusedEvent; | |
| 83 | - type GesturePinchEndEvent = UnusedEvent; | |
| 84 | - type GestureHoldBeginEvent = UnusedEvent; | |
| 85 | - type GestureHoldEndEvent = UnusedEvent; | |
| 86 | - | |
| 87 | - type TouchDownEvent = UnusedEvent; | |
| 88 | - type TouchUpEvent = UnusedEvent; | |
| 89 | - type TouchMotionEvent = UnusedEvent; | |
| 90 | - type TouchCancelEvent = UnusedEvent; | |
| 91 | - type TouchFrameEvent = UnusedEvent; | |
| 92 | - type TabletToolAxisEvent = UnusedEvent; | |
| 93 | - type TabletToolProximityEvent = UnusedEvent; | |
| 94 | - type TabletToolTipEvent = UnusedEvent; | |
| 95 | - type TabletToolButtonEvent = UnusedEvent; | |
| 96 | - | |
| 97 | - type SwitchToggleEvent = UnusedEvent; | |
| 98 | - | |
| 99 | - type SpecialEvent = UnusedEvent; | |
| 100 | -} | |
| 101 | - | |
| 102 | -impl VirtualKeyboardHandler for State { | |
| 103 | - fn on_keyboard_event( | |
| 104 | - &mut self, | |
| 105 | - keycode: Keycode, | |
| 106 | - state: KeyState, | |
| 107 | - time: u32, | |
| 108 | - _keyboard: KeyboardHandle<Self>, | |
| 109 | - ) { | |
| 110 | - // The virtual keyboard impl in Smithay changes the keymap, so we'll need to reset it on | |
| 111 | - // the next real keyboard event. | |
| 112 | - self.niri.reset_keymap = true; | |
| 113 | - | |
| 114 | - let event = VirtualKeyboardKeyEvent { | |
| 115 | - keycode, | |
| 116 | - state, | |
| 117 | - time, | |
| 118 | - }; | |
| 119 | - self.process_input_event(InputEvent::<VirtualKeyboardInputBackend>::Keyboard { event }); | |
| 120 | - } | |
| 121 | - | |
| 122 | - // We handle modifiers when the key event is sent. | |
| 123 | - fn on_keyboard_modifiers( | |
| 124 | - &mut self, | |
| 125 | - _depressed_mods: ModMask, | |
| 126 | - _latched_mods: ModMask, | |
| 127 | - _locked_mods: ModMask, | |
| 128 | - _keyboard: KeyboardHandle<Self>, | |
| 129 | - ) { | |
| 130 | - } | |
| 131 | -} | |
| 132 | -delegate_virtual_keyboard_manager!(State); |