GNOME Bugzilla – Bug 742848
scrolledwindow: should emit edge-overshot when scrollbar reaches end
Last modified: 2015-01-31 23:09:28 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.
sounds plausible. have a patch ?
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.
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.
Pushed to master with those changes - thanks for the review. Attachment 295371 [details] pushed as 404e275 - scrolledwindow: add a new edge-reached signal