After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 742848 - scrolledwindow: should emit edge-overshot when scrollbar reaches end
scrolledwindow: should emit edge-overshot when scrollbar reaches end
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkScrolledWindow
3.15.x
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-01-13 13:03 UTC by Cosimo Cecchi
Modified: 2015-01-31 23:09 UTC
See Also:
GNOME target: 3.16
GNOME version: ---


Attachments
scrolledwindow: add a new edge-reached signal (5.15 KB, patch)
2015-01-25 11:56 UTC, Cosimo Cecchi
committed Details | Review

Description Cosimo Cecchi 2015-01-13 13:03:15 UTC
In bug #738881, gnome-documents was ported to use the newly introduced edge-overshot signal of GtkScrolledWindow to drive the logic of the "Load More" button.
While this works fine for touchpad scrolling, it doesn't work when the scrollbar is dragged to the end. Me and Carlos agree GtkScrolledWindow should emit the signal too in that case.
Comment 1 Matthias Clasen 2015-01-13 13:14:20 UTC
sounds plausible. have a patch ?
Comment 2 Cosimo Cecchi 2015-01-25 11:56:08 UTC
Created attachment 295371 [details] [review]
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.

--

This is a solution me and Carlos agreed upon; add a different signal, since the intent of "edge-overshot" is really to detect when scrolling goes past the boundaries of the scrollable area (e.g. to trigger a refresh), as opposed to detecting when the edge is reached.
Comment 3 Matthias Clasen 2015-01-29 03:54:55 UTC
Review of attachment 295371 [details] [review]:

Looks fine to me, with those cosmetic fixes

::: gtk/gtkscrolledwindow.c
@@ +674,3 @@
                   G_TYPE_NONE, 1, GTK_TYPE_POSITION_TYPE);
+  /**
+   * GtkScrolledWindow::edge-reached:

Please add a newline before the comment

@@ +678,3 @@
+   * @pos: edge side that was reached
+   *
+   * The ::edge-reached signal is emitted whenever user initiated scrolling

Should probably be user-initiated

@@ +3272,3 @@
+    edge_pos = (edge_pos == GTK_POS_LEFT) ? GTK_POS_RIGHT : GTK_POS_LEFT;
+
+  g_signal_emit (scrolled_window, signals[EDGE_REACHED], 0, edge_pos);

I'll point out that you can have value == lower and value == upper - page at the same time. But then, in that case the value should be fixed at lower, and no value-changed signal will ever be emitted...

@@ +3282,3 @@
   GtkScrolledWindowPrivate *priv = scrolled_window->priv;
 
+  maybe_emit_edge_reached (scrolled_window, adjustment);

I guess in theory, you can also end up with value == lower or value == upper by changing the limits - probably a corner case not worth worrying about.
Comment 4 Cosimo Cecchi 2015-01-31 23:09:12 UTC
Pushed to master with those changes - thanks for the review.

Attachment 295371 [details] pushed as 404e275 - scrolledwindow: add a new edge-reached signal