[racket] Racket on OS X

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Nov 26 09:03:57 EST 2010

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

> 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?

> 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.

A second experiment:

 * In "collects/mred/private/wx/cocoa/window.rkt", change the
   implementation of `performKeyEquivalent:' in `MyMenuBar'

      (and the-apple-menu
           (tell #:type _BOOL the-apple-menu performKeyEquivalent: evt))


      (super-tell #:type _BOOL performKeyEquivalent: evt)

 * Run GRacket. Does Cmd-A work? Cmd-Q?

A third experiment:

 * Change the `performKeyEquivalent:' implementation to just


 * Run GRacket. Does Cmd-A work? Cmd-Q?

A fourth experiment:

 * Change the `performKeyEquivalent:' implementation to just


 * Run GRacket. Does Cmd-A work? Cmd-Q?

> 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.


#lang racket/gui

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

(new canvas%
     [parent f]
      (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))
        (send dc draw-text "This is a test!" 10 30)
        (send dc set-text-foreground (make-object color% "black"))
        (send dc draw-text "This is a test!" 10 105))])

(send f show #t)

Posted on the users mailing list.