decorations: Decoration Positioner (#3800)
This commit is contained in:
parent
7345b1a1ea
commit
9be6fbf5ea
27 changed files with 610 additions and 266 deletions
|
|
@ -248,28 +248,9 @@ void CAnimationManager::tick() {
|
|||
case AVARDAMAGE_SHADOW: {
|
||||
RASSERT(PWINDOW, "Tried to AVARDAMAGE_SHADOW a non-window AVAR!");
|
||||
|
||||
static auto* const PSHADOWIGNOREWINDOW = &g_pConfigManager->getConfigValuePtr("decoration:shadow_ignore_window")->intValue;
|
||||
const auto PDECO = PWINDOW->getDecorationByType(DECORATION_SHADOW);
|
||||
|
||||
const auto PDECO = PWINDOW->getDecorationByType(DECORATION_SHADOW);
|
||||
|
||||
if (PDECO) {
|
||||
const auto EXTENTS = PDECO->getWindowDecorationExtents();
|
||||
|
||||
CBox dmg = {PWINDOW->m_vRealPosition.vec().x - EXTENTS.topLeft.x, PWINDOW->m_vRealPosition.vec().y - EXTENTS.topLeft.y,
|
||||
PWINDOW->m_vRealSize.vec().x + EXTENTS.topLeft.x + EXTENTS.bottomRight.x, PWINDOW->m_vRealSize.vec().y + EXTENTS.topLeft.y + EXTENTS.bottomRight.y};
|
||||
|
||||
if (!*PSHADOWIGNOREWINDOW) {
|
||||
// easy, damage the entire box
|
||||
g_pHyprRenderer->damageBox(&dmg);
|
||||
} else {
|
||||
CRegion rg{dmg.x, dmg.y, dmg.width, dmg.height};
|
||||
CRegion wb{PWINDOW->m_vRealPosition.vec().x, PWINDOW->m_vRealPosition.vec().y, PWINDOW->m_vRealSize.vec().x, PWINDOW->m_vRealSize.vec().y};
|
||||
|
||||
rg.subtract(wb);
|
||||
|
||||
g_pHyprRenderer->damageRegion(rg);
|
||||
}
|
||||
}
|
||||
PDECO->damageEntire();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1845,7 +1845,7 @@ void CKeybindManager::mouse(std::string args) {
|
|||
if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT))
|
||||
continue;
|
||||
|
||||
if (wd->getWindowDecorationRegion().containsPoint(mouseCoords)) {
|
||||
if (g_pDecorationPositioner->getWindowDecorationBox(wd.get()).containsPoint(mouseCoords)) {
|
||||
wd->onBeginWindowDragOnDeco(mouseCoords);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1964,9 +1964,6 @@ void CKeybindManager::moveWindowIntoGroup(CWindow* pWindow, CWindow* pWindowInDi
|
|||
if (pWindow->m_sGroupData.deny)
|
||||
return;
|
||||
|
||||
if (!pWindow->m_sGroupData.pNextWindow)
|
||||
pWindow->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(pWindow));
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow); // This removes groupped property!
|
||||
|
||||
static const auto* USECURRPOS = &g_pConfigManager->getConfigValuePtr("group:insert_after_current")->intValue;
|
||||
|
|
@ -1978,6 +1975,9 @@ void CKeybindManager::moveWindowIntoGroup(CWindow* pWindow, CWindow* pWindowInDi
|
|||
g_pLayoutManager->getCurrentLayout()->recalculateWindow(pWindow);
|
||||
g_pCompositor->focusWindow(pWindow);
|
||||
g_pCompositor->warpCursorTo(pWindow->middle());
|
||||
|
||||
if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
|
||||
pWindow->addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(pWindow));
|
||||
}
|
||||
|
||||
void CKeybindManager::moveWindowOutOfGroup(CWindow* pWindow, const std::string& dir) {
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
|
|||
if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT))
|
||||
continue;
|
||||
|
||||
if (wd->getWindowDecorationRegion().containsPoint(mouseCoords)) {
|
||||
if (g_pDecorationPositioner->getWindowDecorationBox(wd.get()).containsPoint(mouseCoords)) {
|
||||
wd->onMouseButtonOnDeco(mouseCoords, e);
|
||||
return;
|
||||
}
|
||||
|
|
@ -675,7 +675,7 @@ void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) {
|
|||
const auto pWindow = g_pCompositor->vectorToWindowIdeal(MOUSECOORDS);
|
||||
|
||||
if (*PGROUPBARSCROLLING && pWindow && !pWindow->m_bIsFullscreen && !pWindow->hasPopupAt(MOUSECOORDS) && pWindow->m_sGroupData.pNextWindow) {
|
||||
const CBox box = pWindow->getDecorationByType(DECORATION_GROUPBAR)->getWindowDecorationRegion().getExtents();
|
||||
const CBox box = g_pDecorationPositioner->getWindowDecorationBox(pWindow->getDecorationByType(DECORATION_GROUPBAR));
|
||||
if (box.containsPoint(MOUSECOORDS)) {
|
||||
if (e->delta > 0)
|
||||
pWindow->setGroupCurrent(pWindow->m_sGroupData.pNextWindow);
|
||||
|
|
@ -1638,7 +1638,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) {
|
|||
if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT))
|
||||
continue;
|
||||
|
||||
if (wd->getWindowDecorationRegion().containsPoint(mouseCoords)) {
|
||||
if (g_pDecorationPositioner->getWindowDecorationBox(wd.get()).containsPoint(mouseCoords)) {
|
||||
onDeco = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue