├── .editorconfig
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── feature_request.md
│ └── others.md
└── workflows
│ ├── ci.yaml
│ └── mandoc.yaml
├── .gitignore
├── .gitmodules
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── config.h.in
├── man
├── meson.build
└── wayfire.1.in
├── meson.build
├── meson_options.txt
├── metadata
├── alpha.xml
├── animate.xml
├── autostart.xml
├── blur.xml
├── command.xml
├── core.xml
├── cube.xml
├── decoration.xml
├── expo.xml
├── extra-gestures.xml
├── fast-switcher.xml
├── fisheye.xml
├── foreign-toplevel.xml
├── grid.xml
├── gtk-shell.xml
├── idle.xml
├── input-device.xml
├── input-method-v1.xml
├── input.xml
├── invert.xml
├── ipc-rules.xml
├── ipc.xml
├── meson.build
├── move.xml
├── oswitch.xml
├── output.xml
├── place.xml
├── preserve-output.xml
├── resize.xml
├── scale-title-filter.xml
├── scale.xml
├── session-lock.xml
├── shortcuts-inhibit.xml
├── simple-tile.xml
├── switcher.xml
├── vswipe.xml
├── vswitch.xml
├── wayfire-shell.xml
├── window-rules.xml
├── wm-actions.xml
├── wobbly.xml
├── workarounds.xml
├── wrot.xml
├── wsets.xml
├── xdg-activation.xml
└── zoom.xml
├── plugins
├── animate
│ ├── animate.cpp
│ ├── animate.hpp
│ ├── basic_animations.hpp
│ ├── fire
│ │ ├── fire.cpp
│ │ ├── fire.hpp
│ │ ├── particle.cpp
│ │ ├── particle.hpp
│ │ └── shaders.hpp
│ ├── meson.build
│ ├── shaders
│ │ ├── frag.glsl
│ │ └── vertex.glsl
│ ├── spin.hpp
│ ├── squeezimize.hpp
│ ├── system_fade.hpp
│ ├── unmapped-view-node.hpp
│ └── zap.hpp
├── blur
│ ├── blur-base.cpp
│ ├── blur.cpp
│ ├── blur.hpp
│ ├── bokeh.cpp
│ ├── box.cpp
│ ├── gaussian.cpp
│ ├── kawase.cpp
│ └── meson.build
├── common
│ ├── meson.build
│ └── wayfire
│ │ └── plugins
│ │ └── common
│ │ ├── cairo-util.hpp
│ │ ├── geometry-animation.hpp
│ │ ├── input-grab.hpp
│ │ ├── key-repeat.hpp
│ │ ├── move-drag-interface.hpp
│ │ ├── preview-indication.hpp
│ │ ├── shared-core-data.hpp
│ │ ├── simple-text-node.hpp
│ │ ├── simple-texture.hpp
│ │ ├── util.hpp
│ │ └── workspace-wall.hpp
├── cube
│ ├── cube-background.hpp
│ ├── cube-control-signal.hpp
│ ├── cube.cpp
│ ├── cube.hpp
│ ├── cubemap-shaders.tpp
│ ├── cubemap.cpp
│ ├── cubemap.hpp
│ ├── meson.build
│ ├── shaders-3-2.tpp
│ ├── shaders.tpp
│ ├── simple-background.cpp
│ ├── simple-background.hpp
│ ├── skydome.cpp
│ └── skydome.hpp
├── decor
│ ├── deco-button.cpp
│ ├── deco-button.hpp
│ ├── deco-layout.cpp
│ ├── deco-layout.hpp
│ ├── deco-subsurface.cpp
│ ├── deco-subsurface.hpp
│ ├── deco-theme.cpp
│ ├── deco-theme.hpp
│ ├── decoration.cpp
│ └── meson.build
├── grid
│ ├── grid.cpp
│ ├── meson.build
│ └── wayfire
│ │ └── plugins
│ │ ├── crossfade.hpp
│ │ └── grid.hpp
├── ipc-rules
│ ├── ipc-events.hpp
│ ├── ipc-input-methods.hpp
│ ├── ipc-rules-common.hpp
│ ├── ipc-rules.cpp
│ ├── ipc-utility-methods.hpp
│ └── meson.build
├── ipc
│ ├── demo-ipc.cpp
│ ├── ipc-activator.hpp
│ ├── ipc-helpers.hpp
│ ├── ipc-method-repository.hpp
│ ├── ipc.cpp
│ ├── ipc.hpp
│ ├── meson.build
│ └── stipc.cpp
├── meson.build
├── protocols
│ ├── foreign-toplevel.cpp
│ ├── gtk-shell.cpp
│ ├── gtk-shell.hpp
│ ├── input-method-v1.cpp
│ ├── input-method-v1.hpp
│ ├── meson.build
│ ├── session-lock.cpp
│ ├── shortcuts-inhibit.cpp
│ ├── text-input-v1-v3.hpp
│ ├── wayfire-shell.cpp
│ └── xdg-activation.cpp
├── scale
│ ├── meson.build
│ ├── scale-title-filter.cpp
│ ├── scale-title-overlay.cpp
│ ├── scale-title-overlay.hpp
│ ├── scale.cpp
│ ├── scale.hpp
│ └── wayfire
│ │ └── plugins
│ │ └── scale-signal.hpp
├── single_plugins
│ ├── alpha.cpp
│ ├── autostart.cpp
│ ├── command.cpp
│ ├── compositor-view-test.cpp
│ ├── expo.cpp
│ ├── extra-gestures.cpp
│ ├── fast-switcher.cpp
│ ├── fisheye.cpp
│ ├── idle.cpp
│ ├── invert.cpp
│ ├── meson.build
│ ├── move.cpp
│ ├── oswitch.cpp
│ ├── place.cpp
│ ├── preserve-output.cpp
│ ├── resize.cpp
│ ├── switcher.cpp
│ ├── vswipe-processing.hpp
│ ├── vswipe.cpp
│ ├── wrot.cpp
│ ├── wsets.cpp
│ ├── xkb-bindings.cpp
│ └── zoom.cpp
├── tile
│ ├── meson.build
│ ├── tile-dragging.hpp
│ ├── tile-ipc.hpp
│ ├── tile-plugin.cpp
│ ├── tile-wset.hpp
│ ├── tree-controller.cpp
│ ├── tree-controller.hpp
│ ├── tree.cpp
│ └── tree.hpp
├── vswitch
│ ├── meson.build
│ ├── vswitch.cpp
│ └── wayfire
│ │ └── plugins
│ │ └── vswitch.hpp
├── window-rules
│ ├── lambda-rules-registration.hpp
│ ├── meson.build
│ ├── view-action-interface.cpp
│ ├── view-action-interface.hpp
│ └── window-rules.cpp
├── wm-actions
│ ├── meson.build
│ ├── wm-actions-signals.hpp
│ └── wm-actions.cpp
└── wobbly
│ ├── meson.build
│ ├── wayfire
│ └── plugins
│ │ └── wobbly
│ │ └── wobbly-signal.hpp
│ ├── wobbly.c
│ ├── wobbly.cpp
│ └── wobbly.h
├── proto
├── gtk-shell.xml
├── meson.build
├── wayfire-shell-unstable-v2.xml
├── wlr-layer-shell-unstable-v1.xml
└── wlr-output-power-management-unstable-v1.xml
├── src
├── api
│ └── wayfire
│ │ ├── bindings-repository.hpp
│ │ ├── bindings.hpp
│ │ ├── compositor-view.hpp
│ │ ├── config-backend.hpp
│ │ ├── core.hpp
│ │ ├── dassert.hpp
│ │ ├── debug.hpp
│ │ ├── geometry.hpp
│ │ ├── idle.hpp
│ │ ├── img.hpp
│ │ ├── input-device.hpp
│ │ ├── matcher.hpp
│ │ ├── nonstd
│ │ ├── observer_ptr.h
│ │ ├── reverse.hpp
│ │ ├── safe-list.hpp
│ │ ├── tracking-allocator.hpp
│ │ ├── wlroots-full.hpp
│ │ └── wlroots.hpp
│ │ ├── object.hpp
│ │ ├── opengl.hpp
│ │ ├── option-wrapper.hpp
│ │ ├── output-layout.hpp
│ │ ├── output.hpp
│ │ ├── per-output-plugin.hpp
│ │ ├── plugin.hpp
│ │ ├── region.hpp
│ │ ├── render-manager.hpp
│ │ ├── scene-input.hpp
│ │ ├── scene-operations.hpp
│ │ ├── scene-render.hpp
│ │ ├── scene.hpp
│ │ ├── seat.hpp
│ │ ├── signal-definitions.hpp
│ │ ├── signal-provider.hpp
│ │ ├── toplevel-view.hpp
│ │ ├── toplevel.hpp
│ │ ├── txn
│ │ ├── transaction-manager.hpp
│ │ ├── transaction-object.hpp
│ │ └── transaction.hpp
│ │ ├── unstable
│ │ ├── translation-node.hpp
│ │ ├── wlr-subsurface-controller.hpp
│ │ ├── wlr-surface-controller.hpp
│ │ ├── wlr-surface-node.hpp
│ │ ├── wlr-text-input-v3-popup.hpp
│ │ ├── wlr-view-events.hpp
│ │ ├── wlr-view-keyboard-interaction.hpp
│ │ ├── xdg-toplevel-base.hpp
│ │ └── xwl-toplevel-base.hpp
│ │ ├── util.hpp
│ │ ├── view-access-interface.hpp
│ │ ├── view-helpers.hpp
│ │ ├── view-transform.hpp
│ │ ├── view.hpp
│ │ ├── window-manager.hpp
│ │ ├── workarea.hpp
│ │ ├── workspace-set.hpp
│ │ └── workspace-stream.hpp
├── core
│ ├── core-impl.hpp
│ ├── core.cpp
│ ├── gldebug.hpp
│ ├── idle.cpp
│ ├── img.cpp
│ ├── matcher.cpp
│ ├── object.cpp
│ ├── opengl-priv.hpp
│ ├── opengl.cpp
│ ├── output-layout.cpp
│ ├── plugin-loader.cpp
│ ├── plugin-loader.hpp
│ ├── plugin.cpp
│ ├── scene-priv.hpp
│ ├── scene.cpp
│ ├── seat
│ │ ├── bindings-repository-impl.hpp
│ │ ├── bindings-repository.cpp
│ │ ├── cursor.cpp
│ │ ├── cursor.hpp
│ │ ├── drag-icon.cpp
│ │ ├── drag-icon.hpp
│ │ ├── hotspot-manager.cpp
│ │ ├── hotspot-manager.hpp
│ │ ├── input-manager.cpp
│ │ ├── input-manager.hpp
│ │ ├── input-method-popup.cpp
│ │ ├── input-method-relay.cpp
│ │ ├── input-method-relay.hpp
│ │ ├── keyboard.cpp
│ │ ├── keyboard.hpp
│ │ ├── pointer.cpp
│ │ ├── pointer.hpp
│ │ ├── pointing-device.cpp
│ │ ├── pointing-device.hpp
│ │ ├── seat-impl.hpp
│ │ ├── seat.cpp
│ │ ├── switch.cpp
│ │ ├── switch.hpp
│ │ ├── tablet.cpp
│ │ ├── tablet.hpp
│ │ ├── touch.cpp
│ │ └── touch.hpp
│ ├── shaders.tpp
│ ├── txn
│ │ ├── transaction-manager-impl.hpp
│ │ ├── transaction-manager.cpp
│ │ └── transaction.cpp
│ ├── view-access-interface.cpp
│ ├── window-manager.cpp
│ ├── wm.cpp
│ └── wm.hpp
├── debug.cpp
├── default-config-backend.cpp
├── geometry.cpp
├── main.cpp
├── main.hpp
├── meson.build
├── output
│ ├── output-impl.hpp
│ ├── output.cpp
│ ├── promotion-manager.hpp
│ ├── render-manager.cpp
│ ├── workarea.cpp
│ ├── workspace-impl.cpp
│ └── workspace-stream.cpp
├── pch
│ └── pch.h
├── region.cpp
├── util.cpp
├── version
│ ├── git-branch.cpp.in
│ └── git-commit.cpp.in
├── view
│ ├── compositor-view.cpp
│ ├── layer-shell
│ │ ├── layer-shell-node.cpp
│ │ ├── layer-shell-node.hpp
│ │ └── layer-shell.cpp
│ ├── toplevel-node.cpp
│ ├── toplevel-node.hpp
│ ├── toplevel-view.cpp
│ ├── translation-node.cpp
│ ├── view-3d.cpp
│ ├── view-impl.cpp
│ ├── view-impl.hpp
│ ├── view.cpp
│ ├── wlr-subsurface-controller.cpp
│ ├── wlr-surface-controller.cpp
│ ├── wlr-surface-node.cpp
│ ├── wlr-surface-pointer-interaction.hpp
│ ├── wlr-surface-touch-interaction.cpp
│ ├── xdg-shell.cpp
│ ├── xdg-shell.hpp
│ ├── xdg-shell
│ │ ├── xdg-toplevel-view.cpp
│ │ ├── xdg-toplevel-view.hpp
│ │ ├── xdg-toplevel.cpp
│ │ └── xdg-toplevel.hpp
│ ├── xwayland.cpp
│ └── xwayland
│ │ ├── xwayland-helpers.cpp
│ │ ├── xwayland-helpers.hpp
│ │ ├── xwayland-toplevel-view.cpp
│ │ ├── xwayland-toplevel-view.hpp
│ │ ├── xwayland-toplevel.cpp
│ │ ├── xwayland-toplevel.hpp
│ │ ├── xwayland-unmanaged-view.hpp
│ │ ├── xwayland-view-base.cpp
│ │ └── xwayland-view-base.hpp
└── wl-listener-wrapper.tpp
├── test
├── geometry
│ ├── geometry_test.cpp
│ └── meson.build
├── meson.build
├── misc
│ ├── meson.build
│ ├── safe-list-test.cpp
│ └── tracking-allocator.cpp
└── txn
│ ├── meson.build
│ ├── transaction-manager-test.cpp
│ ├── transaction-test-object.hpp
│ └── transaction-test.cpp
├── uncrustify.ini
├── wayfire.desktop
└── wayfire.ini
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | end_of_line = lf
5 | insert_final_newline = true
6 | charset = utf-8
7 | indent_style = space
8 | indent_size = 4
9 |
10 | [*.{build,xml,yaml}]
11 | indent_size = 2
12 |
13 | [metadata/**.xml]
14 | indent_style = tab
15 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Bad behavior (crash, something doesn't work, etc.)
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Enable plugin X
16 | 2. Do Y
17 | 3. Z happens
18 |
19 | **Expected behavior**
20 | A clear and concise description of what you expected to happen.
21 |
22 | **Screenshots or stacktrace**
23 | If applicable, add screenshots to help explain your problem.
24 | If it is a crash, attach the backtrace (or the whole log file), Wayfire will print it in the end of the log file or stdout.
25 | Backtrace with address sanitizer enabled (if possible):
26 |
27 | **Wayfire version**
28 | 0.5.0, git, package, something else?
29 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: enhancement
6 | assignees: ''
7 |
8 | ---
9 |
10 | Please describe what you want Wayfire to do.
11 |
12 | If applicable, give an example: User does X, Y, Wayfire does Z
13 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/others.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Others
3 | about: Issues which are neither bugs nor feature requests
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.github/workflows/mandoc.yaml:
--------------------------------------------------------------------------------
1 | name: mandoc
2 |
3 | on:
4 | push:
5 | branches:
6 | - '*'
7 | pull_request:
8 | branches:
9 | - '*'
10 |
11 | jobs:
12 | pipeline:
13 | runs-on: ubuntu-latest
14 | steps:
15 | - uses: actions/checkout@v2
16 | - name: Install dependencies
17 | run: |
18 | sudo apt update
19 | sudo apt-get install -y mandoc
20 | - name: Check man pages
21 | run: |
22 | mandoc -T lint -W warning man/wayfire.1.in
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.toptal.com/developers/gitignore/api/c++,meson,ninja,linux
3 | # Edit at https://www.toptal.com/developers/gitignore?templates=c++,meson,ninja,linux
4 |
5 | ### C++ ###
6 | # Prerequisites
7 | *.d
8 |
9 | # Compiled Object files
10 | *.slo
11 | *.lo
12 | *.o
13 | *.obj
14 |
15 | # Precompiled Headers
16 | *.gch
17 | *.pch
18 |
19 | # Compiled Dynamic libraries
20 | *.so
21 | *.dylib
22 | *.dll
23 |
24 | # Fortran module files
25 | *.mod
26 | *.smod
27 |
28 | # Compiled Static libraries
29 | *.lai
30 | *.la
31 | *.a
32 | *.lib
33 |
34 | # Executables
35 | *.exe
36 | *.out
37 | *.app
38 |
39 | ### Linux ###
40 | *~
41 |
42 | # temporary files which can be created if a process still has a handle open of a deleted file
43 | .fuse_hidden*
44 |
45 | # KDE directory preferences
46 | .directory
47 |
48 | # Linux trash folder which might appear on any partition or disk
49 | .Trash-*
50 |
51 | # .nfs files are created when an open file is removed but is still being accessed
52 | .nfs*
53 |
54 | ### Meson ###
55 | # subproject directories
56 | /subprojects/*
57 | !/subprojects/*.wrap
58 |
59 | ### Ninja ###
60 | .ninja_deps
61 | .ninja_log
62 |
63 | build/**
64 |
65 | # End of https://www.toptal.com/developers/gitignore/api/c++,meson,ninja,linux
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "subprojects/wf-config"]
2 | path = subprojects/wf-config
3 | url = https://github.com/WayfireWM/wf-config
4 | [submodule "subprojects/wlroots"]
5 | path = subprojects/wlroots
6 | url = https://gitlab.freedesktop.org/wlroots/wlroots.git
7 | [submodule "subprojects/wf-utils"]
8 | path = subprojects/wf-utils
9 | url = https://github.com/WayfireWM/wf-utils.git
10 | [submodule "subprojects/wf-touch"]
11 | path = subprojects/wf-touch
12 | url = https://github.com/WayfireWM/wf-touch
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2018 Iliya Bozhinov
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/config.h.in:
--------------------------------------------------------------------------------
1 | #ifndef CONFIG_H
2 | #define CONFIG_H
3 |
4 | #define INSTALL_PREFIX "@INSTALL_PREFIX@"
5 | #define PLUGIN_PATH "@PLUGIN_PATH@"
6 | #define PLUGIN_XML_DIR "@PLUGIN_XML_DIR@"
7 | #define SYSCONFDIR "@SYSCONFDIR@"
8 | #define WF_DEFAULT_CONFIG_BACKEND "@DEFAULT_CONFIG_BACKEND@"
9 | #mesondefine BUILD_WITH_IMAGEIO
10 | #mesondefine USE_GLES32
11 | #mesondefine WF_HAS_XWAYLAND
12 |
13 |
14 | #endif /* end of include guard: CONFIG_H */
15 |
--------------------------------------------------------------------------------
/man/meson.build:
--------------------------------------------------------------------------------
1 | configure_file(input: 'wayfire.1.in',
2 | output: 'wayfire.1',
3 | configuration: conf_data)
4 |
5 | install_man(join_paths(meson.project_build_root(), 'man', 'wayfire.1'))
6 |
--------------------------------------------------------------------------------
/meson_options.txt:
--------------------------------------------------------------------------------
1 | option('enable_gles32', type: 'boolean', value: true, description: 'Enable usage of GLES 3.2')
2 | option('enable_openmp', type: 'boolean', value: true, description: 'Enable usage of OpenMP')
3 | option('use_system_wfconfig', type: 'feature', value: 'auto', description: 'Use the system-wide installation of wf-config')
4 | option('use_system_wlroots', type: 'feature', value: 'auto', description: 'Use the system-wide installation of wlroots')
5 | option('xwayland', type: 'feature', value: 'auto', description: 'Build with xwayland support. Requires wlroots also built with xwayland support')
6 | option('default_config_backend', type: 'string', value: 'default', description: 'Default configuration backend to use')
7 | option('print_trace', type: 'boolean', value: true, description: 'Print stack trace in debug logs (disables coredump)')
8 | option('tests', type: 'feature', value: 'auto', description: 'Enable unit tests')
9 |
--------------------------------------------------------------------------------
/metadata/alpha.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Alpha
5 | <_long>A plugin to change the opacity of windows.
6 | Desktop
7 |
12 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/metadata/autostart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Autostart
5 | <_long>A plugin to run shell commands on startup.
6 | General
7 |
8 | <_short>Autostart
9 | <_long>Specifies the shell commands to run on startup.
10 |
17 |
18 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/metadata/command.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Command
5 | <_long>A plugin to bind key combo (key, button, touch) to execute shell commands.
6 | General
7 |
20 |
21 |
34 |
35 |
48 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/metadata/decoration.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Decoration
5 | <_long>Default decorations around XWayland windows.
6 | Effects
7 |
12 |
17 |
22 |
27 |
28 |
33 |
38 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/metadata/expo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Expo
5 | <_long>A plugin to show an overview of all workspaces.
6 | Desktop
7 |
12 |
17 |
22 |
27 |
32 |
40 |
45 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/metadata/extra-gestures.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Extra Touchscreen Gestures
5 | <_long>A plugin which provides several touchscreen gestures.
6 | Desktop
7 |
14 |
21 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/metadata/fast-switcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Fast Switcher
5 | <_long>A plugin to switch active window.
6 | Window Management
7 |
12 |
17 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/metadata/fisheye.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Fisheye
5 | <_long>A plugin which provides fisheye effect.
6 | Effects
7 |
12 |
18 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/metadata/foreign-toplevel.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Foreign Toplevel Protocol
5 | <_long>An implementation of the wlr-foreign-toplevel-management-v1 protocol.
6 | Utility
7 |
8 |
9 |
--------------------------------------------------------------------------------
/metadata/gtk-shell.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>GTK Shell Protocol
5 | <_long>An implementation of the gtk-shell protocol.
6 | Utility
7 |
8 |
9 |
--------------------------------------------------------------------------------
/metadata/idle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Idle
5 | <_long>A plugin for idle settings, such as the screensaver and DPMS.
6 | Desktop
7 |
8 |
13 |
14 |
19 |
20 |
25 |
26 |
31 |
32 |
37 |
38 |
43 |
49 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/metadata/input-device.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/metadata/input-method-v1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Input-Method-V1 Protocol
5 | <_long>An implementation of the input-method-v1 protocol. Needed for proper functioning of input methods like Fcitx5.
6 | Utility
7 |
11 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/metadata/invert.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Invert
5 | <_long>A plugin to invert the colors of the whole output.
6 | Accessibility
7 |
12 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/metadata/ipc-rules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Window Rules IPC Interface
5 | <_long>Interface to allow an external program to implement window rules (requires the IPC plugin).
6 | Window Management
7 |
8 |
9 |
--------------------------------------------------------------------------------
/metadata/ipc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>IPC protocol
5 | <_long>Allow external programs to interact with Wayfire plugins.
6 | Utility
7 |
8 |
9 |
--------------------------------------------------------------------------------
/metadata/oswitch.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Output Switcher
5 | <_long>A plugin to change the focused output.
6 | Desktop
7 |
12 |
17 |
22 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/metadata/output.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
26 |
27 |
--------------------------------------------------------------------------------
/metadata/place.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Place
5 | <_long>A plugin to position newly opened windows.
6 | Window Management
7 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/metadata/preserve-output.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Preserve Output
5 | <_long>A plugin to restore windows to their original position if outputs are temporarily disconnected.
6 | Window Management
7 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/metadata/resize.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Resize
5 | <_long>A plugin to resize windows by dragging them from any part (not just the edges).
6 | Window Management
7 |
12 |
13 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/metadata/scale-title-filter.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Scale Title Filter
5 | <_long>Filter the views shown by scale by typing.
6 | Utility
7 |
12 |
17 |
22 |
28 |
33 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/metadata/session-lock.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Session Lock Protocol
5 | <_long>An implementation of the ext-session-lock-v1 protocol. Provides more secure screen locking.
6 | Utility
7 |
8 |
9 |
--------------------------------------------------------------------------------
/metadata/shortcuts-inhibit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Keyboard Shortcuts Inhibit Protocol
5 | <_long>An implementation of the keyboard-shortcuts-inhibit-v1 protocol.
6 | Utility
7 |
8 |
13 |
14 |
19 |
20 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/metadata/switcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Switcher
5 | <_long>A plugin to change active window with an animation.
6 | Window Management
7 |
8 |
13 |
18 |
19 |
24 |
29 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/metadata/vswipe.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Viewport Swipe
5 | <_long>A plugin to swipe workspaces in a grid.
6 | Desktop
7 |
12 |
17 |
22 |
27 |
32 |
37 |
42 |
47 |
52 |
57 |
62 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/metadata/wayfire-shell.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Wayfire Shell Protocol
5 | <_long>An implementation of the wayfire-shell protocol.
6 | Utility
7 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/metadata/window-rules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Window Rules
5 | <_long>A plugin to apply specific commands to windows by using various criteria.
6 | Window Management
7 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/metadata/wm-actions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>WM Actions
5 | <_long>A plugin which provides various window management functionalities.
6 | Window Management
7 |
12 |
17 |
22 |
27 |
32 |
37 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/metadata/wobbly.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Wobbly
5 | <_long>A plugin to get wobbly windows.
6 | Effects
7 |
12 |
17 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/metadata/wrot.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Window Rotate
5 | <_long>A plugin to rotate windows with the mouse.
6 | Effects
7 |
12 |
17 |
23 |
28 |
33 |
38 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/metadata/wsets.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Workspace Sets
5 | <_long>A plugin which allows manipulation of workspace sets.
6 | Desktop
7 |
12 |
17 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/metadata/xdg-activation.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>XDG Activation Protocol
5 | <_long>An implementation of the xdg-activation-v1 protocol.
6 | Utility
7 |
8 |
9 |
--------------------------------------------------------------------------------
/metadata/zoom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <_short>Zoom
5 | <_long>A plugin to zoom in the desktop with the mouse.
6 | Accessibility
7 |
12 |
18 |
23 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/plugins/animate/animate.hpp:
--------------------------------------------------------------------------------
1 | #ifndef ANIMATE_H_
2 | #define ANIMATE_H_
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #define WF_ANIMATE_HIDING_ANIMATION (1 << 0)
9 | #define WF_ANIMATE_SHOWING_ANIMATION (1 << 1)
10 | #define WF_ANIMATE_MAP_STATE_ANIMATION (1 << 2)
11 | #define WF_ANIMATE_MINIMIZE_STATE_ANIMATION (1 << 3)
12 |
13 | namespace wf
14 | {
15 | namespace animate
16 | {
17 | enum animation_type
18 | {
19 | ANIMATION_TYPE_MAP = WF_ANIMATE_SHOWING_ANIMATION | WF_ANIMATE_MAP_STATE_ANIMATION,
20 | ANIMATION_TYPE_UNMAP = WF_ANIMATE_HIDING_ANIMATION | WF_ANIMATE_MAP_STATE_ANIMATION,
21 | ANIMATION_TYPE_MINIMIZE = WF_ANIMATE_HIDING_ANIMATION | WF_ANIMATE_MINIMIZE_STATE_ANIMATION,
22 | ANIMATION_TYPE_RESTORE = WF_ANIMATE_SHOWING_ANIMATION | WF_ANIMATE_MINIMIZE_STATE_ANIMATION,
23 | };
24 |
25 | class animation_base_t
26 | {
27 | public:
28 | virtual void init(wayfire_view view, wf::animation_description_t duration, animation_type type)
29 | {}
30 |
31 | /**
32 | * @return True if the animation should continue for at least one more frame.
33 | */
34 | virtual bool step()
35 | {
36 | return false;
37 | }
38 |
39 | /**
40 | * Reverse the animation direction (hiding -> showing, showing -> hiding)
41 | */
42 | virtual void reverse()
43 | {}
44 |
45 | virtual ~animation_base_t() = default;
46 | };
47 |
48 | struct effect_description_t
49 | {
50 | std::function()> generator;
51 | std::function()> default_duration;
52 | };
53 |
54 | /**
55 | * The effects registry holds a list of all available animation effects.
56 | * Plugins can access the effects registry via ref_ptr_t helper in wayfire/plugins/common/shared-core-data.hpp
57 | * They may add/remove their own effects.
58 | */
59 | class animate_effects_registry_t
60 | {
61 | public:
62 | void register_effect(std::string name, effect_description_t effect)
63 | {
64 | effects[name] = effect;
65 | }
66 |
67 | void unregister_effect(std::string name)
68 | {
69 | effects.erase(name);
70 | }
71 |
72 | std::map effects;
73 | };
74 | }
75 | }
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/plugins/animate/fire/fire.hpp:
--------------------------------------------------------------------------------
1 | #ifndef FIRE_ANIMATION_HPP
2 | #define FIRE_ANIMATION_HPP
3 |
4 | #include
5 | #include
6 | #include "../animate.hpp"
7 |
8 | class FireTransformer;
9 | class ParticleSystem;
10 |
11 | class FireAnimation : public wf::animate::animation_base_t
12 | {
13 | std::string name; // the name of the transformer in the view's table
14 | wayfire_view view;
15 | wf::animation::simple_animation_t progression;
16 |
17 | public:
18 |
19 | ~FireAnimation();
20 | void init(wayfire_view view, wf::animation_description_t, wf::animate::animation_type type) override;
21 | bool step() override; /* return true if continue, false otherwise */
22 | void reverse() override; /* reverse the animation */
23 | };
24 |
25 | #endif /* end of include guard: FIRE_ANIMATION_HPP */
26 |
--------------------------------------------------------------------------------
/plugins/animate/fire/shaders.hpp:
--------------------------------------------------------------------------------
1 | #ifndef PARTICLE_ANIMATION_SHADER
2 | #define PARTICLE_ANIMATION_SHADER
3 |
4 | static const char *particle_vert_source =
5 | R"(
6 | #version 100
7 |
8 | attribute mediump float radius;
9 | attribute mediump vec2 position;
10 | attribute mediump vec2 center;
11 | attribute mediump vec4 color;
12 |
13 | uniform mat4 matrix;
14 |
15 | varying mediump vec2 uv;
16 | varying mediump vec4 out_color;
17 | varying mediump float R;
18 |
19 | void main() {
20 | uv = position * radius;
21 | gl_Position = matrix * vec4(center.x + uv.x * 0.75, center.y + uv.y, 0.0, 1.0);
22 |
23 | R = radius;
24 | out_color = color;
25 | }
26 | )";
27 |
28 | static const char *particle_frag_source =
29 | R"(
30 | #version 100
31 |
32 | varying mediump vec2 uv;
33 | varying mediump vec4 out_color;
34 | varying mediump float R;
35 |
36 | uniform mediump float smoothing;
37 |
38 | void main()
39 | {
40 | mediump float len = length(uv);
41 | if (len >= R)
42 | {
43 | gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
44 | }
45 | else {
46 | mediump float factor = 1.0 - len / R;
47 | factor = pow(factor, smoothing);
48 | gl_FragColor = factor * out_color;
49 | }
50 | }
51 | )";
52 |
53 | #endif /* end of include guard: PARTICLE_ANIMATION_SHADER */
54 |
--------------------------------------------------------------------------------
/plugins/animate/meson.build:
--------------------------------------------------------------------------------
1 | dependencies = [wlroots, pixman, wfconfig]
2 |
3 | if get_option('enable_openmp')
4 | dependencies += [dependency('openmp')]
5 | endif
6 |
7 | animiate = shared_module('animate',
8 | ['animate.cpp',
9 | 'fire/particle.cpp',
10 | 'fire/fire.cpp'],
11 | include_directories: [wayfire_api_inc, wayfire_conf_inc],
12 | dependencies: dependencies,
13 | install: true,
14 | install_dir: join_paths(get_option('libdir'), 'wayfire'))
15 |
16 | install_headers(['animate.hpp'], subdir: 'wayfire/plugins/animate')
17 |
--------------------------------------------------------------------------------
/plugins/animate/shaders/frag.glsl:
--------------------------------------------------------------------------------
1 | #version 310 es
2 |
3 | in mediump vec4 out_color;
4 | in mediump vec2 pos;
5 | out mediump vec4 fragColor;
6 |
7 | layout(location = 4) uniform highp float radii;
8 |
9 | void main()
10 | {
11 | mediump float dist_center = sqrt(pos.x * pos.x + pos.y * pos.y);
12 | mediump float factor = (radii - dist_center) / radii;
13 | if (factor < 0.0) factor = 0.0;
14 | mediump float factor2 = factor * factor;
15 |
16 | fragColor = vec4(out_color.xyz, out_color.w * factor2);
17 | }
18 |
--------------------------------------------------------------------------------
/plugins/animate/shaders/vertex.glsl:
--------------------------------------------------------------------------------
1 | #version 310 es
2 |
3 | layout(location = 0) in mediump vec2 position;
4 | layout(location = 1) in mediump vec2 center;
5 | layout(location = 2) in mediump vec4 color;
6 | layout(location = 3) uniform mediump vec2 global_offset;
7 |
8 | out mediump vec4 out_color;
9 | out mediump vec2 pos;
10 |
11 | void main() {
12 | gl_Position = vec4 (position + center + global_offset, 0.0, 1.0);
13 | out_color = color;
14 | pos = position;
15 | }
16 |
--------------------------------------------------------------------------------
/plugins/animate/system_fade.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SYSTEM_FADE_HPP
2 | #define SYSTEM_FADE_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | /* animates wake from suspend/startup by fading in the whole output */
11 | class wf_system_fade
12 | {
13 | wf::animation::simple_animation_t progression;
14 |
15 | wf::output_t *output;
16 |
17 | wf::effect_hook_t damage_hook, render_hook;
18 |
19 | public:
20 | wf_system_fade(wf::output_t *out, wf::animation_description_t dur) :
21 | progression(wf::create_option(dur)), output(out)
22 | {
23 | damage_hook = [=] ()
24 | { output->render->damage_whole(); };
25 |
26 | render_hook = [=] ()
27 | { render(); };
28 |
29 | output->render->add_effect(&damage_hook, wf::OUTPUT_EFFECT_PRE);
30 | output->render->add_effect(&render_hook, wf::OUTPUT_EFFECT_OVERLAY);
31 | output->render->set_redraw_always();
32 | this->progression.animate(1, 0);
33 | }
34 |
35 | void render()
36 | {
37 | wf::color_t color{0, 0, 0, this->progression};
38 | auto fb = output->render->get_target_framebuffer();
39 | auto geometry = output->get_relative_geometry();
40 |
41 | OpenGL::render_begin(fb);
42 | OpenGL::render_rectangle(geometry, color,
43 | fb.get_orthographic_projection());
44 | OpenGL::render_end();
45 |
46 | if (!progression.running())
47 | {
48 | finish();
49 | }
50 | }
51 |
52 | void finish()
53 | {
54 | output->render->rem_effect(&damage_hook);
55 | output->render->rem_effect(&render_hook);
56 | output->render->set_redraw_always(false);
57 |
58 | delete this;
59 | }
60 | };
61 |
62 | #endif
63 |
--------------------------------------------------------------------------------
/plugins/animate/unmapped-view-node.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "wayfire/geometry.hpp"
4 | #include "wayfire/opengl.hpp"
5 | #include "wayfire/region.hpp"
6 | #include "wayfire/scene-render.hpp"
7 | #include "wayfire/scene.hpp"
8 | #include
9 |
10 | namespace wf
11 | {
12 | class unmapped_view_snapshot_node : public wf::scene::node_t
13 | {
14 | wf::render_target_t snapshot;
15 | wf::geometry_t bbox;
16 |
17 | public:
18 | unmapped_view_snapshot_node(wayfire_view view) : node_t(false)
19 | {
20 | view->take_snapshot(snapshot);
21 | bbox = view->get_surface_root_node()->get_bounding_box();
22 | }
23 |
24 | ~unmapped_view_snapshot_node()
25 | {
26 | OpenGL::render_begin();
27 | snapshot.release();
28 | OpenGL::render_end();
29 | }
30 |
31 | wf::geometry_t get_bounding_box() override
32 | {
33 | return bbox;
34 | }
35 |
36 | void gen_render_instances(std::vector& instances,
37 | scene::damage_callback push_damage, wf::output_t *shown_on) override
38 | {
39 | instances.push_back(std::make_unique(this, push_damage, shown_on));
40 | }
41 |
42 | std::string stringify() const override
43 | {
44 | return "unmapped-view-snapshot-node " + this->stringify_flags();
45 | }
46 |
47 | private:
48 | class rinstance_t : public wf::scene::simple_render_instance_t
49 | {
50 | public:
51 | using simple_render_instance_t::simple_render_instance_t;
52 | void render(const wf::render_target_t& target, const wf::region_t& region)
53 | {
54 | OpenGL::render_begin(target);
55 | for (auto& box : region)
56 | {
57 | target.logic_scissor(wlr_box_from_pixman_box(box));
58 | OpenGL::render_texture(self->snapshot.tex, target, self->get_bounding_box());
59 | }
60 |
61 | OpenGL::render_end();
62 | }
63 | };
64 | };
65 | }
66 |
--------------------------------------------------------------------------------
/plugins/blur/meson.build:
--------------------------------------------------------------------------------
1 | blur_base = shared_library('wayfire-blur-base',
2 | ['blur-base.cpp', 'box.cpp', 'gaussian.cpp', 'kawase.cpp', 'bokeh.cpp'],
3 | include_directories: [wayfire_api_inc, wayfire_conf_inc],
4 | dependencies: [wlroots, pixman, wfconfig],
5 | override_options: ['b_lundef=false'],
6 | install: true)
7 | install_headers(['blur.hpp'], subdir: 'wayfire/plugins/blur')
8 |
9 | blur = shared_module('blur', ['blur.cpp'],
10 | link_with: blur_base,
11 | include_directories: [wayfire_api_inc, wayfire_conf_inc],
12 | dependencies: [wlroots, pixman, wfconfig],
13 | install: true, install_dir: join_paths(get_option('libdir'), 'wayfire'))
14 |
--------------------------------------------------------------------------------
/plugins/common/meson.build:
--------------------------------------------------------------------------------
1 | plugins_common_inc = include_directories('.')
2 | install_subdir('wayfire', install_dir: get_option('includedir'))
3 |
--------------------------------------------------------------------------------
/plugins/common/wayfire/plugins/common/geometry-animation.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 |
6 | namespace wf
7 | {
8 | using namespace wf::animation;
9 | class geometry_animation_t : public duration_t
10 | {
11 | public:
12 | using duration_t::duration_t;
13 |
14 | timed_transition_t x{*this};
15 | timed_transition_t y{*this};
16 | timed_transition_t width{*this};
17 | timed_transition_t height{*this};
18 |
19 | void set_start(wf::geometry_t geometry)
20 | {
21 | copy_fields(geometry, &timed_transition_t::start);
22 | }
23 |
24 | void set_end(wf::geometry_t geometry)
25 | {
26 | copy_fields(geometry, &timed_transition_t::end);
27 | }
28 |
29 | operator wf::geometry_t() const
30 | {
31 | return {(int)x, (int)y, (int)width, (int)height};
32 | }
33 |
34 | protected:
35 | void copy_fields(wf::geometry_t geometry, double timed_transition_t::*member)
36 | {
37 | this->x.*member = geometry.x;
38 | this->y.*member = geometry.y;
39 | this->width.*member = geometry.width;
40 | this->height.*member = geometry.height;
41 | }
42 | };
43 |
44 | /** Interpolate the geometry between a and b with alpha (in [0..1]), i.e a *
45 | * (1-alpha) + b * alpha */
46 | static inline wf::geometry_t interpolate(wf::geometry_t a, wf::geometry_t b,
47 | double alpha)
48 | {
49 | const auto& interp = [=] (int32_t wf::geometry_t::*member) -> int32_t
50 | {
51 | return std::round((1 - alpha) * a.*member + alpha * b.*member);
52 | };
53 |
54 | return {
55 | interp(&wf::geometry_t::x),
56 | interp(&wf::geometry_t::y),
57 | interp(&wf::geometry_t::width),
58 | interp(&wf::geometry_t::height)
59 | };
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/plugins/common/wayfire/plugins/common/key-repeat.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace wf
7 | {
8 | struct key_repeat_t
9 | {
10 | wf::option_wrapper_t delay{"input/kb_repeat_delay"};
11 | wf::option_wrapper_t rate{"input/kb_repeat_rate"};
12 |
13 | wf::wl_timer timer_delay;
14 | wf::wl_timer timer_rate;
15 |
16 | using callback_t = std::function;
17 |
18 | key_repeat_t()
19 | {}
20 | key_repeat_t(uint32_t key, callback_t handler)
21 | {
22 | set_callback(key, handler);
23 | }
24 |
25 | void set_callback(uint32_t key, callback_t handler)
26 | {
27 | disconnect();
28 | timer_delay.set_timeout(delay, [=] ()
29 | {
30 | timer_rate.set_timeout(1000 / rate, [=] ()
31 | {
32 | // handle can determine if key should be repeated
33 | return handler(key);
34 | });
35 | });
36 | }
37 |
38 | void disconnect()
39 | {
40 | timer_delay.disconnect();
41 | timer_rate.disconnect();
42 | }
43 | };
44 | }
45 |
--------------------------------------------------------------------------------
/plugins/common/wayfire/plugins/common/shared-core-data.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace wf
7 | {
8 | /**
9 | * The purpose of shared is to allow multiple plugins or plugin instances to
10 | * have shared global custom data.
11 | *
12 | * While this is already possible if the shared data is stored as custom data on
13 | * `wf::get_core()`, the classes here provide convenient wrappers for managing
14 | * the lifetime of the shared data by utilizing RAII.
15 | */
16 | namespace shared_data
17 | {
18 | namespace detail
19 | {
20 | /** Implementation detail: the actual data stored in core. */
21 | template
22 | class shared_data_t : public wf::custom_data_t
23 | {
24 | public:
25 | T data;
26 | int32_t use_count = 0;
27 | };
28 | }
29 |
30 | /**
31 | * A pointer to shared data which holds a reference to it (similar to
32 | * std::shared_ptr). Once the last reference is destroyed, data will be freed
33 | * from core.
34 | */
35 | template
36 | class ref_ptr_t
37 | {
38 | public:
39 | ref_ptr_t()
40 | {
41 | update_use_count(+1);
42 | this->data = &wf::get_core().get_data_safe>()->data;
43 | }
44 |
45 | ref_ptr_t(const ref_ptr_t& other)
46 | {
47 | this->data = other.data;
48 | update_use_count(+1);
49 | }
50 |
51 | ref_ptr_t& operator =(const ref_ptr_t& other)
52 | {
53 | this->data = other.data;
54 | update_use_count(+1);
55 | }
56 |
57 | ref_ptr_t(ref_ptr_t&& other) = default;
58 | ref_ptr_t& operator =(ref_ptr_t&& other) = default;
59 |
60 | ~ref_ptr_t()
61 | {
62 | update_use_count(-1);
63 | }
64 |
65 | T *get()
66 | {
67 | return data;
68 | }
69 |
70 | T*operator ->()
71 | {
72 | return data;
73 | }
74 |
75 | private:
76 | // Update the use count, and delete data if necessary.
77 | void update_use_count(int32_t delta)
78 | {
79 | auto instance = wf::get_core().get_data_safe>();
80 | instance->use_count += delta;
81 | if (instance->use_count <= 0)
82 | {
83 | wf::get_core().erase_data>();
84 | }
85 | }
86 |
87 | // Pointer to the global data
88 | T *data;
89 | };
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/plugins/common/wayfire/plugins/common/simple-text-node.hpp:
--------------------------------------------------------------------------------
1 | #include "wayfire/opengl.hpp"
2 | #include "wayfire/output.hpp"
3 | #include "wayfire/scene.hpp"
4 | #include
5 |
6 | class simple_text_node_t : public wf::scene::node_t
7 | {
8 | class render_instance_t : public wf::scene::simple_render_instance_t
9 | {
10 | public:
11 | using simple_render_instance_t::simple_render_instance_t;
12 |
13 | void render(const wf::render_target_t& target, const wf::region_t& region)
14 | {
15 | OpenGL::render_begin(target);
16 |
17 | auto g = self->get_bounding_box();
18 | for (auto box : region)
19 | {
20 | target.logic_scissor(wlr_box_from_pixman_box(box));
21 | OpenGL::render_texture(self->cr_text.tex.tex, target, g, glm::vec4(1.0f),
22 | OpenGL::TEXTURE_TRANSFORM_INVERT_Y);
23 | }
24 |
25 | OpenGL::render_end();
26 | }
27 | };
28 |
29 | wf::cairo_text_t cr_text;
30 |
31 | public:
32 | simple_text_node_t() : node_t(false)
33 | {}
34 |
35 | void gen_render_instances(std::vector& instances,
36 | wf::scene::damage_callback push_damage, wf::output_t *output) override
37 | {
38 | instances.push_back(std::make_unique(this, push_damage, output));
39 | }
40 |
41 | wf::geometry_t get_bounding_box() override
42 | {
43 | return wf::construct_box(position, size.value_or(cr_text.get_size()));
44 | }
45 |
46 | void set_position(wf::point_t position)
47 | {
48 | this->position = position;
49 | }
50 |
51 | void set_size(wf::dimensions_t size)
52 | {
53 | this->size = size;
54 | }
55 |
56 | void set_text_params(wf::cairo_text_t::params params)
57 | {
58 | this->params = params;
59 | }
60 |
61 | void set_text(std::string text)
62 | {
63 | wf::scene::damage_node(this->shared_from_this(), get_bounding_box());
64 | cr_text.render_text(text, params);
65 | wf::scene::damage_node(this->shared_from_this(), get_bounding_box());
66 | }
67 |
68 | private:
69 | wf::cairo_text_t::params params;
70 | std::optional size;
71 | wf::point_t position;
72 | };
73 |
--------------------------------------------------------------------------------
/plugins/common/wayfire/plugins/common/simple-texture.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace wf
5 | {
6 | struct simple_texture_t
7 | {
8 | GLuint tex = -1;
9 | int width = 0;
10 | int height = 0;
11 |
12 | /**
13 | * Destroy the GL texture.
14 | * This will call OpenGL::render_begin()/end() internally.
15 | */
16 | void release()
17 | {
18 | if (this->tex == (GLuint) - 1)
19 | {
20 | return;
21 | }
22 |
23 | OpenGL::render_begin();
24 | GL_CALL(glDeleteTextures(1, &tex));
25 | OpenGL::render_end();
26 | this->tex = -1;
27 | }
28 |
29 | simple_texture_t() = default;
30 |
31 | /** Auto-release the texture when the object is destroyed */
32 | ~simple_texture_t()
33 | {
34 | release();
35 | }
36 |
37 | simple_texture_t(const simple_texture_t &) = delete;
38 | simple_texture_t& operator =(const simple_texture_t&) = delete;
39 |
40 | simple_texture_t(simple_texture_t && o) noexcept : tex(o.tex), width(o.width),
41 | height(o.height)
42 | {
43 | o.tex = (GLuint) - 1;
44 | }
45 |
46 | simple_texture_t& operator =(simple_texture_t&& o) noexcept
47 | {
48 | if (&o == this)
49 | {
50 | return *this;
51 | }
52 |
53 | release();
54 |
55 | tex = o.tex;
56 | width = o.width;
57 | height = o.height;
58 | o.tex = (GLuint) - 1;
59 |
60 | return *this;
61 | }
62 | };
63 | }
64 |
--------------------------------------------------------------------------------
/plugins/cube/cube-background.hpp:
--------------------------------------------------------------------------------
1 | #ifndef WF_CUBE_BACKGROUND_HPP
2 | #define WF_CUBE_BACKGROUND_HPP
3 |
4 | #include
5 | #include "cube.hpp"
6 |
7 | class wf_cube_background_base
8 | {
9 | public:
10 | virtual void render_frame(const wf::render_target_t& fb,
11 | wf_cube_animation_attribs& attribs) = 0;
12 | virtual ~wf_cube_background_base() = default;
13 | };
14 |
15 | #endif /* end of include guard: WF_CUBE_BACKGROUND_HPP */
16 |
--------------------------------------------------------------------------------
/plugins/cube/cube-control-signal.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CUBE_CONTROL_SIGNAL
2 | #define CUBE_CONTROL_SIGNAL
3 |
4 | #include
5 |
6 | /* A private signal, currently shared by idle & cube
7 | *
8 | * It is used to rotate the cube from the idle plugin as a screensaver.
9 | */
10 |
11 | /* Rotate cube to given angle and zoom level */
12 | struct cube_control_signal
13 | {
14 | double angle; // cube rotation in radians
15 | double zoom; // 1.0 means 100%; increase value to zoom
16 | double ease; // for cube deformation; range 0.0-1.0
17 | bool last_frame; // ends cube animation if true
18 | bool carried_out; // false if cube is disabled
19 | };
20 |
21 | #endif /* end of include guard: CUBE_CONTROL_SIGNAL */
22 |
--------------------------------------------------------------------------------
/plugins/cube/cube.hpp:
--------------------------------------------------------------------------------
1 | #ifndef WF_CUBE_HPP
2 | #define WF_CUBE_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | #define TEX_ERROR_FLAG_COLOR 0, 1, 0, 1
11 |
12 | using namespace wf::animation;
13 |
14 | class cube_animation_t : public duration_t
15 | {
16 | public:
17 | using duration_t::duration_t;
18 | timed_transition_t offset_y{*this};
19 | timed_transition_t offset_z{*this};
20 | timed_transition_t rotation{*this};
21 | timed_transition_t zoom{*this};
22 | timed_transition_t ease_deformation{*this};
23 | };
24 |
25 | struct wf_cube_animation_attribs
26 | {
27 | wf::option_wrapper_t animation_duration{"cube/initial_animation"};
28 | cube_animation_t cube_animation{animation_duration};
29 |
30 | glm::mat4 projection, view;
31 | float side_angle;
32 |
33 | bool in_exit;
34 | };
35 |
36 | #endif /* end of include guard: WF_CUBE_HPP */
37 |
--------------------------------------------------------------------------------
/plugins/cube/cubemap-shaders.tpp:
--------------------------------------------------------------------------------
1 | static const char* cubemap_vertex =
2 | R"(#version 100
3 |
4 | attribute mediump vec3 position;
5 | varying highp vec3 direction;
6 |
7 | uniform mat4 cubeMapMatrix;
8 |
9 | void main()
10 | {
11 | gl_Position = cubeMapMatrix * vec4(position, 1.0);
12 | direction = position;
13 | })";
14 |
15 | static const char* cubemap_fragment =
16 | R"(#version 100
17 | varying highp vec3 direction;
18 | uniform samplerCube smp;
19 |
20 | void main()
21 | {
22 | gl_FragColor = vec4(textureCube(smp, direction).xyz, 1);
23 | })";
24 |
--------------------------------------------------------------------------------
/plugins/cube/cubemap.hpp:
--------------------------------------------------------------------------------
1 | #ifndef WF_CUBE_CUBEMAP_HPP
2 | #define WF_CUBE_CUBEMAP_HPP
3 |
4 | #include "cube-background.hpp"
5 |
6 | class wf_cube_background_cubemap : public wf_cube_background_base
7 | {
8 | public:
9 | wf_cube_background_cubemap();
10 | virtual void render_frame(const wf::render_target_t& fb,
11 | wf_cube_animation_attribs& attribs) override;
12 |
13 | ~wf_cube_background_cubemap();
14 |
15 | private:
16 | void reload_texture();
17 | void create_program();
18 |
19 | OpenGL::program_t program;
20 | GLuint tex = -1;
21 | GLuint vbo_cube_vertices;
22 | GLuint ibo_cube_indices;
23 |
24 | std::string last_background_image;
25 | wf::option_wrapper_t background_image{"cube/cubemap_image"};
26 | };
27 |
28 | #endif /* end of include guard: WF_CUBE_CUBEMAP_HPP */
29 |
--------------------------------------------------------------------------------
/plugins/cube/meson.build:
--------------------------------------------------------------------------------
1 | animiate = shared_module('cube',
2 | ['cube.cpp', 'cubemap.cpp', 'skydome.cpp', 'simple-background.cpp'],
3 | include_directories: [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc, ipc_include_dirs],
4 | dependencies: [wlroots, pixman, wfconfig, json],
5 | install: true,
6 | install_dir: join_paths(get_option('libdir'), 'wayfire'))
7 |
--------------------------------------------------------------------------------
/plugins/cube/shaders.tpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | static const char* cube_vertex_2_0 =
4 | R"(#version 100
5 | attribute mediump vec3 position;
6 | attribute highp vec2 uvPosition;
7 |
8 | varying highp vec2 uvpos;
9 |
10 | uniform mat4 VP;
11 | uniform mat4 model;
12 |
13 | void main() {
14 | gl_Position = VP * model * vec4(position, 1.0);
15 | uvpos = uvPosition;
16 | })";
17 |
18 | static const char* cube_fragment_2_0 =
19 | R"(#version 100
20 | varying highp vec2 uvpos;
21 | uniform sampler2D smp;
22 |
23 | void main() {
24 | gl_FragColor = vec4(texture2D(smp, uvpos).xyz, 1);
25 | })";
26 |
--------------------------------------------------------------------------------
/plugins/cube/simple-background.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "simple-background.hpp"
3 |
4 | wf_cube_simple_background::wf_cube_simple_background()
5 | {}
6 |
7 | void wf_cube_simple_background::render_frame(const wf::render_target_t& fb,
8 | wf_cube_animation_attribs&)
9 | {
10 | OpenGL::render_begin(fb);
11 | OpenGL::clear(background_color, GL_COLOR_BUFFER_BIT);
12 | OpenGL::render_end();
13 | }
14 |
--------------------------------------------------------------------------------
/plugins/cube/simple-background.hpp:
--------------------------------------------------------------------------------
1 | #ifndef WF_CUBE_SIMPLE_BACKGROUND_HPP
2 | #define WF_CUBE_SIMPLE_BACKGROUND_HPP
3 |
4 | #include "cube-background.hpp"
5 |
6 | class wf_cube_simple_background : public wf_cube_background_base
7 | {
8 | wf::option_wrapper_t background_color{"cube/background"};
9 |
10 | public:
11 | wf_cube_simple_background();
12 | virtual void render_frame(const wf::render_target_t& fb,
13 | wf_cube_animation_attribs& attribs) override;
14 | };
15 |
16 | #endif /* end of include guard: WF_CUBE_SIMPLE_BACKGROUND_HPP */
17 |
--------------------------------------------------------------------------------
/plugins/cube/skydome.hpp:
--------------------------------------------------------------------------------
1 | #ifndef WF_CUBE_BACKGROUND_SKYDOME
2 | #define WF_CUBE_BACKGROUND_SKYDOME
3 |
4 | #include "cube-background.hpp"
5 | #include "wayfire/output.hpp"
6 | #include
7 |
8 | class wf_cube_background_skydome : public wf_cube_background_base
9 | {
10 | public:
11 | wf_cube_background_skydome(wf::output_t *output);
12 | virtual void render_frame(const wf::render_target_t& fb,
13 | wf_cube_animation_attribs& attribs) override;
14 |
15 | virtual ~wf_cube_background_skydome();
16 |
17 | private:
18 | wf::output_t *output;
19 |
20 | void load_program();
21 | void fill_vertices();
22 | void reload_texture();
23 |
24 | OpenGL::program_t program;
25 | GLuint tex = -1;
26 |
27 | std::vector vertices;
28 | std::vector coords;
29 | std::vector indices;
30 |
31 | std::string last_background_image;
32 | int last_mirror = -1;
33 | wf::option_wrapper_t background_image{"cube/skydome_texture"};
34 | wf::option_wrapper_t mirror_opt{"cube/skydome_mirror"};
35 | };
36 |
37 | #endif /* end of include guard: WF_CUBE_BACKGROUND_SKYDOME */
38 |
--------------------------------------------------------------------------------
/plugins/decor/deco-subsurface.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DECO_SUBSURFACE_HPP
2 | #define DECO_SUBSURFACE_HPP
3 |
4 | #include "wayfire/object.hpp"
5 | #include "wayfire/toplevel.hpp"
6 | #include
7 | #include
8 |
9 | class simple_decoration_node_t;
10 | namespace wf
11 | {
12 | /**
13 | * A decorator object attached as custom data to a toplevel object.
14 | */
15 | class simple_decorator_t : public wf::custom_data_t
16 | {
17 | wayfire_toplevel_view view;
18 | std::shared_ptr deco;
19 |
20 | wf::signal::connection_t on_view_activated;
21 | wf::signal::connection_t on_view_geometry_changed;
22 | wf::signal::connection_t on_view_fullscreen;
23 |
24 | public:
25 | simple_decorator_t(wayfire_toplevel_view view);
26 | ~simple_decorator_t();
27 | wf::decoration_margins_t get_margins(const wf::toplevel_state_t& state);
28 | };
29 | }
30 |
31 | #endif /* end of include guard: DECO_SUBSURFACE_HPP */
32 |
--------------------------------------------------------------------------------
/plugins/decor/meson.build:
--------------------------------------------------------------------------------
1 | decoration = shared_module('decoration',
2 | ['decoration.cpp', 'deco-subsurface.cpp', 'deco-button.cpp',
3 | 'deco-layout.cpp', 'deco-theme.cpp'],
4 | include_directories: [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc],
5 | dependencies: [wlroots, pixman, wf_protos, wfconfig, cairo, pango, pangocairo],
6 | install: true,
7 | install_dir: join_paths(get_option('libdir'), 'wayfire'))
8 |
--------------------------------------------------------------------------------
/plugins/grid/meson.build:
--------------------------------------------------------------------------------
1 | grid_inc = include_directories('.')
2 | all_include_dirs = [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc, wobbly_inc, grid_inc]
3 | all_deps = [wlroots, pixman, wfconfig, wftouch, cairo, json]
4 |
5 | shared_module('grid', ['grid.cpp'],
6 | include_directories: all_include_dirs,
7 | dependencies: all_deps,
8 | install: true,
9 | install_dir: conf_data.get('PLUGIN_PATH'))
10 |
11 | install_subdir('wayfire', install_dir: get_option('includedir'))
12 |
--------------------------------------------------------------------------------
/plugins/grid/wayfire/plugins/grid.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | namespace wf
8 | {
9 | namespace grid
10 | {
11 | /**
12 | * name: request
13 | * on: core
14 | * when: Emitted before move renders a grid indicator and sets the slot.
15 | * carried_out: true if a plugin can handle move request to grid.
16 | */
17 | struct grid_request_signal
18 | {
19 | /* True if a plugin handled this signal */
20 | bool carried_out = false;
21 | };
22 |
23 | /**
24 | * The slot where a view can be placed with grid.
25 | * BL = bottom-left, TR = top-right, etc.
26 | */
27 | enum slot_t
28 | {
29 | SLOT_NONE = 0,
30 | SLOT_BL = 1,
31 | SLOT_BOTTOM = 2,
32 | SLOT_BR = 3,
33 | SLOT_LEFT = 4,
34 | SLOT_CENTER = 5,
35 | SLOT_RIGHT = 6,
36 | SLOT_TL = 7,
37 | SLOT_TOP = 8,
38 | SLOT_TR = 9,
39 | };
40 |
41 | /*
42 | * 7 8 9
43 | * 4 5 6
44 | * 1 2 3
45 | */
46 | inline uint32_t get_tiled_edges_for_slot(uint32_t slot)
47 | {
48 | if (slot == 0)
49 | {
50 | return 0;
51 | }
52 |
53 | uint32_t edges = wf::TILED_EDGES_ALL;
54 | if (slot % 3 == 0)
55 | {
56 | edges &= ~WLR_EDGE_LEFT;
57 | }
58 |
59 | if (slot % 3 == 1)
60 | {
61 | edges &= ~WLR_EDGE_RIGHT;
62 | }
63 |
64 | if (slot <= 3)
65 | {
66 | edges &= ~WLR_EDGE_TOP;
67 | }
68 |
69 | if (slot >= 7)
70 | {
71 | edges &= ~WLR_EDGE_BOTTOM;
72 | }
73 |
74 | return edges;
75 | }
76 |
77 | inline uint32_t get_slot_from_tiled_edges(uint32_t edges)
78 | {
79 | for (int slot = 0; slot <= 9; slot++)
80 | {
81 | if (get_tiled_edges_for_slot(slot) == edges)
82 | {
83 | return slot;
84 | }
85 | }
86 |
87 | return 0;
88 | }
89 |
90 | /*
91 | * 7 8 9
92 | * 4 5 6
93 | * 1 2 3
94 | * */
95 | inline wf::geometry_t get_slot_dimensions(wf::output_t *output, int n)
96 | {
97 | auto area = output->workarea->get_workarea();
98 | int w2 = area.width / 2;
99 | int h2 = area.height / 2;
100 |
101 | if (n % 3 == 1)
102 | {
103 | area.width = w2;
104 | }
105 |
106 | if (n % 3 == 0)
107 | {
108 | area.width = w2, area.x += w2;
109 | }
110 |
111 | if (n >= 7)
112 | {
113 | area.height = h2;
114 | } else if (n <= 3)
115 | {
116 | area.height = h2, area.y += h2;
117 | }
118 |
119 | return area;
120 | }
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/plugins/ipc-rules/meson.build:
--------------------------------------------------------------------------------
1 | all_include_dirs = [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc]
2 | all_deps = [wlroots, pixman, wfconfig, wftouch, json]
3 |
4 | shared_module('ipc-rules', ['ipc-rules.cpp'],
5 | include_directories: all_include_dirs,
6 | dependencies: all_deps,
7 | install: true,
8 | install_dir: conf_data.get('PLUGIN_PATH'))
9 |
10 | install_headers(['ipc-rules-common.hpp'], subdir: 'wayfire/plugins/ipc')
11 |
--------------------------------------------------------------------------------
/plugins/ipc/ipc.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include "ipc-method-repository.hpp"
9 |
10 | namespace wf
11 | {
12 | namespace ipc
13 | {
14 | /**
15 | * Represents a single connected client to the IPC socket.
16 | */
17 | class server_t;
18 | class client_t : public client_interface_t
19 | {
20 | public:
21 | client_t(server_t *server, int client_fd);
22 | ~client_t();
23 | void send_json(nlohmann::json json) override;
24 |
25 | private:
26 | int fd;
27 | wl_event_source *source;
28 | server_t *ipc;
29 |
30 | int current_buffer_valid = 0;
31 | std::vector buffer;
32 | int read_up_to(int n, int *available);
33 |
34 | /** Handle incoming data on the socket */
35 | std::function handle_fd_activity;
36 | void handle_fd_incoming(uint32_t);
37 | };
38 |
39 | /**
40 | * The IPC server is a singleton object accessed via shared_data::ref_ptr_t.
41 | * It represents the IPC socket used for communication with clients.
42 | */
43 | class server_t
44 | {
45 | public:
46 | server_t();
47 | void init(std::string socket_path);
48 | ~server_t();
49 |
50 | private:
51 | friend class client_t;
52 | wf::shared_data::ref_ptr_t method_repository;
53 |
54 | void handle_incoming_message(client_t *client, nlohmann::json message);
55 |
56 | void client_disappeared(client_t *client);
57 |
58 | int fd = -1;
59 |
60 | /**
61 | * Setup a socket at the given address, and set it as CLOEXEC and non-blocking.
62 | */
63 | int setup_socket(const char *address);
64 | sockaddr_un saddr;
65 | wl_event_source *source;
66 | std::vector> clients;
67 |
68 | std::function accept_new_client;
69 | void do_accept_new_client();
70 | };
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/plugins/ipc/meson.build:
--------------------------------------------------------------------------------
1 | evdev = dependency('libevdev')
2 |
3 | ipc_include_dirs = include_directories('.')
4 |
5 | ipc = shared_module('ipc',
6 | ['ipc.cpp'],
7 | include_directories: [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc],
8 | dependencies: [wlroots, pixman, wfconfig, wftouch, json, evdev],
9 | install: true,
10 | install_dir: conf_data.get('PLUGIN_PATH'))
11 |
12 | stipc = shared_module('stipc',
13 | ['stipc.cpp'],
14 | include_directories: [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc],
15 | dependencies: [wlroots, pixman, wfconfig, wftouch, json, evdev],
16 | install: true,
17 | install_dir: conf_data.get('PLUGIN_PATH'))
18 |
19 | demoipc = shared_module('demo-ipc',
20 | ['demo-ipc.cpp'],
21 | include_directories: [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc],
22 | dependencies: [wlroots, pixman, wfconfig, wftouch, json, evdev],
23 | install: true,
24 | install_dir: conf_data.get('PLUGIN_PATH'))
25 |
26 | install_headers(['ipc-method-repository.hpp', 'ipc-helpers.hpp', 'ipc-activator.hpp'], subdir: 'wayfire/plugins/ipc')
27 |
--------------------------------------------------------------------------------
/plugins/meson.build:
--------------------------------------------------------------------------------
1 | subdir('common')
2 | subdir('ipc')
3 | subdir('protocols')
4 | subdir('vswitch')
5 | subdir('wobbly')
6 | subdir('grid')
7 | subdir('decor')
8 | subdir('animate')
9 | subdir('cube')
10 | subdir('window-rules')
11 | subdir('blur')
12 | subdir('tile')
13 | subdir('wm-actions')
14 | subdir('scale')
15 | subdir('single_plugins')
16 | subdir('ipc-rules')
17 |
--------------------------------------------------------------------------------
/plugins/protocols/gtk-shell.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | /**
6 | * A signal to query the gtk_shell plugin about the gtk-shell-specific app_id of the given view.
7 | */
8 | struct gtk_shell_app_id_query_signal
9 | {
10 | wayfire_view view;
11 |
12 | // Set by the gtk-shell plugin in response to the signal
13 | std::string app_id;
14 | };
15 |
--------------------------------------------------------------------------------
/plugins/protocols/input-method-v1.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace wf
5 | {
6 | /**
7 | * on: core
8 | * Emitted when a text input (v1 or v3) is activated.
9 | */
10 | struct input_method_v1_activate_signal
11 | {};
12 |
13 | /**
14 | * on: core
15 | * Emitted when a text input (v1 or v3) is deactivated.
16 | */
17 | struct input_method_v1_deactivate_signal
18 | {};
19 | }
20 |
--------------------------------------------------------------------------------
/plugins/protocols/meson.build:
--------------------------------------------------------------------------------
1 | protocol_plugins = [
2 | 'foreign-toplevel', 'gtk-shell', 'wayfire-shell', 'xdg-activation', 'shortcuts-inhibit',
3 | 'input-method-v1', 'session-lock'
4 | ]
5 |
6 | all_include_dirs = [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc]
7 | all_deps = [wlroots, pixman, wfconfig, wf_protos, json, cairo, pango, pangocairo]
8 |
9 | foreach plugin : protocol_plugins
10 | shared_module(plugin, plugin + '.cpp',
11 | include_directories: all_include_dirs,
12 | dependencies: all_deps,
13 | install: true,
14 | install_dir: conf_data.get('PLUGIN_PATH'))
15 | endforeach
16 |
17 | install_headers(['input-method-v1.hpp'], subdir: 'wayfire/plugins/input-method-v1/')
18 |
--------------------------------------------------------------------------------
/plugins/protocols/xdg-activation.cpp:
--------------------------------------------------------------------------------
1 | #include "wayfire/core.hpp"
2 | #include "wayfire/signal-definitions.hpp"
3 | #include "wayfire/view.hpp"
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include "config.h"
11 |
12 | class wayfire_xdg_activation_protocol_impl : public wf::plugin_interface_t
13 | {
14 | public:
15 | void init() override
16 | {
17 | xdg_activation = wlr_xdg_activation_v1_create(wf::get_core().display);
18 | xdg_activation_request_activate.notify = xdg_activation_handle_request_activate;
19 |
20 | wl_signal_add(&xdg_activation->events.request_activate, &xdg_activation_request_activate);
21 | }
22 |
23 | void fini() override
24 | {}
25 |
26 | bool is_unloadable() override
27 | {
28 | return false;
29 | }
30 |
31 | private:
32 | static void xdg_activation_handle_request_activate(struct wl_listener *listener, void *data)
33 | {
34 | auto event = static_cast(data);
35 |
36 | wayfire_view view = wf::wl_surface_to_wayfire_view(event->surface->resource);
37 | if (!view)
38 | {
39 | LOGE("Could not get view");
40 | return;
41 | }
42 |
43 | auto toplevel = wf::toplevel_cast(view);
44 | if (!toplevel)
45 | {
46 | LOGE("Could not get toplevel view");
47 | return;
48 | }
49 |
50 | if (!event->token->seat)
51 | {
52 | LOGI("Denying focus request, seat wasn't supplied");
53 | return;
54 | }
55 |
56 | LOGI("Activating view");
57 | wf::get_core().default_wm->focus_request(toplevel);
58 | }
59 |
60 | struct wlr_xdg_activation_v1 *xdg_activation;
61 | struct wl_listener xdg_activation_request_activate;
62 | };
63 |
64 | DECLARE_WAYFIRE_PLUGIN(wayfire_xdg_activation_protocol_impl);
65 |
--------------------------------------------------------------------------------
/plugins/scale/meson.build:
--------------------------------------------------------------------------------
1 | all_include_dirs = [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc, vswitch_inc, wobbly_inc, include_directories('.')]
2 | all_deps = [wlroots, pixman, wfconfig, wftouch, cairo, pango, pangocairo, json]
3 |
4 | shared_module('scale', ['scale.cpp', 'scale-title-overlay.cpp'],
5 | include_directories: all_include_dirs,
6 | dependencies: all_deps,
7 | install: true,
8 | install_dir: conf_data.get('PLUGIN_PATH'))
9 |
10 | shared_module('scale-title-filter', 'scale-title-filter.cpp',
11 | include_directories: all_include_dirs,
12 | dependencies: all_deps,
13 | install: true,
14 | install_dir: conf_data.get('PLUGIN_PATH'))
15 |
16 | install_headers(['wayfire/plugins/scale-signal.hpp'], subdir: 'wayfire/plugins')
17 |
--------------------------------------------------------------------------------
/plugins/scale/scale-title-overlay.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "wayfire/signal-definitions.hpp"
4 | #include "wayfire/signal-provider.hpp"
5 | #include
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | namespace wf
12 | {
13 | namespace scene
14 | {
15 | class title_overlay_node_t;
16 | }
17 | }
18 |
19 |
20 | class scale_show_title_t
21 | {
22 | protected:
23 | /* Overlays for showing the title of each view */
24 | wf::option_wrapper_t bg_color{"scale/bg_color"};
25 | wf::option_wrapper_t text_color{"scale/text_color"};
26 | wf::option_wrapper_t show_view_title_overlay_opt{
27 | "scale/title_overlay"};
28 | wf::option_wrapper_t title_font_size{"scale/title_font_size"};
29 | wf::option_wrapper_t title_position{"scale/title_position"};
30 | wf::output_t *output;
31 |
32 | public:
33 | scale_show_title_t();
34 |
35 | void init(wf::output_t *output);
36 |
37 | void fini();
38 |
39 | protected:
40 | /* signals */
41 | wf::signal::connection_t view_filter;
42 | wf::signal::connection_t scale_end;
43 | wf::signal::connection_t add_title_overlay;
44 | wf::signal::connection_t rem_title_overlay;
45 | wf::signal::connection_t> post_motion;
46 | wf::signal::connection_t>
47 | post_absolute_motion;
48 |
49 | enum class title_overlay_t
50 | {
51 | NEVER,
52 | MOUSE,
53 | ALL,
54 | };
55 |
56 | friend class wf::scene::title_overlay_node_t;
57 |
58 | title_overlay_t show_view_title_overlay;
59 | /* only used if title overlay is set to follow the mouse */
60 | wayfire_view last_title_overlay = nullptr;
61 |
62 | void update_title_overlay_opt();
63 | void update_title_overlay_mouse();
64 | };
65 |
--------------------------------------------------------------------------------
/plugins/scale/scale.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "wayfire/debug.hpp"
4 | #include "wayfire/toplevel-view.hpp"
5 | #include "wayfire/plugins/common/util.hpp"
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | inline wayfire_toplevel_view scale_find_view_at(wf::pointf_t at, wf::output_t *output)
12 | {
13 | auto offset = wf::origin(output->get_layout_geometry());
14 | at.x -= offset.x;
15 | at.y -= offset.y;
16 | return wf::find_output_view_at(output, at);
17 | }
18 |
--------------------------------------------------------------------------------
/plugins/single_plugins/autostart.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | class wayfire_autostart : public wf::plugin_interface_t
8 | {
9 | wf::option_wrapper_t autostart_wf_shell{"autostart/autostart_wf_shell"};
10 | wf::option_wrapper_t>
11 | autostart_entries{"autostart/autostart"};
12 |
13 | public:
14 | void init() override
15 | {
16 | /* Run only once, at startup */
17 | auto section = wf::get_core().config.get_section("autostart");
18 |
19 | bool panel_manually_started = false;
20 | bool background_manually_started = false;
21 |
22 | for (const auto& [name, command] : autostart_entries.value())
23 | {
24 | // Because we accept any option names, we should ignore regular
25 | // options
26 | if (name == "autostart_wf_shell")
27 | {
28 | continue;
29 | }
30 |
31 | wf::get_core().run(command);
32 | if (command.find("wf-panel") != std::string::npos)
33 | {
34 | panel_manually_started = true;
35 | }
36 |
37 | if (command.find("wf-background") != std::string::npos)
38 | {
39 | background_manually_started = true;
40 | }
41 | }
42 |
43 | if (autostart_wf_shell && !panel_manually_started)
44 | {
45 | wf::get_core().run("wf-panel");
46 | }
47 |
48 | if (autostart_wf_shell && !background_manually_started)
49 | {
50 | wf::get_core().run("wf-background");
51 | }
52 | }
53 |
54 | bool is_unloadable() override
55 | {
56 | return false;
57 | }
58 | };
59 |
60 | DECLARE_WAYFIRE_PLUGIN(wayfire_autostart);
61 |
--------------------------------------------------------------------------------
/plugins/single_plugins/compositor-view-test.cpp:
--------------------------------------------------------------------------------
1 | #include "wayfire/compositor-view.hpp"
2 | #include "wayfire/render-manager.hpp"
3 | #include "wayfire/output.hpp"
4 | #include "wayfire/core.hpp"
5 | #include "wayfire/debug.hpp"
6 |
7 | extern "C"
8 | {
9 | #define static
10 | #include
11 | #include
12 | #include
13 | #undef static
14 | }
15 |
16 | class test_view : public wayfire_compositor_view_t,
17 | public wayfire_compositor_interactive_view
18 | {
19 | public:
20 | virtual void _wlr_render_box(const wf::framebuffer_t& fb, int x, int y,
21 | const wlr_box& scissor)
22 | {
23 | wlr_box g{x, y, geometry.width, geometry.height};
24 | geometry = fb.damage_box_from_geometry_box(g);
25 |
26 | float projection[9];
27 | wlr_matrix_projection(projection, fb.viewport_width, fb.viewport_height,
28 | (wl_output_transform)fb.wl_transform);
29 |
30 | float matrix[9];
31 | wlr_matrix_project_box(matrix, &g, WL_OUTPUT_TRANSFORM_NORMAL, 0,
32 | projection);
33 |
34 | OpenGL::render_begin(fb);
35 | auto sbox = scissor;
36 | wlr_renderer_scissor(wf::get_core().renderer, &sbox);
37 |
38 | float color[] = {1.0f, 0.0, 1.0f, 1.0f};
39 |
40 | wlr_render_quad_with_matrix(wf::get_core().renderer, color, matrix);
41 | OpenGL::render_end();
42 | }
43 |
44 | virtual bool accepts_input(int sx, int sy)
45 | {
46 | return 0 <= sx && sx < geometry.width &&
47 | 0 <= sy && sy < geometry.height;
48 | }
49 | };
50 |
51 | class wayfire_cvtest : public wayfire_plugin_t
52 | {
53 | wf::key_callback binding;
54 |
55 | public:
56 | void init(wayfire_config *config)
57 | {
58 | binding = [=] (uint32_t) {test();};
59 | output->add_key(new_static_option(" KEY_T"), &binding);
60 | }
61 |
62 | void test()
63 | {
64 | auto cv = new wayfire_mirror_view_t(output->get_top_view());
65 |
66 | auto v = std::unique_ptr{cv};
67 | wf::get_core().add_view(std::move(v));
68 | cv->map();
69 | }
70 | };
71 |
72 | extern "C"
73 | {
74 | wayfire_plugin_t *newInstance()
75 | {
76 | return new wayfire_cvtest;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/plugins/single_plugins/meson.build:
--------------------------------------------------------------------------------
1 | plugins = [
2 | 'move', 'resize', 'command', 'autostart', 'vswipe', 'wrot', 'expo',
3 | 'switcher', 'fast-switcher', 'oswitch', 'place', 'invert',
4 | 'fisheye', 'zoom', 'alpha', 'idle', 'extra-gestures', 'preserve-output',
5 | 'wsets', 'xkb-bindings'
6 | ]
7 |
8 | all_include_dirs = [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc, vswitch_inc, wobbly_inc, grid_inc]
9 | all_deps = [wlroots, pixman, wfconfig, wftouch, cairo, pango, pangocairo, json]
10 |
11 | foreach plugin : plugins
12 | shared_module(plugin, plugin + '.cpp',
13 | include_directories: all_include_dirs,
14 | dependencies: all_deps,
15 | install: true,
16 | install_dir: conf_data.get('PLUGIN_PATH'))
17 | endforeach
18 |
--------------------------------------------------------------------------------
/plugins/single_plugins/vswipe-processing.hpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | static inline double vswipe_process_delta(const double delta,
5 | const double accumulated_dx,
6 | const int vx, const int vw,
7 | const double speed_cap = 0.5,
8 | const bool free_movement = false)
9 | {
10 | // The slowdown below must be applied differently for going out of bounds.
11 | double sdx_offset = free_movement ?
12 | std::copysign(0, accumulated_dx) : accumulated_dx;
13 | if (vx - accumulated_dx < 0.0)
14 | {
15 | sdx_offset = (accumulated_dx - std::floor(accumulated_dx)) + 1.0;
16 | }
17 |
18 | if (vx - accumulated_dx > vw - 1.0)
19 | {
20 | sdx_offset = (accumulated_dx - std::ceil(accumulated_dx)) - 1.0;
21 | }
22 |
23 | // To achieve a "rubberband" resistance effect when going too far, ease-in
24 | // of the whole swiped distance is used as a slowdown factor for the current
25 | // delta.
26 | const double ease = 1.0 - std::pow(std::abs(sdx_offset) - 0.025, 4.0);
27 |
28 | // If we're moving further in the limit direction, slow down all the way
29 | // to extremely slow, but reversing the direction should be easier.
30 | const double slowdown = wf::clamp(ease,
31 | std::signbit(delta) == std::signbit(sdx_offset) ? 0.005 : 0.2, 1.0);
32 |
33 | return wf::clamp(delta, -speed_cap, speed_cap) * slowdown;
34 | }
35 |
36 | static inline int vswipe_finish_target(const double accumulated_dx,
37 | const int vx, const int vw,
38 | const double last_deltas = 0,
39 | const double move_threshold = 0.35,
40 | const double fast_threshold = 24,
41 | const bool free_movement = false)
42 | {
43 | int target_dx = 0;
44 | if (accumulated_dx > 0)
45 | {
46 | target_dx = std::floor(accumulated_dx);
47 | if ((accumulated_dx - target_dx > move_threshold) ||
48 | ((!free_movement || !target_dx) && (last_deltas > fast_threshold)))
49 | {
50 | ++target_dx;
51 | }
52 |
53 | if (vx - target_dx < 0)
54 | {
55 | target_dx = vx;
56 | }
57 | } else if (accumulated_dx < 0)
58 | {
59 | target_dx = std::ceil(accumulated_dx);
60 | if ((accumulated_dx - target_dx < -move_threshold) ||
61 | ((!free_movement || !target_dx) && (last_deltas < -fast_threshold)))
62 | {
63 | --target_dx;
64 | }
65 |
66 | if (vx - target_dx > vw - 1)
67 | {
68 | target_dx = vx - vw + 1;
69 | }
70 | }
71 |
72 | if (!free_movement)
73 | {
74 | target_dx = wf::clamp(target_dx, -1, 1);
75 | }
76 |
77 | return target_dx;
78 | }
79 |
--------------------------------------------------------------------------------
/plugins/tile/meson.build:
--------------------------------------------------------------------------------
1 | tile = shared_module('simple-tile',
2 | ['tile-plugin.cpp', 'tree.cpp', 'tree-controller.cpp'],
3 | include_directories: [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc, grid_inc, wobbly_inc, ipc_include_dirs],
4 | dependencies: [wlroots, pixman, wfconfig, json],
5 | install: true,
6 | install_dir: join_paths(get_option('libdir'), 'wayfire'))
7 |
8 |
9 |
--------------------------------------------------------------------------------
/plugins/vswitch/meson.build:
--------------------------------------------------------------------------------
1 | vswitch_inc = include_directories('.')
2 |
3 | vswitch = shared_module('vswitch',
4 | ['vswitch.cpp'],
5 | include_directories: [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc, vswitch_inc, ipc_include_dirs],
6 | dependencies: [wlroots, pixman, wfconfig, json],
7 | install: true,
8 | install_dir: join_paths(get_option('libdir'), 'wayfire'))
9 |
10 | install_headers(['wayfire/plugins/vswitch.hpp'], subdir: 'wayfire/plugins')
11 |
--------------------------------------------------------------------------------
/plugins/window-rules/meson.build:
--------------------------------------------------------------------------------
1 | window_rules = shared_module('window-rules',
2 | ['window-rules.cpp', 'view-action-interface.cpp'],
3 | include_directories: [wayfire_api_inc, wayfire_conf_inc, grid_inc, plugins_common_inc],
4 | dependencies: [wlroots, pixman, wfconfig, wfutils],
5 | install: true,
6 | install_dir: join_paths(get_option('libdir'), 'wayfire')
7 | )
8 |
--------------------------------------------------------------------------------
/plugins/window-rules/view-action-interface.hpp:
--------------------------------------------------------------------------------
1 | #ifndef VIEW_ACTION_INTERFACE_HPP
2 | #define VIEW_ACTION_INTERFACE_HPP
3 |
4 | #include "wayfire/action/action_interface.hpp"
5 | #include "wayfire/view.hpp"
6 | #include
7 | #include
8 | #include
9 |
10 | namespace wf
11 | {
12 | class view_action_interface_t : public action_interface_t
13 | {
14 | public:
15 | virtual ~view_action_interface_t() override;
16 |
17 | virtual bool execute(const std::string & name,
18 | const std::vector & args) override;
19 |
20 | void set_view(wayfire_view view);
21 |
22 | private:
23 | void _maximize();
24 | void _unmaximize();
25 | void _minimize();
26 | void _unminimize();
27 | void _make_sticky();
28 | void _always_on_top();
29 |
30 | std::tuple _expect_float(const std::vector & args,
31 | std::size_t position);
32 | std::tuple _expect_double(const std::vector & args,
33 | std::size_t position);
34 | std::tuple _expect_int(const std::vector & args,
35 | std::size_t position);
36 |
37 | std::tuple _validate_alpha(const std::vector & args);
38 | std::tuple _validate_geometry(
39 | const std::vector & args);
40 | std::tuple _validate_position(
41 | const std::vector & args);
42 | std::tuple _validate_size(const std::vector & args);
43 |
44 | std::tuple _validate_ws(const std::vector& args);
45 |
46 | void _set_alpha(float alpha);
47 | void _set_geometry(int x, int y, int w, int h);
48 | void _set_geometry_ppt(int x, int y, int w, int h);
49 | void _start_on_output(std::string output);
50 | void _move(int x, int y);
51 | void _resize(int w, int h);
52 |
53 | void _assign_ws(wf::point_t point);
54 |
55 | wf::geometry_t _get_workspace_grid_geometry(wf::output_t *output) const;
56 |
57 | wayfire_toplevel_view _view;
58 | wayfire_view _nontoplevel;
59 | };
60 | } // End namespace wf.
61 |
62 | #endif // VIEW_ACTION_INTERFACE_HPP
63 |
--------------------------------------------------------------------------------
/plugins/wm-actions/meson.build:
--------------------------------------------------------------------------------
1 | wm_actions = shared_module('wm-actions',
2 | ['wm-actions.cpp'],
3 | include_directories: [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc],
4 | dependencies: [wlroots, pixman, wfconfig, json],
5 | install: true,
6 | install_dir: join_paths(get_option('libdir'), 'wayfire'))
7 |
8 | install_headers( [ 'wm-actions-signals.hpp' ], subdir: 'wayfire/plugins' )
9 |
--------------------------------------------------------------------------------
/plugins/wm-actions/wm-actions-signals.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace wf
6 | {
7 | /**
8 | * on: output
9 | * when: Emitted whenever some entity requests that the view's above state
10 | * is supposed to change.
11 | * arguments: above: whether or not to set above state
12 | */
13 | struct wm_actions_set_above_state_signal
14 | {
15 | wayfire_view view;
16 |
17 | /** The requested above state. If this is true, the view will be
18 | * added to the always-above layer. If it is false, the view will
19 | * be placed in the 'normal' workspace layer. */
20 | bool above;
21 | };
22 |
23 | /**
24 | * on: output
25 | * when: Emitted whenever a views above layer has been changed.
26 | */
27 | struct wm_actions_above_changed_signal
28 | {
29 | wayfire_view view;
30 | };
31 | }
32 |
--------------------------------------------------------------------------------
/plugins/wobbly/meson.build:
--------------------------------------------------------------------------------
1 | wobbly = shared_module('wobbly',
2 | ['wobbly.cpp', 'wobbly.c'],
3 | include_directories: [wayfire_api_inc, wayfire_conf_inc, plugins_common_inc],
4 | dependencies: [wlroots, pixman, wfconfig],
5 | install: true,
6 | install_dir: join_paths(get_option('libdir'), 'wayfire'))
7 |
8 | wobbly_inc = include_directories('.')
9 | install_headers(['wayfire/plugins/wobbly/wobbly-signal.hpp'], subdir: 'wayfire/plugins/wobbly')
10 |
--------------------------------------------------------------------------------
/plugins/wobbly/wobbly.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | *
3 | * Copyright 2014 Scott Moreau
4 | * All Rights Reserved.
5 | *
6 | **************************************************************************/
7 |
8 | #include
9 |
10 | #include
11 |
12 | #define MINIMAL_FRICTION 0.1
13 | #define MAXIMAL_FRICTION 10.0
14 | #define MINIMAL_SPRING_K 0.1
15 | #define MAXIMAL_SPRING_K 10.0
16 | #define WOBBLY_MASS 15.0
17 |
18 | double wobbly_settings_get_friction();
19 | double wobbly_settings_get_spring_k();
20 |
21 | struct wobbly_surface
22 | {
23 | void *ww;
24 | int x, y, width, height;
25 | int x_cells, y_cells;
26 | int grabbed, synced;
27 | int vertex_count;
28 |
29 | GLfloat *v, *uv;
30 | };
31 |
32 | struct wobbly_rect
33 | {
34 | float tlx, tly;
35 | float brx, bry;
36 | };
37 |
38 | int wobbly_init(struct wobbly_surface *surface);
39 | void wobbly_fini(struct wobbly_surface *surface);
40 | void wobbly_set_top_anchor(struct wobbly_surface *surface,
41 | int x, int y, int w, int h);
42 |
43 | void wobbly_grab_notify(struct wobbly_surface *surface, int x, int y);
44 | void wobbly_slight_wobble(struct wobbly_surface *surface);
45 | void wobbly_ungrab_notify(struct wobbly_surface *surface);
46 |
47 | void wobbly_scale(struct wobbly_surface *surface, double dx, double dy);
48 | void wobbly_resize(struct wobbly_surface *surface, int width, int height);
49 | void wobbly_move_notify(struct wobbly_surface *surface, int x, int y);
50 | void wobbly_prepare_paint(struct wobbly_surface *surface, int msSinceLastPaint);
51 | void wobbly_done_paint(struct wobbly_surface *surface);
52 | void wobbly_add_geometry(struct wobbly_surface *surface);
53 | struct wobbly_rect wobbly_boundingbox(struct wobbly_surface *surface);
54 |
55 | void wobbly_force_geometry(struct wobbly_surface *surface,
56 | int x, int y, int w, int h);
57 | void wobbly_unenforce_geometry(struct wobbly_surface *surface);
58 |
59 | void wobbly_translate(struct wobbly_surface *surface, int dx, int dy);
60 |
--------------------------------------------------------------------------------
/proto/meson.build:
--------------------------------------------------------------------------------
1 | wl_protocol_dir = wayland_protos.get_variable(pkgconfig: 'pkgdatadir')
2 |
3 | wayland_scanner = find_program('wayland-scanner', native: true)
4 |
5 | wayland_scanner_server = generator(
6 | wayland_scanner,
7 | output: '@BASENAME@-protocol.h',
8 | arguments: ['server-header', '@INPUT@', '@OUTPUT@'],
9 | )
10 |
11 | wayland_scanner_code = generator(
12 | wayland_scanner,
13 | output: '@BASENAME@-protocol.c',
14 | arguments: ['private-code', '@INPUT@', '@OUTPUT@'],
15 | )
16 |
17 | wayland_scanner_client = generator(
18 | wayland_scanner,
19 | output: '@BASENAME@-client-protocol.h',
20 | arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
21 | )
22 |
23 | server_protocols = [
24 | [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
25 | [wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
26 | [wl_protocol_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml'],
27 | [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
28 | [wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'],
29 | [wl_protocol_dir, 'unstable/relative-pointer/relative-pointer-unstable-v1.xml'],
30 | [wl_protocol_dir, 'stable/tablet/tablet-v2.xml'],
31 | [wl_protocol_dir, 'unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml'],
32 | [wl_protocol_dir, 'unstable/input-method/input-method-unstable-v1.xml'],
33 | [wl_protocol_dir, 'staging/ext-session-lock/ext-session-lock-v1.xml'],
34 | [wl_protocol_dir, 'unstable/text-input/text-input-unstable-v1.xml'],
35 | 'wayfire-shell-unstable-v2.xml',
36 | 'gtk-shell.xml',
37 | 'wlr-layer-shell-unstable-v1.xml',
38 | 'wlr-output-power-management-unstable-v1.xml'
39 | ]
40 |
41 | wl_protos_src = []
42 | wl_protos_headers = []
43 |
44 | foreach p : server_protocols
45 | xml = join_paths(p)
46 | wl_protos_src += wayland_scanner_code.process(xml)
47 | wl_protos_headers += wayland_scanner_server.process(xml)
48 | endforeach
49 |
50 | lib_wl_protos = static_library('wl_protos', wl_protos_src + wl_protos_headers,
51 | dependencies: [wayland_client]) # for the include directory
52 |
53 | wf_protos = declare_dependency(
54 | link_with: lib_wl_protos,
55 | sources: wl_protos_headers,
56 | )
57 |
58 | # Install wayfire-shell protocol, so that other projects can find it
59 | install_data('wayfire-shell-unstable-v2.xml', install_dir: join_paths(pkgdatadir, 'unstable'))
60 |
--------------------------------------------------------------------------------
/src/api/wayfire/compositor-view.hpp:
--------------------------------------------------------------------------------
1 | #ifndef COMPOSITOR_VIEW_HPP
2 | #define COMPOSITOR_VIEW_HPP
3 |
4 | #include "wayfire/geometry.hpp"
5 | #include "wayfire/view.hpp"
6 | #include
7 |
8 | namespace wf
9 | {
10 | /**
11 | * color_rect_view_t represents another common type of compositor view - a
12 | * view which is simply a colored rectangle with a border.
13 | */
14 | class color_rect_view_t : public wf::view_interface_t
15 | {
16 | protected:
17 | wf::color_t _color;
18 | wf::color_t _border_color;
19 | int border;
20 |
21 | wf::geometry_t geometry;
22 | bool _is_mapped;
23 | class color_rect_node_t;
24 |
25 | /**
26 | * Create a colored rect view. The map signal is not fired by default.
27 | * The creator of the colored view should also add it to the desired layer.
28 | */
29 | color_rect_view_t();
30 | friend class wf::tracking_allocator_t;
31 |
32 | public:
33 | /**
34 | * Create and initialize a new color rect view.
35 | * The view will be automatically mapped, and if specified, put on the given output and layer.
36 | */
37 | static std::shared_ptr create(view_role_t role,
38 | wf::output_t *start_output = nullptr, std::optional layer = {});
39 |
40 | /**
41 | * Emit the unmap signal and then drop the internal reference.
42 | */
43 | virtual void close() override;
44 |
45 | /** Set the view color. Color's alpha is not premultiplied */
46 | virtual void set_color(wf::color_t color);
47 | /** Set the view border color. Color's alpha is not premultiplied */
48 | virtual void set_border_color(wf::color_t border);
49 | /** Set the border width. */
50 | virtual void set_border(int width);
51 |
52 | /** Get the view color. Color's alpha is not premultiplied */
53 | wf::color_t get_color()
54 | {
55 | return _color;
56 | }
57 |
58 | /** Get the view border color. Color's alpha is not premultiplied */
59 | wf::color_t get_border_color()
60 | {
61 | return _border_color;
62 | }
63 |
64 | /** Get the border width. */
65 | int get_border()
66 | {
67 | return border;
68 | }
69 |
70 | /** Set the view geometry. */
71 | virtual void set_geometry(wf::geometry_t geometry);
72 | virtual wf::geometry_t get_geometry();
73 |
74 | /* required for view_interface_t */
75 | virtual bool is_mapped() const override;
76 |
77 | virtual wlr_surface *get_keyboard_focus_surface() override;
78 | virtual bool is_focusable() const override;
79 | };
80 | }
81 |
82 | #endif /* end of include guard: COMPOSITOR_VIEW_HPP */
83 |
--------------------------------------------------------------------------------
/src/api/wayfire/config-backend.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | namespace wf
8 | {
9 | /**
10 | * A base class for configuration backend plugins.
11 | *
12 | * A configuration backend plugin is loaded immediately after creating a
13 | * wayland display and initializing the logging infrastructure. Because of
14 | * this, the configuration backend plugins are not allowed to use any
15 | * Wayfire APIs, but can use wf-config.
16 | *
17 | * The job of a configuration backend plugin is to populate and update the
18 | * configuration options used in the rest of the code.
19 | */
20 | class config_backend_t
21 | {
22 | public:
23 | /**
24 | * Initialize the config backend and do the initial loading of config options.
25 | * The config backend must follow the same option types as described in the XML
26 | * files.
27 | *
28 | * @param display The wayland display used by Wayfire.
29 | * @param config A reference to the config manager which needs to be
30 | * populated.
31 | * @param cmd_config_file The configuration file specified on the command line.
32 | */
33 | virtual void init(wl_display *display, config::config_manager_t& config,
34 | const std::string& cmd_config_file) = 0;
35 |
36 | /**
37 | * Find the output section for a given output.
38 | *
39 | * The returned section must be a valid output object as
40 | * described in output.xml
41 | */
42 | virtual std::shared_ptr get_output_section(
43 | wlr_output *output);
44 |
45 | /**
46 | * Find the output section for a given input device.
47 | *
48 | * The returned section must be a valid output object as
49 | * described in input-device.xml
50 | */
51 | virtual std::shared_ptr get_input_device_section(
52 | wlr_input_device *device);
53 |
54 | virtual ~config_backend_t() = default;
55 |
56 | protected:
57 | /** A helper to read the XML directories that Wayfire looks at */
58 | virtual std::vector get_xml_dirs() const;
59 | };
60 | }
61 |
62 | /**
63 | * A macro to declare the necessary functions, given the backend class name.
64 | */
65 | #define DECLARE_WAYFIRE_CONFIG_BACKEND(PluginClass) \
66 | extern "C" \
67 | { \
68 | wf::config_backend_t*newInstance() { return new PluginClass; } \
69 | uint32_t getWayfireVersion() { return WAYFIRE_API_ABI_VERSION; } \
70 | }
71 |
--------------------------------------------------------------------------------
/src/api/wayfire/dassert.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace wf
7 | {
8 | /**
9 | * Print the current stacktrace at runtime.
10 | *
11 | * @param fast_mode If fast_mode is true, the stacktrace will be generated
12 | * using the fastest possible method. However, this means that not all
13 | * information will be printed (for ex., line numbers may be missing).
14 | */
15 | void print_trace(bool fast_mode);
16 |
17 | /**
18 | * Assert that the condition is true.
19 | * Optionally print a message.
20 | * Print backtrace when the assertion fails and exit.
21 | */
22 | inline void dassert(bool condition, std::string message = "")
23 | {
24 | if (!condition)
25 | {
26 | LOGE(message);
27 | print_trace(false);
28 | std::exit(0);
29 | }
30 | }
31 | }
32 |
33 | #define DASSERT(condition) \
34 | wf::dassert(condition, "Assertion failed at " __FILE__ ":" __LINE__)
35 |
--------------------------------------------------------------------------------
/src/api/wayfire/idle.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace wf
4 | {
5 | /**
6 | * Dummy non-copyable type that increments the global inhibitor count when created,
7 | * and decrements when destroyed. These changes influence wlroots idle enablement.
8 | */
9 | class idle_inhibitor_t
10 | {
11 | public:
12 | idle_inhibitor_t();
13 | ~idle_inhibitor_t();
14 |
15 | idle_inhibitor_t(const idle_inhibitor_t &) = delete;
16 | idle_inhibitor_t(idle_inhibitor_t &&) = delete;
17 | idle_inhibitor_t& operator =(const idle_inhibitor_t&) = delete;
18 | idle_inhibitor_t& operator =(idle_inhibitor_t&&) = delete;
19 |
20 | private:
21 | static unsigned int inhibitors;
22 | void notify_update();
23 | };
24 | }
25 |
--------------------------------------------------------------------------------
/src/api/wayfire/img.hpp:
--------------------------------------------------------------------------------
1 | #ifndef IMG_HPP_
2 | #define IMG_HPP_
3 |
4 | #include
5 | #include
6 |
7 | namespace image_io
8 | {
9 | /* Load the image from the given file, binding it to the given GL texture target
10 | * Bind the texture before you call this function
11 | * Guaranteed: doesn't change any GL state except pixel packing */
12 | bool load_from_file(std::string name, GLuint target);
13 |
14 | /* Function that saves the given pixels(in rgba format) to a (currently) png file */
15 | void write_to_file(std::string name, uint8_t *pixels, int w, int h,
16 | std::string type, bool invert = false);
17 |
18 | void write_to_file(std::string name, wf::framebuffer_t buffer);
19 |
20 | /* Initializes all backends, called at startup */
21 | void init();
22 | }
23 |
24 | #endif /* end of include guard: IMG_HPP_ */
25 |
--------------------------------------------------------------------------------
/src/api/wayfire/input-device.hpp:
--------------------------------------------------------------------------------
1 | #ifndef WF_INPUT_DEVICE_HPP
2 | #define WF_INPUT_DEVICE_HPP
3 |
4 | #include
5 |
6 | namespace wf
7 | {
8 | class input_device_t
9 | {
10 | public:
11 | /**
12 | * General comment
13 | * @return The represented wlr_input_device
14 | */
15 | wlr_input_device *get_wlr_handle();
16 |
17 | /**
18 | * @param enabled Whether the compositor should handle input events from
19 | * the device
20 | * @return true if the device state was successfully changed
21 | */
22 | bool set_enabled(bool enabled = true);
23 |
24 | /**
25 | * @return true if the compositor should receive events from the device
26 | */
27 | bool is_enabled();
28 | virtual ~input_device_t() = default;
29 |
30 | protected:
31 | wlr_input_device *handle;
32 | input_device_t(wlr_input_device *handle);
33 | };
34 | }
35 |
36 | #endif /* end of include guard: WF_INPUT_DEVICE_HPP */
37 |
--------------------------------------------------------------------------------
/src/api/wayfire/matcher.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace wf
7 | {
8 | /**
9 | * view_matcher_t provides a way to match certain views based on conditions.
10 | * The conditions are represented as string options.
11 | *
12 | * For information about the syntax or the possible conditions, see
13 | * wf::view_condition_interface_t and wf::condition_parser_t.
14 | */
15 | class view_matcher_t
16 | {
17 | public:
18 | /**
19 | * Create a new matcher from the given option.
20 | *
21 | * Whenever the option value changes, the condition will be updated.
22 | *
23 | * @param option The option where the condition is encoded.
24 | */
25 | view_matcher_t(std::shared_ptr> option);
26 |
27 | /**
28 | * Create a new matcher from the given option name.
29 | * The option will be loaded from core.
30 | *
31 | * @throws a std::runtime_error if the option is not found, or if the option
32 | * is not a string.
33 | */
34 | view_matcher_t(const std::string& option_name);
35 |
36 | view_matcher_t(const view_matcher_t &) = delete;
37 | view_matcher_t(view_matcher_t &&) = default;
38 | view_matcher_t& operator =(const view_matcher_t&) = delete;
39 | view_matcher_t& operator =(view_matcher_t&&) = default;
40 |
41 | /**
42 | * Set the condition option after initialization.
43 | */
44 | void set_from_option(std::shared_ptr> option);
45 |
46 | /**
47 | * @return True if the view matches the condition specified, false otherwise.
48 | */
49 | bool matches(wayfire_view view);
50 |
51 | /** Destructor */
52 | ~view_matcher_t();
53 |
54 | private:
55 | view_matcher_t();
56 |
57 | class impl;
58 | std::unique_ptr priv;
59 | };
60 | }
61 |
--------------------------------------------------------------------------------
/src/api/wayfire/nonstd/reverse.hpp:
--------------------------------------------------------------------------------
1 | #ifndef WF_REVERSE_HPP
2 | #define WF_REVERSE_HPP
3 |
4 | #include
5 |
6 | /* from https://stackoverflow.com/questions/8542591/c11-reverse-range-based-for-loop
7 | * */
8 | namespace wf
9 | {
10 | template
11 | struct reversion_wrapper
12 | {
13 | T& iterable;
14 | };
15 |
16 | template
17 | auto begin(reversion_wrapper w)
18 | {
19 | return std::rbegin(w.iterable);
20 | }
21 |
22 | template
23 | auto end(reversion_wrapper w)
24 | {
25 | return std::rend(w.iterable);
26 | }
27 |
28 | template
29 | reversion_wrapper reverse(T&& iterable)
30 | {
31 | return {iterable};
32 | }
33 | }
34 |
35 | #endif /* end of include guard: WF_REVERSE_HPP */
36 |
--------------------------------------------------------------------------------
/src/api/wayfire/nonstd/tracking-allocator.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | namespace wf
9 | {
10 | /**
11 | * The destruct signal is emitted directly before an object is freed.
12 | * Emitted on objects managed with the tracking allocator which support signals.
13 | */
14 | template
15 | struct destruct_signal
16 | {
17 | T *object;
18 | };
19 |
20 | /**
21 | * The tracking allocator is a factory singleton for allocating objects of a certain type.
22 | * The objects are allocated via shared pointers, and the tracking allocator keeps a list of all allocated
23 | * objects, accessible by plugins.
24 | */
25 | template
26 | class tracking_allocator_t
27 | {
28 | public:
29 | /**
30 | * Get the single global instance of the tracking allocator.
31 | */
32 | static tracking_allocator_t& get()
33 | {
34 | static tracking_allocator_t allocator;
35 | return allocator;
36 | }
37 |
38 | template
39 | std::shared_ptr allocate(Args... args)
40 | {
41 | static_assert(std::is_base_of_v);
42 | auto ptr = std::shared_ptr(
43 | new ConcreteObjectType(std::forward(args)...),
44 | std::bind(&tracking_allocator_t::deallocate_object, this, std::placeholders::_1));
45 |
46 | allocated_objects.push_back(ptr.get());
47 | return ptr;
48 | }
49 |
50 | const std::vector>& get_all()
51 | {
52 | return allocated_objects;
53 | }
54 |
55 | private:
56 | std::vector> allocated_objects;
57 | void deallocate_object(ObjectType *obj)
58 | {
59 | if constexpr (std::is_base_of_v)
60 | {
61 | destruct_signal event;
62 | event.object = obj;
63 | obj->emit(&event);
64 | }
65 |
66 | auto it = std::find(allocated_objects.begin(), allocated_objects.end(),
67 | nonstd::observer_ptr{obj});
68 | wf::dassert(it != allocated_objects.end(), "Object is not allocated?");
69 | allocated_objects.erase(it);
70 | delete obj;
71 | }
72 | };
73 | }
74 |
--------------------------------------------------------------------------------
/src/api/wayfire/nonstd/wlroots.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifndef WLR_USE_UNSTABLE
4 | #define WLR_USE_UNSTABLE
5 | #endif
6 |
7 | /**
8 | * This file is used to put all wlroots headers needed in the Wayfire API
9 | * in an extern "C" block because wlroots headers are not always compatible
10 | * with C++.
11 | */
12 | extern "C"
13 | {
14 | struct wlr_backend;
15 | struct wlr_renderer;
16 | struct wlr_seat;
17 | struct wlr_cursor;
18 | struct wlr_data_device_manager;
19 | struct wlr_data_control_manager_v1;
20 | struct wlr_gamma_control_manager_v1;
21 | struct wlr_xdg_output_manager_v1;
22 | struct wlr_export_dmabuf_manager_v1;
23 | struct wlr_server_decoration_manager;
24 | struct wlr_input_inhibit_manager;
25 | struct wlr_idle_inhibit_manager_v1;
26 | struct wlr_xdg_decoration_manager_v1;
27 | struct wlr_virtual_keyboard_manager_v1;
28 | struct wlr_virtual_pointer_manager_v1;
29 | struct wlr_idle_notifier_v1;
30 | struct wlr_screencopy_manager_v1;
31 | struct wlr_foreign_toplevel_manager_v1;
32 | struct wlr_pointer_gestures_v1;
33 | struct wlr_relative_pointer_manager_v1;
34 | struct wlr_pointer_constraints_v1;
35 | struct wlr_tablet_manager_v2;
36 | struct wlr_input_method_manager_v2;
37 | struct wlr_text_input_manager_v3;
38 | struct wlr_presentation;
39 | struct wlr_primary_selection_v1_device_manager;
40 | struct wlr_drm_lease_v1_manager;
41 | struct wlr_session_lock_manager_v1;
42 |
43 | struct wlr_xdg_foreign_v1;
44 | struct wlr_xdg_foreign_v2;
45 | struct wlr_xdg_foreign_registry;
46 |
47 | struct wlr_pointer_axis_event;
48 | struct wlr_pointer_motion_event;
49 | struct wlr_output_layout;
50 | struct wlr_surface;
51 | struct wlr_texture;
52 | struct wlr_viewporter;
53 |
54 | #include
55 | #include
56 | #include
57 | #include
58 | #define static
59 | #include
60 | #undef static
61 | #include
62 | #include
63 | #include
64 | #include
65 |
66 | static constexpr uint32_t WLR_KEY_PRESSED = WL_KEYBOARD_KEY_STATE_PRESSED;
67 | static constexpr uint32_t WLR_KEY_RELEASED = WL_KEYBOARD_KEY_STATE_RELEASED;
68 |
69 | struct mwlr_keyboard_modifiers_event
70 | {
71 | uint32_t time_msec;
72 | };
73 | }
74 |
--------------------------------------------------------------------------------
/src/api/wayfire/option-wrapper.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | namespace wf
8 | {
9 | namespace detail
10 | {
11 | // Forward declaration to avoid adding unnecessary includes.
12 | [[noreturn]]
13 | void option_wrapper_debug_message(const std::string& option_name, const std::runtime_error& err);
14 | [[noreturn]]
15 | void option_wrapper_debug_message(const std::string& option_name, const std::logic_error& err);
16 | }
17 |
18 | /**
19 | * A simple wrapper around a config option.
20 | */
21 | template
22 | class option_wrapper_t : public base_option_wrapper_t
23 | {
24 | public:
25 | /**
26 | * Initialize the option wrapper and directly load the given option.
27 | */
28 | option_wrapper_t(const std::string& option_name) :
29 | wf::base_option_wrapper_t()
30 | {
31 | this->load_option(option_name);
32 | }
33 |
34 | void load_option(const std::string& option_name)
35 | {
36 | try {
37 | base_option_wrapper_t::load_option(option_name);
38 | } catch (const std::runtime_error& err)
39 | {
40 | detail::option_wrapper_debug_message(option_name, err);
41 | } catch (const std::logic_error& err)
42 | {
43 | detail::option_wrapper_debug_message(option_name, err);
44 | }
45 | }
46 |
47 | option_wrapper_t() : wf::base_option_wrapper_t()
48 | {}
49 |
50 | protected:
51 | std::shared_ptr load_raw_option(const std::string& name)
52 | {
53 | return wf::get_core().config.get_option(name);
54 | }
55 | };
56 | }
57 |
--------------------------------------------------------------------------------
/src/api/wayfire/region.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "wayfire/geometry.hpp"
5 |
6 | /* ---------------------- pixman utility functions -------------------------- */
7 | namespace wf
8 | {
9 | struct region_t
10 | {
11 | region_t();
12 | /* Makes a copy of the given region */
13 | region_t(pixman_region32_t *damage);
14 | region_t(const wlr_box& box);
15 | ~region_t();
16 |
17 | region_t(const region_t& other);
18 | region_t(region_t&& other);
19 |
20 | region_t& operator =(const region_t& other);
21 | region_t& operator =(region_t&& other);
22 |
23 | bool empty() const;
24 | void clear();
25 |
26 | void expand_edges(int amount);
27 | pixman_box32_t get_extents() const;
28 | bool contains_point(const point_t& point) const;
29 | bool contains_pointf(const pointf_t& point) const;
30 |
31 | /* Translate the region */
32 | region_t operator +(const point_t& vector) const;
33 | region_t& operator +=(const point_t& vector);
34 |
35 | region_t operator -(const point_t& vector) const;
36 | region_t& operator -=(const point_t& vector);
37 |
38 | region_t operator *(float scale) const;
39 | region_t& operator *=(float scale);
40 |
41 | /* Region intersection */
42 | region_t operator &(const wlr_box& box) const;
43 | region_t operator &(const region_t& other) const;
44 | region_t& operator &=(const wlr_box& box);
45 | region_t& operator &=(const region_t& other);
46 |
47 | /* Region union */
48 | region_t operator |(const wlr_box& other) const;
49 | region_t operator |(const region_t& other) const;
50 | region_t& operator |=(const wlr_box& other);
51 | region_t& operator |=(const region_t& other);
52 |
53 | /* Subtract the box/region from the current region */
54 | region_t operator ^(const wlr_box& box) const;
55 | region_t operator ^(const region_t& other) const;
56 | region_t& operator ^=(const wlr_box& box);
57 | region_t& operator ^=(const region_t& other);
58 |
59 | pixman_region32_t *to_pixman();
60 |
61 | const pixman_box32_t *begin() const;
62 | const pixman_box32_t *end() const;
63 |
64 | private:
65 | pixman_region32_t _region;
66 | /* Returns a const-casted pixman_region32_t*, useful in const operators
67 | * where we use this->_region as only source for calculations, but pixman
68 | * won't let us pass a const pixman_region32_t* */
69 | pixman_region32_t *unconst() const;
70 | };
71 | }
72 |
73 | wlr_box wlr_box_from_pixman_box(const pixman_box32_t& box);
74 | pixman_box32_t pixman_box_from_wlr_box(const wlr_box& box);
75 |
--------------------------------------------------------------------------------
/src/api/wayfire/scene-operations.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "wayfire/scene-input.hpp"
4 | #include
5 | #include
6 |
7 | // This header contains implementations of simple scenegraph related functionality
8 | // used in many places throughout the codebase.
9 |
10 | namespace wf
11 | {
12 | namespace scene
13 | {
14 | /**
15 | * Remove a child node from a parent node and update the parent.
16 | */
17 | inline void remove_child(node_ptr child, uint32_t add_flags = 0)
18 | {
19 | if (!child->parent())
20 | {
21 | return;
22 | }
23 |
24 | auto parent = dynamic_cast(child->parent());
25 | wf::dassert(parent, "Removing a child from a non-floating container!");
26 |
27 | auto children = parent->get_children();
28 | children.erase(std::remove(children.begin(), children.end(), child),
29 | children.end());
30 | parent->set_children_list(children);
31 | update(parent->shared_from_this(), update_flag::CHILDREN_LIST | add_flags);
32 | }
33 |
34 | inline void add_front(floating_inner_ptr parent, node_ptr child)
35 | {
36 | auto children = parent->get_children();
37 | children.insert(children.begin(), child);
38 | parent->set_children_list(children);
39 | update(parent, update_flag::CHILDREN_LIST);
40 | }
41 |
42 | inline void readd_front(floating_inner_ptr parent, node_ptr child)
43 | {
44 | remove_child(child);
45 | add_front(parent, child);
46 | }
47 |
48 | inline void add_back(floating_inner_ptr parent, node_ptr child)
49 | {
50 | auto children = parent->get_children();
51 | children.push_back(child);
52 | parent->set_children_list(children);
53 | update(parent, update_flag::CHILDREN_LIST);
54 | }
55 |
56 | inline void readd_back(floating_inner_ptr parent, node_ptr child)
57 | {
58 | remove_child(child);
59 | add_back(parent, child);
60 | }
61 |
62 | inline bool raise_to_front(node_ptr child)
63 | {
64 | auto dyn_parent = dynamic_cast(child->parent());
65 | wf::dassert(dyn_parent, "Raise to front in a non-floating container!");
66 |
67 | auto children = dyn_parent->get_children();
68 | if (children.front() == child)
69 | {
70 | return false;
71 | }
72 |
73 | children.erase(std::remove(children.begin(), children.end(), child),
74 | children.end());
75 | children.insert(children.begin(), child);
76 | dyn_parent->set_children_list(children);
77 | update(dyn_parent->shared_from_this(), update_flag::CHILDREN_LIST);
78 | return true;
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/api/wayfire/txn/transaction-manager.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "wayfire/signal-provider.hpp"
4 | #include "wayfire/txn/transaction-object.hpp"
5 | #include
6 |
7 | namespace wf
8 | {
9 | namespace txn
10 | {
11 | /*
12 | * The transaction manager keeps track of all committed and pending transactions and ensures that there is at
13 | * most one committed transaction for a given object.
14 | *
15 | * In order to do ensure correct ordering of transactions, it keeps a list of pending transactions. The first
16 | * transaction is committed as soon as there are no committed transactions with the same objects. In addition,
17 | * any new transactions which are not immediately committed but work with the same objects are coalesced
18 | * together. For example, if there are two transactions, one for objects A, for objects B,C and a third
19 | * transaction for objects A,B comes in, then all these three are merged together. This merging is done to
20 | * avoid sending excessive configure events to clients - for example during an interactive resize.
21 | */
22 | class transaction_manager_t : public signal::provider_t
23 | {
24 | public:
25 | transaction_manager_t();
26 | ~transaction_manager_t();
27 |
28 | /**
29 | * Add a new transaction to the list of scheduled transactions. The transaction might be merged with
30 | * other transactions which came before or after it, according to the coalescing schema described above.
31 | *
32 | * Note that a transaction will never be started immediately. Instead, it will be started on the next idle
33 | * event of the event loop.
34 | */
35 | void schedule_transaction(transaction_uptr tx);
36 |
37 | /**
38 | * A convenience function to create a transaction for a single object and schedule it via
39 | * schedule_transaction().
40 | */
41 | void schedule_object(transaction_object_sptr object);
42 |
43 | /**
44 | * Check whether there is a pending transaction for the given object.
45 | */
46 | bool is_object_pending(transaction_object_sptr object) const;
47 |
48 | /**
49 | * Check whether there is a committed transaction for the given object.
50 | */
51 | bool is_object_committed(transaction_object_sptr object) const;
52 |
53 | struct impl;
54 | std::unique_ptr priv;
55 | };
56 |
57 | /**
58 | * The new-transaction signal is emitted before a new transaction is added to the transaction manager (e.g.
59 | * at the beginning of schedule_transaction()). The transaction may be merged into another transaction before
60 | * it is actually executed.
61 | */
62 | struct new_transaction_signal
63 | {
64 | transaction_t *tx;
65 | };
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/api/wayfire/txn/transaction-object.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace wf
6 | {
7 | namespace txn
8 | {
9 | /**
10 | * A transaction object participates in the transactions system.
11 | *
12 | * Transaction objects usually have double-buffered state, which may not be applicable immediately, that is,
13 | * when a state change is requested, it takes some time until the changes can be applied. Sometimes, multiple
14 | * such objects are updated together in a single transaction, in which case the changes are to be seen as
15 | * atomic across all participating objects.
16 | *
17 | * The typical example of transaction objects are toplevels, where changing for example the size of the
18 | * toplevel requires cooperation from the client, and therefore cannot be done instantaneously.
19 | *
20 | * When speaking about transaction objects, they usually have three different types of state: current,
21 | * committed and pending. Current state is what the object currently is configured as, committed state is a
22 | * state which will soon be current (e.g. changes are underway), and pending are changes which have been
23 | * planned for the future, but execution has not started yet.
24 | */
25 | class transaction_object_t : public signal::provider_t
26 | {
27 | public:
28 | /**
29 | * Get a string representing the transaction object. Used for debugging purposes.
30 | */
31 | virtual std::string stringify() const;
32 |
33 | /**
34 | * Make the pending state committed.
35 | * This function is called when a transaction is committed.
36 | */
37 | virtual void commit() = 0;
38 |
39 | /**
40 | * Make the committed state current.
41 | * This function is called when all transaction objects in a transaction are ready to apply the committed
42 | * state.
43 | */
44 | virtual void apply() = 0;
45 |
46 | virtual ~transaction_object_t() = default;
47 | };
48 |
49 | using transaction_object_sptr = std::shared_ptr;
50 |
51 | /**
52 | * A signal emitted on a transaction_object_t to indicate that it is ready to be applied.
53 | */
54 | struct object_ready_signal
55 | {
56 | transaction_object_t *self;
57 | };
58 |
59 | /**
60 | * Emit the object-ready signal on the given object.
61 | */
62 | inline void emit_object_ready(wf::txn::transaction_object_t *obj)
63 | {
64 | wf::txn::object_ready_signal data_ready;
65 | data_ready.self = obj;
66 | obj->emit(&data_ready);
67 | return;
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/api/wayfire/txn/transaction.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "wayfire/signal-provider.hpp"
4 | #include "wayfire/util.hpp"
5 | #include
6 |
7 | namespace wf
8 | {
9 | namespace txn
10 | {
11 | /**
12 | * A transaction contains one or more transaction objects whose state should be applied atomically, that is,
13 | * changes to the objects should be applied only after all the objects are ready to apply the changes.
14 | */
15 | class transaction_t : public signal::provider_t
16 | {
17 | public:
18 | using timer_setter_t = std::function::callback_t)>;
19 |
20 | /**
21 | * Create a new transaction.
22 | *
23 | * @param timeout The timeout for the transaction in milliseconds after it is committed.
24 | * -1 means that core should pick a default timeout.
25 | */
26 | static std::unique_ptr create(int64_t timeout = -1);
27 |
28 | /**
29 | * Create a new empty transaction.
30 | *
31 | * @param timer A function used to set timeout callbacks at runtime.
32 | * @param timeout The maximal duration, in milliseconds, to wait for transaction objects to become ready.
33 | * When the timeout is reached, all committed state is applied.
34 | */
35 | transaction_t(uint64_t timeout, timer_setter_t timer_setter);
36 |
37 | /**
38 | * Add a new object to the transaction. If the object was already part of it, this is no-op.
39 | */
40 | void add_object(transaction_object_sptr object);
41 |
42 | /**
43 | * Get a list of all the objects currently part of the transaction.
44 | */
45 | const std::vector& get_objects() const;
46 |
47 | /**
48 | * Commit the transaction, that is, commit the pending state of all participating objects.
49 | * As soon as all objects are ready or the transaction times out, the state will be applied.
50 | */
51 | void commit();
52 |
53 | virtual ~transaction_t() = default;
54 |
55 | private:
56 | std::vector objects;
57 | int count_ready_objects = 0;
58 | uint64_t timeout;
59 | timer_setter_t timer_setter;
60 |
61 | void apply(bool did_timeout);
62 | wf::signal::connection_t on_object_ready;
63 | };
64 |
65 | using transaction_uptr = std::unique_ptr;
66 |
67 | /**
68 | * A signal emitted on a transaction as soon as it has been applied.
69 | */
70 | struct transaction_applied_signal
71 | {
72 | transaction_t *self;
73 |
74 | // Set to true if the transaction timed out and the desired object state may not have been achieved.
75 | bool timed_out;
76 | };
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/api/wayfire/unstable/translation-node.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace wf
7 | {
8 | namespace scene
9 | {
10 | /**
11 | * A node which simply applies an offset to its children.
12 | */
13 | class translation_node_t : public wf::scene::floating_inner_node_t
14 | {
15 | public:
16 | translation_node_t(bool is_structure = false);
17 |
18 | /**
19 | * Set the offset the node applies to its children.
20 | * Note that damage is not automatically applied.
21 | */
22 | void set_offset(wf::point_t offset);
23 |
24 | /**
25 | * Get the current offset (set via @set_offset). Default offset is {0, 0}.
26 | */
27 | wf::point_t get_offset() const;
28 |
29 | public: // Implementation of node_t interface
30 | wf::pointf_t to_local(const wf::pointf_t& point) override;
31 | wf::pointf_t to_global(const wf::pointf_t& point) override;
32 |
33 | std::string stringify() const override;
34 | void gen_render_instances(std::vector& instances,
35 | scene::damage_callback damage, wf::output_t *output) override;
36 | wf::geometry_t get_bounding_box() override;
37 | uint32_t optimize_update(uint32_t flags) override;
38 |
39 | protected:
40 | wf::point_t offset = {0, 0};
41 | };
42 |
43 | class translation_node_instance_t : public render_instance_t
44 | {
45 | protected:
46 | std::vector children;
47 | damage_callback push_damage;
48 | std::shared_ptr self;
49 | wf::signal::connection_t on_node_damage;
50 | wf::signal::connection_t on_regen_instances;
51 | wf::output_t *shown_on;
52 | void regen_instances();
53 |
54 | public:
55 | translation_node_instance_t(translation_node_t *self,
56 | damage_callback push_damage, wf::output_t *shown_on);
57 |
58 | // Implementation of render_instance_t
59 | void schedule_instructions(std::vector& instructions,
60 | const wf::render_target_t& target, wf::region_t& damage) override;
61 | void render(const wf::render_target_t& target, const wf::region_t& region) override;
62 | void presentation_feedback(wf::output_t *output) override;
63 | wf::scene::direct_scanout try_scanout(wf::output_t *output) override;
64 | void compute_visibility(wf::output_t *output, wf::region_t& visible) override;
65 | };
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/api/wayfire/unstable/wlr-subsurface-controller.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "wayfire/util.hpp"
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | namespace wf
10 | {
11 | /**
12 | * A subsurface root node. It applies a translation to its children equal to the offset of the subsurface.
13 | */
14 | class wlr_subsurface_root_node_t : public wf::scene::translation_node_t
15 | {
16 | public:
17 | wlr_subsurface_root_node_t(wlr_subsurface *subsurface);
18 | std::string stringify() const override;
19 | bool update_offset(bool damage = true);
20 |
21 | private:
22 | wlr_subsurface *subsurface;
23 | wf::wl_listener_wrapper on_subsurface_destroy;
24 | wf::wl_listener_wrapper on_subsurface_commit;
25 | };
26 |
27 | /**
28 | * A class which manages a wlr_subsurface. Its lifetime is tied to the wlr_subsurface object.
29 | *
30 | * This class is responsible for managing the subsurface's state and enabling/disabling it when the subsurface
31 | * is mapped and unmapped. In addition, it should clean up the scenegraph when the subsurface is destroyed.
32 | */
33 | class wlr_subsurface_controller_t
34 | {
35 | public:
36 | wlr_subsurface_controller_t(wlr_subsurface *sub);
37 | std::shared_ptr get_subsurface_root();
38 |
39 | private:
40 | wlr_subsurface *sub;
41 | wl_listener_wrapper on_map, on_unmap, on_destroy;
42 | std::shared_ptr subsurface_root_node;
43 | };
44 | }
45 |
--------------------------------------------------------------------------------
/src/api/wayfire/unstable/wlr-surface-controller.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "wayfire/scene.hpp"
4 | #include
5 |
6 | namespace wf
7 | {
8 | struct node_recheck_constraints_signal
9 | {};
10 |
11 | /**
12 | * A class for managing a wlr_surface.
13 | * It is responsible for adding subsurfaces to it.
14 | */
15 | class wlr_surface_controller_t
16 | {
17 | public:
18 | static void create_controller(wlr_surface *surface, scene::floating_inner_ptr root_node);
19 | static void try_free_controller(wlr_surface *surface);
20 |
21 | private:
22 | wlr_surface_controller_t(wlr_surface *surface, scene::floating_inner_ptr root_node);
23 | ~wlr_surface_controller_t();
24 |
25 | void update_subsurface_order_and_position();
26 |
27 | scene::floating_inner_ptr root;
28 | wlr_surface *surface;
29 |
30 | wf::wl_listener_wrapper on_destroy;
31 | wf::wl_listener_wrapper on_new_subsurface;
32 | wf::wl_listener_wrapper on_commit;
33 | };
34 | }
35 |
--------------------------------------------------------------------------------
/src/api/wayfire/unstable/wlr-text-input-v3-popup.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | namespace wf
9 | {
10 | class text_input_v3_im_relay_interface_t : public wf::signal::provider_t
11 | {
12 | public:
13 | virtual wlr_text_input_v3 *find_focused_text_input_v3() = 0;
14 | virtual ~text_input_v3_im_relay_interface_t() = default;
15 | };
16 |
17 | /**
18 | * A view implementation which presents an input-method popup-like surface relative to a text-input-v3 cursor.
19 | */
20 | class text_input_v3_popup : public wf::view_interface_t
21 | {
22 | public:
23 | text_input_v3_im_relay_interface_t *relay = nullptr;
24 | wlr_surface *surface = nullptr;
25 |
26 | text_input_v3_popup(text_input_v3_im_relay_interface_t *relay, wlr_surface *surface);
27 | static std::shared_ptr create(text_input_v3_im_relay_interface_t*, wlr_surface*);
28 |
29 | bool is_mapped() const override;
30 | std::string get_app_id() override;
31 | std::string get_title() override;
32 | wf::geometry_t get_geometry();
33 | void map();
34 | void unmap();
35 | void update_geometry();
36 | void update_cursor_rect(wlr_box*);
37 | ~text_input_v3_popup();
38 |
39 | private:
40 | wf::geometry_t geometry{0, 0, 0, 0};
41 | wlr_box old_cursor_rect{0, 0, 0, 0};
42 | wf::dimensions_t last_size{0, 0};
43 | std::shared_ptr main_surface;
44 | std::shared_ptr surface_root_node;
45 |
46 | virtual wlr_surface *get_keyboard_focus_surface() override
47 | {
48 | return nullptr;
49 | }
50 |
51 | wf::signal::connection_t on_text_input_commit = [=] (auto s)
52 | {
53 | update_cursor_rect(&s->cursor_rect);
54 | };
55 |
56 | wf::wl_listener_wrapper on_map;
57 | wf::wl_listener_wrapper on_unmap;
58 | wf::wl_listener_wrapper on_commit;
59 | wf::wl_listener_wrapper on_surface_destroy;
60 |
61 | public:
62 | // This is only a convenience wrapper for the users of this class.
63 | wf::wl_listener_wrapper on_destroy;
64 | };
65 | }
66 |
--------------------------------------------------------------------------------
/src/api/wayfire/unstable/wlr-view-events.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // WF_USE_CONFIG_H is set only when building Wayfire itself, external plugins
4 | // need to use
5 | #ifdef WF_USE_CONFIG_H
6 | #include