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;
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
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
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 
posix_thread.h
_glfwRestoreVideoModeNS
void _glfwRestoreVideoModeNS(_GLFWmonitor *monitor)
VkSurfaceKHR
uint64_t VkSurfaceKHR
Definition: internal.h:120
_GLFWtimerNS::frequency
uint64_t frequency
Definition: cocoa_platform.h:157
_GLFWlibraryNS::unicodeData
id unicodeData
Definition: cocoa_platform.h:111
_GLFWlibraryNS::bundle
CFBundleRef bundle
Definition: cocoa_platform.h:125
_GLFWwindowNS
Definition: cocoa_platform.h:80
_GLFWlibraryNS
Definition: cocoa_platform.h:103
cocoa_joystick.h
_GLFWwindowNS::layer
id layer
Definition: cocoa_platform.h:85
_GLFWlibraryNS::restoreCursorPosX
double restoreCursorPosX
Definition: cocoa_platform.h:120
_GLFWwindowNS::yscale
float yscale
Definition: cocoa_platform.h:92
VkMacOSSurfaceCreateInfoMVK::sType
VkStructureType sType
Definition: cocoa_platform.h:41
PFN_TISGetInputSourceProperty
void *(* PFN_TISGetInputSourceProperty)(TISInputSourceRef, CFStringRef)
Definition: cocoa_platform.h:72
VkAllocationCallbacks
Definition: vulkan_core.h:1648
_glfwInitTimerNS
void _glfwInitTimerNS(void)
Definition: cocoa_time.c:38
osmesa_context.h
VkMacOSSurfaceCreateInfoMVK::pNext
const void * pNext
Definition: cocoa_platform.h:42
_GLFWmonitorNS::displayID
CGDirectDisplayID displayID
Definition: cocoa_platform.h:138
_GLFWwindowNS::fbWidth
int fbWidth
Definition: cocoa_platform.h:91
_GLFWmonitorNS::unitNumber
uint32_t unitNumber
Definition: cocoa_platform.h:140
VkInstance
void * VkInstance
Definition: internal.h:118
void
typedef void(APIENTRY *GLDEBUGPROC)(GLenum source
VkMacOSSurfaceCreateInfoMVK
Definition: cocoa_platform.h:39
_GLFWlibraryNS::restoreCursorPosY
double restoreCursorPosY
Definition: cocoa_platform.h:120
_GLFWwindowNS::height
int height
Definition: cocoa_platform.h:90
_GLFWmonitorNS::previousMode
CGDisplayModeRef previousMode
Definition: cocoa_platform.h:139
VkMacOSSurfaceCreateFlagsMVK
VkFlags VkMacOSSurfaceCreateFlagsMVK
Definition: cocoa_platform.h:37
_GLFWcursorNS::object
id object
Definition: cocoa_platform.h:149
_GLFWlibraryNS::eventSource
CGEventSourceRef eventSource
Definition: cocoa_platform.h:105
std_msgs::UInt8
::std_msgs::UInt8_< std::allocator< void > > UInt8
Definition: UInt8.h:47
_GLFWlibraryNS::keyName
char keyName[64]
Definition: cocoa_platform.h:114
id
void * id
Definition: cocoa_platform.h:34
_GLFWlibraryNS::disabledCursorWindow
_GLFWwindow * disabledCursorWindow
Definition: cocoa_platform.h:122
_GLFWlibraryNS::delegate
id delegate
Definition: cocoa_platform.h:106
GLFW_KEY_LAST
#define GLFW_KEY_LAST
Definition: glfw3.h:483
_GLFWwindow
Definition: internal.h:365
uint32_t
unsigned int uint32_t
Definition: stdint.h:80
VkFlags
uint32_t VkFlags
Definition: vulkan_core.h:66
_GLFWwindowNS::cursorWarpDeltaX
double cursorWarpDeltaX
Definition: cocoa_platform.h:97
VkResult
VkResult
Definition: vulkan_core.h:122
VkMacOSSurfaceCreateInfoMVK::pView
const void * pView
Definition: cocoa_platform.h:44
uint64_t
unsigned __int64 uint64_t
Definition: stdint.h:90
_GLFWlibraryNS::cascadePoint
CGPoint cascadePoint
Definition: cocoa_platform.h:118
_GLFWcursorNS
struct _GLFWcursorNS _GLFWcursorNS
_GLFWmonitorNS
struct _GLFWmonitorNS _GLFWmonitorNS
_glfwPollMonitorsNS
void _glfwPollMonitorsNS(void)
VkMacOSSurfaceCreateInfoMVK::flags
VkMacOSSurfaceCreateFlagsMVK flags
Definition: cocoa_platform.h:43
PFN_vkCreateMacOSSurfaceMVK
VkResult(APIENTRY * PFN_vkCreateMacOSSurfaceMVK)(VkInstance, const VkMacOSSurfaceCreateInfoMVK *, const VkAllocationCallbacks *, VkSurfaceKHR *)
Definition: cocoa_platform.h:47
_GLFWwindowNS::delegate
id delegate
Definition: cocoa_platform.h:83
stdint.h
PFN_TISCopyCurrentKeyboardLayoutInputSource
TISInputSourceRef(* PFN_TISCopyCurrentKeyboardLayoutInputSource)(void)
Definition: cocoa_platform.h:70
egl_context.h
_GLFWlibraryNS::GetInputSourceProperty
PFN_TISGetInputSourceProperty GetInputSourceProperty
Definition: cocoa_platform.h:127
VkStructureType
VkStructureType
Definition: vulkan_core.h:159
nsgl_context.h
_GLFWlibraryNS::scancodes
short int scancodes[GLFW_KEY_LAST+1]
Definition: cocoa_platform.h:116
PFN_LMGetKbdType
UInt8(* PFN_LMGetKbdType)(void)
Definition: cocoa_platform.h:74
_GLFWlibraryNS::keycodes
short int keycodes[256]
Definition: cocoa_platform.h:115
_GLFWwindowNS::width
int width
Definition: cocoa_platform.h:90
_GLFWwindowNS::maximized
GLFWbool maximized
Definition: cocoa_platform.h:87
_GLFWwindowNS::xscale
float xscale
Definition: cocoa_platform.h:92
_GLFWwindowNS::cursorWarpDeltaY
double cursorWarpDeltaY
Definition: cocoa_platform.h:97
_GLFWlibraryNS
struct _GLFWlibraryNS _GLFWlibraryNS
APIENTRY
#define APIENTRY
Definition: glad/glad/glad.h:45
_GLFWtimerNS
Definition: cocoa_platform.h:155
_GLFWtimerNS
struct _GLFWtimerNS _GLFWtimerNS
_GLFWwindowNS::object
id object
Definition: cocoa_platform.h:82
_GLFWlibraryNS::tis
struct _GLFWlibraryNS::@20 tis
_GLFWlibraryNS::kPropertyUnicodeKeyLayoutData
CFStringRef kPropertyUnicodeKeyLayoutData
Definition: cocoa_platform.h:129
_GLFWmonitorNS
Definition: cocoa_platform.h:136
_GLFWmonitor
Definition: internal.h:422
_GLFWlibraryNS::CopyCurrentKeyboardLayoutInputSource
PFN_TISCopyCurrentKeyboardLayoutInputSource CopyCurrentKeyboardLayoutInputSource
Definition: cocoa_platform.h:126
_GLFWlibraryNS::cursorHidden
GLFWbool cursorHidden
Definition: cocoa_platform.h:108
GLFWvidmode
Video mode type.
Definition: glfw3.h:1525
GLFWbool
int GLFWbool
Definition: internal.h:61
VkMacOSSurfaceCreateInfoMVK
struct VkMacOSSurfaceCreateInfoMVK VkMacOSSurfaceCreateInfoMVK
_GLFWlibraryNS::inputSource
TISInputSourceRef inputSource
Definition: cocoa_platform.h:109
_GLFWmonitorNS::screen
id screen
Definition: cocoa_platform.h:141
_GLFWlibraryNS::autoreleasePool
id autoreleasePool
Definition: cocoa_platform.h:107
_GLFWcursorNS
Definition: cocoa_platform.h:147
_GLFWlibraryNS::listener
id listener
Definition: cocoa_platform.h:112
_GLFWlibraryNS::clipboardString
char * clipboardString
Definition: cocoa_platform.h:117
_GLFWwindowNS
struct _GLFWwindowNS _GLFWwindowNS
_GLFWlibraryNS::GetKbdType
PFN_LMGetKbdType GetKbdType
Definition: cocoa_platform.h:128
_GLFWwindowNS::view
id view
Definition: cocoa_platform.h:84
_glfwSetVideoModeNS
void _glfwSetVideoModeNS(_GLFWmonitor *monitor, const GLFWvidmode *desired)
_GLFWwindowNS::fbHeight
int fbHeight
Definition: cocoa_platform.h:91
_GLFWlibraryNS::hidManager
IOHIDManagerRef hidManager
Definition: cocoa_platform.h:110


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Mon Apr 22 2024 02:12:55