Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Fix top bar glitch when moving windows (#1910)
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro authored and keianhzo committed Oct 3, 2019
1 parent 50f8198 commit 93b664b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,10 @@ public void setDelegate(TopBarWidget.Delegate aDelegate) {
}

public void setMoveLeftButtonEnabled(boolean aEnabled) {
mMoveRightButton.setHovered(false);
mMoveLeftButton.setEnabled(aEnabled);
}

public void setMoveRightButtonEnabled(boolean aEnabled) {
mMoveLeftButton.setHovered(false);
mMoveRightButton.setEnabled(aEnabled);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,13 @@ public TopBarWidget getTopBar() {
return mTopBar;
}

public void setTopBar(TopBarWidget aWidget) {
if (mTopBar != aWidget) {
mTopBar = aWidget;
mTopBar.attachToWindow(this);
}
}

public TitleBarWidget getTitleBar() {
return mTitleBar;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,14 @@ public void moveWindowRight(@NonNull WindowWidget aWindow) {
if (aWindow == leftWindow) {
placeWindow(leftWindow, WindowPlacement.FRONT);
placeWindow(frontWindow, WindowPlacement.LEFT);
switchTopBars(leftWindow, frontWindow);
} else if (aWindow == frontWindow) {
if (rightWindow != null) {
placeWindow(rightWindow, WindowPlacement.FRONT);
switchTopBars(rightWindow, frontWindow);
} else if (leftWindow != null) {
placeWindow(leftWindow, WindowPlacement.FRONT);
switchTopBars(leftWindow, frontWindow);
}
placeWindow(frontWindow, WindowPlacement.RIGHT);
}
Expand All @@ -323,11 +326,14 @@ public void moveWindowLeft(@NonNull WindowWidget aWindow) {
if (aWindow == rightWindow) {
placeWindow(rightWindow, WindowPlacement.FRONT);
placeWindow(frontWindow, WindowPlacement.RIGHT);
switchTopBars(rightWindow, frontWindow);
} else if (aWindow == frontWindow) {
if (leftWindow != null) {
placeWindow(leftWindow, WindowPlacement.FRONT);
switchTopBars(leftWindow, frontWindow);
} else if (rightWindow != null) {
placeWindow(rightWindow, WindowPlacement.FRONT);
switchTopBars(rightWindow, frontWindow);
}
placeWindow(frontWindow, WindowPlacement.LEFT);
}
Expand Down Expand Up @@ -715,6 +721,15 @@ public int getWindowsCount() {
return getCurrentWindows().size();
}

private void switchTopBars(WindowWidget w1, WindowWidget w2) {
// Used to fix a minor visual glitch.
// See https://github.com/MozillaReality/FirefoxReality/issues/1722
TopBarWidget bar1 = w1.getTopBar();
TopBarWidget bar2 = w2.getTopBar();
w1.setTopBar(bar2);
w2.setTopBar(bar1);
}

private void updateViews() {
WindowWidget frontWindow = getFrontWindow();
WindowWidget leftWindow = getLeftWindow();
Expand Down

0 comments on commit 93b664b

Please sign in to comment.