1*161f4cd1SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*161f4cd1SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*161f4cd1SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*161f4cd1SAndrew Rist * distributed with this work for additional information 6*161f4cd1SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*161f4cd1SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*161f4cd1SAndrew Rist * "License"); you may not use this file except in compliance 9*161f4cd1SAndrew Rist * with the License. You may obtain a copy of the License at 10*161f4cd1SAndrew Rist * 11*161f4cd1SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*161f4cd1SAndrew Rist * 13*161f4cd1SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*161f4cd1SAndrew Rist * software distributed under the License is distributed on an 15*161f4cd1SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*161f4cd1SAndrew Rist * KIND, either express or implied. See the License for the 17*161f4cd1SAndrew Rist * specific language governing permissions and limitations 18*161f4cd1SAndrew Rist * under the License. 19*161f4cd1SAndrew Rist * 20*161f4cd1SAndrew Rist *************************************************************/ 21*161f4cd1SAndrew Rist 22*161f4cd1SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SV_SALDISP_HXX 25cdf0e10cSrcweir #define _SV_SALDISP_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir // -=-= exports =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 28cdf0e10cSrcweir class SalDisplay; 29cdf0e10cSrcweir class SalColormap; 30cdf0e10cSrcweir class SalVisual; 31cdf0e10cSrcweir class SalXLib; 32cdf0e10cSrcweir 33cdf0e10cSrcweir // -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 34cdf0e10cSrcweir #include <unx/salunx.h> 35cdf0e10cSrcweir #include <vcl/salgtype.hxx> 36cdf0e10cSrcweir #ifndef _SV_PTRSTYLE_HXX 37cdf0e10cSrcweir #include <vcl/ptrstyle.hxx> 38cdf0e10cSrcweir #endif 39cdf0e10cSrcweir #include <sal/types.h> 40cdf0e10cSrcweir #ifndef _OSL_MUTEX_H 41cdf0e10cSrcweir #include <osl/mutex.h> 42cdf0e10cSrcweir #endif 43cdf0e10cSrcweir #include <vector> 44cdf0e10cSrcweir #include <list> 45cdf0e10cSrcweir #include <hash_map> 46cdf0e10cSrcweir #include <tools/gen.hxx> 47cdf0e10cSrcweir #include <salwtype.hxx> 48cdf0e10cSrcweir 49cdf0e10cSrcweir #include <vclpluginapi.h> 50cdf0e10cSrcweir 51cdf0e10cSrcweir // -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 52cdf0e10cSrcweir class BitmapPalette; 53cdf0e10cSrcweir class SalFrame; 54cdf0e10cSrcweir class ColorMask; 55cdf0e10cSrcweir 56cdf0e10cSrcweir namespace vcl_sal { class WMAdaptor; } 57cdf0e10cSrcweir class DtIntegrator; 58cdf0e10cSrcweir 59cdf0e10cSrcweir // -=-= #defines -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 60cdf0e10cSrcweir #define PROPERTY_SUPPORT_WM_SetPos 0x00000001 61cdf0e10cSrcweir #define PROPERTY_SUPPORT_WM_Screen 0x00000002 62cdf0e10cSrcweir #define PROPERTY_SUPPORT_WM_Parent_Pixmap_None 0x00000004 63cdf0e10cSrcweir #define PROPERTY_SUPPORT_WM_ClientPos 0x00000008 64cdf0e10cSrcweir #define PROPERTY_SUPPORT_XSetClipMask 0x00000010 // for bitmap ops. 65cdf0e10cSrcweir #define PROPERTY_SUPPORT_3ButtonMouse 0x00000020 66cdf0e10cSrcweir 67cdf0e10cSrcweir #define PROPERTY_BUG_XA_FAMILY_NAME_nil 0x00001000 68cdf0e10cSrcweir #define PROPERTY_BUG_XCopyArea_GXxor 0x00002000 // from window 69cdf0e10cSrcweir #define PROPERTY_BUG_Stipple 0x00004000 // 0/1 inverted 70cdf0e10cSrcweir #define PROPERTY_BUG_Tile 0x00008000 // Recreate the 71cdf0e10cSrcweir // dither brush each time 72cdf0e10cSrcweir #define PROPERTY_BUG_FillPolygon_Tile 0x00010000 // always Toggle Fillstyle 73cdf0e10cSrcweir #define PROPERTY_BUG_DrawLine 0x00020000 // a DrawLine is one point to short 74cdf0e10cSrcweir #define PROPERTY_BUG_CopyPlane_RevertBWPixel 0x00040000 // revert fg and bg for xcopyplane 75cdf0e10cSrcweir #define PROPERTY_BUG_CopyArea_OnlySmallSlices 0x00080000 76cdf0e10cSrcweir #define PROPERTY_BUG_Bitmap_Bit_Order 0x00100000 77cdf0e10cSrcweir 78cdf0e10cSrcweir #define PROPERTY_FEATURE_Maximize 0x01000000 79cdf0e10cSrcweir #define PROPERTY_FEATURE_SharedMemory 0x02000000 80cdf0e10cSrcweir #define PROPERTY_FEATURE_TrustedSolaris 0x04000000 81cdf0e10cSrcweir 82cdf0e10cSrcweir #define PROPERTY_DEFAULT 0x00000FCB 83cdf0e10cSrcweir 84cdf0e10cSrcweir // ------------------------------------------------------------------------ 85cdf0e10cSrcweir // server vendor 86cdf0e10cSrcweir 87cdf0e10cSrcweir typedef enum { 88cdf0e10cSrcweir vendor_none = 0, 89cdf0e10cSrcweir vendor_attachmate, 90cdf0e10cSrcweir vendor_excursion, 91cdf0e10cSrcweir vendor_hp, 92cdf0e10cSrcweir vendor_hummingbird, 93cdf0e10cSrcweir vendor_ibm, 94cdf0e10cSrcweir vendor_sco, 95cdf0e10cSrcweir vendor_sgi, 96cdf0e10cSrcweir vendor_sun, 97cdf0e10cSrcweir vendor_xfree, 98cdf0e10cSrcweir vendor_xinside, 99cdf0e10cSrcweir vendor_xprinter, 100cdf0e10cSrcweir vendor_unknown 101cdf0e10cSrcweir } srv_vendor_t; 102cdf0e10cSrcweir 103cdf0e10cSrcweir extern "C" srv_vendor_t sal_GetServerVendor( Display *p_display ); 104cdf0e10cSrcweir 105cdf0e10cSrcweir // -=-= SalWM =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 106cdf0e10cSrcweir enum SalWM { olwm, // Open Look 107cdf0e10cSrcweir mwm, // Motif 108cdf0e10cSrcweir kwm, // KDE Desktop Environment 109cdf0e10cSrcweir FourDwm, // SGI 110cdf0e10cSrcweir vuewm, // HP 111cdf0e10cSrcweir dtwm, // CDE 112cdf0e10cSrcweir winmgr, // Oracle NC 113cdf0e10cSrcweir twm, 114cdf0e10cSrcweir fvwm, // ... 115cdf0e10cSrcweir pmwm, // SCO 116cdf0e10cSrcweir otherwm }; 117cdf0e10cSrcweir 118cdf0e10cSrcweir // -=-= SalRGB -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 119cdf0e10cSrcweir // MSB/Bigendian Sicht (SalColor == RGB, r=0xFF0000, g=0xFF00, b=0xFF) 120cdf0e10cSrcweir 121cdf0e10cSrcweir enum SalRGB { RGB, RBG, 122cdf0e10cSrcweir GBR, GRB, 123cdf0e10cSrcweir BGR, BRG, 124cdf0e10cSrcweir RGBA, RBGA, 125cdf0e10cSrcweir GBRA, GRBA, 126cdf0e10cSrcweir BGRA, BRGA, 127cdf0e10cSrcweir otherSalRGB }; 128cdf0e10cSrcweir 129cdf0e10cSrcweir // -=-= SalVisual =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 130cdf0e10cSrcweir class SalVisual : public XVisualInfo 131cdf0e10cSrcweir { 132cdf0e10cSrcweir SalRGB eRGBMode_; 133cdf0e10cSrcweir int nRedShift_; 134cdf0e10cSrcweir int nGreenShift_; 135cdf0e10cSrcweir int nBlueShift_; 136cdf0e10cSrcweir int nRedBits_; 137cdf0e10cSrcweir int nGreenBits_; 138cdf0e10cSrcweir int nBlueBits_; 139cdf0e10cSrcweir public: 140cdf0e10cSrcweir SalVisual(); 141cdf0e10cSrcweir ~SalVisual(); 142cdf0e10cSrcweir SalVisual( const XVisualInfo* pXVI ); 143cdf0e10cSrcweir 144cdf0e10cSrcweir inline VisualID GetVisualId() const { return visualid; } 145cdf0e10cSrcweir inline Visual *GetVisual() const { return visual; } 146cdf0e10cSrcweir inline int GetClass() const { return c_class; } 147cdf0e10cSrcweir inline int GetDepth() const { return depth; } 148cdf0e10cSrcweir inline SalRGB GetMode() const { return eRGBMode_; } 149cdf0e10cSrcweir 150cdf0e10cSrcweir Pixel GetTCPixel( SalColor nColor ) const; 151cdf0e10cSrcweir SalColor GetTCColor( Pixel nPixel ) const; 152cdf0e10cSrcweir sal_Bool Convert( int &n0, int &n1, int &n2, int &n3 ); // 32bit 153cdf0e10cSrcweir sal_Bool Convert( int &n0, int &n1, int &n2 ); // 24bit 154cdf0e10cSrcweir }; 155cdf0e10cSrcweir 156cdf0e10cSrcweir // -=-= SalColormap =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 157cdf0e10cSrcweir class SalColormap 158cdf0e10cSrcweir { 159cdf0e10cSrcweir const SalDisplay* m_pDisplay; 160cdf0e10cSrcweir Colormap m_hColormap; 161cdf0e10cSrcweir std::vector<SalColor> m_aPalette; // Pseudocolor 162cdf0e10cSrcweir SalVisual m_aVisual; 163cdf0e10cSrcweir std::vector<sal_uInt16> m_aLookupTable; // Pseudocolor: 12bit reduction 164cdf0e10cSrcweir Pixel m_nWhitePixel; 165cdf0e10cSrcweir Pixel m_nBlackPixel; 166cdf0e10cSrcweir Pixel m_nUsed; // Pseudocolor 167cdf0e10cSrcweir int m_nScreen; 168cdf0e10cSrcweir 169cdf0e10cSrcweir void GetPalette(); 170cdf0e10cSrcweir void GetLookupTable(); 171cdf0e10cSrcweir public: 172cdf0e10cSrcweir SalColormap( const SalDisplay* pSalDisplay, 173cdf0e10cSrcweir Colormap hColormap, 174cdf0e10cSrcweir int nScreen ); 175cdf0e10cSrcweir SalColormap( const BitmapPalette &rpPalette ); 176cdf0e10cSrcweir SalColormap( sal_uInt16 nDepth ); 177cdf0e10cSrcweir SalColormap(); 178cdf0e10cSrcweir ~SalColormap(); 179cdf0e10cSrcweir 180cdf0e10cSrcweir inline Colormap GetXColormap() const { return m_hColormap; } 181cdf0e10cSrcweir inline const SalDisplay* GetDisplay() const { return m_pDisplay; } 182cdf0e10cSrcweir inline Display* GetXDisplay() const; 183cdf0e10cSrcweir inline const SalVisual& GetVisual() const { return m_aVisual; } 184cdf0e10cSrcweir inline Visual* GetXVisual() const { return m_aVisual.GetVisual(); } 185cdf0e10cSrcweir inline Pixel GetWhitePixel() const { return m_nWhitePixel; } 186cdf0e10cSrcweir inline Pixel GetBlackPixel() const { return m_nBlackPixel; } 187cdf0e10cSrcweir inline Pixel GetUsed() const { return m_nUsed; } 188cdf0e10cSrcweir inline int GetClass() const { return m_aVisual.GetClass(); } 189cdf0e10cSrcweir inline int GetScreenNumber() const { return m_nScreen; } 190cdf0e10cSrcweir 191cdf0e10cSrcweir sal_Bool GetXPixels( XColor &rColor, 192cdf0e10cSrcweir int r, 193cdf0e10cSrcweir int g, 194cdf0e10cSrcweir int b ) const; 195cdf0e10cSrcweir inline sal_Bool GetXPixel( XColor &rColor, 196cdf0e10cSrcweir int r, 197cdf0e10cSrcweir int g, 198cdf0e10cSrcweir int b ) const; 199cdf0e10cSrcweir Pixel GetPixel( SalColor nColor ) const; 200cdf0e10cSrcweir SalColor GetColor( Pixel nPixel ) const; 201cdf0e10cSrcweir void SetPalette( const BitmapPalette &rPalette ); 202cdf0e10cSrcweir }; 203cdf0e10cSrcweir 204cdf0e10cSrcweir // -=-= SalXLib =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 205cdf0e10cSrcweir typedef int(*YieldFunc)(int fd, void* data); 206cdf0e10cSrcweir struct YieldEntry; 207cdf0e10cSrcweir 208cdf0e10cSrcweir class VCLPLUG_GEN_PUBLIC SalXLib 209cdf0e10cSrcweir { 210cdf0e10cSrcweir protected: 211cdf0e10cSrcweir timeval m_aTimeout; 212cdf0e10cSrcweir sal_uLong m_nTimeoutMS; 213cdf0e10cSrcweir int m_pTimeoutFDS[2]; 214cdf0e10cSrcweir 215cdf0e10cSrcweir bool m_bHaveSystemChildFrames; 216cdf0e10cSrcweir 217cdf0e10cSrcweir int nFDs_; 218cdf0e10cSrcweir fd_set aReadFDS_; 219cdf0e10cSrcweir fd_set aExceptionFDS_; 220cdf0e10cSrcweir YieldEntry *pYieldEntries_; 221cdf0e10cSrcweir 222cdf0e10cSrcweir 223cdf0e10cSrcweir struct XErrorStackEntry 224cdf0e10cSrcweir { 225cdf0e10cSrcweir bool m_bIgnore; 226cdf0e10cSrcweir bool m_bWas; 227cdf0e10cSrcweir unsigned int m_nLastErrorRequest; 228cdf0e10cSrcweir XErrorHandler m_aHandler; 229cdf0e10cSrcweir }; 230cdf0e10cSrcweir std::vector< XErrorStackEntry > m_aXErrorHandlerStack; 231cdf0e10cSrcweir XIOErrorHandler m_aOrigXIOErrorHandler; 232cdf0e10cSrcweir public: 233cdf0e10cSrcweir SalXLib(); 234cdf0e10cSrcweir virtual ~SalXLib(); 235cdf0e10cSrcweir virtual void Init(); 236cdf0e10cSrcweir 237cdf0e10cSrcweir virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); 238cdf0e10cSrcweir virtual void Wakeup(); 239cdf0e10cSrcweir virtual void PostUserEvent(); 240cdf0e10cSrcweir 241cdf0e10cSrcweir virtual void Insert( int fd, void* data, 242cdf0e10cSrcweir YieldFunc pending, 243cdf0e10cSrcweir YieldFunc queued, 244cdf0e10cSrcweir YieldFunc handle ); 245cdf0e10cSrcweir virtual void Remove( int fd ); 246cdf0e10cSrcweir 247cdf0e10cSrcweir void XError( Display *pDisp, XErrorEvent *pEvent ); 248cdf0e10cSrcweir bool HasXErrorOccured() const { return m_aXErrorHandlerStack.back().m_bWas; } 249cdf0e10cSrcweir unsigned int GetLastXErrorRequestCode() const { return m_aXErrorHandlerStack.back().m_nLastErrorRequest; } 250cdf0e10cSrcweir void ResetXErrorOccured() { m_aXErrorHandlerStack.back().m_bWas = false; } 251cdf0e10cSrcweir void PushXErrorLevel( bool bIgnore ); 252cdf0e10cSrcweir void PopXErrorLevel(); 253cdf0e10cSrcweir 254cdf0e10cSrcweir virtual void StartTimer( sal_uLong nMS ); 255cdf0e10cSrcweir virtual void StopTimer(); 256cdf0e10cSrcweir 257cdf0e10cSrcweir bool CheckTimeout( bool bExecuteTimers = true ); 258cdf0e10cSrcweir 259cdf0e10cSrcweir void setHaveSystemChildFrame() 260cdf0e10cSrcweir { m_bHaveSystemChildFrames = true; } 261cdf0e10cSrcweir bool getHaveSystemChildFrame() const 262cdf0e10cSrcweir { return m_bHaveSystemChildFrames; } 263cdf0e10cSrcweir }; 264cdf0e10cSrcweir 265cdf0e10cSrcweir // -=-= SalDisplay -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 266cdf0e10cSrcweir 267cdf0e10cSrcweir class SalI18N_InputMethod; 268cdf0e10cSrcweir class SalI18N_KeyboardExtension; 269cdf0e10cSrcweir class AttributeProvider; 270cdf0e10cSrcweir class SalUnicodeConverter; 271cdf0e10cSrcweir class SalConverterCache; 272cdf0e10cSrcweir 273cdf0e10cSrcweir extern "C" { 274cdf0e10cSrcweir struct SnDisplay; 275cdf0e10cSrcweir struct SnLauncheeContext; 276cdf0e10cSrcweir typedef Bool(*X_if_predicate)(Display*,XEvent*,XPointer); 277cdf0e10cSrcweir } 278cdf0e10cSrcweir 279cdf0e10cSrcweir class VCLPLUG_GEN_PUBLIC SalDisplay 280cdf0e10cSrcweir { 281cdf0e10cSrcweir public: 282cdf0e10cSrcweir struct RenderEntry 283cdf0e10cSrcweir { 284cdf0e10cSrcweir Pixmap m_aPixmap; 285cdf0e10cSrcweir Picture m_aPicture; 286cdf0e10cSrcweir 287cdf0e10cSrcweir RenderEntry() : m_aPixmap( 0 ), m_aPicture( 0 ) {} 288cdf0e10cSrcweir }; 289cdf0e10cSrcweir 290cdf0e10cSrcweir typedef std::hash_map<int,RenderEntry> RenderEntryMap; 291cdf0e10cSrcweir 292cdf0e10cSrcweir struct ScreenData 293cdf0e10cSrcweir { 294cdf0e10cSrcweir bool m_bInit; 295cdf0e10cSrcweir 296cdf0e10cSrcweir XLIB_Window m_aRoot; 297cdf0e10cSrcweir XLIB_Window m_aRefWindow; 298cdf0e10cSrcweir Size m_aSize; 299cdf0e10cSrcweir SalVisual m_aVisual; 300cdf0e10cSrcweir SalColormap m_aColormap; 301cdf0e10cSrcweir GC m_aMonoGC; 302cdf0e10cSrcweir GC m_aCopyGC; 303cdf0e10cSrcweir GC m_aAndInvertedGC; 304cdf0e10cSrcweir GC m_aAndGC; 305cdf0e10cSrcweir GC m_aOrGC; 306cdf0e10cSrcweir GC m_aStippleGC; 307cdf0e10cSrcweir Pixmap m_hInvert50; 308cdf0e10cSrcweir mutable RenderEntryMap m_aRenderData; 309cdf0e10cSrcweir 310cdf0e10cSrcweir ScreenData() : 311cdf0e10cSrcweir m_bInit( false ), 312cdf0e10cSrcweir m_aRoot( None ), 313cdf0e10cSrcweir m_aRefWindow( None ), 314cdf0e10cSrcweir m_aMonoGC( None ), 315cdf0e10cSrcweir m_aCopyGC( None ), 316cdf0e10cSrcweir m_aAndInvertedGC( None ), 317cdf0e10cSrcweir m_aAndGC( None ), 318cdf0e10cSrcweir m_aOrGC( None ), 319cdf0e10cSrcweir m_aStippleGC( None ), 320cdf0e10cSrcweir m_hInvert50( None ), 321cdf0e10cSrcweir m_aRenderData( 1 ) 322cdf0e10cSrcweir {} 323cdf0e10cSrcweir }; 324cdf0e10cSrcweir // -=-= UserEvent =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 325cdf0e10cSrcweir struct SalUserEvent 326cdf0e10cSrcweir { 327cdf0e10cSrcweir SalFrame* m_pFrame; 328cdf0e10cSrcweir void* m_pData; 329cdf0e10cSrcweir sal_uInt16 m_nEvent; 330cdf0e10cSrcweir 331cdf0e10cSrcweir SalUserEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT ) 332cdf0e10cSrcweir : m_pFrame( pFrame ), 333cdf0e10cSrcweir m_pData( pData ), 334cdf0e10cSrcweir m_nEvent( nEvent ) 335cdf0e10cSrcweir {} 336cdf0e10cSrcweir }; 337cdf0e10cSrcweir 338cdf0e10cSrcweir protected: 339cdf0e10cSrcweir SalXLib *pXLib_; 340cdf0e10cSrcweir SalI18N_InputMethod *mpInputMethod; 341cdf0e10cSrcweir SalI18N_KeyboardExtension *mpKbdExtension; 342cdf0e10cSrcweir 343cdf0e10cSrcweir AttributeProvider *mpFactory; 344cdf0e10cSrcweir 345cdf0e10cSrcweir Display *pDisp_; // X Display 346cdf0e10cSrcweir int m_nDefaultScreen; // XDefaultScreen 347cdf0e10cSrcweir std::vector< ScreenData > m_aScreens; 348cdf0e10cSrcweir ScreenData m_aInvalidScreenData; 349cdf0e10cSrcweir Pair aResolution_; // [dpi] 350cdf0e10cSrcweir bool mbExactResolution; 351cdf0e10cSrcweir sal_uLong nMaxRequestSize_; // [byte] 352cdf0e10cSrcweir 353cdf0e10cSrcweir srv_vendor_t meServerVendor; 354cdf0e10cSrcweir SalWM eWindowManager_; 355cdf0e10cSrcweir sal_uLong nProperties_; // PROPERTY_SUPPORT, BUG, FEATURE 356cdf0e10cSrcweir sal_Bool bLocal_; // Server==Client? Init 357cdf0e10cSrcweir // in SalDisplay::IsLocal() 358cdf0e10cSrcweir sal_Bool mbLocalIsValid; // bLocal_ is valid ? 359cdf0e10cSrcweir // until x bytes 360cdf0e10cSrcweir 361cdf0e10cSrcweir oslMutex hEventGuard_; 362cdf0e10cSrcweir std::list< SalUserEvent > m_aUserEvents; 363cdf0e10cSrcweir 364cdf0e10cSrcweir XLIB_Cursor aPointerCache_[POINTER_COUNT]; 365cdf0e10cSrcweir SalFrame* m_pCapture; 366cdf0e10cSrcweir 367cdf0e10cSrcweir // Keyboard 368cdf0e10cSrcweir sal_Bool bNumLockFromXS_; // Num Lock handled by X Server 369cdf0e10cSrcweir int nNumLockIndex_; // modifier index in modmap 370cdf0e10cSrcweir int nNumLockMask_; // keyevent state mask for 371cdf0e10cSrcweir KeySym nShiftKeySym_; // first shift modifier 372cdf0e10cSrcweir KeySym nCtrlKeySym_; // first control modifier 373cdf0e10cSrcweir KeySym nMod1KeySym_; // first mod1 modifier 374cdf0e10cSrcweir ByteString m_aKeyboardName; 375cdf0e10cSrcweir 376cdf0e10cSrcweir vcl_sal::WMAdaptor* m_pWMAdaptor; 377cdf0e10cSrcweir DtIntegrator* m_pDtIntegrator; 378cdf0e10cSrcweir 379cdf0e10cSrcweir bool m_bXinerama; 380cdf0e10cSrcweir std::vector< Rectangle > m_aXineramaScreens; 381cdf0e10cSrcweir std::list<SalFrame*> m_aFrames; 382cdf0e10cSrcweir std::list<SalObject*> m_aSalObjects; 383cdf0e10cSrcweir 384cdf0e10cSrcweir bool m_bUseRandRWrapper; // don't use randr on gtk, use gdk signals there 385cdf0e10cSrcweir 386cdf0e10cSrcweir mutable XLIB_Time m_nLastUserEventTime; // mutable because changed on first access 387cdf0e10cSrcweir 388cdf0e10cSrcweir virtual long Dispatch( XEvent *pEvent ) = 0; 389cdf0e10cSrcweir void InitXinerama(); 390cdf0e10cSrcweir void InitRandR( XLIB_Window aRoot ) const; 391cdf0e10cSrcweir void DeInitRandR(); 392cdf0e10cSrcweir int processRandREvent( XEvent* ); 393cdf0e10cSrcweir 394cdf0e10cSrcweir void doDestruct(); 395cdf0e10cSrcweir int addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ); 396cdf0e10cSrcweir public: 397cdf0e10cSrcweir static SalDisplay *GetSalDisplay( Display* display ); 398cdf0e10cSrcweir static sal_Bool BestVisual( Display *pDisp, 399cdf0e10cSrcweir int nScreen, 400cdf0e10cSrcweir XVisualInfo &rVI ); 401cdf0e10cSrcweir 402cdf0e10cSrcweir SalDisplay( Display* pDisp ); 403cdf0e10cSrcweir 404cdf0e10cSrcweir virtual ~SalDisplay(); 405cdf0e10cSrcweir 406cdf0e10cSrcweir 407cdf0e10cSrcweir virtual void registerFrame( SalFrame* pFrame ); 408cdf0e10cSrcweir virtual void deregisterFrame( SalFrame* pFrame ); 409cdf0e10cSrcweir void setHaveSystemChildFrame() const 410cdf0e10cSrcweir { pXLib_->setHaveSystemChildFrame(); } 411cdf0e10cSrcweir bool getHaveSystemChildFrame() const 412cdf0e10cSrcweir { return pXLib_->getHaveSystemChildFrame(); } 413cdf0e10cSrcweir 414cdf0e10cSrcweir void Init(); 415cdf0e10cSrcweir 416cdf0e10cSrcweir void SendInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT ); 417cdf0e10cSrcweir void CancelInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent ); 418cdf0e10cSrcweir bool DispatchInternalEvent(); 419cdf0e10cSrcweir void PrintInfo() const; 420cdf0e10cSrcweir 421cdf0e10cSrcweir void PrintEvent( const ByteString &rComment, 422cdf0e10cSrcweir XEvent *pEvent ) const; 423cdf0e10cSrcweir 424cdf0e10cSrcweir void Beep() const; 425cdf0e10cSrcweir 426cdf0e10cSrcweir void ModifierMapping(); 427cdf0e10cSrcweir String GetKeyNameFromKeySym( KeySym keysym ) const; 428cdf0e10cSrcweir XubString GetKeyName( sal_uInt16 nKeyCode ) const; 429cdf0e10cSrcweir sal_uInt16 GetKeyCode( KeySym keysym, char*pcPrintable ) const; 430cdf0e10cSrcweir KeySym GetKeySym( XKeyEvent *pEvent, 431cdf0e10cSrcweir unsigned char *pPrintable, 432cdf0e10cSrcweir int *pLen, 433cdf0e10cSrcweir KeySym *pUnmodifiedKeySym, 434cdf0e10cSrcweir Status *pStatus, 435cdf0e10cSrcweir XIC = NULL ) const; 436cdf0e10cSrcweir 437cdf0e10cSrcweir XLIB_Cursor GetPointer( int ePointerStyle ); 438cdf0e10cSrcweir virtual int CaptureMouse( SalFrame *pCapture ); 439cdf0e10cSrcweir 440cdf0e10cSrcweir sal_Bool IsLocal(); 441cdf0e10cSrcweir 442cdf0e10cSrcweir void Remove( XEvent *pEvent ); 443cdf0e10cSrcweir 444cdf0e10cSrcweir virtual void initScreen( int nScreen ) const; 445cdf0e10cSrcweir const ScreenData& getDataForScreen( int nScreen ) const 446cdf0e10cSrcweir { 447cdf0e10cSrcweir if( nScreen < 0 || nScreen >= static_cast<int>(m_aScreens.size()) ) 448cdf0e10cSrcweir return m_aInvalidScreenData; 449cdf0e10cSrcweir if( ! m_aScreens[nScreen].m_bInit ) 450cdf0e10cSrcweir initScreen( nScreen ); 451cdf0e10cSrcweir return m_aScreens[nScreen]; 452cdf0e10cSrcweir } 453cdf0e10cSrcweir 454cdf0e10cSrcweir XLIB_Window GetDrawable( int nScreen ) const { return getDataForScreen( nScreen ).m_aRefWindow; } 455cdf0e10cSrcweir Display *GetDisplay() const { return pDisp_; } 456cdf0e10cSrcweir int GetDefaultScreenNumber() const { return m_nDefaultScreen; } 457cdf0e10cSrcweir virtual int GetDefaultMonitorNumber() const { return 0; } 458cdf0e10cSrcweir const Size& GetScreenSize( int nScreen ) const { return getDataForScreen( nScreen ).m_aSize; } 459cdf0e10cSrcweir srv_vendor_t GetServerVendor() const { return meServerVendor; } 460cdf0e10cSrcweir void SetServerVendor() { meServerVendor = sal_GetServerVendor(pDisp_); } 461cdf0e10cSrcweir sal_Bool IsDisplay() const { return !!pXLib_; } 462cdf0e10cSrcweir GC GetMonoGC( int nScreen ) const { return getDataForScreen(nScreen).m_aMonoGC; } 463cdf0e10cSrcweir GC GetCopyGC( int nScreen ) const { return getDataForScreen(nScreen).m_aCopyGC; } 464cdf0e10cSrcweir GC GetAndInvertedGC( int nScreen ) const { return getDataForScreen(nScreen).m_aAndInvertedGC; } 465cdf0e10cSrcweir GC GetAndGC( int nScreen ) const { return getDataForScreen(nScreen).m_aAndGC; } 466cdf0e10cSrcweir GC GetOrGC( int nScreen ) const { return getDataForScreen(nScreen).m_aOrGC; } 467cdf0e10cSrcweir GC GetStippleGC( int nScreen ) const { return getDataForScreen(nScreen).m_aStippleGC; } 468cdf0e10cSrcweir GC GetGC( sal_uInt16 nDepth, int nScreen ) const; 469cdf0e10cSrcweir Pixmap GetInvert50( int nScreen ) const { return getDataForScreen(nScreen).m_hInvert50; } 470cdf0e10cSrcweir const SalColormap& GetColormap( int nScreen ) const { return getDataForScreen(nScreen).m_aColormap; } 471cdf0e10cSrcweir const SalVisual& GetVisual( int nScreen ) const { return getDataForScreen(nScreen).m_aVisual; } 472cdf0e10cSrcweir RenderEntryMap& GetRenderEntries( int nScreen ) const { return getDataForScreen(nScreen).m_aRenderData; } 473cdf0e10cSrcweir const Pair &GetResolution() const { return aResolution_; } 474cdf0e10cSrcweir bool GetExactResolution() const { return mbExactResolution; } 475cdf0e10cSrcweir sal_uLong GetProperties() const { return nProperties_; } 476cdf0e10cSrcweir sal_uLong GetMaxRequestSize() const { return nMaxRequestSize_; } 477cdf0e10cSrcweir XLIB_Time GetLastUserEventTime( bool bAlwaysReget = false ) const; 478cdf0e10cSrcweir 479cdf0e10cSrcweir bool XIfEventWithTimeout( XEvent*, XPointer, X_if_predicate, long i_nTimeout = 1000 ) const; 480cdf0e10cSrcweir 481cdf0e10cSrcweir sal_Bool MouseCaptured( const SalFrame *pFrameData ) const 482cdf0e10cSrcweir { return m_pCapture == pFrameData; } 483cdf0e10cSrcweir SalFrame* GetCaptureFrame() const 484cdf0e10cSrcweir { return m_pCapture; } 485cdf0e10cSrcweir SalXLib* GetXLib() const { return pXLib_; } 486cdf0e10cSrcweir 487cdf0e10cSrcweir SalI18N_InputMethod* GetInputMethod() const { return mpInputMethod; } 488cdf0e10cSrcweir SalI18N_KeyboardExtension* GetKbdExtension() const { return mpKbdExtension; } 489cdf0e10cSrcweir void SetInputMethod( SalI18N_InputMethod *pInputMethod ) 490cdf0e10cSrcweir { mpInputMethod = pInputMethod; } 491cdf0e10cSrcweir void SetKbdExtension(SalI18N_KeyboardExtension *pKbdExtension) 492cdf0e10cSrcweir { mpKbdExtension = pKbdExtension; } 493cdf0e10cSrcweir const char* GetKeyboardName( sal_Bool bRefresh = sal_False ); 494cdf0e10cSrcweir ::vcl_sal::WMAdaptor* getWMAdaptor() const { return m_pWMAdaptor; } 495cdf0e10cSrcweir DtIntegrator* getDtIntegrator() const { return m_pDtIntegrator; } 496cdf0e10cSrcweir bool IsXinerama() const { return m_bXinerama; } 497cdf0e10cSrcweir const std::vector< Rectangle >& GetXineramaScreens() const { return m_aXineramaScreens; } 498cdf0e10cSrcweir XLIB_Window GetRootWindow( int nScreen ) const 499cdf0e10cSrcweir { return getDataForScreen( nScreen ).m_aRoot; } 500cdf0e10cSrcweir const std::vector< ScreenData >& GetScreenData() 501cdf0e10cSrcweir { return m_aScreens; } 502cdf0e10cSrcweir int GetScreenCount() const { return static_cast<int>(m_aScreens.size()); } 503cdf0e10cSrcweir 504cdf0e10cSrcweir const std::list< SalFrame* >& getFrames() const 505cdf0e10cSrcweir { return m_aFrames; } 506cdf0e10cSrcweir 507cdf0e10cSrcweir sal_Bool IsNumLockFromXS() const { return bNumLockFromXS_; } 508cdf0e10cSrcweir 509cdf0e10cSrcweir std::list< SalObject* >& getSalObjects() { return m_aSalObjects; } 510cdf0e10cSrcweir }; 511cdf0e10cSrcweir 512cdf0e10cSrcweir // -=-= inlines =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 513cdf0e10cSrcweir 514cdf0e10cSrcweir inline GC SalDisplay::GetGC( sal_uInt16 nDepth, int nScreen ) const 515cdf0e10cSrcweir { return 1 == nDepth 516cdf0e10cSrcweir ? GetMonoGC( nScreen ) 517cdf0e10cSrcweir : getDataForScreen(nScreen).m_aVisual.GetDepth() == nDepth 518cdf0e10cSrcweir ? GetCopyGC( nScreen ) 519cdf0e10cSrcweir : None; } 520cdf0e10cSrcweir 521cdf0e10cSrcweir inline Display *SalColormap::GetXDisplay() const 522cdf0e10cSrcweir { return m_pDisplay->GetDisplay(); } 523cdf0e10cSrcweir 524cdf0e10cSrcweir class VCLPLUG_GEN_PUBLIC SalX11Display : public SalDisplay 525cdf0e10cSrcweir { 526cdf0e10cSrcweir public: 527cdf0e10cSrcweir SalX11Display( Display* pDisp ); 528cdf0e10cSrcweir virtual ~SalX11Display(); 529cdf0e10cSrcweir 530cdf0e10cSrcweir virtual long Dispatch( XEvent *pEvent ); 531cdf0e10cSrcweir virtual void Yield(); 532cdf0e10cSrcweir 533cdf0e10cSrcweir sal_Bool IsEvent(); 534cdf0e10cSrcweir }; 535cdf0e10cSrcweir 536cdf0e10cSrcweir /*---------------------------------------------------------- 537cdf0e10cSrcweir keep track of correct size of the initial window 538cdf0e10cSrcweir */ 539cdf0e10cSrcweir // get foreign key names 540cdf0e10cSrcweir namespace vcl_sal { 541cdf0e10cSrcweir String getKeysymReplacementName( 542cdf0e10cSrcweir const char* pKeyboard, 543cdf0e10cSrcweir KeySym nSymbol ); 544cdf0e10cSrcweir } 545cdf0e10cSrcweir 546cdf0e10cSrcweir 547cdf0e10cSrcweir #endif // _SV_SALDISP_HXX 548