@@ -329,6 +329,21 @@ export const make = Effect.gen(function* () {
329329 const currentMainWindow = electronWindow . currentMainOrFirst . pipe ( Effect . flatMap ( withoutSplash ) ) ;
330330 const focusedMainWindow = electronWindow . focusedMainOrFirst . pipe ( Effect . flatMap ( withoutSplash ) ) ;
331331
332+ const zoomWindow = Effect . fn ( "desktop.window.zoomWindow" ) ( function * (
333+ window : Electron . BrowserWindow ,
334+ direction : MainWindowZoomDirection ,
335+ ) {
336+ const webContents = window . webContents ;
337+ webContents . setZoomLevel (
338+ direction === "reset" ? 0 : webContents . getZoomLevel ( ) + ( direction === "in" ? 0.5 : - 0.5 ) ,
339+ ) ;
340+ if ( environment . platform === "darwin" ) syncMacosWindowButtons ( window ) ;
341+ // Chromium pushes the new level down to embedded guests, which would zoom
342+ // the previewed page along with the app UI. The preview browser keeps its
343+ // own zoom, so put each guest back where the preview left it.
344+ yield * previewManager . reapplyZoom ( ) ;
345+ } ) ;
346+
332347 const createWindow = Effect . fn ( "desktop.window.createWindow" ) ( function * ( ) : Effect . fn . Return <
333348 Electron . BrowserWindow ,
334349 DesktopWindowError
@@ -645,6 +660,13 @@ export const make = Effect.gen(function* () {
645660 window . webContents . on ( "input-event" , ( _event , input ) => {
646661 if ( input . type === "gestureScrollEnd" ) window . webContents . send ( TRACKPAD_SCROLL_END_CHANNEL ) ;
647662 } ) ;
663+ // Ctrl+wheel never reaches the menu accelerators: Chromium reports it here
664+ // and leaves applying the zoom to the app. A preview guest under the
665+ // pointer emits this on its own webContents and keeps its own zoom.
666+ window . webContents . on ( "zoom-changed" , ( _event , direction ) => {
667+ if ( window . isDestroyed ( ) ) return ;
668+ runFork ( zoomWindow ( window , direction ) ) ;
669+ } ) ;
648670
649671 window . on ( "page-title-updated" , ( event ) => {
650672 event . preventDefault ( ) ;
@@ -976,15 +998,7 @@ export const make = Effect.gen(function* () {
976998 if ( Option . isNone ( window ) || window . value . isDestroyed ( ) ) {
977999 return ;
9781000 }
979- const webContents = window . value . webContents ;
980- webContents . setZoomLevel (
981- direction === "reset" ? 0 : webContents . getZoomLevel ( ) + ( direction === "in" ? 0.5 : - 0.5 ) ,
982- ) ;
983- if ( environment . platform === "darwin" ) syncMacosWindowButtons ( window . value ) ;
984- // Chromium pushes the new level down to embedded guests, which would zoom
985- // the previewed page along with the app UI. The preview browser keeps its
986- // own zoom, so put each guest back where the preview left it.
987- yield * previewManager . reapplyZoom ( ) ;
1001+ yield * zoomWindow ( window . value , direction ) ;
9881002 } ) ,
9891003 runMainContentsCommand : Effect . fn ( "desktop.window.runMainContentsCommand" ) ( function * ( command ) {
9901004 yield * Effect . annotateCurrentSpan ( { command } ) ;
0 commit comments