| 1 |
#include "allegro5/allegro.h" |
| 2 |
#include "allegro5/internal/aintern.h" |
| 3 |
#include "allegro5/platform/aintosx.h" |
| 4 |
#include "allegro5/internal/aintern_system.h" |
| 5 |
#include "allegro5/internal/aintern_bitmap.h" |
| 6 |
#include "allegro5/internal/aintern_opengl.h" |
| 7 |
|
| 8 |
#include "allegro5/opengl/gl_ext.h" |
| 9 |
|
| 10 |
|
| 11 |
/* Number of pixel format attributes we can set */ |
| 12 |
#define AL_OSX_NUM_PFA 64 |
| 13 |
|
| 14 |
@interface ALWindow : NSWindow { |
| 15 |
ALLEGRO_DISPLAY* display; |
| 16 |
} |
| 17 |
|
| 18 |
@property ALLEGRO_DISPLAY *display; |
| 19 |
|
| 20 |
@end |
| 21 |
|
| 22 |
/* This is our version of ALLEGRO_DISPLAY with driver specific extra data. */ |
| 23 |
typedef struct ALLEGRO_DISPLAY_OSX_WIN { |
| 24 |
ALLEGRO_DISPLAY parent; |
| 25 |
int depth; |
| 26 |
NSOpenGLContext* ctx; |
| 27 |
NSOpenGLPixelFormatAttribute attributes[AL_OSX_NUM_PFA]; |
| 28 |
ALWindow* win; |
| 29 |
NSView* view; |
| 30 |
NSCursor* cursor; |
| 31 |
CGDirectDisplayID display_id; |
| 32 |
BOOL show_cursor; |
| 33 |
NSTrackingArea *tracking; |
| 34 |
unsigned int display_group; |
| 35 |
BOOL in_fullscreen; |
| 36 |
BOOL single_buffer; |
| 37 |
CGDisplayModeRef original_mode; |
| 38 |
BOOL send_halt_events; |
| 39 |
ALLEGRO_MUTEX *halt_mutex; |
| 40 |
ALLEGRO_COND *halt_cond; |
| 41 |
BOOL halt_event_acknowledged; |
| 42 |
/* For new (10.14+) vsyncing. */ |
| 43 |
CVDisplayLinkRef display_link; |
| 44 |
ALLEGRO_MUTEX *flip_mutex; |
| 45 |
ALLEGRO_COND *flip_cond; |
| 46 |
int num_flips; |
| 47 |
/* These two store the old window size when restoring from a FS window. */ |
| 48 |
int old_w; |
| 49 |
int old_h; |
| 50 |
} ALLEGRO_DISPLAY_OSX_WIN; |
| 51 |
|
| 52 |
/* This is our version of ALLEGRO_MOUSE_CURSOR */ |
| 53 |
typedef struct ALLEGRO_MOUSE_CURSOR_OSX |
| 54 |
{ |
| 55 |
NSCursor *cursor; |
| 56 |
} ALLEGRO_MOUSE_CURSOR_OSX; |
| 57 |
|