App Server: Don't set workspace in Desktop::MoveWindowBy
This fixes a bug that's been annoying me - when I use Workspaces to move a terminal that's scrolling/moving on another workspace, the terminal begins drawing into the current workspace; this also happens with some other apps, like Qemu. I tracked this down to Desktop::MoveWindowBy, where we update an invisible window's current workspace to the one it's being moved on. Trouble is, the current workspace is set to -1 for windows on another workspace, and IsVisible just returns whether the current workspace is >=0, so doing this causes IsVisible to return true when it shouldn't. This patch replaces that call with one that sets a separate invisible workspace member variable, which preserves all window moving functionality without improperly setting a window as visible. It also fixes a minor graphical glitch when moving off-workspace tiled windows. Fixes #6722 Change-Id: I2c4f04602caed85bf08391d0ea99e4dc74c1e1d8 Reviewed-on: https://review.haiku-os.org/c/haiku/+/9256 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -1484,7 +1484,7 @@ Desktop::MoveWindowBy(Window* window, float x, float y, int32 workspace)
|
||||
}
|
||||
|
||||
stackWindow->Anchor(workspace).position += BPoint(x, y);
|
||||
stackWindow->SetCurrentWorkspace(workspace);
|
||||
stackWindow->SetPriorWorkspace(workspace);
|
||||
_WindowChanged(stackWindow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ Window::Window(const BRect& frame, const char *name,
|
||||
fFeel(feel),
|
||||
fWorkspaces(workspaces),
|
||||
fCurrentWorkspace(-1),
|
||||
fPriorWorkspace(-1),
|
||||
|
||||
fMinWidth(1),
|
||||
fMaxWidth(32768),
|
||||
|
||||
@@ -222,11 +222,16 @@ public:
|
||||
inline bool IsMinimized() const { return fMinimized; }
|
||||
|
||||
void SetCurrentWorkspace(int32 index)
|
||||
{ fCurrentWorkspace = index; }
|
||||
{ fCurrentWorkspace = index; fPriorWorkspace = index; }
|
||||
int32 CurrentWorkspace() const
|
||||
{ return fCurrentWorkspace; }
|
||||
bool IsVisible() const;
|
||||
|
||||
void SetPriorWorkspace(int32 index)
|
||||
{ fPriorWorkspace = index; }
|
||||
int32 PriorWorkspace() const
|
||||
{ return fPriorWorkspace; }
|
||||
|
||||
bool IsDragging() const;
|
||||
bool IsResizing() const;
|
||||
|
||||
@@ -430,6 +435,7 @@ protected:
|
||||
uint32 fFlags;
|
||||
uint32 fWorkspaces;
|
||||
int32 fCurrentWorkspace;
|
||||
int32 fPriorWorkspace;
|
||||
|
||||
int32 fMinWidth;
|
||||
int32 fMaxWidth;
|
||||
|
||||
@@ -530,9 +530,10 @@ WindowArea::_MoveToSAT(SATWindow* triggerWindow)
|
||||
float deltaByY = round(frameSAT.bottom - frame.bottom);
|
||||
|
||||
int32 workspace = triggerWindow->GetWindow()->CurrentWorkspace();
|
||||
if (workspace < 0)
|
||||
workspace = triggerWindow->GetWindow()->PriorWorkspace();
|
||||
Desktop* desktop = triggerWindow->GetWindow()->Desktop();
|
||||
desktop->MoveWindowBy(topWindow->GetWindow(), deltaToX, deltaToY,
|
||||
workspace);
|
||||
desktop->MoveWindowBy(topWindow->GetWindow(), deltaToX, deltaToY, workspace);
|
||||
// Update frame to the new position
|
||||
desktop->ResizeWindowBy(topWindow->GetWindow(), deltaByX, deltaByY);
|
||||
|
||||
|
||||
@@ -389,11 +389,16 @@ BRect
|
||||
SATWindow::CompleteWindowFrame()
|
||||
{
|
||||
BRect frame = fWindow->Frame();
|
||||
if (fDesktop
|
||||
if (fDesktop && fWindow->IsVisible()
|
||||
&& fDesktop->CurrentWorkspace() != fWindow->CurrentWorkspace()) {
|
||||
window_anchor& anchor = fWindow->Anchor(fWindow->CurrentWorkspace());
|
||||
if (anchor.position != kInvalidWindowPosition)
|
||||
frame.OffsetTo(anchor.position);
|
||||
} else if (fDesktop && !fWindow->IsVisible() && fWindow->PriorWorkspace() >= 0
|
||||
&& fDesktop->CurrentWorkspace() != fWindow->PriorWorkspace()) {
|
||||
window_anchor& anchor = fWindow->Anchor(fWindow->PriorWorkspace());
|
||||
if (anchor.position != kInvalidWindowPosition)
|
||||
frame.OffsetTo(anchor.position);
|
||||
}
|
||||
|
||||
AddDecorator(frame);
|
||||
|
||||
Reference in New Issue
Block a user