protocol/toplevel_management: Use WorkspaceHandle in argument
Already depends on `WorkspaceHandler`, so it can get the handle, and toplevel info uses `WorkspaceHandle`s.
This commit is contained in:
parent
1f2434e590
commit
0a6f2726cb
2 changed files with 15 additions and 15 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use cosmic_protocols::workspace::v1::server::zcosmic_workspace_handle_v1::ZcosmicWorkspaceHandleV1;
|
|
||||||
use smithay::{
|
use smithay::{
|
||||||
desktop::{layer_map_for_output, WindowSurfaceType},
|
desktop::{layer_map_for_output, WindowSurfaceType},
|
||||||
input::{pointer::MotionEvent, Seat},
|
input::{pointer::MotionEvent, Seat},
|
||||||
|
|
@ -18,6 +17,7 @@ use crate::{
|
||||||
delegate_toplevel_management, toplevel_rectangle_for, ManagementWindow,
|
delegate_toplevel_management, toplevel_rectangle_for, ManagementWindow,
|
||||||
ToplevelManagementHandler, ToplevelManagementState,
|
ToplevelManagementHandler, ToplevelManagementState,
|
||||||
},
|
},
|
||||||
|
workspace::WorkspaceHandle,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -101,13 +101,9 @@ impl ToplevelManagementHandler for State {
|
||||||
&mut self,
|
&mut self,
|
||||||
_dh: &DisplayHandle,
|
_dh: &DisplayHandle,
|
||||||
window: &<Self as ToplevelInfoHandler>::Window,
|
window: &<Self as ToplevelInfoHandler>::Window,
|
||||||
workspace: ZcosmicWorkspaceHandleV1,
|
to_handle: WorkspaceHandle,
|
||||||
_output: Output,
|
_output: Output,
|
||||||
) {
|
) {
|
||||||
let Some(to_handle) = self.common.workspace_state.get_workspace_handle(&workspace) else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut shell = self.common.shell.write().unwrap();
|
let mut shell = self.common.shell.write().unwrap();
|
||||||
if let Some(mut mapped) = shell.element_for_surface(window).cloned() {
|
if let Some(mut mapped) = shell.element_for_surface(window).cloned() {
|
||||||
if let Some(from_workspace) = shell.space_for_mut(&mapped) {
|
if let Some(from_workspace) = shell.space_for_mut(&mapped) {
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,14 @@ use smithay::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use cosmic_protocols::toplevel_management::v1::server::zcosmic_toplevel_manager_v1::ZcosmicToplelevelManagementCapabilitiesV1 as ManagementCapabilities;
|
pub use cosmic_protocols::toplevel_management::v1::server::zcosmic_toplevel_manager_v1::ZcosmicToplelevelManagementCapabilitiesV1 as ManagementCapabilities;
|
||||||
use cosmic_protocols::{
|
use cosmic_protocols::toplevel_management::v1::server::zcosmic_toplevel_manager_v1::{
|
||||||
toplevel_management::v1::server::zcosmic_toplevel_manager_v1::{
|
self, ZcosmicToplevelManagerV1,
|
||||||
self, ZcosmicToplevelManagerV1,
|
|
||||||
},
|
|
||||||
workspace::v1::server::zcosmic_workspace_handle_v1::ZcosmicWorkspaceHandleV1,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::toplevel_info::{window_from_handle, ToplevelInfoHandler, ToplevelState, Window};
|
use super::{
|
||||||
|
toplevel_info::{window_from_handle, ToplevelInfoHandler, ToplevelState, Window},
|
||||||
|
workspace::WorkspaceHandle,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ToplevelManagementState {
|
pub struct ToplevelManagementState {
|
||||||
|
|
@ -68,7 +68,7 @@ where
|
||||||
&mut self,
|
&mut self,
|
||||||
dh: &DisplayHandle,
|
dh: &DisplayHandle,
|
||||||
window: &<Self as ToplevelInfoHandler>::Window,
|
window: &<Self as ToplevelInfoHandler>::Window,
|
||||||
workspace: ZcosmicWorkspaceHandleV1,
|
workspace: WorkspaceHandle,
|
||||||
output: Output,
|
output: Output,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
@ -255,8 +255,12 @@ where
|
||||||
output,
|
output,
|
||||||
} => {
|
} => {
|
||||||
let window = window_from_handle(toplevel).unwrap();
|
let window = window_from_handle(toplevel).unwrap();
|
||||||
if let Some(output) = Output::from_resource(&output) {
|
if let Some(workspace_handle) =
|
||||||
state.move_to_workspace(dh, &window, workspace, output);
|
state.workspace_state().get_workspace_handle(&workspace)
|
||||||
|
{
|
||||||
|
if let Some(output) = Output::from_resource(&output) {
|
||||||
|
state.move_to_workspace(dh, &window, workspace_handle, output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue