Skip to content

GraphiteWindows: the Window Manager - #27

Merged
colemancda merged 13 commits into
masterfrom
feature/windows
Nov 26, 2026
Merged

colemancda merged 13 commits into
masterfrom
feature/windows

Conversation

@colemancda

Copy link
Copy Markdown
Member

Summary

The Window Manager, next after GraphiteSound in the README's order: windows of every class, their frames, the list the program's windows make, and the regions that govern what a window draws.

  • WindowClass (alert, movable alert, modal, movable modal, floating, document, utility, help, sheet, sheet alert, toolbar, plain, alternate plain, simple, overlay and drawer), with the layer each class floats at and its activation scope; WindowAttributes, with kWindowStandardDocumentAttributes and kWindowStandardFloatingAttributes; WindowRegion, WindowPart and WindowDefPart; WindowPositionMethod.
  • WindowDefinition, the WDEFs as a protocol — the frame's features (kWindowMsgGetFeatures), where the content sits in the structure (kWindowMsgCalculateShape), any of the frame's regions (kWindowMsgGetRegion), hit testing (kWindowMsgHitTest) and the standard state's bounds — and StandardWindowDefinition, the Mac OS 8 and 9 frame: a title bar with the boxes the attributes give it, a four-pixel border around a document's content, a shorter bar and no border on a palette, nothing at all on a frameless window.
  • Window: structure and content bounds (CreateNewWindow takes the content's), MoveWindow by content and MoveWindowStructure by structure as MacWindows documents, SizeWindow, SetWindowBounds; zooming between the user and standard states (GetWindowUserState, SetWindowStandardState), saving the state it leaves as ZoomWindow does; collapsing to the title bar and back; the title, kind, reference constant and parent; and the content in its own buffer (LockPortBits, a resize rebuilds it white), which the host reads to show the window as it likes.
  • WindowManager: the program's windows, front to back by class layer and selection, held weakly so a window the program lets go of is gone from the list; FrontWindow (which skips the palettes), the active document and the active palette (ActivateWindow, the two activation scopes, kWindowNoActivatesAttribute); FindWindow with the menu bar kept, past windows that ignore clicks; showing, hiding, selecting, SendBehind, DisposeWindow; and RepositionWindow: centered, cascaded (GetCascadeOrigin, from the corner again when the next window wouldn't fit) and the alert position, on the main screen or by a parent.
  • The regions the classic kept: every visible window's visible region — its content less what the windows in front cover and the desktop's edges — worked out as each change happens; the update region (InvalWindowRect and Rgn, ValidWindowRect and Rgn, kWindowNoUpdatesAttribute); BeginUpdate and EndUpdate, which hold the port's clip and visible regions to what needs drawing, in the port's local coordinates; and flush (QDFlushPortBuffer), which tells the host the part of the buffer that changed.

Notes for review

  • One commit per file, and the package builds at every one: the source commits come first, as files no target reads yet, then "Added the GraphiteWindows module" wires them in.
  • ZoomWindow saves the state it leaves, so SetWindowUserState while the window sits in the state it would save is saved over — the classic's behavior, and why ZoomWindowIdeal was added; the tests assert it.
  • A window covered again keeps what it drew: the update region grows only for what has been unable to be seen, and the buffer holds the rest.
  • Not here: window groups (the class's layer stands in for ordering), the process-level front window (GetWindowOwner), sheets positioned on their parents, proxy icons, ZoomWindowIdeal and the ideal user state (the states here are the classic's), and drawers' sliding, which is the host's animation. Menus, controls and dialogs come in the modules that follow.

Testing

  • 34 new tests in three files: the frame's shape for every class (the boxes 11 square and four from an edge, the drag region without them, the grow box, the title text between), hit testing at every part and after zooming, bounds, resizing (the buffer rebuilt white), zooming between the states with the states the program sets, collapsing to the title bar and back, attributes changed in place; the list by layer, FrontWindow skipping the palettes, the two activation scopes, no-activates, FindWindow past ignored clicks and under the menu bar, the desktop without the menu bar, centering, cascading (the origin advancing and starting over), the alert position, disposal, and windows let go of; shown windows needing drawing, invalidating and validating, no-updates, BeginUpdate/EndUpdate holding drawing to the update region, occlusion (covered again stays drawn), uncovering by hide and by move, flushing to the host, port bits locks, and drawing through the port.
  • The package's whole suite passes on macOS, with and without the FreeType trait. Linux and the 32-bit targets are left to CI.

@colemancda
colemancda merged commit d4d30c3 into master Nov 26, 2026
3 checks passed
@colemancda
colemancda deleted the feature/windows branch November 26, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant