diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2010-10-25 17:41:04 +0200 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2010-10-25 17:41:04 +0200 |
commit | a420a92b26cb536f6329d176f7349c63e7cfa4d8 (patch) | |
tree | e01480433d6d5a7d4dd14d2cb2d695743564d3ae | |
parent | 68c2ef528c118806f2306794de085ba05b81cfbb (diff) |
vcl116: #i96684# optionally do not switch workspaces of WM
-rw-r--r-- | vcl/unx/inc/wmadaptor.hxx | 6 | ||||
-rw-r--r-- | vcl/unx/source/app/wmadaptor.cxx | 58 |
2 files changed, 49 insertions, 15 deletions
diff --git a/vcl/unx/inc/wmadaptor.hxx b/vcl/unx/inc/wmadaptor.hxx index cbedede2cc99..e8620db29c6f 100644 --- a/vcl/unx/inc/wmadaptor.hxx +++ b/vcl/unx/inc/wmadaptor.hxx @@ -165,6 +165,8 @@ protected: bool m_bLegacyPartialFullscreen; int m_nWinGravity; int m_nInitWinGravity; + bool m_bWMshouldSwitchWorkspace; + bool m_bWMshouldSwitchWorkspaceInit; WMAdaptor( SalDisplay * ) ; @@ -177,6 +179,7 @@ protected: */ virtual bool isValid() const; + bool getWMshouldSwitchWorkspace() const; public: virtual ~WMAdaptor(); @@ -214,8 +217,9 @@ public: /* * attemp to switch the desktop to a certain workarea + * if bConsiderWM is true, then on some WMs the call will not result in any action */ - void switchToWorkArea( int nWorkArea ) const; + void switchToWorkArea( int nWorkArea, bool bConsiderWM = true ) const; /* * sets window title diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx index aa2e4c84ef24..f816c5d1426e 100644 --- a/vcl/unx/source/app/wmadaptor.cxx +++ b/vcl/unx/source/app/wmadaptor.cxx @@ -31,21 +31,22 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> -#include <sal/alloca.h> -#include <wmadaptor.hxx> -#include <saldisp.hxx> -#include <saldata.hxx> -#include <salframe.h> -#include <vcl/salgdi.hxx> -#include <osl/thread.h> -#include <rtl/locale.h> -#include <osl/process.h> - -#include <tools/prex.h> +#include "sal/alloca.h" +#include "wmadaptor.hxx" +#include "saldisp.hxx" +#include "saldata.hxx" +#include "salframe.h" +#include "vcl/salgdi.hxx" +#include "osl/thread.h" +#include "rtl/locale.h" +#include "osl/process.h" +#include "vcl/configsettings.hxx" + +#include "tools/prex.h" #include <X11/X.h> #include <X11/Xatom.h> #include <X11/Xresource.h> -#include <tools/postx.h> +#include "tools/postx.h" #if OSL_DEBUG_LEVEL > 1 #include <stdio.h> @@ -238,7 +239,9 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) : m_bEnableAlwaysOnTopWorks( false ), m_bLegacyPartialFullscreen( false ), m_nWinGravity( StaticGravity ), - m_nInitWinGravity( StaticGravity ) + m_nInitWinGravity( StaticGravity ), + m_bWMshouldSwitchWorkspace( true ), + m_bWMshouldSwitchWorkspaceInit( false ) { Atom aRealType = None; int nFormat = 8; @@ -965,6 +968,30 @@ bool WMAdaptor::getNetWmName() return bNetWM; } +bool WMAdaptor::getWMshouldSwitchWorkspace() const +{ + if( ! m_bWMshouldSwitchWorkspaceInit ) + { + WMAdaptor * pWMA = const_cast<WMAdaptor*>(this); + + pWMA->m_bWMshouldSwitchWorkspace = true; + vcl::SettingsConfigItem* pItem = vcl::SettingsConfigItem::get(); + rtl::OUString aSetting( pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WM" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ShouldSwitchWorkspace" ) ) ) ); + if( aSetting.getLength() == 0 ) + { + if( m_aWMName.EqualsAscii( "awesome" ) ) + { + pWMA->m_bWMshouldSwitchWorkspace = false; + } + } + else + pWMA->m_bWMshouldSwitchWorkspace = aSetting.toBoolean(); + pWMA->m_bWMshouldSwitchWorkspaceInit = true; + } + return m_bWMshouldSwitchWorkspace; +} + /* * WMAdaptor::isValid() */ @@ -2338,8 +2365,11 @@ int WMAdaptor::getWindowWorkArea( XLIB_Window aWindow ) const * WMAdaptor::getCurrentWorkArea */ // fixme: multi screen case -void WMAdaptor::switchToWorkArea( int nWorkArea ) const +void WMAdaptor::switchToWorkArea( int nWorkArea, bool bConsiderWM ) const { + if( bConsiderWM && ! getWMshouldSwitchWorkspace() ) + return; + if( m_aWMAtoms[ NET_CURRENT_DESKTOP ] ) { XEvent aEvent; |