Change MappedIt::get() to return u64
Browse files at this commit0f522f209b415444fd97ba5ecf30c13c179cede7Parent: 30b21365 changed files +14 -16
- src/handlers/compositor.rs +1 -1
- src/handlers/xdg_shell.rs +1 -1
- src/ipc/server.rs +4 -4
- src/niri.rs +6 -8
- src/window/mapped.rs +2 -2
src/handlers/compositor.rsmodified+1 -1
| @@ -216,7 +216,7 @@ impl CompositorHandler for State { | |||
| 216 | #[cfg(feature = "xdp-gnome-screencast")] | 216 | #[cfg(feature = "xdp-gnome-screencast")] |
| 217 | self.niri | 217 | self.niri |
| 218 | .stop_casts_for_target(crate::pw_utils::CastTarget::Window { | 218 | .stop_casts_for_target(crate::pw_utils::CastTarget::Window { |
| 219 | - id: u64::from(id.get()), | 219 | + id: id.get(), |
| 220 | }); | 220 | }); |
| 221 | 221 | ||
| 222 | self.niri.layout.remove_window(&window, transaction.clone()); | 222 | self.niri.layout.remove_window(&window, transaction.clone()); |
src/handlers/xdg_shell.rsmodified+1 -1
| @@ -480,7 +480,7 @@ impl XdgShellHandler for State { | |||
| 480 | #[cfg(feature = "xdp-gnome-screencast")] | 480 | #[cfg(feature = "xdp-gnome-screencast")] |
| 481 | self.niri | 481 | self.niri |
| 482 | .stop_casts_for_target(crate::pw_utils::CastTarget::Window { | 482 | .stop_casts_for_target(crate::pw_utils::CastTarget::Window { |
| 483 | - id: u64::from(mapped.id().get()), | 483 | + id: mapped.id().get(), |
| 484 | }); | 484 | }); |
| 485 | 485 | ||
| 486 | self.backend.with_primary_renderer(|renderer| { | 486 | self.backend.with_primary_renderer(|renderer| { |
src/ipc/server.rsmodified+4 -4
| @@ -375,7 +375,7 @@ fn make_ipc_window(mapped: &Mapped, workspace_id: Option<WorkspaceId>) -> niri_i | |||
| 375 | .unwrap(); | 375 | .unwrap(); |
| 376 | 376 | ||
| 377 | niri_ipc::Window { | 377 | niri_ipc::Window { |
| 378 | - id: u64::from(mapped.id().get()), | 378 | + id: mapped.id().get(), |
| 379 | title: role.title.clone(), | 379 | title: role.title.clone(), |
| 380 | app_id: role.app_id.clone(), | 380 | app_id: role.app_id.clone(), |
| 381 | workspace_id: workspace_id.map(|id| u64::from(id.0)), | 381 | workspace_id: workspace_id.map(|id| u64::from(id.0)), |
| @@ -449,7 +449,7 @@ impl State { | |||
| 449 | break; | 449 | break; |
| 450 | } | 450 | } |
| 451 | 451 | ||
| 452 | - let active_window_id = ws.active_window().map(|win| u64::from(win.id().get())); | 452 | + let active_window_id = ws.active_window().map(|win| win.id().get()); |
| 453 | if ipc_ws.active_window_id != active_window_id { | 453 | if ipc_ws.active_window_id != active_window_id { |
| 454 | events.push(Event::WorkspaceActiveWindowChanged { | 454 | events.push(Event::WorkspaceActiveWindowChanged { |
| 455 | workspace_id: id, | 455 | workspace_id: id, |
| @@ -490,7 +490,7 @@ impl State { | |||
| 490 | output: mon.map(|mon| mon.output_name().clone()), | 490 | output: mon.map(|mon| mon.output_name().clone()), |
| 491 | is_active: mon.map_or(false, |mon| mon.active_workspace_idx == ws_idx), | 491 | is_active: mon.map_or(false, |mon| mon.active_workspace_idx == ws_idx), |
| 492 | is_focused: Some(id) == focused_ws_id, | 492 | is_focused: Some(id) == focused_ws_id, |
| 493 | - active_window_id: ws.active_window().map(|win| u64::from(win.id().get())), | 493 | + active_window_id: ws.active_window().map(|win| win.id().get()), |
| 494 | } | 494 | } |
| 495 | }) | 495 | }) |
| 496 | .collect(); | 496 | .collect(); |
| @@ -521,7 +521,7 @@ impl State { | |||
| 521 | let mut seen = HashSet::new(); | 521 | let mut seen = HashSet::new(); |
| 522 | let mut focused_id = None; | 522 | let mut focused_id = None; |
| 523 | layout.with_windows(|mapped, _, ws_id| { | 523 | layout.with_windows(|mapped, _, ws_id| { |
| 524 | - let id = u64::from(mapped.id().get()); | 524 | + let id = mapped.id().get(); |
| 525 | seen.insert(id); | 525 | seen.insert(id); |
| 526 | 526 | ||
| 527 | if mapped.is_focused() { | 527 | if mapped.is_focused() { |
src/niri.rsmodified+6 -8
| @@ -1379,7 +1379,7 @@ impl State { | |||
| 1379 | StreamTargetId::Window { id } => { | 1379 | StreamTargetId::Window { id } => { |
| 1380 | let mut window = None; | 1380 | let mut window = None; |
| 1381 | self.niri.layout.with_windows(|mapped, _, _| { | 1381 | self.niri.layout.with_windows(|mapped, _, _| { |
| 1382 | - if u64::from(mapped.id().get()) != id { | 1382 | + if mapped.id().get() != id { |
| 1383 | return; | 1383 | return; |
| 1384 | } | 1384 | } |
| 1385 | 1385 | ||
| @@ -1502,7 +1502,7 @@ impl State { | |||
| 1502 | .expect("no X11 support") | 1502 | .expect("no X11 support") |
| 1503 | .wl_surface(); | 1503 | .wl_surface(); |
| 1504 | 1504 | ||
| 1505 | - let id = u64::from(mapped.id().get()); | 1505 | + let id = mapped.id().get(); |
| 1506 | let props = with_states(wl_surface, |states| { | 1506 | let props = with_states(wl_surface, |states| { |
| 1507 | let role = states | 1507 | let role = states |
| 1508 | .data_map | 1508 | .data_map |
| @@ -2841,9 +2841,7 @@ impl Niri { | |||
| 2841 | let mut to_stop = vec![]; | 2841 | let mut to_stop = vec![]; |
| 2842 | for (id, out) in output_changed { | 2842 | for (id, out) in output_changed { |
| 2843 | let refresh = out.current_mode().unwrap().refresh as u32; | 2843 | let refresh = out.current_mode().unwrap().refresh as u32; |
| 2844 | - let target = CastTarget::Window { | 2844 | + let target = CastTarget::Window { id: id.get() }; |
| 2845 | - id: u64::from(id.get()), | ||
| 2846 | - }; | ||
| 2847 | for cast in self.casts.iter_mut().filter(|cast| cast.target == target) { | 2845 | for cast in self.casts.iter_mut().filter(|cast| cast.target == target) { |
| 2848 | if let Err(err) = cast.set_refresh(refresh) { | 2846 | if let Err(err) = cast.set_refresh(refresh) { |
| 2849 | warn!("error changing cast FPS: {err:?}"); | 2847 | warn!("error changing cast FPS: {err:?}"); |
| @@ -3712,7 +3710,7 @@ impl Niri { | |||
| 3712 | }; | 3710 | }; |
| 3713 | 3711 | ||
| 3714 | let mut windows = self.layout.windows_for_output(output); | 3712 | let mut windows = self.layout.windows_for_output(output); |
| 3715 | - let Some(mapped) = windows.find(|win| u64::from(win.id().get()) == id) else { | 3713 | + let Some(mapped) = windows.find(|win| win.id().get() == id) else { |
| 3716 | continue; | 3714 | continue; |
| 3717 | }; | 3715 | }; |
| 3718 | 3716 | ||
| @@ -3759,7 +3757,7 @@ impl Niri { | |||
| 3759 | 3757 | ||
| 3760 | let mut window = None; | 3758 | let mut window = None; |
| 3761 | self.layout.with_windows(|mapped, _, _| { | 3759 | self.layout.with_windows(|mapped, _, _| { |
| 3762 | - if u64::from(mapped.id().get()) != window_id { | 3760 | + if mapped.id().get() != window_id { |
| 3763 | return; | 3761 | return; |
| 3764 | } | 3762 | } |
| 3765 | 3763 | ||
| @@ -3778,7 +3776,7 @@ impl Niri { | |||
| 3778 | 3776 | ||
| 3779 | let mut windows = self.layout.windows_for_output(output); | 3777 | let mut windows = self.layout.windows_for_output(output); |
| 3780 | let mapped = windows | 3778 | let mapped = windows |
| 3781 | - .find(|mapped| u64::from(mapped.id().get()) == window_id) | 3779 | + .find(|mapped| mapped.id().get() == window_id) |
| 3782 | .unwrap(); | 3780 | .unwrap(); |
| 3783 | 3781 | ||
| 3784 | let scale = Scale::from(output.current_scale().fractional_scale()); | 3782 | let scale = Scale::from(output.current_scale().fractional_scale()); |
src/window/mapped.rsmodified+2 -2
| @@ -105,8 +105,8 @@ impl MappedId { | |||
| 105 | MappedId(MAPPED_ID_COUNTER.next()) | 105 | MappedId(MAPPED_ID_COUNTER.next()) |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | - pub fn get(self) -> u32 { | 108 | + pub fn get(self) -> u64 { |
| 109 | - self.0 | 109 | + u64::from(self.0) |
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| 112 | 112 | ||