config: add Seat::show_workspace_on
This commit is contained in:
parent
d2ce140f54
commit
d320d2f3c1
12 changed files with 131 additions and 13 deletions
|
|
@ -122,6 +122,7 @@ pub(crate) struct ConfigClient {
|
|||
window_match_handlers: RefCell<HashMap<WindowMatcher, WindowMatchHandler>>,
|
||||
|
||||
feat_mod_mask: Cell<bool>,
|
||||
feat_show_workspace_on: Cell<bool>,
|
||||
}
|
||||
|
||||
struct ClientMatchHandler {
|
||||
|
|
@ -266,6 +267,7 @@ pub unsafe extern "C" fn init(
|
|||
client_match_handlers: Default::default(),
|
||||
window_match_handlers: Default::default(),
|
||||
feat_mod_mask: Cell::new(false),
|
||||
feat_show_workspace_on: Cell::new(false),
|
||||
});
|
||||
let init = unsafe { slice::from_raw_parts(init, size) };
|
||||
client.handle_init_msg(init);
|
||||
|
|
@ -591,6 +593,18 @@ impl ConfigClient {
|
|||
self.send(&ClientMessage::ShowWorkspace { seat, workspace });
|
||||
}
|
||||
|
||||
pub fn show_workspace_on(&self, seat: Seat, workspace: Workspace, connector: Connector) {
|
||||
if self.feat_show_workspace_on.get() && connector.connected() {
|
||||
self.send(&ClientMessage::ShowWorkspaceOn {
|
||||
seat,
|
||||
workspace,
|
||||
connector,
|
||||
});
|
||||
} else {
|
||||
self.show_workspace(seat, workspace);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_seat_workspace(&self, seat: Seat, workspace: Workspace) {
|
||||
self.send(&ClientMessage::SetSeatWorkspace { seat, workspace });
|
||||
}
|
||||
|
|
@ -2086,6 +2100,7 @@ impl ConfigClient {
|
|||
match feat {
|
||||
ServerFeature::NONE => {}
|
||||
ServerFeature::MOD_MASK => self.feat_mod_mask.set(true),
|
||||
ServerFeature::SHOW_WORKSPACE_ON => self.feat_show_workspace_on.set(true),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ pub struct ServerFeature(u16);
|
|||
impl ServerFeature {
|
||||
pub const NONE: Self = Self(0);
|
||||
pub const MOD_MASK: Self = Self(1);
|
||||
pub const SHOW_WORKSPACE_ON: Self = Self(2);
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
@ -782,6 +783,11 @@ pub enum ClientMessage<'a> {
|
|||
matcher: ClientMatcher,
|
||||
caps: ClientCapabilities,
|
||||
},
|
||||
ShowWorkspaceOn {
|
||||
seat: Seat,
|
||||
workspace: Workspace,
|
||||
connector: Connector,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
|
|||
|
|
@ -439,6 +439,15 @@ impl Seat {
|
|||
get!().show_workspace(self, workspace)
|
||||
}
|
||||
|
||||
/// Shows the workspace and sets the keyboard focus of the seat to that workspace.
|
||||
///
|
||||
/// If the workspace doesn't currently exist and the connector is connected, the
|
||||
/// workspace is created on the given connector. If the connector is not connected,
|
||||
/// the workspace is created on the output that contains the seat's cursor.
|
||||
pub fn show_workspace_on(self, workspace: Workspace, connector: Connector) {
|
||||
get!().show_workspace_on(self, workspace, connector)
|
||||
}
|
||||
|
||||
/// Moves the currently focused window to the workspace.
|
||||
pub fn set_workspace(self, workspace: Workspace) {
|
||||
get!().set_seat_workspace(self, workspace)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue