bugGNU Octave - Bugs: bug #59846, drawnow or refresh not correctly...


bug #59846: drawnow or refresh not correctly working on windows with qt toolkit

Submitted by:  None
Submitted on:  Fri 08 Jan 2021 05:25:54 PM UTC  
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  None Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  6.1.0
Operating System:  Microsoft Windows

Add a New Comment (Rich Markup)

You are not logged in

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


( Jump to the original submission)

Mon 11 Jan 2021 08:52:02 PM UTC, comment #13: 

I agree to comment #12. The only exception is when using the mouse wheel for scrolling while hovering with the mouse over another widget. But as soon as an item is clicked, the keyboard focus should follow.

Torsten Lilge <ttl>
Project Member
Mon 11 Jan 2021 12:30:15 PM UTC, comment #12: 

Having separate keyboard and mouse focus would make Octave different from any other software I know. That would be very confusing imho.
The file browser widget responds correctly to keyboard input for me. E.g. hitting a letter key moves the focus to the first file starting with that letter. I'd rather keep that feature.

Markus M├╝tzel <mmuetzel>
Project Member
Mon 11 Jan 2021 11:10:02 AM UTC, comment #11: 

I think this is partly correct.

If the active widget gets does not offer keyboard input, merely offers mouse control, the keyboard focus should not change to ths active widget.
Directory scrolling / browsing is an example.
You only use mouse control here, no keyboard input is necessary. In this case keyboard control should not change.

This is only a suggestion. You're free to ignore it.

Stefan Grudszus <sgrudszus>
Mon 11 Jan 2021 05:59:22 AM UTC, comment #10: 

But this is the common behavior that the active widget gets the keyboard focus for, e.g., moving the file selection upwards and downwards or for hitting <return> for opening a file.

Instead of selecting the command window by the mouse you can use the shortcut Ctrl-0 to give the command window the focus.

Torsten Lilge <ttl>
Project Member
Sun 10 Jan 2021 08:42:24 PM UTC, comment #9: 


I'll come back to the other focus problem mentioned in my first message.

I'm used to have an ACTIVE command input window.

There I can input commands, watch output.

I use the windows version of octave. I can start CLI or GUI,
in both cases command input window is active at start, the cursor is blinking. You can input commands.
This is the only state in CLI, always ACTIVE.

If I now use the mouse in the GUI to watch variables, browse files, edit code, etc. the command input window gets INACTIVE.
If I want to continue work in command input window it is necessary to activate it by CLICKING ON IT WITH THE MOUSE.
Then, you can see the cursor blinking again.

This is not a bug, but this is not nice.

The command input window should constantly be ACTIVE.

Sun 10 Jan 2021 07:22:57 PM UTC, comment #8: 

Since the discussion so far was based on the assumption that this is a focus problem, here a new description of the bug.

With the attached file, a plot is repeated 50 times with different data. By using refresh () (or drawnow ()), each single plot is drawn in the figure and visible. If refresh () is omitted, only parts of some plots are visible from time to time.

On Windows and only for the "qt" graphics toolkit, not for "fltk", refresh () or drawnow () have no effect and the behavior is as if refresh () is omitted.

When testing with the attached script, the size ns of the plotted data can be adjusted to the computational power of your system. 

(file #50693)

Torsten Lilge <ttl>
Project Member
Sun 10 Jan 2021 03:12:50 PM UTC, comment #7: 

Thanks for confirmation. I have changed the category and the title of the report in order to better reflect the core of the problem.

Torsten Lilge <ttl>
Project Member
Sun 10 Jan 2021 01:53:56 PM UTC, comment #6: 

I can confirm that refresh() is working with fltk graphics toolkit.

The workaround with disp_freq is not needed.

I suggest to reduce graphics output in order to keep stable algorithm performance, so graphics output will not too much slow down program execution.

Thanx a lot for testing and advice.

Sat 09 Jan 2021 10:42:22 PM UTC, comment #5: 

I have just tested on my windows virtual machine (without disp_freq) and I see the problem with the modified files, too. However, when setting

graphics_toolkit ('fltk')

each single epoch is plotted as expected and as I can see on my linux system with both, the qt and the fltk graphics toolkit.

If you can confirm that the files are working with the fltk toolkit, it seems that the refresh() or drawnow() command are not working correctly with the Qt toolkit in windows.

Torsten Lilge <ttl>
Project Member
Sat 09 Jan 2021 09:25:20 PM UTC, comment #4: 

Thanx for the modifications.

It's working better. But not good enough.

I added a display frequency to plot not so much because the figure output takes too long. (plot not finished before new plot...)

This is a workaround:
  disp_freq = 50;

  if ( rem(epoch, disp_freq)== 0 )
    do plotting

So I can see the pattern change every 50 epoch.

It's ok. It's not Matlab..

Sat 09 Jan 2021 02:13:06 PM UTC, comment #3: 

Thanks for the files. I think that this is not a focus problem but a problem with updating the figure contents.

Please find attached slightly modified files where clf() is replaced by suitable hold on/off commands and - most importantly - a refresh() call is added at the end of each epoch (or drawnow('expose')).

(file #50687, file #50688)

Torsten Lilge <ttl>
Project Member
Sat 09 Jan 2021 12:33:46 PM UTC, comment #2: 

I prepared to little m files, which show the mentioned effect.

Run test_cl_pattern.m :

first, you should see the eye matrix in symbolic display

after one second a loop begins: I add some noise to the pattern (eye-matrix) and display it after every modification.

you should see 100 plots which show that the eye pattern is increasingly disturbed by noise

if I run this simply example I can`t merely see some images.

(file #50685, file #50686)

Fri 08 Jan 2021 06:56:50 PM UTC, comment #1: 

Thanks for the report and the acknowledgement.

Regarding the first topic: I am not sure if I understand the scenario correctly. How do switch back from the file browser (the one from windows, not octave's one, right?) to octave? If you use Alt-Tab, then the mouse stays wehre it is but the keyboard focus should go back to octave.

The second topic: When a figure window is behind another application then it is not automatically raised when octave's main window gets focus. But I think this is not what you mean. Is it possible to provide a minimal example where the issue that you are seeing shows up?

Torsten Lilge <ttl>
Project Member
Fri 08 Jan 2021 05:25:54 PM UTC, original submission:  

I encountered strange behaviour of mouse control in GUI:

if you're working in command window and than switch to another window (e.g. browse in file browser) the mouse focus remains in file browser and you always have to click in command window to continue your work there.
this can easily be seen, because cursor in command window stols blinking.

More crucial is working with figures:
I use figures to surveille learning progress of neural networks for example every 100 leaarning steps a new plot in figure.
Problem: Octave does these plots but you can' see it!!
You can test this: simply click with mouse on other windows application, than correct plot can be seen (once!)
For every plot to become visible you have to click elswhere on the screen, e.g. other application, task manager, etc.
If you do not click in between the learning process you do not see the plotting, only first and final plot.
This seems to be a window focus problem ...

By the way, I'm very impressed of octave, great work!



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

Attach Files:

Attached Files
file #50693:  bug59846.m added by ttl (395B - text/x-objcsrc)
file #50687:  test_cl_pattern.m added by ttl (241B - text/x-objcsrc)
file #50688:  cl_pattern.m added by ttl (2KiB - text/x-objcsrc)
file #50685:  cl_pattern.m added by None (1KiB - application/octet-stream)
file #50686:  test_cl_pattern.m added by None (147B - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by sgrudszus (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)

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

    Only project members can vote.




    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-01-10 ttl Attached File- => Added bug59846.m, #50693
    2021-01-10 ttl CategoryGUI => Plotting
        StatusNeed Info => None
        Summarymouse window focus in octave 6.1.0 => drawnow or refresh not correctly working on windows with qt toolkit
    2021-01-09 ttl Attached File- => Added test_cl_pattern.m, #50687
        Attached File- => Added cl_pattern.m, #50688
    2021-01-09 None Attached File- => Added cl_pattern.m, #50685
        Attached File- => Added test_cl_pattern.m, #50686
    2021-01-08 ttl StatusNone => Need Info

    Back to the top

    Powered by Savane 3.5