octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #56110] Setting figure position is ignored whe


From: Rik
Subject: [Octave-bug-tracker] [bug #56110] Setting figure position is ignored when set before the figure is drawn
Date: Thu, 11 Apr 2019 12:58:18 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Follow-up Comment #13, bug #56110 (project octave):

I see what you're saying.  Annotated code


f1 = figure();
## When created in the GUI, there may be graphics events that are put in
## to the queue after creation by the GUI thread
pos1 = get(f1,"position")
pos1(1) = pos1(1) + 50;
pos1(2) = pos1(2) - 50;
pos1(3) = pos1(4) * 2
set(f1,"position",pos1) #before drawn
## get/set operations don't cause a queue flush
## So, "position" is now updated pos1, but drawnow is about to fire and
## run the queued event that returns position back to its starting value
drawnow
get(f1,"position")


Maybe the problem is more that figure() returns control to the interpreter too
quickly (on some computers) while the GUI thread is still active preparing the
figure.  In this scenario, the queued event would actually be flushed, but
there simply hasn't been enough time for the GUI to grab a mutex, post the
event, etc.  This would be consistent with the fact that pasting the code in
to an Octave window works (because there are extra delays with parsing each
command), but fails when the same code is in a script (parsed once, and then
run as fast as possible).

Could someone who can reproduce this try the following code which uses a
pause() statement after figure creation to let the graphics system settle
out.


f1 = figure();
pause (0.1);
pos1 = get(f1,"position")
pos1(1) = pos1(1) + 50;
pos1(2) = pos1(2) - 50;
pos1(3) = pos1(4) * 2
set(f1,"position",pos1) #before drawn
drawnow
pos1_after = get(f1,"position")
if (! isequal (pos1, pos1_after))
  warning ("position1 after drawnow is different");
endif


The script is attached as tst_figpos2.m as well.


(file #46749)
    _______________________________________________________

Additional Item Attachment:

File name: tst_figpos2.m                  Size:0 KB
    <https://savannah.gnu.org/file/tst_figpos2.m?file_id=46749>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?56110>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]