Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screen Rotation #459

Closed
giotherobot opened this issue Feb 21, 2021 · 9 comments
Closed

Screen Rotation #459

giotherobot opened this issue Feb 21, 2021 · 9 comments
Milestone

Comments

@giotherobot
Copy link

Since I'm using a convertible device (Dell Inspiron 14 2in1) with KDE that does not support screen rotation by itself. I use a script to monitor the orientation sensor and rotate the screen nd input devices accordingly. The gestures on the touchscreen do not follow the screen rotation though so a swipe UP on the normal screen becomes a Swipe Left on the rotated screen. It's still workable but takes a bit of thought. Is there any way to solve this?

@JoseExposito
Copy link
Owner

Mmmm that's an interesting use case, I'm not sure if I'll be able to fix this. Could you share your script? I can give it a try.
I only need the bit that you use to rotate the screen.

@giotherobot
Copy link
Author

giotherobot commented Feb 23, 2021

Of course! Here are the commands that I use to rotate the screen and the inputs:

xrandr --output eDP-1 --rotate normal
    xinput set-float-prop 'CUST0000:00 04F3:2A62 Eraser (0)'    "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
    xinput set-float-prop 'CUST0000:00 04F3:2A62 Pen (0)'       "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
    xinput set-float-prop 'pointer:CUST0000:00 04F3:2A62'               "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1

By setting the matrix to 0 1 0 -1 0 1 0 0 1 for example you rotate the screen and inputs with right-up.

@NICHOLAS85
Copy link

I am interested in seeing your solution (if there is one). I've been doing research trying to implement this in my fork of Gebaar without pulling in too many new dependencies.
Many auto-rotating solutions involve changing the Coordinate Transformation Matrix of input devices to reflect their new orientations meaning this information could be used, however, that would involve not using the libinput API and pulling in a new dependency. Libinput has the ability to retrieve devices Calibration matrix or even rotation angle however it seems these are not related to the Coordinate transformations most auto-rotating programs manipulate, they are their own Libinput values.

@NICHOLAS85
Copy link

Just implemented a very rough version of this functionality at NICHOLAS85/gebaar-libinput@b37f412. It basically looks at the inputs Coordinate Transformation Matrix to determine the orientation of the device and changes the desired gesture from there. It uses dependencies already pulled in touchegg so it seems it may be possible to implement something similar in this project.

@chgardener
Copy link

very interested in this as well!

@JoseExposito JoseExposito added this to the 2.0.9 milestone Apr 1, 2021
@JoseExposito
Copy link
Owner

JoseExposito commented Apr 1, 2021

Hi! Sorry for taking so long to fix this, I've been busy working on other stuff.

I just fixed this on master. @giotherobot , @chgardener if you want to test it (I'd really appreciate it) you can compile the latest source code following this instructions:
https://github.com/JoseExposito/touchegg/blob/master/HACKING.md#compilation

Or, you can install the package from the daily PPA:
https://launchpad.net/~touchegg/+archive/ubuntu/daily

Remember to remove the daily PPA and go back to the stable one once you are done with testing 😄

Feel free to reopen the issue if the patch doesn't work.

@NICHOLAS85 thanks for the tip, but I implemented it in a different way to avoid problems matching libinput devices and X11 devices, because it is a little bit problematic, specially with input devices that have multiple inputs associated on X11.

@giotherobot
Copy link
Author

Compiled as soon as I saw this closed, seems to work fine! Thanks, wonderful job!

@JoseExposito
Copy link
Owner

Cool! Thanks for testing it. If nobody find bugs, I'll release v2.0.9 in a few of days so this can go into a stable build 👍

@chgardener
Copy link

Works like a charm! Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants