Changeset 271292 in webkit
- Timestamp:
- Jan 8, 2021, 5:27:34 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/API/wpe/WPEView.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/API/wpe/WPEView.h (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/wpe/backends/WindowViewBackend.cpp (modified) (2 diffs)
-
Tools/wpe/backends/WindowViewBackend.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r271291 r271292 1 2021-01-08 Chris Lord <clord@igalia.com> 2 3 [WPE] Enable smooth-motion and kinetic scrolling on touchpads 4 https://bugs.webkit.org/show_bug.cgi?id=219942 5 6 Reviewed by Žan Doberšek. 7 8 Interpret axis motion events with a zero value as axis stop events and 9 send the appropriate wheel event phase. This enables kinetic scrolling 10 when using touchpads and other smooth-scrolling devices. 11 12 * UIProcess/API/wpe/PageClientImpl.cpp: 13 (WebKit::PageClientImpl::doneWithTouchEvent): 14 * UIProcess/API/wpe/WPEView.cpp: 15 (WKWPE::m_backend): 16 * UIProcess/API/wpe/WPEView.h: 17 1 18 2021-01-08 Youenn Fablet <youenn@apple.com> 2 19 -
trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp
r266025 r271292 218 218 struct wpe_input_axis_event* axisEvent = scrollGestureController.axisEvent(); 219 219 if (axisEvent->type != wpe_input_axis_event_type_null) 220 page.handleWheelEvent(WebKit::NativeWebWheelEvent(axisEvent, m_view.page().deviceScaleFactor(), WebWheelEvent::Phase::PhaseNone, WebWheelEvent::Phase::PhaseNone));220 page.handleWheelEvent(WebKit::NativeWebWheelEvent(axisEvent, m_view.page().deviceScaleFactor(), scrollGestureController.phase(), WebWheelEvent::Phase::PhaseNone)); 221 221 return; 222 222 } -
trunk/Source/WebKit/UIProcess/API/wpe/WPEView.cpp
r268965 r271292 160 160 [](void* data, struct wpe_input_axis_event* event) 161 161 { 162 auto& page = reinterpret_cast<View*>(data)->page(); 163 page.handleWheelEvent(WebKit::NativeWebWheelEvent(event, page.deviceScaleFactor(), WebWheelEvent::Phase::PhaseNone, WebWheelEvent::Phase::PhaseNone)); 162 auto& view = *reinterpret_cast<View*>(data); 163 164 // FIXME: We shouldn't hard-code this. 165 enum Axis { 166 Vertical, 167 Horizontal 168 }; 169 170 switch (event->axis) { 171 case Vertical: 172 view.m_horizontalScrollActive = !!event->value; 173 break; 174 case Horizontal: 175 view.m_verticalScrollActive = !!event->value; 176 break; 177 } 178 179 // We treat an axis motion event with a value of zero to be equivalent 180 // to a 'stop' event. Motion events with zero motion don't exist naturally, 181 // so this allows a backend to express 'stop' events without changing API. 182 auto& page = view.page(); 183 if (event->value) 184 page.handleWheelEvent(WebKit::NativeWebWheelEvent(event, page.deviceScaleFactor(), WebWheelEvent::Phase::PhaseChanged, WebWheelEvent::Phase::PhaseNone)); 185 else if (!view.m_horizontalScrollActive && !view.m_verticalScrollActive) 186 page.handleWheelEvent(WebKit::NativeWebWheelEvent(event, page.deviceScaleFactor(), WebWheelEvent::Phase::PhaseEnded, WebWheelEvent::Phase::PhaseNone)); 164 187 }, 165 188 // handle_touch_event -
trunk/Source/WebKit/UIProcess/API/wpe/WPEView.h
r255488 r271292 135 135 #endif 136 136 137 bool m_horizontalScrollActive { false }; 138 bool m_verticalScrollActive { false }; 139 137 140 WebKit::InputMethodFilter m_inputMethodFilter; 138 141 }; -
trunk/Tools/ChangeLog
r271285 r271292 1 2021-01-08 Chris Lord <clord@igalia.com> 2 3 [WPE] Enable smooth-motion and kinetic scrolling on touchpads 4 https://bugs.webkit.org/show_bug.cgi?id=219942 5 6 Reviewed by Žan Doberšek. 7 8 * wpe/backends/WindowViewBackend.cpp: 9 Update to Wayland protocol 5 and interpret axis stop, discrete and 10 smooth axis motion events. 11 1 12 2021-01-07 Paulo Matos <pmatos@igalia.com> 2 13 -
trunk/Tools/wpe/backends/WindowViewBackend.cpp
r266025 r271292 147 147 148 148 if (!std::strcmp(interface, "wl_seat")) 149 window->m_seat = static_cast<struct wl_seat*>(wl_registry_bind(registry, name, &wl_seat_interface, 4));149 window->m_seat = static_cast<struct wl_seat*>(wl_registry_bind(registry, name, &wl_seat_interface, 5)); 150 150 }, 151 151 // global_remove … … 239 239 [](void* data, struct wl_pointer*, uint32_t time, uint32_t axis, wl_fixed_t value) 240 240 { 241 if (axis != WL_POINTER_AXIS_HORIZONTAL_SCROLL && axis != WL_POINTER_AXIS_VERTICAL_SCROLL) 242 return; 243 241 244 auto& window = *static_cast<WindowViewBackend*>(data); 242 245 if (window.m_seatData.pointer.target) { 243 246 struct wpe_input_axis_event event = { wpe_input_axis_event_type_motion, 244 247 time, window.m_seatData.pointer.coords.first, window.m_seatData.pointer.coords.second, axis, -wl_fixed_to_int(value), window.modifiers() }; 248 if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL && window.m_seatData.axis_discrete.horizontal) 249 event.value = window.m_seatData.axis_discrete.horizontal; 250 else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL && window.m_seatData.axis_discrete.vertical) 251 event.value = window.m_seatData.axis_discrete.vertical; 252 #if WPE_CHECK_VERSION(1, 5, 0) 253 else { 254 struct wpe_input_axis_2d_event event2d = { event, 0, 0 }; 255 event2d.base.type = static_cast<wpe_input_axis_event_type>(wpe_input_axis_event_type_mask_2d | wpe_input_axis_event_type_motion_smooth); 256 257 if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) 258 event2d.x_axis = wl_fixed_to_double(value); 259 else 260 event2d.y_axis = -wl_fixed_to_double(value); 261 262 window.dispatchInputAxisEvent(&event2d.base); 263 return; 264 } 265 #endif 245 266 window.dispatchInputAxisEvent(&event); 246 } 247 }, 248 nullptr, // frame 249 nullptr, // axis_source 250 nullptr, // axis_stop 251 nullptr, // axis_discrete 267 window.m_seatData.axis_discrete.horizontal = window.m_seatData.axis_discrete.vertical = 0; 268 } 269 }, 270 // frame 271 [](void*, struct wl_pointer*) { }, 272 // axis_source 273 [](void*, struct wl_pointer*, uint32_t) { }, 274 // axis_stop 275 [](void* data, struct wl_pointer*, uint32_t time, uint32_t axis) 276 { 277 if (axis != WL_POINTER_AXIS_HORIZONTAL_SCROLL && axis != WL_POINTER_AXIS_VERTICAL_SCROLL) 278 return; 279 280 auto& window = *static_cast<WindowViewBackend*>(data); 281 if (window.m_seatData.pointer.target) { 282 struct wpe_input_axis_event event = { wpe_input_axis_event_type_motion, 283 time, window.m_seatData.pointer.coords.first, window.m_seatData.pointer.coords.second, axis, 0, window.modifiers() }; 284 window.dispatchInputAxisEvent(&event); 285 } 286 }, 287 // axis_discrete 288 [](void* data, struct wl_pointer*, uint32_t axis, int32_t discrete) { 289 auto& window = *static_cast<WindowViewBackend*>(data); 290 switch (axis) { 291 case WL_POINTER_AXIS_HORIZONTAL_SCROLL: 292 window.m_seatData.axis_discrete.horizontal = discrete; 293 break; 294 case WL_POINTER_AXIS_VERTICAL_SCROLL: 295 window.m_seatData.axis_discrete.vertical = -discrete; 296 break; 297 } 298 }, 252 299 }; 253 300 -
trunk/Tools/wpe/backends/WindowViewBackend.h
r261851 r271292 91 91 92 92 struct { 93 int32_t horizontal { 0 }; 94 int32_t vertical { 0 }; 95 } axis_discrete; 96 97 struct { 93 98 int32_t rate { 0 }; 94 99 int32_t delay { 0 };
Note:
See TracChangeset
for help on using the changeset viewer.