mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-31 19:27:00 -06:00
ELECTRON-1380 - Fix pop-up menu position for native title bar (#724)
This commit is contained in:
parent
0255a692b9
commit
1225f50812
@ -67,6 +67,7 @@ export class WindowHandler {
|
|||||||
public url: string | undefined;
|
public url: string | undefined;
|
||||||
public willQuitApp: boolean = false;
|
public willQuitApp: boolean = false;
|
||||||
public spellchecker: SpellChecker | undefined;
|
public spellchecker: SpellChecker | undefined;
|
||||||
|
public isCustomTitleBar: boolean;
|
||||||
|
|
||||||
private readonly contextIsolation: boolean;
|
private readonly contextIsolation: boolean;
|
||||||
private readonly backgroundThrottling: boolean;
|
private readonly backgroundThrottling: boolean;
|
||||||
@ -75,7 +76,6 @@ export class WindowHandler {
|
|||||||
private readonly config: IConfig;
|
private readonly config: IConfig;
|
||||||
// Window reference
|
// Window reference
|
||||||
private readonly windows: object;
|
private readonly windows: object;
|
||||||
private readonly isCustomTitleBar: boolean;
|
|
||||||
|
|
||||||
private loadFailError: string | undefined;
|
private loadFailError: string | undefined;
|
||||||
private mainWindow: ICustomBrowserWindow | null = null;
|
private mainWindow: ICustomBrowserWindow | null = null;
|
||||||
|
@ -5,6 +5,7 @@ import * as filesize from 'filesize';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { format, parse } from 'url';
|
import { format, parse } from 'url';
|
||||||
|
import { apiName } from '../common/api-interface';
|
||||||
|
|
||||||
import { isDevEnv, isMac } from '../common/env';
|
import { isDevEnv, isMac } from '../common/env';
|
||||||
import { i18n, LocaleType } from '../common/i18n';
|
import { i18n, LocaleType } from '../common/i18n';
|
||||||
@ -250,8 +251,9 @@ export const updateLocale = (locale: LocaleType): void => {
|
|||||||
*/
|
*/
|
||||||
export const showPopupMenu = (opts: Electron.PopupOptions): void => {
|
export const showPopupMenu = (opts: Electron.PopupOptions): void => {
|
||||||
const mainWindow = windowHandler.getMainWindow();
|
const mainWindow = windowHandler.getMainWindow();
|
||||||
if (mainWindow && !mainWindow.isDestroyed() && isValidWindow(mainWindow)) {
|
if (mainWindow && windowExists(mainWindow) && isValidWindow(mainWindow) && mainWindow.winName === apiName.mainWindowName) {
|
||||||
const { x, y } = mainWindow.isFullScreen() ? { x: 0, y: 0 } : { x: 20, y: 15 };
|
const coordinates = windowHandler.isCustomTitleBar ? { x: 20, y: 15 } : { x: 10, y: -20 };
|
||||||
|
const { x, y } = mainWindow.isFullScreen() ? { x: 0, y: 0 } : coordinates;
|
||||||
const popupOpts = { window: mainWindow, x, y };
|
const popupOpts = { window: mainWindow, x, y };
|
||||||
const appMenu = windowHandler.appMenu;
|
const appMenu = windowHandler.appMenu;
|
||||||
if (appMenu) {
|
if (appMenu) {
|
||||||
|
Loading…
Reference in New Issue
Block a user