├── LICENSE.txt ├── Makefile.in ├── README.md ├── configure ├── include ├── pointer-constraints-unstable-v1-protocol.h ├── wlr-layer-shell-unstable-v1-protocol.h ├── wlr_foreign_toplevel_management_v1.h └── xdg-shell-protocol.h └── src ├── create-config.c ├── getvaluefromconf.c ├── getvaluefromconf.h ├── getxkbkeyname.c ├── getxkbkeyname.h ├── runcmd.c ├── runcmd.h └── woodland.c /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /Makefile.in: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-or-later 2 | CC = gcc 3 | CFLAGS = -Wall -flto -Wextra -Wpedantic -march=native -funroll-loops -export-dynamic -fomit-frame-pointer 4 | LDFLAGS = -lm 5 | LDFLAGS += $(shell pkg-config --libs stb libdrm glesv2 wlroots libinput pixman-1 xkbcommon wayland-server) 6 | CFLAGS += $(shell pkg-config --cflags stb libdrm glesv2 wlroots libinput pixman-1 xkbcommon wayland-server) 7 | CFLAGS += -Isrc/ 8 | CFLAGS += -DWLR_USE_UNSTABLE 9 | SRCFILES = src/getxkbkeyname.c src/getvaluefromconf.c src/runcmd.c src/woodland.c 10 | OBJFILES = $(patsubst src/%.c, %.o, $(SRCFILES)) 11 | TARGET = woodland 12 | PREFIX = /usr/local 13 | BINDIR = $(PREFIX)/bin 14 | 15 | all: $(TARGET) 16 | 17 | $(TARGET): $(OBJFILES) 18 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 19 | @echo "\nSuccessfully built $(TARGET)!\nType 'make run' to test or 'sudo make install' to install." 20 | 21 | %.o: src/%.c 22 | $(CC) $(CFLAGS) -c $< -o $@ 23 | 24 | .PHONY: run 25 | 26 | run: $(TARGET) 27 | @echo 28 | @echo "_________________________________________________________________________________________________________" 29 | @echo 30 | @echo "'"$(TARGET)"'" output is: 31 | @echo "_________________________________________________________________________________________________________" 32 | @echo 33 | sleep 1 34 | @./$(TARGET) 35 | 36 | install: $(TARGET) 37 | install -d $(DESTDIR)$(BINDIR) 38 | install -m 755 $(TARGET) $(DESTDIR)$(BINDIR) 39 | 40 | clean: 41 | rm -f $(OBJFILES) $(TARGET) 42 | 43 | uninstall: 44 | rm -f $(DESTDIR)$(BINDIR)/$(TARGET) 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-or-later 2 | 3 | # Woodland 4 | 5 | Woodland is a minimal lightweight wlroots-based window-stacking compositor for Wayland, inspired 6 | by Wayfire and TinyWl. For a minimal desktop environment experience you can use it together with: 7 | 8 | Panel: 9 | [diowpanel](https://github.com/DiogenesN/diowpanel)\ 10 | Menu: 11 | [diowmenu](https://github.com/DiogenesN/diowmenu)\ 12 | Window list: 13 | [diowwindowlist](https://github.com/DiogenesN/diowwindowlist)\ 14 | Application launcher: 15 | [diowapplauncher](https://github.com/DiogenesN/diowapplauncher)\ 16 | Welcome Screen: 17 | [welcomescreen](https://github.com/DiogenesN/welcomescreen). 18 | 19 | Woodland has no reliance on any particular Desktop Environment, Desktop Shell or session. 20 | Also it does not depend on any UI toolkits such as Qt or GTK. 21 | 22 | The main goal of Woodland is to provide basic functionality, ease of use and keeping things simple. 23 | It was tested on Debian 12. 24 | 25 | # Special thanks to all the developers, maintainers and contributors of the following projects: 26 | 27 | dwl\ 28 | sway\ 29 | labwc\ 30 | tinywl\ 31 | waybox\ 32 | wayfire\ 33 | wlroots\ 34 | vivarium\ 35 | 36 | # and also to all open-source enthusiasts in general. 37 | 38 | # Features 39 | 40 | 1. Screen zooming. 41 | 2. Idle timeout. 42 | 3. Set background image (without relying on third-party utilities). 43 | 4. Multiple keyboard layouts. 44 | 5. Per application keyboard layout. 45 | 6. Keyboard shortcuts. 46 | 7. Multimedia keys support. 47 | 8. User-defined window placement. 48 | 9. Autostart applications. 49 | 50 | # TODO: 51 | 52 | Idle inhibitor, damage tracking, maximizing, decorations. 53 | 54 | # Installation 55 | 56 | 1. To build the project you need to install the following libs: 57 | 58 | make 59 | pkgconf 60 | libstb-dev 61 | libdrm-dev 62 | libgles-dev 63 | libinput-dev 64 | libwayland-dev 65 | libwlroots-dev 66 | libpixman-1-dev 67 | libxkbcommon-dev 68 | 69 | 2. Open a terminal and run: 70 | 71 | chmod +x ./configure 72 | ./configure 73 | 74 | 3. if all went well then run: 75 | 76 | make 77 | sudo make install 78 | 79 | (if you just want to test it then run: make run) 80 | ## Tips 81 | 82 | If wlroots complains about missing header files then copy the header files from 'include' directory to '/usr/include/wlr/types/' 83 | 84 | # Usage 85 | 86 | You have many options how to launch woodland (or pretty much any application). 87 | The simplest one is to just run woodland from a TTY or login manager. 88 | If you want to autostart woodland without any login manager then these are the steps: 89 | 90 | 1. Create this file: 91 | 92 | sudo nano /etc/profile.d/woodland.sh 93 | 94 | 2. The content of woodland.sh: 95 | 96 | if [ -z $WAYLAMD_DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then 97 | exec woodland > /dev/null 2>&1 98 | fi 99 | 100 | 3. Make it executable: 101 | 102 | sudo chmod +x /etc/profile.d/woodland.sh 103 | 104 | 4. Modify 'getty@tty1.service' for autologin. (Disclaimer: Be cautious!!! This might be a security risk so do at your own risk.) 105 | 106 | sudo nano /etc/systemd/system/getty.target.wants/getty@tty1.service 107 | 108 | 5. Find the line that starts with 'ExecStart', comment it out and add this one instead: 109 | 110 | ExecStart=-/sbin/agetty --skip-login --nonewline --noissue --autologin YOURUSERNAME --noclear - $TERM 111 | 112 | # First intallation start 113 | 114 | You can launch woodland with arguments: woodland -s xfce4-terminal 115 | or you can launch it without any arguments. 116 | If you launch it without arguments for the first time then it will automatically look for the following terminals on the system: 117 | 118 | foot 119 | kitty 120 | alacrity 121 | xfce4-terminal 122 | gnome-terminal 123 | 124 | If it finds any of those installed, it will automatically launch the first one found. 125 | To disable this behavior you will need to set up at least one startup command in woodland.ini. 126 | 127 | # Configuration 128 | Woodland creates the following configuration file: 129 | 130 | ~/.config/woodland/woodland.ini 131 | 132 | it is very straightforward and self-explanatory but we will go through each section 133 | 134 | 1. Welcome screen 135 | 136 | [ Welcome screen ]\ 137 | If you have any weclome screen application then it goes here, 138 | for instance you can use my welcome screen application like this:\ 139 | welcome_screen = welcomescreen --resolution 1920x1080 140 | 141 | 3. Idle 142 | 143 | [ Idle ] 144 | The timeout in milliseconds until the system is considered idle. 145 | One minute is 60000 milliseconds. 146 | idle_timeout = 0 disables the timeout. 147 | d_power_path, the path to the file that controls the brightness level. 148 | idle_timeout = 180000 149 | d_power_path = /sys/class/backlight/intel_backlight/brightness 150 | 151 | 3. Background image 152 | 153 | [ Background ] 154 | Provide the full path to the image. 155 | background = /home/username/image.png 156 | 157 | 4. Keyboard layouts 158 | 159 | [ Keyboard layouts ] 160 | Alt+Shift to switch layouts 161 | e.g: xkb_layouts=us,de 162 | xkb_layouts=us,de 163 | 164 | 4. Multimedian keys 165 | 166 | [ Multimedia keys ] 167 | For default multimedia keys support install: playerctl, alsa-utils 168 | or use your own commands. 169 | play_pause = playerctl play-pause 170 | volume_up = amixer set Master 3+ 171 | volume_down = amixer set Master 3- 172 | volume_mute = amixer set Master toggle 173 | 174 | 5. Keyboard shortcuts 175 | 176 | [ Keyboard Shortcuts ] 177 | Modifiers names: 178 | WLR_MODIFIER_ALT 179 | WLR_MODIFIER_CTRL 180 | WLR_MODIFIER_SHIFT 181 | WLR_MODIFIER_LOGO (Super key) 182 | 183 | Key names here: /usr/include/xkbcommon/xkbcommon-keysyms.h 184 | 185 | Default shortcuts: 186 | to log out 187 | to close the current window 188 | to switch to the next window 189 | Example of user defined shortcuts: 190 | NOTE: You have to preserve binding_ and command_ prefixes. 191 | binding_thunar = WLR_MODIFIER_LOGO XKB_KEY_f 192 | command_thunar = thunar 193 | 194 | 6. Window placement 195 | 196 | [ Window Placement ] 197 | Open specified windows at the given fixed position. 198 | to get the title and/or app_id, use wlrctl tool. 199 | The placement model is as follows: 200 | (declaration) window_place = (keyword) app_id: (app id) app_id (number) x (number) y 201 | (declaration) window_place = (keyword) title: (title) title (number) x (number) y 202 | Example of how to make 'thunar' start at position x=100 y=100: 203 | window_place = app_id: thunar 100 100 204 | or 205 | window_place = title: "some title" 100 100 206 | NOTE: Titles with spaces must be put between double quotes: e.g "New Document" 207 | 208 | Placing thunar 209 | window_place = app_id: thunar -15 -15 210 | 211 | 7. Zoom 212 | 213 | [ Zoom ] 214 | Zooming is activated by pressing super key and scrolling. 215 | zoom_speed defines how fast zooming area is moving around. 216 | zoom_edge_threshold defines the distance from the edges to start panning. 217 | zoom_top_edge if 'enabled' then you can scroll on the left top edge to zoom. 218 | zoom_speed = 5 219 | zoom_top_edge = enabled 220 | zoom_edge_threshold = 30 221 | 222 | 8. Autostart applications 223 | 224 | [ Startup ] 225 | Specify the startup commands. 226 | If no startup command is specified then 227 | it will automatically look for the following terminals: 228 | foot, xfce4-terminal, kitty, gnome-terminal, alacritty. 229 | Example (automatically start thunar and foot): 230 | NOTE: the line must start with startup_command 231 | 232 | My startup applications: 233 | startup_command = mako 234 | startup_command = polari 235 | startup_command = diowmenu 236 | startup_command = diowpanel 237 | startup_command = diowwindowlist 238 | 239 | That is it enjoy! 240 | 241 | # Support 242 | 243 | My Libera IRC support channel: #linuxfriends 244 | 245 | Matrix: https://matrix.to/#/#linuxfriends2:matrix.org 246 | 247 | Email: nicolas.dio@protonmail.com 248 | -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | set -e 4 | 5 | if which pkgconf > /dev/null; then 6 | echo "pkg-config found." 7 | else 8 | echo "Error: 'pkgconf' not found. Please install the library." 9 | exit 1 10 | fi 11 | 12 | if which make > /dev/null; then 13 | echo "make found." 14 | else 15 | echo "Error: 'make' not found. Please install the library." 16 | exit 1 17 | fi 18 | 19 | if pkg-config --exists stb; then 20 | echo "stb found." 21 | else 22 | echo "Error: 'libstb-dev' not found. Please install the library." 23 | exit 1 24 | fi 25 | 26 | if pkg-config --exists libdrm; then 27 | echo "libdrm found." 28 | else 29 | echo "Error: 'libdrm-dev' not found. Please install the library." 30 | exit 1 31 | fi 32 | 33 | if pkg-config --exists glesv2; then 34 | echo "glesv2 found." 35 | else 36 | echo "Error: 'libgles-dev' not found. Please install the library." 37 | exit 1 38 | fi 39 | 40 | if pkg-config --exists wlroots; then 41 | echo "wlroots found." 42 | else 43 | echo "Error: 'libwlroots-dev' not found. Please install the library." 44 | exit 1 45 | fi 46 | 47 | if pkg-config --exists libinput; then 48 | echo "libinput found." 49 | else 50 | echo "Error: 'libinput-dev' not found. Please install the library." 51 | exit 1 52 | fi 53 | 54 | if pkg-config --exists pixman-1; then 55 | echo "pixman-1 found." 56 | else 57 | echo "Error: 'libpixman-1-dev' not found. Please install the library." 58 | exit 1 59 | fi 60 | 61 | if pkg-config --exists xkbcommon; then 62 | echo "xkbcommon found." 63 | else 64 | echo "Error: 'libxkbcommon-dev' not found. Please install the library." 65 | exit 1 66 | fi 67 | 68 | if pkg-config --exists wayland-server; then 69 | echo "wayland-server found." 70 | else 71 | echo "Error: 'libwayland-dev' not found. Please install the library." 72 | exit 1 73 | fi 74 | 75 | cp Makefile.in Makefile 76 | 77 | echo "" 78 | echo "All done!" 79 | echo "" 80 | echo "Type 'make' to build the project." 81 | 82 | exit 0 83 | -------------------------------------------------------------------------------- /include/pointer-constraints-unstable-v1-protocol.h: -------------------------------------------------------------------------------- 1 | /* Generated by wayland-scanner 1.21.0 */ 2 | 3 | #ifndef POINTER_CONSTRAINTS_UNSTABLE_V1_SERVER_PROTOCOL_H 4 | #define POINTER_CONSTRAINTS_UNSTABLE_V1_SERVER_PROTOCOL_H 5 | 6 | #include 7 | #include 8 | #include "wayland-server.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | struct wl_client; 15 | struct wl_resource; 16 | 17 | /** 18 | * @page page_pointer_constraints_unstable_v1 The pointer_constraints_unstable_v1 protocol 19 | * protocol for constraining pointer motions 20 | * 21 | * @section page_desc_pointer_constraints_unstable_v1 Description 22 | * 23 | * This protocol specifies a set of interfaces used for adding constraints to 24 | * the motion of a pointer. Possible constraints include confining pointer 25 | * motions to a given region, or locking it to its current position. 26 | * 27 | * In order to constrain the pointer, a client must first bind the global 28 | * interface "wp_pointer_constraints" which, if a compositor supports pointer 29 | * constraints, is exposed by the registry. Using the bound global object, the 30 | * client uses the request that corresponds to the type of constraint it wants 31 | * to make. See wp_pointer_constraints for more details. 32 | * 33 | * Warning! The protocol described in this file is experimental and backward 34 | * incompatible changes may be made. Backward compatible changes may be added 35 | * together with the corresponding interface version bump. Backward 36 | * incompatible changes are done by bumping the version number in the protocol 37 | * and interface names and resetting the interface version. Once the protocol 38 | * is to be declared stable, the 'z' prefix and the version number in the 39 | * protocol and interface names are removed and the interface version number is 40 | * reset. 41 | * 42 | * @section page_ifaces_pointer_constraints_unstable_v1 Interfaces 43 | * - @subpage page_iface_zwp_pointer_constraints_v1 - constrain the movement of a pointer 44 | * - @subpage page_iface_zwp_locked_pointer_v1 - receive relative pointer motion events 45 | * - @subpage page_iface_zwp_confined_pointer_v1 - confined pointer object 46 | * @section page_copyright_pointer_constraints_unstable_v1 Copyright 47 | *
 48 |  *
 49 |  * Copyright © 2014      Jonas Ådahl
 50 |  * Copyright © 2015      Red Hat Inc.
 51 |  *
 52 |  * Permission is hereby granted, free of charge, to any person obtaining a
 53 |  * copy of this software and associated documentation files (the "Software"),
 54 |  * to deal in the Software without restriction, including without limitation
 55 |  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 56 |  * and/or sell copies of the Software, and to permit persons to whom the
 57 |  * Software is furnished to do so, subject to the following conditions:
 58 |  *
 59 |  * The above copyright notice and this permission notice (including the next
 60 |  * paragraph) shall be included in all copies or substantial portions of the
 61 |  * Software.
 62 |  *
 63 |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 64 |  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 65 |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 66 |  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 67 |  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 68 |  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 69 |  * DEALINGS IN THE SOFTWARE.
 70 |  * 
71 | */ 72 | struct wl_pointer; 73 | struct wl_region; 74 | struct wl_surface; 75 | struct zwp_confined_pointer_v1; 76 | struct zwp_locked_pointer_v1; 77 | struct zwp_pointer_constraints_v1; 78 | 79 | #ifndef ZWP_POINTER_CONSTRAINTS_V1_INTERFACE 80 | #define ZWP_POINTER_CONSTRAINTS_V1_INTERFACE 81 | /** 82 | * @page page_iface_zwp_pointer_constraints_v1 zwp_pointer_constraints_v1 83 | * @section page_iface_zwp_pointer_constraints_v1_desc Description 84 | * 85 | * The global interface exposing pointer constraining functionality. It 86 | * exposes two requests: lock_pointer for locking the pointer to its 87 | * position, and confine_pointer for locking the pointer to a region. 88 | * 89 | * The lock_pointer and confine_pointer requests create the objects 90 | * wp_locked_pointer and wp_confined_pointer respectively, and the client can 91 | * use these objects to interact with the lock. 92 | * 93 | * For any surface, only one lock or confinement may be active across all 94 | * wl_pointer objects of the same seat. If a lock or confinement is requested 95 | * when another lock or confinement is active or requested on the same surface 96 | * and with any of the wl_pointer objects of the same seat, an 97 | * 'already_constrained' error will be raised. 98 | * @section page_iface_zwp_pointer_constraints_v1_api API 99 | * See @ref iface_zwp_pointer_constraints_v1. 100 | */ 101 | /** 102 | * @defgroup iface_zwp_pointer_constraints_v1 The zwp_pointer_constraints_v1 interface 103 | * 104 | * The global interface exposing pointer constraining functionality. It 105 | * exposes two requests: lock_pointer for locking the pointer to its 106 | * position, and confine_pointer for locking the pointer to a region. 107 | * 108 | * The lock_pointer and confine_pointer requests create the objects 109 | * wp_locked_pointer and wp_confined_pointer respectively, and the client can 110 | * use these objects to interact with the lock. 111 | * 112 | * For any surface, only one lock or confinement may be active across all 113 | * wl_pointer objects of the same seat. If a lock or confinement is requested 114 | * when another lock or confinement is active or requested on the same surface 115 | * and with any of the wl_pointer objects of the same seat, an 116 | * 'already_constrained' error will be raised. 117 | */ 118 | extern const struct wl_interface zwp_pointer_constraints_v1_interface; 119 | #endif 120 | #ifndef ZWP_LOCKED_POINTER_V1_INTERFACE 121 | #define ZWP_LOCKED_POINTER_V1_INTERFACE 122 | /** 123 | * @page page_iface_zwp_locked_pointer_v1 zwp_locked_pointer_v1 124 | * @section page_iface_zwp_locked_pointer_v1_desc Description 125 | * 126 | * The wp_locked_pointer interface represents a locked pointer state. 127 | * 128 | * While the lock of this object is active, the wl_pointer objects of the 129 | * associated seat will not emit any wl_pointer.motion events. 130 | * 131 | * This object will send the event 'locked' when the lock is activated. 132 | * Whenever the lock is activated, it is guaranteed that the locked surface 133 | * will already have received pointer focus and that the pointer will be 134 | * within the region passed to the request creating this object. 135 | * 136 | * To unlock the pointer, send the destroy request. This will also destroy 137 | * the wp_locked_pointer object. 138 | * 139 | * If the compositor decides to unlock the pointer the unlocked event is 140 | * sent. See wp_locked_pointer.unlock for details. 141 | * 142 | * When unlocking, the compositor may warp the cursor position to the set 143 | * cursor position hint. If it does, it will not result in any relative 144 | * motion events emitted via wp_relative_pointer. 145 | * 146 | * If the surface the lock was requested on is destroyed and the lock is not 147 | * yet activated, the wp_locked_pointer object is now defunct and must be 148 | * destroyed. 149 | * @section page_iface_zwp_locked_pointer_v1_api API 150 | * See @ref iface_zwp_locked_pointer_v1. 151 | */ 152 | /** 153 | * @defgroup iface_zwp_locked_pointer_v1 The zwp_locked_pointer_v1 interface 154 | * 155 | * The wp_locked_pointer interface represents a locked pointer state. 156 | * 157 | * While the lock of this object is active, the wl_pointer objects of the 158 | * associated seat will not emit any wl_pointer.motion events. 159 | * 160 | * This object will send the event 'locked' when the lock is activated. 161 | * Whenever the lock is activated, it is guaranteed that the locked surface 162 | * will already have received pointer focus and that the pointer will be 163 | * within the region passed to the request creating this object. 164 | * 165 | * To unlock the pointer, send the destroy request. This will also destroy 166 | * the wp_locked_pointer object. 167 | * 168 | * If the compositor decides to unlock the pointer the unlocked event is 169 | * sent. See wp_locked_pointer.unlock for details. 170 | * 171 | * When unlocking, the compositor may warp the cursor position to the set 172 | * cursor position hint. If it does, it will not result in any relative 173 | * motion events emitted via wp_relative_pointer. 174 | * 175 | * If the surface the lock was requested on is destroyed and the lock is not 176 | * yet activated, the wp_locked_pointer object is now defunct and must be 177 | * destroyed. 178 | */ 179 | extern const struct wl_interface zwp_locked_pointer_v1_interface; 180 | #endif 181 | #ifndef ZWP_CONFINED_POINTER_V1_INTERFACE 182 | #define ZWP_CONFINED_POINTER_V1_INTERFACE 183 | /** 184 | * @page page_iface_zwp_confined_pointer_v1 zwp_confined_pointer_v1 185 | * @section page_iface_zwp_confined_pointer_v1_desc Description 186 | * 187 | * The wp_confined_pointer interface represents a confined pointer state. 188 | * 189 | * This object will send the event 'confined' when the confinement is 190 | * activated. Whenever the confinement is activated, it is guaranteed that 191 | * the surface the pointer is confined to will already have received pointer 192 | * focus and that the pointer will be within the region passed to the request 193 | * creating this object. It is up to the compositor to decide whether this 194 | * requires some user interaction and if the pointer will warp to within the 195 | * passed region if outside. 196 | * 197 | * To unconfine the pointer, send the destroy request. This will also destroy 198 | * the wp_confined_pointer object. 199 | * 200 | * If the compositor decides to unconfine the pointer the unconfined event is 201 | * sent. The wp_confined_pointer object is at this point defunct and should 202 | * be destroyed. 203 | * @section page_iface_zwp_confined_pointer_v1_api API 204 | * See @ref iface_zwp_confined_pointer_v1. 205 | */ 206 | /** 207 | * @defgroup iface_zwp_confined_pointer_v1 The zwp_confined_pointer_v1 interface 208 | * 209 | * The wp_confined_pointer interface represents a confined pointer state. 210 | * 211 | * This object will send the event 'confined' when the confinement is 212 | * activated. Whenever the confinement is activated, it is guaranteed that 213 | * the surface the pointer is confined to will already have received pointer 214 | * focus and that the pointer will be within the region passed to the request 215 | * creating this object. It is up to the compositor to decide whether this 216 | * requires some user interaction and if the pointer will warp to within the 217 | * passed region if outside. 218 | * 219 | * To unconfine the pointer, send the destroy request. This will also destroy 220 | * the wp_confined_pointer object. 221 | * 222 | * If the compositor decides to unconfine the pointer the unconfined event is 223 | * sent. The wp_confined_pointer object is at this point defunct and should 224 | * be destroyed. 225 | */ 226 | extern const struct wl_interface zwp_confined_pointer_v1_interface; 227 | #endif 228 | 229 | #ifndef ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM 230 | #define ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM 231 | /** 232 | * @ingroup iface_zwp_pointer_constraints_v1 233 | * wp_pointer_constraints error values 234 | * 235 | * These errors can be emitted in response to wp_pointer_constraints 236 | * requests. 237 | */ 238 | enum zwp_pointer_constraints_v1_error { 239 | /** 240 | * pointer constraint already requested on that surface 241 | */ 242 | ZWP_POINTER_CONSTRAINTS_V1_ERROR_ALREADY_CONSTRAINED = 1, 243 | }; 244 | #endif /* ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM */ 245 | 246 | #ifndef ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM 247 | #define ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM 248 | /** 249 | * @ingroup iface_zwp_pointer_constraints_v1 250 | * constraint lifetime 251 | * 252 | * These values represent different lifetime semantics. They are passed 253 | * as arguments to the factory requests to specify how the constraint 254 | * lifetimes should be managed. 255 | */ 256 | enum zwp_pointer_constraints_v1_lifetime { 257 | /** 258 | * the pointer constraint is defunct once deactivated 259 | * 260 | * A oneshot pointer constraint will never reactivate once it has 261 | * been deactivated. See the corresponding deactivation event 262 | * (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) 263 | * for details. 264 | */ 265 | ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT = 1, 266 | /** 267 | * the pointer constraint may reactivate 268 | * 269 | * A persistent pointer constraint may again reactivate once it 270 | * has been deactivated. See the corresponding deactivation event 271 | * (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) 272 | * for details. 273 | */ 274 | ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT = 2, 275 | }; 276 | #endif /* ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM */ 277 | 278 | /** 279 | * @ingroup iface_zwp_pointer_constraints_v1 280 | * @struct zwp_pointer_constraints_v1_interface 281 | */ 282 | struct zwp_pointer_constraints_v1_interface { 283 | /** 284 | * destroy the pointer constraints manager object 285 | * 286 | * Used by the client to notify the server that it will no longer 287 | * use this pointer constraints object. 288 | */ 289 | void (*destroy)(struct wl_client *client, 290 | struct wl_resource *resource); 291 | /** 292 | * lock pointer to a position 293 | * 294 | * The lock_pointer request lets the client request to disable 295 | * movements of the virtual pointer (i.e. the cursor), effectively 296 | * locking the pointer to a position. This request may not take 297 | * effect immediately; in the future, when the compositor deems 298 | * implementation-specific constraints are satisfied, the pointer 299 | * lock will be activated and the compositor sends a locked event. 300 | * 301 | * The protocol provides no guarantee that the constraints are ever 302 | * satisfied, and does not require the compositor to send an error 303 | * if the constraints cannot ever be satisfied. It is thus possible 304 | * to request a lock that will never activate. 305 | * 306 | * There may not be another pointer constraint of any kind 307 | * requested or active on the surface for any of the wl_pointer 308 | * objects of the seat of the passed pointer when requesting a 309 | * lock. If there is, an error will be raised. See general pointer 310 | * lock documentation for more details. 311 | * 312 | * The intersection of the region passed with this request and the 313 | * input region of the surface is used to determine where the 314 | * pointer must be in order for the lock to activate. It is up to 315 | * the compositor whether to warp the pointer or require some kind 316 | * of user interaction for the lock to activate. If the region is 317 | * null the surface input region is used. 318 | * 319 | * A surface may receive pointer focus without the lock being 320 | * activated. 321 | * 322 | * The request creates a new object wp_locked_pointer which is used 323 | * to interact with the lock as well as receive updates about its 324 | * state. See the the description of wp_locked_pointer for further 325 | * information. 326 | * 327 | * Note that while a pointer is locked, the wl_pointer objects of 328 | * the corresponding seat will not emit any wl_pointer.motion 329 | * events, but relative motion events will still be emitted via 330 | * wp_relative_pointer objects of the same seat. wl_pointer.axis 331 | * and wl_pointer.button events are unaffected. 332 | * @param surface surface to lock pointer to 333 | * @param pointer the pointer that should be locked 334 | * @param region region of surface 335 | * @param lifetime lock lifetime 336 | */ 337 | void (*lock_pointer)(struct wl_client *client, 338 | struct wl_resource *resource, 339 | uint32_t id, 340 | struct wl_resource *surface, 341 | struct wl_resource *pointer, 342 | struct wl_resource *region, 343 | uint32_t lifetime); 344 | /** 345 | * confine pointer to a region 346 | * 347 | * The confine_pointer request lets the client request to confine 348 | * the pointer cursor to a given region. This request may not take 349 | * effect immediately; in the future, when the compositor deems 350 | * implementation- specific constraints are satisfied, the pointer 351 | * confinement will be activated and the compositor sends a 352 | * confined event. 353 | * 354 | * The intersection of the region passed with this request and the 355 | * input region of the surface is used to determine where the 356 | * pointer must be in order for the confinement to activate. It is 357 | * up to the compositor whether to warp the pointer or require some 358 | * kind of user interaction for the confinement to activate. If the 359 | * region is null the surface input region is used. 360 | * 361 | * The request will create a new object wp_confined_pointer which 362 | * is used to interact with the confinement as well as receive 363 | * updates about its state. See the the description of 364 | * wp_confined_pointer for further information. 365 | * @param surface surface to lock pointer to 366 | * @param pointer the pointer that should be confined 367 | * @param region region of surface 368 | * @param lifetime confinement lifetime 369 | */ 370 | void (*confine_pointer)(struct wl_client *client, 371 | struct wl_resource *resource, 372 | uint32_t id, 373 | struct wl_resource *surface, 374 | struct wl_resource *pointer, 375 | struct wl_resource *region, 376 | uint32_t lifetime); 377 | }; 378 | 379 | 380 | /** 381 | * @ingroup iface_zwp_pointer_constraints_v1 382 | */ 383 | #define ZWP_POINTER_CONSTRAINTS_V1_DESTROY_SINCE_VERSION 1 384 | /** 385 | * @ingroup iface_zwp_pointer_constraints_v1 386 | */ 387 | #define ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER_SINCE_VERSION 1 388 | /** 389 | * @ingroup iface_zwp_pointer_constraints_v1 390 | */ 391 | #define ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER_SINCE_VERSION 1 392 | 393 | /** 394 | * @ingroup iface_zwp_locked_pointer_v1 395 | * @struct zwp_locked_pointer_v1_interface 396 | */ 397 | struct zwp_locked_pointer_v1_interface { 398 | /** 399 | * destroy the locked pointer object 400 | * 401 | * Destroy the locked pointer object. If applicable, the 402 | * compositor will unlock the pointer. 403 | */ 404 | void (*destroy)(struct wl_client *client, 405 | struct wl_resource *resource); 406 | /** 407 | * set the pointer cursor position hint 408 | * 409 | * Set the cursor position hint relative to the top left corner 410 | * of the surface. 411 | * 412 | * If the client is drawing its own cursor, it should update the 413 | * position hint to the position of its own cursor. A compositor 414 | * may use this information to warp the pointer upon unlock in 415 | * order to avoid pointer jumps. 416 | * 417 | * The cursor position hint is double-buffered state, see 418 | * wl_surface.commit. 419 | * @param surface_x surface-local x coordinate 420 | * @param surface_y surface-local y coordinate 421 | */ 422 | void (*set_cursor_position_hint)(struct wl_client *client, 423 | struct wl_resource *resource, 424 | wl_fixed_t surface_x, 425 | wl_fixed_t surface_y); 426 | /** 427 | * set a new lock region 428 | * 429 | * Set a new region used to lock the pointer. 430 | * 431 | * The new lock region is double-buffered, see wl_surface.commit. 432 | * 433 | * For details about the lock region, see wp_locked_pointer. 434 | * @param region region of surface 435 | */ 436 | void (*set_region)(struct wl_client *client, 437 | struct wl_resource *resource, 438 | struct wl_resource *region); 439 | }; 440 | 441 | #define ZWP_LOCKED_POINTER_V1_LOCKED 0 442 | #define ZWP_LOCKED_POINTER_V1_UNLOCKED 1 443 | 444 | /** 445 | * @ingroup iface_zwp_locked_pointer_v1 446 | */ 447 | #define ZWP_LOCKED_POINTER_V1_LOCKED_SINCE_VERSION 1 448 | /** 449 | * @ingroup iface_zwp_locked_pointer_v1 450 | */ 451 | #define ZWP_LOCKED_POINTER_V1_UNLOCKED_SINCE_VERSION 1 452 | 453 | /** 454 | * @ingroup iface_zwp_locked_pointer_v1 455 | */ 456 | #define ZWP_LOCKED_POINTER_V1_DESTROY_SINCE_VERSION 1 457 | /** 458 | * @ingroup iface_zwp_locked_pointer_v1 459 | */ 460 | #define ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT_SINCE_VERSION 1 461 | /** 462 | * @ingroup iface_zwp_locked_pointer_v1 463 | */ 464 | #define ZWP_LOCKED_POINTER_V1_SET_REGION_SINCE_VERSION 1 465 | 466 | /** 467 | * @ingroup iface_zwp_locked_pointer_v1 468 | * Sends an locked event to the client owning the resource. 469 | * @param resource_ The client's resource 470 | */ 471 | static inline void 472 | zwp_locked_pointer_v1_send_locked(struct wl_resource *resource_) 473 | { 474 | wl_resource_post_event(resource_, ZWP_LOCKED_POINTER_V1_LOCKED); 475 | } 476 | 477 | /** 478 | * @ingroup iface_zwp_locked_pointer_v1 479 | * Sends an unlocked event to the client owning the resource. 480 | * @param resource_ The client's resource 481 | */ 482 | static inline void 483 | zwp_locked_pointer_v1_send_unlocked(struct wl_resource *resource_) 484 | { 485 | wl_resource_post_event(resource_, ZWP_LOCKED_POINTER_V1_UNLOCKED); 486 | } 487 | 488 | /** 489 | * @ingroup iface_zwp_confined_pointer_v1 490 | * @struct zwp_confined_pointer_v1_interface 491 | */ 492 | struct zwp_confined_pointer_v1_interface { 493 | /** 494 | * destroy the confined pointer object 495 | * 496 | * Destroy the confined pointer object. If applicable, the 497 | * compositor will unconfine the pointer. 498 | */ 499 | void (*destroy)(struct wl_client *client, 500 | struct wl_resource *resource); 501 | /** 502 | * set a new confine region 503 | * 504 | * Set a new region used to confine the pointer. 505 | * 506 | * The new confine region is double-buffered, see 507 | * wl_surface.commit. 508 | * 509 | * If the confinement is active when the new confinement region is 510 | * applied and the pointer ends up outside of newly applied region, 511 | * the pointer may warped to a position within the new confinement 512 | * region. If warped, a wl_pointer.motion event will be emitted, 513 | * but no wp_relative_pointer.relative_motion event. 514 | * 515 | * The compositor may also, instead of using the new region, 516 | * unconfine the pointer. 517 | * 518 | * For details about the confine region, see wp_confined_pointer. 519 | * @param region region of surface 520 | */ 521 | void (*set_region)(struct wl_client *client, 522 | struct wl_resource *resource, 523 | struct wl_resource *region); 524 | }; 525 | 526 | #define ZWP_CONFINED_POINTER_V1_CONFINED 0 527 | #define ZWP_CONFINED_POINTER_V1_UNCONFINED 1 528 | 529 | /** 530 | * @ingroup iface_zwp_confined_pointer_v1 531 | */ 532 | #define ZWP_CONFINED_POINTER_V1_CONFINED_SINCE_VERSION 1 533 | /** 534 | * @ingroup iface_zwp_confined_pointer_v1 535 | */ 536 | #define ZWP_CONFINED_POINTER_V1_UNCONFINED_SINCE_VERSION 1 537 | 538 | /** 539 | * @ingroup iface_zwp_confined_pointer_v1 540 | */ 541 | #define ZWP_CONFINED_POINTER_V1_DESTROY_SINCE_VERSION 1 542 | /** 543 | * @ingroup iface_zwp_confined_pointer_v1 544 | */ 545 | #define ZWP_CONFINED_POINTER_V1_SET_REGION_SINCE_VERSION 1 546 | 547 | /** 548 | * @ingroup iface_zwp_confined_pointer_v1 549 | * Sends an confined event to the client owning the resource. 550 | * @param resource_ The client's resource 551 | */ 552 | static inline void 553 | zwp_confined_pointer_v1_send_confined(struct wl_resource *resource_) 554 | { 555 | wl_resource_post_event(resource_, ZWP_CONFINED_POINTER_V1_CONFINED); 556 | } 557 | 558 | /** 559 | * @ingroup iface_zwp_confined_pointer_v1 560 | * Sends an unconfined event to the client owning the resource. 561 | * @param resource_ The client's resource 562 | */ 563 | static inline void 564 | zwp_confined_pointer_v1_send_unconfined(struct wl_resource *resource_) 565 | { 566 | wl_resource_post_event(resource_, ZWP_CONFINED_POINTER_V1_UNCONFINED); 567 | } 568 | 569 | #ifdef __cplusplus 570 | } 571 | #endif 572 | 573 | #endif 574 | -------------------------------------------------------------------------------- /include/wlr-layer-shell-unstable-v1-protocol.h: -------------------------------------------------------------------------------- 1 | /* Generated by wayland-scanner 1.21.0 */ 2 | 3 | #ifndef WLR_LAYER_SHELL_UNSTABLE_V1_SERVER_PROTOCOL_H 4 | #define WLR_LAYER_SHELL_UNSTABLE_V1_SERVER_PROTOCOL_H 5 | 6 | #include 7 | #include 8 | #include "wayland-server.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | struct wl_client; 15 | struct wl_resource; 16 | 17 | /** 18 | * @page page_wlr_layer_shell_unstable_v1 The wlr_layer_shell_unstable_v1 protocol 19 | * @section page_ifaces_wlr_layer_shell_unstable_v1 Interfaces 20 | * - @subpage page_iface_zwlr_layer_shell_v1 - create surfaces that are layers of the desktop 21 | * - @subpage page_iface_zwlr_layer_surface_v1 - layer metadata interface 22 | * @section page_copyright_wlr_layer_shell_unstable_v1 Copyright 23 | *
 24 |  *
 25 |  * Copyright © 2017 Drew DeVault
 26 |  *
 27 |  * Permission to use, copy, modify, distribute, and sell this
 28 |  * software and its documentation for any purpose is hereby granted
 29 |  * without fee, provided that the above copyright notice appear in
 30 |  * all copies and that both that copyright notice and this permission
 31 |  * notice appear in supporting documentation, and that the name of
 32 |  * the copyright holders not be used in advertising or publicity
 33 |  * pertaining to distribution of the software without specific,
 34 |  * written prior permission.  The copyright holders make no
 35 |  * representations about the suitability of this software for any
 36 |  * purpose.  It is provided "as is" without express or implied
 37 |  * warranty.
 38 |  *
 39 |  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
 40 |  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
 41 |  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
 42 |  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 43 |  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
 44 |  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 45 |  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
 46 |  * THIS SOFTWARE.
 47 |  * 
48 | */ 49 | struct wl_output; 50 | struct wl_surface; 51 | struct xdg_popup; 52 | struct zwlr_layer_shell_v1; 53 | struct zwlr_layer_surface_v1; 54 | 55 | #ifndef ZWLR_LAYER_SHELL_V1_INTERFACE 56 | #define ZWLR_LAYER_SHELL_V1_INTERFACE 57 | /** 58 | * @page page_iface_zwlr_layer_shell_v1 zwlr_layer_shell_v1 59 | * @section page_iface_zwlr_layer_shell_v1_desc Description 60 | * 61 | * Clients can use this interface to assign the surface_layer role to 62 | * wl_surfaces. Such surfaces are assigned to a "layer" of the output and 63 | * rendered with a defined z-depth respective to each other. They may also be 64 | * anchored to the edges and corners of a screen and specify input handling 65 | * semantics. This interface should be suitable for the implementation of 66 | * many desktop shell components, and a broad number of other applications 67 | * that interact with the desktop. 68 | * @section page_iface_zwlr_layer_shell_v1_api API 69 | * See @ref iface_zwlr_layer_shell_v1. 70 | */ 71 | /** 72 | * @defgroup iface_zwlr_layer_shell_v1 The zwlr_layer_shell_v1 interface 73 | * 74 | * Clients can use this interface to assign the surface_layer role to 75 | * wl_surfaces. Such surfaces are assigned to a "layer" of the output and 76 | * rendered with a defined z-depth respective to each other. They may also be 77 | * anchored to the edges and corners of a screen and specify input handling 78 | * semantics. This interface should be suitable for the implementation of 79 | * many desktop shell components, and a broad number of other applications 80 | * that interact with the desktop. 81 | */ 82 | extern const struct wl_interface zwlr_layer_shell_v1_interface; 83 | #endif 84 | #ifndef ZWLR_LAYER_SURFACE_V1_INTERFACE 85 | #define ZWLR_LAYER_SURFACE_V1_INTERFACE 86 | /** 87 | * @page page_iface_zwlr_layer_surface_v1 zwlr_layer_surface_v1 88 | * @section page_iface_zwlr_layer_surface_v1_desc Description 89 | * 90 | * An interface that may be implemented by a wl_surface, for surfaces that 91 | * are designed to be rendered as a layer of a stacked desktop-like 92 | * environment. 93 | * 94 | * Layer surface state (layer, size, anchor, exclusive zone, 95 | * margin, interactivity) is double-buffered, and will be applied at the 96 | * time wl_surface.commit of the corresponding wl_surface is called. 97 | * 98 | * Attaching a null buffer to a layer surface unmaps it. 99 | * 100 | * Unmapping a layer_surface means that the surface cannot be shown by the 101 | * compositor until it is explicitly mapped again. The layer_surface 102 | * returns to the state it had right after layer_shell.get_layer_surface. 103 | * The client can re-map the surface by performing a commit without any 104 | * buffer attached, waiting for a configure event and handling it as usual. 105 | * @section page_iface_zwlr_layer_surface_v1_api API 106 | * See @ref iface_zwlr_layer_surface_v1. 107 | */ 108 | /** 109 | * @defgroup iface_zwlr_layer_surface_v1 The zwlr_layer_surface_v1 interface 110 | * 111 | * An interface that may be implemented by a wl_surface, for surfaces that 112 | * are designed to be rendered as a layer of a stacked desktop-like 113 | * environment. 114 | * 115 | * Layer surface state (layer, size, anchor, exclusive zone, 116 | * margin, interactivity) is double-buffered, and will be applied at the 117 | * time wl_surface.commit of the corresponding wl_surface is called. 118 | * 119 | * Attaching a null buffer to a layer surface unmaps it. 120 | * 121 | * Unmapping a layer_surface means that the surface cannot be shown by the 122 | * compositor until it is explicitly mapped again. The layer_surface 123 | * returns to the state it had right after layer_shell.get_layer_surface. 124 | * The client can re-map the surface by performing a commit without any 125 | * buffer attached, waiting for a configure event and handling it as usual. 126 | */ 127 | extern const struct wl_interface zwlr_layer_surface_v1_interface; 128 | #endif 129 | 130 | #ifndef ZWLR_LAYER_SHELL_V1_ERROR_ENUM 131 | #define ZWLR_LAYER_SHELL_V1_ERROR_ENUM 132 | enum zwlr_layer_shell_v1_error { 133 | /** 134 | * wl_surface has another role 135 | */ 136 | ZWLR_LAYER_SHELL_V1_ERROR_ROLE = 0, 137 | /** 138 | * layer value is invalid 139 | */ 140 | ZWLR_LAYER_SHELL_V1_ERROR_INVALID_LAYER = 1, 141 | /** 142 | * wl_surface has a buffer attached or committed 143 | */ 144 | ZWLR_LAYER_SHELL_V1_ERROR_ALREADY_CONSTRUCTED = 2, 145 | }; 146 | #endif /* ZWLR_LAYER_SHELL_V1_ERROR_ENUM */ 147 | 148 | #ifndef ZWLR_LAYER_SHELL_V1_LAYER_ENUM 149 | #define ZWLR_LAYER_SHELL_V1_LAYER_ENUM 150 | /** 151 | * @ingroup iface_zwlr_layer_shell_v1 152 | * available layers for surfaces 153 | * 154 | * These values indicate which layers a surface can be rendered in. They 155 | * are ordered by z depth, bottom-most first. Traditional shell surfaces 156 | * will typically be rendered between the bottom and top layers. 157 | * Fullscreen shell surfaces are typically rendered at the top layer. 158 | * Multiple surfaces can share a single layer, and ordering within a 159 | * single layer is undefined. 160 | */ 161 | enum zwlr_layer_shell_v1_layer { 162 | ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND = 0, 163 | ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM = 1, 164 | ZWLR_LAYER_SHELL_V1_LAYER_TOP = 2, 165 | ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY = 3, 166 | }; 167 | #endif /* ZWLR_LAYER_SHELL_V1_LAYER_ENUM */ 168 | 169 | /** 170 | * @ingroup iface_zwlr_layer_shell_v1 171 | * @struct zwlr_layer_shell_v1_interface 172 | */ 173 | struct zwlr_layer_shell_v1_interface { 174 | /** 175 | * create a layer_surface from a surface 176 | * 177 | * Create a layer surface for an existing surface. This assigns 178 | * the role of layer_surface, or raises a protocol error if another 179 | * role is already assigned. 180 | * 181 | * Creating a layer surface from a wl_surface which has a buffer 182 | * attached or committed is a client error, and any attempts by a 183 | * client to attach or manipulate a buffer prior to the first 184 | * layer_surface.configure call must also be treated as errors. 185 | * 186 | * After creating a layer_surface object and setting it up, the 187 | * client must perform an initial commit without any buffer 188 | * attached. The compositor will reply with a 189 | * layer_surface.configure event. The client must acknowledge it 190 | * and is then allowed to attach a buffer to map the surface. 191 | * 192 | * You may pass NULL for output to allow the compositor to decide 193 | * which output to use. Generally this will be the one that the 194 | * user most recently interacted with. 195 | * 196 | * Clients can specify a namespace that defines the purpose of the 197 | * layer surface. 198 | * @param layer layer to add this surface to 199 | * @param namespace namespace for the layer surface 200 | */ 201 | void (*get_layer_surface)(struct wl_client *client, 202 | struct wl_resource *resource, 203 | uint32_t id, 204 | struct wl_resource *surface, 205 | struct wl_resource *output, 206 | uint32_t layer, 207 | const char *namespace); 208 | /** 209 | * destroy the layer_shell object 210 | * 211 | * This request indicates that the client will not use the 212 | * layer_shell object any more. Objects that have been created 213 | * through this instance are not affected. 214 | * @since 3 215 | */ 216 | void (*destroy)(struct wl_client *client, 217 | struct wl_resource *resource); 218 | }; 219 | 220 | 221 | /** 222 | * @ingroup iface_zwlr_layer_shell_v1 223 | */ 224 | #define ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE_SINCE_VERSION 1 225 | /** 226 | * @ingroup iface_zwlr_layer_shell_v1 227 | */ 228 | #define ZWLR_LAYER_SHELL_V1_DESTROY_SINCE_VERSION 3 229 | 230 | #ifndef ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ENUM 231 | #define ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ENUM 232 | /** 233 | * @ingroup iface_zwlr_layer_surface_v1 234 | * types of keyboard interaction possible for a layer shell surface 235 | * 236 | * Types of keyboard interaction possible for layer shell surfaces. The 237 | * rationale for this is twofold: (1) some applications are not interested 238 | * in keyboard events and not allowing them to be focused can improve the 239 | * desktop experience; (2) some applications will want to take exclusive 240 | * keyboard focus. 241 | */ 242 | enum zwlr_layer_surface_v1_keyboard_interactivity { 243 | /** 244 | * no keyboard focus is possible 245 | * 246 | * This value indicates that this surface is not interested in 247 | * keyboard events and the compositor should never assign it the 248 | * keyboard focus. 249 | * 250 | * This is the default value, set for newly created layer shell 251 | * surfaces. 252 | * 253 | * This is useful for e.g. desktop widgets that display information 254 | * or only have interaction with non-keyboard input devices. 255 | */ 256 | ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE = 0, 257 | /** 258 | * request exclusive keyboard focus 259 | * 260 | * Request exclusive keyboard focus if this surface is above the 261 | * shell surface layer. 262 | * 263 | * For the top and overlay layers, the seat will always give 264 | * exclusive keyboard focus to the top-most layer which has 265 | * keyboard interactivity set to exclusive. If this layer contains 266 | * multiple surfaces with keyboard interactivity set to exclusive, 267 | * the compositor determines the one receiving keyboard events in 268 | * an implementation- defined manner. In this case, no guarantee is 269 | * made when this surface will receive keyboard focus (if ever). 270 | * 271 | * For the bottom and background layers, the compositor is allowed 272 | * to use normal focus semantics. 273 | * 274 | * This setting is mainly intended for applications that need to 275 | * ensure they receive all keyboard events, such as a lock screen 276 | * or a password prompt. 277 | */ 278 | ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE = 1, 279 | /** 280 | * request regular keyboard focus semantics 281 | * 282 | * This requests the compositor to allow this surface to be 283 | * focused and unfocused by the user in an implementation-defined 284 | * manner. The user should be able to unfocus this surface even 285 | * regardless of the layer it is on. 286 | * 287 | * Typically, the compositor will want to use its normal mechanism 288 | * to manage keyboard focus between layer shell surfaces with this 289 | * setting and regular toplevels on the desktop layer (e.g. click 290 | * to focus). Nevertheless, it is possible for a compositor to 291 | * require a special interaction to focus or unfocus layer shell 292 | * surfaces (e.g. requiring a click even if focus follows the mouse 293 | * normally, or providing a keybinding to switch focus between 294 | * layers). 295 | * 296 | * This setting is mainly intended for desktop shell components 297 | * (e.g. panels) that allow keyboard interaction. Using this option 298 | * can allow implementing a desktop shell that can be fully usable 299 | * without the mouse. 300 | * @since 4 301 | */ 302 | ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND = 2, 303 | }; 304 | /** 305 | * @ingroup iface_zwlr_layer_surface_v1 306 | */ 307 | #define ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND_SINCE_VERSION 4 308 | #endif /* ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ENUM */ 309 | 310 | #ifndef ZWLR_LAYER_SURFACE_V1_ERROR_ENUM 311 | #define ZWLR_LAYER_SURFACE_V1_ERROR_ENUM 312 | enum zwlr_layer_surface_v1_error { 313 | /** 314 | * provided surface state is invalid 315 | */ 316 | ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SURFACE_STATE = 0, 317 | /** 318 | * size is invalid 319 | */ 320 | ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SIZE = 1, 321 | /** 322 | * anchor bitfield is invalid 323 | */ 324 | ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_ANCHOR = 2, 325 | /** 326 | * keyboard interactivity is invalid 327 | */ 328 | ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_KEYBOARD_INTERACTIVITY = 3, 329 | }; 330 | #endif /* ZWLR_LAYER_SURFACE_V1_ERROR_ENUM */ 331 | 332 | #ifndef ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM 333 | #define ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM 334 | enum zwlr_layer_surface_v1_anchor { 335 | /** 336 | * the top edge of the anchor rectangle 337 | */ 338 | ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP = 1, 339 | /** 340 | * the bottom edge of the anchor rectangle 341 | */ 342 | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM = 2, 343 | /** 344 | * the left edge of the anchor rectangle 345 | */ 346 | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT = 4, 347 | /** 348 | * the right edge of the anchor rectangle 349 | */ 350 | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT = 8, 351 | }; 352 | #endif /* ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM */ 353 | 354 | /** 355 | * @ingroup iface_zwlr_layer_surface_v1 356 | * @struct zwlr_layer_surface_v1_interface 357 | */ 358 | struct zwlr_layer_surface_v1_interface { 359 | /** 360 | * sets the size of the surface 361 | * 362 | * Sets the size of the surface in surface-local coordinates. The 363 | * compositor will display the surface centered with respect to its 364 | * anchors. 365 | * 366 | * If you pass 0 for either value, the compositor will assign it 367 | * and inform you of the assignment in the configure event. You 368 | * must set your anchor to opposite edges in the dimensions you 369 | * omit; not doing so is a protocol error. Both values are 0 by 370 | * default. 371 | * 372 | * Size is double-buffered, see wl_surface.commit. 373 | */ 374 | void (*set_size)(struct wl_client *client, 375 | struct wl_resource *resource, 376 | uint32_t width, 377 | uint32_t height); 378 | /** 379 | * configures the anchor point of the surface 380 | * 381 | * Requests that the compositor anchor the surface to the 382 | * specified edges and corners. If two orthogonal edges are 383 | * specified (e.g. 'top' and 'left'), then the anchor point will be 384 | * the intersection of the edges (e.g. the top left corner of the 385 | * output); otherwise the anchor point will be centered on that 386 | * edge, or in the center if none is specified. 387 | * 388 | * Anchor is double-buffered, see wl_surface.commit. 389 | */ 390 | void (*set_anchor)(struct wl_client *client, 391 | struct wl_resource *resource, 392 | uint32_t anchor); 393 | /** 394 | * configures the exclusive geometry of this surface 395 | * 396 | * Requests that the compositor avoids occluding an area with 397 | * other surfaces. The compositor's use of this information is 398 | * implementation-dependent - do not assume that this region will 399 | * not actually be occluded. 400 | * 401 | * A positive value is only meaningful if the surface is anchored 402 | * to one edge or an edge and both perpendicular edges. If the 403 | * surface is not anchored, anchored to only two perpendicular 404 | * edges (a corner), anchored to only two parallel edges or 405 | * anchored to all edges, a positive value will be treated the same 406 | * as zero. 407 | * 408 | * A positive zone is the distance from the edge in surface-local 409 | * coordinates to consider exclusive. 410 | * 411 | * Surfaces that do not wish to have an exclusive zone may instead 412 | * specify how they should interact with surfaces that do. If set 413 | * to zero, the surface indicates that it would like to be moved to 414 | * avoid occluding surfaces with a positive exclusive zone. If set 415 | * to -1, the surface indicates that it would not like to be moved 416 | * to accommodate for other surfaces, and the compositor should 417 | * extend it all the way to the edges it is anchored to. 418 | * 419 | * For example, a panel might set its exclusive zone to 10, so that 420 | * maximized shell surfaces are not shown on top of it. A 421 | * notification might set its exclusive zone to 0, so that it is 422 | * moved to avoid occluding the panel, but shell surfaces are shown 423 | * underneath it. A wallpaper or lock screen might set their 424 | * exclusive zone to -1, so that they stretch below or over the 425 | * panel. 426 | * 427 | * The default value is 0. 428 | * 429 | * Exclusive zone is double-buffered, see wl_surface.commit. 430 | */ 431 | void (*set_exclusive_zone)(struct wl_client *client, 432 | struct wl_resource *resource, 433 | int32_t zone); 434 | /** 435 | * sets a margin from the anchor point 436 | * 437 | * Requests that the surface be placed some distance away from 438 | * the anchor point on the output, in surface-local coordinates. 439 | * Setting this value for edges you are not anchored to has no 440 | * effect. 441 | * 442 | * The exclusive zone includes the margin. 443 | * 444 | * Margin is double-buffered, see wl_surface.commit. 445 | */ 446 | void (*set_margin)(struct wl_client *client, 447 | struct wl_resource *resource, 448 | int32_t top, 449 | int32_t right, 450 | int32_t bottom, 451 | int32_t left); 452 | /** 453 | * requests keyboard events 454 | * 455 | * Set how keyboard events are delivered to this surface. By 456 | * default, layer shell surfaces do not receive keyboard events; 457 | * this request can be used to change this. 458 | * 459 | * This setting is inherited by child surfaces set by the get_popup 460 | * request. 461 | * 462 | * Layer surfaces receive pointer, touch, and tablet events 463 | * normally. If you do not want to receive them, set the input 464 | * region on your surface to an empty region. 465 | * 466 | * Keyboard interactivity is double-buffered, see 467 | * wl_surface.commit. 468 | */ 469 | void (*set_keyboard_interactivity)(struct wl_client *client, 470 | struct wl_resource *resource, 471 | uint32_t keyboard_interactivity); 472 | /** 473 | * assign this layer_surface as an xdg_popup parent 474 | * 475 | * This assigns an xdg_popup's parent to this layer_surface. This 476 | * popup should have been created via xdg_surface::get_popup with 477 | * the parent set to NULL, and this request must be invoked before 478 | * committing the popup's initial state. 479 | * 480 | * See the documentation of xdg_popup for more details about what 481 | * an xdg_popup is and how it is used. 482 | */ 483 | void (*get_popup)(struct wl_client *client, 484 | struct wl_resource *resource, 485 | struct wl_resource *popup); 486 | /** 487 | * ack a configure event 488 | * 489 | * When a configure event is received, if a client commits the 490 | * surface in response to the configure event, then the client must 491 | * make an ack_configure request sometime before the commit 492 | * request, passing along the serial of the configure event. 493 | * 494 | * If the client receives multiple configure events before it can 495 | * respond to one, it only has to ack the last configure event. 496 | * 497 | * A client is not required to commit immediately after sending an 498 | * ack_configure request - it may even ack_configure several times 499 | * before its next surface commit. 500 | * 501 | * A client may send multiple ack_configure requests before 502 | * committing, but only the last request sent before a commit 503 | * indicates which configure event the client really is responding 504 | * to. 505 | * @param serial the serial from the configure event 506 | */ 507 | void (*ack_configure)(struct wl_client *client, 508 | struct wl_resource *resource, 509 | uint32_t serial); 510 | /** 511 | * destroy the layer_surface 512 | * 513 | * This request destroys the layer surface. 514 | */ 515 | void (*destroy)(struct wl_client *client, 516 | struct wl_resource *resource); 517 | /** 518 | * change the layer of the surface 519 | * 520 | * Change the layer that the surface is rendered on. 521 | * 522 | * Layer is double-buffered, see wl_surface.commit. 523 | * @param layer layer to move this surface to 524 | * @since 2 525 | */ 526 | void (*set_layer)(struct wl_client *client, 527 | struct wl_resource *resource, 528 | uint32_t layer); 529 | }; 530 | 531 | #define ZWLR_LAYER_SURFACE_V1_CONFIGURE 0 532 | #define ZWLR_LAYER_SURFACE_V1_CLOSED 1 533 | 534 | /** 535 | * @ingroup iface_zwlr_layer_surface_v1 536 | */ 537 | #define ZWLR_LAYER_SURFACE_V1_CONFIGURE_SINCE_VERSION 1 538 | /** 539 | * @ingroup iface_zwlr_layer_surface_v1 540 | */ 541 | #define ZWLR_LAYER_SURFACE_V1_CLOSED_SINCE_VERSION 1 542 | 543 | /** 544 | * @ingroup iface_zwlr_layer_surface_v1 545 | */ 546 | #define ZWLR_LAYER_SURFACE_V1_SET_SIZE_SINCE_VERSION 1 547 | /** 548 | * @ingroup iface_zwlr_layer_surface_v1 549 | */ 550 | #define ZWLR_LAYER_SURFACE_V1_SET_ANCHOR_SINCE_VERSION 1 551 | /** 552 | * @ingroup iface_zwlr_layer_surface_v1 553 | */ 554 | #define ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE_SINCE_VERSION 1 555 | /** 556 | * @ingroup iface_zwlr_layer_surface_v1 557 | */ 558 | #define ZWLR_LAYER_SURFACE_V1_SET_MARGIN_SINCE_VERSION 1 559 | /** 560 | * @ingroup iface_zwlr_layer_surface_v1 561 | */ 562 | #define ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY_SINCE_VERSION 1 563 | /** 564 | * @ingroup iface_zwlr_layer_surface_v1 565 | */ 566 | #define ZWLR_LAYER_SURFACE_V1_GET_POPUP_SINCE_VERSION 1 567 | /** 568 | * @ingroup iface_zwlr_layer_surface_v1 569 | */ 570 | #define ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE_SINCE_VERSION 1 571 | /** 572 | * @ingroup iface_zwlr_layer_surface_v1 573 | */ 574 | #define ZWLR_LAYER_SURFACE_V1_DESTROY_SINCE_VERSION 1 575 | /** 576 | * @ingroup iface_zwlr_layer_surface_v1 577 | */ 578 | #define ZWLR_LAYER_SURFACE_V1_SET_LAYER_SINCE_VERSION 2 579 | 580 | /** 581 | * @ingroup iface_zwlr_layer_surface_v1 582 | * Sends an configure event to the client owning the resource. 583 | * @param resource_ The client's resource 584 | */ 585 | static inline void 586 | zwlr_layer_surface_v1_send_configure(struct wl_resource *resource_, uint32_t serial, uint32_t width, uint32_t height) 587 | { 588 | wl_resource_post_event(resource_, ZWLR_LAYER_SURFACE_V1_CONFIGURE, serial, width, height); 589 | } 590 | 591 | /** 592 | * @ingroup iface_zwlr_layer_surface_v1 593 | * Sends an closed event to the client owning the resource. 594 | * @param resource_ The client's resource 595 | */ 596 | static inline void 597 | zwlr_layer_surface_v1_send_closed(struct wl_resource *resource_) 598 | { 599 | wl_resource_post_event(resource_, ZWLR_LAYER_SURFACE_V1_CLOSED); 600 | } 601 | 602 | #ifdef __cplusplus 603 | } 604 | #endif 605 | 606 | #endif 607 | -------------------------------------------------------------------------------- /include/wlr_foreign_toplevel_management_v1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This an unstable interface of wlroots. No guarantees are made regarding the 3 | * future consistency of this API. 4 | */ 5 | #ifndef WLR_USE_UNSTABLE 6 | #error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" 7 | #endif 8 | 9 | #ifndef WLR_TYPES_WLR_FOREIGN_TOPLEVEL_MANAGEMENT_V1_H 10 | #define WLR_TYPES_WLR_FOREIGN_TOPLEVEL_MANAGEMENT_V1_H 11 | 12 | #include 13 | #include 14 | 15 | struct wlr_foreign_toplevel_manager_v1 { 16 | struct wl_event_loop *event_loop; 17 | struct wl_global *global; 18 | struct wl_list resources; // wl_resource_get_link 19 | struct wl_list toplevels; // wlr_foreign_toplevel_handle_v1::link 20 | 21 | struct wl_listener display_destroy; 22 | 23 | struct { 24 | struct wl_signal destroy; 25 | } events; 26 | 27 | void *data; 28 | }; 29 | 30 | enum wlr_foreign_toplevel_handle_v1_state { 31 | WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED = (1 << 0), 32 | WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED = (1 << 1), 33 | WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED = (1 << 2), 34 | WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN = (1 << 3), 35 | }; 36 | 37 | struct wlr_foreign_toplevel_handle_v1_output { 38 | struct wl_list link; // wlr_foreign_toplevel_handle_v1::outputs 39 | struct wlr_output *output; 40 | struct wlr_foreign_toplevel_handle_v1 *toplevel; 41 | 42 | // private state 43 | 44 | struct wl_listener output_bind; 45 | struct wl_listener output_destroy; 46 | }; 47 | 48 | struct wlr_foreign_toplevel_handle_v1 { 49 | struct wlr_foreign_toplevel_manager_v1 *manager; 50 | struct wl_list resources; 51 | struct wl_list link; 52 | struct wl_event_source *idle_source; 53 | 54 | char *title; 55 | char *app_id; 56 | struct wlr_foreign_toplevel_handle_v1 *parent; 57 | struct wl_list outputs; // wlr_foreign_toplevel_v1_output 58 | uint32_t state; // wlr_foreign_toplevel_v1_state 59 | 60 | struct { 61 | // wlr_foreign_toplevel_handle_v1_maximized_event 62 | struct wl_signal request_maximize; 63 | //wlr_foreign_toplevel_handle_v1_minimized_event 64 | struct wl_signal request_minimize; 65 | //wlr_foreign_toplevel_handle_v1_activated_event 66 | struct wl_signal request_activate; 67 | //wlr_foreign_toplevel_handle_v1_fullscreen_event 68 | struct wl_signal request_fullscreen; 69 | struct wl_signal request_close; 70 | 71 | //wlr_foreign_toplevel_handle_v1_set_rectangle_event 72 | struct wl_signal set_rectangle; 73 | struct wl_signal destroy; 74 | } events; 75 | 76 | void *data; 77 | }; 78 | 79 | struct wlr_foreign_toplevel_handle_v1_maximized_event { 80 | struct wlr_foreign_toplevel_handle_v1 *toplevel; 81 | bool maximized; 82 | }; 83 | 84 | struct wlr_foreign_toplevel_handle_v1_minimized_event { 85 | struct wlr_foreign_toplevel_handle_v1 *toplevel; 86 | bool minimized; 87 | }; 88 | 89 | struct wlr_foreign_toplevel_handle_v1_activated_event { 90 | struct wlr_foreign_toplevel_handle_v1 *toplevel; 91 | struct wlr_seat *seat; 92 | }; 93 | 94 | struct wlr_foreign_toplevel_handle_v1_fullscreen_event { 95 | struct wlr_foreign_toplevel_handle_v1 *toplevel; 96 | bool fullscreen; 97 | struct wlr_output *output; 98 | }; 99 | 100 | struct wlr_foreign_toplevel_handle_v1_set_rectangle_event { 101 | struct wlr_foreign_toplevel_handle_v1 *toplevel; 102 | struct wlr_surface *surface; 103 | int32_t x, y, width, height; 104 | }; 105 | 106 | struct wlr_foreign_toplevel_manager_v1 *wlr_foreign_toplevel_manager_v1_create( 107 | struct wl_display *display); 108 | 109 | struct wlr_foreign_toplevel_handle_v1 *wlr_foreign_toplevel_handle_v1_create( 110 | struct wlr_foreign_toplevel_manager_v1 *manager); 111 | /* Destroy the given toplevel handle, sending the closed event to any 112 | * client. Also, if the destroyed toplevel is set as a parent of any 113 | * other valid toplevel, clients still holding a handle to both are 114 | * sent a parent signal with NULL parent. If this is not desired, the 115 | * caller should ensure that any child toplevels are destroyed before 116 | * the parent. */ 117 | void wlr_foreign_toplevel_handle_v1_destroy( 118 | struct wlr_foreign_toplevel_handle_v1 *toplevel); 119 | 120 | void wlr_foreign_toplevel_handle_v1_set_title( 121 | struct wlr_foreign_toplevel_handle_v1 *toplevel, const char *title); 122 | void wlr_foreign_toplevel_handle_v1_set_app_id( 123 | struct wlr_foreign_toplevel_handle_v1 *toplevel, const char *app_id); 124 | 125 | void wlr_foreign_toplevel_handle_v1_output_enter( 126 | struct wlr_foreign_toplevel_handle_v1 *toplevel, struct wlr_output *output); 127 | void wlr_foreign_toplevel_handle_v1_output_leave( 128 | struct wlr_foreign_toplevel_handle_v1 *toplevel, struct wlr_output *output); 129 | 130 | void wlr_foreign_toplevel_handle_v1_set_maximized( 131 | struct wlr_foreign_toplevel_handle_v1 *toplevel, bool maximized); 132 | void wlr_foreign_toplevel_handle_v1_set_minimized( 133 | struct wlr_foreign_toplevel_handle_v1 *toplevel, bool minimized); 134 | void wlr_foreign_toplevel_handle_v1_set_activated( 135 | struct wlr_foreign_toplevel_handle_v1 *toplevel, bool activated); 136 | void wlr_foreign_toplevel_handle_v1_set_fullscreen( 137 | struct wlr_foreign_toplevel_handle_v1* toplevel, bool fullscreen); 138 | 139 | /* Set the parent of a toplevel. If the parent changed from its previous 140 | * value, also sends a parent event to all clients that hold handles to 141 | * both toplevel and parent (no message is sent to clients that have 142 | * previously destroyed their parent handle). NULL is allowed as the 143 | * parent, meaning no parent exists. */ 144 | void wlr_foreign_toplevel_handle_v1_set_parent( 145 | struct wlr_foreign_toplevel_handle_v1 *toplevel, 146 | struct wlr_foreign_toplevel_handle_v1 *parent); 147 | 148 | 149 | #endif 150 | -------------------------------------------------------------------------------- /include/xdg-shell-protocol.h: -------------------------------------------------------------------------------- 1 | /* Generated by wayland-scanner 1.21.0 */ 2 | 3 | #ifndef XDG_SHELL_SERVER_PROTOCOL_H 4 | #define XDG_SHELL_SERVER_PROTOCOL_H 5 | 6 | #include 7 | #include 8 | #include "wayland-server.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | struct wl_client; 15 | struct wl_resource; 16 | 17 | /** 18 | * @page page_xdg_shell The xdg_shell protocol 19 | * @section page_ifaces_xdg_shell Interfaces 20 | * - @subpage page_iface_xdg_wm_base - create desktop-style surfaces 21 | * - @subpage page_iface_xdg_positioner - child surface positioner 22 | * - @subpage page_iface_xdg_surface - desktop user interface surface base interface 23 | * - @subpage page_iface_xdg_toplevel - toplevel surface 24 | * - @subpage page_iface_xdg_popup - short-lived, popup surfaces for menus 25 | * @section page_copyright_xdg_shell Copyright 26 | *
  27 |  *
  28 |  * Copyright © 2008-2013 Kristian Høgsberg
  29 |  * Copyright © 2013      Rafael Antognolli
  30 |  * Copyright © 2013      Jasper St. Pierre
  31 |  * Copyright © 2010-2013 Intel Corporation
  32 |  * Copyright © 2015-2017 Samsung Electronics Co., Ltd
  33 |  * Copyright © 2015-2017 Red Hat Inc.
  34 |  *
  35 |  * Permission is hereby granted, free of charge, to any person obtaining a
  36 |  * copy of this software and associated documentation files (the "Software"),
  37 |  * to deal in the Software without restriction, including without limitation
  38 |  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  39 |  * and/or sell copies of the Software, and to permit persons to whom the
  40 |  * Software is furnished to do so, subject to the following conditions:
  41 |  *
  42 |  * The above copyright notice and this permission notice (including the next
  43 |  * paragraph) shall be included in all copies or substantial portions of the
  44 |  * Software.
  45 |  *
  46 |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47 |  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48 |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  49 |  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50 |  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  51 |  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  52 |  * DEALINGS IN THE SOFTWARE.
  53 |  * 
54 | */ 55 | struct wl_output; 56 | struct wl_seat; 57 | struct wl_surface; 58 | struct xdg_popup; 59 | struct xdg_positioner; 60 | struct xdg_surface; 61 | struct xdg_toplevel; 62 | struct xdg_wm_base; 63 | 64 | #ifndef XDG_WM_BASE_INTERFACE 65 | #define XDG_WM_BASE_INTERFACE 66 | /** 67 | * @page page_iface_xdg_wm_base xdg_wm_base 68 | * @section page_iface_xdg_wm_base_desc Description 69 | * 70 | * The xdg_wm_base interface is exposed as a global object enabling clients 71 | * to turn their wl_surfaces into windows in a desktop environment. It 72 | * defines the basic functionality needed for clients and the compositor to 73 | * create windows that can be dragged, resized, maximized, etc, as well as 74 | * creating transient windows such as popup menus. 75 | * @section page_iface_xdg_wm_base_api API 76 | * See @ref iface_xdg_wm_base. 77 | */ 78 | /** 79 | * @defgroup iface_xdg_wm_base The xdg_wm_base interface 80 | * 81 | * The xdg_wm_base interface is exposed as a global object enabling clients 82 | * to turn their wl_surfaces into windows in a desktop environment. It 83 | * defines the basic functionality needed for clients and the compositor to 84 | * create windows that can be dragged, resized, maximized, etc, as well as 85 | * creating transient windows such as popup menus. 86 | */ 87 | extern const struct wl_interface xdg_wm_base_interface; 88 | #endif 89 | #ifndef XDG_POSITIONER_INTERFACE 90 | #define XDG_POSITIONER_INTERFACE 91 | /** 92 | * @page page_iface_xdg_positioner xdg_positioner 93 | * @section page_iface_xdg_positioner_desc Description 94 | * 95 | * The xdg_positioner provides a collection of rules for the placement of a 96 | * child surface relative to a parent surface. Rules can be defined to ensure 97 | * the child surface remains within the visible area's borders, and to 98 | * specify how the child surface changes its position, such as sliding along 99 | * an axis, or flipping around a rectangle. These positioner-created rules are 100 | * constrained by the requirement that a child surface must intersect with or 101 | * be at least partially adjacent to its parent surface. 102 | * 103 | * See the various requests for details about possible rules. 104 | * 105 | * At the time of the request, the compositor makes a copy of the rules 106 | * specified by the xdg_positioner. Thus, after the request is complete the 107 | * xdg_positioner object can be destroyed or reused; further changes to the 108 | * object will have no effect on previous usages. 109 | * 110 | * For an xdg_positioner object to be considered complete, it must have a 111 | * non-zero size set by set_size, and a non-zero anchor rectangle set by 112 | * set_anchor_rect. Passing an incomplete xdg_positioner object when 113 | * positioning a surface raises an invalid_positioner error. 114 | * @section page_iface_xdg_positioner_api API 115 | * See @ref iface_xdg_positioner. 116 | */ 117 | /** 118 | * @defgroup iface_xdg_positioner The xdg_positioner interface 119 | * 120 | * The xdg_positioner provides a collection of rules for the placement of a 121 | * child surface relative to a parent surface. Rules can be defined to ensure 122 | * the child surface remains within the visible area's borders, and to 123 | * specify how the child surface changes its position, such as sliding along 124 | * an axis, or flipping around a rectangle. These positioner-created rules are 125 | * constrained by the requirement that a child surface must intersect with or 126 | * be at least partially adjacent to its parent surface. 127 | * 128 | * See the various requests for details about possible rules. 129 | * 130 | * At the time of the request, the compositor makes a copy of the rules 131 | * specified by the xdg_positioner. Thus, after the request is complete the 132 | * xdg_positioner object can be destroyed or reused; further changes to the 133 | * object will have no effect on previous usages. 134 | * 135 | * For an xdg_positioner object to be considered complete, it must have a 136 | * non-zero size set by set_size, and a non-zero anchor rectangle set by 137 | * set_anchor_rect. Passing an incomplete xdg_positioner object when 138 | * positioning a surface raises an invalid_positioner error. 139 | */ 140 | extern const struct wl_interface xdg_positioner_interface; 141 | #endif 142 | #ifndef XDG_SURFACE_INTERFACE 143 | #define XDG_SURFACE_INTERFACE 144 | /** 145 | * @page page_iface_xdg_surface xdg_surface 146 | * @section page_iface_xdg_surface_desc Description 147 | * 148 | * An interface that may be implemented by a wl_surface, for 149 | * implementations that provide a desktop-style user interface. 150 | * 151 | * It provides a base set of functionality required to construct user 152 | * interface elements requiring management by the compositor, such as 153 | * toplevel windows, menus, etc. The types of functionality are split into 154 | * xdg_surface roles. 155 | * 156 | * Creating an xdg_surface does not set the role for a wl_surface. In order 157 | * to map an xdg_surface, the client must create a role-specific object 158 | * using, e.g., get_toplevel, get_popup. The wl_surface for any given 159 | * xdg_surface can have at most one role, and may not be assigned any role 160 | * not based on xdg_surface. 161 | * 162 | * A role must be assigned before any other requests are made to the 163 | * xdg_surface object. 164 | * 165 | * The client must call wl_surface.commit on the corresponding wl_surface 166 | * for the xdg_surface state to take effect. 167 | * 168 | * Creating an xdg_surface from a wl_surface which has a buffer attached or 169 | * committed is a client error, and any attempts by a client to attach or 170 | * manipulate a buffer prior to the first xdg_surface.configure call must 171 | * also be treated as errors. 172 | * 173 | * After creating a role-specific object and setting it up, the client must 174 | * perform an initial commit without any buffer attached. The compositor 175 | * will reply with initial wl_surface state such as 176 | * wl_surface.preferred_buffer_scale followed by an xdg_surface.configure 177 | * event. The client must acknowledge it and is then allowed to attach a 178 | * buffer to map the surface. 179 | * 180 | * Mapping an xdg_surface-based role surface is defined as making it 181 | * possible for the surface to be shown by the compositor. Note that 182 | * a mapped surface is not guaranteed to be visible once it is mapped. 183 | * 184 | * For an xdg_surface to be mapped by the compositor, the following 185 | * conditions must be met: 186 | * (1) the client has assigned an xdg_surface-based role to the surface 187 | * (2) the client has set and committed the xdg_surface state and the 188 | * role-dependent state to the surface 189 | * (3) the client has committed a buffer to the surface 190 | * 191 | * A newly-unmapped surface is considered to have met condition (1) out 192 | * of the 3 required conditions for mapping a surface if its role surface 193 | * has not been destroyed, i.e. the client must perform the initial commit 194 | * again before attaching a buffer. 195 | * @section page_iface_xdg_surface_api API 196 | * See @ref iface_xdg_surface. 197 | */ 198 | /** 199 | * @defgroup iface_xdg_surface The xdg_surface interface 200 | * 201 | * An interface that may be implemented by a wl_surface, for 202 | * implementations that provide a desktop-style user interface. 203 | * 204 | * It provides a base set of functionality required to construct user 205 | * interface elements requiring management by the compositor, such as 206 | * toplevel windows, menus, etc. The types of functionality are split into 207 | * xdg_surface roles. 208 | * 209 | * Creating an xdg_surface does not set the role for a wl_surface. In order 210 | * to map an xdg_surface, the client must create a role-specific object 211 | * using, e.g., get_toplevel, get_popup. The wl_surface for any given 212 | * xdg_surface can have at most one role, and may not be assigned any role 213 | * not based on xdg_surface. 214 | * 215 | * A role must be assigned before any other requests are made to the 216 | * xdg_surface object. 217 | * 218 | * The client must call wl_surface.commit on the corresponding wl_surface 219 | * for the xdg_surface state to take effect. 220 | * 221 | * Creating an xdg_surface from a wl_surface which has a buffer attached or 222 | * committed is a client error, and any attempts by a client to attach or 223 | * manipulate a buffer prior to the first xdg_surface.configure call must 224 | * also be treated as errors. 225 | * 226 | * After creating a role-specific object and setting it up, the client must 227 | * perform an initial commit without any buffer attached. The compositor 228 | * will reply with initial wl_surface state such as 229 | * wl_surface.preferred_buffer_scale followed by an xdg_surface.configure 230 | * event. The client must acknowledge it and is then allowed to attach a 231 | * buffer to map the surface. 232 | * 233 | * Mapping an xdg_surface-based role surface is defined as making it 234 | * possible for the surface to be shown by the compositor. Note that 235 | * a mapped surface is not guaranteed to be visible once it is mapped. 236 | * 237 | * For an xdg_surface to be mapped by the compositor, the following 238 | * conditions must be met: 239 | * (1) the client has assigned an xdg_surface-based role to the surface 240 | * (2) the client has set and committed the xdg_surface state and the 241 | * role-dependent state to the surface 242 | * (3) the client has committed a buffer to the surface 243 | * 244 | * A newly-unmapped surface is considered to have met condition (1) out 245 | * of the 3 required conditions for mapping a surface if its role surface 246 | * has not been destroyed, i.e. the client must perform the initial commit 247 | * again before attaching a buffer. 248 | */ 249 | extern const struct wl_interface xdg_surface_interface; 250 | #endif 251 | #ifndef XDG_TOPLEVEL_INTERFACE 252 | #define XDG_TOPLEVEL_INTERFACE 253 | /** 254 | * @page page_iface_xdg_toplevel xdg_toplevel 255 | * @section page_iface_xdg_toplevel_desc Description 256 | * 257 | * This interface defines an xdg_surface role which allows a surface to, 258 | * among other things, set window-like properties such as maximize, 259 | * fullscreen, and minimize, set application-specific metadata like title and 260 | * id, and well as trigger user interactive operations such as interactive 261 | * resize and move. 262 | * 263 | * A xdg_toplevel by default is responsible for providing the full intended 264 | * visual representation of the toplevel, which depending on the window 265 | * state, may mean things like a title bar, window controls and drop shadow. 266 | * 267 | * Unmapping an xdg_toplevel means that the surface cannot be shown 268 | * by the compositor until it is explicitly mapped again. 269 | * All active operations (e.g., move, resize) are canceled and all 270 | * attributes (e.g. title, state, stacking, ...) are discarded for 271 | * an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to 272 | * the state it had right after xdg_surface.get_toplevel. The client 273 | * can re-map the toplevel by perfoming a commit without any buffer 274 | * attached, waiting for a configure event and handling it as usual (see 275 | * xdg_surface description). 276 | * 277 | * Attaching a null buffer to a toplevel unmaps the surface. 278 | * @section page_iface_xdg_toplevel_api API 279 | * See @ref iface_xdg_toplevel. 280 | */ 281 | /** 282 | * @defgroup iface_xdg_toplevel The xdg_toplevel interface 283 | * 284 | * This interface defines an xdg_surface role which allows a surface to, 285 | * among other things, set window-like properties such as maximize, 286 | * fullscreen, and minimize, set application-specific metadata like title and 287 | * id, and well as trigger user interactive operations such as interactive 288 | * resize and move. 289 | * 290 | * A xdg_toplevel by default is responsible for providing the full intended 291 | * visual representation of the toplevel, which depending on the window 292 | * state, may mean things like a title bar, window controls and drop shadow. 293 | * 294 | * Unmapping an xdg_toplevel means that the surface cannot be shown 295 | * by the compositor until it is explicitly mapped again. 296 | * All active operations (e.g., move, resize) are canceled and all 297 | * attributes (e.g. title, state, stacking, ...) are discarded for 298 | * an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to 299 | * the state it had right after xdg_surface.get_toplevel. The client 300 | * can re-map the toplevel by perfoming a commit without any buffer 301 | * attached, waiting for a configure event and handling it as usual (see 302 | * xdg_surface description). 303 | * 304 | * Attaching a null buffer to a toplevel unmaps the surface. 305 | */ 306 | extern const struct wl_interface xdg_toplevel_interface; 307 | #endif 308 | #ifndef XDG_POPUP_INTERFACE 309 | #define XDG_POPUP_INTERFACE 310 | /** 311 | * @page page_iface_xdg_popup xdg_popup 312 | * @section page_iface_xdg_popup_desc Description 313 | * 314 | * A popup surface is a short-lived, temporary surface. It can be used to 315 | * implement for example menus, popovers, tooltips and other similar user 316 | * interface concepts. 317 | * 318 | * A popup can be made to take an explicit grab. See xdg_popup.grab for 319 | * details. 320 | * 321 | * When the popup is dismissed, a popup_done event will be sent out, and at 322 | * the same time the surface will be unmapped. See the xdg_popup.popup_done 323 | * event for details. 324 | * 325 | * Explicitly destroying the xdg_popup object will also dismiss the popup and 326 | * unmap the surface. Clients that want to dismiss the popup when another 327 | * surface of their own is clicked should dismiss the popup using the destroy 328 | * request. 329 | * 330 | * A newly created xdg_popup will be stacked on top of all previously created 331 | * xdg_popup surfaces associated with the same xdg_toplevel. 332 | * 333 | * The parent of an xdg_popup must be mapped (see the xdg_surface 334 | * description) before the xdg_popup itself. 335 | * 336 | * The client must call wl_surface.commit on the corresponding wl_surface 337 | * for the xdg_popup state to take effect. 338 | * @section page_iface_xdg_popup_api API 339 | * See @ref iface_xdg_popup. 340 | */ 341 | /** 342 | * @defgroup iface_xdg_popup The xdg_popup interface 343 | * 344 | * A popup surface is a short-lived, temporary surface. It can be used to 345 | * implement for example menus, popovers, tooltips and other similar user 346 | * interface concepts. 347 | * 348 | * A popup can be made to take an explicit grab. See xdg_popup.grab for 349 | * details. 350 | * 351 | * When the popup is dismissed, a popup_done event will be sent out, and at 352 | * the same time the surface will be unmapped. See the xdg_popup.popup_done 353 | * event for details. 354 | * 355 | * Explicitly destroying the xdg_popup object will also dismiss the popup and 356 | * unmap the surface. Clients that want to dismiss the popup when another 357 | * surface of their own is clicked should dismiss the popup using the destroy 358 | * request. 359 | * 360 | * A newly created xdg_popup will be stacked on top of all previously created 361 | * xdg_popup surfaces associated with the same xdg_toplevel. 362 | * 363 | * The parent of an xdg_popup must be mapped (see the xdg_surface 364 | * description) before the xdg_popup itself. 365 | * 366 | * The client must call wl_surface.commit on the corresponding wl_surface 367 | * for the xdg_popup state to take effect. 368 | */ 369 | extern const struct wl_interface xdg_popup_interface; 370 | #endif 371 | 372 | #ifndef XDG_WM_BASE_ERROR_ENUM 373 | #define XDG_WM_BASE_ERROR_ENUM 374 | enum xdg_wm_base_error { 375 | /** 376 | * given wl_surface has another role 377 | */ 378 | XDG_WM_BASE_ERROR_ROLE = 0, 379 | /** 380 | * xdg_wm_base was destroyed before children 381 | */ 382 | XDG_WM_BASE_ERROR_DEFUNCT_SURFACES = 1, 383 | /** 384 | * the client tried to map or destroy a non-topmost popup 385 | */ 386 | XDG_WM_BASE_ERROR_NOT_THE_TOPMOST_POPUP = 2, 387 | /** 388 | * the client specified an invalid popup parent surface 389 | */ 390 | XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT = 3, 391 | /** 392 | * the client provided an invalid surface state 393 | */ 394 | XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE = 4, 395 | /** 396 | * the client provided an invalid positioner 397 | */ 398 | XDG_WM_BASE_ERROR_INVALID_POSITIONER = 5, 399 | /** 400 | * the client didn’t respond to a ping event in time 401 | */ 402 | XDG_WM_BASE_ERROR_UNRESPONSIVE = 6, 403 | }; 404 | #endif /* XDG_WM_BASE_ERROR_ENUM */ 405 | 406 | /** 407 | * @ingroup iface_xdg_wm_base 408 | * @struct xdg_wm_base_interface 409 | */ 410 | struct xdg_wm_base_interface { 411 | /** 412 | * destroy xdg_wm_base 413 | * 414 | * Destroy this xdg_wm_base object. 415 | * 416 | * Destroying a bound xdg_wm_base object while there are surfaces 417 | * still alive created by this xdg_wm_base object instance is 418 | * illegal and will result in a defunct_surfaces error. 419 | */ 420 | void (*destroy)(struct wl_client *client, 421 | struct wl_resource *resource); 422 | /** 423 | * create a positioner object 424 | * 425 | * Create a positioner object. A positioner object is used to 426 | * position surfaces relative to some parent surface. See the 427 | * interface description and xdg_surface.get_popup for details. 428 | */ 429 | void (*create_positioner)(struct wl_client *client, 430 | struct wl_resource *resource, 431 | uint32_t id); 432 | /** 433 | * create a shell surface from a surface 434 | * 435 | * This creates an xdg_surface for the given surface. While 436 | * xdg_surface itself is not a role, the corresponding surface may 437 | * only be assigned a role extending xdg_surface, such as 438 | * xdg_toplevel or xdg_popup. It is illegal to create an 439 | * xdg_surface for a wl_surface which already has an assigned role 440 | * and this will result in a role error. 441 | * 442 | * This creates an xdg_surface for the given surface. An 443 | * xdg_surface is used as basis to define a role to a given 444 | * surface, such as xdg_toplevel or xdg_popup. It also manages 445 | * functionality shared between xdg_surface based surface roles. 446 | * 447 | * See the documentation of xdg_surface for more details about what 448 | * an xdg_surface is and how it is used. 449 | */ 450 | void (*get_xdg_surface)(struct wl_client *client, 451 | struct wl_resource *resource, 452 | uint32_t id, 453 | struct wl_resource *surface); 454 | /** 455 | * respond to a ping event 456 | * 457 | * A client must respond to a ping event with a pong request or 458 | * the client may be deemed unresponsive. See xdg_wm_base.ping and 459 | * xdg_wm_base.error.unresponsive. 460 | * @param serial serial of the ping event 461 | */ 462 | void (*pong)(struct wl_client *client, 463 | struct wl_resource *resource, 464 | uint32_t serial); 465 | }; 466 | 467 | #define XDG_WM_BASE_PING 0 468 | 469 | /** 470 | * @ingroup iface_xdg_wm_base 471 | */ 472 | #define XDG_WM_BASE_PING_SINCE_VERSION 1 473 | 474 | /** 475 | * @ingroup iface_xdg_wm_base 476 | */ 477 | #define XDG_WM_BASE_DESTROY_SINCE_VERSION 1 478 | /** 479 | * @ingroup iface_xdg_wm_base 480 | */ 481 | #define XDG_WM_BASE_CREATE_POSITIONER_SINCE_VERSION 1 482 | /** 483 | * @ingroup iface_xdg_wm_base 484 | */ 485 | #define XDG_WM_BASE_GET_XDG_SURFACE_SINCE_VERSION 1 486 | /** 487 | * @ingroup iface_xdg_wm_base 488 | */ 489 | #define XDG_WM_BASE_PONG_SINCE_VERSION 1 490 | 491 | /** 492 | * @ingroup iface_xdg_wm_base 493 | * Sends an ping event to the client owning the resource. 494 | * @param resource_ The client's resource 495 | * @param serial pass this to the pong request 496 | */ 497 | static inline void 498 | xdg_wm_base_send_ping(struct wl_resource *resource_, uint32_t serial) 499 | { 500 | wl_resource_post_event(resource_, XDG_WM_BASE_PING, serial); 501 | } 502 | 503 | #ifndef XDG_POSITIONER_ERROR_ENUM 504 | #define XDG_POSITIONER_ERROR_ENUM 505 | enum xdg_positioner_error { 506 | /** 507 | * invalid input provided 508 | */ 509 | XDG_POSITIONER_ERROR_INVALID_INPUT = 0, 510 | }; 511 | #endif /* XDG_POSITIONER_ERROR_ENUM */ 512 | 513 | #ifndef XDG_POSITIONER_ANCHOR_ENUM 514 | #define XDG_POSITIONER_ANCHOR_ENUM 515 | enum xdg_positioner_anchor { 516 | XDG_POSITIONER_ANCHOR_NONE = 0, 517 | XDG_POSITIONER_ANCHOR_TOP = 1, 518 | XDG_POSITIONER_ANCHOR_BOTTOM = 2, 519 | XDG_POSITIONER_ANCHOR_LEFT = 3, 520 | XDG_POSITIONER_ANCHOR_RIGHT = 4, 521 | XDG_POSITIONER_ANCHOR_TOP_LEFT = 5, 522 | XDG_POSITIONER_ANCHOR_BOTTOM_LEFT = 6, 523 | XDG_POSITIONER_ANCHOR_TOP_RIGHT = 7, 524 | XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT = 8, 525 | }; 526 | #endif /* XDG_POSITIONER_ANCHOR_ENUM */ 527 | 528 | #ifndef XDG_POSITIONER_GRAVITY_ENUM 529 | #define XDG_POSITIONER_GRAVITY_ENUM 530 | enum xdg_positioner_gravity { 531 | XDG_POSITIONER_GRAVITY_NONE = 0, 532 | XDG_POSITIONER_GRAVITY_TOP = 1, 533 | XDG_POSITIONER_GRAVITY_BOTTOM = 2, 534 | XDG_POSITIONER_GRAVITY_LEFT = 3, 535 | XDG_POSITIONER_GRAVITY_RIGHT = 4, 536 | XDG_POSITIONER_GRAVITY_TOP_LEFT = 5, 537 | XDG_POSITIONER_GRAVITY_BOTTOM_LEFT = 6, 538 | XDG_POSITIONER_GRAVITY_TOP_RIGHT = 7, 539 | XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT = 8, 540 | }; 541 | #endif /* XDG_POSITIONER_GRAVITY_ENUM */ 542 | 543 | #ifndef XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM 544 | #define XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM 545 | /** 546 | * @ingroup iface_xdg_positioner 547 | * constraint adjustments 548 | * 549 | * The constraint adjustment value define ways the compositor will adjust 550 | * the position of the surface, if the unadjusted position would result 551 | * in the surface being partly constrained. 552 | * 553 | * Whether a surface is considered 'constrained' is left to the compositor 554 | * to determine. For example, the surface may be partly outside the 555 | * compositor's defined 'work area', thus necessitating the child surface's 556 | * position be adjusted until it is entirely inside the work area. 557 | * 558 | * The adjustments can be combined, according to a defined precedence: 1) 559 | * Flip, 2) Slide, 3) Resize. 560 | */ 561 | enum xdg_positioner_constraint_adjustment { 562 | /** 563 | * don't move the child surface when constrained 564 | * 565 | * Don't alter the surface position even if it is constrained on 566 | * some axis, for example partially outside the edge of an output. 567 | */ 568 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE = 0, 569 | /** 570 | * move along the x axis until unconstrained 571 | * 572 | * Slide the surface along the x axis until it is no longer 573 | * constrained. 574 | * 575 | * First try to slide towards the direction of the gravity on the x 576 | * axis until either the edge in the opposite direction of the 577 | * gravity is unconstrained or the edge in the direction of the 578 | * gravity is constrained. 579 | * 580 | * Then try to slide towards the opposite direction of the gravity 581 | * on the x axis until either the edge in the direction of the 582 | * gravity is unconstrained or the edge in the opposite direction 583 | * of the gravity is constrained. 584 | */ 585 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X = 1, 586 | /** 587 | * move along the y axis until unconstrained 588 | * 589 | * Slide the surface along the y axis until it is no longer 590 | * constrained. 591 | * 592 | * First try to slide towards the direction of the gravity on the y 593 | * axis until either the edge in the opposite direction of the 594 | * gravity is unconstrained or the edge in the direction of the 595 | * gravity is constrained. 596 | * 597 | * Then try to slide towards the opposite direction of the gravity 598 | * on the y axis until either the edge in the direction of the 599 | * gravity is unconstrained or the edge in the opposite direction 600 | * of the gravity is constrained. 601 | */ 602 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y = 2, 603 | /** 604 | * invert the anchor and gravity on the x axis 605 | * 606 | * Invert the anchor and gravity on the x axis if the surface is 607 | * constrained on the x axis. For example, if the left edge of the 608 | * surface is constrained, the gravity is 'left' and the anchor is 609 | * 'left', change the gravity to 'right' and the anchor to 'right'. 610 | * 611 | * If the adjusted position also ends up being constrained, the 612 | * resulting position of the flip_x adjustment will be the one 613 | * before the adjustment. 614 | */ 615 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X = 4, 616 | /** 617 | * invert the anchor and gravity on the y axis 618 | * 619 | * Invert the anchor and gravity on the y axis if the surface is 620 | * constrained on the y axis. For example, if the bottom edge of 621 | * the surface is constrained, the gravity is 'bottom' and the 622 | * anchor is 'bottom', change the gravity to 'top' and the anchor 623 | * to 'top'. 624 | * 625 | * The adjusted position is calculated given the original anchor 626 | * rectangle and offset, but with the new flipped anchor and 627 | * gravity values. 628 | * 629 | * If the adjusted position also ends up being constrained, the 630 | * resulting position of the flip_y adjustment will be the one 631 | * before the adjustment. 632 | */ 633 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y = 8, 634 | /** 635 | * horizontally resize the surface 636 | * 637 | * Resize the surface horizontally so that it is completely 638 | * unconstrained. 639 | */ 640 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X = 16, 641 | /** 642 | * vertically resize the surface 643 | * 644 | * Resize the surface vertically so that it is completely 645 | * unconstrained. 646 | */ 647 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 32, 648 | }; 649 | #endif /* XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM */ 650 | 651 | /** 652 | * @ingroup iface_xdg_positioner 653 | * @struct xdg_positioner_interface 654 | */ 655 | struct xdg_positioner_interface { 656 | /** 657 | * destroy the xdg_positioner object 658 | * 659 | * Notify the compositor that the xdg_positioner will no longer 660 | * be used. 661 | */ 662 | void (*destroy)(struct wl_client *client, 663 | struct wl_resource *resource); 664 | /** 665 | * set the size of the to-be positioned rectangle 666 | * 667 | * Set the size of the surface that is to be positioned with the 668 | * positioner object. The size is in surface-local coordinates and 669 | * corresponds to the window geometry. See 670 | * xdg_surface.set_window_geometry. 671 | * 672 | * If a zero or negative size is set the invalid_input error is 673 | * raised. 674 | * @param width width of positioned rectangle 675 | * @param height height of positioned rectangle 676 | */ 677 | void (*set_size)(struct wl_client *client, 678 | struct wl_resource *resource, 679 | int32_t width, 680 | int32_t height); 681 | /** 682 | * set the anchor rectangle within the parent surface 683 | * 684 | * Specify the anchor rectangle within the parent surface that 685 | * the child surface will be placed relative to. The rectangle is 686 | * relative to the window geometry as defined by 687 | * xdg_surface.set_window_geometry of the parent surface. 688 | * 689 | * When the xdg_positioner object is used to position a child 690 | * surface, the anchor rectangle may not extend outside the window 691 | * geometry of the positioned child's parent surface. 692 | * 693 | * If a negative size is set the invalid_input error is raised. 694 | * @param x x position of anchor rectangle 695 | * @param y y position of anchor rectangle 696 | * @param width width of anchor rectangle 697 | * @param height height of anchor rectangle 698 | */ 699 | void (*set_anchor_rect)(struct wl_client *client, 700 | struct wl_resource *resource, 701 | int32_t x, 702 | int32_t y, 703 | int32_t width, 704 | int32_t height); 705 | /** 706 | * set anchor rectangle anchor 707 | * 708 | * Defines the anchor point for the anchor rectangle. The 709 | * specified anchor is used derive an anchor point that the child 710 | * surface will be positioned relative to. If a corner anchor is 711 | * set (e.g. 'top_left' or 'bottom_right'), the anchor point will 712 | * be at the specified corner; otherwise, the derived anchor point 713 | * will be centered on the specified edge, or in the center of the 714 | * anchor rectangle if no edge is specified. 715 | * @param anchor anchor 716 | */ 717 | void (*set_anchor)(struct wl_client *client, 718 | struct wl_resource *resource, 719 | uint32_t anchor); 720 | /** 721 | * set child surface gravity 722 | * 723 | * Defines in what direction a surface should be positioned, 724 | * relative to the anchor point of the parent surface. If a corner 725 | * gravity is specified (e.g. 'bottom_right' or 'top_left'), then 726 | * the child surface will be placed towards the specified gravity; 727 | * otherwise, the child surface will be centered over the anchor 728 | * point on any axis that had no gravity specified. If the gravity 729 | * is not in the ‘gravity’ enum, an invalid_input error is 730 | * raised. 731 | * @param gravity gravity direction 732 | */ 733 | void (*set_gravity)(struct wl_client *client, 734 | struct wl_resource *resource, 735 | uint32_t gravity); 736 | /** 737 | * set the adjustment to be done when constrained 738 | * 739 | * Specify how the window should be positioned if the originally 740 | * intended position caused the surface to be constrained, meaning 741 | * at least partially outside positioning boundaries set by the 742 | * compositor. The adjustment is set by constructing a bitmask 743 | * describing the adjustment to be made when the surface is 744 | * constrained on that axis. 745 | * 746 | * If no bit for one axis is set, the compositor will assume that 747 | * the child surface should not change its position on that axis 748 | * when constrained. 749 | * 750 | * If more than one bit for one axis is set, the order of how 751 | * adjustments are applied is specified in the corresponding 752 | * adjustment descriptions. 753 | * 754 | * The default adjustment is none. 755 | * @param constraint_adjustment bit mask of constraint adjustments 756 | */ 757 | void (*set_constraint_adjustment)(struct wl_client *client, 758 | struct wl_resource *resource, 759 | uint32_t constraint_adjustment); 760 | /** 761 | * set surface position offset 762 | * 763 | * Specify the surface position offset relative to the position 764 | * of the anchor on the anchor rectangle and the anchor on the 765 | * surface. For example if the anchor of the anchor rectangle is at 766 | * (x, y), the surface has the gravity bottom|right, and the offset 767 | * is (ox, oy), the calculated surface position will be (x + ox, y 768 | * + oy). The offset position of the surface is the one used for 769 | * constraint testing. See set_constraint_adjustment. 770 | * 771 | * An example use case is placing a popup menu on top of a user 772 | * interface element, while aligning the user interface element of 773 | * the parent surface with some user interface element placed 774 | * somewhere in the popup surface. 775 | * @param x surface position x offset 776 | * @param y surface position y offset 777 | */ 778 | void (*set_offset)(struct wl_client *client, 779 | struct wl_resource *resource, 780 | int32_t x, 781 | int32_t y); 782 | /** 783 | * continuously reconstrain the surface 784 | * 785 | * When set reactive, the surface is reconstrained if the 786 | * conditions used for constraining changed, e.g. the parent window 787 | * moved. 788 | * 789 | * If the conditions changed and the popup was reconstrained, an 790 | * xdg_popup.configure event is sent with updated geometry, 791 | * followed by an xdg_surface.configure event. 792 | * @since 3 793 | */ 794 | void (*set_reactive)(struct wl_client *client, 795 | struct wl_resource *resource); 796 | /** 797 | * 798 | * 799 | * Set the parent window geometry the compositor should use when 800 | * positioning the popup. The compositor may use this information 801 | * to determine the future state the popup should be constrained 802 | * using. If this doesn't match the dimension of the parent the 803 | * popup is eventually positioned against, the behavior is 804 | * undefined. 805 | * 806 | * The arguments are given in the surface-local coordinate space. 807 | * @param parent_width future window geometry width of parent 808 | * @param parent_height future window geometry height of parent 809 | * @since 3 810 | */ 811 | void (*set_parent_size)(struct wl_client *client, 812 | struct wl_resource *resource, 813 | int32_t parent_width, 814 | int32_t parent_height); 815 | /** 816 | * set parent configure this is a response to 817 | * 818 | * Set the serial of an xdg_surface.configure event this 819 | * positioner will be used in response to. The compositor may use 820 | * this information together with set_parent_size to determine what 821 | * future state the popup should be constrained using. 822 | * @param serial serial of parent configure event 823 | * @since 3 824 | */ 825 | void (*set_parent_configure)(struct wl_client *client, 826 | struct wl_resource *resource, 827 | uint32_t serial); 828 | }; 829 | 830 | 831 | /** 832 | * @ingroup iface_xdg_positioner 833 | */ 834 | #define XDG_POSITIONER_DESTROY_SINCE_VERSION 1 835 | /** 836 | * @ingroup iface_xdg_positioner 837 | */ 838 | #define XDG_POSITIONER_SET_SIZE_SINCE_VERSION 1 839 | /** 840 | * @ingroup iface_xdg_positioner 841 | */ 842 | #define XDG_POSITIONER_SET_ANCHOR_RECT_SINCE_VERSION 1 843 | /** 844 | * @ingroup iface_xdg_positioner 845 | */ 846 | #define XDG_POSITIONER_SET_ANCHOR_SINCE_VERSION 1 847 | /** 848 | * @ingroup iface_xdg_positioner 849 | */ 850 | #define XDG_POSITIONER_SET_GRAVITY_SINCE_VERSION 1 851 | /** 852 | * @ingroup iface_xdg_positioner 853 | */ 854 | #define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT_SINCE_VERSION 1 855 | /** 856 | * @ingroup iface_xdg_positioner 857 | */ 858 | #define XDG_POSITIONER_SET_OFFSET_SINCE_VERSION 1 859 | /** 860 | * @ingroup iface_xdg_positioner 861 | */ 862 | #define XDG_POSITIONER_SET_REACTIVE_SINCE_VERSION 3 863 | /** 864 | * @ingroup iface_xdg_positioner 865 | */ 866 | #define XDG_POSITIONER_SET_PARENT_SIZE_SINCE_VERSION 3 867 | /** 868 | * @ingroup iface_xdg_positioner 869 | */ 870 | #define XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION 3 871 | 872 | #ifndef XDG_SURFACE_ERROR_ENUM 873 | #define XDG_SURFACE_ERROR_ENUM 874 | enum xdg_surface_error { 875 | /** 876 | * Surface was not fully constructed 877 | */ 878 | XDG_SURFACE_ERROR_NOT_CONSTRUCTED = 1, 879 | /** 880 | * Surface was already constructed 881 | */ 882 | XDG_SURFACE_ERROR_ALREADY_CONSTRUCTED = 2, 883 | /** 884 | * Attaching a buffer to an unconfigured surface 885 | */ 886 | XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER = 3, 887 | /** 888 | * Invalid serial number when acking a configure event 889 | */ 890 | XDG_SURFACE_ERROR_INVALID_SERIAL = 4, 891 | /** 892 | * Width or height was zero or negative 893 | */ 894 | XDG_SURFACE_ERROR_INVALID_SIZE = 5, 895 | /** 896 | * Surface was destroyed before its role object 897 | */ 898 | XDG_SURFACE_ERROR_DEFUNCT_ROLE_OBJECT = 6, 899 | }; 900 | #endif /* XDG_SURFACE_ERROR_ENUM */ 901 | 902 | /** 903 | * @ingroup iface_xdg_surface 904 | * @struct xdg_surface_interface 905 | */ 906 | struct xdg_surface_interface { 907 | /** 908 | * destroy the xdg_surface 909 | * 910 | * Destroy the xdg_surface object. An xdg_surface must only be 911 | * destroyed after its role object has been destroyed, otherwise a 912 | * defunct_role_object error is raised. 913 | */ 914 | void (*destroy)(struct wl_client *client, 915 | struct wl_resource *resource); 916 | /** 917 | * assign the xdg_toplevel surface role 918 | * 919 | * This creates an xdg_toplevel object for the given xdg_surface 920 | * and gives the associated wl_surface the xdg_toplevel role. 921 | * 922 | * See the documentation of xdg_toplevel for more details about 923 | * what an xdg_toplevel is and how it is used. 924 | */ 925 | void (*get_toplevel)(struct wl_client *client, 926 | struct wl_resource *resource, 927 | uint32_t id); 928 | /** 929 | * assign the xdg_popup surface role 930 | * 931 | * This creates an xdg_popup object for the given xdg_surface and 932 | * gives the associated wl_surface the xdg_popup role. 933 | * 934 | * If null is passed as a parent, a parent surface must be 935 | * specified using some other protocol, before committing the 936 | * initial state. 937 | * 938 | * See the documentation of xdg_popup for more details about what 939 | * an xdg_popup is and how it is used. 940 | */ 941 | void (*get_popup)(struct wl_client *client, 942 | struct wl_resource *resource, 943 | uint32_t id, 944 | struct wl_resource *parent, 945 | struct wl_resource *positioner); 946 | /** 947 | * set the new window geometry 948 | * 949 | * The window geometry of a surface is its "visible bounds" from 950 | * the user's perspective. Client-side decorations often have 951 | * invisible portions like drop-shadows which should be ignored for 952 | * the purposes of aligning, placing and constraining windows. 953 | * 954 | * The window geometry is double buffered, and will be applied at 955 | * the time wl_surface.commit of the corresponding wl_surface is 956 | * called. 957 | * 958 | * When maintaining a position, the compositor should treat the (x, 959 | * y) coordinate of the window geometry as the top left corner of 960 | * the window. A client changing the (x, y) window geometry 961 | * coordinate should in general not alter the position of the 962 | * window. 963 | * 964 | * Once the window geometry of the surface is set, it is not 965 | * possible to unset it, and it will remain the same until 966 | * set_window_geometry is called again, even if a new subsurface or 967 | * buffer is attached. 968 | * 969 | * If never set, the value is the full bounds of the surface, 970 | * including any subsurfaces. This updates dynamically on every 971 | * commit. This unset is meant for extremely simple clients. 972 | * 973 | * The arguments are given in the surface-local coordinate space of 974 | * the wl_surface associated with this xdg_surface, and may extend 975 | * outside of the wl_surface itself to mark parts of the subsurface 976 | * tree as part of the window geometry. 977 | * 978 | * When applied, the effective window geometry will be the set 979 | * window geometry clamped to the bounding rectangle of the 980 | * combined geometry of the surface of the xdg_surface and the 981 | * associated subsurfaces. 982 | * 983 | * The effective geometry will not be recalculated unless a new 984 | * call to set_window_geometry is done and the new pending surface 985 | * state is subsequently applied. 986 | * 987 | * The width and height of the effective window geometry must be 988 | * greater than zero. Setting an invalid size will raise an 989 | * invalid_size error. 990 | */ 991 | void (*set_window_geometry)(struct wl_client *client, 992 | struct wl_resource *resource, 993 | int32_t x, 994 | int32_t y, 995 | int32_t width, 996 | int32_t height); 997 | /** 998 | * ack a configure event 999 | * 1000 | * When a configure event is received, if a client commits the 1001 | * surface in response to the configure event, then the client must 1002 | * make an ack_configure request sometime before the commit 1003 | * request, passing along the serial of the configure event. 1004 | * 1005 | * For instance, for toplevel surfaces the compositor might use 1006 | * this information to move a surface to the top left only when the 1007 | * client has drawn itself for the maximized or fullscreen state. 1008 | * 1009 | * If the client receives multiple configure events before it can 1010 | * respond to one, it only has to ack the last configure event. 1011 | * Acking a configure event that was never sent raises an 1012 | * invalid_serial error. 1013 | * 1014 | * A client is not required to commit immediately after sending an 1015 | * ack_configure request - it may even ack_configure several times 1016 | * before its next surface commit. 1017 | * 1018 | * A client may send multiple ack_configure requests before 1019 | * committing, but only the last request sent before a commit 1020 | * indicates which configure event the client really is responding 1021 | * to. 1022 | * 1023 | * Sending an ack_configure request consumes the serial number sent 1024 | * with the request, as well as serial numbers sent by all 1025 | * configure events sent on this xdg_surface prior to the configure 1026 | * event referenced by the committed serial. 1027 | * 1028 | * It is an error to issue multiple ack_configure requests 1029 | * referencing a serial from the same configure event, or to issue 1030 | * an ack_configure request referencing a serial from a configure 1031 | * event issued before the event identified by the last 1032 | * ack_configure request for the same xdg_surface. Doing so will 1033 | * raise an invalid_serial error. 1034 | * @param serial the serial from the configure event 1035 | */ 1036 | void (*ack_configure)(struct wl_client *client, 1037 | struct wl_resource *resource, 1038 | uint32_t serial); 1039 | }; 1040 | 1041 | #define XDG_SURFACE_CONFIGURE 0 1042 | 1043 | /** 1044 | * @ingroup iface_xdg_surface 1045 | */ 1046 | #define XDG_SURFACE_CONFIGURE_SINCE_VERSION 1 1047 | 1048 | /** 1049 | * @ingroup iface_xdg_surface 1050 | */ 1051 | #define XDG_SURFACE_DESTROY_SINCE_VERSION 1 1052 | /** 1053 | * @ingroup iface_xdg_surface 1054 | */ 1055 | #define XDG_SURFACE_GET_TOPLEVEL_SINCE_VERSION 1 1056 | /** 1057 | * @ingroup iface_xdg_surface 1058 | */ 1059 | #define XDG_SURFACE_GET_POPUP_SINCE_VERSION 1 1060 | /** 1061 | * @ingroup iface_xdg_surface 1062 | */ 1063 | #define XDG_SURFACE_SET_WINDOW_GEOMETRY_SINCE_VERSION 1 1064 | /** 1065 | * @ingroup iface_xdg_surface 1066 | */ 1067 | #define XDG_SURFACE_ACK_CONFIGURE_SINCE_VERSION 1 1068 | 1069 | /** 1070 | * @ingroup iface_xdg_surface 1071 | * Sends an configure event to the client owning the resource. 1072 | * @param resource_ The client's resource 1073 | * @param serial serial of the configure event 1074 | */ 1075 | static inline void 1076 | xdg_surface_send_configure(struct wl_resource *resource_, uint32_t serial) 1077 | { 1078 | wl_resource_post_event(resource_, XDG_SURFACE_CONFIGURE, serial); 1079 | } 1080 | 1081 | #ifndef XDG_TOPLEVEL_ERROR_ENUM 1082 | #define XDG_TOPLEVEL_ERROR_ENUM 1083 | enum xdg_toplevel_error { 1084 | /** 1085 | * provided value is not a valid variant of the resize_edge enum 1086 | */ 1087 | XDG_TOPLEVEL_ERROR_INVALID_RESIZE_EDGE = 0, 1088 | /** 1089 | * invalid parent toplevel 1090 | */ 1091 | XDG_TOPLEVEL_ERROR_INVALID_PARENT = 1, 1092 | /** 1093 | * client provided an invalid min or max size 1094 | */ 1095 | XDG_TOPLEVEL_ERROR_INVALID_SIZE = 2, 1096 | }; 1097 | #endif /* XDG_TOPLEVEL_ERROR_ENUM */ 1098 | 1099 | #ifndef XDG_TOPLEVEL_RESIZE_EDGE_ENUM 1100 | #define XDG_TOPLEVEL_RESIZE_EDGE_ENUM 1101 | /** 1102 | * @ingroup iface_xdg_toplevel 1103 | * edge values for resizing 1104 | * 1105 | * These values are used to indicate which edge of a surface 1106 | * is being dragged in a resize operation. 1107 | */ 1108 | enum xdg_toplevel_resize_edge { 1109 | XDG_TOPLEVEL_RESIZE_EDGE_NONE = 0, 1110 | XDG_TOPLEVEL_RESIZE_EDGE_TOP = 1, 1111 | XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM = 2, 1112 | XDG_TOPLEVEL_RESIZE_EDGE_LEFT = 4, 1113 | XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT = 5, 1114 | XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT = 6, 1115 | XDG_TOPLEVEL_RESIZE_EDGE_RIGHT = 8, 1116 | XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT = 9, 1117 | XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT = 10, 1118 | }; 1119 | #endif /* XDG_TOPLEVEL_RESIZE_EDGE_ENUM */ 1120 | 1121 | #ifndef XDG_TOPLEVEL_STATE_ENUM 1122 | #define XDG_TOPLEVEL_STATE_ENUM 1123 | /** 1124 | * @ingroup iface_xdg_toplevel 1125 | * types of state on the surface 1126 | * 1127 | * The different state values used on the surface. This is designed for 1128 | * state values like maximized, fullscreen. It is paired with the 1129 | * configure event to ensure that both the client and the compositor 1130 | * setting the state can be synchronized. 1131 | * 1132 | * States set in this way are double-buffered. They will get applied on 1133 | * the next commit. 1134 | */ 1135 | enum xdg_toplevel_state { 1136 | /** 1137 | * the surface is maximized 1138 | * the surface is maximized 1139 | * 1140 | * The surface is maximized. The window geometry specified in the 1141 | * configure event must be obeyed by the client, or the 1142 | * xdg_wm_base.invalid_surface_state error is raised. 1143 | * 1144 | * The client should draw without shadow or other decoration 1145 | * outside of the window geometry. 1146 | */ 1147 | XDG_TOPLEVEL_STATE_MAXIMIZED = 1, 1148 | /** 1149 | * the surface is fullscreen 1150 | * the surface is fullscreen 1151 | * 1152 | * The surface is fullscreen. The window geometry specified in 1153 | * the configure event is a maximum; the client cannot resize 1154 | * beyond it. For a surface to cover the whole fullscreened area, 1155 | * the geometry dimensions must be obeyed by the client. For more 1156 | * details, see xdg_toplevel.set_fullscreen. 1157 | */ 1158 | XDG_TOPLEVEL_STATE_FULLSCREEN = 2, 1159 | /** 1160 | * the surface is being resized 1161 | * the surface is being resized 1162 | * 1163 | * The surface is being resized. The window geometry specified in 1164 | * the configure event is a maximum; the client cannot resize 1165 | * beyond it. Clients that have aspect ratio or cell sizing 1166 | * configuration can use a smaller size, however. 1167 | */ 1168 | XDG_TOPLEVEL_STATE_RESIZING = 3, 1169 | /** 1170 | * the surface is now activated 1171 | * the surface is now activated 1172 | * 1173 | * Client window decorations should be painted as if the window 1174 | * is active. Do not assume this means that the window actually has 1175 | * keyboard or pointer focus. 1176 | */ 1177 | XDG_TOPLEVEL_STATE_ACTIVATED = 4, 1178 | /** 1179 | * the surface’s left edge is tiled 1180 | * 1181 | * The window is currently in a tiled layout and the left edge is 1182 | * considered to be adjacent to another part of the tiling grid. 1183 | * 1184 | * The client should draw without shadow or other decoration 1185 | * outside of the window geometry on the left edge. 1186 | * @since 2 1187 | */ 1188 | XDG_TOPLEVEL_STATE_TILED_LEFT = 5, 1189 | /** 1190 | * the surface’s right edge is tiled 1191 | * 1192 | * The window is currently in a tiled layout and the right edge 1193 | * is considered to be adjacent to another part of the tiling grid. 1194 | * 1195 | * The client should draw without shadow or other decoration 1196 | * outside of the window geometry on the right edge. 1197 | * @since 2 1198 | */ 1199 | XDG_TOPLEVEL_STATE_TILED_RIGHT = 6, 1200 | /** 1201 | * the surface’s top edge is tiled 1202 | * 1203 | * The window is currently in a tiled layout and the top edge is 1204 | * considered to be adjacent to another part of the tiling grid. 1205 | * 1206 | * The client should draw without shadow or other decoration 1207 | * outside of the window geometry on the top edge. 1208 | * @since 2 1209 | */ 1210 | XDG_TOPLEVEL_STATE_TILED_TOP = 7, 1211 | /** 1212 | * the surface’s bottom edge is tiled 1213 | * 1214 | * The window is currently in a tiled layout and the bottom edge 1215 | * is considered to be adjacent to another part of the tiling grid. 1216 | * 1217 | * The client should draw without shadow or other decoration 1218 | * outside of the window geometry on the bottom edge. 1219 | * @since 2 1220 | */ 1221 | XDG_TOPLEVEL_STATE_TILED_BOTTOM = 8, 1222 | /** 1223 | * surface repaint is suspended 1224 | * 1225 | * The surface is currently not ordinarily being repainted; for 1226 | * example because its content is occluded by another window, or 1227 | * its outputs are switched off due to screen locking. 1228 | * @since 6 1229 | */ 1230 | XDG_TOPLEVEL_STATE_SUSPENDED = 9, 1231 | }; 1232 | /** 1233 | * @ingroup iface_xdg_toplevel 1234 | */ 1235 | #define XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION 2 1236 | /** 1237 | * @ingroup iface_xdg_toplevel 1238 | */ 1239 | #define XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION 2 1240 | /** 1241 | * @ingroup iface_xdg_toplevel 1242 | */ 1243 | #define XDG_TOPLEVEL_STATE_TILED_TOP_SINCE_VERSION 2 1244 | /** 1245 | * @ingroup iface_xdg_toplevel 1246 | */ 1247 | #define XDG_TOPLEVEL_STATE_TILED_BOTTOM_SINCE_VERSION 2 1248 | /** 1249 | * @ingroup iface_xdg_toplevel 1250 | */ 1251 | #define XDG_TOPLEVEL_STATE_SUSPENDED_SINCE_VERSION 6 1252 | #endif /* XDG_TOPLEVEL_STATE_ENUM */ 1253 | 1254 | #ifndef XDG_TOPLEVEL_WM_CAPABILITIES_ENUM 1255 | #define XDG_TOPLEVEL_WM_CAPABILITIES_ENUM 1256 | enum xdg_toplevel_wm_capabilities { 1257 | /** 1258 | * show_window_menu is available 1259 | */ 1260 | XDG_TOPLEVEL_WM_CAPABILITIES_WINDOW_MENU = 1, 1261 | /** 1262 | * set_maximized and unset_maximized are available 1263 | */ 1264 | XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE = 2, 1265 | /** 1266 | * set_fullscreen and unset_fullscreen are available 1267 | */ 1268 | XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN = 3, 1269 | /** 1270 | * set_minimized is available 1271 | */ 1272 | XDG_TOPLEVEL_WM_CAPABILITIES_MINIMIZE = 4, 1273 | }; 1274 | #endif /* XDG_TOPLEVEL_WM_CAPABILITIES_ENUM */ 1275 | 1276 | /** 1277 | * @ingroup iface_xdg_toplevel 1278 | * @struct xdg_toplevel_interface 1279 | */ 1280 | struct xdg_toplevel_interface { 1281 | /** 1282 | * destroy the xdg_toplevel 1283 | * 1284 | * This request destroys the role surface and unmaps the surface; 1285 | * see "Unmapping" behavior in interface section for details. 1286 | */ 1287 | void (*destroy)(struct wl_client *client, 1288 | struct wl_resource *resource); 1289 | /** 1290 | * set the parent of this surface 1291 | * 1292 | * Set the "parent" of this surface. This surface should be 1293 | * stacked above the parent surface and all other ancestor 1294 | * surfaces. 1295 | * 1296 | * Parent surfaces should be set on dialogs, toolboxes, or other 1297 | * "auxiliary" surfaces, so that the parent is raised when the 1298 | * dialog is raised. 1299 | * 1300 | * Setting a null parent for a child surface unsets its parent. 1301 | * Setting a null parent for a surface which currently has no 1302 | * parent is a no-op. 1303 | * 1304 | * Only mapped surfaces can have child surfaces. Setting a parent 1305 | * which is not mapped is equivalent to setting a null parent. If a 1306 | * surface becomes unmapped, its children's parent is set to the 1307 | * parent of the now-unmapped surface. If the now-unmapped surface 1308 | * has no parent, its children's parent is unset. If the 1309 | * now-unmapped surface becomes mapped again, its parent-child 1310 | * relationship is not restored. 1311 | * 1312 | * The parent toplevel must not be one of the child toplevel's 1313 | * descendants, and the parent must be different from the child 1314 | * toplevel, otherwise the invalid_parent protocol error is raised. 1315 | */ 1316 | void (*set_parent)(struct wl_client *client, 1317 | struct wl_resource *resource, 1318 | struct wl_resource *parent); 1319 | /** 1320 | * set surface title 1321 | * 1322 | * Set a short title for the surface. 1323 | * 1324 | * This string may be used to identify the surface in a task bar, 1325 | * window list, or other user interface elements provided by the 1326 | * compositor. 1327 | * 1328 | * The string must be encoded in UTF-8. 1329 | */ 1330 | void (*set_title)(struct wl_client *client, 1331 | struct wl_resource *resource, 1332 | const char *title); 1333 | /** 1334 | * set application ID 1335 | * 1336 | * Set an application identifier for the surface. 1337 | * 1338 | * The app ID identifies the general class of applications to which 1339 | * the surface belongs. The compositor can use this to group 1340 | * multiple surfaces together, or to determine how to launch a new 1341 | * application. 1342 | * 1343 | * For D-Bus activatable applications, the app ID is used as the 1344 | * D-Bus service name. 1345 | * 1346 | * The compositor shell will try to group application surfaces 1347 | * together by their app ID. As a best practice, it is suggested to 1348 | * select app ID's that match the basename of the application's 1349 | * .desktop file. For example, "org.freedesktop.FooViewer" where 1350 | * the .desktop file is "org.freedesktop.FooViewer.desktop". 1351 | * 1352 | * Like other properties, a set_app_id request can be sent after 1353 | * the xdg_toplevel has been mapped to update the property. 1354 | * 1355 | * See the desktop-entry specification [0] for more details on 1356 | * application identifiers and how they relate to well-known D-Bus 1357 | * names and .desktop files. 1358 | * 1359 | * [0] https://standards.freedesktop.org/desktop-entry-spec/ 1360 | */ 1361 | void (*set_app_id)(struct wl_client *client, 1362 | struct wl_resource *resource, 1363 | const char *app_id); 1364 | /** 1365 | * show the window menu 1366 | * 1367 | * Clients implementing client-side decorations might want to 1368 | * show a context menu when right-clicking on the decorations, 1369 | * giving the user a menu that they can use to maximize or minimize 1370 | * the window. 1371 | * 1372 | * This request asks the compositor to pop up such a window menu at 1373 | * the given position, relative to the local surface coordinates of 1374 | * the parent surface. There are no guarantees as to what menu 1375 | * items the window menu contains, or even if a window menu will be 1376 | * drawn at all. 1377 | * 1378 | * This request must be used in response to some sort of user 1379 | * action like a button press, key press, or touch down event. 1380 | * @param seat the wl_seat of the user event 1381 | * @param serial the serial of the user event 1382 | * @param x the x position to pop up the window menu at 1383 | * @param y the y position to pop up the window menu at 1384 | */ 1385 | void (*show_window_menu)(struct wl_client *client, 1386 | struct wl_resource *resource, 1387 | struct wl_resource *seat, 1388 | uint32_t serial, 1389 | int32_t x, 1390 | int32_t y); 1391 | /** 1392 | * start an interactive move 1393 | * 1394 | * Start an interactive, user-driven move of the surface. 1395 | * 1396 | * This request must be used in response to some sort of user 1397 | * action like a button press, key press, or touch down event. The 1398 | * passed serial is used to determine the type of interactive move 1399 | * (touch, pointer, etc). 1400 | * 1401 | * The server may ignore move requests depending on the state of 1402 | * the surface (e.g. fullscreen or maximized), or if the passed 1403 | * serial is no longer valid. 1404 | * 1405 | * If triggered, the surface will lose the focus of the device 1406 | * (wl_pointer, wl_touch, etc) used for the move. It is up to the 1407 | * compositor to visually indicate that the move is taking place, 1408 | * such as updating a pointer cursor, during the move. There is no 1409 | * guarantee that the device focus will return when the move is 1410 | * completed. 1411 | * @param seat the wl_seat of the user event 1412 | * @param serial the serial of the user event 1413 | */ 1414 | void (*move)(struct wl_client *client, 1415 | struct wl_resource *resource, 1416 | struct wl_resource *seat, 1417 | uint32_t serial); 1418 | /** 1419 | * start an interactive resize 1420 | * 1421 | * Start a user-driven, interactive resize of the surface. 1422 | * 1423 | * This request must be used in response to some sort of user 1424 | * action like a button press, key press, or touch down event. The 1425 | * passed serial is used to determine the type of interactive 1426 | * resize (touch, pointer, etc). 1427 | * 1428 | * The server may ignore resize requests depending on the state of 1429 | * the surface (e.g. fullscreen or maximized). 1430 | * 1431 | * If triggered, the client will receive configure events with the 1432 | * "resize" state enum value and the expected sizes. See the 1433 | * "resize" enum value for more details about what is required. The 1434 | * client must also acknowledge configure events using 1435 | * "ack_configure". After the resize is completed, the client will 1436 | * receive another "configure" event without the resize state. 1437 | * 1438 | * If triggered, the surface also will lose the focus of the device 1439 | * (wl_pointer, wl_touch, etc) used for the resize. It is up to the 1440 | * compositor to visually indicate that the resize is taking place, 1441 | * such as updating a pointer cursor, during the resize. There is 1442 | * no guarantee that the device focus will return when the resize 1443 | * is completed. 1444 | * 1445 | * The edges parameter specifies how the surface should be resized, 1446 | * and is one of the values of the resize_edge enum. Values not 1447 | * matching a variant of the enum will cause the 1448 | * invalid_resize_edge protocol error. The compositor may use this 1449 | * information to update the surface position for example when 1450 | * dragging the top left corner. The compositor may also use this 1451 | * information to adapt its behavior, e.g. choose an appropriate 1452 | * cursor image. 1453 | * @param seat the wl_seat of the user event 1454 | * @param serial the serial of the user event 1455 | * @param edges which edge or corner is being dragged 1456 | */ 1457 | void (*resize)(struct wl_client *client, 1458 | struct wl_resource *resource, 1459 | struct wl_resource *seat, 1460 | uint32_t serial, 1461 | uint32_t edges); 1462 | /** 1463 | * set the maximum size 1464 | * 1465 | * Set a maximum size for the window. 1466 | * 1467 | * The client can specify a maximum size so that the compositor 1468 | * does not try to configure the window beyond this size. 1469 | * 1470 | * The width and height arguments are in window geometry 1471 | * coordinates. See xdg_surface.set_window_geometry. 1472 | * 1473 | * Values set in this way are double-buffered. They will get 1474 | * applied on the next commit. 1475 | * 1476 | * The compositor can use this information to allow or disallow 1477 | * different states like maximize or fullscreen and draw accurate 1478 | * animations. 1479 | * 1480 | * Similarly, a tiling window manager may use this information to 1481 | * place and resize client windows in a more effective way. 1482 | * 1483 | * The client should not rely on the compositor to obey the maximum 1484 | * size. The compositor may decide to ignore the values set by the 1485 | * client and request a larger size. 1486 | * 1487 | * If never set, or a value of zero in the request, means that the 1488 | * client has no expected maximum size in the given dimension. As a 1489 | * result, a client wishing to reset the maximum size to an 1490 | * unspecified state can use zero for width and height in the 1491 | * request. 1492 | * 1493 | * Requesting a maximum size to be smaller than the minimum size of 1494 | * a surface is illegal and will result in an invalid_size error. 1495 | * 1496 | * The width and height must be greater than or equal to zero. 1497 | * Using strictly negative values for width or height will result 1498 | * in a invalid_size error. 1499 | */ 1500 | void (*set_max_size)(struct wl_client *client, 1501 | struct wl_resource *resource, 1502 | int32_t width, 1503 | int32_t height); 1504 | /** 1505 | * set the minimum size 1506 | * 1507 | * Set a minimum size for the window. 1508 | * 1509 | * The client can specify a minimum size so that the compositor 1510 | * does not try to configure the window below this size. 1511 | * 1512 | * The width and height arguments are in window geometry 1513 | * coordinates. See xdg_surface.set_window_geometry. 1514 | * 1515 | * Values set in this way are double-buffered. They will get 1516 | * applied on the next commit. 1517 | * 1518 | * The compositor can use this information to allow or disallow 1519 | * different states like maximize or fullscreen and draw accurate 1520 | * animations. 1521 | * 1522 | * Similarly, a tiling window manager may use this information to 1523 | * place and resize client windows in a more effective way. 1524 | * 1525 | * The client should not rely on the compositor to obey the minimum 1526 | * size. The compositor may decide to ignore the values set by the 1527 | * client and request a smaller size. 1528 | * 1529 | * If never set, or a value of zero in the request, means that the 1530 | * client has no expected minimum size in the given dimension. As a 1531 | * result, a client wishing to reset the minimum size to an 1532 | * unspecified state can use zero for width and height in the 1533 | * request. 1534 | * 1535 | * Requesting a minimum size to be larger than the maximum size of 1536 | * a surface is illegal and will result in an invalid_size error. 1537 | * 1538 | * The width and height must be greater than or equal to zero. 1539 | * Using strictly negative values for width and height will result 1540 | * in a invalid_size error. 1541 | */ 1542 | void (*set_min_size)(struct wl_client *client, 1543 | struct wl_resource *resource, 1544 | int32_t width, 1545 | int32_t height); 1546 | /** 1547 | * maximize the window 1548 | * 1549 | * Maximize the surface. 1550 | * 1551 | * After requesting that the surface should be maximized, the 1552 | * compositor will respond by emitting a configure event. Whether 1553 | * this configure actually sets the window maximized is subject to 1554 | * compositor policies. The client must then update its content, 1555 | * drawing in the configured state. The client must also 1556 | * acknowledge the configure when committing the new content (see 1557 | * ack_configure). 1558 | * 1559 | * It is up to the compositor to decide how and where to maximize 1560 | * the surface, for example which output and what region of the 1561 | * screen should be used. 1562 | * 1563 | * If the surface was already maximized, the compositor will still 1564 | * emit a configure event with the "maximized" state. 1565 | * 1566 | * If the surface is in a fullscreen state, this request has no 1567 | * direct effect. It may alter the state the surface is returned to 1568 | * when unmaximized unless overridden by the compositor. 1569 | */ 1570 | void (*set_maximized)(struct wl_client *client, 1571 | struct wl_resource *resource); 1572 | /** 1573 | * unmaximize the window 1574 | * 1575 | * Unmaximize the surface. 1576 | * 1577 | * After requesting that the surface should be unmaximized, the 1578 | * compositor will respond by emitting a configure event. Whether 1579 | * this actually un-maximizes the window is subject to compositor 1580 | * policies. If available and applicable, the compositor will 1581 | * include the window geometry dimensions the window had prior to 1582 | * being maximized in the configure event. The client must then 1583 | * update its content, drawing it in the configured state. The 1584 | * client must also acknowledge the configure when committing the 1585 | * new content (see ack_configure). 1586 | * 1587 | * It is up to the compositor to position the surface after it was 1588 | * unmaximized; usually the position the surface had before 1589 | * maximizing, if applicable. 1590 | * 1591 | * If the surface was already not maximized, the compositor will 1592 | * still emit a configure event without the "maximized" state. 1593 | * 1594 | * If the surface is in a fullscreen state, this request has no 1595 | * direct effect. It may alter the state the surface is returned to 1596 | * when unmaximized unless overridden by the compositor. 1597 | */ 1598 | void (*unset_maximized)(struct wl_client *client, 1599 | struct wl_resource *resource); 1600 | /** 1601 | * set the window as fullscreen on an output 1602 | * 1603 | * Make the surface fullscreen. 1604 | * 1605 | * After requesting that the surface should be fullscreened, the 1606 | * compositor will respond by emitting a configure event. Whether 1607 | * the client is actually put into a fullscreen state is subject to 1608 | * compositor policies. The client must also acknowledge the 1609 | * configure when committing the new content (see ack_configure). 1610 | * 1611 | * The output passed by the request indicates the client's 1612 | * preference as to which display it should be set fullscreen on. 1613 | * If this value is NULL, it's up to the compositor to choose which 1614 | * display will be used to map this surface. 1615 | * 1616 | * If the surface doesn't cover the whole output, the compositor 1617 | * will position the surface in the center of the output and 1618 | * compensate with with border fill covering the rest of the 1619 | * output. The content of the border fill is undefined, but should 1620 | * be assumed to be in some way that attempts to blend into the 1621 | * surrounding area (e.g. solid black). 1622 | * 1623 | * If the fullscreened surface is not opaque, the compositor must 1624 | * make sure that other screen content not part of the same surface 1625 | * tree (made up of subsurfaces, popups or similarly coupled 1626 | * surfaces) are not visible below the fullscreened surface. 1627 | */ 1628 | void (*set_fullscreen)(struct wl_client *client, 1629 | struct wl_resource *resource, 1630 | struct wl_resource *output); 1631 | /** 1632 | * unset the window as fullscreen 1633 | * 1634 | * Make the surface no longer fullscreen. 1635 | * 1636 | * After requesting that the surface should be unfullscreened, the 1637 | * compositor will respond by emitting a configure event. Whether 1638 | * this actually removes the fullscreen state of the client is 1639 | * subject to compositor policies. 1640 | * 1641 | * Making a surface unfullscreen sets states for the surface based 1642 | * on the following: * the state(s) it may have had before becoming 1643 | * fullscreen * any state(s) decided by the compositor * any 1644 | * state(s) requested by the client while the surface was 1645 | * fullscreen 1646 | * 1647 | * The compositor may include the previous window geometry 1648 | * dimensions in the configure event, if applicable. 1649 | * 1650 | * The client must also acknowledge the configure when committing 1651 | * the new content (see ack_configure). 1652 | */ 1653 | void (*unset_fullscreen)(struct wl_client *client, 1654 | struct wl_resource *resource); 1655 | /** 1656 | * set the window as minimized 1657 | * 1658 | * Request that the compositor minimize your surface. There is no 1659 | * way to know if the surface is currently minimized, nor is there 1660 | * any way to unset minimization on this surface. 1661 | * 1662 | * If you are looking to throttle redrawing when minimized, please 1663 | * instead use the wl_surface.frame event for this, as this will 1664 | * also work with live previews on windows in Alt-Tab, Expose or 1665 | * similar compositor features. 1666 | */ 1667 | void (*set_minimized)(struct wl_client *client, 1668 | struct wl_resource *resource); 1669 | }; 1670 | 1671 | #define XDG_TOPLEVEL_CONFIGURE 0 1672 | #define XDG_TOPLEVEL_CLOSE 1 1673 | #define XDG_TOPLEVEL_CONFIGURE_BOUNDS 2 1674 | #define XDG_TOPLEVEL_WM_CAPABILITIES 3 1675 | 1676 | /** 1677 | * @ingroup iface_xdg_toplevel 1678 | */ 1679 | #define XDG_TOPLEVEL_CONFIGURE_SINCE_VERSION 1 1680 | /** 1681 | * @ingroup iface_xdg_toplevel 1682 | */ 1683 | #define XDG_TOPLEVEL_CLOSE_SINCE_VERSION 1 1684 | /** 1685 | * @ingroup iface_xdg_toplevel 1686 | */ 1687 | #define XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION 4 1688 | /** 1689 | * @ingroup iface_xdg_toplevel 1690 | */ 1691 | #define XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION 5 1692 | 1693 | /** 1694 | * @ingroup iface_xdg_toplevel 1695 | */ 1696 | #define XDG_TOPLEVEL_DESTROY_SINCE_VERSION 1 1697 | /** 1698 | * @ingroup iface_xdg_toplevel 1699 | */ 1700 | #define XDG_TOPLEVEL_SET_PARENT_SINCE_VERSION 1 1701 | /** 1702 | * @ingroup iface_xdg_toplevel 1703 | */ 1704 | #define XDG_TOPLEVEL_SET_TITLE_SINCE_VERSION 1 1705 | /** 1706 | * @ingroup iface_xdg_toplevel 1707 | */ 1708 | #define XDG_TOPLEVEL_SET_APP_ID_SINCE_VERSION 1 1709 | /** 1710 | * @ingroup iface_xdg_toplevel 1711 | */ 1712 | #define XDG_TOPLEVEL_SHOW_WINDOW_MENU_SINCE_VERSION 1 1713 | /** 1714 | * @ingroup iface_xdg_toplevel 1715 | */ 1716 | #define XDG_TOPLEVEL_MOVE_SINCE_VERSION 1 1717 | /** 1718 | * @ingroup iface_xdg_toplevel 1719 | */ 1720 | #define XDG_TOPLEVEL_RESIZE_SINCE_VERSION 1 1721 | /** 1722 | * @ingroup iface_xdg_toplevel 1723 | */ 1724 | #define XDG_TOPLEVEL_SET_MAX_SIZE_SINCE_VERSION 1 1725 | /** 1726 | * @ingroup iface_xdg_toplevel 1727 | */ 1728 | #define XDG_TOPLEVEL_SET_MIN_SIZE_SINCE_VERSION 1 1729 | /** 1730 | * @ingroup iface_xdg_toplevel 1731 | */ 1732 | #define XDG_TOPLEVEL_SET_MAXIMIZED_SINCE_VERSION 1 1733 | /** 1734 | * @ingroup iface_xdg_toplevel 1735 | */ 1736 | #define XDG_TOPLEVEL_UNSET_MAXIMIZED_SINCE_VERSION 1 1737 | /** 1738 | * @ingroup iface_xdg_toplevel 1739 | */ 1740 | #define XDG_TOPLEVEL_SET_FULLSCREEN_SINCE_VERSION 1 1741 | /** 1742 | * @ingroup iface_xdg_toplevel 1743 | */ 1744 | #define XDG_TOPLEVEL_UNSET_FULLSCREEN_SINCE_VERSION 1 1745 | /** 1746 | * @ingroup iface_xdg_toplevel 1747 | */ 1748 | #define XDG_TOPLEVEL_SET_MINIMIZED_SINCE_VERSION 1 1749 | 1750 | /** 1751 | * @ingroup iface_xdg_toplevel 1752 | * Sends an configure event to the client owning the resource. 1753 | * @param resource_ The client's resource 1754 | */ 1755 | static inline void 1756 | xdg_toplevel_send_configure(struct wl_resource *resource_, int32_t width, int32_t height, struct wl_array *states) 1757 | { 1758 | wl_resource_post_event(resource_, XDG_TOPLEVEL_CONFIGURE, width, height, states); 1759 | } 1760 | 1761 | /** 1762 | * @ingroup iface_xdg_toplevel 1763 | * Sends an close event to the client owning the resource. 1764 | * @param resource_ The client's resource 1765 | */ 1766 | static inline void 1767 | xdg_toplevel_send_close(struct wl_resource *resource_) 1768 | { 1769 | wl_resource_post_event(resource_, XDG_TOPLEVEL_CLOSE); 1770 | } 1771 | 1772 | /** 1773 | * @ingroup iface_xdg_toplevel 1774 | * Sends an configure_bounds event to the client owning the resource. 1775 | * @param resource_ The client's resource 1776 | */ 1777 | static inline void 1778 | xdg_toplevel_send_configure_bounds(struct wl_resource *resource_, int32_t width, int32_t height) 1779 | { 1780 | wl_resource_post_event(resource_, XDG_TOPLEVEL_CONFIGURE_BOUNDS, width, height); 1781 | } 1782 | 1783 | /** 1784 | * @ingroup iface_xdg_toplevel 1785 | * Sends an wm_capabilities event to the client owning the resource. 1786 | * @param resource_ The client's resource 1787 | * @param capabilities array of 32-bit capabilities 1788 | */ 1789 | static inline void 1790 | xdg_toplevel_send_wm_capabilities(struct wl_resource *resource_, struct wl_array *capabilities) 1791 | { 1792 | wl_resource_post_event(resource_, XDG_TOPLEVEL_WM_CAPABILITIES, capabilities); 1793 | } 1794 | 1795 | #ifndef XDG_POPUP_ERROR_ENUM 1796 | #define XDG_POPUP_ERROR_ENUM 1797 | enum xdg_popup_error { 1798 | /** 1799 | * tried to grab after being mapped 1800 | */ 1801 | XDG_POPUP_ERROR_INVALID_GRAB = 0, 1802 | }; 1803 | #endif /* XDG_POPUP_ERROR_ENUM */ 1804 | 1805 | /** 1806 | * @ingroup iface_xdg_popup 1807 | * @struct xdg_popup_interface 1808 | */ 1809 | struct xdg_popup_interface { 1810 | /** 1811 | * remove xdg_popup interface 1812 | * 1813 | * This destroys the popup. Explicitly destroying the xdg_popup 1814 | * object will also dismiss the popup, and unmap the surface. 1815 | * 1816 | * If this xdg_popup is not the "topmost" popup, the 1817 | * xdg_wm_base.not_the_topmost_popup protocol error will be sent. 1818 | */ 1819 | void (*destroy)(struct wl_client *client, 1820 | struct wl_resource *resource); 1821 | /** 1822 | * make the popup take an explicit grab 1823 | * 1824 | * This request makes the created popup take an explicit grab. An 1825 | * explicit grab will be dismissed when the user dismisses the 1826 | * popup, or when the client destroys the xdg_popup. This can be 1827 | * done by the user clicking outside the surface, using the 1828 | * keyboard, or even locking the screen through closing the lid or 1829 | * a timeout. 1830 | * 1831 | * If the compositor denies the grab, the popup will be immediately 1832 | * dismissed. 1833 | * 1834 | * This request must be used in response to some sort of user 1835 | * action like a button press, key press, or touch down event. The 1836 | * serial number of the event should be passed as 'serial'. 1837 | * 1838 | * The parent of a grabbing popup must either be an xdg_toplevel 1839 | * surface or another xdg_popup with an explicit grab. If the 1840 | * parent is another xdg_popup it means that the popups are nested, 1841 | * with this popup now being the topmost popup. 1842 | * 1843 | * Nested popups must be destroyed in the reverse order they were 1844 | * created in, e.g. the only popup you are allowed to destroy at 1845 | * all times is the topmost one. 1846 | * 1847 | * When compositors choose to dismiss a popup, they may dismiss 1848 | * every nested grabbing popup as well. When a compositor dismisses 1849 | * popups, it will follow the same dismissing order as required 1850 | * from the client. 1851 | * 1852 | * If the topmost grabbing popup is destroyed, the grab will be 1853 | * returned to the parent of the popup, if that parent previously 1854 | * had an explicit grab. 1855 | * 1856 | * If the parent is a grabbing popup which has already been 1857 | * dismissed, this popup will be immediately dismissed. If the 1858 | * parent is a popup that did not take an explicit grab, an error 1859 | * will be raised. 1860 | * 1861 | * During a popup grab, the client owning the grab will receive 1862 | * pointer and touch events for all their surfaces as normal 1863 | * (similar to an "owner-events" grab in X11 parlance), while the 1864 | * top most grabbing popup will always have keyboard focus. 1865 | * @param seat the wl_seat of the user event 1866 | * @param serial the serial of the user event 1867 | */ 1868 | void (*grab)(struct wl_client *client, 1869 | struct wl_resource *resource, 1870 | struct wl_resource *seat, 1871 | uint32_t serial); 1872 | /** 1873 | * recalculate the popup's location 1874 | * 1875 | * Reposition an already-mapped popup. The popup will be placed 1876 | * given the details in the passed xdg_positioner object, and a 1877 | * xdg_popup.repositioned followed by xdg_popup.configure and 1878 | * xdg_surface.configure will be emitted in response. Any 1879 | * parameters set by the previous positioner will be discarded. 1880 | * 1881 | * The passed token will be sent in the corresponding 1882 | * xdg_popup.repositioned event. The new popup position will not 1883 | * take effect until the corresponding configure event is 1884 | * acknowledged by the client. See xdg_popup.repositioned for 1885 | * details. The token itself is opaque, and has no other special 1886 | * meaning. 1887 | * 1888 | * If multiple reposition requests are sent, the compositor may 1889 | * skip all but the last one. 1890 | * 1891 | * If the popup is repositioned in response to a configure event 1892 | * for its parent, the client should send an 1893 | * xdg_positioner.set_parent_configure and possibly an 1894 | * xdg_positioner.set_parent_size request to allow the compositor 1895 | * to properly constrain the popup. 1896 | * 1897 | * If the popup is repositioned together with a parent that is 1898 | * being resized, but not in response to a configure event, the 1899 | * client should send an xdg_positioner.set_parent_size request. 1900 | * @param token reposition request token 1901 | * @since 3 1902 | */ 1903 | void (*reposition)(struct wl_client *client, 1904 | struct wl_resource *resource, 1905 | struct wl_resource *positioner, 1906 | uint32_t token); 1907 | }; 1908 | 1909 | #define XDG_POPUP_CONFIGURE 0 1910 | #define XDG_POPUP_POPUP_DONE 1 1911 | #define XDG_POPUP_REPOSITIONED 2 1912 | 1913 | /** 1914 | * @ingroup iface_xdg_popup 1915 | */ 1916 | #define XDG_POPUP_CONFIGURE_SINCE_VERSION 1 1917 | /** 1918 | * @ingroup iface_xdg_popup 1919 | */ 1920 | #define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1 1921 | /** 1922 | * @ingroup iface_xdg_popup 1923 | */ 1924 | #define XDG_POPUP_REPOSITIONED_SINCE_VERSION 3 1925 | 1926 | /** 1927 | * @ingroup iface_xdg_popup 1928 | */ 1929 | #define XDG_POPUP_DESTROY_SINCE_VERSION 1 1930 | /** 1931 | * @ingroup iface_xdg_popup 1932 | */ 1933 | #define XDG_POPUP_GRAB_SINCE_VERSION 1 1934 | /** 1935 | * @ingroup iface_xdg_popup 1936 | */ 1937 | #define XDG_POPUP_REPOSITION_SINCE_VERSION 3 1938 | 1939 | /** 1940 | * @ingroup iface_xdg_popup 1941 | * Sends an configure event to the client owning the resource. 1942 | * @param resource_ The client's resource 1943 | * @param x x position relative to parent surface window geometry 1944 | * @param y y position relative to parent surface window geometry 1945 | * @param width window geometry width 1946 | * @param height window geometry height 1947 | */ 1948 | static inline void 1949 | xdg_popup_send_configure(struct wl_resource *resource_, int32_t x, int32_t y, int32_t width, int32_t height) 1950 | { 1951 | wl_resource_post_event(resource_, XDG_POPUP_CONFIGURE, x, y, width, height); 1952 | } 1953 | 1954 | /** 1955 | * @ingroup iface_xdg_popup 1956 | * Sends an popup_done event to the client owning the resource. 1957 | * @param resource_ The client's resource 1958 | */ 1959 | static inline void 1960 | xdg_popup_send_popup_done(struct wl_resource *resource_) 1961 | { 1962 | wl_resource_post_event(resource_, XDG_POPUP_POPUP_DONE); 1963 | } 1964 | 1965 | /** 1966 | * @ingroup iface_xdg_popup 1967 | * Sends an repositioned event to the client owning the resource. 1968 | * @param resource_ The client's resource 1969 | * @param token reposition request token 1970 | */ 1971 | static inline void 1972 | xdg_popup_send_repositioned(struct wl_resource *resource_, uint32_t token) 1973 | { 1974 | wl_resource_post_event(resource_, XDG_POPUP_REPOSITIONED, token); 1975 | } 1976 | 1977 | #ifdef __cplusplus 1978 | } 1979 | #endif 1980 | 1981 | #endif 1982 | -------------------------------------------------------------------------------- /src/create-config.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | 3 | /* creates initial config directory and file */ 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | void create_config(void) { 12 | wlr_log_init(WLR_DEBUG, NULL); 13 | const char *HOME = getenv("HOME"); 14 | if (HOME == NULL) { 15 | fprintf(stderr, "Unable to determine the user's home directory.\n"); 16 | return; 17 | } 18 | 19 | const char *dirConfig = "/.config/woodland"; 20 | const char *fileConfig = "/woodland.ini"; 21 | char dirConfigBuff[strlen(HOME) + strlen(dirConfig) + 1]; 22 | char fileConfigBuff[strlen(HOME) + strlen(dirConfig) + strlen(fileConfig) + 1]; 23 | 24 | snprintf(dirConfigBuff, sizeof(dirConfigBuff), "%s%s", HOME, dirConfig); 25 | snprintf(fileConfigBuff, sizeof(fileConfigBuff), "%s%s%s", HOME, dirConfig, fileConfig); 26 | 27 | struct stat dirBuffer; 28 | struct stat fileBuffer; 29 | 30 | int dirExists = (stat(dirConfigBuff, &dirBuffer) == 0); 31 | int fileExists = (stat(fileConfigBuff, &fileBuffer) == 0); 32 | 33 | // Check if config directory exists 34 | if (!dirExists) { 35 | // Directory does not exist, create it 36 | if (mkdir(dirConfigBuff, 0755) != 0) { 37 | perror("mkdir"); 38 | return; 39 | } 40 | } 41 | 42 | // Check if config file exists 43 | if (!fileExists) { 44 | // File does not exist, create it 45 | FILE *config = fopen(fileConfigBuff, "w+"); 46 | if (config == NULL) { 47 | perror("fopen"); 48 | return; 49 | } 50 | 51 | fprintf(config, "%s\n", "# Configuration file for woodland compositor\n"); 52 | fprintf(config, "%s\n", "[ Welcome screen ]"); 53 | fprintf(config, "%s\n", "# If you have any weclome screen application then it goes here."); 54 | fprintf(config, "%s\n", "welcome_screen = none\n"); 55 | fprintf(config, "%s\n", "[ Idle ]"); 56 | fprintf(config, "%s\n", "# The timeout in milliseconds until the system is considered idle."); 57 | fprintf(config, "%s\n", "# One minute is 60000 milliseconds."); 58 | fprintf(config, "%s\n", "# idle_timeout = 0 disables the timeout."); 59 | fprintf(config, "%s\n", "# d_power_path, the path to the file that controls the brightness level."); 60 | fprintf(config, "%s\n", "idle_timeout = 0"); 61 | fprintf(config, "%s\n", "d_power_path = /sys/class/backlight/intel_backlight/brightness"); 62 | fprintf(config, "%s\n", "\n[ Background ]"); 63 | fprintf(config, "%s\n", "# Provide the full path to the image."); 64 | fprintf(config, "%s\n", "#background = path\n"); 65 | fprintf(config, "%s\n", "[ Keyboard layouts ]"); 66 | fprintf(config, "%s\n", "# Alt+Shift to switch layouts"); 67 | fprintf(config, "%s\n", "# e.g: xkb_layouts=us,de"); 68 | fprintf(config, "%s\n", "xkb_layouts=us\n"); 69 | fprintf(config, "%s\n", "[ Multimedia keys ]"); 70 | fprintf(config, "%s\n", "# For default multimedia keys support install: playerctl, alsa-utils"); 71 | fprintf(config, "%s\n", "# or use your own commands."); 72 | fprintf(config, "%s\n", "play_pause = playerctl play-pause"); 73 | fprintf(config, "%s\n", "volume_up = amixer set Master 3+"); 74 | fprintf(config, "%s\n", "volume_down = amixer set Master 3-"); 75 | fprintf(config, "%s\n", "volume_mute = amixer set Master toggle\n"); 76 | fprintf(config, "%s\n", "[ Keyboard Shortcuts ]"); 77 | fprintf(config, "%s\n", "# Modifiers names:"); 78 | fprintf(config, "%s\n", "# WLR_MODIFIER_ALT"); 79 | fprintf(config, "%s\n", "# WLR_MODIFIER_CTRL"); 80 | fprintf(config, "%s\n", "# WLR_MODIFIER_SHIFT"); 81 | fprintf(config, "%s\n", "# WLR_MODIFIER_LOGO (Super key)"); 82 | fprintf(config, "%s\n", "#\n# Key names here: /usr/include/xkbcommon/xkbcommon-keysyms.h\n#"); 83 | fprintf(config, "%s\n", "# Default shortcuts:"); 84 | fprintf(config, "%s\n", "# to log out"); 85 | fprintf(config, "%s\n", "# to close the current window"); 86 | fprintf(config, "%s\n", "# to switch to the next window"); 87 | fprintf(config, "%s\n", "# Example of user defined shortcuts:"); 88 | fprintf(config, "%s\n", "# NOTE: You have to preserve binding_ and command_ prefixes."); 89 | fprintf(config, "%s\n", "#binding_thunar = WLR_MODIFIER_LOGO XKB_KEY_f"); 90 | fprintf(config, "%s\n", "#command_thunar = thunar\n"); 91 | fprintf(config, "%s\n", "[ Window Placement ]"); 92 | fprintf(config, "%s\n", "# Open specified windows at the given fixed position."); 93 | fprintf(config, "%s\n", "# to get the title and/or app_id, use wlrctl tool."); 94 | fprintf(config, "%s\n", "# The placement model is as follows:"); 95 | fprintf(config, "%s\n", "# (declaration) window_place = (keyword) app_id: (app id) app_id (number) x (number) y"); 96 | fprintf(config, "%s\n", "# (declaration) window_place = (keyword) title: (title) title (number) x (number) y"); 97 | fprintf(config, "%s\n", "# Example of how to make 'thunar' start at position x=100 y=100:"); 98 | fprintf(config, "%s\n", "#window_place = app_id: thunar 100 100 (places thunar at x=100 y=100)"); 99 | fprintf(config, "%s\n", "# or\n#window_place = title: \"some title\" 100 100 (places window containing title at x=100 y=100)"); 100 | fprintf(config, "%s\n", "# NOTE: Titles with spaces must be put between double quotes: e.g \"New Document\"\n"); 101 | fprintf(config, "%s\n", "[ Zoom ]"); 102 | fprintf(config, "%s\n", "# Zooming is activated by pressing super key and scrolling."); 103 | fprintf(config, "%s\n", "# zoom_speed defines how fast zooming area is moving around."); 104 | fprintf(config, "%s\n", "# zoom_edge_threshold defines the distance from the edges to start panning."); 105 | fprintf(config, "%s\n", "# zoom_top_edge if 'enabled' then you can scroll on the left top edge to zoom."); 106 | fprintf(config, "%s\n", "zoom_speed = 5"); 107 | fprintf(config, "%s\n", "zoom_top_edge = disabled"); 108 | fprintf(config, "%s\n", "zoom_edge_threshold = 30\n"); 109 | fprintf(config, "%s\n", "[ Startup ]"); 110 | fprintf(config, "%s\n", "# Specify the startup commands."); 111 | fprintf(config, "%s\n", "# If no startup command is specified then"); 112 | fprintf(config, "%s\n", "# it will automatically look for the following terminals:"); 113 | fprintf(config, "%s\n", "# foot, xfce4-terminal, kitty, gnome-terminal, alacritty."); 114 | fprintf(config, "%s\n", "# Example (automatically start thunar and foot):"); 115 | fprintf(config, "%s\n", "# NOTE: the line must start with startup_command"); 116 | fprintf(config, "%s\n", "#startup_command = thunar"); 117 | fprintf(config, "%s\n", "#startup_command = foot\n"); 118 | fclose(config); 119 | 120 | // Log that the configuration files were created 121 | ///wlr_log(WLR_INFO, "Configuration files created successfully!"); 122 | } 123 | else { 124 | // Log that the configuration files already exist 125 | ///wlr_log(WLR_INFO, "Configuration files exist, nothing to do!"); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/getvaluefromconf.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | 3 | #define MAX_LINE_LENGTH 2048 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | /* DON'T FORGET TO FREE THE MEMORY FOR GET CHAR */ 14 | /* Improved version that gets the value irrespective of number of spaces */ 15 | // Function to trim spaces and other whitespace characters from the start and end of a string 16 | char *trim(char *str) { 17 | char *start = str; 18 | char *end = str + strlen(str) - 1; 19 | // Trim leading whitespace characters 20 | while (isspace((unsigned char)*start)) { 21 | start++; 22 | } 23 | // Trim trailing whitespace characters 24 | while (end > start && isspace((unsigned char)*end)) { 25 | *end-- = '\0'; 26 | } 27 | return strdup(start); 28 | } 29 | 30 | int get_int_value_from_conf(char *fullPathToConf, char *keyToGetValueFrom) { 31 | setlocale(LC_NUMERIC, "C"); 32 | 33 | char buffer[MAX_LINE_LENGTH]; 34 | char value[MAX_LINE_LENGTH]; 35 | int found = 0; 36 | 37 | FILE *pathToConfig = fopen(fullPathToConf, "r"); 38 | 39 | if (pathToConfig == NULL) { 40 | perror("Error opening file"); 41 | return 1; 42 | } 43 | 44 | while (fgets(buffer, sizeof(buffer), pathToConfig) != NULL) { 45 | // Check if the line contains the key and is not a comment 46 | if (strstr(buffer, keyToGetValueFrom) != NULL && strchr(buffer, '#') == NULL) { 47 | char *pos = strchr(buffer, '='); 48 | if (pos != NULL) { 49 | *pos = '\0'; // Split the string into key and value 50 | char *key = trim(buffer); 51 | if (strcmp(key, keyToGetValueFrom) == 0) { 52 | strcpy(value, pos + 1); 53 | strcpy(value, trim(value)); // Trim the value 54 | value[strcspn(value, "\r\n")] = '\0'; // Remove trailing newline characters 55 | found = 1; 56 | free(key); 57 | break; 58 | } 59 | } 60 | } 61 | } 62 | 63 | fclose(pathToConfig); 64 | 65 | if (!found) { 66 | return 1; // Return 1 if the key was not found 67 | } 68 | int valueToNumber = atoi(value); 69 | return valueToNumber; 70 | } 71 | 72 | double get_double_value_from_conf(char *fullPathToConf, char *keyToGetValueFrom) { 73 | setlocale(LC_NUMERIC, "C"); 74 | 75 | char buffer[MAX_LINE_LENGTH]; 76 | char value[MAX_LINE_LENGTH]; 77 | int found = 0; 78 | 79 | FILE *pathToConfig = fopen(fullPathToConf, "r"); 80 | 81 | if (pathToConfig == NULL) { 82 | perror("Error opening file"); 83 | return 1; 84 | } 85 | 86 | while (fgets(buffer, sizeof(buffer), pathToConfig) != NULL) { 87 | // Print out each line for debugging 88 | ///printf("Read line: %s", buffer); 89 | // Check if the line contains the key and is not a comment 90 | if (strstr(buffer, keyToGetValueFrom) != NULL && strchr(buffer, '#') == NULL) { 91 | char *pos = strchr(buffer, '='); 92 | if (pos != NULL) { 93 | *pos = '\0'; // Split the string into key and value 94 | char *key = trim(buffer); 95 | if (strcmp(key, keyToGetValueFrom) == 0) { 96 | strcpy(value, pos + 1); 97 | value[strcspn(value, "\r\n")] = '\0'; // Remove trailing newline characters 98 | found = 1; 99 | free(key); 100 | break; 101 | } 102 | } 103 | } 104 | } 105 | 106 | fclose(pathToConfig); 107 | 108 | if (!found) { 109 | return 1; // Return 1 if the key was not found 110 | } 111 | 112 | // Manually extract the numerical part of the value string 113 | char *num_part = trim(value); 114 | ///printf("Numerical part: '%s'\n", num_part); 115 | 116 | // Convert the numerical part directly to a double 117 | double valueToNumber = strtod(num_part, NULL); 118 | free(num_part); 119 | num_part = NULL; 120 | 121 | return valueToNumber; 122 | } 123 | 124 | // Function to get the value associated with a key from a config file 125 | char *get_char_value_from_conf(const char *fullPathToConf, const char *keyToGetValueFrom) { 126 | setlocale(LC_NUMERIC, "C"); 127 | char buffer[MAX_LINE_LENGTH]; 128 | char value[MAX_LINE_LENGTH]; 129 | int found = 0; 130 | FILE *pathToConfig = fopen(fullPathToConf, "r"); 131 | if (pathToConfig == NULL) { 132 | return NULL; // Return NULL if the file cannot be opened 133 | } 134 | 135 | while (fgets(buffer, sizeof(buffer), pathToConfig) != NULL) { 136 | // Check if the line contains the key and is not a comment 137 | if (strstr(buffer, keyToGetValueFrom) != NULL && strchr(buffer, '#') == NULL) { 138 | char *pos = strchr(buffer, '='); 139 | if (pos != NULL) { 140 | *pos = '\0'; // Split the string into key and value 141 | char *key = trim(buffer); 142 | if (strcmp(key, keyToGetValueFrom) == 0) { 143 | strcpy(value, pos + 1); 144 | const char *tmp_value = trim(value); 145 | strcpy(value, tmp_value); // Trim the value 146 | value[strcspn(value, "\r\n")] = '\0'; // Remove trailing newline characters 147 | found = 1; 148 | free((void *)tmp_value); 149 | free(key); 150 | break; 151 | } 152 | } 153 | } 154 | } 155 | 156 | fclose(pathToConfig); 157 | if (!found) { 158 | return NULL; // Return NULL if the key was not found 159 | } 160 | return strdup(value); 161 | } 162 | -------------------------------------------------------------------------------- /src/getvaluefromconf.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | 3 | #ifndef GETINTVALUEFROMCONF_H_ 4 | #define GETINTVALUEFROMCONF_H_ 5 | 6 | int get_int_value_from_conf(char *fullPathToConf, char *nameToGetValueFrom); 7 | double get_double_value_from_conf(char *fullPathToConf, char *nameToGetValueFrom); 8 | char *get_char_value_from_conf(char *fullPathToConf, char *nameToGetValueFrom); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/getxkbkeyname.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | 3 | /* This function returns the XKB key name from the given hexadecimal symbol. 4 | * the names are defined in: /usr/include/xkbcommon/xkbcommon-keysyms.h 5 | * Usage: 6 | 1) First in your code you need to get the sym: 7 | example: 8 | uint32_t keycode = event->keycode + 8; 9 | const xkb_keysym_t *syms; 10 | // Get a list of keysyms based on the keymap for this keyboard 11 | int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state, keycode, &syms); 12 | // The sym would be syms[i] in the following loop: 13 | for (int i = 0; i < nsyms; i++) { 14 | // Check if the Super key is pressed or released 15 | if (syms[i] == XKB_KEY_Super_L || syms[i] == XKB_KEY_Super_R) { 16 | // do something with syms[i] for instance provide is as argument for a function: 17 | // handle_keybinding_super(server, syms[i]); 18 | } 19 | } 20 | 2) in your handle function (e.g. handle_keybinding_super) get the hexcode: 21 | static bool handle_keybinding_alt(struct woodland_server *server, xkb_keysym_t sym) { 22 | char hexCode[256]; 23 | snprintf(hexCode, sizeof(hexCode), "%#06x", sym); 24 | // Get the key name from the hexcode and print it: 25 | char *keyname = xkb_keyname(hexCode); 26 | if (keyname) { 27 | printf("Key name: %s\n", keyname); 28 | free(keyname); // Free the allocated memory 29 | } 30 | else { 31 | printf("Key not found or error occurred\n"); 32 | } 33 | } 34 | */ 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | char *xkb_keyname(const char *hexadecimal) { 41 | FILE *file = fopen("/usr/include/xkbcommon/xkbcommon-keysyms.h", "r"); 42 | if (!file) { 43 | perror("Error opening file"); 44 | return NULL; 45 | } 46 | char buffer[256]; 47 | char *keyname = NULL; 48 | while (fgets(buffer, sizeof(buffer), file) != NULL) { 49 | // Check if the line contains the provided hexadecimal value 50 | if (strstr(buffer, hexadecimal) != NULL) { 51 | // Check if the line contains the "#define" keyword 52 | char *define_ptr = strstr(buffer, "#define"); 53 | if (define_ptr) { 54 | // Extract the keyname 55 | char *start = define_ptr + strlen("#define"); 56 | while (*start == ' ' || *start == '\t') start++; // Skip whitespace 57 | char *end = start; 58 | while (*end && *end != ' ' && *end != '\t' && *end != '\n') end++; // Find end of keyname 59 | keyname = (char *)malloc(end - start + 1); 60 | if (!keyname) { 61 | perror("Memory allocation error"); 62 | fclose(file); 63 | return NULL; 64 | } 65 | strncpy(keyname, start, end - start); 66 | keyname[end - start] = '\0'; 67 | break; 68 | } 69 | } 70 | } 71 | fclose(file); 72 | return keyname; 73 | } 74 | -------------------------------------------------------------------------------- /src/getxkbkeyname.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | 3 | #ifndef GETXKBKEYNAME_H_ 4 | #define GETXKBKEYNAME_H_ 5 | char *xkb_keyname(const char *hexadecimal); 6 | #endif 7 | -------------------------------------------------------------------------------- /src/runcmd.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | 3 | /* Runs the given command with arguments 4 | * also supports quoted arguments but you need to build the command with \"%s\" 5 | * You need to provide the full path to the executable 6 | * If you don't provide the full path then it will look in /usr/bin and /usr/local/bin 7 | * Usage: 8 | * char *cmd = "/usr/bin/xfce4-terminal --title=TEST --hide-borders --hide-menubar --hide-scrollbar"; 9 | * run_cmd(cmd); 10 | */ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #define MAX_ARGS 300 22 | 23 | int iterCount = 0; 24 | char addPath[2048]; 25 | extern char **environ; 26 | static int currChar = 0; 27 | static bool isUsrBin = true; 28 | static bool firstArgPassed = false; // used to add path only to the first argument 29 | 30 | char *process_arguments(char **command_p) { 31 | // Check if the command was passed without path 32 | if (command_p[0][0] != '/' && !firstArgPassed) { 33 | // Trying to guess the path if not provided 34 | if (isUsrBin && iterCount == 0) { // path to 35 | snprintf(addPath, sizeof(addPath), "/usr/local/bin/%s", *command_p); 36 | *command_p = addPath; 37 | iterCount = iterCount + 1; 38 | } 39 | else if (!isUsrBin && iterCount == 1) { 40 | snprintf(addPath, sizeof(addPath), "/usr/bin/%s", *command_p); 41 | *command_p = addPath; 42 | iterCount = 2; 43 | } 44 | } 45 | 46 | char *text_p = *command_p; 47 | char tmp[2048]; 48 | int count = 0; 49 | int tmp_index = 0; 50 | bool inQuotes = false; 51 | 52 | while (text_p[count] != '\0') { 53 | if (text_p[count] == '"' && !inQuotes) { 54 | inQuotes = true; 55 | } 56 | else if (text_p[count] == '"' && inQuotes) { 57 | inQuotes = false; 58 | } 59 | else { 60 | if (inQuotes && text_p[count] == ' ') { 61 | tmp[tmp_index++] = ' '; 62 | } 63 | else { 64 | tmp[tmp_index++] = text_p[count]; 65 | } 66 | } 67 | count++; 68 | if (!inQuotes && text_p[count] == ' ') { 69 | break; 70 | } 71 | } 72 | 73 | tmp[tmp_index] = '\0'; 74 | currChar = text_p[count]; 75 | 76 | *command_p = &text_p[count + (currChar != '\0')]; // Move the pointer forward 77 | return strdup(tmp); // Return a new copy of the string 78 | } 79 | 80 | static void run_main_cmd(char *command) { 81 | pid_t pid; 82 | int argc = 0; 83 | char *argv[MAX_ARGS]; 84 | char *command_p = command; 85 | 86 | /// Tokenize command and populate argv 87 | while (*command_p != '\0' && argc < MAX_ARGS) { 88 | // sends one argument at a time and returns properly formatted string to populate array 89 | char *string = process_arguments(&command_p); 90 | firstArgPassed = true; 91 | argv[argc] = string; 92 | argc = argc + 1; 93 | } 94 | 95 | // Null terminate the array 96 | argv[argc] = NULL; 97 | 98 | // Execute the command 99 | int status = posix_spawn(&pid, argv[0], NULL, NULL, argv, environ); 100 | 101 | if (status != 0 && iterCount < 2) { 102 | isUsrBin = false; 103 | firstArgPassed = false; 104 | run_main_cmd((char *)command); 105 | } 106 | else if (status != 0 && iterCount == 2) { 107 | fprintf(stderr, "Error: %s. Please provide full path to %s\n", strerror(status), argv[0]); 108 | } 109 | 110 | /// Print and free allocated memory 111 | for (int i = 0; argv[i] != NULL; i++) { 112 | ///printf("argv[%d]: %s\n", i, argv[i]); 113 | free(argv[i]); // Free each string 114 | } 115 | } 116 | 117 | void run_cmd(char *command) { 118 | pid_t pid = fork(); 119 | if (pid == 0) { 120 | // In child process 121 | run_main_cmd(command); 122 | exit(0); // Ensure the child process exits after running the command 123 | } 124 | else if (pid > 0) { 125 | // In parent process 126 | int status; 127 | waitpid(pid, &status, 0); // Wait for the child process to finish 128 | } 129 | else { 130 | // fork failed 131 | perror("fork"); 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /src/runcmd.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | 3 | #ifndef RUNCMD_H_ 4 | #define RUNCMD_H_ 5 | void run_cmd(char *command); 6 | #endif 7 | --------------------------------------------------------------------------------