From 1f88a2a00dfdcc29e805d23c1a88a82b69d59d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 10 Oct 2011 17:08:37 +0100 Subject: [PATCH] fix the fallback logic --- vcl/unx/gtk/app/gtkdata.cxx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 4cb161a303ce..4e10809640ed 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -259,20 +259,24 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const (screen_get_primary_monitor)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_primary_monitor" ); if (sym_gdk_screen_get_primary_monitor) n = 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) + else { - if (g_ascii_strncasecmp (gdk_screen_get_monitor_plug_name(pScreen, i), "LVDS", 4) == 0) { - OSL_ASSERT( size_t(i) < m_aXineramaScreenIndexMap.size() ); - return (size_t(i) < m_aXineramaScreenIndexMap.size()) ? m_aXineramaScreenIndexMap[i] : 0; +#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) + { + n = i; + break; + } } } #endif - return 0; #endif + if( n >= 0 && size_t(n) < m_aXineramaScreenIndexMap.size() ) n = m_aXineramaScreenIndexMap[n]; return n;