Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00019 * All rights reserved. 00020 * 00021 * The Original Code is: all of this file. 00022 * 00023 * Contributor(s): none yet. 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00033 #ifndef _GHOST_SYSTEM_X11_H_ 00034 #define _GHOST_SYSTEM_X11_H_ 00035 00036 #include <X11/Xlib.h> 00037 #include <GL/glx.h> 00038 00039 #include "GHOST_System.h" 00040 #include "../GHOST_Types.h" 00041 00042 #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) 00043 # define GHOST_X11_RES_NAME "Blender" /* res_name */ 00044 # define GHOST_X11_RES_CLASS "Blender" /* res_class */ 00045 #endif 00046 00047 00048 class GHOST_WindowX11; 00049 00057 class GHOST_SystemX11 : public GHOST_System { 00058 public: 00059 00065 GHOST_SystemX11( 00066 ); 00067 00071 virtual ~GHOST_SystemX11(); 00072 00073 00074 GHOST_TSuccess 00075 init( 00076 ); 00077 00078 00088 GHOST_TUns64 00089 getMilliSeconds( 00090 ) const; 00091 00092 00097 GHOST_TUns8 00098 getNumDisplays( 00099 ) const; 00100 00105 void 00106 getMainDisplayDimensions( 00107 GHOST_TUns32& width, 00108 GHOST_TUns32& height 00109 ) const; 00110 00126 GHOST_IWindow* 00127 createWindow( 00128 const STR_String& title, 00129 GHOST_TInt32 left, 00130 GHOST_TInt32 top, 00131 GHOST_TUns32 width, 00132 GHOST_TUns32 height, 00133 GHOST_TWindowState state, 00134 GHOST_TDrawingContextType type, 00135 const bool stereoVisual, 00136 const GHOST_TUns16 numOfAASamples = 0, 00137 const GHOST_TEmbedderWindowID parentWindow = 0 00138 ); 00139 00149 bool 00150 processEvents( 00151 bool waitForEvent 00152 ); 00153 00157 GHOST_TSuccess 00158 getCursorPosition( 00159 GHOST_TInt32& x, 00160 GHOST_TInt32& y 00161 ) const; 00162 00163 GHOST_TSuccess 00164 setCursorPosition( 00165 GHOST_TInt32 x, 00166 GHOST_TInt32 y 00167 ); 00168 00174 GHOST_TSuccess 00175 getModifierKeys( 00176 GHOST_ModifierKeys& keys 00177 ) const ; 00178 00184 GHOST_TSuccess 00185 getButtons( 00186 GHOST_Buttons& buttons 00187 ) const; 00188 00195 void 00196 addDirtyWindow( 00197 GHOST_WindowX11 * bad_wind 00198 ); 00199 00200 00205 Display * 00206 getXDisplay( 00207 ) { 00208 return m_display; 00209 } 00210 00211 #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) 00212 XIM 00213 getX11_XIM( 00214 ) { 00215 return m_xim; 00216 } 00217 #endif 00218 00219 /* Helped function for get data from the clipboard. */ 00220 void getClipboard_xcout(XEvent evt, Atom sel, Atom target, 00221 unsigned char **txt, unsigned long *len, 00222 unsigned int *context) const; 00223 00229 GHOST_TUns8 *getClipboard(bool selection) const; 00230 00236 void putClipboard(GHOST_TInt8 *buffer, bool selection) const; 00237 00241 int toggleConsole(int action) { return 0; } 00242 00249 Atom m_wm_state; 00250 Atom m_wm_change_state; 00251 Atom m_net_state; 00252 Atom m_net_max_horz; 00253 Atom m_net_max_vert; 00254 Atom m_net_fullscreen; 00255 Atom m_motif; 00256 Atom m_wm_take_focus; 00257 Atom m_wm_protocols; 00258 Atom m_delete_window_atom; 00259 00260 /* Atoms for Selection, copy & paste. */ 00261 Atom m_targets; 00262 Atom m_string; 00263 Atom m_compound_text; 00264 Atom m_text; 00265 Atom m_clipboard; 00266 Atom m_primary; 00267 Atom m_xclip_out; 00268 Atom m_incr; 00269 Atom m_utf8_string; 00270 00271 private : 00272 00273 Display * m_display; 00274 #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) 00275 XIM m_xim; 00276 #endif 00277 00279 std::vector<GHOST_WindowX11 *> m_dirty_windows; 00280 00282 GHOST_TUns64 m_start_time; 00283 00285 char m_keyboard_vector[32]; 00286 00287 /* to prevent multiple warp, we store the time of the last warp event 00288 * and stop accumulating all events generated before that */ 00289 Time m_last_warp; 00290 00296 GHOST_WindowX11 * 00297 findGhostWindow( 00298 Window xwind 00299 ) const ; 00300 00301 void 00302 processEvent( 00303 XEvent *xe 00304 ); 00305 00306 Time 00307 lastEventTime( 00308 Time default_time 00309 ); 00310 00311 bool 00312 generateWindowExposeEvents( 00313 ); 00314 }; 00315 00316 #endif 00317