diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-03 13:49:21 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-03 13:49:21 +0200 |
| commit | 462781b16f9763cbfd8f182b8680b00c823ecd9e (patch) | |
| tree | ce59ee859c62eaca851d82d5aed5f69a1aa83409 /src/layout | |
| parent | df6a3c687702e1d66215ff77aa97a003897f4140 (diff) | |
Added drag to move window
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/DwindleLayout.cpp | 13 | ||||
| -rw-r--r-- | src/layout/DwindleLayout.hpp | 1 | ||||
| -rw-r--r-- | src/layout/IHyprLayout.hpp | 5 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index ce1e2a3f..5e4be345 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -324,12 +324,25 @@ void CHyprDwindleLayout::onBeginDragWindow() { return; } + if (!DRAGGINGWINDOW->m_bIsFloating) { + DRAGGINGWINDOW->m_bDraggingTiled = true; + changeWindowFloatingMode(DRAGGINGWINDOW); + } else { + DRAGGINGWINDOW->m_bDraggingTiled = false; + } m_vBeginDragXY = g_pInputManager->getMouseCoordsInternal(); m_vBeginDragPositionXY = DRAGGINGWINDOW->m_vRealPosition; m_vBeginDragSizeXY = DRAGGINGWINDOW->m_vRealSize; } +void CHyprDwindleLayout::onEndDragWindow() { + const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow; + + if (DRAGGINGWINDOW->m_bDraggingTiled) + changeWindowFloatingMode(DRAGGINGWINDOW); +} + void CHyprDwindleLayout::onMouseMove(const Vector2D& mousePos) { const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow; diff --git a/src/layout/DwindleLayout.hpp b/src/layout/DwindleLayout.hpp index f1411322..957c8330 100644 --- a/src/layout/DwindleLayout.hpp +++ b/src/layout/DwindleLayout.hpp @@ -35,6 +35,7 @@ public: virtual void recalculateWindow(CWindow*); virtual void changeWindowFloatingMode(CWindow*); virtual void onBeginDragWindow(); + virtual void onEndDragWindow(); virtual void onMouseMove(const Vector2D&); virtual void onWindowCreatedFloating(CWindow*); virtual void fullscreenRequestForWindow(CWindow*); diff --git a/src/layout/IHyprLayout.hpp b/src/layout/IHyprLayout.hpp index b214dd50..3e85cc24 100644 --- a/src/layout/IHyprLayout.hpp +++ b/src/layout/IHyprLayout.hpp @@ -37,6 +37,11 @@ public: */ virtual void onBeginDragWindow() = 0; /* + Called when a window is ended being dragged + (mouse up) + */ + virtual void onEndDragWindow() = 0; + /* Called whenever the mouse moves, should the layout want to do anything with it. Useful for dragging. |
