mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-05-19 08:30:22 -07:00
layout: center floating window at cursor when picked up from fullscreen (#9780)
* layout: center floating window at cursor when picked up from fullscreen when picking up a floating window after it had been fullscreened before it would return to its previous position which looked ugly because the cursor could be no where near the windows original position, this patch makes it so that the window is returned to the users current cursor position * E
This commit is contained in:
parent
1f0fd79b91
commit
3a47c73f34
@ -240,7 +240,8 @@ void IHyprLayout::onBeginDragWindow() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DRAGGINGWINDOW->isFullscreen()) {
|
const bool WAS_FULLSCREEN = DRAGGINGWINDOW->isFullscreen();
|
||||||
|
if (WAS_FULLSCREEN) {
|
||||||
Debug::log(LOG, "Dragging a fullscreen window");
|
Debug::log(LOG, "Dragging a fullscreen window");
|
||||||
g_pCompositor->setWindowFullscreenInternal(DRAGGINGWINDOW, FSMODE_NONE);
|
g_pCompositor->setWindowFullscreenInternal(DRAGGINGWINDOW, FSMODE_NONE);
|
||||||
}
|
}
|
||||||
@ -257,7 +258,10 @@ void IHyprLayout::onBeginDragWindow() {
|
|||||||
|
|
||||||
m_vDraggingWindowOriginalFloatSize = DRAGGINGWINDOW->m_vLastFloatingSize;
|
m_vDraggingWindowOriginalFloatSize = DRAGGINGWINDOW->m_vLastFloatingSize;
|
||||||
|
|
||||||
if (!DRAGGINGWINDOW->m_bIsFloating) {
|
if (WAS_FULLSCREEN && DRAGGINGWINDOW->m_bIsFloating) {
|
||||||
|
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
||||||
|
*DRAGGINGWINDOW->m_vRealPosition = MOUSECOORDS - DRAGGINGWINDOW->m_vRealSize->goal() / 2.f;
|
||||||
|
} else if (!DRAGGINGWINDOW->m_bIsFloating) {
|
||||||
if (g_pInputManager->dragMode == MBIND_MOVE) {
|
if (g_pInputManager->dragMode == MBIND_MOVE) {
|
||||||
DRAGGINGWINDOW->m_vLastFloatingSize = (DRAGGINGWINDOW->m_vRealSize->goal() * 0.8489).clamp(Vector2D{5, 5}, Vector2D{}).floor();
|
DRAGGINGWINDOW->m_vLastFloatingSize = (DRAGGINGWINDOW->m_vRealSize->goal() * 0.8489).clamp(Vector2D{5, 5}, Vector2D{}).floor();
|
||||||
changeWindowFloatingMode(DRAGGINGWINDOW);
|
changeWindowFloatingMode(DRAGGINGWINDOW);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user