-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #185 from mahkoh/jorth/output-removal
wayland: allow binding to removed outputs
- Loading branch information
Showing
16 changed files
with
212 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
use { | ||
crate::{ | ||
client::{Client, ClientError}, | ||
globals::{Global, GlobalName, RemovableWaylandGlobal}, | ||
ifs::wl_output::{WlOutput, WlOutputGlobal, OUTPUT_VERSION}, | ||
object::Version, | ||
wire::WlOutputId, | ||
}, | ||
std::rc::Rc, | ||
thiserror::Error, | ||
}; | ||
|
||
struct RemovedOutputGlobal { | ||
name: GlobalName, | ||
} | ||
|
||
impl RemovedOutputGlobal { | ||
fn bind_( | ||
self: Rc<Self>, | ||
id: WlOutputId, | ||
client: &Rc<Client>, | ||
version: Version, | ||
) -> Result<(), RemovedOutputError> { | ||
let obj = Rc::new(WlOutput { | ||
global: Default::default(), | ||
id, | ||
xdg_outputs: Default::default(), | ||
client: client.clone(), | ||
version, | ||
tracker: Default::default(), | ||
}); | ||
track!(client, obj); | ||
client.add_client_obj(&obj)?; | ||
Ok(()) | ||
} | ||
} | ||
|
||
global_base!(RemovedOutputGlobal, WlOutput, RemovedOutputError); | ||
|
||
impl Global for RemovedOutputGlobal { | ||
fn singleton(&self) -> bool { | ||
false | ||
} | ||
|
||
fn version(&self) -> u32 { | ||
OUTPUT_VERSION | ||
} | ||
} | ||
|
||
simple_add_global!(RemovedOutputGlobal); | ||
|
||
impl RemovableWaylandGlobal for WlOutputGlobal { | ||
fn create_replacement(&self) -> Rc<dyn Global> { | ||
Rc::new(RemovedOutputGlobal { name: self.name }) | ||
} | ||
} | ||
|
||
#[derive(Debug, Error)] | ||
enum RemovedOutputError { | ||
#[error(transparent)] | ||
ClientError(Box<ClientError>), | ||
} | ||
efrom!(RemovedOutputError, ClientError); |
Oops, something went wrong.