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
NetLogo 3D on Mac OS X 10.6/7: menu items grayed out, unusable with mouse #47
Comments
I don't know how to work around this in our code. If anyone out there knows Swing and wants to take a crack at it, it would be much appreciated. |
I wonder if this still happens in Oracle's Java 7 for Mac. |
This bug still happens in OSX 10.9.1 with 5.0.5 |
@frankduncan writes:
|
iirc, in Swing modal dialogs work a funny way, where the original event dispatch thread is suspended, and a new thread is created for the modal dialog, but for the duration of the dialog, the new thread is the event dispatch thread. what's your evidence that this is a threading issue? |
If I execute the new model action in the running thread instead of booting a modal dialog, it does not disable. Also http://stackoverflow.com/questions/13754955/java-menu-on-mac-grayed-out-on-change-focus |
checking iirc for normal models the modal dialog during loading isn't really necessary, but some models might take a long time to load, e.g. if the world is really big (which is especially likely to be the case in 3D), in which case the progress dialog is nice to have, but not critical |
Alrighty, after some more investigation, this is what I've found. If the ModalProgressTask is not modal, everything works as you'd like. If we don't use the ModalProgressTask, everythings as you'd like. And here's the kicker. If, after letting the other thread come back, with the ModalProgressTask being modal, we then setVisible(true) on it again, starting up another thread that does nothing but return immediately and hide/dispose the ModalProgressTask, everything works as you'd like! My best guess at this time is that OSX is doing something funny because the frame that gets focus (when opening a new model) after the modal dialog closes is the 3D view, something that has no menu items. As an aside, I attempted to also solve this by attaching the menu to the application in OSX, rather than to the JFrame, but that broke many things in many odd ways (does netlogo count on the menu being attached to the jframe for other purposes? That is an interesting question) I'm currently leaning toward re-opening the modal dialog for zero time, as that keeps it nice and modal and has the best user experience. The stuff about threads was, while highly informative as I looked all the stuff up, unfortunately a red herring. |
As an addendum, I would only open the modal dialog for zero time if on a mac and in 3d mode, since that makes it clearer that this is due to odd behavior and shouldn't be removed. |
sgtm |
PR #622 |
Fix #47! Add doubled modal popup for weird OSX issue
WORKAROUND: Corey Brady discovered that you can re-enable the menus by opening a modal dialog and then closing it again. For example, a quick way is to press Command-M to open the Models Library dialog with Command-M, then press Esc key to dismiss it.
the keyboard shortcuts for the grayed out menu items still work, so it's clearly Apple's bug. though it would be good if we could find some kind of workaround to put in the code so users don't have to use the workaround above
a user reports that Mac OS X 10.5 works fine. it's broken on 10.6 and 10.7
both NetLogo 3D 4 and 5 are affected
The text was updated successfully, but these errors were encountered: