[MM-48574] Fixed issue on windows where in some cases window resize does not work (#2441)

* Fixed issue on windows where in some cases window resize does not work

* Use silly instead of debug for window resizing functions
This commit is contained in:
Tasos Boulis
2022-12-01 19:44:47 +02:00
committed by GitHub
parent cf82058738
commit 08e94b9f55
2 changed files with 15 additions and 2 deletions

View File

@@ -131,7 +131,7 @@ export class ModalManager {
}
handleResizeModal = (event: IpcMainEvent, bounds: Electron.Rectangle) => {
log.debug('ModalManager.handleResizeModal', bounds);
log.debug('ModalManager.handleResizeModal', {bounds, modalQueueLength: this.modalQueue.length});
if (this.modalQueue.length) {
const currentModal = this.modalQueue[0];

View File

@@ -264,8 +264,17 @@ export class WindowManager {
return;
}
/**
* Fixes an issue on win11 related to Snap where the first "will-resize" event would return the same bounds
* causing the "resize" event to not fire
*/
const prevBounds = this.getBounds();
if (prevBounds.height === newBounds.height && prevBounds.width === newBounds.width) {
return;
}
if (this.isResizing && this.viewManager.loadingScreenState === LoadingScreenState.HIDDEN && this.viewManager.getCurrentView()) {
log.silly('prevented resize');
log.debug('prevented resize');
event.preventDefault();
return;
}
@@ -297,6 +306,8 @@ export class WindowManager {
}
private throttledWillResize = (newBounds: Electron.Rectangle) => {
log.silly('WindowManager.throttledWillResize', {newBounds});
this.isResizing = true;
this.setCurrentViewBounds(newBounds);
}
@@ -324,6 +335,8 @@ export class WindowManager {
};
setCurrentViewBounds = (bounds: {width: number; height: number}) => {
log.debug('WindowManager.setCurrentViewBounds', {bounds});
const currentView = this.viewManager?.getCurrentView();
if (currentView) {
const adjustedBounds = getAdjustedWindowBoundaries(bounds.width, bounds.height, shouldHaveBackBar(currentView.tab.url, currentView.view.webContents.getURL()));