Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2019-06-13 14:00:46 +0300
committerYuSanka <yusanka@gmail.com>2019-06-13 14:00:46 +0300
commite00774d2e21319ddfacbad417f7dd7309e8f2f56 (patch)
tree615f6198bdd1cb5f956742a415aa72295b4277e1 /src/slic3r/GUI/GUI_ObjectLayers.cpp
parentc9dd5f878699e79d64ccb4059f37b8967e872270 (diff)
Workarounds for selection under OSX and GTK
Diffstat (limited to 'src/slic3r/GUI/GUI_ObjectLayers.cpp')
-rw-r--r--src/slic3r/GUI/GUI_ObjectLayers.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/slic3r/GUI/GUI_ObjectLayers.cpp b/src/slic3r/GUI/GUI_ObjectLayers.cpp
index df0c4faeb..12c1022ce 100644
--- a/src/slic3r/GUI/GUI_ObjectLayers.cpp
+++ b/src/slic3r/GUI/GUI_ObjectLayers.cpp
@@ -42,8 +42,19 @@ ObjectLayers::ObjectLayers(wxWindow* parent) :
void ObjectLayers::select_editor(LayerRangeEditor* editor, const bool is_last_edited_range)
{
if (is_last_edited_range && m_selection_type == editor->type()) {
+ /* Workaround! Under OSX we should use CallAfter() for SetFocus() after LayerEditors "reorganizations",
+ * because of selected control's strange behavior:
+ * cursor is set to the control, but blue border - doesn't.
+ * And as a result we couldn't edit this control.
+ * */
+#ifdef __WXOSX__
+ wxTheApp->CallAfter([editor]() {
+#endif
editor->SetFocus();
editor->SetInsertionPointEnd();
+#ifdef __WXOSX__
+ });
+#endif
}
}
@@ -239,11 +250,15 @@ LayerRangeEditor::LayerRangeEditor( wxWindow* parent,
this->Bind(wxEVT_KILL_FOCUS, [this, edit_fn](wxFocusEvent& e)
{
if (!m_enter_pressed) {
- // update data for next editor selection
+#ifndef __WXGTK__
+ /* Update data for next editor selection.
+ * But under GTK it lucks like there is no information about selected control at e.GetWindow(),
+ * so we'll take it from wxEVT_LEFT_DOWN event
+ * */
LayerRangeEditor* new_editor = dynamic_cast<LayerRangeEditor*>(e.GetWindow());
if (new_editor)
new_editor->set_focus();
-
+#endif // not __WXGTK__
// If LayersList wasn't updated/recreated, we should call e.Skip()
if (m_type & etLayerHeight) {
if (!edit_fn(get_value(), false))
@@ -263,6 +278,14 @@ LayerRangeEditor::LayerRangeEditor( wxWindow* parent,
}
}, this->GetId());
+#ifdef __WXGTK__ // Workaround! To take information about selectable range
+ this->Bind(wxEVT_LEFT_DOWN, [this](wxEvent& e)
+ {
+ set_focus();
+ e.Skip();
+ }, this->GetId());
+#endif //__WXGTK__
+
this->Bind(wxEVT_CHAR, ([this](wxKeyEvent& event)
{
// select all text using Ctrl+A