Tech ENABLE_CTRL_M_ON_WINDOWS [Experimental] to re-enable imgui dialog for settings of 3DConnexion devices (CTRL+M) on Windows

This commit is contained in:
enricoturri1966 2020-11-03 08:41:04 +01:00
parent e6ddcbab0c
commit 30481e1ea8
6 changed files with 44 additions and 2 deletions

View File

@ -57,4 +57,11 @@
#define ENABLE_GCODE_VIEWER_DATA_CHECKING (0 && ENABLE_GCODE_VIEWER) #define ENABLE_GCODE_VIEWER_DATA_CHECKING (0 && ENABLE_GCODE_VIEWER)
//===================
// 2.3.0.alpha3 techs
//===================
#define ENABLE_2_3_0_ALPHA3 1
#define ENABLE_CTRL_M_ON_WINDOWS (1 && ENABLE_2_3_0_ALPHA3)
#endif // _prusaslicer_technologies_h_ #endif // _prusaslicer_technologies_h_

View File

@ -2934,6 +2934,15 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
post_event(SimpleEvent(EVT_GLTOOLBAR_COPY)); post_event(SimpleEvent(EVT_GLTOOLBAR_COPY));
break; break;
#if ENABLE_CTRL_M_ON_WINDOWS
case WXK_CONTROL_M:
{
Mouse3DController& controller = wxGetApp().plater()->get_mouse3d_controller();
controller.show_settings_dialog(!controller.is_settings_dialog_shown());
m_dirty = true;
break;
}
#else
#if defined(__linux__) || defined(__APPLE__) #if defined(__linux__) || defined(__APPLE__)
case WXK_CONTROL_M: case WXK_CONTROL_M:
{ {
@ -2943,6 +2952,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
break; break;
} }
#endif /* __linux__ */ #endif /* __linux__ */
#endif // ENABLE_CTRL_M_ON_WINDOWS
#ifdef __APPLE__ #ifdef __APPLE__
case 'v': case 'v':

View File

@ -178,9 +178,13 @@ void KBShortcutsDialog::fill_shortcuts()
{ "O", L("Zoom out") }, { "O", L("Zoom out") },
{ "Tab", L("Switch between Editor/Preview") }, { "Tab", L("Switch between Editor/Preview") },
{ "Shift+Tab", L("Collapse/Expand the sidebar") }, { "Shift+Tab", L("Collapse/Expand the sidebar") },
#if ENABLE_CTRL_M_ON_WINDOWS
{ ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") },
#else
#if defined(__linux__) || defined(__APPLE__) #if defined(__linux__) || defined(__APPLE__)
{ ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") }, { ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") },
#endif // __linux__ #endif // __linux__
#endif // ENABLE_CTRL_M_ON_WINDOWS
#if ENABLE_RENDER_PICKING_PASS #if ENABLE_RENDER_PICKING_PASS
// Don't localize debugging texts. // Don't localize debugging texts.
{ "P", "Toggle picking pass texture rendering on/off" }, { "P", "Toggle picking pass texture rendering on/off" },

View File

@ -115,10 +115,20 @@ void Mouse3DController::device_attached(const std::string &device)
// Never mind, enumeration will be performed until connected. // Never mind, enumeration will be performed until connected.
m_wakeup = true; m_wakeup = true;
m_stop_condition.notify_all(); m_stop_condition.notify_all();
} #if ENABLE_CTRL_M_ON_WINDOWS
m_connected = true;
#endif // ENABLE_CTRL_M_ON_WINDOWS
}
} }
} }
#if ENABLE_CTRL_M_ON_WINDOWS
void Mouse3DController::device_detached(const std::string& device)
{
m_connected = false;
}
#endif // ENABLE_CTRL_M_ON_WINDOWS
// Filter out mouse scroll events produced by the 3DConnexion driver. // Filter out mouse scroll events produced by the 3DConnexion driver.
bool Mouse3DController::State::process_mouse_wheel() bool Mouse3DController::State::process_mouse_wheel()
{ {
@ -863,6 +873,9 @@ bool Mouse3DController::handle_raw_input_win32(const unsigned char *data, const
DataPacketRaw packet; DataPacketRaw packet;
memcpy(packet.data(), data, packet_length); memcpy(packet.data(), data, packet_length);
handle_packet(packet, packet_length, m_params, m_state); handle_packet(packet, packet_length, m_params, m_state);
#if ENABLE_CTRL_M_ON_WINDOWS
m_connected = true;
#endif // ENABLE_CTRL_M_ON_WINDOWS
} }
return true; return true;

View File

@ -194,6 +194,9 @@ public:
// Called by Win32 HID enumeration callback. // Called by Win32 HID enumeration callback.
void device_attached(const std::string &device); void device_attached(const std::string &device);
#if ENABLE_CTRL_M_ON_WINDOWS
void device_detached(const std::string& device);
#endif // ENABLE_CTRL_M_ON_WINDOWS
// On Windows, the 3DConnexion driver sends out mouse wheel rotation events to an active application // On Windows, the 3DConnexion driver sends out mouse wheel rotation events to an active application
// if the application does not register at the driver. This is a workaround to ignore these superfluous // if the application does not register at the driver. This is a workaround to ignore these superfluous

View File

@ -2016,7 +2016,12 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
// is one of the 3D Mouse vendors (3DConnexion or Logitech). // is one of the 3D Mouse vendors (3DConnexion or Logitech).
this->q->Bind(EVT_HID_DEVICE_ATTACHED, [this](HIDDeviceAttachedEvent &evt) { this->q->Bind(EVT_HID_DEVICE_ATTACHED, [this](HIDDeviceAttachedEvent &evt) {
mouse3d_controller.device_attached(evt.data); mouse3d_controller.device_attached(evt.data);
}); });
#if ENABLE_CTRL_M_ON_WINDOWS
this->q->Bind(EVT_HID_DEVICE_DETACHED, [this](HIDDeviceAttachedEvent& evt) {
mouse3d_controller.device_detached(evt.data);
});
#endif // ENABLE_CTRL_M_ON_WINDOWS
#endif /* _WIN32 */ #endif /* _WIN32 */
notification_manager = new NotificationManager(this->q); notification_manager = new NotificationManager(this->q);