Re: [racket-users] 6.4 + universe has mouse-based hiccups

2016-04-07 Thread Matthew Flatt
At Thu, 07 Apr 2016 15:05:12 -0400, "'John Clements' via Racket Users" wrote:
> > On Apr 7, 2016, at 8:34 AM, Matthew Flatt  wrote:
> > It looks like it's not a question of running DrRacket for a while, but
> > of having multiple tabs in DrRacket. And, more specifically, it's not
> > about DrRacket, but about showing a window containing a `tab-panel%`
> > instance that uses the 'no-border style on OS X.

The problem seems to happen only with 64-bit builds on 10.11. I don't
know why, but 10.11 changes the way that windows are drawn in a fairly
deep way, and it's probably something related to that change.

Fortunately, MiMo42 provides MMTabBarView as a replacement for
PSMTabBarControl. It only works on 64-bit 10.9 and up, but that covers
the case where PSMTabBarControl is a problem. Also, MMTabBarView
includes a Yosemite style. So, I've switched `racket/gui` (and
therefore DrRacket) to use MMTabBarView on 64-bit 10.10 and up.

> (You saw that I opened a PR for this? [...])

Yes, I'll close it.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] 6.4 + universe has mouse-based hiccups

2016-04-07 Thread 'John Clements' via Racket Users

> On Apr 7, 2016, at 8:34 AM, Matthew Flatt  wrote:
> 
> It looks like it's not a question of running DrRacket for a while, but
> of having multiple tabs in DrRacket. And, more specifically, it's not
> about DrRacket, but about showing a window containing a `tab-panel%`
> instance that uses the 'no-border style on OS X.
> 
> 
…

> but don't run it. Start your universe program, and it should be ok.
> Start running the tab-panel program, and your universe program will
> misbehave. Close the frame created by the tab-panel program, and your
> universe program will behave correctly again.

Well, I tried the much simpler test of simply observing the problem, and then 
closing all of the other tabs, and the problem went away. Creating another tab 
brought the problem back.

Thanks!

(You saw that I opened a PR for this? Let me know if you want me to dig up the 
#.)

John



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] 6.4 + universe has mouse-based hiccups

2016-04-07 Thread Matthew Flatt
It looks like it's not a question of running DrRacket for a while, but
of having multiple tabs in DrRacket. And, more specifically, it's not
about DrRacket, but about showing a window containing a `tab-panel%`
instance that uses the 'no-border style on OS X.

For example, start DrRacket with your program in one window. Create a
new window (not a new tab) and paste in

 #lang racket/gui

 (define f (new frame%
[label "Slower"]
[width 200]))
 (new tab-panel%
  [choices '("A" "B")]
  [parent f]
  [style '(no-border)])
 (send f show #t)

but don't run it. Start your universe program, and it should be ok.
Start running the tab-panel program, and your universe program will
misbehave. Close the frame created by the tab-panel program, and your
universe program will behave correctly again.

Using the 'no-border style for `tab-panel%` triggers the use of a
third-party widget PSMTabBarControl, so I think the problem must be in
that widget's implementation or its interaction with the `racket/gui`
event loop. In any case, now that I know that PSBTamBarControl is
relevant, I should be able to fix it soon.

At Wed, 06 Apr 2016 18:10:05 -0400, "John Clements" wrote:
> 
> > On Apr 6, 2016, at 9:02 AM, Matthew Flatt  wrote:
> > 
> > If the problem happens after DrRacket has been running for a while,
> > then that's good information and definitely a problem to investigate.
> 
> I can confirm that (after 3-5 hours of development work) the problem is back.
> 
> I also shortened the program down to about 36 lines (below). Finally, once 
> again I restarted DrR and the problem went away.
> 
> I’ll go ahead and file a bug report, I guess.
> 
> Okay, done.
> 
> John
> 
> 
> #lang racket
> 
> (require 2htdp/universe
> 2htdp/image)
> 
> (define r (rectangle 40 40 'solid 'green))
> 
> ;; represents a position on the screen
> (struct posn (x y) #:transparent)
> 
> ;; in seconds:
> (define TRANSITION-TIME 1)
> 
> ;; in frames per second
> (define FRAME-RATE 40)
> 
> (define SCENEWIDTH 400)
> (define SCENEHEIGHT 300)
> 
> (define transition-frames (* TRANSITION-TIME FRAME-RATE))
> 
> ;; given frame number, overlay
> ;; image at the correct location
> (define (draw-world w)
>   (define frac (/ (modulo w transition-frames) transition-frames))
>   (define 1-frac (- 1 frac))
>   (place-image r (+ (* 1-frac 50) (* frac 100))
>(+ (* 1-frac 120) (* frac 115))
>bg-scene))
> 
> (define bg-scene (empty-scene SCENEWIDTH SCENEHEIGHT))
> 
> (big-bang 0
>   [to-draw draw-world]
>   [on-tick add1 (/ 1 FRAME-RATE)])
> 
> 
> 
> > 
> > Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] 6.4 + universe has mouse-based hiccups

2016-04-06 Thread 'John Clements' via Racket Users

> On Apr 6, 2016, at 9:02 AM, Matthew Flatt  wrote:
> 
> If the problem happens after DrRacket has been running for a while,
> then that's good information and definitely a problem to investigate.

I can confirm that (after 3-5 hours of development work) the problem is back.

I also shortened the program down to about 36 lines (below). Finally, once 
again I restarted DrR and the problem went away.

I’ll go ahead and file a bug report, I guess.

Okay, done.

John


#lang racket

(require 2htdp/universe
2htdp/image)

(define r (rectangle 40 40 'solid 'green))

;; represents a position on the screen
(struct posn (x y) #:transparent)

;; in seconds:
(define TRANSITION-TIME 1)

;; in frames per second
(define FRAME-RATE 40)

(define SCENEWIDTH 400)
(define SCENEHEIGHT 300)

(define transition-frames (* TRANSITION-TIME FRAME-RATE))

;; given frame number, overlay
;; image at the correct location
(define (draw-world w)
  (define frac (/ (modulo w transition-frames) transition-frames))
  (define 1-frac (- 1 frac))
  (place-image r (+ (* 1-frac 50) (* frac 100))
   (+ (* 1-frac 120) (* frac 115))
   bg-scene))

(define bg-scene (empty-scene SCENEWIDTH SCENEHEIGHT))

(big-bang 0
  [to-draw draw-world]
  [on-tick add1 (/ 1 FRAME-RATE)])



> 
> Thanks!



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] 6.4 + universe has mouse-based hiccups

2016-04-06 Thread Matthew Flatt
At Wed, 06 Apr 2016 11:56:51 -0400, "John Clements" wrote:
> 
> > On Apr 6, 2016, at 7:35 AM, Matthew Flatt  wrote:
> > 
> > I haven't been able to replicate the problem, so far, even though my
> > machine and installation is similar to yours.
> > 
> > Do you have a Racket installation on a different machine that you can
> > check? Whatever the problem is, my guess is that it's specific to OS X
> > (but that's just a guess).
> > 
> > Does it matter whether you run the program in DrRacket or just through
> > `racket`?
> 
> I’m able to successfully replicate the problem on my machine at work.
> However, the problem does seem to be specific to DrRacket.
> Furthermore, I find that *restarting* DrRacket appears to solve the
> problem.
> 
> If this workaround continues to work, then I suppose I won’t fret,
> though it’s a bit worrisome.
> 
> I’ll file a bug report if I find that this becomes reproducible.  Apologies 
> for not trying to restart DrRacket earlier; I suppose this can be seen as a 
> tribute to my belief in its stability?

If the problem happens after DrRacket has been running for a while,
then that's good information and definitely a problem to investigate.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] 6.4 + universe has mouse-based hiccups

2016-04-06 Thread 'John Clements' via Racket Users

> On Apr 6, 2016, at 7:35 AM, Matthew Flatt  wrote:
> 
> I haven't been able to replicate the problem, so far, even though my
> machine and installation is similar to yours.
> 
> Do you have a Racket installation on a different machine that you can
> check? Whatever the problem is, my guess is that it's specific to OS X
> (but that's just a guess).
> 
> Does it matter whether you run the program in DrRacket or just through
> `racket`?

I’m able to successfully replicate the problem on my machine at work. However, 
the problem does seem to be specific to DrRacket. Furthermore, I find that 
*restarting* DrRacket appears to solve the problem.

If this workaround continues to work, then I suppose I won’t fret, though it’s 
a bit worrisome.

I’ll file a bug report if I find that this becomes reproducible.  Apologies for 
not trying to restart DrRacket earlier; I suppose this can be seen as a tribute 
to my belief in its stability?

Thanks again for your time.

John


> 
> At Wed, 06 Apr 2016 00:17:51 -0400, "'John Clements' via Racket Users" wrote:
>> I just wrote a simple 2htdp/universe program that animates a moving green 
>> rectangle. I was expecting to scale up to larger #s of rectangles, but I 
>> discover that moving the mouse affects the animation quite seriously. 
>> Specifically, moving the mouse in a small smooth circle causes the green 
>> rectangle to reduce its frame rate to about 7 frames per second. No GC 
>> activity is observed in the log box when gc@debug is added.
>> 
>> I’m going to include the program below: I haven’t tried to minimize it, but 
>> it’s still quite small. (76 lines of HtDP style.) I’m guessing this problem 
>> is 
>> not specific to this program.
>> 
>> FWIW, this is a 13” macbook pro, 16MB, running 10.11.4.
>> 
>> Is this a known issue?
>> 
>> John
>> 
>> 
>> 
>> #lang racket
>> 
>> (require 2htdp/universe
>> 2htdp/image
>> rackunit)
>> 
>> (define r (rectangle 40 40 'solid 'green))
>> 
>> ;; represents a position on the screen
>> (struct posn (x y) #:transparent)
>> 
>> ;; a shape-transition contains an image, a starting
>> ;; position, and an ending position. It represents
>> ;; a shape that moves from the start-pos to the end-pos
>> ;; through the transition
>> (struct shapetrans (image start-pos end-pos) #:transparent)
>> 
>> ;; in seconds:
>> (define TRANSITION-TIME 1)
>> 
>> ;; in frames per second
>> (define FRAME-RATE 40)
>> 
>> (define SCENEWIDTH 400)
>> (define SCENEHEIGHT 300)
>> 
>> (define transition-frames (* TRANSITION-TIME FRAME-RATE))
>> 
>> ;; given fraction of transition and shapetrans, compute
>> ;; shape position
>> (define (trans-posn frac st)
>>  (define 1-frac (- 1 frac))
>>  (match st
>>[(shapetrans _ (posn sx sy) (posn ex ey))
>> (posn (+ (* 1-frac sx) (* frac ex))
>>   (+ (* 1-frac sy) (* frac ey)))]))
>> 
>> (check-equal? (trans-posn 0 (shapetrans r (posn 10 30) (posn -50 100)))
>>  (posn 10 30))
>> (check-equal? (trans-posn 1/2 (shapetrans r (posn 10 30) (posn -50 100)))
>>  (posn -20 65))
>> (check-equal? (trans-posn 1 (shapetrans r (posn 10 30) (posn -50 100)))
>>  (posn -50 100))
>> 
>> ;; given fraction of transition, shapetrans, and scene, overlay
>> ;; shapetrans-image at the correct location
>> (define (add-image frac st scene)
>>  (match (trans-posn frac st)
>>[(posn x y)
>> (place-image (shapetrans-image st) x y scene)]))
>> 
>> 
>> ;; a world is a shapetrans and a frame number
>> (struct world (st frame))
>> 
>> ;; draw a world
>> (define (draw-world w)
>>  (match-define (world st frame) w)
>>  (add-image (/ (modulo frame transition-frames) transition-frames)
>> st
>> (empty-scene SCENEWIDTH SCENEHEIGHT)))
>> 
>> (check-equal? (draw-world (world (shapetrans r (posn 10 30) (posn 20 100))
>> (* 5/2 transition-frames)))
>>  (place-image r 15 65 (empty-scene SCENEWIDTH SCENEHEIGHT)))
>> 
>> ;; advance the frame by 1
>> (define (tick-fun w)
>>  (match-define (world st frame) w)
>>  (world st (add1 frame)))
>> 
>> (big-bang (world (shapetrans r (posn 10 30) (posn 20 100)) 0)
>>  [to-draw draw-world]
>>  [on-tick tick-fun (/ 1 FRAME-RATE)])
>> 
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>> 
>> --
>> [application/pgp-signature "signature.asc"] [~/Desktop & open] [~/Temp & 
>> open]



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more 

Re: [racket-users] 6.4 + universe has mouse-based hiccups

2016-04-06 Thread Matthew Flatt
I haven't been able to replicate the problem, so far, even though my
machine and installation is similar to yours.

Do you have a Racket installation on a different machine that you can
check? Whatever the problem is, my guess is that it's specific to OS X
(but that's just a guess).

Does it matter whether you run the program in DrRacket or just through
`racket`?

At Wed, 06 Apr 2016 00:17:51 -0400, "'John Clements' via Racket Users" wrote:
> I just wrote a simple 2htdp/universe program that animates a moving green 
> rectangle. I was expecting to scale up to larger #s of rectangles, but I 
> discover that moving the mouse affects the animation quite seriously. 
> Specifically, moving the mouse in a small smooth circle causes the green 
> rectangle to reduce its frame rate to about 7 frames per second. No GC 
> activity is observed in the log box when gc@debug is added.
> 
> I’m going to include the program below: I haven’t tried to minimize it, but 
> it’s still quite small. (76 lines of HtDP style.) I’m guessing this problem 
> is 
> not specific to this program.
> 
> FWIW, this is a 13” macbook pro, 16MB, running 10.11.4.
> 
> Is this a known issue?
> 
> John
> 
> 
> 
> #lang racket
> 
> (require 2htdp/universe
>  2htdp/image
>  rackunit)
> 
> (define r (rectangle 40 40 'solid 'green))
> 
> ;; represents a position on the screen
> (struct posn (x y) #:transparent)
> 
> ;; a shape-transition contains an image, a starting
> ;; position, and an ending position. It represents
> ;; a shape that moves from the start-pos to the end-pos
> ;; through the transition
> (struct shapetrans (image start-pos end-pos) #:transparent)
> 
> ;; in seconds:
> (define TRANSITION-TIME 1)
> 
> ;; in frames per second
> (define FRAME-RATE 40)
> 
> (define SCENEWIDTH 400)
> (define SCENEHEIGHT 300)
> 
> (define transition-frames (* TRANSITION-TIME FRAME-RATE))
> 
> ;; given fraction of transition and shapetrans, compute
> ;; shape position
> (define (trans-posn frac st)
>   (define 1-frac (- 1 frac))
>   (match st
> [(shapetrans _ (posn sx sy) (posn ex ey))
>  (posn (+ (* 1-frac sx) (* frac ex))
>(+ (* 1-frac sy) (* frac ey)))]))
> 
> (check-equal? (trans-posn 0 (shapetrans r (posn 10 30) (posn -50 100)))
>   (posn 10 30))
> (check-equal? (trans-posn 1/2 (shapetrans r (posn 10 30) (posn -50 100)))
>   (posn -20 65))
> (check-equal? (trans-posn 1 (shapetrans r (posn 10 30) (posn -50 100)))
>   (posn -50 100))
> 
> ;; given fraction of transition, shapetrans, and scene, overlay
> ;; shapetrans-image at the correct location
> (define (add-image frac st scene)
>   (match (trans-posn frac st)
> [(posn x y)
>  (place-image (shapetrans-image st) x y scene)]))
> 
> 
> ;; a world is a shapetrans and a frame number
> (struct world (st frame))
> 
> ;; draw a world
> (define (draw-world w)
>   (match-define (world st frame) w)
>   (add-image (/ (modulo frame transition-frames) transition-frames)
>  st
>  (empty-scene SCENEWIDTH SCENEHEIGHT)))
> 
> (check-equal? (draw-world (world (shapetrans r (posn 10 30) (posn 20 100))
>  (* 5/2 transition-frames)))
>   (place-image r 15 65 (empty-scene SCENEWIDTH SCENEHEIGHT)))
> 
> ;; advance the frame by 1
> (define (tick-fun w)
>   (match-define (world st frame) w)
>   (world st (add1 frame)))
> 
> (big-bang (world (shapetrans r (posn 10 30) (posn 20 100)) 0)
>   [to-draw draw-world]
>   [on-tick tick-fun (/ 1 FRAME-RATE)])
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> 
> --
> [application/pgp-signature "signature.asc"] [~/Desktop & open] [~/Temp & open]

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] 6.4 + universe has mouse-based hiccups

2016-04-05 Thread 'John Clements' via Racket Users
I just wrote a simple 2htdp/universe program that animates a moving green 
rectangle. I was expecting to scale up to larger #s of rectangles, but I 
discover that moving the mouse affects the animation quite seriously. 
Specifically, moving the mouse in a small smooth circle causes the green 
rectangle to reduce its frame rate to about 7 frames per second. No GC activity 
is observed in the log box when gc@debug is added.

I’m going to include the program below: I haven’t tried to minimize it, but 
it’s still quite small. (76 lines of HtDP style.) I’m guessing this problem is 
not specific to this program.

FWIW, this is a 13” macbook pro, 16MB, running 10.11.4.

Is this a known issue?

John



#lang racket

(require 2htdp/universe
 2htdp/image
 rackunit)

(define r (rectangle 40 40 'solid 'green))

;; represents a position on the screen
(struct posn (x y) #:transparent)

;; a shape-transition contains an image, a starting
;; position, and an ending position. It represents
;; a shape that moves from the start-pos to the end-pos
;; through the transition
(struct shapetrans (image start-pos end-pos) #:transparent)

;; in seconds:
(define TRANSITION-TIME 1)

;; in frames per second
(define FRAME-RATE 40)

(define SCENEWIDTH 400)
(define SCENEHEIGHT 300)

(define transition-frames (* TRANSITION-TIME FRAME-RATE))

;; given fraction of transition and shapetrans, compute
;; shape position
(define (trans-posn frac st)
  (define 1-frac (- 1 frac))
  (match st
[(shapetrans _ (posn sx sy) (posn ex ey))
 (posn (+ (* 1-frac sx) (* frac ex))
   (+ (* 1-frac sy) (* frac ey)))]))

(check-equal? (trans-posn 0 (shapetrans r (posn 10 30) (posn -50 100)))
  (posn 10 30))
(check-equal? (trans-posn 1/2 (shapetrans r (posn 10 30) (posn -50 100)))
  (posn -20 65))
(check-equal? (trans-posn 1 (shapetrans r (posn 10 30) (posn -50 100)))
  (posn -50 100))

;; given fraction of transition, shapetrans, and scene, overlay
;; shapetrans-image at the correct location
(define (add-image frac st scene)
  (match (trans-posn frac st)
[(posn x y)
 (place-image (shapetrans-image st) x y scene)]))


;; a world is a shapetrans and a frame number
(struct world (st frame))

;; draw a world
(define (draw-world w)
  (match-define (world st frame) w)
  (add-image (/ (modulo frame transition-frames) transition-frames)
 st
 (empty-scene SCENEWIDTH SCENEHEIGHT)))

(check-equal? (draw-world (world (shapetrans r (posn 10 30) (posn 20 100))
 (* 5/2 transition-frames)))
  (place-image r 15 65 (empty-scene SCENEWIDTH SCENEHEIGHT)))

;; advance the frame by 1
(define (tick-fun w)
  (match-define (world st frame) w)
  (world st (add1 frame)))

(big-bang (world (shapetrans r (posn 10 30) (posn 20 100)) 0)
  [to-draw draw-world]
  [on-tick tick-fun (/ 1 FRAME-RATE)])



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature