+2006-06-05 Matthew Allum <mallum@openedhand.com>
+
+ * 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 <ebassi@openedhand.com>
* clutter-color.h:
struct _ClutterAnyEvent
{
ClutterEventType type;
- guint8 send_event : 1;
};
struct _ClutterKeyEvent
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:
}
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
}
-ClutterMainContext *
+ClutterMainContext*
clutter_context_get_default (void)
{
if (!ClutterCntx)
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),
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
#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) \
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,
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);