mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
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
This commit is contained in:
parent
f6fe9e7412
commit
7806e409fb
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
|||||||
|
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>
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter-color.h:
|
* clutter-color.h:
|
||||||
|
@ -67,7 +67,6 @@ typedef struct _ClutterInputDevice ClutterInputDevice;
|
|||||||
struct _ClutterAnyEvent
|
struct _ClutterAnyEvent
|
||||||
{
|
{
|
||||||
ClutterEventType type;
|
ClutterEventType type;
|
||||||
guint8 send_event : 1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ClutterKeyEvent
|
struct _ClutterKeyEvent
|
||||||
|
@ -151,13 +151,10 @@ clutter_dispatch_x_event (XEvent *xevent,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
ClutterMainContext *ctx = CLUTTER_CONTEXT ();
|
ClutterMainContext *ctx = CLUTTER_CONTEXT ();
|
||||||
ClutterEvent *event;
|
ClutterEvent event;
|
||||||
ClutterStage *stage = ctx->stage;
|
ClutterStage *stage = ctx->stage;
|
||||||
gboolean emit_input_event = FALSE;
|
gboolean emit_input_event = FALSE;
|
||||||
|
|
||||||
event = clutter_event_new (CLUTTER_NOTHING);
|
|
||||||
event->any.send_event = xevent->xany.send_event ? TRUE : FALSE;
|
|
||||||
|
|
||||||
switch (xevent->type)
|
switch (xevent->type)
|
||||||
{
|
{
|
||||||
case Expose:
|
case Expose:
|
||||||
@ -177,36 +174,35 @@ clutter_dispatch_x_event (XEvent *xevent,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
translate_key_event ((ClutterKeyEvent *) event, xevent);
|
translate_key_event ((ClutterKeyEvent *) &event, xevent);
|
||||||
g_signal_emit_by_name (stage, "key-press-event", event);
|
g_signal_emit_by_name (stage, "key-press-event", &event);
|
||||||
emit_input_event = TRUE;
|
emit_input_event = TRUE;
|
||||||
break;
|
break;
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
translate_key_event ((ClutterKeyEvent *) event, xevent);
|
translate_key_event ((ClutterKeyEvent *) &event, xevent);
|
||||||
g_signal_emit_by_name (stage, "key-release-event", event);
|
g_signal_emit_by_name (stage, "key-release-event", &event);
|
||||||
emit_input_event = TRUE;
|
emit_input_event = TRUE;
|
||||||
break;
|
break;
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
translate_button_event ((ClutterButtonEvent *) event, xevent);
|
translate_button_event ((ClutterButtonEvent *) &event, xevent);
|
||||||
g_signal_emit_by_name (stage, "button-press-event", event);
|
g_signal_emit_by_name (stage, "button-press-event", &event);
|
||||||
emit_input_event = TRUE;
|
emit_input_event = TRUE;
|
||||||
break;
|
break;
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
translate_button_event ((ClutterButtonEvent *) event, xevent);
|
translate_button_event ((ClutterButtonEvent *) &event, xevent);
|
||||||
g_signal_emit_by_name (stage, "button-release-event", event);
|
g_signal_emit_by_name (stage, "button-release-event", &event);
|
||||||
emit_input_event = TRUE;
|
emit_input_event = TRUE;
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
translate_motion_event ((ClutterMotionEvent *) event, xevent);
|
translate_motion_event ((ClutterMotionEvent *) &event, xevent);
|
||||||
g_signal_emit_by_name (stage, "motion-event", event);
|
g_signal_emit_by_name (stage, "motion-event", &event);
|
||||||
emit_input_event = TRUE;
|
emit_input_event = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (emit_input_event)
|
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
|
static void
|
||||||
@ -481,7 +477,7 @@ clutter_gl_context_set_indirect (gboolean indirect)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterMainContext *
|
ClutterMainContext*
|
||||||
clutter_context_get_default (void)
|
clutter_context_get_default (void)
|
||||||
{
|
{
|
||||||
if (!ClutterCntx)
|
if (!ClutterCntx)
|
||||||
|
@ -564,6 +564,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
clutter_marshal_VOID__BOXED,
|
clutter_marshal_VOID__BOXED,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
CLUTTER_TYPE_EVENT);
|
CLUTTER_TYPE_EVENT);
|
||||||
|
|
||||||
stage_signals[BUTTON_PRESS_EVENT] =
|
stage_signals[BUTTON_PRESS_EVENT] =
|
||||||
g_signal_new ("button-press-event",
|
g_signal_new ("button-press-event",
|
||||||
G_TYPE_FROM_CLASS (gobject_class),
|
G_TYPE_FROM_CLASS (gobject_class),
|
||||||
@ -660,14 +661,22 @@ clutter_stage_get_default (void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
retval = CLUTTER_ELEMENT (stage_singleton);
|
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;
|
return retval;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_stage_get_xwindow
|
* clutter_stage_get_xwindow
|
||||||
* @stage: A #ClutterStage
|
* @stage: A #ClutterStage
|
||||||
|
@ -42,10 +42,10 @@ G_BEGIN_DECLS
|
|||||||
#define CLUTTER_TYPE_STAGE clutter_stage_get_type()
|
#define CLUTTER_TYPE_STAGE clutter_stage_get_type()
|
||||||
|
|
||||||
#define CLUTTER_STAGE_WIDTH() \
|
#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() \
|
#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) \
|
#define CLUTTER_STAGE(obj) \
|
||||||
@ -110,19 +110,18 @@ GType clutter_stage_get_type (void);
|
|||||||
|
|
||||||
ClutterElement *clutter_stage_get_default (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);
|
Window clutter_stage_get_xwindow (ClutterStage *stage);
|
||||||
|
|
||||||
void clutter_stage_set_color (ClutterStage *stage,
|
void clutter_stage_set_color (ClutterStage *stage,
|
||||||
const ClutterColor *color);
|
const ClutterColor *color);
|
||||||
|
|
||||||
void clutter_stage_get_color (ClutterStage *stage,
|
void clutter_stage_get_color (ClutterStage *stage,
|
||||||
ClutterColor *color);
|
ClutterColor *color);
|
||||||
|
|
||||||
ClutterElement *clutter_stage_get_element_at_pos (ClutterStage *stage,
|
ClutterElement *clutter_stage_get_element_at_pos (ClutterStage *stage,
|
||||||
gint x,
|
gint x,
|
||||||
gint y);
|
gint y);
|
||||||
|
|
||||||
GdkPixbuf * clutter_stage_snapshot (ClutterStage *stage,
|
GdkPixbuf * clutter_stage_snapshot (ClutterStage *stage,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
|
@ -115,20 +115,9 @@ main (int argc, char *argv[])
|
|||||||
clutter_element_set_size (stage, WINWIDTH, WINHEIGHT);
|
clutter_element_set_size (stage, WINWIDTH, WINHEIGHT);
|
||||||
|
|
||||||
/* and its background color */
|
/* 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),
|
clutter_stage_set_color (CLUTTER_STAGE (stage),
|
||||||
&stage_color);
|
&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);
|
oh = g_new(SuperOH, 1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user