[clutter] osx: Code style cleanups
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] osx: Code style cleanups
- Date: Wed, 13 Jul 2011 18:33:23 +0000 (UTC)
commit 18b3da95efa6d918eacade7e7f73f6979f201266
Author: Emmanuele Bassi <ebassi gnome org>
Date: Wed Jul 13 19:32:47 2011 +0100
osx: Code style cleanups
clutter/osx/clutter-backend-osx.c | 11 +++++----
clutter/osx/clutter-stage-osx.c | 42 ++++++++++++++++++++++++++++--------
2 files changed, 38 insertions(+), 15 deletions(-)
---
diff --git a/clutter/osx/clutter-backend-osx.c b/clutter/osx/clutter-backend-osx.c
index f9ccecd..9d93074 100644
--- a/clutter/osx/clutter-backend-osx.c
+++ b/clutter/osx/clutter-backend-osx.c
@@ -153,17 +153,18 @@ clutter_backend_osx_create_context (ClutterBackend *backend,
#endif
backend_osx->pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
- backend_osx->context = [[NSOpenGLContext alloc]
- initWithFormat: backend_osx->pixel_format
- shareContext: nil];
+
+ backend_osx->context = [[NSOpenGLContext alloc] initWithFormat: backend_osx->pixel_format
+ shareContext: nil];
+
/* Enable vblank sync - http://developer.apple.com/qa/qa2007/qa1521.html */
[backend_osx->context setValues:&sw forParameter: NSOpenGLCPSwapInterval];
+
+ CLUTTER_NOTE (BACKEND, "Context was created");
}
[backend_osx->context makeCurrentContext];
- CLUTTER_NOTE (BACKEND, "Context was created");
-
CLUTTER_OSX_POOL_RELEASE();
return TRUE;
diff --git a/clutter/osx/clutter-stage-osx.c b/clutter/osx/clutter-stage-osx.c
index 26b6091..6a4fc42 100644
--- a/clutter/osx/clutter-stage-osx.c
+++ b/clutter/osx/clutter-stage-osx.c
@@ -148,7 +148,10 @@ 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];
+ tracking_rect = [self addTrackingRect:[self bounds]
+ owner:self
+ userData:NULL
+ assumeInside:NO];
}
return self;
@@ -173,22 +176,36 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
return YES;
}
+- (BOOL) isOpaque
+{
+ if (clutter_stage_get_use_alpha (CLUTTER_STAGE (self->stage_osx->wrapper)))
+ return NO;
+
+ return YES;
+}
+
- (void) reshape
{
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);
+ (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];
+ tracking_rect = [self addTrackingRect:[self bounds]
+ owner:self
+ userData:NULL
+ assumeInside:NO];
}
/* 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, self->stage_osx->wrapper); \
}
+
EVENT_HANDLER(mouseDown)
EVENT_HANDLER(mouseDragged)
EVENT_HANDLER(mouseUp)
@@ -261,7 +278,8 @@ clutter_stage_osx_set_frame (ClutterStageOSX *self)
*/
[self->window setLevel: CLUTTER_OSX_FULLSCREEN_WINDOW_LEVEL];
- [self->window setFrame: [self->window frameRectForContentRect: [[self->window screen] frame]] display: NO];
+ [self->window setFrame: [self->window frameRectForContentRect: [[self->window screen] frame]]
+ display: NO];
}
else
{
@@ -270,8 +288,10 @@ clutter_stage_osx_set_frame (ClutterStageOSX *self)
if (self->haveNormalFrame)
[self->window setFrame: self->normalFrame display: NO];
else
- /* looks better than positioning to 0,0 (bottom right) */
- [self->window center];
+ {
+ /* looks better than positioning to 0,0 (bottom right) */
+ [self->window center];
+ }
}
}
@@ -289,6 +309,7 @@ clutter_stage_osx_realize (ClutterStageWindow *stage_window)
CLUTTER_NOTE (BACKEND, "[%p] realize", self);
backend_osx = CLUTTER_BACKEND_OSX (self->backend);
+
/* Call get_size - this will either get the geometry size (which
* before we create the window is set to 640x480), or if a size
* is set, it will get that. This lets you set a size on the
@@ -296,7 +317,7 @@ clutter_stage_osx_realize (ClutterStageWindow *stage_window)
*/
clutter_actor_get_size (CLUTTER_ACTOR (self->wrapper), &width, &height);
self->requisition_width = width;
- self->requisition_height= height;
+ self->requisition_height = height;
rect = NSMakeRect(0, 0, self->requisition_width, self->requisition_height);
@@ -304,7 +325,7 @@ clutter_stage_osx_realize (ClutterStageWindow *stage_window)
initWithFrame: rect
pixelFormat: backend_osx->pixel_format
stage: self];
- [self->view setOpenGLContext:backend_osx->context];
+ [self->view setOpenGLContext: backend_osx->context];
self->window = [[ClutterGLWindow alloc]
initWithView: self->view
@@ -423,7 +444,8 @@ clutter_stage_osx_resize (ClutterStageWindow *stage_window,
clutter_stage_get_minimum_size (CLUTTER_STAGE (actor),
&min_width,
&min_height);
- [self->window setContentMinSize:NSMakeSize(min_width, min_height)];
+
+ [self->window setContentMinSize: NSMakeSize (min_width, min_height)];
width = width < min_width ? min_width : width;
height = height < min_height ? min_height : height;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]