output: Add increasing output id
This commit is contained in:
parent
f6d3dafda7
commit
361a2282c7
1 changed files with 20 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ use crate::{
|
|||
element::CosmicStack, focus::FocusTarget, grabs::fullscreen_items,
|
||||
layout::tiling::PlaceholderType,
|
||||
},
|
||||
utils,
|
||||
wayland::{
|
||||
handlers::data_device::{self, get_dnd_icon},
|
||||
protocols::workspace::{State as WState, WorkspaceCapabilities},
|
||||
|
|
@ -1510,6 +1511,21 @@ impl Workspaces {
|
|||
#[derive(Debug)]
|
||||
pub struct InvalidWorkspaceIndex;
|
||||
|
||||
utils::id_gen!(next_output_id, OUTPUT_ID, OUTPUT_IDS);
|
||||
pub struct OutputId(usize);
|
||||
|
||||
impl OutputId {
|
||||
pub fn namespace_for_workspace(&self, idx: usize) -> usize {
|
||||
self.0 | (idx << 32)
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for OutputId {
|
||||
fn drop(&mut self) {
|
||||
OUTPUT_IDS.lock().unwrap().remove(&self.0);
|
||||
}
|
||||
}
|
||||
|
||||
impl Common {
|
||||
pub fn add_output(&mut self, output: &Output) {
|
||||
let mut shell = self.shell.write();
|
||||
|
|
@ -1517,6 +1533,10 @@ impl Common {
|
|||
.workspaces
|
||||
.add_output(output, &mut self.workspace_state.update());
|
||||
|
||||
output
|
||||
.user_data()
|
||||
.insert_if_missing_threadsafe(|| OutputId(next_output_id()));
|
||||
|
||||
if let Some(state) = shell.zoom_state.as_ref() {
|
||||
output.user_data().insert_if_missing_threadsafe(|| {
|
||||
Mutex::new(OutputZoomState::new(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue