Blender V4.3
GHOST_SystemHeadless.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10#pragma once
11
12#include "../GHOST_Types.h"
14#include "GHOST_System.hh"
15#include "GHOST_WindowNULL.hh"
16
17#if defined(WITH_OPENGL_BACKEND) && defined(__linux__)
18# include "GHOST_ContextEGL.hh"
19#endif
20#include "GHOST_ContextNone.hh"
21
23
25 public:
27 { /* nop */
28 }
29 ~GHOST_SystemHeadless() override = default;
30
31 bool processEvents(bool /*waitForEvent*/) override
32 {
33 return false;
34 }
36 {
37 return 0;
38 }
40 {
41 return GHOST_kSuccess;
42 }
43 GHOST_TSuccess getButtons(GHOST_Buttons & /*buttons*/) const override
44 {
45 return GHOST_kSuccess;
46 }
56 char *getClipboard(bool /*selection*/) const override
57 {
58 return nullptr;
59 }
60 void putClipboard(const char * /*buffer*/, bool /*selection*/) const override
61 { /* nop */
62 }
63 uint64_t getMilliSeconds() const override
64 {
65 return 0;
66 }
67 uint8_t getNumDisplays() const override
68 {
69 return uint8_t(1);
70 }
71 GHOST_TSuccess getCursorPosition(int32_t & /*x*/, int32_t & /*y*/) const override
72 {
73 return GHOST_kFailure;
74 }
76 {
77 return GHOST_kFailure;
78 }
79 void getMainDisplayDimensions(uint32_t & /*width*/, uint32_t & /*height*/) const override
80 { /* nop */
81 }
82 void getAllDisplayDimensions(uint32_t & /*width*/, uint32_t & /*height*/) const override
83 { /* nop */
84 }
86 {
87#if defined(WITH_OPENGL_BACKEND) && defined(__linux__)
88 GHOST_Context *context;
89 for (int minor = 6; minor >= 3; --minor) {
90 context = new GHOST_ContextEGL((GHOST_System *)this,
91 false,
92 EGLNativeWindowType(0),
93 EGLNativeDisplayType(EGL_DEFAULT_DISPLAY),
94 EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
95 4,
96 minor,
99 EGL_OPENGL_API);
100
101 if (context->initializeDrawingContext()) {
102 return context;
103 }
104 delete context;
105 context = nullptr;
106 }
107
108 return context;
109#else
110 return nullptr;
111#endif
112 }
114 {
115 delete context;
116
117 return GHOST_kSuccess;
118 }
119
121 {
123
124 if (success) {
126
127 if (m_displayManager) {
128 return GHOST_kSuccess;
129 }
130 }
131
132 return GHOST_kFailure;
133 }
134
135 GHOST_IWindow *createWindow(const char *title,
136 int32_t left,
137 int32_t top,
138 uint32_t width,
139 uint32_t height,
141 GHOST_GPUSettings gpuSettings,
142 const bool /*exclusive*/,
143 const bool /*is_dialog*/,
144 const GHOST_IWindow *parentWindow) override
145 {
146 return new GHOST_WindowNULL(title,
147 left,
148 top,
149 width,
150 height,
151 state,
152 parentWindow,
153 gpuSettings.context_type,
154 ((gpuSettings.flags & GHOST_gpuStereoVisual) != 0));
155 }
156
158 {
159 return nullptr;
160 }
161};
#define GHOST_OPENGL_EGL_CONTEXT_FLAGS
#define GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY
GHOST_TWindowState
GHOST_TCapabilityFlag
Definition GHOST_Types.h:96
@ GHOST_kCapabilityWindowPosition
@ GHOST_kCapabilityCursorWarp
@ GHOST_kCapabilityInputIME
@ GHOST_kCapabilityClipboardImages
@ GHOST_kCapabilityPrimaryClipboard
@ GHOST_kCapabilityDesktopSample
#define GHOST_CAPABILITY_FLAG_ALL
GHOST_TSuccess
Definition GHOST_Types.h:87
@ GHOST_kFailure
Definition GHOST_Types.h:87
@ GHOST_kSuccess
Definition GHOST_Types.h:87
@ GHOST_gpuStereoVisual
Definition GHOST_Types.h:76
GHOST_TConsoleWindowState
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &) const override
char * getClipboard(bool) const override
GHOST_TSuccess init() override
bool processEvents(bool) override
uint64_t getMilliSeconds() const override
void getMainDisplayDimensions(uint32_t &, uint32_t &) const override
void getAllDisplayDimensions(uint32_t &, uint32_t &) const override
GHOST_TCapabilityFlag getCapabilities() const override
GHOST_IWindow * getWindowUnderCursor(int32_t, int32_t) override
uint8_t getNumDisplays() const override
GHOST_TSuccess setCursorPosition(int32_t, int32_t) override
~GHOST_SystemHeadless() override=default
GHOST_TSuccess getButtons(GHOST_Buttons &) const override
bool setConsoleWindowState(GHOST_TConsoleWindowState) override
GHOST_TSuccess disposeContext(GHOST_IContext *context) override
void putClipboard(const char *, bool) const override
GHOST_TSuccess getCursorPosition(int32_t &, int32_t &) const override
GHOST_IContext * createOffscreenContext(GHOST_GPUSettings) override
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, const bool, const GHOST_IWindow *parentWindow) override
virtual GHOST_TSuccess init()
GHOST_DisplayManager * m_displayManager
static ulong state[N]
unsigned int uint32_t
Definition stdint.h:80
signed int int32_t
Definition stdint.h:77
unsigned char uint8_t
Definition stdint.h:78
unsigned __int64 uint64_t
Definition stdint.h:90
GHOST_TDrawingContextType context_type