bugGNU Octave - Bugs: bug #52698, Clicking on plot window menu or...

 
 

bug #52698: Clicking on plot window menu or window decoration does not make figure current

Submitter:  Marshall <marsian>
Submitted:  Tue 19 Dec 2017 08:58:04 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Marsian Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 26 Dec 2017 06:11:00 PM UTC, comment #8: 

@Pantxo: I pushed your patch about capturing mouse clicks on the menubar here (http://hg.savannah.gnu.org/hgweb/octave/rev/1b4c4d6ead56).  I agree that I don't think we need to do anything more.  It is useful to be able to move windows with the Window Manager without having them become the current figure.

Rik <rik5>
Group administrator
Thu 21 Dec 2017 01:10:04 PM UTC, comment #7: 

I looked into having any click in a Qt figure make it current:

  • the attached cset is enough to have the figure become the currentfigure if one clicks the toolbar or menubar areas (including buttons).
  • the canvas area is already handled elsewhere.
  • clicking outside the above mentioned areas (e.g. title bar, corners or edges for resizing) does nothing. I don't know how to handle those cases (at least this thread [1] suggests it would involve platform dependent coding) in a ML compatible way. I don't know either if it is desirable since marsian's arguments against ML behavior are pretty sensible.


[1] https://forum.qt.io/topic/8922/solved-how-to-catch-mouse-click-event-on-titlebar-area-of-qmainwindow/7

(file #42695)

Pantxo Diribarne <pantxo>
Group Member
Thu 21 Dec 2017 01:01:54 AM UTC, comment #6: 

I pushed Pantxo's fix here http://hg.savannah.gnu.org/hgweb/octave/rev/e7624c23b101.  It would probably be good to document, at som point, how the mouse and the window figure interact to determine the current figure.

Rik <rik5>
Group administrator
Wed 20 Dec 2017 06:59:10 PM UTC, comment #5: 

The patch works for me for what I wanted.

I don't really care if the figure gains focus when clicking on the title bar, etc. Actually, I think I like that there is a way to rearrange figures manually without changing which has focus for the next plotting commands. I've had to do very careful use of passing axis/figure/plot handles to each plotting/animation function to avoid plotting in the wrong windows/axes, especially when doing long animations: I don't like the animation jumping to another axis (and overwriting that plot) when all I want is to rearrange windows to see more things at once, or to move things to better positions.

For example:

close all
figure(1)
figure(2)
figure(1)
while true
  plot(rand(10));
  drawnow;
endwhile

The second figure will block the first one, which has an animation running on it, but I want to move the second to watch it. Moving and resizing it shouldn't change the focus. But click on the axis of figure(2), and now it will begin the animation there. Rather annoying actually, especially if figure(2) had taken a while to process and draw that data. Stray clicks can ruin good plots.

For what it's worth the following avoids the problem, but it takes more lines of code and I don't always write it this way the first time through a script/function, and don't do it this way until drawing in the wrong axis has bitten me too many times or too hard, or if I need faster animations.

close all
figure(1)
p = plot(rand(10));
figure(2)
figure(1)
while true
  for i=1:10
    set(p(i),'ydata',rand(1,10));
  endfor
  drawnow;
endwhile


I note that 4.2.1 doesn't have this problem at all with this test. In matlab this problem presents itself in almost the same way except that in the above, figure(1) brings the figure window to the front (octave doesn't), so there is less temptation to rearrange windows in this example. In Matlab I can't even move the windows without changing the focus and starting the animation running on the other figure, which would be the result if full figure focus was taken by clicking on titlebar or decorations. I'd accept if the behavior was implemented because matlab does it that way and I already have workarounds (from when I worked a lot in matlab), but I don't prefer that behavior.

Marshall <marsian>
Wed 20 Dec 2017 05:52:09 PM UTC, comment #4: 

@Pantxo: Your patch solves the immediate issue of closing figures.  But it still leaves open the issue that clicking on a figure does not always make it the current figure.

Would it not be good to have comments in this potentially temporary patch to remind later coders that it should be removed when the GUI is fixed?

Rik <rik5>
Group administrator
Wed 20 Dec 2017 09:15:56 AM UTC, comment #3: 

I attached a patch to make use of the "close" function instead of directly executing the closerequestfcn.

(file #42690)

Pantxo Diribarne <pantxo>
Group Member
Tue 19 Dec 2017 09:24:52 PM UTC, comment #2: 

Confirmed.

I changed the bug summary to reflect the true problem which is that clicking on a figure window does not make it the current figure.

For the Qt and fltk toolkits you must click within the Canvas (axes) area of the figure in order to make the figure current.  Clicking in the menu area, or on the window decorations is not enough.

This behavior is present in 4.2.1, but doesn't cause an issue there.

Rik <rik5>
Group administrator
Tue 19 Dec 2017 09:04:20 PM UTC, comment #1: 

I think this is a problem with the Qt toolkit.  Can try changing over to the fltk toolkit just to make sure?

Rik <rik5>
Group administrator
Tue 19 Dec 2017 08:58:04 PM UTC, original submission:  

In the new development version, only the current figure window is closed  even though the close button is pressed on a different figure.

To reproduce, open several figure windows, drag them so you can see any but the top one.

close all
for i=1:4
  figure(i)
endfor


Press the x on figure 3 to close it. Figure 4 will close. call figure(2), then press the x on figure 3, and figure 2 will close. Press the x on figure 1, figure 3 will close.



Marshall <marsian>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #42695:  click_gcf.patch added by pantxo (1KiB - text/x-patch)
file #42690:  close_gui_fig.patch added by pantxo (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by marsian (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-12-21 pantxo Attached File- Added click_gcf.patch, #42695
    2017-12-21 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2017-12-20 pantxo Attached File- Added close_gui_fig.patch, #42690
        StatusConfirmed Patch Submitted
    2017-12-19 rik5 StatusNone Confirmed
        Operating SystemMicrosoft Windows Any
        SummaryOnly the current figure window is closed Clicking on plot window menu or window decoration does not make figure current
    2017-12-19 rik5 CategoryGUI Plotting with OpenGL

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code