Preview plot with touchscreen gestures

More
1 year 5 months ago #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:
Code:
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:

Please Log in to join the conversation.

More
1 year 5 months ago #328526 by Aciera
Nice, thanks for sharing.

Please Log in to join the conversation.

More
10 months 3 weeks ago #339918 by HansU
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 to join the conversation.

More
3 months 5 days ago #348053 by 0x2102
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() 

Please Log in to join the conversation.

Time to create page: 0.155 seconds
Powered by Kunena Forum