diff options
Diffstat (limited to 'src/protocols/ToplevelExport.cpp')
-rw-r--r-- | src/protocols/ToplevelExport.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp index 98afb154..4d7f881a 100644 --- a/src/protocols/ToplevelExport.cpp +++ b/src/protocols/ToplevelExport.cpp @@ -74,8 +74,8 @@ static const struct hyprland_toplevel_export_manager_v1_interface toplevelExport static const struct hyprland_toplevel_export_frame_v1_interface toplevelFrameImpl = {.copy = handleCopyFrame, .destroy = handleDestroyFrame}; SToplevelClient* clientFromResource(wl_resource* resource) { - ASSERT(wl_resource_instance_of(resource, &hyprland_toplevel_export_manager_v1_interface, &toplevelExportManagerImpl)); - return (SToplevelClient*)wl_resource_get_user_data(resource); + ASSERT(wl_resource_instance_of(resource, &hyprland_toplevel_export_manager_v1_interface, &toplevelExportManagerImpl)); + return (SToplevelClient*)wl_resource_get_user_data(resource); } SToplevelFrame* frameFromResource(wl_resource* resource) { @@ -347,6 +347,13 @@ bool CToplevelExportProtocolManager::copyFrameShm(SToplevelFrame* frame, timespe pixman_region32_t fakeDamage; pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecPixelSize.x * 10, PMONITOR->vecPixelSize.y * 10); + if (!wlr_output_attach_render(PMONITOR->output, nullptr)) { + Debug::log(ERR, "[toplevel_export] Couldn't attach render"); + pixman_region32_fini(&fakeDamage); + wlr_buffer_end_data_ptr_access(frame->buffer); + return false; + } + g_pHyprOpenGL->begin(PMONITOR, &fakeDamage, true); g_pHyprOpenGL->clear(CColor(0, 0, 0, 1.0)); @@ -358,7 +365,7 @@ bool CToplevelExportProtocolManager::copyFrameShm(SToplevelFrame* frame, timespe // copy pixels const auto PFORMAT = get_gles2_format_from_drm(format); if (!PFORMAT) { - Debug::log(ERR, "Cannot read pixels, unsupported format %x", PFORMAT); + Debug::log(ERR, "[toplevel_export] Cannot read pixels, unsupported format %x", PFORMAT); g_pHyprOpenGL->end(); pixman_region32_fini(&fakeDamage); wlr_buffer_end_data_ptr_access(frame->buffer); @@ -373,6 +380,8 @@ bool CToplevelExportProtocolManager::copyFrameShm(SToplevelFrame* frame, timespe g_pHyprOpenGL->end(); + wlr_output_rollback(PMONITOR->output); + pixman_region32_fini(&fakeDamage); wlr_buffer_end_data_ptr_access(frame->buffer); @@ -391,4 +400,4 @@ void CToplevelExportProtocolManager::onWindowUnmap(CWindow* pWindow) { if (f.pWindow == pWindow) f.pWindow = nullptr; } -}
\ No newline at end of file +} |