diff libgui/src/octave-dock-widget.cc @ 26428:93c4fabb2ead stable

only reset floating geometry of dock widget when not visible (bug #53207) * octave-dock-widget.cc: update mail address in copyright notice; (handle_settings): compute default floating size based on geometry of screen of the main window, test if restored geometry is on a screen, if not, use default size
author Torsten <mttl@mailbox.org>
date Fri, 04 Jan 2019 22:01:07 +0100
parents 00f796120a6d
children abe3e8597a55
line wrap: on
line diff
--- a/libgui/src/octave-dock-widget.cc	Fri Jan 04 12:40:50 2019 -0800
+++ b/libgui/src/octave-dock-widget.cc	Fri Jan 04 22:01:07 2019 +0100
@@ -1,7 +1,7 @@
 /*
 
 Copyright (C) 2012-2019 Richard Crozier
-Copyright (C) 2013-2019 Torsten <ttl@justmail.de>
+Copyright (C) 2013-2019 Torsten <mttl@mailbox.org>
 
 This file is part of Octave.
 
@@ -443,7 +443,7 @@
     else
       m_icon_color_active = "";
 
-    QRect available_size = QApplication::desktop ()->availableGeometry ();
+    QRect available_size = QApplication::desktop ()->availableGeometry (m_parent);
     int x1, y1, x2, y2;
     available_size.getCoords (&x1, &y1, &x2, &y2);
     QRect default_size = QRect (x1, y1, x2/3, y2/2);
@@ -452,7 +452,10 @@
                                            + "_floating_geometry",
                                            default_size).toRect ();
 
-    if (! available_size.contains (m_recent_float_geom, false))
+    QWidget dummy;
+    dummy.setGeometry (m_recent_float_geom);
+
+    if (QApplication::desktop ()->screenNumber (&dummy) == -1)
       m_recent_float_geom = default_size;
 
     m_recent_dock_geom = settings->value ("DockWidgets/" + objectName (),