bugGNU Octave - Bugs: bug #50637, The GUI raises itself into...


bug #50637: The GUI raises itself into foreground upon clicking a button

Submitted by:  Lars Kindermann <larskindermann>
Submitted on:  Sat Mar 25 19:21:15 2017  
Category: GUISeverity: 1 - Wish
Priority: 3 - LowItem Group: Feature Request
Status: NoneAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Mon Mar 27 08:34:56 2017, comment #3:

Regarding to the bug, that Octave always raises its terminal window to top, even if it shoudn't according to the window manager settings, I located the relevant code. But fixing it does not really solve it at the moment, because there is a similar bug in the underlying Qt lib, too.

The code to transfer focus can be found in octave_dock_widget.h:

and in terminal_dock_widget.cc:

The raise() does not belong there and is surplus, as activateWindow() should handle all necessary stuff by itself and conform to the X11 window manager settings as stated in the Qt documentation:

Thus, raise() should only be used if one deliberately wishes to make a window topmost, regardless what the window manager policy is, e.g. to display a splash screen. It should be removed here.

But in fact Qt's activateWindow() currently seems not to care about any focus and autorise setting of of the Linux desktop, contrary to the documentation: it always raises the window to top by itself.So removing raise() in Octave will not change anything at all at the moment. One should file a bug to Qt.

But removing both activateWindow() and raise() from Octave produces the correct behaviour for my settings and - as far as I can see - does not change behaviour in most other scenarios, except this one: Working in an undocked editor and pressing F5 or clicking the "run" button will not bring the terminal to front but stay inside the editor. What is the intended behaviour for Octave in this case?

I suggest to remove at least the raise() from Octave, which does not change anything at the moment but - just in case Qt will be fixed one day - eventually will make it behave more cooperatively within the desktop settings.

Additionally removing activateWindow(), too, would be preferred by me, as setFocus() alone seems to perform all neccessary actions and makes Octave obey the window manager settings. But we should consider what the majority of users really expects when pressing F5.

Why do I care about this and consider it important, even if not a true "bug"? Personally - spending several hours per day in the GUI at the moment and being used to work with the perhaps untypical but nevertheless fully legit "focus follows mouse" and "no autorise" settings - I found myself typing into the wrong Octave window a thousand times at least. And in general, I think programs should comply to desktop standards as close as possible and not enforce their own specific behaviour. It's a question of design philosophy.

Attached are two patches to tryout, one removing raise(), the other removing also activateWindow().

(file #40166, file #40167)

Lars Kindermann <larskindermann>
Sun Mar 26 20:48:21 2017, comment #2:

Regarding "focus follows mouse" I found an open request in Qt:

QTBUG-47594: Add focus follows mouse option for widgets

Once it is resolved there, it should be very easy to make it work in Octave, too.

Lars Kindermann <larskindermann>
Sat Mar 25 23:10:06 2017, comment #1:


I have "focus follows mouse" also on Windows. Doesn't work inside Octave, though. It does work for undocked panes.
So the "focus follows mouse" behavior should be mimicked inside the main GUI window, i.e., a Qt thing.

FYI, Matlab behaves exactly like Octave.

Philip Nienhuis <philipnienhuis>
Project Member
Sat Mar 25 19:21:15 2017, original submission:

I always use the following settings for any desktop environment and window-manager:

- Focus follows mouse
- Clicking into a window will not bring it to the top

However, the Octave GUI will always make itself the topmost window as soon as you klick several of the buttons, like Run or press F5. But any well behaved program should leave this decision to the window-manager for a consistent desktop behaviour.

Another issue is that the GUI itself should be able to act according to the "focus follows mouse" setting internally, too. I.e. setting the focus automatically to the pane under the mouse. Many programs behave like this, other won't. So this is rather a feature request than a bug. But for anybody adapted to the "focus follow mouse" behaviour, it would make live a lot easier. As it is definitely pretty difficult to obtain the focus setting from all different window managers and desktop environments automatically, I opt rather for a new setting in the GUI preferences.

Lars Kindermann <larskindermann>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #40166:  remove_raise.diff added by larskindermann (650B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by larskindermann (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon Mar 27 08:34:56 2017larskindermannAttached File-=>Added remove_raise.diff, #40166
      Attached File-=>Added remove_raise_and_activate.diff, #40167
    Sat Mar 25 23:10:06 2017philipnienhuisOperating SystemGNU/Linux=>Any
    Sat Mar 25 19:35:28 2017mtmillerSeverity3 - Normal=>1 - Wish
      Priority5 - Normal=>3 - Low
      Item GroupNone=>Feature Request

    Back to the top

    Powered by Savane 3.1-cleanup1