1 //========================================================================
2 // GLFW 3.3 - www.glfw.org
3 //------------------------------------------------------------------------
4 // Copyright (c) 2016 Google Inc.
5 // Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
6 //
7 // This software is provided 'as-is', without any express or implied
8 // warranty. In no event will the authors be held liable for any damages
9 // arising from the use of this software.
10 //
11 // Permission is granted to anyone to use this software for any purpose,
12 // including commercial applications, and to alter it and redistribute it
13 // freely, subject to the following restrictions:
14 //
15 // 1. The origin of this software must not be misrepresented; you must not
16 //    claim that you wrote the original software. If you use this software
17 //    in a product, an acknowledgment in the product documentation would
18 //    be appreciated but is not required.
19 //
20 // 2. Altered source versions must be plainly marked as such, and must not
21 //    be misrepresented as being the original software.
22 //
23 // 3. This notice may not be removed or altered from any source
24 //    distribution.
25 //
26 //========================================================================
27 
28 #include "internal.h"
29 
30 
createNativeWindow(_GLFWwindow * window,const _GLFWwndconfig * wndconfig)31 static int createNativeWindow(_GLFWwindow* window,
32                               const _GLFWwndconfig* wndconfig)
33 {
34     window->null.width = wndconfig->width;
35     window->null.height = wndconfig->height;
36 
37     return GLFW_TRUE;
38 }
39 
40 
41 //////////////////////////////////////////////////////////////////////////
42 //////                       GLFW platform API                      //////
43 //////////////////////////////////////////////////////////////////////////
44 
_glfwPlatformCreateWindow(_GLFWwindow * window,const _GLFWwndconfig * wndconfig,const _GLFWctxconfig * ctxconfig,const _GLFWfbconfig * fbconfig)45 int _glfwPlatformCreateWindow(_GLFWwindow* window,
46                               const _GLFWwndconfig* wndconfig,
47                               const _GLFWctxconfig* ctxconfig,
48                               const _GLFWfbconfig* fbconfig)
49 {
50     if (!createNativeWindow(window, wndconfig))
51         return GLFW_FALSE;
52 
53     if (ctxconfig->client != GLFW_NO_API)
54     {
55         if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API ||
56             ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
57         {
58             if (!_glfwInitOSMesa())
59                 return GLFW_FALSE;
60             if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
61                 return GLFW_FALSE;
62         }
63         else
64         {
65             _glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available");
66             return GLFW_FALSE;
67         }
68     }
69 
70     return GLFW_TRUE;
71 }
72 
_glfwPlatformDestroyWindow(_GLFWwindow * window)73 void _glfwPlatformDestroyWindow(_GLFWwindow* window)
74 {
75     if (window->context.destroy)
76         window->context.destroy(window);
77 }
78 
_glfwPlatformSetWindowTitle(_GLFWwindow * window,const char * title)79 void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
80 {
81 }
82 
_glfwPlatformSetWindowIcon(_GLFWwindow * window,int count,const GLFWimage * images)83 void _glfwPlatformSetWindowIcon(_GLFWwindow* window, int count,
84                                 const GLFWimage* images)
85 {
86 }
87 
_glfwPlatformSetWindowMonitor(_GLFWwindow * window,_GLFWmonitor * monitor,int xpos,int ypos,int width,int height,int refreshRate)88 void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
89                                    _GLFWmonitor* monitor,
90                                    int xpos, int ypos,
91                                    int width, int height,
92                                    int refreshRate)
93 {
94 }
95 
_glfwPlatformGetWindowPos(_GLFWwindow * window,int * xpos,int * ypos)96 void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
97 {
98 }
99 
_glfwPlatformSetWindowPos(_GLFWwindow * window,int xpos,int ypos)100 void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
101 {
102 }
103 
_glfwPlatformGetWindowSize(_GLFWwindow * window,int * width,int * height)104 void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
105 {
106     if (width)
107         *width = window->null.width;
108     if (height)
109         *height = window->null.height;
110 }
111 
_glfwPlatformSetWindowSize(_GLFWwindow * window,int width,int height)112 void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
113 {
114     window->null.width = width;
115     window->null.height = height;
116 }
117 
_glfwPlatformSetWindowSizeLimits(_GLFWwindow * window,int minwidth,int minheight,int maxwidth,int maxheight)118 void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
119                                       int minwidth, int minheight,
120                                       int maxwidth, int maxheight)
121 {
122 }
123 
_glfwPlatformSetWindowAspectRatio(_GLFWwindow * window,int n,int d)124 void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int n, int d)
125 {
126 }
127 
_glfwPlatformGetFramebufferSize(_GLFWwindow * window,int * width,int * height)128 void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
129 {
130     if (width)
131         *width = window->null.width;
132     if (height)
133         *height = window->null.height;
134 }
135 
_glfwPlatformGetWindowFrameSize(_GLFWwindow * window,int * left,int * top,int * right,int * bottom)136 void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
137                                      int* left, int* top,
138                                      int* right, int* bottom)
139 {
140 }
141 
_glfwPlatformGetWindowContentScale(_GLFWwindow * window,float * xscale,float * yscale)142 void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
143                                         float* xscale, float* yscale)
144 {
145     if (xscale)
146         *xscale = 1.f;
147     if (yscale)
148         *yscale = 1.f;
149 }
150 
_glfwPlatformIconifyWindow(_GLFWwindow * window)151 void _glfwPlatformIconifyWindow(_GLFWwindow* window)
152 {
153 }
154 
_glfwPlatformRestoreWindow(_GLFWwindow * window)155 void _glfwPlatformRestoreWindow(_GLFWwindow* window)
156 {
157 }
158 
_glfwPlatformMaximizeWindow(_GLFWwindow * window)159 void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
160 {
161 }
162 
_glfwPlatformWindowMaximized(_GLFWwindow * window)163 int _glfwPlatformWindowMaximized(_GLFWwindow* window)
164 {
165     return GLFW_FALSE;
166 }
167 
_glfwPlatformWindowHovered(_GLFWwindow * window)168 int _glfwPlatformWindowHovered(_GLFWwindow* window)
169 {
170     return GLFW_FALSE;
171 }
172 
_glfwPlatformFramebufferTransparent(_GLFWwindow * window)173 int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
174 {
175     return GLFW_FALSE;
176 }
177 
_glfwPlatformSetWindowResizable(_GLFWwindow * window,GLFWbool enabled)178 void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
179 {
180 }
181 
_glfwPlatformSetWindowDecorated(_GLFWwindow * window,GLFWbool enabled)182 void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
183 {
184 }
185 
_glfwPlatformSetWindowFloating(_GLFWwindow * window,GLFWbool enabled)186 void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
187 {
188 }
189 
_glfwPlatformGetWindowOpacity(_GLFWwindow * window)190 float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
191 {
192     return 1.f;
193 }
194 
_glfwPlatformSetWindowOpacity(_GLFWwindow * window,float opacity)195 void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
196 {
197 }
198 
_glfwPlatformShowWindow(_GLFWwindow * window)199 void _glfwPlatformShowWindow(_GLFWwindow* window)
200 {
201 }
202 
203 
_glfwPlatformRequestWindowAttention(_GLFWwindow * window)204 void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
205 {
206 }
207 
_glfwPlatformUnhideWindow(_GLFWwindow * window)208 void _glfwPlatformUnhideWindow(_GLFWwindow* window)
209 {
210 }
211 
_glfwPlatformHideWindow(_GLFWwindow * window)212 void _glfwPlatformHideWindow(_GLFWwindow* window)
213 {
214 }
215 
_glfwPlatformFocusWindow(_GLFWwindow * window)216 void _glfwPlatformFocusWindow(_GLFWwindow* window)
217 {
218 }
219 
_glfwPlatformWindowFocused(_GLFWwindow * window)220 int _glfwPlatformWindowFocused(_GLFWwindow* window)
221 {
222     return GLFW_FALSE;
223 }
224 
_glfwPlatformWindowIconified(_GLFWwindow * window)225 int _glfwPlatformWindowIconified(_GLFWwindow* window)
226 {
227     return GLFW_FALSE;
228 }
229 
_glfwPlatformWindowVisible(_GLFWwindow * window)230 int _glfwPlatformWindowVisible(_GLFWwindow* window)
231 {
232     return GLFW_FALSE;
233 }
234 
_glfwPlatformPollEvents(void)235 void _glfwPlatformPollEvents(void)
236 {
237 }
238 
_glfwPlatformWaitEvents(void)239 void _glfwPlatformWaitEvents(void)
240 {
241 }
242 
_glfwPlatformWaitEventsTimeout(double timeout)243 void _glfwPlatformWaitEventsTimeout(double timeout)
244 {
245 }
246 
_glfwPlatformPostEmptyEvent(void)247 void _glfwPlatformPostEmptyEvent(void)
248 {
249 }
250 
_glfwPlatformGetCursorPos(_GLFWwindow * window,double * xpos,double * ypos)251 void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
252 {
253 }
254 
_glfwPlatformSetCursorPos(_GLFWwindow * window,double x,double y)255 void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
256 {
257 }
258 
_glfwPlatformSetCursorMode(_GLFWwindow * window,int mode)259 void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
260 {
261 }
262 
_glfwPlatformCreateCursor(_GLFWcursor * cursor,const GLFWimage * image,int xhot,int yhot)263 int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
264                               const GLFWimage* image,
265                               int xhot, int yhot)
266 {
267     return GLFW_TRUE;
268 }
269 
_glfwPlatformCreateStandardCursor(_GLFWcursor * cursor,int shape)270 int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
271 {
272     return GLFW_TRUE;
273 }
274 
_glfwPlatformDestroyCursor(_GLFWcursor * cursor)275 void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
276 {
277 }
278 
_glfwPlatformSetCursor(_GLFWwindow * window,_GLFWcursor * cursor)279 void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
280 {
281 }
282 
_glfwPlatformSetClipboardString(const char * string)283 void _glfwPlatformSetClipboardString(const char* string)
284 {
285 }
286 
_glfwPlatformGetClipboardString(void)287 const char* _glfwPlatformGetClipboardString(void)
288 {
289     return NULL;
290 }
291 
_glfwPlatformGetScancodeName(int scancode)292 const char* _glfwPlatformGetScancodeName(int scancode)
293 {
294     return "";
295 }
296 
_glfwPlatformGetKeyScancode(int key)297 int _glfwPlatformGetKeyScancode(int key)
298 {
299     return -1;
300 }
301 
_glfwPlatformGetRequiredInstanceExtensions(char ** extensions)302 void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
303 {
304 }
305 
_glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,VkPhysicalDevice device,uint32_t queuefamily)306 int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
307                                                       VkPhysicalDevice device,
308                                                       uint32_t queuefamily)
309 {
310     return GLFW_FALSE;
311 }
312 
_glfwPlatformCreateWindowSurface(VkInstance instance,_GLFWwindow * window,const VkAllocationCallbacks * allocator,VkSurfaceKHR * surface)313 VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
314                                           _GLFWwindow* window,
315                                           const VkAllocationCallbacks* allocator,
316                                           VkSurfaceKHR* surface)
317 {
318     // This seems like the most appropriate error to return here
319     return VK_ERROR_INITIALIZATION_FAILED;
320 }
321 
322