Commit Graph

295 Commits

Author SHA1 Message Date
Cosimo Cecchi
404e2753c4 scrolledwindow: add a new edge-reached signal
This will be used to just detect when an edge of the scrollable area is
reached - as opposed to the edge-overshot signal that is emitted when
the user scrolls past the edge.

https://bugzilla.gnome.org/show_bug.cgi?id=742848
2015-01-31 23:08:17 +00:00
Carlos Garnacho
dc952e3d94 scrolledwindow: Don't displace invalidation by the widget allocation
This was left unmodified when GtkScrolledWindow was made a windowed widget.
Displacing here by the widget allocation is not necessary anymore, since
we are invalidating the window set at these coordinates.

This patch is a simplification of a previous one by Timm Bäder.

https://bugzilla.gnome.org/show_bug.cgi?id=742243
2015-01-19 13:06:27 +01:00
Matthias Clasen
9e1f870680 scrolled window: Reduce the hover proximity distance further 2015-01-18 20:01:55 -05:00
Matthias Clasen
9fde44ac10 Fine-tune the proximity hovering for scrollbars
Reduce the distance at which we expand the scrollbar,
and add some hysteresis.
2015-01-18 14:28:47 -05:00
Matthias Clasen
9fcbae2d85 GtkScrolledWindow: Don't start fading right away
When we get a leave event, we need to remove the over bit,
since we may not get motion events that tell us when we lose
proximity, but we don't have to fade out right away - that
will happen on its on due to inactivity a bit later. Having
the indicator stay visible for a bit feels more relaxed.
2015-01-09 21:15:07 -05:00
Matthias Clasen
206f0bbf7f GtkScrolledWindow: Factor out a constant
Define INDICATOR_CLOSE_DISTANCE instead of hardcoding the same
number of pixels in 4 different places.
2015-01-09 21:15:06 -05:00
Matthias Clasen
11eb64a2b6 GtkScrolledWindow: Don't require proximity for track points
These are hard to navigate precisely, so show wide scrollbars
right away.
2015-01-09 21:15:06 -05:00
Matthias Clasen
2a3a7306ef GtkScrolledWindow: Drop device manager complications
We no longer use the presence or absence of particular device
types to determine which scrolling to use.
2015-01-09 21:15:06 -05:00
Matthias Clasen
96fcdebefb GtkScrolledWindow: Drop a redundant field
The Indicator.enabled field was not carrying any extra information,
so just use priv->use_indicators instead.
2015-01-09 21:15:06 -05:00
Matthias Clasen
1c6eca04db GtkScrolledWindow: Rename a private field
touch_mode -> use_indicators, more to the point.
2015-01-09 21:15:06 -05:00
Matthias Clasen
885b3c704f Fix GTK_OVERLAY_SCROLLING=0
This was broken by the recent more dynamic approach.
2015-01-09 06:45:51 -05:00
Matthias Clasen
d5afaa07d3 Fix comment typo 2015-01-09 06:21:37 -05:00
Christian Hergert
4d4883f010 scrolledwindow: fix spurious warnings from previous scrollbar commits 2014-12-26 14:19:55 -08:00
Carlos Garnacho
7f28077b5a scrolledwindow: Enable "hover" mode in scrollbars after a timeout
This way transient mouse movements over scrollbars don't cause flickering,
and more spaced movements have it enabled shortly.
2014-12-24 09:26:43 -05:00
Carlos Garnacho
d2b2b34ae5 scrolledwindow: improve v/hscrollbar proximity detection
Only horizontal coordinates are checked for the vertical scrollbar, and
vice versa.
2014-12-24 09:26:43 -05:00
Carlos Garnacho
8b85db08e5 scrolledwindow: fade out scrollbars on leave notify 2014-12-24 09:26:43 -05:00
Carlos Garnacho
fdf367e868 scrolledwindow: make it a windowed widget again
This is so we can detect crossing events on the scrolledwindow widget,
which can be useful for toggling certain behaviors or not depending on
whether the mouse is on the widget.
2014-12-24 09:26:43 -05:00
Carlos Garnacho
3bcf5e2863 scrolledwindow: Show scrollbars upon captured motion events
On mice, scrollbars are always triggered temporarily. On proximity to an
scrollbar, it will be switched to full-width.
2014-12-24 09:26:43 -05:00
Matthias Clasen
ab5b0d0983 Make the undershoot area larger
As requested by the artists, double the size from 20 to 40.
2014-12-11 14:49:20 -05:00
Matthias Clasen
a083809b93 GtkScrolledWindow: Take border into account
Use the new scrollable API for getting non-scrollable borders
and draw over/undershoot at the right place. In practice, this
means that they now appear below treeview headers.
2014-12-10 10:01:30 -05:00
Matthias Clasen
b73578f95d Add a scrollable indication
Draw a themable indication when an edge of a scrolled window
is hiding some content that can be scrolled in.
2014-12-10 10:00:21 -05:00
Carlos Garnacho
7651061920 scrolledwindow: Avoid too frequent redraws of scrollbars
When overshooting through touchpad kinetic scrolling, the scrollbar remains
mostly static as it already hit a boundary. However, the fade in/out checks
are constantly run during scroll events, causing needless redraws in this
specific case.
2014-11-17 16:55:08 +01:00
Carlos Garnacho
6d5f2ff87e scrolledwindow: Only render background/frame on the widget window
Otherwise it is rendered too on each indicator window, possibly bringing
in an unintended opaque background there. Better seen with git show -b.
2014-11-17 14:55:05 +01:00
Matthias Clasen
a7173d097f Make overlay scrollbar fading interruptible
When the pointer starts hovering the scrollbar after it already
started fading out, interrupt the fade and keep the scrollbar
around.
2014-11-14 11:49:33 -05:00
Carlos Garnacho
632accd9cc scrolledwindow: Use a fully transparent background for the overlay window
The background will be already given and updated in the GtkScrollbar widget,
plus the background remained static on the window since it is realized.
2014-11-13 21:25:52 +01:00
Carlos Garnacho
b591cacc39 scrolledwindow: Don't doubly draw overlay-indicator scrollbars
The scrollbars are still internal children of the GtkScrolledWindow
and handled in ::forall(), no need to propagate draw here again
after chaining up in ::draw().
2014-11-13 20:32:36 +01:00
Carlos Garnacho
e0353b37a8 scrolledwindow: Only render overshoot on the widget window
Without any check, it was being rendered also on the indicator
GdkWindows, which resulted on an over-exposed effect there.
2014-11-13 20:32:36 +01:00
Matthias Clasen
4ed98878c6 GtkScrolledWindow: Add documentation
Document the new overlay scrolling APIs, and add some more
documentation for the other touch support: kinetic scrolling
and overshoot.
2014-10-20 23:07:45 -04:00
Matthias Clasen
4455266c5b GtkScrolledWindow: Add overlay scrollbars
This commit adds a mode to GtkScrolledWindow in which it puts
narrow, auto-hiding scrollbars over the content, instead of
allocating room for the scrollbars outside of the content. We
use traditional scrollbars if we find a mouse or if overlay
scrolling has explicitly turned off.

For test purposes, GTK_TEST_TOUCHSCREEN can be used to get
overlay scrolling even in the presence of a mouse. The
environment variable GTK_OVERLAY_SCROLLING can also be used
to force overlay scrolling on or off.
2014-10-20 23:07:45 -04:00
Carlos Garnacho
ca9d15df92 scrolledwindow: Add ::edge-overshot signal
This signal is emitted whenever user scrolling hits the overshoot
edge in the given direction. May be useful to add "reload" or "load
more" behaviors in apps.

https://bugzilla.gnome.org/show_bug.cgi?id=738534
2014-10-20 18:52:43 +02:00
Benjamin Otte
2c04c5f08b scrolledwindow: Don't set .frame on overshoot boxes 2014-10-15 17:18:26 +02:00
Carlos Garnacho
103e11c937 scrolledwindow: Allow overshooting on scroll events
The overshoot visual notification is probably also nice to have in this
context.

https://bugzilla.gnome.org/show_bug.cgi?id=738533
2014-10-15 17:00:36 +02:00
Carlos Garnacho
c184bd4675 scrolledwindow: Simplify _gtk_scrolled_window_set_adjustment_value()
The two boolean arguments always received the same values, so wipe these
out. Likewise, the boolean return value is unused and sort of meaningless.
2014-10-14 15:53:14 +02:00
Matthias Clasen
4e974edde8 GtkScrolledWindow: Introduce a helper function
Instead of making assumptions about enum value ordering,
introduce a helper function to determine policy values
for which the scrollbar may be visible.
2014-10-09 21:03:40 -04:00
Matthias Clasen
94b680c2cd GtkScrolledWindow: Allow scrolling without bars
Add a new policy, GTK_POLICY_EXTERNAL, which hides the scrollbar,
but does not force the scrolled windows size to be determined by
its child. This can be used to keep two scrolled windows in sync,
while sharing a single scrollbar.

https://bugzilla.gnome.org/show_bug.cgi?id=730730
2014-10-09 20:18:51 -04:00
Matthias Clasen
1331740dd6 Remove an unused internal export
_gtk_scrolled_window_get_scrollbar_spacing is only used in
gtkscrolledwindow.c, so keep it there.
2014-10-09 00:22:13 -04:00
Matthias Clasen
dd8db0f5cb GtkScrolledWindow: code cleanup
Remove return-if-fail parameter checks from static functions,
where we don't normally do these.
2014-10-05 00:19:51 -04:00
Matthias Clasen
bcfa41cec6 Cosmetic documentation improvements 2014-10-05 00:13:09 -04:00
Benjamin Otte
dd7c65a95a scrolledwindow: Rewrite overshoot code with regular styling
Instead of drawing a gradient in the background color, draw a CSS box.

And change the theme so instead of setting just a background color it
draws a gradient.

The resulting visuals are the same.
2014-10-03 06:18:06 +02:00
Benjamin Otte
a6f935bb77 scrolledwindow: Don't use LIGHTEN operator
For the overshoot gradient, using OVER is fine. Simplifies the code and
increases performance.
2014-10-03 06:18:06 +02:00
Benjamin Otte
d941e5f0c0 scrolledwindow: Remove unused variable 2014-10-03 06:18:06 +02:00
Jesse van den Kieboom
3fa425bb9c scrolling: interpret smooth deltas as pixels on quartz
This is a temporary workaround for scrolling units being amplified
on quartz, due to the assumption that smooth scrolling deltas are
always in some abstract unit similar to the one from xi2.

A proper solution for the situation is described in bug #736121, but
since we are close to release, this patch solves the issue temporarily.

https://bugzilla.gnome.org/show_bug.cgi?id=736121
2014-09-05 14:02:11 +02:00
Carlos Garnacho
42c41d7bbd scrolledwindow: Be smarter at invalidating overshoot areas
The previous way to invalidate was meant to work on the overshoot window
so it wouldn't be as taxing. Since the overshoot window is gone, this
would invalidate way more than intended. So constrain invalidated areas
to the sides where overshoot is happenning at that moment.

https://bugzilla.gnome.org/show_bug.cgi?id=735223
2014-08-28 16:44:12 +02:00
Carlos Garnacho
e3a281be13 scrolledwindow: Make kinetic scrolling only work on touch devices
This code was relying on the previous GtkGestureSingle::touch-only default
value, so restore the behavior back.

https://bugzilla.gnome.org/show_bug.cgi?id=734285
2014-08-15 13:53:40 +02:00
Benjamin Otte
c4c383fa39 scrolledwindow: Remove unused variable 2014-07-22 15:06:26 +02:00
Carlos Garnacho
7bdc219464 scrolledwindow: Remove overshoot window and displacement animation
The displacement animation has been replaced by edge gradients, that
have a stronger color the harder overshooting is hit. This makes it
possible to remove the internal overshoot window, which was merely
used to have contents displaced when overshooting to top/left.

Overshooting to bottom/right used to cause queue_resize() to be
called on the scrolled window, this isn't necessary anymore either.

https://bugzilla.gnome.org/show_bug.cgi?id=731297
2014-07-09 23:13:48 -04:00
Matthias Clasen
939fbc43e1 GtkScrolledWindow: Animate the scroll-child keybinding 2014-07-02 20:58:16 -04:00
Matthias Clasen
3dcd0a24b1 GtkScrolledWindow: Enable animated scrolling
We use gtk_adjustment_enable_animation to enable animated
updates of the adjustments. Currently, this is enabled
unconditionally, and with a duration that is hardcoded.

https://bugzilla.gnome.org/show_bug.cgi?id=732376
2014-06-30 18:41:20 -04:00
Matthias Clasen
4067d0623f Revert "scrolledwindow: fix scrolling with shared adjustment"
This reverts commit f0478c3dfd.
Didn't mean to push this.
2014-06-28 22:29:57 -04:00
Stefan Sauer
f0478c3dfd scrolledwindow: fix scrolling with shared adjustment
The GtkPolicyType set on the scrollbar is just about the presentation. What
matters for scrolling is the adjustment.

https://bugzilla.gnome.org/show_bug.cgi?id=730730
2014-06-28 11:49:54 -04:00