diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-10-10 15:41:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-10-10 20:39:27 +0100 |
commit | 0ecc627bc01f8ba286f2a4857f0d093df90fe85e (patch) | |
tree | ebd8ffd03eb1ac03c43013f4b66ca26b3d8b582e | |
parent | fix of underlining problem with Graphite fonts #i114765# (diff) | |
download | core-0ecc627bc01f8ba286f2a4857f0d093df90fe85e.tar.gz core-0ecc627bc01f8ba286f2a4857f0d093df90fe85e.zip |
add GetDefaultMonitorNumber back in
add GetDefaultMonitorNumber back in, but take care for the gener^C vclplug code
route
-rw-r--r-- | vcl/unx/gtk/app/gtkdata.cxx | 32 | ||||
-rw-r--r-- | vcl/unx/inc/plugins/gtk/gtkdata.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/inc/saldisp.hxx | 4 | ||||
-rw-r--r-- | vcl/unx/source/app/saldisp.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/source/app/salsys.cxx | 2 |
5 files changed, 44 insertions, 6 deletions
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 0367d85e3580..bae03d10cce2 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -217,11 +217,12 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) { gint nMonitors = gdk_screen_get_n_monitors(pScreen); m_aXineramaScreens = std::vector<Rectangle>(); + m_aXineramaScreenIndexMap = std::vector<int>(nMonitors); for (gint i = 0; i < nMonitors; ++i) { GdkRectangle dest; gdk_screen_get_monitor_geometry(pScreen, i, &dest); - addXineramaScreenUnique( dest.x, dest.y, dest.width, dest.height ); + addXineramaScreenUnique( i, dest.x, dest.y, dest.width, dest.height ); } m_bXinerama = m_aXineramaScreens.size() > 1; if( ! m_aFrames.empty() ) @@ -235,6 +236,35 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) } } +extern "C" +{ + typedef gint(* screen_get_primary_monitor)(GdkScreen *screen); +} + +int GtkSalDisplay::GetDefaultMonitorNumber() const +{ + GdkScreen* pScreen = gdk_display_get_screen( m_pGdkDisplay, m_nDefaultScreen ); +#if GTK_CHECK_VERSION(2,20,0) + return m_aXineramaScreenIndexMap[gdk_screen_get_primary_monitor(pScreen)]; +#else + static screen_get_primary_monitor sym_gdk_screen_get_primary_monitor = + (screen_get_primary_monitor)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_primary_monitor" ); + if (sym_gdk_screen_get_primary_monitor) + return m_aXineramaScreenIndexMap[sym_gdk_screen_get_primary_monitor(pScreen)]; +#if GTK_CHECK_VERSION(2,14,0) + //gdk_screen_get_primary_monitor unavailable, take the first laptop monitor + //as the default + gint nMonitors = gdk_screen_get_n_monitors(pScreen); + for (gint i = 0; i < nMonitors; ++i) + { + if (g_ascii_strncasecmp (gdk_screen_get_monitor_plug_name(pScreen, i), "LVDS", 4) == 0) + return m_aXineramaScreenIndexMap[i]; + } +#endif + return 0; +#endif +} + void GtkSalDisplay::initScreen( int nScreen ) const { if( nScreen < 0 || nScreen >= static_cast<int>(m_aScreens.size()) ) diff --git a/vcl/unx/inc/plugins/gtk/gtkdata.hxx b/vcl/unx/inc/plugins/gtk/gtkdata.hxx index d4dec957a6b3..7a24b2df0a6d 100644 --- a/vcl/unx/inc/plugins/gtk/gtkdata.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkdata.hxx @@ -73,6 +73,8 @@ public: virtual long Dispatch( XEvent *pEvent ); virtual void initScreen( int nScreen ) const; + virtual int GetDefaultMonitorNumber() const; + static GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event, GdkEvent* event, gpointer data ); diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx index 78de508ed6ef..bd823be95453 100644 --- a/vcl/unx/inc/saldisp.hxx +++ b/vcl/unx/inc/saldisp.hxx @@ -386,6 +386,7 @@ protected: bool m_bXinerama; std::vector< Rectangle > m_aXineramaScreens; + std::vector< int > m_aXineramaScreenIndexMap; std::list<SalFrame*> m_aFrames; std::list<SalObject*> m_aSalObjects; @@ -401,7 +402,7 @@ protected: int processRandREvent( XEvent* ); void doDestruct(); - void addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ); + void addXineramaScreenUnique( int i, long i_nX, long i_nY, long i_nWidth, long i_nHeight ); public: static SalDisplay *GetSalDisplay( Display* display ); static BOOL BestVisual( Display *pDisp, @@ -473,6 +474,7 @@ public: XLIB_Window GetDrawable( int nScreen ) const { return getDataForScreen( nScreen ).m_aRefWindow; } Display *GetDisplay() const { return pDisp_; } int GetDefaultScreenNumber() const { return m_nDefaultScreen; } + virtual int GetDefaultMonitorNumber() const { return 0; } const Size& GetScreenSize( int nScreen ) const { return getDataForScreen( nScreen ).m_aSize; } srv_vendor_t GetServerVendor() const { return meServerVendor; } void SetServerVendor() { meServerVendor = sal_GetServerVendor(pDisp_); } diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index f81f25673995..bcdbf241d1c6 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -2682,7 +2682,7 @@ void SalDisplay::PrintInfo() const sal::static_int_cast< unsigned int >(GetVisual(m_nDefaultScreen).GetVisualId()) ); } -void SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ) +void SalDisplay::addXineramaScreenUnique( int i, long i_nX, long i_nY, long i_nWidth, long i_nHeight ) { // see if any frame buffers are at the same coordinates // this can happen with weird configuration e.g. on @@ -2696,11 +2696,13 @@ void SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, l if( m_aXineramaScreens[n].GetWidth() < i_nWidth || m_aXineramaScreens[n].GetHeight() < i_nHeight ) { + m_aXineramaScreenIndexMap[i] = n; m_aXineramaScreens[n].SetSize( Size( i_nWidth, i_nHeight ) ); } return; } } + m_aXineramaScreenIndexMap[i] = m_aXineramaScreens.size(); m_aXineramaScreens.push_back( Rectangle( Point( i_nX, i_nY ), Size( i_nWidth, i_nHeight ) ) ); } @@ -2727,8 +2729,9 @@ void SalDisplay::InitXinerama() { m_bXinerama = true; m_aXineramaScreens = std::vector<Rectangle>(); + m_aXineramaScreenIndexMap = std::vector<int>(nFramebuffers); for( int i = 0; i < nFramebuffers; i++ ) - addXineramaScreenUnique( pFramebuffers[i].x, + addXineramaScreenUnique( i, pFramebuffers[i].x, pFramebuffers[i].y, pFramebuffers[i].width, pFramebuffers[i].height ); @@ -2744,9 +2747,10 @@ if( XineramaIsActive( pDisp_ ) ) if( nFramebuffers > 1 ) { m_aXineramaScreens = std::vector<Rectangle>(); + m_aXineramaScreenIndexMap = std::vector<int>(nFramebuffers); for( int i = 0; i < nFramebuffers; i++ ) { - addXineramaScreenUnique( pScreens[i].x_org, + addXineramaScreenUnique( i, pScreens[i].x_org, pScreens[i].y_org, pScreens[i].width, pScreens[i].height ); diff --git a/vcl/unx/source/app/salsys.cxx b/vcl/unx/source/app/salsys.cxx index 1ccb214df4ed..84c9dba32e40 100644 --- a/vcl/unx/source/app/salsys.cxx +++ b/vcl/unx/source/app/salsys.cxx @@ -71,7 +71,7 @@ bool X11SalSystem::IsMultiDisplay() unsigned int X11SalSystem::GetDefaultDisplayNumber() { SalDisplay* pSalDisp = GetX11SalData()->GetDisplay(); - return pSalDisp->GetDefaultScreenNumber(); + return pSalDisp->IsXinerama() ? pSalDisp->GetDefaultMonitorNumber() : pSalDisp->GetDefaultScreenNumber(); } Rectangle X11SalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) |