changeset 26827:86b8f4986993

maint: Merge stable to default.
author John W. Eaton <jwe@octave.org>
date Sun, 03 Mar 2019 19:47:10 +0000
parents 20881d195d20 (current diff) f7b10bd40045 (diff)
children 0a24e478a5b8
files
diffstat 3 files changed, 25 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/octave-dock-widget.cc	Sun Mar 03 19:20:50 2019 +0000
+++ b/libgui/src/octave-dock-widget.cc	Sun Mar 03 19:47:10 2019 +0000
@@ -204,8 +204,8 @@
         connect (m_default_float_button, SIGNAL (clicked (bool)),
                  this, SLOT (make_window (bool)));
       }
-    connect (this, SIGNAL (queue_make_window ()),
-             this, SLOT (make_window ()), Qt::QueuedConnection);
+    connect (this, SIGNAL (queue_make_window (bool)),
+             this, SLOT (make_window (bool)), Qt::QueuedConnection);
     connect (this, SIGNAL (queue_make_widget ()),
              this, SLOT (make_widget ()), Qt::QueuedConnection);
 
@@ -249,7 +249,7 @@
 
   // make the widget floating
   void
-  octave_dock_widget::make_window (bool)
+  octave_dock_widget::make_window (bool widget_was_dragged)
   {
     bool vis = isVisible ();
 
@@ -258,18 +258,25 @@
 
     set_focus_predecessor ();  // set focus previously active widget if tabbed
 
+    // Before unparenting, get current geometry for restoring if dragged
+    QRect geom = geometry ();
+
     // the widget has to be reparented (parent = 0), preferably
     // from a non-toplevel widget otherwise may not have full
     // decorations, e.g., no taskbar icon and always in front
     if (isFloating ())
       setFloating (false);
+
 // Remove after thorough testing 3/20/18    m_parent->removeDockWidget (this);
+
     setParent (0, Qt::CustomizeWindowHint | Qt::WindowTitleHint |
                Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::Window);
 
-    // restore the last geometry when floating
-    QRect geom = m_recent_float_geom.isNull () ? QRect (50,100,480,480)
-                                               : m_recent_float_geom;
+    // restore the last geometry when floating only if we have not dragged
+    // the window outside the main window
+    if (! widget_was_dragged)
+      geom = m_recent_float_geom.isNull () ? QRect (50,100,480,480)
+                                           : m_recent_float_geom;
     setGeometry (geom);
 
     // adjust the (un)dock icon
@@ -383,14 +390,14 @@
   {
     // low-level check of whether docked-widget became a window via
     // double-click or via drag-and-drop
-    if ((event->type () == QEvent::MouseButtonDblClick && ! isFloating ())
+    if ( (event->type () == QEvent::MouseButtonDblClick && ! isFloating ())
         || (event->type () == QEvent::ActivationChange && m_waiting_for_mouse_button_release))
       {
         bool retval = QDockWidget::event (event);
         if (isFloating () && parent () != 0)
           {
             m_waiting_for_mouse_button_release = false;
-            emit queue_make_window ();
+            emit queue_make_window (event->type () != QEvent::MouseButtonDblClick);
           }
         return retval;
       }
--- a/libgui/src/octave-dock-widget.h	Sun Mar 03 19:20:50 2019 +0000
+++ b/libgui/src/octave-dock-widget.h	Sun Mar 03 19:47:10 2019 +0000
@@ -96,7 +96,7 @@
 
     void active_changed (bool active);
 
-    void queue_make_window (void);
+    void queue_make_window (bool widget_was_dragged);
 
     void queue_make_widget (void);
 
@@ -142,7 +142,7 @@
 
     void resizeEvent (QResizeEvent *event);
 
-    void make_window (bool not_used = false);
+    void make_window (bool widget_was_dragged = false);
 
     void make_widget (bool not_used = false);
 
--- a/scripts/pkg/private/install.m	Sun Mar 03 19:20:50 2019 +0000
+++ b/scripts/pkg/private/install.m	Sun Mar 03 19:47:10 2019 +0000
@@ -75,10 +75,16 @@
         endif
 
         ## Uncompress the package.
+        [~, ~, ext] = fileparts (tgz);
+        if (strcmpi (ext, ".zip"))
+          func_uncompress = @unzip;
+        else
+          func_uncompress = @untar;
+        endif
         if (verbose)
-          printf ("untar (%s, %s)\n", tgz, tmpdir);
+          printf ("%s (%s, %s)\n", func2str (func_uncompress), tgz, tmpdir);
         endif
-        untar (tgz, tmpdir);
+        func_uncompress (tgz, tmpdir);
 
         ## Get the name of the directories produced by tar.
         [dirlist, err, msg] = readdir (tmpdir);