mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
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.
This commit is contained in:
parent
b9c9aaccb2
commit
93d7454b37
@ -1,3 +1,8 @@
|
||||
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.
|
||||
|
@ -433,7 +433,7 @@ _clutter_event_queue_pop (ClutterBackend *backend)
|
||||
if (!backend->events_queue)
|
||||
return NULL;
|
||||
|
||||
return g_queue_pop_head (backend->events_queue);
|
||||
return g_queue_pop_tail (backend->events_queue);
|
||||
}
|
||||
|
||||
ClutterEvent *
|
||||
@ -442,7 +442,7 @@ _clutter_event_queue_peek (ClutterBackend *backend)
|
||||
if (!backend->events_queue)
|
||||
return NULL;
|
||||
|
||||
return g_queue_peek_head (backend->events_queue);
|
||||
return g_queue_peek_tail (backend->events_queue);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -632,3 +632,19 @@ clutter_init (int *argc,
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -96,6 +96,12 @@ ClutterEvent *_clutter_event_queue_pop (ClutterBackend *backend);
|
||||
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);
|
||||
|
||||
|
@ -88,7 +88,8 @@ enum
|
||||
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.
|
||||
@ -226,24 +227,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
CLUTTER_TYPE_COLOR,
|
||||
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
|
||||
@ -260,7 +243,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
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
|
||||
@ -277,7 +260,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
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
|
||||
@ -296,7 +279,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
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
|
||||
@ -313,7 +296,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
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
|
||||
@ -330,7 +313,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
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
|
||||
@ -347,16 +330,17 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
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));
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ struct _ClutterStageClass
|
||||
void (* flush) (ClutterStage *stage);
|
||||
|
||||
/* signals */
|
||||
void (* input_event) (ClutterStage *stage,
|
||||
void (* event) (ClutterStage *stage,
|
||||
ClutterEvent *event);
|
||||
void (* button_press_event) (ClutterStage *stage,
|
||||
ClutterButtonEvent *event);
|
||||
@ -112,7 +112,8 @@ struct _ClutterStageClass
|
||||
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);
|
||||
|
@ -312,6 +312,8 @@ clutter_event_translate (ClutterBackend *backend,
|
||||
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:
|
||||
|
@ -59,14 +59,8 @@ Macro evaluating to the height of the #ClutterStage
|
||||
</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>
|
||||
@ -132,7 +126,7 @@ Macro evaluating to the height of the #ClutterStage
|
||||
@get_actor_at_pos:
|
||||
@draw_to_pixbuf:
|
||||
@flush:
|
||||
@input_event:
|
||||
@event:
|
||||
@button_press_event:
|
||||
@button_release_event:
|
||||
@scroll_event:
|
||||
|
@ -79,6 +79,17 @@ key_release_cb (ClutterStage *stage,
|
||||
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[])
|
||||
{
|
||||
@ -91,6 +102,8 @@ 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",
|
||||
|
Loading…
Reference in New Issue
Block a user