Skip to content

Commit

Permalink
Merge pull request ScenicFramework#57 from gridpoint-com/fix-scroll-e…
Browse files Browse the repository at this point in the history
…vent

cairo-gtk: fix scroll event x/y offset
  • Loading branch information
crertel authored Oct 28, 2023
2 parents 3ca1d5a + 70d2bf3 commit 392812d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions c_src/device/cairo/cairo_gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,16 @@ static gboolean on_scroll_event(GtkWidget* widget,
{
float x = floorf(event->x);
float y = floorf(event->y);
float xoffset = floorf(event->delta_x);
float yoffset = floorf(event->delta_y);
float xoffset = 0.0;
float yoffset = 0.0;

switch (event->direction) {
case GDK_SCROLL_UP: yoffset = -1.0; break;
case GDK_SCROLL_DOWN: yoffset = 1.0; break;
case GDK_SCROLL_LEFT: xoffset = 1.0; break;
case GDK_SCROLL_RIGHT: xoffset = -1.0; break;
case GDK_SCROLL_SMOOTH: return FALSE;
}
send_scroll(xoffset, yoffset, x, y);

return TRUE;
Expand Down

0 comments on commit 392812d

Please sign in to comment.