Blender V4.5
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 *parentWindow,
60 const bool is_dialog,
61 const bool stereoVisual,
62 const bool exclusive,
63 const bool is_debug,
64 const GHOST_GPUDevice &preferred_device);
65
66 bool getValid() const override;
67
68 void setTitle(const char *title) override;
69
70 std::string getTitle() const override;
71
72 void getWindowBounds(GHOST_Rect &bounds) const override;
73
74 void getClientBounds(GHOST_Rect &bounds) const override;
75
76 bool isDialog() const override;
77
78 GHOST_TSuccess setClientWidth(uint32_t width) override;
79
80 GHOST_TSuccess setClientHeight(uint32_t height) override;
81
82 GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override;
83
84 void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
85
86 void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
87
88 GHOST_TWindowState getState() const override;
89
91
93
94 GHOST_TSuccess invalidate() override;
95
98
103 ~GHOST_WindowX11() override;
104
108
114
115 void validate();
116
121
123 {
124 return m_tabletData;
125 }
126
127#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
128 XIC getX11_XIC()
129 {
130 return m_xic;
131 }
132
133 bool createX11_XIC();
134#endif
135
136#ifdef WITH_X11_XINPUT
137 void refreshXInputDevices();
138#endif
139
140#ifdef WITH_XDND
141 GHOST_DropTargetX11 *getDropTarget()
142 {
143 return m_dropTarget;
144 }
145#endif
146
147 /*
148 * Need this in case that we want start the window
149 * in FullScree or Maximized state.
150 * Check GHOST_WindowX11.cc
151 */
154
156
157 uint16_t getDPIHint() override;
158
159 protected:
165
170 GHOST_TSuccess setWindowCursorVisibility(bool visible) override;
171
177
179
186
192 uint8_t *mask,
193 int sizex,
194 int sizey,
195 int hotX,
196 int hotY,
197 bool canInvertColor) override;
198
199 private:
200 /* Force use of public constructor. */
201
203
205
206 GHOST_TSuccess getStandardCursor(GHOST_TStandardCursor g_cursor, Cursor &xcursor);
207
208 Cursor getEmptyCursor();
209
210 Window m_window;
211 Display *m_display;
212 XVisualInfo *m_visualInfo;
213 void *m_fbconfig;
214
215 GHOST_TWindowState m_normal_state;
216
218 GHOST_SystemX11 *m_system;
219
221 bool m_invalid_window;
222
224 Cursor m_empty_cursor;
225
227 Cursor m_custom_cursor;
228
230 Cursor m_visible_cursor;
231
233 std::map<uint, Cursor> m_standard_cursors;
234
235#ifdef WITH_XDND
236 GHOST_DropTargetX11 *m_dropTarget;
237#endif
238
239 GHOST_TabletData m_tabletData;
240
241#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
242 XIC m_xic;
243#endif
244
245 bool m_valid_setup;
246 bool m_is_debug_context;
247 GHOST_GPUDevice m_preferred_device;
248
249 void icccmSetState(int state);
250 int icccmGetState() const;
251
252 void netwmMaximized(bool set);
253 bool netwmIsMaximized() const;
254
255 void netwmFullScreen(bool set);
256 bool netwmIsFullScreen() const;
257
258 void motifFullScreen(bool set);
259 bool motifIsFullScreen() const;
260};
#define Window
#define Display
GHOST_TWindowState
GHOST_TStandardCursor
GHOST_TDrawingContextType
GHOST_TWindowOrder
GHOST_TSuccess
Definition GHOST_Types.h:80
GHOST_TGrabCursorMode
float progress
Definition WM_types.hh:1019
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
GHOST_TSuccess setDialogHints(GHOST_WindowX11 *parentWindow)
GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type) override
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_TWindowState m_post_state
GHOST_TSuccess setState(GHOST_TWindowState state) override
GHOST_TSuccess endProgressBar() override
void getClientBounds(GHOST_Rect &bounds) const 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 *parentWindow, GHOST_TDrawingContextType type, const bool is_dialog, const bool stereoVisual, const bool exclusive, const bool is_debug, const GHOST_GPUDevice &preferred_device)
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 setWindowCustomCursorShape(uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor) 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
bool isDialog() const override
uint16_t getDPIHint() override
GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) override
GHOST_TSuccess invalidate() override
GHOST_TGrabCursorMode getWindowCursorGrab() const
GHOST_TWindowState getState() const override
GHOST_Window(uint32_t width, uint32_t height, GHOST_TWindowState state, const bool wantStereoVisual=false, const bool exclusive=false)
uint top
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
static ulong state[N]
static int left