Blender V5.0
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 <vector>
16
17#include <wayland-util.h> /* For #wl_fixed_t */
18
58#define USE_EVENT_BACKGROUND_THREAD
59
61
62struct GWL_Output;
63struct GWL_Window;
64
66 public:
68
70 const char *title,
73 uint32_t width,
74 uint32_t height,
76 const GHOST_IWindow *parent_window,
78 const bool is_dialog,
79 const GHOST_ContextParams &context_params,
80 const bool exclusive,
81 const GHOST_GPUDevice &preferred_device);
82
83 ~GHOST_WindowWayland() override;
84
85 /* Ghost API */
86
87#ifdef USE_EVENT_BACKGROUND_THREAD
88 GHOST_TSuccess swapBufferRelease() override; /* Only for assertion. */
89#endif
90
91 uint16_t getDPIHint() override;
92
94
96
98
99 GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap,
100 const uint8_t *mask,
101 const int size[2],
102 const int hot_spot[2],
103 bool can_invert_color) override;
104 bool getCursorGrabUseSoftwareDisplay() override;
105
107
108 bool getValid() const override;
109
110 void setTitle(const char *title) override;
111
112 std::string getTitle() const override;
113
114 void getWindowBounds(GHOST_Rect &bounds) const override;
115
116 void getClientBounds(GHOST_Rect &bounds) const override;
117
118 GHOST_TSuccess setClientWidth(uint32_t width) override;
119
120 GHOST_TSuccess setClientHeight(uint32_t height) override;
121
122 GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override;
123
124 void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
125
126 void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
127
128 GHOST_TSuccess setWindowCursorVisibility(bool visible) override;
129
131
132 GHOST_TWindowState getState() const override;
133
134 GHOST_TSuccess invalidate() override;
135
137
138 bool isDialog() const override;
139
140#ifdef WITH_INPUT_IME
141 void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed) override;
142 void endIME() override;
143#endif /* WITH_INPUT_IME */
144
145 /* WAYLAND direct-data access. */
146
147 int scale_get() const;
148 const struct GWL_WindowScaleParams &scale_params_get() const;
149
150 struct wl_surface *wl_surface_get() const;
151 const std::vector<GWL_Output *> &outputs_get();
152
153 wl_fixed_t wl_fixed_from_window(wl_fixed_t value) const;
154 wl_fixed_t wl_fixed_to_window(wl_fixed_t value) const;
155
156 /* WAYLAND window-level functions. */
157
172
176
177 /* WAYLAND utility functions. */
178
187
190
196
197#ifdef USE_EVENT_BACKGROUND_THREAD
199#endif
200
201 private:
202 GHOST_SystemWayland *system_;
203 struct GWL_Window *window_;
204 GHOST_GPUDevice preferred_device_;
205
210 GHOST_Context *newDrawingContext(GHOST_TDrawingContextType type) override;
211};
#define wl_surface
GHOST_TWindowState
GHOST_TStandardCursor
GHOST_TDrawingContextType
GHOST_TWindowOrder
GHOST_TSuccess
Definition GHOST_Types.h:57
GHOST_TGrabCursorMode
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
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
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
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
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_TSuccess getCursorBitmap(GHOST_CursorBitmapRef *bitmap) override
const std::vector< GWL_Output * > & outputs_get()
GHOST_Window(uint32_t width, uint32_t height, GHOST_TWindowState state, const GHOST_ContextParams &context_params, const bool exclusive=false)
uint top
#define output
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
static ulong state[N]
static int left