#include <gtk/gtk.h>

static gboolean
scroll_event_cb (GtkWidget      *widget,
                 GdkEventScroll *event)
{
  gchar *direction;

  switch (event->direction)
    {
    case GDK_SCROLL_UP:
      direction = "up";
      break;

    case GDK_SCROLL_DOWN:
      direction = "down";
      break;

    case GDK_SCROLL_SMOOTH:
      direction = "smooth";
      break;

    default:
      direction = "other";
      break;
    }

  g_print ("scroll event: direction = %s\n", direction);
}

gint
main (gint argc, gchar *argv[])
{
  GtkWidget *window;
  gint events;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window), 500, 500);
  g_signal_connect (window, "destroy", gtk_main_quit, NULL);

  g_signal_connect (window,
                    "scroll-event",
                    G_CALLBACK (scroll_event_cb),
                    NULL);

  gtk_widget_show_all (window);

  gtk_main ();
  return 0;
}
