mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
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:
parent
079747e8cb
commit
4471e886f5
10
ChangeLog
10
ChangeLog
@ -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>
|
2008-06-29 Tommi Komulainen <tommi.komulainen@iki.fi>
|
||||||
|
|
||||||
* clutter/osx/clutter-event.osx.c (NSEvent:clutterKeyVal:): Add
|
* clutter/osx/clutter-event.osx.c (NSEvent:clutterKeyVal:): Add
|
||||||
|
@ -38,7 +38,6 @@ static GPollFunc old_poll_func = NULL;
|
|||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
@interface NSEvent (Clutter)
|
@interface NSEvent (Clutter)
|
||||||
- (ClutterStage*)clutterStage;
|
|
||||||
- (gint)clutterTime;
|
- (gint)clutterTime;
|
||||||
- (gint)clutterButton;
|
- (gint)clutterButton;
|
||||||
- (void)clutterX:(gint*)ptrX y:(gint*)ptrY;
|
- (void)clutterX:(gint*)ptrX y:(gint*)ptrY;
|
||||||
@ -47,16 +46,6 @@ static GPollFunc old_poll_func = NULL;
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSEvent (Clutter)
|
@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
|
- (gint)clutterTime
|
||||||
{
|
{
|
||||||
return [self timestamp] * 1000;
|
return [self timestamp] * 1000;
|
||||||
@ -177,7 +166,6 @@ static GPollFunc old_poll_func = NULL;
|
|||||||
static gboolean
|
static gboolean
|
||||||
clutter_event_osx_translate (NSEvent *nsevent, ClutterEvent *event)
|
clutter_event_osx_translate (NSEvent *nsevent, ClutterEvent *event)
|
||||||
{
|
{
|
||||||
event->any.stage = [nsevent clutterStage];
|
|
||||||
event->any.time = [nsevent clutterTime];
|
event->any.time = [nsevent clutterTime];
|
||||||
|
|
||||||
switch ([nsevent type])
|
switch ([nsevent type])
|
||||||
@ -248,10 +236,12 @@ clutter_event_osx_translate (NSEvent *nsevent, ClutterEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_clutter_event_osx_put (NSEvent *nsevent)
|
_clutter_event_osx_put (NSEvent *nsevent, ClutterStage *wrapper)
|
||||||
{
|
{
|
||||||
ClutterEvent event = { 0, };
|
ClutterEvent event = { 0, };
|
||||||
|
|
||||||
|
event.any.stage = wrapper;
|
||||||
|
|
||||||
if (clutter_event_osx_translate (nsevent, &event))
|
if (clutter_event_osx_translate (nsevent, &event))
|
||||||
{
|
{
|
||||||
g_assert (event.type != CLUTTER_NOTHING);
|
g_assert (event.type != CLUTTER_NOTHING);
|
||||||
|
@ -34,7 +34,7 @@ G_BEGIN_DECLS
|
|||||||
void _clutter_events_osx_init (void);
|
void _clutter_events_osx_init (void);
|
||||||
void _clutter_events_osx_uninit (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
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ clutter_stage_osx_state_update (ClutterStageOSX *self,
|
|||||||
/* Simply forward all events that reach our view to clutter. */
|
/* Simply forward all events that reach our view to clutter. */
|
||||||
|
|
||||||
#define EVENT_HANDLER(event) -(void)event:(NSEvent *)theEvent { \
|
#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(mouseDown)
|
||||||
EVENT_HANDLER(mouseDragged)
|
EVENT_HANDLER(mouseDragged)
|
||||||
|
Loading…
Reference in New Issue
Block a user