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

Commit 93b664b

Browse files
MortimerGorokeianhzo
authored andcommitted
Fix top bar glitch when moving windows (#1910)
1 parent 50f8198 commit 93b664b

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TopBarWidget.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,10 @@ public void setDelegate(TopBarWidget.Delegate aDelegate) {
190190
}
191191

192192
public void setMoveLeftButtonEnabled(boolean aEnabled) {
193-
mMoveRightButton.setHovered(false);
194193
mMoveLeftButton.setEnabled(aEnabled);
195194
}
196195

197196
public void setMoveRightButtonEnabled(boolean aEnabled) {
198-
mMoveLeftButton.setHovered(false);
199197
mMoveRightButton.setEnabled(aEnabled);
200198
}
201199

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,13 @@ public TopBarWidget getTopBar() {
631631
return mTopBar;
632632
}
633633

634+
public void setTopBar(TopBarWidget aWidget) {
635+
if (mTopBar != aWidget) {
636+
mTopBar = aWidget;
637+
mTopBar.attachToWindow(this);
638+
}
639+
}
640+
634641
public TitleBarWidget getTitleBar() {
635642
return mTitleBar;
636643
}

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,14 @@ public void moveWindowRight(@NonNull WindowWidget aWindow) {
301301
if (aWindow == leftWindow) {
302302
placeWindow(leftWindow, WindowPlacement.FRONT);
303303
placeWindow(frontWindow, WindowPlacement.LEFT);
304+
switchTopBars(leftWindow, frontWindow);
304305
} else if (aWindow == frontWindow) {
305306
if (rightWindow != null) {
306307
placeWindow(rightWindow, WindowPlacement.FRONT);
308+
switchTopBars(rightWindow, frontWindow);
307309
} else if (leftWindow != null) {
308310
placeWindow(leftWindow, WindowPlacement.FRONT);
311+
switchTopBars(leftWindow, frontWindow);
309312
}
310313
placeWindow(frontWindow, WindowPlacement.RIGHT);
311314
}
@@ -323,11 +326,14 @@ public void moveWindowLeft(@NonNull WindowWidget aWindow) {
323326
if (aWindow == rightWindow) {
324327
placeWindow(rightWindow, WindowPlacement.FRONT);
325328
placeWindow(frontWindow, WindowPlacement.RIGHT);
329+
switchTopBars(rightWindow, frontWindow);
326330
} else if (aWindow == frontWindow) {
327331
if (leftWindow != null) {
328332
placeWindow(leftWindow, WindowPlacement.FRONT);
333+
switchTopBars(leftWindow, frontWindow);
329334
} else if (rightWindow != null) {
330335
placeWindow(rightWindow, WindowPlacement.FRONT);
336+
switchTopBars(rightWindow, frontWindow);
331337
}
332338
placeWindow(frontWindow, WindowPlacement.LEFT);
333339
}
@@ -715,6 +721,15 @@ public int getWindowsCount() {
715721
return getCurrentWindows().size();
716722
}
717723

724+
private void switchTopBars(WindowWidget w1, WindowWidget w2) {
725+
// Used to fix a minor visual glitch.
726+
// See https://github.com/MozillaReality/FirefoxReality/issues/1722
727+
TopBarWidget bar1 = w1.getTopBar();
728+
TopBarWidget bar2 = w2.getTopBar();
729+
w1.setTopBar(bar2);
730+
w2.setTopBar(bar1);
731+
}
732+
718733
private void updateViews() {
719734
WindowWidget frontWindow = getFrontWindow();
720735
WindowWidget leftWindow = getLeftWindow();

0 commit comments

Comments
 (0)