Files
libgemui/README.md
T

49 lines
2.9 KiB
Markdown
Raw Normal View History

2026-11-30 17:24:33 +02:00
# libgemui
`libgemui` is a lightweight C11 X11, Cairo, and Pango/HarfBuzz UI toolkit designed for the ANODE desktop environment and standalone X11 utilities. It can be built as either a shared library (`libgemui.so`) or a static archive (`libgemui.a`) with live `.Xresources` / `.xth` theming and fractional DPI scaling.
## Features
- **Double-buffered X11 + Cairo + Pango rendering**: Smooth redraws with XRandR/Xinerama monitor awareness, Pango/HarfBuzz font fallback (`theme.fontFace` + `theme.iconFontFace`), and automatic luminance-aware dark/light control contrast.
- **Fractional DPI scaling & touch sizing**: Reads `Xft.dpi`, `theme.scale` / `anode.scale`, `theme.touchMode` / `anode.touchMode`, `~/.Xresources`, root `XA_RESOURCE_MANAGER`, `GEMUI_SCALE` / `ANODE_SCALE`, and primary monitor EDID DPI (`0.50x` to `4.00x`), with live theme reload via `SIGUSR1` or property updates.
- **Standalone theming fallback**: Ships built-in `Anodized` theme defaults so applications work cleanly on any X11 desktop even when no ANODE theme files or `.Xresources` entries are present.
- **Immediate-mode helpers & hit tracking**: Rect/rounded primitives, text/icon drawing, headers, buttons, toggles, sliders, text inputs, toasts, clipboard retrieval (`gemui_clipboard_get`), non-blocking `poll()` loop for X11 + custom fds + timers, and optional `WM_DELETE_WINDOW` interception (`gemui_set_close_handler`).
- **Standardized File Open / Save dialog**: Built-in modal directory browser (`gemui_open_file_dialog`, `gemui_save_file_dialog`, `gemui_file_dialog_run`) with extension filters, dotfile toggle, UTF-8 filename input, overwrite confirmation, and automatic compact scaling down to tiny screens (`<= 320x360`).
## Dependencies
- POSIX `make`, C11 compiler (`cc`), `ar`, and `pkg-config`
- X11, Cairo, Pango, HarfBuzz, Fontconfig, and FreeType development libraries:
`x11`, `xext`, `xft`, `xinerama`, `xrandr`, `cairo`, `pangocairo`, `pango`, `harfbuzz`, `fontconfig`, `freetype2`
## Build & Install
```sh
make # Build build/libgemui.so, build/libgemui.a, and build/gemui.pc
sudo make install # Install libraries, gemui.h, and gemui.pc (default PREFIX=/usr/local)
```
Targets and options:
- `make shared` / `make static`: Build only `build/libgemui.so` or `build/libgemui.a`.
- `make rebuild` / `make clean` / `make help`: Clean rebuild or inspect build variables (`PREFIX`, `ANODE_PREFIX`, `DESTDIR`, `CC`, `AR`, `CFLAGS`, `LDFLAGS`).
### Using as a Git Submodule / Static Library
When embedding `libgemui` in another repository:
```sh
make static
```
Compile with `-I<path-to-libgemui>` (`#include <gemui.h>`) and link `<path-to-libgemui>/build/libgemui.a` followed by:
```sh
pkg-config --libs x11 xext xft xinerama xrandr cairo pangocairo pango harfbuzz fontconfig freetype2
```
and `-lm`.
## Credits
Created by Luxferre in 2026, released into the public domain with no warranties.