plat/apple_mac_test.rs (Apple)#
Source: lib/plat/apple_mac_test.rs
apple_mac_test -- test aids of the macOS window backend (plattest --test window). Events made here
go to our own windows only ([NSWindow sendEvent:] or straight to our view's method); nothing
reaches the system's event stream.
win_test(op, w, a) -> i64
WT_PIXEL [x, y] 0xRRGGBB of the frame window w shows (its layer's image), -1 none
WT_MOVE [x, y, w, h] the user moves / resizes window w (its client rect, px): reported
WT_CURSOR_IS [shape] 1 when the application's current cursor is that shape's
WT_VISIBLE, WT_ACTIVE, WT_ENABLED 1 / 0 (shown, the key window, win_enable)
WT_POPUP_RECT popup slot w: x | y << 16 | w << 32 | h << 48 (screen px), -1 hidden
WT_POPUP_PIXEL [x, y] a pixel of popup slot w
WT_POPUP_SEND [kind, 0, x, y] a mouse event (TS_MOVE / TS_DOWN / TS_UP) at popup px x, y
WT_CARET the input method's caret (firstRectForCharacterRange), client px x | y << 32
WT_SEND [kind, a, b, 0] an event to window w: TS_MOVE / TS_DOWN / TS_UP at client px a, b;
TS_KEY key code a with the character b (keyDown, the input system);
TS_TEXT the character a (insertText:); TS_WHEEL a lines (up > 0);
TS_PINCH a magnification of a / 1000 (magnifyWithEvent:, at client px b, c)
WT_PARENT [popup] the index of the window w (popup = 1: popup slot w) hangs on, -1 none
WT_MIN_SIZE window w's minimum client size (DIP): w | h << 32
WT_MENU the main menu: its items | the app menu's items << 8 | (1 << 16 when its
Quit is Cmd+Q)
WT_TERMINATE [NSApp terminate:] (Cmd+Q, the Dock's Quit) -> 0 when the app goes on
WT_WORKSPACE [k] NSWorkspace's notification k (0 will sleep, 1 did wake, 2 will power off)
posted in this process
WT_SIGTERM SIGTERM to this process (kill)
WT_TRAY [k, a] the status item: k 0 its menu rows (-1 none), 1 choose row a, 2 a click
WT_DOCK [k, a] the Dock tile: k 0 the badge's number (-1 none), 1 progress shown, 2 the Dock
menu's rows, 3 choose its row a
WT_OPEN_URLS application:openURLs: with build/plattest_open.txt and an https URL
WT_NOTE_CLICK [id] the notification centre's delegate told of a click on notification id
WT_BUNDLE 1 when the program runs inside an app bundle
WT_SYSMENU [k, a, b] the app's menus in the menu bar (sysmenu): k 0 how many, 1 the rows of menu
a, 2 choose row b of menu a, 3 row b's state (1 enabled | 2 checked | 4 a
key equivalent with Command)
file_dialog_autoclose(ms, name) the next file_dialog is closed after ms: Cancel, or (saving)
OK with name (a full path)
WT_PIXEL: u32 = 1
WT_MOVE: u32 = 3
WT_CURSOR_IS: u32 = 5
WT_VISIBLE: u32 = 6
WT_POPUP_RECT: u32 = 7
WT_POPUP_PIXEL: u32 = 8
WT_ENABLED: u32 = 9
WT_CARET: u32 = 10
WT_ACTIVE: u32 = 11
WT_POPUP_SEND: u32 = 13
/// a[0]: the dpi as if the screen had that scale: -1, a test cannot change a Mac's scale
WT_DPI: u32 = 4
/// a[0] = 7 minimised, anything else back again (uigputest)
WT_SHOW: u32 = 18
/// no window animations (show, hide, resize): screen checks see the end state at once
WT_NOANIM: u32 = 16
/// whose pixel is at client point (a[0], a[1]) on the screen: 1 this window (its GPU layer is part of
/// it), 0 another one
WT_FROM_POINT: u32 = 17
WT_SEND: u32 = 32
WT_PARENT: u32 = 33
WT_MIN_SIZE: u32 = 34
WT_MENU: u32 = 35
WT_TERMINATE: u32 = 36
WT_WORKSPACE: u32 = 37
WT_SIGTERM: u32 = 38
WT_TRAY: u32 = 39
WT_DOCK: u32 = 40
WT_OPEN_URLS: u32 = 41
WT_NOTE_CLICK: u32 = 42
WT_BUNDLE: u32 = 43
WT_SYSMENU: u32 = 44
// WT_SEND / WT_POPUP_SEND kinds
TS_MOVE: i32 = 1
TS_DOWN: i32 = 2
TS_UP: i32 = 3
TS_KEY: i32 = 4
TS_TEXT: i32 = 5
TS_WHEEL: i32 = 6
TS_PINCH: i32 = 7
fn win_test(op: u32, w: i32, a: [i32; 4]) -> i64see the file headerfn file_dialog_autoclose(ms: u32, name: Option<&str>)the next file_dialog is closed after ms: Cancel, or OK with name (a full path; saving only)