summaryrefslogtreecommitdiff
path: root/src/layout/IHyprLayout.cpp
diff options
context:
space:
mode:
authorMightyPlaza <123664421+MightyPlaza@users.noreply.github.com>2023-11-19 12:29:01 +0000
committerGitHub <noreply@github.com>2023-11-19 12:29:01 +0000
commitadd23a9ba26c6363c7180ed0b23394d9f1328be2 (patch)
treeca3a75f67ee4a57da76d8262978ef4dd074737ae /src/layout/IHyprLayout.cpp
parent3d89654254a3cc23a57e1bdcd39ad9f743bf98e2 (diff)
group: fix dragging into floating groups (#3719)
* allow dragging into floating groups modified: src/Compositor.cpp modified: src/Compositor.hpp modified: src/layout/IHyprLayout.cpp modified: src/render/decorations/CHyprGroupBarDecoration.cpp * floating-only modified: src/layout/IHyprLayout.cpp
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
-rw-r--r--src/layout/IHyprLayout.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index 8bb51daf..acd84684 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -1,6 +1,7 @@
#include "IHyprLayout.hpp"
#include "../defines.hpp"
#include "../Compositor.hpp"
+#include "../render/decorations/CHyprGroupBarDecoration.hpp"
void IHyprLayout::onWindowCreated(CWindow* pWindow, eDirection direction) {
if (pWindow->m_bIsFloating) {
@@ -264,10 +265,36 @@ void IHyprLayout::onEndDragWindow() {
g_pInputManager->refocus();
changeWindowFloatingMode(DRAGGINGWINDOW);
DRAGGINGWINDOW->m_vLastFloatingSize = m_vDraggingWindowOriginalFloatSize;
+ } else if (g_pInputManager->dragMode == MBIND_MOVE) {
+ g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
+ const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
+ CWindow* pWindow = g_pCompositor->vectorToWindowIdeal(MOUSECOORDS, DRAGGINGWINDOW);
+
+ if (pWindow && pWindow->m_bIsFloating) {
+ for (auto& wd : pWindow->m_dWindowDecorations) {
+ if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT))
+ continue;
+
+ if (g_pDecorationPositioner->getWindowDecorationBox(wd.get()).containsPoint(MOUSECOORDS)) {
+ if (!wd->onEndWindowDragOnDeco(DRAGGINGWINDOW, MOUSECOORDS))
+ return;
+ break;
+ }
+ }
+
+ if (pWindow->m_sGroupData.pNextWindow && DRAGGINGWINDOW->canBeGroupedInto(pWindow)) {
+ static const auto* USECURRPOS = &g_pConfigManager->getConfigValuePtr("group:insert_after_current")->intValue;
+ (*USECURRPOS ? pWindow : pWindow->getGroupTail())->insertWindowToGroup(DRAGGINGWINDOW);
+ pWindow->setGroupCurrent(DRAGGINGWINDOW);
+ DRAGGINGWINDOW->updateWindowDecos();
+
+ if (!DRAGGINGWINDOW->getDecorationByType(DECORATION_GROUPBAR))
+ DRAGGINGWINDOW->addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(DRAGGINGWINDOW));
+ }
+ }
}
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
-
g_pCompositor->focusWindow(DRAGGINGWINDOW);
g_pInputManager->m_bWasDraggingWindow = false;