19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL - Simple DirectMedia Layer 39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Copyright (C) 1997-2012 Sam Lantinga 49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is free software; you can redistribute it and/or 69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall modify it under the terms of the GNU Library General Public 79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License as published by the Free Software Foundation; either 89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall version 2 of the License, or (at your option) any later version. 99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is distributed in the hope that it will be useful, 119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall but WITHOUT ANY WARRANTY; without even the implied warranty of 129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Library General Public License for more details. 149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall You should have received a copy of the GNU Library General Public 169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License along with this library; if not, write to the Free 179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Sam Lantinga 209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall slouken@libsdl.org 219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/ 229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_config.h" 239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall @file SDL_QuartzVideo.h 269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall @author Darrell Walisser, Max Horn, et al. 279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall @abstract SDL video driver for Mac OS X. 299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall @discussion 319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall TODO 339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - Hardware Cursor support with NSCursor instead of Carbon 349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - Keyboard repeat/mouse speed adjust (if needed) 359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - Multiple monitor support (currently only main display) 369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - Accelerated blitting support 379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - Fix white OpenGL window on minimize (fixed) (update: broken again on 10.2) 389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - Find out what events should be sent/ignored if window is minimized 399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - Find a way to deal with external resolution/depth switch while app is running 409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - Check accuracy of QZ_SetGamma() 419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Problems: 429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - OGL not working in full screen with software renderer 439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - SetColors sets palette correctly but clears framebuffer 449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - Crash in CG after several mode switches (I think this has been fixed) 459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - Retained windows don't draw their title bar quite right (OS Bug) (not using retained windows) 469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - Cursor in 8 bit modes is screwy (might just be Radeon PCI bug) (update: not just Radeon) 479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall - Warping cursor delays mouse events for a fraction of a second, 489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall there is a hack around this that helps a bit 499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/ 509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Needs to be first, so QuickTime.h doesn't include glext.h (10.4) */ 529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_opengl.h" 539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <Cocoa/Cocoa.h> 559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <Carbon/Carbon.h> 569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <OpenGL/OpenGL.h> /* For CGL functions and types */ 579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <IOKit/IOKitLib.h> /* For powersave handling */ 589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <pthread.h> 599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_thread.h" 619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_video.h" 629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_error.h" 639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_timer.h" 649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_loadso.h" 659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_syswm.h" 669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "../SDL_sysvideo.h" 679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "../SDL_pixels_c.h" 689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "../../events/SDL_events_c.h" 699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef __powerpc__ 729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This is a workaround to directly access NSOpenGLContext's CGL context 749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall We need this to check for errors NSOpenGLContext doesn't support 759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Please note this is only used on PowerPC (Intel Macs are guaranteed to 769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall have a better API for this, since it showed up in Mac OS X 10.3). 779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/ 789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall@interface NSOpenGLContext (CGLContextAccess) 799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall- (CGLContextObj) cglContext; 809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall@end 819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* use this to get the CGLContext; it handles Cocoa interface changes. */ 849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallCGLContextObj QZ_GetCGLContextObj(NSOpenGLContext *nsctx); 859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Main driver structure to store required state information */ 889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef struct SDL_PrivateVideoData { 899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall BOOL use_new_mode_apis; /* 1 == >= 10.6 APIs available */ 909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall BOOL allow_screensaver; /* 0 == disable screensaver */ 919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall CGDirectDisplayID display; /* 0 == main display (only support single display) */ 929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const void *mode; /* current mode of the display */ 939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const void *save_mode; /* original mode of the display */ 94261c18d69b75388958b8fd9364b9df21003909c3Ji-Hwan Lee#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070) 959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall CGDirectPaletteRef palette; /* palette of an 8-bit display */ 96261c18d69b75388958b8fd9364b9df21003909c3Ji-Hwan Lee#endif 979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall NSOpenGLContext *gl_context; /* OpenGL rendering context */ 989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall NSGraphicsContext *nsgfx_context; /* Cocoa graphics context */ 999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 width, height, bpp; /* frequently used data about the display */ 1009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 flags; /* flags for current mode, for teardown purposes */ 1019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 video_set; /* boolean; indicates if video was set correctly */ 1029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 warp_flag; /* boolean; notify to event loop that a warp just occured */ 1039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 warp_ticks; /* timestamp when the warp occured */ 1049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall NSWindow *window; /* Cocoa window to implement the SDL window */ 1059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall NSView *view; /* the window's view; draw 2D and OpenGL into this view */ 1069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall CGContextRef cg_context; /* CoreGraphics rendering context */ 1079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_Surface *resize_icon; /* icon for the resize badge, we have to draw it by hand */ 1089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GrabMode current_grab_mode; /* default value is SDL_GRAB_OFF */ 1099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_Rect **client_mode_list; /* resolution list to pass back to client */ 1109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDLKey keymap[256]; /* Mac OS X to SDL key mapping */ 1119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 current_mods; /* current keyboard modifiers, to track modifier state */ 1129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall NSText *field_edit; /* a field editor for keyboard composition processing */ 1139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 last_virtual_button;/* last virtual mouse button pressed */ 1149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall io_connect_t power_connection; /* used with IOKit to detect wake from sleep */ 1159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 expect_mouse_up; /* used to determine when to send mouse up events */ 1169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 grab_state; /* used to manage grab behavior */ 1179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall NSPoint cursor_loc; /* saved cursor coords, for activate/deactivate when grabbed */ 1189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall BOOL cursor_should_be_visible; /* tells if cursor is supposed to be visible (SDL_ShowCursor) */ 1199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall BOOL cursor_visible; /* tells if cursor is *actually* visible or not */ 1209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8* sw_buffers[2]; /* pointers to the two software buffers for double-buffer emulation */ 1219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_Thread *thread; /* thread for async updates to the screen */ 1229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_sem *sem1, *sem2; /* synchronization for async screen updates */ 1239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *current_buffer; /* the buffer being copied to the screen */ 1249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall BOOL quit_thread; /* used to quit the async blitting thread */ 1259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SInt32 system_version; /* used to dis-/enable workarounds depending on the system version */ 1269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall void *opengl_library; /* dynamically loaded OpenGL library. */ 1289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} SDL_PrivateVideoData; 1299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define _THIS SDL_VideoDevice *this 1319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define display_id (this->hidden->display) 1329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define mode (this->hidden->mode) 1339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define save_mode (this->hidden->save_mode) 1349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define use_new_mode_apis (this->hidden->use_new_mode_apis) 1359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define allow_screensaver (this->hidden->allow_screensaver) 1369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define palette (this->hidden->palette) 1379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define gl_context (this->hidden->gl_context) 1389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define nsgfx_context (this->hidden->nsgfx_context) 1399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define device_width (this->hidden->width) 1409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define device_height (this->hidden->height) 1419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define device_bpp (this->hidden->bpp) 1429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define mode_flags (this->hidden->flags) 1439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define qz_window (this->hidden->window) 1449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define window_view (this->hidden->view) 1459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define cg_context (this->hidden->cg_context) 1469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define video_set (this->hidden->video_set) 1479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define warp_ticks (this->hidden->warp_ticks) 1489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define warp_flag (this->hidden->warp_flag) 1499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define resize_icon (this->hidden->resize_icon) 1509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define current_grab_mode (this->hidden->current_grab_mode) 1519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define client_mode_list (this->hidden->client_mode_list) 1529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define keymap (this->hidden->keymap) 1539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define current_mods (this->hidden->current_mods) 1549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define field_edit (this->hidden->field_edit) 1559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define last_virtual_button (this->hidden->last_virtual_button) 1569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define power_connection (this->hidden->power_connection) 1579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define expect_mouse_up (this->hidden->expect_mouse_up) 1589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define grab_state (this->hidden->grab_state) 1599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define cursor_loc (this->hidden->cursor_loc) 1609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define cursor_should_be_visible (this->hidden->cursor_should_be_visible) 1619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define cursor_visible (this->hidden->cursor_visible) 1629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define sw_buffers (this->hidden->sw_buffers) 1639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define sw_contexts (this->hidden->sw_contexts) 1649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define thread (this->hidden->thread) 1659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define sem1 (this->hidden->sem1) 1669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define sem2 (this->hidden->sem2) 1679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define current_buffer (this->hidden->current_buffer) 1689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define quit_thread (this->hidden->quit_thread) 1699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define system_version (this->hidden->system_version) 1709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define opengl_library (this->hidden->opengl_library) 1719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* grab states - the input is in one of these states */ 1739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallenum { 1749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall QZ_UNGRABBED = 0, 1759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall QZ_VISIBLE_GRAB, 1769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall QZ_INVISIBLE_GRAB 1779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 1789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* grab actions - these can change the grabbed state */ 1809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallenum { 1819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall QZ_ENABLE_GRAB = 0, 1829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall QZ_DISABLE_GRAB, 1839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall QZ_HIDECURSOR, 1849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall QZ_SHOWCURSOR 1859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 1869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Gamma Functions */ 1889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint QZ_SetGamma (_THIS, float red, float green, float blue); 1899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint QZ_GetGamma (_THIS, float *red, float *green, float *blue); 1909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint QZ_SetGammaRamp (_THIS, Uint16 *ramp); 1919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint QZ_GetGammaRamp (_THIS, Uint16 *ramp); 1929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* OpenGL functions */ 1949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags); 1959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_TearDownOpenGL (_THIS); 1969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid* QZ_GL_GetProcAddress (_THIS, const char *proc); 1979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint QZ_GL_GetAttribute (_THIS, SDL_GLattr attrib, int* value); 1989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint QZ_GL_MakeCurrent (_THIS); 1999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_GL_SwapBuffers (_THIS); 2009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint QZ_GL_LoadLibrary (_THIS, const char *location); 2019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Cursor and Mouse functions */ 2039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_FreeWMCursor (_THIS, WMcursor *cursor); 2049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallWMcursor* QZ_CreateWMCursor (_THIS, Uint8 *data, Uint8 *mask, 2059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int w, int h, int hot_x, int hot_y); 2069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint QZ_ShowWMCursor (_THIS, WMcursor *cursor); 2079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_WarpWMCursor (_THIS, Uint16 x, Uint16 y); 2089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_MoveWMCursor (_THIS, int x, int y); 2099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_CheckMouseMode (_THIS); 2109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_UpdateMouse (_THIS); 2119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Event functions */ 2139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_InitOSKeymap (_THIS); 2149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_PumpEvents (_THIS); 2159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Window Manager functions */ 2179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_SetCaption (_THIS, const char *title, const char *icon); 2189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_SetIcon (_THIS, SDL_Surface *icon, Uint8 *mask); 2199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint QZ_IconifyWindow (_THIS); 220e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hallvoid QZ_SetWindowPos (_THIS, int x, int y); 221e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hallvoid QZ_GetWindowPos (_THIS, int *px, int *py); 222e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hallint QZ_IsWindowVisible (_THIS, int recenter); 223e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hallint QZ_GetMonitorDPI (_THIS, int *xDpi, int *yDpi); 224e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hallint QZ_GetMonitorRect (_THIS, SDL_Rect *rect); 225e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall 2269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallSDL_GrabMode QZ_GrabInput (_THIS, SDL_GrabMode grab_mode); 2279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*int QZ_GetWMInfo (_THIS, SDL_SysWMinfo *info);*/ 2289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Private functions (used internally) */ 2309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_PrivateWarpCursor (_THIS, int x, int y); 2319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_ChangeGrabState (_THIS, int action); 2329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_RegisterForSleepNotifications (_THIS); 2339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_PrivateGlobalToLocal (_THIS, NSPoint *p); 2349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_PrivateCocoaToSDL (_THIS, NSPoint *p); 2359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallBOOL QZ_IsMouseInWindow (_THIS); 2369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_DoActivate (_THIS); 2379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid QZ_DoDeactivate (_THIS); 238