diff options
author | Kurt Zenker <kz@openoffice.org> | 2011-04-13 18:08:13 +0200 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2011-04-13 18:08:13 +0200 |
commit | 3790a43443ab652f17dd20d5fb7eb10a52ec9e8c (patch) | |
tree | 44551dc8ef768362091b5327da8fb92addac98a5 | |
parent | adb0b56e22c794b7f63ee19f4503cb38032e82d7 (diff) | |
parent | a5f4a3b00662d684b9d22045fae21e54a9adb442 (diff) |
CWS-TOOLING: integrate CWS impress211_OOO340
-rw-r--r-- | vcl/inc/unx/wmadaptor.hxx | 5 | ||||
-rwxr-xr-x | vcl/source/window/window.cxx | 2 | ||||
-rwxr-xr-x | vcl/source/window/wrkwin.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/app/saldata.cxx | 18 | ||||
-rw-r--r-- | vcl/unx/generic/app/wmadaptor.cxx | 66 | ||||
-rw-r--r-- | vcl/unx/generic/window/salframe.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtkdata.cxx | 24 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtkframe.cxx | 2 | ||||
-rwxr-xr-x | vcl/win/source/window/salframe.cxx | 31 |
9 files changed, 133 insertions, 20 deletions
diff --git a/vcl/inc/unx/wmadaptor.hxx b/vcl/inc/unx/wmadaptor.hxx index 88f0e62024a9..22750165c446 100644 --- a/vcl/inc/unx/wmadaptor.hxx +++ b/vcl/inc/unx/wmadaptor.hxx @@ -70,6 +70,7 @@ public: NET_WM_STATE_STAYS_ON_TOP, NET_WM_STATE_STICKY, NET_WM_STATE_FULLSCREEN, + NET_WM_FULLSCREEN_MONITORS, NET_WM_STRUT, NET_WM_STRUT_PARTIAL, NET_WM_USER_TIME, @@ -347,6 +348,10 @@ public: * if reference frame is NULL the root window is used instead */ void changeReferenceFrame( X11SalFrame* pFrame, X11SalFrame* pReferenceFrame ) const; + + /* set fullscreen monitor range; takes X11 window as input since it is also used by gtk plugin + */ + virtual void setFullScreenMonitors( XLIB_Window i_aWindow, sal_Int32 i_nScreen ); }; } // namespace diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index ac7101f079c0..f22b97e8426a 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -9784,7 +9784,7 @@ uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscr OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.rendering.SpriteCanvas.MultiScreen" )) : OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.rendering.Canvas" )), + "com.sun.star.rendering.Canvas.MultiScreen" )), aArg ), UNO_QUERY ); diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index 0e667de73067..5c50652afbe5 100755 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -181,7 +181,7 @@ void WorkWindow::ShowFullScreenMode( sal_Bool bFullScreenMode, sal_Int32 nDispla if ( !mbFullScreenMode == !bFullScreenMode ) return; - if( (nDisplay < 0) + if( (nDisplay < -1) || (nDisplay >= static_cast<sal_Int32>(Application::GetScreenCount()) ) ) { nDisplay = GetScreenNumber(); diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index ec8db9509bf6..8230fda8f09d 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -672,6 +672,8 @@ void SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) if (p_prioritize_timer != NULL) CheckTimeout(); + const int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1; + // first, check for already queued events. for ( int nFD = 0; nFD < nFDs_; nFD++ ) { @@ -679,20 +681,11 @@ void SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) if ( pEntry->fd ) { DBG_ASSERT( nFD == pEntry->fd, "wrong fd in Yield()" ); - if ( pEntry->HasPendingEvent() ) + for( int i = 0; i < nMaxEvents && pEntry->HasPendingEvent(); i++ ) { pEntry->HandleNextEvent(); - // #63862# da jetzt alle user-events ueber die interne - // queue kommen, wird die Kontrolle analog zum select - // gesteuerten Zweig einmal bei bWait abgegeben - - /* #i9277# do not reschedule since performance gets down the - the drain under heavy load - YieldMutexReleaser aReleaser; - if ( bWait ) osl_yieldThread(); - */ - - return; + if( ! bHandleAllCurrentEvents ) + return; } } } @@ -779,7 +772,6 @@ void SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) } if ( FD_ISSET( nFD, &ReadFDS ) ) { - int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1; for( int i = 0; pEntry->IsEventQueued() && i < nMaxEvents; i++ ) { pEntry->HandleNextEvent(); diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index 90b2e5426bdf..1d89ed264dcc 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -84,6 +84,7 @@ public: int top_start_x, int top_end_x, int bottom_start_x, int bottom_end_x ) const; virtual void setUserTime( X11SalFrame* i_pFrame, long i_nUserTime ) const; + virtual void setFullScreenMonitors( XLIB_Window i_aWindow, sal_Int32 i_nScreen ); }; class GnomeWMAdaptor : public WMAdaptor @@ -124,6 +125,7 @@ static const WMAdaptorProtocol aProtocolTab[] = { "_NET_CURRENT_DESKTOP", WMAdaptor::NET_CURRENT_DESKTOP }, { "_NET_NUMBER_OF_DESKTOPS", WMAdaptor::NET_NUMBER_OF_DESKTOPS }, { "_NET_WM_DESKTOP", WMAdaptor::NET_WM_DESKTOP }, + { "_NET_WM_FULLSCREEN_MONITORS", WMAdaptor::NET_WM_FULLSCREEN_MONITORS }, { "_NET_WM_ICON_NAME", WMAdaptor::NET_WM_ICON_NAME }, { "_NET_WM_PING", WMAdaptor::NET_WM_PING }, { "_NET_WM_STATE", WMAdaptor::NET_WM_STATE }, @@ -2546,3 +2548,67 @@ void WMAdaptor::answerPing( X11SalFrame* i_pFrame, XClientMessageEvent* i_pEvent XFlush( m_pDisplay ); } } + +/* +* WMAdaptor::setFullScreenMonitors +*/ +void WMAdaptor::setFullScreenMonitors( XLIB_Window, sal_Int32 ) +{ +} + +/* +* NetWMAdaptor::setFullScreenMonitors +*/ +void NetWMAdaptor::setFullScreenMonitors( XLIB_Window i_aWindow, sal_Int32 i_nScreen ) +{ + if( m_aWMAtoms[ NET_WM_FULLSCREEN_MONITORS ] ) + { + const std::vector< Rectangle >& rScreens( m_pSalDisplay->GetXineramaScreens() ); + if( m_pSalDisplay->IsXinerama() && rScreens.size() > 1 ) + { + long nSpannedMonitors[4] = {0,0,0,0}; + if( i_nScreen == -1 ) // all screens + { + long nLeft = rScreens.front().Left(); + long nRight = rScreens.front().Right(); + long nTop = rScreens.front().Top(); + long nBottom = rScreens.front().Bottom(); + for( long i = 1; i < long(rScreens.size()); ++ i ) + { + if( rScreens[i].Left() < nLeft ) + { + nLeft = rScreens[i].Left(); + nSpannedMonitors[2] = i; + } + if( rScreens[i].Top() < nTop ) + { + nTop = rScreens[i].Top(); + nSpannedMonitors[0] = i; + } + if( rScreens[i].Bottom() > nBottom ) + { + nBottom = rScreens[i].Bottom(); + nSpannedMonitors[1] = i; + } + if( rScreens[i].Right() > nRight ) + { + nRight = rScreens[i].Right(); + nSpannedMonitors[3] = i; + } + } + } + else + { + if( i_nScreen < 0 || i_nScreen >= sal_Int32(rScreens.size()) ) + i_nScreen = 0; + nSpannedMonitors[0] = nSpannedMonitors[1] = nSpannedMonitors[2] = nSpannedMonitors[3] = i_nScreen; + } + XChangeProperty( m_pDisplay, i_aWindow, + m_aWMAtoms[ NET_WM_FULLSCREEN_MONITORS ], + XA_CARDINAL, 32, + PropModeReplace, (unsigned char*)nSpannedMonitors, 4 ); + + } + } +} + diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index c0348beb6a34..940ab0ea5f56 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2223,7 +2223,10 @@ void X11SalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen ) if( GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) GetDisplay()->getWMAdaptor()->enableAlwaysOnTop( this, true ); else + { + GetDisplay()->getWMAdaptor()->setFullScreenMonitors( GetShellWindow(), nScreen ); GetDisplay()->getWMAdaptor()->showFullScreen( this, true ); + } if( bVisible ) Show(sal_True); diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index ffa61bc52c10..d468eef57d2a 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -208,6 +208,25 @@ void GtkSalDisplay::screenSizeChanged( GdkScreen* pScreen ) void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) { + /* Caution: since we support the _NET_WM_FULLSCREEN_MONITORS property now and + the EWMH spec says, the index used for that needs to be that of the + Xinerama extension, we need to ensure that the order of m_aXineramaScreens is actually intact. + + gdk_screen_get_monitor_geometry however has a different sort order that has a default monitor number + Xinerama returns the default monitor as 0. + That means if we fill in the multiple montors vector from gdk, we'll get the wrong order unless + the default monitor is incidentally the same (number 0). + + Given that XRandR (which is what gdk_screen_get_monitor_geometry is based on) is + supposed to replace Xinerama, this is bound to get a problem at some time again, + unfortunately there does not currently seem to be a way to map the returns of xinerama to + that of randr. Currently getting Xinerama values again works with updated values, given + a new enough Xserver. + */ + InitXinerama(); + (void)pScreen; + + #if 0 if( pScreen ) { if( gdk_display_get_n_screens(m_pGdkDisplay) == 1 ) @@ -234,6 +253,7 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) } } } + #endif } extern "C" @@ -244,6 +264,9 @@ extern "C" int GtkSalDisplay::GetDefaultMonitorNumber() const { int n = 0; + + // currently disabled, see remarks in monitorsChanged +#if 0 GdkScreen* pScreen = gdk_display_get_screen( m_pGdkDisplay, m_nDefaultScreen ); #if GTK_CHECK_VERSION(2,20,0) n = gdk_screen_get_primary_monitor(pScreen); @@ -255,6 +278,7 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const #endif if( n >= 0 && size_t(n) < m_aXineramaScreenIndexMap.size() ) n = m_aXineramaScreenIndexMap[n]; +#endif return n; } diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 5f4a2bda25f8..d9bca2d2e9ea 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -1814,6 +1814,7 @@ void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen ) aNewPosSize = Rectangle( Point( 0, 0 ), pDisp->GetScreenSize(m_nScreen) ); else aNewPosSize = pDisp->GetXineramaScreens()[ nScreen ]; + gtk_window_resize( GTK_WINDOW(m_pWindow), maGeometry.nWidth = aNewPosSize.GetWidth(), maGeometry.nHeight = aNewPosSize.GetHeight() ); @@ -1828,6 +1829,7 @@ void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen ) // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin) if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) { + pDisp->getWMAdaptor()->setFullScreenMonitors( GDK_WINDOW_XWINDOW( GTK_WIDGET(m_pWindow)->window ), nScreen ); if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) gtk_window_set_resizable( GTK_WINDOW(m_pWindow), sal_True ); gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) ); diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index bcbaee6d8b6c..a82e6a152efc 100755 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -875,7 +875,8 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame, { uno::Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); uno::Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); - if( (pFrame->mnDisplay >= 0) && (pFrame->mnDisplay < xMultiMon->getCount()) ) + sal_Int32 nMonitors = xMultiMon->getCount(); + if( (pFrame->mnDisplay >= 0) && (pFrame->mnDisplay < nMonitors) ) { uno::Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( pFrame->mnDisplay ), UNO_QUERY_THROW ); com::sun::star::awt::Rectangle aRect; @@ -889,10 +890,28 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame, } else { - nScreenX = GetSystemMetrics( SM_XVIRTUALSCREEN ); - nScreenY = GetSystemMetrics( SM_YVIRTUALSCREEN ); - nScreenDX = GetSystemMetrics( SM_CXVIRTUALSCREEN ); - nScreenDY = GetSystemMetrics( SM_CYVIRTUALSCREEN ); + Rectangle aCombined; + uno::Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( 0 ), UNO_QUERY_THROW ); + com::sun::star::awt::Rectangle aRect; + if( xMonitor->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ScreenArea" ) ) ) >>= aRect ) + { + aCombined.Left() = aRect.X; + aCombined.Top() = aRect.Y; + aCombined.Right() = aRect.X + aRect.Width; + aCombined.Bottom() = aRect.Y + aRect.Height; + for( sal_Int32 i = 1 ; i < nMonitors ; i++ ) + { + xMonitor = uno::Reference< XPropertySet >( xMultiMon->getByIndex(i), UNO_QUERY_THROW ); + if( xMonitor->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ScreenArea" ) ) ) >>= aRect ) + { + aCombined.Union( Rectangle( aRect.X, aRect.Y, aRect.X+aRect.Width, aRect.Y+aRect.Height ) ); + } + } + } + nScreenX = aCombined.Left(); + nScreenY = aCombined.Top(); + nScreenDX = aCombined.GetWidth(); + nScreenDY = aCombined.GetHeight(); } } catch( Exception& ) @@ -1001,6 +1020,8 @@ WinSalFrame::WinSalFrame() // ----------------------------------------------------------------------- void WinSalFrame::updateScreenNumber() { + if( mnDisplay == -1 ) // spans all monitors + return; WinSalSystem* pSys = static_cast<WinSalSystem*>(ImplGetSalSystem()); if( pSys ) { |