From cd9ff0b7bb9ef5559420ac2e91f1e97e837fcd34 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Thu, 14 Nov 2024 15:40:28 -0800 Subject: [PATCH] output_configuration: Use `WeakOutput` as user data instead of `Output` --- .../output_configuration/handlers/cosmic.rs | 6 +++--- .../output_configuration/handlers/wlr.rs | 20 +++++++++---------- .../protocols/output_configuration/mod.rs | 10 +++++----- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/wayland/protocols/output_configuration/handlers/cosmic.rs b/src/wayland/protocols/output_configuration/handlers/cosmic.rs index bbd98de9..61be21d6 100644 --- a/src/wayland/protocols/output_configuration/handlers/cosmic.rs +++ b/src/wayland/protocols/output_configuration/handlers/cosmic.rs @@ -54,7 +54,7 @@ impl Dispatch for OutputConfigurationState where D: GlobalDispatch + Dispatch - + Dispatch + + Dispatch + Dispatch + Dispatch + Dispatch @@ -150,7 +150,7 @@ impl Dispatch, where D: GlobalDispatch + Dispatch - + Dispatch + + Dispatch + Dispatch + Dispatch + Dispatch @@ -238,7 +238,7 @@ impl Dispatch + Dispatch - + Dispatch + + Dispatch + Dispatch + Dispatch + Dispatch diff --git a/src/wayland/protocols/output_configuration/handlers/wlr.rs b/src/wayland/protocols/output_configuration/handlers/wlr.rs index 84800f6e..56565c0c 100644 --- a/src/wayland/protocols/output_configuration/handlers/wlr.rs +++ b/src/wayland/protocols/output_configuration/handlers/wlr.rs @@ -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}, @@ -26,7 +26,7 @@ impl GlobalDispatch for OutputC where D: GlobalDispatch + Dispatch - + Dispatch + + Dispatch + Dispatch + Dispatch + Dispatch @@ -63,7 +63,7 @@ impl Dispatch for OutputConfigurationState where D: GlobalDispatch + Dispatch - + Dispatch + + Dispatch + Dispatch + Dispatch + Dispatch @@ -116,11 +116,11 @@ where } } -impl Dispatch for OutputConfigurationState +impl Dispatch for OutputConfigurationState where D: GlobalDispatch + Dispatch - + Dispatch + + Dispatch + Dispatch + Dispatch + Dispatch @@ -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>, ) { @@ -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); } @@ -157,7 +157,7 @@ impl Dispatch for OutputConfigurationState where D: GlobalDispatch + Dispatch - + Dispatch + + Dispatch + Dispatch + Dispatch + Dispatch @@ -191,7 +191,7 @@ impl Dispatch for OutputC where D: GlobalDispatch + Dispatch - + Dispatch + + Dispatch + Dispatch + Dispatch + Dispatch @@ -382,7 +382,7 @@ impl Dispatch where D: GlobalDispatch + Dispatch - + Dispatch + + Dispatch + Dispatch + Dispatch + Dispatch diff --git a/src/wayland/protocols/output_configuration/mod.rs b/src/wayland/protocols/output_configuration/mod.rs index e82b922d..b34995c3 100644 --- a/src/wayland/protocols/output_configuration/mod.rs +++ b/src/wayland/protocols/output_configuration/mod.rs @@ -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}, @@ -154,7 +154,7 @@ where D: GlobalDispatch + GlobalDispatch + Dispatch - + Dispatch + + Dispatch + Dispatch + Dispatch + Dispatch @@ -312,7 +312,7 @@ fn send_head_to_client(dh: &DisplayHandle, mngr: &mut OutputMngrInstance, out where D: GlobalDispatch + Dispatch - + Dispatch + + Dispatch + Dispatch + Dispatch + OutputConfigurationHandler @@ -330,7 +330,7 @@ where if let Ok(head) = client.create_resource::( dh, mngr.obj.version(), - output.clone(), + output.downgrade(), ) { mngr.obj.head(&head); let data = OutputHeadInstance { @@ -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); 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); 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