aboutsummaryrefslogtreecommitdiff
path: root/fiv-view.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-22 16:36:38 +0100
committerPřemysl Eric Janouch <p@janouch.name>2022-07-15 14:00:31 +0200
commitc55500f51ad560273b9d5cd71468baf8b0d3df5a (patch)
tree74360533de00f29921794759827cf08303d1486e /fiv-view.c
parent1fee920902265cfa8943065d0228cbcc7296f304 (diff)
downloadfiv-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.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fiv-view.c b/fiv-view.c
index 83173f7..d4a95c9 100644
--- a/fiv-view.c
+++ b/fiv-view.c
@@ -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.