Preview plot with touchscreen gestures

More
15 May 2025 17:11 - 15 May 2025 17:13 #328525 by Wischi
Hello everyone,

i was facing the same problem preview plot bug in LinuxCNC 2.9.4 with Gmoccapy 3.4.9 as described in this thread:  Question: Gmoccapy 3.4.2 and touchscreen
Preview only moves a couple of mm then stops.

So i decided to change the gremlin.py to use the Gtk3 Gestures. With the modified version you can rotate the preview with one finger again, but also zoom in and out with pinch gestures as well as pan with two fingers. In X, Y, Z view the rotation is locked, only zoom + pan. As of right now it will disable the mouse, but my machine only has the touchscreen so for me its no problem.

~$xinput list show my touchscreen as:
eGalaxTouch Virtual Device for Single
eGalaxTouch Virtial Device for Touch

No further driver installed. Tested with fresh 2.9.4 live iso.

Just replace gremlin.py in /usr/lib/python3/dist-packages/

I just wanted to drop this file in here in case someone has the same problem. It does not work in Axis though! There the preview jumps to a random place, but it is the same behaviour with the original gremlin.

Also made a small video:
Attachments:
Last edit: 15 May 2025 17:13 by Wischi.
The following user(s) said Thank You: juergen-home, tommylight, 0x2102, Aciera, HansU

Please Log in or Create an account to join the conversation.

More
15 May 2025 18:02 #328526 by Aciera
Replied by Aciera on topic Preview plot with touchscreen gestures
Nice, thanks for sharing.

Please Log in or Create an account to join the conversation.

More
09 Dec 2025 14:07 #339918 by HansU
Replied by HansU on topic Preview plot with touchscreen gestures
Thanks for that fix.
But this works only for multitouch screens. For resistive screens you can only rotate the view.
Furthermore this also affects the setting for the mouse - you have always rotate on the left button and zoom on the wheel. Dragging does not work in any setting.

Please Log in or Create an account to join the conversation.

More
25 Jul 2026 10:11 - 25 Jul 2026 10:18 #348053 by 0x2102
Replied by 0x2102 on topic Preview plot with touchscreen gestures
Hello everyone,
first of all, thanks to Wischi for the touch gesture version of gremlin.py — it works perfectly on my hardware (Melfas LGD AIT touch panel, LinuxCNC 2.9, Gmoccapy).

The only limitation for me was the one HansU already mentioned: with the mouse you can only rotate, dragging/panning does not work in any setting, because motion() returns unconditionally.

I'm attaching a version that is Wischi's file unchanged, with one addition: instead of disabling motion() completely, it now filters events by their source device. Only events that clearly come from a real physical mouse are processed — the event must not be pointer-emulated, the source device must be classified as MOUSE, and the device name must not contain "touch". Everything ambiguous is discarded, so the touch behavior stays exactly as in Wischi's version.

The background: many touch controllers expose a second X input device that does driver-level mouse emulation (mine shows up as "Melfas LGD AIT Touch Controller Mouse" in xinput list). Its events look like genuine pointer events to GTK — no emulation flag set — and those are what caused the original "preview only moves a couple of mm then stops" bug in the legacy motion() path. That's why the filter also checks the device name, not just the emulated flag.

Result on my machine:

Touch: unchanged from Wischi's version — one finger rotates (perspective view), two fingers pan and pinch-zoom
Real mouse: full mouse_btn_mode behavior restored — left rotate, middle drag/pan, right zoom (mode 0), shift+left drag also works
Since motion() is active again, the mouse button mode setting in Gmoccapy works again too
Tested on LinuxCNC 2.9 with Gmoccapy, capacitive multitouch panel. As before: just replace gremlin.py in /usr/lib/python3/dist-packages/ (keep a backup of the original — it gets overwritten on updates).

Changes:
1. Lines 40–50 — header comment (documentation only)
2. Lines 676–699 — new helper function _is_real_mouse_event()
3. Line 700 — motion() 
Attachments:
Last edit: 25 Jul 2026 10:18 by 0x2102.
The following user(s) said Thank You: Surmetall

Please Log in or Create an account to join the conversation.

Moderators: newbynobiHansU
Time to create page: 0.570 seconds
Powered by Kunena Forum