Skip to content

Commit

Permalink
Save the focused window between regular and private sessions (#1745)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo authored and bluemarvin committed Sep 3, 2019
1 parent e6ceadd commit 810e5dd
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -68,6 +68,8 @@ class WindowsState {
public static final int MAX_WINDOWS = 3;
private WindowWidget mFullscreenWindow;
private WindowPlacement mPrevWindowPlacement;
private WindowPlacement mRegularWindowPlacement;
private WindowPlacement mPrivateWindowPlacement;
private boolean mStoredCurvedMode = false;
private boolean mForcedCurvedMode = false;

Expand Down Expand Up @@ -98,6 +100,9 @@ public Windows(Context aContext) {
mRegularWindows = new ArrayList<>();
mPrivateWindows = new ArrayList<>();

mRegularWindowPlacement = WindowPlacement.FRONT;
mPrivateWindowPlacement = WindowPlacement.FRONT;

mStoredCurvedMode = SettingsStore.getInstance(mContext).getCylinderDensity() > 0.0f;

restoreWindows();
Expand Down Expand Up @@ -402,6 +407,7 @@ public void enterPrivateMode() {
}
mPrivateMode = true;
updateCurvedMode(true);
mRegularWindowPlacement = mFocusedWindow.getWindowPlacement();
for (WindowWidget window: mRegularWindows) {
setWindowVisible(window, false);
}
Expand All @@ -416,7 +422,7 @@ public void enterPrivateMode() {
}

} else {
focusWindow(getFrontWindow());
focusWindow(getWindowWithPlacement(mPrivateWindowPlacement));
}
updateViews();
mWidgetManager.pushWorldBrightness(this, WidgetManagerDelegate.DEFAULT_DIM_BRIGHTNESS);
Expand All @@ -428,13 +434,14 @@ public void exitPrivateMode() {
}
mPrivateMode = false;
updateCurvedMode(true);
mPrivateWindowPlacement = mFocusedWindow.getWindowPlacement();
for (WindowWidget window: mRegularWindows) {
setWindowVisible(window, true);
}
for (WindowWidget window: mPrivateWindows) {
setWindowVisible(window, false);
}
focusWindow(getFrontWindow());
focusWindow(getWindowWithPlacement(mRegularWindowPlacement));
updateViews();
mWidgetManager.popWorldBrightness(this);
}
Expand Down Expand Up @@ -866,6 +873,7 @@ public void onFullScreen(GeckoSession session, boolean aFullScreen) {
}
}

@Nullable
private WindowWidget getWindowWithSession(GeckoSession aSession) {
for (WindowWidget window: getCurrentWindows()) {
if (window.getSessionStack().containsSession(aSession)) {
Expand Down

0 comments on commit 810e5dd

Please sign in to comment.