diff --git a/src/bin/client.rs b/src/bin/client.rs index 6d6f4ac..a89e331 100644 --- a/src/bin/client.rs +++ b/src/bin/client.rs @@ -20,7 +20,7 @@ use wayland_protocols_misc::zwp_virtual_keyboard_v1::client::{ use wayland_client::{ globals::{registry_queue_init, GlobalListContents}, protocol::{wl_keyboard, wl_pointer, wl_registry, wl_seat}, - Connection, Dispatch, EventQueue, QueueHandle, + Connection, Dispatch, EventQueue, QueueHandle, delegate_noop, }; use tempfile; @@ -127,65 +127,11 @@ fn receive_event( Ok(()) } -impl Dispatch for App { - fn event( - _: &mut Self, - _: &VpManager, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - -impl Dispatch for App { - fn event( - _: &mut Self, - _: &Vp, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - -impl Dispatch for App { - fn event( - _: &mut Self, - _: &VkManager, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - -impl Dispatch for App { - fn event( - _: &mut Self, - _: &Vk, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - -impl Dispatch for App { - fn event( - _: &mut Self, - _: &wl_seat::WlSeat, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} +delegate_noop!(App: Vp); +delegate_noop!(App: Vk); +delegate_noop!(App: VpManager); +delegate_noop!(App: VkManager); +delegate_noop!(App: wl_seat::WlSeat); impl Dispatch for App { fn event( diff --git a/src/bin/server.rs b/src/bin/server.rs index 505011c..a932072 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -25,6 +25,7 @@ use wayland_protocols::wp::{ use wayland_protocols_wlr::layer_shell::v1::client::{zwlr_layer_shell_v1::{ZwlrLayerShellV1, Layer}, zwlr_layer_surface_v1::{self, ZwlrLayerSurfaceV1, Anchor, KeyboardInteractivity}}; use wayland_client::{ + delegate_noop, globals::{registry_queue_init, GlobalListContents}, protocol::{ wl_buffer, wl_compositor, wl_keyboard, wl_pointer, wl_region, wl_registry, wl_seat, wl_shm, @@ -225,66 +226,6 @@ impl App { } } -impl Dispatch for App { - fn event( - _: &mut Self, - _: &wl_compositor::WlCompositor, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - -impl Dispatch for App { - fn event( - _: &mut Self, - _: &wl_surface::WlSurface, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - -impl Dispatch for App { - fn event( - _: &mut Self, - _: &wl_shm::WlShm, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - -impl Dispatch for App { - fn event( - _: &mut Self, - _: &wl_shm_pool::WlShmPool, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - todo!() - } -} - -impl Dispatch for App { - fn event( - _: &mut Self, - _: &wl_buffer::WlBuffer, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} impl Dispatch for App { fn event( @@ -388,42 +329,6 @@ impl Dispatch for App { } } -impl Dispatch for App { - fn event( - _: &mut Self, - _: &ZwpPointerConstraintsV1, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - -impl Dispatch for App { - fn event( - _: &mut Self, - _: &ZwpLockedPointerV1, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - -impl Dispatch for App { - fn event( - _: &mut Self, - _: &ZwpRelativePointerManagerV1, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - impl Dispatch for App { fn event( app: &mut Self, @@ -452,18 +357,6 @@ impl Dispatch for App { } } -impl Dispatch for App { - fn event( - _: &mut Self, - _: &ZwlrLayerShellV1, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - impl Dispatch for App { fn event( app: &mut Self, @@ -483,42 +376,6 @@ impl Dispatch for App { } } -impl Dispatch for App { - fn event( - _: &mut Self, - _: &wl_region::WlRegion, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - -impl Dispatch for App { - fn event( - _: &mut Self, - _: &ZwpKeyboardShortcutsInhibitManagerV1, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - -impl Dispatch for App { - fn event( - _: &mut Self, - _: &ZwpKeyboardShortcutsInhibitorV1, - _: ::Event, - _: &(), - _: &Connection, - _: &QueueHandle, - ) { - } -} - impl Dispatch for App { fn event( _: &mut App, @@ -530,3 +387,19 @@ impl Dispatch for App { ) { } } + +// don't emit any events +delegate_noop!(App: wl_region::WlRegion); +delegate_noop!(App: wl_shm_pool::WlShmPool); +delegate_noop!(App: wl_compositor::WlCompositor); +delegate_noop!(App: ZwlrLayerShellV1); +delegate_noop!(App: ZwpRelativePointerManagerV1); +delegate_noop!(App: ZwpKeyboardShortcutsInhibitManagerV1); +delegate_noop!(App: ZwpPointerConstraintsV1); + +// ignore events +delegate_noop!(App: ignore wl_shm::WlShm); +delegate_noop!(App: ignore wl_buffer::WlBuffer); +delegate_noop!(App: ignore wl_surface::WlSurface); +delegate_noop!(App: ignore ZwpKeyboardShortcutsInhibitorV1); +delegate_noop!(App: ignore ZwpLockedPointerV1);