changeset 25417:b529e3e1393d

Work around for Variable Editor unfloat/float on Ubuntu Unity (bug #53893) * variable-editor.cc (variable_dock_widget::event): In the case of a button press event, reset both state variables m_waiting_for_mouse_button_release and m_waiting_for_mouse_move. (variable_dock_widget::unfloat_float): Similarly, reset the two state variables to ensure no follow-up repeat of the dock/undock process in unexpected situations. Also, indirectly queue the float by emitting signal queue_float(), and hide the widget in order to reduce some flash that occurs of a momentary repaint of floated state. (variable_editor::refloat): Added. New slot that simply issues setFloating(true) and resets the two state variables. Show the widget, activate window and focus. (variable_editor::edit_variable): Make a queued connection between signal queue_float() and slot refloat(). * variable_editor.h (variable_editor::queue_float): Declaration for new signal. (variable_editor::refloat): Added. Declaration for new slot that issues a setFloating(true).
author Daniel J Sebald <daniel.sebald@ieee.org>
date Sun, 27 May 2018 14:26:43 -0500
parents a741730fca5e
children 762eb2e33a7f
files libgui/src/variable-editor.cc libgui/src/variable-editor.h
diffstat 2 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/variable-editor.cc	Tue May 29 13:56:22 2018 -0700
+++ b/libgui/src/variable-editor.cc	Sun May 27 14:26:43 2018 -0500
@@ -304,7 +304,10 @@
     // low-level check of whether docked-widget became a window via
     // via drag-and-drop
     if (event->type () == QEvent::MouseButtonPress)
-      m_waiting_for_mouse_move = false;
+      {
+        m_waiting_for_mouse_move = false;
+        m_waiting_for_mouse_button_release = false;
+      }
     if (event->type () == QEvent::MouseMove && m_waiting_for_mouse_move)
       {
         m_waiting_for_mouse_move = false;
@@ -325,8 +328,23 @@
   void
   variable_dock_widget::unfloat_float (void)
   {
+    hide ();
     setFloating (false);
+    // Avoid a Ubunty Unity issue by queuing this rather than direct.
+    emit queue_float ();
+    m_waiting_for_mouse_move = false;
+    m_waiting_for_mouse_button_release = false;
+  }
+
+  void
+  variable_dock_widget::refloat (void)
+  {
     setFloating (true);
+    m_waiting_for_mouse_move = false;
+    m_waiting_for_mouse_button_release = false;
+    show ();
+    activateWindow ();
+    setFocus ();
   }
 
 #else
@@ -1203,6 +1221,8 @@
 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION)
     connect (page, SIGNAL (queue_unfloat_float ()),
              page, SLOT (unfloat_float ()), Qt::QueuedConnection);
+    connect (page, SIGNAL (queue_float ()),
+             page, SLOT (refloat ()), Qt::QueuedConnection);
 #endif
 
     variable_editor_stack *stack = new variable_editor_stack (page);
--- a/libgui/src/variable-editor.h	Tue May 29 13:56:22 2018 -0700
+++ b/libgui/src/variable-editor.h	Sun May 27 14:26:43 2018 -0500
@@ -103,10 +103,14 @@
 
     void queue_unfloat_float (void);
 
+    void queue_float (void);
+
   protected slots:
 
     void unfloat_float (void);
 
+    void refloat (void);
+
 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION)
   protected: