mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -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>
|
2007-03-22 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter.pc.in: Require gobject-2.0 too.
|
* clutter.pc.in: Require gobject-2.0 too.
|
||||||
|
@ -433,7 +433,7 @@ _clutter_event_queue_pop (ClutterBackend *backend)
|
|||||||
if (!backend->events_queue)
|
if (!backend->events_queue)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return g_queue_pop_head (backend->events_queue);
|
return g_queue_pop_tail (backend->events_queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterEvent *
|
ClutterEvent *
|
||||||
@ -442,7 +442,7 @@ _clutter_event_queue_peek (ClutterBackend *backend)
|
|||||||
if (!backend->events_queue)
|
if (!backend->events_queue)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return g_queue_peek_head (backend->events_queue);
|
return g_queue_peek_tail (backend->events_queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -632,3 +632,19 @@ clutter_init (int *argc,
|
|||||||
|
|
||||||
return CLUTTER_INIT_SUCCESS;
|
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);
|
ClutterEvent *_clutter_event_queue_peek (ClutterBackend *backend);
|
||||||
gboolean _clutter_event_queue_check_pending (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,
|
typedef void (* ClutterEventFunc) (ClutterEvent *event,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
|
@ -88,7 +88,8 @@ enum
|
|||||||
static guint stage_signals[LAST_SIGNAL] = { 0 };
|
static guint stage_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
static void
|
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
|
/* FIXME - destroy the main stage, probably attaching a weak ref
|
||||||
* to it from the backend, so that it gets destroyed too.
|
* 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_TYPE_COLOR,
|
||||||
CLUTTER_PARAM_READWRITE));
|
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:
|
* ClutterStage::button-press-event:
|
||||||
* @stage: the actor which received the event
|
* @stage: the actor which received the event
|
||||||
@ -260,7 +243,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
clutter_marshal_VOID__BOXED,
|
clutter_marshal_VOID__BOXED,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
CLUTTER_TYPE_EVENT);
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||||
/**
|
/**
|
||||||
* ClutterStage::button-release-event:
|
* ClutterStage::button-release-event:
|
||||||
* @stage: the actor which received the event
|
* @stage: the actor which received the event
|
||||||
@ -277,7 +260,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
clutter_marshal_VOID__BOXED,
|
clutter_marshal_VOID__BOXED,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
CLUTTER_TYPE_EVENT);
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||||
/**
|
/**
|
||||||
* ClutterStage::scroll-event:
|
* ClutterStage::scroll-event:
|
||||||
* @stage: the actor which received the event
|
* @stage: the actor which received the event
|
||||||
@ -296,7 +279,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
clutter_marshal_VOID__BOXED,
|
clutter_marshal_VOID__BOXED,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
CLUTTER_TYPE_EVENT);
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||||
/**
|
/**
|
||||||
* ClutterStage::key-press-event:
|
* ClutterStage::key-press-event:
|
||||||
* @stage: the actor which received the event
|
* @stage: the actor which received the event
|
||||||
@ -313,7 +296,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
clutter_marshal_VOID__BOXED,
|
clutter_marshal_VOID__BOXED,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
CLUTTER_TYPE_EVENT);
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||||
/**
|
/**
|
||||||
* ClutterStage::key-release-event:
|
* ClutterStage::key-release-event:
|
||||||
* @stage: the actor which received the event
|
* @stage: the actor which received the event
|
||||||
@ -330,7 +313,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
clutter_marshal_VOID__BOXED,
|
clutter_marshal_VOID__BOXED,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
CLUTTER_TYPE_EVENT);
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||||
/**
|
/**
|
||||||
* ClutterStage::motion-event:
|
* ClutterStage::motion-event:
|
||||||
* @stage: the actor which received the event
|
* @stage: the actor which received the event
|
||||||
@ -347,16 +330,17 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
clutter_marshal_VOID__BOXED,
|
clutter_marshal_VOID__BOXED,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
CLUTTER_TYPE_EVENT);
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||||
|
|
||||||
stage_signals[DELETE_EVENT] =
|
stage_signals[DELETE_EVENT] =
|
||||||
g_signal_new ("delete-event",
|
g_signal_new ("delete-event",
|
||||||
G_TYPE_FROM_CLASS (gobject_class),
|
G_TYPE_FROM_CLASS (gobject_class),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (ClutterStageClass, delete_event),
|
G_STRUCT_OFFSET (ClutterStageClass, delete_event),
|
||||||
NULL, NULL,
|
_clutter_boolean_accumulator, NULL,
|
||||||
clutter_marshal_VOID__VOID,
|
clutter_marshal_VOID__BOXED,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_BOOLEAN, 1,
|
||||||
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||||
|
|
||||||
g_type_class_add_private (gobject_class, sizeof (ClutterStagePrivate));
|
g_type_class_add_private (gobject_class, sizeof (ClutterStagePrivate));
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ struct _ClutterStageClass
|
|||||||
void (* flush) (ClutterStage *stage);
|
void (* flush) (ClutterStage *stage);
|
||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
void (* input_event) (ClutterStage *stage,
|
void (* event) (ClutterStage *stage,
|
||||||
ClutterEvent *event);
|
ClutterEvent *event);
|
||||||
void (* button_press_event) (ClutterStage *stage,
|
void (* button_press_event) (ClutterStage *stage,
|
||||||
ClutterButtonEvent *event);
|
ClutterButtonEvent *event);
|
||||||
@ -112,7 +112,8 @@ struct _ClutterStageClass
|
|||||||
ClutterMotionEvent *event);
|
ClutterMotionEvent *event);
|
||||||
void (* stage_state_event) (ClutterStage *stage,
|
void (* stage_state_event) (ClutterStage *stage,
|
||||||
ClutterStageStateEvent *event);
|
ClutterStageStateEvent *event);
|
||||||
void (* delete_event) (ClutterStage *stage);
|
void (* delete_event) (ClutterStage *stage,
|
||||||
|
ClutterAnyEvent *event);
|
||||||
|
|
||||||
/* padding for future expansion */
|
/* padding for future expansion */
|
||||||
void (*_clutter_stage1) (void);
|
void (*_clutter_stage1) (void);
|
||||||
|
@ -312,6 +312,8 @@ clutter_event_translate (ClutterBackend *backend,
|
|||||||
event->motion.modifier_state = xevent->xmotion.state;
|
event->motion.modifier_state = xevent->xmotion.state;
|
||||||
break;
|
break;
|
||||||
case DestroyNotify:
|
case DestroyNotify:
|
||||||
|
CLUTTER_NOTE (EVENT, "destroy notify:\twindow: %ld",
|
||||||
|
xevent->xdestroywindow.window);
|
||||||
event->type = event->any.type = CLUTTER_DESTROY_NOTIFY;
|
event->type = event->any.type = CLUTTER_DESTROY_NOTIFY;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -59,14 +59,8 @@ Macro evaluating to the height of the #ClutterStage
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
@clutterstage: the object which received the signal.
|
@clutterstage: the object which received the signal.
|
||||||
|
@Param2:
|
||||||
<!-- ##### SIGNAL ClutterStage::input-event ##### -->
|
@Returns:
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@clutterstage: the object which received the signal.
|
|
||||||
@arg1:
|
|
||||||
|
|
||||||
<!-- ##### SIGNAL ClutterStage::key-press-event ##### -->
|
<!-- ##### SIGNAL ClutterStage::key-press-event ##### -->
|
||||||
<para>
|
<para>
|
||||||
@ -132,7 +126,7 @@ Macro evaluating to the height of the #ClutterStage
|
|||||||
@get_actor_at_pos:
|
@get_actor_at_pos:
|
||||||
@draw_to_pixbuf:
|
@draw_to_pixbuf:
|
||||||
@flush:
|
@flush:
|
||||||
@input_event:
|
@event:
|
||||||
@button_press_event:
|
@button_press_event:
|
||||||
@button_release_event:
|
@button_release_event:
|
||||||
@scroll_event:
|
@scroll_event:
|
||||||
|
@ -79,6 +79,17 @@ key_release_cb (ClutterStage *stage,
|
|||||||
g_print ("key-release-event\n");
|
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
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -91,6 +102,8 @@ main (int argc, char *argv[])
|
|||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
|
|
||||||
stage = clutter_stage_get_default ();
|
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_signal_connect (stage, "key-press-event",
|
||||||
G_CALLBACK (key_press_cb), NULL);
|
G_CALLBACK (key_press_cb), NULL);
|
||||||
g_signal_connect (stage, "key-release-event",
|
g_signal_connect (stage, "key-release-event",
|
||||||
|
Loading…
Reference in New Issue
Block a user