mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 21:25:58 +01:00
events: add render event for plugins
This commit is contained in:
parent
412d46ff65
commit
385fe4e301
2 changed files with 29 additions and 0 deletions
|
@ -9,4 +9,15 @@ enum eIcons
|
|||
ICON_CONFUSED,
|
||||
ICON_OK,
|
||||
ICON_NONE
|
||||
};
|
||||
|
||||
enum eRenderStage
|
||||
{
|
||||
RENDER_PRE = 0, /* Before binding the gl context */
|
||||
RENDER_BEGIN, /* Just when the rendering begins, nothing has been rendered yet. Damage, current render data in opengl valid. */
|
||||
RENDER_PRE_WINDOWS, /* Pre windows, post bottom and overlay layers */
|
||||
RENDER_POST_WINDOWS, /* Post windows, pre top/overlay layers, etc */
|
||||
RENDER_LAST_MOMENT, /* Last moment to render with the gl context */
|
||||
RENDER_POST, /* After rendering is finished, gl context not available anymore */
|
||||
RENDER_POST_MIRROR, /* After rendering a mirror */
|
||||
};
|
|
@ -124,6 +124,8 @@ bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow) {
|
|||
void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time) {
|
||||
CWindow* pWorkspaceWindow = nullptr;
|
||||
|
||||
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
|
||||
|
||||
// loop over the tiled windows that are fading out
|
||||
for (auto& w : g_pCompositor->m_vWindows) {
|
||||
if (w->m_iWorkspaceID != pMonitor->activeWorkspace)
|
||||
|
@ -201,6 +203,8 @@ void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWor
|
|||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
||||
}
|
||||
|
||||
EMIT_HOOK_EVENT("render", RENDER_POST_WINDOWS);
|
||||
|
||||
// and the overlay layers
|
||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||
if (ls->alpha.fl() != 0.f)
|
||||
|
@ -457,6 +461,8 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace*
|
|||
|
||||
CWindow* lastWindow = nullptr;
|
||||
|
||||
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
|
||||
|
||||
// Non-floating main
|
||||
for (auto& w : g_pCompositor->m_vWindows) {
|
||||
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
|
||||
|
@ -570,6 +576,8 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace*
|
|||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
||||
}
|
||||
|
||||
EMIT_HOOK_EVENT("render", RENDER_POST_WINDOWS);
|
||||
|
||||
// Render surfaces above windows for monitor
|
||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||
renderLayer(ls.get(), pMonitor, time);
|
||||
|
@ -842,6 +850,8 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
|||
return;
|
||||
}
|
||||
|
||||
EMIT_HOOK_EVENT("render", RENDER_PRE);
|
||||
|
||||
const bool UNLOCK_SC = g_pHyprRenderer->m_bSoftwareCursorsLocked;
|
||||
if (UNLOCK_SC)
|
||||
wlr_output_lock_software_cursors(pMonitor->output, true);
|
||||
|
@ -902,8 +912,11 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
|||
|
||||
g_pHyprOpenGL->begin(pMonitor, &damage);
|
||||
|
||||
EMIT_HOOK_EVENT("render", RENDER_BEGIN);
|
||||
|
||||
if (pMonitor->isMirror()) {
|
||||
g_pHyprOpenGL->renderMirrored();
|
||||
EMIT_HOOK_EVENT("render", RENDER_POST_MIRROR);
|
||||
} else {
|
||||
g_pHyprOpenGL->clear(CColor(17.0 / 255.0, 17.0 / 255.0, 17.0 / 255.0, 1.0));
|
||||
g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper"
|
||||
|
@ -950,6 +963,9 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
|||
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = std::clamp(*PZOOMFACTOR, 1.f, INFINITY);
|
||||
else
|
||||
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = 1.f;
|
||||
|
||||
EMIT_HOOK_EVENT("render", RENDER_LAST_MOMENT);
|
||||
|
||||
g_pHyprOpenGL->end();
|
||||
|
||||
// calc frame damage
|
||||
|
@ -974,6 +990,8 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
|||
|
||||
pMonitor->renderingActive = false;
|
||||
|
||||
EMIT_HOOK_EVENT("render", RENDER_POST);
|
||||
|
||||
wlr_damage_ring_rotate(&pMonitor->damage);
|
||||
|
||||
if (!wlr_output_commit(pMonitor->output)) {
|
||||
|
|
Loading…
Reference in a new issue