diff --git a/ChangeLog b/ChangeLog index 773423f70..f43b40810 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-06-29 Tommi Komulainen + + * clutter/osx/clutter-osx.h (_clutter_event_osx_put) + * clutter/osx/clutter-event-osx.c (clutter_event_osx_translate, + NSEvent:clutterStage:) + * clutter/osx/clutter-stage-osx.c (EVENT_HANDLER): Since events are + delivered to ClutterGLView, pass the associated ClutterStage directly + to event translation. Avoids relying on being embedded in + ClutterGLWindow, which makes it easier to implement clutter-gtk. + 2008-06-29 Tommi Komulainen * clutter/osx/clutter-event.osx.c (NSEvent:clutterKeyVal:): Add diff --git a/clutter/osx/clutter-event-osx.c b/clutter/osx/clutter-event-osx.c index d4afa8230..e2df62178 100644 --- a/clutter/osx/clutter-event-osx.c +++ b/clutter/osx/clutter-event-osx.c @@ -38,7 +38,6 @@ static GPollFunc old_poll_func = NULL; /*************************************************************************/ @interface NSEvent (Clutter) -- (ClutterStage*)clutterStage; - (gint)clutterTime; - (gint)clutterButton; - (void)clutterX:(gint*)ptrX y:(gint*)ptrY; @@ -47,16 +46,6 @@ static GPollFunc old_poll_func = NULL; @end @implementation NSEvent (Clutter) -- (ClutterStage*)clutterStage -{ - ClutterGLWindow *w = (ClutterGLWindow*)[self window]; - if (![w isKindOfClass:[ClutterGLWindow class]]) - return NULL; - - ClutterStageOSX *stage_osx = w->stage_osx; - return stage_osx->wrapper; -} - - (gint)clutterTime { return [self timestamp] * 1000; @@ -177,7 +166,6 @@ static GPollFunc old_poll_func = NULL; static gboolean clutter_event_osx_translate (NSEvent *nsevent, ClutterEvent *event) { - event->any.stage = [nsevent clutterStage]; event->any.time = [nsevent clutterTime]; switch ([nsevent type]) @@ -248,10 +236,12 @@ clutter_event_osx_translate (NSEvent *nsevent, ClutterEvent *event) } void -_clutter_event_osx_put (NSEvent *nsevent) +_clutter_event_osx_put (NSEvent *nsevent, ClutterStage *wrapper) { ClutterEvent event = { 0, }; - + + event.any.stage = wrapper; + if (clutter_event_osx_translate (nsevent, &event)) { g_assert (event.type != CLUTTER_NOTHING); diff --git a/clutter/osx/clutter-osx.h b/clutter/osx/clutter-osx.h index d7271387f..3c4fc9cac 100644 --- a/clutter/osx/clutter-osx.h +++ b/clutter/osx/clutter-osx.h @@ -34,7 +34,7 @@ G_BEGIN_DECLS void _clutter_events_osx_init (void); void _clutter_events_osx_uninit (void); -void _clutter_event_osx_put (NSEvent *nsevent); +void _clutter_event_osx_put (NSEvent *nsevent, ClutterStage *wrapper); G_END_DECLS diff --git a/clutter/osx/clutter-stage-osx.c b/clutter/osx/clutter-stage-osx.c index a118c176a..cb60b3676 100644 --- a/clutter/osx/clutter-stage-osx.c +++ b/clutter/osx/clutter-stage-osx.c @@ -159,7 +159,7 @@ clutter_stage_osx_state_update (ClutterStageOSX *self, /* Simply forward all events that reach our view to clutter. */ #define EVENT_HANDLER(event) -(void)event:(NSEvent *)theEvent { \ - _clutter_event_osx_put (theEvent); \ + _clutter_event_osx_put (theEvent, self->stage_osx->wrapper); \ } EVENT_HANDLER(mouseDown) EVENT_HANDLER(mouseDragged)