diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-09-30 15:24:50 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-09-30 15:24:50 +0300 |
| commit | 94e5408f46dd1635004748f34ad38ae9f2bc945d (patch) | |
| tree | 018aafd7661f0e9d17797a73643a060cd7dabe4b | |
| parent | eb190e3f9447e4d49cfdcb5a0093443ca8b684fe (diff) | |
| download | niri-94e5408f46dd1635004748f34ad38ae9f2bc945d.tar.gz niri-94e5408f46dd1635004748f34ad38ae9f2bc945d.tar.bz2 niri-94e5408f46dd1635004748f34ad38ae9f2bc945d.zip | |
Update Smithay
| -rw-r--r-- | Cargo.lock | 4 | ||||
| -rw-r--r-- | src/handlers/mod.rs | 9 | ||||
| -rw-r--r-- | src/handlers/xdg_shell.rs | 33 | ||||
| -rw-r--r-- | src/ipc/server.rs | 15 | ||||
| -rw-r--r-- | src/niri.rs | 20 |
5 files changed, 37 insertions, 44 deletions
@@ -3522,7 +3522,7 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/Smithay/smithay.git#b29ff8fdbfa3a15b777d36a7c5f19f86dfe5c94c" +source = "git+https://github.com/Smithay/smithay.git#bcab0754ee883ee3dbda145a3ee2b704ee2ee68d" dependencies = [ "appendlist", "bitflags 2.6.0", @@ -3594,7 +3594,7 @@ dependencies = [ [[package]] name = "smithay-drm-extras" version = "0.1.0" -source = "git+https://github.com/Smithay/smithay.git#b29ff8fdbfa3a15b777d36a7c5f19f86dfe5c94c" +source = "git+https://github.com/Smithay/smithay.git#bcab0754ee883ee3dbda145a3ee2b704ee2ee68d" dependencies = [ "drm", "libdisplay-info", diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 63bde132..6b0c2c6b 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -143,6 +143,15 @@ impl PointerConstraintsHandler for State { &self.niri.pointer_focus, ); } + + fn cursor_position_hint( + &mut self, + _surface: &WlSurface, + _pointer: &PointerHandle<Self>, + _location: Point<f64, Logical>, + ) { + // FIXME + } } delegate_pointer_constraints!(State); diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index 80dd2262..06c60a4c 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -27,8 +27,8 @@ use smithay::wayland::shell::kde::decoration::{KdeDecorationHandler, KdeDecorati use smithay::wayland::shell::wlr_layer::{self, Layer}; use smithay::wayland::shell::xdg::decoration::XdgDecorationHandler; use smithay::wayland::shell::xdg::{ - PopupSurface, PositionerState, ToplevelSurface, XdgPopupSurfaceData, XdgShellHandler, - XdgShellState, XdgToplevelSurfaceData, + PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState, + XdgToplevelSurfaceData, }; use smithay::wayland::xdg_foreign::{XdgForeignHandler, XdgForeignState}; use smithay::{ @@ -261,7 +261,7 @@ impl XdgShellHandler for State { // A configure is required in response to this event. However, if an initial configure // wasn't sent, then we will send this as part of the initial configure later. - if initial_configure_sent(&surface) { + if surface.is_initial_configure_sent() { surface.send_configure(); } } @@ -552,7 +552,7 @@ impl XdgDecorationHandler for State { // A configure is required in response to this event. However, if an initial configure // wasn't sent, then we will send this as part of the initial configure later. - if initial_configure_sent(&toplevel) { + if toplevel.is_initial_configure_sent() { toplevel.send_configure(); } } @@ -565,7 +565,7 @@ impl XdgDecorationHandler for State { // A configure is required in response to this event. However, if an initial configure // wasn't sent, then we will send this as part of the initial configure later. - if initial_configure_sent(&toplevel) { + if toplevel.is_initial_configure_sent() { toplevel.send_configure(); } } @@ -620,18 +620,6 @@ impl XdgForeignHandler for State { } delegate_xdg_foreign!(State); -fn initial_configure_sent(toplevel: &ToplevelSurface) -> bool { - with_states(toplevel.wl_surface(), |states| { - states - .data_map - .get::<XdgToplevelSurfaceData>() - .unwrap() - .lock() - .unwrap() - .initial_configure_sent - }) -} - impl State { pub fn send_initial_configure(&mut self, toplevel: &ToplevelSurface) { let _span = tracy_client::span!("State::send_initial_configure"); @@ -788,16 +776,7 @@ impl State { if let Some(popup) = self.niri.popups.find_popup(surface) { match popup { PopupKind::Xdg(ref popup) => { - let initial_configure_sent = with_states(surface, |states| { - states - .data_map - .get::<XdgPopupSurfaceData>() - .unwrap() - .lock() - .unwrap() - .initial_configure_sent - }); - if !initial_configure_sent { + if !popup.is_initial_configure_sent() { if let Some(output) = self.output_for_popup(&PopupKind::Xdg(popup.clone())) { let scale = output.current_scale(); diff --git a/src/ipc/server.rs b/src/ipc/server.rs index bdafee2e..633707eb 100644 --- a/src/ipc/server.rs +++ b/src/ipc/server.rs @@ -16,7 +16,6 @@ use futures_util::{select_biased, AsyncBufReadExt, AsyncWrite, AsyncWriteExt, Fu use niri_config::OutputName; use niri_ipc::state::{EventStreamState, EventStreamStatePart as _}; use niri_ipc::{Event, KeyboardLayouts, OutputConfigChanged, Reply, Request, Response, Workspace}; -use smithay::input::keyboard::XkbContextHandler; use smithay::reexports::calloop::generic::Generic; use smithay::reexports::calloop::{Interest, LoopHandle, Mode, PostAction}; use smithay::reexports::rustix::fs::unlink; @@ -385,10 +384,13 @@ impl State { pub fn ipc_keyboard_layouts_changed(&mut self) { let keyboard = self.niri.seat.get_keyboard().unwrap(); let keyboard_layouts = keyboard.with_xkb_state(self, |context| { - let layouts = context.keymap().layouts(); + let xkb = context.xkb().lock().unwrap(); + let layouts = xkb.layouts(); KeyboardLayouts { - names: layouts.map(str::to_owned).collect(), - current_idx: context.active_layout().0 as u8, + names: layouts + .map(|layout| xkb.layout_name(layout).to_owned()) + .collect(), + current_idx: xkb.active_layout().0 as u8, } }); @@ -406,7 +408,10 @@ impl State { pub fn ipc_refresh_keyboard_layout_index(&mut self) { let keyboard = self.niri.seat.get_keyboard().unwrap(); - let idx = keyboard.with_xkb_state(self, |context| context.active_layout().0 as u8); + let idx = keyboard.with_xkb_state(self, |context| { + let xkb = context.xkb().lock().unwrap(); + xkb.active_layout().0 as u8 + }); let Some(server) = &self.niri.ipc_server else { return; diff --git a/src/niri.rs b/src/niri.rs index a2c81ae6..396852bf 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -44,7 +44,7 @@ use smithay::desktop::{ layer_map_for_output, LayerSurface, PopupGrab, PopupManager, PopupUngrabStrategy, Space, Window, WindowSurfaceType, }; -use smithay::input::keyboard::{Layout as KeyboardLayout, XkbContextHandler}; +use smithay::input::keyboard::Layout as KeyboardLayout; use smithay::input::pointer::{CursorIcon, CursorImageAttributes, CursorImageStatus, MotionEvent}; use smithay::input::{Seat, SeatState}; use smithay::output::{self, Output, OutputModeSource, PhysicalProperties, Subpixel}; @@ -641,13 +641,13 @@ impl State { let Some(output) = self.niri.layout.active_output() else { return false; }; - let monitor = self.niri.layout.monitor_for_output(&output).unwrap(); + let monitor = self.niri.layout.monitor_for_output(output).unwrap(); let mut rv = false; let rect = monitor.active_tile_visual_rectangle(); if let Some(rect) = rect { - let output_geo = self.niri.global_space.output_geometry(&output).unwrap(); + let output_geo = self.niri.global_space.output_geometry(output).unwrap(); let mut rect = rect; rect.loc += output_geo.loc.to_f64(); rv = self.move_cursor_to_rect(rect, mode); @@ -899,8 +899,10 @@ impl State { } if self.niri.config.borrow().input.keyboard.track_layout == TrackLayout::Window { - let current_layout = - keyboard.with_xkb_state(self, |context| context.active_layout()); + let current_layout = keyboard.with_xkb_state(self, |context| { + let xkb = context.xkb().lock().unwrap(); + xkb.active_layout() + }); let mut new_layout = current_layout; // Store the currently active layout for the surface. @@ -2601,16 +2603,14 @@ impl Niri { let pointer_pos = (pointer_pos - hotspot.to_f64()).to_physical_precise_round(output_scale); - let pointer_elements = render_elements_from_surface_tree( + render_elements_from_surface_tree( renderer, &surface, pointer_pos, output_scale, 1., Kind::Cursor, - ); - - pointer_elements + ) } RenderCursor::Named { icon, @@ -2760,7 +2760,7 @@ impl Niri { }; let icon = if let CursorImageStatus::Named(icon) = cursor_image { - icon.clone() + *icon } else { Default::default() }; |
