+2007-03-23 Emmanuele Bassi <ebassi@openedhand.com>
+
+ * clutter/clutter-event.c: Pop and peek the event queue
+ from the tail - it's a queue, not a stack.
+
2007-03-22 Emmanuele Bassi <ebassi@openedhand.com>
* clutter.pc.in: Require gobject-2.0 too.
if (!backend->events_queue)
return NULL;
- return g_queue_pop_head (backend->events_queue);
+ return g_queue_pop_tail (backend->events_queue);
}
ClutterEvent *
if (!backend->events_queue)
return NULL;
- return g_queue_peek_head (backend->events_queue);
+ return g_queue_peek_tail (backend->events_queue);
}
gboolean
return CLUTTER_INIT_SUCCESS;
}
+
+gboolean
+_clutter_boolean_accumulator (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer dummy)
+{
+ gboolean continue_emission;
+ gboolean signal_handled;
+
+ signal_handled = g_value_get_boolean (handler_return);
+ g_value_set_boolean (return_accu, signal_handled);
+ continue_emission = !signal_handled;
+
+ return continue_emission;
+}
ClutterEvent *_clutter_event_queue_peek (ClutterBackend *backend);
gboolean _clutter_event_queue_check_pending (ClutterBackend *backend);
+/* signal accumulators */
+gboolean _clutter_boolean_accumulator (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer dummy);
+
typedef void (* ClutterEventFunc) (ClutterEvent *event,
gpointer data);
static guint stage_signals[LAST_SIGNAL] = { 0 };
static void
-clutter_stage_delete_event (ClutterStage *stage)
+clutter_stage_delete_event (ClutterStage *stage,
+ ClutterAnyEvent *event)
{
/* FIXME - destroy the main stage, probably attaching a weak ref
* to it from the backend, so that it gets destroyed too.
CLUTTER_PARAM_READWRITE));
/**
- * ClutterStage::input-event:
- * @stage: the actor which received the event
- * @event: the event received
- *
- * The ::input-event is a signal emitted when any input event is
- * received. Valid input events are mouse button press and release
- * events, and key press and release events.
- */
- stage_signals[INPUT_EVENT] =
- g_signal_new ("input-event",
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterStageClass, input_event),
- NULL, NULL,
- clutter_marshal_VOID__BOXED,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_EVENT);
- /**
* ClutterStage::button-press-event:
* @stage: the actor which received the event
* @event: a #ClutterButtonEvent
NULL, NULL,
clutter_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
- CLUTTER_TYPE_EVENT);
+ CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* ClutterStage::button-release-event:
* @stage: the actor which received the event
NULL, NULL,
clutter_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
- CLUTTER_TYPE_EVENT);
+ CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* ClutterStage::scroll-event:
* @stage: the actor which received the event
NULL, NULL,
clutter_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
- CLUTTER_TYPE_EVENT);
+ CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* ClutterStage::key-press-event:
* @stage: the actor which received the event
NULL, NULL,
clutter_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
- CLUTTER_TYPE_EVENT);
+ CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* ClutterStage::key-release-event:
* @stage: the actor which received the event
NULL, NULL,
clutter_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
- CLUTTER_TYPE_EVENT);
+ CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* ClutterStage::motion-event:
* @stage: the actor which received the event
NULL, NULL,
clutter_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
- CLUTTER_TYPE_EVENT);
+ CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
stage_signals[DELETE_EVENT] =
g_signal_new ("delete-event",
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterStageClass, delete_event),
- NULL, NULL,
- clutter_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ _clutter_boolean_accumulator, NULL,
+ clutter_marshal_VOID__BOXED,
+ G_TYPE_BOOLEAN, 1,
+ CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
g_type_class_add_private (gobject_class, sizeof (ClutterStagePrivate));
}
void (* flush) (ClutterStage *stage);
/* signals */
- void (* input_event) (ClutterStage *stage,
+ void (* event) (ClutterStage *stage,
ClutterEvent *event);
void (* button_press_event) (ClutterStage *stage,
ClutterButtonEvent *event);
ClutterMotionEvent *event);
void (* stage_state_event) (ClutterStage *stage,
ClutterStageStateEvent *event);
- void (* delete_event) (ClutterStage *stage);
+ void (* delete_event) (ClutterStage *stage,
+ ClutterAnyEvent *event);
/* padding for future expansion */
void (*_clutter_stage1) (void);
event->motion.modifier_state = xevent->xmotion.state;
break;
case DestroyNotify:
+ CLUTTER_NOTE (EVENT, "destroy notify:\twindow: %ld",
+ xevent->xdestroywindow.window);
event->type = event->any.type = CLUTTER_DESTROY_NOTIFY;
break;
default:
</para>
@clutterstage: the object which received the signal.
-
-<!-- ##### SIGNAL ClutterStage::input-event ##### -->
-<para>
-
-</para>
-
-@clutterstage: the object which received the signal.
-@arg1:
+@Param2:
+@Returns:
<!-- ##### SIGNAL ClutterStage::key-press-event ##### -->
<para>
@get_actor_at_pos:
@draw_to_pixbuf:
@flush:
-@input_event:
+@event:
@button_press_event:
@button_release_event:
@scroll_event:
g_print ("key-release-event\n");
}
+static gboolean
+delete_event_cb (ClutterStage *stage,
+ ClutterEvent *event,
+ gpointer data)
+{
+ g_print ("delete-event\n");
+
+ return TRUE;
+}
+
+
int
main (int argc, char *argv[])
{
clutter_init (&argc, &argv);
stage = clutter_stage_get_default ();
+ g_signal_connect (stage, "delete-event",
+ G_CALLBACK (delete_event_cb), NULL);
g_signal_connect (stage, "key-press-event",
G_CALLBACK (key_press_cb), NULL);
g_signal_connect (stage, "key-release-event",