app.dhover×592 error×27all
// macOS/AppKit F08 demo — DPI / backingScaleFactor (../../../features/f08-dpi-scaling.md).
// Where the scale lives, when it becomes learnable, and what AppKit pre-scales for a
// software renderer. Built on the scaffold/f02 recipe; the run findings are A[ssh]
// (locked console — no monitor drag possible; that path is Tier C).
//
// What it logs:
//   - every scale source: NSScreen.screens (per-screen backingScaleFactor + frame),
//     NSWindow.backingScaleFactor, NSView convertRectToBacking:, and the CALayer
//     contentsScale during a brief wantsLayer=YES probe;
//   - the created-at-wrong-scale timeline with µs timestamps: window scale at
//     initWithContentRect return, the VIEW's pre-install conversion scale (a windowless
//     view converts at 1.0), and viewDidChangeBackingProperties firing 1.0 -> 2.0
//     synchronously inside setContentView: — plus a counter proving nothing else
//     triggers it headless (resizes, ordering, an off-screen setFrameOrigin:);
//   - convertRectToBacking:/convertRectFromBacking: round-trips, incl. odd and
//     fractional point sizes;
//   - drawRect: ground truth: CGContextGetCTM of the view's context — the transform
//     AppKit pre-installs so points-rect drawing lands on device pixels;
//   - the deliberately-mismatched probe: one frame draws a 1.0-scale (points-sized)
//     CGImage into the 2.0 view — same points rect, half the pixels, so Quartz
//     resamples it x2 (the classic blurry-stretch); the CGImage size vs CTM scale is
//     the app-observable evidence;
//   - per-resize buffer math assert pixels == points x scale (the f02 invariant);
//     1-physical-px hairlines (1/scale-point rects) at the window edges;
//   - runtime-rescale observability: registration for
//     NSApplicationDidChangeScreenParametersNotification and
//     NSWindowDidChangeBackingPropertiesNotification (with the old-scale userInfo key),
//     which would fire on a display config change / monitor drag (Tier C).
//
// Modes: WSI_AUTO_EXIT=1 = bounded scripted run (exit 1 on any math mismatch);
// without it the window stays up for a manual monitor-drag session.
// Headless-safe: prints `SKIP:` and exits 0 when there is no window server.
module 
(module) app
app
;
import
(package) core
core
.
(module) core.attribute

This module contains UDA's (User Defined Attributes) either used in the runtime or special UDA's recognized by compiler.

Attribute Name, Linkage, Description

gnuAbiTag, C++, Declares an ABI tag on a C++ symbol. mustuse,, Ensures that values of a struct or union type are not discarded. optional, Objective-C, Makes an Objective-C interface method optional. selector, Objective-C, Attaches an Objective-C selector to a method. standalone,, Marks a shared module constructor as not depending on any other module constructor being run first. weak,, Specifies that a global symbol should be emitted with weak linkage.

Source

core/attribute.d

@copyrightCopyright Jacob Carlborg 2015.@licenseBoost License 1.0@authorsJacob Carlborg
attribute
: selector;
module `core.attribute` import `selector` not found
import
(package) core
core
.
(package) core.stdc
stdc
.
(module) core.stdc.stdio

D header file for C99 <stdio.h>

pubs.opengroup.org/onlinepubs/009695399/basedefs/stdio.h.html, stdio.h

Source

core/stdc/stdio.d

@copyrightCopyright Sean Kelly 2005 - 2009.@licenseDistributed under the Boost Software License 1.0. (See accompanying file LICENSE)@authorsSean Kelly, Alex Rønne Petersen@standardsISO/IEC 9899:1999 (E)
stdio
:
(alias) app.printf = int core.stdc.stdio.printf(scope const(char*) format, scope const ...) nothrow @nogc
printf
;
import
(package) core
core
.
(package) core.stdc
stdc
.
(module) core.stdc.stdlib

D header file for C99.

pubs.opengroup.org/onlinepubs/009695399/basedefs/stdlib.h.html, stdlib.h

Source

core/stdc/stdlib.d

@copyrightCopyright Sean Kelly 2005 - 2014.@licenseDistributed under the Boost Software License 1.0. (See accompanying file LICENSE)@authorsSean Kelly@standardsISO/IEC 9899:1999 (E)
stdlib
:
(alias) app.getenv = char* core.stdc.stdlib.getenv(scope const(char*) name) nothrow @nogc
getenv
,
(alias) app.malloc = void* core.stdc.stdlib.malloc(ulong size) nothrow @nogc
malloc
,
(alias) app.free = void core.stdc.stdlib.free(void* ptr) nothrow @nogc
free
;
import instrument : instr, instrInit;
unable to read module `instrument` Expected 'instrument.d' or 'instrument/package.d' in one of the following import paths:
unable to read module `instrument` Expected 'instrument.d' or 'instrument/package.d' in one of the following import paths:
unable to read module `instrument` Expected 'instrument.d' or 'instrument/package.d' in one of the following import paths:
import objc.autorelease : autoreleasepool_push, autoreleasepool_pop; // objective-d
unable to read module `autorelease` Expected 'objc/autorelease.d' or 'objc/autorelease/package.d' in one of the following import paths:
unable to read module `autorelease` Expected 'objc/autorelease.d' or 'objc/autorelease/package.d' in one of the following import paths:
unable to read module `autorelease` Expected 'objc/autorelease.d' or 'objc/autorelease/package.d' in one of the following import paths:
import objc.rt : SEL;
unable to read module `rt` Expected 'objc/rt.d' or 'objc/rt/package.d' in one of the following import paths:
unable to read module `rt` Expected 'objc/rt.d' or 'objc/rt/package.d' in one of the following import paths:
unable to read module `rt` Expected 'objc/rt.d' or 'objc/rt/package.d' in one of the following import paths:
// --- C-level declarations --------------------------------------------------------- extern (C) struct
(struct) app.CGAffineTransform
CGAffineTransform
{ double
(field) double app.CGAffineTransform.a
a
,
(field) double app.CGAffineTransform.b
b
,
(field) double app.CGAffineTransform.c
c
,
(field) double app.CGAffineTransform.d
d
,
(field) double app.CGAffineTransform.tx
tx
,
(field) double app.CGAffineTransform.ty
ty
;
} extern (C) nothrow @nogc { uint
uint app.CGMainDisplayID() nothrow @nogc
CGMainDisplayID
();
void*
void* app.CGColorSpaceCreateDeviceRGB() nothrow @nogc
CGColorSpaceCreateDeviceRGB
();
void
void app.CGColorSpaceRelease(void* space) nothrow @nogc
CGColorSpaceRelease
(void*
(parameter) void* space
space
);
void*
void* app.CGDataProviderCreateWithData(void* info, const(void)* data, ulong size, void* releaseCallback) nothrow @nogc
CGDataProviderCreateWithData
(void*
(parameter) void* info
info
, const(void)*
(parameter) const(void)* data
data
,
(alias) object.size_t = ulong
size_t
(parameter) ulong size
size
,
void*
(parameter) void* releaseCallback
releaseCallback
);
void
void app.CGDataProviderRelease(void* provider) nothrow @nogc
CGDataProviderRelease
(void*
(parameter) void* provider
provider
);
void*
void* app.CGImageCreate(ulong width, ulong height, ulong bitsPerComponent, ulong bitsPerPixel, ulong bytesPerRow, void* colorSpace, uint bitmapInfo, void* provider, const(double)* decode, bool shouldInterpolate, int intent) nothrow @nogc
CGImageCreate
(
(alias) object.size_t = ulong
size_t
(parameter) ulong width
width
,
(alias) object.size_t = ulong
size_t
(parameter) ulong height
height
,
(alias) object.size_t = ulong
size_t
(parameter) ulong bitsPerComponent
bitsPerComponent
,
(alias) object.size_t = ulong
size_t
(parameter) ulong bitsPerPixel
bitsPerPixel
,
(alias) object.size_t = ulong
size_t
(parameter) ulong bytesPerRow
bytesPerRow
, void*
(parameter) void* colorSpace
colorSpace
, uint
(parameter) uint bitmapInfo
bitmapInfo
,
void*
(parameter) void* provider
provider
, const(double)*
(parameter) const(double)* decode
decode
, bool
(parameter) bool shouldInterpolate
shouldInterpolate
, int
(parameter) int intent
intent
);
void
void app.CGImageRelease(void* image) nothrow @nogc
CGImageRelease
(void*
(parameter) void* image
image
);
(alias) object.size_t = ulong
size_t
ulong app.CGImageGetWidth(void* image) nothrow @nogc
CGImageGetWidth
(void*
(parameter) void* image
image
);
(alias) object.size_t = ulong
size_t
ulong app.CGImageGetHeight(void* image) nothrow @nogc
CGImageGetHeight
(void*
(parameter) void* image
image
);
void
void app.CGContextDrawImage(void* ctx, app.NSRect rect, void* image) nothrow @nogc
CGContextDrawImage
(void*
(parameter) void* ctx
ctx
,
(struct) app.NSRect
NSRect
(parameter) app.NSRect rect
rect
, void*
(parameter) void* image
image
);
void
void app.CGContextSetRGBFillColor(void* ctx, double r, double g, double b, double a) nothrow @nogc
CGContextSetRGBFillColor
(void*
(parameter) void* ctx
ctx
, double
(parameter) double r
r
, double
(parameter) double g
g
, double
(parameter) double b
b
, double
(parameter) double a
a
);
void
void app.CGContextFillRect(void* ctx, app.NSRect rect) nothrow @nogc
CGContextFillRect
(void*
(parameter) void* ctx
ctx
,
(struct) app.NSRect
NSRect
(parameter) app.NSRect rect
rect
);
(struct) app.CGAffineTransform
CGAffineTransform
app.CGAffineTransform app.CGContextGetCTM(void* ctx) nothrow @nogc
CGContextGetCTM
(void*
(parameter) void* ctx
ctx
);
// AppKit-exported notification-name / userInfo-key constants (NSString*). extern __gshared void*
(__gshared global) void* app.NSApplicationDidChangeScreenParametersNotification
NSApplicationDidChangeScreenParametersNotification
;
extern __gshared void*
(__gshared global) void* app.NSWindowDidChangeBackingPropertiesNotification
NSWindowDidChangeBackingPropertiesNotification
;
extern __gshared void*
(__gshared global) void* app.NSBackingPropertyOldScaleFactorKey
NSBackingPropertyOldScaleFactorKey
;
} enum uint
(constant) uint app.kCGImageAlphaNoneSkipFirst = 6u
kCGImageAlphaNoneSkipFirst
= 6;
enum uint
(constant) uint app.kCGBitmapByteOrder32Little = 8192u
kCGBitmapByteOrder32Little
= 2 << 12;
enum int
(constant) int app.kCGRenderingIntentDefault = 0
kCGRenderingIntentDefault
= 0;
extern (C) struct
(struct) app.NSPoint
NSPoint
{ double
(field) double app.NSPoint.x
x
,
(field) double app.NSPoint.y
y
;
} extern (C) struct
(struct) app.NSSize
NSSize
{ double
(field) double app.NSSize.width
width
,
(field) double app.NSSize.height
height
;
} extern (C) struct
(struct) app.NSRect
NSRect
{
(struct) app.NSPoint
NSPoint
(field) app.NSPoint app.NSRect.origin
origin
;
(struct) app.NSSize
NSSize
(field) app.NSSize app.NSRect.size
size
;
} // --- AppKit class declarations ---------------------------------------------------- extern (Objective-C): extern class
(class) app.NSObject
NSObject
class `app.NSObject` Objective-C classes not supported
{ } extern class
(class) app.NSString
NSString
:
(class) app.NSObject
NSObject
class `app.NSString` Objective-C classes not supported
{ static
(class) app.NSString
NSString
app.NSString app.NSString.alloc()
alloc
() @selector("alloc");
(class) app.NSString
NSString
app.NSString app.NSString.initWithUTF8String(const(char)* s)
initWithUTF8String
(const(char)*
(parameter) const(char)* s
s
) @selector("initWithUTF8String:");
const(char)*
const(char)* app.NSString.UTF8String()
UTF8String
() @selector("UTF8String");
} extern class
(class) app.NSArray
NSArray
:
(class) app.NSObject
NSObject
class `app.NSArray` Objective-C classes not supported
{ ulong
ulong app.NSArray.count()
count
() @selector("count");
(class) app.NSObject
NSObject
app.NSObject app.NSArray.objectAtIndex(ulong index)
objectAtIndex
(ulong
(parameter) ulong index
index
) @selector("objectAtIndex:");
} extern class
(class) app.NSNumber
NSNumber
:
(class) app.NSObject
NSObject
class `app.NSNumber` Objective-C classes not supported
{ double
double app.NSNumber.doubleValue()
doubleValue
() @selector("doubleValue");
} extern class
(class) app.NSDictionary
NSDictionary
:
(class) app.NSObject
NSObject
class `app.NSDictionary` Objective-C classes not supported
{
(class) app.NSObject
NSObject
app.NSObject app.NSDictionary.objectForKey(app.NSObject key)
objectForKey
(
(class) app.NSObject
NSObject
(parameter) app.NSObject key
key
) @selector("objectForKey:");
} extern class
(class) app.NSNotification
NSNotification
:
(class) app.NSObject
NSObject
class `app.NSNotification` Objective-C classes not supported
{
(class) app.NSDictionary
NSDictionary
app.NSDictionary app.NSNotification.userInfo()
userInfo
() @selector("userInfo");
} extern class
(class) app.NSNotificationCenter
NSNotificationCenter
:
(class) app.NSObject
NSObject
class `app.NSNotificationCenter` Objective-C classes not supported
{ static
(class) app.NSNotificationCenter
NSNotificationCenter
app.NSNotificationCenter app.NSNotificationCenter.defaultCenter()
defaultCenter
() @selector("defaultCenter");
void
app.NSNotificationCenter.addObserver
addObserver
(
(class) app.NSObject
NSObject
observer, SEL sel,
(class) app.NSObject
NSObject
(parameter) NSObject name
name
,
(class) app.NSObject
NSObject
(parameter) NSObject obj
obj
)
@selector("addObserver:selector:name:object:"); void
void app.NSNotificationCenter.postNotificationName(app.NSObject name, app.NSObject obj)
postNotificationName
(
(class) app.NSObject
NSObject
(parameter) app.NSObject name
name
,
(class) app.NSObject
NSObject
(parameter) app.NSObject obj
obj
)
@selector("postNotificationName:object:"); } extern class
(class) app.NSScreen
NSScreen
:
(class) app.NSObject
NSObject
class `app.NSScreen` Objective-C classes not supported
{ static
(class) app.NSArray
NSArray
app.NSArray app.NSScreen.screens()
screens
() @selector("screens");
static
(class) app.NSScreen
NSScreen
app.NSScreen app.NSScreen.mainScreen()
mainScreen
() @selector("mainScreen");
double
double app.NSScreen.backingScaleFactor()
backingScaleFactor
() @selector("backingScaleFactor");
(struct) app.NSRect
NSRect
app.NSRect app.NSScreen.frame()
frame
() @selector("frame");
(class) app.NSString
NSString
app.NSString app.NSScreen.localizedName()
localizedName
() @selector("localizedName");
} extern class
(class) app.CALayer
CALayer
:
(class) app.NSObject
NSObject
class `app.CALayer` Objective-C classes not supported
{ double
double app.CALayer.contentsScale()
contentsScale
() @selector("contentsScale");
} extern class
(class) app.NSResponder
NSResponder
:
(class) app.NSObject
NSObject
class `app.NSResponder` Objective-C classes not supported
{ } extern class
(class) app.NSEvent
NSEvent
:
(class) app.NSObject
NSObject
class `app.NSEvent` Objective-C classes not supported
{ static
(class) app.NSEvent
NSEvent
app.NSEvent app.NSEvent.otherEventWithType(long type, app.NSPoint location, ulong modifierFlags, double timestamp, long windowNumber, app.NSObject context, short subtype, long data1, long data2)
otherEventWithType
(long
(parameter) long type
type
,
(struct) app.NSPoint
NSPoint
(parameter) app.NSPoint location
location
, ulong
(parameter) ulong modifierFlags
modifierFlags
,
double
(parameter) double timestamp
timestamp
, long
(parameter) long windowNumber
windowNumber
,
(class) app.NSObject
NSObject
(parameter) app.NSObject context
context
, short
(parameter) short subtype
subtype
,
long
(parameter) long data1
data1
, long
(parameter) long data2
data2
)
@selector("otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:"); } extern class
(class) app.NSTimer
NSTimer
:
(class) app.NSObject
NSObject
class `app.NSTimer` Objective-C classes not supported
{ static
(class) app.NSTimer
NSTimer
app.NSTimer.scheduledTimerWithTimeInterval
scheduledTimerWithTimeInterval
(double interval,
(class) app.NSObject
NSObject
target,
SEL sel,
(class) app.NSObject
NSObject
(parameter) NSObject userInfo
userInfo
, bool repeats)
@selector("scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:"); } extern class
(class) app.NSGraphicsContext
NSGraphicsContext
:
(class) app.NSObject
NSObject
class `app.NSGraphicsContext` Objective-C classes not supported
{ static
(class) app.NSGraphicsContext
NSGraphicsContext
app.NSGraphicsContext app.NSGraphicsContext.currentContext()
currentContext
() @selector("currentContext");
void*
void* app.NSGraphicsContext.CGContext()
CGContext
() @selector("CGContext");
} extern class
(class) app.NSApplication
NSApplication
:
(class) app.NSResponder
NSResponder
class `app.NSApplication` Objective-C classes not supported
{ static
(class) app.NSApplication
NSApplication
app.NSApplication app.NSApplication.sharedApplication()
sharedApplication
() @selector("sharedApplication");
void
void app.NSApplication.setActivationPolicy(long policy)
setActivationPolicy
(long
(parameter) long policy
policy
) @selector("setActivationPolicy:");
void
void app.NSApplication.activateIgnoringOtherApps(bool flag)
activateIgnoringOtherApps
(bool
(parameter) bool flag
flag
) @selector("activateIgnoringOtherApps:");
void
void app.NSApplication.run()
run
() @selector("run");
void
void app.NSApplication.stop(app.NSObject sender)
stop
(
(class) app.NSObject
NSObject
(parameter) app.NSObject sender
sender
) @selector("stop:");
void
void app.NSApplication.postEvent(app.NSEvent event, bool atStart)
postEvent
(
(class) app.NSEvent
NSEvent
(parameter) app.NSEvent event
event
, bool
(parameter) bool atStart
atStart
) @selector("postEvent:atStart:");
} extern class
(class) app.NSView
NSView
:
(class) app.NSResponder
NSResponder
class `app.NSView` Objective-C classes not supported
{ void
void app.NSView.setFrameSize(app.NSSize newSize)
setFrameSize
(
(struct) app.NSSize
NSSize
(parameter) app.NSSize newSize
newSize
) @selector("setFrameSize:");
void
void app.NSView.setNeedsDisplay(bool flag)
setNeedsDisplay
(bool
(parameter) bool flag
flag
) @selector("setNeedsDisplay:");
(struct) app.NSRect
NSRect
app.NSRect app.NSView.bounds()
bounds
() @selector("bounds");
(struct) app.NSRect
NSRect
app.NSRect app.NSView.convertRectToBacking(app.NSRect rect)
convertRectToBacking
(
(struct) app.NSRect
NSRect
(parameter) app.NSRect rect
rect
) @selector("convertRectToBacking:");
(struct) app.NSRect
NSRect
app.NSRect app.NSView.convertRectFromBacking(app.NSRect rect)
convertRectFromBacking
(
(struct) app.NSRect
NSRect
(parameter) app.NSRect rect
rect
) @selector("convertRectFromBacking:");
void
void app.NSView.setWantsLayer(bool flag)
setWantsLayer
(bool
(parameter) bool flag
flag
) @selector("setWantsLayer:");
(class) app.CALayer
CALayer
app.CALayer app.NSView.layer()
layer
() @selector("layer");
(class) app.NSWindow
NSWindow
app.NSWindow app.NSView.window()
window
() @selector("window");
} extern class
(class) app.NSWindow
NSWindow
:
(class) app.NSResponder
NSResponder
class `app.NSWindow` Objective-C classes not supported
{ static
(class) app.NSWindow
NSWindow
app.NSWindow app.NSWindow.alloc()
alloc
() @selector("alloc");
(class) app.NSWindow
NSWindow
app.NSWindow app.NSWindow.initWithContentRect(app.NSRect contentRect, ulong styleMask, ulong backing, bool defer)
initWithContentRect
(
(struct) app.NSRect
NSRect
(parameter) app.NSRect contentRect
contentRect
, ulong
(parameter) ulong styleMask
styleMask
,
ulong
(parameter) ulong backing
backing
, bool
(parameter) bool defer
defer
) @selector("initWithContentRect:styleMask:backing:defer:");
void
void app.NSWindow.setTitle(app.NSString title)
setTitle
(
(class) app.NSString
NSString
(parameter) app.NSString title
title
) @selector("setTitle:");
void
void app.NSWindow.setContentView(app.NSView view)
setContentView
(
(class) app.NSView
NSView
(parameter) app.NSView view
view
) @selector("setContentView:");
void
void app.NSWindow.setDelegate(app.NSObject anObject)
setDelegate
(
(class) app.NSObject
NSObject
(parameter) app.NSObject anObject
anObject
) @selector("setDelegate:");
void
void app.NSWindow.makeKeyAndOrderFront(app.NSObject sender)
makeKeyAndOrderFront
(
(class) app.NSObject
NSObject
(parameter) app.NSObject sender
sender
) @selector("makeKeyAndOrderFront:");
void
void app.NSWindow.setContentSize(app.NSSize size)
setContentSize
(
(struct) app.NSSize
NSSize
(parameter) app.NSSize size
size
) @selector("setContentSize:");
void
void app.NSWindow.setFrameOrigin(app.NSPoint point)
setFrameOrigin
(
(struct) app.NSPoint
NSPoint
(parameter) app.NSPoint point
point
) @selector("setFrameOrigin:");
(struct) app.NSRect
NSRect
app.NSRect app.NSWindow.frame()
frame
() @selector("frame");
double
double app.NSWindow.backingScaleFactor()
backingScaleFactor
() @selector("backingScaleFactor");
(class) app.NSScreen
NSScreen
app.NSScreen app.NSWindow.screen()
screen
() @selector("screen");
(struct) app.NSRect
NSRect
app.NSRect app.NSWindow.convertRectToBacking(app.NSRect rect)
convertRectToBacking
(
(struct) app.NSRect
NSRect
(parameter) app.NSRect rect
rect
) @selector("convertRectToBacking:");
} // The instrumented view: scale-aware CPU blit + CTM logging + the mismatch probe. class
(class) app.ScaleView
ScaleView
:
(class) app.NSView
NSView
class `app.ScaleView` Objective-C classes not supported
{ static
(class) app.ScaleView
ScaleView
app.ScaleView app.ScaleView.alloc()
alloc
() @selector("alloc");
(class) app.ScaleView
ScaleView
app.ScaleView app.ScaleView.initWithFrame(app.NSRect frame)
initWithFrame
(
(struct) app.NSRect
NSRect
(parameter) app.NSRect frame
frame
) @selector("initWithFrame:");
override void
void app.ScaleView.setFrameSize(app.NSSize newSize)
setFrameSize
(
(struct) app.NSSize
NSSize
(parameter) app.NSSize newSize
newSize
) @selector("setFrameSize:")
{ super.
super.setFrameSize
setFrameSize
(newSize);
onViewResized(this, newSize); } // The scale-migration signal. Counted + timestamped: the only firing expected in // this headless run is the 1.0 -> 2.0 flip inside setContentView:. void
void app.ScaleView.viewDidChangeBackingProperties()
viewDidChangeBackingProperties
() @selector("viewDidChangeBackingProperties")
{ ++g_backingChanges;
(unresolved type) NSWindow
NSWindow
_error_ w
w
= this.
this.window
window
();
immutable
_error_ scale
scale
= w !is null ? w.
w.backingScaleFactor
backingScaleFactor
() : 0.0;
immutable
_error_ b
b
= this.
this.convertRectToBacking
convertRectToBacking
(NSRect(NSPoint(0, 0), NSSize(100, 100)));
instr("backing_changed", "n=%d window_scale=%.1f view_converts_100pt_to=%.0fpx phase=%s", g_backingChanges, scale, b.
b.size
size
.
b.size.width
width
, g_phase);
} void
void app.ScaleView.drawRect(app.NSRect dirtyRect)
drawRect
(
(struct) app.NSRect
NSRect
(parameter) app.NSRect dirtyRect
dirtyRect
) @selector("drawRect:")
{ onDrawRect(this, this.
this.bounds
bounds
());
} void
void app.ScaleView.tick(app.NSTimer timer)
tick
(
(class) app.NSTimer
NSTimer
(parameter) app.NSTimer timer
timer
) @selector("tick:")
{ onTick(this); } // Would fire on any display configuration change (resolution/scale/arrangement, // monitor plug/unplug) — the app-level runtime-rescale signal. Registration is // the headless deliverable; an actual firing needs Tier C. void
void app.ScaleView.screenParamsChanged(app.NSNotification n)
screenParamsChanged
(
(class) app.NSNotification
NSNotification
(parameter) app.NSNotification n
n
) @selector("screenParamsChanged:")
{ instr("screen_params_changed", "phase=%s", g_phase); logScreens("notification"); } // Window-level backing change notification; userInfo carries the OLD scale. void
void app.ScaleView.windowBackingChanged(app.NSNotification n)
windowBackingChanged
(
(class) app.NSNotification
NSNotification
(parameter) app.NSNotification n
n
) @selector("windowBackingChanged:")
{ double
_error_ oldScale
oldScale
= 0;
(unresolved type) NSDictionary
NSDictionary
_error_ info
info
= n.
n.userInfo
userInfo
();
if (info !is null) { auto
_error_ num
num
= cast(
(unresolved type) NSNumber
NSNumber
) info.
info.objectForKey
objectForKey
(
cast(
(unresolved type) NSObject
NSObject
) NSBackingPropertyOldScaleFactorKey);
if (num !is null) oldScale = num.
num.doubleValue
doubleValue
();
} instr("window_backing_changed", "old_scale=%.1f new_scale=%.1f phase=%s", oldScale, g_win !is null ? g_win.
g_win.backingScaleFactor
backingScaleFactor
() : 0.0, g_phase);
} void
void app.ScaleView.windowWillClose(app.NSObject notification)
windowWillClose
(
(class) app.NSObject
NSObject
(parameter) app.NSObject notification
notification
) @selector("windowWillClose:")
{ instr("close_requested"); g_app.
g_app.stop
stop
(null);
} } extern (D): // back to D linkage enum
(constant) int app.NSApplicationActivationPolicyRegular = 0
NSApplicationActivationPolicyRegular
= 0;
enum : ulong {
(enum value) app.NSWindowStyleMaskTitled = 1LU
NSWindowStyleMaskTitled
= 1,
(enum value) app.NSWindowStyleMaskClosable = 2LU
NSWindowStyleMaskClosable
= 2,
(enum value) app.NSWindowStyleMaskResizable = 8LU
NSWindowStyleMaskResizable
= 8,
} enum ulong
(constant) ulong app.NSBackingStoreBuffered = 2LU
NSBackingStoreBuffered
= 2;
enum long
(constant) long app.NSEventTypeApplicationDefined = 15L
NSEventTypeApplicationDefined
= 15;
// --- Demo state -------------------------------------------------------------------- __gshared
(class) app.NSApplication
NSApplication
(__gshared global) app.NSApplication app.g_app
g_app
;
__gshared
(class) app.NSWindow
NSWindow
(__gshared global) app.NSWindow app.g_win
g_win
;
__gshared uint*
(__gshared global) uint* app.g_buf
g_buf
;
__gshared
(alias) object.size_t = ulong
size_t
(__gshared global) ulong app.g_bufW
g_bufW
,
(__gshared global) ulong app.g_bufH
g_bufH
;
__gshared int
(__gshared global) int app.g_tick
g_tick
,
(__gshared global) int app.g_frames
g_frames
,
(__gshared global) int app.g_backingChanges
g_backingChanges
,
(__gshared global) int app.g_mismatches
g_mismatches
;
__gshared bool
(__gshared global) bool app.g_auto
g_auto
,
(__gshared global) bool app.g_stopRequested
g_stopRequested
,
(__gshared global) bool app.g_firstConfigureSeen
g_firstConfigureSeen
;
__gshared bool
(__gshared global) bool app.g_probeMismatch
g_probeMismatch
; // next drawRect uses a 1.0-scale (points-sized) buffer
__gshared
(struct) app.CGAffineTransform
CGAffineTransform
(__gshared global) app.CGAffineTransform app.g_lastCtm
g_lastCtm
;
__gshared bool
(__gshared global) bool app.g_ctmLogged
g_ctmLogged
,
(__gshared global) bool app.g_ctmVsBackingLogged
g_ctmVsBackingLogged
;
__gshared const(char)*
(__gshared global) const(char)* app.g_phase
g_phase
= "setup";
// Schedule (ticks of a ~16 ms timer). immutable int[2][3]
(immutable global) immutable(int[2][3]) app.resizeSizes
resizeSizes
= [[640, 400], [333, 217], [480, 320]];
enum
(constant) int app.resizeStartTick = 20
resizeStartTick
= 20;
enum
(constant) int app.resizeStrideTicks = 8
resizeStrideTicks
= 8;
enum
(constant) int app.mismatchProbeTick = 50
mismatchProbeTick
= 50;
enum
(constant) int app.offscreenMoveTick = 60
offscreenMoveTick
= 60;
enum
(constant) int app.moveBackTick = 70
moveBackTick
= 70;
enum
(constant) int app.observerSelftestTick = 78
observerSelftestTick
= 78;
enum
(constant) int app.autoExitTick = 85
autoExitTick
= 85;
void
void app.renderGradient(uint* buf, ulong w, ulong h) nothrow @nogc
renderGradient
(uint*
(parameter) uint* buf
buf
,
(alias) object.size_t = ulong
size_t
(parameter) ulong w
w
,
(alias) object.size_t = ulong
size_t
(parameter) ulong h
h
) nothrow @nogc
{ foreach (
(parameter) y
y
; 0 .. h)
foreach (
(parameter) x
x
; 0 .. w)
{ immutable
_error_ r
r
= cast(uint)(x * 255 / w);
immutable
_error_ g
g
= cast(uint)(y * 255 / h);
immutable
_error_ b
b
= cast(uint)((x + y) * 255 / (w + h));
buf[y * w + x] = 0xFF00_0000 | (r << 16) | (g << 8) | b; } } long
long app.pixelsFor(double points, double scale) nothrow @nogc
pixelsFor
(double
(parameter) double points
points
, double
(parameter) double scale
scale
) nothrow @nogc
{ return cast(long)(points * scale + 0.5); } void
void app.logScreens(const(char)* when)
logScreens
(const(char)*
(parameter) const(char)* when
when
)
{
(unresolved type) NSArray
NSArray
_error_ screens
screens
= NSScreen.
NSScreen.screens
screens
();
immutable
_error_ n
n
= screens !is null ? screens.
screens.count
count
() : 0;
instr("screens", "when=%s count=%llu", when, n); foreach (
(parameter) i
i
; 0 .. n)
{ auto
_error_ s
s
= cast(
(unresolved type) NSScreen
NSScreen
) screens.
screens.objectAtIndex
objectAtIndex
(i);
immutable
_error_ f
f
= s.
s.frame
frame
();
(unresolved type) NSString
NSString
_error_ name
name
= s.
s.localizedName
localizedName
();
instr("screen", "idx=%llu scale=%.1f frame=(%.0f,%.0f %.0fx%.0f) name=\"%s\"", i, s.
s.backingScaleFactor
backingScaleFactor
(), f.
f.origin
origin
.
f.origin.x
x
, f.
f.origin
origin
.
f.origin.y
y
, f.
f.size
size
.
f.size.width
width
,
f.
f.size
size
.
f.size.height
height
, name !is null ? name.
name.UTF8String
UTF8String
() : "");
}
(unresolved type) NSScreen
NSScreen
_error_ main
main
= NSScreen.
NSScreen.mainScreen
mainScreen
();
if (main !is null) instr("screen", "idx=main scale=%.1f", main.
main.backingScaleFactor
backingScaleFactor
());
} // convertRectToBacking:/convertRectFromBacking: round-trips, incl. odd + fractional // point sizes — the points <-> pixels unit conversion contract. void
void app.roundTrips(app.ScaleView view)
roundTrips
(
(class) app.ScaleView
ScaleView
(parameter) app.ScaleView view
view
)
{ immutable double[2][4]
_error_ sizes
sizes
= [[480.0, 320.0], [333.0, 217.0], [100.5, 50.25],
[1.0, 1.0]]; foreach (
(parameter) sz
sz
; sizes)
{ immutable
_error_ pt
pt
= NSRect(NSPoint(0, 0), NSSize(sz[0], sz[1]));
immutable
_error_ px
px
= view.
view.convertRectToBacking
convertRectToBacking
(pt);
immutable
_error_ back
back
= view.
view.convertRectFromBacking
convertRectFromBacking
(px);
immutable
_error_ ok
ok
= back.
back.size
size
.
back.size.width
width
== pt.
pt.size
size
.
pt.size.width
width
&& back.
back.size
size
.
back.size.height
height
== pt.
pt.size
size
.
pt.size.height
height
;
if (!ok) ++g_mismatches; instr("round_trip", "points=%.2fx%.2f -> pixels=%.2fx%.2f -> points=%.2fx%.2f exact=%d", pt.
pt.size
size
.
pt.size.width
width
, pt.
pt.size
size
.
pt.size.height
height
, px.
px.size
size
.
px.size.width
width
, px.
px.size
size
.
px.size.height
height
,
back.
back.size
size
.
back.size.width
width
, back.
back.size
size
.
back.size.height
height
, ok ? 1 : 0);
} // The window-level converter answers the same question pre-contentView. immutable
_error_ wpx
wpx
= g_win.
g_win.convertRectToBacking
convertRectToBacking
(NSRect(NSPoint(0, 0), NSSize(100, 100)));
instr("round_trip", "window_converts_100pt_to=%.0fpx", wpx.
wpx.size
size
.
wpx.size.width
width
);
} // Brief wantsLayer probe: what contentsScale does AppKit hand the backing layer? void
void app.layerProbe(app.ScaleView view)
layerProbe
(
(class) app.ScaleView
ScaleView
(parameter) app.ScaleView view
view
)
{ instr("layer_probe", "stage=before layer=%s", view.
view.layer
layer
() !is null ? "non-nil".ptr : "nil".ptr);
view.
view.setWantsLayer
setWantsLayer
(true);
(unresolved type) CALayer
CALayer
_error_ layer
layer
= view.
view.layer
layer
();
instr("layer_probe", "stage=wants_layer layer=%s contents_scale=%.1f", layer !is null ? "non-nil".ptr : "nil".ptr, layer !is null ? layer.
layer.contentsScale
contentsScale
() : 0.0);
view.
view.setWantsLayer
setWantsLayer
(false);
instr("layer_probe", "stage=after_revert layer=%s", view.
view.layer
layer
() !is null ? "non-nil".ptr : "nil".ptr);
} void
void app.onViewResized(app.ScaleView view, app.NSSize size)
onViewResized
(
(class) app.ScaleView
ScaleView
(parameter) app.ScaleView view
view
,
(struct) app.NSSize
NSSize
(parameter) app.NSSize size
size
)
{
(unresolved type) NSWindow
NSWindow
_error_ w
w
= view.
view.window
window
();
immutable
_error_ backing
backing
= view.
view.convertRectToBacking
convertRectToBacking
(NSRect(NSPoint(0, 0), size));
immutable
_error_ pw
pw
= cast(long) backing.
backing.size
size
.
backing.size.width
width
;
immutable
_error_ ph
ph
= cast(long) backing.
backing.size
size
.
backing.size.height
height
;
if (w is null) { // The first setFrameSize: fires inside setContentView: BEFORE the view's // window link is established — informational, not a math failure. instr(g_firstConfigureSeen ? "resize".ptr : "first_configure".ptr, "points=%dx%d pixels=%lldx%lld window=nil", cast(int) size.
size.width
width
, cast(int) size.
size.height
height
, pw, ph);
} else { immutable
_error_ scale
scale
= w.
w.backingScaleFactor
backingScaleFactor
();
immutable
_error_ match
match
= pw == pixelsFor(size.
size.width
width
, scale)
&& ph == pixelsFor(size.
size.height
height
, scale);
if (!match) ++g_mismatches; instr(g_firstConfigureSeen ? "resize".ptr : "first_configure".ptr, "points=%dx%d pixels=%lldx%lld scale=%.1f match=%d", cast(int) size.
size.width
width
, cast(int) size.
size.height
height
, pw, ph, scale, match ? 1 : 0);
} g_firstConfigureSeen = true; } void
void app.logCtmIfChanged(void* ctx, const(char)* when)
logCtmIfChanged
(void*
(parameter) void* ctx
ctx
, const(char)*
(parameter) const(char)* when
when
)
{ immutable
_error_ ctm
ctm
= CGContextGetCTM(ctx);
if (g_ctmLogged && ctm == g_lastCtm) return; g_lastCtm = ctm; g_ctmLogged = true; instr("ctm", "when=%s a=%.2f b=%.2f c=%.2f d=%.2f tx=%.2f ty=%.2f", when, ctm.
ctm.a
a
, ctm.
ctm.b
b
, ctm.
ctm.c
c
, ctm.
ctm.d
d
, ctm.
ctm.tx
tx
, ctm.
ctm.ty
ty
);
} void
void app.onDrawRect(app.ScaleView view, app.NSRect bounds)
onDrawRect
(
(class) app.ScaleView
ScaleView
(parameter) app.ScaleView view
view
,
(struct) app.NSRect
NSRect
(parameter) app.NSRect bounds
bounds
)
{ void*
_error_ ctx
ctx
= NSGraphicsContext.
NSGraphicsContext.currentContext
currentContext
().
NSGraphicsContext.currentContext().CGContext
CGContext
();
logCtmIfChanged(ctx, "drawRect"); // THE ground truth of what AppKit pre-scales
(unresolved type) NSWindow
NSWindow
_error_ w
w
= view.
view.window
window
();
immutable
_error_ scale
scale
= w !is null ? w.
w.backingScaleFactor
backingScaleFactor
() : 1.0;
if (!g_ctmVsBackingLogged && g_lastCtm.
g_lastCtm.a
a
!= scale)
{ g_ctmVsBackingLogged = true; instr("ctm_vs_backing", "ctm_a=%.1f backing_scale=%.1f note=context_scale_disagrees_with_geometry_scale", g_lastCtm.
g_lastCtm.a
a
, scale);
} immutable
_error_ backing
backing
= view.
view.convertRectToBacking
convertRectToBacking
(bounds);
// Buffer size: backing pixels normally; points (1.0-scale) for the mismatch probe. immutable
_error_ pw
pw
= g_probeMismatch ? cast(
(unresolved type) size_t
size_t
) bounds.
bounds.size
size
.
bounds.size.width
width
: cast(
(unresolved type) size_t
size_t
) backing.
backing.size
size
.
backing.size.width
width
;
immutable
_error_ ph
ph
= g_probeMismatch ? cast(
(unresolved type) size_t
size_t
) bounds.
bounds.size
size
.
bounds.size.height
height
: cast(
(unresolved type) size_t
size_t
) backing.
backing.size
size
.
backing.size.height
height
;
if (pw == 0 || ph == 0) return; if (pw != g_bufW || ph != g_bufH) { free(g_buf); g_buf = cast(uint*) malloc(pw * ph * 4); g_bufW = pw; g_bufH = ph; instr("buffer_alloc", "size=%zux%zu bytes=%zu", pw, ph, pw * ph * 4); } renderGradient(g_buf, pw, ph); void*
_error_ cs
cs
= CGColorSpaceCreateDeviceRGB();
void*
_error_ dp
dp
= CGDataProviderCreateWithData(null, g_buf, pw * ph * 4, null);
void*
_error_ img
img
= CGImageCreate(pw, ph, 8, 32, pw * 4, cs,
kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, dp, null, false, kCGRenderingIntentDefault); CGContextDrawImage(ctx, bounds, img); if (g_probeMismatch) { // App-observable mismatch evidence: the CGImage is points-sized while the CTM // maps the same points rect onto scale x as many device pixels -> Quartz // resamples (stretches) the image x scale. On screen: blurry. instr("mismatch_probe", "img_px=%zux%zu rect_pt=%.0fx%.0f ctm_scale=%.1f device_px=%.0fx%.0f note=resampled_x%.1f_blurry", CGImageGetWidth(img), CGImageGetHeight(img), bounds.
bounds.size
size
.
bounds.size.width
width
,
bounds.
bounds.size
size
.
bounds.size.height
height
, g_lastCtm.
g_lastCtm.a
a
, bounds.
bounds.size
size
.
bounds.size.width
width
* g_lastCtm.
g_lastCtm.a
a
,
bounds.
bounds.size
size
.
bounds.size.height
height
* g_lastCtm.
g_lastCtm.a
a
, g_lastCtm.
g_lastCtm.a
a
);
g_probeMismatch = false; g_bufW = g_bufH = 0; // force a realloc back to backing size next frame } CGImageRelease(img); CGDataProviderRelease(dp); CGColorSpaceRelease(cs); // Crisp 1-physical-px hairlines at the window edges: thickness 1/scale POINTS. // With the CTM pre-scale (x scale) that is exactly one device pixel. immutable
_error_ hl
hl
= 1.0 / scale;
CGContextSetRGBFillColor(ctx, 1, 1, 1, 1); CGContextFillRect(ctx, NSRect(NSPoint(0, 0), NSSize(bounds.
bounds.size
size
.
bounds.size.width
width
, hl)));
CGContextFillRect(ctx, NSRect(NSPoint(0, bounds.
bounds.size
size
.
bounds.size.height
height
- hl),
NSSize(bounds.
bounds.size
size
.
bounds.size.width
width
, hl)));
CGContextFillRect(ctx, NSRect(NSPoint(0, 0), NSSize(hl, bounds.
bounds.size
size
.
bounds.size.height
height
)));
CGContextFillRect(ctx, NSRect(NSPoint(bounds.
bounds.size
size
.
bounds.size.width
width
- hl, 0),
NSSize(hl, bounds.
bounds.size
size
.
bounds.size.height
height
)));
if (g_frames == 0) instr("hairline", "thickness_pt=%.2f device_px=%.1f", hl, hl * g_lastCtm.
g_lastCtm.a
a
);
++g_frames; } void
void app.onTick(app.ScaleView view)
onTick
(
(class) app.ScaleView
ScaleView
(parameter) app.ScaleView view
view
)
{ ++g_tick; view.
view.setNeedsDisplay
setNeedsDisplay
(true);
if (!g_auto) return; // interactive mode: keep the window up for a manual monitor drag immutable
_error_ rEnd
rEnd
= resizeStartTick + cast(int) resizeSizes.length * resizeStrideTicks;
if (g_tick >= resizeStartTick && g_tick < rEnd && (g_tick - resizeStartTick) % resizeStrideTicks == 0) { immutable
_error_ size
size
= resizeSizes[(g_tick - resizeStartTick) / resizeStrideTicks];
g_phase = "resize_storm"; instr("step", "name=setContentSize size=%dx%d", size[0], size[1]); g_win.
g_win.setContentSize
setContentSize
(NSSize(size[0], size[1]));
} else if (g_tick == mismatchProbeTick) { g_phase = "mismatch_probe"; instr("step", "name=mismatch_probe note=next_frame_draws_points_sized_buffer"); g_probeMismatch = true; } else if (g_tick == offscreenMoveTick) { // A hypothetical second screen: with none attached, what does AppKit do with // an off-screen frame origin, and does any backing/screen change fire? g_phase = "offscreen_move"; instr("step", "name=setFrameOrigin origin=(5000,100) note=no_second_screen"); g_win.
g_win.setFrameOrigin
setFrameOrigin
(NSPoint(5000, 100));
immutable
_error_ f
f
= g_win.
g_win.frame
frame
();
(unresolved type) NSScreen
NSScreen
_error_ scr
scr
= g_win.
g_win.screen
screen
();
instr("offscreen_result", "frame=(%.0f,%.0f %.0fx%.0f) screen=%s scale=%.1f backing_changes=%d", f.
f.origin
origin
.
f.origin.x
x
, f.
f.origin
origin
.
f.origin.y
y
, f.
f.size
size
.
f.size.width
width
, f.
f.size
size
.
f.size.height
height
,
scr !is null ? "non-nil".ptr : "nil".ptr, g_win.
g_win.backingScaleFactor
backingScaleFactor
(), g_backingChanges);
} else if (g_tick == moveBackTick) { g_phase = "move_back"; instr("step", "name=setFrameOrigin origin=(120,120)"); g_win.
g_win.setFrameOrigin
setFrameOrigin
(NSPoint(120, 120));
} else if (g_tick == observerSelftestTick) { // Prove the notification observers are wired (nothing fires them headless): // post the screen-params notification by hand and expect the handler to log. g_phase = "observer_selftest"; instr("step", "name=post_didChangeScreenParameters note=selftest"); NSNotificationCenter.
NSNotificationCenter.defaultCenter
defaultCenter
().
NSNotificationCenter.defaultCenter().postNotificationName
postNotificationName
(
cast(
(unresolved type) NSObject
NSObject
) NSApplicationDidChangeScreenParametersNotification, null);
} else if (g_tick >= autoExitTick && !g_stopRequested) { g_stopRequested = true; instr("step", "name=NSApp_stop tick=%d", g_tick); g_app.
g_app.stop
stop
(null);
(unresolved type) NSEvent
NSEvent
_error_ ev
ev
= NSEvent.
NSEvent.otherEventWithType
otherEventWithType
(NSEventTypeApplicationDefined,
NSPoint(0, 0), 0, 0, 0, null, 0, 0, 0); g_app.
g_app.postEvent
postEvent
(ev, true); // stop: needs an event dispatch to take effect
} } int
int D main()
main
()
{ g_auto = getenv("WSI_AUTO_EXIT") !is null; instrInit("APPKIT_F08"); instr("init_start", "auto_exit=%d", g_auto ? 1 : 0); if (CGMainDisplayID() == 0) { printf("SKIP: no macOS window server (CGMainDisplayID == 0)\n"); return 0; } auto
_error_ pool
pool
= autoreleasepool_push();
scope (exit) autoreleasepool_pop(pool); g_app = NSApplication.
NSApplication.sharedApplication
sharedApplication
();
g_app.
g_app.setActivationPolicy
setActivationPolicy
(NSApplicationActivationPolicyRegular);
logScreens("startup"); // --- created-at-wrong-scale timeline (timestamps are the instr() µs column) ---- immutable
_error_ contentRect
contentRect
= NSRect(NSPoint(120, 120), NSSize(480, 320));
instr("timeline", "t=window_init_call size=480x320"); g_win = NSWindow.
NSWindow.alloc
alloc
().
NSWindow.alloc().initWithContentRect
initWithContentRect
(contentRect,
NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable, NSBackingStoreBuffered, false);
(unresolved type) NSScreen
NSScreen
_error_ wscr
wscr
= g_win.
g_win.screen
screen
();
instr("timeline", "t=window_init_return window_scale=%.1f screen_scale=%.1f", g_win.
g_win.backingScaleFactor
backingScaleFactor
(), wscr !is null ? wscr.
wscr.backingScaleFactor
backingScaleFactor
() : 0.0);
g_win.
g_win.setTitle
setTitle
(NSString.
NSString.alloc
alloc
().
NSString.alloc().initWithUTF8String
initWithUTF8String
("wsi-f08-dpi"));
(unresolved type) ScaleView
ScaleView
_error_ view
view
= ScaleView.
ScaleView.alloc
alloc
().
ScaleView.alloc().initWithFrame
initWithFrame
(contentRect);
immutable
_error_ preInstall
preInstall
= view.
view.convertRectToBacking
convertRectToBacking
(NSRect(NSPoint(0, 0), NSSize(100, 100)));
instr("timeline", "t=view_pre_install view_converts_100pt_to=%.0fpx window=%s", preInstall.
preInstall.size
size
.
preInstall.size.width
width
, view.
view.window
window
() !is null ? "non-nil".ptr : "nil".ptr);
// Notification registrations BEFORE setContentView: so any backing flip is caught.
(unresolved type) NSNotificationCenter
NSNotificationCenter
_error_ nc
nc
= NSNotificationCenter.
NSNotificationCenter.defaultCenter
defaultCenter
();
nc.
nc.addObserver
addObserver
(view, SEL.register("screenParamsChanged:"),
cast(
(unresolved type) NSObject
NSObject
) NSApplicationDidChangeScreenParametersNotification, null);
nc.
nc.addObserver
addObserver
(view, SEL.register("windowBackingChanged:"),
cast(
(unresolved type) NSObject
NSObject
) NSWindowDidChangeBackingPropertiesNotification, null);
instr("step", "name=notification_observers registered=didChangeScreenParameters,windowDidChangeBackingProperties"); instr("timeline", "t=setContentView_call"); g_win.
g_win.setContentView
setContentView
(view);
g_win.
g_win.setDelegate
setDelegate
(view);
instr("timeline", "t=setContentView_return backing_changes=%d", g_backingChanges); instr("step", "name=makeKeyAndOrderFront"); g_win.
g_win.makeKeyAndOrderFront
makeKeyAndOrderFront
(null);
g_app.
g_app.activateIgnoringOtherApps
activateIgnoringOtherApps
(true);
instr("timeline", "t=after_order_front backing_changes=%d", g_backingChanges); roundTrips(view); layerProbe(view); g_phase = "run"; instr("step", "name=NSTimer_scheduledTimerWithTimeInterval interval_ms=16"); NSTimer.
NSTimer.scheduledTimerWithTimeInterval
scheduledTimerWithTimeInterval
(0.016, view, SEL.register("tick:"), null, true);
instr("step", "name=NSApp_run"); g_app.
g_app.run
run
();
instr("loop_exit", "frames=%d ticks=%d backing_changes=%d mismatches=%d", g_frames, g_tick, g_backingChanges, g_mismatches); free(g_buf); return g_mismatches == 0 ? 0 : 1; }