~whynothugo/shotman

1f70987cdf3bd118a22979a786e961ae49b1d6ab — Hugo Osvaldo Barrera 1 year, 9 months ago 38b2005
Use my upstreamed delegate_noop
1 files changed, 11 insertions(+), 29 deletions(-)

M src/main.rs
M src/main.rs => src/main.rs +11 -29
@@ 13,6 13,7 @@ use clap::{Parser, ValueEnum};
use log::{debug, error, info, warn};
use rustix::fs::{fcntl_getfl, fcntl_setfl, OFlags};
use smithay_client_toolkit::output::{OutputHandler, OutputState};
use wayland_client::delegate_noop;
use smithay_client_toolkit::registry::{ProvidesRegistryState, RegistryHandler, RegistryState};
use smithay_client_toolkit::seat::keyboard::{keysyms, KeyboardData, KeyboardHandler};
use smithay_client_toolkit::{


@@ 538,24 539,6 @@ impl State {
    }
}

/// Ignore all events for a given wayland interface.
macro_rules! dispatch_noop {
    ($dispatch_from: ty: [ $($interface: ty),* $(,)?]) => {
        $(
            impl wayland_client::Dispatch<$interface, ()> for $dispatch_from {
                fn event(
                    _: &mut Self,
                    _: &$interface,
                    _: <$interface as wayland_client::Proxy>::Event,
                    _: &(),
                    _: &$crate::Connection,
                    _: &$crate::QueueHandle<Self>,
                ) {}
            }
        )*
    };
}

impl RegistryHandler<State> for State {
    fn ready(state: &mut State, _: &Connection, qh: &QueueHandle<State>) {
        state.wl_data_device_manager = state


@@ 646,19 629,18 @@ impl ProvidesRegistryState for State {
}

// These interfaces have no events, so there's nothing to handle.
dispatch_noop!(State: [
    wl_compositor::WlCompositor, ZwlrScreencopyManagerV1,
    wl_subcompositor::WlSubcompositor,
    wl_subsurface::WlSubsurface,
    wp_viewporter::WpViewporter,
    wp_viewport::WpViewport,
    wl_shm_pool::WlShmPool,
    wl_data_device_manager::WlDataDeviceManager,
    zwlr_layer_shell_v1::ZwlrLayerShellV1,
]);
delegate_noop!(State: wl_compositor::WlCompositor);
delegate_noop!(State: ZwlrScreencopyManagerV1);
delegate_noop!(State: wl_subcompositor::WlSubcompositor);
delegate_noop!(State: wl_subsurface::WlSubsurface);
delegate_noop!(State: wp_viewporter::WpViewporter);
delegate_noop!(State: wp_viewport::WpViewport);
delegate_noop!(State: wl_shm_pool::WlShmPool);
delegate_noop!(State: wl_data_device_manager::WlDataDeviceManager);
delegate_noop!(State: zwlr_layer_shell_v1::ZwlrLayerShellV1);

// Don't care about other clients offering selections, nor things being dragged.
dispatch_noop!(State: [wl_data_offer::WlDataOffer]);
delegate_noop!(State: ignore wl_data_offer::WlDataOffer);

impl Dispatch<wl_surface::WlSurface, ()> for State {
    fn event(