summaryrefslogtreecommitdiff
path: root/pugl/pugl_x11.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-29 06:08:19 +0000
committerDavid Robillard <d@drobilla.net>2012-04-29 06:08:19 +0000
commitd4b2829de83ca5f0efd3d1ee2683ee400e63ffe2 (patch)
treed2e514e1090cf34e77174503bfb4859e9448fdb8 /pugl/pugl_x11.c
parent48c439c06576092e1b3de89146c7f201a3f4453b (diff)
Scroll API.
Diffstat (limited to 'pugl/pugl_x11.c')
-rw-r--r--pugl/pugl_x11.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c
index d8685b2..735cdb1 100644
--- a/pugl/pugl_x11.c
+++ b/pugl/pugl_x11.c
@@ -238,8 +238,23 @@ puglProcessEvents(PuglWindow* win)
}
break;
case ButtonPress:
+ if (event.xbutton.button >= 4 && event.xbutton.button <= 7) {
+ if (win->scrollFunc) {
+ int dx = 0, dy = 0;
+ switch (event.xbutton.button) {
+ case 4: dy = 1; break;
+ case 5: dy = -1; break;
+ case 6: dx = -1; break;
+ case 7: dx = 1; break;
+ }
+ win->scrollFunc(win, dx, dy);
+ }
+ break;
+ }
+ // nobreak
case ButtonRelease:
- if (win->mouseFunc) {
+ if (win->mouseFunc &&
+ (event.xbutton.button < 4 || event.xbutton.button > 7)) {
win->mouseFunc(win,
event.xbutton.button, event.type == ButtonPress,
event.xbutton.x, event.xbutton.y);