app.dhover×622 error×26all
// macOS/AppKit F12 demo — cursors (../../../features/f12-cursors.md).
// The server composites the cursor on macOS; the app's job is only to SAY which
// cursor — via NSCursor standard cursors set from cursorUpdate: (driven by
// NSTrackingArea with the NSTrackingCursorUpdate option), the legacy
// addCursorRect:cursor: mechanism, or a custom NSCursor initWithImage:hotSpot:.
// Built on the scaffold/f08 recipe; run findings are A[ssh] (locked console — no
// pointer motion possible, so cursorUpdate: is driven directly per zone and the
// on-screen pixels are Tier C).
//
// What it logs:
//   - the standard-cursor VOCABULARY: every public NSCursor class getter probed via
//     class_getClassMethod (available=0/1), including the macOS 15 additions
//     (columnResize/rowResize/zoomIn/zoomOut/frameResizeCursorFromPosition:
//     inDirections:) and the never-public diagonal-resize names — the vocabulary gap
//     vs Win32/X11 is the deliverable;
//   - a 3x3 hover-zone grid of NSTrackingAreas (options MouseEnteredAndExited |
//     CursorUpdate | ActiveInKeyWindow — CursorUpdate is documented as NOT supported
//     with ActiveAlways), each install logged, plus updateTrackingAreas and the
//     legacy resetCursorRects/addCursorRect:cursor: path;
//   - cursor_set per zone driven through cursorUpdate: directly (locked session =
//     no real pointer), with each cursor's image size, rep count and rep pixel
//     widths (the built-in 1x+2x HiDPI pairs);
//   - the eight resize directions: the soft-deprecated pre-15 six
//     (left/right/leftRight/up/down/upDown — no public diagonals before macOS 15)
//     then frameResizeCursorFromPosition:inDirections: for all four edges + four
//     corners via objc_msgSend;
//   - one custom cursor: a CPU-drawn 24x24 ARGB bullseye NSBitmapImageRep plus a
//     48x48 2x rep in the same NSImage (AppKit picks the rep by screen scale at
//     display time), hotspot (12,12), set + read back;
//   - push/pop vs set: the cursor-stack probe (what currentCursor reports after
//     each push/pop/set, including set-under-a-stack);
//   - NSCursor.hide/unhide pairing (the F10 visibility connection);
//   - a synthetic CGEventPost mouse-move probe: does an in-process posted move
//     reach the tracking areas in a locked session? (counters say at exit).
//
// Modes: WSI_AUTO_EXIT=1 = bounded scripted run; without it the window stays up for
// a manual (Tier C) hover 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
,
(alias) app.snprintf = int core.stdc.stdio.snprintf(scope char* s, ulong n, scope const(char*) format, scope const ...) nothrow @nogc
snprintf
;
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
;
import
(package) core
core
.
(package) core.stdc
stdc
.
(module) core.stdc.string

D header file for C99.

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

Source

core/stdc/string.d

@copyrightCopyright Sean Kelly 2005 - 2009.@licenseDistributed under the Boost Software License 1.0. (See accompanying file LICENSE)@authorsSean Kelly@standardsISO/IEC 9899:1999 (E)
string
:
(alias) app.memcpy = void* core.stdc.string.memcpy(return scope void* s1, scope const(void*) s2, ulong n) pure nothrow @nogc
memcpy
;
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, Class, Method;
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:
// Dynamic dispatch for the macOS-15 availability-gated NSCursor getters: resolve // objc_msgSend via dlsym (objc.rt's own declaration is private) and cast it to the // exact signature — the Apple-documented calling pattern for objc_msgSend. import
(package) core
core
.
(package) core.sys
sys
.
(package) core.sys.posix
posix
.
(module) core.sys.posix.dlfcn

D header file for POSIX.

@copyrightCopyright Sean Kelly 2005 - 2009.@licenseBoost License 1.0.@authorsSean Kelly, Alex Rønne Petersen@standardsThe Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
dlfcn
:
(alias) app.dlsym = void* core.sys.posix.dlfcn.dlsym(void*, scope const(char*)) nothrow @nogc
dlsym
;
enum
(constant) void* app.RTLD_DEFAULT = cast(void*)cast(size_t)18446744073709551614LU
RTLD_DEFAULT
= cast(void*) -2; // dlfcn.h, macOS
alias
(alias) app.MsgSend0 = extern (C) void* function(void*, void*) nothrow @nogc
MsgSend0
= extern (C) void* function(void*, void*) nothrow @nogc;
alias
(alias) app.MsgSend2 = extern (C) void* function(void*, void*, ulong, ulong) nothrow @nogc
MsgSend2
= extern (C) void* function(void*, void*, ulong, ulong) nothrow @nogc;
void*
void* app.msgSendAddr()
msgSendAddr
()
{ __gshared void*
(__gshared global) void* app.msgSendAddr.addr
addr
;
if (
(__gshared global) void* app.msgSendAddr.addr
addr
is null)
(__gshared global) void* app.msgSendAddr.addr
addr
=
void* core.sys.posix.dlfcn.dlsym(void*, scope const(char*)) nothrow @nogc
dlsym
(
(constant) void* app.RTLD_DEFAULT = cast(void*)cast(size_t)18446744073709551614LU
RTLD_DEFAULT
, "objc_msgSend");
return
(__gshared global) void* app.msgSendAddr.addr
addr
;
} // --- C-level declarations --------------------------------------------------------- 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
;
} extern (C) nothrow @nogc { uint
uint app.CGMainDisplayID() nothrow @nogc
CGMainDisplayID
();
(struct) app.NSRect
NSRect
app.NSRect app.CGDisplayBounds(uint display) nothrow @nogc
CGDisplayBounds
(uint
(parameter) uint display
display
);
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
);
void*
void* app.CGEventCreateMouseEvent(void* source, uint type, app.NSPoint pos, uint button) nothrow @nogc
CGEventCreateMouseEvent
(void*
(parameter) void* source
source
, uint
(parameter) uint type
type
,
(struct) app.NSPoint
NSPoint
(parameter) app.NSPoint pos
pos
, uint
(parameter) uint button
button
);
void
void app.CGEventPost(uint tap, void* event) nothrow @nogc
CGEventPost
(uint
(parameter) uint tap
tap
, void*
(parameter) void* event
event
);
void
void app.CFRelease(void* obj) nothrow @nogc
CFRelease
(void*
(parameter) void* obj
obj
);
} enum uint
(constant) uint app.kCGEventMouseMoved = 5u
kCGEventMouseMoved
= 5;
enum uint
(constant) uint app.kCGSessionEventTap = 1u
kCGSessionEventTap
= 1;
// NSTrackingAreaOptions (NSTrackingArea.h). Note the header on ActiveAlways: // "Not supported for NSTrackingCursorUpdate." enum : ulong {
(enum value) app.NSTrackingMouseEnteredAndExited = 1LU
NSTrackingMouseEnteredAndExited
= 0x01,
(enum value) app.NSTrackingCursorUpdate = 4LU
NSTrackingCursorUpdate
= 0x04,
(enum value) app.NSTrackingActiveInKeyWindow = 32LU
NSTrackingActiveInKeyWindow
= 0x20,
} // NSCursorFrameResizePosition (NSCursor.h, macOS 15): edges are bits, corners ORs. enum : ulong {
(enum value) app.frpTop = 1LU
frpTop
= 1 << 0,
(enum value) app.frpLeft = 2LU
frpLeft
= 1 << 1,
(enum value) app.frpBottom = 4LU
frpBottom
= 1 << 2,
(enum value) app.frpRight = 8LU
frpRight
= 1 << 3,
} enum ulong
(constant) ulong app.frameResizeDirectionsAll = 3LU
frameResizeDirectionsAll
= 0b11; // Inward | Outward
// --- 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:");
} 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.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:");
(struct) app.NSPoint
NSPoint
app.NSPoint app.NSEvent.locationInWindow()
locationInWindow
() @selector("locationInWindow");
} 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
(parameter) SEL 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.NSImageRep
NSImageRep
:
(class) app.NSObject
NSObject
class `app.NSImageRep` Objective-C classes not supported
{ long
long app.NSImageRep.pixelsWide()
pixelsWide
() @selector("pixelsWide");
long
long app.NSImageRep.pixelsHigh()
pixelsHigh
() @selector("pixelsHigh");
} extern class
(class) app.NSBitmapImageRep
NSBitmapImageRep
:
(class) app.NSImageRep
NSImageRep
class `app.NSBitmapImageRep` Objective-C classes not supported
{ static
(class) app.NSBitmapImageRep
NSBitmapImageRep
app.NSBitmapImageRep app.NSBitmapImageRep.alloc()
alloc
() @selector("alloc");
(class) app.NSBitmapImageRep
NSBitmapImageRep
app.NSBitmapImageRep app.NSBitmapImageRep.initWithBitmapDataPlanes(ubyte** planes, long pixelsWide, long pixelsHigh, long bitsPerSample, long samplesPerPixel, bool hasAlpha, bool isPlanar, app.NSString colorSpaceName, long bytesPerRow, long bitsPerPixel)
initWithBitmapDataPlanes
(ubyte**
(parameter) ubyte** planes
planes
, long
(parameter) long pixelsWide
pixelsWide
,
long
(parameter) long pixelsHigh
pixelsHigh
, long
(parameter) long bitsPerSample
bitsPerSample
, long
(parameter) long samplesPerPixel
samplesPerPixel
, bool
(parameter) bool hasAlpha
hasAlpha
,
bool
(parameter) bool isPlanar
isPlanar
,
(class) app.NSString
NSString
(parameter) app.NSString colorSpaceName
colorSpaceName
, long
(parameter) long bytesPerRow
bytesPerRow
, long
(parameter) long bitsPerPixel
bitsPerPixel
)
@selector("initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:"); ubyte*
ubyte* app.NSBitmapImageRep.bitmapData()
bitmapData
() @selector("bitmapData");
void
void app.NSBitmapImageRep.setSize(app.NSSize size)
setSize
(
(struct) app.NSSize
NSSize
(parameter) app.NSSize size
size
) @selector("setSize:");
} extern class
(class) app.NSImage
NSImage
:
(class) app.NSObject
NSObject
class `app.NSImage` Objective-C classes not supported
{ static
(class) app.NSImage
NSImage
app.NSImage app.NSImage.alloc()
alloc
() @selector("alloc");
(class) app.NSImage
NSImage
app.NSImage app.NSImage.initWithSize(app.NSSize size)
initWithSize
(
(struct) app.NSSize
NSSize
(parameter) app.NSSize size
size
) @selector("initWithSize:");
void
void app.NSImage.addRepresentation(app.NSImageRep rep)
addRepresentation
(
(class) app.NSImageRep
NSImageRep
(parameter) app.NSImageRep rep
rep
) @selector("addRepresentation:");
(struct) app.NSSize
NSSize
app.NSSize app.NSImage.size()
size
() @selector("size");
(class) app.NSArray
NSArray
app.NSArray app.NSImage.representations()
representations
() @selector("representations");
} extern class
(class) app.NSCursor
NSCursor
:
(class) app.NSObject
NSObject
class `app.NSCursor` Objective-C classes not supported
{ static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.alloc()
alloc
() @selector("alloc");
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.initWithImage(app.NSImage image, app.NSPoint hotSpot)
initWithImage
(
(class) app.NSImage
NSImage
(parameter) app.NSImage image
image
,
(struct) app.NSPoint
NSPoint
(parameter) app.NSPoint hotSpot
hotSpot
)
@selector("initWithImage:hotSpot:"); // The pre-macOS-15 public vocabulary (resize* are soft-deprecated since 15). static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.arrowCursor()
arrowCursor
() @selector("arrowCursor");
static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.IBeamCursor()
IBeamCursor
() @selector("IBeamCursor");
static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.crosshairCursor()
crosshairCursor
() @selector("crosshairCursor");
static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.pointingHandCursor()
pointingHandCursor
() @selector("pointingHandCursor");
static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.openHandCursor()
openHandCursor
() @selector("openHandCursor");
static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.resizeLeftCursor()
resizeLeftCursor
() @selector("resizeLeftCursor");
static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.resizeRightCursor()
resizeRightCursor
() @selector("resizeRightCursor");
static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.resizeLeftRightCursor()
resizeLeftRightCursor
() @selector("resizeLeftRightCursor");
static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.resizeUpCursor()
resizeUpCursor
() @selector("resizeUpCursor");
static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.resizeDownCursor()
resizeDownCursor
() @selector("resizeDownCursor");
static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.resizeUpDownCursor()
resizeUpDownCursor
() @selector("resizeUpDownCursor");
static
(class) app.NSCursor
NSCursor
app.NSCursor app.NSCursor.currentCursor()
currentCursor
() @selector("currentCursor");
static void
void app.NSCursor.hide()
hide
() @selector("hide");
static void
void app.NSCursor.unhide()
unhide
() @selector("unhide");
void
void app.NSCursor.set()
set
() @selector("set");
void
void app.NSCursor.push()
push
() @selector("push");
void
void app.NSCursor.pop()
pop
() @selector("pop");
(class) app.NSImage
NSImage
app.NSImage app.NSCursor.image()
image
() @selector("image");
(struct) app.NSPoint
NSPoint
app.NSPoint app.NSCursor.hotSpot()
hotSpot
() @selector("hotSpot");
} extern class
(class) app.NSTrackingArea
NSTrackingArea
:
(class) app.NSObject
NSObject
class `app.NSTrackingArea` Objective-C classes not supported
{ static
(class) app.NSTrackingArea
NSTrackingArea
app.NSTrackingArea app.NSTrackingArea.alloc()
alloc
() @selector("alloc");
(class) app.NSTrackingArea
NSTrackingArea
app.NSTrackingArea app.NSTrackingArea.initWithRect(app.NSRect rect, ulong options, app.NSObject owner, app.NSObject userInfo)
initWithRect
(
(struct) app.NSRect
NSRect
(parameter) app.NSRect rect
rect
, ulong
(parameter) ulong options
options
,
(class) app.NSObject
NSObject
(parameter) app.NSObject owner
owner
,
(class) app.NSObject
NSObject
(parameter) app.NSObject userInfo
userInfo
) @selector("initWithRect:options:owner:userInfo:");
} extern class
(class) app.NSResponder
NSResponder
:
(class) app.NSObject
NSObject
class `app.NSResponder` Objective-C classes not supported
{ } 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.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
{
(struct) app.NSRect
NSRect
app.NSRect app.NSView.bounds()
bounds
() @selector("bounds");
void
void app.NSView.addTrackingArea(app.NSTrackingArea area)
addTrackingArea
(
(class) app.NSTrackingArea
NSTrackingArea
(parameter) app.NSTrackingArea area
area
) @selector("addTrackingArea:");
(class) app.NSArray
NSArray
app.NSArray app.NSView.trackingAreas()
trackingAreas
() @selector("trackingAreas");
void
void app.NSView.addCursorRect(app.NSRect rect, app.NSCursor cursor)
addCursorRect
(
(struct) app.NSRect
NSRect
(parameter) app.NSRect rect
rect
,
(class) app.NSCursor
NSCursor
(parameter) app.NSCursor cursor
cursor
) @selector("addCursorRect:cursor:");
void
void app.NSView.updateTrackingAreas()
updateTrackingAreas
() @selector("updateTrackingAreas");
} 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.invalidateCursorRectsForView(app.NSView view)
invalidateCursorRectsForView
(
(class) app.NSView
NSView
(parameter) app.NSView view
view
)
@selector("invalidateCursorRectsForView:"); bool
bool app.NSWindow.areCursorRectsEnabled()
areCursorRectsEnabled
() @selector("areCursorRectsEnabled");
(struct) app.NSRect
NSRect
app.NSRect app.NSWindow.frame()
frame
() @selector("frame");
} // The instrumented view: 3x3 zone grid, tracking areas, cursorUpdate: routing. class
(class) app.ZoneView
ZoneView
:
(class) app.NSView
NSView
class `app.ZoneView` Objective-C classes not supported
{ static
(class) app.ZoneView
ZoneView
app.ZoneView app.ZoneView.alloc()
alloc
() @selector("alloc");
(class) app.ZoneView
ZoneView
app.ZoneView app.ZoneView.initWithFrame(app.NSRect frame)
initWithFrame
(
(struct) app.NSRect
NSRect
(parameter) app.NSRect frame
frame
) @selector("initWithFrame:");
void
void app.ZoneView.drawRect(app.NSRect dirtyRect)
drawRect
(
(struct) app.NSRect
NSRect
(parameter) app.NSRect dirtyRect
dirtyRect
) @selector("drawRect:")
{ // Checkerboard the 9 zones (the Tier-C visual aid; cheap flat fills). void*
_error_ ctx
ctx
= NSGraphicsContext.
NSGraphicsContext.currentContext
currentContext
().
NSGraphicsContext.currentContext().CGContext
CGContext
();
immutable
_error_ b
b
= this.
this.bounds
bounds
();
foreach (
(parameter) z
z
; 0 .. 9)
{ immutable
_error_ shade
shade
= 0.25 + 0.08 * z;
CGContextSetRGBFillColor(ctx, shade, shade, shade, 1); CGContextFillRect(ctx, zoneRect(b, z)); } } void
void app.ZoneView.tick(app.NSTimer timer)
tick
(
(class) app.NSTimer
NSTimer
(parameter) app.NSTimer timer
timer
) @selector("tick:")
{ onTick(this); } // The modern path: AppKit sends cursorUpdate: when the pointer enters a tracking // area registered with NSTrackingCursorUpdate. Locked session = no pointer, so // the schedule calls this directly with e=null and g_forcedZone set. void
void app.ZoneView.cursorUpdate(app.NSEvent e)
cursorUpdate
(
(class) app.NSEvent
NSEvent
(parameter) app.NSEvent e
e
) @selector("cursorUpdate:")
{ ++g_cursorUpdates; int
_error_ zone
zone
= g_forcedZone;
if (e !is null) { immutable
_error_ p
p
= e.
e.locationInWindow
locationInWindow
();
zone = zoneAt(this.
this.bounds
bounds
(), p);
} instr("cursor_update", "n=%d zone=%d source=%s", g_cursorUpdates, zone, e !is null ? "event".ptr : "driven".ptr); if (zone >= 0 && zone < 9) setZoneCursor(zone); } void
void app.ZoneView.mouseEntered(app.NSEvent e)
mouseEntered
(
(class) app.NSEvent
NSEvent
(parameter) app.NSEvent e
e
) @selector("mouseEntered:")
{ ++g_mouseEnters; instr("mouse_entered", "n=%d", g_mouseEnters); } void
void app.ZoneView.mouseExited(app.NSEvent e)
mouseExited
(
(class) app.NSEvent
NSEvent
(parameter) app.NSEvent e
e
) @selector("mouseExited:")
{ ++g_mouseExits; instr("mouse_exited", "n=%d", g_mouseExits); } // AppKit calls this when tracking areas need recomputation (resize, scroll, …). override void
void app.ZoneView.updateTrackingAreas()
updateTrackingAreas
() @selector("updateTrackingAreas")
{ ++g_updateTrackingCalls; instr("update_tracking_areas", "n=%d count=%llu", g_updateTrackingCalls, this.
this.trackingAreas
trackingAreas
().
this.trackingAreas().count
count
());
super.
super.updateTrackingAreas
updateTrackingAreas
();
} // The legacy mechanism (pre-NSTrackingArea, still alive): AppKit asks the view // to re-declare its cursor rects; one addCursorRect:cursor: per region. void
void app.ZoneView.resetCursorRects()
resetCursorRects
() @selector("resetCursorRects")
{ ++g_resetCursorRects; this.
this.addCursorRect
addCursorRect
(this.
this.bounds
bounds
(), NSCursor.
NSCursor.crosshairCursor
crosshairCursor
());
instr("reset_cursor_rects", "n=%d mechanism=addCursorRect_cursor legacy=1", g_resetCursorRects); } void
void app.ZoneView.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
(class) app.ZoneView
ZoneView
(__gshared global) app.ZoneView app.g_view
g_view
;
__gshared
(class) app.NSCursor
NSCursor
(__gshared global) app.NSCursor app.g_customCursor
g_customCursor
;
__gshared int
(__gshared global) int app.g_tick
g_tick
,
(__gshared global) int app.g_cursorUpdates
g_cursorUpdates
,
(__gshared global) int app.g_mouseEnters
g_mouseEnters
,
(__gshared global) int app.g_mouseExits
g_mouseExits
;
__gshared int
(__gshared global) int app.g_updateTrackingCalls
g_updateTrackingCalls
,
(__gshared global) int app.g_resetCursorRects
g_resetCursorRects
,
(__gshared global) int app.g_forcedZone
g_forcedZone
= -1;
__gshared bool
(__gshared global) bool app.g_auto
g_auto
,
(__gshared global) bool app.g_stopRequested
g_stopRequested
;
// Name registry so currentCursor() pointers are loggable by name. __gshared void*[40]
(__gshared global) void*[40] app.g_curPtrs
g_curPtrs
;
__gshared const(char)*[40]
(__gshared global) const(char)*[40] app.g_curNames
g_curNames
;
__gshared int
(__gshared global) int app.g_curCount
g_curCount
;
// Schedule (ticks of a ~16 ms timer). enum
(constant) int app.zoneDriveStartTick = 5
zoneDriveStartTick
= 5; // zones 0..8 on ticks 5..13
enum
(constant) int app.legacyResizeTick = 16
legacyResizeTick
= 16;
enum
(constant) int app.macos15Tick = 18
macos15Tick
= 18;
enum
(constant) int app.invalidateRectsTick = 20
invalidateRectsTick
= 20;
enum
(constant) int app.cgEventTick = 24
cgEventTick
= 24;
enum
(constant) int app.syntheticResultTick = 38
syntheticResultTick
= 38;
enum
(constant) int app.autoExitTick = 45
autoExitTick
= 45;
(class) app.NSString
NSString
app.NSString app.nsstr(const(char)* s)
nsstr
(const(char)*
(parameter) const(char)* s
s
)
{ return NSString.
NSString.alloc
alloc
().
NSString.alloc().initWithUTF8String
initWithUTF8String
(s);
}
(struct) app.NSRect
NSRect
app.NSRect app.zoneRect(app.NSRect b, int z)
zoneRect
(
(struct) app.NSRect
NSRect
(parameter) app.NSRect b
b
, int
(parameter) int z
z
)
{ immutable
_error_ w
w
= b.
b.size
size
.
b.size.width
width
/ 3,
_error_ h
h
= b.
b.size
size
.
b.size.height
height
/ 3;
return NSRect(NSPoint(b.
b.origin
origin
.
b.origin.x
x
+ (z % 3) * w, b.
b.origin
origin
.
b.origin.y
y
+ (z / 3) * h),
NSSize(w, h)); } int
int app.zoneAt(app.NSRect b, app.NSPoint p)
zoneAt
(
(struct) app.NSRect
NSRect
(parameter) app.NSRect b
b
,
(struct) app.NSPoint
NSPoint
(parameter) app.NSPoint p
p
)
{ if (b.
b.size
size
.
b.size.width
width
<= 0 || b.
b.size
size
.
b.size.height
height
<= 0)
return -1; immutable
_error_ cx
cx
= cast(int) (3 * (p.
p.x
x
- b.
b.origin
origin
.
b.origin.x
x
) / b.
b.size
size
.
b.size.width
width
);
immutable
_error_ cy
cy
= cast(int) (3 * (p.
p.y
y
- b.
b.origin
origin
.
b.origin.y
y
) / b.
b.size
size
.
b.size.height
height
);
return cx < 0 || cx > 2 || cy < 0 || cy > 2 ? -1 : cy * 3 + cx; } void
void app.registerCursor(app.NSCursor c, const(char)* name)
registerCursor
(
(class) app.NSCursor
NSCursor
(parameter) app.NSCursor c
c
, const(char)*
(parameter) const(char)* name
name
)
{ if (c is null || g_curCount >= g_curPtrs.length) return; g_curPtrs[g_curCount] = cast(void*) c; g_curNames[g_curCount] = name; ++g_curCount; } const(char)*
const(char)* app.cursorName(app.NSCursor c)
cursorName
(
(class) app.NSCursor
NSCursor
(parameter) app.NSCursor c
c
)
{ foreach (
(parameter) i
i
; 0 .. g_curCount)
if (g_curPtrs[i] is cast(void*) c) return g_curNames[i]; return c is null ? "nil".ptr : "unregistered".ptr; } // One cursor_set log line, with the image facts (size in points, reps, rep pixel // widths — standard cursors ship 1x+2x pairs; that is the HiDPI mechanism). void
void app.setAndLog(app.NSCursor c, const(char)* name, const(char)* path)
setAndLog
(
(class) app.NSCursor
NSCursor
(parameter) app.NSCursor c
c
, const(char)*
(parameter) const(char)* name
name
, const(char)*
(parameter) const(char)* path
path
)
{ if (c is null) { instr("cursor_set", "name=%s path=%s skipped=nil", name, path); return; } registerCursor(c, name); c.
c.set
set
();
(unresolved type) NSImage
NSImage
_error_ img
img
= c.
c.image
image
();
immutable
_error_ sz
sz
= img !is null ? img.
img.size
size
() : NSSize(0, 0);
immutable
_error_ hot
hot
= c.
c.hotSpot
hotSpot
();
char[64]
_error_ reps
reps
= void;
repsSummary(img, reps[]); instr("cursor_set", "name=%s path=%s size_pt=%.0fx%.0f hotspot=(%.0f,%.0f) reps=%s", name, path, sz.
sz.width
width
, sz.
sz.height
height
, hot.
hot.x
x
, hot.
hot.y
y
, reps.ptr);
} // "n:px1,px2,…" — rep count and per-rep pixel width. void
void app.repsSummary(app.NSImage img, char[] buf)
repsSummary
(
(class) app.NSImage
NSImage
(parameter) app.NSImage img
img
, char[]
(parameter) char[] buf
buf
)
{ buf[0] = '0'; buf[1] = 0; if (img is null) return;
(unresolved type) NSArray
NSArray
_error_ rs
rs
= img.
img.representations
representations
();
immutable
_error_ n
n
= rs.
rs.count
count
();
size_t
_error_ off
off
= snprintf(buf.ptr, buf.length, "%llu:", n);
foreach (
(parameter) i
i
; 0 .. n)
{ auto
_error_ r
r
= cast(
(unresolved type) NSImageRep
NSImageRep
) rs.
rs.objectAtIndex
objectAtIndex
(i);
off += snprintf(buf.ptr + off, buf.length - off, i == 0 ? "%ld" : ",%ld", r.
r.pixelsWide
pixelsWide
());
} } // --- The standard-cursor vocabulary probe ------------------------------------------- void
void app.probeVocabulary()
probeVocabulary
()
{ // Public class getters (pre-15 + the macOS 15 additions), the parameterized // 15.0 selectors, and the diagonal names that never existed publicly. static struct
(struct) Probe
Probe
{
(unresolved type) string
string
_error_ sel
sel
;
(unresolved type) string
string
_error_ note
note
;
} static immutable
(unresolved type) Probe
Probe
[]
Probe[] probes
probes
= [
{"arrowCursor", "10.0"}, {"IBeamCursor", "10.0"}, {"IBeamCursorForVerticalLayout", "10.7"}, {"crosshairCursor", "10.0"}, {"pointingHandCursor", "10.0"}, {"closedHandCursor", "10.0"}, {"openHandCursor", "10.0"}, {"operationNotAllowedCursor", "10.5"}, {"dragLinkCursor", "10.6"}, {"dragCopyCursor", "10.6"}, {"contextualMenuCursor", "10.6"}, {"disappearingItemCursor", "10.0"}, {"resizeLeftCursor", "10.0_soft_deprecated_15.0"}, {"resizeRightCursor", "10.0_soft_deprecated_15.0"}, {"resizeLeftRightCursor", "10.0_soft_deprecated_15.0"}, {"resizeUpCursor", "10.0_soft_deprecated_15.0"}, {"resizeDownCursor", "10.0_soft_deprecated_15.0"}, {"resizeUpDownCursor", "10.0_soft_deprecated_15.0"}, {"zoomInCursor", "15.0"}, {"zoomOutCursor", "15.0"}, {"columnResizeCursor", "15.0"}, {"rowResizeCursor", "15.0"}, {"columnResizeCursorInDirections:", "15.0"}, {"rowResizeCursorInDirections:", "15.0"}, {"frameResizeCursorFromPosition:inDirections:", "15.0"}, {"currentCursor", "10.0"}, {"currentSystemCursor", "10.6_deprecated"}, // The gap: no public diagonal resize cursors existed before macOS 15. {"resizeNorthWestSouthEastCursor", "never_public"}, {"resizeNorthEastSouthWestCursor", "never_public"}, {"_windowResizeNorthWestSouthEastCursor", "private"}, ]; Class
_error_ cls
cls
= Class.lookup("NSCursor");
foreach (
(parameter) p
p
; probes)
instr("vocab", "sel=%s available=%d note=%s", p.
p.sel
sel
.ptr,
cls.getClassMethod(SEL.register(p.
p.sel
sel
.ptr)).ptr !is null ? 1 : 0,
p.
p.note
note
.ptr);
} // --- The custom bullseye cursor ------------------------------------------------------ // CPU-paint an RGBA bullseye: alternating dark/light rings, transparent corners. void
void app.paintBullseye(ubyte* px, int n)
paintBullseye
(ubyte*
(parameter) ubyte* px
px
, int
(parameter) int n
n
)
{ immutable
_error_ c
c
= (n - 1) / 2.0;
foreach (
(parameter) y
y
; 0 .. n)
foreach (
(parameter) x
x
; 0 .. n)
{ immutable
_error_ dx
dx
= x - c,
_error_ dy
dy
= y - c;
immutable
_error_ r
r
= (dx * dx + dy * dy) ^^ 0.5;
ubyte*
_error_ p
p
= px + 4 * (y * n + x);
if (r > c) // outside: fully transparent { p[0] = p[1] = p[2] = p[3] = 0; continue; } immutable
_error_ ring
ring
= cast(int) (r * 8 / n); // 0..3 rings
immutable
_error_ dark
dark
= (ring & 1) == 0;
p[0] = dark ? 16 : 240; // R (premultiplied; alpha=255 so identical) p[1] = dark ? 16 : 64; // G p[2] = dark ? 16 : 32; // B p[3] = 255; // A } }
(class) app.NSBitmapImageRep
NSBitmapImageRep
app.NSBitmapImageRep app.makeRep(int px, double sizePt)
makeRep
(int
(parameter) int px
px
, double
(parameter) double sizePt
sizePt
)
{ auto
_error_ rep
rep
= NSBitmapImageRep.
NSBitmapImageRep.alloc
alloc
().
NSBitmapImageRep.alloc().initWithBitmapDataPlanes
initWithBitmapDataPlanes
(null, px, px, 8, 4,
true, false, nsstr("NSDeviceRGBColorSpace"), px * 4, 32); paintBullseye(rep.
rep.bitmapData
bitmapData
(), px);
rep.
rep.setSize
setSize
(NSSize(sizePt, sizePt)); // pt size != px size on the 2x rep
return rep; }
(class) app.NSCursor
NSCursor
app.NSCursor app.buildCustomCursor()
buildCustomCursor
()
{
(unresolved type) NSImage
NSImage
_error_ img
img
= NSImage.
NSImage.alloc
alloc
().
NSImage.alloc().initWithSize
initWithSize
(NSSize(24, 24));
img.
img.addRepresentation
addRepresentation
(makeRep(24, 24)); // 1x
img.
img.addRepresentation
addRepresentation
(makeRep(48, 24)); // 2x — AppKit picks by screen scale
(unresolved type) NSCursor
NSCursor
_error_ cur
cur
= NSCursor.
NSCursor.alloc
alloc
().
NSCursor.alloc().initWithImage
initWithImage
(img, NSPoint(12, 12));
char[64]
_error_ reps
reps
= void;
repsSummary(img, reps[]); immutable
_error_ hot
hot
= cur.
cur.hotSpot
hotSpot
();
instr("custom_cursor", "image_pt=%.0fx%.0f reps=%s hotspot=(%.0f,%.0f) " ~ "note=hotspot_in_flipped_image_coords", img.
img.size
size
().
img.size().width
width
,
img.
img.size
size
().
img.size().height
height
, reps.ptr, hot.
hot.x
x
, hot.
hot.y
y
);
return cur; } // --- Probes ------------------------------------------------------------------------- void
void app.logCurrent(const(char)* after)
logCurrent
(const(char)*
(parameter) const(char)* after
after
)
{
(unresolved type) NSCursor
NSCursor
_error_ cur
cur
= NSCursor.
NSCursor.currentCursor
currentCursor
();
instr("cursor_stack", "after=%s current=%s", after, cursorName(cur)); } // push/pop vs set: what does the app-side stack report? void
void app.stackProbe()
stackProbe
()
{
(unresolved type) NSCursor
NSCursor
_error_ arrow
arrow
= NSCursor.
NSCursor.arrowCursor
arrowCursor
();
(unresolved type) NSCursor
NSCursor
_error_ ibeam
ibeam
= NSCursor.
NSCursor.IBeamCursor
IBeamCursor
();
(unresolved type) NSCursor
NSCursor
_error_ cross
cross
= NSCursor.
NSCursor.crosshairCursor
crosshairCursor
();
(unresolved type) NSCursor
NSCursor
_error_ hand
hand
= NSCursor.
NSCursor.pointingHandCursor
pointingHandCursor
();
registerCursor(arrow, "arrow"); registerCursor(ibeam, "iBeam"); registerCursor(cross, "crosshair"); registerCursor(hand, "pointingHand"); instr("step", "name=stack_probe"); arrow.
arrow.set
set
();
logCurrent("arrow.set"); ibeam.
ibeam.push
push
();
logCurrent("iBeam.push"); cross.
cross.push
push
();
logCurrent("crosshair.push"); hand.
hand.set
set
(); // set while two pushes are outstanding: replace top? bypass?
logCurrent("pointingHand.set_under_stack"); cross.
cross.pop
pop
();
logCurrent("pop_1"); ibeam.
ibeam.pop
pop
();
logCurrent("pop_2"); arrow.
arrow.set
set
();
logCurrent("arrow.set_final"); // The F10 connection: hide/unhide is a balanced counter, independent of which // cursor is set — a capture/lock mode must pair them or leak invisibility. NSCursor.
NSCursor.hide
hide
();
NSCursor.
NSCursor.unhide
unhide
();
instr("cursor_visibility", "hide_unhide=balanced note=f10_lock_pairing"); } // Zone -> cursor mapping (zones 0..8, row-major from bottom-left in view coords). void
void app.setZoneCursor(int zone)
setZoneCursor
(int
(parameter) int zone
zone
)
{ switch (zone) { case 0: setAndLog(NSCursor.
NSCursor.arrowCursor
arrowCursor
(), "arrow", "standard");
break; case 1: setAndLog(NSCursor.
NSCursor.IBeamCursor
IBeamCursor
(), "iBeam", "standard");
break; case 2: setAndLog(NSCursor.
NSCursor.pointingHandCursor
pointingHandCursor
(), "pointingHand", "standard");
break; case 3: setAndLog(NSCursor.
NSCursor.crosshairCursor
crosshairCursor
(), "crosshair", "standard");
break; case 4: setAndLog(NSCursor.
NSCursor.openHandCursor
openHandCursor
(), "openHand", "standard");
break; case 5: setAndLog(NSCursor.
NSCursor.resizeLeftRightCursor
resizeLeftRightCursor
(), "resizeLeftRight",
"standard_soft_deprecated"); break; case 6: setAndLog(NSCursor.
NSCursor.resizeUpDownCursor
resizeUpDownCursor
(), "resizeUpDown",
"standard_soft_deprecated"); break; case 7: setAndLog(macos15Cursor("columnResizeCursor"), "columnResize", "macos15"); break; case 8: setAndLog(g_customCursor, "customBullseye", "initWithImage_hotSpot"); break; default: break; } } // Availability-gated class getter via the runtime (returns null when absent).
(class) app.NSCursor
NSCursor
app.NSCursor app.macos15Cursor(const(char)* sel)
macos15Cursor
(const(char)*
(parameter) const(char)* sel
sel
)
{ Class
_error_ cls
cls
= Class.lookup("NSCursor");
auto
_error_ s
s
= SEL.register(sel);
if (cls.getClassMethod(s).ptr is null) return null; auto
_error_ send0
send0
= cast(
(unresolved type) MsgSend0
MsgSend0
) msgSendAddr();
return cast(
(unresolved type) NSCursor
NSCursor
) send0(cls.ptr, s.ptr);
} // The eight resize directions, both vocabularies. void
void app.resizeSequence()
resizeSequence
()
{ instr("step", "name=legacy_resize_six note=no_public_diagonals_before_macos15"); setAndLog(NSCursor.
NSCursor.resizeLeftCursor
resizeLeftCursor
(), "resizeLeft", "standard_soft_deprecated");
setAndLog(NSCursor.
NSCursor.resizeRightCursor
resizeRightCursor
(), "resizeRight", "standard_soft_deprecated");
setAndLog(NSCursor.
NSCursor.resizeLeftRightCursor
resizeLeftRightCursor
(), "resizeLeftRight",
"standard_soft_deprecated"); setAndLog(NSCursor.
NSCursor.resizeUpCursor
resizeUpCursor
(), "resizeUp", "standard_soft_deprecated");
setAndLog(NSCursor.
NSCursor.resizeDownCursor
resizeDownCursor
(), "resizeDown", "standard_soft_deprecated");
setAndLog(NSCursor.
NSCursor.resizeUpDownCursor
resizeUpDownCursor
(), "resizeUpDown",
"standard_soft_deprecated"); } void
void app.frameResizeSequence()
frameResizeSequence
()
{ Class
_error_ cls
cls
= Class.lookup("NSCursor");
auto
_error_ s
s
= SEL.register("frameResizeCursorFromPosition:inDirections:");
if (cls.getClassMethod(s).ptr is null) { instr("step", "name=frame_resize_eight available=0"); return; } instr("step", "name=frame_resize_eight available=1"); static immutable
(unresolved type) string
string
[8]
string[8] names
names
= ["top", "left", "bottom", "right", "topLeft",
"topRight", "bottomLeft", "bottomRight"]; static immutable ulong[8]
ulong[8] pos
pos
= [frpTop, frpLeft, frpBottom, frpRight,
frpTop | frpLeft, frpTop | frpRight, frpBottom | frpLeft, frpBottom | frpRight]; foreach (
(parameter) i
i
; 0 .. 8)
{ auto
_error_ send2
send2
= cast(
(unresolved type) MsgSend2
MsgSend2
) msgSendAddr();
auto
_error_ c
c
= cast(
(unresolved type) NSCursor
NSCursor
) send2(cls.ptr, s.ptr, pos[i], frameResizeDirectionsAll);
char[32]
_error_ nm
nm
= void;
snprintf(nm.ptr, nm.length, "frameResize.%s", names[i].ptr); setAndLog(c, nm.ptr, "macos15_frame_resize"); } } // Synthetic pointer motion: post a CGEvent mouse-move into zone centers. In-process // posting needs no accessibility grant, but a locked session has no live pointer // pipeline — counters at syntheticResultTick give the honest answer. void
void app.cgEventProbe()
cgEventProbe
()
{ immutable
_error_ wf
wf
= g_win.
g_win.frame
frame
(); // AppKit global coords: bottom-left origin, y-up
immutable
_error_ db
db
= CGDisplayBounds(CGMainDisplayID()); // CG: top-left origin
// Global CG point of the window-content center. immutable
_error_ gx
gx
= wf.
wf.origin
origin
.
wf.origin.x
x
+ wf.
wf.size
size
.
wf.size.width
width
/ 2;
immutable
_error_ gy
gy
= db.
db.size
size
.
db.size.height
height
- (wf.
wf.origin
origin
.
wf.origin.y
y
+ wf.
wf.size
size
.
wf.size.height
height
/ 2);
instr("step", "name=cg_event_probe target_global=(%.0f,%.0f) tap=session", gx, gy); foreach (
(parameter) i
i
; 0 .. 2)
{ void*
_error_ ev
ev
= CGEventCreateMouseEvent(null, kCGEventMouseMoved,
NSPoint(gx + i * 40, gy), 0); CGEventPost(kCGSessionEventTap, ev); CFRelease(ev); } instr("cg_event_posted", "moves=2"); } void
void app.installTrackingAreas(app.ZoneView view)
installTrackingAreas
(
(class) app.ZoneView
ZoneView
(parameter) app.ZoneView view
view
)
{ immutable
_error_ b
b
= view.
view.bounds
bounds
();
immutable
_error_ opts
opts
= NSTrackingMouseEnteredAndExited | NSTrackingCursorUpdate
| NSTrackingActiveInKeyWindow; foreach (
(parameter) z
z
; 0 .. 9)
{ immutable
_error_ r
r
= zoneRect(b, z);
auto
_error_ area
area
= NSTrackingArea.
NSTrackingArea.alloc
alloc
().
NSTrackingArea.alloc().initWithRect
initWithRect
(r, opts, view, null);
view.
view.addTrackingArea
addTrackingArea
(area);
instr("tracking_install", "zone=%d rect=(%.0f,%.0f %.0fx%.0f) options=0x%llx", z, r.
r.origin
origin
.
r.origin.x
x
, r.
r.origin
origin
.
r.origin.y
y
, r.
r.size
size
.
r.size.width
width
, r.
r.size
size
.
r.size.height
height
, opts);
} instr("tracking_areas", "count=%llu note=cursor_update_incompatible_with_active_always", view.
view.trackingAreas
trackingAreas
().
view.trackingAreas().count
count
());
} void
void app.onTick(app.ZoneView view)
onTick
(
(class) app.ZoneView
ZoneView
(parameter) app.ZoneView view
view
)
{ ++g_tick; if (!g_auto) return; // interactive mode: keep the window up for a manual hover session if (g_tick >= zoneDriveStartTick && g_tick < zoneDriveStartTick + 9) { g_forcedZone = g_tick - zoneDriveStartTick; view.
view.cursorUpdate
cursorUpdate
(null); // drive the cursorUpdate: logic directly (no pointer)
g_forcedZone = -1; } else if (g_tick == legacyResizeTick) resizeSequence(); else if (g_tick == macos15Tick) frameResizeSequence(); else if (g_tick == invalidateRectsTick) { instr("step", "name=invalidateCursorRectsForView rects_enabled=%d", g_win.
g_win.areCursorRectsEnabled
areCursorRectsEnabled
() ? 1 : 0);
g_win.
g_win.invalidateCursorRectsForView
invalidateCursorRectsForView
(view);
} else if (g_tick == cgEventTick) cgEventProbe(); else if (g_tick == syntheticResultTick) instr("synthetic_result", "cursor_updates_from_events=%d mouse_entered=%d " ~ "mouse_exited=%d reset_cursor_rects=%d note=locked_session", g_cursorUpdates - 9, g_mouseEnters, g_mouseExits, g_resetCursorRects); 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_F12"); 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);
probeVocabulary(); immutable
_error_ contentRect
contentRect
= NSRect(NSPoint(120, 120), NSSize(480, 320));
g_win = NSWindow.
NSWindow.alloc
alloc
().
NSWindow.alloc().initWithContentRect
initWithContentRect
(contentRect,
NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable, NSBackingStoreBuffered, false); g_win.
g_win.setTitle
setTitle
(nsstr("wsi-f12-cursors"));
g_view = ZoneView.
ZoneView.alloc
alloc
().
ZoneView.alloc().initWithFrame
initWithFrame
(contentRect);
g_win.
g_win.setContentView
setContentView
(g_view);
g_win.
g_win.setDelegate
setDelegate
(g_view);
installTrackingAreas(g_view); g_win.
g_win.makeKeyAndOrderFront
makeKeyAndOrderFront
(null);
g_customCursor = buildCustomCursor(); registerCursor(g_customCursor, "customBullseye"); stackProbe(); instr("step", "name=NSTimer_scheduledTimerWithTimeInterval interval_ms=16"); NSTimer.
NSTimer.scheduledTimerWithTimeInterval
scheduledTimerWithTimeInterval
(0.016, g_view, SEL.register("tick:"), null,
true); instr("step", "name=NSApp_run"); g_app.
g_app.run
run
();
instr("loop_exit", "ticks=%d cursor_updates=%d mouse_entered=%d mouse_exited=%d " ~ "update_tracking=%d reset_rects=%d", g_tick, g_cursorUpdates, g_mouseEnters, g_mouseExits, g_updateTrackingCalls, g_resetCursorRects); return 0; }