mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 22:45:59 +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
|
@ -10,3 +10,14 @@ enum eIcons
|
||||||
ICON_OK,
|
ICON_OK,
|
||||||
ICON_NONE
|
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) {
|
void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time) {
|
||||||
CWindow* pWorkspaceWindow = nullptr;
|
CWindow* pWorkspaceWindow = nullptr;
|
||||||
|
|
||||||
|
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
|
||||||
|
|
||||||
// loop over the tiled windows that are fading out
|
// loop over the tiled windows that are fading out
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_iWorkspaceID != pMonitor->activeWorkspace)
|
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);
|
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMIT_HOOK_EVENT("render", RENDER_POST_WINDOWS);
|
||||||
|
|
||||||
// and the overlay layers
|
// and the overlay layers
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||||
if (ls->alpha.fl() != 0.f)
|
if (ls->alpha.fl() != 0.f)
|
||||||
|
@ -457,6 +461,8 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace*
|
||||||
|
|
||||||
CWindow* lastWindow = nullptr;
|
CWindow* lastWindow = nullptr;
|
||||||
|
|
||||||
|
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
|
||||||
|
|
||||||
// Non-floating main
|
// Non-floating main
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
|
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);
|
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMIT_HOOK_EVENT("render", RENDER_POST_WINDOWS);
|
||||||
|
|
||||||
// Render surfaces above windows for monitor
|
// Render surfaces above windows for monitor
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||||
renderLayer(ls.get(), pMonitor, time);
|
renderLayer(ls.get(), pMonitor, time);
|
||||||
|
@ -842,6 +850,8 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMIT_HOOK_EVENT("render", RENDER_PRE);
|
||||||
|
|
||||||
const bool UNLOCK_SC = g_pHyprRenderer->m_bSoftwareCursorsLocked;
|
const bool UNLOCK_SC = g_pHyprRenderer->m_bSoftwareCursorsLocked;
|
||||||
if (UNLOCK_SC)
|
if (UNLOCK_SC)
|
||||||
wlr_output_lock_software_cursors(pMonitor->output, true);
|
wlr_output_lock_software_cursors(pMonitor->output, true);
|
||||||
|
@ -902,8 +912,11 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
||||||
|
|
||||||
g_pHyprOpenGL->begin(pMonitor, &damage);
|
g_pHyprOpenGL->begin(pMonitor, &damage);
|
||||||
|
|
||||||
|
EMIT_HOOK_EVENT("render", RENDER_BEGIN);
|
||||||
|
|
||||||
if (pMonitor->isMirror()) {
|
if (pMonitor->isMirror()) {
|
||||||
g_pHyprOpenGL->renderMirrored();
|
g_pHyprOpenGL->renderMirrored();
|
||||||
|
EMIT_HOOK_EVENT("render", RENDER_POST_MIRROR);
|
||||||
} else {
|
} else {
|
||||||
g_pHyprOpenGL->clear(CColor(17.0 / 255.0, 17.0 / 255.0, 17.0 / 255.0, 1.0));
|
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"
|
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);
|
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = std::clamp(*PZOOMFACTOR, 1.f, INFINITY);
|
||||||
else
|
else
|
||||||
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = 1.f;
|
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = 1.f;
|
||||||
|
|
||||||
|
EMIT_HOOK_EVENT("render", RENDER_LAST_MOMENT);
|
||||||
|
|
||||||
g_pHyprOpenGL->end();
|
g_pHyprOpenGL->end();
|
||||||
|
|
||||||
// calc frame damage
|
// calc frame damage
|
||||||
|
@ -974,6 +990,8 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
||||||
|
|
||||||
pMonitor->renderingActive = false;
|
pMonitor->renderingActive = false;
|
||||||
|
|
||||||
|
EMIT_HOOK_EVENT("render", RENDER_POST);
|
||||||
|
|
||||||
wlr_damage_ring_rotate(&pMonitor->damage);
|
wlr_damage_ring_rotate(&pMonitor->damage);
|
||||||
|
|
||||||
if (!wlr_output_commit(pMonitor->output)) {
|
if (!wlr_output_commit(pMonitor->output)) {
|
||||||
|
|
Loading…
Reference in a new issue