3 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version. The Blender
9 * Foundation also sells licenses for use in proprietary software under
10 * the Blender License. See http://www.blender.org/BL/ for information
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 * All rights reserved.
25 * The Original Code is: all of this file.
27 * Contributor(s): none yet.
29 * ***** END GPL/BL DUAL LICENSE BLOCK *****
32 * @file GHOST_WindowX11.h
33 * Declaration of GHOST_WindowX11 class.
36 #ifndef _GHOST_WINDOWX11_H_
37 #define _GHOST_WINDOWX11_H_
39 #include "GHOST_Window.h"
46 class GHOST_SystemX11;
49 * X11 implementation of GHOST_IWindow.
50 * Dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
51 * @author Laurence Bourn
52 * @date October 26, 2001
55 class GHOST_WindowX11 : public GHOST_Window
60 * Creates a new window and opens it.
61 * To check if the window was created properly, use the getValid() method.
62 * @param title The text shown in the title bar of the window.
63 * @param left The coordinate of the left edge of the window.
64 * @param top The coordinate of the top edge of the window.
65 * @param width The width the window.
66 * @param height The height the window.
67 * @param state The state the window is initially opened with.
68 * @param type The type of drawing context installed in this window.
69 * @param stereoVisual Stereo visual for quad buffered stereo.
72 GHOST_SystemX11 *system,
74 const STR_String& title,
79 GHOST_TWindowState state,
80 GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
81 const bool stereoVisual = false
89 setTitle(const STR_String& title);
144 GHOST_TWindowState state
149 GHOST_TWindowOrder order
157 activateDrawingContext(
165 * Closes the window and disposes resources allocated.
171 * X11 system specific calls.
175 * The reverse of invalidate! Tells this window
176 * that all events for it have been pushed into
177 * the GHOST event queue.
185 * Return a handle to the x11 window type.
193 * Tries to install a rendering context in this window.
194 * @param type The type of rendering context installed.
195 * @return Indication as to whether installation has succeeded.
198 installDrawingContext(
199 GHOST_TDrawingContextType type
203 * Removes the current drawing context.
204 * @return Indication as to whether removal has succeeded.
207 removeDrawingContext(
211 * Sets the cursor visibility on the window using
212 * native window system calls.
215 setWindowCursorVisibility(
220 * Sets the cursor shape on the window using
221 * native window system calls.
224 setWindowCursorShape(
225 GHOST_TStandardCursor shape
229 * Sets the cursor shape on the window using
230 * native window system calls.
233 setWindowCustomCursorShape(
234 GHOST_TUns8 bitmap[16][2],
235 GHOST_TUns8 mask[16][2],
241 * Sets the cursor shape on the window using
242 * native window system calls (Arbitrary size/color).
245 setWindowCustomCursorShape(
258 /// Force use of public constructor.
264 const GHOST_WindowX11 &
269 GHOST_TStandardCursor g_cursor
276 GLXContext m_context;
279 XVisualInfo *m_visual;
281 /** The first created OpenGL context (for sharing display lists) */
282 static GLXContext s_firstContext;
284 /// A pointer to the typed system class.
286 GHOST_SystemX11 * m_system;
290 /** Used to concatenate calls to invalidate() on this window. */
291 bool m_invalid_window;
293 /** XCursor structure of an empty (blank) cursor */
294 Cursor m_empty_cursor;
296 /** XCursor structure of the custom cursor */
297 Cursor m_custom_cursor;
299 /** Cache of XC_* ID's to XCursor structures */
300 std::map<unsigned int, Cursor> m_standard_cursors;
304 #endif // _GHOST_WINDOWX11_H_