GtkScrolledWindow auto-scroll during drag-n-drop

Is there some built in way to make scrolled windows autoscroll when dragging during a DnD operation towards their edges?

This seems like what would be a common operation for apps that support dragging and dropping things into scrollable containers. Here is an example from Zrythm:


I am initiating a drag from the GtkTreeView and I want to drop the row inside that container, which is structured roughly as:

    - box 1
    - box 2
    - box 3
    - box 4
    - box 5
    - box 6
    - box 7
    - box 8
    - box 9

Each box accepts a drag, however I’d expect the scrolled window to auto-scroll since I am dragging something within its bounds close to its edges. Is there built in functionality for this or would I have to implement drag motion handlers and change the scrolled window’s GtkAlignment manually?

1 Like

The GtkTreeView in nautilus ( GNOME Files ) list view does seem to scroll on drag drops, when moved towards the edge.

You can take a look at it.


thanks! I found some autoscroll code in nautilus-dnd.c, so I guess there isn’t a built in way to do it and would need a custom implementation. the nautilus code seems to do roughly what I imagined

1 Like

I think 'GtkScrolledWindow' should probably support this feature.

Maybe GTK devs can clarify that part.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.