Updating tk +quartz failed on Snow Leopard

Ryan Schmidt ryandesign at macports.org
Thu Aug 25 09:38:58 PDT 2016


> On Aug 25, 2016, at 5:44 AM, Mojca Miklavec <mojca at macports.org> wrote:
> 
> Hi,
> 
> I'm moving the discussion from the user mailing list to the developer
> one, hoping to catch attention of more experienced developers there.
> 
> To summarize.
> 
> Tk fails to compile on Snow Lepard due to the following chunk of code:
> 
>    MacDrawable *macDraw = (MacDrawable *) d;
>    NSWindow *win = TkMacOSXDrawableWindow(d);
>    int scalefactor = 1;
>    if (win && [win respondsToSelector:@selector(backingScaleFactor)]) {
>        scalefactor = ([win backingScaleFactor] == 2.0) ? 2 : 1;
>    }
> 
> The function backingScaleFactor has only been added in 10.7 and
> returns a floating point number.
> 
> On 10.6 the "if" sentence is false, so the "scalefactor = ..." never
> gets executed. The problem is that 10.6 believes that [win
> backingScaleFactor] returns "id" rather than a floating point number
> (it doesn't know the function after all) and throws a compile error
> because id cannot be compared with a floating point (2.0).

tk isn't the first program to need to deal with Retina displays. Can we find any other program that uses NSWindow's backingScaleFactor selector and see how it handles it?



More information about the macports-dev mailing list