Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix window revealing when navigating with multiple windows #13561

Merged
merged 1 commit into from
Apr 4, 2024
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
2 changes: 1 addition & 1 deletion packages/core/src/electron-browser/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const api: TheiaCoreAPI = {
ipcRenderer.send(CHANNEL_SET_MENU, mainMenuId, convertMenu(menu, handlers));
},
getSecurityToken: () => ipcRenderer.sendSync(CHANNEL_GET_SECURITY_TOKEN),
focusWindow: (name: string) => ipcRenderer.send(CHANNEL_FOCUS_WINDOW, name),
focusWindow: (name?: string) => ipcRenderer.send(CHANNEL_FOCUS_WINDOW, name),
showItemInFolder: fsPath => {
ipcRenderer.send(CHANNEL_SHOW_ITEM_IN_FOLDER, fsPath);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class ElectronWindowService extends DefaultWindowService {
}

override focus(): void {
window.electronTheiaCore.focusWindow(window.name);
window.electronTheiaCore.focusWindow();
}
@postConstruct()
protected init(): void {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/electron-common/electron-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export interface TheiaCoreAPI {
popup(menu: MenuDto[], x: number, y: number, onClosed: () => void, windowName?: string): Promise<number>;
closePopup(handle: number): void;

focusWindow(name: string): void;
focusWindow(name?: string): void;

showItemInFolder(fsPath: string): void;

Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/electron-main/electron-api-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ export class TheiaMainApi implements ElectronMainApplicationContribution {

// focus windows for secondary window support
ipcMain.on(CHANNEL_FOCUS_WINDOW, (event, windowName) => {
const electronWindow = BrowserWindow.getAllWindows().find(win => win.webContents.mainFrame.name === windowName);
const electronWindow = windowName
? BrowserWindow.getAllWindows().find(win => win.webContents.mainFrame.name === windowName)
: BrowserWindow.fromWebContents(event.sender);
if (electronWindow) {
if (electronWindow.isMinimized()) {
electronWindow.restore();
Expand Down
Loading