Update smithay
Browse files at this commit5ac350d51c0f16be3e40355bcb25cf23d34cc662Parent: 494e98c- chore
- update smithay
9 changed files +70 -41
- Cargo.lock +2 -2
- src/handlers/compositor.rs +2 -1
- src/handlers/mod.rs +3 -1
- src/handlers/xdg_shell.rs +7 -3
- src/input.rs +1 -1
- src/layout/mod.rs +33 -18
- src/layout/workspace.rs +19 -12
- src/niri.rs +1 -1
- src/protocols/foreign_toplevel.rs +2 -2
Cargo.lockmodified+2 -2
| @@ -3072,7 +3072,7 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" | |||
| 3072 | [[package]] | 3072 | [[package]] |
| 3073 | name = "smithay" | 3073 | name = "smithay" |
| 3074 | version = "0.3.0" | 3074 | version = "0.3.0" |
| 3075 | -source = "git+https://github.com/Smithay/smithay.git#3de7636e6cb562a1b9f14c76e17b0e4b27381c22" | 3075 | +source = "git+https://github.com/Smithay/smithay.git#b62ced79c70030680cdcd3d03233bc6b8df722e2" |
| 3076 | dependencies = [ | 3076 | dependencies = [ |
| 3077 | "appendlist", | 3077 | "appendlist", |
| 3078 | "bitflags 2.4.2", | 3078 | "bitflags 2.4.2", |
| @@ -3144,7 +3144,7 @@ dependencies = [ | |||
| 3144 | [[package]] | 3144 | [[package]] |
| 3145 | name = "smithay-drm-extras" | 3145 | name = "smithay-drm-extras" |
| 3146 | version = "0.1.0" | 3146 | version = "0.1.0" |
| 3147 | -source = "git+https://github.com/Smithay/smithay.git#3de7636e6cb562a1b9f14c76e17b0e4b27381c22" | 3147 | +source = "git+https://github.com/Smithay/smithay.git#b62ced79c70030680cdcd3d03233bc6b8df722e2" |
| 3148 | dependencies = [ | 3148 | dependencies = [ |
| 3149 | "drm", | 3149 | "drm", |
| 3150 | "edid-rs", | 3150 | "edid-rs", |
src/handlers/compositor.rsmodified+2 -1
| @@ -129,6 +129,7 @@ impl CompositorHandler for State { | |||
| 129 | 129 | ||
| 130 | let parent = window | 130 | let parent = window |
| 131 | .toplevel() | 131 | .toplevel() |
| 132 | + .expect("no x11 support") | ||
| 132 | .parent() | 133 | .parent() |
| 133 | .and_then(|parent| self.niri.layout.find_window_and_output(&parent)) | 134 | .and_then(|parent| self.niri.layout.find_window_and_output(&parent)) |
| 134 | // Only consider the parent if we configured the window for the same | 135 | // Only consider the parent if we configured the window for the same |
| @@ -168,7 +169,7 @@ impl CompositorHandler for State { | |||
| 168 | // The toplevel remains unmapped. | 169 | // The toplevel remains unmapped. |
| 169 | let unmapped = entry.get(); | 170 | let unmapped = entry.get(); |
| 170 | if unmapped.needs_initial_configure() { | 171 | if unmapped.needs_initial_configure() { |
| 171 | - let toplevel = unmapped.window.toplevel().clone(); | 172 | + let toplevel = unmapped.window.toplevel().expect("no x11 support").clone(); |
| 172 | self.queue_initial_configure(toplevel); | 173 | self.queue_initial_configure(toplevel); |
| 173 | } | 174 | } |
| 174 | return; | 175 | return; |
src/handlers/mod.rsmodified+3 -1
| @@ -64,6 +64,7 @@ use crate::utils::output_size; | |||
| 64 | impl SeatHandler for State { | 64 | impl SeatHandler for State { |
| 65 | type KeyboardFocus = WlSurface; | 65 | type KeyboardFocus = WlSurface; |
| 66 | type PointerFocus = WlSurface; | 66 | type PointerFocus = WlSurface; |
| 67 | + type TouchFocus = WlSurface; | ||
| 67 | 68 | ||
| 68 | fn seat_state(&mut self) -> &mut SeatState<State> { | 69 | fn seat_state(&mut self) -> &mut SeatState<State> { |
| 69 | &mut self.niri.seat_state | 70 | &mut self.niri.seat_state |
| @@ -339,7 +340,7 @@ impl ForeignToplevelHandler for State { | |||
| 339 | 340 | ||
| 340 | fn close(&mut self, wl_surface: WlSurface) { | 341 | fn close(&mut self, wl_surface: WlSurface) { |
| 341 | if let Some((window, _)) = self.niri.layout.find_window_and_output(&wl_surface) { | 342 | if let Some((window, _)) = self.niri.layout.find_window_and_output(&wl_surface) { |
| 342 | - window.toplevel().send_close(); | 343 | + window.toplevel().expect("no x11 support").send_close(); |
| 343 | } | 344 | } |
| 344 | } | 345 | } |
| 345 | 346 | ||
| @@ -348,6 +349,7 @@ impl ForeignToplevelHandler for State { | |||
| 348 | { | 349 | { |
| 349 | if !window | 350 | if !window |
| 350 | .toplevel() | 351 | .toplevel() |
| 352 | + .expect("no x11 support") | ||
| 351 | .current_state() | 353 | .current_state() |
| 352 | .capabilities | 354 | .capabilities |
| 353 | .contains(xdg_toplevel::WmCapabilities::Fullscreen) | 355 | .contains(xdg_toplevel::WmCapabilities::Fullscreen) |
src/handlers/xdg_shell.rsmodified+7 -3
| @@ -112,7 +112,7 @@ impl XdgShellHandler for State { | |||
| 112 | 112 | ||
| 113 | fn new_toplevel(&mut self, surface: ToplevelSurface) { | 113 | fn new_toplevel(&mut self, surface: ToplevelSurface) { |
| 114 | let wl_surface = surface.wl_surface().clone(); | 114 | let wl_surface = surface.wl_surface().clone(); |
| 115 | - let unmapped = Unmapped::new(Window::new(surface)); | 115 | + let unmapped = Unmapped::new(Window::new_wayland_window(surface)); |
| 116 | let existing = self.niri.unmapped_windows.insert(wl_surface, unmapped); | 116 | let existing = self.niri.unmapped_windows.insert(wl_surface, unmapped); |
| 117 | assert!(existing.is_none()); | 117 | assert!(existing.is_none()); |
| 118 | } | 118 | } |
| @@ -210,7 +210,9 @@ impl XdgShellHandler for State { | |||
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | let layout_focus = self.niri.layout.focus(); | 212 | let layout_focus = self.niri.layout.focus(); |
| 213 | - if Some(&root) != layout_focus.map(|win| win.toplevel().wl_surface()) { | 213 | + if Some(&root) |
| 214 | + != layout_focus.map(|win| win.toplevel().expect("no x11 support").wl_surface()) | ||
| 215 | + { | ||
| 214 | let _ = PopupManager::dismiss_popup(&root, &popup); | 216 | let _ = PopupManager::dismiss_popup(&root, &popup); |
| 215 | return; | 217 | return; |
| 216 | } | 218 | } |
| @@ -771,7 +773,9 @@ impl State { | |||
| 771 | pub fn update_reactive_popups(&self, window: &Window, output: &Output) { | 773 | pub fn update_reactive_popups(&self, window: &Window, output: &Output) { |
| 772 | let _span = tracy_client::span!("Niri::update_reactive_popups"); | 774 | let _span = tracy_client::span!("Niri::update_reactive_popups"); |
| 773 | 775 | ||
| 774 | - for (popup, _) in PopupManager::popups_for_surface(window.toplevel().wl_surface()) { | 776 | + for (popup, _) in PopupManager::popups_for_surface( |
| 777 | + window.toplevel().expect("no x11 support").wl_surface(), | ||
| 778 | + ) { | ||
| 775 | match popup { | 779 | match popup { |
| 776 | PopupKind::Xdg(ref popup) => { | 780 | PopupKind::Xdg(ref popup) => { |
| 777 | if popup.with_pending_state(|state| state.positioner.reactive) { | 781 | if popup.with_pending_state(|state| state.positioner.reactive) { |
src/input.rsmodified+1 -1
| @@ -371,7 +371,7 @@ impl State { | |||
| 371 | } | 371 | } |
| 372 | Action::CloseWindow => { | 372 | Action::CloseWindow => { |
| 373 | if let Some(window) = self.niri.layout.focus() { | 373 | if let Some(window) = self.niri.layout.focus() { |
| 374 | - window.toplevel().send_close(); | 374 | + window.toplevel().expect("no x11 support").send_close(); |
| 375 | } | 375 | } |
| 376 | } | 376 | } |
| 377 | Action::FullscreenWindow => { | 377 | Action::FullscreenWindow => { |
src/layout/mod.rsmodified+33 -18
| @@ -247,35 +247,45 @@ impl LayoutElement for Window { | |||
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | fn request_size(&self, size: Size<i32, Logical>) { | 249 | fn request_size(&self, size: Size<i32, Logical>) { |
| 250 | - self.toplevel().with_pending_state(|state| { | 250 | + self.toplevel() |
| 251 | - state.size = Some(size); | 251 | + .expect("no x11 support") |
| 252 | - state.states.unset(xdg_toplevel::State::Fullscreen); | 252 | + .with_pending_state(|state| { |
| 253 | - }); | 253 | + state.size = Some(size); |
| 254 | + state.states.unset(xdg_toplevel::State::Fullscreen); | ||
| 255 | + }); | ||
| 254 | } | 256 | } |
| 255 | 257 | ||
| 256 | fn request_fullscreen(&self, size: Size<i32, Logical>) { | 258 | fn request_fullscreen(&self, size: Size<i32, Logical>) { |
| 257 | - self.toplevel().with_pending_state(|state| { | 259 | + self.toplevel() |
| 258 | - state.size = Some(size); | 260 | + .expect("no x11 support") |
| 259 | - state.states.set(xdg_toplevel::State::Fullscreen); | 261 | + .with_pending_state(|state| { |
| 260 | - }); | 262 | + state.size = Some(size); |
| 263 | + state.states.set(xdg_toplevel::State::Fullscreen); | ||
| 264 | + }); | ||
| 261 | } | 265 | } |
| 262 | 266 | ||
| 263 | fn min_size(&self) -> Size<i32, Logical> { | 267 | fn min_size(&self) -> Size<i32, Logical> { |
| 264 | - with_states(self.toplevel().wl_surface(), |state| { | 268 | + with_states( |
| 265 | - let curr = state.cached_state.current::<SurfaceCachedState>(); | 269 | + self.toplevel().expect("no x11 support").wl_surface(), |
| 266 | - curr.min_size | 270 | + |state| { |
| 267 | - }) | 271 | + let curr = state.cached_state.current::<SurfaceCachedState>(); |
| 272 | + curr.min_size | ||
| 273 | + }, | ||
| 274 | + ) | ||
| 268 | } | 275 | } |
| 269 | 276 | ||
| 270 | fn max_size(&self) -> Size<i32, Logical> { | 277 | fn max_size(&self) -> Size<i32, Logical> { |
| 271 | - with_states(self.toplevel().wl_surface(), |state| { | 278 | + with_states( |
| 272 | - let curr = state.cached_state.current::<SurfaceCachedState>(); | 279 | + self.toplevel().expect("no x11 support").wl_surface(), |
| 273 | - curr.max_size | 280 | + |state| { |
| 274 | - }) | 281 | + let curr = state.cached_state.current::<SurfaceCachedState>(); |
| 282 | + curr.max_size | ||
| 283 | + }, | ||
| 284 | + ) | ||
| 275 | } | 285 | } |
| 276 | 286 | ||
| 277 | fn is_wl_surface(&self, wl_surface: &WlSurface) -> bool { | 287 | fn is_wl_surface(&self, wl_surface: &WlSurface) -> bool { |
| 278 | - self.toplevel().wl_surface() == wl_surface | 288 | + self.toplevel().expect("no x11 support").wl_surface() == wl_surface |
| 279 | } | 289 | } |
| 280 | 290 | ||
| 281 | fn set_preferred_scale_transform(&self, scale: i32, transform: Transform) { | 291 | fn set_preferred_scale_transform(&self, scale: i32, transform: Transform) { |
| @@ -285,7 +295,10 @@ impl LayoutElement for Window { | |||
| 285 | } | 295 | } |
| 286 | 296 | ||
| 287 | fn has_ssd(&self) -> bool { | 297 | fn has_ssd(&self) -> bool { |
| 288 | - self.toplevel().current_state().decoration_mode | 298 | + self.toplevel() |
| 299 | + .expect("no x11 support") | ||
| 300 | + .current_state() | ||
| 301 | + .decoration_mode | ||
| 289 | == Some(zxdg_toplevel_decoration_v1::Mode::ServerSide) | 302 | == Some(zxdg_toplevel_decoration_v1::Mode::ServerSide) |
| 290 | } | 303 | } |
| 291 | 304 | ||
| @@ -305,6 +318,7 @@ impl LayoutElement for Window { | |||
| 305 | 318 | ||
| 306 | fn is_fullscreen(&self) -> bool { | 319 | fn is_fullscreen(&self) -> bool { |
| 307 | self.toplevel() | 320 | self.toplevel() |
| 321 | + .expect("no x11 support") | ||
| 308 | .current_state() | 322 | .current_state() |
| 309 | .states | 323 | .states |
| 310 | .contains(xdg_toplevel::State::Fullscreen) | 324 | .contains(xdg_toplevel::State::Fullscreen) |
| @@ -312,6 +326,7 @@ impl LayoutElement for Window { | |||
| 312 | 326 | ||
| 313 | fn is_pending_fullscreen(&self) -> bool { | 327 | fn is_pending_fullscreen(&self) -> bool { |
| 314 | self.toplevel() | 328 | self.toplevel() |
| 329 | + .expect("no x11 support") | ||
| 315 | .with_pending_state(|state| state.states.contains(xdg_toplevel::State::Fullscreen)) | 330 | .with_pending_state(|state| state.states.contains(xdg_toplevel::State::Fullscreen)) |
| 316 | } | 331 | } |
| 317 | } | 332 | } |
src/layout/workspace.rsmodified+19 -12
| @@ -361,15 +361,18 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 361 | set_preferred_scale_transform(window, output); | 361 | set_preferred_scale_transform(window, output); |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | - window.toplevel().with_pending_state(|state| { | 364 | + window |
| 365 | - if state.states.contains(xdg_toplevel::State::Fullscreen) { | 365 | + .toplevel() |
| 366 | - state.size = Some(self.view_size); | 366 | + .expect("no x11 support") |
| 367 | - } else { | 367 | + .with_pending_state(|state| { |
| 368 | - state.size = Some(self.new_window_size(width)); | 368 | + if state.states.contains(xdg_toplevel::State::Fullscreen) { |
| 369 | - } | 369 | + state.size = Some(self.view_size); |
| 370 | + } else { | ||
| 371 | + state.size = Some(self.new_window_size(width)); | ||
| 372 | + } | ||
| 370 | 373 | ||
| 371 | - state.bounds = Some(self.toplevel_bounds()); | 374 | + state.bounds = Some(self.toplevel_bounds()); |
| 372 | - }); | 375 | + }); |
| 373 | } | 376 | } |
| 374 | 377 | ||
| 375 | fn compute_new_view_offset_for_column(&self, current_x: i32, idx: usize) -> i32 { | 378 | fn compute_new_view_offset_for_column(&self, current_x: i32, idx: usize) -> i32 { |
| @@ -1211,11 +1214,15 @@ impl Workspace<Window> { | |||
| 1211 | && col.active_tile_idx == tile_idx; | 1214 | && col.active_tile_idx == tile_idx; |
| 1212 | win.set_activated(active); | 1215 | win.set_activated(active); |
| 1213 | 1216 | ||
| 1214 | - win.toplevel().with_pending_state(|state| { | 1217 | + win.toplevel() |
| 1215 | - state.bounds = Some(bounds); | 1218 | + .expect("no x11 support") |
| 1216 | - }); | 1219 | + .with_pending_state(|state| { |
| 1220 | + state.bounds = Some(bounds); | ||
| 1221 | + }); | ||
| 1217 | 1222 | ||
| 1218 | - win.toplevel().send_pending_configure(); | 1223 | + win.toplevel() |
| 1224 | + .expect("no x11 support") | ||
| 1225 | + .send_pending_configure(); | ||
| 1219 | win.refresh(); | 1226 | win.refresh(); |
| 1220 | } | 1227 | } |
| 1221 | } | 1228 | } |
src/niri.rsmodified+1 -1
| @@ -478,7 +478,7 @@ impl State { | |||
| 478 | self.niri | 478 | self.niri |
| 479 | .layout | 479 | .layout |
| 480 | .focus() | 480 | .focus() |
| 481 | - .map(|win| win.toplevel().wl_surface().clone()) | 481 | + .map(|win| win.toplevel().expect("no x11 support").wl_surface().clone()) |
| 482 | }; | 482 | }; |
| 483 | let layer_focus = |surface: &LayerSurface| { | 483 | let layer_focus = |surface: &LayerSurface| { |
| 484 | surface | 484 | surface |
src/protocols/foreign_toplevel.rsmodified+2 -2
| @@ -96,7 +96,7 @@ pub fn refresh(state: &mut State) { | |||
| 96 | // the previous window and only then activate the newly focused window. | 96 | // the previous window and only then activate the newly focused window. |
| 97 | let mut focused = None; | 97 | let mut focused = None; |
| 98 | state.niri.layout.with_windows(|window, output| { | 98 | state.niri.layout.with_windows(|window, output| { |
| 99 | - let wl_surface = window.toplevel().wl_surface(); | 99 | + let wl_surface = window.toplevel().expect("no x11 support").wl_surface(); |
| 100 | 100 | ||
| 101 | with_states(wl_surface, |states| { | 101 | with_states(wl_surface, |states| { |
| 102 | let role = states | 102 | let role = states |
| @@ -116,7 +116,7 @@ pub fn refresh(state: &mut State) { | |||
| 116 | 116 | ||
| 117 | // Finally, refresh the focused window. | 117 | // Finally, refresh the focused window. |
| 118 | if let Some((window, output)) = focused { | 118 | if let Some((window, output)) = focused { |
| 119 | - let wl_surface = window.toplevel().wl_surface(); | 119 | + let wl_surface = window.toplevel().expect("no x11 support").wl_surface(); |
| 120 | 120 | ||
| 121 | with_states(wl_surface, |states| { | 121 | with_states(wl_surface, |states| { |
| 122 | let role = states | 122 | let role = states |