pencil2d / pencil

Pencil2D is an easy, intuitive tool to make 2D hand-drawn animations. Pencil2D is open source and cross-platform.
http://pencil2d.org
GNU General Public License v2.0
1.47k stars 273 forks source link

When using xinput Coordinate Transform matrix, the input doesn't work. #1440

Open dov opened 4 years ago

dov commented 4 years ago

Issue Summary

I typically physically rotate my tablet and use it on half of my 27 inch screen. The map the tablet to my screen I then use the following command:

xinput set-prop "Wacom One by Wacom S Pen stylus" --type=float "Coordinate Transformation Matrix" 0 -0.5 0.93 1.2 0 0 0 0 1

This works fine e.g. in Krita and in gimp, but in pencil the stylus becomes useless. I guess that you are using some low level of xinput that bypasses the trasformation matrix.

### Actual Results I press the stylus in the canvas and nothing is drawn. If I use the mouse, then it works. ### Expected Results I expect to get the same behavior pressing the mouse LMB and by pressing the stylus to my tablet. ### Video or Image Reference There is nothing to show as nothing appears when pressing the stylus to the tablet when being inside the canvas. ### Steps to reproduce ### System Information + Pencil2D Version: Version: 0.6.4 + Operating System: Fedora 32, x86_64 + RAM Size: 32GB + Graphics Tablet: One by WACOM
J5lx commented 4 years ago

Hi, thanks for reporting. Unfortunately (or fortunately, depending on how you look at it), I can’t reproduce that issue with my Huion tablet on Arch Linux, using the transformation matrix you posted. We are using Qt for our tablet handling, which is also what Krita uses, so it seems weird that it works there but not in Pencil2D. It would be great if you could answer a few questions which might help us figure out what is going wrong:

dov commented 4 years ago

Sorry, I found the reason, and it has nothing to do with the input matrix, and it is more subtle why it happens to me in pencil2d and not in krita. Actually, when I started using krita, I had the same problem, but there is a workaround.

The problem is that the following three entities don't work together very well: the environment variable QT_SCALE_FACTOR, xinput, highdpi display. Whenever QT_SCALE_FACTOR (or the corresponding API, which I assume that pencil2d is using) is used, a mismatch arises between the screen coordinates and the qt elements focusing. I had the same problem with krita when I used an external QT_SCALE_FACTOR, but after I turned it off everything was ok. (It's not ideal as I really have to squint in order to read the fonts...)

My guess is that you are using the scale factor either implicitly or explicitly, and my 4k screen triggers it. That is what is messing up the stylus screen coordination. I looked for a "scale factor" parameter in the pencil2d settings, but I couldn't find one. I'll check out the sources one of these days and will look for it.

I'll let you decide whether you want to reject this bug based on my findings.

J5lx commented 4 years ago

Ah, I’m glad you were able to figure it out. But I still can’t reproduce it with that environment variable, so I suppose it must indeed have something to do with the display DPI as well (since I only have a “normal” DPI display). @scribblemaniac I recall that you are using a 4K monitor, would you mind taking a look at this?