2007-10-26 18:06:45 -04:00
|
|
|
/* Clutter - An OpenGL based 'interactive canvas' library.
|
|
|
|
* OSX backend - integration with NSWindow and NSView
|
|
|
|
*
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
* Copyright (C) 2007-2008 Tommi Komulainen <tommi.komulainen@iki.fi>
|
2007-10-26 18:06:45 -04:00
|
|
|
* Copyright (C) 2007 OpenedHand Ltd.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2010-03-01 07:56:10 -05:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*
|
2007-10-26 18:06:45 -04:00
|
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "clutter-osx.h"
|
|
|
|
#include "clutter-stage-osx.h"
|
|
|
|
#include "clutter-backend-osx.h"
|
|
|
|
#import <AppKit/AppKit.h>
|
|
|
|
|
|
|
|
#include <clutter/clutter-debug.h>
|
|
|
|
#include <clutter/clutter-private.h>
|
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (ClutterStageOSX,
|
|
|
|
clutter_stage_osx,
|
|
|
|
G_TYPE_OBJECT,
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
|
|
|
|
clutter_stage_window_iface_init))
|
2007-10-26 18:06:45 -04:00
|
|
|
|
|
|
|
/* FIXME: this should be in clutter-stage.c */
|
|
|
|
static void
|
|
|
|
clutter_stage_osx_state_update (ClutterStageOSX *self,
|
|
|
|
ClutterStageState unset_flags,
|
|
|
|
ClutterStageState set_flags);
|
|
|
|
|
|
|
|
#define CLUTTER_OSX_FULLSCREEN_WINDOW_LEVEL (NSMainMenuWindowLevel + 1)
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
@implementation ClutterGLWindow
|
|
|
|
- (id)initWithView:(NSView *)aView UTF8Title:(const char *)aTitle stage:(ClutterStageOSX *)aStage
|
|
|
|
{
|
|
|
|
if ((self = [super initWithContentRect: [aView frame]
|
|
|
|
styleMask: NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask
|
|
|
|
backing: NSBackingStoreBuffered
|
|
|
|
defer: NO]) != nil)
|
|
|
|
{
|
|
|
|
[self setDelegate: self];
|
|
|
|
[self useOptimizedDrawing: YES];
|
2009-07-13 11:56:47 -04:00
|
|
|
[self setAcceptsMouseMovedEvents:YES];
|
2007-10-26 18:06:45 -04:00
|
|
|
[self setContentView: aView];
|
2008-06-05 16:10:00 -04:00
|
|
|
[self setTitle:[NSString stringWithUTF8String: aTitle ? aTitle : ""]];
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
self->stage_osx = aStage;
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) windowShouldClose: (id) sender
|
|
|
|
{
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
CLUTTER_NOTE (BACKEND, "[%p] windowShouldClose", self->stage_osx);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
|
|
|
ClutterEvent event;
|
|
|
|
event.type = CLUTTER_DELETE;
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
event.any.stage = CLUTTER_STAGE (self->stage_osx->wrapper);
|
2007-10-26 18:06:45 -04:00
|
|
|
clutter_event_put (&event);
|
|
|
|
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSRect) constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen*)aScreen
|
|
|
|
{
|
|
|
|
/* in fullscreen mode we don't want to be constrained by menubar or dock
|
|
|
|
* FIXME: calculate proper constraints depending on fullscreen mode
|
|
|
|
*/
|
|
|
|
|
|
|
|
return frameRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) windowDidBecomeKey:(NSNotification*)aNotification
|
|
|
|
{
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
CLUTTER_NOTE (BACKEND, "[%p] windowDidBecomeKey", self->stage_osx);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
if (self->stage_osx->stage_state & CLUTTER_STAGE_STATE_FULLSCREEN)
|
2007-10-26 18:06:45 -04:00
|
|
|
[self setLevel: CLUTTER_OSX_FULLSCREEN_WINDOW_LEVEL];
|
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
clutter_stage_osx_state_update (self->stage_osx, 0, CLUTTER_STAGE_STATE_ACTIVATED);
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) windowDidResignKey:(NSNotification*)aNotification
|
|
|
|
{
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
CLUTTER_NOTE (BACKEND, "[%p] windowDidResignKey", self->stage_osx);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
if (self->stage_osx->stage_state & CLUTTER_STAGE_STATE_FULLSCREEN)
|
2007-10-26 18:06:45 -04:00
|
|
|
{
|
|
|
|
[self setLevel: NSNormalWindowLevel];
|
|
|
|
[self orderBack: nil];
|
|
|
|
}
|
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
clutter_stage_osx_state_update (self->stage_osx, CLUTTER_STAGE_STATE_ACTIVATED, 0);
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
@interface ClutterGLView : NSOpenGLView
|
|
|
|
{
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
ClutterStageOSX *stage_osx;
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
- (void) drawRect: (NSRect) bounds;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation ClutterGLView
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
- (id) initWithFrame: (NSRect)aFrame pixelFormat:(NSOpenGLPixelFormat*)aFormat stage:(ClutterStageOSX*)aStage
|
2007-10-26 18:06:45 -04:00
|
|
|
{
|
|
|
|
if ((self = [super initWithFrame:aFrame pixelFormat:aFormat]) != nil)
|
|
|
|
{
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
self->stage_osx = aStage;
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
2008-02-03 18:25:12 -05:00
|
|
|
|
2007-10-26 18:06:45 -04:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) drawRect: (NSRect) bounds
|
|
|
|
{
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
clutter_actor_paint (CLUTTER_ACTOR (self->stage_osx->wrapper));
|
2009-06-29 12:10:34 -04:00
|
|
|
cogl_flush ();
|
2007-10-26 18:06:45 -04:00
|
|
|
[[self openGLContext] flushBuffer];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* In order to receive key events */
|
|
|
|
- (BOOL) acceptsFirstResponder
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We want 0,0 top left */
|
|
|
|
- (BOOL) isFlipped
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setFrameSize: (NSSize) aSize
|
|
|
|
{
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
CLUTTER_NOTE (BACKEND, "[%p] setFrameSize: %dx%d", self->stage_osx,
|
2007-10-26 18:06:45 -04:00
|
|
|
(int)aSize.width, (int)aSize.height);
|
|
|
|
|
|
|
|
[super setFrameSize: aSize];
|
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
clutter_actor_set_size (CLUTTER_ACTOR (self->stage_osx->wrapper),
|
|
|
|
(int)aSize.width, (int)aSize.height);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
CLUTTER_SET_PRIVATE_FLAGS(self->stage_osx->wrapper, CLUTTER_ACTOR_SYNC_MATRICES);
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Simply forward all events that reach our view to clutter. */
|
|
|
|
|
|
|
|
#define EVENT_HANDLER(event) -(void)event:(NSEvent *)theEvent { \
|
2008-06-29 06:31:31 -04:00
|
|
|
_clutter_event_osx_put (theEvent, self->stage_osx->wrapper); \
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
EVENT_HANDLER(mouseDown)
|
|
|
|
EVENT_HANDLER(mouseDragged)
|
|
|
|
EVENT_HANDLER(mouseUp)
|
|
|
|
EVENT_HANDLER(mouseMoved)
|
|
|
|
EVENT_HANDLER(mouseEntered)
|
|
|
|
EVENT_HANDLER(mouseExited)
|
|
|
|
EVENT_HANDLER(rightMouseDown)
|
|
|
|
EVENT_HANDLER(rightMouseDragged)
|
|
|
|
EVENT_HANDLER(rightMouseUp)
|
|
|
|
EVENT_HANDLER(otherMouseDown)
|
|
|
|
EVENT_HANDLER(otherMouseDragged)
|
|
|
|
EVENT_HANDLER(otherMouseUp)
|
|
|
|
EVENT_HANDLER(scrollWheel)
|
|
|
|
EVENT_HANDLER(keyDown)
|
|
|
|
EVENT_HANDLER(keyUp)
|
|
|
|
EVENT_HANDLER(flagsChanged)
|
|
|
|
EVENT_HANDLER(helpRequested)
|
|
|
|
EVENT_HANDLER(tabletPoint)
|
|
|
|
EVENT_HANDLER(tabletProximity)
|
|
|
|
|
|
|
|
#undef EVENT_HANDLER
|
|
|
|
@end
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
static void
|
|
|
|
clutter_stage_osx_state_update (ClutterStageOSX *self,
|
|
|
|
ClutterStageState unset_flags,
|
|
|
|
ClutterStageState set_flags)
|
|
|
|
{
|
|
|
|
ClutterStageStateEvent event;
|
|
|
|
|
|
|
|
event.new_state = self->stage_state;
|
|
|
|
event.new_state |= set_flags;
|
|
|
|
event.new_state &= ~unset_flags;
|
|
|
|
|
|
|
|
if (event.new_state == self->stage_state)
|
|
|
|
return;
|
|
|
|
|
|
|
|
event.changed_mask = event.new_state ^ self->stage_state;
|
|
|
|
|
|
|
|
self->stage_state = event.new_state;
|
|
|
|
|
|
|
|
event.type = CLUTTER_STAGE_STATE;
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
event.stage = CLUTTER_STAGE (self->wrapper);
|
2007-10-26 18:06:45 -04:00
|
|
|
clutter_event_put ((ClutterEvent*)&event);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_stage_osx_save_frame (ClutterStageOSX *self)
|
|
|
|
{
|
2009-11-05 10:44:32 -05:00
|
|
|
g_assert (self->window != NULL);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
self->normalFrame = [self->window frame];
|
|
|
|
self->haveNormalFrame = TRUE;
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_stage_osx_set_frame (ClutterStageOSX *self)
|
|
|
|
{
|
|
|
|
g_assert (self->window != NULL);
|
|
|
|
|
|
|
|
if (self->stage_state & CLUTTER_STAGE_STATE_FULLSCREEN)
|
|
|
|
{
|
|
|
|
/* Raise above the menubar (and dock) covering the whole screen.
|
|
|
|
*
|
|
|
|
* NOTE: This effectively breaks Option-Tabbing as our window covers
|
|
|
|
* all other applications completely. However we deal with the situation
|
|
|
|
* by lowering the window to the bottom of the normal level stack on
|
|
|
|
* windowDidResignKey notification.
|
|
|
|
*/
|
|
|
|
[self->window setLevel: CLUTTER_OSX_FULLSCREEN_WINDOW_LEVEL];
|
|
|
|
|
|
|
|
[self->window setFrame: [self->window frameRectForContentRect: [[self->window screen] frame]] display: NO];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[self->window setLevel: NSNormalWindowLevel];
|
|
|
|
|
|
|
|
if (self->haveNormalFrame)
|
|
|
|
[self->window setFrame: self->normalFrame display: NO];
|
|
|
|
else
|
|
|
|
/* looks better than positioning to 0,0 (bottom right) */
|
|
|
|
[self->window center];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************/
|
2009-11-05 10:44:32 -05:00
|
|
|
static gboolean
|
|
|
|
clutter_stage_osx_realize (ClutterStageWindow *stage_window)
|
2007-10-26 18:06:45 -04:00
|
|
|
{
|
2009-11-05 10:44:32 -05:00
|
|
|
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
2007-10-26 18:06:45 -04:00
|
|
|
ClutterBackendOSX *backend_osx;
|
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
CLUTTER_NOTE (BACKEND, "[%p] realize", self);
|
|
|
|
|
2007-10-26 18:06:45 -04:00
|
|
|
CLUTTER_OSX_POOL_ALLOC();
|
|
|
|
|
|
|
|
backend_osx = CLUTTER_BACKEND_OSX (self->backend);
|
|
|
|
|
|
|
|
NSRect rect = NSMakeRect(0, 0, self->requisition_width, self->requisition_height);
|
|
|
|
|
|
|
|
self->view = [[ClutterGLView alloc]
|
|
|
|
initWithFrame: rect
|
|
|
|
pixelFormat: backend_osx->pixel_format
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
stage: self];
|
|
|
|
[self->view setOpenGLContext:backend_osx->context];
|
2007-10-26 18:06:45 -04:00
|
|
|
|
|
|
|
self->window = [[ClutterGLWindow alloc]
|
|
|
|
initWithView: self->view
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
UTF8Title: clutter_stage_get_title (CLUTTER_STAGE (self->wrapper))
|
2007-10-26 18:06:45 -04:00
|
|
|
stage: self];
|
|
|
|
|
|
|
|
/* looks better than positioning to 0,0 (bottom right) */
|
|
|
|
[self->window center];
|
|
|
|
|
|
|
|
CLUTTER_OSX_POOL_RELEASE();
|
|
|
|
|
2009-06-06 09:55:00 -04:00
|
|
|
CLUTTER_NOTE (BACKEND, "Stage successfully realized");
|
2009-11-05 10:44:32 -05:00
|
|
|
|
|
|
|
return TRUE;
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-11-05 10:44:32 -05:00
|
|
|
clutter_stage_osx_unrealize (ClutterStageWindow *stage_window)
|
2007-10-26 18:06:45 -04:00
|
|
|
{
|
2009-11-05 10:44:32 -05:00
|
|
|
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
CLUTTER_NOTE (BACKEND, "[%p] unrealize", self);
|
|
|
|
|
|
|
|
/* ensure we get realize+unrealize properly paired */
|
|
|
|
g_return_if_fail (self->view != NULL && self->window != NULL);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
|
|
|
CLUTTER_OSX_POOL_ALLOC();
|
|
|
|
|
|
|
|
[self->view release];
|
|
|
|
[self->window close];
|
|
|
|
|
|
|
|
self->view = NULL;
|
|
|
|
self->window = NULL;
|
|
|
|
|
|
|
|
CLUTTER_OSX_POOL_RELEASE();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-07-26 15:10:42 -04:00
|
|
|
clutter_stage_osx_show (ClutterStageWindow *stage_window,
|
|
|
|
gboolean do_raise)
|
2007-10-26 18:06:45 -04:00
|
|
|
{
|
2009-07-26 15:10:42 -04:00
|
|
|
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
CLUTTER_NOTE (BACKEND, "[%p] show", self);
|
2007-11-26 07:07:25 -05:00
|
|
|
|
2007-10-26 18:06:45 -04:00
|
|
|
CLUTTER_OSX_POOL_ALLOC();
|
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
clutter_stage_osx_realize (stage_window);
|
2009-07-26 15:10:42 -04:00
|
|
|
clutter_actor_map (CLUTTER_ACTOR (self->wrapper));
|
|
|
|
|
2007-10-26 18:06:45 -04:00
|
|
|
clutter_stage_osx_set_frame (self);
|
|
|
|
|
|
|
|
[self->window makeKeyAndOrderFront: nil];
|
|
|
|
|
|
|
|
CLUTTER_OSX_POOL_RELEASE();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-07-26 15:10:42 -04:00
|
|
|
clutter_stage_osx_hide (ClutterStageWindow *stage_window)
|
2007-10-26 18:06:45 -04:00
|
|
|
{
|
2009-07-26 15:10:42 -04:00
|
|
|
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
CLUTTER_NOTE (BACKEND, "[%p] hide", self);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
|
|
|
CLUTTER_OSX_POOL_ALLOC();
|
|
|
|
|
|
|
|
[self->window orderOut: nil];
|
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
clutter_stage_osx_unrealize (stage_window);
|
2009-07-26 15:10:42 -04:00
|
|
|
clutter_actor_unmap (CLUTTER_ACTOR (self->wrapper));
|
2007-10-26 18:06:45 -04:00
|
|
|
|
2009-07-26 15:10:42 -04:00
|
|
|
CLUTTER_OSX_POOL_RELEASE();
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-11-05 10:44:32 -05:00
|
|
|
clutter_stage_osx_get_geometry (ClutterStageWindow *stage_window,
|
|
|
|
ClutterGeometry *geometry)
|
2007-10-26 18:06:45 -04:00
|
|
|
{
|
2009-11-05 10:44:32 -05:00
|
|
|
ClutterBackend *backend = clutter_get_default_backend ();
|
|
|
|
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
|
|
|
gboolean is_fullscreen, resize;
|
2008-06-11 05:45:22 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
g_return_if_fail (CLUTTER_IS_BACKEND_OSX (backend));
|
2008-06-11 05:45:22 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
CLUTTER_OSX_POOL_ALLOC ();
|
2008-06-11 05:45:22 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
is_fullscreen = FALSE;
|
|
|
|
g_object_get (G_OBJECT (self->wrapper),
|
|
|
|
"fullscreen-set", &is_fullscreen,
|
|
|
|
NULL);
|
2008-06-11 05:45:22 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
if (is_fullscreen)
|
|
|
|
{
|
|
|
|
NSSize size = [[NSScreen mainScreen] frame].size;
|
2008-06-11 05:45:22 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
geometry->width = size.width;
|
|
|
|
geometry->height = size.height;
|
|
|
|
}
|
|
|
|
else
|
2008-06-11 05:45:22 -04:00
|
|
|
{
|
2009-11-05 10:44:32 -05:00
|
|
|
resize = clutter_stage_get_user_resizable (self->wrapper);
|
|
|
|
|
|
|
|
if (resize)
|
|
|
|
{
|
|
|
|
geometry->width = 1;
|
|
|
|
geometry->height = 1;
|
|
|
|
}
|
2008-06-11 05:45:22 -04:00
|
|
|
else
|
2009-11-05 10:44:32 -05:00
|
|
|
{
|
|
|
|
geometry->width = self->requisition_width;
|
|
|
|
geometry->height = self->requisition_height;
|
|
|
|
}
|
2008-06-11 05:45:22 -04:00
|
|
|
}
|
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
CLUTTER_OSX_POOL_RELEASE ();
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-11-05 10:44:32 -05:00
|
|
|
clutter_stage_osx_resize (ClutterStageWindow *stage_window,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2007-10-26 18:06:45 -04:00
|
|
|
{
|
2009-11-05 10:44:32 -05:00
|
|
|
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
self->requisition_width = width;
|
|
|
|
self->requisition_height = height;
|
2007-10-26 18:06:45 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
CLUTTER_OSX_POOL_ALLOC ();
|
2007-10-26 18:06:45 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
NSSize size = NSMakeSize (self->requisition_width,
|
|
|
|
self->requisition_height);
|
|
|
|
[self->window setContentSize: size];
|
2007-10-26 18:06:45 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
CLUTTER_OSX_POOL_RELEASE ();
|
2008-06-11 05:45:22 -04:00
|
|
|
|
|
|
|
/* make sure that the viewport is updated */
|
|
|
|
CLUTTER_SET_PRIVATE_FLAGS (self->wrapper, CLUTTER_ACTOR_SYNC_MATRICES);
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************/
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
static ClutterActor *
|
|
|
|
clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window)
|
|
|
|
{
|
|
|
|
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
|
|
|
|
|
|
|
return CLUTTER_ACTOR (self->wrapper);
|
|
|
|
}
|
|
|
|
|
2007-10-26 18:06:45 -04:00
|
|
|
static void
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
clutter_stage_osx_set_title (ClutterStageWindow *stage_window,
|
|
|
|
const char *title)
|
2007-10-26 18:06:45 -04:00
|
|
|
{
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
CLUTTER_NOTE (BACKEND, "[%p] set_title: %s", self, title);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
|
|
|
CLUTTER_OSX_POOL_ALLOC();
|
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
[self->window setTitle:[NSString stringWithUTF8String: title ? title : ""]];
|
2007-10-26 18:06:45 -04:00
|
|
|
|
|
|
|
CLUTTER_OSX_POOL_RELEASE();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
clutter_stage_osx_set_fullscreen (ClutterStageWindow *stage_window,
|
|
|
|
gboolean fullscreen)
|
2007-10-26 18:06:45 -04:00
|
|
|
{
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
CLUTTER_NOTE (BACKEND, "[%p] set_fullscreen: %u", self, fullscreen);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
|
|
|
CLUTTER_OSX_POOL_ALLOC();
|
|
|
|
|
|
|
|
/* Make sure to update the state before clutter_stage_osx_set_frame.
|
|
|
|
*
|
|
|
|
* Toggling fullscreen isn't atomic, there's two "events" involved:
|
|
|
|
* - stage state change (via state_update)
|
|
|
|
* - stage size change (via set_frame -> setFrameSize / set_size)
|
|
|
|
*
|
|
|
|
* We do state change first. Not sure there's any difference.
|
|
|
|
*/
|
|
|
|
if (fullscreen)
|
|
|
|
{
|
2009-11-05 10:44:32 -05:00
|
|
|
clutter_stage_osx_state_update (self, 0, CLUTTER_STAGE_STATE_FULLSCREEN);
|
|
|
|
clutter_stage_osx_save_frame (self);
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
2009-11-05 10:44:32 -05:00
|
|
|
else
|
|
|
|
clutter_stage_osx_state_update (self, CLUTTER_STAGE_STATE_FULLSCREEN, 0);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
clutter_stage_osx_set_frame (self);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
|
|
|
CLUTTER_OSX_POOL_RELEASE();
|
|
|
|
}
|
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
static void
|
|
|
|
clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
|
|
|
{
|
|
|
|
iface->get_wrapper = clutter_stage_osx_get_wrapper;
|
|
|
|
iface->set_title = clutter_stage_osx_set_title;
|
|
|
|
iface->set_fullscreen = clutter_stage_osx_set_fullscreen;
|
2009-07-26 15:10:42 -04:00
|
|
|
iface->show = clutter_stage_osx_show;
|
|
|
|
iface->hide = clutter_stage_osx_hide;
|
2009-11-05 10:44:32 -05:00
|
|
|
iface->realize = clutter_stage_osx_realize;
|
|
|
|
iface->unrealize = clutter_stage_osx_unrealize;
|
|
|
|
iface->get_geometry = clutter_stage_osx_get_geometry;
|
|
|
|
iface->resize = clutter_stage_osx_resize;
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
}
|
|
|
|
|
2007-10-26 18:06:45 -04:00
|
|
|
/*************************************************************************/
|
2009-11-05 10:44:32 -05:00
|
|
|
ClutterStageWindow *
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
clutter_stage_osx_new (ClutterBackend *backend,
|
|
|
|
ClutterStage *wrapper)
|
2007-10-26 18:06:45 -04:00
|
|
|
{
|
|
|
|
ClutterStageOSX *self;
|
|
|
|
|
|
|
|
self = g_object_new (CLUTTER_TYPE_STAGE_OSX, NULL);
|
|
|
|
self->backend = backend;
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
self->wrapper = wrapper;
|
2007-10-26 18:06:45 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
return CLUTTER_STAGE_WINDOW(self);
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
static void
|
|
|
|
clutter_stage_osx_init (ClutterStageOSX *self)
|
|
|
|
{
|
|
|
|
self->requisition_width = 640;
|
|
|
|
self->requisition_height = 480;
|
|
|
|
|
OSX: add multistage support
Bug #911 - OSX: add multistage support
* clutter/osx/clutter-backend-osx.{c,h}
(clutter_backend_osx_init_stage, clutter_backend_osx_get_stage,
clutter_backend_osx_redraw, clutter_backend_osx_create_stage,
clutter_backend_osx_ensure_context, clutter_backend_osx_class_init,
clutter_backend_osx_dispose, ClutterGLView:drawRect:):
* clutter/osx/clutter-stage-osx.{c,h} (clutter_stage_osx_realize,
ClutterGLWindow:setFrameSize:):
Adapt to new multistage backend API. Don't keep a pointer to
default stage. Derive from ClutterActor instead of ClutterStage.
Implement ClutterStageWindow interface. Paint, resize and
otherwise manipulate the wrapper rather than self when necessary.
(clutter_backend_post_parse): Create our singleton GL context
here. We could probably create the context when the default
stage is created, but I think this is more clean.
* clutter/osx/clutter-event-osx.c (clutter_event_osx_translate)
* clutter/osx/clutter-stage-osx.c (clutter_stage_osx_state_update,
ClutterGLWindow:windowShouldClose:):
* clutter/osx/clutter-stage-osx.h: Export ClutterGLWindow interface
for clutter-event-osx.c to easily get the stage for NSWindow.
Fill in ClutterEventAny::stage on our events.
Consistently use 'stage_osx' and 'wrapper' as variable names
when referring to ClutterStageOSX and ClutterStage objects
respectively.
2008-06-05 17:27:58 -04:00
|
|
|
CLUTTER_SET_PRIVATE_FLAGS(self, CLUTTER_ACTOR_IS_TOPLEVEL);
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-11-05 10:44:32 -05:00
|
|
|
clutter_stage_osx_finalize (GObject *gobject)
|
2007-10-26 18:06:45 -04:00
|
|
|
{
|
2009-11-05 10:44:32 -05:00
|
|
|
G_OBJECT_CLASS (clutter_stage_osx_parent_class)->finalize (gobject);
|
|
|
|
}
|
2007-10-26 18:06:45 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
static void
|
|
|
|
clutter_stage_osx_dispose (GObject *gobject)
|
|
|
|
{
|
|
|
|
G_OBJECT_CLASS (clutter_stage_osx_parent_class)->dispose (gobject);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_stage_osx_class_init (ClutterStageOSXClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
2007-10-26 18:06:45 -04:00
|
|
|
|
2009-11-05 10:44:32 -05:00
|
|
|
gobject_class->finalize = clutter_stage_osx_finalize;
|
|
|
|
gobject_class->dispose = clutter_stage_osx_dispose;
|
2007-10-26 18:06:45 -04:00
|
|
|
}
|