From 06ef58ab3e6a52e34bf05dcba6cb524dc9bf5456 Mon Sep 17 00:00:00 2001 From: Alex Tang Date: Fri, 7 Jun 2024 07:14:41 -0700 Subject: [PATCH] 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-" 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 --- src/slic3r/GUI/KBShortcutsDialog.cpp | 5 +++++ src/slic3r/GUI/MainFrame.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index 357a628cc7..bda65536b5 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -196,7 +196,12 @@ void KBShortcutsDialog::fill_shortcuts() // Configuration { ctrl + "P", L("Preferences") }, //3D control +#ifdef __APPLE__ + { ctrl + "Shift+M", L("Show/Hide 3Dconnexion devices settings dialog") }, +#else { ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") }, +#endif // __APPLE + // Switch table page { ctrl + "Tab", L("Switch table page")}, //DEL diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 24bc9423cb..68b3ed6665 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -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; }