[clutter/wip/backend-next] osx: Clean up the backend implementation
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/backend-next] osx: Clean up the backend implementation
- Date: Mon, 7 Nov 2011 14:50:43 +0000 (UTC)
commit 1adb7485ba5c75aef837fff3438f61a0fc0fd41e
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Nov 7 14:48:48 2011 +0000
osx: Clean up the backend implementation
Instead of implementing create_stage() and a constructor for
ClutterStageOSX, we can use the default implementations in
ClutterBackend, and spare us some code duplication.
clutter/osx/clutter-backend-osx.c | 27 ++++-----------------------
clutter/osx/clutter-stage-osx.c | 33 +++++++++------------------------
clutter/osx/clutter-stage-osx.h | 3 ---
3 files changed, 13 insertions(+), 50 deletions(-)
---
diff --git a/clutter/osx/clutter-backend-osx.c b/clutter/osx/clutter-backend-osx.c
index 020a0ae..be7d75e 100644
--- a/clutter/osx/clutter-backend-osx.c
+++ b/clutter/osx/clutter-backend-osx.c
@@ -71,27 +71,8 @@ clutter_backend_osx_post_parse (ClutterBackend *backend,
static ClutterFeatureFlags
clutter_backend_osx_get_features (ClutterBackend *backend)
{
- return CLUTTER_FEATURE_STAGE_MULTIPLE|CLUTTER_FEATURE_STAGE_USER_RESIZE;
-}
-
-static ClutterStageWindow*
-clutter_backend_osx_create_stage (ClutterBackend *backend,
- ClutterStage *wrapper,
- GError **error)
-{
- ClutterStageWindow *impl;
-
- CLUTTER_OSX_POOL_ALLOC();
-
- impl = _clutter_stage_osx_new (backend, wrapper);
-
- CLUTTER_NOTE (BACKEND, "create_stage: wrapper=%p - impl=%p",
- wrapper,
- impl);
-
- CLUTTER_OSX_POOL_RELEASE();
-
- return impl;
+ return CLUTTER_FEATURE_STAGE_MULTIPLE
+ | CLUTTER_FEATURE_STAGE_USER_RESIZE;
}
void
@@ -127,7 +108,7 @@ clutter_backend_osx_create_context (ClutterBackend *backend,
*/
NSOpenGLPixelFormatAttribute attrs[] = {
NSOpenGLPFADoubleBuffer,
- NSOpenGLPFADepthSize, 24,
+ NSOpenGLPFADepthSize, 32,
NSOpenGLPFAStencilSize, 8,
0
};
@@ -174,6 +155,7 @@ clutter_backend_osx_ensure_context (ClutterBackend *backend,
g_assert (CLUTTER_IS_STAGE_OSX (impl));
stage_osx = CLUTTER_STAGE_OSX (impl);
+ [backend_osx->context clearDrawable];
[backend_osx->context setView:stage_osx->view];
[backend_osx->context makeCurrentContext];
}
@@ -235,7 +217,6 @@ clutter_backend_osx_class_init (ClutterBackendOSXClass *klass)
backend_class->post_parse = clutter_backend_osx_post_parse;
backend_class->get_features = clutter_backend_osx_get_features;
- backend_class->create_stage = clutter_backend_osx_create_stage;
backend_class->create_context = clutter_backend_osx_create_context;
backend_class->ensure_context = clutter_backend_osx_ensure_context;
}
diff --git a/clutter/osx/clutter-stage-osx.c b/clutter/osx/clutter-stage-osx.c
index 8c56e3d..c93c066 100644
--- a/clutter/osx/clutter-stage-osx.c
+++ b/clutter/osx/clutter-stage-osx.c
@@ -128,7 +128,7 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
- (NSSize) windowWillResize:(NSWindow *) sender toSize:(NSSize) frameSize
{
- if ( clutter_stage_get_user_resizable (self->stage_osx->wrapper) )
+ if (clutter_stage_get_user_resizable (self->stage_osx->wrapper))
{
guint min_width, min_height;
clutter_stage_get_minimum_size (self->stage_osx->wrapper,
@@ -143,7 +143,7 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
- (void)windowDidChangeScreen:(NSNotification *)notification
{
- clutter_stage_ensure_redraw (CLUTTER_STAGE(self->stage_osx->wrapper));
+ clutter_stage_ensure_redraw (CLUTTER_STAGE (self->stage_osx->wrapper));
}
@end
@@ -203,8 +203,8 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
stage_osx->requisition_width = [self bounds].size.width;
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);
+ stage_osx->requisition_width,
+ stage_osx->requisition_height);
[self removeTrackingRect:tracking_rect];
tracking_rect = [self addTrackingRect:[self bounds]
@@ -610,32 +610,17 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
}
/*************************************************************************/
-ClutterStageWindow *
-_clutter_stage_osx_new (ClutterBackend *backend,
- ClutterStage *wrapper)
-{
- ClutterStageOSX *self;
-
- self = g_object_new (CLUTTER_TYPE_STAGE_OSX,
- "backend", backend,
- "wrapper", wrapper,
- NULL);
-
- self->isHiding = false;
- self->haveRealized = false;
- self->view = NULL;
- self->window = NULL;
-
- return CLUTTER_STAGE_WINDOW (self);
-}
-
-/*************************************************************************/
static void
clutter_stage_osx_init (ClutterStageOSX *self)
{
self->requisition_width = 640;
self->requisition_height = 480;
self->acceptFocus = TRUE;
+
+ self->isHiding = false;
+ self->haveRealized = false;
+ self->view = NULL;
+ self->window = NULL;
}
static void
diff --git a/clutter/osx/clutter-stage-osx.h b/clutter/osx/clutter-stage-osx.h
index 6c4bad7..be1f338 100644
--- a/clutter/osx/clutter-stage-osx.h
+++ b/clutter/osx/clutter-stage-osx.h
@@ -82,9 +82,6 @@ struct _ClutterStageOSXClass
GType _clutter_stage_osx_get_type (void) G_GNUC_CONST;
-ClutterStageWindow * _clutter_stage_osx_new (ClutterBackend *backend,
- ClutterStage *wrapper);
-
G_END_DECLS
#endif /* __CLUTTER_STAGE_OSX_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]