Blender V4.3
GHOST_C-api.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11#include <cstdlib>
12#include <cstring>
13
14#include "GHOST_C-api.h"
15#include "GHOST_IEvent.hh"
17#include "GHOST_ISystem.hh"
18#include "intern/GHOST_Debug.hh"
19#ifdef WITH_XR_OPENXR
20# include "GHOST_IXrContext.hh"
22#endif
25
26GHOST_SystemHandle GHOST_CreateSystem()
27{
28 GHOST_ISystem::createSystem(true, false);
30
31 return (GHOST_SystemHandle)system;
32}
33
34GHOST_SystemHandle GHOST_CreateSystemBackground()
35{
38
39 return (GHOST_SystemHandle)system;
40}
41
42void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, GHOST_Debug debug)
43{
44 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
45
46 system->initDebug(debug);
47}
48
49GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
50{
51 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
52
53 return system->disposeSystem();
54}
55
56#if !(defined(WIN32) || defined(__APPLE__))
58{
60}
61#endif
62
63void GHOST_ShowMessageBox(GHOST_SystemHandle systemhandle,
64 const char *title,
65 const char *message,
66 const char *help_label,
67 const char *continue_label,
68 const char *link,
69 GHOST_DialogOptions dialog_options)
70{
71 const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
72 system->showMessageBox(title, message, help_label, continue_label, link, dialog_options);
73}
74
75GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
76 GHOST_TUserDataPtr user_data)
77{
78 return (GHOST_EventConsumerHandle) new GHOST_CallbackEventConsumer(eventCallback, user_data);
79}
80
81GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhandle)
82{
83 delete ((GHOST_CallbackEventConsumer *)consumerhandle);
84 return GHOST_kSuccess;
85}
86
87uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
88{
89 const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
90
91 return system->getMilliSeconds();
92}
93
94GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
95 uint64_t delay,
96 uint64_t interval,
97 GHOST_TimerProcPtr timerproc,
98 GHOST_TUserDataPtr user_data)
99{
100 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
101
102 return (GHOST_TimerTaskHandle)system->installTimer(delay, interval, timerproc, user_data);
103}
104
105GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
106 GHOST_TimerTaskHandle timertaskhandle)
107{
108 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
109 GHOST_ITimerTask *timertask = (GHOST_ITimerTask *)timertaskhandle;
110
111 return system->removeTimer(timertask);
112}
113
114uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
115{
116 const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
117
118 return system->getNumDisplays();
119}
120
121GHOST_TSuccess GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
122 uint32_t *r_width,
123 uint32_t *r_height)
124{
125 const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
126 *r_width = 0;
127 *r_height = 0;
128 system->getMainDisplayDimensions(*r_width, *r_height);
129 return (*r_width == 0 && *r_height == 0) ? GHOST_kFailure : GHOST_kSuccess;
130}
131
132GHOST_TSuccess GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
133 uint32_t *r_width,
134 uint32_t *r_height)
135{
136 const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
137 *r_width = 0;
138 *r_height = 0;
139 system->getAllDisplayDimensions(*r_width, *r_height);
140 return (*r_width == 0 && *r_height == 0) ? GHOST_kFailure : GHOST_kSuccess;
141}
142
143GHOST_ContextHandle GHOST_CreateGPUContext(GHOST_SystemHandle systemhandle,
144 GHOST_GPUSettings gpuSettings)
145{
146 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
147
148 return (GHOST_ContextHandle)system->createOffscreenContext(gpuSettings);
149}
150
151GHOST_TSuccess GHOST_DisposeGPUContext(GHOST_SystemHandle systemhandle,
152 GHOST_ContextHandle contexthandle)
153{
154 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
155 GHOST_IContext *context = (GHOST_IContext *)contexthandle;
156
157 return system->disposeContext(context);
158}
159
160GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
161 GHOST_WindowHandle parent_windowhandle,
162 const char *title,
163 int32_t left,
164 int32_t top,
165 uint32_t width,
166 uint32_t height,
168 bool is_dialog,
169 GHOST_GPUSettings gpuSettings)
170{
171 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
172
173 return (GHOST_WindowHandle)system->createWindow(title,
174 left,
175 top,
176 width,
177 height,
178 state,
179 gpuSettings,
180 false,
181 is_dialog,
182 (GHOST_IWindow *)parent_windowhandle);
183}
184
185GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle)
186{
187 const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
188
189 return window->getUserData();
190}
191void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr user_data)
192{
193 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
194
195 window->setUserData(user_data);
196}
197
198bool GHOST_IsDialogWindow(GHOST_WindowHandle windowhandle)
199{
200 const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
201
202 return window->isDialog();
203}
204
205GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
206 GHOST_WindowHandle windowhandle)
207{
208 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
209 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
210
211 return system->disposeWindow(window);
212}
213
214bool GHOST_ValidWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle)
215{
216 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
217 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
218
219 return system->validWindow(window);
220}
221
222GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
223 const GHOST_DisplaySetting *setting,
224 const bool stereoVisual)
225{
226 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
227 GHOST_IWindow *window = nullptr;
228 bool bstereoVisual;
229
230 if (stereoVisual) {
231 bstereoVisual = true;
232 }
233 else {
234 bstereoVisual = false;
235 }
236
237 system->beginFullScreen(*setting, &window, bstereoVisual);
238
239 return (GHOST_WindowHandle)window;
240}
241
242GHOST_TSuccess GHOST_EndFullScreen(GHOST_SystemHandle systemhandle)
243{
244 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
245
246 return system->endFullScreen();
247}
248
249bool GHOST_GetFullScreen(GHOST_SystemHandle systemhandle)
250{
251 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
252
253 return system->getFullScreen();
254}
255
256GHOST_WindowHandle GHOST_GetWindowUnderCursor(GHOST_SystemHandle systemhandle,
257 int32_t x,
258 int32_t y)
259{
260 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
261 GHOST_IWindow *window = system->getWindowUnderCursor(x, y);
262
263 return (GHOST_WindowHandle)window;
264}
265
266bool GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, bool waitForEvent)
267{
268 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
269
270 return system->processEvents(waitForEvent);
271}
272
273void GHOST_DispatchEvents(GHOST_SystemHandle systemhandle)
274{
275 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
276
277 system->dispatchEvents();
278}
279
280GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle,
281 GHOST_EventConsumerHandle consumerhandle)
282{
283 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
284
285 return system->addEventConsumer((GHOST_CallbackEventConsumer *)consumerhandle);
286}
287
288GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle,
289 GHOST_EventConsumerHandle consumerhandle)
290{
291 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
292
293 return system->removeEventConsumer((GHOST_CallbackEventConsumer *)consumerhandle);
294}
295
296GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle, float progress)
297{
298 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
299
300 return window->setProgressBar(progress);
301}
302
303GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle)
304{
305 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
306
307 return window->endProgressBar();
308}
309
310GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle)
311{
312 const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
313
314 return window->getCursorShape();
315}
316
317GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
318 GHOST_TStandardCursor cursorshape)
319{
320 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
321
322 return window->setCursorShape(cursorshape);
323}
324
325GHOST_TSuccess GHOST_HasCursorShape(GHOST_WindowHandle windowhandle,
326 GHOST_TStandardCursor cursorshape)
327{
328 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
329
330 return window->hasCursorShape(cursorshape);
331}
332
333GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
334 uint8_t *bitmap,
335 uint8_t *mask,
336 int sizex,
337 int sizey,
338 int hotX,
339 int hotY,
340 bool canInvertColor)
341{
342 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
343
344 return window->setCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, canInvertColor);
345}
346
347GHOST_TSuccess GHOST_GetCursorBitmap(GHOST_WindowHandle windowhandle,
348 GHOST_CursorBitmapRef *bitmap)
349{
350 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
351
352 return window->getCursorBitmap(bitmap);
353}
354
355bool GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
356{
357 const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
358
359 return window->getCursorVisibility();
360}
361
362GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle, bool visible)
363{
364 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
365
366 return window->setCursorVisibility(visible);
367}
368
369/* Unused, can expose again if needed although WAYLAND
370 * can only properly use client relative coordinates, so leave disabled if possible. */
371#if 0
372GHOST_TSuccess GHOST_GetCursorPositionScreenCoords(GHOST_SystemHandle systemhandle,
373 int32_t *x,
374 int32_t *y)
375{
376 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
377
378 return system->getCursorPosition(*x, *y);
379}
380
381GHOST_TSuccess GHOST_SetCursorPositionScreenCoords(GHOST_SystemHandle systemhandle,
382 int32_t x,
383 int32_t y)
384{
385 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
386
387 return system->setCursorPosition(x, y);
388}
389#endif
390
391GHOST_TSuccess GHOST_GetCursorPosition(const GHOST_SystemHandle systemhandle,
392 const GHOST_WindowHandle windowhandle,
393 int32_t *x,
394 int32_t *y)
395{
396 const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
397 const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
398
399 return system->getCursorPositionClientRelative(window, *x, *y);
400}
401
402GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
403 GHOST_WindowHandle windowhandle,
404 int32_t x,
405 int32_t y)
406{
407 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
408 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
409
410 return system->setCursorPositionClientRelative(window, x, y);
411}
412
413GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
415 GHOST_TAxisFlag wrap_axis,
416 const int bounds[4],
417 const int mouse_ungrab_xy[2])
418{
419 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
420 GHOST_Rect bounds_rect;
421 int32_t mouse_xy[2];
422
423 if (bounds) {
424 bounds_rect = GHOST_Rect(bounds[0], bounds[1], bounds[2], bounds[3]);
425 }
426 if (mouse_ungrab_xy) {
427 mouse_xy[0] = mouse_ungrab_xy[0];
428 mouse_xy[1] = mouse_ungrab_xy[1];
429 }
430
431 return window->setCursorGrab(
432 mode, wrap_axis, bounds ? &bounds_rect : nullptr, mouse_ungrab_xy ? mouse_xy : nullptr);
433}
434
435void GHOST_GetCursorGrabState(GHOST_WindowHandle windowhandle,
436 GHOST_TGrabCursorMode *r_mode,
437 GHOST_TAxisFlag *r_axis_flag,
438 int r_bounds[4],
439 bool *r_use_software_cursor)
440{
441 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
442 GHOST_Rect bounds_rect;
443 bool use_software_cursor;
444 window->getCursorGrabState(*r_mode, *r_axis_flag, bounds_rect, use_software_cursor);
445 r_bounds[0] = bounds_rect.m_l;
446 r_bounds[1] = bounds_rect.m_t;
447 r_bounds[2] = bounds_rect.m_r;
448 r_bounds[3] = bounds_rect.m_b;
449 *r_use_software_cursor = use_software_cursor;
450}
451
452GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
454 bool *r_is_down)
455{
456 const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
458 bool is_down = false;
459
460 result = system->getModifierKeyState(mask, is_down);
461 *r_is_down = is_down;
462
463 return result;
464}
465
466GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
467 GHOST_TButton mask,
468 bool *r_is_down)
469{
470 const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
472 bool is_down = false;
473
474 result = system->getButtonState(mask, is_down);
475 *r_is_down = is_down;
476
477 return result;
478}
479
480#ifdef WITH_INPUT_NDOF
481void GHOST_setNDOFDeadZone(float deadzone)
482{
484 system->setNDOFDeadZone(deadzone);
485}
486#endif
487
488void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, bool can_accept)
489{
490 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
491
492 window->setAcceptDragOperation(can_accept);
493}
494
495GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
496{
497 const GHOST_IEvent *event = (const GHOST_IEvent *)eventhandle;
498
499 return event->getType();
500}
501
502uint64_t GHOST_GetEventTime(GHOST_EventHandle eventhandle)
503{
504 const GHOST_IEvent *event = (const GHOST_IEvent *)eventhandle;
505
506 return event->getTime();
507}
508
509GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle)
510{
511 const GHOST_IEvent *event = (const GHOST_IEvent *)eventhandle;
512
513 return (GHOST_WindowHandle)event->getWindow();
514}
515
516GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
517{
518 const GHOST_IEvent *event = (const GHOST_IEvent *)eventhandle;
519
520 return event->getData();
521}
522
523GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle)
524{
525 const GHOST_ITimerTask *timertask = (const GHOST_ITimerTask *)timertaskhandle;
526
527 return timertask->getTimerProc();
528}
529
530void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle, GHOST_TimerProcPtr timerproc)
531{
532 GHOST_ITimerTask *timertask = (GHOST_ITimerTask *)timertaskhandle;
533
534 timertask->setTimerProc(timerproc);
535}
536
537GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle)
538{
539 const GHOST_ITimerTask *timertask = (const GHOST_ITimerTask *)timertaskhandle;
540
541 return timertask->getUserData();
542}
543
544void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
545 GHOST_TUserDataPtr user_data)
546{
547 GHOST_ITimerTask *timertask = (GHOST_ITimerTask *)timertaskhandle;
548
549 timertask->setUserData(user_data);
550}
551
552bool GHOST_GetValid(GHOST_WindowHandle windowhandle)
553{
554 const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
555
556 return window->getValid();
557}
558
560{
561 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
562
563 return window->getDrawingContextType();
564}
565
566GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle,
568{
569 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
570
571 return window->setDrawingContextType(type);
572}
573
574GHOST_ContextHandle GHOST_GetDrawingContext(GHOST_WindowHandle windowhandle)
575{
576 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
577 return (GHOST_ContextHandle)window->getDrawingContext();
578}
579
580void GHOST_SetTitle(GHOST_WindowHandle windowhandle, const char *title)
581{
582 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
583
584 window->setTitle(title);
585}
586
587char *GHOST_GetTitle(GHOST_WindowHandle windowhandle)
588{
589 const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
590 std::string title = window->getTitle();
591
592 const size_t ctitle_size = title.size() + 1;
593 char *ctitle = (char *)malloc(ctitle_size);
594
595 if (ctitle == nullptr) {
596 return nullptr;
597 }
598
599 memcpy(ctitle, title.c_str(), ctitle_size);
600
601 return ctitle;
602}
603
604GHOST_TSuccess GHOST_SetPath(GHOST_WindowHandle windowhandle, const char *filepath)
605{
606 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
607
608 return window->setPath(filepath);
609}
610
611GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle)
612{
613 const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
614 GHOST_Rect *rectangle = nullptr;
615
616 rectangle = new GHOST_Rect();
617 window->getWindowBounds(*rectangle);
618
619 return (GHOST_RectangleHandle)rectangle;
620}
621
622GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle)
623{
624 const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
625 GHOST_Rect *rectangle = nullptr;
626
627 rectangle = new GHOST_Rect();
628 window->getClientBounds(*rectangle);
629
630 return (GHOST_RectangleHandle)rectangle;
631}
632
633void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle)
634{
635 delete (GHOST_Rect *)rectanglehandle;
636}
637
638GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, uint32_t width)
639{
640 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
641
642 return window->setClientWidth(width);
643}
644
645GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uint32_t height)
646{
647 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
648
649 return window->setClientHeight(height);
650}
651
652GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
653 uint32_t width,
654 uint32_t height)
655{
656 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
657
658 return window->setClientSize(width, height);
659}
660
662 GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
663{
664 const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
665
666 window->screenToClient(inX, inY, *outX, *outY);
667}
668
670 GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
671{
672 const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
673
674 window->clientToScreen(inX, inY, *outX, *outY);
675}
676
677GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle)
678{
679 const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
680
681 return window->getState();
682}
683
685{
686 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
687
688 return window->setState(state);
689}
690
691GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, bool isUnsavedChanges)
692{
693 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
694
695 return window->setModifiedState(isUnsavedChanges);
696}
697
698GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle, GHOST_TWindowOrder order)
699{
700 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
701
702 return window->setOrder(order);
703}
704
705GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle)
706{
707 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
708
709 return window->swapBuffers();
710}
711
712GHOST_TSuccess GHOST_SetSwapInterval(GHOST_WindowHandle windowhandle, int interval)
713{
714 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
715
716 return window->setSwapInterval(interval);
717}
718
719GHOST_TSuccess GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle, int *r_interval)
720{
721 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
722
723 return window->getSwapInterval(*r_interval);
724}
725
727{
728 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
729
730 return window->activateDrawingContext();
731}
732
733GHOST_TSuccess GHOST_ActivateGPUContext(GHOST_ContextHandle contexthandle)
734{
735 GHOST_IContext *context = (GHOST_IContext *)contexthandle;
736 if (context) {
737 return context->activateDrawingContext();
738 }
739 GHOST_PRINTF("%s: Context not valid\n", __func__);
740 return GHOST_kFailure;
741}
742
743GHOST_TSuccess GHOST_ReleaseGPUContext(GHOST_ContextHandle contexthandle)
744{
745 GHOST_IContext *context = (GHOST_IContext *)contexthandle;
746
747 return context->releaseDrawingContext();
748}
749
750uint GHOST_GetContextDefaultGPUFramebuffer(GHOST_ContextHandle contexthandle)
751{
752 GHOST_IContext *context = (GHOST_IContext *)contexthandle;
753
754 return context->getDefaultFramebuffer();
755}
756
757uint GHOST_GetDefaultGPUFramebuffer(GHOST_WindowHandle windowhandle)
758{
759 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
760
761 return window->getDefaultFramebuffer();
762}
763
764GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle)
765{
766 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
767
768 return window->invalidate();
769}
770
771void GHOST_SetMultitouchGestures(GHOST_SystemHandle systemhandle, const bool use)
772{
773 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
774 return system->setMultitouchGestures(use);
775}
776
777void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI api)
778{
779 GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
780 system->setTabletAPI(api);
781}
782
784{
785 const GHOST_ISystem *system = GHOST_ISystem::getSystem();
786 return system->getPixelAtCursor(r_color);
787}
788
789int32_t GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
790{
791 return ((GHOST_Rect *)rectanglehandle)->getWidth();
792}
793
794int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
795{
796 return ((GHOST_Rect *)rectanglehandle)->getHeight();
797}
798
800 GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b)
801{
802 const GHOST_Rect *rect = (GHOST_Rect *)rectanglehandle;
803
804 *l = rect->m_l;
805 *t = rect->m_t;
806 *r = rect->m_r;
807 *b = rect->m_b;
808}
809
811 GHOST_RectangleHandle rectanglehandle, int32_t l, int32_t t, int32_t r, int32_t b)
812{
813 ((GHOST_Rect *)rectanglehandle)->set(l, t, r, b);
814}
815
816GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehandle)
817{
819
820 if (((GHOST_Rect *)rectanglehandle)->isEmpty()) {
821 result = GHOST_kSuccess;
822 }
823 return result;
824}
825
826GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle)
827{
829
830 if (((GHOST_Rect *)rectanglehandle)->isValid()) {
831 result = GHOST_kSuccess;
832 }
833 return result;
834}
835
836void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, int32_t i)
837{
838 ((GHOST_Rect *)rectanglehandle)->inset(i);
839}
840
841void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
842 GHOST_RectangleHandle anotherrectanglehandle)
843{
844 ((GHOST_Rect *)rectanglehandle)->unionRect(*(GHOST_Rect *)anotherrectanglehandle);
845}
846
847void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y)
848{
849 ((GHOST_Rect *)rectanglehandle)->unionPoint(x, y);
850}
851
852GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y)
853{
855
856 if (((GHOST_Rect *)rectanglehandle)->isInside(x, y)) {
857 result = GHOST_kSuccess;
858 }
859 return result;
860}
861
862GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle,
863 GHOST_RectangleHandle anotherrectanglehandle)
864{
866
867 visible = ((GHOST_Rect *)rectanglehandle)->getVisibility(*(GHOST_Rect *)anotherrectanglehandle);
868
869 return visible;
870}
871
872void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy)
873{
874 ((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy);
875}
876
878 GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy, int32_t w, int32_t h)
879{
880 ((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy, w, h);
881}
882
883GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
884 GHOST_RectangleHandle anotherrectanglehandle)
885{
887
888 if (((GHOST_Rect *)rectanglehandle)->clip(*(GHOST_Rect *)anotherrectanglehandle)) {
889 result = GHOST_kSuccess;
890 }
891 return result;
892}
893
894char *GHOST_getClipboard(bool selection)
895{
896 const GHOST_ISystem *system = GHOST_ISystem::getSystem();
897 return system->getClipboard(selection);
898}
899
900void GHOST_putClipboard(const char *buffer, bool selection)
901{
902 const GHOST_ISystem *system = GHOST_ISystem::getSystem();
903 system->putClipboard(buffer, selection);
904}
905
911
912uint *GHOST_getClipboardImage(int *r_width, int *r_height)
913{
914 const GHOST_ISystem *system = GHOST_ISystem::getSystem();
915 return system->getClipboardImage(r_width, r_height);
916}
917
918GHOST_TSuccess GHOST_putClipboardImage(uint *rgba, int width, int height)
919{
920 const GHOST_ISystem *system = GHOST_ISystem::getSystem();
921 return system->putClipboardImage(rgba, width, height);
922}
923
929
931{
933 return system->useNativePixel();
934}
935
941
943{
944 GHOST_ISystem::setBacktraceFn(backtrace_fn);
945}
946
947void GHOST_UseWindowFocus(bool use_focus)
948{
950 return system->useWindowFocus(use_focus);
951}
952
953void GHOST_SetAutoFocus(bool auto_focus)
954{
956 system->setAutoFocus(auto_focus);
957}
958
959float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
960{
961 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
962 if (window) {
963 return window->getNativePixelSize();
964 }
965 return 1.0f;
966}
967
968uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle)
969{
970 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
971 return window->getDPIHint();
972}
973
974#ifdef WITH_INPUT_IME
975
976void GHOST_BeginIME(
977 GHOST_WindowHandle windowhandle, int32_t x, int32_t y, int32_t w, int32_t h, bool complete)
978{
979 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
980 window->beginIME(x, y, w, h, complete);
981}
982
983void GHOST_EndIME(GHOST_WindowHandle windowhandle)
984{
985 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
986 window->endIME();
987}
988
989#endif /* WITH_INPUT_IME */
990
991#ifdef WITH_XR_OPENXR
992
993# define GHOST_XR_CAPI_CALL(call, ctx) \
994 try { \
995 call; \
996 } \
997 catch (GHOST_XrException & e) { \
998 (ctx)->dispatchErrorMessage(&e); \
999 }
1000
1001# define GHOST_XR_CAPI_CALL_RET(call, ctx) \
1002 try { \
1003 return call; \
1004 } \
1005 catch (GHOST_XrException & e) { \
1006 (ctx)->dispatchErrorMessage(&e); \
1007 }
1008
1009void GHOST_XrSessionStart(GHOST_XrContextHandle xr_contexthandle,
1010 const GHOST_XrSessionBeginInfo *begin_info)
1011{
1012 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1013 GHOST_XR_CAPI_CALL(xr_context->startSession(begin_info), xr_context);
1014}
1015
1016void GHOST_XrSessionEnd(GHOST_XrContextHandle xr_contexthandle)
1017{
1018 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1019 GHOST_XR_CAPI_CALL(xr_context->endSession(), xr_context);
1020}
1021
1022void GHOST_XrSessionDrawViews(GHOST_XrContextHandle xr_contexthandle, void *draw_customdata)
1023{
1024 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1025 GHOST_XR_CAPI_CALL(xr_context->drawSessionViews(draw_customdata), xr_context);
1026}
1027
1028int GHOST_XrSessionIsRunning(const GHOST_XrContextHandle xr_contexthandle)
1029{
1030 const GHOST_IXrContext *xr_context = (const GHOST_IXrContext *)xr_contexthandle;
1031 GHOST_XR_CAPI_CALL_RET(xr_context->isSessionRunning(), xr_context);
1032 return 0; /* Only reached if exception is thrown. */
1033}
1034
1035void GHOST_XrGraphicsContextBindFuncs(GHOST_XrContextHandle xr_contexthandle,
1036 GHOST_XrGraphicsContextBindFn bind_fn,
1037 GHOST_XrGraphicsContextUnbindFn unbind_fn)
1038{
1039 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1040 GHOST_XR_CAPI_CALL(xr_context->setGraphicsContextBindFuncs(bind_fn, unbind_fn), xr_context);
1041}
1042
1043void GHOST_XrDrawViewFunc(GHOST_XrContextHandle xr_contexthandle, GHOST_XrDrawViewFn draw_view_fn)
1044{
1045 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1046 GHOST_XR_CAPI_CALL(xr_context->setDrawViewFunc(draw_view_fn), xr_context);
1047}
1048
1049void GHOST_XrPassthroughEnabledFunc(GHOST_XrContextHandle xr_contexthandle,
1050 GHOST_XrPassthroughEnabledFn passthrough_enabled_fn)
1051{
1052 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1053 GHOST_XR_CAPI_CALL(xr_context->setPassthroughEnabledFunc(passthrough_enabled_fn), xr_context);
1054}
1055
1056void GHOST_XrDisablePassthroughFunc(GHOST_XrContextHandle xr_contexthandle,
1057 GHOST_XrDisablePassthroughFn disable_passthrough_fn)
1058{
1059 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1060 GHOST_XR_CAPI_CALL(xr_context->setDisablePassthroughFunc(disable_passthrough_fn), xr_context);
1061}
1062
1063int GHOST_XrSessionNeedsUpsideDownDrawing(const GHOST_XrContextHandle xr_contexthandle)
1064{
1065 const GHOST_IXrContext *xr_context = (const GHOST_IXrContext *)xr_contexthandle;
1066
1067 GHOST_XR_CAPI_CALL_RET(xr_context->needsUpsideDownDrawing(), xr_context);
1068 return 0; /* Only reached if exception is thrown. */
1069}
1070
1071int GHOST_XrCreateActionSet(GHOST_XrContextHandle xr_contexthandle,
1072 const GHOST_XrActionSetInfo *info)
1073{
1074 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1075 GHOST_XrSession *xr_session = xr_context->getSession();
1076 GHOST_XR_CAPI_CALL_RET(xr_session->createActionSet(*info), xr_context);
1077 return 0;
1078}
1079
1080void GHOST_XrDestroyActionSet(GHOST_XrContextHandle xr_contexthandle, const char *action_set_name)
1081{
1082 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1083 GHOST_XrSession *xr_session = xr_context->getSession();
1084 GHOST_XR_CAPI_CALL(xr_session->destroyActionSet(action_set_name), xr_context);
1085}
1086
1087int GHOST_XrCreateActions(GHOST_XrContextHandle xr_contexthandle,
1088 const char *action_set_name,
1090 const GHOST_XrActionInfo *infos)
1091{
1092 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1093 GHOST_XrSession *xr_session = xr_context->getSession();
1094 GHOST_XR_CAPI_CALL_RET(xr_session->createActions(action_set_name, count, infos), xr_context);
1095 return 0;
1096}
1097
1098void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_contexthandle,
1099 const char *action_set_name,
1101 const char *const *action_names)
1102{
1103 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1104 GHOST_XrSession *xr_session = xr_context->getSession();
1105 GHOST_XR_CAPI_CALL(xr_session->destroyActions(action_set_name, count, action_names), xr_context);
1106}
1107
1108int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
1109 const char *action_set_name,
1111 const GHOST_XrActionProfileInfo *infos)
1112{
1113 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1114 GHOST_XrSession *xr_session = xr_context->getSession();
1115 GHOST_XR_CAPI_CALL_RET(xr_session->createActionBindings(action_set_name, count, infos),
1116 xr_context);
1117 return 0;
1118}
1119
1120void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_contexthandle,
1121 const char *action_set_name,
1123 const char *const *action_names,
1124 const char *const *profile_paths)
1125{
1126 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1127 GHOST_XrSession *xr_session = xr_context->getSession();
1128 GHOST_XR_CAPI_CALL(
1129 xr_session->destroyActionBindings(action_set_name, count, action_names, profile_paths),
1130 xr_context);
1131}
1132
1133int GHOST_XrAttachActionSets(GHOST_XrContextHandle xr_contexthandle)
1134{
1135 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1136 GHOST_XrSession *xr_session = xr_context->getSession();
1137 GHOST_XR_CAPI_CALL_RET(xr_session->attachActionSets(), xr_context);
1138 return 0;
1139}
1140
1141int GHOST_XrSyncActions(GHOST_XrContextHandle xr_contexthandle, const char *action_set_name)
1142{
1143 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1144 GHOST_XrSession *xr_session = xr_context->getSession();
1145 GHOST_XR_CAPI_CALL_RET(xr_session->syncActions(action_set_name), xr_context);
1146 return 0;
1147}
1148
1149int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_contexthandle,
1150 const char *action_set_name,
1151 const char *action_name,
1152 const char *subaction_path,
1153 const int64_t *duration,
1154 const float *frequency,
1155 const float *amplitude)
1156{
1157 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1158 GHOST_XrSession *xr_session = xr_context->getSession();
1159 GHOST_XR_CAPI_CALL_RET(
1160 xr_session->applyHapticAction(
1161 action_set_name, action_name, subaction_path, *duration, *frequency, *amplitude),
1162 xr_context);
1163 return 0;
1164}
1165
1166void GHOST_XrStopHapticAction(GHOST_XrContextHandle xr_contexthandle,
1167 const char *action_set_name,
1168 const char *action_name,
1169 const char *subaction_path)
1170{
1171 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1172 GHOST_XrSession *xr_session = xr_context->getSession();
1173 GHOST_XR_CAPI_CALL(xr_session->stopHapticAction(action_set_name, action_name, subaction_path),
1174 xr_context);
1175}
1176
1177void *GHOST_XrGetActionSetCustomdata(GHOST_XrContextHandle xr_contexthandle,
1178 const char *action_set_name)
1179{
1180 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1181 GHOST_XrSession *xr_session = xr_context->getSession();
1182 GHOST_XR_CAPI_CALL_RET(xr_session->getActionSetCustomdata(action_set_name), xr_context);
1183 return nullptr;
1184}
1185
1186void *GHOST_XrGetActionCustomdata(GHOST_XrContextHandle xr_contexthandle,
1187 const char *action_set_name,
1188 const char *action_name)
1189{
1190 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1191 GHOST_XrSession *xr_session = xr_context->getSession();
1192 GHOST_XR_CAPI_CALL_RET(xr_session->getActionCustomdata(action_set_name, action_name),
1193 xr_context);
1194 return nullptr;
1195}
1196
1197uint GHOST_XrGetActionCount(GHOST_XrContextHandle xr_contexthandle, const char *action_set_name)
1198{
1199 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1200 GHOST_XrSession *xr_session = xr_context->getSession();
1201 GHOST_XR_CAPI_CALL_RET(xr_session->getActionCount(action_set_name), xr_context);
1202 return 0;
1203}
1204
1205void GHOST_XrGetActionCustomdataArray(GHOST_XrContextHandle xr_contexthandle,
1206 const char *action_set_name,
1207 void **r_customdata_array)
1208{
1209 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1210 GHOST_XrSession *xr_session = xr_context->getSession();
1211 GHOST_XR_CAPI_CALL(xr_session->getActionCustomdataArray(action_set_name, r_customdata_array),
1212 xr_context);
1213}
1214
1215int GHOST_XrLoadControllerModel(GHOST_XrContextHandle xr_contexthandle, const char *subaction_path)
1216{
1217 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1218 GHOST_XrSession *xr_session = xr_context->getSession();
1219 GHOST_XR_CAPI_CALL_RET(xr_session->loadControllerModel(subaction_path), xr_context);
1220 return 0;
1221}
1222
1223void GHOST_XrUnloadControllerModel(GHOST_XrContextHandle xr_contexthandle,
1224 const char *subaction_path)
1225{
1226 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1227 GHOST_XrSession *xr_session = xr_context->getSession();
1228 GHOST_XR_CAPI_CALL(xr_session->unloadControllerModel(subaction_path), xr_context);
1229}
1230
1231int GHOST_XrUpdateControllerModelComponents(GHOST_XrContextHandle xr_contexthandle,
1232 const char *subaction_path)
1233{
1234 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1235 GHOST_XrSession *xr_session = xr_context->getSession();
1236 GHOST_XR_CAPI_CALL_RET(xr_session->updateControllerModelComponents(subaction_path), xr_context);
1237 return 0;
1238}
1239
1240int GHOST_XrGetControllerModelData(GHOST_XrContextHandle xr_contexthandle,
1241 const char *subaction_path,
1242 GHOST_XrControllerModelData *r_data)
1243{
1244 GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
1245 GHOST_XrSession *xr_session = xr_context->getSession();
1246 GHOST_XR_CAPI_CALL_RET(xr_session->getControllerModelData(subaction_path, *r_data), xr_context);
1247 return 0;
1248}
1249
1250#endif /* WITH_XR_OPENXR */
1251
1252#ifdef WITH_VULKAN_BACKEND
1253
1254void GHOST_GetVulkanHandles(GHOST_ContextHandle contexthandle,
1255 void *r_instance,
1256 void *r_physical_device,
1257 void *r_device,
1258 uint32_t *r_graphic_queue_family,
1259 void *r_queue,
1260 void **r_queue_mutex)
1261{
1262 GHOST_IContext *context = (GHOST_IContext *)contexthandle;
1263 context->getVulkanHandles(
1264 r_instance, r_physical_device, r_device, r_graphic_queue_family, r_queue, r_queue_mutex);
1265}
1266
1267void GHOST_SetVulkanSwapBuffersCallbacks(
1268 GHOST_ContextHandle contexthandle,
1269 void (*swap_buffers_pre_callback)(const GHOST_VulkanSwapChainData *),
1270 void (*swap_buffers_post_callback)(void))
1271{
1272 GHOST_IContext *context = (GHOST_IContext *)contexthandle;
1273 context->setVulkanSwapBuffersCallbacks(swap_buffers_pre_callback, swap_buffers_post_callback);
1274}
1275
1276void GHOST_GetVulkanSwapChainFormat(GHOST_WindowHandle windowhandle,
1277 GHOST_VulkanSwapChainData *r_swap_chain_data)
1278{
1279 GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
1280 window->getVulkanSwapChainFormat(r_swap_chain_data);
1281}
1282
1283#endif /* WITH_VULKAN_BACKEND */
unsigned int uint
GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y)
GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_putClipboardImage(uint *rgba, int width, int height)
GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle, uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
int32_t GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
GHOST_TSuccess GHOST_GetPixelAtCursor(float r_color[3])
GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle, GHOST_RectangleHandle anotherrectanglehandle)
GHOST_TSuccess GHOST_GetCursorPosition(const GHOST_SystemHandle systemhandle, const GHOST_WindowHandle windowhandle, int32_t *x, int32_t *y)
bool GHOST_GetFullScreen(GHOST_SystemHandle systemhandle)
GHOST_ContextHandle GHOST_CreateGPUContext(GHOST_SystemHandle systemhandle, GHOST_GPUSettings gpuSettings)
GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle, GHOST_TWindowOrder order)
GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle, uint32_t width, uint32_t height)
GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle, int32_t x, int32_t y)
void GHOST_ShowMessageBox(GHOST_SystemHandle systemhandle, const char *title, const char *message, const char *help_label, const char *continue_label, const char *link, GHOST_DialogOptions dialog_options)
void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_RectangleHandle anotherrectanglehandle)
void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
GHOST_WindowHandle GHOST_GetWindowUnderCursor(GHOST_SystemHandle systemhandle, int32_t x, int32_t y)
GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback, GHOST_TUserDataPtr user_data)
GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
GHOST_TSuccess GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle, uint32_t *r_width, uint32_t *r_height)
GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle)
uint GHOST_GetContextDefaultGPUFramebuffer(GHOST_ContextHandle contexthandle)
void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy, int32_t w, int32_t h)
GHOST_TSuccess GHOST_hasClipboardImage()
GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehandle)
uint GHOST_GetDefaultGPUFramebuffer(GHOST_WindowHandle windowhandle)
void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle)
GHOST_TSuccess GHOST_SetPath(GHOST_WindowHandle windowhandle, const char *filepath)
void GHOST_UseWindowFocus(bool use_focus)
bool GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, bool waitForEvent)
void GHOST_SetTitle(GHOST_WindowHandle windowhandle, const char *title)
GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_ReleaseGPUContext(GHOST_ContextHandle contexthandle)
GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, uint32_t width)
GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uint32_t height)
const char * GHOST_SystemBackend()
void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle, GHOST_TStandardCursor cursorshape)
GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_RectangleHandle anotherrectanglehandle)
GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhandle)
char * GHOST_getClipboard(bool selection)
GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle)
uint64_t GHOST_GetEventTime(GHOST_EventHandle eventhandle)
GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle, float progress)
GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle)
GHOST_SystemHandle GHOST_CreateSystem()
GHOST_TSuccess GHOST_EndFullScreen(GHOST_SystemHandle systemhandle)
GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, bool isUnsavedChanges)
GHOST_SystemHandle GHOST_CreateSystemBackground()
void GHOST_SetAutoFocus(bool auto_focus)
GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle, GHOST_TGrabCursorMode mode, GHOST_TAxisFlag wrap_axis, const int bounds[4], const int mouse_ungrab_xy[2])
GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle)
bool GHOST_setConsoleWindowState(GHOST_TConsoleWindowState action)
void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle, GHOST_TimerProcPtr timerproc)
GHOST_TSuccess GHOST_ActivateGPUContext(GHOST_ContextHandle contexthandle)
void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle, GHOST_TUserDataPtr user_data)
GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle, GHOST_TWindowState state)
void GHOST_SetBacktraceHandler(GHOST_TBacktraceFn backtrace_fn)
GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle, GHOST_TimerTaskHandle timertaskhandle)
int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI api)
GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle)
void GHOST_GetCursorGrabState(GHOST_WindowHandle windowhandle, GHOST_TGrabCursorMode *r_mode, GHOST_TAxisFlag *r_axis_flag, int r_bounds[4], bool *r_use_software_cursor)
GHOST_TSuccess GHOST_GetCursorBitmap(GHOST_WindowHandle windowhandle, GHOST_CursorBitmapRef *bitmap)
void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy)
void GHOST_SetMultitouchGestures(GHOST_SystemHandle systemhandle, const bool use)
GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
bool GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle, bool visible)
uint * GHOST_getClipboardImage(int *r_width, int *r_height)
GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle, GHOST_TModifierKey mask, bool *r_is_down)
GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle parent_windowhandle, const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, bool is_dialog, GHOST_GPUSettings gpuSettings)
bool GHOST_ValidWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle)
float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
bool GHOST_IsDialogWindow(GHOST_WindowHandle windowhandle)
GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle, const GHOST_DisplaySetting *setting, const bool stereoVisual)
void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, GHOST_Debug debug)
void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, bool can_accept)
void GHOST_putClipboard(const char *buffer, bool selection)
GHOST_ContextHandle GHOST_GetDrawingContext(GHOST_WindowHandle windowhandle)
void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr user_data)
GHOST_TCapabilityFlag GHOST_GetCapabilities()
GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle)
void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b)
char * GHOST_GetTitle(GHOST_WindowHandle windowhandle)
bool GHOST_UseNativePixels()
GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_HasCursorShape(GHOST_WindowHandle windowhandle, GHOST_TStandardCursor cursorshape)
GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle)
void GHOST_DispatchEvents(GHOST_SystemHandle systemhandle)
void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle, int32_t l, int32_t t, int32_t r, int32_t b)
GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle, GHOST_TDrawingContextType type)
GHOST_TSuccess GHOST_DisposeGPUContext(GHOST_SystemHandle systemhandle, GHOST_ContextHandle contexthandle)
GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_SetSwapInterval(GHOST_WindowHandle windowhandle, int interval)
GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle, uint64_t delay, uint64_t interval, GHOST_TimerProcPtr timerproc, GHOST_TUserDataPtr user_data)
void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, int32_t i)
GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle)
uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y)
bool GHOST_GetValid(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle, int *r_interval)
GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle, GHOST_TButton mask, bool *r_is_down)
GHOST_TSuccess GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle, uint32_t *r_width, uint32_t *r_height)
GHOST C-API function and type declarations.
void GHOST_BeginIME(GHOST_WindowHandle windowhandle, int32_t x, int32_t y, int32_t w, int32_t h, bool complete)
void GHOST_EndIME(GHOST_WindowHandle windowhandle)
bool(* GHOST_EventCallbackProcPtr)(GHOST_EventHandle event, GHOST_TUserDataPtr user_data)
Definition GHOST_C-api.h:24
#define GHOST_PRINTF(x,...)
GHOST_TWindowState
void * GHOST_TUserDataPtr
Definition GHOST_Types.h:85
GHOST_TStandardCursor
GHOST_TEventType
GHOST_TCapabilityFlag
Definition GHOST_Types.h:96
GHOST_TVisibility
@ GHOST_kNotVisible
GHOST_TAxisFlag
void(* GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, uint64_t time)
const void * GHOST_TEventDataPtr
GHOST_TDrawingContextType
GHOST_TWindowOrder
GHOST_TModifierKey
GHOST_TSuccess
Definition GHOST_Types.h:87
@ GHOST_kFailure
Definition GHOST_Types.h:87
@ GHOST_kSuccess
Definition GHOST_Types.h:87
void(* GHOST_TBacktraceFn)(void *file_handle)
Definition GHOST_Types.h:63
GHOST_TGrabCursorMode
GHOST_TButton
GHOST_TConsoleWindowState
GHOST_TTabletAPI
GHOST_DialogOptions
Definition GHOST_Types.h:80
ATTR_WARN_UNUSED_RESULT const BMLoop * l
virtual bool isInside(const btVector3 &pt, btScalar tolerance) const
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
virtual GHOST_TSuccess releaseDrawingContext()=0
virtual GHOST_TSuccess activateDrawingContext()=0
virtual unsigned int getDefaultFramebuffer()=0
virtual GHOST_TEventType getType() const =0
virtual GHOST_TEventDataPtr getData() const =0
virtual GHOST_IWindow * getWindow() const =0
virtual uint64_t getTime() const =0
virtual GHOST_TSuccess endFullScreen()=0
static GHOST_ISystem * getSystem()
virtual void putClipboard(const char *buffer, bool selection) const =0
virtual GHOST_ITimerTask * installTimer(uint64_t delay, uint64_t interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData=nullptr)=0
static void setBacktraceFn(GHOST_TBacktraceFn backtrace_fn)
virtual GHOST_TSuccess showMessageBox(const char *, const char *, const char *, const char *, const char *, GHOST_DialogOptions) const =0
virtual bool getFullScreen()=0
virtual void initDebug(GHOST_Debug debug)=0
virtual void setTabletAPI(GHOST_TTabletAPI api)=0
virtual char * getClipboard(bool selection) const =0
virtual GHOST_TSuccess setCursorPositionClientRelative(GHOST_IWindow *window, int32_t x, int32_t y)=0
virtual void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const =0
virtual bool validWindow(GHOST_IWindow *window)=0
virtual GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const =0
virtual void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const =0
virtual uint * getClipboardImage(int *r_width, int *r_height) const =0
virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer *consumer)=0
virtual GHOST_IContext * createOffscreenContext(GHOST_GPUSettings gpuSettings)=0
virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &isDown) const =0
virtual void useWindowFocus(const bool use_focus)=0
virtual GHOST_TSuccess disposeContext(GHOST_IContext *context)=0
virtual GHOST_TSuccess removeTimer(GHOST_ITimerTask *timerTask)=0
virtual bool useNativePixel()=0
static GHOST_TSuccess createSystem(bool verbose, bool background)
static GHOST_TSuccess disposeSystem()
virtual uint8_t getNumDisplays() const =0
virtual void setMultitouchGestures(const bool use)=0
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting &setting, GHOST_IWindow **window, const bool stereoVisual)=0
virtual bool setConsoleWindowState(GHOST_TConsoleWindowState action)=0
virtual void dispatchEvents()=0
virtual GHOST_TSuccess hasClipboardImage(void) const =0
static const char * getSystemBackend()
virtual GHOST_TCapabilityFlag getCapabilities() const =0
virtual GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const =0
virtual GHOST_IWindow * createWindow(const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_GPUSettings gpuSettings, const bool exclusive=false, const bool is_dialog=false, const GHOST_IWindow *parentWindow=nullptr)=0
virtual void setAutoFocus(const bool auto_focus)=0
virtual GHOST_TSuccess getCursorPositionClientRelative(const GHOST_IWindow *window, int32_t &x, int32_t &y) const =0
virtual GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const =0
virtual uint64_t getMilliSeconds() const =0
virtual GHOST_TSuccess disposeWindow(GHOST_IWindow *window)=0
virtual GHOST_TSuccess setCursorPosition(int32_t x, int32_t y)=0
virtual GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer *consumer)=0
virtual GHOST_TSuccess getPixelAtCursor(float r_color[3]) const =0
virtual GHOST_IWindow * getWindowUnderCursor(int32_t x, int32_t y)=0
virtual bool processEvents(bool waitForEvent)=0
static GHOST_TSuccess createSystemBackground()
virtual GHOST_TUserDataPtr getUserData() const =0
virtual void setTimerProc(const GHOST_TimerProcPtr timerProc)=0
virtual GHOST_TimerProcPtr getTimerProc() const =0
virtual void setUserData(const GHOST_TUserDataPtr userData)=0
virtual void setTitle(const char *title)=0
virtual void getClientBounds(GHOST_Rect &bounds) const =0
virtual void setAcceptDragOperation(bool canAccept)=0
virtual GHOST_TSuccess activateDrawingContext()=0
virtual GHOST_TSuccess getCursorBitmap(GHOST_CursorBitmapRef *bitmap)=0
virtual GHOST_TSuccess endProgressBar()=0
virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order)=0
virtual void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const =0
virtual GHOST_TSuccess setClientHeight(uint32_t height)=0
virtual GHOST_TSuccess setProgressBar(float progress)=0
virtual bool isDialog() const =0
virtual std::string getTitle() const =0
virtual GHOST_TSuccess setClientSize(uint32_t width, uint32_t height)=0
virtual GHOST_TSuccess setState(GHOST_TWindowState state)=0
virtual GHOST_TSuccess getSwapInterval(int &intervalOut)=0
virtual GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape)=0
virtual GHOST_TSuccess setClientWidth(uint32_t width)=0
virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges)=0
virtual float getNativePixelSize()=0
virtual GHOST_IContext * getDrawingContext()=0
virtual GHOST_TSuccess setCursorVisibility(bool visible)=0
virtual void getCursorGrabState(GHOST_TGrabCursorMode &mode, GHOST_TAxisFlag &axis_flag, GHOST_Rect &bounds, bool &use_software_cursor)=0
virtual void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const =0
virtual void getWindowBounds(GHOST_Rect &bounds) const =0
virtual GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor cursorShape)=0
virtual bool getCursorVisibility() const =0
virtual GHOST_TSuccess setPath(const char *filepath)=0
virtual GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type)=0
virtual bool getValid() const =0
virtual GHOST_TSuccess setSwapInterval(int interval)=0
virtual GHOST_TUserDataPtr getUserData() const =0
virtual GHOST_TSuccess invalidate()=0
virtual void setUserData(const GHOST_TUserDataPtr userData)=0
virtual GHOST_TDrawingContextType getDrawingContextType()=0
virtual GHOST_TSuccess swapBuffers()=0
virtual GHOST_TStandardCursor getCursorShape() const =0
virtual uint16_t getDPIHint()=0
virtual GHOST_TWindowState getState() const =0
virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode, GHOST_TAxisFlag, GHOST_Rect *, int32_t[2])
virtual GHOST_TSuccess setCustomCursorShape(uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)=0
virtual unsigned int getDefaultFramebuffer()=0
virtual void endSession()=0
virtual GHOST_XrSession * getSession()=0
virtual void setDisablePassthroughFunc(GHOST_XrDisablePassthroughFn disable_passthrough_fn)=0
virtual void startSession(const GHOST_XrSessionBeginInfo *begin_info)=0
virtual void setPassthroughEnabledFunc(GHOST_XrPassthroughEnabledFn passthrough_enabled_fn)=0
virtual bool needsUpsideDownDrawing() const =0
virtual void setGraphicsContextBindFuncs(GHOST_XrGraphicsContextBindFn bind_fn, GHOST_XrGraphicsContextUnbindFn unbind_fn)=0
virtual void drawSessionViews(void *draw_customdata)=0
virtual bool isSessionRunning() const =0
virtual void setDrawViewFunc(GHOST_XrDrawViewFn draw_view_fn)=0
int32_t m_l
int32_t m_r
int32_t m_b
int32_t m_t
void destroyActionBindings(const char *action_set_name, uint32_t count, const char *const *action_names, const char *const *profile_paths)
void destroyActionSet(const char *action_set_name)
bool createActionSet(const GHOST_XrActionSetInfo &info)
void * getActionCustomdata(const char *action_set_name, const char *action_name)
void unloadControllerModel(const char *subaction_path)
void * getActionSetCustomdata(const char *action_set_name)
bool updateControllerModelComponents(const char *subaction_path)
bool createActionBindings(const char *action_set_name, uint32_t count, const GHOST_XrActionProfileInfo *infos)
void stopHapticAction(const char *action_set_name, const char *action_name, const char *subaction_path)
void getActionCustomdataArray(const char *action_set_name, void **r_customdata_array)
bool loadControllerModel(const char *subaction_path)
bool syncActions(const char *action_set_name=nullptr)
void destroyActions(const char *action_set_name, uint32_t count, const char *const *action_names)
bool applyHapticAction(const char *action_set_name, const char *action_name, const char *subaction_path, const int64_t &duration, const float &frequency, const float &amplitude)
uint32_t getActionCount(const char *action_set_name)
bool getControllerModelData(const char *subaction_path, GHOST_XrControllerModelData &r_data)
bool createActions(const char *action_set_name, uint32_t count, const GHOST_XrActionInfo *infos)
local_group_size(16, 16) .push_constant(Type b
int count
static ulong state[N]
unsigned short uint16_t
Definition stdint.h:79
unsigned int uint32_t
Definition stdint.h:80
__int64 int64_t
Definition stdint.h:89
signed int int32_t
Definition stdint.h:77
unsigned char uint8_t
Definition stdint.h:78
unsigned __int64 uint64_t
Definition stdint.h:90