mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
Fixed bugs with mouse events.
Enter/leave events are now being received. Mouse move events now work properly. Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com> http://bugzilla.clutter-project.org/show_bug.cgi?id=2545
This commit is contained in:
parent
cef380040d
commit
901ed32568
@ -502,11 +502,13 @@ osx_source_h_priv = \
|
||||
$(srcdir)/osx/clutter-backend-osx.h \
|
||||
$(srcdir)/osx/clutter-event-loop-osx.h \
|
||||
$(srcdir)/osx/clutter-stage-osx.h \
|
||||
$(srcdir)/osx/clutter-device-manager-osx.h \
|
||||
$(NULL)
|
||||
|
||||
osx_source_c_priv = \
|
||||
$(srcdir)/osx/clutter-event-loop-osx.c \
|
||||
$(srcdir)/osx/clutter-event-osx.c \
|
||||
$(srcdir)/osx/clutter-device-manager-osx.c \
|
||||
$(NULL)
|
||||
|
||||
if SUPPORT_OSX
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2007-2008 Tommi Komulainen <tommi.komulainen@iki.fi>
|
||||
* Copyright (C) 2007 OpenedHand Ltd.
|
||||
* Copyright (C) 2011 Crystalnix <vgachkaylo@crystalnix.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -95,7 +96,7 @@ clutter_backend_osx_create_device_manager (ClutterBackendOSX *backend_osx)
|
||||
return;
|
||||
|
||||
backend_osx->device_manager = g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_OSX,
|
||||
"backend", backend,
|
||||
"backend", CLUTTER_BACKEND(backend_osx),
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2007 Tommi Komulainen <tommi.komulainen@iki.fi>
|
||||
* Copyright (C) 2007 OpenedHand Ltd.
|
||||
* Copyright (C) 2011 Crystalnix <vgachkaylo@crystalnix.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -23,6 +24,7 @@
|
||||
#define __CLUTTER_BACKEND_OSX_H__
|
||||
|
||||
#include "clutter-backend-private.h"
|
||||
#include "clutter-device-manager.h"
|
||||
|
||||
@class NSOpenGLPixelFormat, NSOpenGLContext;
|
||||
|
||||
@ -44,6 +46,7 @@ struct _ClutterBackendOSX
|
||||
|
||||
NSOpenGLPixelFormat *pixel_format;
|
||||
NSOpenGLContext *context;
|
||||
ClutterDeviceManager *device_manager;
|
||||
};
|
||||
|
||||
struct _ClutterBackendOSXClass
|
||||
|
@ -42,6 +42,8 @@ struct _ClutterDeviceManagerOSX
|
||||
{
|
||||
ClutterDeviceManager parent_instance;
|
||||
|
||||
GSList *devices;
|
||||
|
||||
ClutterInputDevice *core_pointer;
|
||||
ClutterInputDevice *core_keyboard;
|
||||
};
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "clutter-stage-osx.h"
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#include <glib/gmain.h>
|
||||
#include <glib.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
|
@ -278,6 +278,8 @@ clutter_event_osx_translate (NSEvent *nsevent,
|
||||
stage_osx = CLUTTER_STAGE_OSX (impl);
|
||||
manager_osx = CLUTTER_DEVICE_MANAGER_OSX (clutter_device_manager_get_default ());
|
||||
|
||||
event->any.time = [nsevent clutterTime];
|
||||
|
||||
switch ([nsevent type])
|
||||
{
|
||||
case NSLeftMouseDown:
|
||||
@ -324,7 +326,7 @@ clutter_event_osx_translate (NSEvent *nsevent,
|
||||
|
||||
[nsevent clutterX:&(event->crossing.x) y:&(event->crossing.y)];
|
||||
event->crossing.related = NULL;
|
||||
event->crossing.actor = CLUTTER_ACTOR (stage);
|
||||
event->crossing.source = CLUTTER_ACTOR (stage);
|
||||
clutter_event_set_device (event, manager_osx->core_pointer);
|
||||
|
||||
_clutter_stage_add_device (stage, manager_osx->core_pointer);
|
||||
@ -338,7 +340,7 @@ clutter_event_osx_translate (NSEvent *nsevent,
|
||||
|
||||
[nsevent clutterX:&(event->crossing.x) y:&(event->crossing.y)];
|
||||
event->crossing.related = NULL;
|
||||
event->crossing.actor = CLUTTER_ACTOR (stage);
|
||||
event->crossing.source = CLUTTER_ACTOR (stage);
|
||||
clutter_event_set_device (event, manager_osx->core_pointer);
|
||||
|
||||
_clutter_stage_remove_device (stage, manager_osx->core_pointer);
|
||||
@ -398,9 +400,9 @@ _clutter_event_osx_put (NSEvent *nsevent,
|
||||
event->any.stage = wrapper;
|
||||
event->any.time = [nsevent clutterTime];
|
||||
|
||||
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);
|
||||
|
||||
_clutter_event_push (event, FALSE);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2007-2008 Tommi Komulainen <tommi.komulainen@iki.fi>
|
||||
* Copyright (C) 2007 OpenedHand Ltd.
|
||||
* Copyright (C) 2011 Crystalnix <vgachkaylo@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -135,6 +136,7 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
|
||||
@interface ClutterGLView : NSOpenGLView
|
||||
{
|
||||
ClutterStageOSX *stage_osx;
|
||||
NSTrackingRectTag tracking_rect;
|
||||
}
|
||||
- (void) drawRect: (NSRect) bounds;
|
||||
@end
|
||||
@ -145,6 +147,7 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
|
||||
if ((self = [super initWithFrame:aFrame pixelFormat:aFormat]) != nil)
|
||||
{
|
||||
self->stage_osx = aStage;
|
||||
tracking_rect = [self addTrackingRect:[self bounds] owner:self userData:NULL assumeInside:NO];
|
||||
}
|
||||
|
||||
return self;
|
||||
@ -176,6 +179,9 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
|
||||
stage_osx->requisition_height = [self bounds].size.height;
|
||||
clutter_actor_set_size (CLUTTER_ACTOR (self->stage_osx->wrapper),
|
||||
(int)[self bounds].size.width, (int)[self bounds].size.height);
|
||||
|
||||
[self removeTrackingRect:tracking_rect];
|
||||
tracking_rect = [self addTrackingRect:[self bounds] owner:self userData:NULL assumeInside:NO];
|
||||
}
|
||||
|
||||
/* Simply forward all events that reach our view to clutter. */
|
||||
|
Loading…
Reference in New Issue
Block a user