Added drag to move window

This commit is contained in:
vaxerski 2022-04-03 13:49:21 +02:00
parent df6a3c6877
commit 462781b16f
5 changed files with 27 additions and 3 deletions

View file

@ -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;

View file

@ -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*);

View file

@ -36,6 +36,11 @@ public:
as.
*/
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.