# HG changeset patch # User Torsten # Date 1393966707 -3600 # Node ID 17baa684892c1cd7adcb8d740afd1f6966c48d19 # Parent e0cc67d5a462ef71b1a73358b5bdbd449e436a56 fix flashing while debuggung and editor is tabbed behind console (bug #41757) * file-editor.cc (is_editor_console_tabbed): new function returning true if editor is tabbed together with console; (request_open_file): do not give focus to editor if debug pointer or breakpoint marker is added and editor is tabbed with console * file-editor.h: new function is_editor_console_tabbed * main-window.h: new function get_dock_widget_list () returning the internal list of all dock widgets diff -r e0cc67d5a462 -r 17baa684892c libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Tue Mar 04 20:10:00 2014 +0000 +++ b/libgui/src/m-editor/file-editor.cc Tue Mar 04 21:58:27 2014 +0100 @@ -41,6 +41,7 @@ #include "octave-link.h" #include "utils.h" +#include "main-window.h" file_editor::file_editor (QWidget *p) : file_editor_interface (p) @@ -264,6 +265,23 @@ return false; } +bool +file_editor::is_editor_console_tabbed () +{ + main_window *w = static_cast(main_win ()); + QList w_list = w->tabifiedDockWidgets (this); + QDockWidget *console = + static_cast (w->get_dock_widget_list ().at (0)); + + for (int i = 0; i < w_list.count (); i++) + { + if (w_list.at (i) == console) + return true; + } + + return false; +} + void file_editor::request_open_file (const QString& openFileName, int line, bool debug_pointer, @@ -302,8 +320,11 @@ emit fetab_do_breakpoint_marker (insert, tab, line); } - emit fetab_set_focus (tab); - set_focus (); + if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) + { + emit fetab_set_focus (tab); + set_focus (); + } } else { @@ -402,9 +423,12 @@ } } - // really show editor and the current editor tab - set_focus (); - emit file_loaded_signal (); + if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) + { + // really show editor and the current editor tab + set_focus (); + emit file_loaded_signal (); + } } } } diff -r e0cc67d5a462 -r 17baa684892c libgui/src/m-editor/file-editor.h --- a/libgui/src/m-editor/file-editor.h Tue Mar 04 20:10:00 2014 +0000 +++ b/libgui/src/m-editor/file-editor.h Tue Mar 04 21:58:27 2014 +0100 @@ -182,6 +182,7 @@ private: + bool is_editor_console_tabbed (); void construct (void); void add_file_editor_tab (file_editor_tab *f, const QString& fn); void save_file_as (QWidget *fetabID = 0); diff -r e0cc67d5a462 -r 17baa684892c libgui/src/main-window.h --- a/libgui/src/main-window.h Tue Mar 04 20:10:00 2014 +0000 +++ b/libgui/src/main-window.h Tue Mar 04 21:58:27 2014 +0100 @@ -196,6 +196,9 @@ void clipboard_has_changed (QClipboard::Mode); void clear_clipboard (); + // get the dockwidgets + QList get_dock_widget_list () + { return dock_widget_list (); } protected: void closeEvent (QCloseEvent * closeEvent);