summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2010-11-18 03:34:11 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2010-11-24 02:34:55 +0100
commitea9e07da3b913bdde37808dda0afba2144bd36b7 (patch)
tree6966b63bdccb1657d95e8e2fae2ea6f808b6de6e
parentd48a6bf4345fe7dd74dbf5e30328ab30836d1cc5 (diff)
downloadspice-gtk-ea9e07da3b913bdde37808dda0afba2144bd36b7.tar.gz
spice-gtk-ea9e07da3b913bdde37808dda0afba2144bd36b7.tar.xz
spice-gtk-ea9e07da3b913bdde37808dda0afba2144bd36b7.zip
gtk: hack to handle scrolling
-rw-r--r--gtk/spice-widget.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index bd672b3..508a1fb 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -958,6 +958,32 @@ static gboolean motion_event(GtkWidget *widget, GdkEventMotion *motion)
return true;
}
+static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *scroll)
+{
+ int button;
+ SpiceDisplay *display = SPICE_DISPLAY(widget);
+ spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display);
+
+ SPICE_DEBUG("%s", __FUNCTION__);
+
+ if (!d->inputs)
+ return true;
+
+ if (scroll->direction == GDK_SCROLL_UP)
+ button = SPICE_MOUSE_BUTTON_UP;
+ else if (scroll->direction == GDK_SCROLL_DOWN)
+ button = SPICE_MOUSE_BUTTON_DOWN;
+ else {
+ SPICE_DEBUG("unsupported scroll direction");
+ return true;
+ }
+
+ spice_inputs_button_press(d->inputs, button,
+ button_mask_gdk_to_spice(scroll->state));
+ spice_inputs_button_release(d->inputs, button,
+ button_mask_gdk_to_spice(scroll->state));
+}
+
static gboolean button_event(GtkWidget *widget, GdkEventButton *button)
{
SpiceDisplay *display = SPICE_DISPLAY(widget);
@@ -1120,6 +1146,7 @@ static void spice_display_class_init(SpiceDisplayClass *klass)
gtkwidget_class->button_press_event = button_event;
gtkwidget_class->button_release_event = button_event;
gtkwidget_class->configure_event = configure_event;
+ gtkwidget_class->scroll_event = scroll_event;
gtkobject_class->destroy = spice_display_destroy;