diff --git a/build/wire.rs b/build/wire.rs index 327b1fb3..2b952f64 100644 --- a/build/wire.rs +++ b/build/wire.rs @@ -299,12 +299,17 @@ fn write_request_handler( Ok(()) } -fn write_file(f: &mut W, file: &DirEntry) -> Result<()> { +fn write_file( + f: &mut W, + file: &DirEntry, + interface_names: &mut Vec, +) -> Result<()> { let file_name = file.file_name(); let file_name = std::str::from_utf8(file_name.as_bytes())?; println!("cargo:rerun-if-changed=wire/{}", file_name); let obj_name = file_name.split(".").next().unwrap(); let camel_obj_name = to_camel(obj_name); + interface_names.push(camel_obj_name.clone()); writeln!(f)?; writeln!(f, "id!({}Id);", camel_obj_name)?; writeln!(f)?; @@ -355,9 +360,21 @@ pub fn main() -> Result<()> { files.push(file?); } files.sort_by_key(|f| f.file_name()); + let mut interface_names = vec![]; for file in files { - write_file(&mut f, &file) + write_file(&mut f, &file, &mut interface_names) .with_context(|| format!("While processing {}", file.path().display()))?; } + writeln!(f)?; + writeln!(f, "#[doc(hidden)]")?; + writeln!(f, "#[expect(dead_code)]")?; + writeln!(f, "pub mod interface_singletons {{")?; + for interface in &interface_names { + writeln!( + f, + " pub const {interface}: Option = None;" + )?; + } + writeln!(f, "}}")?; Ok(()) } diff --git a/src/globals.rs b/src/globals.rs index f28341e1..be9538d2 100644 --- a/src/globals.rs +++ b/src/globals.rs @@ -135,10 +135,10 @@ pub trait GlobalBase { version: Version, ) -> Result<(), GlobalsError>; fn interface(&self) -> Interface; + fn singleton(&self) -> Option; } pub trait Global: GlobalBase { - fn singleton(&self) -> bool; fn version(&self) -> u32; fn required_caps(&self) -> ClientCaps { ClientCaps::none() @@ -168,6 +168,15 @@ macro_rules! singletons { globals.singletons[Singleton::$name] = name; )* } + + #[expect(non_upper_case_globals)] + pub mod interface_singletons { + pub use crate::wire::interface_singletons::*; + + $( + pub const $name: Option = Some(crate::globals::Singleton::$name); + )* + } }; } @@ -328,7 +337,7 @@ impl Globals { macro_rules! emit { ($singleton:expr) => { for global in globals.values() { - if global.singleton() == $singleton { + if global.singleton().is_some() == $singleton { if global.exposed(®istry.client.state) && caps.contains(global.required_caps()) && (xwayland || !global.xwayland_only()) diff --git a/src/ifs/color_management/wp_color_manager_v1.rs b/src/ifs/color_management/wp_color_manager_v1.rs index 1b75c0b4..9610e5ac 100644 --- a/src/ifs/color_management/wp_color_manager_v1.rs +++ b/src/ifs/color_management/wp_color_manager_v1.rs @@ -283,10 +283,6 @@ global_base!( ); impl Global for WpColorManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 2 } diff --git a/src/ifs/ext_foreign_toplevel_image_capture_source_manager_v1.rs b/src/ifs/ext_foreign_toplevel_image_capture_source_manager_v1.rs index 62529684..56e5ffdd 100644 --- a/src/ifs/ext_foreign_toplevel_image_capture_source_manager_v1.rs +++ b/src/ifs/ext_foreign_toplevel_image_capture_source_manager_v1.rs @@ -79,10 +79,6 @@ global_base!( ); impl Global for ExtForeignToplevelImageCaptureSourceManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/ext_foreign_toplevel_list_v1.rs b/src/ifs/ext_foreign_toplevel_list_v1.rs index 72b4a170..c5421a16 100644 --- a/src/ifs/ext_foreign_toplevel_list_v1.rs +++ b/src/ifs/ext_foreign_toplevel_list_v1.rs @@ -134,10 +134,6 @@ global_base!( ); impl Global for ExtForeignToplevelListV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/ext_idle_notifier_v1.rs b/src/ifs/ext_idle_notifier_v1.rs index cdc79305..e239a4f8 100644 --- a/src/ifs/ext_idle_notifier_v1.rs +++ b/src/ifs/ext_idle_notifier_v1.rs @@ -140,10 +140,6 @@ global_base!( ); impl Global for ExtIdleNotifierV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 2 } diff --git a/src/ifs/ext_image_copy/ext_image_copy_capture_manager_v1.rs b/src/ifs/ext_image_copy/ext_image_copy_capture_manager_v1.rs index c2a219e1..77ad9b55 100644 --- a/src/ifs/ext_image_copy/ext_image_copy_capture_manager_v1.rs +++ b/src/ifs/ext_image_copy/ext_image_copy_capture_manager_v1.rs @@ -142,10 +142,6 @@ global_base!( ); impl Global for ExtImageCopyCaptureManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/ext_output_image_capture_source_manager_v1.rs b/src/ifs/ext_output_image_capture_source_manager_v1.rs index 643318dc..568fe378 100644 --- a/src/ifs/ext_output_image_capture_source_manager_v1.rs +++ b/src/ifs/ext_output_image_capture_source_manager_v1.rs @@ -76,10 +76,6 @@ global_base!( ); impl Global for ExtOutputImageCaptureSourceManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/ext_session_lock_manager_v1.rs b/src/ifs/ext_session_lock_manager_v1.rs index 834324c5..eee71c17 100644 --- a/src/ifs/ext_session_lock_manager_v1.rs +++ b/src/ifs/ext_session_lock_manager_v1.rs @@ -91,10 +91,6 @@ global_base!( ); impl Global for ExtSessionLockManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/head_management/jay_head_manager_v1.rs b/src/ifs/head_management/jay_head_manager_v1.rs index 3ce36535..5a3e8c3e 100644 --- a/src/ifs/head_management/jay_head_manager_v1.rs +++ b/src/ifs/head_management/jay_head_manager_v1.rs @@ -62,10 +62,6 @@ global_base!( simple_add_global!(JayHeadManagerV1Global); impl Global for JayHeadManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/ipc/data_control/ext_data_control_manager_v1.rs b/src/ifs/ipc/data_control/ext_data_control_manager_v1.rs index 57678c46..a1d60588 100644 --- a/src/ifs/ipc/data_control/ext_data_control_manager_v1.rs +++ b/src/ifs/ipc/data_control/ext_data_control_manager_v1.rs @@ -102,10 +102,6 @@ global_base!( ); impl Global for ExtDataControlManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/ipc/data_control/zwlr_data_control_manager_v1.rs b/src/ifs/ipc/data_control/zwlr_data_control_manager_v1.rs index 2111000b..b79b4a0f 100644 --- a/src/ifs/ipc/data_control/zwlr_data_control_manager_v1.rs +++ b/src/ifs/ipc/data_control/zwlr_data_control_manager_v1.rs @@ -102,10 +102,6 @@ global_base!( ); impl Global for ZwlrDataControlManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 2 } diff --git a/src/ifs/ipc/wl_data_device_manager.rs b/src/ifs/ipc/wl_data_device_manager.rs index d4c12b54..922629f0 100644 --- a/src/ifs/ipc/wl_data_device_manager.rs +++ b/src/ifs/ipc/wl_data_device_manager.rs @@ -95,10 +95,6 @@ global_base!( ); impl Global for WlDataDeviceManagerGlobal { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 4 } diff --git a/src/ifs/ipc/zwp_primary_selection_device_manager_v1.rs b/src/ifs/ipc/zwp_primary_selection_device_manager_v1.rs index 9bace1c4..20714596 100644 --- a/src/ifs/ipc/zwp_primary_selection_device_manager_v1.rs +++ b/src/ifs/ipc/zwp_primary_selection_device_manager_v1.rs @@ -90,10 +90,6 @@ global_base!( ); impl Global for ZwpPrimarySelectionDeviceManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/jay_compositor.rs b/src/ifs/jay_compositor.rs index dc740dcc..218d7c29 100644 --- a/src/ifs/jay_compositor.rs +++ b/src/ifs/jay_compositor.rs @@ -75,10 +75,6 @@ impl JayCompositorGlobal { global_base!(JayCompositorGlobal, JayCompositor, JayCompositorError); impl Global for JayCompositorGlobal { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 25 } diff --git a/src/ifs/jay_damage_tracking.rs b/src/ifs/jay_damage_tracking.rs index 04d30db0..703f6a1e 100644 --- a/src/ifs/jay_damage_tracking.rs +++ b/src/ifs/jay_damage_tracking.rs @@ -53,10 +53,6 @@ global_base!( ); impl Global for JayDamageTrackingGlobal { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/jay_popup_ext_manager_v1.rs b/src/ifs/jay_popup_ext_manager_v1.rs index 9bcce725..a1fb8842 100644 --- a/src/ifs/jay_popup_ext_manager_v1.rs +++ b/src/ifs/jay_popup_ext_manager_v1.rs @@ -54,10 +54,6 @@ global_base!( ); impl Global for JayPopupExtManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/jay_tray_v1.rs b/src/ifs/jay_tray_v1.rs index 712eb130..f80e4982 100644 --- a/src/ifs/jay_tray_v1.rs +++ b/src/ifs/jay_tray_v1.rs @@ -50,10 +50,6 @@ impl JayTrayV1Global { global_base!(JayTrayV1Global, JayTrayV1, JayTrayManagerV1Error); impl Global for JayTrayV1Global { - fn singleton(&self) -> bool { - false - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/org_kde_kwin_server_decoration_manager.rs b/src/ifs/org_kde_kwin_server_decoration_manager.rs index 3f829e24..d591e67b 100644 --- a/src/ifs/org_kde_kwin_server_decoration_manager.rs +++ b/src/ifs/org_kde_kwin_server_decoration_manager.rs @@ -53,10 +53,6 @@ global_base!( ); impl Global for OrgKdeKwinServerDecorationManagerGlobal { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wl_compositor.rs b/src/ifs/wl_compositor.rs index b205c8da..1f5ee522 100644 --- a/src/ifs/wl_compositor.rs +++ b/src/ifs/wl_compositor.rs @@ -79,10 +79,6 @@ impl WlCompositorRequestHandler for WlCompositor { global_base!(WlCompositorGlobal, WlCompositor, WlCompositorError); impl Global for WlCompositorGlobal { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 7 } diff --git a/src/ifs/wl_drm.rs b/src/ifs/wl_drm.rs index 624cf89d..c70a1217 100644 --- a/src/ifs/wl_drm.rs +++ b/src/ifs/wl_drm.rs @@ -56,10 +56,6 @@ impl WlDrmGlobal { global_base!(WlDrmGlobal, WlDrm, WlDrmError); impl Global for WlDrmGlobal { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 2 } diff --git a/src/ifs/wl_fixes.rs b/src/ifs/wl_fixes.rs index ac32e3dc..e26735e9 100644 --- a/src/ifs/wl_fixes.rs +++ b/src/ifs/wl_fixes.rs @@ -42,10 +42,6 @@ global_base!(WlFixesGlobal, WlFixes, WlFixesError); simple_add_global!(WlFixesGlobal); impl Global for WlFixesGlobal { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wl_output.rs b/src/ifs/wl_output.rs index 211aaee7..9d165ba9 100644 --- a/src/ifs/wl_output.rs +++ b/src/ifs/wl_output.rs @@ -423,10 +423,6 @@ global_base!(WlOutputGlobal, WlOutput, WlOutputError); const OUTPUT_VERSION: u32 = 4; impl Global for WlOutputGlobal { - fn singleton(&self) -> bool { - false - } - fn version(&self) -> u32 { OUTPUT_VERSION } diff --git a/src/ifs/wl_output/removed_output.rs b/src/ifs/wl_output/removed_output.rs index 0741c3ed..d074868d 100644 --- a/src/ifs/wl_output/removed_output.rs +++ b/src/ifs/wl_output/removed_output.rs @@ -38,10 +38,6 @@ impl RemovedOutputGlobal { global_base!(RemovedOutputGlobal, WlOutput, RemovedOutputError); impl Global for RemovedOutputGlobal { - fn singleton(&self) -> bool { - false - } - fn version(&self) -> u32 { OUTPUT_VERSION } diff --git a/src/ifs/wl_seat.rs b/src/ifs/wl_seat.rs index 0b8f2652..e3f930e0 100644 --- a/src/ifs/wl_seat.rs +++ b/src/ifs/wl_seat.rs @@ -1599,10 +1599,6 @@ impl CursorUserOwner for WlSeatGlobal { global_base!(WlSeatGlobal, WlSeat, WlSeatError); impl Global for WlSeatGlobal { - fn singleton(&self) -> bool { - false - } - fn version(&self) -> u32 { 10 } diff --git a/src/ifs/wl_seat/ext_transient_seat_manager_v1.rs b/src/ifs/wl_seat/ext_transient_seat_manager_v1.rs index aae26a1c..8bb016a1 100644 --- a/src/ifs/wl_seat/ext_transient_seat_manager_v1.rs +++ b/src/ifs/wl_seat/ext_transient_seat_manager_v1.rs @@ -52,10 +52,6 @@ global_base!( ); impl Global for ExtTransientSeatManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wl_seat/tablet/zwp_tablet_manager_v2.rs b/src/ifs/wl_seat/tablet/zwp_tablet_manager_v2.rs index 101ccf85..f8256707 100644 --- a/src/ifs/wl_seat/tablet/zwp_tablet_manager_v2.rs +++ b/src/ifs/wl_seat/tablet/zwp_tablet_manager_v2.rs @@ -52,10 +52,6 @@ global_base!( ); impl Global for ZwpTabletManagerV2Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 2 } diff --git a/src/ifs/wl_seat/text_input/zwp_input_method_manager_v2.rs b/src/ifs/wl_seat/text_input/zwp_input_method_manager_v2.rs index c848fb23..9c3d75e4 100644 --- a/src/ifs/wl_seat/text_input/zwp_input_method_manager_v2.rs +++ b/src/ifs/wl_seat/text_input/zwp_input_method_manager_v2.rs @@ -52,10 +52,6 @@ global_base!( ); impl Global for ZwpInputMethodManagerV2Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wl_seat/text_input/zwp_text_input_manager_v3.rs b/src/ifs/wl_seat/text_input/zwp_text_input_manager_v3.rs index b0389f35..9e3bc1af 100644 --- a/src/ifs/wl_seat/text_input/zwp_text_input_manager_v3.rs +++ b/src/ifs/wl_seat/text_input/zwp_text_input_manager_v3.rs @@ -52,10 +52,6 @@ global_base!( ); impl Global for ZwpTextInputManagerV3Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wl_seat/wp_pointer_warp_v1.rs b/src/ifs/wl_seat/wp_pointer_warp_v1.rs index 33158ea2..466e089a 100644 --- a/src/ifs/wl_seat/wp_pointer_warp_v1.rs +++ b/src/ifs/wl_seat/wp_pointer_warp_v1.rs @@ -45,10 +45,6 @@ impl WpPointerWarpV1Global { global_base!(WpPointerWarpV1Global, WpPointerWarpV1, WpPointerWarpV1Error); impl Global for WpPointerWarpV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wl_seat/zwp_pointer_constraints_v1.rs b/src/ifs/wl_seat/zwp_pointer_constraints_v1.rs index 519915b2..3d2ed4fc 100644 --- a/src/ifs/wl_seat/zwp_pointer_constraints_v1.rs +++ b/src/ifs/wl_seat/zwp_pointer_constraints_v1.rs @@ -313,10 +313,6 @@ global_base!( ); impl Global for ZwpPointerConstraintsV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wl_seat/zwp_pointer_gestures_v1.rs b/src/ifs/wl_seat/zwp_pointer_gestures_v1.rs index 91430a6a..389749b9 100644 --- a/src/ifs/wl_seat/zwp_pointer_gestures_v1.rs +++ b/src/ifs/wl_seat/zwp_pointer_gestures_v1.rs @@ -56,10 +56,6 @@ global_base!( ); impl Global for ZwpPointerGesturesV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 3 } diff --git a/src/ifs/wl_seat/zwp_relative_pointer_manager_v1.rs b/src/ifs/wl_seat/zwp_relative_pointer_manager_v1.rs index 4a44679f..ef88fbab 100644 --- a/src/ifs/wl_seat/zwp_relative_pointer_manager_v1.rs +++ b/src/ifs/wl_seat/zwp_relative_pointer_manager_v1.rs @@ -52,10 +52,6 @@ global_base!( ); impl Global for ZwpRelativePointerManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wl_seat/zwp_virtual_keyboard_manager_v1.rs b/src/ifs/wl_seat/zwp_virtual_keyboard_manager_v1.rs index 23d4ab8e..7ed8604f 100644 --- a/src/ifs/wl_seat/zwp_virtual_keyboard_manager_v1.rs +++ b/src/ifs/wl_seat/zwp_virtual_keyboard_manager_v1.rs @@ -53,10 +53,6 @@ global_base!( ); impl Global for ZwpVirtualKeyboardManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wl_shm.rs b/src/ifs/wl_shm.rs index ffd1ea47..6b77108c 100644 --- a/src/ifs/wl_shm.rs +++ b/src/ifs/wl_shm.rs @@ -85,10 +85,6 @@ impl WlShmRequestHandler for WlShm { global_base!(WlShmGlobal, WlShm, WlShmError); impl Global for WlShmGlobal { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 2 } diff --git a/src/ifs/wl_subcompositor.rs b/src/ifs/wl_subcompositor.rs index b64095d9..ad9a85bb 100644 --- a/src/ifs/wl_subcompositor.rs +++ b/src/ifs/wl_subcompositor.rs @@ -70,10 +70,6 @@ impl WlSubcompositorRequestHandler for WlSubcompositor { global_base!(WlSubcompositorGlobal, WlSubcompositor, WlSubcompositorError); impl Global for WlSubcompositorGlobal { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wl_surface/xwayland_shell_v1.rs b/src/ifs/wl_surface/xwayland_shell_v1.rs index a0aaae1f..5b7c557b 100644 --- a/src/ifs/wl_surface/xwayland_shell_v1.rs +++ b/src/ifs/wl_surface/xwayland_shell_v1.rs @@ -79,10 +79,6 @@ impl XwaylandShellV1RequestHandler for XwaylandShellV1 { global_base!(XwaylandShellV1Global, XwaylandShellV1, XwaylandShellV1Error); impl Global for XwaylandShellV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wlr_output_manager/zwlr_output_manager_v1.rs b/src/ifs/wlr_output_manager/zwlr_output_manager_v1.rs index a5dd6912..972bc6b6 100644 --- a/src/ifs/wlr_output_manager/zwlr_output_manager_v1.rs +++ b/src/ifs/wlr_output_manager/zwlr_output_manager_v1.rs @@ -253,10 +253,6 @@ global_base!( ); impl Global for ZwlrOutputManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 4 } diff --git a/src/ifs/workspace_manager/ext_workspace_manager_v1.rs b/src/ifs/workspace_manager/ext_workspace_manager_v1.rs index c050f582..2f7d5b3a 100644 --- a/src/ifs/workspace_manager/ext_workspace_manager_v1.rs +++ b/src/ifs/workspace_manager/ext_workspace_manager_v1.rs @@ -211,10 +211,6 @@ global_base!( ); impl Global for ExtWorkspaceManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_alpha_modifier_v1.rs b/src/ifs/wp_alpha_modifier_v1.rs index f727fe4e..ccf18ab0 100644 --- a/src/ifs/wp_alpha_modifier_v1.rs +++ b/src/ifs/wp_alpha_modifier_v1.rs @@ -75,10 +75,6 @@ global_base!( ); impl Global for WpAlphaModifierV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_color_representation_manager_v1.rs b/src/ifs/wp_color_representation_manager_v1.rs index 006e843e..9fea611a 100644 --- a/src/ifs/wp_color_representation_manager_v1.rs +++ b/src/ifs/wp_color_representation_manager_v1.rs @@ -126,10 +126,6 @@ global_base!( ); impl Global for WpColorRepresentationManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_commit_timing_manager_v1.rs b/src/ifs/wp_commit_timing_manager_v1.rs index 66b51763..f27b7cf1 100644 --- a/src/ifs/wp_commit_timing_manager_v1.rs +++ b/src/ifs/wp_commit_timing_manager_v1.rs @@ -57,10 +57,6 @@ global_base!( ); impl Global for WpCommitTimingManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_content_type_manager_v1.rs b/src/ifs/wp_content_type_manager_v1.rs index 511f233d..28dc69b9 100644 --- a/src/ifs/wp_content_type_manager_v1.rs +++ b/src/ifs/wp_content_type_manager_v1.rs @@ -47,10 +47,6 @@ global_base!( simple_add_global!(WpContentTypeManagerV1Global); impl Global for WpContentTypeManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_cursor_shape_manager_v1.rs b/src/ifs/wp_cursor_shape_manager_v1.rs index 2b4b37f5..4a77a090 100644 --- a/src/ifs/wp_cursor_shape_manager_v1.rs +++ b/src/ifs/wp_cursor_shape_manager_v1.rs @@ -47,10 +47,6 @@ global_base!( simple_add_global!(WpCursorShapeManagerV1Global); impl Global for WpCursorShapeManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 2 } diff --git a/src/ifs/wp_drm_lease_device_v1.rs b/src/ifs/wp_drm_lease_device_v1.rs index fba54909..aa79e577 100644 --- a/src/ifs/wp_drm_lease_device_v1.rs +++ b/src/ifs/wp_drm_lease_device_v1.rs @@ -77,10 +77,6 @@ global_base!( simple_add_global!(WpDrmLeaseDeviceV1Global); impl Global for WpDrmLeaseDeviceV1Global { - fn singleton(&self) -> bool { - false - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_drm_lease_device_v1/removed_device.rs b/src/ifs/wp_drm_lease_device_v1/removed_device.rs index 6e520882..20835874 100644 --- a/src/ifs/wp_drm_lease_device_v1/removed_device.rs +++ b/src/ifs/wp_drm_lease_device_v1/removed_device.rs @@ -50,10 +50,6 @@ global_base!( simple_add_global!(RemovedWpDrmLeaseDeviceV1Global); impl Global for RemovedWpDrmLeaseDeviceV1Global { - fn singleton(&self) -> bool { - false - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_fifo_manager_v1.rs b/src/ifs/wp_fifo_manager_v1.rs index 270e8b56..d367e927 100644 --- a/src/ifs/wp_fifo_manager_v1.rs +++ b/src/ifs/wp_fifo_manager_v1.rs @@ -48,10 +48,6 @@ impl WpFifoManagerV1Global { global_base!(WpFifoManagerV1Global, WpFifoManagerV1, WpFifoManagerV1Error); impl Global for WpFifoManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_fractional_scale_manager_v1.rs b/src/ifs/wp_fractional_scale_manager_v1.rs index afc48f53..7af85ae5 100644 --- a/src/ifs/wp_fractional_scale_manager_v1.rs +++ b/src/ifs/wp_fractional_scale_manager_v1.rs @@ -52,10 +52,6 @@ global_base!( ); impl Global for WpFractionalScaleManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_linux_drm_syncobj_manager_v1.rs b/src/ifs/wp_linux_drm_syncobj_manager_v1.rs index be7270a9..28bbf116 100644 --- a/src/ifs/wp_linux_drm_syncobj_manager_v1.rs +++ b/src/ifs/wp_linux_drm_syncobj_manager_v1.rs @@ -59,10 +59,6 @@ global_base!( ); impl Global for WpLinuxDrmSyncobjManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_presentation.rs b/src/ifs/wp_presentation.rs index 1314d0d4..0a80f038 100644 --- a/src/ifs/wp_presentation.rs +++ b/src/ifs/wp_presentation.rs @@ -44,10 +44,6 @@ impl WpPresentationGlobal { global_base!(WpPresentationGlobal, WpPresentation, WpPresentationError); impl Global for WpPresentationGlobal { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 2 } diff --git a/src/ifs/wp_security_context_manager_v1.rs b/src/ifs/wp_security_context_manager_v1.rs index 9c597ca5..8a6c668c 100644 --- a/src/ifs/wp_security_context_manager_v1.rs +++ b/src/ifs/wp_security_context_manager_v1.rs @@ -45,10 +45,6 @@ global_base!( ); impl Global for WpSecurityContextManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_single_pixel_buffer_manager_v1.rs b/src/ifs/wp_single_pixel_buffer_manager_v1.rs index 7a5b321c..64201782 100644 --- a/src/ifs/wp_single_pixel_buffer_manager_v1.rs +++ b/src/ifs/wp_single_pixel_buffer_manager_v1.rs @@ -45,10 +45,6 @@ global_base!( ); impl Global for WpSinglePixelBufferManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_tearing_control_manager_v1.rs b/src/ifs/wp_tearing_control_manager_v1.rs index 58f2ec9f..90e89247 100644 --- a/src/ifs/wp_tearing_control_manager_v1.rs +++ b/src/ifs/wp_tearing_control_manager_v1.rs @@ -45,10 +45,6 @@ global_base!( ); impl Global for WpTearingControlManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/wp_viewporter.rs b/src/ifs/wp_viewporter.rs index cd775238..d892d819 100644 --- a/src/ifs/wp_viewporter.rs +++ b/src/ifs/wp_viewporter.rs @@ -41,10 +41,6 @@ impl WpViewporterGlobal { global_base!(WpViewporterGlobal, WpViewporter, WpViewporterError); impl Global for WpViewporterGlobal { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/xdg_activation_v1.rs b/src/ifs/xdg_activation_v1.rs index f234c3ff..f9879444 100644 --- a/src/ifs/xdg_activation_v1.rs +++ b/src/ifs/xdg_activation_v1.rs @@ -44,10 +44,6 @@ global_base!(XdgActivationV1Global, XdgActivationV1, XdgActivationV1Error); simple_add_global!(XdgActivationV1Global); impl Global for XdgActivationV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/xdg_toplevel_drag_manager_v1.rs b/src/ifs/xdg_toplevel_drag_manager_v1.rs index 97eb8a87..fd5ed7fe 100644 --- a/src/ifs/xdg_toplevel_drag_manager_v1.rs +++ b/src/ifs/xdg_toplevel_drag_manager_v1.rs @@ -47,10 +47,6 @@ global_base!( simple_add_global!(XdgToplevelDragManagerV1Global); impl Global for XdgToplevelDragManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/xdg_toplevel_tag_manager_v1.rs b/src/ifs/xdg_toplevel_tag_manager_v1.rs index cdcecdab..993f1110 100644 --- a/src/ifs/xdg_toplevel_tag_manager_v1.rs +++ b/src/ifs/xdg_toplevel_tag_manager_v1.rs @@ -46,10 +46,6 @@ global_base!( ); impl Global for XdgToplevelTagManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/xdg_wm_base.rs b/src/ifs/xdg_wm_base.rs index 0f7cceaf..ac8e3b58 100644 --- a/src/ifs/xdg_wm_base.rs +++ b/src/ifs/xdg_wm_base.rs @@ -107,10 +107,6 @@ impl XdgWmBaseRequestHandler for XdgWmBase { global_base!(XdgWmBaseGlobal, XdgWmBase, XdgWmBaseError); impl Global for XdgWmBaseGlobal { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 7 } diff --git a/src/ifs/xdg_wm_dialog_v1.rs b/src/ifs/xdg_wm_dialog_v1.rs index 5adfedf3..ed77794f 100644 --- a/src/ifs/xdg_wm_dialog_v1.rs +++ b/src/ifs/xdg_wm_dialog_v1.rs @@ -43,10 +43,6 @@ impl XdgWmDialogV1Global { global_base!(XdgWmDialogV1Global, XdgWmDialogV1, XdgWmDialogV1Error); impl Global for XdgWmDialogV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/zwlr_foreign_toplevel_manager_v1.rs b/src/ifs/zwlr_foreign_toplevel_manager_v1.rs index 3c040f8c..f82feb9d 100644 --- a/src/ifs/zwlr_foreign_toplevel_manager_v1.rs +++ b/src/ifs/zwlr_foreign_toplevel_manager_v1.rs @@ -126,10 +126,6 @@ global_base!( ); impl Global for ZwlrForeignToplevelManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 3 } diff --git a/src/ifs/zwlr_gamma_control_manager_v1.rs b/src/ifs/zwlr_gamma_control_manager_v1.rs index 966fd6ca..f2102ee9 100644 --- a/src/ifs/zwlr_gamma_control_manager_v1.rs +++ b/src/ifs/zwlr_gamma_control_manager_v1.rs @@ -47,10 +47,6 @@ global_base!( simple_add_global!(ZwlrGammaControlManagerV1Global); impl Global for ZwlrGammaControlManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/zwlr_layer_shell_v1.rs b/src/ifs/zwlr_layer_shell_v1.rs index f1e59041..2d060860 100644 --- a/src/ifs/zwlr_layer_shell_v1.rs +++ b/src/ifs/zwlr_layer_shell_v1.rs @@ -102,10 +102,6 @@ global_base!( ); impl Global for ZwlrLayerShellV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 5 } diff --git a/src/ifs/zwlr_screencopy_manager_v1.rs b/src/ifs/zwlr_screencopy_manager_v1.rs index 57471b3e..2ff6c8a4 100644 --- a/src/ifs/zwlr_screencopy_manager_v1.rs +++ b/src/ifs/zwlr_screencopy_manager_v1.rs @@ -51,10 +51,6 @@ global_base!( simple_add_global!(ZwlrScreencopyManagerV1Global); impl Global for ZwlrScreencopyManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 3 } diff --git a/src/ifs/zwp_idle_inhibit_manager_v1.rs b/src/ifs/zwp_idle_inhibit_manager_v1.rs index 71884fc9..8c8b3b73 100644 --- a/src/ifs/zwp_idle_inhibit_manager_v1.rs +++ b/src/ifs/zwp_idle_inhibit_manager_v1.rs @@ -48,10 +48,6 @@ global_base!( ); impl Global for ZwpIdleInhibitManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 1 } diff --git a/src/ifs/zwp_linux_dmabuf_v1.rs b/src/ifs/zwp_linux_dmabuf_v1.rs index 0e443876..55bdc4da 100644 --- a/src/ifs/zwp_linux_dmabuf_v1.rs +++ b/src/ifs/zwp_linux_dmabuf_v1.rs @@ -65,10 +65,6 @@ global_base!( ); impl Global for ZwpLinuxDmabufV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 5 } diff --git a/src/ifs/zxdg_decoration_manager_v1.rs b/src/ifs/zxdg_decoration_manager_v1.rs index e4377644..6e228830 100644 --- a/src/ifs/zxdg_decoration_manager_v1.rs +++ b/src/ifs/zxdg_decoration_manager_v1.rs @@ -45,10 +45,6 @@ global_base!( ); impl Global for ZxdgDecorationManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 2 } diff --git a/src/ifs/zxdg_output_manager_v1.rs b/src/ifs/zxdg_output_manager_v1.rs index fd64a128..f4498bad 100644 --- a/src/ifs/zxdg_output_manager_v1.rs +++ b/src/ifs/zxdg_output_manager_v1.rs @@ -77,10 +77,6 @@ global_base!( ); impl Global for ZxdgOutputManagerV1Global { - fn singleton(&self) -> bool { - true - } - fn version(&self) -> u32 { 3 } diff --git a/src/macros.rs b/src/macros.rs index 260665c6..99fd01a4 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -87,6 +87,10 @@ macro_rules! global_base { fn interface(&self) -> crate::object::Interface { crate::wire::$ifname } + + fn singleton(&self) -> Option { + crate::globals::interface_singletons::$ifname + } } impl From<$ename> for crate::globals::GlobalError {