tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
82.3k stars 2.47k forks source link

[bug] - Cannot exit fullscreen on macOS #7851

Open 0xDevrim opened 1 year ago

0xDevrim commented 1 year ago

Describe the bug

Cannot exit fullscreen on macOS on a window created on front-end.

Reproduction

  1. Create a new window

    const webview = new WebviewWindow(id, {
    url: `...`,
    maximized: true,
    });
  2. Go fullscreen on the newly created window

    import { appWindow } from "@tauri-apps/api/window";
    ...
    appWindow.setFullscreen(true)
    .then()
    .catch(error => {
    console.log('e: ', error);
    })
  3. Exit fullscreen

    appWindow.setFullscreen(false)
    .then(()=> {
    console.log('fs');
    })
    .catch(error => {
    console.log('e: ', error);
    })

Expected behavior

Exit fullscreen mode successfully.

Platform and versions

[✔] Environment
    - OS: Mac OS 13.1.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.71.1 (eb26296b5 2023-08-03)
    ✔ Cargo: 1.71.1 (7f1d04c00 2023-07-29)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 16.18.1
    - yarn: 1.22.19
    - npm: 8.19.2

[-] Packages
    - tauri [RUST]: 1.4.1
    - tauri-build [RUST]: 1.4.0
    - wry [RUST]: 0.24.3
    - tao [RUST]: 0.16.2
    - @tauri-apps/api [NPM]: 1.4.0
    - @tauri-apps/cli [NPM]: 1.4.0

[-] App
    - build-type: bundle
    - CSP: default-src 'self' *.{mydomain}.net, asset:, https://asset.localhost; style-src 'self' *.{mydomain}.net, asset:, https://asset.localhost; img-src 'self' *.{mydomain}.net, asset:, https://asset.localhost; font-src 'self' *.{mydomain}.net, asset:, https://asset.localhost; media-src 'self' *.{mydomain}.net, asset:, https://asset.localhost; object-src 'self' *.{mydomain}.net, asset:, https://asset.localhost; prefetch-src 'self' *.{mydomain}.net, asset:, https://asset.localhost; child-src 'self' *.{mydomain}.net, asset:, https://asset.localhost; frame-src 'self' *.{mydomain}.net, asset:, https://asset.localhost; frame-ancestors 'self' *.{mydomain}.net, asset:, https://asset.localhost
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

1   HIToolbox                           0x00000001b38805c8 _ZN15MenuBarInstance22EnsureAutoShowObserverEv + 120
2   HIToolbox                           0x00000001b3880188 _ZN15MenuBarInstance14EnableAutoShowEv + 60
3   HIToolbox                           0x00000001b37ed8bc _ZN15MenuBarInstance21UpdateAggregateUIModeE21MenuBarAnimationStylehhh + 1184
4   HIToolbox                           0x00000001b3880004 _ZN15MenuBarInstance19SetFullScreenUIModeEjj + 180
5   AppKit                              0x00000001ad676008 -[NSApplication _setPresentationOptions:instance:flags:] + 956
6   AppKit                              0x00000001ad50bbb0 -[NSApplication _updateFullScreenPresentationOptionsForInstance:] + 404
7   CoreFoundation                      0x00000001aa12d570 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
8   CoreFoundation                      0x00000001aa1cb054 ___CFXRegistrationPost_block_invoke + 88
9   CoreFoundation                      0x00000001aa1caf9c _CFXRegistrationPost + 440
10  CoreFoundation                      0x00000001aa0feb74 _CFXNotificationPost + 708
11  Foundation                          0x00000001aafec72c -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
12  AppKit                              0x00000001ad67658c spacesNotificationHandler + 96
13  SkyLight                            0x00000001aed604dc _ZN12_GLOBAL__N_123notify_datagram_handlerEj15CGSDatagramTypePvmS1_ + 896
14  SkyLight                            0x00000001af08c4c4 _ZN21CGSDatagramReadStream26dispatchMainQueueDatagramsEv + 228
15  SkyLight                            0x00000001af08c3c0 ___ZN21CGSDatagramReadStream15mainQueueWakeupEv_block_invoke + 28
16  libdispatch.dylib                   0x00000001a9ed09dc _dispatch_call_block_and_release + 32
17  libdispatch.dylib                   0x00000001a9ed2504 _dispatch_client_callout + 20
18  libdispatch.dylib                   0x00000001a9ee0d1c _dispatch_main_queue_drain + 928
19  libdispatch.dylib                   0x00000001a9ee096c _dispatch_main_queue_callback_4CF + 44
20  CoreFoundation                      0x00000001aa179d50 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
21  CoreFoundation                      0x00000001aa1377d0 __CFRunLoopRun + 2036
22  CoreFoundation                      0x00000001aa136888 CFRunLoopRunSpecific + 612
23  HIToolbox                           0x00000001b380bfa0 RunCurrentEventLoopInMode + 292
24  HIToolbox                           0x00000001b380bde4 ReceiveNextEventCommon + 672
25  HIToolbox                           0x00000001b380bb2c _BlockUntilNextEventMatchingListInModeWithFilter + 72
26  AppKit                              0x00000001ad3b8424 _DPSNextEvent + 632
27  AppKit                              0x00000001ad3b75b4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
28  AppKit                              0x00000001ad3ab9e4 -[NSApplication run] + 464
29  {bundle}                          0x0000000101381764 _ZN60_$LT$$LP$$RP$$u20$as$u20$objc..message..MessageArguments$GT$6invoke17h0615565dea008511E + 64
30  {bundle}                          0x0000000101385cf8 _ZN4objc7message8platform15send_unverified28_$u7b$$u7b$closure$u7d$$u7d$17h0c4ee8130af35f12E + 52
31  {bundle}                          0x0000000101384814 _ZN14objc_exception3try28_$u7b$$u7b$closure$u7d$$u7d$17ha2716e576b97b0ceE + 44
32  {bundle}                          0x0000000101383204 _ZN14objc_exception10try_no_ret24try_objc_execute_closure17h7720bee02e6d0b17E + 76
33  {bundle}                          0x00000001013902e8 RustObjCExceptionTryCatch + 36
34  {bundle}                          0x0000000101381f40 _ZN14objc_exception10try_no_ret17h2a539adefe458226E + 168
35  {bundle}                          0x00000001013838f4 _ZN14objc_exception3try17h52107131436dcd17E + 72
36  {bundle}                          0x0000000101388d7c _ZN4objc9exception3try17h05c41c44a3be7534E + 12
37  {bundle}                          0x0000000101384c90 _ZN4objc7message8platform15send_unverified17h0830e7e8951f3f31E + 136
38  {bundle}                          0x0000000100f720f4 _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$10run_return17h8be7bc1c7429b32eE + 1120
39  {bundle}                          0x0000000100f73118 _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$3run17hef553920fce2ef49E + 20
40  {bundle}                          0x0000000100cc38bc _ZN3tao10event_loop30EventLoopWindowTarget$LT$T$GT$23set_device_event_filter17h4efa93e5fa9b273fE + 0
41  {bundle}                          0x0000000100c8b48c _ZN83_$LT$tauri_runtime_wry..Wry$LT$T$GT$$u20$as$u20$tauri_runtime..Runtime$LT$T$GT$$GT$3run17hf1b83808b370318bE + 704
42  {bundle}                          0x0000000100c4ff7c _ZN5tauri3app12App$LT$R$GT$3run17h16fbe4e09c35a168E + 280
43  {bundle}                          0x0000000100c502a4 _ZN5tauri3app16Builder$LT$R$GT$3run17h673cdc874809f42cE + 120
44  {bundle}                          0x0000000100d30c78 _ZN10{bundle}4main28_$u7b$$u7b$closure$u7d$$u7d$17h66743b76ae40d524E + 12692
45  {bundle}                          0x0000000100d330bc _ZN5tokio7runtime4park16CachedParkThread8block_on28_$u7b$$u7b$closure$u7d$$u7d$17hcebb6e22b2ef096cE + 56
46  {bundle}                          0x0000000100d32f9c _ZN5tokio7runtime4park16CachedParkThread8block_on17h80bba96b5966eecbE + 680
47  {bundle}                          0x0000000100d5bb10 _ZN5tokio7runtime7context8blocking19BlockingRegionGuard8block_on17h248a1d1b992b8eb4E + 100
48  {bundle}                          0x0000000100de40b0 _ZN5tokio7runtime9scheduler12multi_thread11MultiThread8block_on28_$u7b$$u7b$closure$u7d$$u7d$17hda9695213b52da5eE + 56
49  {bundle}                          0x0000000100c2ff6c _ZN5tokio7runtime7context7runtime13enter_runtime17h136018d436b806f0E + 240
50  {bundle}                          0x0000000100de406c _ZN5tokio7runtime9scheduler12multi_thread11MultiThread8block_on17he9860fdcbb8d86ebE + 76
51  {bundle}                          0x0000000100ef86cc _ZN5tokio7runtime7runtime7Runtime8block_on17h2ac3f68b90e1c420E + 204
52  {bundle}                          0x0000000100f7099c _ZN10{bundle}4main17h9bfaef7ee802f7beE + 164
53  {bundle}                          0x0000000100ce4444 _ZN4core3ops8function6FnOnce9call_once17h34a6e6f6c454c9a4E + 20
54  {bundle}                          0x0000000100f0a568 _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h6a0f5dbc60d0dcbfE + 24
55  {bundle}                          0x0000000100e27734 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hd7653907f19f2fedE + 28
56  {bundle}                          0x0000000101a338a8 _ZN3std2rt19lang_start_internal17hdd06e3566639fc5bE + 648
57  {bundle}                          0x0000000100e27700 _ZN3std2rt10lang_start17h547917a13bc98fceE + 84
58  {bundle}                          0x0000000100f70a18 main + 36
59  dyld                                0x00000001a9d2fe50 start + 2544
1   HIToolbox                           0x00000001b380b90c _ZN15MenuBarInstance22RemoveAutoShowObserverEv + 44
2   HIToolbox                           0x00000001b384a478 _ZL17BroadcastInternaljPvh + 184
3   SkyLight                            0x00000001aed604dc _ZN12_GLOBAL__N_123notify_datagram_handlerEj15CGSDatagramTypePvmS1_ + 896
4   SkyLight                            0x00000001af08c4c4 _ZN21CGSDatagramReadStream26dispatchMainQueueDatagramsEv + 228
5   SkyLight                            0x00000001af08c3c0 ___ZN21CGSDatagramReadStream15mainQueueWakeupEv_block_invoke + 28
6   libdispatch.dylib                   0x00000001a9ed09dc _dispatch_call_block_and_release + 32
7   libdispatch.dylib                   0x00000001a9ed2504 _dispatch_client_callout + 20
8   libdispatch.dylib                   0x00000001a9ee0d1c _dispatch_main_queue_drain + 928
9   libdispatch.dylib                   0x00000001a9ee096c _dispatch_main_queue_callback_4CF + 44
10  CoreFoundation                      0x00000001aa179d50 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
11  CoreFoundation                      0x00000001aa1377d0 __CFRunLoopRun + 2036
12  CoreFoundation                      0x00000001aa136888 CFRunLoopRunSpecific + 612
13  HIToolbox                           0x00000001b380bfa0 RunCurrentEventLoopInMode + 292
14  HIToolbox                           0x00000001b380bde4 ReceiveNextEventCommon + 672
15  HIToolbox                           0x00000001b380bb2c _BlockUntilNextEventMatchingListInModeWithFilter + 72
16  AppKit                              0x00000001ad3b8424 _DPSNextEvent + 632
17  AppKit                              0x00000001ad3b75b4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
18  AppKit                              0x00000001ad3ab9e4 -[NSApplication run] + 464
19  {bundle}                          0x0000000101381764 _ZN60_$LT$$LP$$RP$$u20$as$u20$objc..message..MessageArguments$GT$6invoke17h0615565dea008511E + 64
20  {bundle}                          0x0000000101385cf8 _ZN4objc7message8platform15send_unverified28_$u7b$$u7b$closure$u7d$$u7d$17h0c4ee8130af35f12E + 52
21  {bundle}                          0x0000000101384814 _ZN14objc_exception3try28_$u7b$$u7b$closure$u7d$$u7d$17ha2716e576b97b0ceE + 44
22  {bundle}                          0x0000000101383204 _ZN14objc_exception10try_no_ret24try_objc_execute_closure17h7720bee02e6d0b17E + 76
23  {bundle}                          0x00000001013902e8 RustObjCExceptionTryCatch + 36
24  {bundle}                          0x0000000101381f40 _ZN14objc_exception10try_no_ret17h2a539adefe458226E + 168
25  {bundle}                          0x00000001013838f4 _ZN14objc_exception3try17h52107131436dcd17E + 72
26  {bundle}                          0x0000000101388d7c _ZN4objc9exception3try17h05c41c44a3be7534E + 12
27  {bundle}                          0x0000000101384c90 _ZN4objc7message8platform15send_unverified17h0830e7e8951f3f31E + 136
28  {bundle}                          0x0000000100f720f4 _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$10run_return17h8be7bc1c7429b32eE + 1120
29  {bundle}                          0x0000000100f73118 _ZN3tao13platform_impl8platform10event_loop18EventLoop$LT$T$GT$3run17hef553920fce2ef49E + 20
30  {bundle}                          0x0000000100cc38bc _ZN3tao10event_loop30EventLoopWindowTarget$LT$T$GT$23set_device_event_filter17h4efa93e5fa9b273fE + 0
31  {bundle}                          0x0000000100c8b48c _ZN83_$LT$tauri_runtime_wry..Wry$LT$T$GT$$u20$as$u20$tauri_runtime..Runtime$LT$T$GT$$GT$3run17hf1b83808b370318bE + 704
32  {bundle}                          0x0000000100c4ff7c _ZN5tauri3app12App$LT$R$GT$3run17h16fbe4e09c35a168E + 280
33  {bundle}                          0x0000000100c502a4 _ZN5tauri3app16Builder$LT$R$GT$3run17h673cdc874809f42cE + 120
34  {bundle}                          0x0000000100d30c78 _ZN10{bundle}4main28_$u7b$$u7b$closure$u7d$$u7d$17h66743b76ae40d524E + 12692
35  {bundle}                          0x0000000100d330bc _ZN5tokio7runtime4park16CachedParkThread8block_on28_$u7b$$u7b$closure$u7d$$u7d$17hcebb6e22b2ef096cE + 56
36  {bundle}                          0x0000000100d32f9c _ZN5tokio7runtime4park16CachedParkThread8block_on17h80bba96b5966eecbE + 680
37  {bundle}                          0x0000000100d5bb10 _ZN5tokio7runtime7context8blocking19BlockingRegionGuard8block_on17h248a1d1b992b8eb4E + 100
38  {bundle}                          0x0000000100de40b0 _ZN5tokio7runtime9scheduler12multi_thread11MultiThread8block_on28_$u7b$$u7b$closure$u7d$$u7d$17hda9695213b52da5eE + 56
39  {bundle}                          0x0000000100c2ff6c _ZN5tokio7runtime7context7runtime13enter_runtime17h136018d436b806f0E + 240
40  {bundle}                          0x0000000100de406c _ZN5tokio7runtime9scheduler12multi_thread11MultiThread8block_on17he9860fdcbb8d86ebE + 76
41  {bundle}                          0x0000000100ef86cc _ZN5tokio7runtime7runtime7Runtime8block_on17h2ac3f68b90e1c420E + 204
42  {bundle}                          0x0000000100f7099c _ZN10{bundle}4main17h9bfaef7ee802f7beE + 164
43  {bundle}                          0x0000000100ce4444 _ZN4core3ops8function6FnOnce9call_once17h34a6e6f6c454c9a4E + 20
44  {bundle}                          0x0000000100f0a568 _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h6a0f5dbc60d0dcbfE + 24
45  {bundle}                          0x0000000100e27734 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hd7653907f19f2fedE + 28
46  {bundle}                          0x0000000101a338a8 _ZN3std2rt19lang_start_internal17hdd06e3566639fc5bE + 648
47  {bundle}                          0x0000000100e27700 _ZN3std2rt10lang_start17h547917a13bc98fceE + 84
48  {bundle}                          0x0000000100f70a18 main + 36
49  dyld                                0x00000001a9d2fe50 start + 2544

Additional context

Just a basic go fullscreen / exit fullscreen functionality on a window created via js. Not doing anything special. No error on JS side but stack trace added is from the terminal window.

pewsheen commented 1 year ago

Hi, could you provide a minimal reproducible repo? I couldn't reproduce the issue on my side. Maybe there's something I'm missing.