зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1752862 - Allow some customization of the GTK kinetic scroll parameters. r=botond
This doesn't change behavior by default, but should allow users to tweak them and provide feedback as to which scroll speed is better for them. It seems for some people at least the current speed is too much. The "pixel" mode I implemented should behave exactly like GNOME web, in terms of scroll speed. Differential Revision: https://phabricator.services.mozilla.com/D137472
This commit is contained in:
Родитель
f8028fad27
Коммит
e2e408cd72
|
@ -526,6 +526,32 @@
|
|||
value: true
|
||||
mirror: always
|
||||
|
||||
# Mode to use when receiving kinetic scroll input.
|
||||
#
|
||||
# * 0: Auto mode (uses the default behavior, subject to change).
|
||||
# * 1: Page mode: Uses gtk deltas as a percentage of the page size to scroll. This mode matches:
|
||||
#
|
||||
# https://gitlab.gnome.org/GNOME/gtk/blob/c734c7e9188b56f56c3a504abee05fa40c5475ac/gtk/gtkrange.c#L3063-3074
|
||||
#
|
||||
# * 2: Pixel mode: Uses gtk deltas as a fixed pixel multiplier. This mode matches e.g. GNOME web.
|
||||
#
|
||||
# https://webkit-search.igalia.com/webkit/rev/215039ef09d6bfd6e088175bfe30788d95b9705d/Source/WebKit/Shared/gtk/WebEventFactory.cpp#265-296
|
||||
# (multiplied then by pixelsPerLineStep which in GNOME-web is 40).
|
||||
- name: apz.gtk.kinetic_scroll.delta_mode
|
||||
type: uint32_t
|
||||
value: 0
|
||||
mirror: always
|
||||
|
||||
- name: apz.gtk.kinetic_scroll.page_delta_mode_multiplier
|
||||
type: float
|
||||
value: 1.0f
|
||||
mirror: always
|
||||
|
||||
- name: apz.gtk.kinetic_scroll.pixel_delta_mode_multiplier
|
||||
type: float
|
||||
value: 40.0f
|
||||
mirror: always
|
||||
|
||||
- name: apz.gtk.touchpad_pinch.enabled
|
||||
type: RelaxedAtomicBool
|
||||
value: true
|
||||
|
|
|
@ -4612,13 +4612,25 @@ void nsWindow::OnScrollEvent(GdkEventScroll* aEvent) {
|
|||
mPanInProgress = true;
|
||||
}
|
||||
|
||||
const bool isPageMode =
|
||||
StaticPrefs::apz_gtk_kinetic_scroll_delta_mode() != 2;
|
||||
const double multiplier =
|
||||
isPageMode
|
||||
? StaticPrefs::
|
||||
apz_gtk_kinetic_scroll_page_delta_mode_multiplier()
|
||||
: StaticPrefs::
|
||||
apz_gtk_kinetic_scroll_pixel_delta_mode_multiplier() *
|
||||
FractionalScaleFactor();
|
||||
ScreenPoint deltas(float(aEvent->delta_x * multiplier),
|
||||
float(aEvent->delta_y * multiplier));
|
||||
|
||||
LayoutDeviceIntPoint touchPoint = GetRefPoint(this, aEvent);
|
||||
PanGestureInput panEvent(
|
||||
eventType, aEvent->time, GetEventTimeStamp(aEvent->time),
|
||||
ScreenPoint(touchPoint.x, touchPoint.y),
|
||||
ScreenPoint(aEvent->delta_x, aEvent->delta_y),
|
||||
ScreenPoint(touchPoint.x, touchPoint.y), deltas,
|
||||
KeymapWrapper::ComputeKeyModifiers(aEvent->state));
|
||||
panEvent.mDeltaType = PanGestureInput::PANDELTA_PAGE;
|
||||
panEvent.mDeltaType = isPageMode ? PanGestureInput::PANDELTA_PAGE
|
||||
: PanGestureInput::PANDELTA_PIXEL;
|
||||
panEvent.mSimulateMomentum = true;
|
||||
|
||||
DispatchPanGestureInput(panEvent);
|
||||
|
|
Загрузка…
Ссылка в новой задаче