-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS support #65
base: master
Are you sure you want to change the base?
macOS support #65
Conversation
Ported down to macOS 10.13, the oldest version supported by OSX-KVM and virtualbox-macos
Apparently Rosetta should be able to support -march=x86-64-v2 but I'm too scared to find out.
On macOS 10.13: - App icon didn't show - App launched interpreting the -psn_* argument as a tilemap
Also fixed some cases where the menu wouldn't be updated
Builds fine on linux again. Homogenized linux instructions with macos scripts.
The command+shift+f fullscreen menu item toggle doesn't correspond to the OS's native idea of fullscreen. And using command+shift+f to enter fullscreen does not enter proper fullscreen. Pressing the native fullscreen button to enter fullscreen and then command+shift+f to "enter" fullscreen again crashes: details
|
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): main-window.cpp // 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
} main.cpp if (window->full_screen()) {
+#ifdef __APPLE__
+ cocoa_fullscreen(window, true);
+#else
window->fullscreen();
+#endif
} |
|
Entering proper fullscreen mode, then opening the help window, then closing the help window causes a segfault: details
|
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the only other few changes I made besides the bugfixes for fullscreen and the menu bar that I already mentioned.
NSBackTabCharacter = 0x0019, | ||
NSDeleteCharacter = 0x007f, | ||
NSLineSeparatorCharacter = 0x2028, | ||
NSParagraphSeparatorCharacter = 0x2029 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few entries here which may or may not come in handy for tilemap studio/polished map:
NSEscapeCharacter = 0x001b,
NSUpArrowFunctionKey = 0xf700,
NSDownArrowFunctionKey = 0xf701,
NSLeftArrowFunctionKey = 0xf702,
NSRightArrowFunctionKey = 0xf703
#define SHIFT_KEY_PLUS SHIFT_KEY "+" | ||
#define COMMAND_SHIFT_KEYS_PLUS COMMAND_KEY_PLUS SHIFT_KEY_PLUS | ||
#define COMMAND_ALT_KEYS_PLUS COMMAND_KEY_PLUS ALT_KEY_PLUS | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added several more defines in here to avoid a bunch of ifdefs in main-window:
#ifdef __APPLE__
[...]
#define BACKSPACE_KEY NSBackspaceCharacter
#define DELETE_KEY FL_COMMAND + NSBackspaceCharacter
#define TAB_KEY NSTabCharacter
#define ESCAPE_KEY NSEscapeCharacter
#define UP_KEY NSUpArrowFunctionKey
#define DOWN_KEY NSDownArrowFunctionKey
#define LEFT_KEY NSLeftArrowFunctionKey
#define RIGHT_KEY NSRightArrowFunctionKey
#define FULLSCREEN_KEY FL_COMMAND + FL_SHIFT + 'f'
#else
[...]
#define BACKSPACE_KEY FL_BackSpace
#define DELETE_KEY FL_Delete
#define TAB_KEY FL_Tab
#define ESCAPE_KEY FL_Escape
#define UP_KEY FL_Up
#define DOWN_KEY FL_Down
#define LEFT_KEY FL_Left
#define RIGHT_KEY FL_Right
#define FULLSCREEN_KEY FL_F + 11
#endif
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). 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: dannye/crystal-tracker@f2fa195 |
No description provided.