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

Attempt to fix force_zero_scaling for tablet and touch #3644

Merged

Conversation

Ant01n3
Copy link
Contributor

@Ant01n3 Ant01n3 commented Oct 23, 2023

Describe your PR, what does it fix/add?

Tries to fix tablet and touch events not scaled back (mouse is OK) when using force_zero_scaling on XWayland windows and output scale is not 1. (Fixing #3573 )

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

My knowledge of the code base and event propagation mechanisms of Hyprland is really limited. I hope I haven't forgotten anything.

Is it ready for merging, or does it need work?

It needs to be thoroughly tested. I'm currently using it with Krita (which doesn't support Wayland) and I've done some tests with xev to check that mouse, tablet and touch positions match.

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's it

src/managers/input/Touch.cpp Outdated Show resolved Hide resolved
src/managers/input/Touch.cpp Outdated Show resolved Hide resolved
@vaxerski
Copy link
Member

also, needs a clang-format

@Ant01n3
Copy link
Contributor Author

Ant01n3 commented Oct 24, 2023

also, needs a clang-format

Done.

@vaxerski
Copy link
Member

you resolved conversations without addressing them

@Ant01n3
Copy link
Contributor Author

Ant01n3 commented Oct 24, 2023

you resolved conversations without addressing them

Sorry, I do not understand what you want me to do. Be kind.

@vaxerski
Copy link
Member

in both cases your calculations are wrong and I commented the correct formulas

@Ant01n3
Copy link
Contributor Author

Ant01n3 commented Oct 24, 2023

in both cases your calculations are wrong and I commented the correct formulas

(g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow->m_vRealPosition.goalv()) * m_sTouchData.touchFocusWindow->m_fX11SurfaceScaledBy

corresponds, for me, to (coords - windowPos) * scale ? But maybe I do not understand well the meaning of these functions/fields ?

The other one is more convoluted due to the use of touchSurfaceOrigin but I fail to see how the formula you give can be implemented (I tried to change as few things as possible in the original code, but as I need to scale the coords, I needed to scale touchSurfaceOrigin also, that is the only things I changed).

I tested the code (and I am actually using the modified version) and it seems to work (I admit this is not a proof). I did tests with xev to see if the computed pixel positions are the same as the mouse.

@vaxerski
Copy link
Member

that is correct

@Ant01n3
Copy link
Contributor Author

Ant01n3 commented Oct 24, 2023

Ok, so should I consider the code is now ok and resolve the conversations ?

@vaxerski
Copy link
Member

well, no, you are still calculating it differently and I am pretty sure it is wrong

@vaxerski
Copy link
Member

I'll test it on my laptop tomorrow and edit myself. But it definitely is wrong

@vaxerski
Copy link
Member

patch.txt

this fixes both my comments, and works properly.

@Ant01n3
Copy link
Contributor Author

Ant01n3 commented Oct 27, 2023

Done. The last commit contains your patch.

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@vaxerski vaxerski merged commit 1d47e2c into hyprwm:main Oct 27, 2023
10 checks passed
thejch pushed a commit to thejch/Hyprland that referenced this pull request Nov 15, 2023
* Attempt to fix force_zero_scaling for tablet and touch for XWayland apps.

* Formated using clang-format.

* Simpler way to compute touch origin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants