From: Matthew Allum Date: Mon, 5 Jun 2006 21:44:13 +0000 (+0000) Subject: 2006-06-05 Matthew Allum X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7806e409fb6a2cb09bfdef83f19be60a2207c27d;p=profile%2Fivi%2Fclutter.git 2006-06-05 Matthew Allum * clutter/clutter-event.h: Remove send_event field. Clutter shouldn't need it. * clutter/clutter-main.c: (clutter_dispatch_x_event): Dont malloc a new clutter event for each xevent. * clutter/clutter-stage.h: * clutter/clutter-stage.c: (clutter_stage_class_init), (clutter_stage_get_default): Dont ref stage from clutter_stage_get_default. * examples/super-oh.c: (main): Remove some now uneeded debug g_prints --- diff --git a/ChangeLog b/ChangeLog index a66d988..a75c34d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2006-06-05 Matthew Allum + + * clutter/clutter-event.h: + Remove send_event field. Clutter shouldn't need it. + + * clutter/clutter-main.c: (clutter_dispatch_x_event): + Dont malloc a new clutter event for each xevent. + + * clutter/clutter-stage.h: + * clutter/clutter-stage.c: (clutter_stage_class_init), + (clutter_stage_get_default): + Dont ref stage from clutter_stage_get_default. + + * examples/super-oh.c: (main): + Remove some now uneeded debug g_prints + 2006-06-05 Emmanuele Bassi * clutter-color.h: diff --git a/clutter/clutter-event.h b/clutter/clutter-event.h index 6b8593f..7cda71d 100644 --- a/clutter/clutter-event.h +++ b/clutter/clutter-event.h @@ -67,7 +67,6 @@ typedef struct _ClutterInputDevice ClutterInputDevice; struct _ClutterAnyEvent { ClutterEventType type; - guint8 send_event : 1; }; struct _ClutterKeyEvent diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index 5e4ceeb..c46604b 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -151,13 +151,10 @@ clutter_dispatch_x_event (XEvent *xevent, gpointer data) { ClutterMainContext *ctx = CLUTTER_CONTEXT (); - ClutterEvent *event; + ClutterEvent event; ClutterStage *stage = ctx->stage; gboolean emit_input_event = FALSE; - event = clutter_event_new (CLUTTER_NOTHING); - event->any.send_event = xevent->xany.send_event ? TRUE : FALSE; - switch (xevent->type) { case Expose: @@ -177,36 +174,35 @@ clutter_dispatch_x_event (XEvent *xevent, } break; case KeyPress: - translate_key_event ((ClutterKeyEvent *) event, xevent); - g_signal_emit_by_name (stage, "key-press-event", event); + translate_key_event ((ClutterKeyEvent *) &event, xevent); + g_signal_emit_by_name (stage, "key-press-event", &event); emit_input_event = TRUE; break; case KeyRelease: - translate_key_event ((ClutterKeyEvent *) event, xevent); - g_signal_emit_by_name (stage, "key-release-event", event); + translate_key_event ((ClutterKeyEvent *) &event, xevent); + g_signal_emit_by_name (stage, "key-release-event", &event); emit_input_event = TRUE; break; case ButtonPress: - translate_button_event ((ClutterButtonEvent *) event, xevent); - g_signal_emit_by_name (stage, "button-press-event", event); + translate_button_event ((ClutterButtonEvent *) &event, xevent); + g_signal_emit_by_name (stage, "button-press-event", &event); emit_input_event = TRUE; break; case ButtonRelease: - translate_button_event ((ClutterButtonEvent *) event, xevent); - g_signal_emit_by_name (stage, "button-release-event", event); + translate_button_event ((ClutterButtonEvent *) &event, xevent); + g_signal_emit_by_name (stage, "button-release-event", &event); emit_input_event = TRUE; break; case MotionNotify: - translate_motion_event ((ClutterMotionEvent *) event, xevent); - g_signal_emit_by_name (stage, "motion-event", event); + translate_motion_event ((ClutterMotionEvent *) &event, xevent); + g_signal_emit_by_name (stage, "motion-event", &event); emit_input_event = TRUE; break; } if (emit_input_event) - g_signal_emit_by_name (stage, "input-event", event); + g_signal_emit_by_name (stage, "input-event", &event); - clutter_event_free (event); } static void @@ -481,7 +477,7 @@ clutter_gl_context_set_indirect (gboolean indirect) } -ClutterMainContext * +ClutterMainContext* clutter_context_get_default (void) { if (!ClutterCntx) diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index 4189fb9..6a63b07 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -564,6 +564,7 @@ clutter_stage_class_init (ClutterStageClass *klass) clutter_marshal_VOID__BOXED, G_TYPE_NONE, 1, CLUTTER_TYPE_EVENT); + stage_signals[BUTTON_PRESS_EVENT] = g_signal_new ("button-press-event", G_TYPE_FROM_CLASS (gobject_class), @@ -660,14 +661,22 @@ clutter_stage_get_default (void) else { retval = CLUTTER_ELEMENT (stage_singleton); - g_object_ref (retval); + + /* We dont ref for now as its assumed there will always be + * a stage and no real support for multiple stages. Non + * reffing makes API slightly simpler and allows for things + * like CLUTTER_STAGE_WIDTH() work nicely. + * + * In future if multiple stage support is added probably + * add a clutter-stage-manager class that would manage + * multiple instances. + * g_object_ref (retval); + */ } return retval; - } - /** * clutter_stage_get_xwindow * @stage: A #ClutterStage diff --git a/clutter/clutter-stage.h b/clutter/clutter-stage.h index 94a46df..9c8c6ea 100644 --- a/clutter/clutter-stage.h +++ b/clutter/clutter-stage.h @@ -42,10 +42,10 @@ G_BEGIN_DECLS #define CLUTTER_TYPE_STAGE clutter_stage_get_type() #define CLUTTER_STAGE_WIDTH() \ - clutter_element_get_width(CLUTTER_ELEMENT(clutter_stage())) + clutter_element_get_width(CLUTTER_ELEMENT(clutter_stage_get_default())) #define CLUTTER_STAGE_HEIGHT() \ - clutter_element_get_height(CLUTTER_ELEMENT(clutter_stage())) + clutter_element_get_height(CLUTTER_ELEMENT(clutter_stage_get_default())) #define CLUTTER_STAGE(obj) \ @@ -110,19 +110,18 @@ GType clutter_stage_get_type (void); ClutterElement *clutter_stage_get_default (void); -/* FIXME: no need for below to take stage arg ? - * convert to defines also ? -*/ - Window clutter_stage_get_xwindow (ClutterStage *stage); void clutter_stage_set_color (ClutterStage *stage, const ClutterColor *color); + void clutter_stage_get_color (ClutterStage *stage, ClutterColor *color); + ClutterElement *clutter_stage_get_element_at_pos (ClutterStage *stage, gint x, gint y); + GdkPixbuf * clutter_stage_snapshot (ClutterStage *stage, gint x, gint y, diff --git a/examples/super-oh.c b/examples/super-oh.c index cacc711..c896189 100644 --- a/examples/super-oh.c +++ b/examples/super-oh.c @@ -115,20 +115,9 @@ main (int argc, char *argv[]) clutter_element_set_size (stage, WINWIDTH, WINHEIGHT); /* and its background color */ - g_print ("before clutter_stage_set_color: (%3d, %3d, %3d, %3d)\n", - stage_color.red, - stage_color.green, - stage_color.blue, - stage_color.alpha); + clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - clutter_stage_get_color (CLUTTER_STAGE (stage), - &stage_color); - g_print ("after clutter_stage_get_color: (%3d, %3d, %3d, %3d)\n", - stage_color.red, - stage_color.green, - stage_color.blue, - stage_color.alpha); oh = g_new(SuperOH, 1);