Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroy layer shell surfaces instead of layer shell for freeze-feat #115

Conversation

CheerfulPianissimo
Copy link

Attempts to solve the freeze feature crashing sporadically as described in #109 (comment)
#109 (comment) :

Alright, I have a patch that solves this. The existing code destroys the layer_shell object instead of the layer_surface objects, destroying only layer_surface objects seems to solve the issue but destroying both in that order doesn't. It isn't clear to me why this is the case but I'll create a PR for you to test.

@Gigas002 can you test this fix?

@Gigas002
Copy link

While it doesn't throw error anymore, the wayshot process hangs until manually killed, and the screenshot itself isn't copied into clipboard. Log:

╰─ ./wayshot --clipboard -s "d" --log-level "trace"
2024-04-13T02:49:46.293407Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 1, interface: "wl_shm", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293466Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 2, interface: "wl_drm", version: 2 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293513Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 3, interface: "zwp_linux_dmabuf_v1", version: 4 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293547Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 4, interface: "wl_compositor", version: 6 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293571Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 5, interface: "wl_subcompositor", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293593Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 6, interface: "wl_data_device_manager", version: 3 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293614Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 7, interface: "zwlr_export_dmabuf_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293641Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 8, interface: "zwlr_data_control_manager_v1", version: 2 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293669Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 9, interface: "zwp_primary_selection_device_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293693Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 10, interface: "wp_viewporter", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293713Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 11, interface: "zwlr_gamma_control_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293742Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 12, interface: "zwlr_output_power_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293783Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 13, interface: "xdg_wm_base", version: 6 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293828Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 14, interface: "wl_seat", version: 9 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293849Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 15, interface: "wp_presentation", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293869Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 16, interface: "ext_idle_notifier_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293893Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 17, interface: "zwlr_layer_shell_v1", version: 4 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293925Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 18, interface: "org_kde_kwin_server_decoration_manager", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293948Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 19, interface: "zxdg_decoration_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293967Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 20, interface: "zwlr_output_manager_v1", version: 4 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.293995Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 21, interface: "zwp_keyboard_shortcuts_inhibit_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294014Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 22, interface: "zwp_pointer_constraints_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294035Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 23, interface: "zwp_relative_pointer_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294056Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 24, interface: "zwp_virtual_keyboard_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294076Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 25, interface: "zwlr_virtual_pointer_manager_v1", version: 2 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294097Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 26, interface: "zwlr_foreign_toplevel_manager_v1", version: 3 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294117Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 27, interface: "wp_drm_lease_device_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294138Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 28, interface: "wp_drm_lease_device_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294158Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 29, interface: "zwp_tablet_manager_v2", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294178Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 30, interface: "zwp_idle_inhibit_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294199Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 31, interface: "zxdg_exporter_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294219Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 32, interface: "zxdg_importer_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294240Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 33, interface: "zxdg_exporter_v2", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294262Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 34, interface: "zxdg_importer_v2", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294282Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 35, interface: "zwp_pointer_gestures_v1", version: 3 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294303Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 36, interface: "zwp_text_input_manager_v3", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294324Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 37, interface: "zwp_input_method_manager_v2", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294343Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 38, interface: "xdg_activation_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294364Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 39, interface: "ext_session_lock_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294384Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 40, interface: "wp_cursor_shape_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294405Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 41, interface: "wp_tearing_control_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294425Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 42, interface: "wp_single_pixel_buffer_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294445Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 43, interface: "xwayland_shell_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294466Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 44, interface: "hyprland_toplevel_export_manager_v1", version: 2 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294486Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 45, interface: "wp_fractional_scale_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294507Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 46, interface: "zwp_text_input_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294527Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 47, interface: "hyprland_global_shortcuts_manager_v1", version: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294548Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 48, interface: "zwlr_screencopy_manager_v1", version: 3 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294567Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 49, interface: "zxdg_output_manager_v1", version: 3 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294601Z TRACE event{state=OutputCaptureState { outputs: [] } event=Global { name: 50, interface: "wl_output", version: 4 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294772Z TRACE event{state=OutputCaptureState { outputs: [OutputInfo { wl_output: WlOutput { id: ObjectId(wl_output@5, 6), version: 4, data: Some(ObjectData { .. }), backend: WeakBackend { inner: WeakInnerBackend { state: (Weak) } } }, name: "", description: "", transform: Normal, physical_size: Size { width: 0, height: 0 }, logical_region: LogicalRegion { inner: Region { position: Position { x: 0, y: 0 }, size: Size { width: 0, height: 0 } } } }] } event=Geometry { x: 0, y: 0, physical_width: 340, physical_height: 190, subpixel: Value(Unknown), make: "Chimei Innolux Corporation", model: "0x1521", transform: Value(Normal) }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294811Z TRACE event{state=OutputCaptureState { outputs: [OutputInfo { wl_output: WlOutput { id: ObjectId(wl_output@5, 6), version: 4, data: Some(ObjectData { .. }), backend: WeakBackend { inner: WeakInnerBackend { state: (Weak) } } }, name: "", description: "", transform: Normal, physical_size: Size { width: 0, height: 0 }, logical_region: LogicalRegion { inner: Region { position: Position { x: 0, y: 0 }, size: Size { width: 0, height: 0 } } } }] } event=Mode { flags: Value(Mode(Current)), width: 1920, height: 1080, refresh: 144003 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294836Z TRACE event{state=OutputCaptureState { outputs: [OutputInfo { wl_output: WlOutput { id: ObjectId(wl_output@5, 6), version: 4, data: Some(ObjectData { .. }), backend: WeakBackend { inner: WeakInnerBackend { state: (Weak) } } }, name: "", description: "", transform: Normal, physical_size: Size { width: 1920, height: 1080 }, logical_region: LogicalRegion { inner: Region { position: Position { x: 0, y: 0 }, size: Size { width: 0, height: 0 } } } }] } event=Scale { factor: 1 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294861Z TRACE event{state=OutputCaptureState { outputs: [OutputInfo { wl_output: WlOutput { id: ObjectId(wl_output@5, 6), version: 4, data: Some(ObjectData { .. }), backend: WeakBackend { inner: WeakInnerBackend { state: (Weak) } } }, name: "", description: "", transform: Normal, physical_size: Size { width: 1920, height: 1080 }, logical_region: LogicalRegion { inner: Region { position: Position { x: 0, y: 0 }, size: Size { width: 0, height: 0 } } } }] } event=Name { name: "eDP-1" }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294890Z TRACE event{state=OutputCaptureState { outputs: [OutputInfo { wl_output: WlOutput { id: ObjectId(wl_output@5, 6), version: 4, data: Some(ObjectData { .. }), backend: WeakBackend { inner: WeakInnerBackend { state: (Weak) } } }, name: "eDP-1", description: "", transform: Normal, physical_size: Size { width: 1920, height: 1080 }, logical_region: LogicalRegion { inner: Region { position: Position { x: 0, y: 0 }, size: Size { width: 0, height: 0 } } } }] } event=Description { description: "Chimei Innolux Corporation 0x1521 (eDP-1)" }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294915Z TRACE event{state=OutputCaptureState { outputs: [OutputInfo { wl_output: WlOutput { id: ObjectId(wl_output@5, 6), version: 4, data: Some(ObjectData { .. }), backend: WeakBackend { inner: WeakInnerBackend { state: (Weak) } } }, name: "eDP-1", description: "Chimei Innolux Corporation 0x1521 (eDP-1)", transform: Normal, physical_size: Size { width: 1920, height: 1080 }, logical_region: LogicalRegion { inner: Region { position: Position { x: 0, y: 0 }, size: Size { width: 0, height: 0 } } } }] } event=Done}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294944Z TRACE event{state=OutputCaptureState { outputs: [OutputInfo { wl_output: WlOutput { id: ObjectId(wl_output@5, 6), version: 4, data: Some(ObjectData { .. }), backend: WeakBackend { inner: WeakInnerBackend { state: (Weak) } } }, name: "eDP-1", description: "Chimei Innolux Corporation 0x1521 (eDP-1)", transform: Normal, physical_size: Size { width: 1920, height: 1080 }, logical_region: LogicalRegion { inner: Region { position: Position { x: 0, y: 0 }, size: Size { width: 0, height: 0 } } } }] } event=Name { name: "eDP-1" } index=0}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294971Z TRACE event{state=OutputCaptureState { outputs: [OutputInfo { wl_output: WlOutput { id: ObjectId(wl_output@5, 6), version: 4, data: Some(ObjectData { .. }), backend: WeakBackend { inner: WeakInnerBackend { state: (Weak) } } }, name: "eDP-1", description: "Chimei Innolux Corporation 0x1521 (eDP-1)", transform: Normal, physical_size: Size { width: 1920, height: 1080 }, logical_region: LogicalRegion { inner: Region { position: Position { x: 0, y: 0 }, size: Size { width: 0, height: 0 } } } }] } event=Description { description: "Chimei Innolux Corporation 0x1521 (eDP-1)" } index=0}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.294999Z TRACE event{state=OutputCaptureState { outputs: [OutputInfo { wl_output: WlOutput { id: ObjectId(wl_output@5, 6), version: 4, data: Some(ObjectData { .. }), backend: WeakBackend { inner: WeakInnerBackend { state: (Weak) } } }, name: "eDP-1", description: "Chimei Innolux Corporation 0x1521 (eDP-1)", transform: Normal, physical_size: Size { width: 1920, height: 1080 }, logical_region: LogicalRegion { inner: Region { position: Position { x: 0, y: 0 }, size: Size { width: 0, height: 0 } } } }] } event=LogicalPosition { x: 0, y: 0 } index=0}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.295025Z TRACE event{state=OutputCaptureState { outputs: [OutputInfo { wl_output: WlOutput { id: ObjectId(wl_output@5, 6), version: 4, data: Some(ObjectData { .. }), backend: WeakBackend { inner: WeakInnerBackend { state: (Weak) } } }, name: "eDP-1", description: "Chimei Innolux Corporation 0x1521 (eDP-1)", transform: Normal, physical_size: Size { width: 1920, height: 1080 }, logical_region: LogicalRegion { inner: Region { position: Position { x: 0, y: 0 }, size: Size { width: 0, height: 0 } } } }] } event=LogicalSize { width: 1920, height: 1080 } index=0}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.295050Z TRACE event{state=OutputCaptureState { outputs: [OutputInfo { wl_output: WlOutput { id: ObjectId(wl_output@5, 6), version: 4, data: Some(ObjectData { .. }), backend: WeakBackend { inner: WeakInnerBackend { state: (Weak) } } }, name: "eDP-1", description: "Chimei Innolux Corporation 0x1521 (eDP-1)", transform: Normal, physical_size: Size { width: 1920, height: 1080 }, logical_region: LogicalRegion { inner: Region { position: Position { x: 0, y: 0 }, size: Size { width: 1920, height: 1080 } } } }] } event=Done}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.295074Z TRACE libwayshot: Outputs detected: [
    OutputInfo {
        wl_output: WlOutput {
            id: ObjectId(wl_output@5, 6),
            version: 4,
            data: Some(
                ObjectData { .. },
            ),
            backend: WeakBackend {
                inner: WeakInnerBackend {
                    state: (Weak),
                },
            },
        },
        name: "eDP-1",
        description: "Chimei Innolux Corporation 0x1521 (eDP-1)",
        transform: Normal,
        physical_size: Size {
            width: 1920,
            height: 1080,
        },
        logical_region: LogicalRegion {
            inner: Region {
                position: Position {
                    x: 0,
                    y: 0,
                },
                size: Size {
                    width: 1920,
                    height: 1080,
                },
            },
        },
    },
]
2024-04-13T02:49:46.295300Z DEBUG capture_frame_copy{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))" region="fullscreen"}: libwayshot: Capturing output...
2024-04-13T02:49:46.295433Z TRACE capture_frame_copy{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))" region="fullscreen"}:event{event=Buffer { format: Value(Xrgb8888), width: 1920, height: 1080, stride: 7680 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.295478Z TRACE capture_frame_copy{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))" region="fullscreen"}:event{event=LinuxDmabuf { format: 875713112, width: 1920, height: 1080 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.295503Z TRACE capture_frame_copy{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))" region="fullscreen"}:event{event=BufferDone}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.295519Z TRACE capture_frame_copy{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))" region="fullscreen"}: libwayshot: Received compositor frame buffer formats: [
    FrameFormat {
        format: Xrgb8888,
        size: Size {
            width: 1920,
            height: 1080,
        },
        stride: 7680,
    },
]
2024-04-13T02:49:46.295534Z TRACE capture_frame_copy{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))" region="fullscreen"}: libwayshot: Selected frame buffer format: Some(
    FrameFormat {
        format: Xrgb8888,
        size: Size {
            width: 1920,
            height: 1080,
        },
        stride: 7680,
    },
)
2024-04-13T02:49:46.315739Z TRACE capture_frame_copy{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))" region="fullscreen"}:event{event=Flags { flags: Value(Flags(0x0)) }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.315803Z TRACE capture_frame_copy{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))" region="fullscreen"}:event{event=Ready { tv_sec_hi: 0, tv_sec_lo: 270, tv_nsec: 663506970 }}: libwayshot::dispatch: return=()
2024-04-13T02:49:46.355178Z DEBUG capture_frame_copy{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))" region="fullscreen"}: libwayshot: Created frame copy: FrameCopy {
    frame_format: FrameFormat {
        format: Xrgb8888,
        size: Size {
            width: 1920,
            height: 1080,
        },
        stride: 7680,
    },
    frame_color_type: Rgba8,
    frame_mmap: MmapMut {
        ptr: 0x00007ad74d617000,
        len: 8294400,
    },
    transform: Normal,
    logical_region: LogicalRegion {
        inner: Region {
            position: Position {
                x: 0,
                y: 0,
            },
            size: Size {
                width: 1920,
                height: 1080,
            },
        },
    },
    physical_size: Size {
        width: 1920,
        height: 1080,
    },
}
2024-04-13T02:49:46.355524Z DEBUG screenshot_region_capturer:overlay_frames::surface{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))"}: libwayshot: Committing surface creation changes.
2024-04-13T02:49:46.355556Z DEBUG screenshot_region_capturer:overlay_frames::surface{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))"}: libwayshot: Waiting for layer surface to be configured.
2024-04-13T02:49:46.355690Z DEBUG screenshot_region_capturer:overlay_frames::surface{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))"}: libwayshot::dispatch: Acking configure
2024-04-13T02:49:46.355729Z TRACE screenshot_region_capturer:overlay_frames::surface{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))"}: libwayshot::dispatch: Acked configure
2024-04-13T02:49:46.355762Z DEBUG screenshot_region_capturer:overlay_frames::surface{output="eDP-1 (Chimei Innolux Corporation 0x1521 (eDP-1))"}: libwayshot: Committing surface with attached buffer.
2024-04-13T02:49:52.301942Z DEBUG screenshot_region_capturer: libwayshot: Destroying layer shell surfaces.

@CheerfulPianissimo
Copy link
Author

Reading the protocol, it seems that unmapping the layer shell surface by committing a null buffer to it is necessary before destruction. Have tested this on sway, river and Hyprland. Can you test this too @Gigas002 ?

@Gigas002
Copy link

Works great now 👍

@CheerfulPianissimo CheerfulPianissimo marked this pull request as ready for review April 13, 2024 06:52
@Shinyzenith
Copy link
Member

@CheerfulPianissimo Would you like me to review and merge this PR?

@@ -452,6 +452,8 @@ impl WayshotConnection {
}
};

let mut layer_shell_surfaces = Vec::new();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We know the wl_output count right? Can we just make a static array to reduce allocations?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be possible, I'll look into it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, no, we don't know the wl_output count at compile time so I can't see how we could use a simple static array. What we can do is use Vec::with_capacity to init the vec with the number of output frames, is this what you meant?

@CheerfulPianissimo
Copy link
Author

Yes, freeze feat with clipboard is unusable on some compositors without this. Up to you if you want it merge it as it is or want to wait fot the static allocation change @Shinyzenith .

@Shinyzenith
Copy link
Member

What do you mean by static allocation change? Do you have any pr/issue/code sample i can look at?

@CheerfulPianissimo
Copy link
Author

This chnage you requested @Shinyzenith #115 (comment)

@Shinyzenith
Copy link
Member

Ah my apologies, I am forgetful. Would be ideal to get it done first. Thank you for your help sooraj, much appreciated.

debug!("Unmapping and destroying layer shell surfaces.");
for (surface, layer_shell_surface) in layer_shell_surfaces.iter() {
surface.attach(None, 0, 0);
surface.commit(); //unmap surface by committing a null buffer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I am approving and merging the PR for now but I am unsure if this is correct

@Shinyzenith Shinyzenith merged commit 2dd8af6 into waycrate:freeze-feat-andreas May 28, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants