JFLib

ui/form.rs#

Source: lib/ui/form.rs

form -- the kind of device the app runs on: a desktop, a tablet or a phone

  form_factor() -> FF_DESKTOP / FF_TABLET / FF_PHONE
  mobile() -> bool                 a tablet or a phone (form_factor() != FF_DESKTOP)

The platform decides, never the window's size alone: Windows, Linux, macOS and the browser are
FF_DESKTOP however small a window is dragged (a narrow desktop window keeps the desktop's
behaviour); Android and iOS are FF_TABLET, and FF_PHONE where the main window's shorter side is
below 600 DIP (Android's own line between a phone and a tablet, `sw600dp`; a tablet's app in a
narrow split screen is laid out like a phone's then).  The shorter side keeps a phone a phone
when it is turned.  An iPad stays FF_TABLET in every window that is not that narrow, also a
large one in Stage Manager or iPadOS 26's windows (the user's decision of 2026-11-19: iPadOS owns
the window and draws its controls, the finger stays the main way; docs/APPLE.md AP9).

jfgui_FORM=desktop|tablet|phone decides instead (any platform: tests, and a look at the phone's
layout on the desktop; scripts: `system env jfgui_FORM phone`).

What the library does by itself on a phone or a tablet (only there):
  the title bar has no caption buttons (chrome.rs: the system owns the app's window);
  a menu bar that does not fit its row becomes one menu button (popup.rs, menubar);
  the status bar's items roll sideways with the finger when the bar is too narrow (chrome.rs);
  windows and content dialogs keep inside the screen, what does not fit rolls (win.rs, chrome.rs);
  Android and iOS paint the system's bars in the colours at the app's edges (the hosts).
Apps ask form_factor() for what only they know: which panels a phone shows, which a tablet.

impl Ui

  • fn form_factor(&self) -> u32 ui_form_factor: FF_DESKTOP, FF_TABLET or FF_PHONE (the platform's; jfgui_FORM decides instead). A desktop window stays FF_DESKTOP however narrow it is.
  • fn mobile(&self) -> bool ui_mobile: the app runs on a phone or a tablet (form_factor() != FF_DESKTOP)

Source: docs/API.md in the JFLib repository.