Mercurial > octave
diff libgui/src/octave-dock-widget.cc @ 27281:0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
* file-editor.cc (focus): renamed into activate and make use of
octave_dock_widget::activate;
(set_focus): use qt setFocus instead of own old octave_dock_widget::focus;
(request_new_file, request_close_file, active_tab_changed,
handle_visibility, request_open_file):
call new method activate instead of old focus;
* file-editor.h: removed method focus and added new method activate
* main-window.cc (focus_command_window): activate instead of focus;
(editor_tabs_changed, construct_documentation_menu):
use activate slot instead of focus;
* octave-dock-widget.cc (make_window, make_widget, set_focus_predecessor):
use qt setFocus instead of removed focus method;
(activate): implementation of renamed method;
(handle_visibility): moved implementation from header to here
* octave-dock-widget.h: renamed focus into activate, moved implementation
from here to cc-file, use setFocus in handle_visibility,
moved implementation for handle_visibility from here to cc-file
* terminal-dock-widget.cc (focus): removed virtual implementation
* terminal-dock-widget.h: removed focus method
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Mon, 22 Jul 2019 22:20:56 +0200 |
parents | 420611c61298 |
children | 5f170ea12fa1 |
line wrap: on
line diff
--- a/libgui/src/octave-dock-widget.cc Mon Jul 22 20:05:55 2019 +0200 +++ b/libgui/src/octave-dock-widget.cc Mon Jul 22 22:20:56 2019 +0200 @@ -299,7 +299,7 @@ if (vis) { show (); - focus (); + setFocus (); set_style (true); } @@ -347,7 +347,7 @@ if (vis) { show (); - focus (); + setFocus (); set_style (true); } } @@ -566,7 +566,23 @@ emit active_changed (false); } - void + void octave_dock_widget::activate (void) + { + if (! isVisible ()) + setVisible (true); + + setFocus (); + activateWindow (); + raise (); + } + + void octave_dock_widget::handle_visibility (bool visible) + { + if (visible && ! isFloating ()) + setFocus (); + } + + void octave_dock_widget::toplevel_change (bool toplevel) { QObject *dockobj; @@ -710,7 +726,7 @@ { // only != 0 if widget was tabbed if (m_predecessor_widget && m_predecessor_widget->isVisible ()) - m_predecessor_widget->focus (); + m_predecessor_widget->setFocus (); m_predecessor_widget = nullptr; // FIXME: Until cset bda0c5b38bda, the wrong keys "Dockwidget/..." were used