Repository navigation
Alex/simplify gui - #30
Merged
Merged
Conversation
A GUI written with Dear ImGui and rendered in software, as an alternative to Qt: it builds without Qt nor vcpkg. Select it with -DCLAP_PLUGINS_GUI=imgui (preset ninja-imgui); Qt stays the default. On Linux, it shows up in a floating Wayland window with its own connection to the compositor, so the host and the plugin share no Wayland object: - set_transient() gets the host's xdg-foreign handle, to keep the plugin's window above the host's - the experimental clap.gui-wayland.experimental extension gives an xdg-activation token for the next show() - without xdg-decoration (mutter), the plugin draws its own title bar The contract is described in plugins/gui/wayland-floating.h, and isn't part of CLAP. tools/wayland-host is a minimal host implementing it. So far, only the gain plugin has a skin; the others show a knob per parameter. There is no keyboard input yet, and no X11, Win32 or Cocoa backend. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plugins' GUIs are now all written with Dear ImGui and rendered in software. Each platform only shows a pixel buffer and reports the mouse: - X11: embedded (XEmbed) or floating, with XCB because Xlib's error handlers are process-wide; the host gives the scale - Wayland: floating only, see plugins/gui/wayland-floating.h - Win32: embedded child window, with its own timer - Cocoa: embedded NSView, whose class is created at runtime with a name unique to the binary, with its own timer The QML skins are ported to plugins/gui/skins.cc: gain, dc-offset, char-check, track-info, transport-info, undo-test and synth. The other plugins show a knob per parameter. Qt was the only reason for vcpkg, so both go away, along with the out-of-process GUI (plugins/io), the threaded GUI proxies, the GUI factories and PathProvider. CorePlugin now owns the GUI directly and takes a skin name. The build scripts only drove vcpkg and Qt: they are removed, CMake presets do the job (ninja, ninja-headless, vs, vs-headless). One GitHub workflow builds the GUI and headless variants on Linux, macOS and Windows. Jenkins and the Dockerfile use the presets. tools/gui-host replaces tools/wayland-host and tries the GUIs on Linux: X11 embedded or floating, and Wayland floating. The Win32 and Cocoa windows were reviewed but neither compiled nor run. There is no keyboard input yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With X11, CLAP's plugins use the scale which the host sets, and the plugins here reflect it as is. The test host only set it with --scale, so the GUIs were at 1x on HiDPI desktops. Like a real host, it now gives its own scale: Xft.dpi, or with XWayland, the ratio between the X11 screen's width and the Wayland outputs' logical layout. This covers the compositors which don't scale the X11 clients, like COSMIC with descaling, where X11 has no scale information. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clap-wayland-experiment (a new submodule) drafts the extensions for floating plugin windows on Wayland, one per protocol: - clap.gui-xdg-foreign-v2/1 gives the host's xdg-foreign handle, to keep the plugin's window above the host's; NULL removes the parent - clap.gui-xdg-activation-v1/1 gives the xdg-activation token They replace plugins/gui/wayland-floating.h, which passed the handle in clap_plugin_gui->set_transient(). As the draft says, set_transient() now returns false for Wayland. clap-gui-host uses the new extensions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clap-wayland-experiment now drafts a nested compositor approach: the host runs a Wayland compositor of its own, gives the plugin a socket to it (clap_host_gui_wayland_nested_compositor), and an embedding token (clap_plugin_gui_wayland_nested_compositor->set_parent()). The plugin's surface goes into the host's window with the clap_surface_embedding_v1 protocol. This implements the plugin's side, for the CLAP_WINDOW_API_WAYLAND_SURFACE_EMBEDDING_V1 window API: - it is supported, and preferred, only if the host has the extension - WaylandWindow gets an embedded mode: it connects with the host's socket, has no xdg_toplevel, and embeds its surface with the token; set_parent() again embeds it elsewhere - when the host ends the embedding, or the connection is lost, the plugin tells the host that the GUI was destroyed, as the windows now report it separately from a close request clap-gui-host doesn't host it yet. The submodule is updated, and its CMake helper generates the protocol's code. The popups and the XKB key forwarding aren't used: the GUI has neither popups nor keyboard input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each one supports a single window API and mode: - check-x11-floating - check-x11-embed - check-wayland-floating - check-wayland-embed, which needs the host's nested compositor The generic window API check, the preferred API and create() only accept that combination, and only the Wayland extensions of that mode are exposed. Their GUI shows the window API, the mode, the scale and the logical size, with a gain knob. clap-gui-host says it can't host the embedding API yet, rather than opening a window for nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
check-windows-floating and check-windows-embed are only available on Windows, check-cocoa-floating and check-cocoa-embed on macOS. The GUI only embedded its window there, so the floating windows are new: - Win32: a top-level window; set_transient() makes the host's window its owner, which keeps it above - Cocoa: an NSWindow whose content is the view; set_transient() makes it a child window of the host's window, again each time it's shown Closing them only hides them, and the host is told. Like the rest of the Win32 and Cocoa code, they weren't compiled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLAP's gui.h says that CLAP_WINDOW_API_WAYLAND uses physical sizes, which is going to be corrected: Wayland is logical, the host doesn't call set_scale(), and the plugin gets the scale from the compositor. The sizes were already logical and set_scale() refused for Wayland, but the scale only came from wp_fractional_scale_v1 or, with wl_compositor v6, wl_surface.preferred_buffer_scale. Without them, for example with a host's nested compositor which doesn't offer them, the GUI stayed at 1x. It now falls back to the biggest scale of the outputs which the surface is on, from wl_surface.enter/leave and wl_output.scale. clap-gui-host doesn't call set_scale() for Wayland anymore, --scale is for X11. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It sleeps 20 seconds in clap_plugin.destroy(), to test how hosts handle plugins which take long to be destroyed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The presets need CMake 3.21, the Arch packages lacked the compiler, and the tests weren't documented. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.