Blender V5.0
GHOST_WindowX11.hh
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
9
10#pragma once
11
12#include "GHOST_Window.hh"
13#include <X11/Xlib.h>
14#include <X11/Xutil.h>
15/* For tablets. */
16#ifdef WITH_X11_XINPUT
17# include <X11/extensions/XInput.h>
18#endif
19
20#include <map>
21
22class GHOST_SystemX11;
23
24#ifdef WITH_XDND
26#endif
27
34 public:
51 Display *display,
52 const char *title,
55 uint32_t width,
56 uint32_t height,
58 GHOST_WindowX11 *parent_window,
60 const bool is_dialog,
61 const GHOST_ContextParams &context_params,
62 const bool exclusive,
63 const GHOST_GPUDevice &preferred_device);
64
65 bool getValid() const override;
66
67 void setTitle(const char *title) override;
68
69 std::string getTitle() const override;
70
71 void getWindowBounds(GHOST_Rect &bounds) const override;
72
73 void getClientBounds(GHOST_Rect &bounds) const override;
74
75 bool isDialog() const override;
76
77 GHOST_TSuccess setClientWidth(uint32_t width) override;
78
79 GHOST_TSuccess setClientHeight(uint32_t height) override;
80
81 GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override;
82
83 void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
84
85 void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
86
87 GHOST_TWindowState getState() const override;
88
90
92
93 GHOST_TSuccess invalidate() override;
94
95 GHOST_TSuccess setProgressBar(float progress) override;
97
102 ~GHOST_WindowX11() override;
103
107
113
114 void validate();
115
120
122 {
123 return tablet_data_;
124 }
125
126#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
127 XIC getX11_XIC()
128 {
129 return xic_;
130 }
131
132 bool createX11_XIC();
133#endif
134
135#ifdef WITH_X11_XINPUT
136 void refreshXInputDevices();
137#endif
138
139#ifdef WITH_XDND
140 GHOST_DropTargetX11 *getDropTarget()
141 {
142 return drop_target_;
143 }
144#endif
145
146 /*
147 * Need this in case that we want start the window
148 * in FullScree or Maximized state.
149 * Check GHOST_WindowX11.cc
150 */
153
155
156 uint16_t getDPIHint() override;
157
158 protected:
164
169 GHOST_TSuccess setWindowCursorVisibility(bool visible) override;
170
176
178
185
190 GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap,
191 const uint8_t *mask,
192 const int size[2],
193 const int hot_spot[2],
194 bool can_invert_color) override;
195
196 private:
197 /* Force use of public constructor. */
198
200
202
203 GHOST_TSuccess getStandardCursor(GHOST_TStandardCursor g_cursor, Cursor &xcursor);
204
205 Cursor getEmptyCursor();
206
207 Window window_;
208 Display *display_;
209 XVisualInfo *visual_info_;
210 void *fbconfig_;
211
212 GHOST_TWindowState normal_state_;
213
215 GHOST_SystemX11 *system_;
216
218 bool invalid_window_;
219
221 Cursor empty_cursor_;
222
224 Cursor custom_cursor_;
225
227 Cursor visible_cursor_;
228
230 std::map<uint, Cursor> standard_cursors_;
231
232#ifdef WITH_XDND
233 GHOST_DropTargetX11 *drop_target_;
234#endif
235
236 GHOST_TabletData tablet_data_;
237
238#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
239 XIC xic_;
240#endif
241
242 bool valid_setup_;
243 GHOST_GPUDevice preferred_device_;
244
245 void icccmSetState(int state);
246 int icccmGetState() const;
247
248 void netwmMaximized(bool set);
249 bool netwmIsMaximized() const;
250
251 void netwmFullScreen(bool set);
252 bool netwmIsFullScreen() const;
253
254 void motifFullScreen(bool set);
255 bool motifIsFullScreen() const;
256
257 void motifShowWindowFrame(bool set);
258 bool motifIsShowWindowFrame() const;
259};
#define Window
#define Display
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
GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type) override
GHOST_WindowX11(GHOST_SystemX11 *system, Display *display, const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_WindowX11 *parent_window, GHOST_TDrawingContextType type, const bool is_dialog, const GHOST_ContextParams &context_params, const bool exclusive, const GHOST_GPUDevice &preferred_device)
bool getValid() const override
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
GHOST_TSuccess setClientHeight(uint32_t height) override
void getWindowBounds(GHOST_Rect &bounds) const override
GHOST_TabletData & GetTabletData()
~GHOST_WindowX11() override
GHOST_TSuccess setState(GHOST_TWindowState state) override
GHOST_TSuccess endProgressBar() override
void getClientBounds(GHOST_Rect &bounds) const override
void setTitle(const char *title) override
std::string getTitle() const override
GHOST_TSuccess setClientWidth(uint32_t width) override
GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape) override
GHOST_TSuccess setProgressBar(float progress) override
GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape) override
GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override
GHOST_TSuccess setOrder(GHOST_TWindowOrder order) override
GHOST_TSuccess setWindowCursorVisibility(bool visible) override
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
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
bool isDialog() const override
uint16_t getDPIHint() override
GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) override
GHOST_TSuccess invalidate() override
GHOST_TWindowState post_state_
GHOST_TGrabCursorMode getWindowCursorGrab() const
GHOST_TSuccess setDialogHints(GHOST_WindowX11 *parent_window)
GHOST_TWindowState getState() const override
GHOST_Window(uint32_t width, uint32_t height, GHOST_TWindowState state, const GHOST_ContextParams &context_params, const bool exclusive=false)
uint top
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
static ulong state[N]
static int left