diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-11-22 16:36:38 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2022-07-15 14:00:31 +0200 |
commit | c55500f51ad560273b9d5cd71468baf8b0d3df5a (patch) | |
tree | 74360533de00f29921794759827cf08303d1486e /fiv-view.c | |
parent | 1fee920902265cfa8943065d0228cbcc7296f304 (diff) | |
download | fiv-c55500f51ad560273b9d5cd71468baf8b0d3df5a.tar.gz fiv-c55500f51ad560273b9d5cd71468baf8b0d3df5a.tar.xz fiv-c55500f51ad560273b9d5cd71468baf8b0d3df5a.zip |
Support dragging the view
It would also be possible to handle this through press/motion/release
event handlers, though GtkGestureDrag is more convenient for hacking in
support for dragging to widgets not supporting GtkScrollable (yet).
There may be some undesired interactions lurking, besides the jarring
movements when dragging native GdkWindows (these are a pain).
Diffstat (limited to 'fiv-view.c')
-rw-r--r-- | fiv-view.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -384,8 +384,12 @@ fiv_view_realize(GtkWidget *widget) // Assuming here that we can't ask for a higher-precision Visual // than what we get automatically. .visual = gtk_widget_get_visual(widget), - .event_mask = gtk_widget_get_events(widget) | GDK_SCROLL_MASK | - GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK, + + // Pointer motion/release enables attaching GtkGestureDrag to + // the parent GtkScrolledWindow, having it work with the mouse. + .event_mask = gtk_widget_get_events(widget) | GDK_KEY_PRESS_MASK | + GDK_SCROLL_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | + GDK_POINTER_MOTION_MASK, }; // We need this window to receive input events at all. |