Commit Graph

11 Commits

Author SHA1 Message Date
Alexander Mikhaylenko
d7a5dedd4f scrolledwindow: Cancel overshoot on dimension changes
If we scroll down in a list that's still being filled, we hit the edge and
initiate overshoot, and then the adjustment's upper value increases. This
leads to an unwanted bounce back.

Additionally, if in a similar situation the upper value decreases, the
overscroll glow gets stuck.

Update kinetic scrolling upper and lower value on changes, and immediately
cancel it if dimensions on that side change.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3752
2021-04-01 16:37:30 +05:00
Chris Lord
4b459a99be scrolledwindow: Accumulate velocity with kinetic scrolling
Accumulate existing velocity when decelerating from a swipe if the swipe
velocity is above a certain fraction of that existing velocity.
2020-11-09 15:28:32 +00:00
Björn Daase
6315cd977c *: Fix spelling mistakes found by codespell 2020-08-21 15:29:34 +02:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Christoph Reiter
2d5cf2b4c4 Drop fallback-c89.c
We require a C compiler supporting C99 now. The main purpose of
these fallbacks was for MSVC. From what I can see this is now all supported
by MSVC 2015+ anyway.

The only other change this includes is to replace isnanf() with the
(type infering) C99 isnan() macro, because MSVC doesn't provide isnanf().
2020-05-31 17:09:23 +02:00
Timm Bäder
e6d104bfa0 Rename gtkkineticscrolling.h to gtkkineticscrollingprivate.h
To match the naming scheme we use for all private header files.
2018-03-28 16:47:54 +02:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Christian Hergert
4f63d83955 kineticscrolling: avoid stutter at tail of kinetic deceleration
When decelerating the kinetic scroll, we can get into a position where it
looks like we are stuttering. This happens because the amount we move is
so little that it takes multiple frames to make forward progress by one
pixel.

This prevents that by detecting when we have reached the slow stutter of
the deceleration and simply stops the deceleration phase immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=765493
2016-04-24 03:49:20 -07:00
Matthias Clasen
9545c01764 kinetic scrolling: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Chun-wei Fan
d8de23bef6 gtk/gtkkineticscrolling.c: Include fallback-c89.c
... as round() is being used, which is for C99 and later.  fallback-c89.c
includes math.h as well.
2014-06-06 14:47:19 +08:00
Lieven van der Heide
c726226825 gtk: Add kinetic scrolling helper
GtkKineticScrolling implements the actual physics laws for friction
and springs. When created, position/velocity/boundaries/constants are
given, so at every gtk_kinetic_scrolling_tick() it returns the current
position, and whether the system is in rest.

https://bugzilla.gnome.org/show_bug.cgi?id=729608
2014-06-05 16:49:23 +02:00