├── .github └── workflows │ ├── build-for-bookworm-wlroots-018.yml │ ├── build-for-fedora41.yml │ ├── build-for-freebsd.yml │ ├── build-for-linux.yml │ ├── build-for-opensuse-tumbleweed.yml │ ├── package-release.yml │ └── publish-doc.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── Templates ├── TEMPLATE.c.tpl └── TEMPLATE.h.tpl ├── apps ├── CMakeLists.txt ├── example_toplevel.c ├── libwlclient │ ├── CMakeLists.txt │ ├── client.c │ ├── dblbuf.c │ ├── dblbuf.h │ ├── icon.c │ ├── icon.h │ ├── libwlclient.h │ ├── xdg_toplevel.c │ └── xdg_toplevel.h ├── primitives │ ├── CMakeLists.txt │ ├── primitives.c │ ├── primitives.h │ ├── segment_display.c │ ├── segment_display.h │ ├── segment_display_16x24.png │ ├── segment_display_6x8.png │ ├── segment_display_7x10.png │ └── segment_display_test.c └── wlmclock.c ├── build-cscope-index.sh ├── cmake ├── EmbedBinary.cmake ├── WaylandProtocol.cmake ├── embed.cmake.in ├── embed_binary.c.in └── embed_binary.h.in ├── doc ├── BUILD.md ├── CMakeLists.txt ├── Doxyfile.in ├── FEATURES.md ├── ROADMAP.md ├── RUN.md ├── commandline.md ├── config.md ├── manual.css ├── manual.md ├── protocols.md └── wlmaker-default-screenshot.png ├── etc ├── CMakeLists.txt ├── root-menu.plist ├── style-debian.plist ├── style.plist ├── wlmaker-example.plist ├── wlmaker-home.plist ├── wlmaker-state.plist └── wlmaker.plist ├── examples ├── CMakeLists.txt └── README.md ├── icons ├── CMakeLists.txt ├── README.md ├── chrome-48x48.png ├── clip-48x48.png ├── firefox-48x48.png ├── terminal-48x48.png └── wlmclock-64x64.png ├── include ├── backend │ ├── backend.h │ ├── output.h │ ├── output_config.h │ └── output_manager.h └── toolkit │ ├── bordered.h │ ├── box.h │ ├── buffer.h │ ├── button.h │ ├── container.h │ ├── content.h │ ├── dock.h │ ├── element.h │ ├── env.h │ ├── fsm.h │ ├── gfxbuf.h │ ├── image.h │ ├── input.h │ ├── layer.h │ ├── lock.h │ ├── menu.h │ ├── menu_item.h │ ├── pane.h │ ├── panel.h │ ├── popup.h │ ├── primitives.h │ ├── rectangle.h │ ├── resizebar.h │ ├── resizebar_area.h │ ├── root.h │ ├── style.h │ ├── surface.h │ ├── test.h │ ├── tile.h │ ├── titlebar.h │ ├── titlebar_button.h │ ├── titlebar_title.h │ ├── toolkit.h │ ├── util.h │ ├── window.h │ └── workspace.h ├── iwyu-mappings.imp ├── libcairo-fontconfig.supp ├── libdrm.supp ├── protocols ├── CMakeLists.txt └── wlmaker-icon-unstable-v1.xml ├── share ├── CMakeLists.txt ├── wlmaker.desktop.in └── wlmclock.desktop.in ├── src ├── CMakeLists.txt ├── action.c ├── action.h ├── action_item.c ├── action_item.h ├── backend │ ├── CMakeLists.txt │ ├── backend.c │ ├── output.c │ ├── output_config.c │ └── output_manager.c ├── background.c ├── background.h ├── backtrace.c ├── backtrace.h ├── clip.c ├── clip.h ├── config.c ├── config.h ├── corner.c ├── corner.h ├── cursor.c ├── cursor.h ├── dock.c ├── dock.h ├── icon_manager.c ├── icon_manager.h ├── idle.c ├── idle.h ├── keyboard.c ├── keyboard.h ├── launcher.c ├── launcher.h ├── layer_panel.c ├── layer_panel.h ├── layer_shell.c ├── layer_shell.h ├── lock_mgr.c ├── lock_mgr.h ├── root_menu.c ├── root_menu.h ├── server.c ├── server.h ├── subprocess_monitor.c ├── subprocess_monitor.h ├── task_list.c ├── task_list.h ├── tl_menu.c ├── tl_menu.h ├── toolkit │ ├── CMakeLists.txt │ ├── bordered.c │ ├── box.c │ ├── buffer.c │ ├── button.c │ ├── container.c │ ├── content.c │ ├── dock.c │ ├── element.c │ ├── env.c │ ├── fsm.c │ ├── gfxbuf.c │ ├── image.c │ ├── layer.c │ ├── lock.c │ ├── menu.c │ ├── menu_item.c │ ├── pane.c │ ├── panel.c │ ├── popup.c │ ├── primitives.c │ ├── rectangle.c │ ├── resizebar.c │ ├── resizebar_area.c │ ├── root.c │ ├── style.c │ ├── surface.c │ ├── test.c │ ├── tile.c │ ├── titlebar.c │ ├── titlebar_button.c │ ├── titlebar_title.c │ ├── toolkit.md │ ├── util.c │ ├── window.c │ └── workspace.c ├── wlmaker.c ├── x11_cursor.xpm ├── xdg_decoration.c ├── xdg_decoration.h ├── xdg_popup.c ├── xdg_popup.h ├── xdg_shell.c ├── xdg_shell.h ├── xdg_toplevel.c ├── xdg_toplevel.h ├── xwl.c ├── xwl.h ├── xwl_content.c ├── xwl_content.h ├── xwl_popup.c ├── xwl_popup.h ├── xwl_toplevel.c └── xwl_toplevel.h ├── tests ├── CMakeLists.txt ├── backend_test.c ├── data │ ├── clip_pressed.png │ ├── clip_raised.png │ └── toolkit │ │ ├── menu_item_disabled.png │ │ ├── menu_item_enabled.png │ │ ├── menu_item_highlighted.png │ │ ├── primitive_close_icon.png │ │ ├── primitive_close_icon_large.png │ │ ├── primitive_fill_adgradient.png │ │ ├── primitive_fill_dgradient.png │ │ ├── primitive_fill_hgradient.png │ │ ├── primitive_fill_solid.png │ │ ├── primitive_fill_vgradient.png │ │ ├── primitive_minimize_icon.png │ │ ├── primitive_minimize_icon_large.png │ │ ├── primitive_text.png │ │ ├── primitive_window_title.png │ │ ├── resizebar_area_pressed.png │ │ ├── resizebar_area_released.png │ │ ├── test_icon.png │ │ ├── title_blurred.png │ │ ├── title_blurred_short.png │ │ ├── title_button_blurred.png │ │ ├── title_button_focussed_pressed.png │ │ ├── title_button_focussed_released.png │ │ └── title_focussed.png ├── toolkit_test.c └── wlmaker_test.c ├── third_party └── protocols │ ├── CMakeLists.txt │ └── wlr-layer-shell-unstable-v1.xml └── valgrind.md /.github/workflows/build-for-bookworm-wlroots-018.yml: -------------------------------------------------------------------------------- 1 | name: Build for Linux (Bookworm, libwlroots-0.18) 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | env: 10 | INSTALL_PATH: "${HOME}/wlmaker" 11 | INSTALL_LIBRARY_PATH: "${HOME}/wlmaker/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)" 12 | INSTALL_PKGCONFIG_PATH: "${HOME}/wlmaker/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/pkgconfig/:${HOME}/wlmaker/share/pkgconfig/" 13 | 14 | jobs: 15 | build_matrix: 16 | strategy: 17 | matrix: 18 | compiler: [ "gcc" ] 19 | runs-on: ubuntu-latest 20 | container: 21 | image: debian:bookworm 22 | 23 | steps: 24 | - name: Install package dependencies. 25 | run: | 26 | apt-get update 27 | apt-get install -y \ 28 | bison \ 29 | clang \ 30 | cmake \ 31 | flex \ 32 | foot \ 33 | git \ 34 | glslang-dev \ 35 | glslang-tools \ 36 | gnustep-base-runtime \ 37 | graphviz \ 38 | libcairo2-dev \ 39 | libgbm-dev \ 40 | libinput-dev \ 41 | libncurses-dev \ 42 | libseat-dev \ 43 | libudev-dev \ 44 | libvulkan-dev \ 45 | libwayland-dev \ 46 | libxcb-composite0-dev \ 47 | libxcb-dri3-dev \ 48 | libxcb-ewmh-dev \ 49 | libxcb-icccm4-dev \ 50 | libxcb-present-dev \ 51 | libxcb-render-util0-dev \ 52 | libxcb-res0-dev \ 53 | libxcb-xinput-dev \ 54 | libxkbcommon-dev \ 55 | libxml2-dev \ 56 | meson \ 57 | plantuml \ 58 | seatd \ 59 | wayland-protocols \ 60 | xmlto \ 61 | xsltproc \ 62 | xwayland 63 | 64 | - name: Checkout code, including git submodules. 65 | uses: actions/checkout@v4 66 | with: 67 | submodules: recursive 68 | 69 | - name: Configure and build dependencies/. 70 | run: | 71 | export CC="${{ matrix.compiler }}" 72 | export PKG_CONFIG_PATH="${{ env.INSTALL_PKGCONFIG_PATH }}" 73 | export LD_LIBRARY_PATH="${{ env.INSTALL_LIBRARY_PATH }}" 74 | export PATH="${PATH}:${{ env.INSTALL_PATH }}/bin" 75 | cmake -DCMAKE_INSTALL_PREFIX:PATH=${{ env.INSTALL_PATH }} dependencies/ -B dependencies/build/ 76 | cmake --build dependencies/build 77 | 78 | - name: Configure wlmaker through CMake. 79 | run: | 80 | export CC="${{ matrix.compiler }}" 81 | export PKG_CONFIG_PATH="${{ env.INSTALL_PKGCONFIG_PATH }}" 82 | export LD_LIBRARY_PATH="${{ env.INSTALL_LIBRARY_PATH }}" 83 | export PATH="${PATH}:${{ env.INSTALL_PATH }}/bin" 84 | cmake -DCMAKE_INSTALL_PREFIX:PATH=${{ env.INSTALL_PATH }} -Dconfig_WERROR=ON -B build/ 85 | 86 | - name: Build wlmaker. 87 | run: | 88 | export CC="${{ matrix.compiler }}" 89 | export LD_LIBRARY_PATH="${{ env.INSTALL_LIBRARY_PATH }}" 90 | export PATH="${PATH}:${{ env.INSTALL_PATH }}/bin" 91 | cmake --build build/ 92 | 93 | - name: Run all tests. 94 | run: | 95 | export LD_LIBRARY_PATH="${{ env.INSTALL_LIBRARY_PATH }}" 96 | ctest --test-dir build/ --build-run-dir build/ -V 97 | -------------------------------------------------------------------------------- /.github/workflows/build-for-fedora41.yml: -------------------------------------------------------------------------------- 1 | name: Build for Fedora Linux 41 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | jobs: 10 | build_matrix: 11 | strategy: 12 | matrix: 13 | compiler: [ "gcc", "clang" ] 14 | runs-on: ubuntu-latest 15 | container: 16 | image: fedora:41 17 | 18 | steps: 19 | - name: Install package dependencies. 20 | run: | 21 | dnf -y upgrade 22 | dnf -y install \ 23 | bison \ 24 | cairo-devel \ 25 | clang \ 26 | cmake \ 27 | flex \ 28 | gcc \ 29 | git \ 30 | ncurses-devel \ 31 | pkg-config \ 32 | plantuml \ 33 | wayland-protocols-devel \ 34 | wlroots-devel \ 35 | xwayland-run 36 | 37 | - name: Checkout code, including git submodules. 38 | uses: actions/checkout@v3 39 | with: 40 | # Not using 'recursive' prevents fetching extra submodules below 41 | # dependencies/. These are only needed to build wlroots from source. 42 | submodules: true 43 | 44 | - name: Configure wlmaker through CMake. 45 | run: | 46 | export CC="${{ matrix.compiler }}" 47 | cmake -B build/ -Dconfig_WERROR=ON 48 | 49 | - name: Build wlmaker. 50 | run: | 51 | export CC="${{ matrix.compiler }}" 52 | cmake --build build/ 53 | 54 | - name: Run all tests. 55 | run: | 56 | ctest --test-dir build/ --build-run-dir build/ -V 57 | -------------------------------------------------------------------------------- /.github/workflows/build-for-freebsd.yml: -------------------------------------------------------------------------------- 1 | name: Build for Free BSD 14.2 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout code, including git submodules. 14 | uses: actions/checkout@v4 15 | with: 16 | submodules: true 17 | 18 | - name: Configure, build and test wlmaker through CMake. 19 | uses: cross-platform-actions/action@v0.26.0 20 | with: 21 | operating_system: freebsd 22 | version: '14.2' 23 | run: | 24 | sudo sed -i '' 's/quarterly/latest/' /etc/pkg/FreeBSD.conf 25 | sudo pkg install -y \ 26 | devel/bison \ 27 | devel/cmake-core \ 28 | devel/evdev-proto \ 29 | devel/libbacktrace \ 30 | devel/libepoll-shim \ 31 | devel/pkgconf \ 32 | graphics/cairo \ 33 | graphics/wayland \ 34 | graphics/wayland-protocols \ 35 | lang/gcc \ 36 | x11-toolkits/wlroots018 \ 37 | x11/libxcb \ 38 | x11/libxkbcommon 39 | cmake -B build/ -Dconfig_WERROR=ON 40 | cmake --build build/ 41 | ctest --test-dir build/ --build-run-dir build/ -V 42 | -------------------------------------------------------------------------------- /.github/workflows/build-for-linux.yml: -------------------------------------------------------------------------------- 1 | name: Build for Linux (Trixie, pre-compiled libwlroots-0.18-dev) 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | jobs: 10 | build_matrix: 11 | strategy: 12 | matrix: 13 | compiler: [ "gcc", "clang" ] 14 | runs-on: ubuntu-latest 15 | container: 16 | image: debian:trixie 17 | 18 | steps: 19 | - name: Install package dependencies. 20 | run: | 21 | apt-get update 22 | apt-get install -y \ 23 | bison \ 24 | clang \ 25 | cmake \ 26 | flex \ 27 | gcc \ 28 | git \ 29 | libbacktrace-dev \ 30 | libcairo2-dev \ 31 | libncurses-dev \ 32 | libwlroots-0.18-dev \ 33 | pkg-config \ 34 | plantuml \ 35 | xwayland 36 | 37 | - name: Checkout code, including git submodules. 38 | uses: actions/checkout@v3 39 | with: 40 | # Not using 'recursive' prevents fetching extra submodules below 41 | # dependencies/. These are only needed to build wlroots from source. 42 | submodules: true 43 | 44 | - name: Configure wlmaker through CMake. 45 | run: | 46 | export CC="${{ matrix.compiler }}" 47 | cmake -B build/ -Dconfig_WERROR=ON 48 | 49 | - name: Build wlmaker. 50 | run: | 51 | export CC="${{ matrix.compiler }}" 52 | cmake --build build/ 53 | 54 | - name: Run all tests. 55 | run: | 56 | ctest --test-dir build/ --build-run-dir build/ -V 57 | -------------------------------------------------------------------------------- /.github/workflows/build-for-opensuse-tumbleweed.yml: -------------------------------------------------------------------------------- 1 | name: Build for openSUSE Tumbleweed 2 | 3 | on: 4 | push: 5 | branches: [ "disabled-main" ] 6 | pull_request: 7 | branches: [ "disabled-main" ] 8 | 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | container: 13 | image: opensuse/tumbleweed 14 | 15 | steps: 16 | - name: Install package dependencies. 17 | run: | 18 | zypper --non-interactive install \ 19 | bison \ 20 | cairo-devel \ 21 | cmake \ 22 | flex \ 23 | gcc \ 24 | git \ 25 | libxcb-devel \ 26 | libxkbcommon-devel \ 27 | ncurses-devel \ 28 | wayland-devel \ 29 | wayland-protocols-devel \ 30 | wlroots-devel \ 31 | xwayland-devel 32 | 33 | - name: Checkout code, including git submodules. 34 | uses: actions/checkout@v3 35 | with: 36 | # Not using 'recursive' prevents fetching extra submodules below 37 | # dependencies/. These are only needed to build wlroots from source. 38 | submodules: true 39 | 40 | - name: Configure wlmaker through CMake. 41 | run: | 42 | cmake -B build/ -Dconfig_WERROR=ON 43 | 44 | - name: Build wlmaker. 45 | run: | 46 | cmake --build build/ 47 | 48 | - name: Run all tests. 49 | run: | 50 | ctest --test-dir build/ --build-run-dir build/ -V 51 | -------------------------------------------------------------------------------- /.github/workflows/package-release.yml: -------------------------------------------------------------------------------- 1 | name: Create source package for release 2 | # Needing this, because wlmaker uses submodules, and github source package 3 | # creation will not include submodules -- and cannot be tuned for that. 4 | # See: https://github.com/phkaeser/wlmaker/issues/133 5 | 6 | on: 7 | push: 8 | branches: 9 | - main 10 | tags: 11 | - v* 12 | release: 13 | types: 14 | - published 15 | 16 | jobs: 17 | release: 18 | name: Create Release 19 | if: startsWith(github.ref, 'refs/tags/') 20 | runs-on: ubuntu-latest 21 | 22 | steps: 23 | - name: Checkout code, including required submodules. 24 | uses: actions/checkout@v3 25 | with: 26 | # Not using 'recursive' prevents fetching extra submodules below 27 | # dependencies/. These are only needed to build wlroots from source. 28 | submodules: true 29 | 30 | - name: Create source package. 31 | run: | 32 | export WLM_VERSION="$(echo "${{ github.ref }}" | sed "s/^refs\/tags\/v//")" 33 | # Setup folder with package name, for apprropriate unpacking. 34 | rm -rf "/tmp/wlmaker-${WLM_VERSION}" 35 | cp -a "${PWD}" "/tmp/wlmaker-${WLM_VERSION}" 36 | mv "/tmp/wlmaker-${WLM_VERSION}" . 37 | tar -zcvf "wlmaker-${WLM_VERSION}.tar.gz" "wlmaker-${WLM_VERSION}" 38 | echo "WLM_ARCHIVE=wlmaker-${WLM_VERSION}.tar.gz" >> "${GITHUB_ENV}" 39 | echo "Created source archive wlmaker-${WLM_VERSION}.tar.gz." 40 | 41 | - name: Upload source package. 42 | uses: softprops/action-gh-release@v1 43 | with: 44 | files: ${{env.WLM_ARCHIVE}} 45 | -------------------------------------------------------------------------------- /.github/workflows/publish-doc.yml: -------------------------------------------------------------------------------- 1 | name: Generate and publish Documentation 2 | 3 | on: 4 | # The principal run is on pushes targeting the default branch. 5 | push: 6 | branches: [ "main" ] 7 | # We also run on pull requests towards main, to catch issues with generating 8 | # the documentation before they're merged. 9 | pull_request: 10 | branches: [ "main" ] 11 | 12 | # Allows you to run this workflow manually from the Actions tab. 13 | workflow_dispatch: 14 | 15 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 16 | permissions: 17 | contents: read 18 | pages: write 19 | id-token: write 20 | 21 | # Allow only one concurrent deployment, skipping runs queued between the run 22 | # in-progress and latest queued. However, do NOT cancel in-progress runs as we 23 | # want to allow these production deployments to complete. 24 | concurrency: 25 | group: "pages" 26 | cancel-in-progress: false 27 | 28 | jobs: 29 | # Generate documentation, in a container. 30 | generate_doc: 31 | name: "Generate documentation" 32 | runs-on: ubuntu-latest 33 | container: 34 | image: debian:trixie 35 | 36 | steps: 37 | - name: Install package dependencies. 38 | run: | 39 | apt-get update 40 | apt-get install -y \ 41 | bison \ 42 | cmake \ 43 | doxygen \ 44 | flex \ 45 | gcc \ 46 | git \ 47 | libcairo2-dev \ 48 | libncurses-dev \ 49 | libwlroots-0.18-dev \ 50 | pkg-config \ 51 | plantuml 52 | 53 | - name: Checkout code, including git submodules. 54 | uses: actions/checkout@v3 55 | with: 56 | submodules: true 57 | 58 | - name: Configure wlmaker through CMake, with doxygen. 59 | run: | 60 | cmake -Dconfig_DOXYGEN_CRITICAL=ON -B build/ 61 | 62 | - name: Build documentation. 63 | run: cmake --build build/ --target doc 64 | 65 | - name: Configure GitHub Pages. 66 | uses: actions/configure-pages@v5 67 | 68 | - name: Upload the generated documentation. 69 | uses: actions/upload-pages-artifact@v3 70 | with: 71 | # Upload entire repository 72 | path: 'build/doc/html/' 73 | 74 | # Deploys the uploaded documentation to GitHub Pages. 75 | deploy: 76 | name: "Deploy the generated documentation" 77 | environment: 78 | name: github-pages 79 | url: ${{ steps.deployment.outputs.page_url }} 80 | runs-on: ubuntu-latest 81 | needs: generate_doc 82 | # Skip deployment unless it's the "push" on "main". 83 | if: ${{ github.event_name == 'push' }} 84 | steps: 85 | - name: Deploy to GitHub Pages. 86 | id: deployment 87 | uses: actions/deploy-pages@v4 88 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/*~ 2 | **/CMakeFiles/* 3 | **/CMakeCache.txt 4 | **/build/* 5 | **/build-clang/* 6 | TAGS 7 | cscope.files 8 | cscope.in.out 9 | cscope.out 10 | cscope.po.out -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "submodules/libbase"] 2 | path = submodules/libbase 3 | url = https://github.com/phkaeser/libbase.git 4 | branch = main 5 | update = rebase 6 | [submodule "examples/gtk-layer-shell"] 7 | path = examples/gtk-layer-shell 8 | url = https://github.com/wmww/gtk-layer-shell.git 9 | [submodule "dependencies"] 10 | path = dependencies 11 | url = https://github.com/phkaeser/wlmaker-dependencies.git 12 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We would love to accept your patches and contributions to this project. 4 | 5 | ## Before you begin 6 | 7 | ### Sign our Contributor License Agreement 8 | 9 | Contributions to this project must be accompanied by a 10 | [Contributor License Agreement](https://cla.developers.google.com/about) (CLA). 11 | You (or your employer) retain the copyright to your contribution; this simply 12 | gives us permission to use and redistribute your contributions as part of the 13 | project. 14 | 15 | If you or your current employer have already signed the Google CLA (even if it 16 | was for a different project), you probably don't need to do it again. 17 | 18 | Visit to see your current agreements or to 19 | sign a new one. 20 | 21 | ### Review our Community Guidelines 22 | 23 | This project follows [Google's Open Source Community 24 | Guidelines](https://opensource.google/conduct/). 25 | 26 | ## Contribution process 27 | 28 | ### Code Reviews 29 | 30 | All submissions, including submissions by project members, require review. We 31 | use [GitHub pull requests](https://docs.github.com/articles/about-pull-requests) 32 | for this purpose. 33 | -------------------------------------------------------------------------------- /Templates/TEMPLATE.c.tpl: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file (>>>FILE<<<) 4 | * 5 | * @copyright 6 | * Copyright (>>>YEAR<<<) Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | (>>>POINT<<<) 22 | 23 | /* == Declarations ========================================================= */ 24 | 25 | /* == Data ================================================================= */ 26 | 27 | /* == Exported methods ===================================================== */ 28 | 29 | /* == Local (static) methods =============================================== */ 30 | 31 | /* == Unit Tests =========================================================== */ 32 | 33 | /* == End of (>>>FILE<<<) ================================================== */ 34 | -------------------------------------------------------------------------------- /Templates/TEMPLATE.h.tpl: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file (>>>FILE<<<) 4 | * 5 | * @copyright 6 | * Copyright (>>>YEAR<<<) Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __(>>>FILE_UPCASE<<<)_H__ 21 | #define __(>>>FILE_UPCASE<<<)_H__ 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif // __cplusplus 26 | 27 | (>>>POINT<<<) 28 | 29 | #ifdef __cplusplus 30 | } // extern "C" 31 | #endif // __cplusplus 32 | 33 | #endif /* __(>>>FILE_UPCASE<<<)_H__ */ 34 | /* == End of (>>>FILE<<<) ================================================== */ 35 | -------------------------------------------------------------------------------- /apps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | CMAKE_MINIMUM_REQUIRED(VERSION 3.13) 16 | 17 | ADD_SUBDIRECTORY(libwlclient) 18 | ADD_SUBDIRECTORY(primitives) 19 | 20 | ADD_EXECUTABLE(wlmclock wlmclock.c) 21 | TARGET_INCLUDE_DIRECTORIES(wlmclock PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 22 | TARGET_LINK_LIBRARIES(wlmclock libwlclient primitives m) 23 | 24 | ADD_EXECUTABLE(example_toplevel example_toplevel.c) 25 | TARGET_INCLUDE_DIRECTORIES(example_toplevel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 26 | TARGET_LINK_LIBRARIES(example_toplevel m libwlclient) 27 | 28 | INSTALL(TARGETS wlmclock DESTINATION bin) 29 | 30 | IF(iwyu_path_and_options) 31 | SET_TARGET_PROPERTIES( 32 | wlmclock PROPERTIES 33 | C_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}") 34 | SET_TARGET_PROPERTIES( 35 | example_toplevel PROPERTIES 36 | C_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}") 37 | ENDIF(iwyu_path_and_options) 38 | -------------------------------------------------------------------------------- /apps/libwlclient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | CMAKE_MINIMUM_REQUIRED(VERSION 3.13) 16 | INCLUDE(WaylandProtocol) 17 | 18 | PKG_CHECK_MODULES(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client>=1.22.0) 19 | PKG_CHECK_MODULES(WAYLAND_PROTOCOLS REQUIRED IMPORTED_TARGET wayland-protocols>=1.32) 20 | 21 | PKG_GET_VARIABLE(WAYLAND_PROTOCOL_DIR wayland-protocols pkgdatadir) 22 | 23 | ADD_LIBRARY(libwlclient STATIC) 24 | 25 | SET(PUBLIC_HEADER_FILES 26 | dblbuf.h 27 | icon.h 28 | libwlclient.h 29 | xdg_toplevel.h 30 | ) 31 | SET_TARGET_PROPERTIES( 32 | libwlclient PROPERTIES 33 | VERSION 1.0 34 | PUBLIC_HEADER "${PUBLIC_HEADER_FILES}") 35 | 36 | SET(SOURCES 37 | client.c 38 | dblbuf.c 39 | icon.c 40 | xdg_toplevel.c 41 | ) 42 | WaylandProtocol_ADD( 43 | SOURCES 44 | BASE_NAME xdg-decoration 45 | PROTOCOL_FILE "${WAYLAND_PROTOCOL_DIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml" 46 | SIDE client) 47 | WaylandProtocol_ADD( 48 | SOURCES 49 | BASE_NAME xdg-shell 50 | PROTOCOL_FILE "${WAYLAND_PROTOCOL_DIR}/stable/xdg-shell/xdg-shell.xml" 51 | SIDE client) 52 | WaylandProtocol_ADD( 53 | SOURCES 54 | BASE_NAME wlmaker-icon-unstable-v1 55 | PROTOCOL_FILE "${PROJECT_SOURCE_DIR}/protocols/wlmaker-icon-unstable-v1.xml" 56 | SIDE client) 57 | 58 | TARGET_SOURCES(libwlclient PRIVATE ${SOURCES}) 59 | 60 | TARGET_INCLUDE_DIRECTORIES( 61 | libwlclient PRIVATE 62 | ${WAYLAND_CLIENT_INCLUDE_DIRS} 63 | ${XKBCOMMON_INCLUDE_DIRS} 64 | ${CMAKE_CURRENT_BINARY_DIR}) 65 | TARGET_LINK_LIBRARIES( 66 | libwlclient 67 | libbase 68 | PkgConfig::WAYLAND_CLIENT 69 | PkgConfig::XKBCOMMON) 70 | INCLUDE(CheckSymbolExists) 71 | CHECK_SYMBOL_EXISTS(signalfd "sys/signalfd.h" HAVE_SIGNALFD) 72 | IF(NOT HAVE_SIGNALFD) 73 | PKG_CHECK_MODULES(EPOLL REQUIRED IMPORTED_TARGET epoll-shim) 74 | TARGET_LINK_LIBRARIES(libwlclient PkgConfig::EPOLL) 75 | ENDIF() 76 | 77 | IF(iwyu_path_and_options) 78 | SET_TARGET_PROPERTIES( 79 | libwlclient PROPERTIES 80 | C_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}") 81 | ENDIF(iwyu_path_and_options) 82 | -------------------------------------------------------------------------------- /apps/libwlclient/dblbuf.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file dblbuf.h 4 | * 5 | * Functions for working with a double buffer on a wayland surface. 6 | * 7 | * @copyright 8 | * Copyright 2025 Google LLC 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); 11 | * you may not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * https://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | */ 22 | #ifndef __WLCL_DBLBUF_H__ 23 | #define __WLCL_DBLBUF_H__ 24 | 25 | #include 26 | #include 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif // __cplusplus 31 | 32 | struct wl_shm; 33 | struct wl_surface; 34 | 35 | /** Forward declaration: Double buffer state. */ 36 | typedef struct _wlcl_dblbuf_t wlcl_dblbuf_t; 37 | 38 | /** Callback that indicates the buffer is ready to draw into. */ 39 | typedef bool (*wlcl_dblbuf_ready_callback_t)( 40 | bs_gfxbuf_t *gfxbuf_ptr, 41 | void *ud_ptr); 42 | 43 | /** 44 | * Creates a double buffer for the surface with provided dimensions. 45 | * 46 | * @param app_id_ptr 47 | * @param wl_surface_ptr 48 | * @param wl_shm_ptr 49 | * @param width 50 | * @param height 51 | * 52 | * @return Pointer to state of the double buffer, or NULL on error. Call 53 | * @ref wlcl_dblbuf_destroy for freeing up the associated resources. 54 | */ 55 | wlcl_dblbuf_t *wlcl_dblbuf_create( 56 | const char *app_id_ptr, 57 | struct wl_surface *wl_surface_ptr, 58 | struct wl_shm *wl_shm_ptr, 59 | unsigned width, 60 | unsigned height); 61 | 62 | /** Destroys the double buffer. */ 63 | void wlcl_dblbuf_destroy(wlcl_dblbuf_t *dblbuf_ptr); 64 | 65 | /** 66 | * Registers a callback for when a frame can be drawn into the buffer. 67 | * 68 | * The frame can be drawn if (1) it is due, and (2) there is a back buffer 69 | * available ("released") for drawing into. If these conditions hold true, 70 | * `callback` will be called right away. Otherwise, it will be called once 71 | * these conditions are fulfilled. 72 | * 73 | * The callback will be called only once. If the client wishes further 74 | * notifications, they must call @ref wlcl_dblbuf_register_ready_callback 75 | * again. 76 | * 77 | * The callback must be registered only after the surface is ready. Eg. for 78 | * an XDG toplevel, after it has received & acknowledged `configure`. 79 | * 80 | * @param dblbuf_ptr 81 | * @param callback The callback function, or NULL to clear the 82 | * callback. 83 | * @param callback_ud_ptr Argument to use for `callback`. 84 | */ 85 | void wlcl_dblbuf_register_ready_callback( 86 | wlcl_dblbuf_t *dblbuf_ptr, 87 | wlcl_dblbuf_ready_callback_t callback, 88 | void *callback_ud_ptr); 89 | 90 | #ifdef __cplusplus 91 | } // extern "C" 92 | #endif // __cplusplus 93 | 94 | #endif /* __WLCL_DBLBUF_H__ */ 95 | /* == End of dblbuf_buffer.h =============================================== */ 96 | -------------------------------------------------------------------------------- /apps/libwlclient/icon.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file icon.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __LIBWLCLIENT_ICON_H__ 21 | #define __LIBWLCLIENT_ICON_H__ 22 | 23 | #include 24 | #include 25 | 26 | #include "libwlclient.h" // IWYU pragma: keep 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif // __cplusplus 31 | 32 | /** Forward declaration of an icon's state. */ 33 | typedef struct _wlclient_icon_t wlclient_icon_t; 34 | 35 | /** 36 | * Creates an icon. 37 | * 38 | * @param wlclient_ptr 39 | * 40 | * @return An icon state or NULL on error. The state must be free'd by calling 41 | * @ref wlclient_icon_destroy. 42 | */ 43 | wlclient_icon_t *wlclient_icon_create( 44 | wlclient_t *wlclient_ptr); 45 | 46 | /** 47 | * Destroys the icon. 48 | * 49 | * @param icon_ptr 50 | */ 51 | void wlclient_icon_destroy( 52 | wlclient_icon_t *icon_ptr); 53 | 54 | /** 55 | * Returns whether the icon protocol is supported on the client. 56 | * 57 | * @param wlclient_ptr 58 | */ 59 | bool wlclient_icon_supported(wlclient_t *wlclient_ptr); 60 | 61 | /** 62 | * Sets a callback to invoke when the background buffer is ready for drawing. 63 | * 64 | * @see wlcl_dblbuf_register_ready_callback. 65 | * 66 | * @param icon_ptr 67 | * @param callback 68 | * @param ud_ptr 69 | */ 70 | void wlclient_icon_register_ready_callback( 71 | wlclient_icon_t *icon_ptr, 72 | bool (*callback)(bs_gfxbuf_t *gfxbuf_ptr, void *ud_ptr), 73 | void *ud_ptr); 74 | 75 | #ifdef __cplusplus 76 | } // extern "C" 77 | #endif // __cplusplus 78 | 79 | #endif /* __LIBWLCLIENT_ICON_H__ */ 80 | /* == End of icon.h ======================================================== */ 81 | -------------------------------------------------------------------------------- /apps/libwlclient/xdg_toplevel.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file xdg_toplevel.h 4 | * 5 | * @copyright 6 | * Copyright 2024 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __LIBWLCLIENT_XDG_TOPLEVEL_H__ 21 | #define __LIBWLCLIENT_XDG_TOPLEVEL_H__ 22 | 23 | #include 24 | #include 25 | 26 | #include "libwlclient.h" // IWYU pragma: keep 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif // __cplusplus 31 | 32 | /** Forward declaration: State of the toplevel. */ 33 | typedef struct _wlclient_xdg_toplevel_t wlclient_xdg_toplevel_t; 34 | 35 | /** 36 | * Creates a XDG toplevel. 37 | * 38 | * @param wlclient_ptr 39 | * @param title_ptr 40 | * @param width 41 | * @param height 42 | * 43 | * @return State of the toplevel or NULL on error. 44 | */ 45 | wlclient_xdg_toplevel_t *wlclient_xdg_toplevel_create( 46 | wlclient_t *wlclient_ptr, 47 | const char *title_ptr, 48 | unsigned width, 49 | unsigned height); 50 | 51 | /** 52 | * Destroys the XDG toplevel. 53 | * 54 | * @param toplevel_ptr 55 | */ 56 | void wlclient_xdg_toplevel_destroy(wlclient_xdg_toplevel_t *toplevel_ptr); 57 | 58 | /** 59 | * Returns whether the XDG shell protocol is supported on the client. 60 | * 61 | * @param wlclient_ptr 62 | */ 63 | bool wlclient_xdg_supported(wlclient_t *wlclient_ptr); 64 | 65 | /** 66 | * Registers the callback to notify when the buffer is ready to draw into. 67 | * 68 | * @param toplevel_ptr 69 | * @param callback 70 | * @param callback_ud_ptr 71 | */ 72 | void wlclient_xdg_toplevel_register_ready_callback( 73 | wlclient_xdg_toplevel_t *toplevel_ptr, 74 | bool (*callback)(bs_gfxbuf_t *gfxbuf_ptr, void *ud_ptr), 75 | void *callback_ud_ptr); 76 | 77 | #ifdef __cplusplus 78 | } // extern "C" 79 | #endif // __cplusplus 80 | 81 | #endif /* __LIBWLCLIENT_XDG_TOPLEVEL_H__ */ 82 | /* == End of xdg_toplevel.h ================================================== */ 83 | -------------------------------------------------------------------------------- /apps/primitives/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | CMAKE_MINIMUM_REQUIRED(VERSION 3.13) 16 | 17 | ADD_LIBRARY(primitives STATIC) 18 | TARGET_SOURCES( 19 | primitives PRIVATE 20 | primitives.h primitives.c 21 | segment_display.h segment_display.c) 22 | TARGET_INCLUDE_DIRECTORIES( 23 | primitives PRIVATE) 24 | TARGET_LINK_LIBRARIES( 25 | primitives 26 | libbase) 27 | 28 | ADD_EXECUTABLE(segment_display_test 29 | segment_display_test.c 30 | segment_display.c 31 | segment_display.h) 32 | TARGET_COMPILE_DEFINITIONS( 33 | segment_display_test PRIVATE 34 | TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}") 35 | TARGET_INCLUDE_DIRECTORIES( 36 | segment_display_test PRIVATE 37 | ${CAIRO_INCLUDE_DIRS}) 38 | TARGET_LINK_LIBRARIES( 39 | segment_display_test PRIVATE 40 | libbase 41 | PkgConfig::CAIRO) 42 | ADD_TEST( 43 | NAME segment_display_test 44 | COMMAND segment_display_test) 45 | 46 | IF(iwyu_path_and_options) 47 | SET_TARGET_PROPERTIES( 48 | primitives PROPERTIES 49 | C_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}") 50 | SET_TARGET_PROPERTIES( 51 | segment_display_test PROPERTIES 52 | C_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}") 53 | ENDIF(iwyu_path_and_options) 54 | -------------------------------------------------------------------------------- /apps/primitives/primitives.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file primitives.c 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #include "primitives.h" 22 | 23 | /* == Exported methods ===================================================== */ 24 | 25 | /* ------------------------------------------------------------------------- */ 26 | void wlm_primitives_set_bezel_color( 27 | cairo_t *cairo_ptr, 28 | bool illuminated) 29 | { 30 | if (illuminated) { 31 | cairo_set_source_rgba(cairo_ptr, 1.0, 1.0, 1.0, 0.6); 32 | } else { 33 | cairo_set_source_rgba(cairo_ptr, 0.0, 0.0, 0.0, 0.4); 34 | } 35 | } 36 | 37 | /* ------------------------------------------------------------------------- */ 38 | void wlm_primitives_draw_bezel_at( 39 | cairo_t *cairo_ptr, 40 | int x, 41 | int y, 42 | unsigned width, 43 | unsigned height, 44 | double bezel_width, 45 | bool raised) 46 | { 47 | cairo_save(cairo_ptr); 48 | cairo_set_line_width(cairo_ptr, 0); 49 | 50 | // Northwestern corner is illuminted when raised. 51 | wlm_primitives_set_bezel_color(cairo_ptr, raised); 52 | cairo_move_to(cairo_ptr, x, y); 53 | cairo_line_to(cairo_ptr, x + width, y + 0); 54 | cairo_line_to(cairo_ptr, x + width - bezel_width, y + bezel_width); 55 | cairo_line_to(cairo_ptr, x + bezel_width, y + bezel_width); 56 | cairo_line_to(cairo_ptr, x + bezel_width, y + height - bezel_width); 57 | cairo_line_to(cairo_ptr, x + 0, y + height); 58 | cairo_line_to(cairo_ptr, x + 0, y + 0); 59 | cairo_fill(cairo_ptr); 60 | 61 | // Southeastern corner is illuminated when sunken. 62 | wlm_primitives_set_bezel_color(cairo_ptr, !raised); 63 | cairo_move_to(cairo_ptr, x + width, y + height); 64 | cairo_line_to(cairo_ptr, x + 0, y + height); 65 | cairo_line_to(cairo_ptr, x + bezel_width, y + height - bezel_width); 66 | cairo_line_to(cairo_ptr, x + width - bezel_width, y + height - bezel_width); 67 | cairo_line_to(cairo_ptr, x + width - bezel_width, y + bezel_width); 68 | cairo_line_to(cairo_ptr, x + width, y + 0); 69 | cairo_line_to(cairo_ptr, x + width, y + height); 70 | cairo_fill(cairo_ptr); 71 | 72 | cairo_restore(cairo_ptr); 73 | } 74 | 75 | /* == End of primitives.c ================================================== */ 76 | -------------------------------------------------------------------------------- /apps/primitives/primitives.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file primitives.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLM_PRIMITIVES_H__ 21 | #define __WLM_PRIMITIVES_H__ 22 | 23 | #include 24 | #include 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif // __cplusplus 29 | 30 | /** 31 | * Sets the bezel color. 32 | * 33 | * Note: Window Maker draws the bezel by adding 80 (0x50) to each R, G, B of 34 | * the underlying title for the illuminated side; respectively by subtracting 35 | * 40 (0x28) on the non-illuminated side. 36 | * We are using cairo's overlaying with the respective "alpha" values below, 37 | * which leads to different results. 38 | * 39 | * @param cairo_ptr 40 | * @param illuminated 41 | */ 42 | void wlm_primitives_set_bezel_color( 43 | cairo_t *cairo_ptr, 44 | bool illuminated); 45 | 46 | /** 47 | * Draws a bezel into the cairo, at specified position and width/height. 48 | * 49 | * TODO(kaeser@gubbe.ch): Share this code with the server. 50 | * 51 | * @param cairo_ptr A cairo, backed by an image surface. 52 | * @param x 53 | * @param y 54 | * @param width 55 | * @param height 56 | * @param bezel_width 57 | * @param raised Whether the bezel is to highlight a raised (true) 58 | * or pressed (false) state. 59 | */ 60 | void wlm_primitives_draw_bezel_at( 61 | cairo_t *cairo_ptr, 62 | int x, 63 | int y, 64 | unsigned width, 65 | unsigned height, 66 | double bezel_width, 67 | bool raised); 68 | 69 | #ifdef __cplusplus 70 | } // extern "C" 71 | #endif // __cplusplus 72 | 73 | #endif /* __WLM_PRIMITIVES_H__ */ 74 | /* == End of primitives.h ================================================== */ 75 | -------------------------------------------------------------------------------- /apps/primitives/segment_display.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file segment_display.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLM_SEGMENT_DISPLAY_H__ 21 | #define __WLM_SEGMENT_DISPLAY_H__ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif // __cplusplus 31 | 32 | /** Parameters to describe segment properties. */ 33 | typedef struct { 34 | /** Offset distance, from origin to start of segment. */ 35 | double offset; 36 | /** Full width of the segment, along the lateral direction. */ 37 | double width; 38 | /** Length of a horizontal segment, along longitudinal direction. */ 39 | double hlength; 40 | /** Length of a vertical segment, along longitudinal direction. */ 41 | double vlength; 42 | } wlm_cairo_7segment_param_t; 43 | 44 | /** Parameters for a 6x8-pixel-sized 7-segment digit display. */ 45 | extern const wlm_cairo_7segment_param_t wlm_cairo_7segment_param_6x8; 46 | /** Parameters for a 7x10-pixel-sized 7-segment digit display. */ 47 | extern const wlm_cairo_7segment_param_t wlm_cairo_7segment_param_7x10; 48 | /** Parameters for a 8x12-pixel-sized 7-segment digit display. */ 49 | extern const wlm_cairo_7segment_param_t wlm_cairo_7segment_param_8x12; 50 | /** Parameters for a 16x24-pixel-sized 7-segment digit display. */ 51 | extern const wlm_cairo_7segment_param_t wlm_cairo_7segment_param_16x24; 52 | 53 | /** 54 | * Draws a digit using 7-segment visualization. 55 | * 56 | * @param cairo_ptr The `cairo_t` target to draw the digits to. 57 | * @param param_ptr Visualization parameters for the segments. 58 | * @param x X coordinate of lower left corner. 59 | * @param y Y coordinate of lower left corner. 60 | * @param color_on An ARGB32 value for an illuminated segment. 61 | * @param color_off An ARGB32 value for a non-illuminated segment. 62 | * @param digit Digit to draw. Must be 0 <= digit < 10. 63 | */ 64 | void wlm_cairo_7segment_display_digit( 65 | cairo_t *cairo_ptr, 66 | const wlm_cairo_7segment_param_t *param_ptr, 67 | uint32_t x, 68 | uint32_t y, 69 | uint32_t color_on, 70 | uint32_t color_off, 71 | uint8_t digit); 72 | 73 | /** Unit test cases. */ 74 | extern const bs_test_case_t wlm_cairo_segment_display_test_cases[]; 75 | 76 | #ifdef __cplusplus 77 | } // extern "C" 78 | #endif // __cplusplus 79 | 80 | #endif /* __WLM_SEGMENT_DISPLAY_H__ */ 81 | /* == End of segment_display.h ============================================= */ 82 | -------------------------------------------------------------------------------- /apps/primitives/segment_display_16x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/apps/primitives/segment_display_16x24.png -------------------------------------------------------------------------------- /apps/primitives/segment_display_6x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/apps/primitives/segment_display_6x8.png -------------------------------------------------------------------------------- /apps/primitives/segment_display_7x10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/apps/primitives/segment_display_7x10.png -------------------------------------------------------------------------------- /apps/primitives/segment_display_test.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file cairo_segment_display_test.c 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | #include "segment_display.h" 25 | 26 | /** Unit tests. */ 27 | const bs_test_set_t tests[] = { 28 | { 1, "segment_dipslay", wlm_cairo_segment_display_test_cases }, 29 | { 0, NULL, NULL } 30 | }; 31 | 32 | #if !defined(TEST_DATA_DIR) 33 | /** Directory root for looking up test data. See `bs_test_resolve_path`. */ 34 | #define TEST_DATA_DIR "./" 35 | #endif // TEST_DATA_DIR 36 | 37 | /** Main program, runs the unit tests. */ 38 | int main(int argc, const char **argv) 39 | { 40 | const bs_test_param_t params = { 41 | .test_data_dir_ptr = TEST_DATA_DIR 42 | }; 43 | return bs_test(tests, argc, argv, ¶ms); 44 | } 45 | 46 | /* == End of segment_display_test.c ======================================== */ 47 | -------------------------------------------------------------------------------- /build-cscope-index.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Generates Cscope index for wlmaker and all dependencies. 3 | 4 | set -o errexit 5 | 6 | SUBPATHS="\ 7 | dependencies \ 8 | include \ 9 | src \ 10 | submodules" 11 | 12 | base_path="$(readlink -f "$(dirname "${0}")")" 13 | rm -f "${base_path}/cscope.files" 14 | 15 | for p in ${SUBPATHS} ; do 16 | echo "Processing ${base_path}/${p} ..." 17 | find "${base_path}/${p}" -name "*.h" -o -name "*.c" -o -name "*.cpp" | xargs etags 18 | find "${base_path}/${p}" -name "*.h" -o -name "*.c" -o -name "*.cpp" >> cscope.files 19 | done 20 | 21 | cscope -Rbkq -i cscope.files 2>/dev/null 22 | echo "Done." 23 | exit 0 24 | -------------------------------------------------------------------------------- /cmake/EmbedBinary.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | CMAKE_MINIMUM_REQUIRED(VERSION 3.13) 16 | 17 | # During the INCLUDE() call, CMAKE_CURRENT_LIST_DIR is this file's path. 18 | # Store it for later, during the FUNCTION() call it'll be the caller's path. 19 | SET(EMBED_BINARY_TEMPLATE_DIR ${CMAKE_CURRENT_LIST_DIR}) 20 | 21 | # Adds a static C library to embed the binary file with the specified prefix. 22 | # 23 | # Generates a C source and header file from the contents of `binary_file`, and 24 | # adds both of these to a new library target `library_target`. 25 | # 26 | # The embedded data can then be accessed as external variables: 27 | # 28 | # #include ".h" 29 | # 30 | # * uint8_t embedded_binary__data[]; 31 | # * const size_t embedded_binary__size; 32 | FUNCTION(EmbedBinary_ADD_LIBRARY library_target prefix binary_file) 33 | 34 | SET(output_basename "${CMAKE_CURRENT_BINARY_DIR}/${prefix}") 35 | SET(output_source "${output_basename}.c") 36 | SET(output_header "${output_basename}.h") 37 | SET(generated_cmake "${output_basename}.cmake") 38 | 39 | SET(template_header "${EMBED_BINARY_TEMPLATE_DIR}/embed_binary.h.in") 40 | SET(template_source "${EMBED_BINARY_TEMPLATE_DIR}/embed_binary.c.in") 41 | 42 | CONFIGURE_FILE( 43 | "${EMBED_BINARY_TEMPLATE_DIR}/embed.cmake.in" 44 | "${generated_cmake}" 45 | @ONLY) 46 | 47 | ADD_CUSTOM_COMMAND( 48 | OUTPUT "${output_source}" "${output_header}" 49 | COMMAND ${CMAKE_COMMAND} -P "${generated_cmake}" 50 | MAIN_DEPENDENCY "${binary_file}" 51 | DEPENDS "${generated_cmake}" "${template_header}" "${template_source}" 52 | ) 53 | 54 | ADD_LIBRARY(${library_target} STATIC) 55 | TARGET_SOURCES( 56 | ${library_target} PRIVATE 57 | "${output_source}" 58 | "${output_header}") 59 | TARGET_INCLUDE_DIRECTORIES( 60 | ${library_target} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") 61 | SET_TARGET_PROPERTIES( 62 | ${library_target} 63 | PROPERTIES VERSION 1.0 64 | PUBLIC_HEADER "${output_header}") 65 | 66 | ENDFUNCTION() 67 | -------------------------------------------------------------------------------- /cmake/WaylandProtocol.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FIND_PROGRAM( 16 | WaylandScanner_EXECUTABLE 17 | NAMES wayland-scanner) 18 | MARK_AS_ADVANCED(WaylandScanner_EXECUTABLE) 19 | 20 | FIND_PACKAGE_HANDLE_STANDARD_ARGS( 21 | WaylandScanner 22 | FOUND_VAR WaylandScanner_FOUND 23 | REQUIRED_VARS WaylandScanner_EXECUTABLE) 24 | 25 | # ----------------------------------------------------------------------------- 26 | # Adds the wayland protocol's header and glue code to . 27 | FUNCTION(WaylandProtocol_ADD target_var) 28 | IF(NOT WaylandScanner_EXECUTABLE) 29 | MESSAGE(FATAL_ERROR "'wayland-scanner' executable required, not found.") 30 | ENDIF() 31 | 32 | # Parse and verify arguments. 33 | SET(oneValueArgs PROTOCOL_FILE BASE_NAME SIDE) 34 | CMAKE_PARSE_ARGUMENTS(ARGS "" "${oneValueArgs}" "" ${ARGN}) 35 | IF(NOT ${ARGS_SIDE} STREQUAL "client" AND NOT ${ARGS_SIDE} STREQUAL "server") 36 | MESSAGE(FATAL_ERROR "SIDE arg must be \"client\" or \"server\".") 37 | ENDIF() 38 | IF(ARGS_UNPARSED_ARGUMENTS) 39 | MESSAGE(FATAL_ERROR "Unknown args passed to _wayland_protocol_add: \"${ARGS_UNPARSED_ARGUMENTS}\"") 40 | ENDIF(ARGS_UNPARSED_ARGUMENTS) 41 | 42 | GET_FILENAME_COMPONENT(_protocol_file ${ARGS_PROTOCOL_FILE} ABSOLUTE) 43 | 44 | # Generate the client header. 45 | SET(_header "${CMAKE_CURRENT_BINARY_DIR}/${ARGS_BASE_NAME}-${ARGS_SIDE}-protocol.h") 46 | SET_SOURCE_FILES_PROPERTIES(${_header} GENERATED) 47 | ADD_CUSTOM_COMMAND( 48 | OUTPUT ${_header} 49 | COMMAND ${WaylandScanner_EXECUTABLE} "${ARGS_SIDE}-header" ${_protocol_file} ${_header} 50 | DEPENDS ${WaylandScanner_EXECUTABLE} ${_protocol_file} 51 | VERBATIM) 52 | 53 | # Generate the glue code. 54 | SET(_glue_code "${CMAKE_CURRENT_BINARY_DIR}/${ARGS_BASE_NAME}-protocol.c") 55 | SET_SOURCE_FILES_PROPERTIES(${_glue_code} GENERATED) 56 | ADD_CUSTOM_COMMAND( 57 | OUTPUT ${_glue_code} 58 | COMMAND ${WaylandScanner_EXECUTABLE} private-code ${_protocol_file} ${_glue_code} 59 | DEPENDS ${WaylandScanner_EXECUTABLE} ${_protocol_file} 60 | VERBATIM) 61 | 62 | LIST(APPEND ${target_var} "${_header}" "${_glue_code}") 63 | SET(${target_var} ${${target_var}} PARENT_SCOPE) 64 | ENDFUNCTION() 65 | -------------------------------------------------------------------------------- /cmake/embed.cmake.in: -------------------------------------------------------------------------------- 1 | # -*- cmake -*- 2 | # Copyright 2024 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | FILE(READ "@binary_file@" binary_content HEX) 17 | 18 | STRING(REGEX MATCHALL "([A-Fa-f0-9][A-Fa-f0-9])" separated_content ${binary_content}) 19 | 20 | SET(prefix "@prefix@") 21 | STRING(TOUPPER "@prefix@" prefix_uppercase) 22 | SET(binary_file "@binary_file@") 23 | SET(output_header "@output_header@") 24 | SET(output_source "@output_source@") 25 | SET(output_data "") 26 | 27 | SET(bytes 0) 28 | FOREACH(token IN LISTS separated_content) 29 | IF(NOT bytes EQUAL 0) 30 | STRING(APPEND output_data ", ") 31 | ENDIF() 32 | MATH(EXPR line_pos "${bytes} & 0xF") 33 | IF(line_pos EQUAL 0) 34 | STRING(APPEND output_data "\n ") 35 | ENDIF() 36 | 37 | STRING(APPEND output_data "0x${token}") 38 | 39 | MATH(EXPR bytes "${bytes} + 1") 40 | ENDFOREACH() 41 | 42 | CONFIGURE_FILE("@template_header@" "@output_header@" @ONLY) 43 | CONFIGURE_FILE("@template_source@" "@output_source@" @ONLY) 44 | 45 | FILE(WRITE @OUTPUT_BASENAME@.c "${output}") 46 | -------------------------------------------------------------------------------- /cmake/embed_binary.c.in: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file @output_source@ 4 | * Generated from "@binary_file@" 5 | * 6 | * @copyright 7 | * Copyright 2024 Google LLC 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include "@output_header@" 23 | 24 | const uint8_t embedded_binary_@prefix@_data[] = {@output_data@}; 25 | 26 | const size_t embedded_binary_@prefix@_size = sizeof( 27 | embedded_binary_@prefix@_data); 28 | 29 | /* == End of @output_source ================================================ */ 30 | -------------------------------------------------------------------------------- /cmake/embed_binary.h.in: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file @output_header@ 4 | * Generated from "@binary_file@" 5 | * 6 | * @copyright 7 | * Copyright 2024 Google LLC 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #ifndef __EMBEDDED_@prefix_uppercase@_H__ 23 | #define __EMBEDDED_@prefix_uppercase@_H__ 24 | 25 | #include 26 | #include 27 | 28 | /** Embedded content of "@binary_file@". */ 29 | extern const uint8_t embedded_binary_@prefix@_data[]; 30 | 31 | /** Size of "@binary_file@". */ 32 | extern const size_t embedded_binary_@prefix@_size; 33 | 34 | #endif // __EMBEDDED_@prefix_uppercase@_H__ 35 | /* == End of @output_header ================================================ */ 36 | -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | CMAKE_MINIMUM_REQUIRED(VERSION 3.13) 16 | 17 | FIND_PACKAGE(Doxygen) 18 | IF(DOXYGEN_FOUND) 19 | 20 | FIND_FILE(PLANTUML_JAR 21 | NAMES plantuml.jar 22 | HINTS ENV{PLANTUML_JAR_PATH} 23 | PATHS 24 | /usr/global/share/java/plantuml/ 25 | /usr/local/share/java/plantuml/ 26 | /usr/share/java/ 27 | /usr/local/share/java/ 28 | /usr/share/plantuml/) 29 | IF(PLANTUML_JAR) 30 | SET(DOXYGEN_PLANTUML_JAR_FILE ${PLANTUML_JAR}) 31 | ELSE() 32 | SET(DOXYGEN_PLANTUML_JAR_FILE "") 33 | MESSAGE( 34 | NOTICE 35 | "Did not find plantuml.jar -- Will not generate class diagrams.") 36 | ENDIF(PLANTUML_JAR) 37 | 38 | IF(config_DOXYGEN_CRITICAL) 39 | SET(DOXYGEN_WARN_AS_ERROR "YES") 40 | ELSE(config_DOXYGEN_CRITICAL) 41 | SET(DOXYGEN_WARN_AS_ERROR "NO") 42 | ENDIF(config_DOXYGEN_CRITICAL) 43 | 44 | # set input and output files 45 | SET(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) 46 | SET(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) 47 | 48 | # request to configure the file 49 | CONFIGURE_FILE(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) 50 | MESSAGE(NOTICE "Doxygen available, adding 'doc' target.") 51 | 52 | ADD_CUSTOM_TARGET( 53 | doc 54 | COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} 55 | DEPENDS ${DOXYGEN_OUT} 56 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 57 | COMMENT "Generating API documentation with Doxygen." 58 | VERBATIM) 59 | 60 | FILE( 61 | COPY ${PROJECT_SOURCE_DIR}/tests/data/toolkit/primitive_close_icon.png 62 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/html) 63 | FILE( 64 | COPY ${PROJECT_SOURCE_DIR}/tests/data/toolkit/primitive_minimize_icon.png 65 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/html) 66 | 67 | ELSE() 68 | MESSAGE(NOTICE "Doxygen not found. Not adding 'doc' target to generate API documentation.") 69 | ENDIF(DOXYGEN_FOUND) 70 | -------------------------------------------------------------------------------- /doc/commandline.md: -------------------------------------------------------------------------------- 1 | # Commandline Reference for wlmaker {#commandline} 2 | 3 | # Commandline Reference {#commandline_reference} 4 | 5 | ``` 6 | --start_xwayland : Optional: Whether to start XWayland. Disabled by default. 7 | --config_file : Optional: Path to a configuration file. If not provided, wlmaker will scan default paths for a configuration file, or fall back to a built-in configuration. 8 | --state_file : Optional: Path to a state file, with state of workspaces, dock and clips configured. If not provided, wlmaker will scan default paths for a state file, or fall back to a built-in default. 9 | --style_file : Optional: Path to a style ("theme") file. If not provided, wlmaker will use a built-in default style. 10 | --root_menu_file : Optional: Path to a file describing the root menu. If not provided, wlmaker will use a built-in definition for the root menu. 11 | --log_level : Log level to apply. One of DEBUG, INFO, WARNING, ERROR. 12 | Enum values: 13 | DEBUG (0) 14 | INFO (1) 15 | WARNING (2) 16 | ERROR (3) 17 | --height : Desired output height. Applies when running in windowed mode, and only if --width is set, too. Set to 0 for using the output's preferred dimensions. 18 | --width : Desired output width. Applies when running in windowed mode, and only if --height is set, too. Set to 0 for using the output's preferred dimensions. 19 | ``` 20 | 21 | * `--start_xwayland` , `--start_xwayland=true`: Starts *XWayland*. Permits to 22 | run X11 client applications under wlmaker. 23 | 24 | `--nostart_xwayland`, `--start_xwayland=false`: Do not start *XWayland*. 25 | 26 | * `--config_file=`: Loads the @ref config_file from ``. Optional. 27 | If not provided, wlmaker will attempt to load the file from default 28 | locations, or fall back to use a compiled-in default. 29 | 30 | * `--state_file=`: Loads the *State* from ``. Optional. If not 31 | provided, wlmaker will attempt to load the file from default locations, or 32 | fall back to use a compiled-in default. 33 | 34 | * `--style_file=`: Loads the *Style* from ``. Optional. If not 35 | provided, wlmaker will attempt to load the file from default locations, or 36 | fall back to use a compiled-in default. 37 | 38 | * `--root_menu_file=`: Loads the contents of the root menu from ``. 39 | If not provided, wlmaker will use a compiled-in default definition. 40 | 41 | * `--log_level=`: Optional, to adjust the log level. Logs are written to 42 | `stderr`. Use `--log_level=DEBUG` for most detailled output. 43 | 44 | * `--height=HHH`, `--width=WWW`: Desired width and height for the output. 45 | Applies only when running in windowed mode (under X11 or Wayland). Both 46 | values must be provided to take effect. 47 | -------------------------------------------------------------------------------- /doc/manual.css: -------------------------------------------------------------------------------- 1 | /* Doxygen extra stylesheet. Make it look like a wlmaker window. */ 2 | 3 | body { 4 | background-color: #505080; 5 | margin: 0; 6 | } 7 | 8 | body, table, div, p, dl { 9 | font: 12pt Helvetica,sans-serif; 10 | } 11 | 12 | div.contents { 13 | background-color: #a6a6b6; 14 | border-color: black; 15 | border: 1px solid; 16 | color: black; 17 | filter: drop-shadow(4px 4px 4px black); 18 | margin-left: auto; 19 | margin-right: auto; 20 | margin-top: 0px; 21 | padding-bottom: 20px; 22 | padding-left: 20px; 23 | padding-right: 20px; 24 | width: 960px; 25 | } 26 | 27 | div.fragment { 28 | background-color: #202020; 29 | border: 0px none; 30 | color: silver; 31 | padding: 8px; 32 | } 33 | 34 | div.header { 35 | background-color: #505080; 36 | background-image: linear-gradient(10deg, #000010, #202070); 37 | border-bottom: 1px solid #101038; 38 | border-left: 1px solid #808088; 39 | border-right: 1px solid #101038; 40 | border-top: 1px solid #808088; 41 | filter: drop-shadow(4px 4px 4px black); 42 | margin-bottom: 0px; 43 | margin-left: auto; 44 | margin-right: auto; 45 | margin-top: 20px; 46 | padding: 0px; 47 | width: 998px; 48 | } 49 | 50 | div.headertitle { 51 | background-image: url('primitive_minimize_icon.png'), url('primitive_close_icon.png'); 52 | background-position: left, right; 53 | background-repeat: no-repeat, no-repeat; 54 | border: 0px none; 55 | margin: 0px; 56 | padding-bottom: 0px; 57 | padding-left: 22px; 58 | padding-right: 22px; 59 | padding-top: 0px; 60 | } 61 | 62 | div.title { 63 | border-bottom: 0px none; 64 | border-left: 2px groove #808088; 65 | border-right: 2px groove #808088; 66 | border-top: 0px none; 67 | color: white; 68 | font-size: 14px; 69 | height: 22px; 70 | margin: 0px; 71 | padding-left: 4px; 72 | } 73 | 74 | h1 { font-size: 1.4em; } 75 | h2 { font-size: 1.2em; } 76 | h3 { font-size: 1.1em; } 77 | 78 | div.line { 79 | font: 12pt Monospace, fixed; 80 | line-height: normal; 81 | } 82 | 83 | /* Colorization */ 84 | .contents a:visited { color: #505080; } 85 | a { color: #3c3c60; text-decoration: underline; } 86 | a:hover { text-decoration: underline dashed; } 87 | a:visited { color: #505080; } 88 | code { background-color: #9898a0; } 89 | div.line { font-size: 12pt; min-height: 14pt; } 90 | span.charliteral { color: lightskyblue; } 91 | span.comment { color: gray; } 92 | span.keyword { color: lightgreen; } 93 | span.keywordtype { color: limegreen; } 94 | span.lineno { color: gray; background-color: #202020; border-right: 2px solid gray; } 95 | span.stringliteral { color: lightskyblue; } 96 | 97 | /* hides titlearea and the main navigation. */ 98 | #top { display: none; } 99 | hr.footer { display: none; } 100 | .footer { display: none; } 101 | -------------------------------------------------------------------------------- /doc/manual.md: -------------------------------------------------------------------------------- 1 | # wlmaker Manual {#mainpage} 2 | 3 | ## wlmaker 4 | 5 | wlmaker is a [Wayland Compositor](https://en.wikipedia.org/wiki/Wayland_(protocol)#Wayland_compositors), 6 | designed to reproduce the behaviour of 7 | [Window Maker](https://www.windowmaker.org/), which reproduces the elegant look 8 | and feel of the [NeXTSTEP](https://en.wikipedia.org/wiki/NeXTSTEP) user 9 | interface. 10 | 11 | **Key features:** 12 | 13 | * Compositor for windows in stacking mode. 14 | * Easy to use, lightweight, low on gimmicks and fast. 15 | * Highly configurable and human-readable [config files](#config_file). 16 | * Dock and clip, with support for dockable apps. 17 | 18 | ## Documentation 19 | 20 | * @ref commandline 21 | * @ref config 22 | * @ref protocols 23 | 24 | ## Download 25 | 26 | A few Linux and FreeBSD distributions provide a recent and compiled 27 | binary of wlmaker, so you can install it directly from there: 28 | 29 | 30 | Packaging status 31 | 32 | 33 | Alternatively, you can obtain the source code from it's 34 | [git repository](https://github.com/phkaeser/wlmaker). Please follow the 35 | [instructions](https://github.com/phkaeser/wlmakerdoc/BUILD.md) to build from 36 | source. 37 | 38 | ## Bugs and missing features 39 | 40 | Report bugs at https://github.com/phkaeser/wlmaker/issues. 41 | -------------------------------------------------------------------------------- /doc/protocols.md: -------------------------------------------------------------------------------- 1 | # Wayland Protocol support {#protocols} 2 | 3 | # Wayland Protocol support 4 | 5 | This page documents which of the Wayland protocols (beyond the core 6 | [Wayland protocol](https://wayland.app/protocols/wayland)) are supported 7 | by wlmaker. 8 | 9 | # Idle inhibit 10 | 11 | Permits inhibiting the idle behaviour, such as locking the screen. 12 | 13 | * Status: Implemented, untested. 14 | * Reference: https://wayland.app/protocols/idle-inhibit-unstable-v1 15 | 16 | # Session lock 17 | 18 | Allows privileged Wayland clients to lock the session and display arbitrary 19 | graphics while the session is locked. An example of such a client is 20 | [swaylock](https://github.com/swaywm/swaylock). 21 | 22 | * Status: Supported. 23 | * Reference: https://wayland.app/protocols/ext-session-lock-v1 24 | 25 | # wlr layer shell {#protocols_wlr_layer_shell} 26 | 27 | Clients can use this interface to associate `wl_surface` with a *layer* of the 28 | output. The surfaces may slo be anchored to edges and/or corners of a screen, 29 | specify input semantics and will be rendered above or below desktop elements, 30 | as configured. 31 | 32 | * Status: Supported, except popups and input semantics. 33 | * Reference: https://wayland.app/protocols/wlr-layer-shell-unstable-v1 34 | 35 | # wlr screencopy 36 | 37 | This protocol allows clients to ask the compositor to copy part of the screen 38 | content to a client buffer. 39 | 40 | * Status: Supported. 41 | * Reference: https://wayland.app/protocols/wlr-screencopy-unstable-v1 42 | 43 | # wlr output management {#protocols_wlr_output_management} 44 | 45 | Implements interfaces to obtain and modify output device configruation. It 46 | permits thirdparty clients (such as `wlr-randr`, `wdisplays`) to obtain a list 47 | of available outputs, and set their propertis. 48 | 49 | * Status: Supported. 50 | * Reference: https://wayland.app/protocols/wlr-output-management-unstable-v1 51 | 52 | # XDG decoration 53 | 54 | This interface allows a compositor to announce support for server-side 55 | decorations. A client can use this protocol to request being decorated by 56 | wlmaker. 57 | 58 | * Status: Supported. 59 | * Reference: https://wayland.app/protocols/xdg-decoration-unstable-v1 60 | 61 | # XDG shell 62 | 63 | Interface for creating desktop-style surfaces. 64 | 65 | * Status: Supported, with a few gaps. 66 | * Reference: https://wayland.app/protocols/xdg-shell 67 | -------------------------------------------------------------------------------- /doc/wlmaker-default-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/doc/wlmaker-default-screenshot.png -------------------------------------------------------------------------------- /etc/root-menu.plist: -------------------------------------------------------------------------------- 1 | // Definition of root menu. Follows Window Maker plist order. 2 | ("Root Menu", 3 | ("Applications...", 4 | ("Terminal", ShellExecute, "/usr/bin/foot"), 5 | ("Chrome", ShellExecute, "/usr/bin/google-chrome --enable-features=UseOzonePlatform --ozone-platform=wayland --user-data-dir=/tmp/chrome-wayland")), 6 | ("Previous Workspace", WorkspacePrevious), 7 | ("Next Workspace", WorkspaceNext), 8 | ("Lock", LockScreen), 9 | (Exit, Quit)) 10 | -------------------------------------------------------------------------------- /etc/style-debian.plist: -------------------------------------------------------------------------------- 1 | // Following the 'Debian' theme of Window Maker. 2 | { 3 | BackgroundColor = "argb32:ff77aac4"; 4 | Cursor = { 5 | Name = default; 6 | Size = 48; 7 | }; 8 | Dock = { 9 | Margin = { 10 | Width = 1; 11 | Color = "argb32:c0000000"; 12 | }; 13 | }; 14 | Tile = { 15 | Size = 128; 16 | ContentSize = 96; 17 | BezelWidth = 4; 18 | Fill = { 19 | From = "argb32:ffa6a6b6"; 20 | To = "argb32:ff515561"; 21 | Type = DGRADIENT; 22 | }; 23 | }; 24 | Clip = { 25 | Font = { 26 | Face = Helvetica; 27 | Weight = Bold; 28 | Size = 24; 29 | }; 30 | TextColor = "argb32:ff000000"; 31 | }; 32 | Window = { 33 | TitleBar = { 34 | FocussedFill = { 35 | From = "argb32:ff505a5e"; 36 | To = "argb32:ff202a2e"; 37 | Type = ADGRADIENT; 38 | }; 39 | FocussedTextColor = "argb32:ffffffff"; 40 | BlurredFill = { 41 | From = "argb32:ffc2c0c5"; 42 | To = "argb32:ff828085"; 43 | Type = ADGRADIENT; 44 | }; 45 | BlurredTextColor = "argb32:ff000000"; 46 | Height = 44; 47 | BezelWidth = 3; 48 | Margin = { 49 | Width = 1; 50 | Color = "argb32:ff000000" ; 51 | }; 52 | Font = { 53 | Face = Helvetica; 54 | Weight = Bold; 55 | Size = 24; 56 | }; 57 | }; 58 | ResizeBar = { 59 | Fill = { 60 | Color = "argb32:ffc2c0c5"; 61 | Type = SOLID; 62 | }; 63 | Height = 14; 64 | BezelWidth = 3; 65 | CornerWidth = 58; 66 | }; 67 | Border = { 68 | Width = 2; 69 | Color = "argb32:ff000000"; 70 | }; 71 | Margin = { 72 | Width = 2; 73 | Color = "argb32:ff000000"; 74 | }; 75 | }; 76 | Menu = { 77 | Margin = { 78 | Width = 2; 79 | Color = "argb32:ff000000"; 80 | }; 81 | Border = { 82 | Width = 2; 83 | Color = "argb32:ff000000"; 84 | }; 85 | Item = { 86 | Fill = { 87 | From = "argb32:ffa6a6b6"; 88 | To = "argb32:ff515561"; 89 | Type = DGRADIENT; 90 | }; 91 | HighlightedFill = { 92 | Color = "argb32:ffffffff"; 93 | Type = SOLID; 94 | }; 95 | Font = { 96 | Face = Helvetica; 97 | Weight = Normal; 98 | Size = 24; 99 | }; 100 | EnabledTextColor = "argb32:ff000000"; 101 | HighlightedTextColor = "argb32:ff000000"; 102 | DisabledTextColor = "argb32:ff808080"; 103 | Height = 44; 104 | BezelWidth = 3; 105 | Width = 240; 106 | }; 107 | }; 108 | TaskList = { 109 | Fill = { 110 | Color = "argb32:c0202020"; 111 | Type = SOLID; 112 | }; 113 | Font = { 114 | Face = Helvetica; 115 | Weight = Bold; 116 | Size = 36; 117 | }; 118 | TextColor = "argb32:ffffffff"; 119 | }; 120 | } 121 | -------------------------------------------------------------------------------- /etc/style.plist: -------------------------------------------------------------------------------- 1 | // Style oriented on Window Maker's default. 2 | { 3 | BackgroundColor = "argb32:ff505080"; 4 | Cursor = { 5 | Name = default; 6 | Size = 24; 7 | }; 8 | Dock = { 9 | Margin = { 10 | Width = 1; 11 | Color = "argb32:ff000000"; 12 | }; 13 | }; 14 | Tile = { 15 | Size = 64; 16 | ContentSize = 48; 17 | BezelWidth = 2; 18 | Fill = { 19 | From = "argb32:ffa6a6b6"; 20 | To = "argb32:ff515561"; 21 | Type = DGRADIENT; 22 | }; 23 | }; 24 | Clip = { 25 | Font = { 26 | Face = Helvetica; 27 | Weight = Bold; 28 | Size = 12; 29 | }; 30 | TextColor = "argb32:ff000000"; 31 | }; 32 | Window = { 33 | TitleBar = { 34 | FocussedFill = { 35 | From = "argb32:ff000010"; 36 | To = "argb32:ff202070"; 37 | Type = DGRADIENT; 38 | }; 39 | FocussedTextColor = "argb32:ffffffff"; 40 | BlurredFill = { 41 | Color = "argb32:ff666666"; 42 | Type = SOLID; 43 | }; 44 | BlurredTextColor = "argb32:ff000000"; 45 | Height = 22; 46 | BezelWidth = 1; 47 | Margin = { 48 | Width = 1; 49 | Color = "argb32:ff000000"; 50 | }; 51 | Font = { 52 | Face = Helvetica; 53 | Weight = Bold; 54 | Size = 15; 55 | }; 56 | }; 57 | ResizeBar = { 58 | Fill = { 59 | Color = "argb32:ffc2c0c5"; 60 | Type = SOLID; 61 | }; 62 | Height = 7; 63 | CornerWidth = 29; 64 | BezelWidth = 1; 65 | }; 66 | Border = { 67 | Width = 1; 68 | Color = "argb32:ff000000"; 69 | }; 70 | Margin = { 71 | Width = 1; 72 | Color = "argb32:ff000000"; 73 | }; 74 | }; 75 | Menu = { 76 | Margin = { 77 | Width = 1; 78 | Color = "argb32:ff000000"; 79 | }; 80 | Border = { 81 | Width = 1; 82 | Color = "argb32:ff000000"; 83 | }; 84 | Item = { 85 | Fill = { 86 | From = "argb32:ffa6a6b6"; 87 | To = "argb32:ff515561"; 88 | Type = DGRADIENT; 89 | }; 90 | HighlightedFill = { 91 | Color = "argb32:ffffffff"; 92 | Type = SOLID; 93 | }; 94 | Font = { 95 | Face = Helvetica; 96 | Weight = Normal; 97 | Size = 14; 98 | }; 99 | EnabledTextColor = "argb32:ff000000"; 100 | HighlightedTextColor = "argb32:ff000000"; 101 | DisabledTextColor = "argb32:ff808080"; 102 | Height = 22; 103 | BezelWidth = 1; 104 | Width = 150; 105 | }; 106 | }; 107 | TaskList = { 108 | Fill = { 109 | Color = "argb32:c0202020"; 110 | Type = SOLID; 111 | }; 112 | Font = { 113 | Face = Helvetica; 114 | Weight = Bold; 115 | Size = 18; 116 | }; 117 | TextColor = "argb32:ffffffff"; 118 | }; 119 | } 120 | -------------------------------------------------------------------------------- /etc/wlmaker-home.plist: -------------------------------------------------------------------------------- 1 | // Base configuration for wlmaker: Keyboard and autostarted applications. 2 | { 3 | Keyboard = { 4 | XkbRMLVO = { 5 | Rules = "evdev"; 6 | Model = "pc105"; 7 | Layout = "ch"; 8 | Variant = "de_nodeadkeys"; 9 | Options = ""; 10 | }; 11 | Repeat = { 12 | // Delay before initiating repeats, in milliseconds. 13 | Delay = 300; 14 | // Repeats per second. 15 | Rate = 25; 16 | }; 17 | }; 18 | KeyBindings = { 19 | "Ctrl+Alt+Logo+Q" = Quit; 20 | "Ctrl+Alt+Logo+L" = LockScreen; 21 | "Ctrl+Alt+Logo+T" = LaunchTerminal; 22 | 23 | "Ctrl+Alt+Logo+Left" = WorkspacePrevious; 24 | "Ctrl+Alt+Logo+Right" = WorkspaceNext; 25 | 26 | "Ctrl+Alt+Logo+Escape" = TaskNext; 27 | "Shift+Ctrl+Alt+Logo+Escape" = TaskPrevious; 28 | 29 | "Alt+Logo+Up" = WindowRaise; 30 | "Alt+Logo+Down" = WindowLower; 31 | "Ctrl+Alt+Logo+F" = WindowFullscreen; 32 | "Ctrl+Alt+Logo+M" = WindowMaximize; 33 | 34 | }; 35 | ScreenLock = { 36 | IdleSeconds = 300; 37 | Command = "/usr/bin/swaylock"; 38 | }; 39 | // Optional array: Commands to start once wlmaker is running. 40 | Autostart = ( 41 | "/usr/bin/foot" 42 | ); 43 | } -------------------------------------------------------------------------------- /etc/wlmaker-state.plist: -------------------------------------------------------------------------------- 1 | { 2 | Dock = { 3 | Edge = RIGHT; 4 | Anchor = TOP; 5 | Launchers = ( 6 | { 7 | CommandLine = "/usr/bin/foot"; 8 | Icon = "terminal-48x48.png"; 9 | }, 10 | { 11 | CommandLine = "/usr/bin/google-chrome --enable-features=UseOzonePlatform --ozone-platform=wayland --user-data-dir=/tmp/chrome-wayland"; 12 | Icon = "chrome-48x48.png"; 13 | }, 14 | { 15 | CommandLine = "MOZ_ENABLE_WAYLAND=1 /usr/bin/firefox"; 16 | Icon = "firefox-48x48.png"; 17 | } 18 | ); 19 | }; 20 | Clip = { 21 | Edge = BOTTOM; 22 | Anchor = RIGHT; 23 | }; 24 | Workspaces = ( 25 | { 26 | Name = Main; 27 | }, 28 | { 29 | Name = Second; 30 | }, 31 | { 32 | Name = Third; 33 | // Color is optional here, overrides the style's BackgroundColor. 34 | Color = "argb32:ff508050"; 35 | }, 36 | ); 37 | } -------------------------------------------------------------------------------- /etc/wlmaker.plist: -------------------------------------------------------------------------------- 1 | //! @page etc_wlmaker_plist etc/wlmaker.plist 2 | //! Compiled-in default configuration. See @ref config_file for details. 3 | //! @include etc/wlmaker.plist 4 | // Base configuration for wlmaker: Keyboard and autostarted applications. 5 | { 6 | Keyboard = { 7 | XkbRMLVO = { 8 | Rules = "evdev"; 9 | Model = "pc105"; 10 | Layout = "us"; 11 | Variant = "intl"; 12 | Options = ""; 13 | }; 14 | Repeat = { 15 | // Delay before initiating repeats, in milliseconds. 16 | Delay = 300; 17 | // Repeats per second. 18 | Rate = 25; 19 | }; 20 | }; 21 | // Configuration for XDG decoration protocol: Server or client-side? 22 | Decoration = { 23 | Mode = SuggestServer; 24 | }; 25 | KeyBindings = { 26 | "Ctrl+Alt+Logo+Q" = Quit; 27 | "Ctrl+Alt+Logo+L" = LockScreen; 28 | "Ctrl+Alt+Logo+T" = LaunchTerminal; 29 | 30 | "Ctrl+Alt+Logo+Left" = WorkspacePrevious; 31 | "Ctrl+Alt+Logo+Right" = WorkspaceNext; 32 | 33 | "Ctrl+Alt+Logo+Escape" = TaskNext; 34 | "Shift+Ctrl+Alt+Logo+Escape" = TaskPrevious; 35 | 36 | "Alt+Logo+Up" = WindowRaise; 37 | "Alt+Logo+Down" = WindowLower; 38 | "Ctrl+Alt+Logo+F" = WindowToggleFullscreen; 39 | "Ctrl+Alt+Logo+M" = WindowToggleMaximized; 40 | 41 | // TODO(kaeser@gubbe.ch): Swap with F12, to match Window Maker's behaviour. 42 | "Ctrl+Alt+Logo+R" = RootMenu; 43 | 44 | // TODO(kaeser@gubbe.ch): xkbcommon emits XF86Switch_VT_n for Fn only with 45 | // Ctrl+Alt presset. Means: Here, it should not need the modifiers to be 46 | // listed. Should determine how to handle that w/o modifiers. 47 | "Ctrl+Alt+XF86Switch_VT_1" = SwitchToVT1; 48 | "Ctrl+Alt+XF86Switch_VT_2" = SwitchToVT2; 49 | "Ctrl+Alt+XF86Switch_VT_3" = SwitchToVT3; 50 | "Ctrl+Alt+XF86Switch_VT_4" = SwitchToVT4; 51 | "Ctrl+Alt+XF86Switch_VT_5" = SwitchToVT5; 52 | "Ctrl+Alt+XF86Switch_VT_6" = SwitchToVT6; 53 | "Ctrl+Alt+XF86Switch_VT_7" = SwitchToVT7; 54 | "Ctrl+Alt+XF86Switch_VT_8" = SwitchToVT8; 55 | "Ctrl+Alt+XF86Switch_VT_9" = SwitchToVT9; 56 | "Ctrl+Alt+XF86Switch_VT_10" = SwitchToVT10; 57 | "Ctrl+Alt+XF86Switch_VT_11" = SwitchToVT11; 58 | "Ctrl+Alt+XF86Switch_VT_12" = SwitchToVT12; 59 | }; 60 | HotCorner = { 61 | // Delay for the pointer occupying a corner before triggering 'Enter'. 62 | TriggerDelay = 500; 63 | // For each corner 'TopLeft', 'TopRight', 'BottomLeft' and 'BottomRight' 64 | // there are 'Enter' and 'Leave' events that can be bound to an action. 65 | TopLeftEnter = LockScreen; 66 | TopLeftLeave = None; 67 | TopRightEnter = InhibitLockBegin; 68 | TopRightLeave = InhibitLockEnd; 69 | BottomLeftEnter = None; 70 | BottomLeftLeave = None; 71 | BottomRightEnter = None; 72 | BottomRightLeave = None; 73 | }; 74 | ScreenLock = { 75 | IdleSeconds = 300; 76 | Command = "/usr/bin/swaylock"; 77 | }; 78 | // Optional array: Commands to start once wlmaker is running. 79 | Autostart = ( 80 | "/usr/bin/foot" 81 | ); 82 | Outputs = ( 83 | { 84 | Name = "*"; 85 | Transformation = Normal; 86 | Scale = 1.0; 87 | }, 88 | ); 89 | } -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # Default arguments: 16 | # cmake -DCMAKE_INSTALL_PREFIX:PATH=${HOME}/.local . -B build 17 | 18 | CMAKE_MINIMUM_REQUIRED(VERSION 3.13) 19 | PROJECT(wlmaker VERSION 0.1 20 | DESCRIPTION "Wayland Maker - Examples & Tools") 21 | 22 | # Requires out-of-source builds. 23 | FILE(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOCATION_PATH) 24 | IF(EXISTS "${LOCATION_PATH}") 25 | MESSAGE( 26 | FATAL_ERROR 27 | "You cannot build into a source directory (containing a CMakeLists.txt file).\n" 28 | "Please make a build subdirectory, for example:\n" 29 | "cmake -B build\n" 30 | "(cd build && make)") 31 | ENDIF() 32 | 33 | # If not found: Try 'pip3 install --user meson' 34 | FIND_PROGRAM(MESON_EXECUTABLE NAMES meson REQUIRED) 35 | FIND_PROGRAM(NINJA_EXECUTABLE NAMES ninja REQUIRED) 36 | 37 | INCLUDE(ExternalProject) 38 | 39 | # Extra packages required on Debian: 40 | # 41 | # libgtk-3-dev 42 | # libgirepository1.0-dev 43 | # valac 44 | # 45 | # Hm. Could also have installed gtk-layer-shell-examples ? 46 | # Also, there is https://github.com/wmww/gtk4-layer-shell. 47 | ExternalProject_Add(gtk_layer_shell 48 | SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gtk-layer-shell" 49 | INSTALL_DIR ${CMAKE_INSTALL_PREFIX} 50 | CONFIGURE_COMMAND ${MESON_EXECUTABLE} --prefix= -Dexamples=true 51 | BUILD_COMMAND ${NINJA_EXECUTABLE} -C 52 | INSTALL_COMMAND ${NINJA_EXECUTABLE} -C install 53 | ) 54 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples or tools suitable for wlmaker 2 | 3 | Through git submodules, this directory points to various tools for using with, 4 | or for experimenting with wlmaker. 5 | 6 | These tools are not built by default. See `CMakeLists.txt` for potential 7 | further package dependencies. 8 | 9 | ``` 10 | git submodule update --init --recursive --merge 11 | git submodule update --checkout --recursive --merge 12 | cmake -DCMAKE_INSTALL_PREFIX:PATH=${HOME}/.local . -B build 13 | ``` 14 | 15 | -------------------------------------------------------------------------------- /icons/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | CMAKE_MINIMUM_REQUIRED(VERSION 3.13) 16 | 17 | INSTALL(FILES 18 | chrome-48x48.png 19 | clip-48x48.png 20 | firefox-48x48.png 21 | terminal-48x48.png 22 | wlmclock-64x64.png 23 | DESTINATION share/icons/wlmaker) 24 | -------------------------------------------------------------------------------- /icons/README.md: -------------------------------------------------------------------------------- 1 | Icons that are re-distributable with wlmaker, respecting the various 2 | licenses below: 3 | 4 | * chrome-48x48.png : MIT License [SuperTinyIcons](https://github.com/edent/SuperTinyIcons/blob/master/LICENSE)) 5 | * https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/chrome.svg 6 | * Resized using gimp. 7 | 8 | * firefox-48x48.png : MIT License [SuperTinyIcons](https://github.com/edent/SuperTinyIcons/blob/master/LICENSE)) 9 | * https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/firefox.svg 10 | * Edited to remove background, resized using gimp. 11 | 12 | * terminal-48x48.png : Public Domain [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Terminalicon2.png) 13 | * https://upload.wikimedia.org/wikipedia/commons/b/b3/Terminalicon2.png 14 | * convert -resize 48x48^ Terminalicon2.png terminal-48x48.png 15 | 16 | * clip-48x48.png : Public domain [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Ryanlerch_green_paperclip.svg) 17 | * https://upload.wikimedia.org/wikipedia/commons/0/0c/Ryanlerch_green_paperclip.svg 18 | * Edited for size in gimp, resized. 19 | 20 | -------------------------------------------------------------------------------- /icons/chrome-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/icons/chrome-48x48.png -------------------------------------------------------------------------------- /icons/clip-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/icons/clip-48x48.png -------------------------------------------------------------------------------- /icons/firefox-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/icons/firefox-48x48.png -------------------------------------------------------------------------------- /icons/terminal-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/icons/terminal-48x48.png -------------------------------------------------------------------------------- /icons/wlmclock-64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/icons/wlmclock-64x64.png -------------------------------------------------------------------------------- /include/backend/backend.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file backend.h 4 | * 5 | * @copyright 6 | * Copyright 2025 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMBE_BACKEND_H__ 21 | #define __WLMBE_BACKEND_H__ 22 | 23 | #include 24 | #include 25 | #include 26 | //#include 27 | 28 | struct wl_display; 29 | struct wlr_output_layout; 30 | struct wlr_scene; 31 | 32 | /** Forward declaration. */ 33 | typedef struct _wlmbe_backend_t wlmbe_backend_t; 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif // __cplusplus 38 | 39 | /** 40 | * Creates the backend drivers. 41 | * 42 | * @param wl_display_ptr 43 | * @param wlr_scene_ptr 44 | * @param wlr_output_layout_ptr 45 | * @param width 46 | * @param height 47 | * @param config_dict_ptr 48 | * 49 | * @return the server backend state, or NULL on error. 50 | */ 51 | wlmbe_backend_t *wlmbe_backend_create( 52 | struct wl_display *wl_display_ptr, 53 | struct wlr_scene *wlr_scene_ptr, 54 | struct wlr_output_layout *wlr_output_layout_ptr, 55 | int width, 56 | int height, 57 | bspl_dict_t *config_dict_ptr); 58 | 59 | /** 60 | * Destroys the server backend. 61 | * 62 | * @param backend_ptr 63 | */ 64 | void wlmbe_backend_destroy(wlmbe_backend_t *backend_ptr); 65 | 66 | /** 67 | * Switches to the given virtual terminal, if a wlroots session is available. 68 | * 69 | * Logs if wlr_session_change_vt() fails, but ignores the errors. 70 | * 71 | * @param backend_ptr 72 | * @param vt_num 73 | */ 74 | void wlmbe_backend_switch_to_vt(wlmbe_backend_t *backend_ptr, unsigned vt_num); 75 | 76 | /** Accessor. TODO(kaeser@gubbe.ch): Eliminate. */ 77 | struct wlr_backend *wlmbe_backend_wlr(wlmbe_backend_t *backend_ptr); 78 | /** Accessor. TODO(kaeser@gubbe.ch): Eliminate. */ 79 | struct wlr_compositor *wlmbe_backend_compositor(wlmbe_backend_t *backend_ptr); 80 | 81 | /** 82 | * Returns the primary output. Currently that is the first output found 83 | * in the output layout. 84 | * 85 | * @param wlr_output_layout_ptr 86 | * 87 | * @return A pointer to the `struct wlr_output` for the primary output. 88 | */ 89 | struct wlr_output *wlmbe_primary_output( 90 | struct wlr_output_layout *wlr_output_layout_ptr); 91 | 92 | /** 93 | * Returns the number of outputs active in the output layout. 94 | * 95 | * @param wlr_output_layout_ptr 96 | * 97 | * @return Number of outputs. 98 | */ 99 | size_t wlmbe_num_outputs(struct wlr_output_layout *wlr_output_layout_ptr); 100 | 101 | /** Unit test cases. */ 102 | extern const bs_test_case_t wlmbe_backend_test_cases[]; 103 | 104 | #ifdef __cplusplus 105 | } // extern "C" 106 | #endif // __cplusplus 107 | 108 | #endif /* __WLMBE_BACKEND_H__ */ 109 | /* == End of backend.h ===================================================== */ 110 | -------------------------------------------------------------------------------- /include/backend/output.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file output.h 4 | * 5 | * @copyright 6 | * Copyright 2025 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMBE_OUTPUT_H__ 21 | #define __WLMBE_OUTPUT_H__ 22 | 23 | #include 24 | 25 | #include "output_config.h" 26 | 27 | /** Handle for an output device. */ 28 | typedef struct _wlmbe_output_t wlmbe_output_t; 29 | 30 | struct wlr_output; 31 | struct wlr_allocator; 32 | struct wlr_renderer; 33 | struct wlr_scene; 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif // __cplusplus 38 | 39 | /** 40 | * Creates an output device from `wlr_output_ptr`. 41 | * 42 | * @param wlr_output_ptr 43 | * @param wlr_allocator_ptr 44 | * @param wlr_renderer_ptr 45 | * @param wlr_scene_ptr 46 | * @param config_ptr 47 | * @param width 48 | * @param height 49 | * 50 | * @return The output device handle or NULL on error. 51 | */ 52 | wlmbe_output_t *wlmbe_output_create( 53 | struct wlr_output *wlr_output_ptr, 54 | struct wlr_allocator *wlr_allocator_ptr, 55 | struct wlr_renderer *wlr_renderer_ptr, 56 | struct wlr_scene *wlr_scene_ptr, 57 | wlmbe_output_config_t *config_ptr, 58 | int width, 59 | int height); 60 | 61 | /** 62 | * Destroys the output device handle, as created by @ref wlmbe_output_create. 63 | * 64 | * @param output_ptr 65 | */ 66 | void wlmbe_output_destroy(wlmbe_output_t *output_ptr); 67 | 68 | /** @return A long description string, @see wlmbe_output_t::description_ptr. */ 69 | const char *wlmbe_output_description(wlmbe_output_t *output_ptr); 70 | 71 | /** Returns @ref wlmbe_output_t::wlr_output_ptr. */ 72 | struct wlr_output *wlmbe_wlr_output_from_output(wlmbe_output_t *output_ptr); 73 | 74 | /** Returns @ref wlmbe_output_t::attributes_ptr. */ 75 | wlmbe_output_config_attributes_t *wlmbe_output_attributes( 76 | wlmbe_output_t *output_ptr); 77 | 78 | /** Returns a pointer to @ref wlmbe_output_t::dlnode. */ 79 | bs_dllist_node_t *wlmbe_dlnode_from_output(wlmbe_output_t *output_ptr); 80 | 81 | /** Returns the @ref wlmbe_output_t for @ref wlmbe_output_t::dlnode. */ 82 | wlmbe_output_t *wlmbe_output_from_dlnode(bs_dllist_node_t *dlnode_ptr); 83 | 84 | #ifdef __cplusplus 85 | } // extern "C" 86 | #endif // __cplusplus 87 | 88 | #endif /* __WLMBE_OUTPUT_H__ */ 89 | /* == End of output.h ====================================================== */ 90 | -------------------------------------------------------------------------------- /include/backend/output_manager.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file output_manager.h 4 | * 5 | * @copyright 6 | * Copyright 2025 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMBE_OUTPUT_MANAGER_H__ 21 | #define __WLMBE_OUTPUT_MANAGER_H__ 22 | 23 | struct wl_display; 24 | struct wlr_backend; 25 | struct wlr_output_layout; 26 | struct wlr_scene; 27 | 28 | /** Forward declaration: Handle for output managers. */ 29 | typedef struct _wlmbe_output_manager_t wlmbe_output_manager_t; 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif // __cplusplus 34 | 35 | /** 36 | * Instantiates output managers for both `wlr-output-management-unstable-v1` 37 | * and `xdg-output-unstable-v1`. Both will listen for output changes in 38 | * `wlr_output_layout_ptr` and update the respective output configurations 39 | * is requested so. 40 | * 41 | * @param wl_display_ptr 42 | * @param wlr_scene_ptr 43 | * @param wlr_output_layout_ptr 44 | * @param wlr_backend_ptr 45 | * 46 | * @return Handle for the output managers, or NULL on error. Must be destroyed 47 | * by @ref wlmbe_output_manager_destroy. 48 | */ 49 | wlmbe_output_manager_t *wlmbe_output_manager_create( 50 | struct wl_display *wl_display_ptr, 51 | struct wlr_scene *wlr_scene_ptr, 52 | struct wlr_output_layout *wlr_output_layout_ptr, 53 | struct wlr_backend *wlr_backend_ptr); 54 | 55 | /** 56 | * Destroy the output manager, returned from @ref wlmbe_output_manager_create. 57 | * 58 | * @param output_manager_ptr 59 | */ 60 | void wlmbe_output_manager_destroy( 61 | wlmbe_output_manager_t *output_manager_ptr); 62 | 63 | #ifdef __cplusplus 64 | } // extern "C" 65 | #endif // __cplusplus 66 | 67 | #endif /* __WLMBE_OUTPUT_MANAGER_H__ */ 68 | /* == End of output_manager.h ============================================== */ 69 | -------------------------------------------------------------------------------- /include/toolkit/buffer.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file buffer.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_BUFFER_H__ 21 | #define __WLMTK_BUFFER_H__ 22 | 23 | #include 24 | #include 25 | 26 | #include "element.h" 27 | #include "env.h" 28 | 29 | struct _wlmtk_buffer_t; 30 | /** Forward declaration: Buffer state. */ 31 | typedef struct _wlmtk_buffer_t wlmtk_buffer_t; 32 | 33 | /** Forward declaration. */ 34 | struct wlr_buffer; 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif // __cplusplus 39 | 40 | /** State of a texture-backed buffer. */ 41 | struct _wlmtk_buffer_t { 42 | /** Super class of the buffer: An element. */ 43 | wlmtk_element_t super_element; 44 | /** Virtual method table of the super element before extending it. */ 45 | wlmtk_element_vmt_t orig_super_element_vmt; 46 | 47 | /** WLR buffer holding the contents. */ 48 | struct wlr_buffer *wlr_buffer_ptr; 49 | /** Scene graph API node. Only set after calling `create_scene_node`. */ 50 | struct wlr_scene_buffer *wlr_scene_buffer_ptr; 51 | 52 | /** Listener for the `destroy` signal of `wlr_scene_buffer_ptr->node`. */ 53 | struct wl_listener wlr_scene_buffer_node_destroy_listener; 54 | }; 55 | 56 | /** 57 | * Initializes the buffer. 58 | * 59 | * @param buffer_ptr 60 | * @param env_ptr 61 | * 62 | * @return true on success. 63 | */ 64 | bool wlmtk_buffer_init(wlmtk_buffer_t *buffer_ptr, 65 | wlmtk_env_t *env_ptr); 66 | 67 | /** 68 | * Cleans up the buffer. 69 | * 70 | * @param buffer_ptr 71 | */ 72 | void wlmtk_buffer_fini(wlmtk_buffer_t *buffer_ptr); 73 | 74 | /** 75 | * Sets (or updates) buffer contents. 76 | * 77 | * @param buffer_ptr 78 | * @param wlr_buffer_ptr A WLR buffer to use for the update. That buffer 79 | * will get locked by @ref wlmtk_buffer_t for the 80 | * duration of it's use. 81 | */ 82 | void wlmtk_buffer_set( 83 | wlmtk_buffer_t *buffer_ptr, 84 | struct wlr_buffer *wlr_buffer_ptr); 85 | 86 | /** @return the superclass' @ref wlmtk_element_t of `buffer_ptr`. */ 87 | wlmtk_element_t *wlmtk_buffer_element(wlmtk_buffer_t *buffer_ptr); 88 | 89 | #ifdef __cplusplus 90 | } // extern "C" 91 | #endif // __cplusplus 92 | 93 | #endif /* __WLMTK_BUFFER_H__ */ 94 | /* == End of buffer.h ====================================================== */ 95 | -------------------------------------------------------------------------------- /include/toolkit/dock.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file dock.h 4 | * 5 | * @copyright 6 | * Copyright 2024 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_DOCK_H__ 21 | #define __WLMTK_DOCK_H__ 22 | 23 | #include 24 | #define WLR_USE_UNSTABLE 25 | #include 26 | #undef WLR_USE_UNSTABLE 27 | 28 | #include "element.h" 29 | #include "env.h" 30 | #include "panel.h" 31 | #include "style.h" 32 | #include "tile.h" 33 | 34 | /** Forward declaration: Dock handle. */ 35 | typedef struct _wlmtk_dock_t wlmtk_dock_t; 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif // __cplusplus 40 | 41 | /** Positioning options for the dock. */ 42 | typedef struct { 43 | /** Principal edge the dock aligns to. Must not be WLR_EDGE_NONE. */ 44 | enum wlr_edges edge; 45 | /** Dock anchor, along @ref wlmtk_dock_positioning_t::edge. */ 46 | enum wlr_edges anchor; 47 | } wlmtk_dock_positioning_t; 48 | 49 | /** 50 | * Creates a dock. A dock contains icons, launchers and the likes. 51 | * 52 | * The dock is an implementation of a @ref wlmtk_panel_t. 53 | * 54 | * @param dock_positioning_ptr 55 | * @param style_ptr 56 | * @param env_ptr 57 | * 58 | * @return The dock handle, or NULL on error. Must be destroyed calling 59 | * @ref wlmtk_dock_destroy. 60 | */ 61 | wlmtk_dock_t *wlmtk_dock_create( 62 | const wlmtk_dock_positioning_t *dock_positioning_ptr, 63 | const wlmtk_dock_style_t *style_ptr, 64 | wlmtk_env_t *env_ptr); 65 | 66 | /** 67 | * Destroys the dock. 68 | * 69 | * @param dock_ptr 70 | */ 71 | void wlmtk_dock_destroy(wlmtk_dock_t *dock_ptr); 72 | 73 | /** 74 | * Adds the tile to the dock. 75 | * 76 | * @param dock_ptr 77 | * @param tile_ptr 78 | */ 79 | void wlmtk_dock_add_tile( 80 | wlmtk_dock_t *dock_ptr, 81 | wlmtk_tile_t *tile_ptr); 82 | 83 | /** 84 | * Removes the tile from the dock. 85 | * 86 | * @param dock_ptr 87 | * @param tile_ptr 88 | */ 89 | void wlmtk_dock_remove_tile( 90 | wlmtk_dock_t *dock_ptr, 91 | wlmtk_tile_t *tile_ptr); 92 | 93 | /** @return Pointer to the superclass @ref wlmtk_panel_t of `dock_ptr`. */ 94 | wlmtk_panel_t *wlmtk_dock_panel(wlmtk_dock_t *dock_ptr); 95 | 96 | /** @return Pointer to the superclass @ref wlmtk_element_t of `dock_ptr`. */ 97 | wlmtk_element_t *wlmtk_dock_element(wlmtk_dock_t *dock_ptr); 98 | 99 | /** Unit tests for @ref wlmtk_dock_t. */ 100 | extern const bs_test_case_t wlmtk_dock_test_cases[]; 101 | 102 | #ifdef __cplusplus 103 | } // extern "C" 104 | #endif // __cplusplus 105 | 106 | #endif /* __WLMTK_DOCK_H__ */ 107 | /* == End of dock.h ======================================================== */ 108 | -------------------------------------------------------------------------------- /include/toolkit/env.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file env.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_ENV_H__ 21 | #define __WLMTK_ENV_H__ 22 | 23 | /** Forward declaration: Environment. */ 24 | typedef struct _wlmtk_env_t wlmtk_env_t; 25 | 26 | /** Forward declaration. */ 27 | struct wlr_cursor; 28 | /** Forward declaration. */ 29 | struct wlr_seat; 30 | /** Forward declaration. */ 31 | struct wlr_xcursor_manager; 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif // __cplusplus 36 | 37 | /** Cursor types. */ 38 | typedef enum { 39 | /** Default. */ 40 | WLMTK_CURSOR_DEFAULT, 41 | /** Resizing, southern border. */ 42 | WLMTK_CURSOR_RESIZE_S, 43 | /** Resizing, south-eastern corner. */ 44 | WLMTK_CURSOR_RESIZE_SE, 45 | /** Resizing, south-western corner. */ 46 | WLMTK_CURSOR_RESIZE_SW, 47 | } wlmtk_env_cursor_t; 48 | 49 | /** 50 | * Creates an environment state from the cursor. 51 | * 52 | * @param wlr_cursor_ptr 53 | * @param wlr_xcursor_manager_ptr 54 | * @param wlr_seat_ptr 55 | * 56 | * @return An environment state or NULL on error. 57 | */ 58 | wlmtk_env_t *wlmtk_env_create( 59 | struct wlr_cursor *wlr_cursor_ptr, 60 | struct wlr_xcursor_manager *wlr_xcursor_manager_ptr, 61 | struct wlr_seat *wlr_seat_ptr); 62 | 63 | /** 64 | * Destroys the environment state. 65 | * 66 | * @param env_ptr 67 | */ 68 | void wlmtk_env_destroy(wlmtk_env_t *env_ptr); 69 | 70 | /** 71 | * Sets a cursor. 72 | * 73 | * @param env_ptr 74 | * @param cursor 75 | */ 76 | void wlmtk_env_set_cursor(wlmtk_env_t *env_ptr, wlmtk_env_cursor_t cursor); 77 | 78 | /** 79 | * Returns the pointer to the wlr_seat. 80 | * 81 | * @param env_ptr 82 | */ 83 | struct wlr_seat *wlmtk_env_wlr_seat(wlmtk_env_t *env_ptr); 84 | 85 | #ifdef __cplusplus 86 | } // extern "C" 87 | #endif // __cplusplus 88 | 89 | #endif /* __WLMTK_ENV_H__ */ 90 | /* == End of env.h ========================================================= */ 91 | -------------------------------------------------------------------------------- /include/toolkit/fsm.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file fsm.h 4 | * Event-driven finite state machine. 5 | * 6 | * @copyright 7 | * Copyright 2023 Google LLC 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | #ifndef __WLMTK_FSM_H__ 22 | #define __WLMTK_FSM_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | struct _wlmtk_fsm_t; 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif // __cplusplus 33 | 34 | /** Forward declaration. */ 35 | typedef struct _wlmtk_fsm_t wlmtk_fsm_t; 36 | 37 | /** State machine definition. */ 38 | typedef struct { 39 | /** State before receiving the event. */ 40 | int state; 41 | /** Event. */ 42 | int event; 43 | /** Upon having (state, event): State to transition to. */ 44 | int to_state; 45 | /** Handler for the activity at (state, event). */ 46 | bool (*handler)(wlmtk_fsm_t *fsm_ptr, void *ud_ptr); 47 | } wlmtk_fsm_transition_t; 48 | 49 | /** Finite state machine. State. */ 50 | struct _wlmtk_fsm_t { 51 | /** The transitions table. */ 52 | const wlmtk_fsm_transition_t *transitions; 53 | /** Current state. */ 54 | int state; 55 | }; 56 | 57 | /** Sentinel element for state transition table. */ 58 | #define WLMTK_FSM_TRANSITION_SENTINEL { \ 59 | .state = -1, \ 60 | .event = -1, \ 61 | .to_state = -1, \ 62 | .handler = NULL, \ 63 | } 64 | 65 | /** 66 | * Initializes the finite-state machine. 67 | * 68 | * @param fsm_ptr 69 | * @param transitions 70 | * @param initial_state 71 | */ 72 | void wlmtk_fsm_init( 73 | wlmtk_fsm_t *fsm_ptr, 74 | const wlmtk_fsm_transition_t *transitions, 75 | int initial_state); 76 | 77 | /** 78 | * Handles an event for the finite-state machine. 79 | * 80 | * Will search for the transition matching (current state, event) and call the 81 | * associate handler. 82 | * 83 | * @param fsm_ptr 84 | * @param event 85 | * @param ud_ptr 86 | * 87 | * @return If a matching transition was found: The return value of the 88 | * associated handler (or true, if no handler was given). Otherwise, 89 | * returns false. 90 | */ 91 | bool wlmtk_fsm_event( 92 | wlmtk_fsm_t *fsm_ptr, 93 | int event, 94 | void *ud_ptr); 95 | 96 | /** Unit tests for the finite-state machine. */ 97 | extern const bs_test_case_t wlmtk_fsm_test_cases[]; 98 | 99 | #ifdef __cplusplus 100 | } // extern "C" 101 | #endif // __cplusplus 102 | 103 | #endif /* __WLMTK_FSM_H__ */ 104 | /* == End of fsm.h ====================================================== */ 105 | -------------------------------------------------------------------------------- /include/toolkit/gfxbuf.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file gfxbuf.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_GFXBUF_H__ 21 | #define __WLMTK_GFXBUF_H__ 22 | 23 | #include 24 | #include 25 | #define WLR_USE_UNSTABLE 26 | #include 27 | #undef WLR_USE_UNSTABLE 28 | 29 | struct wlr_buffer; 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif // __cplusplus 34 | 35 | /** 36 | * Creates a wlroots buffer tied to a libbase graphics buffer. 37 | * 38 | * This creates a libbase graphics buffer, and wraps it as `struct wlr_buffer`. 39 | * 40 | * @param width 41 | * @param height 42 | * 43 | * @return A struct wlr_buffer. Must be released using wlr_buffer_drop(). 44 | */ 45 | struct wlr_buffer *bs_gfxbuf_create_wlr_buffer( 46 | unsigned width, 47 | unsigned height); 48 | 49 | /** 50 | * Drops a WLR buffer, and sets the pointer to NULL. 51 | * 52 | * @param wlr_buffer_ptr_ptr Points to a pointer to a WLR buffer. The pointer 53 | * to the WLR buffer may be NULL; in that case, the 54 | * call is a no-op. 55 | */ 56 | void wlr_buffer_drop_nullify(struct wlr_buffer **wlr_buffer_ptr_ptr); 57 | 58 | /** 59 | * Returns the libbase graphics buffer for the `struct wlr_buffer`. 60 | * 61 | * @param wlr_buffer_ptr Pointer to a `struct wlr_buffer`. Must be a 62 | * `wlr_buffer` that was previously created by 63 | * @ref bs_gfxbuf_create_wlr_buffer. 64 | * 65 | * @return Pointer to the libbase graphics buffer. The `wlr_buffer_ptr` must 66 | * outlive the `bs_gfxbuf_t*`. Must not be destroyed. 67 | */ 68 | bs_gfxbuf_t *bs_gfxbuf_from_wlr_buffer(struct wlr_buffer *wlr_buffer_ptr); 69 | 70 | /** 71 | * Returns a `cairo_t` for the WLR buffer backed by a libbase graphics buffer. 72 | * 73 | * @param wlr_buffer_ptr Pointer to a `struct wlr_buffer`. Must be a 74 | * `wlr_buffer` that was previously created by 75 | * @ref bs_gfxbuf_create_wlr_buffer. 76 | * 77 | * @return Pointer to the the cairo. The `wlr_buffer_ptr` must outlive the 78 | * `cairo_t*`. It must be destroyed using `cairo_destroy`. 79 | */ 80 | cairo_t *cairo_create_from_wlr_buffer(struct wlr_buffer *wlr_buffer_ptr); 81 | 82 | #ifdef __cplusplus 83 | } // extern "C" 84 | #endif // __cplusplus 85 | 86 | #endif /* __WLMTK_GFXBUF_H__ */ 87 | /* == End of gfxbuf.h ====================================================== */ 88 | -------------------------------------------------------------------------------- /include/toolkit/image.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file image.h 4 | * 5 | * @copyright 6 | * Copyright 2024 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_IMAGE_H__ 21 | #define __WLMTK_IMAGE_H__ 22 | 23 | #include 24 | 25 | #include "element.h" 26 | #include "env.h" 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif // __cplusplus 31 | 32 | /** Forward declaration: State of a toolkit image. */ 33 | typedef struct _wlmtk_image_t wlmtk_image_t; 34 | 35 | /** 36 | * Creates a toolkit image: An element showing the image. 37 | * 38 | * @param image_path_ptr 39 | * @param env_ptr 40 | * 41 | * @return Pointer to the toolkit image, or NULL on error. 42 | */ 43 | wlmtk_image_t *wlmtk_image_create( 44 | const char *image_path_ptr, 45 | wlmtk_env_t *env_ptr); 46 | 47 | /** 48 | * Creates a toolkit image, scaled while preserving aspect ratio. 49 | * 50 | * @param image_path_ptr 51 | * @param width 52 | * @param height 53 | * @param env_ptr 54 | * 55 | * @return Pointer to the toolkit image or NULL on error. 56 | */ 57 | wlmtk_image_t *wlmtk_image_create_scaled( 58 | const char *image_path_ptr, 59 | int width, 60 | int height, 61 | wlmtk_env_t *env_ptr); 62 | 63 | /** 64 | * Destroys the toolkit image. 65 | * 66 | * @param image_ptr 67 | */ 68 | void wlmtk_image_destroy(wlmtk_image_t *image_ptr); 69 | 70 | /** @return the parent @ref wlmtk_element_t of `image_ptr`. */ 71 | wlmtk_element_t *wlmtk_image_element(wlmtk_image_t *image_ptr); 72 | 73 | /** Unit test cases. */ 74 | extern const bs_test_case_t wlmtk_image_test_cases[]; 75 | 76 | #ifdef __cplusplus 77 | } // extern "C" 78 | #endif // __cplusplus 79 | 80 | #endif /* __IMAGE_H__ */ 81 | /* == End of image.h ================================================== */ 82 | -------------------------------------------------------------------------------- /include/toolkit/input.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file input.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_INPUT_H__ 21 | #define __WLMTK_INPUT_H__ 22 | 23 | // BTN_LEFT, BTN_RIGHT, ... 24 | #include 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif // __cplusplus 29 | 30 | /** Forward declaration: Button event. */ 31 | typedef struct _wlmtk_button_event_t wlmtk_button_event_t; 32 | 33 | /** Button state. */ 34 | typedef enum { 35 | WLMTK_BUTTON_DOWN, 36 | WLMTK_BUTTON_UP, 37 | WLMTK_BUTTON_CLICK, 38 | WLMTK_BUTTON_DOUBLE_CLICK, 39 | } wlmtk_button_event_type_t; 40 | 41 | /** Button events. */ 42 | struct _wlmtk_button_event_t { 43 | /** Button for which the event applies: linux/input-event-codes.h */ 44 | uint32_t button; 45 | /** Type of the event: DOWN, UP, ... */ 46 | wlmtk_button_event_type_t type; 47 | /** Time of the button event, in milliseconds. */ 48 | uint32_t time_msec; 49 | }; 50 | 51 | #ifdef __cplusplus 52 | } // extern "C" 53 | #endif // __cplusplus 54 | 55 | #endif /* __WLMTK_INPUT_H__ */ 56 | /* == End of input.h ======================================================= */ 57 | -------------------------------------------------------------------------------- /include/toolkit/lock.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file lock.h 4 | * 5 | * @copyright 6 | * Copyright 2024 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_LOCK_H__ 21 | #define __WLMTK_LOCK_H__ 22 | 23 | /** Forward declaration: Lock. */ 24 | typedef struct _wlmtk_lock_t wlmtk_lock_t; 25 | 26 | #include "element.h" 27 | #include "env.h" 28 | #include "root.h" // IWYU pragma: keep 29 | 30 | /** Forward declaration: Session lock handle. */ 31 | struct wlr_session_lock_v1; 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif // __cplusplus 36 | 37 | /** 38 | * Creates a session lock handle. 39 | * 40 | * @param wlr_session_lock_v1_ptr 41 | * @param root_ptr 42 | * @param env_ptr 43 | * 44 | * @return The lock handle or NULL on error. 45 | */ 46 | wlmtk_lock_t *wlmtk_lock_create( 47 | struct wlr_session_lock_v1 *wlr_session_lock_v1_ptr, 48 | wlmtk_root_t *root_ptr, 49 | wlmtk_env_t *env_ptr); 50 | 51 | /** 52 | * Destroys the session lock handle. 53 | * 54 | * @param lock_ptr 55 | */ 56 | void wlmtk_lock_destroy(wlmtk_lock_t *lock_ptr); 57 | 58 | /** 59 | * @returns Pointer to @ref wlmtk_element_t of @ref wlmtk_lock_t::container. 60 | * */ 61 | wlmtk_element_t *wlmtk_lock_element(wlmtk_lock_t *lock_ptr); 62 | 63 | 64 | #ifdef __cplusplus 65 | } // extern "C" 66 | #endif // __cplusplus 67 | 68 | #endif /* __WLMTK_LOCK_H__ */ 69 | /* == End of lock.h ======================================================== */ 70 | -------------------------------------------------------------------------------- /include/toolkit/pane.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file pane.h 4 | * 5 | * @copyright 6 | * Copyright 2025 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_PANE_H__ 21 | #define __WLMTK_PANE_H__ 22 | 23 | struct _wlmtk_pane_t; 24 | /** Forward declaration: State of a (window or popup) pane. */ 25 | typedef struct _wlmtk_pane_t wlmtk_pane_t; 26 | 27 | #include 28 | #include 29 | 30 | #include "container.h" // IWYU pragma: keep 31 | #include "element.h" 32 | #include "env.h" 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif // __cplusplus 37 | 38 | /** State of a window or popup pane. */ 39 | struct _wlmtk_pane_t { 40 | /** Super class of the pane: A container, holds element and popups. */ 41 | wlmtk_container_t super_container; 42 | 43 | /** Points to the element contained in this pane. */ 44 | wlmtk_element_t *element_ptr; 45 | /** Container for the popups. */ 46 | wlmtk_container_t popup_container; 47 | }; 48 | 49 | /** 50 | * Initializes the pane with the given element. 51 | * 52 | * @param pane_ptr 53 | * @param element_ptr is added to @ref wlmtk_pane_t::super_container 54 | * until @ref wlmtk_pane_fini is called. Will *NOT* 55 | * take ownership. 56 | * @param env_ptr 57 | * 58 | * @return true on success. 59 | */ 60 | bool wlmtk_pane_init( 61 | wlmtk_pane_t *pane_ptr, 62 | wlmtk_element_t *element_ptr, 63 | wlmtk_env_t *env_ptr); 64 | 65 | /** 66 | * Un-initializes the pane. 67 | * 68 | * @param pane_ptr 69 | */ 70 | void wlmtk_pane_fini(wlmtk_pane_t *pane_ptr); 71 | 72 | /** @return Pointer to the superclass @ref wlmtk_element_t of the pane. */ 73 | wlmtk_element_t *wlmtk_pane_element(wlmtk_pane_t *pane_ptr); 74 | 75 | /** Adds a popup (pane). */ 76 | void wlmtk_pane_add_popup(wlmtk_pane_t *pane_ptr, wlmtk_pane_t *popup_ptr); 77 | 78 | /** Removes a popup (pane). */ 79 | void wlmtk_pane_remove_popup(wlmtk_pane_t *pane_ptr, wlmtk_pane_t *popup_ptr); 80 | 81 | /** Unit test cases. */ 82 | extern const bs_test_case_t wlmtk_pane_test_cases[]; 83 | 84 | #ifdef __cplusplus 85 | } // extern "C" 86 | #endif // __cplusplus 87 | 88 | #endif /* __WLMTK_PANE_H__ */ 89 | /* == End of pane.h ======================================================== */ 90 | -------------------------------------------------------------------------------- /include/toolkit/popup.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file popup.h 4 | * 5 | * @copyright 6 | * Copyright 2024 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_POPUP_H__ 21 | #define __WLMTK_POPUP_H__ 22 | 23 | #include 24 | 25 | struct _wlmtk_popup_t; 26 | /** Forward declaration: Popup. */ 27 | typedef struct _wlmtk_popup_t wlmtk_popup_t; 28 | 29 | #include "container.h" // IWYU pragma: keep 30 | #include "element.h" 31 | #include "env.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif // __cplusplus 36 | 37 | /** 38 | * State of a popup. 39 | * 40 | * A popup contains a @ref wlmtk_element_t, and may contain further popups. 41 | * These further popups will be stacked above the principal element, in order 42 | * of them being added. 43 | */ 44 | struct _wlmtk_popup_t { 45 | /** Super class of the panel. */ 46 | wlmtk_container_t super_container; 47 | 48 | /** And the popup container. Popups can contain child popups. */ 49 | wlmtk_container_t popup_container; 50 | 51 | /** The contained element. */ 52 | wlmtk_element_t *element_ptr; 53 | }; 54 | 55 | /** 56 | * Initializes the popup. 57 | * 58 | * @param popup_ptr 59 | * @param env_ptr 60 | * @param element_ptr 61 | * 62 | * @return true on success. 63 | */ 64 | bool wlmtk_popup_init( 65 | wlmtk_popup_t *popup_ptr, 66 | wlmtk_env_t *env_ptr, 67 | wlmtk_element_t *element_ptr); 68 | 69 | /** 70 | * Un-initializes the popup. Will remove it from the parent container. 71 | * 72 | * @param popup_ptr 73 | */ 74 | void wlmtk_popup_fini(wlmtk_popup_t *popup_ptr); 75 | 76 | /** Returns the base @ref wlmtk_element_t. */ 77 | wlmtk_element_t *wlmtk_popup_element(wlmtk_popup_t *popup_ptr); 78 | 79 | /** 80 | * Adds a further popup to `popup_ptr`. 81 | * 82 | * @param popup_ptr 83 | * @param further_popup_ptr 84 | */ 85 | void wlmtk_popup_add_popup(wlmtk_popup_t *popup_ptr, 86 | wlmtk_popup_t *further_popup_ptr); 87 | 88 | #ifdef __cplusplus 89 | } // extern "C" 90 | #endif // __cplusplus 91 | 92 | #endif /* __WLMTK_POPUP_H__ */ 93 | /* == End of popup.h ======================================================= */ 94 | -------------------------------------------------------------------------------- /include/toolkit/rectangle.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file rectangle.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_RECTANGLE_H__ 21 | #define __WLMTK_RECTANGLE_H__ 22 | 23 | #include 24 | #include 25 | 26 | #include "element.h" 27 | #include "env.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif // __cplusplus 32 | 33 | /** Forward declaration: Rectangle state. */ 34 | typedef struct _wlmtk_rectangle_t wlmtk_rectangle_t; 35 | 36 | /** 37 | * Creates a rectangle. Useful for margins and borders. 38 | * 39 | * @param env_ptr 40 | * @param width 41 | * @param height 42 | * @param color 43 | * 44 | * @return Pointer to the rectangle state or NULL on error. 45 | */ 46 | wlmtk_rectangle_t *wlmtk_rectangle_create( 47 | wlmtk_env_t *env_ptr, 48 | int width, 49 | int height, 50 | uint32_t color); 51 | 52 | /** 53 | * Destroys the rectangle. 54 | * 55 | * @param rectangle_ptr 56 | */ 57 | void wlmtk_rectangle_destroy(wlmtk_rectangle_t *rectangle_ptr); 58 | 59 | /** 60 | * Sets (or updates) the size of the rectangle. 61 | * 62 | * @param rectangle_ptr 63 | * @param width 64 | * @param height 65 | */ 66 | void wlmtk_rectangle_set_size( 67 | wlmtk_rectangle_t *rectangle_ptr, 68 | int width, 69 | int height); 70 | 71 | /** 72 | * Sets (or updates) the color of the rectangle. 73 | * 74 | * @param rectangle_ptr 75 | * @param color 76 | */ 77 | void wlmtk_rectangle_set_color( 78 | wlmtk_rectangle_t *rectangle_ptr, 79 | uint32_t color); 80 | 81 | /** Returns the superclass @ref wlmtk_element_t of the rectangle. */ 82 | wlmtk_element_t *wlmtk_rectangle_element(wlmtk_rectangle_t *rectangle_ptr); 83 | 84 | /** 85 | * Gets the @ref wlmtk_rectangle_t instance from it's element superclass. 86 | * 87 | * Requires `element_ptr` as pointer to @ref wlmtk_rectangle_t::super_element. 88 | * 89 | * @param element_ptr 90 | * 91 | * @return The pointer to the @ref wlmtk_rectangle_t instance. 92 | */ 93 | wlmtk_rectangle_t *wlmtk_rectangle_from_element(wlmtk_element_t *element_ptr); 94 | 95 | /** Unit tests. */ 96 | extern const bs_test_case_t wlmtk_rectangle_test_cases[]; 97 | 98 | #ifdef __cplusplus 99 | } // extern "C" 100 | #endif // __cplusplus 101 | 102 | #endif /* __WLMTK_RECTANGLE_H__ */ 103 | /* == End of rectangle.h =================================================== */ 104 | -------------------------------------------------------------------------------- /include/toolkit/resizebar.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file resizebar.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_RESIZEBAR_H__ 21 | #define __WLMTK_RESIZEBAR_H__ 22 | 23 | /** Forward declaration: Title bar. */ 24 | typedef struct _wlmtk_resizebar_t wlmtk_resizebar_t; 25 | 26 | #include 27 | #include 28 | 29 | #include "element.h" 30 | #include "env.h" 31 | #include "style.h" 32 | 33 | #include "window.h" // IWYU pragma: keep 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif // __cplusplus 38 | 39 | /** 40 | * Creates the resize bar. 41 | * 42 | * @param env_ptr 43 | * @param window_ptr 44 | * @param style_ptr 45 | * 46 | * @return Pointer to the resizebar state, or NULL on error. 47 | */ 48 | wlmtk_resizebar_t *wlmtk_resizebar_create( 49 | wlmtk_env_t *env_ptr, 50 | wlmtk_window_t *window_ptr, 51 | const wlmtk_resizebar_style_t *style_ptr); 52 | 53 | /** 54 | * Destroys the resize bar. 55 | * 56 | * @param resizebar_ptr 57 | */ 58 | void wlmtk_resizebar_destroy(wlmtk_resizebar_t *resizebar_ptr); 59 | 60 | /** 61 | * Sets the width of the resize bar. 62 | * 63 | * @param resizebar_ptr 64 | * @param width 65 | * 66 | * @return true on success. 67 | */ 68 | bool wlmtk_resizebar_set_width( 69 | wlmtk_resizebar_t * resizebar_ptr, 70 | unsigned width); 71 | 72 | /** 73 | * Returns the super Element of the resizebar. 74 | * 75 | * @param resizebar_ptr 76 | * 77 | * @return Pointer to the element. 78 | */ 79 | wlmtk_element_t *wlmtk_resizebar_element(wlmtk_resizebar_t *resizebar_ptr); 80 | 81 | /** Unit test cases. */ 82 | extern const bs_test_case_t wlmtk_resizebar_test_cases[]; 83 | 84 | #ifdef __cplusplus 85 | } // extern "C" 86 | #endif // __cplusplus 87 | 88 | #endif /* __WLMTK_RESIZEBAR_H__ */ 89 | /* == End of resizebar.h ================================================== */ 90 | -------------------------------------------------------------------------------- /include/toolkit/resizebar_area.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file resizebar_area.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_RESIZEBAR_AREA_H__ 21 | #define __WLMTK_RESIZEBAR_AREA_H__ 22 | 23 | #include 24 | #include // for bool 25 | #include // for uint32_t 26 | 27 | /** Forward declaration: Element of the resizebar. */ 28 | typedef struct _wlmtk_resizebar_area_t wlmtk_resizebar_area_t ; 29 | 30 | #include "element.h" 31 | #include "env.h" 32 | #include "style.h" 33 | #include "window.h" 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif // __cplusplus 38 | 39 | /** 40 | * Creates a resizebar button. 41 | * 42 | * @param window_ptr 43 | * @param env_ptr 44 | * @param edges 45 | * 46 | * @return Pointer to the resizebar button. 47 | */ 48 | wlmtk_resizebar_area_t *wlmtk_resizebar_area_create( 49 | wlmtk_window_t *window_ptr, 50 | wlmtk_env_t *env_ptr, 51 | uint32_t edges); 52 | 53 | /** 54 | * Destroys the resizebar element. 55 | * 56 | * @param resizebar_area_ptr 57 | */ 58 | void wlmtk_resizebar_area_destroy( 59 | wlmtk_resizebar_area_t *resizebar_area_ptr); 60 | 61 | /** 62 | * Redraws the element, with updated position and width. 63 | * 64 | * @param resizebar_area_ptr 65 | * @param gfxbuf_ptr 66 | * @param position 67 | * @param width 68 | * @param style_ptr 69 | * 70 | * @return true on success. 71 | */ 72 | bool wlmtk_resizebar_area_redraw( 73 | wlmtk_resizebar_area_t *resizebar_area_ptr, 74 | bs_gfxbuf_t *gfxbuf_ptr, 75 | unsigned position, 76 | unsigned width, 77 | const wlmtk_resizebar_style_t *style_ptr); 78 | 79 | /** Returns the button's super_buffer.super_element address. */ 80 | wlmtk_element_t *wlmtk_resizebar_area_element( 81 | wlmtk_resizebar_area_t *resizebar_area_ptr); 82 | 83 | /** Unit test cases. */ 84 | extern const bs_test_case_t wlmtk_resizebar_area_test_cases[]; 85 | 86 | #ifdef __cplusplus 87 | } // extern "C" 88 | #endif // __cplusplus 89 | 90 | #endif /* __WLMTK_RESIZEBAR_AREA_H__ */ 91 | /* == End of resizebar_area.h ============================================== */ 92 | -------------------------------------------------------------------------------- /include/toolkit/test.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file test.h 4 | * 5 | * @copyright 6 | * Copyright 2024 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMTK_TEST_H__ 21 | #define __WLMTK_TEST_H__ 22 | 23 | #include // IWYU pragma: keep 24 | #include 25 | 26 | /** Forward declaration. */ 27 | struct wlr_output; 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif // __cplusplus 32 | 33 | /** Unit test comparator: Whether _box matches expected dimensions. */ 34 | #define WLMTK_TEST_VERIFY_WLRBOX_EQ(_test, _x, _y, _width, _height, _box) \ 35 | do { \ 36 | struct wlr_box __box = (_box); \ 37 | int __x = (_x), __y = (_y), __width = (_width), __height = (_height); \ 38 | if (__x != __box.x || __y != __box.y || \ 39 | __height != __box.height || __width != __box.width) { \ 40 | bs_test_fail_at( \ 41 | (_test), __FILE__, __LINE__, \ 42 | "Expecting {%d, %d, %d, %d}, got '%s' {%d, %d, %d, %d}", \ 43 | __x, __y, __width, __height, \ 44 | #_box, __box.x, __box.y, __box.width, __box.height); \ 45 | } \ 46 | } while (false) 47 | 48 | /** Initializes a struct wlr_output sufficient for testing. */ 49 | void wlmtk_test_wlr_output_init(struct wlr_output *wlr_output_ptr); 50 | 51 | #ifdef __cplusplus 52 | } // extern "C" 53 | #endif // __cplusplus 54 | 55 | #endif /* __WLMTK_TEST_H__ */ 56 | /* == End of test.h ================================================== */ 57 | -------------------------------------------------------------------------------- /include/toolkit/toolkit.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file toolkit.h 4 | * 5 | * See @ref toolkit_page for documentation. 6 | * 7 | * @copyright 8 | * Copyright 2023 Google LLC 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); 11 | * you may not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * https://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | */ 22 | #ifndef __WLMTK_TOOLKIT_H__ 23 | #define __WLMTK_TOOLKIT_H__ 24 | 25 | // IWYU pragma: begin_exports 26 | #include "bordered.h" 27 | #include "box.h" 28 | #include "buffer.h" 29 | #include "button.h" 30 | #include "container.h" 31 | #include "content.h" 32 | #include "dock.h" 33 | #include "element.h" 34 | #include "env.h" 35 | #include "fsm.h" 36 | #include "gfxbuf.h" 37 | #include "image.h" 38 | #include "input.h" 39 | #include "layer.h" 40 | #include "lock.h" 41 | #include "menu.h" 42 | #include "menu_item.h" 43 | #include "pane.h" 44 | #include "panel.h" 45 | #include "popup.h" 46 | #include "primitives.h" 47 | #include "rectangle.h" 48 | #include "resizebar.h" 49 | #include "resizebar_area.h" 50 | #include "root.h" 51 | #include "style.h" 52 | #include "surface.h" 53 | #include "test.h" 54 | #include "tile.h" 55 | #include "titlebar.h" 56 | #include "titlebar_button.h" 57 | #include "titlebar_title.h" 58 | #include "util.h" 59 | #include "window.h" 60 | #include "workspace.h" 61 | // IWYU pragma: end_exports 62 | 63 | #ifdef __cplusplus 64 | extern "C" { 65 | #endif // __cplusplus 66 | 67 | #ifdef __cplusplus 68 | } // extern "C" 69 | #endif // __cplusplus 70 | 71 | #endif /* __WLMTK_TOOLKIT_H__ */ 72 | /* == End of toolkit.h ===================================================== */ 73 | -------------------------------------------------------------------------------- /iwyu-mappings.imp: -------------------------------------------------------------------------------- 1 | # -*- mode: python; -*- 2 | [ 3 | # Weird iwyu complaint to add "#include // for tm" 4 | { "symbol": ["tm", "public", "", "public" ]}, 5 | { "symbol": ["wl_list", "public", "", "public" ]}, 6 | ] 7 | -------------------------------------------------------------------------------- /libcairo-fontconfig.supp: -------------------------------------------------------------------------------- 1 | { 2 | 3 | Memcheck:Leak 4 | match-leak-kinds: definite 5 | fun:malloc 6 | obj:/usr/lib/x86_64-linux-gnu/libfontconfig.so.1.12.0 7 | obj:/usr/lib/x86_64-linux-gnu/libfontconfig.so.1.12.0 8 | fun:FcPatternDuplicate 9 | obj:/usr/lib/x86_64-linux-gnu/libcairo.so.2.11600.0 10 | obj:/usr/lib/x86_64-linux-gnu/libcairo.so.2.11600.0 11 | fun:cairo_toy_font_face_create 12 | fun:cairo_select_font_face 13 | fun:* 14 | } 15 | { 16 | 17 | Memcheck:Leak 18 | match-leak-kinds: definite 19 | fun:malloc 20 | obj:/usr/lib/x86_64-linux-gnu/libfontconfig.so.1.12.0 21 | obj:/usr/lib/x86_64-linux-gnu/libfontconfig.so.1.12.0 22 | obj:/usr/lib/x86_64-linux-gnu/libfontconfig.so.1.12.0 23 | obj:/usr/lib/x86_64-linux-gnu/libfontconfig.so.1.12.0 24 | obj:/usr/lib/x86_64-linux-gnu/libexpat.so.1.8.10 25 | obj:/usr/lib/x86_64-linux-gnu/libexpat.so.1.8.10 26 | obj:/usr/lib/x86_64-linux-gnu/libexpat.so.1.8.10 27 | fun:XML_ParseBuffer 28 | obj:/usr/lib/x86_64-linux-gnu/libfontconfig.so.1.12.0 29 | obj:/usr/lib/x86_64-linux-gnu/libfontconfig.so.1.12.0 30 | obj:/usr/lib/x86_64-linux-gnu/libfontconfig.so.1.12.0 31 | } 32 | -------------------------------------------------------------------------------- /libdrm.supp: -------------------------------------------------------------------------------- 1 | { 2 | 3 | Memcheck:Leak 4 | ... 5 | obj:/usr/lib/*/dri/* 6 | ... 7 | } 8 | -------------------------------------------------------------------------------- /protocols/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | CMAKE_MINIMUM_REQUIRED(VERSION 3.13) 16 | 17 | PKG_CHECK_MODULES(WAYLAND_PROTOCOLS REQUIRED IMPORTED_TARGET wayland-protocols>=1.32) 18 | PKG_CHECK_MODULES(WAYLAND_SERVER REQUIRED IMPORTED_TARGET wayland-server>=1.22.0) 19 | 20 | PKG_GET_VARIABLE(WAYLAND_PROTOCOL_DIR wayland-protocols pkgdatadir) 21 | 22 | INCLUDE(WaylandProtocol) 23 | 24 | SET(SOURCES) 25 | WaylandProtocol_ADD( 26 | SOURCES 27 | BASE_NAME wlmaker-icon-unstable-v1 28 | PROTOCOL_FILE wlmaker-icon-unstable-v1.xml 29 | SIDE server) 30 | 31 | PKG_GET_VARIABLE(WAYLAND_PROTOCOLDIR wayland-protocols pkgdatadir) 32 | # Needing XDG Shell, since the toplevel icon protocol refers to it. 33 | WaylandProtocol_ADD( 34 | SOURCES 35 | BASE_NAME xdg-shell 36 | PROTOCOL_FILE "${WAYLAND_PROTOCOLDIR}/stable/xdg-shell/xdg-shell.xml" 37 | SIDE server) 38 | 39 | ADD_LIBRARY(wlmaker_protocols STATIC) 40 | TARGET_SOURCES( 41 | wlmaker_protocols PRIVATE 42 | ${SOURCES}) 43 | 44 | TARGET_COMPILE_OPTIONS( 45 | wlmaker_protocols PRIVATE 46 | ${WAYLAND_SERVER_CFLAGS} 47 | ${WAYLAND_SERVER_CFLAGS_OTHER} 48 | ${WAYLAND_PROTOCOLS_CFLAGS} 49 | ${WAYLAND_PROTOCOLS_CFLAGS_OTHER}) 50 | -------------------------------------------------------------------------------- /share/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | CMAKE_MINIMUM_REQUIRED(VERSION 3.13) 16 | 17 | CONFIGURE_FILE( 18 | ${CMAKE_CURRENT_SOURCE_DIR}/wlmaker.desktop.in 19 | ${CMAKE_CURRENT_BINARY_DIR}/wlmaker.desktop 20 | @ONLY) 21 | INSTALL( 22 | FILES ${CMAKE_CURRENT_BINARY_DIR}/wlmaker.desktop 23 | TYPE DATA) 24 | 25 | CONFIGURE_FILE( 26 | ${CMAKE_CURRENT_SOURCE_DIR}/wlmclock.desktop.in 27 | ${CMAKE_CURRENT_BINARY_DIR}/wlmclock.desktop 28 | @ONLY) 29 | INSTALL( 30 | FILES ${CMAKE_CURRENT_BINARY_DIR}/wlmclock.desktop 31 | TYPE DATA) 32 | -------------------------------------------------------------------------------- /share/wlmaker.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=WaylandMaker 3 | Comment=A Wayland compositor inspired by Window Maker 4 | Exec=@CMAKE_INSTALL_PREFIX@/bin/wlmaker 5 | Type=Application 6 | -------------------------------------------------------------------------------- /share/wlmclock.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=WLMClock 3 | GenericName="Wayland Maker Clock dockapp" 4 | Comment="Display date and time" 5 | Exec=@CMAKE_INSTALL_PREFIX@/bin/wlmclock 6 | Type=Application 7 | Categories=Utility;Clock; 8 | Keywords=clock;dockapp;wlmaker 9 | -------------------------------------------------------------------------------- /src/backend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | CMAKE_MINIMUM_REQUIRED(VERSION 3.13) 16 | 17 | SET(PUBLIC_HEADER_FILES 18 | backend.h 19 | output.h 20 | output_config.h 21 | output_manager.h) 22 | 23 | ADD_LIBRARY(backend STATIC 24 | backend.c 25 | output.c 26 | output_config.c 27 | output_manager.c) 28 | 29 | TARGET_INCLUDE_DIRECTORIES( 30 | backend 31 | PUBLIC 32 | ${PROJECT_SOURCE_DIR}/include 33 | PRIVATE 34 | ${WAYLAND_SERVER_INCLUDE_DIRS} 35 | ${WLROOTS_INCLUDE_DIRS} 36 | ${PROJECT_SOURCE_DIR}/include 37 | ) 38 | TARGET_INCLUDE_DIRECTORIES( 39 | backend 40 | PRIVATE 41 | ${PROJECT_SOURCE_DIR}/include/backend 42 | ) 43 | 44 | SET_TARGET_PROPERTIES( 45 | backend PROPERTIES 46 | VERSION 1.0 47 | PUBLIC_HEADER "${PUBLIC_HEADER_FILES}" 48 | ) 49 | 50 | TARGET_COMPILE_OPTIONS( 51 | backend PRIVATE 52 | ${WAYLAND_SERVER_CFLAGS} 53 | ${WAYLAND_SERVER_CFLAGS_OTHER} 54 | ) 55 | 56 | TARGET_LINK_LIBRARIES( 57 | backend 58 | PUBLIC 59 | libbase 60 | libbase_plist 61 | PkgConfig::WAYLAND_SERVER 62 | PRIVATE 63 | toolkit 64 | PkgConfig::WLROOTS) 65 | 66 | IF(iwyu_path_and_options) 67 | SET_TARGET_PROPERTIES( 68 | backend PROPERTIES 69 | C_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}") 70 | ENDIF(iwyu_path_and_options) 71 | -------------------------------------------------------------------------------- /src/background.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file background.h 4 | * 5 | * @copyright 6 | * Copyright 2024 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __BACKGROUND_H__ 21 | #define __BACKGROUND_H__ 22 | 23 | #include 24 | 25 | #include "toolkit/toolkit.h" 26 | 27 | struct wlr_output_layout; 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif // __cplusplus 32 | 33 | /** Forward declaration: Background state. */ 34 | typedef struct _wlmaker_background_t wlmaker_background_t; 35 | 36 | /** 37 | * Creates a background, derived from a @ref wlmtk_panel_t. 38 | * 39 | * @param workspace_ptr 40 | * @param wlr_output_layout_ptr 41 | * @param color 42 | * @param env_ptr 43 | * 44 | * @return A handle for the background, or NULL on error. 45 | */ 46 | wlmaker_background_t *wlmaker_background_create( 47 | wlmtk_workspace_t *workspace_ptr, 48 | struct wlr_output_layout *wlr_output_layout_ptr, 49 | uint32_t color, 50 | wlmtk_env_t *env_ptr); 51 | 52 | /** 53 | * Destroys the background. 54 | * 55 | * @param background_ptr 56 | */ 57 | void wlmaker_background_destroy(wlmaker_background_t *background_ptr); 58 | 59 | #ifdef __cplusplus 60 | } // extern "C" 61 | #endif // __cplusplus 62 | 63 | #endif /* __BACKGROUND_H__ */ 64 | /* == End of background.h ================================================== */ 65 | -------------------------------------------------------------------------------- /src/backtrace.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file backtrace.h 4 | * 5 | * @copyright 6 | * Copyright 2025 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __BACKTRACE_H__ 21 | #define __BACKTRACE_H__ 22 | 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif // __cplusplus 28 | 29 | /** 30 | * Sets up signal handlers to catch issues and log a backtrace. 31 | * 32 | * @param filename_ptr path name of the executable file; if it is NULL 33 | * the library will try system-specific path names. 34 | * If not NULL, FILENAME must point to a permanent 35 | * buffer. 36 | * 37 | * @return true on success. 38 | */ 39 | bool wlmaker_backtrace_setup(const char *filename_ptr); 40 | 41 | #ifdef __cplusplus 42 | } // extern "C" 43 | #endif // __cplusplus 44 | 45 | #endif /* __BACKTRACE_H__ */ 46 | /* == End of backtrace.h =================================================== */ 47 | -------------------------------------------------------------------------------- /src/clip.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file clip.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | * 20 | * Creates the wlmaker clip. A view, with server-bound surfaces, that act 21 | * as a workspace-local dock and a workspace pager. 22 | * 23 | * Corresponding Window Maker documentation: 24 | * http://www.windowmaker.org/docs/guidedtour/clip.html 25 | */ 26 | #ifndef __CLIP_H__ 27 | #define __CLIP_H__ 28 | 29 | #include 30 | #include 31 | 32 | /** Forward definition: Clip handle. */ 33 | typedef struct _wlmaker_clip_t wlmaker_clip_t; 34 | 35 | #include "config.h" 36 | #include "server.h" 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif // __cplusplus 41 | 42 | /** 43 | * Creates the Clip. Needs the server to be up with workspaces running. 44 | * 45 | * @param server_ptr 46 | * @param state_dict_ptr 47 | * @param style_ptr 48 | * 49 | * @return Pointer to the Clip handle, or NULL on error. 50 | */ 51 | wlmaker_clip_t *wlmaker_clip_create( 52 | wlmaker_server_t *server_ptr, 53 | bspl_dict_t *state_dict_ptr, 54 | const wlmaker_config_style_t *style_ptr); 55 | 56 | /** 57 | * Destroys the Clip. 58 | * 59 | * @param clip_ptr 60 | */ 61 | void wlmaker_clip_destroy(wlmaker_clip_t *clip_ptr); 62 | 63 | /** Unit test cases. */ 64 | extern const bs_test_case_t wlmaker_clip_test_cases[]; 65 | 66 | #ifdef __cplusplus 67 | } // extern "C" 68 | #endif // __cplusplus 69 | 70 | #endif /* __CLIP_H__ */ 71 | /* == End of clip.h ======================================================== */ 72 | -------------------------------------------------------------------------------- /src/corner.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file corner.h 4 | * 5 | * @copyright 6 | * Copyright 2024 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __CORNER_H__ 21 | #define __CORNER_H__ 22 | 23 | /** Forward declaration: State of hot corner monitor. */ 24 | typedef struct _wlmaker_corner_t wlmaker_corner_t; 25 | 26 | #include 27 | #include 28 | 29 | #include "cursor.h" // IWYU pragma: keep 30 | #include "server.h" // IWYU pragma: keep 31 | 32 | struct wl_event_loop; 33 | struct wlr_output_layout; 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif // __cplusplus 38 | 39 | /** 40 | * Creates the hot-corner handler. 41 | * 42 | * @param hot_corner_config_dict_ptr 43 | * @param wl_event_loop_ptr 44 | * @param wlr_output_layout_ptr 45 | * @param cursor_ptr 46 | * @param server_ptr 47 | * 48 | * @return Pointer to the hot-corner monitor. 49 | */ 50 | wlmaker_corner_t *wlmaker_corner_create( 51 | bspl_dict_t *hot_corner_config_dict_ptr, 52 | struct wl_event_loop *wl_event_loop_ptr, 53 | struct wlr_output_layout *wlr_output_layout_ptr, 54 | wlmaker_cursor_t *cursor_ptr, 55 | wlmaker_server_t *server_ptr); 56 | 57 | /** 58 | * Destroys the hot-corner handler. 59 | * 60 | * @param corner_ptr 61 | */ 62 | void wlmaker_corner_destroy(wlmaker_corner_t *corner_ptr); 63 | 64 | /** Unit test cases. */ 65 | extern const bs_test_case_t wlmaker_corner_test_cases[]; 66 | 67 | #ifdef __cplusplus 68 | } // extern "C" 69 | #endif // __cplusplus 70 | 71 | #endif /* __CORNER_H__ */ 72 | /* == End of corner.h ====================================================== */ 73 | -------------------------------------------------------------------------------- /src/dock.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file dock.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | * 20 | * Creates the wlmaker dock: A view, with server-bound surfaces, that acts as 21 | * launcher for Apps. 22 | * 23 | * Corresponding Window Maker documentation: 24 | * http://www.windowmaker.org/docs/guidedtour/dock.html 25 | */ 26 | #ifndef __DOCK_H__ 27 | #define __DOCK_H__ 28 | 29 | #include 30 | #include 31 | 32 | /** Forward definition: Dock handle. */ 33 | typedef struct _wlmaker_dock_t wlmaker_dock_t; 34 | 35 | #include "config.h" 36 | #include "server.h" 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif // __cplusplus 41 | 42 | /** 43 | * Creates the Dock handle. Needs the server to be up with workspaces running. 44 | * 45 | * @param server_ptr 46 | * @param state_dict_ptr 47 | * @param style_ptr 48 | * 49 | * @return Pointer to the Dock handle, or NULL on error. 50 | */ 51 | wlmaker_dock_t *wlmaker_dock_create( 52 | wlmaker_server_t *server_ptr, 53 | bspl_dict_t *state_dict_ptr, 54 | const wlmaker_config_style_t *style_ptr); 55 | 56 | /** 57 | * Destroys the Dock handle. 58 | * 59 | * @param dock_ptr 60 | */ 61 | void wlmaker_dock_destroy(wlmaker_dock_t *dock_ptr); 62 | 63 | /** Unit test cases. */ 64 | extern const bs_test_case_t wlmaker_dock_test_cases[]; 65 | 66 | #ifdef __cplusplus 67 | } // extern "C" 68 | #endif // __cplusplus 69 | 70 | #endif /* __DOCK_H__ */ 71 | /* == End of dock.h ======================================================== */ 72 | -------------------------------------------------------------------------------- /src/icon_manager.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file icon_manager.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __ICON_MANAGER_H__ 21 | #define __ICON_MANAGER_H__ 22 | 23 | struct wl_display; 24 | 25 | /** Forward declaration: Icon Manager handle. */ 26 | typedef struct _wlmaker_icon_manager_t wlmaker_icon_manager_t; 27 | 28 | /** Forward declaration: Toplevel icon handle. */ 29 | typedef struct _wlmaker_toplevel_icon_t wlmaker_toplevel_icon_t; 30 | 31 | #include "server.h" // IWYU pragma: keep 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif // __cplusplus 36 | 37 | /** 38 | * Creates an icon manager. 39 | * 40 | * @param wl_display_ptr 41 | * @param server_ptr 42 | * 43 | * @return The handle of the icon manager or NULL on error. Must be destroyed 44 | * by calling @ref wlmaker_icon_manager_destroy. 45 | */ 46 | wlmaker_icon_manager_t *wlmaker_icon_manager_create( 47 | struct wl_display *wl_display_ptr, 48 | wlmaker_server_t *server_ptr); 49 | 50 | /** 51 | * Destroys the Icon Manager. 52 | * 53 | * @param icon_manager_ptr 54 | */ 55 | void wlmaker_icon_manager_destroy( 56 | wlmaker_icon_manager_t *icon_manager_ptr); 57 | 58 | #ifdef __cplusplus 59 | } // extern "C" 60 | #endif // __cplusplus 61 | 62 | #endif /* __ICON_MANAGER_H__ */ 63 | /* == End of icon_manager.h ================================================ */ 64 | -------------------------------------------------------------------------------- /src/idle.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file idle.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __IDLE_H__ 21 | #define __IDLE_H__ 22 | 23 | #include 24 | 25 | /** Forward declaration: Idle monitor handle. */ 26 | typedef struct _wlmaker_idle_monitor_t wlmaker_idle_monitor_t; 27 | 28 | #include "server.h" // IWYU pragma: keep 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif // __cplusplus 33 | 34 | /** 35 | * Creates the idle monitor. 36 | * 37 | * @param server_ptr 38 | * 39 | * @return Handle of the idle monitor or NULL on error. 40 | */ 41 | wlmaker_idle_monitor_t *wlmaker_idle_monitor_create( 42 | wlmaker_server_t *server_ptr); 43 | 44 | /** 45 | * Destroys the idle monitor. 46 | * 47 | * @param idle_monitor_ptr 48 | */ 49 | void wlmaker_idle_monitor_destroy(wlmaker_idle_monitor_t *idle_monitor_ptr); 50 | 51 | /** 52 | * Resets the idle monitor: For example, when a key is pressed. 53 | * 54 | * @param idle_monitor_ptr 55 | */ 56 | void wlmaker_idle_monitor_reset(wlmaker_idle_monitor_t *idle_monitor_ptr); 57 | 58 | /** 59 | * Executes the configured 'Command' for locking. Overrides inhibits. 60 | * 61 | * @param idle_monitor_ptr 62 | * 63 | * @return true on success. 64 | */ 65 | bool wlmaker_idle_monitor_lock(wlmaker_idle_monitor_t *idle_monitor_ptr); 66 | 67 | /** 68 | * Inhibits locking: Increases inhibitor counter, which will prevent locking 69 | * when the idle timer expires. @see wlmaker_idle_monitor_uninhibit for 70 | * releasing the inhibitor. 71 | * 72 | * @param idle_monitor_ptr 73 | */ 74 | void wlmaker_idle_monitor_inhibit(wlmaker_idle_monitor_t *idle_monitor_ptr); 75 | 76 | /** 77 | * Uninhibits locking: Decreases the counter. If 0, and no other inhibitors 78 | * found, an expired idle timer will lock. 79 | * 80 | * @param idle_monitor_ptr 81 | */ 82 | void wlmaker_idle_monitor_uninhibit(wlmaker_idle_monitor_t *idle_monitor_ptr); 83 | 84 | #ifdef __cplusplus 85 | } // extern "C" 86 | #endif // __cplusplus 87 | 88 | #endif /* __IDLE_H__ */ 89 | /* == End of idle.h ======================================================== */ 90 | -------------------------------------------------------------------------------- /src/keyboard.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file keyboard.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMAKER_KEYBOARD_H__ 21 | #define __WLMAKER_KEYBOARD_H__ 22 | 23 | #define WLR_USE_UNSTABLE 24 | #include 25 | #include 26 | #undef WLR_USE_UNSTABLE 27 | 28 | #include "server.h" // IWYU pragma: keep 29 | 30 | struct wlr_keyboard; 31 | 32 | /** Type of the keyboard handle. */ 33 | typedef struct _wlmaker_keyboard_t wlmaker_keyboard_t; 34 | 35 | /** 36 | * Creates a handle for a registered keyboard. 37 | * 38 | * @param server_ptr 39 | * @param wlr_keyboard_ptr 40 | * @param wlr_seat_ptr 41 | * 42 | * @return The handle or NULL on error. Free via wlmaker_keyboard_destroy(). 43 | */ 44 | wlmaker_keyboard_t *wlmaker_keyboard_create( 45 | wlmaker_server_t *server_ptr, 46 | struct wlr_keyboard *wlr_keyboard_ptr, 47 | struct wlr_seat *wlr_seat_ptr); 48 | 49 | /** 50 | * Destroys the keyboard handle. 51 | * 52 | * @param keyboard_ptr 53 | */ 54 | void wlmaker_keyboard_destroy(wlmaker_keyboard_t *keyboard_ptr); 55 | 56 | #ifdef __cplusplus 57 | } // extern "C" 58 | #endif // __cplusplus 59 | 60 | #endif /* __WLMAKER_KEYBOARD_H__ */ 61 | /* == End of keyboard.h ==================================================== */ 62 | -------------------------------------------------------------------------------- /src/launcher.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file launcher.h 4 | * 5 | * @copyright 6 | * Copyright 2024 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __LAUNCHER_H__ 21 | #define __LAUNCHER_H__ 22 | 23 | #include 24 | #include 25 | 26 | #include "subprocess_monitor.h" 27 | #include "toolkit/toolkit.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif // __cplusplus 32 | 33 | /** Forward declaration: Launcher handle. */ 34 | typedef struct _wlmaker_launcher_t wlmaker_launcher_t; 35 | 36 | /** 37 | * Creates an application launcher, configured from a plist dict. 38 | * 39 | * @param style_ptr 40 | * @param dict_ptr 41 | * @param monitor_ptr 42 | * @param env_ptr 43 | * 44 | * @return Pointer to the launcher handle or NULL on error. 45 | */ 46 | wlmaker_launcher_t *wlmaker_launcher_create_from_plist( 47 | const wlmtk_tile_style_t *style_ptr, 48 | bspl_dict_t *dict_ptr, 49 | wlmaker_subprocess_monitor_t *monitor_ptr, 50 | wlmtk_env_t *env_ptr); 51 | 52 | /** 53 | * Destroys the application launcher. 54 | * 55 | * @param launcher_ptr 56 | */ 57 | void wlmaker_launcher_destroy(wlmaker_launcher_t *launcher_ptr); 58 | 59 | /** @return A pointer to the @ref wlmtk_tile_t superclass of `launcher_ptr`. */ 60 | wlmtk_tile_t *wlmaker_launcher_tile(wlmaker_launcher_t *launcher_ptr); 61 | 62 | /** Unit tests. */ 63 | extern const bs_test_case_t wlmaker_launcher_test_cases[]; 64 | 65 | #ifdef __cplusplus 66 | } // extern "C" 67 | #endif // __cplusplus 68 | 69 | #endif /* __LAUNCHER_H__ */ 70 | /* == End of launcher.h ==================================================== */ 71 | -------------------------------------------------------------------------------- /src/layer_panel.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file layer_panel.h 4 | * 5 | * @copyright 6 | * Copyright 2024 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __LAYER_PANEL_H__ 21 | #define __LAYER_PANEL_H__ 22 | 23 | #include 24 | 25 | /** Handler for a layer panel. */ 26 | typedef struct _wlmaker_layer_panel_t wlmaker_layer_panel_t; 27 | 28 | #include "server.h" 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif // __cplusplus 33 | 34 | /** Forward declaration for wlroots layer surface. */ 35 | struct wlr_layer_surface_v1; 36 | 37 | /** 38 | * Creates a layer panel for the given layer surface. 39 | * 40 | * A layer panel is the implementation of a WLroots layer shell surface. 41 | * 42 | * @param wlr_layer_surface_v1_ptr 43 | * @param server_ptr 44 | * 45 | * @return The handler for the layer surface or NULL on error. The associated 46 | * resources will be destroyed once `wlr_layer_surface_v1_ptr` is 47 | * destroyed. 48 | */ 49 | wlmaker_layer_panel_t *wlmaker_layer_panel_create( 50 | struct wlr_layer_surface_v1 *wlr_layer_surface_v1_ptr, 51 | wlmaker_server_t *server_ptr); 52 | 53 | /** Unit test cases of layer panel. */ 54 | extern const bs_test_case_t wlmaker_layer_panel_test_cases[]; 55 | 56 | #ifdef __cplusplus 57 | } // extern "C" 58 | #endif // __cplusplus 59 | 60 | #endif /* __LAYER_PANEL_H__ */ 61 | /* == End of layer_panel.h ================================================= */ 62 | -------------------------------------------------------------------------------- /src/layer_shell.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file layer_shell.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __LAYER_SHELL_H__ 21 | #define __LAYER_SHELL_H__ 22 | 23 | /** Handle for the layer shell. */ 24 | typedef struct _wlmaker_layer_shell_t wlmaker_layer_shell_t; 25 | 26 | #include "server.h" // IWYU pragma: keep 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif // __cplusplus 31 | 32 | /** 33 | * Creates a layer shell handler. 34 | * 35 | * @param server_ptr 36 | * 37 | * @return A handle to the layer shell handler, or NULL on error. 38 | */ 39 | wlmaker_layer_shell_t *wlmaker_layer_shell_create( 40 | wlmaker_server_t *server_ptr); 41 | 42 | /** 43 | * Destroys the layer shell handler. 44 | * 45 | * @param layer_shell_ptr 46 | */ 47 | void wlmaker_layer_shell_destroy(wlmaker_layer_shell_t *layer_shell_ptr); 48 | 49 | #ifdef __cplusplus 50 | } // extern "C" 51 | #endif // __cplusplus 52 | 53 | #endif /* __LAYER_SHELL_H__ */ 54 | /* == End of layer_shell.h ================================================= */ 55 | -------------------------------------------------------------------------------- /src/lock_mgr.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file lock_mgr.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __LOCK_MGR_H__ 21 | #define __LOCK_MGR_H__ 22 | 23 | /** Forward declaration: State of the session lock manager. */ 24 | typedef struct _wlmaker_lock_mgr_t wlmaker_lock_mgr_t; 25 | 26 | #include "server.h" // IWYU pragma: keep 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif // __cplusplus 31 | 32 | /** 33 | * Creates the session lock manager. 34 | * 35 | * @param server_ptr 36 | * 37 | * @return The session lock manager handler or NULL on error. 38 | */ 39 | wlmaker_lock_mgr_t *wlmaker_lock_mgr_create( 40 | wlmaker_server_t *server_ptr); 41 | 42 | /** 43 | * Destroys the session lock manager. 44 | * 45 | * @param lock_mgr_ptr 46 | */ 47 | void wlmaker_lock_mgr_destroy(wlmaker_lock_mgr_t *lock_mgr_ptr); 48 | 49 | #ifdef __cplusplus 50 | } // extern "C" 51 | #endif // __cplusplus 52 | 53 | #endif /* __LOCK_MGR_H__ */ 54 | /* == End of lock_mgr.h ==================================================== */ 55 | -------------------------------------------------------------------------------- /src/root_menu.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file root_menu.h 4 | * 5 | * @copyright 6 | * Copyright 2024 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMAKER_ROOT_MENU_H__ 21 | #define __WLMAKER_ROOT_MENU_H__ 22 | 23 | #include "toolkit/toolkit.h" 24 | 25 | /** Forward declaration: State of root menu. */ 26 | typedef struct _wlmaker_root_menu_t wlmaker_root_menu_t; 27 | 28 | #include "server.h" // IWYU pragma: keep 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif // __cplusplus 33 | 34 | /** 35 | * Creates a root menu. 36 | * 37 | * @param server_ptr 38 | * @param window_style_ptr 39 | * @param menu_style_ptr 40 | * @param env_ptr 41 | * 42 | * @return Handle of the root menu, or NULL on error. 43 | */ 44 | wlmaker_root_menu_t *wlmaker_root_menu_create( 45 | wlmaker_server_t *server_ptr, 46 | const wlmtk_window_style_t *window_style_ptr, 47 | const wlmtk_menu_style_t *menu_style_ptr, 48 | wlmtk_env_t *env_ptr); 49 | 50 | /** 51 | * Destroys the root menu. 52 | * 53 | * @param root_menu_ptr 54 | */ 55 | void wlmaker_root_menu_destroy(wlmaker_root_menu_t *root_menu_ptr); 56 | 57 | /** @return the window holding the root menu. */ 58 | wlmtk_window_t *wlmaker_root_menu_window(wlmaker_root_menu_t *root_menu_ptr); 59 | 60 | /** @return Pointer to @ref wlmtk_menu_t of the root menu. */ 61 | wlmtk_menu_t *wlmaker_root_menu_menu(wlmaker_root_menu_t *root_menu_ptr); 62 | 63 | #ifdef __cplusplus 64 | } // extern "C" 65 | #endif // __cplusplus 66 | 67 | #endif /* __ROOT_MENU_H__ */ 68 | /* == End of root_menu.h =================================================== */ 69 | -------------------------------------------------------------------------------- /src/task_list.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file task_list.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __TASK_LIST_H__ 21 | #define __TASK_LIST_H__ 22 | 23 | /** Forward definition: Task list handle. */ 24 | typedef struct _wlmaker_task_list_t wlmaker_task_list_t; 25 | 26 | #include "config.h" 27 | #include "server.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif // __cplusplus 32 | 33 | // TODO(kaeser@gubbe.ch): Move this to wlmaker_keyboard. 34 | // Taskswitch: 35 | // modifer = ALT, and PRESSED is TAB enables it, and will switch focus 36 | // to the next-open View. 37 | // 38 | // - TAB will switch focus one further 39 | // - Shift-TAB will switch focus one back 40 | // (- Cursor left/right will also switch focus further/one back) 41 | // - Esc will restore focus of the view that has it before switcher. 42 | // 43 | // will remain active until: 44 | // - ALT is released 45 | // - any key outside the handled keys are pressed 46 | // - mouse is presset outside the task switch window 47 | // - workspace is switched. 48 | // 49 | // Means: It needs a means of... 50 | // - grabbing keyboard focus and holding it until release. 51 | // - grabbing mouse focus and holding it until release. 52 | // - not losing focus and top-of-stack until release. 53 | // => Should be atop each layer -> have it's own layer? or OVERLAY ? 54 | // (likely go with overlay) 55 | // 56 | // => means, this is like a "layer view" except the extra focus constraints. 57 | 58 | /** 59 | * Creates a task list for the server. 60 | * 61 | * Will allocate the task list handle, and register signal handlers so the task 62 | * list reacts to `task_list_enabled_event` and `task_list_disabled_event` of 63 | * the `wlmaker_server_t`. 64 | * 65 | * @param server_ptr 66 | * @param style_ptr 67 | * 68 | * @return The task list handle or NULL on error. Must be released by calling 69 | * @ref wlmaker_task_list_destroy. 70 | */ 71 | wlmaker_task_list_t *wlmaker_task_list_create( 72 | wlmaker_server_t *server_ptr, 73 | const wlmaker_config_style_t *style_ptr); 74 | 75 | /** 76 | * Destroys the task list, as created by @ref wlmaker_task_list_create. 77 | * 78 | * @param task_list_ptr 79 | */ 80 | void wlmaker_task_list_destroy( 81 | wlmaker_task_list_t *task_list_ptr); 82 | 83 | #ifdef __cplusplus 84 | } // extern "C" 85 | #endif // __cplusplus 86 | 87 | #endif /* __TASK_LIST_H__ */ 88 | /* == End of task_list.h =================================================== */ 89 | -------------------------------------------------------------------------------- /src/tl_menu.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file tl_menu.h 4 | * 5 | * @copyright 6 | * Copyright 2025 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __WLMAKER_TL_MENU_H__ 21 | #define __WLMAKER_TL_MENU_H__ 22 | 23 | #include "toolkit/toolkit.h" 24 | 25 | #include "server.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif // __cplusplus 30 | 31 | /** Forward declaration: State of a toplevel's menu. */ 32 | typedef struct _wlmaker_tl_menu_t wlmaker_tl_menu_t; 33 | 34 | /** 35 | * Creates a (window) menu for a toplevel (window). 36 | * 37 | * @param window_ptr 38 | * @param server_ptr 39 | * 40 | * @return pointer to the toplevel's menu state or NULL on error. 41 | */ 42 | wlmaker_tl_menu_t *wlmaker_tl_menu_create( 43 | wlmtk_window_t *window_ptr, 44 | wlmaker_server_t *server_ptr); 45 | 46 | /** 47 | * Destroys the toplevel's menu. 48 | * 49 | * @param tl_menu_ptr 50 | */ 51 | void wlmaker_tl_menu_destroy(wlmaker_tl_menu_t *tl_menu_ptr); 52 | 53 | #ifdef __cplusplus 54 | } // extern "C" 55 | #endif // __cplusplus 56 | 57 | #endif /* __TL_MENU_H__ */ 58 | /* == End of tl_menu.h ===================================================== */ 59 | -------------------------------------------------------------------------------- /src/toolkit/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | CMAKE_MINIMUM_REQUIRED(VERSION 3.13) 16 | 17 | SET(PUBLIC_HEADER_FILES 18 | bordered.h 19 | box.h 20 | buffer.h 21 | button.h 22 | container.h 23 | content.h 24 | dock.h 25 | element.h 26 | env.h 27 | fsm.h 28 | gfxbuf.h 29 | image.h 30 | input.h 31 | layer.h 32 | lock.h 33 | menu.h 34 | menu_item.h 35 | pane.h 36 | panel.h 37 | popup.h 38 | primitives.h 39 | rectangle.h 40 | resizebar.h 41 | resizebar_area.h 42 | root.h 43 | style.h 44 | surface.h 45 | test.h 46 | tile.h 47 | titlebar.h 48 | titlebar_button.h 49 | titlebar_title.h 50 | toolkit.h 51 | util.h 52 | window.h 53 | workspace.h 54 | ) 55 | 56 | ADD_LIBRARY(toolkit STATIC) 57 | TARGET_SOURCES(toolkit PRIVATE 58 | bordered.c 59 | box.c 60 | buffer.c 61 | button.c 62 | container.c 63 | content.c 64 | dock.c 65 | element.c 66 | env.c 67 | fsm.c 68 | gfxbuf.c 69 | image.c 70 | layer.c 71 | lock.c 72 | menu.c 73 | menu_item.c 74 | pane.c 75 | panel.c 76 | popup.c 77 | primitives.c 78 | rectangle.c 79 | resizebar.c 80 | resizebar_area.c 81 | root.c 82 | style.c 83 | surface.c 84 | test.c 85 | tile.c 86 | titlebar.c 87 | titlebar_button.c 88 | titlebar_title.c 89 | util.c 90 | window.c 91 | workspace.c 92 | ) 93 | TARGET_INCLUDE_DIRECTORIES( 94 | toolkit PUBLIC 95 | ${WLROOTS_INCLUDE_DIRS} 96 | ${CAIRO_INCLUDE_DIRS} 97 | ${PROJECT_SOURCE_DIR}/include 98 | ) 99 | TARGET_INCLUDE_DIRECTORIES( 100 | toolkit PRIVATE 101 | ${PROJECT_SOURCE_DIR}/include/toolkit 102 | ) 103 | SET_TARGET_PROPERTIES( 104 | toolkit PROPERTIES 105 | VERSION 1.0 106 | PUBLIC_HEADER "${PUBLIC_HEADER_FILES}" 107 | ) 108 | 109 | TARGET_COMPILE_OPTIONS( 110 | toolkit PRIVATE 111 | ${WAYLAND_SERVER_CFLAGS} 112 | ${WAYLAND_SERVER_CFLAGS_OTHER} 113 | ) 114 | 115 | TARGET_LINK_LIBRARIES( 116 | toolkit 117 | PUBLIC libbase PkgConfig::CAIRO PkgConfig::WLROOTS 118 | PRIVATE PkgConfig::WAYLAND_SERVER 119 | ) 120 | 121 | IF(iwyu_path_and_options) 122 | SET_TARGET_PROPERTIES( 123 | toolkit PROPERTIES 124 | C_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}") 125 | ENDIF(iwyu_path_and_options) 126 | -------------------------------------------------------------------------------- /src/toolkit/style.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file style.c 4 | * 5 | * @copyright 6 | * Copyright 2024 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | /* == Exported methods ===================================================== */ 25 | 26 | /* ------------------------------------------------------------------------- */ 27 | cairo_font_weight_t wlmtk_style_font_weight_cairo_from_wlmtk( 28 | wlmtk_style_font_weight_t weight) 29 | { 30 | switch (weight) { 31 | case WLMTK_FONT_WEIGHT_NORMAL: return CAIRO_FONT_WEIGHT_NORMAL; 32 | case WLMTK_FONT_WEIGHT_BOLD: return CAIRO_FONT_WEIGHT_BOLD; 33 | default: 34 | bs_log(BS_FATAL, "Unhandled font weight %d", weight); 35 | BS_ABORT(); 36 | } 37 | return CAIRO_FONT_WEIGHT_NORMAL; 38 | } 39 | 40 | /* == End of style.c ======================================================= */ 41 | -------------------------------------------------------------------------------- /src/toolkit/test.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file test.c 4 | * 5 | * @copyright 6 | * Copyright 2025 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #include "test.h" 22 | 23 | #include 24 | #include 25 | #define WLR_USE_UNSTABLE 26 | #include 27 | #include 28 | #undef WLR_USE_UNSTABLE 29 | 30 | /* == Exported methods ===================================================== */ 31 | 32 | /* ------------------------------------------------------------------------- */ 33 | void wlmtk_test_wlr_output_init(struct wlr_output *wlr_output_ptr) 34 | { 35 | wlr_addon_set_init(&wlr_output_ptr->addons); 36 | wlr_addon_set_init(&wlr_output_ptr->addons); 37 | wl_list_init(&wlr_output_ptr->display_destroy.link); 38 | wl_list_init(&wlr_output_ptr->modes); 39 | wl_list_init(&wlr_output_ptr->resources); 40 | wl_signal_init(&wlr_output_ptr->events.commit); 41 | wl_signal_init(&wlr_output_ptr->events.damage); 42 | wl_signal_init(&wlr_output_ptr->events.destroy); 43 | wl_signal_init(&wlr_output_ptr->events.frame); 44 | wl_signal_init(&wlr_output_ptr->events.request_state); 45 | wl_signal_init(&wlr_output_ptr->events.needs_frame); 46 | } 47 | 48 | /* == End of test.c ======================================================== */ 49 | -------------------------------------------------------------------------------- /src/x11_cursor.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * x11_cursor_xpm[] = { 3 | "20 20 85 1", 4 | " c None", 5 | ". c #000000", 6 | "+ c #FFFFFF", 7 | "@ c #A2A2A2", 8 | "# c #DDDDDD", 9 | "$ c #969696", 10 | "% c #2C2C2C", 11 | "& c #E1E1E1", 12 | "* c #8E8E8E", 13 | "= c #0E0E0E", 14 | "- c #343434", 15 | "; c #E3E3E3", 16 | "> c #8C8C8C", 17 | ", c #090909", 18 | "' c #151515", 19 | ") c #414141", 20 | "! c #E8E8E8", 21 | "~ c #7F7F7F", 22 | "{ c #030303", 23 | "] c #101010", 24 | "^ c #1C1C1C", 25 | "/ c #4A4A4A", 26 | "( c #EAEAEA", 27 | "_ c #7D7D7D", 28 | ": c #0B0B0B", 29 | "< c #171717", 30 | "[ c #242424", 31 | "} c #565656", 32 | "| c #ECECEC", 33 | "1 c #727272", 34 | "2 c #050505", 35 | "3 c #121212", 36 | "4 c #1E1E1E", 37 | "5 c #2B2B2B", 38 | "6 c #626262", 39 | "7 c #EEEEEE", 40 | "8 c #666666", 41 | "9 c #0C0C0C", 42 | "0 c #191919", 43 | "a c #262626", 44 | "b c #323232", 45 | "c c #6B6B6B", 46 | "d c #646464", 47 | "e c #070707", 48 | "f c #141414", 49 | "g c #202020", 50 | "h c #2D2D2D", 51 | "i c #393939", 52 | "j c #777777", 53 | "k c #585858", 54 | "l c #020202", 55 | "m c #1B1B1B", 56 | "n c #272727", 57 | "o c #404040", 58 | "p c #7C7C7C", 59 | "q c #535353", 60 | "r c #DEDEDE", 61 | "s c #EFEFEF", 62 | "t c #4E4E4E", 63 | "u c #1F1F1F", 64 | "v c #6A6A6A", 65 | "w c #C2C2C2", 66 | "x c #222222", 67 | "y c #E0E0E0", 68 | "z c #434343", 69 | "A c #B1B1B1", 70 | "B c #828282", 71 | "C c #878787", 72 | "D c #B7B7B7", 73 | "E c #E5E5E5", 74 | "F c #767676", 75 | "G c #1A1A1A", 76 | "H c #FCFCFC", 77 | "I c #737373", 78 | "J c #BCBCBC", 79 | "K c #808080", 80 | "L c #B4B4B4", 81 | "M c #757575", 82 | "N c #818181", 83 | "O c #4F4F4F", 84 | "P c #EBEBEB", 85 | "Q c #BEBEBE", 86 | "R c #444444", 87 | "S c #131313", 88 | "T c #BDBDBD", 89 | "T ", 90 | "+@ ", 91 | "+#$ ", 92 | "+%&* ", 93 | "+=-;> ", 94 | "+,')!~ ", 95 | "+{]^/(_ ", 96 | "+.:<[}|1 ", 97 | "+.2345678 ", 98 | "+..90abc7d ", 99 | "+..efghij7k ", 100 | "+..l=mn-op7q ", 101 | "+...,0r++++st ", 102 | "+..uv]jw ", 103 | "+.xy7m4!z ", 104 | "+a;~AB3CD ", 105 | "+EF )|Gn7b ", 106 | "HI JKfLM ", 107 | "N OPQ!n ", 108 | " RkS "}; 109 | -------------------------------------------------------------------------------- /src/xdg_decoration.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file xdg_decoration.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __XDG_DECORATION_H__ 21 | #define __XDG_DECORATION_H__ 22 | 23 | /** The decoration manager handle. */ 24 | typedef struct _wlmaker_xdg_decoration_manager_t wlmaker_xdg_decoration_manager_t; 25 | 26 | #include "server.h" // IWYU pragma: keep 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif // __cplusplus 31 | 32 | /** 33 | * Creates a new XDG decoration manager. 34 | * 35 | * @param server_ptr 36 | * 37 | * @return A decoration manager handle or NULL on error. 38 | */ 39 | wlmaker_xdg_decoration_manager_t *wlmaker_xdg_decoration_manager_create( 40 | wlmaker_server_t *server_ptr); 41 | 42 | /** 43 | * Destroys the XDG decoration manager. 44 | * 45 | * @param decoration_manager_ptr 46 | */ 47 | void wlmaker_xdg_decoration_manager_destroy( 48 | wlmaker_xdg_decoration_manager_t *decoration_manager_ptr); 49 | 50 | #ifdef __cplusplus 51 | } // extern "C" 52 | #endif // __cplusplus 53 | 54 | #endif /* __XDG_DECORATION_H__ */ 55 | /* == End of xdg_decoration.h ============================================== */ 56 | -------------------------------------------------------------------------------- /src/xdg_popup.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file xdg_popup.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __XDG_POPUP_H__ 21 | #define __XDG_POPUP_H__ 22 | 23 | #include 24 | #define WLR_USE_UNSTABLE 25 | #include 26 | #undef WLR_USE_UNSTABLE 27 | 28 | #include "toolkit/toolkit.h" 29 | 30 | struct wlr_xdg_popup; 31 | 32 | struct _wlmaker_xdg_popup_t; 33 | /** Forward declaration: State of the toolkit's XDG popup. */ 34 | typedef struct _wlmaker_xdg_popup_t wlmaker_xdg_popup_t; 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif // __cplusplus 39 | 40 | /** State of toolkit popup. */ 41 | struct _wlmaker_xdg_popup_t { 42 | /** Super class: popup. */ 43 | wlmtk_popup_t super_popup; 44 | 45 | /** Surface of the popup. */ 46 | wlmtk_surface_t *surface_ptr; 47 | /** The WLR popup. */ 48 | struct wlr_xdg_popup *wlr_xdg_popup_ptr; 49 | 50 | /** Listener for the `reposition` signal of `wlr_xdg_popup::events` */ 51 | struct wl_listener reposition_listener; 52 | /** Listener for the `destroy` signal of `wlr_xdg_surface::events`. */ 53 | struct wl_listener destroy_listener; 54 | /** Listener for the `new_popup` signal of `wlr_xdg_surface::events`. */ 55 | struct wl_listener new_popup_listener; 56 | /** Listener for the `commit` signal of the `wlr_surface`. */ 57 | struct wl_listener surface_commit_listener; 58 | }; 59 | 60 | /** 61 | * Creates a popup. 62 | * 63 | * @return Popup handle or NULL on error. 64 | */ 65 | wlmaker_xdg_popup_t *wlmaker_xdg_popup_create( 66 | struct wlr_xdg_popup *wlr_xdg_popup_ptr, 67 | wlmtk_env_t *env_ptr); 68 | 69 | /** 70 | * Destroys the popup. 71 | * 72 | * @param wlmaker_xdg_popup_ptr 73 | */ 74 | void wlmaker_xdg_popup_destroy( 75 | wlmaker_xdg_popup_t *wlmaker_xdg_popup_ptr); 76 | 77 | #ifdef __cplusplus 78 | } // extern "C" 79 | #endif // __cplusplus 80 | 81 | #endif /* __XDG_POPUP_H__ */ 82 | /* == End of xdg_popup.h =================================================== */ 83 | -------------------------------------------------------------------------------- /src/xdg_shell.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file xdg_shell.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __XDG_SHELL_H__ 21 | #define __XDG_SHELL_H__ 22 | 23 | #include 24 | #define WLR_USE_UNSTABLE 25 | #include 26 | #undef WLR_USE_UNSTABLE 27 | 28 | struct _wlmaker_xdg_shell_t; 29 | /** Handle for XDG Shell server handler. */ 30 | typedef struct _wlmaker_xdg_shell_t wlmaker_xdg_shell_t; 31 | 32 | #include "server.h" // IWYU pragma: keep 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif // __cplusplus 37 | 38 | /** Handle for XDG Shell server handler. */ 39 | struct _wlmaker_xdg_shell_t { 40 | /** Back-link to the server this XDG Shell belongs to. */ 41 | wlmaker_server_t *server_ptr; 42 | 43 | /** XDG Shell handler. */ 44 | struct wlr_xdg_shell *wlr_xdg_shell_ptr; 45 | 46 | /** Listener for the `new_surface` signal raised by `wlr_xdg_shell`. */ 47 | struct wl_listener new_surface_listener; 48 | 49 | /** Listener for the `new_toplevel` signal raised by `wlr_xdg_shell`. */ 50 | struct wl_listener new_toplevel_listener; 51 | /** Listener for the `new_popup` signal raised by `wlr_xdg_shell`. */ 52 | struct wl_listener new_popup_listener; 53 | /** Listener for the `destroy` signal raised by `wlr_xdg_shell`. */ 54 | struct wl_listener destroy_listener; 55 | }; 56 | 57 | /** 58 | * Creates an XDG shell server handler. 59 | * 60 | * @param server_ptr 61 | * 62 | * @return The XDG Shell server handler or NULL on error. 63 | */ 64 | wlmaker_xdg_shell_t *wlmaker_xdg_shell_create(wlmaker_server_t *server_ptr); 65 | 66 | /** 67 | * Destroys the XDG Shell server handler. 68 | * 69 | * @param xdg_shell_ptr 70 | */ 71 | void wlmaker_xdg_shell_destroy(wlmaker_xdg_shell_t *xdg_shell_ptr); 72 | 73 | #ifdef __cplusplus 74 | } // extern "C" 75 | #endif // __cplusplus 76 | 77 | #endif /* __XDG_SHELL_H__ */ 78 | /* == End of xdg_shell.h =================================================== */ 79 | -------------------------------------------------------------------------------- /src/xdg_toplevel.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file xdg_toplevel.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __XDG_TOPLEVEL_H__ 21 | #define __XDG_TOPLEVEL_H__ 22 | 23 | #include "server.h" 24 | #include "toolkit/toolkit.h" 25 | 26 | struct wlr_xdg_toplevel; 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif // __cplusplus 31 | 32 | /** 33 | * Creates a toolkit window with the XDG surface as content. 34 | * 35 | * @param wlr_xdg_toplevel_ptr 36 | * @param server_ptr 37 | * 38 | * @return The window, or NULL on error. 39 | */ 40 | wlmtk_window_t *wlmtk_window_create_from_xdg_toplevel( 41 | struct wlr_xdg_toplevel *wlr_xdg_toplevel_ptr, 42 | wlmaker_server_t *server_ptr); 43 | 44 | #ifdef __cplusplus 45 | } // extern "C" 46 | #endif // __cplusplus 47 | 48 | #endif /* __XDG_TOPLEVEL_H__ */ 49 | /* == End of xdg_toplevel.h ================================================ */ 50 | -------------------------------------------------------------------------------- /src/xwl.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file xwl.h 4 | * 5 | * Interface layer to Wlroots XWayland. 6 | * 7 | * @copyright 8 | * Copyright 2023 Google LLC 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); 11 | * you may not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * https://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | */ 22 | #ifndef __XWL_H__ 23 | #define __XWL_H__ 24 | 25 | #if defined(WLMAKER_HAVE_XWAYLAND) 26 | #include 27 | #include 28 | 29 | struct wlr_xwayland_surface; 30 | 31 | #endif // defined(WLMAKER_HAVE_XWAYLAND) 32 | 33 | /** Forward declaration: XWayland interface. */ 34 | typedef struct _wlmaker_xwl_t wlmaker_xwl_t; 35 | #include "server.h" // IWYU pragma: keep 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif // __cplusplus 40 | 41 | #if defined(WLMAKER_HAVE_XWAYLAND) 42 | 43 | /** XCB Atom identifiers. */ 44 | typedef enum { 45 | NET_WM_WINDOW_TYPE_NORMAL, 46 | NET_WM_WINDOW_TYPE_DIALOG, 47 | NET_WM_WINDOW_TYPE_UTILITY, 48 | NET_WM_WINDOW_TYPE_TOOLBAR, 49 | NET_WM_WINDOW_TYPE_SPLASH, 50 | NET_WM_WINDOW_TYPE_MENU, 51 | NET_WM_WINDOW_TYPE_DROPDOWN_MENU, 52 | NET_WM_WINDOW_TYPE_POPUP_MENU, 53 | NET_WM_WINDOW_TYPE_TOOLTIP, 54 | NET_WM_WINDOW_TYPE_NOTIFICATION, 55 | 56 | // Sentinel element. 57 | XWL_MAX_ATOM_ID 58 | } xwl_atom_identifier_t; 59 | #endif // defined(WLMAKER_HAVE_XWAYLAND) 60 | 61 | /** 62 | * Creates the XWayland interface. 63 | * 64 | * @param server_ptr 65 | * 66 | * @return NULL on error, or a pointer to a @ref wlmaker_xwl_t. Must be free-d 67 | * by calling @ref wlmaker_xwl_destroy. 68 | */ 69 | wlmaker_xwl_t *wlmaker_xwl_create(wlmaker_server_t *server_ptr); 70 | 71 | /** 72 | * Destroys the XWayland interface. 73 | * 74 | * @param xwl_ptr 75 | */ 76 | void wlmaker_xwl_destroy(wlmaker_xwl_t *xwl_ptr); 77 | 78 | #if defined(WLMAKER_HAVE_XWAYLAND) 79 | 80 | /** 81 | * Returns whether the XWayland surface has any of the window types. 82 | * 83 | * @param xwl_ptr 84 | * @param wlr_xwayland_surface_ptr 85 | * @param atom_identifiers NULL-terminated set of window type we're looking 86 | * for. 87 | * 88 | * @return Whether `atom_identifiers` is in any of the window types. 89 | */ 90 | bool xwl_is_window_type( 91 | wlmaker_xwl_t *xwl_ptr, 92 | struct wlr_xwayland_surface *wlr_xwayland_surface_ptr, 93 | const xwl_atom_identifier_t *atom_identifiers); 94 | 95 | /** Returns a human-readable name for the atom. */ 96 | const char *xwl_atom_name( 97 | wlmaker_xwl_t *xwl_ptr, 98 | xcb_atom_t atom); 99 | 100 | #ifdef __cplusplus 101 | } // extern "C" 102 | #endif // __cplusplus 103 | 104 | #endif // defined(WLMAKER_HAVE_XWAYLAND) 105 | #endif /* __XWL_H__ */ 106 | /* == End of xwl.h ========================================================= */ 107 | -------------------------------------------------------------------------------- /src/xwl_content.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file xwl_content.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __XWL_CONTENT_H__ 21 | #define __XWL_CONTENT_H__ 22 | 23 | #if defined(WLMAKER_HAVE_XWAYLAND) 24 | 25 | #include 26 | 27 | #include "server.h" 28 | #include "toolkit/toolkit.h" 29 | #include "xwl.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif // __cplusplus 34 | 35 | /** Forward declaration. */ 36 | struct wlr_xwayland_surface; 37 | 38 | /** XWayland window (content) state. */ 39 | typedef struct _wlmaker_xwl_content_t wlmaker_xwl_content_t; 40 | 41 | /** 42 | * Creates an XWayland window. Technically, window content. 43 | * 44 | * @param wlr_xwayland_surface_ptr 45 | * @param xwl_ptr 46 | * @param server_ptr 47 | * 48 | * @return Pointer to a @ref wlmaker_xwl_content_t. 49 | */ 50 | wlmaker_xwl_content_t *wlmaker_xwl_content_create( 51 | struct wlr_xwayland_surface *wlr_xwayland_surface_ptr, 52 | wlmaker_xwl_t *xwl_ptr, 53 | wlmaker_server_t *server_ptr); 54 | 55 | /** 56 | * Destroys the XWayland window (content). 57 | * 58 | * @param xwl_content_ptr 59 | */ 60 | void wlmaker_xwl_content_destroy(wlmaker_xwl_content_t *xwl_content_ptr); 61 | 62 | /** Gets the @ref wlmtk_content_t for the XWL content. */ 63 | wlmtk_content_t *wlmtk_content_from_xwl_content( 64 | wlmaker_xwl_content_t *xwl_content_ptr); 65 | /** Gets the @ref wlmtk_surface_t. Only valid if associated. */ 66 | wlmtk_surface_t *wlmtk_surface_from_xwl_content( 67 | wlmaker_xwl_content_t *xwl_content_ptr); 68 | 69 | /** Unit tests for XWL content. */ 70 | extern const bs_test_case_t wlmaker_xwl_content_test_cases[]; 71 | 72 | #ifdef __cplusplus 73 | } // extern "C" 74 | #endif // __cplusplus 75 | 76 | #endif // defined(WLMAKER_HAVE_XWAYLAND) 77 | #endif /* __XWL_CONTENT_H__ */ 78 | /* == End of xwl_content.h ================================================= */ 79 | -------------------------------------------------------------------------------- /src/xwl_popup.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file xwl_popup.c 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #if defined(WLMAKER_HAVE_XWAYLAND) 21 | 22 | #include "xwl_popup.h" 23 | 24 | #include 25 | #include 26 | 27 | /* == Declarations ========================================================= */ 28 | 29 | /** State of an XWayland popup (child window). */ 30 | struct _wlmaker_xwl_popup_t { 31 | /** Content that this popup embeds. */ 32 | wlmaker_xwl_content_t *xwl_content_ptr; 33 | }; 34 | 35 | /* == Exported methods ===================================================== */ 36 | 37 | /* ------------------------------------------------------------------------- */ 38 | wlmaker_xwl_popup_t *wlmaker_xwl_popup_create( 39 | wlmaker_xwl_content_t *xwl_content_ptr) 40 | { 41 | wlmaker_xwl_popup_t *xwl_popup_ptr = logged_calloc( 42 | 1, sizeof(wlmaker_xwl_popup_t)); 43 | if (NULL == xwl_popup_ptr) return NULL; 44 | xwl_popup_ptr->xwl_content_ptr = xwl_content_ptr; 45 | 46 | return xwl_popup_ptr; 47 | } 48 | 49 | /* ------------------------------------------------------------------------- */ 50 | void wlmaker_xwl_popup_destroy(wlmaker_xwl_popup_t *xwl_popup_ptr) 51 | { 52 | free(xwl_popup_ptr); 53 | } 54 | 55 | /* == Local (static) methods =============================================== */ 56 | 57 | #endif // defined(WLMAKER_HAVE_XWAYLAND) 58 | /* == End of xwl_popup.c =================================================== */ 59 | -------------------------------------------------------------------------------- /src/xwl_popup.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file xwl_popup.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __XWL_POPUP_H__ 21 | #define __XWL_POPUP_H__ 22 | #if defined(WLMAKER_HAVE_XWAYLAND) 23 | 24 | #include "xwl_content.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif // __cplusplus 29 | 30 | /** Forward declaration: State of an XWayland child window. */ 31 | typedef struct _wlmaker_xwl_popup_t wlmaker_xwl_popup_t; 32 | 33 | /** 34 | * Creates a XWayland popup from `xwl_content_ptr`. 35 | * 36 | * @param xwl_content_ptr 37 | * 38 | * @return A pointer to the created @ref wlmaker_xwl_popup_t or NULL on error. 39 | */ 40 | wlmaker_xwl_popup_t *wlmaker_xwl_popup_create( 41 | wlmaker_xwl_content_t *xwl_content_ptr); 42 | 43 | /** 44 | * Destroys the XWayland popup. 45 | * 46 | * @param xwl_popup_ptr 47 | */ 48 | void wlmaker_xwl_popup_destroy(wlmaker_xwl_popup_t *xwl_popup_ptr); 49 | 50 | #ifdef __cplusplus 51 | } // extern "C" 52 | #endif // __cplusplus 53 | 54 | #endif // defined(WLMAKER_HAVE_XWAYLAND) 55 | #endif /* __XWL_POPUP_H__ */ 56 | /* == End of xwl_popup.h =================================================== */ 57 | -------------------------------------------------------------------------------- /src/xwl_toplevel.h: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file xwl_toplevel.h 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __XWL_TOPLEVEL_H__ 21 | #define __XWL_TOPLEVEL_H__ 22 | #if defined(WLMAKER_HAVE_XWAYLAND) 23 | 24 | #include 25 | 26 | #include "server.h" 27 | #include "toolkit/toolkit.h" 28 | #include "xwl_content.h" 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif // __cplusplus 33 | 34 | /** Forward declaration. */ 35 | typedef struct _wlmaker_xwl_toplevel_t wlmaker_xwl_toplevel_t; 36 | 37 | /** 38 | * Creates a toplevel XWayland window. 39 | * 40 | * @param content_ptr 41 | * @param server_ptr 42 | * @param env_ptr 43 | */ 44 | wlmaker_xwl_toplevel_t *wlmaker_xwl_toplevel_create( 45 | wlmaker_xwl_content_t *content_ptr, 46 | wlmaker_server_t *server_ptr, 47 | wlmtk_env_t *env_ptr); 48 | 49 | /** 50 | * Destroys the toplevel XWayland window. 51 | * 52 | * @param xwl_toplevel_ptr 53 | */ 54 | void wlmaker_xwl_toplevel_destroy( 55 | wlmaker_xwl_toplevel_t *xwl_toplevel_ptr); 56 | 57 | /** 58 | * Sets decoration for the toplevel window. 59 | * 60 | * @param xwl_toplevel_ptr 61 | * @param decorated 62 | */ 63 | void wlmaker_xwl_toplevel_set_decorations( 64 | wlmaker_xwl_toplevel_t *xwl_toplevel_ptr, 65 | bool decorated); 66 | 67 | /** Accessor: Exposes @ref wlmtk_window_t. */ 68 | wlmtk_window_t *wlmtk_window_from_xwl_toplevel( 69 | wlmaker_xwl_toplevel_t *xwl_toplevel_ptr); 70 | 71 | #ifdef __cplusplus 72 | } // extern "C" 73 | #endif // __cplusplus 74 | 75 | #endif // defined(WLMAKER_HAVE_XWAYLAND) 76 | #endif /* __XWL_TOPLEVEL_H__ */ 77 | /* == End of xwl_toplevel.h ================================================== */ 78 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ADD_EXECUTABLE(backend_test backend_test.c) 16 | ADD_DEPENDENCIES(backend_test backend) 17 | TARGET_LINK_LIBRARIES(backend_test backend) 18 | ADD_TEST(NAME backend_test COMMAND backend_test) 19 | 20 | ADD_EXECUTABLE(toolkit_test toolkit_test.c) 21 | TARGET_LINK_LIBRARIES(toolkit_test toolkit) 22 | TARGET_INCLUDE_DIRECTORIES( 23 | toolkit_test PRIVATE ${PROJECT_SOURCE_DIR}/include/toolkit) 24 | TARGET_COMPILE_DEFINITIONS( 25 | toolkit_test PUBLIC TEST_DATA_DIR="${PROJECT_SOURCE_DIR}/tests/data") 26 | ADD_TEST(NAME toolkit_test COMMAND toolkit_test) 27 | 28 | ADD_EXECUTABLE(wlmaker_test wlmaker_test.c) 29 | ADD_DEPENDENCIES(wlmaker_test wlmaker_lib) 30 | TARGET_INCLUDE_DIRECTORIES( 31 | wlmaker_test PRIVATE ${PROJECT_SOURCE_DIR}/src) 32 | TARGET_LINK_LIBRARIES(wlmaker_test PRIVATE wlmaker_lib) 33 | TARGET_COMPILE_DEFINITIONS( 34 | wlmaker_test PUBLIC TEST_DATA_DIR="${PROJECT_SOURCE_DIR}/tests/data") 35 | ADD_TEST(NAME wlmaker_test COMMAND wlmaker_test) 36 | 37 | IF(iwyu_path_and_options) 38 | SET_TARGET_PROPERTIES( 39 | backend_test PROPERTIES 40 | C_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}") 41 | SET_TARGET_PROPERTIES( 42 | toolkit_test PROPERTIES 43 | C_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}") 44 | SET_TARGET_PROPERTIES( 45 | wlmaker_test PROPERTIES 46 | C_INCLUDE_WHAT_YOU_USE "${iwyu_path_and_options}") 47 | ENDIF(iwyu_path_and_options) 48 | -------------------------------------------------------------------------------- /tests/backend_test.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file backend_test.c 4 | * 5 | * @copyright 6 | * Copyright 2025 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | #include "backend/backend.h" 25 | #include "backend/output_config.h" 26 | 27 | /** Backend unit tests. */ 28 | const bs_test_set_t backend_tests[] = { 29 | { 1, "backend", wlmbe_backend_test_cases }, 30 | { 1, "output_config", wlmbe_output_config_test_cases }, 31 | { 0, NULL, NULL } 32 | }; 33 | 34 | /** Main program, runs the unit tests. */ 35 | int main(int argc, const char **argv) 36 | { 37 | const bs_test_param_t params = {}; 38 | return bs_test(backend_tests, argc, argv, ¶ms); 39 | } 40 | 41 | /* == End of backend_test.c ================================================ */ 42 | -------------------------------------------------------------------------------- /tests/data/clip_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/clip_pressed.png -------------------------------------------------------------------------------- /tests/data/clip_raised.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/clip_raised.png -------------------------------------------------------------------------------- /tests/data/toolkit/menu_item_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/menu_item_disabled.png -------------------------------------------------------------------------------- /tests/data/toolkit/menu_item_enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/menu_item_enabled.png -------------------------------------------------------------------------------- /tests/data/toolkit/menu_item_highlighted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/menu_item_highlighted.png -------------------------------------------------------------------------------- /tests/data/toolkit/primitive_close_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/primitive_close_icon.png -------------------------------------------------------------------------------- /tests/data/toolkit/primitive_close_icon_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/primitive_close_icon_large.png -------------------------------------------------------------------------------- /tests/data/toolkit/primitive_fill_adgradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/primitive_fill_adgradient.png -------------------------------------------------------------------------------- /tests/data/toolkit/primitive_fill_dgradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/primitive_fill_dgradient.png -------------------------------------------------------------------------------- /tests/data/toolkit/primitive_fill_hgradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/primitive_fill_hgradient.png -------------------------------------------------------------------------------- /tests/data/toolkit/primitive_fill_solid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/primitive_fill_solid.png -------------------------------------------------------------------------------- /tests/data/toolkit/primitive_fill_vgradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/primitive_fill_vgradient.png -------------------------------------------------------------------------------- /tests/data/toolkit/primitive_minimize_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/primitive_minimize_icon.png -------------------------------------------------------------------------------- /tests/data/toolkit/primitive_minimize_icon_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/primitive_minimize_icon_large.png -------------------------------------------------------------------------------- /tests/data/toolkit/primitive_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/primitive_text.png -------------------------------------------------------------------------------- /tests/data/toolkit/primitive_window_title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/primitive_window_title.png -------------------------------------------------------------------------------- /tests/data/toolkit/resizebar_area_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/resizebar_area_pressed.png -------------------------------------------------------------------------------- /tests/data/toolkit/resizebar_area_released.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/resizebar_area_released.png -------------------------------------------------------------------------------- /tests/data/toolkit/test_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/test_icon.png -------------------------------------------------------------------------------- /tests/data/toolkit/title_blurred.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/title_blurred.png -------------------------------------------------------------------------------- /tests/data/toolkit/title_blurred_short.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/title_blurred_short.png -------------------------------------------------------------------------------- /tests/data/toolkit/title_button_blurred.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/title_button_blurred.png -------------------------------------------------------------------------------- /tests/data/toolkit/title_button_focussed_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/title_button_focussed_pressed.png -------------------------------------------------------------------------------- /tests/data/toolkit/title_button_focussed_released.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/title_button_focussed_released.png -------------------------------------------------------------------------------- /tests/data/toolkit/title_focussed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phkaeser/wlmaker/8b046404014324d14bea4ce3a8b3c479f4b7b800/tests/data/toolkit/title_focussed.png -------------------------------------------------------------------------------- /tests/toolkit_test.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file toolkit_test.c 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | #include "toolkit/toolkit.h" 25 | 26 | /** Toolkit unit tests. */ 27 | const bs_test_set_t toolkit_tests[] = { 28 | { 1, "bordered", wlmtk_bordered_test_cases }, 29 | { 1, "box", wlmtk_box_test_cases }, 30 | { 1, "button", wlmtk_button_test_cases }, 31 | { 1, "container", wlmtk_container_test_cases }, 32 | { 1, "content", wlmtk_content_test_cases }, 33 | { 1, "dock", wlmtk_dock_test_cases }, 34 | { 1, "element", wlmtk_element_test_cases }, 35 | { 1, "fsm", wlmtk_fsm_test_cases }, 36 | { 1, "image", wlmtk_image_test_cases }, 37 | { 1, "layer", wlmtk_layer_test_cases }, 38 | { 1, "menu", wlmtk_menu_test_cases }, 39 | { 1, "menu_item", wlmtk_menu_item_test_cases }, 40 | { 1, "pane", wlmtk_pane_test_cases }, 41 | { 1, "panel", wlmtk_panel_test_cases }, 42 | { 1, "surface", wlmtk_surface_test_cases }, 43 | { 1, "rectangle", wlmtk_rectangle_test_cases }, 44 | { 1, "resizebar", wlmtk_resizebar_test_cases }, 45 | { 1, "resizebar_area", wlmtk_resizebar_area_test_cases }, 46 | { 1, "root", wlmtk_root_test_cases }, 47 | { 1, "tile", wlmtk_tile_test_cases }, 48 | { 1, "titlebar", wlmtk_titlebar_test_cases }, 49 | { 1, "titlebar_button", wlmtk_titlebar_button_test_cases }, 50 | { 1, "titlebar_title", wlmtk_titlebar_title_test_cases }, 51 | { 1, "util", wlmtk_util_test_cases }, 52 | { 1, "window", wlmtk_window_test_cases }, 53 | { 1, "workspace", wlmtk_workspace_test_cases }, 54 | { 1, "primitives", wlmaker_primitives_test_cases }, 55 | { 0, NULL, NULL } 56 | }; 57 | 58 | #if !defined(TEST_DATA_DIR) 59 | /** Directory root for looking up test data. See `bs_test_resolve_path`. */ 60 | #define TEST_DATA_DIR "./" 61 | #endif // TEST_DATA_DIR 62 | 63 | /** Main program, runs the unit tests. */ 64 | int main(int argc, const char **argv) 65 | { 66 | const bs_test_param_t params = { 67 | .test_data_dir_ptr = TEST_DATA_DIR 68 | }; 69 | return bs_test(toolkit_tests, argc, argv, ¶ms); 70 | } 71 | 72 | /* == End of toolkit_test.c ================================================ */ 73 | -------------------------------------------------------------------------------- /tests/wlmaker_test.c: -------------------------------------------------------------------------------- 1 | /* ========================================================================= */ 2 | /** 3 | * @file wlmaker_test.c 4 | * 5 | * @copyright 6 | * Copyright 2023 Google LLC 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | #include "action.h" 25 | #include "action_item.h" 26 | #include "clip.h" 27 | #include "config.h" 28 | #include "corner.h" 29 | #include "dock.h" 30 | #include "launcher.h" 31 | #include "layer_panel.h" 32 | #include "server.h" 33 | #if defined(WLMAKER_HAVE_XWAYLAND) 34 | #include "xwl_content.h" 35 | #endif // defined(WLMAKER_HAVE_XWAYLAND) 36 | 37 | /** WLMaker unit tests. */ 38 | const bs_test_set_t wlmaker_tests[] = { 39 | { 1, "action", wlmaker_action_test_cases }, 40 | { 1, "action_item", wlmaker_action_item_test_cases }, 41 | { 1, "clip", wlmaker_clip_test_cases }, 42 | { 1, "config", wlmaker_config_test_cases }, 43 | { 1, "corner", wlmaker_corner_test_cases }, 44 | { 1, "dock", wlmaker_dock_test_cases }, 45 | { 1, "launc her", wlmaker_launcher_test_cases}, 46 | { 1, "layer_panel", wlmaker_layer_panel_test_cases }, 47 | { 1, "server", wlmaker_server_test_cases }, 48 | #if defined(WLMAKER_HAVE_XWAYLAND) 49 | { 1, "xwl_content", wlmaker_xwl_content_test_cases }, 50 | #endif // defined(WLMAKER_HAVE_XWAYLAND) 51 | { 0, NULL, NULL } 52 | }; 53 | 54 | #if !defined(TEST_DATA_DIR) 55 | /** Directory root for looking up test data. See `bs_test_resolve_path`. */ 56 | #define TEST_DATA_DIR "./" 57 | #endif // TEST_DATA_DIR 58 | 59 | /** Main program, runs the unit tests. */ 60 | int main(int argc, const char **argv) 61 | { 62 | const bs_test_param_t params = { 63 | .test_data_dir_ptr = TEST_DATA_DIR 64 | }; 65 | return bs_test(wlmaker_tests, argc, argv, ¶ms); 66 | } 67 | 68 | /* == End of wlmaker_test.c ================================================ */ 69 | -------------------------------------------------------------------------------- /third_party/protocols/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | CMAKE_MINIMUM_REQUIRED(VERSION 3.13) 16 | 17 | FIND_PROGRAM( 18 | WAYLAND_SCANNER_EXECUTABLE 19 | NAMES wayland-scanner 20 | REQUIRED) 21 | IF(NOT WAYLAND_SCANNER_EXECUTABLE) 22 | MESSAGE(FATAL_ERROR "'wayland-scanner' executable not found.") 23 | ENDIF() 24 | 25 | PKG_GET_VARIABLE(PROTOCOL_DIR wayland-protocols pkgdatadir) 26 | 27 | ADD_CUSTOM_COMMAND( 28 | OUTPUT wlr-layer-shell-unstable-v1-protocol.h 29 | COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/wlr-layer-shell-unstable-v1.xml wlr-layer-shell-unstable-v1-protocol.h 30 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/wlr-layer-shell-unstable-v1.xml 31 | VERBATIM) 32 | 33 | ADD_CUSTOM_COMMAND( 34 | OUTPUT xdg-shell-protocol.h 35 | COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header ${PROTOCOL_DIR}/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.h 36 | DEPENDS ${PROTOCOL_DIR}/stable/xdg-shell/xdg-shell.xml 37 | VERBATIM) 38 | 39 | ADD_LIBRARY( 40 | protocol_headers 41 | OBJECT 42 | wlr-layer-shell-unstable-v1-protocol.h 43 | xdg-shell-protocol.h) 44 | SET_TARGET_PROPERTIES( 45 | protocol_headers PROPERTIES 46 | LINKER_LANGUAGE C) 47 | -------------------------------------------------------------------------------- /valgrind.md: -------------------------------------------------------------------------------- 1 | # Using valgrind for wlmaker 2 | 3 | By default, valgrind's leak detection reports many potential and definitive 4 | leaks from libdrm and from fontconfig (via cairo). Since these are outside 5 | our control, it's helpful to suppress these leaks [^1]. 6 | 7 | To run with these leak-checks suppressed: 8 | ``` 9 | valgrind \ 10 | --leak-check=full \ 11 | --suppressions=./libdrm.supp \ 12 | --suppressions=./libcairo-fontconfig.supp \ 13 | build/src/wlmaker 14 | ``` 15 | 16 | ## Generating suppressions files 17 | 18 | To (re)generate suppressions, run: 19 | 20 | ``` 21 | valgrind \ 22 | --leak-check=full \ 23 | --show-reachable=yes \ 24 | --error-limit=no \ 25 | --gen-suppressions=all \ 26 | --suppressions=./libdrm.supp \ 27 | --suppressions=./libcairo-fontconfig.supp \ 28 | --log-file=new_suppressions.log \ 29 | build/src/wlmaker 30 | ``` 31 | 32 | [^1]: https://wiki.wxwidgets.org/Valgrind_Suppression_File_Howto 33 | --------------------------------------------------------------------------------