Open mid-kid opened 2 years ago
This workaround mostly fixes it (using either method will always toggle, sys menu bar is always accessible, preferences are saved correctly), although using the native fullscreen button doesn't update the view menu checkbox (purely visual):
// Save global config
Preferences::set("theme", (int)OS::current_theme());
+#ifdef __APPLE__
+ if (cocoa_is_fullscreen(mw)) {
+#else
if (mw->full_screen()) {
+#endif
void Main_Window::full_screen_cb(Fl_Menu_ *m, Main_Window *mw) {
+#ifdef __APPLE__
+ if (!cocoa_is_fullscreen(mw)) {
+ mw->_wx = mw->x(); mw->_wy = mw->y();
+ mw->_ww = mw->w(); mw->_wh = mw->h();
+ cocoa_fullscreen(mw, true);
+ mw->_full_screen_mi->set();
+ }
+ else {
+ cocoa_fullscreen(mw, false);
+ mw->_full_screen_mi->clear();
+ }
+#else
if (m->mvalue()->value()) {
mw->_wx = mw->x(); mw->_wy = mw->y();
mw->_ww = mw->w(); mw->_wh = mw->h();
mw->fullscreen();
}
else {
mw->fullscreen_off();
mw->resize(mw->_wx, mw->_wy, mw->_ww, mw->_wh);
}
+#endif
}
if (window->full_screen()) {
+#ifdef __APPLE__
+ cocoa_fullscreen(window, true);
+#else
window->fullscreen();
+#endif
}
grid_cb()
/rainbow_tiles_cb()
/bold_palettes_cb()
need mw->_menu_bar->update();
to update the checkbox state in the sys menu bar.
Entering proper fullscreen mode, then opening the help window, then closing the help window causes a segfault:
I indeed didn't bother to implement os-native full screening because I couldn't easily figure it out. I considered this less important with regards to getting any release of this tool onto mac os at all.
Found another type of bug today.
Modal windows can now be stacked thanks to the shortcuts in the system menu bar always being active (even when there is a modal window which is supposed to grab all events, which is usually what blocks the main window's menu bar shortcuts).
For example, you can press Cmd+E to open the Resize dialog and then immediately press Cmd+W to open the "unsaved changes" dialog (if the file has unsaved changes). (Clicking into the sys menu bar with the mouse also works.)
From here, you can click OK to close the file but the Resize dialog remains open. Pressing OK in the resize dialog creates a tilemap with no filename.
This can also be used to open all the tools in the Tools menu simultaneously, but this may possibly be harmless.
(Edit: I fixed this in crystal-tracker here: https://github.com/dannye/crystal-tracker/commit/f2fa19500c7603cf15497a73e4355072233f7fb4
by adding if (Fl::modal()) return;
to the very start of every callback that has any potential to open a modal.)
The command+shift+f fullscreen menu item toggle doesn't correspond to the OS's native idea of fullscreen. (ie, pressing the native, green fullscreen button in the top-left of the window enters proper fullscreen but doesn't set
_full_screen_mi->value()
.)And using command+shift+f to enter fullscreen does not enter proper fullscreen. (the sys menu bar is inaccessible because it doesn't slide down when the cursor is pressed against the top edge)
Pressing the native fullscreen button to enter fullscreen and then command+shift+f to "enter" fullscreen again crashes:
details
``` Process: tilemapstudio [88819] Path: /Users/USER/*/tilemapstudio Identifier: tilemapstudio Version: 0 Code Type: X86-64 (Native) Parent Process: bash [47856] Responsible: Terminal [47852] User ID: 501 Date/Time: 2022-08-20 10:55:47.902 -0500 OS Version: macOS 11.4 (20F71) Report Version: 12 Anonymous UUID: C13E08C3-74CA-2349-7C54-7395585CE5F0 Sleep/Wake UUID: F7547D80-EA4B-4A10-9B96-69156344CF86 Time Awake Since Boot: 480000 seconds Time Since Wake: 930 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Application Specific Information: *** Terminating app due to uncaught exception 'NSGenericException', reason: 'NSWindowStyleMaskFullScreen cleared on a window outside of a full screen transition. Called from ( 0 AppKit 0x00007fff22d65dca __25-[NSWindow setStyleMask:]_block_invoke + 125 1 AppKit 0x00007fff22d65cf3 NSPerformVisuallyAtomicChange + 132 2 AppKit 0x00007fff22d65c00 -[NSWindow setStyleMask:] + 170 3 tilemapstudio 0x000000010bad6436 _ZN9Fl_Window12fullscreen_xEv + 88 4 tilemapstudio 0x000000010baffbd6 _ZN8Fl_Menu_6pickedEPK12Fl_Menu_Item + 134 5 tilemapstudio 0x000000010badd468 -[FLMenuItem itemCallback:] + 50 6 tilemapstudio 0x000000010badd658 -[FLMenuItem doCallback] + 41 7 AppKit 0x00007fff22f3470b -[NSApplication(NSResponder) sendAction:to:from:] + 288 8 AppKit 0x00007fff23037749 -[NSMenuItem _corePerformAction] + 413 9 AppKit 0x00007fff23037468 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 95 10 AppKit 0x00007fff230364b5 -[NSMenu performKeyEquivalent:] + 412 11 tilemapstudio 0x000000010badde0d _ZL26process_sys_menu_shortcutsi + 127 12 tilemapstudio 0x000000010badf37b _ZN2Fl7handle_EiP9Fl_Window + 1569 13 tilemapstudio 0x000000010badf18c _ZN2Fl7handle_EiP9Fl_Window + 1074 14 tilemapstudio 0x000000010bad494c -[FLView performKeyEquivalent:] + 193 15 AppKit 0x00007fff230358c6 -[NSView performKeyEquivalent:] + 189 16 AppKit 0x00007fff235c7531 -[NSWindow _commonPerformKeyEquivalent:conditionally:] + 73 17 AppKit 0x00007fff2348d88b routeKeyEquivalent + 162 18 AppKit 0x00007fff22e9b57f -[NSApplication(NSEvent) sendEvent:] + 1147 19 tilemapstudio 0x000000010bad10d1 _Z21fl_mac_flush_and_waitd + 534 20 tilemapstudio 0x000000010bade637 _ZN2Fl3runEv + 19 21 libdyld.dylib 0x00007fff20436f5d start + 1 22 ??? 0x0000000000000001 0x0 + 1 )' abort() called terminating with uncaught exception of type NSException Application Specific Backtrace 1: 0 CoreFoundation 0x00007fff2058e87b __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff202c6d92 objc_exception_throw + 48 2 CoreFoundation 0x00007fff2058e6df +[NSException raise:format:] + 189 3 AppKit 0x00007fff22d65e07 __25-[NSWindow setStyleMask:]_block_invoke + 186 4 AppKit 0x00007fff22d65cf3 NSPerformVisuallyAtomicChange + 132 5 AppKit 0x00007fff22d65c00 -[NSWindow setStyleMask:] + 170 6 tilemapstudio 0x000000010bad6436 _ZN9Fl_Window12fullscreen_xEv + 88 7 tilemapstudio 0x000000010baffbd6 _ZN8Fl_Menu_6pickedEPK12Fl_Menu_Item + 134 8 tilemapstudio 0x000000010badd468 -[FLMenuItem itemCallback:] + 50 9 tilemapstudio 0x000000010badd658 -[FLMenuItem doCallback] + 41 10 AppKit 0x00007fff22f3470b -[NSApplication(NSResponder) sendAction:to:from:] + 288 11 AppKit 0x00007fff23037749 -[NSMenuItem _corePerformAction] + 413 12 AppKit 0x00007fff23037468 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 95 13 AppKit 0x00007fff230364b5 -[NSMenu performKeyEquivalent:] + 412 14 tilemapstudio 0x000000010badde0d _ZL26process_sys_menu_shortcutsi + 127 15 tilemapstudio 0x000000010badf37b _ZN2Fl7handle_EiP9Fl_Window + 1569 16 tilemapstudio 0x000000010badf18c _ZN2Fl7handle_EiP9Fl_Window + 1074 17 tilemapstudio 0x000000010bad494c -[FLView performKeyEquivalent:] + 193 18 AppKit 0x00007fff230358c6 -[NSView performKeyEquivalent:] + 189 19 AppKit 0x00007fff235c7531 -[NSWindow _commonPerformKeyEquivalent:conditionally:] + 73 20 AppKit 0x00007fff2348d88b routeKeyEquivalent + 162 21 AppKit 0x00007fff22e9b57f -[NSApplication(NSEvent) sendEvent:] + 1147 22 tilemapstudio 0x000000010bad10d1 _Z21fl_mac_flush_and_waitd + 534 23 tilemapstudio 0x000000010bade637 _ZN2Fl3runEv + 19 24 libdyld.dylib 0x00007fff20436f5d start + 1 25 ??? 0x0000000000000001 0x0 + 1 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x00007fff203ec92e __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fff2041b5bd pthread_kill + 263 2 libsystem_c.dylib 0x00007fff20370411 abort + 120 3 libc++abi.dylib 0x00007fff203deef2 abort_message + 241 4 libc++abi.dylib 0x00007fff203d05fd demangling_terminate_handler() + 266 5 libobjc.A.dylib 0x00007fff202c958d _objc_terminate() + 96 6 libc++abi.dylib 0x00007fff203de307 std::__terminate(void (*)()) + 8 7 libc++abi.dylib 0x00007fff203e0dd1 __cxa_rethrow + 99 8 libobjc.A.dylib 0x00007fff202c7110 objc_exception_rethrow + 37 9 com.apple.AppKit 0x00007fff235c7581 -[NSWindow _commonPerformKeyEquivalent:conditionally:] + 153 10 com.apple.AppKit 0x00007fff2348d88b routeKeyEquivalent + 162 11 com.apple.AppKit 0x00007fff22e9b57f -[NSApplication(NSEvent) sendEvent:] + 1147 12 tilemapstudio 0x000000010bad10d1 fl_mac_flush_and_wait(double) + 534 13 tilemapstudio 0x000000010bade637 Fl::run() + 19 14 libdyld.dylib 0x00007fff20436f5d start + 1 Thread 1: 0 libsystem_pthread.dylib 0x00007fff20417420 start_wqthread + 0 Thread 2: 0 libsystem_pthread.dylib 0x00007fff20417420 start_wqthread + 0 Thread 3: 0 libsystem_pthread.dylib 0x00007fff20417420 start_wqthread + 0 Thread 4:: com.apple.NSEventThread 0 libsystem_kernel.dylib 0x00007fff203e62ba mach_msg_trap + 10 1 libsystem_kernel.dylib 0x00007fff203e662c mach_msg + 60 2 com.apple.CoreFoundation 0x00007fff20514b5f __CFRunLoopServiceMachPort + 316 3 com.apple.CoreFoundation 0x00007fff2051323f __CFRunLoopRun + 1328 4 com.apple.CoreFoundation 0x00007fff2051264c CFRunLoopRunSpecific + 563 5 com.apple.AppKit 0x00007fff22e9968a _NSEventThread + 124 6 libsystem_pthread.dylib 0x00007fff2041b8fc _pthread_start + 224 7 libsystem_pthread.dylib 0x00007fff20417443 thread_start + 15 Thread 5: 0 libsystem_pthread.dylib 0x00007fff20417420 start_wqthread + 0 Thread 6: 0 libsystem_pthread.dylib 0x00007fff20417420 start_wqthread + 0 Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000000000000 rbx: 0x0000000110181e00 rcx: 0x00007ffee4134198 rdx: 0x0000000000000000 rdi: 0x0000000000000103 rsi: 0x0000000000000006 rbp: 0x00007ffee41341c0 rsp: 0x00007ffee4134198 r8: 0x00007ffee4134060 r9: 0x0000000000000000 r10: 0x0000000110181e00 r11: 0x0000000000000246 r12: 0x0000000000000103 r13: 0x0000003000000008 r14: 0x0000000000000006 r15: 0x0000000000000016 rip: 0x00007fff203ec92e rfl: 0x0000000000000246 cr2: 0x00007fbacb1a4000 Logical CPU: 0 Error Code: 0x02000148 Trap Number: 133 Thread 0 instruction stream not available. Thread 0 last branch register state not available. Binary Images: 0x10bacb000 - 0x10bba2fff +tilemapstudio (0)