summaryrefslogtreecommitdiff
path: root/src/video/cocoa
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2011-10-31 05:56:58 -0400
committerSam Lantinga <slouken@libsdl.org>2011-10-31 05:56:58 -0400
commit07b4a2ffe6a33667d09fbe4693d4c977b2f3d100 (patch)
tree0c97c27488f1b550ada2af5270b321833378a7ac /src/video/cocoa
parente19a2fbe61685250e0db0d972253250cc85c4809 (diff)
Lots of fixes importing SDL source wholesale into a new iOS project
--HG-- rename : src/libm/math.h => src/libm/math_libm.h
Diffstat (limited to 'src/video/cocoa')
-rw-r--r--src/video/cocoa/SDL_cocoaclipboard.m4
-rw-r--r--src/video/cocoa/SDL_cocoaevents.m4
-rw-r--r--src/video/cocoa/SDL_cocoakeyboard.m6
-rw-r--r--src/video/cocoa/SDL_cocoamodes.m6
-rw-r--r--src/video/cocoa/SDL_cocoamouse.m19
-rw-r--r--src/video/cocoa/SDL_cocoaopengl.m4
-rw-r--r--src/video/cocoa/SDL_cocoashape.m10
-rw-r--r--src/video/cocoa/SDL_cocoavideo.m4
-rw-r--r--src/video/cocoa/SDL_cocoawindow.m6
9 files changed, 42 insertions, 21 deletions
diff --git a/src/video/cocoa/SDL_cocoaclipboard.m b/src/video/cocoa/SDL_cocoaclipboard.m
index e575f2ca..2b1b231e 100644
--- a/src/video/cocoa/SDL_cocoaclipboard.m
+++ b/src/video/cocoa/SDL_cocoaclipboard.m
@@ -20,6 +20,8 @@
*/
#include "SDL_config.h"
+#if SDL_VIDEO_DRIVER_COCOA
+
#include "SDL_cocoavideo.h"
#include "../../events/SDL_clipboardevents_c.h"
@@ -124,4 +126,6 @@ Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data)
[pool release];
}
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m
index b5e4e027..321ea76a 100644
--- a/src/video/cocoa/SDL_cocoaevents.m
+++ b/src/video/cocoa/SDL_cocoaevents.m
@@ -19,6 +19,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
#include "SDL_timer.h"
#include "SDL_cocoavideo.h"
@@ -220,4 +222,6 @@ Cocoa_PumpEvents(_THIS)
[pool release];
}
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m
index c82b7059..c2da570d 100644
--- a/src/video/cocoa/SDL_cocoakeyboard.m
+++ b/src/video/cocoa/SDL_cocoakeyboard.m
@@ -20,6 +20,8 @@
*/
#include "SDL_config.h"
+#if SDL_VIDEO_DRIVER_COCOA
+
#include "SDL_cocoavideo.h"
#include "../../events/SDL_keyboard_c.h"
@@ -28,7 +30,7 @@
#include <Carbon/Carbon.h>
//#define DEBUG_IME NSLog
-#define DEBUG_IME (void)
+#define DEBUG_IME(...)
#ifndef NX_DEVICERCTLKEYMASK
#define NX_DEVICELCTLKEYMASK 0x00000001
@@ -733,4 +735,6 @@ Cocoa_QuitKeyboard(_THIS)
{
}
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m
index 5babd40d..cbed0bae 100644
--- a/src/video/cocoa/SDL_cocoamodes.m
+++ b/src/video/cocoa/SDL_cocoamodes.m
@@ -20,6 +20,8 @@
*/
#include "SDL_config.h"
+#if SDL_VIDEO_DRIVER_COCOA
+
#include "SDL_cocoavideo.h"
/* !!! FIXME: clean out the pre-10.6 code when it makes sense to do so. */
@@ -113,7 +115,6 @@ static SDL_bool
GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode)
{
SDL_DisplayModeData *data;
- CFNumberRef number;
long width, height, bpp, refreshRate;
data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
@@ -146,6 +147,7 @@ GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode)
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
+ CFNumberRef number;
CFDictionaryRef vidmode = (CFDictionaryRef) moderef;
number = CFDictionaryGetValue(vidmode, kCGDisplayWidth);
CFNumberGetValue(number, kCFNumberLongType, &width);
@@ -448,4 +450,6 @@ Cocoa_QuitModes(_THIS)
ShowMenuBar();
}
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m
index 488bef6b..024639c7 100644
--- a/src/video/cocoa/SDL_cocoamouse.m
+++ b/src/video/cocoa/SDL_cocoamouse.m
@@ -20,6 +20,8 @@
*/
#include "SDL_config.h"
+#if SDL_VIDEO_DRIVER_COCOA
+
#include "SDL_events.h"
#include "SDL_cocoavideo.h"
@@ -147,21 +149,6 @@ Cocoa_InitMouse(_THIS)
SDL_SetDefaultCursor(Cocoa_CreateDefaultCursor());
}
-static int
-ConvertMouseButtonToSDL(int button)
-{
- switch (button)
- {
- case 0:
- return(SDL_BUTTON_LEFT); /* 1 */
- case 1:
- return(SDL_BUTTON_RIGHT); /* 3 */
- case 2:
- return(SDL_BUTTON_MIDDLE); /* 2 */
- }
- return button+1;
-}
-
void
Cocoa_HandleMouseEvent(_THIS, NSEvent *event)
{
@@ -202,4 +189,6 @@ Cocoa_QuitMouse(_THIS)
{
}
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m
index 6dbf8e12..378ab3c9 100644
--- a/src/video/cocoa/SDL_cocoaopengl.m
+++ b/src/video/cocoa/SDL_cocoaopengl.m
@@ -20,11 +20,11 @@
*/
#include "SDL_config.h"
-#include "SDL_cocoavideo.h"
-
/* NSOpenGL implementation of SDL OpenGL support */
#if SDL_VIDEO_OPENGL_CGL
+#include "SDL_cocoavideo.h"
+
#include <OpenGL/CGLTypes.h>
#include <OpenGL/OpenGL.h>
#include <OpenGL/CGLRenderers.h>
diff --git a/src/video/cocoa/SDL_cocoashape.m b/src/video/cocoa/SDL_cocoashape.m
index 19d432d5..542a8289 100644
--- a/src/video/cocoa/SDL_cocoashape.m
+++ b/src/video/cocoa/SDL_cocoashape.m
@@ -19,6 +19,10 @@
3. This notice may not be removed or altered from any source distribution.
*/
+#include "SDL_config.h"
+
+#if SDL_VIDEO_DRIVER_COCOA
+
#include "SDL_cocoavideo.h"
#include "SDL_shape.h"
#include "SDL_cocoashape.h"
@@ -89,6 +93,8 @@ Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShape
closure.window = shaper->window;
SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure);
[closure.path addClip];
+
+ return 0;
}
int
@@ -97,3 +103,7 @@ Cocoa_ResizeWindowShape(SDL_Window *window) {
assert(data != NULL);
return 0;
}
+
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m
index 02d9eefb..886b2beb 100644
--- a/src/video/cocoa/SDL_cocoavideo.m
+++ b/src/video/cocoa/SDL_cocoavideo.m
@@ -20,6 +20,8 @@
*/
#include "SDL_config.h"
+#if SDL_VIDEO_DRIVER_COCOA
+
#include "SDL.h"
#include "SDL_endian.h"
#include "SDL_cocoavideo.h"
@@ -259,4 +261,6 @@ SDL_PromptAssertion_cocoa(const SDL_assert_data *data)
return (SDL_assert_state) (clicked - NSAlertFirstButtonReturn);
}
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
/* vim: set ts=4 sw=4 expandtab: */
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index f21addc8..f8956e08 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -20,6 +20,8 @@
*/
#include "SDL_config.h"
+#if SDL_VIDEO_DRIVER_COCOA
+
#include "SDL_syswm.h"
#include "SDL_timer.h" /* For SDL_GetTicks() */
#include "../SDL_sysvideo.h"
@@ -277,8 +279,6 @@ static __inline__ void ConvertNSRect(NSRect *r)
- (void)mouseEntered:(NSEvent *)theEvent
{
- SDL_Mouse *mouse = SDL_GetMouse();
-
SDL_SetMouseFocus(_data->window);
SDL_SetCursor(NULL);
@@ -991,4 +991,6 @@ Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
}
}
+#endif /* SDL_VIDEO_DRIVER_COCOA */
+
/* vi: set ts=4 sw=4 expandtab: */