Blender  V2.93
GHOST_WindowX11.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
25 #pragma once
26 
27 #include "GHOST_Window.h"
28 #include <X11/Xlib.h>
29 #include <X11/Xutil.h>
30 // For tablets
31 #ifdef WITH_X11_XINPUT
32 # include <X11/extensions/XInput.h>
33 #endif
34 
35 #include "GHOST_TaskbarX11.h"
36 
37 #include <map>
38 
39 class GHOST_SystemX11;
40 
41 #ifdef WITH_XDND
43 #endif
44 
51 class GHOST_WindowX11 : public GHOST_Window {
52  public:
69  Display *display,
70  const char *title,
76  GHOST_WindowX11 *parentWindow,
78  const bool is_dialog = false,
79  const bool stereoVisual = false,
80  const bool exclusive = false,
81  const bool alphaBackground = false,
82  const bool is_debug = false);
83 
84  bool getValid() const;
85 
86  void setTitle(const char *title);
87 
88  std::string getTitle() const;
89 
90  void getWindowBounds(GHOST_Rect &bounds) const;
91 
92  void getClientBounds(GHOST_Rect &bounds) const;
93 
94  bool isDialog() const;
95 
97 
99 
101 
102  void screenToClient(GHOST_TInt32 inX,
103  GHOST_TInt32 inY,
104  GHOST_TInt32 &outX,
105  GHOST_TInt32 &outY) const;
106 
107  void clientToScreen(GHOST_TInt32 inX,
108  GHOST_TInt32 inY,
109  GHOST_TInt32 &outX,
110  GHOST_TInt32 &outY) const;
111 
113 
115 
117 
119 
120  GHOST_TSuccess setProgressBar(float progress);
122 
128 
139  void validate();
140 
144  Window getXWindow();
145 
147  {
148  return m_tabletData;
149  }
150 
151 #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
152  XIC getX11_XIC()
153  {
154  return m_xic;
155  }
156 
157  bool createX11_XIC();
158 #endif
159 
160 #ifdef WITH_X11_XINPUT
161  void refreshXInputDevices();
162 #endif
163 
164 #ifdef WITH_XDND
165  GHOST_DropTargetX11 *getDropTarget()
166  {
167  return m_dropTarget;
168  }
169 #endif
170 
171  /*
172  * Need this in case that we want start the window
173  * in FullScree or Maximized state.
174  * Check GHOST_WindowX11.cpp
175  */
178 
180 
182 
184 
186 
187  protected:
193 
199 
205 
207 
214 
220  GHOST_TUns8 *mask,
221  int sizex,
222  int sizey,
223  int hotX,
224  int hotY,
225  bool canInvertColor);
226 
227  private:
228  /* Force use of public constructor. */
229 
230  GHOST_WindowX11();
231 
233 
234  GHOST_TSuccess getStandardCursor(GHOST_TStandardCursor g_cursor, Cursor &xcursor);
235 
236  Cursor getEmptyCursor();
237 
238  Window m_window;
239  Display *m_display;
240  XVisualInfo *m_visualInfo;
241  void *m_fbconfig;
242 
243  GHOST_TWindowState m_normal_state;
244 
246  GHOST_SystemX11 *m_system;
247 
249  bool m_invalid_window;
250 
252  Cursor m_empty_cursor;
253 
255  Cursor m_custom_cursor;
256 
258  Cursor m_visible_cursor;
259 
261  std::map<unsigned int, Cursor> m_standard_cursors;
262 
263  GHOST_TaskBarX11 m_taskbar;
264 
265 #ifdef WITH_XDND
266  GHOST_DropTargetX11 *m_dropTarget;
267 #endif
268 
269  GHOST_TabletData m_tabletData;
270 
271 #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
272  XIC m_xic;
273 #endif
274 
275  bool m_valid_setup;
276  bool m_is_debug_context;
277 
278  void icccmSetState(int state);
279  int icccmGetState() const;
280 
281  void netwmMaximized(bool set);
282  bool netwmIsMaximized() const;
283 
284  void netwmFullScreen(bool set);
285  bool netwmIsFullScreen() const;
286 
287  void motifFullScreen(bool set);
288  bool motifIsFullScreen() const;
289 };
GHOST_TWindowState
Definition: GHOST_Types.h:144
GHOST_TStandardCursor
Definition: GHOST_Types.h:222
unsigned int GHOST_TUns32
Definition: GHOST_Types.h:64
int GHOST_TInt32
Definition: GHOST_Types.h:63
unsigned short GHOST_TUns16
Definition: GHOST_Types.h:62
GHOST_TDrawingContextType
Definition: GHOST_Types.h:156
@ GHOST_kDrawingContextTypeNone
Definition: GHOST_Types.h:157
GHOST_TWindowOrder
Definition: GHOST_Types.h:154
GHOST_TSuccess
Definition: GHOST_Types.h:91
GHOST_TGrabCursorMode
Definition: GHOST_Types.h:412
unsigned char GHOST_TUns8
Definition: GHOST_Types.h:60
_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 type
_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 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
_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 GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint order
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition: btDbvt.cpp:299
GHOST_TSuccess setClientHeight(GHOST_TUns32 height)
GHOST_TSuccess setDialogHints(GHOST_WindowX11 *parentWindow)
GHOST_TSuccess setClientWidth(GHOST_TUns32 width)
GHOST_TUns16 getDPIHint()
void setTitle(const char *title)
GHOST_TWindowState m_post_state
GHOST_TSuccess setOrder(GHOST_TWindowOrder order)
GHOST_TSuccess endProgressBar()
GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape)
GHOST_TSuccess endFullScreen() const
bool isDialog() const
void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 &outX, GHOST_TInt32 &outY) const
void getClientBounds(GHOST_Rect &bounds) const
GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type)
GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode)
std::string getTitle() const
GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height)
bool getValid() const
void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 &outX, GHOST_TInt32 &outY) const
GHOST_TSuccess setState(GHOST_TWindowState state)
GHOST_TabletData & GetTabletData()
GHOST_TSuccess setWindowCursorVisibility(bool visible)
GHOST_TWindowState getState() const
GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape)
GHOST_TSuccess invalidate()
void getWindowBounds(GHOST_Rect &bounds) const
GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
GHOST_TSuccess beginFullScreen() const
GHOST_TGrabCursorMode getWindowCursorGrab() const
GHOST_TSuccess setProgressBar(float progress)
static ulong state[N]
static int left
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)