Loading

Missing events

  1. #include <gtk/gtk.h>
  2. #include <clutter-gtk/clutter-gtk.h>
  3.  
  4. gboolean
  5. clutter_stage_event_cb (ClutterStage *stage,
  6.                         ClutterEvent *event,
  7.                         gpointer      udata)
  8. {
  9.   gboolean handled = FALSE;
  10.  
  11.   switch (event->type)
  12.     {
  13.     case CLUTTER_MOTION:
  14.       g_print ("[%ld] [%p] CLUTTER_MOTION\n", g_get_monotonic_time (), stage);
  15.       handled = TRUE;
  16.       break;
  17.     case CLUTTER_ENTER:
  18.       g_print ("[%ld] [%p] CLUTTER_ENTER\n", g_get_monotonic_time (), stage);
  19.       handled = TRUE;
  20.       break;
  21.     case CLUTTER_LEAVE:
  22.       g_print ("[%ld] [%p] CLUTTER_LEAVE\n", g_get_monotonic_time (), stage);
  23.       handled = TRUE;
  24.       break;
  25.     }
  26.  
  27.   return handled;
  28. }
  29.  
  30. int
  31. main (int   argc,
  32.       char *argv[])
  33. {
  34.   ClutterInitError ret = gtk_clutter_init (&argc, &argv);
  35.  
  36.   GtkWidget *window1 = gtk_clutter_window_new ();
  37.   ClutterActor *stage1 = gtk_clutter_window_get_stage (GTK_CLUTTER_WINDOW (window1));
  38.   gtk_window_set_default_size (GTK_WINDOW (window1), 200, 200);
  39.   g_signal_connect (stage1, "event", G_CALLBACK (clutter_stage_event_cb), NULL);
  40.   gtk_widget_show_all (window1);
  41.  
  42.   GtkWidget *window2 = gtk_clutter_window_new ();
  43.   ClutterActor *stage2 = gtk_clutter_window_get_stage (GTK_CLUTTER_WINDOW (window2));
  44.   gtk_window_set_default_size (GTK_WINDOW (window2), 200, 200);
  45.   g_signal_connect (stage2, "event", G_CALLBACK (clutter_stage_event_cb), NULL);
  46.   gtk_widget_show_all (window2);
  47.  
  48.   gtk_main ();
  49.   return 0;
  50. }