macosx_sys.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #import "../posix/posix_public.h"
  2. #import <Foundation/NSGeometry.h>
  3. @class NSEvent, NSOpenGLContext, NSWindow;
  4. #import <ApplicationServices/ApplicationServices.h>
  5. #import <OpenGL/CGLTypes.h>
  6. // sys
  7. const char *macosx_scanForLibraryDirectory(void);
  8. // In macosx_input.m
  9. void Sys_InitInput(void);
  10. void Sys_ShutdownInput(void);
  11. CGDirectDisplayID Sys_DisplayToUse(void);
  12. //extern void osxQuit();
  13. void SetProgramPath(char *path);
  14. void Sys_SetMouseInputRect(CGRect newRect);
  15. void Sys_AnnoyingBanner();
  16. // In macosx_glimp.m
  17. bool Sys_Hide();
  18. bool Sys_Unhide();
  19. typedef struct {
  20. CGDirectDisplayID display;
  21. uint32 tableSize;
  22. CGGammaValue *red;
  23. CGGammaValue *blue;
  24. CGGammaValue *green;
  25. } glwgamma_t;
  26. typedef struct
  27. {
  28. CGDirectDisplayID display;
  29. NSDictionary *desktopMode;
  30. NSDictionary *gameMode;
  31. CGDisplayCount displayCount;
  32. glwgamma_t *originalDisplayGammaTables;
  33. glwgamma_t inGameTable;
  34. glwgamma_t tempTable;
  35. NSOpenGLContext *_ctx;
  36. CGLContextObj _cgl_ctx;
  37. bool _ctx_is_current;
  38. NSWindow *window;
  39. FILE *log_fp;
  40. unsigned int bufferSwapCount;
  41. unsigned int glPauseCount;
  42. } glwstate_t;
  43. extern glwstate_t glw_state;
  44. #define OSX_SetGLContext(context) \
  45. do { \
  46. NSOpenGLContext *_context = (context); \
  47. glw_state._ctx = _context; \
  48. glw_state._cgl_ctx = [_context cglContext]; \
  49. } while (0)
  50. #define OSX_GetNSGLContext() glw_state._ctx
  51. #define OSX_GetCGLContext() glw_state._cgl_ctx
  52. #define OSX_GLContextIsCurrent() glw_state._ctx_is_current
  53. #define OSX_GLContextSetCurrent() \
  54. do { \
  55. [glw_state._ctx makeCurrentContext]; \
  56. glw_state._ctx_is_current = (glw_state._ctx != nil); \
  57. } while (0)
  58. #define OSX_GLContextClearCurrent() \
  59. do { \
  60. [NSOpenGLContext clearCurrentContext]; \
  61. glw_state._ctx_is_current = NO; \
  62. } while (0)
  63. void Sys_PauseGL();
  64. void Sys_ResumeGL();