From 7858cd6b6a4df66f18fb30e3555170b30817531a Mon Sep 17 00:00:00 2001 From: Tommaso Bianchi Date: Mon, 20 Jul 2026 10:14:02 +0200 Subject: [PATCH] Sketch: open the dimension field on the right monitor, and stop it freezing the view Ports snaporca-cad c741fb9677. SketchInlineEditor::open() clamped its position with wxGetClientDisplayRect(), which describes only the PRIMARY monitor. On a multi-head desktop (the reporting machine runs 5760x1080 across screens at +0, +1920 and +3840) a field anchored on the left or right screen was clamped onto the middle one and left invisible, while m_awaiting_length made the sketch tool consume every mouse event until it was answered: orbit and pan died after any sketch, with Enter the only way out. Clamp to the display the anchor is actually on instead. Also let drags and the wheel through that freeze, so a field that lands somewhere unexpected degrades to odd placement rather than a dead viewport. Both files were byte-identical between the forks apart from this change, so they are copied verbatim. Verified on the snaporca side by the user; this fork is still uncompiled (needs Eigen 5.0.1, which the available deps image does not provide). Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01BVzKmX6Y1aEteit1HTXG4Q --- src/slic3r/GUI/DesignSketchTool.cpp | 5 +++++ src/slic3r/GUI/SketchInlineEditor.cpp | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/DesignSketchTool.cpp b/src/slic3r/GUI/DesignSketchTool.cpp index 6820ee40d0..5c5e1e6407 100644 --- a/src/slic3r/GUI/DesignSketchTool.cpp +++ b/src/slic3r/GUI/DesignSketchTool.cpp @@ -7403,6 +7403,11 @@ bool DesignSketchTool::on_mouse(wxMouseEvent& evt, GLCanvas3D& canvas) // so the Polyline handler ends the chain. Without this the freeze ate every terminator. if (m_mode == Mode::Polyline && (evt.RightDown() || evt.LeftDClick()) && on_inline_dismiss) on_inline_dismiss(); // -> set_inline_busy(false), m_awaiting_length=false + // The freeze exists so a stray click can't draw under the floating field — it was + // never meant to trap the camera. Let drags and the wheel through, so a field that + // opens somewhere unexpected can't leave the viewport unusable. + else if (evt.Dragging() || evt.GetWheelRotation() != 0) + return false; else return true; } diff --git a/src/slic3r/GUI/SketchInlineEditor.cpp b/src/slic3r/GUI/SketchInlineEditor.cpp index a3e4c94b03..d329422281 100644 --- a/src/slic3r/GUI/SketchInlineEditor.cpp +++ b/src/slic3r/GUI/SketchInlineEditor.cpp @@ -1,5 +1,7 @@ #include "SketchInlineEditor.hpp" +#include + #include #include #include @@ -83,7 +85,15 @@ void SketchInlineEditor::open(const wxPoint& screen_px, double value, wxPoint pos(screen_px.x - sz.GetWidth() / 2, screen_px.y - sz.GetHeight() / 2); // Keep the frame fully on-screen: an anchor that maps off the display makes GTK drop // the window at a default corner (top-left) instead of the requested point. - const wxRect area = wxGetClientDisplayRect(); + // Clamp to the display the anchor is ON, not the primary one: wxGetClientDisplayRect() + // only ever describes the primary monitor, so on a multi-head desktop it shoved this + // field onto a different screen than the app. It then sat invisible while + // m_awaiting_length made the sketch tool eat every mouse event, which read as the + // viewport freezing after a sketch with only Enter able to release it. + int disp = wxDisplay::GetFromPoint(screen_px); + if (disp == wxNOT_FOUND) disp = wxDisplay::GetFromWindow(m_frame); + const wxRect area = (disp != wxNOT_FOUND) ? wxDisplay(unsigned(disp)).GetClientArea() + : wxGetClientDisplayRect(); pos.x = std::max(area.GetLeft(), std::min(pos.x, area.GetRight() - sz.GetWidth())); pos.y = std::max(area.GetTop(), std::min(pos.y, area.GetBottom() - sz.GetHeight())); // Show() BEFORE Move(): GTK ignores a Move() issued before the window is mapped (the