Blender V5.3
GHOST_WindowWayland.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#pragma once
12
13#include "GHOST_Window.hh"
14
15#include <span>
16#include <vector>
17
18#include <wayland-util.h> /* For #wl_fixed_t */
19
59#define USE_EVENT_BACKGROUND_THREAD
60
62
63struct GWL_Output;
64struct GWL_Window;
65
73
78
80 int32_t event_xy[2] = {0, 0};
88 GHOST_CSD_EventState_Button buttons[/*GHOST_kButtonMaskLeft + 1*/ 1];
89};
90
96 struct wl_buffer *buffer = nullptr;
97 void *buffer_data = nullptr;
98 size_t buffer_size = 0;
101};
102
104
106 public:
108
110 const char *title,
111 int32_t left,
112 int32_t top,
113 uint32_t width,
114 uint32_t height,
116 const GHOST_IWindow *parent_window,
118 const bool is_dialog,
119 const GHOST_ContextParams &context_params,
120 const bool exclusive,
121 const GHOST_GPUDevice &preferred_device);
122
123 ~GHOST_WindowWayland() override;
124
125 /* Ghost API */
126
127#ifdef USE_EVENT_BACKGROUND_THREAD
128 GHOST_TSuccess swapBufferRelease() override; /* Only for assertion. */
129#endif
130
131 uint16_t getDPIHint() override;
132
134 GHOST_TWindowTiledFlag getTiledEdges() const override;
135
137
139
141
142 GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap,
143 const uint8_t *mask,
144 const int size[2],
145 const int hot_spot[2],
146 bool can_invert_color) override;
147 bool getCursorGrabUseSoftwareDisplay() override;
148
150
151 bool getValid() const override;
152
153 void setTitle(const char *title) override;
154
155 std::string getTitle() const override;
156
157 void getWindowBounds(GHOST_Rect &bounds) const override;
158
159 void getClientBounds(GHOST_Rect &bounds) const override;
160
161 GHOST_TSuccess setClientWidth(uint32_t width) override;
162
163 GHOST_TSuccess setClientHeight(uint32_t height) override;
164
165 GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override;
166
167 void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
168
169 void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
170
171 GHOST_TSuccess setWindowCursorVisibility(bool visible) override;
172
174
175 GHOST_TWindowState getState() const override;
176
177 GHOST_TSuccess invalidate() override;
178
180
181 bool isDialog() const override;
182
183#ifdef WITH_INPUT_IME
184 void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed) override;
185 void endIME() override;
186#endif /* WITH_INPUT_IME */
187
188 /* WAYLAND direct-data access. */
189
190 int scale_get() const;
191 const struct GWL_WindowScaleParams &scale_params_get() const;
192
193 struct wl_surface *wl_surface_get() const;
194 const std::span<GWL_Output *const> outputs_get() const;
195
196 wl_fixed_t wl_fixed_from_window(wl_fixed_t value) const;
197 wl_fixed_t wl_fixed_to_window(wl_fixed_t value) const;
198
200
201 /* WAYLAND window-level functions. */
202
217
221
222 /* WAYLAND utility functions. */
223
232
235
241
242#ifdef USE_EVENT_BACKGROUND_THREAD
244#endif
245
246#ifdef WITH_GHOST_CSD
247 struct xdg_toplevel *xdg_toplevel_get();
248 GHOST_TWindowState xdg_toplevel_state_get();
249
250 const GHOST_CSD_Elem *csd_layout(int *r_num);
252 void csd_layout_refresh();
253 GHOST_CSD_EventState &csd_eventstate_get();
254
255 GHOST_TCSD_Type csd_elem_active_type_get() const;
256 void csd_elem_active_type_set(GHOST_TCSD_Type type);
257
262 void csd_margin_geometry_get(int32_t &r_margin_size, int32_t r_window_size[2]) const;
263#endif
264
265 private:
266 GHOST_SystemWayland *system_;
267 struct GWL_Window *window_;
268 GHOST_GPUDevice preferred_device_;
269
274 GHOST_Context *newDrawingContext(GHOST_TDrawingContextType type) override;
275};
#define wl_surface
GHOST_TWindowState
GHOST_TStandardCursor
GHOST_TCSD_Type
@ GHOST_kCSDTypeBody
GHOST_TDrawingContextType
GHOST_TWindowOrder
GHOST_TSuccess
GHOST_TGrabCursorMode
GHOST_TWindowTiledFlag
void gwl_xdg_window_icon_free(GWL_XDG_WindowIcon &icon)
unsigned long long int uint64_t
#define output
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
const struct GWL_WindowScaleParams & scale_params_get() const
GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override
bool outputs_leave(GWL_Output *output)
GHOST_TSuccess setClientWidth(uint32_t width) override
wl_fixed_t wl_fixed_to_window(wl_fixed_t value) const
GHOST_TSuccess setOrder(GHOST_TWindowOrder order) override
GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) override
GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor cursor_shape) override
GHOST_TSuccess setState(GHOST_TWindowState state) override
GHOST_TSuccess setWindowCursorVisibility(bool visible) override
GHOST_WindowWayland(GHOST_SystemWayland *system, const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, const GHOST_IWindow *parent_window, GHOST_TDrawingContextType type, const bool is_dialog, const GHOST_ContextParams &context_params, const bool exclusive, const GHOST_GPUDevice &preferred_device)
GHOST_TWindowState getState() const override
bool getCursorGrabUseSoftwareDisplay() override
bool isDialog() const override
struct wl_surface * wl_surface_get() const
GHOST_TSuccess notify_decor_redraw()
bool getValid() const override
wl_fixed_t wl_fixed_from_window(wl_fixed_t value) const
std::string getTitle() const override
void getClientBounds(GHOST_Rect &bounds) const override
const std::span< GWL_Output *const > outputs_get() const
uint16_t getDPIHint() override
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
GHOST_TSuccess swapBufferRelease() override
GHOST_TSuccess setClientHeight(uint32_t height) override
GHOST_TSuccess cursor_shape_refresh()
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
bool outputs_enter(GWL_Output *output)
GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap, const uint8_t *mask, const int size[2], const int hot_spot[2], bool can_invert_color) override
GHOST_TSuccess invalidate() override
GWL_XDG_WindowIcon & gwl_xdg_icon_get()
GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape) override
GHOST_TSuccess setWindowCustomCursorGenerator(GHOST_CursorGenerator *cursor_generator) override
void setTitle(const char *title) override
void getWindowBounds(GHOST_Rect &bounds) const override
GHOST_TWindowTiledFlag getTiledEdges() const override
GHOST_TSuccess getCursorBitmap(GHOST_CursorBitmapRef *bitmap) override
GHOST_Window(uint32_t width, uint32_t height, GHOST_TWindowState state, const GHOST_ContextParams &context_params, const bool exclusive=false)
const int state
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
GHOST_CSD_EventState_ButtonAction action_history[3]
GHOST_CSD_EventState_Button buttons[1]
struct wl_buffer * buffer