mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-25 08:25:58 +01:00
allow dragging into floating groups
modified: src/Compositor.cpp modified: src/Compositor.hpp modified: src/layout/IHyprLayout.cpp Signed-off-by: MightyPlaza <123664421+MightyPlaza@users.noreply.github.com>
This commit is contained in:
parent
6013a3c8a0
commit
30cb505364
3 changed files with 55 additions and 3 deletions
|
@ -813,6 +813,24 @@ CWindow* CCompositor::windowFloatingFromCursor() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CWindow* CCompositor::windowFloatingFromCursorIgnore(CWindow* pWindow) {
|
||||||
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
|
wlr_box box = w->getWindowInputBox();
|
||||||
|
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w->m_bIsMapped && w->m_bIsFloating && !w->isHidden() && w->m_bPinned && !w->m_bNoFocus &&
|
||||||
|
w.get() != pWindow)
|
||||||
|
return w.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
|
wlr_box box = w->getWindowInputBox();
|
||||||
|
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() &&
|
||||||
|
!w->m_bPinned && !w->m_bNoFocus && w.get() != pWindow)
|
||||||
|
return w.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
wlr_surface* CCompositor::vectorWindowToSurface(const Vector2D& pos, CWindow* pWindow, Vector2D& sl) {
|
wlr_surface* CCompositor::vectorWindowToSurface(const Vector2D& pos, CWindow* pWindow, Vector2D& sl) {
|
||||||
|
|
||||||
if (!windowValidMapped(pWindow))
|
if (!windowValidMapped(pWindow))
|
||||||
|
|
|
@ -29,8 +29,7 @@
|
||||||
#include "plugins/PluginSystem.hpp"
|
#include "plugins/PluginSystem.hpp"
|
||||||
#include "helpers/Watchdog.hpp"
|
#include "helpers/Watchdog.hpp"
|
||||||
|
|
||||||
enum eManagersInitStage
|
enum eManagersInitStage {
|
||||||
{
|
|
||||||
STAGE_PRIORITY = 0,
|
STAGE_PRIORITY = 0,
|
||||||
STAGE_LATE
|
STAGE_LATE
|
||||||
};
|
};
|
||||||
|
@ -145,6 +144,7 @@ class CCompositor {
|
||||||
Vector2D vectorToSurfaceLocal(const Vector2D&, CWindow*, wlr_surface*);
|
Vector2D vectorToSurfaceLocal(const Vector2D&, CWindow*, wlr_surface*);
|
||||||
CWindow* windowFromCursor();
|
CWindow* windowFromCursor();
|
||||||
CWindow* windowFloatingFromCursor();
|
CWindow* windowFloatingFromCursor();
|
||||||
|
CWindow* windowFloatingFromCursorIgnore(CWindow*);
|
||||||
CMonitor* getMonitorFromOutput(wlr_output*);
|
CMonitor* getMonitorFromOutput(wlr_output*);
|
||||||
CWindow* getWindowForPopup(wlr_xdg_popup*);
|
CWindow* getWindowForPopup(wlr_xdg_popup*);
|
||||||
CWindow* getWindowFromSurface(wlr_surface*);
|
CWindow* getWindowFromSurface(wlr_surface*);
|
||||||
|
|
|
@ -260,10 +260,44 @@ void IHyprLayout::onEndDragWindow() {
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
changeWindowFloatingMode(DRAGGINGWINDOW);
|
changeWindowFloatingMode(DRAGGINGWINDOW);
|
||||||
DRAGGINGWINDOW->m_vLastFloatingSize = m_vDraggingWindowOriginalFloatSize;
|
DRAGGINGWINDOW->m_vLastFloatingSize = m_vDraggingWindowOriginalFloatSize;
|
||||||
|
} else if (g_pInputManager->dragMode == MBIND_MOVE) {
|
||||||
|
CWindow* pWindow = g_pCompositor->windowFloatingFromCursorIgnore(DRAGGINGWINDOW);
|
||||||
|
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
||||||
|
|
||||||
|
if (pWindow && pWindow->m_sGroupData.pNextWindow && // target is group
|
||||||
|
!pWindow->getGroupHead()->m_sGroupData.locked && // target unlocked
|
||||||
|
!(DRAGGINGWINDOW->m_sGroupData.pNextWindow && DRAGGINGWINDOW->getGroupHead()->m_sGroupData.locked) && // source unlocked or isn't group
|
||||||
|
!g_pKeybindManager->m_bGroupsLocked) {
|
||||||
|
|
||||||
|
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
||||||
|
bool handled = true;
|
||||||
|
|
||||||
|
for (auto& wd : pWindow->m_dWindowDecorations) {
|
||||||
|
if (!wd->allowsInput())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (wd->getWindowDecorationRegion().containsPoint(MOUSECOORDS)) {
|
||||||
|
wd->dragWindowToDecoration(DRAGGINGWINDOW, MOUSECOORDS);
|
||||||
|
handled = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (handled) {
|
||||||
|
static const auto* USECURRPOS = &g_pConfigManager->getConfigValuePtr("group:insert_after_current")->intValue;
|
||||||
|
(*USECURRPOS ? pWindow : pWindow->getGroupTail())->insertWindowToGroup(DRAGGINGWINDOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
pWindow->setGroupCurrent(DRAGGINGWINDOW);
|
||||||
|
DRAGGINGWINDOW->updateWindowDecos();
|
||||||
|
recalculateWindow(DRAGGINGWINDOW);
|
||||||
|
|
||||||
|
g_pCompositor->focusWindow(DRAGGINGWINDOW);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
||||||
|
|
||||||
g_pCompositor->focusWindow(DRAGGINGWINDOW);
|
g_pCompositor->focusWindow(DRAGGINGWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue