~whynothugo/shotman

49d074708e39d87c22e27f758af29cc2e8b739f2 — Hugo Osvaldo Barrera 3 months ago 942013f
Rename OutputUserData to OutputDetector

This is more obvious
1 files changed, 7 insertions(+), 8 deletions(-)

M src/main.rs
M src/main.rs => src/main.rs +7 -8
@@ 126,8 126,7 @@ enum DesiredTarget {

/// Empty type used to declare handlers for objects related to detecting the
/// currently active output.
#[derive(Default)]
struct DetectorUserData {}
struct OutputDetector;

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


@@ 435,7 434,7 @@ impl State {
        // TODO: bump to v3 for linux_dma_buffer
        let compositor: wl_compositor::WlCompositor = global_list.bind(qh, 4..=4, ())?;

        let detector_surface = compositor.create_surface(qh, DetectorUserData::default());
        let detector_surface = compositor.create_surface(qh, OutputDetector);
        let window_surface = compositor.create_surface(qh, ());
        let shot_surface = compositor.create_surface(qh, ());



@@ 462,7 461,7 @@ impl State {
            zwlr_layer_shell_v1::Layer::Background,
            String::from("shotman"),
            qh,
            DetectorUserData::default(),
            OutputDetector,
        );
        let window_layer_surface = wlr_layer_shell.get_layer_surface(
            &window_surface,


@@ 1027,12 1026,12 @@ impl Dispatch<wp_fractional_scale_v1::WpFractionalScaleV1, ()> for State {
}

/// Simple hack to determine the "currently active output".
impl Dispatch<wl_surface::WlSurface, DetectorUserData> for State {
impl Dispatch<wl_surface::WlSurface, OutputDetector> for State {
    fn event(
        state: &mut Self,
        _: &wl_surface::WlSurface,
        event: wl_surface::Event,
        _: &DetectorUserData,
        _: &OutputDetector,
        _: &Connection,
        qh: &QueueHandle<Self>,
    ) {


@@ 1143,12 1142,12 @@ impl Dispatch<zwlr_layer_surface_v1::ZwlrLayerSurfaceV1, ThumbnailWindow> for St
/// We render a 1x1px invisible layer shell, and detect on which output the surface enters when
/// rendered. The `configure` event should only be received once, at which point we simply commit
/// the 1x1px empty surface.
impl Dispatch<zwlr_layer_surface_v1::ZwlrLayerSurfaceV1, DetectorUserData> for State {
impl Dispatch<zwlr_layer_surface_v1::ZwlrLayerSurfaceV1, OutputDetector> for State {
    fn event(
        state: &mut Self,
        wlr_layer_surface: &zwlr_layer_surface_v1::ZwlrLayerSurfaceV1,
        event: zwlr_layer_surface_v1::Event,
        _: &DetectorUserData,
        _: &OutputDetector,
        _: &Connection,
        _: &QueueHandle<Self>,
    ) {