mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
ENH:keyboard shortcut in macos
1.fix:global shortcut cannot use in webview panel 2.fix:ban original web-shortcut in webview 3.add cmd+q & cmd+h shortcut in macos 4.move some global shortcut to prepare panel Change-Id: I17ba3c86069dab92df754a319d0c0c3d77b34d74
This commit is contained in:
parent
042e17952c
commit
1a8e5295b2
4 changed files with 147 additions and 57 deletions
|
@ -2948,6 +2948,26 @@ std::string GUI_App::handle_web_request(std::string cmd)
|
|||
}
|
||||
else if (command_str.compare("begin_network_plugin_download") == 0) {
|
||||
CallAfter([this] { wxGetApp().ShowDownNetPluginDlg(); });
|
||||
}
|
||||
else if (command_str.compare("get_web_shortcut") == 0) {
|
||||
if (root.get_child_optional("key_event") != boost::none) {
|
||||
pt::ptree key_event_node = root.get_child("key_event");
|
||||
auto keyCode = key_event_node.get<int>("key");
|
||||
auto ctrlKey = key_event_node.get<bool>("ctrl");
|
||||
auto shiftKey = key_event_node.get<bool>("shift");
|
||||
auto cmdKey = key_event_node.get<bool>("cmd");
|
||||
|
||||
wxKeyEvent e(wxEVT_CHAR_HOOK);
|
||||
#ifdef __APPLE__
|
||||
e.SetControlDown(cmdKey);
|
||||
#else
|
||||
e.SetControlDown(ctrlKey);
|
||||
#endif
|
||||
e.SetShiftDown(shiftKey);
|
||||
e.m_keyCode = keyCode;
|
||||
e.SetEventObject(mainframe);
|
||||
wxPostEvent(mainframe, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue