Allow Cmd-Shift-M to bring up 3dConnexion Spacemouse Dialog (EXCEPT on "Home" sub-screen) (#5598)

* Prevent Cmd-Shift-M from minimizing on Mac EXCEPT on "Home" sub-screen

The problem is that hitting "Cmd-Shift-M" on mac always minimizes the app, even though it should only minimize on "Cmd-M", and not on "Cmd-Shift-M".

The code that minimizes (using the WXWidgets "Iconize()" call) happens in MainFrame.cpp keyboard event loop.  The code that's checking, looks for "Cmd-M" but does not check for any other keyboard modifiers, so I added a check to ignore the event if Shift is pressed along with "Cmd-M".

There's a secondary issue that isn't really relevant to this bug in that the app will still minimize when pressing "Cmd-Shift-M", but ONLY on the "Home" sub-screen. (all other sub-screens work as they should).

I'm not sure why, but when the "Home" sub-screen is selected, the keyboard event loop (MainFrame.cpp, line 609), is called TWICE when "Cmd-Shift-<any key>" is pressed:

* Once where the event's wxKeyModifier (retrieved via `evt.GetModifiers()` is set to `wxMOD_CONTROL`  AND `wxMOD_SHIFT`.  (this is correct)
* Once where the event's wxKeyModifier  is **ONLY** set to `wxMOD_CONTROL` (this is wrong).

Again, this double-event (with the wrong modifiers) only happens when the user is on the "Home" sub-screen.  For the context of this bug the 3DConnexion preferences dialog isn't needed on the "Home" sub-screen so this secondary bug doesn't matter.  But it does make the UX odd where Cmd-Shift-M will minimize the app when the user is viewing the "Home" sub-screen, but not minimize the app when the user is viewing any other sub-screen.

* Merge branch 'main' into spacemouse_dialog
This commit is contained in:
Alex Tang 2024-06-07 07:14:41 -07:00 committed by GitHub
parent 4ee2193408
commit 06ef58ab3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -543,7 +543,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
if (evt.CmdDown() && (evt.GetKeyCode() == 'H')) {
//call parent_menu hide behavior
return;}
if (evt.CmdDown() && (evt.GetKeyCode() == 'M')) {
if (evt.CmdDown() && (!evt.ShiftDown()) && (evt.GetKeyCode() == 'M')) {
this->Iconize();
return;
}