LCOV - code coverage report
Current view: top level - libreoffice/vcl/unx/generic/app - wmadaptor.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 911 0.0 %
Date: 2012-12-27 Functions: 0 52 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             : 
      21             : #include <string.h>
      22             : #include <stdio.h>
      23             : #include <stdlib.h>
      24             : 
      25             : #include "sal/alloca.h"
      26             : #include "rtl/locale.h"
      27             : 
      28             : #include "osl/thread.h"
      29             : #include "osl/process.h"
      30             : #include <sal/macros.h>
      31             : #include "vcl/configsettings.hxx"
      32             : 
      33             : #include "unx/wmadaptor.hxx"
      34             : #include "unx/saldisp.hxx"
      35             : #include "unx/saldata.hxx"
      36             : #include "unx/salframe.h"
      37             : 
      38             : #include "salgdi.hxx"
      39             : 
      40             : #include "tools/prex.h"
      41             : #include <X11/X.h>
      42             : #include <X11/Xatom.h>
      43             : #include <X11/Xresource.h>
      44             : #include "tools/postx.h"
      45             : 
      46             : #if OSL_DEBUG_LEVEL > 1
      47             : #include <stdio.h>
      48             : #endif
      49             : 
      50             : namespace vcl_sal {
      51             : 
      52             : class NetWMAdaptor : public WMAdaptor
      53             : {
      54             :     void setNetWMState( X11SalFrame* pFrame ) const;
      55             :     void initAtoms();
      56             :     virtual bool isValid() const;
      57             : public:
      58             :     NetWMAdaptor( SalDisplay* );
      59             :     virtual ~NetWMAdaptor();
      60             : 
      61             :     virtual void setWMName( X11SalFrame* pFrame, const String& rWMName ) const;
      62             :     virtual void maximizeFrame( X11SalFrame* pFrame, bool bHorizontal = true, bool bVertical = true ) const;
      63             :     virtual void shade( X11SalFrame* pFrame, bool bToShaded ) const;
      64             :     virtual void setFrameTypeAndDecoration( X11SalFrame* pFrame, WMWindowType eType, int nDecorationFlags, X11SalFrame* pTransientFrame = NULL ) const;
      65             :     virtual void enableAlwaysOnTop( X11SalFrame* pFrame, bool bEnable ) const;
      66             :     virtual int handlePropertyNotify( X11SalFrame* pFrame, XPropertyEvent* pEvent ) const;
      67             :     virtual void showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const;
      68             :     virtual void frameIsMapping( X11SalFrame* pFrame ) const;
      69             :     virtual void setFrameStruts( X11SalFrame* pFrame,
      70             :                                  int left, int right, int top, int bottom,
      71             :                                  int left_start_y, int left_end_y,
      72             :                                  int right_start_y, int right_end_y,
      73             :                                  int top_start_x, int top_end_x,
      74             :                                  int bottom_start_x, int bottom_end_x ) const;
      75             :     virtual void setUserTime( X11SalFrame* i_pFrame, long i_nUserTime ) const;
      76             : };
      77             : 
      78             : class GnomeWMAdaptor : public WMAdaptor
      79             : {
      80             :     bool m_bValid;
      81             : 
      82             :     void setGnomeWMState( X11SalFrame* pFrame ) const;
      83             :     void initAtoms();
      84             :     virtual bool isValid() const;
      85             : public:
      86             :     GnomeWMAdaptor( SalDisplay * );
      87             :     virtual ~GnomeWMAdaptor();
      88             : 
      89             :     virtual void maximizeFrame( X11SalFrame* pFrame, bool bHorizontal = true, bool bVertical = true ) const;
      90             :     virtual void shade( X11SalFrame* pFrame, bool bToShaded ) const;
      91             :     virtual void enableAlwaysOnTop( X11SalFrame* pFrame, bool bEnable ) const;
      92             :     virtual int handlePropertyNotify( X11SalFrame* pFrame, XPropertyEvent* pEvent ) const;
      93             : };
      94             : 
      95             : }
      96             : 
      97             : using namespace vcl_sal;
      98             : 
      99             : struct WMAdaptorProtocol
     100             : {
     101             :     const char* pProtocol;
     102             :     int             nProtocol;
     103             : };
     104             : 
     105             : 
     106             : /*
     107             :  *  table must be sorted ascending in strings
     108             :  *  since it is use with bsearch
     109             :  */
     110             : static const WMAdaptorProtocol aProtocolTab[] =
     111             : {
     112             :     { "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE", WMAdaptor::KDE_NET_WM_WINDOW_TYPE_OVERRIDE },
     113             :     { "_NET_CURRENT_DESKTOP", WMAdaptor::NET_CURRENT_DESKTOP },
     114             :     { "_NET_NUMBER_OF_DESKTOPS", WMAdaptor::NET_NUMBER_OF_DESKTOPS },
     115             :     { "_NET_WM_DESKTOP", WMAdaptor::NET_WM_DESKTOP },
     116             :     { "_NET_WM_ICON_NAME", WMAdaptor::NET_WM_ICON_NAME },
     117             :     { "_NET_WM_PING", WMAdaptor::NET_WM_PING },
     118             :     { "_NET_WM_STATE", WMAdaptor::NET_WM_STATE },
     119             :     { "_NET_WM_STATE_ABOVE", WMAdaptor::NET_WM_STATE_STAYS_ON_TOP },
     120             :     { "_NET_WM_STATE_FULLSCREEN", WMAdaptor::NET_WM_STATE_FULLSCREEN },
     121             :     { "_NET_WM_STATE_MAXIMIZED_HORIZ", WMAdaptor::NET_WM_STATE_MAXIMIZED_HORZ }, // common bug in e.g. older kwin and sawfish implementations
     122             :     { "_NET_WM_STATE_MAXIMIZED_HORZ", WMAdaptor::NET_WM_STATE_MAXIMIZED_HORZ },
     123             :     { "_NET_WM_STATE_MAXIMIZED_VERT", WMAdaptor::NET_WM_STATE_MAXIMIZED_VERT },
     124             :     { "_NET_WM_STATE_MODAL", WMAdaptor::NET_WM_STATE_MODAL },
     125             :     { "_NET_WM_STATE_SHADED", WMAdaptor::NET_WM_STATE_SHADED },
     126             :     { "_NET_WM_STATE_SKIP_PAGER", WMAdaptor::NET_WM_STATE_SKIP_PAGER },
     127             :     { "_NET_WM_STATE_SKIP_TASKBAR", WMAdaptor::NET_WM_STATE_SKIP_TASKBAR },
     128             :     { "_NET_WM_STATE_STAYS_ON_TOP", WMAdaptor::NET_WM_STATE_STAYS_ON_TOP },
     129             :     { "_NET_WM_STATE_STICKY", WMAdaptor::NET_WM_STATE_STICKY },
     130             :     { "_NET_WM_STRUT", WMAdaptor::NET_WM_STRUT },
     131             :     { "_NET_WM_STRUT_PARTIAL", WMAdaptor::NET_WM_STRUT_PARTIAL },
     132             :     { "_NET_WM_WINDOW_TYPE", WMAdaptor::NET_WM_WINDOW_TYPE },
     133             :     { "_NET_WM_WINDOW_TYPE_DESKTOP", WMAdaptor::NET_WM_WINDOW_TYPE_DESKTOP },
     134             :     { "_NET_WM_WINDOW_TYPE_DIALOG", WMAdaptor::NET_WM_WINDOW_TYPE_DIALOG },
     135             :     { "_NET_WM_WINDOW_TYPE_DOCK", WMAdaptor::NET_WM_WINDOW_TYPE_DOCK },
     136             :     { "_NET_WM_WINDOW_TYPE_MENU", WMAdaptor::NET_WM_WINDOW_TYPE_MENU },
     137             :     { "_NET_WM_WINDOW_TYPE_NORMAL", WMAdaptor::NET_WM_WINDOW_TYPE_NORMAL },
     138             :     { "_NET_WM_WINDOW_TYPE_SPLASH", WMAdaptor::NET_WM_WINDOW_TYPE_SPLASH },
     139             :     { "_NET_WM_WINDOW_TYPE_SPLASHSCREEN", WMAdaptor::NET_WM_WINDOW_TYPE_SPLASH }, // bug in Metacity 2.4.1
     140             :     { "_NET_WM_WINDOW_TYPE_TOOLBAR", WMAdaptor::NET_WM_WINDOW_TYPE_TOOLBAR },
     141             :     { "_NET_WM_WINDOW_TYPE_UTILITY", WMAdaptor::NET_WM_WINDOW_TYPE_UTILITY },
     142             :     { "_NET_WORKAREA", WMAdaptor::NET_WORKAREA },
     143             :     { "_WIN_APP_STATE", WMAdaptor::WIN_APP_STATE },
     144             :     { "_WIN_CLIENT_LIST", WMAdaptor::WIN_CLIENT_LIST },
     145             :     { "_WIN_EXPANDED_SIZE", WMAdaptor::WIN_EXPANDED_SIZE },
     146             :     { "_WIN_HINTS", WMAdaptor::WIN_HINTS },
     147             :     { "_WIN_ICONS", WMAdaptor::WIN_ICONS },
     148             :     { "_WIN_LAYER", WMAdaptor::WIN_LAYER },
     149             :     { "_WIN_STATE", WMAdaptor::WIN_STATE },
     150             :     { "_WIN_WORKSPACE", WMAdaptor::WIN_WORKSPACE },
     151             :     { "_WIN_WORKSPACE_COUNT", WMAdaptor::WIN_WORKSPACE_COUNT }
     152             : };
     153             : 
     154             : /*
     155             :  *  table containing atoms to get anyway
     156             :  */
     157             : 
     158             : static const WMAdaptorProtocol aAtomTab[] =
     159             : {
     160             :     { "WM_STATE", WMAdaptor::WM_STATE },
     161             :     { "_MOTIF_WM_HINTS", WMAdaptor::MOTIF_WM_HINTS },
     162             :     { "WM_PROTOCOLS", WMAdaptor::WM_PROTOCOLS },
     163             :     { "WM_DELETE_WINDOW", WMAdaptor::WM_DELETE_WINDOW },
     164             :     { "WM_TAKE_FOCUS", WMAdaptor::WM_TAKE_FOCUS },
     165             :     { "WM_COMMAND", WMAdaptor::WM_COMMAND },
     166             :     { "WM_CLIENT_LEADER", WMAdaptor::WM_CLIENT_LEADER },
     167             :     { "WM_LOCALE_NAME", WMAdaptor::WM_LOCALE_NAME },
     168             :     { "WM_TRANSIENT_FOR", WMAdaptor::WM_TRANSIENT_FOR },
     169             :     { "SAL_QUITEVENT", WMAdaptor::SAL_QUITEVENT },
     170             :     { "SAL_USEREVENT", WMAdaptor::SAL_USEREVENT },
     171             :     { "SAL_EXTTEXTEVENT", WMAdaptor::SAL_EXTTEXTEVENT },
     172             :     { "SAL_GETTIMEEVENT", WMAdaptor::SAL_GETTIMEEVENT },
     173             :     { "VCL_SYSTEM_SETTINGS", WMAdaptor::VCL_SYSTEM_SETTINGS },
     174             :     { "_XSETTINGS_SETTINGS", WMAdaptor::XSETTINGS },
     175             :     { "_XEMBED", WMAdaptor::XEMBED },
     176             :     { "_XEMBED_INFO", WMAdaptor::XEMBED_INFO },
     177             :     { "_NET_WM_USER_TIME", WMAdaptor::NET_WM_USER_TIME },
     178             :     { "_NET_WM_PID", WMAdaptor::NET_WM_PID }
     179             : };
     180             : 
     181             : extern "C" {
     182           0 : static int compareProtocol( const void* pLeft, const void* pRight )
     183             : {
     184           0 :     return strcmp( ((const WMAdaptorProtocol*)pLeft)->pProtocol, ((const WMAdaptorProtocol*)pRight)->pProtocol );
     185             : }
     186             : }
     187             : 
     188           0 : WMAdaptor* WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay )
     189             : {
     190           0 :     WMAdaptor*          pAdaptor    = NULL;
     191             : 
     192             :     // try a NetWM
     193           0 :     pAdaptor = new NetWMAdaptor( pSalDisplay );
     194           0 :     if( ! pAdaptor->isValid() )
     195           0 :         delete pAdaptor, pAdaptor = NULL;
     196             : #if OSL_DEBUG_LEVEL > 1
     197             :     else
     198             :         fprintf( stderr, "WM supports extended WM hints\n" );
     199             : #endif
     200             : 
     201             :     // try a GnomeWM
     202           0 :     if( ! pAdaptor )
     203             :     {
     204           0 :         pAdaptor = new GnomeWMAdaptor( pSalDisplay );
     205           0 :         if( ! pAdaptor->isValid() )
     206           0 :             delete pAdaptor, pAdaptor = NULL;
     207             : #if OSL_DEBUG_LEVEL > 1
     208             :         else
     209             :             fprintf( stderr, "WM supports GNOME WM hints\n" );
     210             : #endif
     211             :     }
     212             : 
     213           0 :     if( ! pAdaptor )
     214           0 :         pAdaptor = new WMAdaptor( pSalDisplay );
     215             : 
     216             : #if OSL_DEBUG_LEVEL > 1
     217             :     fprintf(stderr, "Window Manager's name is \"%s\"\n",
     218             :         rtl::OUStringToOString(pAdaptor->getWindowManagerName(),
     219             :         RTL_TEXTENCODING_UTF8).getStr());
     220             : #endif
     221           0 :     return pAdaptor;
     222             : }
     223             : 
     224             : 
     225             : /*
     226             :  *  WMAdaptor constructor
     227             :  */
     228             : 
     229           0 : WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) :
     230             :         m_pSalDisplay( pDisplay ),
     231             :         m_bTransientBehaviour( true ),
     232             :         m_bEnableAlwaysOnTopWorks( false ),
     233             :         m_bLegacyPartialFullscreen( false ),
     234             :         m_nWinGravity( StaticGravity ),
     235             :         m_nInitWinGravity( StaticGravity ),
     236             :         m_bWMshouldSwitchWorkspace( true ),
     237           0 :         m_bWMshouldSwitchWorkspaceInit( false )
     238             : {
     239           0 :     Atom                aRealType   = None;
     240           0 :     int                 nFormat     = 8;
     241           0 :     unsigned long       nItems      = 0;
     242           0 :     unsigned long       nBytesLeft  = 0;
     243           0 :     unsigned char*  pProperty   = NULL;
     244             : 
     245             :     // default desktops
     246           0 :     m_nDesktops = 1;
     247             :     m_aWMWorkAreas = ::std::vector< Rectangle >
     248           0 :         ( 1, Rectangle( Point(), m_pSalDisplay->GetScreenSize( m_pSalDisplay->GetDefaultXScreen() ) ) );
     249           0 :     m_bEqualWorkAreas = true;
     250             : 
     251           0 :     memset( m_aWMAtoms, 0, sizeof( m_aWMAtoms ) );
     252           0 :     m_pDisplay = m_pSalDisplay->GetDisplay();
     253             : 
     254           0 :     initAtoms();
     255           0 :     getNetWmName(); // try to discover e.g. Sawfish
     256             : 
     257           0 :     if( m_aWMName.Len() == 0 )
     258             :     {
     259             :         // check for ReflectionX wm (as it needs a workaround in Windows mode
     260           0 :         Atom aRwmRunning = XInternAtom( m_pDisplay, "RWM_RUNNING", True );
     261           0 :         if( aRwmRunning != None &&
     262             :             XGetWindowProperty( m_pDisplay,
     263             :                                 m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
     264             :                                 aRwmRunning,
     265             :                                 0, 32,
     266             :                                 False,
     267             :                                 aRwmRunning,
     268             :                                 &aRealType,
     269             :                                 &nFormat,
     270             :                                 &nItems,
     271             :                                 &nBytesLeft,
     272           0 :                                 &pProperty ) == 0 )
     273             :         {
     274           0 :             if( aRealType == aRwmRunning )
     275           0 :                 m_aWMName = String( RTL_CONSTASCII_USTRINGPARAM("ReflectionX" ) );
     276           0 :             XFree( pProperty );
     277             :         }
     278           0 :         else if( (aRwmRunning = XInternAtom( m_pDisplay, "_WRQ_WM_RUNNING", True )) != None &&
     279             :             XGetWindowProperty( m_pDisplay,
     280             :                                 m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
     281             :                                 aRwmRunning,
     282             :                                 0, 32,
     283             :                                 False,
     284             :                                 XA_STRING,
     285             :                                 &aRealType,
     286             :                                 &nFormat,
     287             :                                 &nItems,
     288             :                                 &nBytesLeft,
     289           0 :                                 &pProperty ) == 0 )
     290             :         {
     291           0 :             if( aRealType == XA_STRING )
     292           0 :                 m_aWMName = String( RTL_CONSTASCII_USTRINGPARAM( "ReflectionX Windows" ) );
     293           0 :             XFree( pProperty );
     294             :         }
     295             :     }
     296           0 :     if( m_aWMName.Len() == 0 )
     297             :     {
     298           0 :         Atom aTTAPlatform = XInternAtom( m_pDisplay, "TTA_CLIENT_PLATFORM", True );
     299           0 :         if( aTTAPlatform != None &&
     300             :             XGetWindowProperty( m_pDisplay,
     301             :                                 m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
     302             :                                 aTTAPlatform,
     303             :                                 0, 32,
     304             :                                 False,
     305             :                                 XA_STRING,
     306             :                                 &aRealType,
     307             :                                 &nFormat,
     308             :                                 &nItems,
     309             :                                 &nBytesLeft,
     310           0 :                                 &pProperty ) == 0 )
     311             :         {
     312           0 :             if( aRealType == XA_STRING )
     313             :             {
     314           0 :                 m_aWMName = String( RTL_CONSTASCII_USTRINGPARAM("Tarantella" ) );
     315             :                 // #i62319# pretend that AlwaysOnTop works since
     316             :                 // the alwaysontop workaround in salframe.cxx results
     317             :                 // in a raise/lower loop on a Windows tarantella client
     318             :                 // FIXME: this property contains an identification string that
     319             :                 // in theory should be good enough to recognize running on a
     320             :                 // Windows client; however this string does not seem to be
     321             :                 // documented as well as the property itself.
     322           0 :                 m_bEnableAlwaysOnTopWorks = true;
     323             :             }
     324           0 :             XFree( pProperty );
     325             :         }
     326             :     }
     327           0 : }
     328             : 
     329             : /*
     330             :  *  WMAdaptor destructor
     331             :  */
     332             : 
     333           0 : WMAdaptor::~WMAdaptor()
     334             : {
     335           0 : }
     336             : 
     337             : /*
     338             :  *  NetWMAdaptor constructor
     339             :  */
     340             : 
     341           0 : NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
     342           0 :         WMAdaptor( pSalDisplay )
     343             : {
     344             :     // currently all _NET WMs do transient like expected
     345           0 :     m_bTransientBehaviour = true;
     346             : 
     347           0 :     Atom                aRealType   = None;
     348           0 :     int                 nFormat     = 8;
     349           0 :     unsigned long       nItems      = 0;
     350           0 :     unsigned long       nBytesLeft  = 0;
     351           0 :     unsigned char*  pProperty   = NULL;
     352             : 
     353           0 :     initAtoms();
     354             : 
     355             :     // check for NetWM
     356           0 :     bool bNetWM = getNetWmName();
     357           0 :     if( bNetWM
     358             :         && XGetWindowProperty( m_pDisplay,
     359             :                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
     360             :                                m_aWMAtoms[ NET_SUPPORTED ],
     361             :                                0, 0,
     362             :                                False,
     363             :                                XA_ATOM,
     364             :                                &aRealType,
     365             :                                &nFormat,
     366             :                                &nItems,
     367             :                                &nBytesLeft,
     368           0 :                                &pProperty ) == 0
     369             :         && aRealType == XA_ATOM
     370             :         && nFormat == 32
     371             :         )
     372             :     {
     373           0 :         if( pProperty )
     374             :         {
     375           0 :             XFree( pProperty );
     376           0 :             pProperty = NULL;
     377             :         }
     378             :         // collect supported protocols
     379           0 :         if( XGetWindowProperty( m_pDisplay,
     380             :                                 m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
     381             :                                 m_aWMAtoms[ NET_SUPPORTED ],
     382             :                                 0, nBytesLeft/4,
     383             :                                 False,
     384             :                                 XA_ATOM,
     385             :                                 &aRealType,
     386             :                                 &nFormat,
     387             :                                 &nItems,
     388             :                                 &nBytesLeft,
     389           0 :                                 &pProperty ) == 0
     390             :             && nItems
     391             :             )
     392             :         {
     393           0 :             Atom* pAtoms = (Atom*)pProperty;
     394           0 :             char** pAtomNames = (char**)alloca( sizeof(char*)*nItems );
     395           0 :             if( XGetAtomNames( m_pDisplay, pAtoms, nItems, pAtomNames ) )
     396             :             {
     397             : #if OSL_DEBUG_LEVEL > 1
     398             :                 fprintf( stderr, "supported protocols:\n" );
     399             : #endif
     400           0 :                 for( unsigned int i = 0; i < nItems; i++ )
     401             :                 {
     402             :                     // #i80971# protect against invalid atoms
     403           0 :                     if( pAtomNames[i] == NULL )
     404           0 :                         continue;
     405             : 
     406             :                     WMAdaptorProtocol aSearch;
     407           0 :                     aSearch.pProtocol = pAtomNames[i];
     408             :                     WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*)
     409             :                         bsearch( &aSearch,
     410             :                                  aProtocolTab,
     411             :                                  SAL_N_ELEMENTS( aProtocolTab ),
     412             :                                  sizeof( struct WMAdaptorProtocol ),
     413           0 :                                  compareProtocol );
     414           0 :                     if( pMatch )
     415             :                     {
     416           0 :                         m_aWMAtoms[ pMatch->nProtocol ] = pAtoms[ i ];
     417           0 :                         if( pMatch->nProtocol == NET_WM_STATE_STAYS_ON_TOP )
     418           0 :                             m_bEnableAlwaysOnTopWorks = true;
     419             :                     }
     420             : #if OSL_DEBUG_LEVEL > 1
     421             :                     fprintf( stderr, "  %s%s\n", pAtomNames[i], ((pMatch)&&(pMatch->nProtocol != -1)) ? "" : " (unsupported)" );
     422             : #endif
     423           0 :                     XFree( pAtomNames[i] );
     424             :                 }
     425             :             }
     426           0 :             XFree( pProperty );
     427           0 :             pProperty = NULL;
     428             :         }
     429           0 :         else if( pProperty )
     430             :         {
     431           0 :             XFree( pProperty );
     432           0 :             pProperty = NULL;
     433             :         }
     434             : 
     435             :         // get number of desktops
     436           0 :         if( m_aWMAtoms[ NET_NUMBER_OF_DESKTOPS ]
     437             :             && XGetWindowProperty( m_pDisplay,
     438             :                                    m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
     439             :                                    m_aWMAtoms[ NET_NUMBER_OF_DESKTOPS ],
     440             :                                    0, 1,
     441             :                                    False,
     442             :                                    XA_CARDINAL,
     443             :                                    &aRealType,
     444             :                                    &nFormat,
     445             :                                    &nItems,
     446             :                                    &nBytesLeft,
     447           0 :                                    &pProperty ) == 0
     448             :             && pProperty
     449             :             )
     450             :         {
     451           0 :             m_nDesktops = *(long*)pProperty;
     452           0 :             XFree( pProperty );
     453           0 :             pProperty = NULL;
     454             :             // get work areas
     455           0 :             if( m_aWMAtoms[ NET_WORKAREA ]
     456             :                 && XGetWindowProperty( m_pDisplay,
     457             :                                        m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
     458             :                                        m_aWMAtoms[ NET_WORKAREA ],
     459             :                                        0, 4*m_nDesktops,
     460             :                                        False,
     461             :                                        XA_CARDINAL,
     462             :                                        &aRealType,
     463             :                                        &nFormat,
     464             :                                        &nItems,
     465             :                                        &nBytesLeft,
     466             :                                        &pProperty
     467           0 :                                        ) == 0
     468             :                 && nItems == 4*(unsigned)m_nDesktops
     469             :                 )
     470             :             {
     471           0 :                 m_aWMWorkAreas = ::std::vector< Rectangle > ( m_nDesktops );
     472           0 :                 long* pValues = (long*)pProperty;
     473           0 :                 for( int i = 0; i < m_nDesktops; i++ )
     474             :                 {
     475           0 :                     Point aPoint( pValues[4*i],
     476           0 :                                   pValues[4*i+1] );
     477           0 :                     Size aSize( pValues[4*i+2],
     478           0 :                                 pValues[4*i+3] );
     479           0 :                     Rectangle aWorkArea( aPoint, aSize );
     480           0 :                     m_aWMWorkAreas[i] = aWorkArea;
     481           0 :                     if( aWorkArea != m_aWMWorkAreas[0] )
     482           0 :                         m_bEqualWorkAreas = false;
     483             : #if OSL_DEBUG_LEVEL > 1
     484             :                     fprintf( stderr, "workarea %d: %ldx%ld+%ld+%ld\n",
     485             :                              i,
     486             :                              m_aWMWorkAreas[i].GetWidth(),
     487             :                              m_aWMWorkAreas[i].GetHeight(),
     488             :                              m_aWMWorkAreas[i].Left(),
     489             :                              m_aWMWorkAreas[i].Top() );
     490             : #endif
     491             :                 }
     492           0 :                 XFree( pProperty );
     493             :             }
     494             :             else
     495             :             {
     496             : #if OSL_DEBUG_LEVEL > 1
     497             :                 fprintf( stderr, "%ld workareas for %d desktops !\n", nItems/4, m_nDesktops );
     498             : #endif
     499           0 :                 if( pProperty )
     500             :                 {
     501           0 :                     XFree(pProperty);
     502           0 :                     pProperty = NULL;
     503             :                 }
     504             :             }
     505             :         }
     506           0 :         else if( pProperty )
     507             :         {
     508           0 :             XFree( pProperty );
     509           0 :             pProperty = NULL;
     510             :         }
     511             :     }
     512           0 :     else if( pProperty )
     513             :     {
     514           0 :         XFree( pProperty );
     515           0 :         pProperty = NULL;
     516             :     }
     517           0 : }
     518             : 
     519             : /*
     520             :  *  NetWMAdaptor destructor
     521             :  */
     522           0 : NetWMAdaptor::~NetWMAdaptor()
     523             : {
     524           0 : }
     525             : 
     526             : /*
     527             :  *  GnomeWMAdaptor constructor
     528             :  */
     529             : 
     530           0 : GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
     531             :         WMAdaptor( pSalDisplay ),
     532           0 :         m_bValid( false )
     533             : {
     534             :     // currently all Gnome WMs do transient like expected
     535           0 :     m_bTransientBehaviour = true;
     536             : 
     537           0 :     Atom                aRealType   = None;
     538           0 :     int                 nFormat     = 8;
     539           0 :     unsigned long       nItems      = 0;
     540           0 :     unsigned long       nBytesLeft  = 0;
     541           0 :     unsigned char*  pProperty   = NULL;
     542             : 
     543           0 :     initAtoms();
     544             : 
     545             :     // check for GnomeWM
     546           0 :     if( m_aWMAtoms[ WIN_SUPPORTING_WM_CHECK ] && m_aWMAtoms[ WIN_PROTOCOLS ] )
     547             :     {
     548           0 :         XLIB_Window         aWMChild    = None;
     549           0 :         if( XGetWindowProperty( m_pDisplay,
     550             :                                 m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
     551             :                                 m_aWMAtoms[ WIN_SUPPORTING_WM_CHECK ],
     552             :                                 0, 1,
     553             :                                 False,
     554             :                                 XA_CARDINAL,
     555             :                                 &aRealType,
     556             :                                 &nFormat,
     557             :                                 &nItems,
     558             :                                 &nBytesLeft,
     559           0 :                                 &pProperty ) == 0
     560             :             && aRealType == XA_CARDINAL
     561             :             && nFormat == 32
     562             :             && nItems != 0
     563             :             )
     564             :         {
     565           0 :             aWMChild = *(XLIB_Window*)pProperty;
     566           0 :             XFree( pProperty );
     567           0 :             pProperty = NULL;
     568           0 :             XLIB_Window aCheckWindow = None;
     569           0 :             GetGenericData()->ErrorTrapPush();
     570           0 :             if( XGetWindowProperty( m_pDisplay,
     571             :                                     aWMChild,
     572             :                                     m_aWMAtoms[ WIN_SUPPORTING_WM_CHECK ],
     573             :                                     0, 1,
     574             :                                     False,
     575             :                                     XA_CARDINAL,
     576             :                                     &aRealType,
     577             :                                     &nFormat,
     578             :                                     &nItems,
     579             :                                     &nBytesLeft,
     580           0 :                                     &pProperty ) == 0
     581             :                 && aRealType == XA_CARDINAL
     582             :                 && nFormat == 32
     583             :                 && nItems != 0 )
     584             :             {
     585           0 :                 if (! GetGenericData()->ErrorTrapPop( false ) )
     586             :                 {
     587           0 :                     GetGenericData()->ErrorTrapPush();
     588             : 
     589           0 :                     aCheckWindow =  *(XLIB_Window*)pProperty;
     590           0 :                     XFree( pProperty );
     591           0 :                     pProperty = NULL;
     592           0 :                     if( aCheckWindow == aWMChild )
     593             :                     {
     594           0 :                         m_bValid = true;
     595             :                         /*
     596             :                          *  get name of WM
     597             :                          *  this is NOT part of the GNOME WM hints, but e.g. Sawfish
     598             :                          *  already supports this part of the extended WM hints
     599             :                          */
     600           0 :                         m_aWMAtoms[ UTF8_STRING ] = XInternAtom( m_pDisplay, "UTF8_STRING", False );
     601           0 :                         getNetWmName();
     602             :                     }
     603             :                 }
     604             :                 else
     605           0 :                     GetGenericData()->ErrorTrapPush();
     606             :             }
     607           0 :             GetGenericData()->ErrorTrapPop();
     608             :         }
     609           0 :         else if( pProperty )
     610             :         {
     611           0 :             XFree( pProperty );
     612           0 :             pProperty = NULL;
     613             :         }
     614             :     }
     615           0 :     if( m_bValid
     616             :         && XGetWindowProperty( m_pDisplay,
     617             :                                m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
     618             :                                m_aWMAtoms[ WIN_PROTOCOLS ],
     619             :                                0, 0,
     620             :                                False,
     621             :                                XA_ATOM,
     622             :                                &aRealType,
     623             :                                &nFormat,
     624             :                                &nItems,
     625             :                                &nBytesLeft,
     626           0 :                                &pProperty ) == 0
     627             :         && aRealType == XA_ATOM
     628             :         && nFormat == 32
     629             :         )
     630             :     {
     631           0 :         if( pProperty )
     632             :         {
     633           0 :             XFree( pProperty );
     634           0 :             pProperty = NULL;
     635             :         }
     636             :         // collect supported protocols
     637           0 :         if( XGetWindowProperty( m_pDisplay,
     638             :                                 m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
     639             :                                 m_aWMAtoms[ WIN_PROTOCOLS ],
     640             :                                 0, nBytesLeft/4,
     641             :                                 False,
     642             :                                 XA_ATOM,
     643             :                                 &aRealType,
     644             :                                 &nFormat,
     645             :                                 &nItems,
     646             :                                 &nBytesLeft,
     647           0 :                                 &pProperty ) == 0
     648             :             && pProperty
     649             :             )
     650             :         {
     651           0 :             Atom* pAtoms = (Atom*)pProperty;
     652           0 :             char** pAtomNames = (char**)alloca( sizeof(char*)*nItems );
     653           0 :             if( XGetAtomNames( m_pDisplay, pAtoms, nItems, pAtomNames ) )
     654             :             {
     655             : #if OSL_DEBUG_LEVEL > 1
     656             :                 fprintf( stderr, "supported protocols:\n" );
     657             : #endif
     658           0 :                 for( unsigned int i = 0; i < nItems; i++ )
     659             :                 {
     660             :                     // #i80971# protect against invalid atoms
     661           0 :                     if( pAtomNames[i] == NULL )
     662           0 :                         continue;
     663             : 
     664             :                     WMAdaptorProtocol aSearch;
     665           0 :                     aSearch.pProtocol = pAtomNames[i];
     666             :                     WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*)
     667             :                         bsearch( &aSearch,
     668             :                                  aProtocolTab,
     669             :                                  SAL_N_ELEMENTS( aProtocolTab ),
     670             :                                  sizeof( struct WMAdaptorProtocol ),
     671           0 :                                  compareProtocol );
     672           0 :                     if( pMatch )
     673             :                     {
     674           0 :                         m_aWMAtoms[ pMatch->nProtocol ] = pAtoms[ i ];
     675           0 :                         if( pMatch->nProtocol == WIN_LAYER )
     676           0 :                             m_bEnableAlwaysOnTopWorks = true;
     677             :                     }
     678           0 :                     if( strncmp( "_ICEWM_TRAY", pAtomNames[i], 11 ) == 0 )
     679             :                     {
     680           0 :                         m_aWMName = String(RTL_CONSTASCII_USTRINGPARAM("IceWM" ));
     681           0 :                         m_nWinGravity = NorthWestGravity;
     682           0 :                         m_nInitWinGravity = NorthWestGravity;
     683             :                     }
     684             : #if OSL_DEBUG_LEVEL > 1
     685             :                     fprintf( stderr, "  %s%s\n", pAtomNames[i], ((pMatch) && (pMatch->nProtocol != -1)) ? "" : " (unsupported)" );
     686             : #endif
     687           0 :                     XFree( pAtomNames[i] );
     688             :                 }
     689             :             }
     690           0 :             XFree( pProperty );
     691           0 :             pProperty = NULL;
     692             :         }
     693           0 :         else if( pProperty )
     694             :         {
     695           0 :             XFree( pProperty );
     696           0 :             pProperty = NULL;
     697             :         }
     698             : 
     699             :         // get number of desktops
     700           0 :         if( m_aWMAtoms[ WIN_WORKSPACE_COUNT ]
     701             :             && XGetWindowProperty( m_pDisplay,
     702             :                                    m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
     703             :                                    m_aWMAtoms[ WIN_WORKSPACE_COUNT ],
     704             :                                    0, 1,
     705             :                                    False,
     706             :                                    XA_CARDINAL,
     707             :                                    &aRealType,
     708             :                                    &nFormat,
     709             :                                    &nItems,
     710             :                                    &nBytesLeft,
     711           0 :                                    &pProperty ) == 0
     712             :             && pProperty
     713             :             )
     714             :         {
     715           0 :             m_nDesktops = *(long*)pProperty;
     716           0 :             XFree( pProperty );
     717           0 :             pProperty = NULL;
     718             :         }
     719           0 :         else if( pProperty )
     720             :         {
     721           0 :             XFree( pProperty );
     722           0 :             pProperty = NULL;
     723             :         }
     724             :     }
     725           0 :     else if( pProperty )
     726             :     {
     727           0 :         XFree( pProperty );
     728           0 :         pProperty = NULL;
     729             :     }
     730           0 : }
     731             : 
     732             : /*
     733             :  *  GnomeWMAdaptor destructor
     734             :  */
     735           0 : GnomeWMAdaptor::~GnomeWMAdaptor()
     736             : {
     737           0 : }
     738             : 
     739             : /*
     740             :  *  getNetWmName()
     741             :  */
     742           0 : bool WMAdaptor::getNetWmName()
     743             : {
     744           0 :     Atom                aRealType   = None;
     745           0 :     int                 nFormat     = 8;
     746           0 :     unsigned long       nItems      = 0;
     747           0 :     unsigned long       nBytesLeft  = 0;
     748           0 :     unsigned char*  pProperty   = NULL;
     749           0 :     bool                bNetWM      = false;
     750             : 
     751           0 :     if( m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ] && m_aWMAtoms[ NET_WM_NAME ] )
     752             :     {
     753           0 :         XLIB_Window         aWMChild = None;
     754           0 :         if( XGetWindowProperty( m_pDisplay,
     755             :                                 m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
     756             :                                 m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ],
     757             :                                 0, 1,
     758             :                                 False,
     759             :                                 XA_WINDOW,
     760             :                                 &aRealType,
     761             :                                 &nFormat,
     762             :                                 &nItems,
     763             :                                 &nBytesLeft,
     764           0 :                                 &pProperty ) == 0
     765             :             && aRealType == XA_WINDOW
     766             :             && nFormat == 32
     767             :             && nItems != 0
     768             :             )
     769             :         {
     770           0 :             aWMChild = *(XLIB_Window*)pProperty;
     771           0 :             XFree( pProperty );
     772           0 :             pProperty = NULL;
     773           0 :             XLIB_Window aCheckWindow = None;
     774           0 :             GetGenericData()->ErrorTrapPush();
     775           0 :             if( XGetWindowProperty( m_pDisplay,
     776             :                                     aWMChild,
     777             :                                     m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ],
     778             :                                     0, 1,
     779             :                                     False,
     780             :                                     XA_WINDOW,
     781             :                                     &aRealType,
     782             :                                     &nFormat,
     783             :                                     &nItems,
     784             :                                     &nBytesLeft,
     785           0 :                                     &pProperty ) == 0
     786             :                 && aRealType == XA_WINDOW
     787             :                 && nFormat == 32
     788             :                 && nItems != 0 )
     789             :                 {
     790           0 :                     if ( ! GetGenericData()->ErrorTrapPop( false ) )
     791             :                     {
     792           0 :                         GetGenericData()->ErrorTrapPush();
     793           0 :                         aCheckWindow =  *(XLIB_Window*)pProperty;
     794           0 :                         XFree( pProperty );
     795           0 :                         pProperty = NULL;
     796           0 :                         if( aCheckWindow == aWMChild )
     797             :                         {
     798           0 :                             bNetWM = true;
     799             :                             // get name of WM
     800           0 :                             m_aWMAtoms[ UTF8_STRING ] = XInternAtom( m_pDisplay, "UTF8_STRING", False );
     801           0 :                             if( XGetWindowProperty( m_pDisplay,
     802             :                                                     aWMChild,
     803             :                                                     m_aWMAtoms[ NET_WM_NAME ],
     804             :                                                     0, 256,
     805             :                                                     False,
     806             :                                                     AnyPropertyType, /* m_aWMAtoms[ UTF8_STRING ],*/
     807             :                                                     &aRealType,
     808             :                                                     &nFormat,
     809             :                                                     &nItems,
     810             :                                                     &nBytesLeft,
     811           0 :                                                     &pProperty ) == 0
     812             :                                 && nItems != 0
     813             :                                 )
     814             :                             {
     815           0 :                                 if (aRealType == m_aWMAtoms[ UTF8_STRING ])
     816           0 :                                     m_aWMName = String( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 );
     817           0 :                                 else if (aRealType == XA_STRING)
     818           0 :                                     m_aWMName = String( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_ISO_8859_1 );
     819             : 
     820           0 :                                 XFree( pProperty );
     821           0 :                                 pProperty = NULL;
     822             :                             }
     823           0 :                             else if( pProperty )
     824             :                             {
     825           0 :                                 XFree( pProperty );
     826           0 :                                 pProperty = NULL;
     827             :                             }
     828             : 
     829             :                             // if this is metacity, check for version to enable a legacy workaround
     830           0 :                             if( m_aWMName.EqualsAscii( "Metacity" ) )
     831             :                             {
     832           0 :                                 int nVersionMajor = 0, nVersionMinor = 0;
     833           0 :                                 Atom nVersionAtom = XInternAtom( m_pDisplay, "_METACITY_VERSION", True );
     834           0 :                                 if( nVersionAtom )
     835             :                                 {
     836           0 :                                     if( XGetWindowProperty( m_pDisplay,
     837             :                                                             aWMChild,
     838             :                                                             nVersionAtom,
     839             :                                                             0, 256,
     840             :                                                             False,
     841             :                                                             m_aWMAtoms[ UTF8_STRING ],
     842             :                                                             &aRealType,
     843             :                                                             &nFormat,
     844             :                                                             &nItems,
     845             :                                                             &nBytesLeft,
     846           0 :                                                             &pProperty ) == 0
     847             :                                         && nItems != 0
     848             :                                         )
     849             :                                     {
     850           0 :                                         rtl::OUString aMetaVersion( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 );
     851           0 :                                         nVersionMajor = aMetaVersion.getToken(0, '.').toInt32();
     852           0 :                                         nVersionMinor = aMetaVersion.getToken(1, '.').toInt32();
     853             :                                     }
     854           0 :                                     if( pProperty )
     855             :                                     {
     856           0 :                                         XFree( pProperty );
     857           0 :                                         pProperty = NULL;
     858             :                                     }
     859             :                                 }
     860           0 :                                 if( nVersionMajor < 2 || (nVersionMajor == 2 && nVersionMinor < 12) )
     861           0 :                                     m_bLegacyPartialFullscreen = true;
     862             :                             }
     863             :                         }
     864             :                     }
     865             :                     else
     866             :                     {
     867           0 :                         if( pProperty )
     868             :                         {
     869           0 :                             XFree( pProperty );
     870           0 :                             pProperty = NULL;
     871             :                         }
     872           0 :                         GetGenericData()->ErrorTrapPush();
     873             :                     }
     874             :                 }
     875             : 
     876           0 :             GetGenericData()->ErrorTrapPop();
     877             :         }
     878           0 :         else if( pProperty )
     879             :         {
     880           0 :             XFree( pProperty );
     881           0 :             pProperty = NULL;
     882             :         }
     883             :     }
     884           0 :     return bNetWM;
     885             : }
     886             : 
     887           0 : bool WMAdaptor::getWMshouldSwitchWorkspace() const
     888             : {
     889           0 :     if( ! m_bWMshouldSwitchWorkspaceInit )
     890             :     {
     891           0 :         WMAdaptor * pWMA = const_cast<WMAdaptor*>(this);
     892             : 
     893           0 :         pWMA->m_bWMshouldSwitchWorkspace = true;
     894           0 :         vcl::SettingsConfigItem* pItem = vcl::SettingsConfigItem::get();
     895             :         rtl::OUString aSetting( pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WM" ) ),
     896           0 :                                                  rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ShouldSwitchWorkspace" ) ) ) );
     897           0 :         if( aSetting.isEmpty() )
     898             :         {
     899           0 :             if( m_aWMName.EqualsAscii( "awesome" ) )
     900             :             {
     901           0 :                 pWMA->m_bWMshouldSwitchWorkspace = false;
     902             :             }
     903             :         }
     904             :         else
     905           0 :             pWMA->m_bWMshouldSwitchWorkspace = aSetting.toBoolean();
     906           0 :         pWMA->m_bWMshouldSwitchWorkspaceInit = true;
     907             :     }
     908           0 :     return m_bWMshouldSwitchWorkspace;
     909             : }
     910             : 
     911             : /*
     912             :  *  WMAdaptor::isValid()
     913             :  */
     914           0 : bool WMAdaptor::isValid() const
     915             : {
     916           0 :     return true;
     917             : }
     918             : 
     919             : /*
     920             :  *  NetWMAdaptor::isValid()
     921             :  */
     922           0 : bool NetWMAdaptor::isValid() const
     923             : {
     924             :     // some necessary sanity checks; there are WMs out there
     925             :     // which implement some of the WM hints spec without
     926             :     // real functionality
     927             :     return
     928           0 :         m_aWMAtoms[ NET_SUPPORTED ]
     929           0 :         && m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ]
     930           0 :         && m_aWMAtoms[ NET_WM_NAME ]
     931           0 :         && m_aWMAtoms[ NET_WM_WINDOW_TYPE_NORMAL ]
     932           0 :         && m_aWMAtoms[ NET_WM_WINDOW_TYPE_DIALOG ]
     933             :         ;
     934             : }
     935             : 
     936             : /*
     937             :  *  GnomeWMAdaptor::isValid()
     938             :  */
     939           0 : bool GnomeWMAdaptor::isValid() const
     940             : {
     941           0 :     return m_bValid;
     942             : }
     943             : 
     944             : /*
     945             :  *  WMAdaptor::initAtoms
     946             :  */
     947             : 
     948           0 : void WMAdaptor::initAtoms()
     949             : {
     950             :     // get basic atoms
     951           0 :     for( unsigned int i = 0; i < SAL_N_ELEMENTS( aAtomTab ); i++ )
     952           0 :         m_aWMAtoms[ aAtomTab[i].nProtocol ] = XInternAtom( m_pDisplay, aAtomTab[i].pProtocol, False );
     953           0 :     m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ]   = XInternAtom( m_pDisplay, "_NET_SUPPORTING_WM_CHECK", True );
     954           0 :     m_aWMAtoms[ NET_WM_NAME ]               = XInternAtom( m_pDisplay, "_NET_WM_NAME", True );
     955           0 : }
     956             : 
     957             : /*
     958             :  *  NetWMAdaptor::initAtoms
     959             :  */
     960             : 
     961           0 : void NetWMAdaptor::initAtoms()
     962             : {
     963           0 :     WMAdaptor::initAtoms();
     964             : 
     965           0 :     m_aWMAtoms[ NET_SUPPORTED ]             = XInternAtom( m_pDisplay, "_NET_SUPPORTED", True );
     966           0 : }
     967             : 
     968             : /*
     969             :  *  GnomeWMAdaptor::initAtoms
     970             :  */
     971             : 
     972           0 : void GnomeWMAdaptor::initAtoms()
     973             : {
     974           0 :     WMAdaptor::initAtoms();
     975             : 
     976           0 :     m_aWMAtoms[ WIN_PROTOCOLS ]             = XInternAtom( m_pDisplay, "_WIN_PROTOCOLS", True );
     977           0 :     m_aWMAtoms[ WIN_SUPPORTING_WM_CHECK ]   = XInternAtom( m_pDisplay, "_WIN_SUPPORTING_WM_CHECK", True );
     978           0 : }
     979             : 
     980             : /*
     981             :  *  WMAdaptor::setWMName
     982             :  *  sets WM_NAME
     983             :  *       WM_ICON_NAME
     984             :  */
     985             : 
     986           0 : void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
     987             : {
     988             :     rtl::OString aTitle(rtl::OUStringToOString(rWMName,
     989           0 :         osl_getThreadTextEncoding()));
     990             : 
     991           0 :     ::rtl::OString aWMLocale;
     992           0 :     rtl_Locale* pLocale = NULL;
     993           0 :     osl_getProcessLocale( &pLocale );
     994           0 :     if( pLocale )
     995             :     {
     996           0 :         ::rtl::OUString aLocaleString( pLocale->Language );
     997           0 :         ::rtl::OUString aCountry( pLocale->Country );
     998           0 :         ::rtl::OUString aVariant( pLocale->Variant );
     999             : 
    1000           0 :         if( !aCountry.isEmpty() )
    1001             :         {
    1002           0 :             aLocaleString += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_"));
    1003           0 :             aLocaleString += aCountry;
    1004             :         }
    1005           0 :         if( !aVariant.isEmpty() )
    1006           0 :             aLocaleString += aVariant;
    1007           0 :         aWMLocale = ::rtl::OUStringToOString( aLocaleString, RTL_TEXTENCODING_ISO_8859_1 );
    1008             :     }
    1009             :     else
    1010             :     {
    1011           0 :         static const char* pLang = getenv( "LANG" );
    1012           0 :         aWMLocale = pLang ? pLang : "C";
    1013             :     }
    1014             : 
    1015             :     static bool bTrustXmb = true;
    1016             :     #ifdef SOLARIS
    1017             :     /* #i64273# there are some weird cases when using IIIMP on Solaris
    1018             :     *  where for unknown reasons XmbTextListToTextProperty results in
    1019             :     *  garbage. Test one string once to ensure safety.
    1020             :     *
    1021             :     *  FIXME: This must be a bug in xiiimp.so.2 somewhere. However
    1022             :     *  it was not possible to recreate this in a small sample program.
    1023             :     *  This reeks of memory corruption somehow.
    1024             :     */
    1025             :     static bool bOnce = true;
    1026             :     if( bOnce )
    1027             :     {
    1028             :         bOnce = false;
    1029             :         XTextProperty aTestProp = { NULL, None, 0, 0 };
    1030             :         const char *pText = "trustme";
    1031             :         char* pT = const_cast<char*>(pText);
    1032             :         XmbTextListToTextProperty( m_pDisplay,
    1033             :                                    &pT,
    1034             :                                    1,
    1035             :                                    XStdICCTextStyle,
    1036             :                                    &aTestProp );
    1037             :         bTrustXmb = (aTestProp.nitems == 7)                     &&
    1038             :                     (aTestProp.value != NULL )                  &&
    1039             :                     (strncmp( (char*)aTestProp.value, pText, 7 ) == 0) &&
    1040             :                     (aTestProp.encoding == XA_STRING);
    1041             :         if( aTestProp.value )
    1042             :             XFree( aTestProp.value );
    1043             :         #if OSL_DEBUG_LEVEL > 1
    1044             :         fprintf( stderr, "%s\n",
    1045             :                  bTrustXmb ?
    1046             :                  "XmbTextListToTextProperty seems to work" :
    1047             :                  "XmbTextListToTextProperty does not seem to work" );
    1048             :         #endif
    1049             :     }
    1050             :     #endif
    1051             : 
    1052           0 :     char* pT = const_cast<char*>(aTitle.getStr());
    1053           0 :     XTextProperty aProp = { NULL, None, 0, 0 };
    1054           0 :     if( bTrustXmb )
    1055             :     {
    1056             :         XmbTextListToTextProperty( m_pDisplay,
    1057             :                                    &pT,
    1058             :                                    1,
    1059             :                                    XStdICCTextStyle,
    1060           0 :                                    &aProp );
    1061             :     }
    1062             : 
    1063           0 :     unsigned char* pData = aProp.nitems ? aProp.value : (unsigned char*)aTitle.getStr();
    1064           0 :     Atom nType = aProp.nitems ? aProp.encoding : XA_STRING;
    1065           0 :     int nFormat = aProp.nitems ? aProp.format : 8;
    1066           0 :     int nBytes = aProp.nitems ? aProp.nitems : aTitle.getLength();
    1067           0 :     const SystemEnvData* pEnv = pFrame->GetSystemData();
    1068             :     XChangeProperty( m_pDisplay,
    1069             :                      (XLIB_Window)pEnv->aShellWindow,
    1070             :                      XA_WM_NAME,
    1071             :                      nType,
    1072             :                      nFormat,
    1073             :                      PropModeReplace,
    1074             :                      pData,
    1075           0 :                      nBytes );
    1076             :     XChangeProperty( m_pDisplay,
    1077             :                      (XLIB_Window)pEnv->aShellWindow,
    1078             :                      XA_WM_ICON_NAME,
    1079             :                      nType,
    1080             :                      nFormat,
    1081             :                      PropModeReplace,
    1082             :                      pData,
    1083           0 :                      nBytes );
    1084             :     XChangeProperty( m_pDisplay,
    1085             :                      (XLIB_Window)pEnv->aShellWindow,
    1086           0 :                      m_aWMAtoms[ WM_LOCALE_NAME ],
    1087             :                      XA_STRING,
    1088             :                      8,
    1089             :                      PropModeReplace,
    1090           0 :                      (unsigned char*)aWMLocale.getStr(),
    1091           0 :                      aWMLocale.getLength() );
    1092           0 :     if (aProp.value != NULL)
    1093           0 :         XFree( aProp.value );
    1094           0 : }
    1095             : 
    1096             : /*
    1097             :  *  NetWMAdaptor::setWMName
    1098             :  *  sets WM_NAME
    1099             :  *       _NET_WM_NAME
    1100             :  *       WM_ICON_NAME
    1101             :  *       _NET_WM_ICON_NAME
    1102             :  */
    1103           0 : void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
    1104             : {
    1105           0 :     WMAdaptor::setWMName( pFrame, rWMName );
    1106             : 
    1107           0 :     rtl::OString aTitle(rtl::OUStringToOString(rWMName, RTL_TEXTENCODING_UTF8));
    1108           0 :     const SystemEnvData* pEnv = pFrame->GetSystemData();
    1109           0 :     if( m_aWMAtoms[ NET_WM_NAME ] )
    1110             :         XChangeProperty( m_pDisplay,
    1111             :                          (XLIB_Window)pEnv->aShellWindow,
    1112           0 :                          m_aWMAtoms[ NET_WM_NAME ],
    1113           0 :                          m_aWMAtoms[ UTF8_STRING ],
    1114             :                          8,
    1115             :                          PropModeReplace,
    1116           0 :                          (unsigned char*)aTitle.getStr(),
    1117           0 :                          aTitle.getLength() );
    1118           0 :     if( m_aWMAtoms[ NET_WM_ICON_NAME ] )
    1119             :         XChangeProperty( m_pDisplay,
    1120             :                          (XLIB_Window)pEnv->aShellWindow,
    1121           0 :                          m_aWMAtoms[ NET_WM_ICON_NAME ],
    1122           0 :                          m_aWMAtoms[ UTF8_STRING ],
    1123             :                          8,
    1124             :                          PropModeReplace,
    1125           0 :                          (unsigned char*)aTitle.getStr(),
    1126           0 :                          aTitle.getLength() );
    1127           0 : }
    1128             : 
    1129             : /*
    1130             :  *  NetWMAdaptor::setNetWMState
    1131             :  *  sets _NET_WM_STATE
    1132             :  */
    1133           0 : void NetWMAdaptor::setNetWMState( X11SalFrame* pFrame ) const
    1134             : {
    1135           0 :     if( m_aWMAtoms[ NET_WM_STATE ] )
    1136             :     {
    1137             :         Atom aStateAtoms[ 10 ];
    1138           0 :         int nStateAtoms = 0;
    1139             : 
    1140             :         // set NET_WM_STATE_MODAL
    1141           0 :         if( m_aWMAtoms[ NET_WM_STATE_MODAL ]
    1142             :             && pFrame->meWindowType == windowType_ModalDialogue )
    1143             :         {
    1144           0 :             aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_MODAL ];
    1145             :             /*
    1146             :              *  #90998# NET_WM_STATE_SKIP_TASKBAR set on a frame will
    1147             :              *  cause kwin not to give it the focus on map request
    1148             :              *  this seems to be a bug in kwin
    1149             :              *  aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_SKIP_TASKBAR ];
    1150             :              */
    1151             :         }
    1152           0 :         if( pFrame->mbMaximizedVert
    1153           0 :             && m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ] )
    1154           0 :             aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ];
    1155           0 :         if( pFrame->mbMaximizedHorz
    1156           0 :             && m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_HORZ ] )
    1157           0 :             aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_HORZ ];
    1158           0 :         if( pFrame->bAlwaysOnTop_ && m_aWMAtoms[ NET_WM_STATE_STAYS_ON_TOP ] )
    1159           0 :             aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_STAYS_ON_TOP ];
    1160           0 :         if( pFrame->mbShaded && m_aWMAtoms[ NET_WM_STATE_SHADED ] )
    1161           0 :             aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_SHADED ];
    1162           0 :         if( pFrame->mbFullScreen && m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ] )
    1163           0 :             aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ];
    1164           0 :         if( pFrame->meWindowType == windowType_Utility && m_aWMAtoms[ NET_WM_STATE_SKIP_TASKBAR ] )
    1165           0 :             aStateAtoms[ nStateAtoms++ ] = m_aWMAtoms[ NET_WM_STATE_SKIP_TASKBAR ];
    1166             : 
    1167           0 :         if( nStateAtoms )
    1168             :         {
    1169             :             XChangeProperty( m_pDisplay,
    1170             :                              pFrame->GetShellWindow(),
    1171           0 :                              m_aWMAtoms[ NET_WM_STATE ],
    1172             :                              XA_ATOM,
    1173             :                              32,
    1174             :                              PropModeReplace,
    1175             :                              (unsigned char*)aStateAtoms,
    1176             :                              nStateAtoms
    1177           0 :                              );
    1178             :         }
    1179             :         else
    1180             :             XDeleteProperty( m_pDisplay,
    1181             :                              pFrame->GetShellWindow(),
    1182           0 :                              m_aWMAtoms[ NET_WM_STATE ] );
    1183           0 :         if( pFrame->mbMaximizedHorz
    1184             :            && pFrame->mbMaximizedVert
    1185           0 :            && ! ( pFrame->nStyle_ & SAL_FRAME_STYLE_SIZEABLE ) )
    1186             :         {
    1187             :             /*
    1188             :              *  for maximizing use NorthWestGravity (including decoration)
    1189             :              */
    1190             :             XSizeHints  hints;
    1191             :             long        supplied;
    1192           0 :             bool bHint = false;
    1193           0 :             if( XGetWMNormalHints( m_pDisplay,
    1194             :                                    pFrame->GetShellWindow(),
    1195             :                                    &hints,
    1196           0 :                                    &supplied ) )
    1197             :             {
    1198           0 :                 bHint = true;
    1199           0 :                 hints.flags |= PWinGravity;
    1200           0 :                 hints.win_gravity = NorthWestGravity;
    1201             :                 XSetWMNormalHints( m_pDisplay,
    1202             :                                    pFrame->GetShellWindow(),
    1203           0 :                                    &hints );
    1204           0 :                 XSync( m_pDisplay, False );
    1205             :             }
    1206             : 
    1207             :             // SetPosSize necessary to set width/height, min/max w/h
    1208           0 :             sal_Int32 nCurrent = 0;
    1209             :             /*
    1210             :              *  get current desktop here if work areas have different size
    1211             :              *  (does this happen on any platform ?)
    1212             :              */
    1213           0 :             if( ! m_bEqualWorkAreas )
    1214             :             {
    1215           0 :                 nCurrent = getCurrentWorkArea();
    1216           0 :                 if( nCurrent < 0 )
    1217           0 :                     nCurrent = 0;
    1218             :             }
    1219           0 :             Rectangle aPosSize = m_aWMWorkAreas[nCurrent];
    1220           0 :             const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() );
    1221           0 :             aPosSize = Rectangle( Point( aPosSize.Left() + rGeom.nLeftDecoration,
    1222           0 :                                          aPosSize.Top()  + rGeom.nTopDecoration ),
    1223           0 :                                   Size( aPosSize.GetWidth()
    1224             :                                         - rGeom.nLeftDecoration
    1225             :                                         - rGeom.nRightDecoration,
    1226           0 :                                         aPosSize.GetHeight()
    1227             :                                         - rGeom.nTopDecoration
    1228             :                                         - rGeom.nBottomDecoration )
    1229           0 :                                   );
    1230           0 :             pFrame->SetPosSize( aPosSize );
    1231             : 
    1232             :             /*
    1233             :              *  reset gravity hint to static gravity
    1234             :              *  (this should not move window according to ICCCM)
    1235             :              */
    1236           0 :             if( bHint && pFrame->nShowState_ != SHOWSTATE_UNKNOWN )
    1237             :             {
    1238           0 :                 hints.win_gravity = StaticGravity;
    1239             :                 XSetWMNormalHints( m_pDisplay,
    1240             :                                    pFrame->GetShellWindow(),
    1241           0 :                                    &hints );
    1242             :             }
    1243             :         }
    1244             :     }
    1245           0 : }
    1246             : 
    1247             : /*
    1248             :  *  GnomeWMAdaptor::setNetWMState
    1249             :  *  sets _WIN_STATE
    1250             :  */
    1251           0 : void GnomeWMAdaptor::setGnomeWMState( X11SalFrame* pFrame ) const
    1252             : {
    1253           0 :     if( m_aWMAtoms[ WIN_STATE ] )
    1254             :     {
    1255           0 :         sal_uInt32 nWinWMState = 0;
    1256             : 
    1257           0 :         if( pFrame->mbMaximizedVert )
    1258           0 :             nWinWMState |= 1 << 2;
    1259           0 :         if( pFrame->mbMaximizedHorz )
    1260           0 :             nWinWMState |= 1 << 3;
    1261           0 :         if( pFrame->mbShaded )
    1262           0 :             nWinWMState |= 1 << 5;
    1263             : 
    1264             :         XChangeProperty( m_pDisplay,
    1265             :                          pFrame->GetShellWindow(),
    1266           0 :                          m_aWMAtoms[ WIN_STATE ],
    1267             :                          XA_CARDINAL,
    1268             :                          32,
    1269             :                          PropModeReplace,
    1270             :                          (unsigned char*)&nWinWMState,
    1271             :                          1
    1272           0 :                          );
    1273           0 :         if( pFrame->mbMaximizedHorz
    1274             :            && pFrame->mbMaximizedVert
    1275           0 :            && ! ( pFrame->nStyle_ & SAL_FRAME_STYLE_SIZEABLE ) )
    1276             :         {
    1277             :             /*
    1278             :              *  for maximizing use NorthWestGravity (including decoration)
    1279             :              */
    1280             :             XSizeHints  hints;
    1281             :             long        supplied;
    1282           0 :             bool bHint = false;
    1283           0 :             if( XGetWMNormalHints( m_pDisplay,
    1284             :                                    pFrame->GetShellWindow(),
    1285             :                                    &hints,
    1286           0 :                                    &supplied ) )
    1287             :             {
    1288           0 :                 bHint = true;
    1289           0 :                 hints.flags |= PWinGravity;
    1290           0 :                 hints.win_gravity = NorthWestGravity;
    1291             :                 XSetWMNormalHints( m_pDisplay,
    1292             :                                    pFrame->GetShellWindow(),
    1293           0 :                                    &hints );
    1294           0 :                 XSync( m_pDisplay, False );
    1295             :             }
    1296             : 
    1297             :             // SetPosSize necessary to set width/height, min/max w/h
    1298           0 :             sal_Int32 nCurrent = 0;
    1299             :             /*
    1300             :              *  get current desktop here if work areas have different size
    1301             :              *  (does this happen on any platform ?)
    1302             :              */
    1303           0 :             if( ! m_bEqualWorkAreas )
    1304             :             {
    1305           0 :                 nCurrent = getCurrentWorkArea();
    1306           0 :                 if( nCurrent < 0 )
    1307           0 :                     nCurrent = 0;
    1308             :             }
    1309           0 :             Rectangle aPosSize = m_aWMWorkAreas[nCurrent];
    1310           0 :             const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() );
    1311           0 :             aPosSize = Rectangle( Point( aPosSize.Left() + rGeom.nLeftDecoration,
    1312           0 :                                          aPosSize.Top()  + rGeom.nTopDecoration ),
    1313           0 :                                   Size( aPosSize.GetWidth()
    1314             :                                         - rGeom.nLeftDecoration
    1315             :                                         - rGeom.nRightDecoration,
    1316           0 :                                         aPosSize.GetHeight()
    1317             :                                         - rGeom.nTopDecoration
    1318             :                                         - rGeom.nBottomDecoration )
    1319           0 :                                   );
    1320           0 :             pFrame->SetPosSize( aPosSize );
    1321             : 
    1322             :             /*
    1323             :              *  reset gravity hint to static gravity
    1324             :              *  (this should not move window according to ICCCM)
    1325             :              */
    1326           0 :             if( bHint && pFrame->nShowState_ != SHOWSTATE_UNKNOWN )
    1327             :             {
    1328           0 :                 hints.win_gravity = StaticGravity;
    1329             :                 XSetWMNormalHints( m_pDisplay,
    1330             :                                    pFrame->GetShellWindow(),
    1331           0 :                                    &hints );
    1332             :             }
    1333             :         }
    1334             :     }
    1335           0 : }
    1336             : 
    1337             : /*
    1338             :  *  WMAdaptor::setFrameDecoration
    1339             :  *  sets _MOTIF_WM_HINTS
    1340             :  *       WM_TRANSIENT_FOR
    1341             :  */
    1342             : 
    1343           0 : void WMAdaptor::setFrameTypeAndDecoration( X11SalFrame* pFrame, WMWindowType eType, int nDecorationFlags, X11SalFrame* pReferenceFrame ) const
    1344             : {
    1345           0 :     pFrame->meWindowType        = eType;
    1346           0 :     pFrame->mnDecorationFlags   = nDecorationFlags;
    1347             : 
    1348           0 :     if( ! pFrame->mbFullScreen )
    1349             :     {
    1350             :         // set mwm hints
    1351             :         struct _mwmhints {
    1352             :             unsigned long flags, func, deco;
    1353             :             long input_mode;
    1354             :             unsigned long status;
    1355             :         } aHint;
    1356             : 
    1357           0 :         aHint.flags = 15; /* flags for functions, decoration, input mode and status */
    1358           0 :         aHint.deco = 0;
    1359           0 :         aHint.func = 1L << 2;
    1360           0 :         aHint.status = 0;
    1361           0 :         aHint.input_mode = 0;
    1362             : 
    1363             :         // evaluate decoration flags
    1364           0 :         if( nDecorationFlags & decoration_All )
    1365           0 :             aHint.deco = 1, aHint.func = 1;
    1366             :         else
    1367             :         {
    1368           0 :             if( nDecorationFlags & decoration_Title )
    1369           0 :                 aHint.deco |= 1L << 3;
    1370           0 :             if( nDecorationFlags & decoration_Border )
    1371           0 :                 aHint.deco |= 1L << 1;
    1372           0 :             if( nDecorationFlags & decoration_Resize )
    1373           0 :                 aHint.deco |= 1L << 2, aHint.func |= 1L << 1;
    1374           0 :             if( nDecorationFlags & decoration_MinimizeBtn )
    1375           0 :                 aHint.deco |= 1L << 5, aHint.func |= 1L << 3;
    1376           0 :             if( nDecorationFlags & decoration_MaximizeBtn )
    1377           0 :                 aHint.deco |= 1L << 6, aHint.func |= 1L << 4;
    1378           0 :             if( nDecorationFlags & decoration_CloseBtn )
    1379           0 :                 aHint.deco |= 1L << 4, aHint.func |= 1L << 5;
    1380             :         }
    1381             :         // evaluate window type
    1382           0 :         switch( eType )
    1383             :         {
    1384             :             case windowType_ModalDialogue:
    1385           0 :                 aHint.input_mode = 1;
    1386           0 :                 break;
    1387             :             default:
    1388           0 :                 break;
    1389             :         }
    1390             : 
    1391             :         // set the hint
    1392             :         XChangeProperty( m_pDisplay,
    1393             :                          pFrame->GetShellWindow(),
    1394           0 :                          m_aWMAtoms[ MOTIF_WM_HINTS ],
    1395           0 :                          m_aWMAtoms[ MOTIF_WM_HINTS ],
    1396             :                          32,
    1397             :                          PropModeReplace,
    1398             :                          (unsigned char*)&aHint,
    1399           0 :                          5 );
    1400             :     }
    1401             : 
    1402             :     // set transientFor hint
    1403             :     /*  #91030# dtwm will not map a dialogue if the transient
    1404             :      *  window is iconified. This is deemed undesireable because
    1405             :      *  message boxes do not get mapped, so use the root as transient
    1406             :      *  instead.
    1407             :      */
    1408           0 :     if( pReferenceFrame )
    1409             :     {
    1410             :         XSetTransientForHint( m_pDisplay,
    1411             :                               pFrame->GetShellWindow(),
    1412             :                               pReferenceFrame->bMapped_ ?
    1413             :                               pReferenceFrame->GetShellWindow() :
    1414           0 :                               m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() )
    1415           0 :                               );
    1416           0 :         if( ! pReferenceFrame->bMapped_ )
    1417           0 :             pFrame->mbTransientForRoot = true;
    1418             :     }
    1419           0 : }
    1420             : 
    1421             : /*
    1422             :  *  NetWMAdaptor::setFrameDecoration
    1423             :  *  sets _MOTIF_WM_HINTS
    1424             :  *       _NET_WM_WINDOW_TYPE
    1425             :  *       _NET_WM_STATE
    1426             :  *       WM_TRANSIENT_FOR
    1427             :  */
    1428             : 
    1429           0 : void NetWMAdaptor::setFrameTypeAndDecoration( X11SalFrame* pFrame, WMWindowType eType, int nDecorationFlags, X11SalFrame* pReferenceFrame ) const
    1430             : {
    1431           0 :     WMAdaptor::setFrameTypeAndDecoration( pFrame, eType, nDecorationFlags, pReferenceFrame );
    1432             : 
    1433           0 :     setNetWMState( pFrame );
    1434             : 
    1435             :     // set NET_WM_WINDOW_TYPE
    1436           0 :     if( m_aWMAtoms[ NET_WM_WINDOW_TYPE ] )
    1437             :     {
    1438             :         Atom aWindowTypes[4];
    1439           0 :         int nWindowTypes = 0;
    1440           0 :         switch( eType )
    1441             :         {
    1442             :             case windowType_Utility:
    1443           0 :                 aWindowTypes[nWindowTypes++] =
    1444           0 :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_UTILITY ] ?
    1445             :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_UTILITY ] :
    1446           0 :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_DIALOG ];
    1447           0 :                 break;
    1448             :             case windowType_ModelessDialogue:
    1449             :             case windowType_ModalDialogue:
    1450           0 :                 aWindowTypes[nWindowTypes++] =
    1451           0 :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_DIALOG ];
    1452           0 :                 break;
    1453             :             case windowType_Splash:
    1454           0 :                 aWindowTypes[nWindowTypes++] =
    1455           0 :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_SPLASH ] ?
    1456             :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_SPLASH ] :
    1457           0 :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_NORMAL ];
    1458           0 :                 break;
    1459             :             case windowType_Toolbar:
    1460           0 :                 if( m_aWMAtoms[ KDE_NET_WM_WINDOW_TYPE_OVERRIDE ] )
    1461           0 :                     aWindowTypes[nWindowTypes++] = m_aWMAtoms[ KDE_NET_WM_WINDOW_TYPE_OVERRIDE ];
    1462           0 :                 aWindowTypes[nWindowTypes++] =
    1463           0 :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_TOOLBAR ] ?
    1464             :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_TOOLBAR ] :
    1465           0 :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_NORMAL];
    1466           0 :                 break;
    1467             :             case windowType_Dock:
    1468           0 :                 aWindowTypes[nWindowTypes++] =
    1469           0 :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_DOCK ] ?
    1470             :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_DOCK ] :
    1471           0 :                     m_aWMAtoms[ NET_WM_WINDOW_TYPE_NORMAL];
    1472           0 :                 break;
    1473             :             default:
    1474           0 :                 aWindowTypes[nWindowTypes++] = m_aWMAtoms[ NET_WM_WINDOW_TYPE_NORMAL ];
    1475           0 :                 break;
    1476             :         }
    1477             :         XChangeProperty( m_pDisplay,
    1478             :                          pFrame->GetShellWindow(),
    1479           0 :                          m_aWMAtoms[ NET_WM_WINDOW_TYPE ],
    1480             :                          XA_ATOM,
    1481             :                          32,
    1482             :                          PropModeReplace,
    1483             :                          (unsigned char*)aWindowTypes,
    1484           0 :                          nWindowTypes );
    1485             :     }
    1486           0 :     if( ( eType == windowType_ModalDialogue ||
    1487             :           eType == windowType_ModelessDialogue )
    1488             :         && ! pReferenceFrame )
    1489             :     {
    1490             :         XSetTransientForHint( m_pDisplay,
    1491             :                               pFrame->GetShellWindow(),
    1492           0 :                               m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ) );
    1493           0 :         pFrame->mbTransientForRoot = true;
    1494             :     }
    1495           0 : }
    1496             : 
    1497             : /*
    1498             :  *  WMAdaptor::maximizeFrame
    1499             :  */
    1500             : 
    1501           0 : void WMAdaptor::maximizeFrame( X11SalFrame* pFrame, bool bHorizontal, bool bVertical ) const
    1502             : {
    1503           0 :     pFrame->mbMaximizedVert = bVertical;
    1504           0 :     pFrame->mbMaximizedHorz = bHorizontal;
    1505             : 
    1506           0 :     const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() );
    1507             : 
    1508             :     // discard pending configure notifies for this frame
    1509           0 :     XSync( m_pDisplay, False );
    1510             :     XEvent aDiscard;
    1511           0 :     while( XCheckTypedWindowEvent( m_pDisplay,
    1512             :                                    pFrame->GetShellWindow(),
    1513             :                                    ConfigureNotify,
    1514           0 :                                    &aDiscard ) )
    1515             :         ;
    1516           0 :     while( XCheckTypedWindowEvent( m_pDisplay,
    1517             :                                    pFrame->GetWindow(),
    1518             :                                    ConfigureNotify,
    1519           0 :                                    &aDiscard ) )
    1520             :         ;
    1521             : 
    1522           0 :     if( bHorizontal || bVertical )
    1523             :     {
    1524           0 :         Size aScreenSize( m_pSalDisplay->GetScreenSize( pFrame->GetScreenNumber() ) );
    1525           0 :         Point aTL( rGeom.nLeftDecoration, rGeom.nTopDecoration );
    1526           0 :         if( m_pSalDisplay->IsXinerama() )
    1527             :         {
    1528           0 :             Point aMed( aTL.X() + rGeom.nWidth/2, aTL.Y() + rGeom.nHeight/2 );
    1529           0 :             const std::vector< Rectangle >& rScreens = m_pSalDisplay->GetXineramaScreens();
    1530           0 :             for( unsigned int i = 0; i < rScreens.size(); i++ )
    1531           0 :                 if( rScreens[i].IsInside( aMed ) )
    1532             :                 {
    1533           0 :                     aTL += rScreens[i].TopLeft();
    1534           0 :                     aScreenSize = rScreens[i].GetSize();
    1535           0 :                     break;
    1536             :                 }
    1537             :         }
    1538             :         Rectangle aTarget( aTL,
    1539           0 :                            Size( aScreenSize.Width() - rGeom.nLeftDecoration - rGeom.nTopDecoration,
    1540           0 :                                  aScreenSize.Height() - rGeom.nTopDecoration - rGeom.nBottomDecoration )
    1541           0 :                            );
    1542           0 :         if( ! bHorizontal )
    1543             :         {
    1544             :             aTarget.SetSize(
    1545             :                             Size(
    1546           0 :                                  pFrame->maRestorePosSize.IsEmpty() ?
    1547           0 :                                  rGeom.nWidth : pFrame->maRestorePosSize.GetWidth(),
    1548             :                                  aTarget.GetHeight()
    1549             :                                  )
    1550           0 :                             );
    1551           0 :             aTarget.Left() =
    1552           0 :                 pFrame->maRestorePosSize.IsEmpty() ?
    1553           0 :                 rGeom.nX : pFrame->maRestorePosSize.Left();
    1554             :         }
    1555           0 :         else if( ! bVertical )
    1556             :         {
    1557             :             aTarget.SetSize(
    1558             :                             Size(
    1559             :                                  aTarget.GetWidth(),
    1560           0 :                                  pFrame->maRestorePosSize.IsEmpty() ?
    1561           0 :                                  rGeom.nHeight : pFrame->maRestorePosSize.GetHeight()
    1562             :                                  )
    1563           0 :                             );
    1564           0 :             aTarget.Top() =
    1565           0 :                 pFrame->maRestorePosSize.IsEmpty() ?
    1566           0 :                 rGeom.nY : pFrame->maRestorePosSize.Top();
    1567             :         }
    1568             : 
    1569           0 :         Rectangle aRestore( Point( rGeom.nX, rGeom.nY ), Size( rGeom.nWidth, rGeom.nHeight ) );
    1570           0 :         if( pFrame->bMapped_ )
    1571             :         {
    1572             :             XSetInputFocus( m_pDisplay,
    1573             :                             pFrame->GetShellWindow(),
    1574             :                             RevertToNone,
    1575             :                             CurrentTime
    1576           0 :                             );
    1577             :         }
    1578             : 
    1579           0 :         if( pFrame->maRestorePosSize.IsEmpty() )
    1580           0 :             pFrame->maRestorePosSize = aRestore;
    1581             : 
    1582           0 :         pFrame->SetPosSize( aTarget );
    1583           0 :         pFrame->nWidth_     = aTarget.GetWidth();
    1584           0 :         pFrame->nHeight_    = aTarget.GetHeight();
    1585             :         XRaiseWindow( m_pDisplay,
    1586             :                       pFrame->GetShellWindow()
    1587           0 :                       );
    1588           0 :         if( pFrame->GetStackingWindow() )
    1589             :             XRaiseWindow( m_pDisplay,
    1590             :                           pFrame->GetStackingWindow()
    1591           0 :                           );
    1592             : 
    1593             :     }
    1594             :     else
    1595             :     {
    1596           0 :         pFrame->SetPosSize( pFrame->maRestorePosSize );
    1597           0 :         pFrame->maRestorePosSize = Rectangle();
    1598           0 :         pFrame->nWidth_             = rGeom.nWidth;
    1599           0 :         pFrame->nHeight_            = rGeom.nHeight;
    1600             :     }
    1601           0 : }
    1602             : 
    1603             : /*
    1604             :  *  NetWMAdaptor::maximizeFrame
    1605             :  *  changes _NET_WM_STATE by sending a client message
    1606             :  */
    1607             : 
    1608           0 : void NetWMAdaptor::maximizeFrame( X11SalFrame* pFrame, bool bHorizontal, bool bVertical ) const
    1609             : {
    1610           0 :     pFrame->mbMaximizedVert = bVertical;
    1611           0 :     pFrame->mbMaximizedHorz = bHorizontal;
    1612             : 
    1613           0 :     if( m_aWMAtoms[ NET_WM_STATE ]
    1614           0 :         && m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ]
    1615           0 :         && m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_HORZ ]
    1616             :         && ( pFrame->nStyle_ & ~SAL_FRAME_STYLE_DEFAULT )
    1617             :         )
    1618             :     {
    1619           0 :         if( pFrame->bMapped_ )
    1620             :         {
    1621             :             // window already mapped, send WM a message
    1622             :             XEvent aEvent;
    1623           0 :             aEvent.type                 = ClientMessage;
    1624           0 :             aEvent.xclient.display      = m_pDisplay;
    1625           0 :             aEvent.xclient.window       = pFrame->GetShellWindow();
    1626           0 :             aEvent.xclient.message_type = m_aWMAtoms[ NET_WM_STATE ];
    1627           0 :             aEvent.xclient.format       = 32;
    1628           0 :             aEvent.xclient.data.l[0]    = bHorizontal ? 1 : 0;
    1629           0 :             aEvent.xclient.data.l[1]    = m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_HORZ ];
    1630           0 :             aEvent.xclient.data.l[2]    = bHorizontal == bVertical ? m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ] : 0;
    1631           0 :             aEvent.xclient.data.l[3]    = 0;
    1632           0 :             aEvent.xclient.data.l[4]    = 0;
    1633             :             XSendEvent( m_pDisplay,
    1634             :                         m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
    1635             :                         False,
    1636             :                         SubstructureNotifyMask | SubstructureRedirectMask,
    1637             :                         &aEvent
    1638           0 :                         );
    1639           0 :             if( bHorizontal != bVertical )
    1640             :             {
    1641           0 :                 aEvent.xclient.data.l[0]= bVertical ? 1 : 0;
    1642           0 :                 aEvent.xclient.data.l[1]= m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ];
    1643           0 :                 aEvent.xclient.data.l[2]= 0;
    1644             :                 XSendEvent( m_pDisplay,
    1645             :                             m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
    1646             :                             False,
    1647             :                             SubstructureNotifyMask | SubstructureRedirectMask,
    1648             :                             &aEvent
    1649           0 :                             );
    1650             :             }
    1651             :         }
    1652             :         else
    1653             :         {
    1654             :             // window not mapped yet, set _NET_WM_STATE directly
    1655           0 :             setNetWMState( pFrame );
    1656             :         }
    1657           0 :         if( !bHorizontal && !bVertical )
    1658           0 :             pFrame->maRestorePosSize = Rectangle();
    1659           0 :         else if( pFrame->maRestorePosSize.IsEmpty() )
    1660             :         {
    1661           0 :             const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() );
    1662             :             pFrame->maRestorePosSize =
    1663           0 :                 Rectangle( Point( rGeom.nX, rGeom.nY ), Size( rGeom.nWidth, rGeom.nHeight ) );
    1664           0 :         }
    1665             :     }
    1666             :     else
    1667           0 :         WMAdaptor::maximizeFrame( pFrame, bHorizontal, bVertical );
    1668           0 : }
    1669             : 
    1670             : /*
    1671             :  *  GnomeWMAdaptor::maximizeFrame
    1672             :  *  changes _WIN_STATE by sending a client message
    1673             :  */
    1674             : 
    1675           0 : void GnomeWMAdaptor::maximizeFrame( X11SalFrame* pFrame, bool bHorizontal, bool bVertical ) const
    1676             : {
    1677           0 :     pFrame->mbMaximizedVert = bVertical;
    1678           0 :     pFrame->mbMaximizedHorz = bHorizontal;
    1679             : 
    1680           0 :     if( m_aWMAtoms[ WIN_STATE ]
    1681             :         && ( pFrame->nStyle_ & ~SAL_FRAME_STYLE_DEFAULT )
    1682             :         )
    1683             :     {
    1684           0 :         if( pFrame->bMapped_ )
    1685             :         {
    1686             :              // window already mapped, send WM a message
    1687             :             XEvent aEvent;
    1688           0 :             aEvent.type                 = ClientMessage;
    1689           0 :             aEvent.xclient.display      = m_pDisplay;
    1690           0 :             aEvent.xclient.window       = pFrame->GetShellWindow();
    1691           0 :             aEvent.xclient.message_type = m_aWMAtoms[ WIN_STATE ];
    1692           0 :             aEvent.xclient.format       = 32;
    1693           0 :             aEvent.xclient.data.l[0]    = (1<<2)|(1<<3);
    1694             :             aEvent.xclient.data.l[1]    =
    1695             :                 (bVertical ? (1<<2) : 0)
    1696           0 :                 | (bHorizontal ? (1<<3) : 0);
    1697           0 :             aEvent.xclient.data.l[2]    = 0;
    1698           0 :             aEvent.xclient.data.l[3]    = 0;
    1699           0 :             aEvent.xclient.data.l[4]    = 0;
    1700             :             XSendEvent( m_pDisplay,
    1701             :                         m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
    1702             :                         False,
    1703             :                         SubstructureNotifyMask,
    1704             :                         &aEvent
    1705           0 :                         );
    1706             :         }
    1707             :         else
    1708             :             // window not mapped yet, set _WIN_STATE directly
    1709           0 :             setGnomeWMState( pFrame );
    1710             : 
    1711           0 :         if( !bHorizontal && !bVertical )
    1712           0 :             pFrame->maRestorePosSize = Rectangle();
    1713           0 :         else if( pFrame->maRestorePosSize.IsEmpty() )
    1714             :         {
    1715           0 :             const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() );
    1716             :             pFrame->maRestorePosSize =
    1717           0 :                 Rectangle( Point( rGeom.nX, rGeom.nY ), Size( rGeom.nWidth, rGeom.nHeight ) );
    1718           0 :         }
    1719             :     }
    1720             :     else
    1721           0 :         WMAdaptor::maximizeFrame( pFrame, bHorizontal, bVertical );
    1722           0 : }
    1723             : 
    1724             : /*
    1725             :  *  WMAdaptor::enableAlwaysOnTop
    1726             :  */
    1727           0 : void WMAdaptor::enableAlwaysOnTop( X11SalFrame*, bool /*bEnable*/ ) const
    1728             : {
    1729           0 : }
    1730             : 
    1731             : /*
    1732             :  *  NetWMAdaptor::enableAlwaysOnTop
    1733             :  */
    1734           0 : void NetWMAdaptor::enableAlwaysOnTop( X11SalFrame* pFrame, bool bEnable ) const
    1735             : {
    1736           0 :     pFrame->bAlwaysOnTop_ = bEnable;
    1737           0 :     if( m_aWMAtoms[ NET_WM_STATE_STAYS_ON_TOP ] )
    1738             :     {
    1739           0 :         if( pFrame->bMapped_ )
    1740             :         {
    1741             :             // window already mapped, send WM a message
    1742             :             XEvent aEvent;
    1743           0 :             aEvent.type                 = ClientMessage;
    1744           0 :             aEvent.xclient.display      = m_pDisplay;
    1745           0 :             aEvent.xclient.window       = pFrame->GetShellWindow();
    1746           0 :             aEvent.xclient.message_type = m_aWMAtoms[ NET_WM_STATE ];
    1747           0 :             aEvent.xclient.format       = 32;
    1748           0 :             aEvent.xclient.data.l[0]    = bEnable ? 1 : 0;
    1749           0 :             aEvent.xclient.data.l[1]    = m_aWMAtoms[ NET_WM_STATE_STAYS_ON_TOP ];
    1750           0 :             aEvent.xclient.data.l[2]    = 0;
    1751           0 :             aEvent.xclient.data.l[3]    = 0;
    1752           0 :             aEvent.xclient.data.l[4]    = 0;
    1753             :             XSendEvent( m_pDisplay,
    1754             :                         m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
    1755             :                         False,
    1756             :                         SubstructureNotifyMask | SubstructureRedirectMask,
    1757             :                         &aEvent
    1758           0 :                         );
    1759             :         }
    1760             :         else
    1761           0 :             setNetWMState( pFrame );
    1762             :     }
    1763           0 : }
    1764             : 
    1765             : /*
    1766             :  *  GnomeWMAdaptor::enableAlwaysOnTop
    1767             :  */
    1768           0 : void GnomeWMAdaptor::enableAlwaysOnTop( X11SalFrame* pFrame, bool bEnable ) const
    1769             : {
    1770           0 :     pFrame->bAlwaysOnTop_ = bEnable;
    1771           0 :     if( m_aWMAtoms[ WIN_LAYER ] )
    1772             :     {
    1773           0 :         if( pFrame->bMapped_ )
    1774             :         {
    1775             :             // window already mapped, send WM a message
    1776             :             XEvent aEvent;
    1777           0 :             aEvent.type                 = ClientMessage;
    1778           0 :             aEvent.xclient.display      = m_pDisplay;
    1779           0 :             aEvent.xclient.window       = pFrame->GetShellWindow();
    1780           0 :             aEvent.xclient.message_type = m_aWMAtoms[ WIN_LAYER ];
    1781           0 :             aEvent.xclient.format       = 32;
    1782           0 :             aEvent.xclient.data.l[0]    = bEnable ? 6 : 4;
    1783           0 :             aEvent.xclient.data.l[1]    = 0;
    1784           0 :             aEvent.xclient.data.l[2]    = 0;
    1785           0 :             aEvent.xclient.data.l[3]    = 0;
    1786           0 :             aEvent.xclient.data.l[4]    = 0;
    1787             :             XSendEvent( m_pDisplay,
    1788             :                         m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
    1789             :                         False,
    1790             :                         SubstructureNotifyMask | SubstructureRedirectMask,
    1791             :                         &aEvent
    1792           0 :                         );
    1793             :         }
    1794             :         else
    1795             :         {
    1796           0 :             sal_uInt32 nNewLayer = bEnable ? 6 : 4;
    1797             :             XChangeProperty( m_pDisplay,
    1798             :                              pFrame->GetShellWindow(),
    1799           0 :                              m_aWMAtoms[ WIN_LAYER ],
    1800             :                              XA_CARDINAL,
    1801             :                              32,
    1802             :                              PropModeReplace,
    1803             :                              (unsigned char*)&nNewLayer,
    1804             :                              1
    1805           0 :                              );
    1806             :         }
    1807             :     }
    1808           0 : }
    1809             : 
    1810             : /*
    1811             :  *  WMAdaptor::changeReferenceFrame
    1812             :  */
    1813           0 : void WMAdaptor::changeReferenceFrame( X11SalFrame* pFrame, X11SalFrame* pReferenceFrame ) const
    1814             : {
    1815           0 :     if( ! ( pFrame->nStyle_ & SAL_FRAME_STYLE_PLUG )
    1816           0 :         && ! pFrame->IsOverrideRedirect()
    1817           0 :         && ! pFrame->IsFloatGrabWindow()
    1818             :         )
    1819             :     {
    1820           0 :         XLIB_Window aTransient = pFrame->pDisplay_->GetRootWindow( pFrame->GetScreenNumber() );
    1821           0 :         pFrame->mbTransientForRoot = true;
    1822           0 :         if( pReferenceFrame )
    1823             :         {
    1824           0 :             aTransient = pReferenceFrame->GetShellWindow();
    1825           0 :             pFrame->mbTransientForRoot = false;
    1826             :         }
    1827             :         XSetTransientForHint( m_pDisplay,
    1828             :                               pFrame->GetShellWindow(),
    1829           0 :                               aTransient );
    1830             :     }
    1831           0 : }
    1832             : 
    1833             : /*
    1834             :  *  WMAdaptor::handlePropertyNotify
    1835             :  */
    1836           0 : int WMAdaptor::handlePropertyNotify( X11SalFrame*, XPropertyEvent* ) const
    1837             : {
    1838           0 :     return 0;
    1839             : }
    1840             : 
    1841             : /*
    1842             :  *  NetWMAdaptor::handlePropertyNotify
    1843             :  */
    1844           0 : int NetWMAdaptor::handlePropertyNotify( X11SalFrame* pFrame, XPropertyEvent* pEvent ) const
    1845             : {
    1846           0 :     int nHandled = 1;
    1847           0 :     if( pEvent->atom == m_aWMAtoms[ NET_WM_STATE ] )
    1848             :     {
    1849           0 :         pFrame->mbMaximizedHorz = pFrame->mbMaximizedVert = false;
    1850           0 :         pFrame->mbShaded = false;
    1851             : 
    1852           0 :         if( pEvent->state == PropertyNewValue )
    1853             :         {
    1854             :             Atom nType, *pStates;
    1855             :             int nFormat;
    1856             :             unsigned long nItems, nBytesLeft;
    1857           0 :             unsigned char* pData = NULL;
    1858           0 :             long nOffset = 0;
    1859           0 :             do
    1860             :             {
    1861             :                 XGetWindowProperty( m_pDisplay,
    1862             :                                     pEvent->window,
    1863           0 :                                     m_aWMAtoms[ NET_WM_STATE ],
    1864             :                                     nOffset, 64,
    1865             :                                     False,
    1866             :                                     XA_ATOM,
    1867             :                                     &nType,
    1868             :                                     &nFormat,
    1869             :                                     &nItems, &nBytesLeft,
    1870           0 :                                     &pData );
    1871           0 :                 if( pData )
    1872             :                 {
    1873           0 :                     if( nType == XA_ATOM && nFormat == 32 && nItems > 0 )
    1874             :                     {
    1875           0 :                         pStates = (Atom*)pData;
    1876           0 :                         for( unsigned long i = 0; i < nItems; i++ )
    1877             :                         {
    1878           0 :                             if( pStates[i] == m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ] && m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_VERT ] )
    1879           0 :                                 pFrame->mbMaximizedVert = true;
    1880           0 :                             else if( pStates[i] == m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_HORZ ] && m_aWMAtoms[ NET_WM_STATE_MAXIMIZED_HORZ ] )
    1881           0 :                                 pFrame->mbMaximizedHorz = true;
    1882           0 :                             else if( pStates[i] == m_aWMAtoms[ NET_WM_STATE_SHADED ] && m_aWMAtoms[ NET_WM_STATE_SHADED ] )
    1883           0 :                                 pFrame->mbShaded = true;
    1884             :                         }
    1885             :                     }
    1886           0 :                     XFree( pData );
    1887           0 :                     pData = NULL;
    1888           0 :                     nOffset += nItems * nFormat / 32;
    1889             :                 }
    1890             :                 else
    1891           0 :                     break;
    1892             :             } while( nBytesLeft > 0 );
    1893             :         }
    1894             : 
    1895           0 :         if( ! (pFrame->mbMaximizedHorz || pFrame->mbMaximizedVert ) )
    1896           0 :             pFrame->maRestorePosSize = Rectangle();
    1897             :         else
    1898             :         {
    1899           0 :             const SalFrameGeometry& rGeom = pFrame->GetUnmirroredGeometry();
    1900             :             // the current geometry may already be changed by the corresponding
    1901             :             // ConfigureNotify, but this cannot be helped
    1902             :             pFrame->maRestorePosSize =
    1903             :                 Rectangle( Point( rGeom.nX, rGeom.nY ),
    1904           0 :                            Size( rGeom.nWidth, rGeom.nHeight ) );
    1905             :         }
    1906             :     }
    1907           0 :     else if( pEvent->atom == m_aWMAtoms[ NET_WM_DESKTOP ] )
    1908             :     {
    1909           0 :         pFrame->m_nWorkArea = getWindowWorkArea( pFrame->GetShellWindow() );
    1910             :     }
    1911             :     else
    1912           0 :         nHandled = 0;
    1913             : 
    1914           0 :     return nHandled;
    1915             : }
    1916             : 
    1917             : /*
    1918             :  *  GnomeWMAdaptor::handlePropertyNotify
    1919             :  */
    1920           0 : int GnomeWMAdaptor::handlePropertyNotify( X11SalFrame* pFrame, XPropertyEvent* pEvent ) const
    1921             : {
    1922           0 :     int nHandled = 1;
    1923           0 :     if( pEvent->atom == m_aWMAtoms[ WIN_STATE ] )
    1924             :     {
    1925           0 :         pFrame->mbMaximizedHorz = pFrame->mbMaximizedVert = false;
    1926           0 :         pFrame->mbShaded = false;
    1927             : 
    1928           0 :         if( pEvent->state == PropertyNewValue )
    1929             :         {
    1930             :             Atom nType;
    1931           0 :             int nFormat = 0;
    1932           0 :             unsigned long nItems = 0;
    1933           0 :             unsigned long nBytesLeft = 0;
    1934           0 :             unsigned char* pData = 0;
    1935             :             XGetWindowProperty( m_pDisplay,
    1936             :                                 pEvent->window,
    1937           0 :                                 m_aWMAtoms[ WIN_STATE ],
    1938             :                                 0, 1,
    1939             :                                 False,
    1940             :                                 XA_CARDINAL,
    1941             :                                 &nType,
    1942             :                                 &nFormat,
    1943             :                                 &nItems, &nBytesLeft,
    1944           0 :                                 &pData );
    1945           0 :             if( pData )
    1946             :             {
    1947           0 :                 if( nType == XA_CARDINAL && nFormat == 32 && nItems == 1 )
    1948             :                 {
    1949           0 :                     sal_uInt32 nWinState = *(sal_uInt32*)pData;
    1950           0 :                     if( nWinState & (1<<2) )
    1951           0 :                         pFrame->mbMaximizedVert = true;
    1952           0 :                     if( nWinState & (1<<3) )
    1953           0 :                         pFrame->mbMaximizedHorz = true;
    1954           0 :                     if( nWinState & (1<<5) )
    1955           0 :                         pFrame->mbShaded = true;
    1956             :                 }
    1957           0 :                 XFree( pData );
    1958             :             }
    1959             :         }
    1960             : 
    1961           0 :         if( ! (pFrame->mbMaximizedHorz || pFrame->mbMaximizedVert ) )
    1962           0 :             pFrame->maRestorePosSize = Rectangle();
    1963             :         else
    1964             :         {
    1965           0 :             const SalFrameGeometry& rGeom = pFrame->GetUnmirroredGeometry();
    1966             :             // the current geometry may already be changed by the corresponding
    1967             :             // ConfigureNotify, but this cannot be helped
    1968             :             pFrame->maRestorePosSize =
    1969             :                 Rectangle( Point( rGeom.nX, rGeom.nY ),
    1970           0 :                            Size( rGeom.nWidth, rGeom.nHeight ) );
    1971             :         }
    1972             :     }
    1973           0 :     else if( pEvent->atom == m_aWMAtoms[ NET_WM_DESKTOP ] )
    1974             :     {
    1975           0 :         pFrame->m_nWorkArea = getWindowWorkArea( pFrame->GetShellWindow() );
    1976             :     }
    1977             :     else
    1978           0 :         nHandled = 0;
    1979             : 
    1980           0 :     return nHandled;
    1981             : }
    1982             : 
    1983             : /*
    1984             :  * WMAdaptor::shade
    1985             :  */
    1986           0 : void WMAdaptor::shade( X11SalFrame*, bool /*bToShaded*/ ) const
    1987             : {
    1988           0 : }
    1989             : 
    1990             : /*
    1991             :  * NetWMAdaptor::shade
    1992             :  */
    1993           0 : void NetWMAdaptor::shade( X11SalFrame* pFrame, bool bToShaded ) const
    1994             : {
    1995           0 :     if( m_aWMAtoms[ NET_WM_STATE ]
    1996           0 :         && m_aWMAtoms[ NET_WM_STATE_SHADED ]
    1997             :         && ( pFrame->nStyle_ & ~SAL_FRAME_STYLE_DEFAULT )
    1998             :         )
    1999             :     {
    2000           0 :         pFrame->mbShaded = bToShaded;
    2001           0 :         if( pFrame->bMapped_ )
    2002             :         {
    2003             :             // window already mapped, send WM a message
    2004             :             XEvent aEvent;
    2005           0 :             aEvent.type                 = ClientMessage;
    2006           0 :             aEvent.xclient.display      = m_pDisplay;
    2007           0 :             aEvent.xclient.window       = pFrame->GetShellWindow();
    2008           0 :             aEvent.xclient.message_type = m_aWMAtoms[ NET_WM_STATE ];
    2009           0 :             aEvent.xclient.format       = 32;
    2010           0 :             aEvent.xclient.data.l[0]    = bToShaded ? 1 : 0;
    2011           0 :             aEvent.xclient.data.l[1]    = m_aWMAtoms[ NET_WM_STATE_SHADED ];
    2012           0 :             aEvent.xclient.data.l[2]    = 0;
    2013           0 :             aEvent.xclient.data.l[3]    = 0;
    2014           0 :             aEvent.xclient.data.l[4]    = 0;
    2015             :             XSendEvent( m_pDisplay,
    2016             :                         m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
    2017             :                         False,
    2018             :                         SubstructureNotifyMask | SubstructureRedirectMask,
    2019             :                         &aEvent
    2020           0 :                         );
    2021             :         }
    2022             :         else
    2023             :         {
    2024             :             // window not mapped yet, set _NET_WM_STATE directly
    2025           0 :             setNetWMState( pFrame );
    2026             :         }
    2027             :     }
    2028           0 : }
    2029             : 
    2030             : /*
    2031             :  *  GnomeWMAdaptor::shade
    2032             :  */
    2033           0 : void GnomeWMAdaptor::shade( X11SalFrame* pFrame, bool bToShaded ) const
    2034             : {
    2035           0 :     if( m_aWMAtoms[ WIN_STATE ] )
    2036             :     {
    2037           0 :         pFrame->mbShaded = bToShaded;
    2038           0 :         if( pFrame->bMapped_ )
    2039             :         {
    2040             :             // window already mapped, send WM a message
    2041             :             XEvent aEvent;
    2042           0 :             aEvent.type                 = ClientMessage;
    2043           0 :             aEvent.xclient.display      = m_pDisplay;
    2044           0 :             aEvent.xclient.window       = pFrame->GetShellWindow();
    2045           0 :             aEvent.xclient.message_type = m_aWMAtoms[ WIN_STATE ];
    2046           0 :             aEvent.xclient.format       = 32;
    2047           0 :             aEvent.xclient.data.l[0]    = (1<<5);
    2048           0 :             aEvent.xclient.data.l[1]    = bToShaded ? (1<<5) : 0;
    2049           0 :             aEvent.xclient.data.l[2]    = 0;
    2050           0 :             aEvent.xclient.data.l[3]    = 0;
    2051           0 :             aEvent.xclient.data.l[4]    = 0;
    2052             :             XSendEvent( m_pDisplay,
    2053             :                         m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
    2054             :                         False,
    2055             :                         SubstructureNotifyMask | SubstructureRedirectMask,
    2056             :                         &aEvent
    2057           0 :                         );
    2058             :         }
    2059             :         else
    2060           0 :             setGnomeWMState( pFrame );
    2061             :     }
    2062           0 : }
    2063             : 
    2064             : /*
    2065             :  *  WMAdaptor::showFullScreen
    2066             :  */
    2067           0 : void WMAdaptor::showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const
    2068             : {
    2069           0 :     pFrame->mbFullScreen = bFullScreen;
    2070           0 :     maximizeFrame( pFrame, bFullScreen, bFullScreen );
    2071           0 : }
    2072             : 
    2073             : /*
    2074             :  *  NetWMAdaptor::showFullScreen
    2075             :  */
    2076           0 : void NetWMAdaptor::showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const
    2077             : {
    2078           0 :     if( m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ] )
    2079             :     {
    2080           0 :         pFrame->mbFullScreen = bFullScreen;
    2081           0 :         if( bFullScreen )
    2082             :         {
    2083           0 :             if( m_aWMAtoms[ MOTIF_WM_HINTS ] )
    2084             :             {
    2085             :                 XDeleteProperty( m_pDisplay,
    2086             :                                  pFrame->GetShellWindow(),
    2087           0 :                                 m_aWMAtoms[ MOTIF_WM_HINTS ] );
    2088             :             }
    2089             :         }
    2090           0 :         if( pFrame->bMapped_ )
    2091             :         {
    2092             :             // window already mapped, send WM a message
    2093             :             XEvent aEvent;
    2094           0 :             aEvent.type                 = ClientMessage;
    2095           0 :             aEvent.xclient.display      = m_pDisplay;
    2096           0 :             aEvent.xclient.window       = pFrame->GetShellWindow();
    2097           0 :             aEvent.xclient.message_type = m_aWMAtoms[ NET_WM_STATE ];
    2098           0 :             aEvent.xclient.format       = 32;
    2099           0 :             aEvent.xclient.data.l[0]    = bFullScreen ? 1 : 0;
    2100           0 :             aEvent.xclient.data.l[1]    = m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ];
    2101           0 :             aEvent.xclient.data.l[2]    = 0;
    2102           0 :             aEvent.xclient.data.l[3]    = 0;
    2103           0 :             aEvent.xclient.data.l[4]    = 0;
    2104             :             XSendEvent( m_pDisplay,
    2105             :                         m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
    2106             :                         False,
    2107             :                         SubstructureNotifyMask | SubstructureRedirectMask,
    2108             :                         &aEvent
    2109           0 :                         );
    2110             :         }
    2111             :         else
    2112             :         {
    2113             :             // window not mapped yet, set _NET_WM_STATE directly
    2114           0 :             setNetWMState( pFrame );
    2115             :         }
    2116             :         // #i42750# guess size before resize event shows up
    2117           0 :         if( bFullScreen )
    2118             :         {
    2119           0 :             if( m_pSalDisplay->IsXinerama() )
    2120             :             {
    2121             :                 XLIB_Window aRoot, aChild;
    2122           0 :                 int root_x = 0, root_y = 0, lx, ly;
    2123             :                 unsigned int mask;
    2124             :                 XQueryPointer( m_pDisplay,
    2125             :                 m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
    2126             :                 &aRoot, &aChild,
    2127           0 :                 &root_x, &root_y, &lx, &ly, &mask );
    2128           0 :                 const std::vector< Rectangle >& rScreens = m_pSalDisplay->GetXineramaScreens();
    2129           0 :                 Point aMousePoint( root_x, root_y );
    2130           0 :                 for( unsigned int i = 0; i < rScreens.size(); i++ )
    2131             :                 {
    2132           0 :                     if( rScreens[i].IsInside( aMousePoint ) )
    2133             :                     {
    2134           0 :                         pFrame->maGeometry.nX       = rScreens[i].Left();
    2135           0 :                         pFrame->maGeometry.nY       = rScreens[i].Top();
    2136           0 :                         pFrame->maGeometry.nWidth   = rScreens[i].GetWidth();
    2137           0 :                         pFrame->maGeometry.nHeight  = rScreens[i].GetHeight();
    2138           0 :                         break;
    2139             :                     }
    2140             :                 }
    2141             :             }
    2142             :             else
    2143             :             {
    2144           0 :                 Size aSize = m_pSalDisplay->GetScreenSize( pFrame->GetScreenNumber() );
    2145           0 :                 pFrame->maGeometry.nX       = 0;
    2146           0 :                 pFrame->maGeometry.nY       = 0;
    2147           0 :                 pFrame->maGeometry.nWidth   = aSize.Width();
    2148           0 :                 pFrame->maGeometry.nHeight  = aSize.Height();
    2149             :             }
    2150           0 :             pFrame->CallCallback( SALEVENT_MOVERESIZE, NULL );
    2151             :         }
    2152             :     }
    2153           0 :     else WMAdaptor::showFullScreen( pFrame, bFullScreen );
    2154           0 : }
    2155             : 
    2156             : /*
    2157             :  *  WMAdaptor::getCurrentWorkArea
    2158             :  */
    2159             : // FIXME: multiscreen case
    2160           0 : int WMAdaptor::getCurrentWorkArea() const
    2161             : {
    2162           0 :     int nCurrent = -1;
    2163           0 :     if( m_aWMAtoms[ NET_CURRENT_DESKTOP ] )
    2164             :     {
    2165           0 :         Atom                aRealType   = None;
    2166           0 :         int                 nFormat     = 8;
    2167           0 :         unsigned long       nItems      = 0;
    2168           0 :         unsigned long       nBytesLeft  = 0;
    2169           0 :         unsigned char*  pProperty   = NULL;
    2170           0 :         if( XGetWindowProperty( m_pDisplay,
    2171             :                                 m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
    2172           0 :                                 m_aWMAtoms[ NET_CURRENT_DESKTOP ],
    2173             :                                 0, 1,
    2174             :                                 False,
    2175             :                                 XA_CARDINAL,
    2176             :                                 &aRealType,
    2177             :                                 &nFormat,
    2178             :                                 &nItems,
    2179             :                                 &nBytesLeft,
    2180           0 :                                 &pProperty ) == 0
    2181             :                                 && pProperty
    2182             :         )
    2183             :         {
    2184           0 :             nCurrent = int(*(sal_Int32*)pProperty);
    2185           0 :             XFree( pProperty );
    2186             :         }
    2187           0 :         else if( pProperty )
    2188             :         {
    2189           0 :             XFree( pProperty );
    2190           0 :             pProperty = NULL;
    2191             :         }
    2192             :     }
    2193           0 :     return nCurrent;
    2194             : }
    2195             : 
    2196             : /*
    2197             :  *  WMAdaptor::getWindowWorkArea
    2198             :  */
    2199           0 : int WMAdaptor::getWindowWorkArea( XLIB_Window aWindow ) const
    2200             : {
    2201           0 :     int nCurrent = -1;
    2202           0 :     if( m_aWMAtoms[ NET_WM_DESKTOP ] )
    2203             :     {
    2204           0 :         Atom                aRealType   = None;
    2205           0 :         int                 nFormat     = 8;
    2206           0 :         unsigned long       nItems      = 0;
    2207           0 :         unsigned long       nBytesLeft  = 0;
    2208           0 :         unsigned char*  pProperty   = NULL;
    2209           0 :         if( XGetWindowProperty( m_pDisplay,
    2210             :                                 aWindow,
    2211           0 :                                 m_aWMAtoms[ NET_WM_DESKTOP ],
    2212             :                                 0, 1,
    2213             :                                 False,
    2214             :                                 XA_CARDINAL,
    2215             :                                 &aRealType,
    2216             :                                 &nFormat,
    2217             :                                 &nItems,
    2218             :                                 &nBytesLeft,
    2219           0 :                                 &pProperty ) == 0
    2220             :                                 && pProperty
    2221             :         )
    2222             :         {
    2223           0 :             nCurrent = int(*(sal_Int32*)pProperty);
    2224           0 :             XFree( pProperty );
    2225             :         }
    2226           0 :         else if( pProperty )
    2227             :         {
    2228           0 :             XFree( pProperty );
    2229           0 :             pProperty = NULL;
    2230             :         }
    2231             :     }
    2232           0 :     return nCurrent;
    2233             : }
    2234             : 
    2235             : /*
    2236             :  *  WMAdaptor::getCurrentWorkArea
    2237             :  */
    2238             : // fixme: multi screen case
    2239           0 : void WMAdaptor::switchToWorkArea( int nWorkArea, bool bConsiderWM ) const
    2240             : {
    2241           0 :     if( bConsiderWM && ! getWMshouldSwitchWorkspace() )
    2242           0 :         return;
    2243             : 
    2244           0 :     if( m_aWMAtoms[ NET_CURRENT_DESKTOP ] )
    2245             :     {
    2246             :         XEvent aEvent;
    2247           0 :         aEvent.type                 = ClientMessage;
    2248           0 :         aEvent.xclient.display      = m_pDisplay;
    2249           0 :         aEvent.xclient.window       = m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() );
    2250           0 :         aEvent.xclient.message_type = m_aWMAtoms[ NET_CURRENT_DESKTOP ];
    2251           0 :         aEvent.xclient.format       = 32;
    2252           0 :         aEvent.xclient.data.l[0]    = nWorkArea;
    2253           0 :         aEvent.xclient.data.l[1]    = 0;
    2254           0 :         aEvent.xclient.data.l[2]    = 0;
    2255           0 :         aEvent.xclient.data.l[3]    = 0;
    2256           0 :         aEvent.xclient.data.l[4]    = 0;
    2257             :         XSendEvent( m_pDisplay,
    2258             :                     m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
    2259             :                     False,
    2260             :                     SubstructureNotifyMask | SubstructureRedirectMask,
    2261             :                     &aEvent
    2262           0 :                     );
    2263             :     }
    2264             : }
    2265             : 
    2266             : /*
    2267             :  * WMAdaptor::frameIsMapping
    2268             :  */
    2269           0 : void WMAdaptor::frameIsMapping( X11SalFrame* ) const
    2270             : {
    2271           0 : }
    2272             : 
    2273             : /*
    2274             :  * NetWMAdaptor::frameIsMapping
    2275             :  */
    2276           0 : void NetWMAdaptor::frameIsMapping( X11SalFrame* pFrame ) const
    2277             : {
    2278           0 :     setNetWMState( pFrame );
    2279           0 : }
    2280             : 
    2281             : /*
    2282             :  * WMAdaptor::setFrameStruts
    2283             :  */
    2284           0 : void WMAdaptor::setFrameStruts( X11SalFrame*,
    2285             :                                 int, int, int, int,
    2286             :                                 int, int, int, int,
    2287             :                                 int, int, int, int ) const
    2288             : {
    2289           0 : }
    2290             : 
    2291             : /*
    2292             :  * NetWMAdaptor::setFrameStruts
    2293             :  */
    2294           0 : void NetWMAdaptor::setFrameStruts( X11SalFrame* pFrame,
    2295             :                                    int left, int right, int top, int bottom,
    2296             :                                    int left_start_y, int left_end_y,
    2297             :                                    int right_start_y, int right_end_y,
    2298             :                                    int top_start_x, int top_end_x,
    2299             :                                    int bottom_start_x, int bottom_end_x ) const
    2300             : {
    2301             :     long nData[12];
    2302           0 :     nData[0] = left;
    2303           0 :     nData[1] = right;
    2304           0 :     nData[2] = top;
    2305           0 :     nData[3] = bottom;
    2306           0 :     nData[4] = left_start_y;
    2307           0 :     nData[5] = left_end_y;
    2308           0 :     nData[6] = right_start_y;
    2309           0 :     nData[7] = right_end_y;
    2310           0 :     nData[8] = top_start_x;
    2311           0 :     nData[9] = top_end_x;
    2312           0 :     nData[10]= bottom_start_x;
    2313           0 :     nData[11]= bottom_end_x;
    2314           0 :     Atom aProperty = None;
    2315           0 :     int nSetData = 0;
    2316             : 
    2317           0 :     if( m_aWMAtoms[NET_WM_STRUT_PARTIAL] )
    2318             :     {
    2319           0 :         aProperty = m_aWMAtoms[NET_WM_STRUT_PARTIAL];
    2320           0 :         nSetData = 12;
    2321             :     }
    2322           0 :     else if( m_aWMAtoms[NET_WM_STRUT] )
    2323             :     {
    2324           0 :         aProperty = m_aWMAtoms[NET_WM_STRUT];
    2325           0 :         nSetData = 4;
    2326             :     }
    2327           0 :     if( nSetData )
    2328             :     {
    2329             :             XChangeProperty( m_pDisplay,
    2330             :                              pFrame->GetShellWindow(),
    2331             :                              aProperty,
    2332             :                              XA_CARDINAL,
    2333             :                              32,
    2334             :                              PropModeReplace,
    2335             :                              (unsigned char*)&nData,
    2336             :                              nSetData
    2337           0 :                              );
    2338             :     }
    2339           0 : }
    2340             : 
    2341             : /*
    2342             :  * WMAdaptor::setUserTime
    2343             :  */
    2344           0 : void WMAdaptor::setUserTime( X11SalFrame*, long ) const
    2345             : {
    2346           0 : }
    2347             : 
    2348             : /*
    2349             :  * NetWMAdaptor::setUserTime
    2350             :  */
    2351           0 : void NetWMAdaptor::setUserTime( X11SalFrame* i_pFrame, long i_nUserTime ) const
    2352             : {
    2353           0 :     if( m_aWMAtoms[NET_WM_USER_TIME] )
    2354             :     {
    2355             :         XChangeProperty( m_pDisplay,
    2356             :                          i_pFrame->GetShellWindow(),
    2357           0 :                          m_aWMAtoms[NET_WM_USER_TIME],
    2358             :                          XA_CARDINAL,
    2359             :                          32,
    2360             :                          PropModeReplace,
    2361             :                          (unsigned char*)&i_nUserTime,
    2362             :                          1
    2363           0 :                          );
    2364             :     }
    2365           0 : }
    2366             : 
    2367             : /*
    2368             :  * WMAdaptor::setPID
    2369             :  */
    2370           0 : void WMAdaptor::setPID( X11SalFrame* i_pFrame ) const
    2371             : {
    2372           0 :     if( m_aWMAtoms[NET_WM_PID] )
    2373             :     {
    2374           0 :         long nPID = (long)getpid();
    2375             :         XChangeProperty( m_pDisplay,
    2376             :                          i_pFrame->GetShellWindow(),
    2377           0 :                          m_aWMAtoms[NET_WM_PID],
    2378             :                          XA_CARDINAL,
    2379             :                          32,
    2380             :                          PropModeReplace,
    2381             :                          (unsigned char*)&nPID,
    2382             :                          1
    2383           0 :                          );
    2384             :     }
    2385           0 : }
    2386             : 
    2387             : /*
    2388             : * WMAdaptor::setClientMachine
    2389             : */
    2390           0 : void WMAdaptor::setClientMachine( X11SalFrame* i_pFrame ) const
    2391             : {
    2392           0 :     rtl::OString aWmClient( rtl::OUStringToOString( GetGenericData()->GetHostname(), RTL_TEXTENCODING_ASCII_US ) );
    2393           0 :     XTextProperty aClientProp = { (unsigned char*)aWmClient.getStr(), XA_STRING, 8, sal::static_int_cast<unsigned long>( aWmClient.getLength() ) };
    2394           0 :     XSetWMClientMachine( m_pDisplay, i_pFrame->GetShellWindow(), &aClientProp );
    2395           0 : }
    2396             : 
    2397           0 : void WMAdaptor::answerPing( X11SalFrame* i_pFrame, XClientMessageEvent* i_pEvent ) const
    2398             : {
    2399           0 :     if( m_aWMAtoms[NET_WM_PING] &&
    2400           0 :         i_pEvent->message_type == m_aWMAtoms[ WM_PROTOCOLS ] &&
    2401           0 :         (Atom)i_pEvent->data.l[0] == m_aWMAtoms[ NET_WM_PING ] )
    2402             :     {
    2403             :         XEvent aEvent;
    2404           0 :         aEvent.xclient = *i_pEvent;
    2405           0 :         aEvent.xclient.window = m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() );
    2406             :         XSendEvent( m_pDisplay,
    2407             :                     m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() ),
    2408             :                     False,
    2409             :                     SubstructureNotifyMask | SubstructureRedirectMask,
    2410             :                     &aEvent
    2411           0 :                     );
    2412           0 :         XFlush( m_pDisplay );
    2413             :     }
    2414           0 : }
    2415             : 
    2416             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10