Blender  V3.3
GHOST_SystemWayland.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
8 #pragma once
9 
10 #include "../GHOST_Types.h"
11 #include "GHOST_System.h"
12 #include "GHOST_WindowWayland.h"
13 
14 #ifdef WITH_GHOST_WAYLAND_DYNLOAD
15 # include <wayland_dynload_client.h>
16 #endif
17 #include <wayland-client.h>
18 
19 #ifdef WITH_GHOST_WAYLAND_LIBDECOR
20 # ifdef WITH_GHOST_WAYLAND_DYNLOAD
22 # endif
23 # include <libdecor.h>
24 #else
25 /* Generated by `wayland-scanner`. */
26 # include <xdg-decoration-unstable-v1-client-protocol.h>
27 # include <xdg-shell-client-protocol.h>
28 #endif
29 
30 #include <string>
31 
33 
34 struct display_t;
35 
36 bool ghost_wl_output_own(const struct wl_output *output);
37 void ghost_wl_output_tag(struct wl_output *output);
39 
40 bool ghost_wl_surface_own(const struct wl_surface *surface);
41 void ghost_wl_surface_tag(struct wl_surface *surface);
43 
44 bool ghost_wl_surface_own_cursor_pointer(const struct wl_surface *surface);
45 void ghost_wl_surface_tag_cursor_pointer(struct wl_surface *surface);
46 
47 bool ghost_wl_surface_own_cursor_tablet(const struct wl_surface *surface);
48 void ghost_wl_surface_tag_cursor_tablet(struct wl_surface *surface);
49 
50 #ifdef WITH_GHOST_WAYLAND_DYNLOAD
55 bool ghost_wl_dynload_libraries();
56 #endif
57 
58 struct output_t {
59  struct wl_output *wl_output = nullptr;
60  struct zxdg_output_v1 *xdg_output = nullptr;
62  int32_t size_native[2] = {0, 0};
64  int32_t size_mm[2] = {0, 0};
65 
66  int32_t size_logical[2] = {0, 0};
67  bool has_size_logical = false;
68 
71  bool has_position_logical = false;
72 
73  int transform = 0;
74  int scale = 1;
83  wl_fixed_t scale_fractional = wl_fixed_from_int(1);
84  bool has_scale_fractional = false;
85 
86  std::string make;
87  std::string model;
88 };
89 
91  public:
93 
94  ~GHOST_SystemWayland() override;
95 
96  bool processEvents(bool waitForEvent) override;
97 
99 
100  GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const override;
101 
102  GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const override;
103 
104  char *getClipboard(bool selection) const override;
105 
106  void putClipboard(const char *buffer, bool selection) const override;
107 
108  uint8_t getNumDisplays() const override;
109 
111  int32_t &x,
112  int32_t &y) const override;
114  int32_t x,
115  int32_t y) override;
116 
117  GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const override;
119 
120  void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const override;
121 
122  void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const override;
123 
125 
127 
128  GHOST_IWindow *createWindow(const char *title,
129  int32_t left,
130  int32_t top,
131  uint32_t width,
135  GHOST_GLSettings glSettings,
136  const bool exclusive,
137  const bool is_dialog,
138  const GHOST_IWindow *parentWindow) override;
139 
141 
143 
145  uint8_t *mask,
146  int sizex,
147  int sizey,
148  int hotX,
149  int hotY,
150  bool canInvertColor);
151 
153 
154  GHOST_TSuccess setCursorVisibility(bool visible);
155 
156  bool supportsCursorWarp();
157  bool supportsWindowPosition();
158 
160 
161  /* WAYLAND direct-data access. */
162 
163  wl_display *display();
164 
165  wl_compositor *compositor();
166 
167 #ifdef WITH_GHOST_WAYLAND_LIBDECOR
168  libdecor *decor_context();
169 #else
170  xdg_wm_base *xdg_shell();
171  zxdg_decoration_manager_v1 *xdg_decoration_manager();
172 #endif
173 
174  const std::vector<output_t *> &outputs() const;
175 
176  wl_shm *shm() const;
177 
178  /* WAYLAND utility functions. */
179 
180  void selection_set(const std::string &selection);
181 
183  void window_surface_unref(const wl_surface *surface);
184 
186  const GHOST_TGrabCursorMode mode_current,
187  int32_t init_grab_xy[2],
188  const GHOST_Rect *wrap_bounds,
189  GHOST_TAxisFlag wrap_axis,
190  wl_surface *surface,
191  int scale);
192 
193  private:
194  struct display_t *d;
195  std::string selection;
196 };
void ghost_wl_surface_tag_cursor_pointer(struct wl_surface *surface)
void ghost_wl_surface_tag_cursor_tablet(struct wl_surface *surface)
void ghost_wl_surface_tag(struct wl_surface *surface)
bool ghost_wl_surface_own_cursor_pointer(const struct wl_surface *surface)
struct output_t * ghost_wl_output_user_data(struct wl_output *output)
bool ghost_wl_surface_own(const struct wl_surface *surface)
bool ghost_wl_surface_own_cursor_tablet(const struct wl_surface *surface)
void ghost_wl_output_tag(struct wl_output *output)
GHOST_WindowWayland * ghost_wl_surface_user_data(struct wl_surface *surface)
bool ghost_wl_output_own(const struct wl_output *output)
GHOST_TWindowState
Definition: GHOST_Types.h:129
GHOST_TStandardCursor
Definition: GHOST_Types.h:214
GHOST_TAxisFlag
Definition: GHOST_Types.h:420
GHOST_TDrawingContextType
Definition: GHOST_Types.h:148
GHOST_TSuccess
Definition: GHOST_Types.h:74
GHOST_TGrabCursorMode
Definition: GHOST_Types.h:404
GHOST_TConsoleWindowState
Definition: GHOST_Types.h:139
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble top
zxdg_decoration_manager_v1 * xdg_decoration_manager()
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const override
char * getClipboard(bool selection) const override
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y) override
GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const override
GHOST_TSuccess disposeContext(GHOST_IContext *context) override
void window_surface_unref(const wl_surface *surface)
GHOST_IContext * createOffscreenContext(GHOST_GLSettings glSettings) override
wl_compositor * compositor()
void selection_set(const std::string &selection)
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const override
uint8_t getNumDisplays() const override
void putClipboard(const char *buffer, bool selection) const override
GHOST_IWindow * createWindow(const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings, const bool exclusive, const bool is_dialog, const GHOST_IWindow *parentWindow) override
GHOST_TSuccess setCursorVisibility(bool visible)
bool window_cursor_grab_set(const GHOST_TGrabCursorMode mode, const GHOST_TGrabCursorMode mode_current, int32_t init_grab_xy[2], const GHOST_Rect *wrap_bounds, GHOST_TAxisFlag wrap_axis, wl_surface *surface, int scale)
const std::vector< output_t * > & outputs() const
GHOST_TSuccess getCursorBitmap(GHOST_CursorBitmapRef *bitmap)
GHOST_TSuccess setCursorShape(GHOST_TStandardCursor shape)
bool processEvents(bool waitForEvent) override
GHOST_TSuccess getCursorPositionClientRelative(const GHOST_IWindow *window, int32_t &x, int32_t &y) const override
GHOST_TSuccess setCursorPositionClientRelative(GHOST_IWindow *window, int32_t x, int32_t y) override
int setConsoleWindowState(GHOST_TConsoleWindowState action) override
GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor cursorShape)
GHOST_TSuccess setCustomCursorShape(uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const override
bool getCursorGrabUseSoftwareDisplay(const GHOST_TGrabCursorMode mode)
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const override
struct @211::@212 surface
ccl_global float * buffer
ccl_global KernelShaderEvalInput ccl_global float * output
const int state
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
static int left
unsigned int uint32_t
Definition: stdint.h:80
signed int int32_t
Definition: stdint.h:77
unsigned char uint8_t
Definition: stdint.h:78
int32_t size_native[2]
struct zxdg_output_v1 * xdg_output
struct wl_output * wl_output
int32_t size_logical[2]
int32_t position_logical[2]
int32_t size_mm[2]
bool has_position_logical
std::string model
wl_fixed_t scale_fractional
std::string make
bool has_scale_fractional