bugGNU Octave - Bugs: bug #53410, Variable Editor: Title bar doesn't...

 
 

bug #53410: Variable Editor: Title bar doesn't highlight according to focus rules

Submitter:  Dan Sebald <sebald>
Submitted:  Wed 21 Mar 2018 09:20:40 PM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 11 Apr 2018 07:31:17 PM UTC, comment #15: 

@Dan: The latest patch works fine with docking/undocking.  I pushed it here http://hg.savannah.gnu.org/hgweb/octave/rev/07bddddc5856.

Rik <rik5>
Group administrator
Wed 11 Apr 2018 04:30:16 AM UTC, comment #14: 

Huh.  So it does.  I printed out the following:


  void variable_editor::focusInEvent (QFocusEvent *ev)
  {
std::cerr << "HOCUS FOCUS\n";
    octave_dock_widget::focusInEvent (ev);

    // set focus to the current variable
    QWidget *fw = m_main->focusWidget ();
    if (fw != nullptr)
      fw->setFocus ();
else
std::cerr << "fw is NULL\n";
  }


and it appears that the focusInEvent is occurring with the transition to/from docked state (good), but the m_main QMainWindow for the individual variables is losing its focusWidget() (it becomes NULL, bad).  I wonder why, and I wonder if there is anything one can do to prevent the loss of focusWidget().  I would have to think losing focus transitioning to/from docked state must have always been there but I never paid close attention.

Well, give the following patch a try.  It records the V.E.'s QMainWindow's focusWidget() just before, presumably, transition to from docked state via the focusOutEvent().

(file #43878)

Dan Sebald <sebald>
Tue 10 Apr 2018 11:58:23 PM UTC, comment #13: 

@Dan: I applied your last focus patch here http://hg.savannah.gnu.org/hgweb/octave/rev/8cff7eceee87.

A final note, I find that the highlighting and focus seems to be lost if you use the button to dock/undock the Variable Editor window.

Sample code:


run-octave -f --gui
x = magic (3);
y = 1:10;
openvar y   # 'y' is correctly highlighted and focus is inside y variable
openvar x   # 'x' is correctly highlighted and focus is inside x variable
# Click on the dock/undock button on the Variable Editor (not the dock/undock for an individual variable)
# Result is that focus is no longer on Variable Editor and variable name is no longer highlighted
# This fails going either direction: starting from detached window and docking or starting from docked widget and detaching.



Rik <rik5>
Group administrator
Mon 09 Apr 2018 11:39:28 PM UTC, comment #12: 

Sorry Rik, I didn't do that last changeset correctly.  It effectively loses the titlebar highlight control again.  I think proxies, et al., isn't enough to do this correctly so I added a focusInEvent() to override the virtual function and set the highlight back to the variable_dock_widget.  Patch attached.

(file #43862)

Dan Sebald <sebald>
Mon 09 Apr 2018 10:08:05 PM UTC, comment #11: 

Seems correct.  I tried the test code in comment #10 and it correctly preserves the focus.  I pushed the patch to the stable branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/df4e64464f38)

Rik <rik5>
Group administrator
Mon 09 Apr 2018 09:51:08 PM UTC, comment #10: 

This modification wasn't quite complete.  Notice that with the addition of the allowed window focus (i.e., titlebar highlighting), if one clicks on the title bar (or some portion of the window not covered by a widget), the current variable panel loses focus.  Try


>> x = magic(5);
>> openvar x;


then click on the titlebar of Variable Editor; the focus leaves "x" panel.  The attached patch prevents that loss of focus.

(file #43861)

Dan Sebald <sebald>
Wed 04 Apr 2018 04:29:33 PM UTC, comment #9: 

Closing report per comment #8.

Rik <rik5>
Group administrator
Tue 27 Mar 2018 03:07:12 AM UTC, comment #8: 

Yes, I think this can be closed.  Focus behavior (exactly when and how) looks to be something more dependent on the Window Manager, as opposed to Qt defining how focus events take place.  I noticed this when testing the code for Bug #53276.  On KDE/Plasma it seemed a focus took place when drag-and-drop moved across the boundary of some QDockWidgets inside the main GUI, but that didn't happen on Mint/Cinnamon.  So, it wouldn't surprise me if this is slightly different on different systems.

However, I can say that no other octave_dock_widget derived feature alters the focus policy to NoFocus.  So, these changes internally make the variable_editor consistent with the rest.

At the time I wasn't aware there was a title highlighting because I had that feature turned off in my Preferences.  I was thinking along the lines of the tab order.  As Torsten noted, he was first using tab to get to the variable_editor (as opposed to clicking on the title bar or main window border).  My thought was to take the variable_editor parent window out of the tab-chain because so often when I tab around something on the web, once in a while the tab seems to go somewhere invisible for a few tabs--the shorter the tab chain, the better.

Anyway, I think I'll leave consistency of title bar behavior to Torsten if there are further changes needed.  As a feature request, I'm curious if a transparent (no-focus) and standard-highlight (focus) are possible, but it isn't that essential.  I suspect that users will eventually have suggestions of how highlight could be improved.

Dan Sebald <sebald>
Mon 26 Mar 2018 08:50:29 PM UTC, comment #7: 

I applied the patch and merged with default.

Can this item be closed?

I don't see any change in highlighting when a docked window has the focus.  Maybe it is just the theme I'm using or something about my particular setup though.  Title bars of undocked windows are highlighted as I expect.

John W. Eaton <jwe>
Group administrator
Mon 26 Mar 2018 04:38:42 AM UTC, comment #6: 

Confirmed. Previously, I have used the shortcuts for switching between the widgets and in this case, the highlighting works.

Torsten Lilge <ttl>
Group Member
Sun 25 Mar 2018 08:15:33 PM UTC, comment #5: 

Yes, the "inner" octave_dock_widget (or variable_dock_widget) title bar is the portion highlighted.  To illustrate what happens here I'm attaching a succession of screen captures for the result of creating a variable x, and then

1) Click on the title bar of Workspace window: The Workspace window becomes highlighted.

2) Click on the title bar of Command Window: The Command Window becomes highlighted (and Workspace window loses its highlight).

3) Click on the title bar of Variable Editor: Nothing changes, the Command Window remains highlighted while Variable Editor does not acquire highlight.  It's because the Variable Editor itself cannot accept focus.

4) Click on the title bar of variable dock widget "x": Both the Variable Editor window and the "x" window title become highlighted.  The reason Variable Editor now becomes highlighted is because the variable_dock_widget (an item on Variable Editor object) can accept focus.


Dan Sebald <sebald>
Sat 24 Mar 2018 06:23:48 AM UTC, comment #4: 

Maybe it should be added that the title bar which is addressed here is the "inner" one, not the one from the window manager when the widget is floating? This assumes that custom styles for the title bars are activated in the preferences.

Btw: I can't reproduce this on Ubuntu Unity

Torsten Lilge <ttl>
Group Member
Fri 23 Mar 2018 09:58:58 PM UTC, comment #3: 

I understand not seeing this one; it's real subtle.  It took me a while to notice it was happening.  Without the patch, try docking everything, the Variable Editor included.  Maybe put the Variable Editor in a tabbed dock stack.  Then click from one window to the next and at some point the title bar highlighting should seem to not move when it should.  Then pick the right sequence and it will correct itself.

Dan Sebald <sebald>
Fri 23 Mar 2018 09:44:59 PM UTC, comment #2: 

With or without the patch, the title bar of the variable editor window seems to highlight as I expect when I move the mouse of the window.  I have the variable editor window detached.  So I don't understand what the issue was here.  Or maybe it just doesn't affect me.  Can you give a precise recipe for demonstrating the bug?

John W. Eaton <jwe>
Group administrator
Thu 22 Mar 2018 02:15:36 AM UTC, comment #1: 

Changeset attached.

(file #43621)

Dan Sebald <sebald>
Wed 21 Mar 2018 09:20:40 PM UTC, original submission:  

I wasn't aware of the title bar highlighting when I created the multipanel V.E.  After activating the highlighting feature in the Settings, it's clear that focus policy is not correct by clicking focus between the V.E. widget and other widgets in the main window, or floating the V.E. and then change focus around.

This should be a simple matter of reinstating the focus policy.  I will create a changeset shortly.

Dan Sebald <sebald>

 

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

Attach Files:
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by sebald (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-11 sebald Attached File- Added octave-ve_focus_restore_after_dock_undock-djs2018apr10.patch, #43878
    2018-04-09 sebald Attached File- Added octave-ve_focus_via_virtual-djs2018apr09.patch, #43862
    2018-04-09 sebald Attached File- Added octave-ve_focus_proxy-djs2018apr09.patch, #43861
    2018-04-04 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2018-03-26 jwe StatusNone Ready For Test
    2018-03-25 sebald Attached File- Added Workspace_titlebar_click_Screenshot_from_2018-03-25_14-56-23.png, #43676
        Attached File- Added Command_Window_titltebar_click_Screenshot_from_2018-03-25_15-00-27.png, #43677
        Attached File- Added Variable_Editor_titlebar_click_Screenshot_from_2018-03-25_15-01-51.png, #43678
        Attached File- Added x_titlebar_click_Screenshot_from_2018-03-25_15-03-02.png, #43679
    2018-03-22 sebald Attached File- Added octave-ve_titlebar_highlight-djs2018mar21.patch, #43621

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code