mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2026-05-05 10:18:00 +02:00
Hyprscrolling: Make resizeactive keyboard binds work for vertical window resizing (#442)
* Get resizeactive keyboard binds working. Set corner based on window having previous or next neighbors in the column. Negate delta.y when not the top window. * Rename mod_delta modDelta. Remove braces on short ifs.
This commit is contained in:
parent
ba1823c787
commit
bdd56d2c56
1 changed files with 11 additions and 5 deletions
|
|
@ -612,6 +612,7 @@ void CScrollingLayout::onBeginDragWindow() {
|
|||
|
||||
void CScrollingLayout::resizeActiveWindow(const Vector2D& delta, eRectCorner corner, PHLWINDOW pWindow) {
|
||||
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_lastWindow.lock();
|
||||
Vector2D modDelta = delta;
|
||||
|
||||
if (!validMapped(PWINDOW))
|
||||
return;
|
||||
|
|
@ -626,9 +627,6 @@ void CScrollingLayout::resizeActiveWindow(const Vector2D& delta, eRectCorner cor
|
|||
return;
|
||||
}
|
||||
|
||||
if (corner == CORNER_NONE)
|
||||
return;
|
||||
|
||||
if (!DATA->column || !DATA->column->workspace || !DATA->column->workspace->workspace || !DATA->column->workspace->workspace->m_monitor)
|
||||
return;
|
||||
|
||||
|
|
@ -666,6 +664,14 @@ void CScrollingLayout::resizeActiveWindow(const Vector2D& delta, eRectCorner cor
|
|||
const auto CURR_WD = DATA;
|
||||
const auto NEXT_WD = DATA->column->next(DATA);
|
||||
const auto PREV_WD = DATA->column->prev(DATA);
|
||||
if (corner == CORNER_NONE) {
|
||||
if (!PREV_WD)
|
||||
corner = CORNER_BOTTOMRIGHT;
|
||||
else {
|
||||
corner = CORNER_TOPRIGHT;
|
||||
modDelta.y *= -1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
switch (corner) {
|
||||
case CORNER_BOTTOMLEFT:
|
||||
|
|
@ -687,10 +693,10 @@ void CScrollingLayout::resizeActiveWindow(const Vector2D& delta, eRectCorner cor
|
|||
if (!PREV_WD)
|
||||
break;
|
||||
|
||||
if (PREV_WD->windowSize <= MIN_ROW_HEIGHT && delta.y <= 0 || CURR_WD->windowSize <= MIN_ROW_HEIGHT && delta.y >= 0)
|
||||
if (PREV_WD->windowSize <= MIN_ROW_HEIGHT && modDelta.y <= 0 || CURR_WD->windowSize <= MIN_ROW_HEIGHT && delta.y >= 0)
|
||||
break;
|
||||
|
||||
float adjust = std::clamp((float)(delta.y / USABLE.h), -(PREV_WD->windowSize - MIN_ROW_HEIGHT), (CURR_WD->windowSize - MIN_ROW_HEIGHT));
|
||||
float adjust = std::clamp((float)(modDelta.y / USABLE.h), -(PREV_WD->windowSize - MIN_ROW_HEIGHT), (CURR_WD->windowSize - MIN_ROW_HEIGHT));
|
||||
|
||||
PREV_WD->windowSize = std::clamp(PREV_WD->windowSize + adjust, MIN_ROW_HEIGHT, MAX_ROW_HEIGHT);
|
||||
CURR_WD->windowSize = std::clamp(CURR_WD->windowSize - adjust, MIN_ROW_HEIGHT, MAX_ROW_HEIGHT);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue