Modified: trunk/Source/WebKit/ChangeLog (262371 => 262372)
--- trunk/Source/WebKit/ChangeLog 2020-06-01 09:24:05 UTC (rev 262371)
+++ trunk/Source/WebKit/ChangeLog 2020-06-01 12:27:42 UTC (rev 262372)
@@ -1,5 +1,19 @@
2020-06-01 Carlos Garcia Campos <cgar...@igalia.com>
+ [GTK4] Fix pointer lock in X11
+ https://bugs.webkit.org/show_bug.cgi?id=212592
+
+ Reviewed by Adrian Perez de Castro.
+
+ I forgot to forward the motion events for X11 in GTK4.
+
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (MotionEvent::MotionEvent): Add a constructor that receives the positions and state.
+ (webkitWebViewBaseMotion): Notify the pointer lock manager about the event. Also save the last motion event and
+ compute the movement delta.
+
+2020-06-01 Carlos Garcia Campos <cgar...@igalia.com>
+
[GTK4] Make inspector work
https://bugs.webkit.org/show_bug.cgi?id=212321
Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp (262371 => 262372)
--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2020-06-01 09:24:05 UTC (rev 262371)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2020-06-01 12:27:42 UTC (rev 262372)
@@ -173,11 +173,13 @@
yRoot = rootPoint.y();
}
- position.setX(x);
- position.setY(y);
- globalPosition.setX(xRoot);
- globalPosition.setY(yRoot);
+ MotionEvent(FloatPoint(x, y), FloatPoint(xRoot, yRoot), state);
+ }
+ MotionEvent(FloatPoint&& position, FloatPoint&& globalPosition, GdkModifierType state)
+ : position(WTFMove(position))
+ , globalPosition(WTFMove(globalPosition))
+ {
if (state & GDK_CONTROL_MASK)
modifiers.add(WebEvent::Modifier::ControlKey);
if (state & GDK_SHIFT_MASK)
@@ -1371,10 +1373,24 @@
static gboolean webkitWebViewBaseMotion(WebKitWebViewBase* webViewBase, double x, double y, GtkEventController* controller)
{
- // FIXME: Forward event to dialog.
- // FIXME: Pointer lock.
- webViewBase->priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(gtk_event_controller_get_current_event(controller), { clampToInteger(x), clampToInteger(y) }, 0, WTF::nullopt));
+ WebKitWebViewBasePrivate* priv = webViewBase->priv;
+ if (priv->dialog)
+ return GDK_EVENT_PROPAGATE;
+ if (priv->pointerLockManager) {
+ priv->pointerLockManager->didReceiveMotionEvent(FloatPoint(x, y));
+ return GDK_EVENT_STOP;
+ }
+
+ auto* event = gtk_event_controller_get_current_event(controller);
+ Optional<FloatSize> movementDelta;
+ MotionEvent motionEvent(FloatPoint(x, y), FloatPoint(x, y), gdk_event_get_modifier_state(event));
+ if (priv->lastMotionEvent)
+ movementDelta = motionEvent.position - priv->lastMotionEvent->position;
+ priv->lastMotionEvent = WTFMove(motionEvent);
+
+ webViewBase->priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(event, { clampToInteger(x), clampToInteger(y) }, 0, movementDelta));
+
return GDK_EVENT_PROPAGATE;
}