Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 637888b2d2a394b67803afc2340826d0d25db9fc
https://github.com/WebKit/WebKit/commit/637888b2d2a394b67803afc2340826d0d25db9fc
Author: Roope Salmi <[email protected]>
Date: 2024-07-03 (Wed, 03 Jul 2024)
Changed paths:
M Source/WebKit/UIProcess/gtk/PointerLockManager.cpp
M Source/WebKit/UIProcess/gtk/PointerLockManager.h
M Source/WebKit/UIProcess/gtk/PointerLockManagerX11.cpp
M Source/WebKit/UIProcess/gtk/PointerLockManagerX11.h
Log Message:
-----------
[GTK] Fix pointer lock on X11
https://bugs.webkit.org/show_bug.cgi?id=273876
Reviewed by Carlos Garcia Campos.
The XGrabPointer call was returning AlreadyGrabbed. This is apparently
because there is an active passive grab when the mouse is pressed down,
that comes via X Input Extensions (XI2) and not X Core. The XGrabPointer
implementation returns AlreadyGrabbed when the "grabtype" differs, i.e.
"XI" or "CORE". The passive grab may have changed into a touch grab at
some point, which goes through XI2.
My solution is to call XUngrabPointer before trying to grab it.
Fixing this uncovered a secondary issue: the coordinates given to
XWarpPointer were incorrect. I get the actual root-relative coordinates
with XQueryPointer during lock() instead of trying to convert from
m_initialPoint. (That would require handling the offset of the widget
inside the window and DPI scaling.)
I then got a continuous stream of MouseEvents even when the mouse was
stationary due to float rounding differences. In didReceiveMotionEvent,
I added a check that the delta coordinates are non-zero when rounded to
integers, so no events are sent with delta 0.
There are slight errors and differences in how movementX/Y values behave
when locked vs unlocked. These should be addressed separately.
Tested manually with -DUSE_GTK4=ON,OFF, GDK_SCALE=1,2.
* Source/WebKit/UIProcess/gtk/PointerLockManager.cpp:
(WebKit::PointerLockManager::handleMotion):
* Source/WebKit/UIProcess/gtk/PointerLockManager.h:
* Source/WebKit/UIProcess/gtk/PointerLockManagerX11.cpp:
(WebKit::PointerLockManagerX11::lock):
(WebKit::PointerLockManagerX11::didReceiveMotionEvent):
* Source/WebKit/UIProcess/gtk/PointerLockManagerX11.h:
Canonical link: https://commits.webkit.org/280623@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes