Skip to content

Linux (Wayland) fixes, and window features (transparency, topmost); Fix pie menu behaviours - #25

Open
concprog wants to merge 55 commits into
ppmpreetham:mainfrom
concprog:pie-overlay
Open

concprog wants to merge 55 commits into
ppmpreetham:mainfrom
concprog:pie-overlay

Conversation

@concprog

@concprog concprog commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

What does this change?

Fixes:

  • Wayland windows wait for the compositor's first configure before returning, as GHOST does. Before, a new window drew nothing until a later event-loop pass (buipy_render failed on Wayland sessions).
  • Wayland frames copied and damaged the whole window on every frame after the first full one: the double-buffer copy recorded its own full copy as the next frame's damage. Only what changed is copied and reported now.
  • Setting a node's geometry or a flag property (visible, enabled, ...) to the value it already had relaid out and redrew the whole window. Unchanged values now do nothing. The Rust binding places every widget each frame, so every Rust frame was a full redraw earleir.
  • BK_canvas_put_item / BK_canvas_truncate (display lists rebuilt each frame) redrew the whole canvas. Only items that changed, moved or were removed are redrawn now.
  • A Python exception inside a Dear ImGui frame no longer aborts the process in debug builds. The backend has ImGui_ImplBUI_AbandonFrame() (C: cImGui_ImplBUI_AbandonFrame), which ends the frame with Dear ImGui's error recovery; the Python binding calls it (buipy_imgui aborted with "Missing End()").

Linux windows

  • wm "state" 2 / 0 hides and shows a window on X11 and Wayland. X11 had no "state", and Wayland could not hide a window.
  • wm "override" (no frame) and "topmost" work on X11 (_MOTIF_WM_HINTS, _NET_WM_STATE_ABOVE, ported from GHOST). "override" works on Wayland through client-side decorations. Both worked only on Win32 and Cocoa.
  • wm "transparent" gives per-pixel alpha: a 32-bit ARGB visual on X11, ARGB8888 buffers on Wayland. The software raster can keep alpha (BUI_raster_set_alpha, BUI_raster_clear). Opaque frames are the same as to before.
  • wm "layer" and "anchor" make a wlr-layer-shell surface on Wayland (KDE Plasma, wlroots compositors). Wayland has no other way to keep a window on top. The protocol XML is in kit/extern/wayland_protocols and listed in THIRD_PARTY_NOTICES.md.
  • Wayland cursors go through the cursor-shape protocol, as in GHOST, so the compositor draws them and no cursor theme is loaded. Without the protocol, the theme loaded on the first cursor change. Builds with wayland-protocols <1.32 keep the earlier behaviour.

API:

  • BKWindowCallbacks.on_focus reports when a window gets or loses keyboard focus, on Win32, Cocoa, X11 and Wayland. Losing focus cancels an open pie, as Blender's WINDEACTIVATE does. Bindings: Python Window.on_focus, Rust App::on_window_activation, JavaScript window events focus / blur.
  • Transparent windows from the bindings: Rust WindowOptions.window_background = WindowBackgroundAppearance::Transparent, JavaScript app.window({ transparent: true }).
  • BK_hit_at(ctx, x, y) is public (it was internal): the interactive node under a point. Python ctx.hit, Lua ctx:hit.
  • BK_open_pie takes a centre point, so its signature changes. -100000 keeps the pointer, as in BK_open_menu.

Pie behaviour:

  • Opened by a held key, releasing the key picks the item; a quick tap keeps the pie open for a click (pie_menu_begin, pie_tap_timeout).
  • An item with sub opens a sub-pie at the pointer.
  • Accelerator keys with underlined letters (menu_block_set_keyaccels).
  • Open animation over pie_animation_timeout (60 ms), off with reduced motion.
  • Pie number keys are numpad directions (8 north, 6 east, ...), as in Blender's pie_handler. They were item positions.
  • Pies with more than 8 items get Blender's "More" slot holding the rest. Items past the eighth used to be dropped.

Python:

  • Removed the text shadow so that it is visually similar to Rust and JS bindings

Benchmarks
(Rust CPU renderer, native Wayland, KDE, 1920x1080 at 120 Hz):

  • CPU per frame for one changing label in a 941x982 window: 2.7 ms before, 0.43 ms after.
  • First frame: 33.7 ms median over 10 launches.

How was it tested?

  • ctest --test-dir build passes
  • cargo test passes (if Rust changed)
  • Added or updated a test for this change
  • Benchmarks attached (for rendering or layout changes)

Checklist

  • CHANGELOG.md updated (Unreleased)
  • Docs updated (docs/, README if user-facing)
  • New files carry the SPDX-License-Identifier: GPL-2.0-or-later header

@concprog

concprog commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator Author

More (quick) measurements (re-runs):
(Bun CPU renderer, native Wayland, KDE, 1920x1080 at 120 Hz):

  • CPU per frame for one changing label in a 941x982 window: 0.84 ms.
  • First frame: 88.6 ms median over 10 launches (React app).

(Python CPU renderer, native Wayland, KDE, 1920x1080 at 120 Hz):

  • CPU per frame for one changing label in a 941x982 window: 4.43 ms.
  • First frame: 87.4 ms median over 10 launches.

Fixed a regression I introduced - pie animation: close_popups freed the pie while animations still ran on it.

@concprog concprog changed the title Linux (Wayland) fixes, and linux window features (transparency, topmost Linux (Wayland) fixes, and linux window features (transparency, topmost); Fix pie menu behaviours Nov 8, 2026
@concprog concprog changed the title Linux (Wayland) fixes, and linux window features (transparency, topmost); Fix pie menu behaviours Linux (Wayland) fixes, and window features (transparency, topmost); Fix pie menu behaviours Nov 9, 2026

This branch has not been deployed

No deployments
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