config: add Seat.get_keyboard_output and Connector.workspaces
This commit is contained in:
parent
b83bf0657b
commit
00735e4621
7 changed files with 127 additions and 30 deletions
|
|
@ -417,6 +417,12 @@ impl Client {
|
|||
workspace
|
||||
}
|
||||
|
||||
pub fn get_seat_keyboard_workspace(&self, seat: Seat) -> Workspace {
|
||||
let res = self.send_with_response(&ClientMessage::GetSeatKeyboardWorkspace { seat });
|
||||
get_response!(res, Workspace(0), GetSeatKeyboardWorkspace { workspace });
|
||||
workspace
|
||||
}
|
||||
|
||||
pub fn set_default_workspace_capture(&self, capture: bool) {
|
||||
self.send(&ClientMessage::SetDefaultWorkspaceCapture { capture });
|
||||
}
|
||||
|
|
@ -1076,6 +1082,19 @@ impl Client {
|
|||
self.send(&ClientMessage::SetEiSocketEnabled { enabled })
|
||||
}
|
||||
|
||||
pub fn get_connector_active_workspace(&self, connector: Connector) -> Workspace {
|
||||
let res =
|
||||
self.send_with_response(&ClientMessage::GetConnectorActiveWorkspace { connector });
|
||||
get_response!(res, Workspace(0), GetConnectorActiveWorkspace { workspace });
|
||||
workspace
|
||||
}
|
||||
|
||||
pub fn get_connector_workspaces(&self, connector: Connector) -> Vec<Workspace> {
|
||||
let res = self.send_with_response(&ClientMessage::GetConnectorWorkspaces { connector });
|
||||
get_response!(res, vec![], GetConnectorWorkspaces { workspaces });
|
||||
workspaces
|
||||
}
|
||||
|
||||
pub fn latch<F: FnOnce() + 'static>(&self, seat: Seat, f: F) {
|
||||
if !self.feat_mod_mask.get() {
|
||||
log::error!("compositor does not support latching");
|
||||
|
|
|
|||
|
|
@ -556,6 +556,15 @@ pub enum ClientMessage<'a> {
|
|||
SetShowFloatPinIcon {
|
||||
show: bool,
|
||||
},
|
||||
GetSeatKeyboardWorkspace {
|
||||
seat: Seat,
|
||||
},
|
||||
GetConnectorActiveWorkspace {
|
||||
connector: Connector,
|
||||
},
|
||||
GetConnectorWorkspaces {
|
||||
connector: Connector,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
@ -710,6 +719,15 @@ pub enum Response {
|
|||
GetFloatPinned {
|
||||
pinned: bool,
|
||||
},
|
||||
GetSeatKeyboardWorkspace {
|
||||
workspace: Workspace,
|
||||
},
|
||||
GetConnectorActiveWorkspace {
|
||||
workspace: Workspace,
|
||||
},
|
||||
GetConnectorWorkspaces {
|
||||
workspaces: Vec<Workspace>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
|
|||
|
|
@ -359,6 +359,14 @@ impl Seat {
|
|||
get!(Workspace(0)).get_seat_workspace(self)
|
||||
}
|
||||
|
||||
/// Returns the workspace that is currently active on the output that contains the seat's
|
||||
/// keyboard focus.
|
||||
///
|
||||
/// If no such workspace exists, `exists` returns `false` for the returned workspace.
|
||||
pub fn get_keyboard_workspace(self) -> Workspace {
|
||||
get!(Workspace(0)).get_seat_keyboard_workspace(self)
|
||||
}
|
||||
|
||||
/// Shows the workspace and sets the keyboard focus of the seat to that workspace.
|
||||
///
|
||||
/// If the workspace doesn't currently exist, it is created on the output that contains the
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use {
|
||||
crate::{
|
||||
_private::WireMode,
|
||||
PciId,
|
||||
PciId, Workspace,
|
||||
video::connector_type::{
|
||||
CON_9PIN_DIN, CON_COMPONENT, CON_COMPOSITE, CON_DISPLAY_PORT, CON_DPI, CON_DSI,
|
||||
CON_DVIA, CON_DVID, CON_DVII, CON_EDP, CON_EMBEDDED_WINDOW, CON_HDMIA, CON_HDMIB,
|
||||
|
|
@ -301,6 +301,21 @@ impl Connector {
|
|||
pub fn set_brightness(self, brightness: Option<f64>) {
|
||||
get!().connector_set_brightness(self, brightness);
|
||||
}
|
||||
|
||||
/// Get the currently visible/active workspace.
|
||||
///
|
||||
/// If this connector is not connected, or is there no active workspace, returns a
|
||||
/// workspace whose `exists()` returns false.
|
||||
pub fn active_workspace(self) -> Workspace {
|
||||
get!(Workspace(0)).get_connector_active_workspace(self)
|
||||
}
|
||||
|
||||
/// Get all workspaces on this connector.
|
||||
///
|
||||
/// If this connector is not connected, returns an empty list.
|
||||
pub fn workspaces(self) -> Vec<Workspace> {
|
||||
get!().get_connector_workspaces(self)
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns all available DRM devices.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue