plat/apple_ios_pad.rs (Apple)#
Source: lib/plat/apple_ios_pad.rs
apple_ios_pad -- the iPad's parts of iOS's host (docs/APPLE.md AP9): the app's menus in the menu bar
of iPadOS, the pointer of a trackpad or mouse without a button, its wheel and pinch, and the test
aids of plattest --test ipad
is_pad() -> bool the device is an iPad (UIUserInterfaceIdiomPad)
sysmenu_supported() / sysmenu_window_row() / sysmenu_set() plat::sysmenu on the iPad
app_methods() / view_methods() (apple_ios.rs register) the app delegate's menu methods, JFView's
actions of the recognizers
add_recognizers(view) (apple_ios.rs vc_load_view) hover, wheel and pinch on JFView
ios_pad_* (tests, any thread) window sizes, the keyboard, turning, the menus
built with a stand-in for UIKit's builder, the pointer's paths
without a pointer; on the main thread
The menus: UIKit asks the app delegate (a UIResponder) for the main menu (buildMenuWithBuilder:).
With menus of the app the system's File, Edit, Format and View menus go and the app's follow the
application menu, before Window, as on the Mac (apple_mac_app.rs). Every row is a UICommand, with
a key equivalent a UIKeyCommand, whose action jfSysMenu: goes up the responder chain to the app
delegate; its propertyList is the row's id. Separators become inline groups (UIMenu has none).
sysmenu_set asks for a rebuild; iPadOS builds when it needs the menu (the bar revealed, Command
held), never without input. iPadOS 26 shows the menus in its menu bar (a swipe down from the top
edge or the pointer there reveals it), every iPadOS shows the rows with a key while Command is
held. The window keeps its own menu row (sysmenu_window_row, the user's decision of 2026-11-19):
the bar of iPadOS hides until it is revealed, the row stays the way for the finger. The iPhone
has no menu bar: unsupported there.
The pointer: a UIHoverGestureRecognizer moves the mouse without a button (the Apple Pencil's hover
on the iPads that have it: a pen without pressure), a UIPanGestureRecognizer that takes no touches,
only scroll events, turns a trackpad's two fingers and a mouse wheel into E_WHEEL (WHEEL_PIXELS,
as the Mac's trackpad), a UIPinchGestureRecognizer for the indirect pointer alone turns a
trackpad's pinch into Ctrl + wheel (as macOS). None of them takes or delays a finger.
struct IosMenuRowone row as UIKit holds it (tests)label: Stringid: u32-- the id of its command (0: a submenu or a row without action)disabled: boolchecked: boolkey: String-- the key equivalent's input (UIKit's names for special keys) and its UIKeyModifierFlagskey_flags: isizesub: usize-- the rows of a submenu (0: none)sep_before: bool-- a separator (an inline group's border) comes before it
struct IosPadViewwhat the host shows (ios_pad_view): sizes in points unless named pxpad: bool-- the device is an iPadscene: (f64, f64)-- the window scene's bounds (the window iPadOS gave the app), the window's, JFView'swindow: (f64, f64)view: (f64, f64)safe: (f64, f64, f64, f64)-- the safe area's insets of the root view: top, left, bottom, rightcanvas: (i32, i32)-- the canvas in px as last sent (E_RESIZE) and its px per pointscale: f64screen_scale: f64-- the screen's own scaleorientation: isize-- the interface orientation of the scene (UIInterfaceOrientation: 1 portrait .. 4 landscape)window_row: bool-- the app's menus in the window row stay (sysmenu_window_row)shown: (i32, i32)-- the size of the last picture shown (px)keyboard: bool-- the on-screen keyboard is asked for (JFView first responder)last_wheel: (u8, u8, u32)-- the last E_WHEEL the wheel or the pinch sent: btn, mods, datagpu: Option<IosGpuLayer>-- the GPU's layer (apple_ios_gpu.rs): made, shown, its drawable's size (px) and frame (points)
struct IosGpuLayerthe GPU's layer as the host has it (IosPadView::gpu)shown: booldrawable: (f64, f64)frame: (f64, f64)
fn ios_pad_view() -> Option<IosPadView>(tests, any thread) the host's sizes now; None without UIKit's hostfn ios_pad_window(w: f64, h: f64) -> bool(tests, any thread) the window's frame inside its scene in points, as Split View, Slide Over or Stage Manager would give it (w or h 0: the scene's whole bounds again) -> false without the hostfn ios_pad_rotate(landscape: bool) -> bool(tests, any thread) the scene turned to landscape (true) or portrait, as the user turning the iPad would (requestGeometryUpdateWithPreferences:) -> false without the hostfn ios_text_size(category: Option<&str>) -> bool(tests, any thread) the text size of the system as the user would set it (Settings, Display & Text Size): the window's trait override of preferredContentSizeCategory ("XXL": the size after the default "Large"; None: the override gone, the system's again) -> false without the host or before iOS 17 (no trait overrides)fn ios_dark(dark: Option<bool>) -> bool(tests, any thread) dark (Some(true)) or light for the window, as the user's setting would be (overrideUserInterfaceStyle); None: the system's again -> false without the hostfn ios_pad_keyboard(show: bool) -> bool(tests, any thread) the on-screen keyboard as a tap into a text box brings it (JFView first responder) or "Done" hides it -> false without the hoststruct IosPadMenusthe main menu after the last build (ios_pad_menus)builds: u32-- builds so far (UIKit's and ios_pad_menu_build's), rebuilds sysmenu_set asked UIKit forrebuilds: u32system_gone: bool-- the system's File, Edit, Format and View menus wentmenus: Vec<(String, Vec<IosMenuRow>)>-- the app's menus with their rows as the builder holds them
enum IosPadPointerwhat the tests feed in where a pointer would (ios_pad_pointer)Hover { x: f64, y: f64, pen: Option<(i32, i32)> }-- the pointer (pen: the pencil's hover with this tilt) over the view without a button at (x, y) points; Leave: it left the viewLeaveScroll { dx: f64, dy: f64, x: f64, y: f64 }-- two fingers on the trackpad move the content by (dx, dy) points at (x, y)Pinch { m: f64, x: f64, y: f64 }-- a trackpad's pinch: the scale changed by m (0.1 = 10 % larger)
fn ios_pad_pointer(p: IosPadPointer) -> bool(tests, any thread) the recognizers' paths with the values a pointer would give (the simulator has no pointer of its own to drive) -> false without the host