Diff
Modified: trunk/Source/WebKit/ChangeLog (271291 => 271292)
--- trunk/Source/WebKit/ChangeLog 2021-01-08 13:18:52 UTC (rev 271291)
+++ trunk/Source/WebKit/ChangeLog 2021-01-08 13:27:34 UTC (rev 271292)
@@ -1,3 +1,20 @@
+2021-01-08 Chris Lord <[email protected]>
+
+ [WPE] Enable smooth-motion and kinetic scrolling on touchpads
+ https://bugs.webkit.org/show_bug.cgi?id=219942
+
+ Reviewed by Žan Doberšek.
+
+ Interpret axis motion events with a zero value as axis stop events and
+ send the appropriate wheel event phase. This enables kinetic scrolling
+ when using touchpads and other smooth-scrolling devices.
+
+ * UIProcess/API/wpe/PageClientImpl.cpp:
+ (WebKit::PageClientImpl::doneWithTouchEvent):
+ * UIProcess/API/wpe/WPEView.cpp:
+ (WKWPE::m_backend):
+ * UIProcess/API/wpe/WPEView.h:
+
2021-01-08 Youenn Fablet <[email protected]>
Make sure that if NetworkProcess clears DOMCache, it also clears service worker registrations
Modified: trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp (271291 => 271292)
--- trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp 2021-01-08 13:18:52 UTC (rev 271291)
+++ trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp 2021-01-08 13:27:34 UTC (rev 271292)
@@ -217,7 +217,7 @@
if (scrollGestureController.handleEvent(touchPoint)) {
struct wpe_input_axis_event* axisEvent = scrollGestureController.axisEvent();
if (axisEvent->type != wpe_input_axis_event_type_null)
- page.handleWheelEvent(WebKit::NativeWebWheelEvent(axisEvent, m_view.page().deviceScaleFactor(), WebWheelEvent::Phase::PhaseNone, WebWheelEvent::Phase::PhaseNone));
+ page.handleWheelEvent(WebKit::NativeWebWheelEvent(axisEvent, m_view.page().deviceScaleFactor(), scrollGestureController.phase(), WebWheelEvent::Phase::PhaseNone));
return;
}
Modified: trunk/Source/WebKit/UIProcess/API/wpe/WPEView.cpp (271291 => 271292)
--- trunk/Source/WebKit/UIProcess/API/wpe/WPEView.cpp 2021-01-08 13:18:52 UTC (rev 271291)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WPEView.cpp 2021-01-08 13:27:34 UTC (rev 271292)
@@ -159,8 +159,31 @@
// handle_axis_event
[](void* data, struct wpe_input_axis_event* event)
{
- auto& page = reinterpret_cast<View*>(data)->page();
- page.handleWheelEvent(WebKit::NativeWebWheelEvent(event, page.deviceScaleFactor(), WebWheelEvent::Phase::PhaseNone, WebWheelEvent::Phase::PhaseNone));
+ auto& view = *reinterpret_cast<View*>(data);
+
+ // FIXME: We shouldn't hard-code this.
+ enum Axis {
+ Vertical,
+ Horizontal
+ };
+
+ switch (event->axis) {
+ case Vertical:
+ view.m_horizontalScrollActive = !!event->value;
+ break;
+ case Horizontal:
+ view.m_verticalScrollActive = !!event->value;
+ break;
+ }
+
+ // We treat an axis motion event with a value of zero to be equivalent
+ // to a 'stop' event. Motion events with zero motion don't exist naturally,
+ // so this allows a backend to express 'stop' events without changing API.
+ auto& page = view.page();
+ if (event->value)
+ page.handleWheelEvent(WebKit::NativeWebWheelEvent(event, page.deviceScaleFactor(), WebWheelEvent::Phase::PhaseChanged, WebWheelEvent::Phase::PhaseNone));
+ else if (!view.m_horizontalScrollActive && !view.m_verticalScrollActive)
+ page.handleWheelEvent(WebKit::NativeWebWheelEvent(event, page.deviceScaleFactor(), WebWheelEvent::Phase::PhaseEnded, WebWheelEvent::Phase::PhaseNone));
},
// handle_touch_event
[](void* data, struct wpe_input_touch_event* event)
Modified: trunk/Source/WebKit/UIProcess/API/wpe/WPEView.h (271291 => 271292)
--- trunk/Source/WebKit/UIProcess/API/wpe/WPEView.h 2021-01-08 13:18:52 UTC (rev 271291)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WPEView.h 2021-01-08 13:27:34 UTC (rev 271292)
@@ -134,6 +134,9 @@
mutable GRefPtr<WebKitWebViewAccessible> m_accessible;
#endif
+ bool m_horizontalScrollActive { false };
+ bool m_verticalScrollActive { false };
+
WebKit::InputMethodFilter m_inputMethodFilter;
};
Modified: trunk/Tools/ChangeLog (271291 => 271292)
--- trunk/Tools/ChangeLog 2021-01-08 13:18:52 UTC (rev 271291)
+++ trunk/Tools/ChangeLog 2021-01-08 13:27:34 UTC (rev 271292)
@@ -1,3 +1,14 @@
+2021-01-08 Chris Lord <[email protected]>
+
+ [WPE] Enable smooth-motion and kinetic scrolling on touchpads
+ https://bugs.webkit.org/show_bug.cgi?id=219942
+
+ Reviewed by Žan Doberšek.
+
+ * wpe/backends/WindowViewBackend.cpp:
+ Update to Wayland protocol 5 and interpret axis stop, discrete and
+ smooth axis motion events.
+
2021-01-07 Paulo Matos <[email protected]>
Fix mktemp call for busybox mktemp
Modified: trunk/Tools/wpe/backends/WindowViewBackend.cpp (271291 => 271292)
--- trunk/Tools/wpe/backends/WindowViewBackend.cpp 2021-01-08 13:18:52 UTC (rev 271291)
+++ trunk/Tools/wpe/backends/WindowViewBackend.cpp 2021-01-08 13:27:34 UTC (rev 271292)
@@ -146,7 +146,7 @@
window->m_xdg = static_cast<struct zxdg_shell_v6*>(wl_registry_bind(registry, name, &zxdg_shell_v6_interface, 1));
if (!std::strcmp(interface, "wl_seat"))
- window->m_seat = static_cast<struct wl_seat*>(wl_registry_bind(registry, name, &wl_seat_interface, 4));
+ window->m_seat = static_cast<struct wl_seat*>(wl_registry_bind(registry, name, &wl_seat_interface, 5));
},
// global_remove
[](void*, struct wl_registry*, uint32_t) { },
@@ -238,17 +238,64 @@
// axis
[](void* data, struct wl_pointer*, uint32_t time, uint32_t axis, wl_fixed_t value)
{
+ if (axis != WL_POINTER_AXIS_HORIZONTAL_SCROLL && axis != WL_POINTER_AXIS_VERTICAL_SCROLL)
+ return;
+
auto& window = *static_cast<WindowViewBackend*>(data);
if (window.m_seatData.pointer.target) {
struct wpe_input_axis_event event = { wpe_input_axis_event_type_motion,
time, window.m_seatData.pointer.coords.first, window.m_seatData.pointer.coords.second, axis, -wl_fixed_to_int(value), window.modifiers() };
+ if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL && window.m_seatData.axis_discrete.horizontal)
+ event.value = window.m_seatData.axis_discrete.horizontal;
+ else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL && window.m_seatData.axis_discrete.vertical)
+ event.value = window.m_seatData.axis_discrete.vertical;
+#if WPE_CHECK_VERSION(1, 5, 0)
+ else {
+ struct wpe_input_axis_2d_event event2d = { event, 0, 0 };
+ event2d.base.type = static_cast<wpe_input_axis_event_type>(wpe_input_axis_event_type_mask_2d | wpe_input_axis_event_type_motion_smooth);
+
+ if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
+ event2d.x_axis = wl_fixed_to_double(value);
+ else
+ event2d.y_axis = -wl_fixed_to_double(value);
+
+ window.dispatchInputAxisEvent(&event2d.base);
+ return;
+ }
+#endif
window.dispatchInputAxisEvent(&event);
+ window.m_seatData.axis_discrete.horizontal = window.m_seatData.axis_discrete.vertical = 0;
}
},
- nullptr, // frame
- nullptr, // axis_source
- nullptr, // axis_stop
- nullptr, // axis_discrete
+ // frame
+ [](void*, struct wl_pointer*) { },
+ // axis_source
+ [](void*, struct wl_pointer*, uint32_t) { },
+ // axis_stop
+ [](void* data, struct wl_pointer*, uint32_t time, uint32_t axis)
+ {
+ if (axis != WL_POINTER_AXIS_HORIZONTAL_SCROLL && axis != WL_POINTER_AXIS_VERTICAL_SCROLL)
+ return;
+
+ auto& window = *static_cast<WindowViewBackend*>(data);
+ if (window.m_seatData.pointer.target) {
+ struct wpe_input_axis_event event = { wpe_input_axis_event_type_motion,
+ time, window.m_seatData.pointer.coords.first, window.m_seatData.pointer.coords.second, axis, 0, window.modifiers() };
+ window.dispatchInputAxisEvent(&event);
+ }
+ },
+ // axis_discrete
+ [](void* data, struct wl_pointer*, uint32_t axis, int32_t discrete) {
+ auto& window = *static_cast<WindowViewBackend*>(data);
+ switch (axis) {
+ case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
+ window.m_seatData.axis_discrete.horizontal = discrete;
+ break;
+ case WL_POINTER_AXIS_VERTICAL_SCROLL:
+ window.m_seatData.axis_discrete.vertical = -discrete;
+ break;
+ }
+ },
};
const struct wl_keyboard_listener WindowViewBackend::s_keyboardListener = {
Modified: trunk/Tools/wpe/backends/WindowViewBackend.h (271291 => 271292)
--- trunk/Tools/wpe/backends/WindowViewBackend.h 2021-01-08 13:18:52 UTC (rev 271291)
+++ trunk/Tools/wpe/backends/WindowViewBackend.h 2021-01-08 13:27:34 UTC (rev 271292)
@@ -90,6 +90,11 @@
} touch;
struct {
+ int32_t horizontal { 0 };
+ int32_t vertical { 0 };
+ } axis_discrete;
+
+ struct {
int32_t rate { 0 };
int32_t delay { 0 };
} repeatInfo;