mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
Fix some ISO C90 warnings on OSX
This commit is contained in:
parent
e90ded6c23
commit
54a4511247
@ -23,8 +23,10 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "clutter-osx.h"
|
||||
|
||||
#include "clutter-backend-osx.h"
|
||||
#include "clutter-device-manager-osx.h"
|
||||
#include "clutter-shader.h"
|
||||
#include "clutter-stage-osx.h"
|
||||
|
||||
#include "clutter-debug.h"
|
||||
@ -76,13 +78,13 @@ clutter_backend_osx_create_stage (ClutterBackend *backend,
|
||||
{
|
||||
ClutterStageWindow *impl;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "create_stage: wrapper=%p", wrapper);
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
impl = _clutter_stage_osx_new (backend, wrapper);
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "create_stage: impl=%p", impl);
|
||||
CLUTTER_NOTE (BACKEND, "create_stage: wrapper=%p - impl=%p",
|
||||
wrapper,
|
||||
impl);
|
||||
|
||||
CLUTTER_OSX_POOL_RELEASE();
|
||||
|
||||
@ -129,11 +131,13 @@ clutter_backend_osx_create_context (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendOSX *backend_osx = CLUTTER_BACKEND_OSX (backend);
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
if ( backend_osx->context == nil)
|
||||
|
||||
if (backend_osx->context == nil)
|
||||
{
|
||||
/* Allocate ourselves a GL context. Since we're supposed to have only one per
|
||||
* backend we can just as well create it now.
|
||||
/* Allocate ourselves a GL context. Since we're supposed to have
|
||||
* only one per backend we can just as well create it now.
|
||||
*/
|
||||
NSOpenGLPixelFormatAttribute attrs[] = {
|
||||
NSOpenGLPFADoubleBuffer,
|
||||
@ -142,20 +146,24 @@ clutter_backend_osx_create_context (ClutterBackend *backend,
|
||||
0
|
||||
};
|
||||
|
||||
backend_osx->pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
|
||||
backend_osx->context = [[NSOpenGLContext alloc]
|
||||
initWithFormat: backend_osx->pixel_format
|
||||
shareContext: nil];
|
||||
/* Enable vblank sync - http://developer.apple.com/qa/qa2007/qa1521.html */
|
||||
#ifdef MAC_OS_X_VERSION_10_5
|
||||
const int sw = 1;
|
||||
#else
|
||||
const long sw = 1;
|
||||
#endif
|
||||
|
||||
backend_osx->pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
|
||||
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];
|
||||
}
|
||||
|
||||
[backend_osx->context makeCurrentContext];
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Context was created");
|
||||
|
||||
CLUTTER_OSX_POOL_RELEASE();
|
||||
|
||||
return TRUE;
|
||||
@ -167,10 +175,10 @@ clutter_backend_osx_ensure_context (ClutterBackend *backend,
|
||||
{
|
||||
ClutterBackendOSX *backend_osx = CLUTTER_BACKEND_OSX (backend);
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "ensure_context: wrapper=%p", wrapper);
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "ensure_context: wrapper=%p", wrapper);
|
||||
|
||||
if (wrapper)
|
||||
{
|
||||
ClutterStageWindow *impl = _clutter_stage_get_window (wrapper);
|
||||
@ -196,13 +204,14 @@ clutter_backend_osx_ensure_context (ClutterBackend *backend,
|
||||
static void
|
||||
clutter_backend_osx_init (ClutterBackendOSX *backend_osx)
|
||||
{
|
||||
const ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||
|
||||
backend_osx->context = nil;
|
||||
backend_osx->pixel_format = nil;
|
||||
|
||||
/* Bring our app to foreground, background apps don't appear in dock or
|
||||
/* Bring our app to foreground, background apps don't appear in dock or
|
||||
* accept keyboard focus.
|
||||
*/
|
||||
const ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||
TransformProcessType (&psn, kProcessTransformToForegroundApplication);
|
||||
|
||||
/* Also raise our app to front, otherwise our window will remain under the
|
||||
|
@ -142,7 +142,7 @@ clutter_device_manager_osx_get_core_device (ClutterDeviceManager *manager,
|
||||
|
||||
static ClutterInputDevice *
|
||||
clutter_device_manager_osx_get_device (ClutterDeviceManager *manager,
|
||||
gint id)
|
||||
gint id_)
|
||||
{
|
||||
ClutterDeviceManagerOSX *manager_osx = CLUTTER_DEVICE_MANAGER_OSX (manager);
|
||||
GSList *l;
|
||||
@ -151,7 +151,7 @@ clutter_device_manager_osx_get_device (ClutterDeviceManager *manager,
|
||||
{
|
||||
ClutterInputDevice *device = l->data;
|
||||
|
||||
if (clutter_input_device_get_device_id (device) == id)
|
||||
if (clutter_input_device_get_device_id (device) == id_)
|
||||
return device;
|
||||
}
|
||||
|
||||
|
@ -340,12 +340,13 @@ got_fd_activity (void *info)
|
||||
static void
|
||||
select_thread_start (void)
|
||||
{
|
||||
CFRunLoopSourceContext source_context = {0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, got_fd_activity };
|
||||
|
||||
g_return_if_fail (select_thread_state == BEFORE_START);
|
||||
|
||||
pipe (select_thread_wakeup_pipe);
|
||||
fcntl (select_thread_wakeup_pipe[0], F_SETFL, O_NONBLOCK);
|
||||
|
||||
CFRunLoopSourceContext source_context = {0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, got_fd_activity };
|
||||
select_main_thread_source = CFRunLoopSourceCreate (NULL, 0, &source_context);
|
||||
|
||||
CFRunLoopAddSource (main_thread_run_loop, select_main_thread_source, kCFRunLoopCommonModes);
|
||||
|
@ -222,11 +222,14 @@ process_scroll_event (ClutterEvent *event,
|
||||
{
|
||||
ClutterStageWindow *impl;
|
||||
ClutterStageOSX *stage_osx;
|
||||
gfloat *scroll_pos;
|
||||
|
||||
impl = _clutter_stage_get_window (event->any.stage);
|
||||
stage_osx = CLUTTER_STAGE_OSX (impl);
|
||||
|
||||
gfloat *scroll_pos = isVertical ? &(stage_osx->scroll_pos_y) : &(stage_osx->scroll_pos_x);
|
||||
scroll_pos = isVertical
|
||||
? &(stage_osx->scroll_pos_y)
|
||||
: &(stage_osx->scroll_pos_x);
|
||||
|
||||
while (abs (*scroll_pos) >= WHEEL_DELTA)
|
||||
{
|
||||
|
@ -74,9 +74,10 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
|
||||
|
||||
- (BOOL) windowShouldClose: (id) sender
|
||||
{
|
||||
ClutterEvent event;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] windowShouldClose", self->stage_osx);
|
||||
|
||||
ClutterEvent event;
|
||||
event.type = CLUTTER_DELETE;
|
||||
event.any.stage = CLUTTER_STAGE (self->stage_osx->wrapper);
|
||||
clutter_event_put (&event);
|
||||
@ -281,24 +282,24 @@ clutter_stage_osx_realize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
||||
ClutterBackendOSX *backend_osx;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] realize", self);
|
||||
gfloat width, height;
|
||||
NSRect rect;
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
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
|
||||
* stage before it's realized.
|
||||
*/
|
||||
gfloat width, height;
|
||||
clutter_actor_get_size (CLUTTER_ACTOR (self->wrapper),
|
||||
&width,
|
||||
&height);
|
||||
clutter_actor_get_size (CLUTTER_ACTOR (self->wrapper), &width, &height);
|
||||
self->requisition_width = width;
|
||||
self->requisition_height= height;
|
||||
NSRect rect = NSMakeRect(0, 0, self->requisition_width, self->requisition_height);
|
||||
|
||||
rect = NSMakeRect(0, 0, self->requisition_width, self->requisition_height);
|
||||
|
||||
self->view = [[ClutterGLView alloc]
|
||||
initWithFrame: rect
|
||||
@ -313,10 +314,10 @@ clutter_stage_osx_realize (ClutterStageWindow *stage_window)
|
||||
/* looks better than positioning to 0,0 (bottom right) */
|
||||
[self->window center];
|
||||
|
||||
CLUTTER_OSX_POOL_RELEASE();
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Stage successfully realized");
|
||||
|
||||
CLUTTER_OSX_POOL_RELEASE();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -325,13 +326,13 @@ clutter_stage_osx_unrealize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] unrealize", self);
|
||||
|
||||
/* ensure we get realize+unrealize properly paired */
|
||||
g_return_if_fail (self->view != NULL && self->window != NULL);
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
[self->view release];
|
||||
[self->window close];
|
||||
|
||||
@ -346,11 +347,12 @@ clutter_stage_osx_show (ClutterStageWindow *stage_window,
|
||||
gboolean do_raise)
|
||||
{
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] show", self);
|
||||
BOOL isViewHidden;
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] show", self);
|
||||
|
||||
clutter_stage_osx_realize (stage_window);
|
||||
clutter_actor_map (CLUTTER_ACTOR (self->wrapper));
|
||||
|
||||
@ -359,8 +361,8 @@ clutter_stage_osx_show (ClutterStageWindow *stage_window,
|
||||
/* Draw view should be avoided and it is the reason why
|
||||
* we should hide OpenGL view while we showing the stage.
|
||||
*/
|
||||
BOOL isViewHidden = [self->view isHidden];
|
||||
if ( isViewHidden == NO)
|
||||
isViewHidden = [self->view isHidden];
|
||||
if (isViewHidden == NO)
|
||||
[self->view setHidden:YES];
|
||||
|
||||
if (self->acceptFocus)
|
||||
@ -383,10 +385,10 @@ clutter_stage_osx_hide (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] hide", self);
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] hide", self);
|
||||
|
||||
[self->window orderOut: nil];
|
||||
|
||||
clutter_stage_osx_unrealize (stage_window);
|
||||
@ -415,8 +417,11 @@ clutter_stage_osx_resize (ClutterStageWindow *stage_window,
|
||||
{
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
||||
ClutterActor *actor = clutter_stage_osx_get_wrapper (stage_window);
|
||||
|
||||
guint min_width, min_height;
|
||||
NSSize size;
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC ();
|
||||
|
||||
clutter_stage_get_minimum_size (CLUTTER_STAGE (actor),
|
||||
&min_width,
|
||||
&min_height);
|
||||
@ -428,10 +433,7 @@ clutter_stage_osx_resize (ClutterStageWindow *stage_window,
|
||||
self->requisition_width = width;
|
||||
self->requisition_height = height;
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC ();
|
||||
|
||||
NSSize size = NSMakeSize (self->requisition_width,
|
||||
self->requisition_height);
|
||||
size = NSMakeSize (self->requisition_width, self->requisition_height);
|
||||
[self->window setContentSize: size];
|
||||
|
||||
CLUTTER_OSX_POOL_RELEASE ();
|
||||
@ -452,10 +454,10 @@ clutter_stage_osx_set_title (ClutterStageWindow *stage_window,
|
||||
{
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] set_title: %s", self, title);
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] set_title: %s", self, title);
|
||||
|
||||
[self->window setTitle:[NSString stringWithUTF8String: title ? title : ""]];
|
||||
|
||||
CLUTTER_OSX_POOL_RELEASE();
|
||||
@ -467,10 +469,10 @@ clutter_stage_osx_set_fullscreen (ClutterStageWindow *stage_window,
|
||||
{
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] set_fullscreen: %u", self, fullscreen);
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] set_fullscreen: %u", self, fullscreen);
|
||||
|
||||
/* Make sure to update the state before clutter_stage_osx_set_frame.
|
||||
*
|
||||
* Toggling fullscreen isn't atomic, there's two "events" involved:
|
||||
@ -496,10 +498,12 @@ clutter_stage_osx_set_cursor_visible (ClutterStageWindow *stage_window,
|
||||
gboolean cursor_visible)
|
||||
{
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
if ( cursor_visible )
|
||||
|
||||
if (cursor_visible)
|
||||
[NSCursor unhide];
|
||||
else
|
||||
[NSCursor hide];
|
||||
|
||||
CLUTTER_OSX_POOL_RELEASE();
|
||||
}
|
||||
|
||||
@ -507,9 +511,12 @@ static void
|
||||
clutter_stage_osx_set_user_resizable (ClutterStageWindow *stage_window,
|
||||
gboolean is_resizable)
|
||||
{
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
[self->window setShowsResizeIndicator:is_resizable];
|
||||
|
||||
CLUTTER_OSX_POOL_RELEASE();
|
||||
}
|
||||
|
||||
@ -517,9 +524,12 @@ static void
|
||||
clutter_stage_osx_set_accept_focus (ClutterStageWindow *stage_window,
|
||||
gboolean accept_focus)
|
||||
{
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
self->acceptFocus = !!accept_focus;
|
||||
|
||||
CLUTTER_OSX_POOL_RELEASE();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user