1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-22 18:28:52 -05:00

Removed deprecated Carbon port.

This commit is contained in:
Camilla Berglund 2010-09-11 02:04:00 +02:00
parent cf2df6e478
commit 134d7d0708
10 changed files with 0 additions and 2086 deletions

View File

@ -1,38 +0,0 @@
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/lib
${GLFW_INCLUDE_DIR})
set(libglfw_SOURCES
${common_SOURCES}
carbon_enable.c
carbon_fullscreen.c
carbon_glext.c
carbon_init.c
carbon_joystick.c
carbon_time.c
carbon_window.c)
add_library(libglfwStatic STATIC ${libglfw_SOURCES})
add_library(libglfwShared SHARED ${libglfw_SOURCES})
target_link_libraries(libglfwShared ${GLFW_LIBRARIES})
set_target_properties(libglfwStatic libglfwShared PROPERTIES
CLEAN_DIRECT_OUTPUT 1
OUTPUT_NAME glfw
)
# Append -fno-common to the compile flags to work around a bug in the Apple GCC
get_target_property(CFLAGS libglfwShared COMPILE_FLAGS)
if(NOT CFLAGS)
set(CFLAGS "")
endif(NOT CFLAGS)
set_target_properties(libglfwShared PROPERTIES COMPILE_FLAGS "${CFLAGS} -fno-common")
install(TARGETS libglfwStatic libglfwShared DESTINATION lib)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig)

View File

@ -1,43 +0,0 @@
//========================================================================
// GLFW - An OpenGL framework
// Platform: Carbon/AGL/CGL
// API Version: 3.0
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2003 Keith Bauer
// Copyright (c) 2003-2010 Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
void _glfwPlatformEnableSystemKeys( void )
{
// Nothing to do; event handling code checks the status of
// _glfwWin.sysKeysDisabled to ensure this behavior.
}
void _glfwPlatformDisableSystemKeys( void )
{
// Nothing to do; event handling code checks the status of
// _glfwWin.sysKeysDisabled to ensure this behavior.
}

View File

@ -1,129 +0,0 @@
//========================================================================
// GLFW - An OpenGL framework
// Platform: Carbon/AGL/CGL
// API Version: 3.0
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2003 Keith Bauer
// Copyright (c) 2003-2010 Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#include "internal.h"
//========================================================================
// Compares two video modes
//========================================================================
static int _glfwVideoModesEqual( GLFWvidmode* first,
GLFWvidmode* second )
{
if( first->width != second->width )
return 0;
if( first->height != second->height )
return 0;
if( first->redBits + first->greenBits + first->blueBits !=
second->redBits + second->greenBits + second->blueBits )
return 0;
return 1;
}
//========================================================================
// Converts a CG mode to a GLFW mode
//========================================================================
static void _glfwCGToGLFWVideoMode( CFDictionaryRef cgMode,
GLFWvidmode* glfwMode )
{
int bitsPerSample;
CFNumberGetValue( CFDictionaryGetValue( cgMode, kCGDisplayWidth ),
kCFNumberIntType,
&(glfwMode->width) );
CFNumberGetValue( CFDictionaryGetValue( cgMode, kCGDisplayHeight ),
kCFNumberIntType,
&(glfwMode->height) );
CFNumberGetValue( CFDictionaryGetValue( cgMode, kCGDisplayBitsPerSample ),
kCFNumberIntType,
&bitsPerSample );
glfwMode->redBits = bitsPerSample;
glfwMode->greenBits = bitsPerSample;
glfwMode->blueBits = bitsPerSample;
}
//========================================================================
// Get a list of available video modes
//========================================================================
int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount )
{
int i, j, maxModes, numModes;
GLFWvidmode mode;
CFArrayRef availableModes = CGDisplayAvailableModes( kCGDirectMainDisplay );
CFIndex numberOfAvailableModes = CFArrayGetCount( availableModes );
numModes = 0;
maxModes = ( numberOfAvailableModes < maxcount ?
numberOfAvailableModes :
maxcount );
for( i = 0; i < maxModes; ++i )
{
_glfwCGToGLFWVideoMode( CFArrayGetValueAtIndex( availableModes, i ),
&mode );
// Is it a valid mode? (only list depths >= 15 bpp)
if( mode.redBits + mode.greenBits + mode.blueBits < 15 )
continue;
// Check for duplicate of current mode in target list
for( j = 0; j < numModes; ++j )
{
if( _glfwVideoModesEqual( &mode, &(list[j]) ) )
break;
}
// If empty list or no match found
if( numModes == 0 || j == numModes )
{
list[numModes++] = mode;
}
}
return numModes;
}
//========================================================================
// Get the desktop video mode
//========================================================================
void _glfwPlatformGetDesktopMode( GLFWvidmode *mode )
{
_glfwCGToGLFWVideoMode( _glfwDesktopVideoMode, mode );
}

View File

@ -1,53 +0,0 @@
//========================================================================
// GLFW - An OpenGL framework
// Platform: Carbon/AGL/CGL
// API Version: 3.0
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2003 Keith Bauer
// Copyright (c) 2003-2010 Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#include "internal.h"
int _glfwPlatformExtensionSupported( const char *extension )
{
// There are no AGL, CGL or NSGL extensions.
return GL_FALSE;
}
void * _glfwPlatformGetProcAddress( const char *procname )
{
CFStringRef symbolName = CFStringCreateWithCString( kCFAllocatorDefault,
procname,
kCFStringEncodingASCII );
void *symbol = CFBundleGetFunctionPointerForName( _glfwLibrary.Libs.OpenGLFramework,
symbolName );
CFRelease( symbolName );
return symbol;
}

View File

@ -1,159 +0,0 @@
//========================================================================
// GLFW - An OpenGL framework
// Platform: Carbon/AGL/CGL
// API Version: 3.0
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2003 Keith Bauer
// Copyright (c) 2003-2010 Camilla Berglund <elmindreda@elmindreda.org>
// Copyright (c) 2006-2007 Robin Leffmann
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#include "internal.h"
#include <unistd.h>
//========================================================================
// Global variables
//========================================================================
// KCHR resource pointer for keycode translation
void *KCHRPtr;
//========================================================================
// Terminate GLFW when exiting application
//========================================================================
static void glfw_atexit( void )
{
glfwTerminate();
}
#define NO_BUNDLE_MESSAGE \
"Working in unbundled mode. " \
"You should build a .app wrapper for your Mac OS X applications.\n"
#define UNBUNDLED \
fprintf(stderr, NO_BUNDLE_MESSAGE); \
_glfwLibrary.Unbundled = 1; \
return
void _glfwChangeToResourcesDirectory( void )
{
CFBundleRef mainBundle = CFBundleGetMainBundle();
if( mainBundle == NULL )
{
UNBUNDLED;
}
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL( mainBundle );
char resourcesPath[ _GLFW_MAX_PATH_LENGTH ];
CFStringRef lastComponent = CFURLCopyLastPathComponent( resourcesURL );
if( kCFCompareEqualTo != CFStringCompare(
CFSTR( "Resources" ),
lastComponent,
0 ) )
{
UNBUNDLED;
}
CFRelease( lastComponent );
if( !CFURLGetFileSystemRepresentation( resourcesURL,
TRUE,
(UInt8*)resourcesPath,
_GLFW_MAX_PATH_LENGTH ) )
{
CFRelease( resourcesURL );
UNBUNDLED;
}
CFRelease( resourcesURL );
if( chdir( resourcesPath ) != 0 )
{
UNBUNDLED;
}
}
int _glfwPlatformInit( void )
{
struct timeval tv;
UInt32 nullDummy = 0;
_glfwWin.window = NULL;
_glfwWin.aglContext = NULL;
_glfwWin.cglContext = NULL;
_glfwWin.windowUPP = NULL;
_glfwInput.Modifiers = 0;
_glfwLibrary.Unbundled = 0;
_glfwLibrary.Libs.OpenGLFramework =
CFBundleGetBundleWithIdentifier( CFSTR( "com.apple.opengl" ) );
if( _glfwLibrary.Libs.OpenGLFramework == NULL )
{
fprintf( stderr, "glfwInit failing because you aren't linked to OpenGL\n" );
return GL_FALSE;
}
_glfwDesktopVideoMode = CGDisplayCurrentMode( kCGDirectMainDisplay );
if( _glfwDesktopVideoMode == NULL )
{
fprintf( stderr, "glfwInit failing because it kind find the desktop display mode\n" );
return GL_FALSE;
}
// Install atexit routine
atexit( glfw_atexit );
_glfwChangeToResourcesDirectory();
// Ugly hack to reduce the nasty jump that occurs at the first non-
// sys keypress, caused by OS X loading certain meta scripts used
// for lexical- and raw keycode translation - instead of letting
// this happen while our application is running, we do some blunt
// function calls in advance just to get the script caching out of
// the way BEFORE our window/screen is opened. These calls might
// generate err return codes, but we don't care in this case.
// NOTE: KCHRPtr is declared globally, because we need it later on.
KCHRPtr = (void *)GetScriptVariable( smCurrentScript, smKCHRCache );
KeyTranslate( KCHRPtr, 0, &nullDummy );
UppercaseText( (char *)&nullDummy, 0, smSystemScript );
gettimeofday( &tv, NULL );
_glfwLibrary.Timer.t0 = tv.tv_sec + (double) tv.tv_usec / 1000000.0;
return GL_TRUE;
}
int _glfwPlatformTerminate( void )
{
return GL_TRUE;
}

View File

@ -1,51 +0,0 @@
//========================================================================
// GLFW - An OpenGL framework
// Platform: Carbon/AGL/CGL
// API Version: 3.0
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2003 Keith Bauer
// Copyright (c) 2003-2010 Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#include "internal.h"
// TO DO: use HID manager to implement joystick support.
int _glfwPlatformGetJoystickParam( int joy, int param )
{
// GL_FALSE == 0
return 0;
}
int _glfwPlatformGetJoystickPos( int joy, float *pos, int numaxes )
{
return 0;
}
int _glfwPlatformGetJoystickButtons( int joy, unsigned char *buttons, int numbuttons )
{
return 0;
}

View File

@ -1,62 +0,0 @@
//========================================================================
// GLFW - An OpenGL framework
// Platform: Carbon/AGL/CGL
// API Version: 3.0
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2003 Keith Bauer
// Copyright (c) 2003-2010 Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#include "internal.h"
//************************************************************************
//**** Platform implementation functions ****
//************************************************************************
//========================================================================
// Return timer value in seconds
//========================================================================
double _glfwPlatformGetTime( void )
{
struct timeval tv;
gettimeofday( &tv, NULL );
return tv.tv_sec + (double) tv.tv_usec / 1000000.0 - _glfwLibrary.Timer.t0;
}
//========================================================================
// Set timer value in seconds
//========================================================================
void _glfwPlatformSetTime( double time )
{
struct timeval tv;
gettimeofday( &tv, NULL );
_glfwLibrary.Timer.t0 = tv.tv_sec + (double) tv.tv_usec / 1000000.0 - time;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +0,0 @@
prefix=@PREFIX@
exec_prefix=@PREFIX@
libdir=@PREFIX@/lib
includedir=@PREFIX@/include
Name: GLFW
Description: A portable framework for OpenGL development
Version: 3.0
URL: http://www.glfw.org/
Libs: -L${libdir} -lglfw -framework AGL -framework OpenGL -framework Carbon
Cflags: -I${includedir}

View File

@ -1,265 +0,0 @@
//========================================================================
// GLFW - An OpenGL framework
// Platform: Carbon/AGL/CGL
// API Version: 3.0
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2003 Keith Bauer
// Copyright (c) 2003-2010 Camilla Berglund <elmindreda@elmindreda.org>
// Copyright (c) 2006-2007 Robin Leffmann
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#ifndef _platform_h_
#define _platform_h_
// This is the Mac OS X version of GLFW
#define _GLFW_MAC_OS_X
#include <Carbon/Carbon.h>
#include <OpenGL/OpenGL.h>
#include <AGL/agl.h>
#include "../../include/GL/glfw.h"
#if MACOSX_DEPLOYMENT_TARGET < MAC_OS_X_VERSION_10_3
#ifndef kCGLNoError
#define kCGLNoError 0
#endif
#endif
#ifndef GL_VERSION_3_0
typedef const GLubyte * (APIENTRY *PFNGLGETSTRINGIPROC) (GLenum, GLuint);
#endif /*GL_VERSION_3_0*/
//========================================================================
// Defines
//========================================================================
#define _GLFW_MAX_PATH_LENGTH (8192)
#define MAC_KEY_ENTER 0x24
#define MAC_KEY_RETURN 0x34
#define MAC_KEY_ESC 0x35
#define MAC_KEY_F1 0x7A
#define MAC_KEY_F2 0x78
#define MAC_KEY_F3 0x63
#define MAC_KEY_F4 0x76
#define MAC_KEY_F5 0x60
#define MAC_KEY_F6 0x61
#define MAC_KEY_F7 0x62
#define MAC_KEY_F8 0x64
#define MAC_KEY_F9 0x65
#define MAC_KEY_F10 0x6D
#define MAC_KEY_F11 0x67
#define MAC_KEY_F12 0x6F
#define MAC_KEY_F13 0x69
#define MAC_KEY_F14 0x6B
#define MAC_KEY_F15 0x71
#define MAC_KEY_UP 0x7E
#define MAC_KEY_DOWN 0x7D
#define MAC_KEY_LEFT 0x7B
#define MAC_KEY_RIGHT 0x7C
#define MAC_KEY_TAB 0x30
#define MAC_KEY_BACKSPACE 0x33
#define MAC_KEY_HELP 0x72
#define MAC_KEY_DEL 0x75
#define MAC_KEY_PAGEUP 0x74
#define MAC_KEY_PAGEDOWN 0x79
#define MAC_KEY_HOME 0x73
#define MAC_KEY_END 0x77
#define MAC_KEY_KP_0 0x52
#define MAC_KEY_KP_1 0x53
#define MAC_KEY_KP_2 0x54
#define MAC_KEY_KP_3 0x55
#define MAC_KEY_KP_4 0x56
#define MAC_KEY_KP_5 0x57
#define MAC_KEY_KP_6 0x58
#define MAC_KEY_KP_7 0x59
#define MAC_KEY_KP_8 0x5B
#define MAC_KEY_KP_9 0x5C
#define MAC_KEY_KP_DIVIDE 0x4B
#define MAC_KEY_KP_MULTIPLY 0x43
#define MAC_KEY_KP_SUBTRACT 0x4E
#define MAC_KEY_KP_ADD 0x45
#define MAC_KEY_KP_DECIMAL 0x41
#define MAC_KEY_KP_EQUAL 0x51
#define MAC_KEY_KP_ENTER 0x4C
#define MAC_KEY_NUMLOCK 0x47
//========================================================================
// GLFW platform specific types
//========================================================================
//------------------------------------------------------------------------
// Pointer length integer
//------------------------------------------------------------------------
typedef intptr_t GLFWintptr;
GLFWGLOBAL CFDictionaryRef _glfwDesktopVideoMode;
//------------------------------------------------------------------------
// Window structure
//------------------------------------------------------------------------
typedef struct _GLFWwin_struct _GLFWwin;
struct _GLFWwin_struct {
// ========= PLATFORM INDEPENDENT MANDATORY PART =========================
// User callback functions
GLFWwindowsizefun windowSizeCallback;
GLFWwindowclosefun windowCloseCallback;
GLFWwindowrefreshfun windowRefreshCallback;
GLFWmousebuttonfun mouseButtonCallback;
GLFWmouseposfun mousePosCallback;
GLFWmousewheelfun mouseWheelCallback;
GLFWkeyfun keyCallback;
GLFWcharfun charCallback;
// User selected window settings
int fullscreen; // Fullscreen flag
int mouseLock; // Mouse-lock flag
int sysKeysDisabled; // System keys disabled flag
int windowNoResize; // Resize- and maximize gadgets disabled flag
int refreshRate; // Vertical monitor refresh rate
// Window status & parameters
int opened; // Flag telling if window is opened or not
int active; // Application active flag
int iconified; // Window iconified flag
int width, height; // Window width and heigth
int accelerated; // GL_TRUE if window is HW accelerated
// Framebuffer attributes
int redBits;
int greenBits;
int blueBits;
int alphaBits;
int depthBits;
int stencilBits;
int accumRedBits;
int accumGreenBits;
int accumBlueBits;
int accumAlphaBits;
int auxBuffers;
int stereo;
int samples;
// OpenGL extensions and context attributes
int glMajor, glMinor, glRevision;
int glForward, glDebug, glProfile;
PFNGLGETSTRINGIPROC GetStringi;
// ========= PLATFORM SPECIFIC PART ======================================
WindowRef window;
AGLContext aglContext;
AGLPixelFormat aglPixelFormat;
CGLContextObj cglContext;
CGLPixelFormatObj cglPixelFormat;
EventHandlerUPP windowUPP;
EventHandlerUPP mouseUPP;
EventHandlerUPP commandUPP;
EventHandlerUPP keyboardUPP;
};
GLFWGLOBAL _GLFWwin _glfwWin;
//------------------------------------------------------------------------
// User input status (some of this should go in _GLFWwin)
//------------------------------------------------------------------------
GLFWGLOBAL struct {
// ========= PLATFORM INDEPENDENT MANDATORY PART =========================
// Mouse status
int MousePosX, MousePosY;
int WheelPos;
char MouseButton[ GLFW_MOUSE_BUTTON_LAST + 1 ];
// Keyboard status
char Key[ GLFW_KEY_LAST + 1 ];
int LastChar;
// User selected settings
int StickyKeys;
int StickyMouseButtons;
int KeyRepeat;
// ========= PLATFORM SPECIFIC PART ======================================
UInt32 Modifiers;
} _glfwInput;
//------------------------------------------------------------------------
// Library global data
//------------------------------------------------------------------------
GLFWGLOBAL struct {
// ========= PLATFORM INDEPENDENT MANDATORY PART =========================
// Window opening hints
_GLFWhints hints;
// ========= PLATFORM SPECIFIC PART ======================================
// Timer data
struct {
double t0;
} Timer;
struct {
// Bundle for dynamically-loading extension function pointers
CFBundleRef OpenGLFramework;
} Libs;
int Unbundled;
} _glfwLibrary;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
void _glfwChangeToResourcesDirectory( void );
#endif // _platform_h_