Skip to content

Commit

Permalink
Always add the new window to the center. Update tray when windows are…
Browse files Browse the repository at this point in the history
… moved. (#1689)
  • Loading branch information
MortimerGoro authored and keianhzo committed Aug 28, 2019
1 parent 85ab9b8 commit 6d9dd2a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Expand Up @@ -265,6 +265,11 @@ public void onFocusedWindowChanged(@NonNull WindowWidget aFocusedWindow, @Nullab
public void onWindowBorderChanged(@NonNull WindowWidget aChangeWindow) {
mKeyboard.proxifyLayerIfNeeded(mWindows.getCurrentWindows());
}

@Override
public void onWindowsMoved() {
updateWidget(mTray);
}
});

// Create Browser navigation widget
Expand Down
Expand Up @@ -88,6 +88,7 @@ public enum WindowPlacement{
public interface Delegate {
void onFocusedWindowChanged(@NonNull WindowWidget aFocusedWindow, @Nullable WindowWidget aPrevFocusedWindow);
void onWindowBorderChanged(@NonNull WindowWidget aChangeWindow);
void onWindowsMoved();
}

public Windows(Context aContext) {
Expand Down Expand Up @@ -192,14 +193,16 @@ public WindowWidget addWindow() {
placeWindow(frontWindow, WindowPlacement.RIGHT);
} else if (leftWindow != null && focusedWindow == frontWindow) {
// Opening a new window from front window
placeWindow(newWindow, WindowPlacement.RIGHT);
placeWindow(newWindow, WindowPlacement.FRONT);
placeWindow(frontWindow, WindowPlacement.RIGHT);
} else if (rightWindow != null && focusedWindow == rightWindow) {
// Opening a new window from right window
placeWindow(newWindow, WindowPlacement.FRONT);
placeWindow(frontWindow, WindowPlacement.LEFT);
} else if (rightWindow != null && focusedWindow == frontWindow) {
// Opening a new window from right window
placeWindow(newWindow, WindowPlacement.LEFT);
placeWindow(newWindow, WindowPlacement.FRONT);
placeWindow(frontWindow, WindowPlacement.LEFT);
}

updateMaxWindowScales();
Expand Down Expand Up @@ -292,6 +295,9 @@ public void moveWindowRight(@NonNull WindowWidget aWindow) {
placeWindow(frontWindow, WindowPlacement.RIGHT);
}
updateViews();
if (mDelegate != null) {
mDelegate.onWindowsMoved();
}
}

public void moveWindowLeft(@NonNull WindowWidget aWindow) {
Expand All @@ -311,6 +317,9 @@ public void moveWindowLeft(@NonNull WindowWidget aWindow) {
placeWindow(frontWindow, WindowPlacement.LEFT);
}
updateViews();
if (mDelegate != null) {
mDelegate.onWindowsMoved();
}
}

public void focusWindow(@NonNull WindowWidget aWindow) {
Expand Down

0 comments on commit 6d9dd2a

Please sign in to comment.