[PATCH libreoffice-4-0-3] fdo#62815 - tolerate crazy / out-of-bound ScreenNumbers for ...
Petr Mladek (via Code Review)
gerrit at gerrit.libreoffice.org
Tue Apr 30 03:51:49 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3695
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/95/3695/1
fdo#62815 - tolerate crazy / out-of-bound ScreenNumbers for FullScreen
Thus making the gtk+ backend more similar to the generic backend
in this regard; also be more strict about invalid monitors -> empty
screens.
Change-Id: Ia4f2e1205cb1d309fb1bb01f9631167339a3478e
Signed-off-by: Petr Mladek <pmladek at suse.cz>
---
M vcl/unx/gtk/app/gtksys.cxx
M vcl/unx/gtk/window/gtkframe.cxx
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx
index bc06b25..c822fd2 100644
--- a/vcl/unx/gtk/app/gtksys.cxx
+++ b/vcl/unx/gtk/app/gtksys.cxx
@@ -70,6 +70,13 @@
}
+/**
+ * GtkSalSystem::countScreenMonitors()
+ *
+ * This method builds the vector which allows us to map from VCL's
+ * idea of linear integer ScreenNumber to to gtk+'s rather more
+ * complicated screen + monitor concept.
+ */
void
GtkSalSystem::countScreenMonitors()
{
@@ -134,6 +141,11 @@
break;
}
nMonitor = nIdx;
+
+ // handle invalid monitor indexes as non-existent screens
+ if (nMonitor < 0 || (pScreen && nMonitor >= gdk_screen_get_n_monitors (pScreen)))
+ pScreen = NULL;
+
return pScreen;
}
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 03f8c59..61d3f78 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -2059,7 +2059,15 @@
return;
gint nMonitor;
+ bool bSameMonitor = false;
GdkScreen *pScreen = getDisplay()->getSystem()->getScreenMonitorFromIdx( nNewScreen, nMonitor );
+ if (!pScreen)
+ {
+ g_warning ("Attempt to move GtkSalFrame to invalid screen %d => "
+ "fallback to current\n", nNewScreen);
+ pScreen = gtk_widget_get_screen( m_pWindow );
+ bSameMonitor = true;
+ }
// Heavy lifting, need to move screen ...
if( pScreen != gtk_widget_get_screen( m_pWindow ))
@@ -2067,6 +2075,9 @@
gint nOldMonitor = gdk_screen_get_monitor_at_window(
pScreen, widget_get_window( m_pWindow ) );
+ if (bSameMonitor)
+ nMonitor = nOldMonitor;
+
#if OSL_DEBUG_LEVEL > 1
if( nMonitor == nOldMonitor )
g_warning( "An apparently pointless SetScreen - should we elide it ?" );
--
To view, visit https://gerrit.libreoffice.org/3695
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4f2e1205cb1d309fb1bb01f9631167339a3478e
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0-3
Gerrit-Owner: Petr Mladek <pmladek at suse.cz>
Gerrit-Reviewer: Michael Meeks <michael.meeks at suse.com>
More information about the LibreOffice
mailing list