Skip to content

Commit

Permalink
output_configuration: Use WeakOutput as user data instead of Output
Browse files Browse the repository at this point in the history
  • Loading branch information
ids1024 authored and Drakulix committed Nov 18, 2024
1 parent 8d7f491 commit cd9ff0b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/wayland/protocols/output_configuration/handlers/cosmic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl<D> Dispatch<ZcosmicOutputManagerV1, (), D> for OutputConfigurationState<D>
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand Down Expand Up @@ -150,7 +150,7 @@ impl<D> Dispatch<ZcosmicOutputConfigurationV1, Weak<ZwlrOutputConfigurationV1>,
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand Down Expand Up @@ -238,7 +238,7 @@ impl<D> Dispatch<ZcosmicOutputConfigurationHeadV1, Weak<ZwlrOutputConfigurationH
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand Down
20 changes: 10 additions & 10 deletions src/wayland/protocols/output_configuration/handlers/wlr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use cosmic_protocols::output_management::v1::server::zcosmic_output_configuration_v1;
use smithay::{
output::{Mode, Output},
output::{Mode, Output, WeakOutput},
reexports::{
wayland_protocols_wlr::output_management::v1::server::{
zwlr_output_configuration_head_v1::{self, ZwlrOutputConfigurationHeadV1},
Expand All @@ -26,7 +26,7 @@ impl<D> GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData, D> for OutputC
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand Down Expand Up @@ -63,7 +63,7 @@ impl<D> Dispatch<ZwlrOutputManagerV1, (), D> for OutputConfigurationState<D>
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand Down Expand Up @@ -116,11 +116,11 @@ where
}
}

impl<D> Dispatch<ZwlrOutputHeadV1, Output, D> for OutputConfigurationState<D>
impl<D> Dispatch<ZwlrOutputHeadV1, WeakOutput, D> for OutputConfigurationState<D>
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand All @@ -132,7 +132,7 @@ where
_client: &Client,
obj: &ZwlrOutputHeadV1,
request: zwlr_output_head_v1::Request,
_data: &Output,
_data: &WeakOutput,
_dh: &DisplayHandle,
_data_init: &mut DataInit<'_, D>,
) {
Expand All @@ -146,7 +146,7 @@ where
}
}

fn destroyed(state: &mut D, _client: ClientId, obj: &ZwlrOutputHeadV1, _data: &Output) {
fn destroyed(state: &mut D, _client: ClientId, obj: &ZwlrOutputHeadV1, _data: &WeakOutput) {
for instance in &mut state.output_configuration_state().instances {
instance.heads.retain(|h| &h.obj != obj);
}
Expand All @@ -157,7 +157,7 @@ impl<D> Dispatch<ZwlrOutputModeV1, Mode, D> for OutputConfigurationState<D>
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand Down Expand Up @@ -191,7 +191,7 @@ impl<D> Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration, D> for OutputC
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand Down Expand Up @@ -382,7 +382,7 @@ impl<D> Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration, D>
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand Down
10 changes: 5 additions & 5 deletions src/wayland/protocols/output_configuration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use cosmic_protocols::output_management::v1::server::{
zcosmic_output_head_v1::ZcosmicOutputHeadV1, zcosmic_output_manager_v1::ZcosmicOutputManagerV1,
};
use smithay::{
output::{Mode, Output},
output::{Mode, Output, WeakOutput},
reexports::{
wayland_protocols_wlr::output_management::v1::server::{
zwlr_output_configuration_head_v1::{self, ZwlrOutputConfigurationHeadV1},
Expand Down Expand Up @@ -154,7 +154,7 @@ where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ GlobalDispatch<WlOutput, WlOutputData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand Down Expand Up @@ -312,7 +312,7 @@ fn send_head_to_client<D>(dh: &DisplayHandle, mngr: &mut OutputMngrInstance, out
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ OutputConfigurationHandler
Expand All @@ -330,7 +330,7 @@ where
if let Ok(head) = client.create_resource::<ZwlrOutputHeadV1, _, D>(
dh,
mngr.obj.version(),
output.clone(),
output.downgrade(),
) {
mngr.obj.head(&head);
let data = OutputHeadInstance {
Expand Down Expand Up @@ -468,7 +468,7 @@ macro_rules! delegate_output_configuration {
smithay::reexports::wayland_protocols_wlr::output_management::v1::server::zwlr_output_manager_v1::ZwlrOutputManagerV1: ()
] => $crate::wayland::protocols::output_configuration::OutputConfigurationState<Self>);
smithay::reexports::wayland_server::delegate_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty: [
smithay::reexports::wayland_protocols_wlr::output_management::v1::server::zwlr_output_head_v1::ZwlrOutputHeadV1: smithay::output::Output
smithay::reexports::wayland_protocols_wlr::output_management::v1::server::zwlr_output_head_v1::ZwlrOutputHeadV1: smithay::output::WeakOutput
] => $crate::wayland::protocols::output_configuration::OutputConfigurationState<Self>);
smithay::reexports::wayland_server::delegate_dispatch!($(@< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $ty: [
smithay::reexports::wayland_protocols_wlr::output_management::v1::server::zwlr_output_mode_v1::ZwlrOutputModeV1: smithay::output::Mode
Expand Down

0 comments on commit cd9ff0b

Please sign in to comment.