@@ -91,13 +91,22 @@ CScrollOverview::CScrollOverview(PHLWORKSPACE startedOn_, bool swipe_) : started
9191 moveViewportWorkspace (e.delta > 0 );
9292 };
9393
94+ auto onWindowOpen = [this ](void * self, SCallbackInfo& info, std::any param) {
95+ if (closing)
96+ return ;
97+
98+ redrawAll ();
99+ };
100+
94101 mouseMoveHook = g_pHookSystem->hookDynamic (" mouseMove" , onCursorMove);
95102 touchMoveHook = g_pHookSystem->hookDynamic (" touchMove" , onCursorMove);
96103 mouseAxisHook = g_pHookSystem->hookDynamic (" mouseAxis" , onMouseAxis);
97104
98105 mouseButtonHook = g_pHookSystem->hookDynamic (" mouseButton" , onCursorSelect);
99106 touchDownHook = g_pHookSystem->hookDynamic (" touchDown" , onCursorSelect);
100107
108+ windowOpenHook = g_pHookSystem->hookDynamic (" openWindow" , onWindowOpen);
109+
101110 g_pInputManager->setCursorImageUntilUnset (" left_ptr" );
102111
103112 redrawAll ();
@@ -275,6 +284,9 @@ void CScrollOverview::redrawWindowImage(SP<SWindowImage> img) {
275284
276285 g_pHyprOpenGL->m_renderData .blockScreenShader = true ;
277286 g_pHyprRenderer->endRender ();
287+
288+ img->lastWindowPosition = img->pWindow ->m_realPosition ->value ();
289+ img->lastWindowSize = img->pWindow ->m_realSize ->value ();
278290}
279291
280292void CScrollOverview::redrawAll (bool forcelowres) {
@@ -391,6 +403,23 @@ void CScrollOverview::onWorkspaceChange() {
391403}
392404
393405void CScrollOverview::render () {
406+ bool needsDamage = false ;
407+ for (const auto & img : images) {
408+ for (const auto & i : img->windowImages ) {
409+ if (!i->pWindow )
410+ continue ;
411+
412+ if (i->lastWindowSize != i->pWindow ->m_realSize ->value () || i->lastWindowPosition != i->pWindow ->m_realPosition ->value ()) {
413+ needsDamage = true ;
414+ i->lastWindowPosition = i->pWindow ->m_realPosition ->value ();
415+ i->lastWindowSize = i->pWindow ->m_realSize ->value ();
416+ }
417+ }
418+ }
419+
420+ if (needsDamage)
421+ damage ();
422+
394423 g_pHyprRenderer->m_renderPass .add (makeUnique<COverviewPassElement>());
395424}
396425
@@ -417,7 +446,14 @@ void CScrollOverview::fullRender() {
417446 // render all views
418447 float yoff = -(float )activeIdx * pMonitor->m_size .y * scale->value ();
419448 for (const auto & wimg : images) {
449+ bool dirty = false ;
450+
420451 for (const auto & img : wimg->windowImages ) {
452+ if (!img->pWindow ) {
453+ dirty = true ;
454+ continue ;
455+ }
456+
421457 CBox texbox = CBox{img->pWindow ->m_realPosition ->value () - pMonitor->m_position , pMonitor->m_size };
422458
423459 // scale the box to the viewport center
@@ -427,7 +463,7 @@ void CScrollOverview::fullRender() {
427463
428464 texbox.scale (pMonitor->m_scale ).round ();
429465 CRegion damage{0 , 0 , INT16_MAX, INT16_MAX};
430- g_pHyprOpenGL->renderTextureInternal (img->fb .getTexture (), texbox, {.damage = &damage, .a = 1.0 });
466+ g_pHyprOpenGL->renderTextureInternal (img->fb .getTexture (), texbox, {.damage = &damage, .a = 1.0 * img-> pWindow -> m_alpha -> value () });
431467
432468 if (img->highlight ) {
433469 CBox texbox2 = CBox{img->pWindow ->m_realPosition ->value (), img->pWindow ->m_realSize ->value ()}
@@ -445,6 +481,9 @@ void CScrollOverview::fullRender() {
445481 g_pHyprOpenGL->renderTextureInternal (floatingFb.getTexture (), floatbox, {.damage = &damage, .a = 1.0 });
446482
447483 yoff += pMonitor->m_size .y * scale->value ();
484+
485+ if (dirty)
486+ std::erase_if (wimg->windowImages , [](const auto & e) { return !e->pWindow ; });
448487 }
449488}
450489
0 commit comments