Forge Draggable Windows logo

Forge Draggable Windows

Community
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.

Overview

PublisherNebulavenus
Repositoryforge-gpu
Skill nameforge-draggable-windows
Stars
46
Forks
7
Bundled files
Instructions only
LicenseZlib
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by Nebulavenus on GitHub. Read the source before you install it.

Installation

Install the Forge Draggable Windows AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-draggable-windows
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Forge Draggable Windows in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Forge Draggable Windows on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Forge Draggable Windows is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

Frequently asked questions

What does the Forge Draggable Windows AI skill do?

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.

Why use Forge Draggable Windows on TypingMind?

Because you install it once and use it with any model. Forge Draggable Windows is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Forge Draggable Windows in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-draggable-windows. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Forge Draggable Windows?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Forge Draggable Windows?

As many as you like. As long as a model supports skills, you can use Forge Draggable Windows with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Forge Draggable Windows AI skill free?

Yes. It is published on GitHub by Nebulavenus under the Zlib license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇