Skip to content

Commit

Permalink
Don't arrange, but only limit the position on screen dimension changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsbers committed May 30, 2024
1 parent 313f4e3 commit b74955d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/wmframe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2106,7 +2106,7 @@ void YFrameWindow::maybeFocus() {
}
}

void YFrameWindow::focus(bool canWarp) {
void YFrameWindow::limitPos() {
if (limitPosition &&
(x() >= int(desktop->width()) - borderX() ||
y() >= int(desktop->height()) - borderY() - titleY() ||
Expand All @@ -2125,6 +2125,10 @@ void YFrameWindow::focus(bool canWarp) {
newY = int(- borderY());
setCurrentPositionOuter(newX, newY);
}
}

void YFrameWindow::focus(bool canWarp) {
limitPos();
manager->setFocus(this, canWarp);
if (raiseOnFocus && manager->isRunning()) {
wmRaise();
Expand Down
1 change: 1 addition & 0 deletions src/wmframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class YFrameWindow:
void createPointerWindows();
void grabKeys();

void limitPos();
void maybeFocus();
void focus(bool canWarp = false);
void activate(bool canWarp = false, bool curWork = true);
Expand Down
6 changes: 5 additions & 1 deletion src/wmmgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3877,7 +3877,11 @@ void YWindowManager::updateScreenSize(XEvent *event) {

/// TODO #warning "make something better"
if (arrangeWindowsOnScreenSizeChange && resize) {
wmActionListener->actionPerformed(actionArrange, 0);
for (YFrameIter frame(focusedIterator()); ++frame; ) {
if (frame->visible()) {
frame->limitPos();
}
}
}
if (resize) {
arrangeIcons();
Expand Down

0 comments on commit b74955d

Please sign in to comment.