{"id":28000634,"url":"https://github.com/sysprog21/mado","last_synced_at":"2025-05-08T23:53:58.215Z","repository":{"id":248791994,"uuid":"829783225","full_name":"sysprog21/mado","owner":"sysprog21","description":"A window system for resource-constrained devices ","archived":false,"fork":false,"pushed_at":"2025-03-17T06:39:59.000Z","size":1274,"stargazers_count":61,"open_issues_count":15,"forks_count":20,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-08T23:53:53.321Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sysprog21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-17T02:39:41.000Z","updated_at":"2025-04-28T07:58:07.000Z","dependencies_parsed_at":"2024-09-11T04:13:28.779Z","dependency_job_id":"36ed72bb-6fea-4a49-9c16-3f79e1ead1bb","html_url":"https://github.com/sysprog21/mado","commit_stats":null,"previous_names":["sysprog21/mado"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Fmado","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Fmado/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Fmado/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysprog21%2Fmado/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysprog21","download_url":"https://codeload.github.com/sysprog21/mado/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166486,"owners_count":21864471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-08T23:53:57.773Z","updated_at":"2025-05-08T23:53:58.200Z","avatar_url":"https://github.com/sysprog21.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mado: A Window System for Resource-Constrained Devices\n\n## Introduction\n\nMADO (Minimalistic Application Display Orchestrator) is an open-source library\nthat brings advanced window system features to smaller devices. With embedded\nsystems now featuring high-resolution displays and powerful CPUs, sophisticated\ngraphical user interfaces can be realized even in the smallest devices. Although\nCPU power has increased dramatically within a given power budget, these small\nsystems still face severe memory constraints. This unique environment presents\ninteresting challenges for graphical system design and implementation.\n\nTo address these challenges, `Mado` has been developed. Drawing from ideas used\nin modern window systems for larger environments, `Mado` provides overlapping\ntranslucent windows, anti-aliased graphics, drop shadow, animations, and scalable\nfonts within a memory budget of several kilobytes. `Mado` embeds window management\ndirectly into the toolkit, supporting resizing, moving, and minimizing without\nexternal control. The toolkit automatically constructs suitable decorations for\neach window as regular toolkit objects, and the normal event dispatch mechanism\ndirects window management activities.\n\n`Mado` is a continuation of the work on [TWIN](https://keithp.com/~keithp/talks/twin-ols2005/),\noriginally developed by Keith Packard. 'Mado' means 'window' in the language of\nthe [Tao people](https://en.wikipedia.org/wiki/Tao_people) (also known as Yami),\nan Austronesian ethnic group native to the tiny outlying Orchid Island of Taiwan.\n\n## Principles of design\n\nFocusing on specific hardware capabilities and limitations, `Mado` efficiently\nutilizes limited resources. Over-constraining requirements can limit potential\ntarget environments, but exploring reduced variation can be beneficial.\n\n`Mado` assumes little-to-no graphics acceleration within the framebuffer, which\nis connected to the CPU via a slow link. Therefore, most drawing is done in\nlocal memory, not directly to the framebuffer, ensuring synchronized screen\nupdates and potentially reducing power consumption by minimizing off-chip data\nreferences.\n\nThe system requires a color screen with fixed color mapping. This simplifies\nsoftware by allowing anti-aliased drawing to generate nearly invisible errors\ninstead of visibly incorrect results. Smooth color gradations eliminate the need\nfor dithering or other color-approximating schemes.\n\n`Mado` is designed to ensure respectable CPU performance, which mitigates the\nneed for caching intermediate rendering results like glyph images for text. It\nsupports only a single, general performance class of drawing operations,\nfocusing exclusively on anti-aliased drawing. This focus is practical because\nthe CPUs that `Mado` supports are sufficiently fast, rendering non-anti-aliased\ndrawing obsolete. Moreover, `Mado` avoids reliance on a floating point unit (FPU)\nor extensive FPU emulation by employing its own fixed-point arithmetic for all\nnecessary computations. This approach extends to nearly all of `Mado`'s optional\ncomponents as well. For specific tasks such as subpixel font layout and alpha\nblending, `Mado` utilizes fixed-point math, ensuring that it remains efficient\neven on CPUs without an FPU.\n\nThese environmental limitations enable `Mado` to provide significant\nfunctionality with minimal wasted code. Unlike window systems designed for\nvaried platforms, `Mado` avoids unnecessary generalization and variability,\nbenefiting the entire application stack.\n\n## Build and Verify\n\n### Prerequisites\n\n`Mado` is built with a minimalist design in mind. However, its verification\nrelies on certain third-party packages for full functionality and access to all\nits features. We encourage the development environment to be installed with all optional\npackages, including [libjpeg](https://www.ijg.org/) and [libpng](https://github.com/pnggroup/libpng).\n* macOS: `brew install jpeg libpng`\n* Ubuntu Linux / Debian: `sudo apt install libjpeg-dev libpng-dev`\n\nThe renderer implementation can either use the built-in pixel manipulation or be based on [Pixman](https://pixman.org/).\nThe built-in renderer is simple and performs adequately on platforms without SIMD instructions,\nsuch as RISC-V processors without vector extensions.\nHowever, for modern CPU architectures with extensive ISA extensions, Pixman offers faster pixel manipulation.\nInstall [Pixman](https://pixman.org/) before selecting the corresponding renderer implementation.\n* macOS: `brew install pixman`\n* Ubuntu Linux / Debian: `sudo apt install libpixman-1-dev`\n\nIn the meantime, ensure that you choose a graphics backend and install the necessary packages beforehand.\n\nFor SDL backend, install the [SDL2 library](https://www.libsdl.org/).\n* macOS: `brew install sdl2`\n* Ubuntu Linux / Debian: `sudo apt install libsdl2-dev`\n\nFor the VNC backend, please note that it has only been tested on GNU/Linux, and the prebuilt [neatvnc](https://github.com/any1/neatvnc) package might be outdated. To ensure you have the latest version, you can build the required packages from source by running the script:\n```shell\n$ tools/build-neatvnc.sh\n```\n\nFor Linux framebuffer backend, install `libudev` and `libuuid`:\n* Ubuntu Linux / Debian: `sudo apt install libudev-dev uuid-dev`\n\n### Configuration\n\nConfigure via [Kconfiglib](https://pypi.org/project/kconfiglib/), you should select either SDL video, the Linux framebuffer, or VNC as the graphics backend.\n```shell\n$ make config\n```\n\n### Build and execution\n\nBuild the library and demo program:\n\n```shell\n$ make\n```\n\nTo run demo program with SDL backend:\n\n```shell\n$ ./demo-sdl\n```\n\nOnce the window appears, you should be able to move the windows and interact with the widgets.\n\nTo run demo program with the Linux framebuffer backend:\n\n```shell\n$ sudo ./demo-fbdev\n```\n\nNormal users don't have access to `/dev/fb0` so require `sudo`. Alternatively, you can add the user to the video group to avoid typing `sudo` every time:\n\n```shell\n$ sudo usermod -a -G video $USERNAME\n```\n\nIn addition, the framebuffer device can be assigned via the environment variable `FRAMEBUFFER`.\n\nTo run demo program with the VNC backend:\n\n```shell\n$ ./demo-vnc\n```\n\nThis will start the VNC server. You can use any VNC client to connect using the specified IP address (default is `127.0.0.1`) and port (default is `5900`).\nThe IP address can be set using the `MADO_VNC_HOST` environment variable, and the port can be configured using `MADO_VNC_PORT`.\n\n## License\n\n`Mado` is available under a MIT-style license, permitting liberal commercial use.\nUse of this source code is governed by a MIT license that can be found in the [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysprog21%2Fmado","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysprog21%2Fmado","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysprog21%2Fmado/lists"}