amiga-bootcamp/09_intuition/windows.md
Ilia Sharin 21751c0025 docs(amiga): complete AmigaOS 3.1/3.2 developer reference — 172 files across 17 sections
Comprehensive technical documentation covering:
- Hardware: OCS/ECS/AGA custom chip registers, Copper & Blitter deep dives
- Boot sequence: cold boot through startup-sequence
- Binary format: HUNK executable spec, relocation, debug info
- Linking & ABI: .fd files, LVO tables, register calling conventions
- Exec kernel: tasks, interrupts, memory, signals, semaphores
- AmigaDOS: file I/O, FFS/OFS layout, CLI/Shell scripting
- Graphics: planar bitmaps, Copper programming, HAM/EHB modes
- Intuition: screens, windows, IDCMP, BOOPSI
- Devices: trackdisk, SCSI, serial, timer, audio, keyboard
- Libraries: utility, expansion, IFFParse, locale, ARexx
- Networking: bsdsocket API, SANA-II, TCP/IP stack comparison
- Toolchain: GCC, vasm/vlink, SAS/C, NDK, debugging
- Reverse engineering: IDA/Ghidra setup, compiler fingerprints, case studies
- CPU & MMU: 68040/060 emulation libs, PMMU, cache management
- Driver development: SANA-II, Picasso96/RTG, AHI audio

All files include breadcrumb navigation. No local paths or proprietary content.
2026-04-23 12:17:35 -04:00

2.7 KiB

← Home · Intuition

Windows — OpenWindow, IDCMP, WA_ Tags

Overview

A Window is a rectangular region on a Screen where an application renders and receives input. Windows are managed by Intuition and provide title bars, borders, close/zoom/depth gadgets, sizing, and IDCMP message delivery.


Opening a Window (OS 2.0+)

struct Window *win = OpenWindowTags(NULL,
    WA_Left,        50,
    WA_Top,         30,
    WA_Width,       400,
    WA_Height,      200,
    WA_Title,       "My Window",
    WA_Flags,       WFLG_CLOSEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET |
                    WFLG_SIZEGADGET | WFLG_ACTIVATE | WFLG_GIMMEZEROZERO,
    WA_IDCMP,       IDCMP_CLOSEWINDOW | IDCMP_MOUSEBUTTONS | IDCMP_VANILLAKEY,
    WA_CustomScreen, myScreen,
    TAG_DONE);

Common WA_ Tags

Tag Description
WA_Left, WA_Top Position
WA_Width, WA_Height Size
WA_MinWidth, WA_MaxWidth Size limits
WA_Title Window title string
WA_Flags WFLG_* flags
WA_IDCMP IDCMP class mask
WA_CustomScreen Screen to open on
WA_PubScreen Public screen to open on
WA_SuperBitMap Use super-bitmap scrolling
WA_Gadgets First gadget in chain
WA_Checkmark Custom checkmark image
WA_Borderless No borders

Window Flags (WFLG_*)

#define WFLG_SIZEGADGET    (1<<0)
#define WFLG_DRAGBAR       (1<<1)
#define WFLG_DEPTHGADGET   (1<<2)
#define WFLG_CLOSEGADGET   (1<<3)
#define WFLG_SIZEBRIGHT    (1<<4)   /* right-side sizing */
#define WFLG_SIZEBBOTTOM   (1<<5)
#define WFLG_SMART_REFRESH (0)       /* refresh type */
#define WFLG_SIMPLE_REFRESH (1<<6)
#define WFLG_SUPER_BITMAP  (1<<7)
#define WFLG_BACKDROP      (1<<8)
#define WFLG_REPORTMOUSE   (1<<9)
#define WFLG_GIMMEZEROZERO (1<<10)   /* inner area starts at 0,0 */
#define WFLG_BORDERLESS    (1<<11)
#define WFLG_ACTIVATE      (1<<12)
#define WFLG_RMBTRAP       (1<<16)   /* trap right-button clicks */
#define WFLG_NOCAREREFRESH (1<<17)

Event Loop

BOOL running = TRUE;
while (running) {
    WaitPort(win->UserPort);
    struct IntuiMessage *imsg;
    while ((imsg = (struct IntuiMessage *)GetMsg(win->UserPort))) {
        switch (imsg->Class) {
            case IDCMP_CLOSEWINDOW:
                running = FALSE;
                break;
            case IDCMP_VANILLAKEY:
                Printf("Key: %lc\n", imsg->Code);
                break;
        }
        ReplyMsg((struct Message *)imsg);
    }
}
CloseWindow(win);

References

  • NDK39: intuition/intuition.h
  • ADCD 2.1: OpenWindowTagList, CloseWindow
  • 09_intuition/idcmp.md — IDCMP message classes