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

Fix top bar glitch when moving windows #1910

Merged
merged 1 commit into from
Oct 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -624,6 +624,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 @@ -307,11 +307,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 @@ -329,11 +332,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 @@ -726,6 +732,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