Ok, based on the latest findings, here is the version that performed best
on my end:

import threads # for milliseconds()
procedure main()
    w := open("resize", "g", "size=400,400", "resize=on")
    width := 400
    t := milliseconds()
    repeat {
       count := 0
       while *Pending(w)>0 & Event(w) & ((count +:= 1) < 10)
       x := WAttrib(w, "width")
       if (width ~= x) & milliseconds()-t>20 then{
          width := x
          WAttrib(w, "size=" || x || "," || x)
          WFlush(w)
          t := milliseconds()
          }
       }
    close(w)
end

In addition to adding the check *Pending()>0, I also added a real time
limit on how many times we resize/refresh the window per seconds. That did
it. currently it is set to at most 50 FPS.  I think we were just pushing
too much refreshes to the window system casuing it to loose its mind :-)

Cheers,
Jafar



On Sat, Nov 12, 2016 at 10:33 AM, Jafar Al-Gharaibeh <to.ja...@gmail.com>
wrote:

>
> > That is correct. Pending() returns the window's event queue if the
>> > queue has any events, otherwise it fails. You could replace the while
>> > push above with L := Pending() and you'd have access to the event
>> > queue directly. each event code in the list is followed by the x/y
>> > mouse pointer location - I think - of where the event took place. You
>> > can also create artificial event by pushing values directly to the
>> > list or via Pending() itself something like:
>> >
>> > Pending(w, -10, 100, 200)
>> Pending() is NOT failing. It is blocking - not returning at all until
>> there is or are events. If you look at the attached output file, the
>> data suggests that Pending() is also returning lists of length 0. This
>> is why I was able to remove the repeat {} loop from the original code. I
>> actually had both write statements after the while loop but inside the
>> repeat loop and neither was executed.
>>
>>  From what you have said, the expected results from Pending() is not
>> quite matching the actual results obtained. I have tried looking through
>> the RTL code but as yet I have not been able to find the relevant
>> section. It will be at least 3 to 4 days (at present) before I can
>> devote any time to looking at this further.
>>
>
> Bruce,
>
>   You are correct, we overlooked it, but I always used Pending() in this
> manner to check if a window has events:
>
> while *Pending()>0 do...
>
>  I didn't catch this first although it felt like something was missing :-)
>
> Cheers,
> Jafar
>
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to