diff libgui/src/main-window.cc @ 19580:cbd5d36c5472

maint: Periodic merge of gui-release to default.
author John W. Eaton <jwe@octave.org>
date Thu, 08 Jan 2015 12:51:35 -0500
parents 7934b56c8b7b 52c51472b6b9
children c8cb111e727e
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Wed Jan 07 18:12:01 2015 -0500
+++ b/libgui/src/main-window.cc	Thu Jan 08 12:51:35 2015 -0500
@@ -174,6 +174,12 @@
       if (dock)
         break; // it is a QDockWidget ==> exit loop
 
+      if (qobject_cast <octave_qscintilla *> (w_new))
+        {
+          dock = static_cast <octave_dock_widget *> (editor_window);
+          break; // it is the editor window ==> exit loop
+        }
+
       w_new = qobject_cast <QWidget *> (w_new->previousInFocusChain ());
       if (w_new == start)
         break; // we have arrived where we began ==> exit loop
@@ -181,15 +187,16 @@
       count++;
     }
 
+  // editor needs extra handling
+  octave_dock_widget *edit_dock_widget =
+                        static_cast <octave_dock_widget *> (editor_window);
   // if new dock has focus, emit signal and store active focus
-  if (dock != _active_dock)
+  // except editor changes to a dialog (dock=0)
+  if ((dock || _active_dock != edit_dock_widget) && (dock != _active_dock))
     {
       // signal to all dock widgets for updating the style
       emit active_dock_changed (_active_dock, dock);
 
-      // if editor gets/loses focus, shortcuts and menus have to be updated
-      octave_dock_widget *edit_dock_widget =
-                        static_cast <octave_dock_widget *> (editor_window);
       if (edit_dock_widget == dock)
         emit editor_focus_changed (true);
       else if (edit_dock_widget == _active_dock)