OSX: don't depend on ClutterGLWindow

* 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.
This commit is contained in:
Tommi Komulainen 2008-06-29 10:31:31 +00:00
parent 079747e8cb
commit 4471e886f5
4 changed files with 16 additions and 16 deletions

View File

@ -1,3 +1,13 @@
2008-06-29 Tommi Komulainen <tommi.komulainen@iki.fi>
* 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 <tommi.komulainen@iki.fi>
* clutter/osx/clutter-event.osx.c (NSEvent:clutterKeyVal:): Add

View File

@ -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);

View File

@ -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

View File

@ -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)