LCOV - code coverage report
Current view: top level - vcl/inc/unx - salframe.h (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 17 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 15 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_VCL_INC_UNX_SALFRAME_H
      21             : #define INCLUDED_VCL_INC_UNX_SALFRAME_H
      22             : 
      23             : #include <prex.h>
      24             : #include <postx.h>
      25             : 
      26             : #include <unx/salunx.h>
      27             : #include <unx/saltype.h>
      28             : #include <unx/saldisp.hxx>
      29             : #include <unx/x11windowprovider.hxx>
      30             : #include <salframe.hxx>
      31             : #include <salwtype.hxx>
      32             : #include <salinst.hxx>
      33             : 
      34             : #include <vcl/ptrstyle.hxx>
      35             : #include <vcl/sysdata.hxx>
      36             : #include <vcl/timer.hxx>
      37             : #include <vclpluginapi.h>
      38             : 
      39             : #include <list>
      40             : 
      41             : class   X11SalGraphics;
      42             : class   SalI18N_InputContext;
      43             : 
      44             : namespace vcl_sal { class WMAdaptor; class NetWMAdaptor; class GnomeWMAdaptor; }
      45             : 
      46             : // X11SalFrame
      47             : #define SHOWSTATE_UNKNOWN       -1
      48             : #define SHOWSTATE_MINIMIZED     0
      49             : #define SHOWSTATE_NORMAL        1
      50             : #define SHOWSTATE_HIDDEN        2
      51             : 
      52             : class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame, public X11WindowProvider
      53             : {
      54             :     friend class vcl_sal::WMAdaptor;
      55             :     friend class vcl_sal::NetWMAdaptor;
      56             :     friend class vcl_sal::GnomeWMAdaptor;
      57             : 
      58             :     X11SalFrame*    mpParent;             // pointer to parent frame
      59             :                                           // which should never obscur this frame
      60             :     bool            mbTransientForRoot;
      61             :     std::list< X11SalFrame* > maChildren; // List of child frames
      62             : 
      63             :     SalDisplay     *pDisplay_;
      64             :     SalX11Screen    m_nXScreen;
      65             :     ::Window        mhWindow;
      66             :     ::Window        mhShellWindow;
      67             :     ::Window        mhForeignParent;
      68             :     // window to fall back to when no longer in fullscreen mode
      69             :     ::Window        mhStackingWindow;
      70             :     // window to listen for CirculateNotify events
      71             : 
      72             :     Pixmap          mhBackgroundPixmap;
      73             : 
      74             :     Cursor          hCursor_;
      75             :     int             nCaptured_;         // is captured
      76             : 
      77             :     X11SalGraphics  *pGraphics_;            // current frame graphics
      78             :     X11SalGraphics  *pFreeGraphics_;        // first free frame graphics
      79             : 
      80             :     sal_uInt16      nKeyCode_;          // last key code
      81             :     sal_uInt16      nKeyState_;         // last key state
      82             :     int             nCompose_;          // compose state
      83             :     bool            mbSendExtKeyModChange;
      84             :     sal_uInt16      mnExtKeyMod;
      85             : 
      86             :     int             nShowState_;        // show state
      87             :     int             nWidth_;            // client width
      88             :     int             nHeight_;           // client height
      89             :     Rectangle       maRestorePosSize;
      90             :     sal_uIntPtr         nStyle_;
      91             :     SalExtStyle     mnExtStyle;
      92             :     bool            bAlwaysOnTop_;
      93             :     bool            bViewable_;
      94             :     bool            bMapped_;
      95             :     bool            mbInShow;
      96             :     bool            bDefaultPosition_;  // client is centered initially
      97             :     bool            m_bXEmbed;
      98             :     int             nVisibility_;
      99             :     int             m_nWorkArea;
     100             :     bool            m_bSetFocusOnMap;
     101             : 
     102             :     int             nScreenSaversTimeout_;
     103             :     Rectangle       maPaintRegion;
     104             : 
     105             :     Timer           maAlwaysOnTopRaiseTimer;
     106             : 
     107             :     // data for WMAdaptor
     108             :     int             meWindowType;
     109             :     int             mnDecorationFlags;
     110             :     bool            mbMaximizedVert;
     111             :     bool            mbMaximizedHorz;
     112             :     bool            mbShaded;
     113             :     bool            mbFullScreen;
     114             : 
     115             :     // icon id
     116             :     int             mnIconID;
     117             : 
     118             :     OUString          m_aTitle;
     119             : 
     120             :     OUString   m_sWMClass;
     121             : 
     122             :     SystemEnvData maSystemChildData;
     123             : 
     124             :     SalI18N_InputContext *mpInputContext;
     125             :     Bool            mbInputFocus;
     126             : 
     127             :     XRectangle*     m_pClipRectangles;
     128             :     int             m_nCurClipRect;
     129             :     int             m_nMaxClipRect;
     130             : 
     131             :     bool mPendingSizeEvent;
     132             : 
     133             :     void            GetPosSize( Rectangle &rPosSize );
     134             :     void            SetSize   ( const Size      &rSize );
     135             :     void            Center();
     136             :     void            SetPosSize( const Rectangle &rPosSize );
     137             :     void            Minimize();
     138             :     void            Maximize();
     139             :     void            Restore();
     140             : 
     141             :     void            RestackChildren( ::Window* pTopLevelWindows, int nTopLevelWindows );
     142             :     void            RestackChildren();
     143             : 
     144             :     long            HandleKeyEvent      ( XKeyEvent         *pEvent );
     145             :     long            HandleMouseEvent    ( XEvent            *pEvent );
     146             :     long            HandleFocusEvent    ( XFocusChangeEvent *pEvent );
     147             :     long            HandleExposeEvent   ( XEvent            *pEvent );
     148             :     long            HandleSizeEvent     ( XConfigureEvent   *pEvent );
     149             :     long            HandleMapUnmapEvent ( XEvent            *pEvent );
     150             :     long            HandleStateEvent    ( XPropertyEvent    *pEvent );
     151             :     long            HandleReparentEvent ( XReparentEvent    *pEvent );
     152             :     long            HandleClientMessage ( XClientMessageEvent*pEvent );
     153             : 
     154             :     DECL_LINK_TYPED( HandleAlwaysOnTopRaise, Timer*, void );
     155             : 
     156             :     void            createNewWindow( ::Window aParent, SalX11Screen nXScreen = SalX11Screen( -1 ) );
     157             :     void            updateScreenNumber();
     158             : 
     159             :     void            setXEmbedInfo();
     160             :     void            askForXEmbedFocus( sal_Int32 i_nTimeCode );
     161             : 
     162             :     void            updateWMClass();
     163             : public:
     164             :     X11SalFrame( SalFrame* pParent, sal_uIntPtr nSalFrameStyle, SystemParentData* pSystemParent = NULL );
     165             :     virtual ~X11SalFrame();
     166             : 
     167             :     long            Dispatch( XEvent *pEvent );
     168             :     void            Init( sal_uIntPtr nSalFrameStyle, SalX11Screen nScreen = SalX11Screen( -1 ),
     169             :                           SystemParentData* pParentData = NULL, bool bUseGeometry = false );
     170             : 
     171           0 :     SalDisplay* GetDisplay() const
     172             :     {
     173           0 :         return pDisplay_;
     174             :     }
     175           0 :     Display *GetXDisplay() const
     176             :     {
     177           0 :         return pDisplay_->GetDisplay();
     178             :     }
     179             :     ::Window GetDrawable() const
     180             :     {
     181             :         return GetWindow();
     182             :     }
     183           0 :     SalX11Screen            GetScreenNumber() const { return m_nXScreen; }
     184           0 :     ::Window                GetWindow() const { return mhWindow; }
     185           0 :     ::Window                GetShellWindow() const { return mhShellWindow; }
     186           0 :     ::Window                GetForeignParent() const { return mhForeignParent; }
     187           0 :     ::Window                GetStackingWindow() const { return mhStackingWindow; }
     188             :     long                    ShutDown() const { return CallCallback( SALEVENT_SHUTDOWN, 0 ); }
     189           0 :     long                    Close() const { return CallCallback( SALEVENT_CLOSE, 0 ); }
     190             :               sal_uIntPtr           GetStyle() const { return nStyle_; }
     191             : 
     192           0 :     Cursor          GetCursor() const { return hCursor_; }
     193           0 :     bool            IsCaptured() const { return nCaptured_ == 1; }
     194             : #if !defined(__synchronous_extinput__)
     195             :     void            HandleExtTextEvent (XClientMessageEvent *pEvent);
     196             : #endif
     197             :     bool                    IsOverrideRedirect() const;
     198           0 :     bool                    IsChildWindow() const { return (nStyle_ & (SAL_FRAME_STYLE_PLUG|SAL_FRAME_STYLE_SYSTEMCHILD)) != 0; }
     199           0 :     bool                    IsSysChildWindow() const { return (nStyle_ & (SAL_FRAME_STYLE_SYSTEMCHILD)) != 0; }
     200             :     bool                    IsFloatGrabWindow() const;
     201           0 :     SalI18N_InputContext* getInputContext() const { return mpInputContext; }
     202             :     void                    getPosSize( Rectangle& rRect ) { GetPosSize( rRect ); }
     203             :     void                    setPosSize( const Rectangle& rRect ) { SetPosSize( rRect ); }
     204           0 :     bool                    isMapped() const { return bMapped_; }
     205           0 :     bool                    hasFocus() const { return mbInputFocus; }
     206             : 
     207             :     void                    beginUnicodeSequence();
     208             :     bool                    appendUnicodeSequence( sal_Unicode );
     209             :     bool                    endUnicodeSequence();
     210             : 
     211             :     virtual SalGraphics*        AcquireGraphics() SAL_OVERRIDE;
     212             :     virtual void                ReleaseGraphics( SalGraphics* pGraphics ) SAL_OVERRIDE;
     213             : 
     214             :     // call with true to clear graphics (setting None as drawable)
     215             :     // call with false to setup graphics with window (GetWindow())
     216             :     virtual void                updateGraphics( bool bClear );
     217             : 
     218             :     virtual bool                PostEvent( void* pData ) SAL_OVERRIDE;
     219             : 
     220             :     virtual void                SetTitle( const OUString& rTitle ) SAL_OVERRIDE;
     221             :     virtual void                SetIcon( sal_uInt16 nIcon ) SAL_OVERRIDE;
     222             :     virtual void                SetMenu( SalMenu* pMenu ) SAL_OVERRIDE;
     223             :     virtual void                                DrawMenuBar() SAL_OVERRIDE;
     224             : 
     225             :     virtual void                SetExtendedFrameStyle( SalExtStyle nExtStyle ) SAL_OVERRIDE;
     226             :     virtual void                Show( bool bVisible, bool bNoActivate = false ) SAL_OVERRIDE;
     227             :     virtual void                SetMinClientSize( long nWidth, long nHeight ) SAL_OVERRIDE;
     228             :     virtual void                SetMaxClientSize( long nWidth, long nHeight ) SAL_OVERRIDE;
     229             :     virtual void                SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) SAL_OVERRIDE;
     230             :     virtual void                GetClientSize( long& rWidth, long& rHeight ) SAL_OVERRIDE;
     231             :     virtual void                GetWorkArea( Rectangle& rRect ) SAL_OVERRIDE;
     232             :     virtual SalFrame*           GetParent() const SAL_OVERRIDE;
     233             :     virtual void                SetWindowState( const SalFrameState* pState ) SAL_OVERRIDE;
     234             :     virtual bool                GetWindowState( SalFrameState* pState ) SAL_OVERRIDE;
     235             :     virtual void                ShowFullScreen( bool bFullScreen, sal_Int32 nMonitor ) SAL_OVERRIDE;
     236             :     virtual void                StartPresentation( bool bStart ) SAL_OVERRIDE;
     237             :     virtual void                SetAlwaysOnTop( bool bOnTop ) SAL_OVERRIDE;
     238             :     virtual void                ToTop( sal_uInt16 nFlags ) SAL_OVERRIDE;
     239             :     virtual void                SetPointer( PointerStyle ePointerStyle ) SAL_OVERRIDE;
     240             :     virtual void                CaptureMouse( bool bMouse ) SAL_OVERRIDE;
     241             :     virtual void                SetPointerPos( long nX, long nY ) SAL_OVERRIDE;
     242             :     using SalFrame::Flush;
     243             :     virtual void                Flush() SAL_OVERRIDE;
     244             :     virtual void                Sync() SAL_OVERRIDE;
     245             :     virtual void                SetInputContext( SalInputContext* pContext ) SAL_OVERRIDE;
     246             :     virtual void                EndExtTextInput( EndExtTextInputFlags nFlags ) SAL_OVERRIDE;
     247             :     virtual OUString              GetKeyName( sal_uInt16 nKeyCode ) SAL_OVERRIDE;
     248             :     virtual bool                MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) SAL_OVERRIDE;
     249             :     virtual LanguageType        GetInputLanguage() SAL_OVERRIDE;
     250             :     virtual void                UpdateSettings( AllSettings& rSettings ) SAL_OVERRIDE;
     251             :     virtual void                Beep() SAL_OVERRIDE;
     252             :     virtual const SystemEnvData*    GetSystemData() const SAL_OVERRIDE;
     253             :     virtual SalPointerState     GetPointerState() SAL_OVERRIDE;
     254             :     virtual KeyIndicatorState   GetIndicatorState() SAL_OVERRIDE;
     255             :     virtual void                SimulateKeyPress( sal_uInt16 nKeyCode ) SAL_OVERRIDE;
     256             :     virtual void                SetParent( SalFrame* pNewParent ) SAL_OVERRIDE;
     257             :     virtual bool                SetPluginParent( SystemParentData* pNewParent ) SAL_OVERRIDE;
     258             : 
     259             :     virtual void                SetScreenNumber( unsigned int ) SAL_OVERRIDE;
     260             :     virtual void                SetApplicationID( const OUString &rWMClass ) SAL_OVERRIDE;
     261             : 
     262             :     // shaped system windows
     263             :     // set clip region to none (-> rectangular windows, normal state)
     264             :     virtual void                    ResetClipRegion() SAL_OVERRIDE;
     265             :     // start setting the clipregion consisting of nRects rectangles
     266             :     virtual void                    BeginSetClipRegion( sal_uIntPtr nRects ) SAL_OVERRIDE;
     267             :     // add a rectangle to the clip region
     268             :     virtual void                    UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) SAL_OVERRIDE;
     269             :     // done setting up the clipregion
     270             :     virtual void                    EndSetClipRegion() SAL_OVERRIDE;
     271             : 
     272             :     virtual Window GetX11Window() SAL_OVERRIDE;
     273             : 
     274             :     static Bool checkKeyReleaseForRepeat( Display*, XEvent*, XPointer pX11SalFrame );
     275             : 
     276             :     /// @internal
     277             :     void setPendingSizeEvent();
     278             : };
     279             : 
     280             : #endif // INCLUDED_VCL_INC_UNX_SALFRAME_H
     281             : 
     282             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11