changeset 19567:52c51472b6b9 gui-release

improved search for active dock-widget after focus has changed * main-window.cc (focus_changed): check new widget for qscintilla-widget, do not change editor style sheet when focus switches from editor to find dialog in order to prevent some side effects in the find dialog
author Torsten <ttl@justmail.de>
date Sun, 04 Jan 2015 11:58:31 +0100
parents b0ba6653305a
children 9da61e3ecbe7
files libgui/src/main-window.cc
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Sat Jan 03 10:05:06 2015 -0500
+++ b/libgui/src/main-window.cc	Sun Jan 04 11:58:31 2015 +0100
@@ -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)