Colby-CPU-Sim / CPUSim

GNU General Public License v3.0
52 stars 18 forks source link

The Apple Menu doesn't contain the correct menu items #84

Open moirage opened 7 years ago

moirage commented 7 years ago

When I build a Mac application, it correctly puts the menubar at the top of the screen like is done on a Mac, instead of at the top of the window. And it adds an Apple menu on the left end of the menu bar. However, there are two Quit menu items now: one in the Apple menu and one in the File menu. They both perform the same action. Also, there is no way to move the Preferences and About menu items to the Apple menu, as is standard for Mac applications. I think this is a JavaFX missing feature.

Nava2 commented 7 years ago

Looking this up took me here: SO. I then went into DesktopController and found this line. @djskrien do you know why this was commented out? It looks like it'd be the solution to fixing this issue. However, I don't have my Mac handy to try it and see.

djskrien commented 7 years ago

The reason I commented out that line, as the comment preceding the line says, was a bug it caused with undo/redo/cut/copy/paste/delete keyboard shortcuts. The RichTextFX TextArea we use for editing assembly language programs has built-in undo/redo/cut/copy/paste/delete keyboard shortcuts. These work just fine in CPU Sim on every platform except one: a Mac in which CPU Sim's menubar is at the top of the screen. If the menubar is at the top of the screen, then, when you use those keyboard shortcuts, the action is executed twice. Executing the action twice is not a problem with cut or copy, but pasting twice or undoing twice is not good. (The action is only executed once if you select the menu item with the mouse instead of using the keyboard shortcut.) I thought at first that it was a bug in TextArea, but I think it might be a bug in JavaFX on the Mac. I have been hoping that Java 9, when it appears, will have a fix. I haven't pursued the issue in a while.

Nava2 commented 7 years ago

For later, here is the repository of the component: https://github.com/TomasMikula/RichTextFX

Perhaps we can update the dependency, see if it fixes itself. If it doesn't, time to open a bug.