Logo vun Forge Draggable Windows

Forge Draggable Windows

Communautéit
Nebulavenus
forge-draggable-windows

Add draggable, z-ordered, collapsible windows to a ForgeUiContext application. Wraps the existing immediate-mode UI context with deferred draw ordering and input routing by z-order.

Iwwersiicht

EditeurNebulavenus
Repositoryforge-gpu
Skill-Nummforge-draggable-windows
Stären
46
Forks
7
Matgeliwwert Fichieren
Nëmmen Instruktiounen
LizenzZlib
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum Nebulavenus op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Forge Draggable Windows an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-draggable-windows
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Nebulavenus/forge-gpu.git /tmp/forge-gpu
mkdir -p .claude/skills
cp -r /tmp/forge-gpu/.claude/skills/forge-draggable-windows .claude/skills/forge-draggable-windows
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Forge Draggable Windows an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Forge Draggable Windows automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Forge Draggable Windows net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Add draggable windows with z-ordering and collapse/expand to any application that uses ForgeUiContext. Based on UI Lesson 10.

When to use

  • You need draggable floating panels that users can rearrange
  • You need z-ordering so overlapping windows draw and receive input correctly
  • You need a collapse toggle to let users minimize windows to their title bar
  • You want deferred draw ordering (per-window draw lists sorted by z at frame end)
  • You need input routing that respects z-order (foreground windows block clicks to background windows in overlap regions)

Key API calls

  • forge_ui_wctx_init(wctx, ctx) -- initialize a window context wrapping an existing ForgeUiContext
  • forge_ui_wctx_free(wctx) -- free per-window draw list buffers
  • forge_ui_wctx_begin(wctx) -- begin a frame (determines hovered window from previous frame data, resets per-frame state)
  • forge_ui_wctx_end(wctx) -- end a frame (sorts draw lists by z_order, appends to main buffers in back-to-front order)
  • forge_ui_wctx_window_begin(wctx, id, title, state) -- begin a window (returns true if expanded, false if collapsed or invalid)
  • forge_ui_wctx_window_end(wctx) -- end a window (computes content height, draws scrollbar, restores main buffers)

Correct order

  1. Initialize a ForgeUiWindowContext wrapping your ForgeUiContext
  2. Each frame: call forge_ui_ctx_begin(), then forge_ui_wctx_begin()
  3. Declare windows: window_begin / widgets / window_end blocks
  4. End frame: call forge_ui_wctx_end(), then forge_ui_ctx_end()

Widget IDs must be unique and each window reserves three IDs: id for the window/drag handle, id+1 for the scrollbar, id+2 for the collapse toggle.

When window_begin returns false (collapsed or invalid), skip all child widgets and do not call window_end.

Key concepts

  1. ForgeUiWindowState -- application-owned persistent state: rect (position/size, updated by drag), scroll_y (content scroll offset), collapsed (toggled by clicking the collapse button), z_order (draw priority, higher = on top, updated on click)
  2. Grab offset -- stored on the press frame as (mouse - rect.origin); used during drag to maintain the relative click position
  3. Bring-to-front -- on any mouse press inside a window, set z_order = max(all z) + 1
  4. Deferred draw -- per-window vertex/index buffers assembled at frame end in back-to-front z-order
  5. Input routing pre-pass -- wctx_begin scans previous frame's window rects to find the topmost window under the mouse; widgets in other windows silently fail hit tests
  6. Keyboard suppression -- widgets in covered windows preserve visual focus but do not process keyboard input (games can suppress window input for game controls without the window appearing unfocused)

Common mistakes

  1. Forgetting wctx_end() -- without it, per-window draw lists are never appended to the main buffer and nothing renders
  2. Calling window_end when collapsed -- window_begin returns false for collapsed windows; calling window_end in that case corrupts state
  3. ID collisions -- each window needs 3 contiguous IDs (id, id+1, id+2); overlapping ranges cause unpredictable hot/active behavior
  4. Not checking wctx_init return -- returns false if the context pointer is null or allocation fails
  5. Resetting grab offset -- the ForgeUiWindowContext grab offset must persist across frames (not reset by wctx_begin) because drags span multiple frames
  6. Ignoring one-frame lag -- hovered_window_id uses previous frame data; z-order changes take effect on the next frame's input routing

Ready-to-use template

Three overlapping windows

c
#include "ui/forge_ui.h"
#include "ui/forge_ui_window.h"

/* Window IDs (each reserves id, id+1, id+2) */
#define ID_WIN_A  100
#define ID_WIN_B  200
#define ID_WIN_C  300

/* Widget IDs inside windows */
#define ID_CB_1   110
#define ID_SLIDER 120

/* Widget dimensions */
#define LABEL_HEIGHT     26.0f
#define CHECKBOX_HEIGHT  28.0f
#define SLIDER_HEIGHT    30.0f
#define SLIDER_MIN        0.0f
#define SLIDER_MAX      100.0f

/* Application-owned window state (persists across frames) */
ForgeUiWindowState win_a = {
    .rect = { 30.0f, 30.0f, 260.0f, 280.0f },
    .scroll_y = 0.0f,
    .collapsed = false,
    .z_order = 0
};
ForgeUiWindowState win_b = {
    .rect = { 200.0f, 80.0f, 260.0f, 200.0f },
    .scroll_y = 0.0f,
    .collapsed = false,
    .z_order = 1
};

/* Application-owned widget state */
bool option_a = true;
float slider_val = 50.0f;

/* --- Frame loop --- */

ForgeUiContext ctx;
forge_ui_ctx_init(&ctx, &atlas);

ForgeUiWindowContext wctx;
forge_ui_wctx_init(&wctx, &ctx);

/* Each frame: */
forge_ui_ctx_begin(&ctx, mouse_x, mouse_y, mouse_down);
ctx.scroll_delta = scroll_delta;
forge_ui_wctx_begin(&wctx);

/* Window A: settings */
if (forge_ui_wctx_window_begin(&wctx, ID_WIN_A, "Settings", &win_a)) {
    (void)forge_ui_ctx_checkbox_layout(
        wctx.ctx, ID_CB_1, "Option A", &option_a, CHECKBOX_HEIGHT);
    (void)forge_ui_ctx_slider_layout(
        wctx.ctx, ID_SLIDER, &slider_val,
        SLIDER_MIN, SLIDER_MAX, SLIDER_HEIGHT);
    forge_ui_wctx_window_end(&wctx);
}

/* Window B: status */
if (forge_ui_wctx_window_begin(&wctx, ID_WIN_B, "Status", &win_b)) {
    forge_ui_ctx_label_layout(wctx.ctx, "Hello, windows!",
                              LABEL_HEIGHT, 0.9f, 0.9f, 0.9f, 1.0f);
    forge_ui_wctx_window_end(&wctx);
}

forge_ui_wctx_end(&wctx);   /* sorts and assembles draw lists */
forge_ui_ctx_end(&ctx);      /* finalizes hot/active state */

/* Use ctx.vertices, ctx.indices, ctx.vertex_count, ctx.index_count
 * for rendering — vertices are in correct z-sorted draw order. */

Key observations

  • Pass wctx.ctx (not &ctx) to widget functions inside a window -- the window context redirects the vertex/index pointers
  • window_begin returns false for both collapsed windows and validation failures -- never call window_end when it returns false
  • Widget return values (checkbox_layout, slider_layout) indicate whether the value changed, not success/failure -- (void) cast is fine when the result is not needed
  • Set ctx.scroll_delta before wctx_begin so the input routing pre-pass can associate the scroll with the correct window

Reference

Heefeg gestallte Froen

Wat mécht de KI-Skill Forge Draggable Windows?

Add draggable, z-ordered, collapsible windows to a ForgeUiContext application. Wraps the existing immediate-mode UI context with deferred draw ordering and input routing by z-order.

Firwat Forge Draggable Windows op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Forge Draggable Windows besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Forge Draggable Windows an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-draggable-windows an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Forge Draggable Windows benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Forge Draggable Windows benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Forge Draggable Windows domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Forge Draggable Windows gratis?

Jo. De Skill gëtt vum Nebulavenus ënner der Lizenz Zlib op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇