cocoa_platform.h
Go to the documentation of this file.
1 //========================================================================
2 // GLFW 3.3 macOS - www.glfw.org
3 //------------------------------------------------------------------------
4 // Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org>
5 //
6 // This software is provided 'as-is', without any express or implied
7 // warranty. In no event will the authors be held liable for any damages
8 // arising from the use of this software.
9 //
10 // Permission is granted to anyone to use this software for any purpose,
11 // including commercial applications, and to alter it and redistribute it
12 // freely, subject to the following restrictions:
13 //
14 // 1. The origin of this software must not be misrepresented; you must not
15 // claim that you wrote the original software. If you use this software
16 // in a product, an acknowledgment in the product documentation would
17 // be appreciated but is not required.
18 //
19 // 2. Altered source versions must be plainly marked as such, and must not
20 // be misrepresented as being the original software.
21 //
22 // 3. This notice may not be removed or altered from any source
23 // distribution.
24 //
25 //========================================================================
26 
27 #include <stdint.h>
28 #include <dlfcn.h>
29 
30 #include <Carbon/Carbon.h>
31 #if defined(__OBJC__)
32 #import <Cocoa/Cocoa.h>
33 #else
34 typedef void* id;
35 #endif
36 
38 
40 {
42  const void* pNext;
44  const void* pView;
46 
48 
49 #include "posix_thread.h"
50 #include "cocoa_joystick.h"
51 #include "nsgl_context.h"
52 #include "egl_context.h"
53 #include "osmesa_context.h"
54 
55 #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL)
56 #define _glfw_dlclose(handle) dlclose(handle)
57 #define _glfw_dlsym(handle, name) dlsym(handle, name)
58 
59 #define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->ns.view)
60 #define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
61 
62 #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS ns
63 #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryNS ns
64 #define _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerNS ns
65 #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorNS ns
66 #define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorNS ns
67 
68 // HIToolbox.framework pointer typedefs
69 #define kTISPropertyUnicodeKeyLayoutData _glfw.ns.tis.kPropertyUnicodeKeyLayoutData
70 typedef TISInputSourceRef (*PFN_TISCopyCurrentKeyboardLayoutInputSource)(void);
71 #define TISCopyCurrentKeyboardLayoutInputSource _glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource
72 typedef void* (*PFN_TISGetInputSourceProperty)(TISInputSourceRef,CFStringRef);
73 #define TISGetInputSourceProperty _glfw.ns.tis.GetInputSourceProperty
75 #define LMGetKbdType _glfw.ns.tis.GetKbdType
76 
77 
78 // Cocoa-specific per-window data
79 //
80 typedef struct _GLFWwindowNS
81 {
82  id object;
84  id view;
85  id layer;
86 
88 
89  // Cached window properties to filter out duplicate events
90  int width, height;
91  int fbWidth, fbHeight;
92  float xscale, yscale;
93 
94  // The total sum of the distances the cursor has been warped
95  // since the last cursor motion event was processed
96  // This is kept to counteract Cocoa doing the same internally
97  double cursorWarpDeltaX, cursorWarpDeltaY;
98 
100 
101 // Cocoa-specific global data
102 //
103 typedef struct _GLFWlibraryNS
104 {
105  CGEventSourceRef eventSource;
109  TISInputSourceRef inputSource;
110  IOHIDManagerRef hidManager;
113 
114  char keyName[64];
115  short int keycodes[256];
116  short int scancodes[GLFW_KEY_LAST + 1];
118  CGPoint cascadePoint;
119  // Where to place the cursor when re-enabled
120  double restoreCursorPosX, restoreCursorPosY;
121  // The window whose disabled cursor mode is active
123 
124  struct {
125  CFBundleRef bundle;
130  } tis;
131 
133 
134 // Cocoa-specific per-monitor data
135 //
136 typedef struct _GLFWmonitorNS
137 {
138  CGDirectDisplayID displayID;
139  CGDisplayModeRef previousMode;
141  id screen;
142 
144 
145 // Cocoa-specific per-cursor data
146 //
147 typedef struct _GLFWcursorNS
148 {
149  id object;
150 
151 } _GLFWcursorNS;
152 
153 // Cocoa-specific global timer data
154 //
155 typedef struct _GLFWtimerNS
156 {
158 
159 } _GLFWtimerNS;
160 
161 
162 void _glfwInitTimerNS(void);
163 
164 void _glfwPollMonitorsNS(void);
165 void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired);
167 
VkStructureType
Definition: vulkan_core.h:159
typedef void(APIENTRY *GLDEBUGPROC)(GLenum source
VkResult
Definition: vulkan_core.h:122
void *(* PFN_TISGetInputSourceProperty)(TISInputSourceRef, CFStringRef)
CGPoint cascadePoint
#define APIENTRY
void * id
uint32_t unitNumber
TISInputSourceRef(* PFN_TISCopyCurrentKeyboardLayoutInputSource)(void)
void _glfwInitTimerNS(void)
Definition: cocoa_time.c:38
PFN_LMGetKbdType GetKbdType
struct _GLFWlibraryNS _GLFWlibraryNS
void _glfwRestoreVideoModeNS(_GLFWmonitor *monitor)
uint64_t frequency
IOHIDManagerRef hidManager
struct _GLFWtimerNS _GLFWtimerNS
GLFWbool cursorHidden
CGDisplayModeRef previousMode
int GLFWbool
Definition: internal.h:61
PFN_TISGetInputSourceProperty GetInputSourceProperty
double cursorWarpDeltaY
void * VkInstance
Definition: internal.h:118
unsigned int uint32_t
Definition: stdint.h:80
VkMacOSSurfaceCreateFlagsMVK flags
GLint GLsizei GLsizei height
struct _GLFWmonitorNS _GLFWmonitorNS
CGDirectDisplayID displayID
unsigned __int64 uint64_t
Definition: stdint.h:90
TISInputSourceRef inputSource
uint64_t VkSurfaceKHR
Definition: internal.h:120
CFStringRef kPropertyUnicodeKeyLayoutData
UInt8(* PFN_LMGetKbdType)(void)
CGEventSourceRef eventSource
char * clipboardString
_GLFWwindow * disabledCursorWindow
double restoreCursorPosY
VkResult(APIENTRY * PFN_vkCreateMacOSSurfaceMVK)(VkInstance, const VkMacOSSurfaceCreateInfoMVK *, const VkAllocationCallbacks *, VkSurfaceKHR *)
void _glfwSetVideoModeNS(_GLFWmonitor *monitor, const GLFWvidmode *desired)
PFN_TISCopyCurrentKeyboardLayoutInputSource CopyCurrentKeyboardLayoutInputSource
uint32_t VkFlags
Definition: vulkan_core.h:66
#define GLFW_KEY_LAST
Definition: glfw3.h:483
Video mode type.
Definition: glfw3.h:1525
struct _GLFWcursorNS _GLFWcursorNS
void _glfwPollMonitorsNS(void)
struct _GLFWwindowNS _GLFWwindowNS
CFBundleRef bundle
VkFlags VkMacOSSurfaceCreateFlagsMVK
::std_msgs::UInt8_< std::allocator< void > > UInt8
Definition: UInt8.h:47
struct VkMacOSSurfaceCreateInfoMVK VkMacOSSurfaceCreateInfoMVK
GLFWbool maximized


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:11