~whynothugo/shotman

8f58d080dab4fc07cc416d2c2695cdef9bace932 — Hugo Osvaldo Barrera 8 months ago 308e1ee
Use empty type to identify Dispatch impls
1 files changed, 11 insertions(+), 8 deletions(-)

M src/main.rs
M src/main.rs => src/main.rs +11 -8
@@ 87,9 87,10 @@ enum DesiredTarget {
    },
}

/// Empty type used to declare handlers for objects related to detecting the
/// currently active output.
/// Related to types used to detect currently active output.
struct OutputDetector;
/// Related to types associated with the thumbnail window.
struct Window;

fn main() -> anyhow::Result<()> {
    let cli = Cli::parse();


@@ 399,7 400,7 @@ impl State {
        let compositor: wl_compositor::WlCompositor = global_list.bind(qh, 4..=4, ())?;

        let detector_surface = compositor.create_surface(qh, OutputDetector);
        let window_surface = compositor.create_surface(qh, ());
        let window_surface = compositor.create_surface(qh, Window);
        let shot_surface = compositor.create_surface(qh, ());

        match global_list.bind::<wp_fractional_scale_manager_v1::WpFractionalScaleManagerV1, _, _>(


@@ 408,7 409,7 @@ impl State {
            (),
        ) {
            Ok(fractional_scale_manager) => {
                Some(fractional_scale_manager.get_fractional_scale(&window_surface, qh, ()))
                Some(fractional_scale_manager.get_fractional_scale(&window_surface, qh, Window))
            }
            Err(e) => {
                info!("Fractional scale support disabled: {}", e);


@@ 938,13 939,15 @@ delegate_noop!(State: wp_fractional_scale_manager_v1::WpFractionalScaleManagerV1

// Don't care about other clients offering selections, nor things being dragged.
delegate_noop!(State: ignore wl_data_offer::WlDataOffer);
// Only applies to the screenshot surface. Nothing to do.
delegate_noop!(State: ignore wl_surface::WlSurface);

impl Dispatch<wl_surface::WlSurface, ()> for State {
impl Dispatch<wl_surface::WlSurface, Window> for State {
    fn event(
        state: &mut Self,
        _: &wl_surface::WlSurface,
        event: wl_surface::Event,
        _: &(),
        _: &Window,
        _: &Connection,
        _: &QueueHandle<Self>,
    ) {


@@ 974,12 977,12 @@ impl Dispatch<wl_surface::WlSurface, ()> for State {
    }
}

impl Dispatch<wp_fractional_scale_v1::WpFractionalScaleV1, ()> for State {
impl Dispatch<wp_fractional_scale_v1::WpFractionalScaleV1, Window> for State {
    fn event(
        state: &mut Self,
        _: &wp_fractional_scale_v1::WpFractionalScaleV1,
        event: wp_fractional_scale_v1::Event,
        _: &(),
        _: &Window,
        _: &Connection,
        _: &QueueHandle<Self>,
    ) {