[racket] Racket 5.0.99.2 on OS X

From: Jakub Piotr Cłapa (jpc-ml at zenburn.net)
Date: Mon Nov 29 15:04:53 EST 2010

Dear Matthew,

Sorry for the long delay. I will try to help you as much as I can.

On 26.11.10 15:03, Matthew Flatt wrote:
> At Thu, 25 Nov 2010 21:30:59 +0100, Jakub Piotr Cłapa wrote:
>> I tried to install the new Racket nightly on OS X (the previous one was
>> missing cairo IIRC).
>
> Can you tell me more about your system, including the processor and OS
> version?

10.6.5 on a Core 2 Duo Macbook Pro.

>> 1. Different (horrible) antialiased font rendering when using white text
>> on black background. [1]
>
> I'm not able to replicate this behavior on my machines (x86 10.6 or
> PowerPC 10.4).
>
> As a simpler test, can you run the program at the bottom of this
> message in both the old and new versions and send me screen shots?

While playing with your example code I managed to narrow it down to 
'partly-smoothed. It seems that it really gave full smoothing (at least 
with Monaco) in the old MrEd. In the new one there is a big difference 
between partial and full smoothing and with partial the output gets 
worse on dark backgrounds (even for 'swiss). Strage, because I thought 
that this setting was one of the things I checked before sending my e-mail.

The code:
#lang racket/gui

(define f (new frame%
                [label "Text Test"]
                [width 200]
                [height 172]))

(new canvas%
      [parent f]
      [paint-callback
       (lambda (c dc)
         (send dc set-brush "black" 'solid)
         (send dc draw-rectangle 0 0 200 75)
         (send dc set-text-foreground (make-object color% "white"))
         (send dc set-font (make-object font% 12 'swiss 'normal 'normal 
#f 'partly-smoothed))
         (send dc draw-text "send dc set-font!" 10 30)
         (send dc set-text-foreground (make-object color% "black"))
         (send dc draw-text "send dc set-font!" 10 105))])

(send f show #t)

Screenshot:
http://cl.ly/0w0M3n0m0e1i2Z1o1k1w

With full-smoothing there are no differences (for both Monaco and 'swiss).

So I guess it's not a bug, it's a feature. ;]

>> 2. Cmd- keyboard shortcuts do not work at all (no action).
>
> I've had one other report of this problem, but I don't yet have a good
> idea why Cmd- combinations aren't delivered as key events.
>
> Since I'm not able to replicate the problem on my machines, maybe you
> can help me debug the problem. With a few experiments.
>
> The first experiment:
>
>   * In "collects/mred/private/wx/cocoa/window.rkt", you add a
>     `printf' to the start of `do-key-event'. (You won't need to
>     recompile anything after making the change.)
>
>   * Run the program at the end of this message.
>
>   * After the program starts, type a key; you should normally see two
>     printouts from `do-key-event' --- one for the key press and one for
>     the key release. For a Cmd- combination, you should see a printout
>     for the key press, but my guess is that you won't see anything when
>     you type a Cmd- combination.
>
>   * Be sure to remove the `printf' before trying to run DrRacket;
>     printing isn't really allowed at that layer of the system.

I added:
(define (do-key-event wxb event self down? wheel?)
   (eprintf "~s~n" (list 'do-key-event wxb event self down? wheel?))

For normal keypresses (with Alt/Option too) I get these pairs:
(do-key-event #<weak-box> #<cpointer:id> #<cpointer:id> #t #f)
(do-key-event #<weak-box> #<cpointer:id> #<cpointer:id> #f #f)

For anything with Cmd- I do not get any prints.

It worked with both standalone gracket and drracket. OTOH The modified 
DrRacket hanged hanged once during the tests so maybe you are right 
about the layers. :)
In either case the output goes to original the stderr of the process (so 
the Terminal or Console) and both give the same results.

> A second experiment:
>
>   * In "collects/mred/private/wx/cocoa/window.rkt", change the
>     implementation of `performKeyEquivalent:' in `MyMenuBar'
>     from
>
>        (and the-apple-menu
>             (tell #:type _BOOL the-apple-menu performKeyEquivalent: evt))
>
>     to
>
>        (super-tell #:type _BOOL performKeyEquivalent: evt)
>
>   * Run GRacket. Does Cmd-A work? Cmd-Q?

I failed to notice that Cmd-Q and Cmd-H always worked just like Cmd-,. 
Sorry.

This is fun: In 5.0.99.2 I do not have any mention of 
performKeyEquivalent in window.rkt or anywhere else in collects. ;-)
I downloaded 5.0.99.3 (plt-5.0.99.3-bin-i386-osx-mac.dmg) and I cannot 
find anything either.

> A third experiment:
>
>   * Change the `performKeyEquivalent:' implementation to just
>
>        #t
>
>   * Run GRacket. Does Cmd-A work? Cmd-Q?
>
> A fourth experiment:
>
>   * Change the `performKeyEquivalent:' implementation to just
>
>        #f
>
>   * Run GRacket. Does Cmd-A work? Cmd-Q?

Ditto.

>> 3. In preferences I can only switch tabs and click OK/Cancel. Other
>> buttons and drop-downs do not react to clicks. I can activate and change
>> some of them using the keyboard (Tabs + Space).
>
> I see this on my PowerPC 10.4 machine (though your screen shots look
> like 10.5, at least), so I should be able to fix this one.

I don't know if it should but it still does not work on 5.0.99.3.

-- 
regards,
Jakub Piotr Cłapa


Posted on the users mailing list.