├── .buildconfig ├── .gitignore ├── AUTHORS ├── COPYING ├── INSTALL ├── Makefile.am ├── NEWS ├── README ├── autogen.sh ├── common ├── xfwm-common.c └── xfwm-common.h ├── configure.ac.in ├── meson.build ├── po ├── Makefile.in.in ├── POTFILES ├── en_GB.po └── stamp-it ├── protocol ├── Makefile.am ├── meson.build ├── scan.sh ├── window-switcher-unstable-v1.xml ├── wlr-foreign-toplevel-management-unstable-v1.xml ├── wlr-layer-shell-unstable-v1.xml ├── xdg-shell-unstable-v6.xml └── xfway-shell.xml ├── src ├── Makefile.am ├── client.c ├── client.h ├── display.h ├── main-shell-client.c ├── main-wayland.c ├── os-compatibility.c ├── os-compatibility.h ├── screen.c ├── screen.h ├── server.h ├── settings.h ├── shell.c ├── shell.h ├── stacking.c ├── stacking.h ├── tabwin.c ├── tabwin.h ├── window-switcher.c ├── wlr_foreign_toplevel_management_v1.c ├── wlr_foreign_toplevel_management_v1.h ├── wlr_layer_shell_v1.c ├── wlr_layer_shell_v1.h └── xfway.h ├── tests └── test-switcher │ ├── Makefile.am │ └── switcher-test.c ├── util ├── helpers.h ├── libgwater-wayland.c ├── libgwater-wayland.h ├── signal.c └── signal.h ├── xfway-protocols-uninstalled.pc.in └── xfway-protocols.pc.in /.buildconfig: -------------------------------------------------------------------------------- 1 | [default] 2 | name=Default 3 | runtime=host 4 | config-opts= 5 | run-opts= 6 | prefix=/home/adlo/.cache/gnome-builder/install/test-libweston-desktop/host 7 | app-id= 8 | postbuild= 9 | prebuild= 10 | default=true 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.deps 2 | build/ 3 | protocol/*.h 4 | protocol/*.c 5 | Makefile 6 | Makefile.in 7 | xfway 8 | xfway-shell 9 | tests/test-switcher/test-switcher 10 | *.la 11 | *.lo 12 | *.o 13 | *.pc 14 | *.so 15 | .libs 16 | /aclocal.m4 17 | /autom4te.cache 18 | /compile 19 | /config.* 20 | /configure 21 | /configure.ac 22 | /depcomp 23 | /install-sh 24 | /intltool-extract.in 25 | /intltool-merge.in 26 | /intltool-update.in 27 | /libtool 28 | /ltmain.sh 29 | /logs 30 | /m4/ 31 | /missing 32 | /stamp-h1 33 | /test-driver 34 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adlocode/xfway/d95c63ca2d15a41bbe22c76d488d57d492ee07ca/AUTHORS -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library 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 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | 342 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Installation Instructions 2 | ************************* 3 | 4 | Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software 5 | Foundation, Inc. 6 | 7 | Copying and distribution of this file, with or without modification, 8 | are permitted in any medium without royalty provided the copyright 9 | notice and this notice are preserved. This file is offered as-is, 10 | without warranty of any kind. 11 | 12 | Basic Installation 13 | ================== 14 | 15 | Briefly, the shell command './configure && make && make install' 16 | should configure, build, and install this package. The following 17 | more-detailed instructions are generic; see the 'README' file for 18 | instructions specific to this package. Some packages provide this 19 | 'INSTALL' file but do not implement all of the features documented 20 | below. The lack of an optional feature in a given package is not 21 | necessarily a bug. More recommendations for GNU packages can be found 22 | in *note Makefile Conventions: (standards)Makefile Conventions. 23 | 24 | The 'configure' shell script attempts to guess correct values for 25 | various system-dependent variables used during compilation. It uses 26 | those values to create a 'Makefile' in each directory of the package. 27 | It may also create one or more '.h' files containing system-dependent 28 | definitions. Finally, it creates a shell script 'config.status' that 29 | you can run in the future to recreate the current configuration, and a 30 | file 'config.log' containing compiler output (useful mainly for 31 | debugging 'configure'). 32 | 33 | It can also use an optional file (typically called 'config.cache' and 34 | enabled with '--cache-file=config.cache' or simply '-C') that saves the 35 | results of its tests to speed up reconfiguring. Caching is disabled by 36 | default to prevent problems with accidental use of stale cache files. 37 | 38 | If you need to do unusual things to compile the package, please try 39 | to figure out how 'configure' could check whether to do them, and mail 40 | diffs or instructions to the address given in the 'README' so they can 41 | be considered for the next release. If you are using the cache, and at 42 | some point 'config.cache' contains results you don't want to keep, you 43 | may remove or edit it. 44 | 45 | The file 'configure.ac' (or 'configure.in') is used to create 46 | 'configure' by a program called 'autoconf'. You need 'configure.ac' if 47 | you want to change it or regenerate 'configure' using a newer version of 48 | 'autoconf'. 49 | 50 | The simplest way to compile this package is: 51 | 52 | 1. 'cd' to the directory containing the package's source code and type 53 | './configure' to configure the package for your system. 54 | 55 | Running 'configure' might take a while. While running, it prints 56 | some messages telling which features it is checking for. 57 | 58 | 2. Type 'make' to compile the package. 59 | 60 | 3. Optionally, type 'make check' to run any self-tests that come with 61 | the package, generally using the just-built uninstalled binaries. 62 | 63 | 4. Type 'make install' to install the programs and any data files and 64 | documentation. When installing into a prefix owned by root, it is 65 | recommended that the package be configured and built as a regular 66 | user, and only the 'make install' phase executed with root 67 | privileges. 68 | 69 | 5. Optionally, type 'make installcheck' to repeat any self-tests, but 70 | this time using the binaries in their final installed location. 71 | This target does not install anything. Running this target as a 72 | regular user, particularly if the prior 'make install' required 73 | root privileges, verifies that the installation completed 74 | correctly. 75 | 76 | 6. You can remove the program binaries and object files from the 77 | source code directory by typing 'make clean'. To also remove the 78 | files that 'configure' created (so you can compile the package for 79 | a different kind of computer), type 'make distclean'. There is 80 | also a 'make maintainer-clean' target, but that is intended mainly 81 | for the package's developers. If you use it, you may have to get 82 | all sorts of other programs in order to regenerate files that came 83 | with the distribution. 84 | 85 | 7. Often, you can also type 'make uninstall' to remove the installed 86 | files again. In practice, not all packages have tested that 87 | uninstallation works correctly, even though it is required by the 88 | GNU Coding Standards. 89 | 90 | 8. Some packages, particularly those that use Automake, provide 'make 91 | distcheck', which can by used by developers to test that all other 92 | targets like 'make install' and 'make uninstall' work correctly. 93 | This target is generally not run by end users. 94 | 95 | Compilers and Options 96 | ===================== 97 | 98 | Some systems require unusual options for compilation or linking that 99 | the 'configure' script does not know about. Run './configure --help' 100 | for details on some of the pertinent environment variables. 101 | 102 | You can give 'configure' initial values for configuration parameters 103 | by setting variables in the command line or in the environment. Here is 104 | an example: 105 | 106 | ./configure CC=c99 CFLAGS=-g LIBS=-lposix 107 | 108 | *Note Defining Variables::, for more details. 109 | 110 | Compiling For Multiple Architectures 111 | ==================================== 112 | 113 | You can compile the package for more than one kind of computer at the 114 | same time, by placing the object files for each architecture in their 115 | own directory. To do this, you can use GNU 'make'. 'cd' to the 116 | directory where you want the object files and executables to go and run 117 | the 'configure' script. 'configure' automatically checks for the source 118 | code in the directory that 'configure' is in and in '..'. This is known 119 | as a "VPATH" build. 120 | 121 | With a non-GNU 'make', it is safer to compile the package for one 122 | architecture at a time in the source code directory. After you have 123 | installed the package for one architecture, use 'make distclean' before 124 | reconfiguring for another architecture. 125 | 126 | On MacOS X 10.5 and later systems, you can create libraries and 127 | executables that work on multiple system types--known as "fat" or 128 | "universal" binaries--by specifying multiple '-arch' options to the 129 | compiler but only a single '-arch' option to the preprocessor. Like 130 | this: 131 | 132 | ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 133 | CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 134 | CPP="gcc -E" CXXCPP="g++ -E" 135 | 136 | This is not guaranteed to produce working output in all cases, you 137 | may have to build one architecture at a time and combine the results 138 | using the 'lipo' tool if you have problems. 139 | 140 | Installation Names 141 | ================== 142 | 143 | By default, 'make install' installs the package's commands under 144 | '/usr/local/bin', include files under '/usr/local/include', etc. You 145 | can specify an installation prefix other than '/usr/local' by giving 146 | 'configure' the option '--prefix=PREFIX', where PREFIX must be an 147 | absolute file name. 148 | 149 | You can specify separate installation prefixes for 150 | architecture-specific files and architecture-independent files. If you 151 | pass the option '--exec-prefix=PREFIX' to 'configure', the package uses 152 | PREFIX as the prefix for installing programs and libraries. 153 | Documentation and other data files still use the regular prefix. 154 | 155 | In addition, if you use an unusual directory layout you can give 156 | options like '--bindir=DIR' to specify different values for particular 157 | kinds of files. Run 'configure --help' for a list of the directories 158 | you can set and what kinds of files go in them. In general, the default 159 | for these options is expressed in terms of '${prefix}', so that 160 | specifying just '--prefix' will affect all of the other directory 161 | specifications that were not explicitly provided. 162 | 163 | The most portable way to affect installation locations is to pass the 164 | correct locations to 'configure'; however, many packages provide one or 165 | both of the following shortcuts of passing variable assignments to the 166 | 'make install' command line to change installation locations without 167 | having to reconfigure or recompile. 168 | 169 | The first method involves providing an override variable for each 170 | affected directory. For example, 'make install 171 | prefix=/alternate/directory' will choose an alternate location for all 172 | directory configuration variables that were expressed in terms of 173 | '${prefix}'. Any directories that were specified during 'configure', 174 | but not in terms of '${prefix}', must each be overridden at install time 175 | for the entire installation to be relocated. The approach of makefile 176 | variable overrides for each directory variable is required by the GNU 177 | Coding Standards, and ideally causes no recompilation. However, some 178 | platforms have known limitations with the semantics of shared libraries 179 | that end up requiring recompilation when using this method, particularly 180 | noticeable in packages that use GNU Libtool. 181 | 182 | The second method involves providing the 'DESTDIR' variable. For 183 | example, 'make install DESTDIR=/alternate/directory' will prepend 184 | '/alternate/directory' before all installation names. The approach of 185 | 'DESTDIR' overrides is not required by the GNU Coding Standards, and 186 | does not work on platforms that have drive letters. On the other hand, 187 | it does better at avoiding recompilation issues, and works well even 188 | when some directory options were not specified in terms of '${prefix}' 189 | at 'configure' time. 190 | 191 | Optional Features 192 | ================= 193 | 194 | If the package supports it, you can cause programs to be installed 195 | with an extra prefix or suffix on their names by giving 'configure' the 196 | option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. 197 | 198 | Some packages pay attention to '--enable-FEATURE' options to 199 | 'configure', where FEATURE indicates an optional part of the package. 200 | They may also pay attention to '--with-PACKAGE' options, where PACKAGE 201 | is something like 'gnu-as' or 'x' (for the X Window System). The 202 | 'README' should mention any '--enable-' and '--with-' options that the 203 | package recognizes. 204 | 205 | For packages that use the X Window System, 'configure' can usually 206 | find the X include and library files automatically, but if it doesn't, 207 | you can use the 'configure' options '--x-includes=DIR' and 208 | '--x-libraries=DIR' to specify their locations. 209 | 210 | Some packages offer the ability to configure how verbose the 211 | execution of 'make' will be. For these packages, running './configure 212 | --enable-silent-rules' sets the default to minimal output, which can be 213 | overridden with 'make V=1'; while running './configure 214 | --disable-silent-rules' sets the default to verbose, which can be 215 | overridden with 'make V=0'. 216 | 217 | Particular systems 218 | ================== 219 | 220 | On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC 221 | is not installed, it is recommended to use the following options in 222 | order to use an ANSI C compiler: 223 | 224 | ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" 225 | 226 | and if that doesn't work, install pre-built binaries of GCC for HP-UX. 227 | 228 | HP-UX 'make' updates targets which have the same time stamps as their 229 | prerequisites, which makes it generally unusable when shipped generated 230 | files such as 'configure' are involved. Use GNU 'make' instead. 231 | 232 | On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot 233 | parse its '' header file. The option '-nodtk' can be used as a 234 | workaround. If GNU CC is not installed, it is therefore recommended to 235 | try 236 | 237 | ./configure CC="cc" 238 | 239 | and if that doesn't work, try 240 | 241 | ./configure CC="cc -nodtk" 242 | 243 | On Solaris, don't put '/usr/ucb' early in your 'PATH'. This 244 | directory contains several dysfunctional programs; working variants of 245 | these programs are available in '/usr/bin'. So, if you need '/usr/ucb' 246 | in your 'PATH', put it _after_ '/usr/bin'. 247 | 248 | On Haiku, software installed for all users goes in '/boot/common', 249 | not '/usr/local'. It is recommended to use the following options: 250 | 251 | ./configure --prefix=/boot/common 252 | 253 | Specifying the System Type 254 | ========================== 255 | 256 | There may be some features 'configure' cannot figure out 257 | automatically, but needs to determine by the type of machine the package 258 | will run on. Usually, assuming the package is built to be run on the 259 | _same_ architectures, 'configure' can figure that out, but if it prints 260 | a message saying it cannot guess the machine type, give it the 261 | '--build=TYPE' option. TYPE can either be a short name for the system 262 | type, such as 'sun4', or a canonical name which has the form: 263 | 264 | CPU-COMPANY-SYSTEM 265 | 266 | where SYSTEM can have one of these forms: 267 | 268 | OS 269 | KERNEL-OS 270 | 271 | See the file 'config.sub' for the possible values of each field. If 272 | 'config.sub' isn't included in this package, then this package doesn't 273 | need to know the machine type. 274 | 275 | If you are _building_ compiler tools for cross-compiling, you should 276 | use the option '--target=TYPE' to select the type of system they will 277 | produce code for. 278 | 279 | If you want to _use_ a cross compiler, that generates code for a 280 | platform different from the build platform, you should specify the 281 | "host" platform (i.e., that on which the generated programs will 282 | eventually be run) with '--host=TYPE'. 283 | 284 | Sharing Defaults 285 | ================ 286 | 287 | If you want to set default values for 'configure' scripts to share, 288 | you can create a site shell script called 'config.site' that gives 289 | default values for variables like 'CC', 'cache_file', and 'prefix'. 290 | 'configure' looks for 'PREFIX/share/config.site' if it exists, then 291 | 'PREFIX/etc/config.site' if it exists. Or, you can set the 292 | 'CONFIG_SITE' environment variable to the location of the site script. 293 | A warning: not all 'configure' scripts look for a site script. 294 | 295 | Defining Variables 296 | ================== 297 | 298 | Variables not defined in a site shell script can be set in the 299 | environment passed to 'configure'. However, some packages may run 300 | configure again during the build, and the customized values of these 301 | variables may be lost. In order to avoid this problem, you should set 302 | them in the 'configure' command line, using 'VAR=value'. For example: 303 | 304 | ./configure CC=/usr/local2/bin/gcc 305 | 306 | causes the specified 'gcc' to be used as the C compiler (unless it is 307 | overridden in the site shell script). 308 | 309 | Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an 310 | Autoconf limitation. Until the limitation is lifted, you can use this 311 | workaround: 312 | 313 | CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash 314 | 315 | 'configure' Invocation 316 | ====================== 317 | 318 | 'configure' recognizes the following options to control how it 319 | operates. 320 | 321 | '--help' 322 | '-h' 323 | Print a summary of all of the options to 'configure', and exit. 324 | 325 | '--help=short' 326 | '--help=recursive' 327 | Print a summary of the options unique to this package's 328 | 'configure', and exit. The 'short' variant lists options used only 329 | in the top level, while the 'recursive' variant lists options also 330 | present in any nested packages. 331 | 332 | '--version' 333 | '-V' 334 | Print the version of Autoconf used to generate the 'configure' 335 | script, and exit. 336 | 337 | '--cache-file=FILE' 338 | Enable the cache: use and save the results of the tests in FILE, 339 | traditionally 'config.cache'. FILE defaults to '/dev/null' to 340 | disable caching. 341 | 342 | '--config-cache' 343 | '-C' 344 | Alias for '--cache-file=config.cache'. 345 | 346 | '--quiet' 347 | '--silent' 348 | '-q' 349 | Do not print messages saying which checks are being made. To 350 | suppress all normal output, redirect it to '/dev/null' (any error 351 | messages will still be shown). 352 | 353 | '--srcdir=DIR' 354 | Look for the package's source code in directory DIR. Usually 355 | 'configure' can determine that directory automatically. 356 | 357 | '--prefix=DIR' 358 | Use DIR as the installation prefix. *note Installation Names:: for 359 | more details, including other options available for fine-tuning the 360 | installation locations. 361 | 362 | '--no-create' 363 | '-n' 364 | Run the configure checks, but stop before creating any output 365 | files. 366 | 367 | 'configure' also accepts some other, not widely useful, options. Run 368 | 'configure --help' for more details. 369 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | @SET_MAKE@ 2 | 3 | ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} 4 | 5 | EXTRA_DIST = \ 6 | example.gtkrc-2.0 \ 7 | intltool-extract.in \ 8 | intltool-merge.in \ 9 | intltool-update.in \ 10 | COMPOSITOR 11 | 12 | EXTRA_DIST += \ 13 | protocol/xfway-shell.xml 14 | 15 | DISTCLEANFILES = \ 16 | intltool-extract \ 17 | intltool-merge \ 18 | intltool-update 19 | 20 | SUBDIRS = \ 21 | protocol \ 22 | src \ 23 | tests/test-switcher 24 | 25 | BUILT_SOURCES = \ 26 | protocol/xfway-shell-client-protocol.c \ 27 | protocol/xfway-shell-client-protocol.h \ 28 | protocol/xfway-shell-server-protocol.h \ 29 | protocol/window-switcher-unstable-v1-server-protocol.h \ 30 | protocol/window-switcher-unstable-v1-client-protocol.h \ 31 | protocol/window-switcher-unstable-v1-server-protocol.c \ 32 | protocol/wlr-foreign-toplevel-management-unstable-v1-protocol.h \ 33 | protocol/wlr-foreign-toplevel-management-unstable-v1-client-protocol.h \ 34 | protocol/wlr-foreign-toplevel-management-unstable-v1-protocol.c \ 35 | protocol/wlr-layer-shell-unstable-v1-protocol.h \ 36 | protocol/wlr-layer-shell-unstable-v1-client-protocol.h \ 37 | protocol/wlr-layer-shell-unstable-v1-protocol.c 38 | 39 | 40 | 41 | 42 | distclean-local: 43 | rm -rf *.cache 44 | 45 | html: Makefile 46 | make -C doc html 47 | 48 | dist-bz2: dist 49 | zcat $(PACKAGE)-$(VERSION).tar.gz | \ 50 | bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2 51 | 52 | distcheck-bz2: distcheck 53 | zcat $(PACKAGE)-$(VERSION).tar.gz | \ 54 | bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2 55 | 56 | snapshot: dist 57 | mv $(PACKAGE)-$(VERSION).tar.gz \ 58 | $(PACKAGE)-$(VERSION)-r@REVISION@.tar.gz 59 | 60 | snapshot-bz2: dist-bz2 61 | mv $(PACKAGE)-$(VERSION).tar.bz2 \ 62 | $(PACKAGE)-$(VERSION)-r@REVISION@.tar.bz2 63 | 64 | .PHONY: ChangeLog 65 | 66 | ChangeLog: Makefile 67 | (GIT_DIR=$(top_srcdir)/.git git log > .changelog.tmp \ 68 | && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) \ 69 | || (touch ChangeLog; echo 'Git directory not found: installing possibly empty changelog.' >&2) 70 | 71 | dist-hook: ChangeLog 72 | 73 | .SECONDEXPANSION: 74 | 75 | define protostability 76 | $(if $(findstring unstable,$1),unstable,stable) 77 | endef 78 | 79 | define protoname 80 | $(shell echo $1 | $(SED) 's/\([a-z\-]\+\)-[a-z]\+-v[0-9]\+/\1/') 81 | endef 82 | 83 | protocol/xfway-shell-client-protocol.h : $(top_srcdir)/protocol/xfway-shell.xml 84 | $(AM_V_GEN) $(wayland_scanner) client-header $(top_srcdir)/protocol/xfway-shell.xml $(top_srcdir)/protocol/xfway-shell-client-protocol.h 85 | 86 | protocol/xfway-shell-client-protocol.c : $(top_srcdir)/protocol/xfway-shell.xml 87 | $(AM_V_GEN) $(wayland_scanner) private-code $(top_srcdir)/protocol/xfway-shell.xml $(top_srcdir)/protocol/xfway-shell-client-protocol.c 88 | 89 | protocol/xfway-shell-server-protocol.h : $(top_srcdir)/protocol/xfway-shell.xml 90 | $(AM_V_GEN) $(wayland_scanner) server-header $(top_srcdir)/protocol/xfway-shell.xml $(top_srcdir)/protocol/xfway-shell-server-protocol.h 91 | 92 | 93 | protocol/window-switcher-unstable-v1-server-protocol.h : $(top_srcdir)/protocol/window-switcher-unstable-v1.xml 94 | $(AM_V_GEN) $(wayland_scanner) server-header $(top_srcdir)/protocol/window-switcher-unstable-v1.xml $(top_srcdir)/protocol/window-switcher-unstable-v1-server-protocol.h 95 | 96 | protocol/window-switcher-unstable-v1-client-protocol.h : $(top_srcdir)/protocol/window-switcher-unstable-v1.xml 97 | $(AM_V_GEN) $(wayland_scanner) client-header $(top_srcdir)/protocol/window-switcher-unstable-v1.xml $(top_srcdir)/protocol/window-switcher-unstable-v1-client-protocol.h 98 | 99 | protocol/window-switcher-unstable-v1-server-protocol.c : $(top_srcdir)/protocol/window-switcher-unstable-v1.xml 100 | $(AM_V_GEN) $(wayland_scanner) private-code $(top_srcdir)/protocol/window-switcher-unstable-v1.xml $(top_srcdir)/protocol/window-switcher-unstable-v1-server-protocol.c 101 | 102 | 103 | protocol/wlr-foreign-toplevel-management-unstable-v1-protocol.h : $(top_srcdir)/protocol/wlr-foreign-toplevel-management-unstable-v1.xml 104 | $(AM_V_GEN) $(wayland_scanner) server-header $(top_srcdir)/protocol/wlr-foreign-toplevel-management-unstable-v1.xml $(top_srcdir)/protocol/wlr-foreign-toplevel-management-unstable-v1-protocol.h 105 | 106 | protocol/wlr-foreign-toplevel-management-unstable-v1-client-protocol.h : $(top_srcdir)/protocol/window-switcher-unstable-v1.xml 107 | $(AM_V_GEN) $(wayland_scanner) client-header $(top_srcdir)/protocol/wlr-foreign-toplevel-management-unstable-v1.xml $(top_srcdir)/protocol/wlr-foreign-toplevel-management-unstable-v1-client-protocol.h 108 | 109 | protocol/wlr-foreign-toplevel-management-unstable-v1-protocol.c : $(top_srcdir)/protocol/wlr-foreign-toplevel-management-unstable-v1.xml 110 | $(AM_V_GEN) $(wayland_scanner) private-code $(top_srcdir)/protocol/wlr-foreign-toplevel-management-unstable-v1.xml $(top_srcdir)/protocol/wlr-foreign-toplevel-management-unstable-v1-protocol.c 111 | 112 | 113 | protocol/wlr-layer-shell-unstable-v1-protocol.h : $(top_srcdir)/protocol/wlr-layer-shell-unstable-v1.xml 114 | $(AM_V_GEN) $(wayland_scanner) server-header $(top_srcdir)/protocol/wlr-layer-shell-unstable-v1.xml $(top_srcdir)/protocol/wlr-layer-shell-unstable-v1-protocol.h 115 | 116 | protocol/wlr-layer-shell-unstable-v1-client-protocol.h : $(top_srcdir)/protocol/wlr-layer-shell-unstable-v1.xml 117 | $(AM_V_GEN) $(wayland_scanner) client-header $(top_srcdir)/protocol/wlr-layer-shell-unstable-v1.xml $(top_srcdir)/protocol/wlr-layer-shell-unstable-v1-client-protocol.h 118 | 119 | protocol/wlr-layer-shell-unstable-v1-protocol.c : $(top_srcdir)/protocol/wlr-layer-shell-unstable-v1.xml 120 | $(AM_V_GEN) $(wayland_scanner) private-code $(top_srcdir)/protocol/wlr-layer-shell-unstable-v1.xml $(top_srcdir)/protocol/wlr-layer-shell-unstable-v1-protocol.c 121 | 122 | protocol/xdg-shell.h : $(top_srcdir)/protocol/xdg-shell-unstable-v6.xml 123 | $(AM_V_GEN) $(wayland_scanner) server-header $(top_srcdir)/protocol/xdg-shell-unstable-v6.xml $(top_srcdir)/protocol/xdg-shell.h 124 | 125 | protocol/xdg-shell.c : $(top_srcdir)/protocol/xdg-shell-unstable-v6.xml 126 | $(AM_V_GEN) $(wayland_scanner) private-code $(top_srcdir)/protocol/xdg-shell-unstable-v6.xml $(top_srcdir)/protocol/xdg-shell.c 127 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adlocode/xfway/d95c63ca2d15a41bbe22c76d488d57d492ee07ca/README -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # vi:set et ai sw=2 sts=2 ts=2: */ 4 | #- 5 | # Copyright (c) 2009 Jannis Pohlmann 6 | # 7 | # This program is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of 10 | # the License, or (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public 18 | # License along with this program; if not, write to the Free 19 | # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 | # Boston, MA 02110-1301, USA. 21 | 22 | (type xdt-autogen) >/dev/null 2>&1 || { 23 | cat >&2 < 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, 18 | * MA 02110-1301, USA. 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | #include "xfwm-common.h" 25 | 26 | 27 | 28 | void 29 | xfwm_widget_reparent (GtkWidget *widget, 30 | GtkWidget *new_parent) 31 | { 32 | GtkWidget *old_parent; 33 | 34 | g_return_if_fail (GTK_IS_WIDGET (widget)); 35 | g_return_if_fail (GTK_IS_CONTAINER (new_parent)); 36 | 37 | old_parent = gtk_widget_get_parent (widget); 38 | 39 | g_return_if_fail (old_parent != NULL); 40 | 41 | if (old_parent != new_parent) 42 | { 43 | g_object_ref (widget); 44 | gtk_container_remove (GTK_CONTAINER (old_parent), widget); 45 | gtk_container_add (GTK_CONTAINER (new_parent), widget); 46 | g_object_unref (widget); 47 | } 48 | } 49 | 50 | 51 | 52 | void 53 | xfwm_get_screen_dimensions (gint *width, gint *height) 54 | { 55 | #if GTK_CHECK_VERSION(3, 22, 0) 56 | GdkDisplay *display; 57 | GdkMonitor *monitor; 58 | GdkRectangle geometry; 59 | 60 | display = gdk_display_get_default (); 61 | monitor = gdk_display_get_primary_monitor (display); 62 | gdk_monitor_get_geometry (monitor, &geometry); 63 | 64 | if (width != NULL) 65 | *width = geometry.width; 66 | if (height != NULL) 67 | *height = geometry.height; 68 | #else 69 | if (width != NULL) 70 | *width = gdk_screen_width (); 71 | if (height != NULL) 72 | *height = gdk_screen_height (); 73 | #endif 74 | } 75 | 76 | 77 | 78 | static void 79 | xfwm_geometry_convert_to_device_pixels (GdkRectangle *geometry, 80 | gint scale) 81 | { 82 | if (geometry != NULL) 83 | { 84 | geometry->x *= scale; 85 | geometry->y *= scale; 86 | geometry->width *= scale; 87 | geometry->height *= scale; 88 | } 89 | } 90 | 91 | 92 | 93 | void 94 | xfwm_get_monitor_geometry (GdkScreen *screen, 95 | gint monitor_num, 96 | GdkRectangle *geometry, 97 | gboolean scaled) 98 | { 99 | gint scale; 100 | #if GTK_CHECK_VERSION(3, 22, 0) 101 | GdkDisplay *display; 102 | GdkMonitor *monitor; 103 | 104 | display = gdk_screen_get_display (screen); 105 | monitor = gdk_display_get_monitor (display, monitor_num); 106 | scale = gdk_monitor_get_scale_factor (monitor); 107 | gdk_monitor_get_geometry (monitor, geometry); 108 | #else 109 | scale = gdk_screen_get_monitor_scale_factor (screen, monitor_num); 110 | gdk_screen_get_monitor_geometry (screen, monitor_num, geometry); 111 | #endif 112 | 113 | if (scaled && scale != 1) 114 | xfwm_geometry_convert_to_device_pixels (geometry, scale); 115 | } 116 | 117 | 118 | 119 | void 120 | xfwm_get_primary_monitor_geometry (GdkScreen *screen, 121 | GdkRectangle *geometry, 122 | gboolean scaled) 123 | { 124 | gint scale; 125 | #if GTK_CHECK_VERSION(3, 22, 0) 126 | GdkDisplay *display; 127 | GdkMonitor *monitor; 128 | 129 | display = gdk_screen_get_display (screen); 130 | monitor = gdk_display_get_primary_monitor (display); 131 | scale = gdk_monitor_get_scale_factor (monitor); 132 | gdk_monitor_get_geometry (monitor, geometry); 133 | #else 134 | gint monitor_num; 135 | 136 | monitor_num = gdk_screen_get_primary_monitor (screen); 137 | scale = gdk_screen_get_monitor_scale_factor (screen, monitor_num); 138 | gdk_screen_get_monitor_geometry (screen, monitor_num, geometry); 139 | #endif 140 | 141 | if (scaled && scale != 1) 142 | xfwm_geometry_convert_to_device_pixels (geometry, scale); 143 | } 144 | 145 | 146 | 147 | gint 148 | xfwm_get_primary_refresh_rate (GdkScreen *screen) 149 | { 150 | #if GTK_CHECK_VERSION(3, 22, 0) 151 | GdkDisplay *display; 152 | GdkMonitor *monitor; 153 | 154 | display = gdk_screen_get_display (screen); 155 | monitor = gdk_display_get_primary_monitor (display); 156 | 157 | return gdk_monitor_get_refresh_rate (monitor) / 1000; 158 | #else 159 | return 60; 160 | #endif 161 | } 162 | 163 | 164 | 165 | gint 166 | xfwm_get_n_monitors (GdkScreen *screen) 167 | { 168 | #if GTK_CHECK_VERSION(3, 22, 0) 169 | return gdk_display_get_n_monitors (gdk_screen_get_display (screen)); 170 | #else 171 | return gdk_screen_get_n_monitors (screen); 172 | #endif 173 | } 174 | 175 | 176 | 177 | static gchar * 178 | substitute_screen_number (const gchar *display_name, 179 | gint screen_number) 180 | { 181 | GString *str; 182 | gchar *p; 183 | 184 | str = g_string_new (display_name); 185 | 186 | p = strrchr (str->str, '.'); 187 | if (p != NULL && p > strchr (str->str, ':')) 188 | { 189 | /* remove screen number from string */ 190 | g_string_truncate (str, p - str->str); 191 | } 192 | 193 | g_string_append_printf (str, ".%d", screen_number); 194 | 195 | return g_string_free (str, FALSE); 196 | } 197 | 198 | 199 | 200 | gchar * 201 | xfwm_make_display_name (GdkScreen *screen) 202 | { 203 | const gchar *name; 204 | gint number; 205 | 206 | name = gdk_display_get_name (gdk_screen_get_display (screen)); 207 | number = gdk_x11_screen_get_screen_number (screen); 208 | 209 | return substitute_screen_number (name, number); 210 | } 211 | -------------------------------------------------------------------------------- /common/xfwm-common.h: -------------------------------------------------------------------------------- 1 | /* vi:set sw=2 sts=2 ts=2 et ai tw=100: */ 2 | /*- 3 | * Copyright (c) 2017 Viktor Odintsev 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, 18 | * MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef __COMMON_H__ 22 | #define __COMMON_H__ 23 | 24 | #include 25 | 26 | void xfwm_widget_reparent (GtkWidget *widget, 27 | GtkWidget *new_parent); 28 | 29 | void xfwm_get_screen_dimensions (gint *width, 30 | gint *height); 31 | 32 | void xfwm_get_monitor_geometry (GdkScreen *screen, 33 | gint monitor_num, 34 | GdkRectangle *geometry, 35 | gboolean scaled); 36 | 37 | void xfwm_get_primary_monitor_geometry (GdkScreen *screen, 38 | GdkRectangle *geometry, 39 | gboolean scaled); 40 | 41 | gint xfwm_get_primary_refresh_rate (GdkScreen *screen); 42 | 43 | gint xfwm_get_n_monitors (GdkScreen *screen); 44 | 45 | gchar *xfwm_make_display_name (GdkScreen *screen); 46 | 47 | #endif /* !__COMMON_H__ */ 48 | -------------------------------------------------------------------------------- /configure.ac.in: -------------------------------------------------------------------------------- 1 | dnl configure.ac 2 | dnl 3 | dnl xfwm4 - window manager for the Xfce4 desktop environment 4 | dnl 5 | 6 | m4_define([xfwm4_version_major], [4]) 7 | m4_define([xfwm4_version_minor], [13]) 8 | m4_define([xfwm4_version_micro], [1]) 9 | m4_define([xfwm4_version_build], [@REVISION@]) 10 | m4_define([xfwm4_version_tag], [git]) 11 | m4_define([xfwm4_version], [xfwm4_version_major().xfwm4_version_minor().xfwm4_version_micro()ifelse(xfwm4_version_tag(), [git], [xfwm4_version_tag().xfwm4_version_build()], [xfwm4_version_tag()])]) 12 | 13 | m4_define([xfway_protocols_version], [1.0.0]) 14 | 15 | m4_define([gtk_minimum_version], [3.20.0]) 16 | m4_define([xfce_minimum_version], [4.8.0]) 17 | m4_define([libxfce4ui_minimum_version], [4.12.0]) 18 | m4_define([libxfce4kbd_private_minimum_version], [4.12.0]) 19 | m4_define([xfconf_minimum_version], [4.13.0]) 20 | m4_define([xfconf_legacy_version], [4.12.0]) 21 | m4_define([xcomposite_minimum_version], [0.2]) 22 | m4_define([wnck_minimum_version], [3.14]) 23 | m4_define([startup_notification_minimum_version], [0.5]) 24 | m4_define([intltool_minimum_version], [0.35]) 25 | m4_define([libepoxy_minimum_version], [1.0]) 26 | m4_define([xpresent_minimum_version], [1.0]) 27 | m4_define([presentproto_minimum_version], [1.1]) 28 | 29 | dnl init autoconf 30 | AC_COPYRIGHT([Copyright (c) 2002-2015 31 | The Xfce development team. All rights reserved. 32 | 33 | Written for Xfce by Olivier Fourdan .]) 34 | AC_INIT([xfway], [xfwm4_version], [xfce4-dev@xfce.org]) 35 | AM_INIT_AUTOMAKE([1.8 dist-bzip2 tar-ustar no-dist-gzip]) 36 | 37 | AC_CONFIG_MACRO_DIRS([m4]) 38 | AC_CONFIG_HEADERS([config.h]) 39 | 40 | AC_SUBST([XFWAY_PROTOCOLS_VERSION], [xfway_protocols_version]) 41 | 42 | PKG_CHECK_MODULES(WAYLAND_PROTOCOLS, [wayland-protocols >= 1.13], 43 | [ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`]) 44 | AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir) 45 | 46 | AC_ARG_VAR([wayland_scanner], [The wayland-scanner executable]) 47 | AC_PATH_PROG([wayland_scanner], [wayland-scanner]) 48 | if test x$wayland_scanner = x; then 49 | if test "x$cross_compiling" != "xyes"; then 50 | PKG_CHECK_MODULES(WAYLAND_SCANNER, [wayland-scanner]) 51 | wayland_scanner=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner` 52 | else 53 | AC_MSG_WARN([You are cross compiling without wayland-scanner in your path. make check will fail.]) 54 | fi 55 | fi 56 | 57 | AM_MAINTAINER_MODE() 58 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 59 | 60 | dnl set helper path prefix 61 | AC_ARG_WITH([helper-path-prefix], 62 | [AC_HELP_STRING([--with-helper-path-prefix=PATH], 63 | [Path prefix under which helper executables will be installed (default: $libdir)])], 64 | [HELPER_PATH_PREFIX="$withval"], 65 | [HELPER_PATH_PREFIX="$libdir"]) 66 | AC_SUBST([HELPER_PATH_PREFIX]) 67 | 68 | dnl check for UNIX variants 69 | AC_AIX 70 | AC_ISC_POSIX 71 | AC_MINIX 72 | AM_CONDITIONAL([HAVE_CYGWIN], [test "`uname | grep \"CYGWIN\"`" != ""]) 73 | 74 | dnl check for basic programs 75 | AC_PROG_CC 76 | AM_PROG_CC_C_O 77 | AC_PROG_INSTALL 78 | IT_PROG_INTLTOOL([intltool_minimum_version], [no-xml]) 79 | 80 | dnl check for libtool 81 | LT_PREREQ([2.2.6]) 82 | LT_INIT([disable-static]) 83 | 84 | dnl Check C Compiler Characteristics 85 | AC_C_INLINE 86 | 87 | dnl check for standard header files 88 | AC_HEADER_STDC 89 | AC_CHECK_HEADERS([stropts.h]) 90 | AC_CHECK_FUNCS([daemon setsid]) 91 | AC_CHECK_FUNCS(opendir) 92 | 93 | dnl Math lib is required (if available) 94 | MATH_LIBS="" 95 | AC_CHECK_LIB(m, ceil, MATH_LIBS="-lm") 96 | AC_SUBST([MATH_LIBS]) 97 | 98 | dnl Check for i18n support 99 | XDT_I18N([@LINGUAS@]) 100 | 101 | dnl Check for X11 window system 102 | XDT_CHECK_LIBX11_REQUIRE 103 | XDT_CHECK_LIBSM 104 | 105 | dnl Check for Xext library 106 | AC_CHECK_LIB([Xext], [XShapeCombineShape], 107 | [ 108 | if ! echo $LIBX11_LIBS | grep -q -- '-lXext'; then 109 | LIBX11_LIBS="$LIBX11_LIBS -lXext" 110 | fi 111 | ], [], [$LIBX11_CFLAGS $LIBX11_LDFLAGS $LIBX11_LIBS]) 112 | 113 | dnl Check for Xi library 114 | AC_CHECK_LIB([Xi], [XISelectEvents], 115 | [ 116 | if ! echo $LIBX11_LIBS | grep -q -- '-lXi'; then 117 | LIBX11_LIBS="$LIBX11_LIBS -lXi" 118 | AC_DEFINE([HAVE_XI2], [1], [Define to enable XI2]) 119 | fi 120 | ], [], [$LIBX11_CFLAGS $LIBX11_LDFLAGS $LIBX11_LIBS]) 121 | 122 | XDT_CHECK_PACKAGE([WAYLAND_SERVER], [wayland-server], [1.0.0]) 123 | XDT_CHECK_PACKAGE([WAYLAND_CLIENT], [wayland-client], [1.0.0]) 124 | XDT_CHECK_PACKAGE([LIBWESTON], [libweston-8], [6.0.0], 125 | [XDT_CHECK_PACKAGE([LIBWESTON_DESKTOP], [libweston-desktop-8], [6.0.0])], 126 | [XDT_CHECK_PACKAGE([LIBWESTON], [libweston-5], [5.0.0]) 127 | XDT_CHECK_PACKAGE([LIBWESTON_DESKTOP], [libweston-desktop-5], [5.0.0]) 128 | ]) 129 | XDT_CHECK_PACKAGE([LIBINPUT], [libinput], [1.10.0]) 130 | XDT_CHECK_PACKAGE([PIXMAN], [pixman-1], [0.34.0]) 131 | XDT_CHECK_PACKAGE([XKBCOMMON], [xkbcommon], [0.8.0]) 132 | XDT_CHECK_PACKAGE([EGL], [egl], [1.0.0]) 133 | XDT_CHECK_PACKAGE([EVDEV], [libevdev], [1.5.8]) 134 | 135 | XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [gtk_minimum_version]) 136 | XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [xfce_minimum_version]) 137 | XDT_CHECK_PACKAGE([LIBXFCE4UI], libxfce4ui-2, [libxfce4ui_minimum_version]) 138 | XDT_CHECK_PACKAGE([LIBXFCE4KBD_PRIVATE], libxfce4kbd-private-3, [libxfce4kbd_private_minimum_version]) 139 | XDT_CHECK_PACKAGE([LIBXFCONF], libxfconf-0, [xfconf_minimum_version],, 140 | [ 141 | AC_DEFINE([XFCONF_LEGACY], [], [Use dbus-glib provided by xfconf 4.12 to obtain array type]) 142 | XDT_CHECK_PACKAGE([LIBXFCONF], [libxfconf-0], [xfconf_legacy_version]) 143 | ]) 144 | XDT_CHECK_PACKAGE([LIBWNCK], [libwnck-3.0], [wnck_minimum_version]) 145 | XDT_CHECK_PACKAGE([XINERAMA], [xinerama], [0]) 146 | 147 | dnl AS_IF([test "x$USE_MAINTAINER_MODE" = "xyes"], 148 | dnl [ 149 | dnl AC_PATH_PROG([EXO_CSOURCE], [exo-csource]) 150 | dnl AS_IF([test -z "$EXO_CSOURCE"], 151 | dnl [ 152 | dnl echo '*** The program "exo-csource" is required to build when --enable-maintainer-mode' 153 | dnl echo '*** is specified.' 154 | dnl exit 1 155 | dnl ]) 156 | dnl AC_PATH_PROG([GLIB_COMPILE_RESOURCES], [glib-compile-resources]) 157 | dnl AS_IF([test -z "$GLIB_COMPILE_RESOURCES"], 158 | dnl [ 159 | dnl echo '*** The program "glib-compile-resources" is required to build when --dnl enable-maintainer-mode' 160 | dnl echo '*** is specified.' 161 | dnl exit 1 162 | dnl ]) 163 | dnl ]) 164 | 165 | dnl 166 | dnl Sync to vblank support 167 | dnl 168 | EPOXY_FOUND="no" 169 | XDT_CHECK_OPTIONAL_PACKAGE([EPOXY], 170 | [epoxy], [libepoxy_minimum_version], 171 | [epoxy], 172 | [library for handling OpenGL function pointer management], [yes]) 173 | 174 | dnl 175 | dnl Startup notification support 176 | dnl 177 | LIBSTARTUP_NOTIFICATION_FOUND="no" 178 | XDT_CHECK_OPTIONAL_PACKAGE([LIBSTARTUP_NOTIFICATION], 179 | [libstartup-notification-1.0], [startup_notification_minimum_version], 180 | [startup-notification], 181 | [startup notification library], [yes]) 182 | 183 | 184 | dnl 185 | dnl XSync support 186 | dnl 187 | XSYNC_LIBS= 188 | AC_ARG_ENABLE([xsync], 189 | AC_HELP_STRING([--enable-xsync], [try to use the xsync extension]) 190 | AC_HELP_STRING([--disable-xsync], [don't try to use the xsync extension]), 191 | [], [enable_xsync=yes]) 192 | have_xsync="no" 193 | if test x"$enable_xsync" = x"yes"; then 194 | AC_CHECK_LIB([Xext], [XSyncQueryExtension], 195 | [ have_xsync="yes" 196 | XSYNC_LIBS=" -lXext" 197 | AC_DEFINE([HAVE_XSYNC], [1], [Define to enable xsync]) 198 | ],[]) 199 | fi 200 | AC_SUBST([XSYNC_LIBS]) 201 | 202 | dnl 203 | dnl Render support 204 | dnl 205 | AC_ARG_ENABLE([render], 206 | AC_HELP_STRING([--enable-render], [try to use the render extension]) 207 | AC_HELP_STRING([--disable-render], [don't try to use the render extension]), 208 | [], [enable_render=yes]) 209 | have_render="no" 210 | RENDER_LIBS= 211 | if test x"$enable_render" = x"yes"; then 212 | if $PKG_CONFIG --print-errors --exists xrender 2>&1; then 213 | PKG_CHECK_MODULES(RENDER, xrender) 214 | have_render="yes" 215 | AC_DEFINE([HAVE_RENDER], [1], [Define to enable render]) 216 | else 217 | dnl fallback to check for libXrender 218 | AC_CHECK_LIB([Xrender], [XRenderCreatePicture], 219 | [ have_render="yes" 220 | RENDER_LIBS=" -lXrender" 221 | AC_DEFINE([HAVE_RENDER], [1], [Define to enable render]) 222 | ],[]) 223 | fi 224 | fi 225 | AC_SUBST([RENDER_LIBS]) 226 | 227 | dnl 228 | dnl RANDR extension 229 | dnl (please note that Xrandr requires Xrender - and no, it's not a typo ;) 230 | dnl 231 | AC_ARG_ENABLE([randr], 232 | AC_HELP_STRING([--enable-randr], [try to use the randr extension (requires render)]) 233 | AC_HELP_STRING([--disable-randr], [don't try to use the randr extension]), 234 | [], [enable_randr=yes]) 235 | RANDR_LIBS= 236 | have_xrandr="no" 237 | if test x"$enable_randr" = x"yes"; then 238 | if test x"$have_render" = x"yes"; then 239 | have_xrandr="no" 240 | ac_CFLAGS="$CFLAGS" 241 | CFLAGS="$CFLAGS $LIBX11_CFLAGS" 242 | AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration, 243 | [AC_CHECK_HEADER(X11/extensions/Xrandr.h, 244 | RANDR_LIBS="-lXrandr -lXrender" 245 | 246 | AC_DEFINE([HAVE_RANDR], [1], [Define to enable xrandr]) 247 | have_xrandr="yes",, 248 | [#include ])],, 249 | $LIBS $LIBX11_LDFLAGS $LIBX11_LIBS -lXrender -lXext) 250 | CFLAGS="$ac_CFLAGS" 251 | fi 252 | fi 253 | AC_SUBST([RANDR_LIBS]) 254 | 255 | dnl 256 | dnl XPresent support 257 | dnl 258 | AC_ARG_ENABLE([xpresent], 259 | AC_HELP_STRING([--enable-xpresent], [try to use the xpresent extension]) 260 | AC_HELP_STRING([--disable-xpresent], [don't try to use the xpresent extension]), 261 | [], [enable_xpresent=yes]) 262 | have_xpresent="no" 263 | XPRESENT_LIBS= 264 | if test x"$enable_xpresent" = x"yes"; then 265 | if $PKG_CONFIG --print-errors --exists xpresent 2>&1; then 266 | PKG_CHECK_MODULES(PRESENT_EXTENSION, presentproto >= [presentproto_minimum_version] xpresent) 267 | have_xpresent="yes" 268 | AC_DEFINE([HAVE_PRESENT_EXTENSION], [1], [Define to enable xpresent]) 269 | fi 270 | fi 271 | AC_SUBST([PRESENT_EXTENSION_LIBS]) 272 | 273 | dnl 274 | dnl Xcomposite and related extensions 275 | dnl 276 | compositor="no" 277 | ENABLE_COMPOSITOR="" 278 | 279 | AC_ARG_ENABLE([compositor], 280 | AC_HELP_STRING([--enable-compositor], [enable compositor in xfwm4 (default)]) 281 | AC_HELP_STRING([--disable-compositor], [disable compositor in xfwm4]), 282 | [], [enable_compositor=yes]) 283 | 284 | if test x"$enable_compositor" = x"yes"; then 285 | if test x"$have_render" = x"yes"; then 286 | if $PKG_CONFIG --print-errors --exists xcomposite xfixes xdamage xrender 2>&1; then 287 | PKG_CHECK_MODULES(COMPOSITOR, xcomposite >= [xcomposite_minimum_version] xfixes xdamage) 288 | AC_DEFINE([HAVE_COMPOSITOR], [1], [Define to enable compositor]) 289 | ENABLE_COMPOSITOR="--enable-compositor" 290 | AC_DEFINE([HAVE_COMPOSITOR], [1], [Define to enable compositor]) 291 | compositor="yes" 292 | fi 293 | fi 294 | fi 295 | AC_SUBST(ENABLE_COMPOSITOR) 296 | 297 | dnl 298 | dnl Old unsupported KDE systray protocol 299 | dnl 300 | ENABLE_KDE_SYSTRAY="" 301 | kde_systray="no" 302 | AC_ARG_ENABLE([kde_systray], 303 | AC_HELP_STRING([--enable-kde-systray], [enable KDE systray proxy (deprecated)]), 304 | kde_systray="$enableval", 305 | kde_systray="no") 306 | 307 | if test x"$kde_systray" = x"yes"; then 308 | AC_DEFINE([ENABLE_KDE_SYSTRAY_PROXY], [1], [Define to enable KDE systray proxy support]) 309 | ENABLE_KDE_SYSTRAY="--enable-kde-systray" 310 | fi 311 | AC_SUBST(ENABLE_KDE_SYSTRAY) 312 | 313 | dnl Check for debugging support 314 | XDT_FEATURE_DEBUG 315 | 316 | REVISION=unknown 317 | if test x"@REVISION@" != x""; then 318 | REVISION=@REVISION@ 319 | fi 320 | AC_DEFINE_UNQUOTED([REVISION], "$REVISION", [git id]) 321 | AC_SUBST([REVISION]) 322 | 323 | AC_CONFIG_FILES([ 324 | xfway-protocols.pc 325 | xfway-protocols-uninstalled.pc 326 | ]) 327 | 328 | AC_OUTPUT([ 329 | Makefile 330 | src/Makefile 331 | protocol/Makefile 332 | po/Makefile.in 333 | tests/test-switcher/Makefile 334 | ]) 335 | 336 | dnl XDT_CHECK_PACKAGE([XFWAY_PROTOCOLS], [xfway-protocols], [0.0.0]) 337 | 338 | echo 339 | echo "Build Configuration for $PACKAGE version $VERSION revision $REVISION:" 340 | echo " Startup notification support: $LIBSTARTUP_NOTIFICATION_FOUND" 341 | echo " XSync support: $have_xsync" 342 | echo " Render support: $have_render" 343 | echo " Xrandr support: $have_xrandr" 344 | echo " Xpresent support: $have_xpresent" 345 | echo " Embedded compositor: $compositor" 346 | echo " Epoxy support: $EPOXY_FOUND" 347 | echo " KDE systray protocol proxy: $kde_systray" 348 | echo 349 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project('xfway', 'c', 2 | default_options: 'c_std=c11') 3 | cc = meson.get_compiler('c') 4 | 5 | wayland_server = dependency('wayland-server') 6 | wayland_client = dependency('wayland-client') 7 | wayland_protocols = dependency('wayland-protocols') 8 | libweston = dependency ('libweston-4') 9 | libweston_desktop= dependency ('libweston-desktop-4') 10 | libinput = dependency('libinput') 11 | pixman = dependency('pixman-1') 12 | xkbcommon = dependency('xkbcommon') 13 | egl = dependency('egl') 14 | libevdev = dependency('libevdev') 15 | gtk = dependency('gtk+-3.0') 16 | m = cc.find_library('m', required : false) 17 | 18 | inc = include_directories('protocols') 19 | 20 | subdir ('protocols') 21 | 22 | executable('xfway', 'server.h', 'shell.c', 'shell.h', 'main-wayland.c', 'xfway-protocol.h', dependencies : [wayland_server, wayland_client, wayland_protocols, libinput, libweston, pixman, xkbcommon, egl, libevdev, libweston_desktop, gtk], 23 | include_directories : inc, 24 | link_with : server_protos) 25 | 26 | -------------------------------------------------------------------------------- /po/Makefile.in.in: -------------------------------------------------------------------------------- 1 | # Makefile for program source directory in GNU NLS utilities package. 2 | # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper 3 | # Copyright (C) 2004-2008 Rodney Dawes 4 | # 5 | # This file may be copied and used freely without restrictions. It may 6 | # be used in projects which are not available under a GNU Public License, 7 | # but which still want to provide support for the GNU gettext functionality. 8 | # 9 | # - Modified by Owen Taylor to use GETTEXT_PACKAGE 10 | # instead of PACKAGE and to look for po2tbl in ./ not in intl/ 11 | # 12 | # - Modified by jacob berkman to install 13 | # Makefile.in.in and po2tbl.sed.in for use with glib-gettextize 14 | # 15 | # - Modified by Rodney Dawes for use with intltool 16 | # 17 | # We have the following line for use by intltoolize: 18 | # INTLTOOL_MAKEFILE 19 | 20 | GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ 21 | PACKAGE = @PACKAGE@ 22 | VERSION = @VERSION@ 23 | 24 | SHELL = @SHELL@ 25 | 26 | srcdir = @srcdir@ 27 | top_srcdir = @top_srcdir@ 28 | top_builddir = @top_builddir@ 29 | VPATH = @srcdir@ 30 | 31 | prefix = @prefix@ 32 | exec_prefix = @exec_prefix@ 33 | datadir = @datadir@ 34 | datarootdir = @datarootdir@ 35 | libdir = @libdir@ 36 | localedir = @localedir@ 37 | subdir = po 38 | install_sh = @install_sh@ 39 | # Automake >= 1.8 provides @mkdir_p@. 40 | # Until it can be supposed, use the safe fallback: 41 | mkdir_p = $(install_sh) -d 42 | 43 | INSTALL = @INSTALL@ 44 | INSTALL_DATA = @INSTALL_DATA@ 45 | 46 | GMSGFMT = @GMSGFMT@ 47 | MSGFMT = @MSGFMT@ 48 | XGETTEXT_ARGS = @XGETTEXT_ARGS@ 49 | XGETTEXT = @XGETTEXT@ $(XGETTEXT_ARGS) 50 | INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ 51 | INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ 52 | MSGMERGE = XGETTEXT_ARGS="$(XGETTEXT_ARGS)" INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist 53 | GENPOT = XGETTEXT_ARGS="$(XGETTEXT_ARGS)" INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot 54 | 55 | ALL_LINGUAS = @ALL_LINGUAS@ 56 | 57 | PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi) 58 | 59 | USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep \^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep \^$$lang$$`"; then printf "$$lang "; fi; done; fi) 60 | 61 | USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done) 62 | 63 | POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done) 64 | 65 | DISTFILES = Makefile.in.in POTFILES.in $(POFILES) 66 | EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS 67 | 68 | POTFILES = \ 69 | # This comment gets stripped out 70 | 71 | CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done) 72 | 73 | .SUFFIXES: 74 | .SUFFIXES: .po .pox .gmo .mo .msg .cat 75 | 76 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 77 | INTLTOOL_V_MSGFMT = $(INTLTOOL__v_MSGFMT_$(V)) 78 | INTLTOOL__v_MSGFMT_= $(INTLTOOL__v_MSGFMT_$(AM_DEFAULT_VERBOSITY)) 79 | INTLTOOL__v_MSGFMT_0 = @echo " MSGFMT" $@; 80 | 81 | .po.pox: 82 | $(MAKE) $(GETTEXT_PACKAGE).pot 83 | $(MSGMERGE) $* $(GETTEXT_PACKAGE).pot -o $*.pox 84 | 85 | .po.mo: 86 | $(INTLTOOL_V_MSGFMT)$(MSGFMT) -o $@ $< 87 | 88 | .po.gmo: 89 | $(INTLTOOL_V_MSGFMT)file=`echo $* | sed 's,.*/,,'`.gmo \ 90 | && rm -f $$file && $(GMSGFMT) -o $$file $< 91 | 92 | .po.cat: 93 | sed -f ../intl/po2msg.sed < $< > $*.msg \ 94 | && rm -f $@ && gencat $@ $*.msg 95 | 96 | 97 | all: all-@USE_NLS@ 98 | 99 | all-yes: $(CATALOGS) 100 | all-no: 101 | 102 | $(GETTEXT_PACKAGE).pot: $(POTFILES) 103 | $(GENPOT) 104 | 105 | install: install-data 106 | install-data: install-data-@USE_NLS@ 107 | install-data-no: all 108 | install-data-yes: all 109 | linguas="$(USE_LINGUAS)"; \ 110 | for lang in $$linguas; do \ 111 | dir=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \ 112 | $(mkdir_p) $$dir; \ 113 | if test -r $$lang.gmo; then \ 114 | $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ 115 | echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \ 116 | else \ 117 | $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ 118 | echo "installing $(srcdir)/$$lang.gmo as" \ 119 | "$$dir/$(GETTEXT_PACKAGE).mo"; \ 120 | fi; \ 121 | if test -r $$lang.gmo.m; then \ 122 | $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \ 123 | echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \ 124 | else \ 125 | if test -r $(srcdir)/$$lang.gmo.m ; then \ 126 | $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \ 127 | $$dir/$(GETTEXT_PACKAGE).mo.m; \ 128 | echo "installing $(srcdir)/$$lang.gmo.m as" \ 129 | "$$dir/$(GETTEXT_PACKAGE).mo.m"; \ 130 | else \ 131 | true; \ 132 | fi; \ 133 | fi; \ 134 | done 135 | 136 | # Empty stubs to satisfy archaic automake needs 137 | dvi info ctags tags CTAGS TAGS ID: 138 | 139 | # Define this as empty until I found a useful application. 140 | install-exec installcheck: 141 | 142 | uninstall: 143 | linguas="$(USE_LINGUAS)"; \ 144 | for lang in $$linguas; do \ 145 | rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \ 146 | rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \ 147 | done 148 | 149 | check: all $(GETTEXT_PACKAGE).pot 150 | rm -f missing notexist 151 | srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m 152 | if [ -r missing -o -r notexist ]; then \ 153 | exit 1; \ 154 | fi 155 | 156 | mostlyclean: 157 | rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp 158 | rm -f .intltool-merge-cache 159 | 160 | clean: mostlyclean 161 | 162 | distclean: clean 163 | rm -f Makefile Makefile.in POTFILES stamp-it 164 | rm -f *.mo *.msg *.cat *.cat.m *.gmo 165 | 166 | maintainer-clean: distclean 167 | @echo "This command is intended for maintainers to use;" 168 | @echo "it deletes files that may require special tools to rebuild." 169 | rm -f Makefile.in.in 170 | 171 | distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) 172 | dist distdir: $(DISTFILES) 173 | dists="$(DISTFILES)"; \ 174 | extra_dists="$(EXTRA_DISTFILES)"; \ 175 | for file in $$extra_dists; do \ 176 | test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \ 177 | done; \ 178 | for file in $$dists; do \ 179 | test -f $$file || file="$(srcdir)/$$file"; \ 180 | ln $$file $(distdir) 2> /dev/null \ 181 | || cp -p $$file $(distdir); \ 182 | done 183 | 184 | update-po: Makefile 185 | $(MAKE) $(GETTEXT_PACKAGE).pot 186 | tmpdir=`pwd`; \ 187 | linguas="$(USE_LINGUAS)"; \ 188 | for lang in $$linguas; do \ 189 | echo "$$lang:"; \ 190 | result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \ 191 | if $$result; then \ 192 | if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ 193 | rm -f $$tmpdir/$$lang.new.po; \ 194 | else \ 195 | if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ 196 | :; \ 197 | else \ 198 | echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ 199 | rm -f $$tmpdir/$$lang.new.po; \ 200 | exit 1; \ 201 | fi; \ 202 | fi; \ 203 | else \ 204 | echo "msgmerge for $$lang.gmo failed!"; \ 205 | rm -f $$tmpdir/$$lang.new.po; \ 206 | fi; \ 207 | done 208 | 209 | Makefile POTFILES: stamp-it 210 | @if test ! -f $@; then \ 211 | rm -f stamp-it; \ 212 | $(MAKE) stamp-it; \ 213 | fi 214 | 215 | stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in 216 | cd $(top_builddir) \ 217 | && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \ 218 | $(SHELL) ./config.status 219 | 220 | # Tell versions [3.59,3.63) of GNU make not to export all variables. 221 | # Otherwise a system limit (for SysV at least) may be exceeded. 222 | .NOEXPORT: 223 | -------------------------------------------------------------------------------- /po/POTFILES: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adlocode/xfway/d95c63ca2d15a41bbe22c76d488d57d492ee07ca/po/POTFILES -------------------------------------------------------------------------------- /po/stamp-it: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adlocode/xfway/d95c63ca2d15a41bbe22c76d488d57d492ee07ca/po/stamp-it -------------------------------------------------------------------------------- /protocol/Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | unstable_protocols_SOURCES = \ 4 | xfway-shell.xml \ 5 | $(NULL) 6 | 7 | unstable_protocols_CFLAGS = \ 8 | $(WAYLAND_PROTOCOLS_CFLAGS) \ 9 | $(NULL) 10 | 11 | unstable_protocols_LDADD = \ 12 | $(WAYLAND_PROTOCOLS_LIBS) \ 13 | $(NULL) 14 | 15 | stable_protocols = \ 16 | \ 17 | $(NULL) 18 | 19 | nobase_dist_pkgdata_DATA = \ 20 | $(unstable_protocols) \ 21 | $(stable_protocols) \ 22 | $(NULL) 23 | 24 | #dist_noinst_DATA = \ 25 | #$(sort $(foreach p,$(unstable_protocols),$(dir $p)README)) \ 26 | #$(sort $(foreach p,$(stable_protocols),$(dir $p)README)) \ 27 | # $(NULL) 28 | 29 | #noarch_pkgconfig_DATA = wayland-protocols.pc 30 | 31 | dist_check_SCRIPTS = scan.sh 32 | 33 | TESTS = $(unstable_protocols) $(stable_protocols) 34 | TEST_EXTENSIONS = .xml 35 | AM_TESTS_ENVIRONMENT = SCANNER='$(wayland_scanner)'; export SCANNER; 36 | XML_LOG_COMPILER = $(srcdir)/scan.sh 37 | -------------------------------------------------------------------------------- /protocol/meson.build: -------------------------------------------------------------------------------- 1 | wl_protocol_dir = wayland_protocols.get_pkgconfig_variable('pkgdatadir') 2 | 3 | wayland_scanner = find_program('wayland-scanner') 4 | 5 | #should check wayland_scanner's version, but it is hard to get 6 | if wayland_server.version().version_compare('>=1.14.91') 7 | code_type = 'private-code' 8 | else 9 | code_type = 'code' 10 | endif 11 | 12 | wayland_scanner_code = generator( 13 | wayland_scanner, 14 | output: '@BASENAME@-protocol.c', 15 | arguments: [code_type, '@INPUT@', '@OUTPUT@'], 16 | ) 17 | 18 | wayland_scanner_client = generator( 19 | wayland_scanner, 20 | output: '@BASENAME@-client-protocol.h', 21 | arguments: ['client-header', '@INPUT@', '@OUTPUT@'], 22 | ) 23 | 24 | wayland_scanner_server = generator( 25 | wayland_scanner, 26 | output: '@BASENAME@-protocol.h', 27 | arguments: ['server-header', '@INPUT@', '@OUTPUT@'], 28 | ) 29 | 30 | client_protocols = [ 31 | 32 | ] 33 | 34 | server_protocols = [ 35 | ['xfway.xml'], 36 | ] 37 | 38 | client_protos_src = [] 39 | client_protos_headers = [] 40 | 41 | server_protos_src = [] 42 | server_protos_headers = [] 43 | 44 | foreach p : client_protocols 45 | xml = join_paths(p) 46 | client_protos_src += wayland_scanner_code.process(xml) 47 | client_protos_headers += wayland_scanner_client.process(xml) 48 | endforeach 49 | 50 | foreach p : server_protocols 51 | xml = join_paths(p) 52 | server_protos_src += wayland_scanner_code.process(xml) 53 | server_protos_headers += wayland_scanner_server.process(xml) 54 | endforeach 55 | 56 | lib_client_protos = static_library( 57 | 'client_protos', 58 | client_protos_src + client_protos_headers, 59 | dependencies: [wayland_client] 60 | ) # for the include directory 61 | 62 | client_protos = declare_dependency( 63 | link_with: lib_client_protos, 64 | sources: client_protos_headers, 65 | ) 66 | 67 | lib_server_protos = static_library( 68 | 'server_protos', 69 | server_protos_src + server_protos_headers, 70 | dependencies: [wayland_client] 71 | ) # for the include directory 72 | 73 | server_protos = declare_dependency( 74 | link_with: lib_server_protos, 75 | sources: server_protos_headers, 76 | ) 77 | -------------------------------------------------------------------------------- /protocol/scan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | if [ "x$SCANNER" = "x" ] ; then 4 | echo "No scanner present, test skipped." 1>&2 5 | exit 77 6 | fi 7 | 8 | $SCANNER client-header --strict $1 /dev/null 9 | $SCANNER server-header --strict $1 /dev/null 10 | $SCANNER private-code --strict $1 /dev/null 11 | $SCANNER public-code --strict $1 /dev/null 12 | -------------------------------------------------------------------------------- /protocol/window-switcher-unstable-v1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Copyright © 2017 Quentin "Sardem FF7" Glidic 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | 24 | 25 | 26 | 27 | The object is a singleton global. 28 | 29 | This interface can only be bound once at the same time. 30 | Any binding of this interface while already bound results 31 | in a protocol error (bound). 32 | Compositors are expected to restrict this interface to trusted clients. 33 | 34 | This interface is intended for window switchers of any kind. 35 | 36 | 37 | 38 | 39 | 40 | 41 | These errors can be emitted in response to 42 | ww_window_switcher requests. 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | This event will be sent whenever the implicit grab is broken. 53 | When receiving this event, the client must destroy the wl_surface. 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | The object is a singleton global. 62 | 63 | This interface can only be bound once at the same time. 64 | Any binding of this interface while already bound results 65 | in a protocol error (bound). 66 | 67 | Compositors are expected to restrict this interface to trusted clients. 68 | 69 | 70 | 71 | 72 | 73 | 74 | These errors can be emitted in response to 75 | ww_window_switcher_window requests. 76 | 77 | 78 | 79 | 80 | 81 | 82 | Tell the compositor to switch to this window. 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | Tell the compositor to close this window. 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | This tells the compositor to draw a thumbnail of the window 99 | in the given rectangle. 100 | 101 | All of x, y, width and height must be positive. And width and 102 | height must be strictly positive. Otherwise, a protocol error 103 | (invalid_rectangle) is raised. 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | This event will be sent whenever all data for this window has 133 | been transmitted. 134 | 135 | If some data event was not received, it means the data was 136 | unavailable. 137 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /protocol/wlr-foreign-toplevel-management-unstable-v1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Copyright © 2018 Ilia Bozhinov 5 | 6 | Permission to use, copy, modify, distribute, and sell this 7 | software and its documentation for any purpose is hereby granted 8 | without fee, provided that the above copyright notice appear in 9 | all copies and that both that copyright notice and this permission 10 | notice appear in supporting documentation, and that the name of 11 | the copyright holders not be used in advertising or publicity 12 | pertaining to distribution of the software without specific, 13 | written prior permission. The copyright holders make no 14 | representations about the suitability of this software for any 15 | purpose. It is provided "as is" without express or implied 16 | warranty. 17 | 18 | THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 19 | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 22 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 23 | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 24 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 25 | THIS SOFTWARE. 26 | 27 | 28 | 29 | 30 | The purpose of this protocol is to enable the creation of taskbars 31 | and docks by providing them with a list of opened applications and 32 | letting them request certain actions on them, like maximizing, etc. 33 | 34 | After a client binds the zwlr_foreign_toplevel_manager_v1, each opened 35 | toplevel window will be sent via the toplevel event 36 | 37 | 38 | 39 | 40 | This event is emitted whenever a new toplevel window is created. It 41 | is emitted for all toplevels, regardless of the app that has created 42 | them. 43 | 44 | All initial details of the toplevel(title, app_id, states, etc.) will 45 | be sent immediately after this event via the corresponding events in 46 | zwlr_foreign_toplevel_handle_v1. 47 | 48 | 49 | 50 | 51 | 52 | 53 | Indicates the client no longer wishes to receive events for new toplevels. 54 | However the compositor may emit further toplevel_created events, until 55 | the finished event is emitted. 56 | 57 | The client must not send any more requests after this one. 58 | 59 | 60 | 61 | 62 | 63 | This event indicates that the compositor is done sending events to the 64 | zwlr_foreign_toplevel_manager_v1. The server will destroy the object 65 | immediately after sending this request, so it will become invalid and 66 | the client should free any resources associated with it. 67 | 68 | 69 | 70 | 71 | 72 | 73 | A zwlr_foreign_toplevel_handle_v1 object represents an opened toplevel 74 | window. Each app may have multiple opened toplevels. 75 | 76 | Each toplevel has a list of outputs it is visible on, conveyed to the 77 | client with the output_enter and output_leave events. 78 | 79 | 80 | 81 | 82 | This event is emitted whenever the title of the toplevel changes. 83 | 84 | 85 | 86 | 87 | 88 | 89 | This event is emitted whenever the app-id of the toplevel changes. 90 | 91 | 92 | 93 | 94 | 95 | 96 | This event is emitted whenever the toplevel becomes visible on 97 | the given output. A toplevel may be visible on multiple outputs. 98 | 99 | 100 | 101 | 102 | 103 | 104 | This event is emitted whenever the toplevel stops being visible on 105 | the given output. It is guaranteed that an entered-output event 106 | with the same output has been emitted before this event. 107 | 108 | 109 | 110 | 111 | 112 | 113 | Requests that the toplevel be maximized. If the maximized state actually 114 | changes, this will be indicated by the state event. 115 | 116 | 117 | 118 | 119 | 120 | Requests that the toplevel be unmaximized. If the maximized state actually 121 | changes, this will be indicated by the state event. 122 | 123 | 124 | 125 | 126 | 127 | Requests that the toplevel be minimized. If the minimized state actually 128 | changes, this will be indicated by the state event. 129 | 130 | 131 | 132 | 133 | 134 | Requests that the toplevel be unminimized. If the minimized state actually 135 | changes, this will be indicated by the state event. 136 | 137 | 138 | 139 | 140 | 141 | Request that this toplevel be activated on the given seat. 142 | There is no guarantee the toplevel will be actually activated. 143 | 144 | 145 | 146 | 147 | 148 | 149 | The different states that a toplevel can have. These have the same meaning 150 | as the states with the same names defined in xdg-toplevel 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | This event is emitted immediately after the zlw_foreign_toplevel_handle_v1 162 | is created and each time the toplevel state changes, either because of a 163 | compositor action or because of a request in this protocol. 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | This event is sent after all changes in the toplevel state have been 172 | sent. 173 | 174 | This allows changes to the zwlr_foreign_toplevel_handle_v1 properties 175 | to be seen as atomic, even if they happen via multiple events. 176 | 177 | 178 | 179 | 180 | 181 | Send a request to the toplevel to close itself. The compositor would 182 | typically use a shell-specific method to carry out this request, for 183 | example by sending the xdg_toplevel.close event. However, this gives 184 | no guarantees the toplevel will actually be destroyed. If and when 185 | this happens, the zwlr_foreign_toplevel_handle_v1.closed event will 186 | be emitted. 187 | 188 | 189 | 190 | 191 | 192 | The rectangle of the surface specified in this request corresponds to 193 | the place where the app using this protocol represents the given toplevel. 194 | It can be used by the compositor as a hint for some operations, e.g 195 | minimizing. The client is however not required to set this, in which 196 | case the compositor is free to decide some default value. 197 | 198 | If the client specifies more than one rectangle, only the last one is 199 | considered. 200 | 201 | The dimensions are given in surface-local coordinates. 202 | Setting width=height=0 removes the already-set rectangle. 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 215 | 216 | 217 | 218 | 219 | This event means the toplevel has been destroyed. It is guaranteed there 220 | won't be any more events for this zwlr_foreign_toplevel_handle_v1. The 221 | toplevel itself becomes inert so any requests will be ignored except the 222 | destroy request. 223 | 224 | 225 | 226 | 227 | 228 | Destroys the zwlr_foreign_toplevel_handle_v1 object. 229 | 230 | This request should be called either when the client does not want to 231 | use the toplevel anymore or after the closed event to finalize the 232 | destruction of the object. 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | Requests that the toplevel be fullscreened on the given output. If the 241 | fullscreen state and/or the outputs the toplevel is visible on actually 242 | change, this will be indicated by the state and output_enter/leave 243 | events. 244 | 245 | The output parameter is only a hint to the compositor. Also, if output 246 | is NULL, the compositor should decide which output the toplevel will be 247 | fullscreened on, if at all. 248 | 249 | 250 | 251 | 252 | 253 | 254 | Requests that the toplevel be unfullscreened. If the fullscreen state 255 | actually changes, this will be indicated by the state event. 256 | 257 | 258 | 259 | 260 | -------------------------------------------------------------------------------- /protocol/wlr-layer-shell-unstable-v1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Copyright © 2017 Drew DeVault 5 | 6 | Permission to use, copy, modify, distribute, and sell this 7 | software and its documentation for any purpose is hereby granted 8 | without fee, provided that the above copyright notice appear in 9 | all copies and that both that copyright notice and this permission 10 | notice appear in supporting documentation, and that the name of 11 | the copyright holders not be used in advertising or publicity 12 | pertaining to distribution of the software without specific, 13 | written prior permission. The copyright holders make no 14 | representations about the suitability of this software for any 15 | purpose. It is provided "as is" without express or implied 16 | warranty. 17 | 18 | THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 19 | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 22 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 23 | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 24 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 25 | THIS SOFTWARE. 26 | 27 | 28 | 29 | 30 | Clients can use this interface to assign the surface_layer role to 31 | wl_surfaces. Such surfaces are assigned to a "layer" of the output and 32 | rendered with a defined z-depth respective to each other. They may also be 33 | anchored to the edges and corners of a screen and specify input handling 34 | semantics. This interface should be suitable for the implementation of 35 | many desktop shell components, and a broad number of other applications 36 | that interact with the desktop. 37 | 38 | 39 | 40 | 41 | Create a layer surface for an existing surface. This assigns the role of 42 | layer_surface, or raises a protocol error if another role is already 43 | assigned. 44 | 45 | Creating a layer surface from a wl_surface which has a buffer attached 46 | or committed is a client error, and any attempts by a client to attach 47 | or manipulate a buffer prior to the first layer_surface.configure call 48 | must also be treated as errors. 49 | 50 | You may pass NULL for output to allow the compositor to decide which 51 | output to use. Generally this will be the one that the user most 52 | recently interacted with. 53 | 54 | Clients can specify a namespace that defines the purpose of the layer 55 | surface. 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | These values indicate which layers a surface can be rendered in. They 73 | are ordered by z depth, bottom-most first. Traditional shell surfaces 74 | will typically be rendered between the bottom and top layers. 75 | Fullscreen shell surfaces are typically rendered at the top layer. 76 | Multiple surfaces can share a single layer, and ordering within a 77 | single layer is undefined. 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | An interface that may be implemented by a wl_surface, for surfaces that 90 | are designed to be rendered as a layer of a stacked desktop-like 91 | environment. 92 | 93 | Layer surface state (size, anchor, exclusive zone, margin, interactivity) 94 | is double-buffered, and will be applied at the time wl_surface.commit of 95 | the corresponding wl_surface is called. 96 | 97 | 98 | 99 | 100 | Sets the size of the surface in surface-local coordinates. The 101 | compositor will display the surface centered with respect to its 102 | anchors. 103 | 104 | If you pass 0 for either value, the compositor will assign it and 105 | inform you of the assignment in the configure event. You must set your 106 | anchor to opposite edges in the dimensions you omit; not doing so is a 107 | protocol error. Both values are 0 by default. 108 | 109 | Size is double-buffered, see wl_surface.commit. 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | Requests that the compositor anchor the surface to the specified edges 118 | and corners. If two orthoginal edges are specified (e.g. 'top' and 119 | 'left'), then the anchor point will be the intersection of the edges 120 | (e.g. the top left corner of the output); otherwise the anchor point 121 | will be centered on that edge, or in the center if none is specified. 122 | 123 | Anchor is double-buffered, see wl_surface.commit. 124 | 125 | 126 | 127 | 128 | 129 | 130 | Requests that the compositor avoids occluding an area of the surface 131 | with other surfaces. The compositor's use of this information is 132 | implementation-dependent - do not assume that this region will not 133 | actually be occluded. 134 | 135 | A positive value is only meaningful if the surface is anchored to an 136 | edge, rather than a corner. The zone is the number of surface-local 137 | coordinates from the edge that are considered exclusive. 138 | 139 | Surfaces that do not wish to have an exclusive zone may instead specify 140 | how they should interact with surfaces that do. If set to zero, the 141 | surface indicates that it would like to be moved to avoid occluding 142 | surfaces with a positive excluzive zone. If set to -1, the surface 143 | indicates that it would not like to be moved to accommodate for other 144 | surfaces, and the compositor should extend it all the way to the edges 145 | it is anchored to. 146 | 147 | For example, a panel might set its exclusive zone to 10, so that 148 | maximized shell surfaces are not shown on top of it. A notification 149 | might set its exclusive zone to 0, so that it is moved to avoid 150 | occluding the panel, but shell surfaces are shown underneath it. A 151 | wallpaper or lock screen might set their exclusive zone to -1, so that 152 | they stretch below or over the panel. 153 | 154 | The default value is 0. 155 | 156 | Exclusive zone is double-buffered, see wl_surface.commit. 157 | 158 | 159 | 160 | 161 | 162 | 163 | Requests that the surface be placed some distance away from the anchor 164 | point on the output, in surface-local coordinates. Setting this value 165 | for edges you are not anchored to has no effect. 166 | 167 | The exclusive zone includes the margin. 168 | 169 | Margin is double-buffered, see wl_surface.commit. 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | Set to 1 to request that the seat send keyboard events to this layer 180 | surface. For layers below the shell surface layer, the seat will use 181 | normal focus semantics. For layers above the shell surface layers, the 182 | seat will always give exclusive keyboard focus to the top-most layer 183 | which has keyboard interactivity set to true. 184 | 185 | Layer surfaces receive pointer, touch, and tablet events normally. If 186 | you do not want to receive them, set the input region on your surface 187 | to an empty region. 188 | 189 | Events is double-buffered, see wl_surface.commit. 190 | 191 | 192 | 193 | 194 | 195 | 196 | This assigns an xdg_popup's parent to this layer_surface. This popup 197 | should have been created via xdg_surface::get_popup with the parent set 198 | to NULL, and this request must be invoked before committing the popup's 199 | initial state. 200 | 201 | See the documentation of xdg_popup for more details about what an 202 | xdg_popup is and how it is used. 203 | 204 | 205 | 206 | 207 | 208 | 209 | When a configure event is received, if a client commits the 210 | surface in response to the configure event, then the client 211 | must make an ack_configure request sometime before the commit 212 | request, passing along the serial of the configure event. 213 | 214 | If the client receives multiple configure events before it 215 | can respond to one, it only has to ack the last configure event. 216 | 217 | A client is not required to commit immediately after sending 218 | an ack_configure request - it may even ack_configure several times 219 | before its next surface commit. 220 | 221 | A client may send multiple ack_configure requests before committing, but 222 | only the last request sent before a commit indicates which configure 223 | event the client really is responding to. 224 | 225 | 226 | 227 | 228 | 229 | 230 | This request destroys the layer surface. 231 | 232 | 233 | 234 | 235 | 236 | The configure event asks the client to resize its surface. 237 | 238 | Clients should arrange their surface for the new states, and then send 239 | an ack_configure request with the serial sent in this configure event at 240 | some point before committing the new surface. 241 | 242 | The client is free to dismiss all but the last configure event it 243 | received. 244 | 245 | The width and height arguments specify the size of the window in 246 | surface-local coordinates. 247 | 248 | The size is a hint, in the sense that the client is free to ignore it if 249 | it doesn't resize, pick a smaller size (to satisfy aspect ratio or 250 | resize in steps of NxM pixels). If the client picks a smaller size and 251 | is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the 252 | surface will be centered on this axis. 253 | 254 | If the width or height arguments are zero, it means the client should 255 | decide its own window dimension. 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | The closed event is sent by the compositor when the surface will no 265 | longer be shown. The output may have been destroyed or the user may 266 | have asked for it to be removed. Further changes to the surface will be 267 | ignored. The client should destroy the resource after receiving this 268 | event, and create a new surface if they so choose. 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | -------------------------------------------------------------------------------- /protocol/xfway-shell.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Traditional user interfaces can rely on this interface to define the 6 | foundations of typical desktops. Currently it's possible to set up 7 | background, panels and locking surfaces. 8 | 9 | 10 | 11 | 12 | Tell the client to create an alt-tab switcher. 13 | 14 | 15 | 16 | 17 | 18 | Tell the client to select the next window in the switcher. 19 | 20 | 21 | 22 | 23 | 24 | Tell the client to destroy the alt-tab switcher. 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = xfway xfway-shell 2 | 3 | AM_CPPFLAGS = \ 4 | -DBINDIR='"$(bindir)"' \ 5 | -DLIBEXECDIR='"$(libexecdir)"' 6 | 7 | xfway_SOURCES = \ 8 | $(top_srcdir)/protocol/xfway-shell-client-protocol.c \ 9 | $(top_srcdir)/protocol/xfway-shell-client-protocol.h \ 10 | $(top_srcdir)/protocol/xfway-shell-server-protocol.h \ 11 | $(top_srcdir)/protocol/window-switcher-unstable-v1-server-protocol.c \ 12 | $(top_srcdir)/protocol/window-switcher-unstable-v1-server-protocol.h \ 13 | $(top_srcdir)/util/signal.c \ 14 | $(top_srcdir)/util/signal.h \ 15 | $(top_srcdir)/protocol/wlr-foreign-toplevel-management-unstable-v1-protocol.c \ 16 | $(top_srcdir)/wlr-foreign-toplevel-management-unstable-v1-protocol.h \ 17 | wlr_foreign_toplevel_management_v1.c \ 18 | wlr_foreign_toplevel_management_v1.h \ 19 | $(top_srcdir)/protocol/wlr-layer-shell-unstable-v1-protocol.c \ 20 | $(top_srcdir)/protocol/wlr-layer-shell-unstable-v1-protocol.h \ 21 | wlr_layer_shell_v1.c \ 22 | wlr_layer_shell_v1.h \ 23 | $(top_srcdir)/protocol/xdg-shell.c \ 24 | $(top_srcdir)/protocol/xdg-shell.h \ 25 | os-compatibility.c \ 26 | os-compatibility.h \ 27 | $(top_srcdir)/util/helpers.h \ 28 | xfway.h \ 29 | window-switcher.c \ 30 | shell.c \ 31 | shell.h \ 32 | server.h \ 33 | main-wayland.c 34 | 35 | xfway_CFLAGS = \ 36 | $(WAYLAND_SERVER_CFLAGS) \ 37 | $(LIBWESTON_CFLAGS) \ 38 | $(LIBWESTON_DESKTOP_CFLAGS) \ 39 | $(LIBINPUT_CFLAGS) \ 40 | $(XKBCOMMON_CFLAGS) \ 41 | $(EGL_CFLAGS) \ 42 | $(EVDEV_CFLAGS) \ 43 | $(GTK_CFLAGS) \ 44 | $(LIBXFCONF_CFLAGS) 45 | 46 | xfway_LDADD = \ 47 | $(WAYLAND_SERVER_LIBS) \ 48 | $(LIBWESTON_LIBS) \ 49 | $(LIBWESTON_DESKTOP_LIBS) \ 50 | $(LIBINPUT_LIBS) \ 51 | $(XKBCOMMON_LIBS) \ 52 | $(EGL_LIBS) \ 53 | $(EVDEV_LIBS) \ 54 | $(PIXMAN_LIBS) \ 55 | $(GTK_LIBS) \ 56 | $(LIBXFCONF_LIBS) 57 | 58 | xfway_shell_SOURCES = \ 59 | $(top_srcdir)/protocol/xfway-shell-client-protocol.c \ 60 | $(top_srcdir)/protocol/xfway-shell-client-protocol.h \ 61 | $(top_srcdir)/protocol/wlr-foreign-toplevel-management-unstable-v1-protocol.c \ 62 | $(top_srcdir)/protocol/wlr-foreign-toplevel-management-unstable-v1-client-protocol.h \ 63 | display.h \ 64 | screen.c \ 65 | screen.h \ 66 | client.c \ 67 | client.h \ 68 | stacking.c \ 69 | stacking.h \ 70 | settings.h \ 71 | tabwin.c \ 72 | tabwin.h \ 73 | $(top_srcdir)/common/xfwm-common.c \ 74 | $(top_srcdir)/common/xfwm-common.h \ 75 | $(top_srcdir)/util/libgwater-wayland.c \ 76 | $(top_srcdir)/util/libgwater-wayland.h \ 77 | $(top_srcdir)/util/helpers.h \ 78 | main-shell-client.c 79 | 80 | xfway_shell_CFLAGS = \ 81 | $(WAYLAND_CLIENT_CFLAGS) \ 82 | $(WAYLAND_PROTOCOLS_CFLAGS) \ 83 | $(GTK_CFLAGS) 84 | 85 | xfway_shell_LDADD = \ 86 | $(WAYLAND_CLIENT_LIBS) \ 87 | $(WAYLAND_PROTOCOLS_LIBS) \ 88 | $(GTK_LIBS) 89 | 90 | -------------------------------------------------------------------------------- /src/client.c: -------------------------------------------------------------------------------- 1 | /* $Id$ 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2, or (at your option) 6 | any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | MA 02110-1301, USA. 17 | 18 | 19 | oroborus - (c) 2001 Ken Lynch 20 | xfwm4 - (c) 2002-2011 Olivier Fourdan 21 | 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include "client.h" 39 | #include "screen.h" 40 | #include "stacking.h" 41 | 42 | Client * 43 | clientFrame (ScreenInfo *screen_info, 44 | struct zwlr_foreign_toplevel_handle_v1 *toplevel_handle, 45 | gboolean recapture) 46 | { 47 | Client *c = NULL; 48 | gboolean shaped; 49 | unsigned long valuemask; 50 | long pid; 51 | int i; 52 | 53 | c = g_new0 (Client, 1); 54 | if (!c) 55 | { 56 | fprintf (stderr, "cannot allocate memory for the window structure\n"); 57 | return NULL; 58 | } 59 | 60 | c->toplevel_handle = toplevel_handle; 61 | c->screen_info = screen_info; 62 | 63 | c->name = NULL; 64 | 65 | clientAddToList (c); 66 | 67 | return c; 68 | } 69 | 70 | static void 71 | clientFree (Client *c) 72 | { 73 | g_return_if_fail (c != NULL); 74 | 75 | g_free (c); 76 | } 77 | 78 | void 79 | clientUnframe (Client *c, gboolean remap) 80 | { 81 | clientRemoveFromList (c); 82 | 83 | clientFree (c); 84 | } 85 | -------------------------------------------------------------------------------- /src/client.h: -------------------------------------------------------------------------------- 1 | /* $Id$ 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2, or (at your option) 6 | any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | MA 02110-1301, USA. 17 | 18 | 19 | oroborus - (c) 2001 Ken Lynch 20 | xfwm4 - (c) 2002-2011 Olivier Fourdan 21 | 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | #include 38 | #include "display.h" 39 | #include "screen.h" 40 | 41 | 42 | #ifndef INC_CLIENT_H 43 | #define INC_CLIENT_H 44 | 45 | #define APPLY +1 46 | #define REMOVE -1 47 | 48 | #define PLACEMENT_MOUSE 0 49 | #define PLACEMENT_ROOT 1 50 | 51 | #define NO_CFG_FLAG 0 52 | #define CFG_CONSTRAINED (1<<0) 53 | #define CFG_REQUEST (1<<1) 54 | #define CFG_NOTIFY (1<<2) 55 | #define CFG_KEEP_VISIBLE (1<<3) 56 | #define CFG_FORCE_REDRAW (1<<4) 57 | 58 | #define SEARCH_INCLUDE_HIDDEN (1<<0) 59 | #define SEARCH_INCLUDE_SHADED (1<<1) 60 | #define SEARCH_INCLUDE_ALL_WORKSPACES (1<<2) 61 | #define SEARCH_INCLUDE_SKIP_FOCUS (1<<3) 62 | #define SEARCH_INCLUDE_SKIP_PAGER (1<<4) 63 | #define SEARCH_INCLUDE_SKIP_TASKBAR (1<<5) 64 | #define SEARCH_SAME_APPLICATION (1<<6) 65 | #define SEARCH_DIFFERENT_APPLICATION (1<<7) 66 | 67 | #define NO_UPDATE_FLAG 0 68 | #define UPDATE_BUTTON_GRABS (1<<0) 69 | #define UPDATE_FRAME (1<<1) 70 | #define UPDATE_GRAVITY (1<<2) 71 | #define UPDATE_MAXIMIZE (1<<3) 72 | #define UPDATE_CACHE (1<<4) 73 | #define UPDATE_ALL (UPDATE_BUTTON_GRABS | \ 74 | UPDATE_FRAME | \ 75 | UPDATE_GRAVITY | \ 76 | UPDATE_MAXIMIZE | \ 77 | UPDATE_CACHE) 78 | 79 | #define CLIENT_FILL_VERT (1L<<0) 80 | #define CLIENT_FILL_HORIZ (1L<<1) 81 | #define CLIENT_FILL (CLIENT_FILL_VERT | \ 82 | CLIENT_FILL_HORIZ) 83 | 84 | 85 | #define STRUTS_SIZE 12 86 | 87 | #ifndef CLIENT_MIN_VISIBLE 88 | #define CLIENT_MIN_VISIBLE 15 89 | #endif 90 | 91 | #ifndef CLIENT_XSYNC_TIMEOUT 92 | #define CLIENT_XSYNC_TIMEOUT 500 /* ms */ 93 | #endif 94 | 95 | #ifndef CLIENT_BLINK_TIMEOUT 96 | #define CLIENT_BLINK_TIMEOUT 500 /* ms */ 97 | #endif 98 | 99 | #ifndef CLIENT_PING_TIMEOUT 100 | #define CLIENT_PING_TIMEOUT 3000 /* ms */ 101 | #endif 102 | 103 | #ifndef MAX_BLINK_ITERATIONS 104 | #define MAX_BLINK_ITERATIONS 5 105 | #endif 106 | 107 | #ifndef MAX_SNAP_DRIFT 108 | #define MAX_SNAP_DRIFT 15 109 | #endif 110 | 111 | #define XFWM_FLAG_HAS_BORDER (1L<<0) 112 | #define XFWM_FLAG_HAS_MENU (1L<<1) 113 | #define XFWM_FLAG_HAS_MAXIMIZE (1L<<2) 114 | #define XFWM_FLAG_HAS_CLOSE (1L<<3) 115 | #define XFWM_FLAG_HAS_HIDE (1L<<4) 116 | #define XFWM_FLAG_HAS_MOVE (1L<<5) 117 | #define XFWM_FLAG_HAS_RESIZE (1L<<6) 118 | #define XFWM_FLAG_HAS_STICK (1L<<7) 119 | #define XFWM_FLAG_FOCUS (1L<<8) 120 | #define XFWM_FLAG_IS_RESIZABLE (1L<<9) 121 | #define XFWM_FLAG_MAP_PENDING (1L<<10) 122 | #define XFWM_FLAG_VISIBLE (1L<<11) 123 | #define XFWM_FLAG_MANAGED (1L<<13) 124 | #define XFWM_FLAG_SESSION_MANAGED (1L<<14) 125 | #define XFWM_FLAG_WORKSPACE_SET (1L<<15) 126 | #define XFWM_FLAG_WAS_SHOWN (1L<<16) 127 | #define XFWM_FLAG_DRAW_ACTIVE (1L<<17) 128 | #define XFWM_FLAG_SEEN_ACTIVE (1L<<18) 129 | #define XFWM_FLAG_FIRST_MAP (1L<<19) 130 | #define XFWM_FLAG_SAVED_POS (1L<<20) 131 | #define XFWM_FLAG_MOVING_RESIZING (1L<<21) 132 | #define XFWM_FLAG_NEEDS_REDRAW (1L<<22) 133 | #define XFWM_FLAG_OPACITY_LOCKED (1L<<23) 134 | 135 | #define CLIENT_FLAG_HAS_STRUT (1L<<0) 136 | #define CLIENT_FLAG_HAS_STRUT_PARTIAL (1L<<1) 137 | #define CLIENT_FLAG_HAS_USER_TIME (1L<<2) 138 | #define CLIENT_FLAG_HAS_STARTUP_TIME (1L<<3) 139 | #define CLIENT_FLAG_ABOVE (1L<<4) 140 | #define CLIENT_FLAG_BELOW (1L<<5) 141 | #define CLIENT_FLAG_FULLSCREEN (1L<<6) 142 | #define CLIENT_FLAG_ICONIFIED (1L<<7) 143 | #define CLIENT_FLAG_MAXIMIZED_VERT (1L<<8) 144 | #define CLIENT_FLAG_MAXIMIZED_HORIZ (1L<<9) 145 | #define CLIENT_FLAG_MAXIMIZED (CLIENT_FLAG_MAXIMIZED_VERT | \ 146 | CLIENT_FLAG_MAXIMIZED_HORIZ) 147 | #define CLIENT_FLAG_SHADED (1L<<10) 148 | #define CLIENT_FLAG_SKIP_PAGER (1L<<11) 149 | #define CLIENT_FLAG_SKIP_TASKBAR (1L<<12) 150 | #define CLIENT_FLAG_STATE_MODAL (1L<<13) 151 | #define CLIENT_FLAG_STICKY (1L<<15) 152 | #define CLIENT_FLAG_NAME_CHANGED (1L<<16) 153 | #define CLIENT_FLAG_DEMANDS_ATTENTION (1L<<17) 154 | #define CLIENT_FLAG_HAS_SHAPE (1L<<18) 155 | #define CLIENT_FLAG_FULLSCREEN_MONITORS (1L<<19) 156 | #define CLIENT_FLAG_HAS_FRAME_EXTENTS (1L<<20) 157 | #define CLIENT_FLAG_HIDE_TITLEBAR (1L<<21) 158 | #define CLIENT_FLAG_XSYNC_WAITING (1L<<22) 159 | #define CLIENT_FLAG_XSYNC_ENABLED (1L<<23) 160 | #define CLIENT_FLAG_XSYNC_EXT_COUNTER (1L<<24) 161 | #define CLIENT_FLAG_RESTORE_SIZE_POS (1L<<25) 162 | 163 | #define WM_FLAG_DELETE (1L<<0) 164 | #define WM_FLAG_INPUT (1L<<1) 165 | #define WM_FLAG_TAKEFOCUS (1L<<2) 166 | #define WM_FLAG_CONTEXT_HELP (1L<<3) 167 | #define WM_FLAG_URGENT (1L<<4) 168 | #define WM_FLAG_PING (1L<<5) 169 | 170 | #define XFWM_FLAG_INITIAL_VALUES XFWM_FLAG_HAS_BORDER | \ 171 | XFWM_FLAG_HAS_MENU | \ 172 | XFWM_FLAG_HAS_MAXIMIZE | \ 173 | XFWM_FLAG_HAS_STICK | \ 174 | XFWM_FLAG_HAS_HIDE | \ 175 | XFWM_FLAG_HAS_CLOSE | \ 176 | XFWM_FLAG_HAS_MOVE | \ 177 | XFWM_FLAG_HAS_RESIZE | \ 178 | XFWM_FLAG_FIRST_MAP | \ 179 | XFWM_FLAG_NEEDS_REDRAW 180 | 181 | #define ALL_WORKSPACES (guint) 0xFFFFFFFF 182 | 183 | #define CONSTRAINED_WINDOW(c) ((c->win_layer > WIN_LAYER_DESKTOP) && \ 184 | !(c->type & (WINDOW_DESKTOP | WINDOW_DOCK))) 185 | 186 | #define WINDOW_TYPE_DIALOG (WINDOW_DIALOG | \ 187 | WINDOW_MODAL_DIALOG) 188 | #define WINDOW_TYPE_DONT_PLACE (WINDOW_DESKTOP | \ 189 | WINDOW_DOCK | \ 190 | WINDOW_UTILITY | \ 191 | WINDOW_SPLASHSCREEN) 192 | #define WINDOW_REGULAR_FOCUSABLE (WINDOW_NORMAL | \ 193 | WINDOW_TYPE_DIALOG | \ 194 | WINDOW_UTILITY) 195 | #define WINDOW_TYPE_DONT_FOCUS (WINDOW_SPLASHSCREEN | \ 196 | WINDOW_DOCK) 197 | #define WINDOW_TYPE_STATE_FOCUSED (WINDOW_SPLASHSCREEN | \ 198 | WINDOW_DOCK ) 199 | 200 | /* Which bits of opacity are applied */ 201 | #define OPACITY_MOVE (1<<0) 202 | #define OPACITY_RESIZE (1<<1) 203 | #define OPACITY_INACTIVE (1<<2) 204 | 205 | /* Convenient macros */ 206 | #define FLAG_TEST(flag,bits) ((flag) & (bits)) 207 | #define FLAG_TEST_ALL(flag,bits) (((flag) & (bits)) == (bits)) 208 | #define FLAG_TEST_AND_NOT(flag,bits1,bits2) (((flag) & ((bits1) | (bits2))) == (bits1)) 209 | #define FLAG_SET(flag,bits) (flag |= (bits)) 210 | #define FLAG_UNSET(flag,bits) (flag &= ~(bits)) 211 | #define FLAG_TOGGLE(flag,bits) (flag ^= (bits)) 212 | 213 | #define CLIENT_CAN_HIDE_WINDOW(c) (FLAG_TEST(c->xfwm_flags, XFWM_FLAG_HAS_HIDE) && \ 214 | !FLAG_TEST(c->flags, CLIENT_FLAG_SKIP_TASKBAR)) 215 | #define CLIENT_CAN_MAXIMIZE_WINDOW(c) (FLAG_TEST_ALL(c->xfwm_flags, XFWM_FLAG_HAS_MAXIMIZE | \ 216 | XFWM_FLAG_IS_RESIZABLE) && \ 217 | !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) 218 | #define CLIENT_CAN_FILL_WINDOW(c) (FLAG_TEST(c->xfwm_flags, XFWM_FLAG_HAS_RESIZE | \ 219 | XFWM_FLAG_IS_RESIZABLE) && \ 220 | !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN | \ 221 | CLIENT_FLAG_MAXIMIZED | \ 222 | CLIENT_FLAG_SHADED)) 223 | #define CLIENT_CAN_TILE_WINDOW(c) (CLIENT_CAN_MAXIMIZE_WINDOW(c) && \ 224 | !FLAG_TEST (c->flags, CLIENT_FLAG_SHADED) && \ 225 | (c->type & WINDOW_NORMAL)) 226 | #define CLIENT_HAS_FRAME(c) (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER) && \ 227 | !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN) && \ 228 | (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED) || \ 229 | !FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED) || \ 230 | !((FLAG_TEST (c->flags, CLIENT_FLAG_HIDE_TITLEBAR) || \ 231 | (c->screen_info->params->titleless_maximize)) && \ 232 | (c->screen_info->params->borderless_maximize)))) 233 | 234 | typedef enum 235 | { 236 | UNSET = 0, 237 | WINDOW_NORMAL = (1 << 0), 238 | WINDOW_DESKTOP = (1 << 1), 239 | WINDOW_DOCK = (1 << 2), 240 | WINDOW_DIALOG = (1 << 3), 241 | WINDOW_MODAL_DIALOG = (1 << 4), 242 | WINDOW_TOOLBAR = (1 << 5), 243 | WINDOW_MENU = (1 << 6), 244 | WINDOW_UTILITY = (1 << 7), 245 | WINDOW_SPLASHSCREEN = (1 << 8), 246 | WINDOW_NOTIFICATION = (1 << 9) 247 | } 248 | netWindowType; 249 | 250 | typedef enum 251 | { 252 | TILE_NONE = 0, 253 | TILE_LEFT, 254 | TILE_RIGHT, 255 | TILE_DOWN, 256 | TILE_UP, 257 | TILE_DOWN_LEFT, 258 | TILE_DOWN_RIGHT, 259 | TILE_UP_LEFT, 260 | TILE_UP_RIGHT 261 | } 262 | tilePositionType; 263 | 264 | struct _Client 265 | { 266 | /* Reference to our screen structure */ 267 | ScreenInfo *screen_info; 268 | 269 | struct zwlr_foreign_toplevel_handle_v1 *toplevel_handle; 270 | 271 | Client *next; 272 | Client *prev; 273 | 274 | gchar *name; 275 | }; 276 | 277 | 278 | 279 | extern Client *clients; 280 | extern unsigned int client_count; 281 | 282 | 283 | Client *clientFrame (ScreenInfo *, 284 | struct zwlr_foreign_toplevel_handle_v1 *, 285 | gboolean); 286 | void clientUnframe (Client *, 287 | gboolean); 288 | 289 | #endif /* INC_CLIENT_H */ 290 | -------------------------------------------------------------------------------- /src/display.h: -------------------------------------------------------------------------------- 1 | typedef struct _ScreenInfo ScreenInfo; 2 | typedef struct _Client Client; 3 | typedef struct _XfwmParams XfwmParams; 4 | 5 | -------------------------------------------------------------------------------- /src/main-shell-client.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2019 adlo 2 | * 3 | * This library is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This library is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this library; if not, see 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include "screen.h" 23 | #include "client.h" 24 | #include "../util/libgwater-wayland.h" 25 | 26 | struct wl_display *display = NULL; 27 | static struct wl_registry *registry = NULL; 28 | 29 | static Client *focus = NULL; 30 | 31 | enum toplevel_state_field { 32 | TOPLEVEL_STATE_MAXIMIZED = (1 << 0), 33 | TOPLEVEL_STATE_MINIMIZED = (1 << 1), 34 | TOPLEVEL_STATE_ACTIVATED = (1 << 2), 35 | TOPLEVEL_STATE_FULLSCREEN = (1 << 3), 36 | TOPLEVEL_STATE_INVALID = (1 << 4), 37 | }; 38 | 39 | static void shell_handle_tabwin (void *data, struct xfway_shell *shell) 40 | { 41 | 42 | } 43 | 44 | static void shell_handle_tabwin_next (void *data, struct xfway_shell *shell) 45 | { 46 | 47 | } 48 | 49 | static void shell_handle_tabwin_destroy (void *data, struct xfway_shell *shell) 50 | { 51 | 52 | } 53 | 54 | struct xfway_shell_listener shell_impl = { 55 | shell_handle_tabwin, 56 | shell_handle_tabwin_next, 57 | shell_handle_tabwin_destroy, 58 | }; 59 | 60 | static void toplevel_handle_title(void *data, 61 | struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel, 62 | const char *title) 63 | { 64 | Client *c = data; 65 | if (c->name) 66 | g_free (c->name); 67 | c->name = g_strdup (title); 68 | } 69 | 70 | static void toplevel_handle_app_id(void *data, 71 | struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel, 72 | const char *app_id) 73 | { 74 | 75 | } 76 | 77 | static uint32_t array_to_state(struct wl_array *array) { 78 | uint32_t state = 0; 79 | uint32_t *entry; 80 | wl_array_for_each(entry, array) { 81 | if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED) 82 | state |= TOPLEVEL_STATE_MAXIMIZED; 83 | if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED) 84 | state |= TOPLEVEL_STATE_MINIMIZED; 85 | if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED) 86 | state |= TOPLEVEL_STATE_ACTIVATED; 87 | if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN) 88 | state |= TOPLEVEL_STATE_FULLSCREEN; 89 | } 90 | 91 | return state; 92 | } 93 | 94 | static void toplevel_handle_state(void *data, 95 | struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel, 96 | struct wl_array *state) { 97 | Client *c = data; 98 | uint32_t s = array_to_state(state); 99 | 100 | if (s & TOPLEVEL_STATE_ACTIVATED) 101 | focus = c; 102 | } 103 | 104 | static void toplevel_handle_done(void *data, 105 | struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel) 106 | { 107 | 108 | } 109 | 110 | static void toplevel_handle_closed(void *data, 111 | struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel) 112 | { 113 | Client *c = data; 114 | 115 | if (c->name) 116 | g_free (c->name); 117 | 118 | clientUnframe (c, FALSE); 119 | } 120 | 121 | static const struct zwlr_foreign_toplevel_handle_v1_listener toplevel_impl = { 122 | .title = toplevel_handle_title, 123 | .app_id = toplevel_handle_app_id, 124 | .output_enter = NULL, 125 | .output_leave = NULL, 126 | .state = toplevel_handle_state, 127 | .done = toplevel_handle_done, 128 | .closed = toplevel_handle_closed, 129 | }; 130 | 131 | static void toplevel_manager_handle_toplevel(void *data, 132 | struct zwlr_foreign_toplevel_manager_v1 *toplevel_manager, 133 | struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel) 134 | { 135 | ScreenInfo *screen_info = data; 136 | Client *c; 137 | 138 | c = clientFrame (screen_info, zwlr_toplevel, FALSE); 139 | 140 | zwlr_foreign_toplevel_handle_v1_add_listener (zwlr_toplevel, &toplevel_impl, 141 | c); 142 | } 143 | 144 | static void toplevel_manager_handle_finished(void *data, 145 | struct zwlr_foreign_toplevel_manager_v1 *toplevel_manager) { 146 | zwlr_foreign_toplevel_manager_v1_destroy(toplevel_manager); 147 | } 148 | 149 | static const struct zwlr_foreign_toplevel_manager_v1_listener toplevel_manager_impl = { 150 | .toplevel = toplevel_manager_handle_toplevel, 151 | .finished = toplevel_manager_handle_finished, 152 | }; 153 | 154 | void global_add (void *data, 155 | struct wl_registry *registry, 156 | uint32_t name, 157 | const char *interface, 158 | uint32_t version) 159 | { 160 | ScreenInfo *screen_info = data; 161 | 162 | if (strcmp (interface, "xfway_shell") == 0) 163 | { 164 | struct xfway_shell *shell = NULL; 165 | shell = wl_registry_bind (registry, name, &xfway_shell_interface, 1); 166 | 167 | xfway_shell_add_listener (shell, &shell_impl, NULL); 168 | } 169 | else if (strcmp(interface, 170 | "zwlr_foreign_toplevel_manager_v1") == 0) { 171 | screen_info->toplevel_manager = wl_registry_bind(registry, name, 172 | &zwlr_foreign_toplevel_manager_v1_interface, 173 | 2); 174 | 175 | zwlr_foreign_toplevel_manager_v1_add_listener(screen_info->toplevel_manager, 176 | &toplevel_manager_impl, screen_info); 177 | } 178 | } 179 | void global_remove (void *data, 180 | struct wl_registry *registry, 181 | uint32_t name) 182 | { 183 | 184 | } 185 | 186 | struct wl_registry_listener registry_listener = 187 | { 188 | .global = global_add, 189 | .global_remove = global_remove 190 | }; 191 | 192 | int main (int argc, 193 | char **argv) 194 | { 195 | ScreenInfo *screen_info; 196 | GdkScreen *screen; 197 | GWaterWaylandSource *source; 198 | display = wl_display_connect (NULL); 199 | 200 | if (display == NULL) 201 | { 202 | fprintf (stderr, "Can't connect to display"); 203 | } 204 | 205 | gtk_init (&argc, &argv); 206 | 207 | screen = gdk_screen_get_default (); 208 | 209 | screen_info = myScreenInit (screen); 210 | 211 | registry = wl_display_get_registry (display); 212 | 213 | wl_registry_add_listener (registry, ®istry_listener, screen_info); 214 | 215 | wl_display_roundtrip (display); 216 | wl_display_roundtrip (display); 217 | 218 | source = g_water_wayland_source_new_for_display (NULL, display); 219 | 220 | gtk_main (); 221 | 222 | return 0; 223 | } 224 | -------------------------------------------------------------------------------- /src/os-compatibility.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2012 Collabora, Ltd. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the 13 | * next paragraph) shall be included in all copies or substantial 14 | * portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | 26 | #include "config.h" 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "os-compatibility.h" 38 | 39 | int 40 | os_fd_set_cloexec(int fd) 41 | { 42 | long flags; 43 | 44 | if (fd == -1) 45 | return -1; 46 | 47 | flags = fcntl(fd, F_GETFD); 48 | if (flags == -1) 49 | return -1; 50 | 51 | if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) 52 | return -1; 53 | 54 | return 0; 55 | } 56 | 57 | static int 58 | set_cloexec_or_close(int fd) 59 | { 60 | if (os_fd_set_cloexec(fd) != 0) { 61 | close(fd); 62 | return -1; 63 | } 64 | return fd; 65 | } 66 | 67 | int 68 | os_socketpair_cloexec(int domain, int type, int protocol, int *sv) 69 | { 70 | int ret; 71 | 72 | #ifdef SOCK_CLOEXEC 73 | ret = socketpair(domain, type | SOCK_CLOEXEC, protocol, sv); 74 | if (ret == 0 || errno != EINVAL) 75 | return ret; 76 | #endif 77 | 78 | ret = socketpair(domain, type, protocol, sv); 79 | if (ret < 0) 80 | return ret; 81 | 82 | sv[0] = set_cloexec_or_close(sv[0]); 83 | sv[1] = set_cloexec_or_close(sv[1]); 84 | 85 | if (sv[0] != -1 && sv[1] != -1) 86 | return 0; 87 | 88 | close(sv[0]); 89 | close(sv[1]); 90 | return -1; 91 | } 92 | 93 | int 94 | os_epoll_create_cloexec(void) 95 | { 96 | int fd; 97 | 98 | #ifdef EPOLL_CLOEXEC 99 | fd = epoll_create1(EPOLL_CLOEXEC); 100 | if (fd >= 0) 101 | return fd; 102 | if (errno != EINVAL) 103 | return -1; 104 | #endif 105 | 106 | fd = epoll_create(1); 107 | return set_cloexec_or_close(fd); 108 | } 109 | 110 | static int 111 | create_tmpfile_cloexec(char *tmpname) 112 | { 113 | int fd; 114 | 115 | #ifdef HAVE_MKOSTEMP 116 | fd = mkostemp(tmpname, O_CLOEXEC); 117 | if (fd >= 0) 118 | unlink(tmpname); 119 | #else 120 | fd = mkstemp(tmpname); 121 | if (fd >= 0) { 122 | fd = set_cloexec_or_close(fd); 123 | unlink(tmpname); 124 | } 125 | #endif 126 | 127 | return fd; 128 | } 129 | 130 | /* 131 | * Create a new, unique, anonymous file of the given size, and 132 | * return the file descriptor for it. The file descriptor is set 133 | * CLOEXEC. The file is immediately suitable for mmap()'ing 134 | * the given size at offset zero. 135 | * 136 | * The file should not have a permanent backing store like a disk, 137 | * but may have if XDG_RUNTIME_DIR is not properly implemented in OS. 138 | * 139 | * The file name is deleted from the file system. 140 | * 141 | * The file is suitable for buffer sharing between processes by 142 | * transmitting the file descriptor over Unix sockets using the 143 | * SCM_RIGHTS methods. 144 | * 145 | * If the C library implements posix_fallocate(), it is used to 146 | * guarantee that disk space is available for the file at the 147 | * given size. If disk space is insufficient, errno is set to ENOSPC. 148 | * If posix_fallocate() is not supported, program may receive 149 | * SIGBUS on accessing mmap()'ed file contents instead. 150 | */ 151 | int 152 | os_create_anonymous_file(off_t size) 153 | { 154 | static const char template[] = "/weston-shared-XXXXXX"; 155 | const char *path; 156 | char *name; 157 | int fd; 158 | int ret; 159 | 160 | path = getenv("XDG_RUNTIME_DIR"); 161 | if (!path) { 162 | errno = ENOENT; 163 | return -1; 164 | } 165 | 166 | name = malloc(strlen(path) + sizeof(template)); 167 | if (!name) 168 | return -1; 169 | 170 | strcpy(name, path); 171 | strcat(name, template); 172 | 173 | fd = create_tmpfile_cloexec(name); 174 | 175 | free(name); 176 | 177 | if (fd < 0) 178 | return -1; 179 | 180 | #ifdef HAVE_POSIX_FALLOCATE 181 | do { 182 | ret = posix_fallocate(fd, 0, size); 183 | } while (ret == EINTR); 184 | if (ret != 0) { 185 | close(fd); 186 | errno = ret; 187 | return -1; 188 | } 189 | #else 190 | do { 191 | ret = ftruncate(fd, size); 192 | } while (ret < 0 && errno == EINTR); 193 | if (ret < 0) { 194 | close(fd); 195 | return -1; 196 | } 197 | #endif 198 | 199 | return fd; 200 | } 201 | 202 | #ifndef HAVE_STRCHRNUL 203 | char * 204 | strchrnul(const char *s, int c) 205 | { 206 | while (*s && *s != c) 207 | s++; 208 | return (char *)s; 209 | } 210 | #endif 211 | -------------------------------------------------------------------------------- /src/os-compatibility.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2012 Collabora, Ltd. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the 13 | * next paragraph) shall be included in all copies or substantial 14 | * portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | 26 | #ifndef OS_COMPATIBILITY_H 27 | #define OS_COMPATIBILITY_H 28 | 29 | #include "config.h" 30 | 31 | #include 32 | 33 | #ifdef HAVE_EXECINFO_H 34 | #include 35 | #else 36 | static inline int 37 | backtrace(void **buffer, int size) 38 | { 39 | return 0; 40 | } 41 | #endif 42 | 43 | int 44 | os_fd_set_cloexec(int fd); 45 | 46 | int 47 | os_socketpair_cloexec(int domain, int type, int protocol, int *sv); 48 | 49 | int 50 | os_epoll_create_cloexec(void); 51 | 52 | int 53 | os_create_anonymous_file(off_t size); 54 | 55 | #ifndef HAVE_STRCHRNUL 56 | char * 57 | strchrnul(const char *s, int c); 58 | #endif 59 | 60 | #endif /* OS_COMPATIBILITY_H */ 61 | -------------------------------------------------------------------------------- /src/screen.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2019 adlo 2 | * 3 | * This library is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This library is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this library; if not, see 15 | */ 16 | 17 | #include "screen.h" 18 | 19 | ScreenInfo * 20 | myScreenInit (GdkScreen *gscr) 21 | { 22 | ScreenInfo *screen_info; 23 | 24 | screen_info = g_new0 (ScreenInfo, 1); 25 | screen_info->params = g_new0 (XfwmParams, 1); 26 | 27 | screen_info->gscr = gscr; 28 | 29 | screen_info->toplevel_manager = NULL; 30 | 31 | screen_info->windows_stack = NULL; 32 | screen_info->windows = NULL; 33 | 34 | screen_info->clients = NULL; 35 | screen_info->client_count = 0; 36 | 37 | return (screen_info); 38 | } 39 | 40 | gint 41 | myScreenGetNumMonitors (ScreenInfo *screen_info) 42 | { 43 | return 1; 44 | } 45 | 46 | gint 47 | myScreenGetMonitorIndex (ScreenInfo *screen_info, gint idx) 48 | { 49 | return 1; 50 | } 51 | -------------------------------------------------------------------------------- /src/screen.h: -------------------------------------------------------------------------------- 1 | /* $Id$ 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2, or (at your option) 6 | any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | MA 02110-1301, USA. 17 | 18 | 19 | oroborus - (c) 2001 Ken Lynch 20 | xfwm4 - (c) 2002-2011 Olivier Fourdan 21 | 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | //#include 33 | //#include 34 | 35 | #ifdef HAVE_LIBSTARTUP_NOTIFICATION 36 | #define SN_API_NOT_YET_FROZEN 37 | //x#include 38 | #endif 39 | 40 | #ifdef HAVE_COMPOSITOR 41 | #ifdef HAVE_EPOXY 42 | #include 43 | #include 44 | #endif /* HAVE_EPOXY */ 45 | #endif /* HAVE_COMPOSITOR */ 46 | 47 | #ifndef INC_SCREEN_H 48 | #define INC_SCREEN_H 49 | 50 | #include "display.h" 51 | #include "settings.h" 52 | //#include "mywindow.h" 53 | //#include "mypixmap.h" 54 | #include "client.h" 55 | //#include "hints.h" 56 | #include 57 | 58 | #define MODIFIER_MASK (ShiftMask | \ 59 | ControlMask | \ 60 | AltMask | \ 61 | MetaMask | \ 62 | SuperMask | \ 63 | HyperMask) 64 | 65 | 66 | #ifdef HAVE_COMPOSITOR 67 | 68 | #ifdef HAVE_PRESENT_EXTENSION 69 | #define N_BUFFERS 2 70 | #else 71 | #define N_BUFFERS 1 72 | #endif /* HAVE_PRESENT_EXTENSION */ 73 | 74 | struct _gaussian_conv { 75 | int size; 76 | double *data; 77 | }; 78 | typedef struct _gaussian_conv gaussian_conv; 79 | 80 | #endif /* HAVE_COMPOSITOR */ 81 | 82 | typedef enum 83 | { 84 | VBLANK_OFF = 0, 85 | VBLANK_AUTO, 86 | VBLANK_XPRESENT, 87 | VBLANK_GLX, 88 | VBLANK_ERROR, 89 | } vblankMode; 90 | 91 | struct _ScreenInfo 92 | { 93 | /* The display this screen belongs to */ 94 | //DisplayInfo *display_info; 95 | 96 | /* Window stacking, per screen */ 97 | GList *windows_stack; 98 | Client *last_raise; 99 | GList *windows; 100 | Client *clients; 101 | guint client_count; 102 | unsigned long client_serial; 103 | gint key_grabs; 104 | gint pointer_grabs; 105 | 106 | struct zwlr_foreign_toplevel_manager_v1 *toplevel_manager; 107 | 108 | /* Theme pixmaps and other params, per screen */ 109 | GdkRGBA title_colors[2]; 110 | GdkRGBA title_shadow_colors[2]; 111 | //xfwmPixmap buttons[BUTTON_COUNT][STATE_COUNT]; 112 | //xfwmPixmap corners[CORNER_COUNT][2]; 113 | //xfwmPixmap sides[SIDE_COUNT][2]; 114 | //xfwmPixmap title[TITLE_COUNT][2]; 115 | //xfwmPixmap top[TITLE_COUNT][2]; 116 | 117 | /* Per screen graphic contexts */ 118 | GC box_gc; 119 | 120 | /* Title font */ 121 | gint font_height; 122 | PangoFontDescription *font_desc; 123 | PangoAttrList *pango_attr_list; 124 | 125 | /* Screen data */ 126 | Colormap cmap; 127 | GdkScreen *gscr; 128 | Screen *xscreen; 129 | gint depth; 130 | gint width; /* Size of all output combined */ 131 | gint height; /* Size of all output combined */ 132 | Visual *visual; 133 | 134 | GtkWidget *gtk_win; 135 | //xfwmWindow sidewalk[4]; 136 | Window xfwm4_win; 137 | Window xroot; 138 | Window shape_win; 139 | 140 | gint gnome_margins[4]; 141 | gint margins[4]; 142 | gint screen; 143 | guint current_ws; 144 | guint previous_ws; 145 | 146 | /* Monitor search caching */ 147 | GdkRectangle cache_monitor; 148 | gint num_monitors; 149 | GArray *monitors_index; 150 | 151 | /* Workspace definitions */ 152 | guint workspace_count; 153 | gchar **workspace_names; 154 | int workspace_names_items; 155 | //NetWmDesktopLayout desktop_layout; 156 | 157 | /* Button handler for GTK */ 158 | gulong button_handler_id; 159 | 160 | /* xfconf */ 161 | //XfconfChannel *xfwm4_channel; 162 | 163 | /* Shortcuts */ 164 | //XfceShortcutsProvider *shortcuts_provider; 165 | 166 | /* Per screen parameters */ 167 | XfwmParams *params; 168 | 169 | /* show desktop flag */ 170 | gboolean show_desktop; 171 | 172 | /* tabwin css provider */ 173 | gboolean tabwin_provider_ready; 174 | GtkCssProvider *tabwin_provider; 175 | 176 | #ifdef ENABLE_KDE_SYSTRAY_PROXY 177 | /* There can be one systray per screen */ 178 | Atom net_system_tray_selection; 179 | Window systray; 180 | #endif 181 | 182 | #ifdef HAVE_LIBSTARTUP_NOTIFICATION 183 | /* Startup notification data, per screen */ 184 | //SnMonitorContext *sn_context; 185 | GSList *startup_sequences; 186 | guint startup_sequence_timeout; 187 | #endif 188 | 189 | #ifdef HAVE_COMPOSITOR 190 | #if HAVE_OVERLAYS 191 | Window overlay; 192 | Window root_overlay; 193 | #endif 194 | GList *cwindows; 195 | Window output; 196 | 197 | gaussian_conv *gaussianMap; 198 | gint gaussianSize; 199 | guchar *shadowCorner; 200 | guchar *shadowTop; 201 | 202 | gushort current_buffer; 203 | Pixmap rootPixmap[N_BUFFERS]; 204 | //Picture rootBuffer[N_BUFFERS]; 205 | //Picture zoomBuffer; 206 | //Picture rootPicture; 207 | //Picture blackPicture; 208 | //Picture rootTile; 209 | //XserverRegion prevDamage; 210 | //XserverRegion allDamage; 211 | unsigned long cursorSerial; 212 | //Picture cursorPicture; 213 | gint cursorOffsetX; 214 | gint cursorOffsetY; 215 | XRectangle cursorLocation; 216 | 217 | guint wins_unredirected; 218 | gboolean compositor_active; 219 | gboolean clipChanged; 220 | 221 | gboolean damages_pending; 222 | 223 | guint compositor_timeout_id; 224 | 225 | //XTransform transform; 226 | gboolean zoomed; 227 | guint zoom_timeout_id; 228 | gboolean use_glx; 229 | gboolean use_present; 230 | 231 | vblankMode vblank_mode; 232 | 233 | #ifdef HAVE_EPOXY 234 | gboolean texture_inverted; 235 | 236 | GLuint rootTexture; 237 | GLenum texture_format; 238 | GLenum texture_target; 239 | GLenum texture_type; 240 | GLfloat texture_filter; 241 | GLXDrawable glx_drawable; 242 | GLXFBConfig glx_fbconfig; 243 | GLXContext glx_context; 244 | GLXWindow glx_window; 245 | #ifdef HAVE_XSYNC 246 | //XSyncFence fence[N_BUFFERS]; 247 | #endif /* HAVE_XSYNC */ 248 | #endif /* HAVE_EPOXY */ 249 | 250 | #ifdef HAVE_PRESENT_EXTENSION 251 | gboolean present_pending; 252 | #endif /* HAVE_PRESENT_EXTENSION */ 253 | 254 | #endif /* HAVE_COMPOSITOR */ 255 | }; 256 | 257 | gboolean myScreenCheckWMAtom (ScreenInfo *, 258 | Atom atom); 259 | ScreenInfo *myScreenInit (GdkScreen *); 260 | ScreenInfo *myScreenClose (ScreenInfo *); 261 | Display *myScreenGetXDisplay (ScreenInfo *); 262 | GtkWidget *myScreenGetGtkWidget (ScreenInfo *); 263 | GdkWindow *myScreenGetGdkWindow (ScreenInfo *); 264 | gboolean myScreenGrabKeyboard (ScreenInfo *, 265 | guint, 266 | guint32); 267 | gboolean myScreenGrabPointer (ScreenInfo *, 268 | gboolean, 269 | guint, 270 | Cursor, 271 | guint32); 272 | gboolean myScreenChangeGrabPointer (ScreenInfo *, 273 | gboolean, 274 | guint, 275 | Cursor, 276 | guint32); 277 | unsigned int myScreenUngrabKeyboard (ScreenInfo *, 278 | guint32); 279 | unsigned int myScreenUngrabPointer (ScreenInfo *, 280 | guint32); 281 | void myScreenGrabKeys (ScreenInfo *); 282 | void myScreenUngrabKeys (ScreenInfo *); 283 | //gint myScreenGetKeyPressed (ScreenInfo *, 284 | //XfwmEventKey *); 285 | int myScreenGetModifierPressed (ScreenInfo *); 286 | Client *myScreenGetClientFromWindow (ScreenInfo *, 287 | Window, 288 | unsigned short); 289 | gboolean myScreenComputeSize (ScreenInfo *); 290 | gint myScreenGetNumMonitors (ScreenInfo *); 291 | gint myScreenGetMonitorIndex (ScreenInfo *, 292 | gint); 293 | gboolean myScreenRebuildMonitorIndex (ScreenInfo *); 294 | void myScreenInvalidateMonitorCache (ScreenInfo *); 295 | void myScreenFindMonitorAtPoint (ScreenInfo *, 296 | gint, 297 | gint, 298 | GdkRectangle *); 299 | PangoFontDescription * myScreenGetFontDescription (ScreenInfo *); 300 | gboolean myScreenUpdateFontHeight (ScreenInfo *); 301 | void myScreenGetXineramaMonitorGeometry (ScreenInfo *, 302 | gint, 303 | GdkRectangle *); 304 | #endif /* INC_SCREEN_H */ 305 | -------------------------------------------------------------------------------- /src/server.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2018 - 2019 adlo 2 | * 3 | * This library is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This library is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this library; if not, see 15 | */ 16 | #ifndef XFWAY_SERVER_H 17 | #define XFWAY_SERVER_H 18 | 19 | #define _GNU_SOURCE 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include "wlr_foreign_toplevel_management_v1.h" 37 | 38 | struct weston_window_switcher; 39 | 40 | struct _xfwmDisplay 41 | { 42 | struct weston_compositor *compositor; 43 | struct wl_listener heads_changed_listener; 44 | bool init_failed; 45 | struct wl_list layoutput_list; /**< wet_layoutput::compositor_link */ 46 | union 47 | { 48 | const struct weston_drm_output_api *drm; 49 | const struct weston_windowed_output_api *windowed; 50 | } api; 51 | 52 | XfconfChannel *channel; 53 | 54 | struct weston_layer black_background_layer; 55 | struct weston_layer background_layer; 56 | struct weston_surface *background; 57 | struct weston_view *background_view; 58 | struct weston_layer bottom_layer; 59 | struct weston_layer surfaces_layer; 60 | struct weston_layer top_layer; 61 | struct weston_layer overlay_layer; 62 | 63 | struct wl_list outputs; 64 | 65 | int (*simple_output_configure)(struct weston_output *output); 66 | 67 | GdkDisplay *gdisplay; 68 | 69 | }; 70 | 71 | typedef struct _xfwmDisplay xfwmDisplay; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/settings.h: -------------------------------------------------------------------------------- 1 | /* $Id$ 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2, or (at your option) 6 | any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | MA 02110-1301, USA. 17 | 18 | 19 | oroborus - (c) 2001 Ken Lynch 20 | xfwm4 - (c) 2002-2015 Olivier Fourdan 21 | 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include 29 | #include 30 | #include "screen.h" 31 | //#include "keyboard.h" 32 | //#include "mypixmap.h" 33 | //#include "hints.h" 34 | 35 | #ifndef INC_SETTINGS_H 36 | #define INC_SETTINGS_H 37 | 38 | #ifndef DEFAULT_THEME 39 | #define DEFAULT_THEME "Default" 40 | #endif 41 | 42 | #ifndef DEFAULT_HDPI_THEME 43 | #define DEFAULT_HDPI_THEME "Default-xhdpi" 44 | #endif 45 | 46 | enum 47 | { 48 | TITLE_SHADOW_NONE = 0, 49 | TITLE_SHADOW_UNDER = 1, 50 | TITLE_SHADOW_FRAME = 2 51 | }; 52 | 53 | /** All key definition prior to FIRST_KEY are not grabbed continuously */ 54 | #define FIRST_KEY KEY_ADD_ADJACENT_WORKSPACE 55 | enum 56 | { 57 | KEY_CANCEL = 0, 58 | KEY_DOWN, 59 | KEY_LEFT, 60 | KEY_RIGHT, 61 | KEY_UP, 62 | /* FIRST_KEY starts here */ 63 | KEY_ADD_ADJACENT_WORKSPACE, 64 | KEY_ADD_WORKSPACE, 65 | KEY_CLOSE_WINDOW, 66 | KEY_CYCLE_WINDOWS, 67 | KEY_CYCLE_REVERSE_WINDOWS, 68 | KEY_DEL_ACTIVE_WORKSPACE, 69 | KEY_DEL_WORKSPACE, 70 | KEY_DOWN_WORKSPACE, 71 | KEY_FILL_HORIZ, 72 | KEY_FILL_VERT, 73 | KEY_FILL_WINDOW, 74 | KEY_HIDE_WINDOW, 75 | KEY_LEFT_WORKSPACE, 76 | KEY_LOWER_WINDOW, 77 | KEY_MAXIMIZE_HORIZ, 78 | KEY_MAXIMIZE_VERT, 79 | KEY_MAXIMIZE_WINDOW, 80 | KEY_MOVE, 81 | KEY_MOVE_DOWN_WORKSPACE, 82 | KEY_MOVE_LEFT_WORKSPACE, 83 | KEY_MOVE_NEXT_WORKSPACE, 84 | KEY_MOVE_PREV_WORKSPACE, 85 | KEY_MOVE_RIGHT_WORKSPACE, 86 | KEY_MOVE_UP_WORKSPACE, 87 | KEY_MOVE_WORKSPACE_1, 88 | KEY_MOVE_WORKSPACE_10, 89 | KEY_MOVE_WORKSPACE_11, 90 | KEY_MOVE_WORKSPACE_12, 91 | KEY_MOVE_WORKSPACE_2, 92 | KEY_MOVE_WORKSPACE_3, 93 | KEY_MOVE_WORKSPACE_4, 94 | KEY_MOVE_WORKSPACE_5, 95 | KEY_MOVE_WORKSPACE_6, 96 | KEY_MOVE_WORKSPACE_7, 97 | KEY_MOVE_WORKSPACE_8, 98 | KEY_MOVE_WORKSPACE_9, 99 | KEY_NEXT_WORKSPACE, 100 | KEY_POPUP_MENU, 101 | KEY_PREV_WORKSPACE, 102 | KEY_RAISE_WINDOW, 103 | KEY_RAISELOWER_WINDOW, 104 | KEY_RESIZE, 105 | KEY_RIGHT_WORKSPACE, 106 | KEY_SHADE_WINDOW, 107 | KEY_SHOW_DESKTOP, 108 | KEY_STICK_WINDOW, 109 | KEY_SWITCH_APPLICATION, 110 | KEY_SWITCH_WINDOW, 111 | KEY_TILE_DOWN, 112 | KEY_TILE_LEFT, 113 | KEY_TILE_RIGHT, 114 | KEY_TILE_UP, 115 | KEY_TILE_DOWN_LEFT, 116 | KEY_TILE_DOWN_RIGHT, 117 | KEY_TILE_UP_LEFT, 118 | KEY_TILE_UP_RIGHT, 119 | KEY_TOGGLE_ABOVE, 120 | KEY_TOGGLE_FULLSCREEN, 121 | KEY_UP_WORKSPACE, 122 | KEY_WORKSPACE_1, 123 | KEY_WORKSPACE_2, 124 | KEY_WORKSPACE_3, 125 | KEY_WORKSPACE_4, 126 | KEY_WORKSPACE_5, 127 | KEY_WORKSPACE_6, 128 | KEY_WORKSPACE_7, 129 | KEY_WORKSPACE_8, 130 | KEY_WORKSPACE_9, 131 | KEY_WORKSPACE_10, 132 | KEY_WORKSPACE_11, 133 | KEY_WORKSPACE_12, 134 | KEY_COUNT 135 | }; 136 | 137 | enum 138 | { 139 | ALIGN_LEFT, 140 | ALIGN_RIGHT, 141 | ALIGN_CENTER 142 | }; 143 | 144 | enum 145 | { 146 | ACTIVATE_ACTION_NONE, 147 | ACTIVATE_ACTION_BRING, 148 | ACTIVATE_ACTION_SWITCH 149 | }; 150 | 151 | enum 152 | { 153 | DOUBLE_CLICK_ACTION_NONE, 154 | DOUBLE_CLICK_ACTION_MAXIMIZE, 155 | DOUBLE_CLICK_ACTION_SHADE, 156 | DOUBLE_CLICK_ACTION_FILL, 157 | DOUBLE_CLICK_ACTION_HIDE 158 | }; 159 | 160 | enum 161 | { 162 | PLACE_MOUSE, 163 | PLACE_CENTER 164 | }; 165 | 166 | struct _Settings 167 | { 168 | gchar *option; 169 | GValue *value; 170 | GType type; 171 | gboolean required; 172 | }; 173 | 174 | struct _XfwmParams 175 | { 176 | //MyKey keys[KEY_COUNT]; 177 | //gchar button_layout[BUTTON_STRING_COUNT + 1]; 178 | int xfwm_margins[4]; 179 | int activate_action; 180 | int button_offset; 181 | int button_spacing; 182 | int cycle_tabwin_mode; 183 | int double_click_action; 184 | guint easy_click; 185 | int focus_delay; 186 | int frame_opacity; 187 | int frame_border_top; 188 | int inactive_opacity; 189 | int maximized_offset; 190 | int move_opacity; 191 | int placement_mode; 192 | int placement_ratio; 193 | int popup_opacity; 194 | int raise_delay; 195 | int resize_opacity; 196 | int shadow_delta_height; 197 | int shadow_delta_width; 198 | int shadow_delta_x; 199 | int shadow_delta_y; 200 | int shadow_opacity; 201 | int snap_width; 202 | int title_alignment; 203 | int title_horizontal_offset; 204 | int title_shadow[2]; 205 | int wrap_resistance; 206 | gboolean borderless_maximize; 207 | gboolean titleless_maximize; 208 | gboolean box_move; 209 | gboolean box_resize; 210 | gboolean click_to_focus; 211 | gboolean cycle_apps_only; 212 | gboolean cycle_draw_frame; 213 | gboolean cycle_raise; 214 | gboolean cycle_hidden; 215 | gboolean cycle_minimum; 216 | gboolean cycle_preview; 217 | gboolean cycle_workspaces; 218 | gboolean focus_hint; 219 | gboolean focus_new; 220 | gboolean full_width_title; 221 | gboolean horiz_scroll_opacity; 222 | gboolean mousewheel_rollup; 223 | gboolean prevent_focus_stealing; 224 | gboolean raise_on_click; 225 | gboolean raise_on_focus; 226 | gboolean raise_with_any_button; 227 | gboolean repeat_urgent_blink; 228 | gboolean scroll_workspaces; 229 | gboolean show_app_icon; 230 | gboolean show_dock_shadow; 231 | gboolean show_frame_shadow; 232 | gboolean show_popup_shadow; 233 | gboolean snap_resist; 234 | gboolean snap_to_border; 235 | gboolean snap_to_windows; 236 | gboolean tile_on_move; 237 | gboolean title_vertical_offset_active; 238 | gboolean title_vertical_offset_inactive; 239 | gboolean toggle_workspaces; 240 | gboolean unredirect_overlays; 241 | gboolean urgent_blink; 242 | gboolean use_compositing; 243 | gboolean wrap_cycle; 244 | gboolean wrap_layout; 245 | gboolean wrap_windows; 246 | gboolean wrap_workspaces; 247 | gboolean zoom_desktop; 248 | }; 249 | 250 | gboolean loadSettings (ScreenInfo *); 251 | //gboolean reloadSettings (DisplayInfo *, 252 | //int); 253 | gboolean initSettings (ScreenInfo *); 254 | void closeSettings (ScreenInfo *); 255 | 256 | #endif /* INC_SETTINGS_H */ 257 | -------------------------------------------------------------------------------- /src/shell.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2018 adlo 2 | * 3 | * This library is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This library is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this library; if not, see 15 | */ 16 | 17 | void xfway_server_shell_init (xfwmDisplay *server, int argc, char *argv[]); 18 | -------------------------------------------------------------------------------- /src/stacking.c: -------------------------------------------------------------------------------- 1 | /* $Id$ 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2, or (at your option) 6 | any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | MA 02110-1301, USA. 17 | 18 | 19 | xfwm4 - (c) 2002-2011 Olivier Fourdan 20 | 21 | */ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include "config.h" 25 | #endif 26 | 27 | #include 28 | 29 | #include "display.h" 30 | #include "screen.h" 31 | #include "client.h" 32 | #include "stacking.h" 33 | 34 | void 35 | clientAddToList (Client * c) 36 | { 37 | ScreenInfo *screen_info; 38 | //DisplayInfo *display_info; 39 | 40 | g_return_if_fail (c != NULL); 41 | //TRACE ("client \"%s\" (0x%lx)", c->name, c->window); 42 | 43 | screen_info = c->screen_info; 44 | //display_info = screen_info->display_info; 45 | //myDisplayAddClient (display_info, c); 46 | 47 | screen_info->client_count++; 48 | if (screen_info->clients) 49 | { 50 | c->prev = screen_info->clients->prev; 51 | c->next = screen_info->clients; 52 | screen_info->clients->prev->next = c; 53 | screen_info->clients->prev = c; 54 | } 55 | else 56 | { 57 | screen_info->clients = c; 58 | c->next = c; 59 | c->prev = c; 60 | } 61 | 62 | screen_info->windows = g_list_append (screen_info->windows, c); 63 | screen_info->windows_stack = g_list_append (screen_info->windows_stack, c); 64 | 65 | //clientSetNetClientList (screen_info, display_info->atoms[NET_CLIENT_LIST], screen_info->windows); 66 | 67 | //FLAG_SET (c->xfwm_flags, XFWM_FLAG_MANAGED); 68 | } 69 | 70 | void 71 | clientRemoveFromList (Client * c) 72 | { 73 | ScreenInfo *screen_info; 74 | //DisplayInfo *display_info; 75 | 76 | g_return_if_fail (c != NULL); 77 | //TRACE ("client \"%s\" (0x%lx)", c->name, c->window); 78 | 79 | //FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_MANAGED); 80 | 81 | screen_info = c->screen_info; 82 | //display_info = screen_info->display_info; 83 | // myDisplayRemoveClient (display_info, c); 84 | 85 | g_assert (screen_info->client_count > 0); 86 | screen_info->client_count--; 87 | if (screen_info->client_count == 0) 88 | { 89 | screen_info->clients = NULL; 90 | } 91 | else 92 | { 93 | c->next->prev = c->prev; 94 | c->prev->next = c->next; 95 | if (c == screen_info->clients) 96 | { 97 | screen_info->clients = screen_info->clients->next; 98 | } 99 | } 100 | 101 | screen_info->windows = g_list_remove (screen_info->windows, c); 102 | screen_info->windows_stack = g_list_remove (screen_info->windows_stack, c); 103 | 104 | //clientSetNetClientList (screen_info, display_info->atoms[NET_CLIENT_LIST], screen_info->windows); 105 | //clientSetNetClientList (screen_info, display_info->atoms[NET_CLIENT_LIST_STACKING], screen_info->windows_stack); 106 | 107 | //FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_MANAGED); 108 | } 109 | -------------------------------------------------------------------------------- /src/stacking.h: -------------------------------------------------------------------------------- 1 | /* $Id$ 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2, or (at your option) 6 | any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | MA 02110-1301, USA. 17 | 18 | 19 | xfwm4 - (c) 2002-2011 Olivier Fourdan 20 | 21 | */ 22 | 23 | #ifndef INC_STACKING_H 24 | #define INC_STACKING_H 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include "config.h" 28 | #endif 29 | 30 | #include 31 | #include "screen.h" 32 | #include "client.h" 33 | 34 | void clientAddToList (Client *); 35 | void clientRemoveFromList (Client *); 36 | 37 | #endif /* INC_STACKING_H */ 38 | -------------------------------------------------------------------------------- /src/tabwin.h: -------------------------------------------------------------------------------- 1 | /* $Id$ 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2, or (at your option) 6 | any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, 16 | MA 02110-1301, USA. 17 | 18 | 19 | xfwm4 - (c) 2002-2011 Olivier Fourdan 20 | 21 | */ 22 | 23 | #ifndef INC_TABWIN_H 24 | #define INC_TABWIN_H 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include "config.h" 28 | #endif 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | typedef struct _Tabwin Tabwin; 35 | typedef struct _TabwinWidget TabwinWidget; 36 | typedef struct _TabwinWidgetClass TabwinWidgetClass; 37 | 38 | typedef enum 39 | { 40 | STANDARD_ICON_GRID, 41 | OVERFLOW_COLUMN_GRID, 42 | } 43 | CYCLE_TABWIN_MODE; 44 | 45 | struct _Tabwin 46 | { 47 | GList *tabwin_list; 48 | GList **client_list; 49 | GList *icon_list; 50 | GList *selected; 51 | gint monitor_width; 52 | gint monitor_height; 53 | gint client_count; 54 | gint grid_cols; 55 | gint grid_rows; 56 | gint icon_size; 57 | gint icon_scale; 58 | gint label_height; 59 | gboolean display_workspace; 60 | }; 61 | 62 | struct _TabwinWidget 63 | { 64 | GtkWindow __parent__; 65 | /* The below must be freed when destroying */ 66 | GList *widgets; 67 | 68 | /* these don't have to be */ 69 | Tabwin *tabwin; 70 | GtkWidget *label; 71 | GtkWidget *container; 72 | GtkWidget *selected; 73 | GtkWidget *hovered; 74 | 75 | gulong selected_callback; 76 | gint width; 77 | gint height; 78 | gint monitor_num; 79 | }; 80 | 81 | struct _TabwinWidgetClass 82 | { 83 | GtkWindowClass __parent__; 84 | }; 85 | 86 | Tabwin *tabwinCreate (GList **, 87 | GList *, 88 | gboolean); 89 | Client *tabwinGetSelected (Tabwin *); 90 | Client *tabwinSelectHead (Tabwin *); 91 | Client *tabwinSelectNext (Tabwin *); 92 | Client *tabwinSelectPrev (Tabwin *); 93 | Client *tabwinSelectDelta (Tabwin *, int, int); 94 | Client *tabwinSelectHovered (Tabwin *); 95 | Client *tabwinRemoveClient (Tabwin *, 96 | Client *); 97 | void tabwinDestroy (Tabwin *); 98 | 99 | #endif /* INC_TABWIN_H */ 100 | -------------------------------------------------------------------------------- /src/window-switcher.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2019 adlo 2 | * 3 | * This library is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This library is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this library; if not, see 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | struct weston_window_switcher 24 | { 25 | struct weston_compositor *compositor; 26 | struct wl_client *client; 27 | struct wl_resource *binding; 28 | struct wl_list windows; 29 | }; 30 | 31 | struct weston_window_switcher_window 32 | { 33 | struct wl_list link; 34 | struct weston_window_switcher *switcher; 35 | struct wl_resource *resource; 36 | struct weston_desktop_surface *surface; 37 | struct weston_view *view; 38 | struct wl_listener surface_destroy_listener; 39 | struct wl_listener view_destroy_listener; 40 | }; 41 | 42 | static void _weston_window_switcher_request_destroy (struct wl_client *client, 43 | struct wl_resource *resource) 44 | { 45 | 46 | } 47 | 48 | static void 49 | _weston_window_switcher_window_surface_destroyed (struct wl_listener *listener, 50 | void *data) 51 | { 52 | struct weston_window_switcher_window *self = wl_container_of (listener, self, surface_destroy_listener); 53 | 54 | self->surface = NULL; 55 | } 56 | 57 | static void 58 | _weston_window_switcher_window_destroy (struct wl_resource *resource) 59 | { 60 | 61 | } 62 | 63 | static void 64 | _weston_window_switcher_window_request_switch_to (struct wl_client *client, 65 | struct wl_resource *resource, 66 | struct wl_resource *seat_resource, 67 | uint32_t serial) 68 | { 69 | struct weston_window_switcher_window *self = wl_resource_get_user_data (resource); 70 | struct weston_surface *surface = weston_desktop_surface_get_surface (self->surface); 71 | struct weston_seat *seat = wl_resource_get_user_data (seat_resource); 72 | struct weston_keyboard *keyboard = weston_seat_get_keyboard (seat); 73 | struct weston_pointer *pointer = weston_seat_get_pointer (seat); 74 | struct weston_touch *touch = weston_seat_get_touch (seat); 75 | 76 | if (keyboard == NULL) 77 | return; 78 | 79 | if ((keyboard != NULL) && (keyboard->grab_serial == serial)) 80 | weston_keyboard_set_focus (keyboard, surface); 81 | else if ((pointer != NULL) && (pointer->grab_serial == serial)) 82 | weston_keyboard_set_focus (keyboard, surface); 83 | else if ((touch != NULL) && (touch->grab_serial == serial)) 84 | weston_keyboard_set_focus (keyboard, surface); 85 | 86 | } 87 | 88 | static void 89 | _weston_window_switcher_window_request_close (struct wl_client *client, 90 | struct wl_resource *resource, 91 | struct wl_resource *seat_resource, 92 | uint32_t serial) 93 | { 94 | struct weston_window_switcher_window *self = wl_resource_get_user_data (resource); 95 | struct weston_seat *seat = wl_resource_get_user_data (seat_resource); 96 | struct weston_keyboard *keyboard = weston_seat_get_keyboard (seat); 97 | struct weston_pointer *pointer = weston_seat_get_pointer (seat); 98 | struct weston_touch *touch = weston_seat_get_touch (seat); 99 | 100 | if (keyboard == NULL) 101 | return; 102 | 103 | if ((keyboard != NULL) && (keyboard->grab_serial == serial)) 104 | weston_desktop_surface_close (self->surface); 105 | else if ((pointer != NULL) && (pointer->grab_serial == serial)) 106 | weston_desktop_surface_close (self->surface); 107 | else if ((touch != NULL) && (touch->grab_serial == serial)) 108 | weston_desktop_surface_close (self->surface); 109 | } 110 | 111 | static void 112 | _weston_window_switcher_window_request_show (struct wl_client *client, 113 | struct wl_resource *resource, 114 | struct wl_resource *surface, 115 | int32_t x, 116 | int32_t y, 117 | int32_t width, 118 | int32_t height) 119 | { 120 | 121 | } 122 | 123 | static const struct zww_window_switcher_window_v1_interface weston_window_switcher_window_implementation = { 124 | .destroy = _weston_window_switcher_request_destroy, 125 | .switch_to = _weston_window_switcher_window_request_switch_to, 126 | .close = _weston_window_switcher_window_request_close, 127 | .show = _weston_window_switcher_window_request_show, 128 | }; 129 | 130 | void 131 | _weston_window_switcher_window_create (struct weston_window_switcher *switcher, 132 | struct weston_surface *surface) 133 | { 134 | struct weston_window_switcher_window *self; 135 | struct weston_desktop_surface *dsurface = weston_surface_get_desktop_surface (surface); 136 | 137 | if (dsurface == NULL) 138 | return; 139 | 140 | if (switcher->client == NULL) 141 | return; 142 | 143 | weston_log ("\nserver: window create\n"); 144 | 145 | wl_list_for_each (self,&switcher->windows, link) 146 | { 147 | if (self->surface == dsurface) 148 | return; 149 | } 150 | 151 | self = zalloc (sizeof (struct weston_window_switcher_window)); 152 | if (self == NULL) 153 | { 154 | wl_client_post_no_memory (switcher->client); 155 | return; 156 | } 157 | 158 | self->switcher = switcher; 159 | self->surface = dsurface; 160 | 161 | self->resource = wl_resource_create (switcher->client, &zww_window_switcher_window_v1_interface, 162 | wl_resource_get_version (switcher->binding), 0); 163 | if (self->resource == NULL) 164 | { 165 | wl_client_post_no_memory (switcher->client); 166 | return; 167 | } 168 | 169 | self->surface_destroy_listener.notify = _weston_window_switcher_window_surface_destroyed; 170 | wl_signal_add (&surface->destroy_signal, &self->surface_destroy_listener); 171 | wl_resource_set_implementation(self->resource, &weston_window_switcher_window_implementation, 172 | self, _weston_window_switcher_window_destroy); 173 | zww_window_switcher_v1_send_window (switcher->binding, self->resource); 174 | 175 | const char *title = weston_desktop_surface_get_title (self->surface); 176 | if (title != NULL) 177 | zww_window_switcher_window_v1_send_title (self->resource, title); 178 | const char *app_id = weston_desktop_surface_get_app_id (self->surface); 179 | if (app_id != NULL) 180 | zww_window_switcher_window_v1_send_app_id (self->resource, app_id); 181 | zww_window_switcher_window_v1_send_done (self->resource); 182 | 183 | } 184 | 185 | static const struct zww_window_switcher_v1_interface weston_window_switcher_implementation = 186 | { 187 | .destroy = _weston_window_switcher_request_destroy, 188 | }; 189 | 190 | static void 191 | _weston_window_switcher_bind (struct wl_client *client, 192 | void *data, 193 | uint32_t version, 194 | uint32_t id) 195 | { 196 | struct weston_window_switcher *self = data; 197 | struct wl_resource *resource; 198 | 199 | weston_log ("\nserver: switcher bind\n"); 200 | 201 | resource = wl_resource_create (client, &zww_window_switcher_v1_interface, version, id); 202 | wl_resource_set_implementation (resource, &weston_window_switcher_implementation, 203 | self, NULL); 204 | 205 | if (self->binding != NULL) 206 | { 207 | wl_resource_post_error (resource, ZWW_WINDOW_SWITCHER_V1_ERROR_BOUND, 208 | "interface object already bound"); 209 | wl_resource_destroy (resource); 210 | return; 211 | } 212 | 213 | self->client = client; 214 | self->binding = resource; 215 | 216 | struct weston_view *view; 217 | wl_list_for_each (view, &self->compositor->view_list, link) 218 | _weston_window_switcher_window_create (self, view->surface); 219 | } 220 | 221 | WL_EXPORT int 222 | weston_window_switcher_module_init (struct weston_compositor *compositor, 223 | struct weston_window_switcher **out_switcher, 224 | int argc, char *argv[]) 225 | { 226 | struct weston_window_switcher *window_switcher; 227 | window_switcher = zalloc (sizeof (struct weston_window_switcher)); 228 | 229 | window_switcher->compositor = compositor; 230 | window_switcher->client = NULL; 231 | 232 | wl_list_init (&window_switcher->windows); 233 | 234 | if (wl_global_create (window_switcher->compositor->wl_display, 235 | &zww_window_switcher_v1_interface, 1, 236 | window_switcher, _weston_window_switcher_bind) == NULL) 237 | return -1; 238 | 239 | *out_switcher = window_switcher; 240 | 241 | return 0; 242 | } 243 | -------------------------------------------------------------------------------- /src/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; 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 wl_listener output_destroy; 40 | struct wlr_output *output; 41 | 42 | struct wlr_foreign_toplevel_handle_v1 *toplevel; 43 | };*/ 44 | 45 | struct wlr_foreign_toplevel_handle_v1 { 46 | struct wlr_foreign_toplevel_manager_v1 *manager; 47 | struct wl_list resources; 48 | struct wl_list link; 49 | struct wl_event_source *idle_source; 50 | 51 | char *title; 52 | char *app_id; 53 | struct wl_list outputs; // wlr_foreign_toplevel_v1_output 54 | uint32_t state; // wlr_foreign_toplevel_v1_state 55 | 56 | struct { 57 | // wlr_foreign_toplevel_handle_v1_maximized_event 58 | struct wl_signal request_maximize; 59 | //wlr_foreign_toplevel_handle_v1_minimized_event 60 | struct wl_signal request_minimize; 61 | //wlr_foreign_toplevel_handle_v1_activated_event 62 | struct wl_signal request_activate; 63 | //wlr_foreign_toplevel_handle_v1_fullscreen_event 64 | struct wl_signal request_fullscreen; 65 | struct wl_signal request_close; 66 | 67 | //wlr_foreign_toplevel_handle_v1_set_rectangle_event 68 | struct wl_signal set_rectangle; 69 | struct wl_signal destroy; 70 | } events; 71 | 72 | void *data; 73 | }; 74 | 75 | struct wlr_foreign_toplevel_handle_v1_maximized_event { 76 | struct wlr_foreign_toplevel_handle_v1 *toplevel; 77 | bool maximized; 78 | }; 79 | 80 | struct wlr_foreign_toplevel_handle_v1_minimized_event { 81 | struct wlr_foreign_toplevel_handle_v1 *toplevel; 82 | bool minimized; 83 | }; 84 | 85 | struct wlr_foreign_toplevel_handle_v1_activated_event { 86 | struct wlr_foreign_toplevel_handle_v1 *toplevel; 87 | struct wlr_seat *seat; 88 | }; 89 | 90 | /*struct wlr_foreign_toplevel_handle_v1_fullscreen_event { 91 | struct wlr_foreign_toplevel_handle_v1 *toplevel; 92 | bool fullscreen; 93 | struct wlr_output *output; 94 | };*/ 95 | 96 | struct wlr_foreign_toplevel_handle_v1_set_rectangle_event { 97 | struct wlr_foreign_toplevel_handle_v1 *toplevel; 98 | struct wlr_surface *surface; 99 | int32_t x, y, width, height; 100 | }; 101 | 102 | struct wlr_foreign_toplevel_manager_v1 *wlr_foreign_toplevel_manager_v1_create( 103 | struct wl_display *display); 104 | void wlr_foreign_toplevel_manager_v1_destroy( 105 | struct wlr_foreign_toplevel_manager_v1 *manager); 106 | 107 | struct wlr_foreign_toplevel_handle_v1 *wlr_foreign_toplevel_handle_v1_create( 108 | struct wlr_foreign_toplevel_manager_v1 *manager); 109 | void wlr_foreign_toplevel_handle_v1_destroy( 110 | struct wlr_foreign_toplevel_handle_v1 *toplevel); 111 | 112 | void wlr_foreign_toplevel_handle_v1_set_title( 113 | struct wlr_foreign_toplevel_handle_v1 *toplevel, const char *title); 114 | void wlr_foreign_toplevel_handle_v1_set_app_id( 115 | struct wlr_foreign_toplevel_handle_v1 *toplevel, const char *app_id); 116 | 117 | //void wlr_foreign_toplevel_handle_v1_output_enter( 118 | //struct wlr_foreign_toplevel_handle_v1 *toplevel, struct wlr_output *output); 119 | //void wlr_foreign_toplevel_handle_v1_output_leave( 120 | //struct wlr_foreign_toplevel_handle_v1 *toplevel, struct wlr_output *output); 121 | 122 | void wlr_foreign_toplevel_handle_v1_set_maximized( 123 | struct wlr_foreign_toplevel_handle_v1 *toplevel, bool maximized); 124 | void wlr_foreign_toplevel_handle_v1_set_minimized( 125 | struct wlr_foreign_toplevel_handle_v1 *toplevel, bool minimized); 126 | void wlr_foreign_toplevel_handle_v1_set_activated( 127 | struct wlr_foreign_toplevel_handle_v1 *toplevel, bool activated); 128 | void wlr_foreign_toplevel_handle_v1_set_fullscreen( 129 | struct wlr_foreign_toplevel_handle_v1* toplevel, bool fullscreen); 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /src/wlr_layer_shell_v1.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2019 adlo 2 | * 3 | * This library is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This library is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this library; if not, see 15 | */ 16 | 17 | /* 18 | * This an unstable interface of wlroots. No guarantees are made regarding the 19 | * future consistency of this API. 20 | */ 21 | //#ifndef WLR_USE_UNSTABLE 22 | //#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" 23 | //#endif 24 | 25 | #ifndef WLR_TYPES_WLR_LAYER_SHELL_V1_H 26 | #define WLR_TYPES_WLR_LAYER_SHELL_V1_H 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "server.h" 32 | //#include 33 | //#include 34 | #include 35 | 36 | /** 37 | * wlr_layer_shell_v1 allows clients to arrange themselves in "layers" on the 38 | * desktop in accordance with the wlr-layer-shell protocol. When a client is 39 | * added, the new_surface signal will be raised and passed a reference to our 40 | * wlr_layer_surface_v1. At this time, the client will have configured the 41 | * surface as it desires, including information like desired anchors and 42 | * margins. The compositor should use this information to decide how to arrange 43 | * the layer on-screen, then determine the dimensions of the layer and call 44 | * wlr_layer_surface_v1_configure. The client will then attach a buffer and 45 | * commit the surface, at which point the wlr_layer_surface_v1 map signal is 46 | * raised and the compositor should begin rendering the surface. 47 | */ 48 | struct wlr_layer_shell_v1 { 49 | struct wl_global *global; 50 | struct wl_list resources; // wl_resource 51 | struct wl_list surfaces; // wl_layer_surface 52 | 53 | xfwmDisplay *xfwm_display; 54 | 55 | struct wl_listener display_destroy; 56 | 57 | struct { 58 | // struct wlr_layer_surface_v1 * 59 | // Note: the output may be NULL. In this case, it is your 60 | // responsibility to assign an output before returning. 61 | struct wl_signal new_surface; 62 | struct wl_signal destroy; 63 | } events; 64 | 65 | void *data; 66 | }; 67 | 68 | struct wlr_layer_surface_v1_state { 69 | uint32_t anchor; 70 | int32_t exclusive_zone; 71 | struct { 72 | uint32_t top, right, bottom, left; 73 | } margin; 74 | bool keyboard_interactive; 75 | uint32_t desired_width, desired_height; 76 | uint32_t actual_width, actual_height; 77 | }; 78 | 79 | struct wlr_layer_surface_v1_configure { 80 | struct wl_list link; // wlr_layer_surface_v1::configure_list 81 | uint32_t serial; 82 | struct wlr_layer_surface_v1_state state; 83 | }; 84 | 85 | struct wlr_layer_surface_v1 { 86 | struct wl_list link; // wlr_layer_shell_v1::surfaces 87 | struct weston_surface *surface; 88 | struct weston_view *view; 89 | struct wlr_output *output; 90 | struct weston_output *head; 91 | struct wl_resource *resource; 92 | struct wlr_layer_shell_v1 *shell; 93 | struct wl_list popups; // wlr_xdg_popup::link 94 | 95 | char *namespace; 96 | enum zwlr_layer_shell_v1_layer layer; 97 | 98 | bool added, configured, mapped, closed; 99 | uint32_t configure_serial; 100 | struct wl_event_source *configure_idle; 101 | uint32_t configure_next_serial; 102 | struct wl_list configure_list; 103 | 104 | struct wlr_layer_surface_v1_configure *acked_configure; 105 | 106 | struct wlr_layer_surface_v1_state client_pending; 107 | struct wlr_layer_surface_v1_state server_pending; 108 | struct wlr_layer_surface_v1_state current; 109 | 110 | struct wl_listener surface_destroy; 111 | 112 | struct { 113 | struct wl_signal destroy; 114 | struct wl_signal map; 115 | struct wl_signal unmap; 116 | struct wl_signal new_popup; 117 | } events; 118 | 119 | void *data; 120 | }; 121 | 122 | struct wlr_layer_shell_v1 *wlr_layer_shell_v1_create(struct wl_display *display, xfwmDisplay *xfwm_display); 123 | void wlr_layer_shell_v1_destroy(struct wlr_layer_shell_v1 *layer_shell); 124 | 125 | /** 126 | * Notifies the layer surface to configure itself with this width/height. The 127 | * layer_surface will signal its map event when the surface is ready to assume 128 | * this size. 129 | */ 130 | void wlr_layer_surface_v1_configure(struct wlr_layer_surface_v1 *surface, 131 | uint32_t width, uint32_t height); 132 | 133 | /** 134 | * Unmaps this layer surface and notifies the client that it has been closed. 135 | */ 136 | void wlr_layer_surface_v1_close(struct wlr_layer_surface_v1 *surface); 137 | 138 | //bool wlr_surface_is_layer_surface(struct wlr_surface *surface); 139 | 140 | struct wlr_layer_surface_v1 *wlr_layer_surface_v1_from_weston_surface( 141 | struct weston_surface *surface); 142 | 143 | /* Calls the iterator function for each sub-surface and popup of this surface */ 144 | //void wlr_layer_surface_v1_for_each_surface(struct wlr_layer_surface_v1 *surface, 145 | //wlr_surface_iterator_func_t iterator, void *user_data); 146 | 147 | /** 148 | * Find a surface within this layer-surface tree at the given surface-local 149 | * coordinates. Returns the surface and coordinates in the leaf surface 150 | * coordinate system or NULL if no surface is found at that location. 151 | */ 152 | struct wlr_surface *wlr_layer_surface_v1_surface_at( 153 | struct wlr_layer_surface_v1 *surface, double sx, double sy, 154 | double *sub_x, double *sub_y); 155 | 156 | #endif 157 | -------------------------------------------------------------------------------- /src/xfway.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2016 Giulio Camuffo 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice (including the 13 | * next paragraph) shall be included in all copies or substantial 14 | * portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | */ 25 | 26 | #ifndef XFWAY_H 27 | #define XFWAY_H 28 | 29 | #include 30 | #include 31 | #include 32 | //#include 33 | //#include 34 | 35 | struct weston_process; 36 | typedef void (*weston_process_cleanup_func_t)(struct weston_process *process, 37 | int status); 38 | 39 | struct weston_process { 40 | pid_t pid; 41 | weston_process_cleanup_func_t cleanup; 42 | struct wl_list link; 43 | }; 44 | 45 | WL_EXPORT char * 46 | wet_get_binary_path(const char *name); 47 | 48 | struct wl_client * 49 | weston_client_launch(struct weston_compositor *compositor, 50 | struct weston_process *proc, 51 | const char *path, 52 | weston_process_cleanup_func_t cleanup); 53 | 54 | struct wl_client * 55 | weston_client_start(struct weston_compositor *compositor, const char *path); 56 | 57 | void 58 | weston_watch_process(struct weston_process *process); 59 | 60 | #endif //XFWAY_H 61 | -------------------------------------------------------------------------------- /tests/test-switcher/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = test-switcher 2 | 3 | test_switcher_SOURCES = \ 4 | $(top_srcdir)/protocol/window-switcher-unstable-v1-server-protocol.c \ 5 | $(top_srcdir)/protocol/window-switcher-unstable-v1-client-protocol.h \ 6 | $(top_srcdir)/protocol/xfway-shell-client-protocol.c \ 7 | $(top_srcdir)/protocol/xfway-shell-client-protocol.h \ 8 | switcher-test.c 9 | 10 | test_switcher_CFLAGS = \ 11 | $(WAYLAND_SERVER_CFLAGS) \ 12 | $(WAYLAND_CLIENT_CFLAGS) \ 13 | $(LIBWESTON_CFLAGS) \ 14 | $(LIBWESTON_DESKTOP_CFLAGS) \ 15 | $(LIBINPUT_CFLAGS) \ 16 | $(XKBCOMMON_CFLAGS) \ 17 | $(EGL_CFLAGS) \ 18 | $(EVDEV_CFLAGS) \ 19 | $(GTK_CFLAGS) 20 | 21 | test_switcher_LDADD = \ 22 | $(WAYLAND_SERVER_LIBS) \ 23 | $(WAYLAND_CLIENT_LIBS) \ 24 | $(LIBWESTON_LIBS) \ 25 | $(LIBWESTON_DESKTOP_LIBS) \ 26 | $(LIBINPUT_LIBS) \ 27 | $(XKBCOMMON_LIBS) \ 28 | $(EGL_LIBS) \ 29 | $(EVDEV_LIBS) \ 30 | $(PIXMAN_LIBS) \ 31 | $(GTK_LIBS) 32 | -------------------------------------------------------------------------------- /tests/test-switcher/switcher-test.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2019 adlo 2 | * 3 | * This library is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This library is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this library; if not, see 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | struct wl_display *display = NULL; 24 | static struct wl_registry *registry = NULL; 25 | struct zww_window_switcher_v1 *switcher = NULL; 26 | 27 | void switcher_window (void *data, 28 | struct zww_window_switcher_v1 *zww_window_switcher_v1, 29 | struct zww_window_switcher_window_v1 *window) 30 | { 31 | fprintf (stderr, "client: window\n"); 32 | } 33 | 34 | struct zww_window_switcher_v1_listener switcher_listener = { 35 | .window = switcher_window, 36 | }; 37 | 38 | void global_add(void *our_data, 39 | struct wl_registry *registry, 40 | uint32_t name, 41 | const char *interface, 42 | uint32_t version) { 43 | 44 | if (strcmp(interface, "zww_window_switcher_v1") == 0) { 45 | if (switcher == NULL) 46 | { 47 | switcher = wl_registry_bind (registry, name, &zww_window_switcher_v1_interface, 48 | 1); 49 | printf ("%s", "\nclient: bind switcher\n"); 50 | 51 | zww_window_switcher_v1_add_listener(switcher, 52 | &switcher_listener, NULL); 53 | } 54 | } 55 | else if (strcmp(interface, "xfway_shell") == 0) { 56 | struct xfway_shell *xfshell = NULL; 57 | xfshell = wl_registry_bind (registry, name, &xfway_shell_interface, 58 | 1); 59 | printf ("%s", "\nclient: bind shell\n"); 60 | } 61 | 62 | } 63 | 64 | void global_remove(void *our_data, 65 | struct wl_registry *registry, 66 | uint32_t name) { 67 | // TODO 68 | } 69 | 70 | struct wl_registry_listener registry_listener = { 71 | .global = global_add, 72 | .global_remove = global_remove 73 | }; 74 | 75 | 76 | int main (int argc, 77 | char **argv) 78 | { 79 | display = wl_display_connect (NULL); 80 | int ret = 0; 81 | 82 | if (display == NULL) 83 | { 84 | fprintf (stderr, "Can't connect to display"); 85 | } 86 | 87 | registry = wl_display_get_registry (display); 88 | 89 | wl_registry_add_listener(registry, ®istry_listener, NULL); 90 | 91 | wl_display_roundtrip (display); 92 | wl_display_roundtrip (display); 93 | 94 | while (ret != -1) 95 | ret = wl_display_dispatch (display); 96 | 97 | return 0; 98 | } 99 | -------------------------------------------------------------------------------- /util/helpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Samsung Electronics Co., Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 16 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 17 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | #ifndef WESTON_HELPERS_H 23 | #define WESTON_HELPERS_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /** 30 | * @file 31 | * Simple misc helper macros. 32 | */ 33 | 34 | /** 35 | * Compile-time computation of number of items in a hardcoded array. 36 | * 37 | * @param a the array being measured. 38 | * @return the number of items hardcoded into the array. 39 | */ 40 | #ifndef ARRAY_LENGTH 41 | #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) 42 | #endif 43 | 44 | /** 45 | * Returns the smaller of two values. 46 | * 47 | * @param x the first item to compare. 48 | * @param y the second item to compare. 49 | * @return the value that evaluates to lesser than the other. 50 | */ 51 | #ifndef MIN 52 | #define MIN(x,y) (((x) < (y)) ? (x) : (y)) 53 | #endif 54 | 55 | /** 56 | * Returns the bigger of two values. 57 | * 58 | * @param x the first item to compare. 59 | * @param y the second item to compare. 60 | * @return the value that evaluates to more than the other. 61 | */ 62 | #ifndef MAX 63 | #define MAX(x,y) (((x) > (y)) ? (x) : (y)) 64 | #endif 65 | 66 | /** 67 | * Returns a pointer to the containing struct of a given member item. 68 | * 69 | * To demonstrate, the following example retrieves a pointer to 70 | * `example_container` given only its `destroy_listener` member: 71 | * 72 | * @code 73 | * struct example_container { 74 | * struct wl_listener destroy_listener; 75 | * // other members... 76 | * }; 77 | * 78 | * void example_container_destroy(struct wl_listener *listener, void *data) 79 | * { 80 | * struct example_container *ctr; 81 | * 82 | * ctr = wl_container_of(listener, ctr, destroy_listener); 83 | * // destroy ctr... 84 | * } 85 | * @endcode 86 | * 87 | * @param ptr A valid pointer to the contained item. 88 | * 89 | * @param type A pointer to the type of content that the list item 90 | * stores. Type does not need be a valid pointer; a null or 91 | * an uninitialised pointer will suffice. 92 | * 93 | * @param member The named location of ptr within the sample type. 94 | * 95 | * @return The container for the specified pointer. 96 | */ 97 | #ifndef container_of 98 | #define container_of(ptr, type, member) ({ \ 99 | const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ 100 | (type *)( (char *)__mptr - offsetof(type,member) );}) 101 | #endif 102 | 103 | /** 104 | * Build-time static assertion support 105 | * 106 | * A build-time equivalent to assert(), will generate a compilation error 107 | * if the supplied condition does not evaluate true. 108 | * 109 | * The following example demonstrates use of static_assert to ensure that 110 | * arrays which are supposed to mirror each other have a consistent 111 | * size. 112 | * 113 | * This is only a fallback definition; support must be provided by the 114 | * compiler itself. 115 | * 116 | * @code 117 | * int small[4]; 118 | * long expanded[4]; 119 | * 120 | * static_assert(ARRAY_LENGTH(small) == ARRAY_LENGTH(expanded), 121 | * "size mismatch between small and expanded arrays"); 122 | * for (i = 0; i < ARRAY_LENGTH(small); i++) 123 | * expanded[i] = small[4]; 124 | * @endcode 125 | * 126 | * @param condition Expression to check for truth 127 | * @param msg Message to print on failure 128 | */ 129 | #ifndef static_assert 130 | # ifdef _Static_assert 131 | # define static_assert(cond, msg) _Static_assert(cond, msg) 132 | # else 133 | # define static_assert(cond, msg) 134 | # endif 135 | #endif 136 | 137 | #ifdef __cplusplus 138 | } 139 | #endif 140 | 141 | #endif /* WESTON_HELPERS_H */ 142 | -------------------------------------------------------------------------------- /util/libgwater-wayland.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libgwater-wayland - Wayland GSource 3 | * 4 | * Copyright © 2014-2017 Quentin "Sardem FF7" Glidic 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include "config.h" 28 | #endif /* HAVE_CONFIG_H */ 29 | 30 | #ifdef G_LOG_DOMAIN 31 | #undef G_LOG_DOMAIN 32 | #endif /* G_LOG_DOMAIN */ 33 | #define G_LOG_DOMAIN "GWaterWayland" 34 | 35 | #include 36 | 37 | #include 38 | 39 | #include 40 | 41 | #include "libgwater-wayland.h" 42 | 43 | struct _GWaterWaylandSource { 44 | GSource source; 45 | gboolean display_owned; 46 | struct wl_display *display; 47 | gpointer fd; 48 | int error; 49 | }; 50 | 51 | static gboolean 52 | _g_water_wayland_source_prepare(GSource *source, gint *timeout) 53 | { 54 | GWaterWaylandSource *self = (GWaterWaylandSource *)source; 55 | 56 | *timeout = 0; 57 | if ( wl_display_prepare_read(self->display) != 0 ) 58 | return TRUE; 59 | else if ( wl_display_flush(self->display) < 0 ) 60 | { 61 | self->error = errno; 62 | return TRUE; 63 | } 64 | 65 | *timeout = -1; 66 | return FALSE; 67 | } 68 | 69 | static gboolean 70 | _g_water_wayland_source_check(GSource *source) 71 | { 72 | GWaterWaylandSource *self = (GWaterWaylandSource *)source; 73 | 74 | if ( self->error > 0 ) 75 | return TRUE; 76 | 77 | GIOCondition revents; 78 | revents = g_source_query_unix_fd(source, self->fd); 79 | 80 | if ( revents & G_IO_IN ) 81 | { 82 | if ( wl_display_read_events(self->display) < 0 ) 83 | self->error = errno; 84 | } 85 | else 86 | wl_display_cancel_read(self->display); 87 | 88 | return ( revents > 0 ); 89 | } 90 | 91 | static gboolean 92 | _g_water_wayland_source_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) 93 | { 94 | GWaterWaylandSource *self = (GWaterWaylandSource *)source; 95 | GIOCondition revents; 96 | 97 | revents = g_source_query_unix_fd(source, self->fd); 98 | if ( ( self->error > 0 ) || ( revents & (G_IO_ERR | G_IO_HUP) ) ) 99 | { 100 | errno = self->error; 101 | self->error = 0; 102 | if ( callback != NULL ) 103 | return callback(user_data); 104 | return G_SOURCE_REMOVE; 105 | } 106 | 107 | if ( wl_display_dispatch_pending(self->display) < 0 ) 108 | { 109 | if ( callback != NULL ) 110 | return callback(user_data); 111 | return G_SOURCE_REMOVE; 112 | } 113 | 114 | return G_SOURCE_CONTINUE; 115 | } 116 | 117 | static void 118 | _g_water_wayland_source_finalize(GSource *source) 119 | { 120 | GWaterWaylandSource *self = (GWaterWaylandSource *)source; 121 | 122 | if ( self->display_owned ) 123 | wl_display_disconnect(self->display); 124 | } 125 | 126 | static GSourceFuncs _g_water_wayland_source_funcs = { 127 | .prepare = _g_water_wayland_source_prepare, 128 | .check = _g_water_wayland_source_check, 129 | .dispatch = _g_water_wayland_source_dispatch, 130 | .finalize = _g_water_wayland_source_finalize, 131 | }; 132 | 133 | GWaterWaylandSource * 134 | g_water_wayland_source_new(GMainContext *context, const gchar *name) 135 | { 136 | struct wl_display *display; 137 | GWaterWaylandSource *self; 138 | 139 | display = wl_display_connect(name); 140 | if ( display == NULL ) 141 | return NULL; 142 | 143 | self = g_water_wayland_source_new_for_display(context, display); 144 | self->display_owned = TRUE; 145 | return self; 146 | } 147 | 148 | GWaterWaylandSource * 149 | g_water_wayland_source_new_for_display(GMainContext *context, struct wl_display *display) 150 | { 151 | g_return_val_if_fail(display != NULL, NULL); 152 | 153 | GSource *source; 154 | GWaterWaylandSource *self; 155 | 156 | source = g_source_new(&_g_water_wayland_source_funcs, sizeof(GWaterWaylandSource)); 157 | self = (GWaterWaylandSource *)source; 158 | self->display = display; 159 | 160 | self->fd = g_source_add_unix_fd(source, wl_display_get_fd(self->display), G_IO_IN | G_IO_ERR | G_IO_HUP); 161 | 162 | g_source_attach(source, context); 163 | 164 | return self; 165 | } 166 | 167 | void 168 | g_water_wayland_source_free(GWaterWaylandSource *self) 169 | { 170 | GSource * source = (GSource *)self; 171 | g_return_if_fail(self != NULL); 172 | 173 | g_source_destroy(source); 174 | 175 | g_source_unref(source); 176 | } 177 | 178 | void 179 | g_water_wayland_source_set_error_callback(GWaterWaylandSource *self, GSourceFunc callback, gpointer user_data, GDestroyNotify destroy_notify) 180 | { 181 | g_return_if_fail(self != NULL); 182 | 183 | g_source_set_callback((GSource *)self, callback, user_data, destroy_notify); 184 | } 185 | 186 | struct wl_display * 187 | g_water_wayland_source_get_display(GWaterWaylandSource *self) 188 | { 189 | g_return_val_if_fail(self != NULL, NULL); 190 | 191 | return self->display; 192 | } 193 | -------------------------------------------------------------------------------- /util/libgwater-wayland.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libgwater-wayland - Wayland GSource 3 | * 4 | * Copyright © 2014-2017 Quentin "Sardem FF7" Glidic 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef __G_WATER_WAYLAND_H__ 27 | #define __G_WATER_WAYLAND_H__ 28 | 29 | G_BEGIN_DECLS 30 | 31 | typedef struct _GWaterWaylandSource GWaterWaylandSource; 32 | 33 | GWaterWaylandSource *g_water_wayland_source_new(GMainContext *context, const gchar *name); 34 | GWaterWaylandSource *g_water_wayland_source_new_for_display(GMainContext *context, struct wl_display *display); 35 | void g_water_wayland_source_free(GWaterWaylandSource *self); 36 | 37 | void g_water_wayland_source_set_error_callback(GWaterWaylandSource *self, GSourceFunc callback, gpointer user_data, GDestroyNotify destroy_notify); 38 | struct wl_display *g_water_wayland_source_get_display(GWaterWaylandSource *source); 39 | 40 | G_END_DECLS 41 | 42 | #endif /* __G_WATER_WAYLAND_H__ */ 43 | -------------------------------------------------------------------------------- /util/signal.c: -------------------------------------------------------------------------------- 1 | #include "util/signal.h" 2 | 3 | static void handle_noop(struct wl_listener *listener, void *data) { 4 | // Do nothing 5 | } 6 | 7 | void wlr_signal_emit_safe(struct wl_signal *signal, void *data) { 8 | struct wl_listener cursor; 9 | struct wl_listener end; 10 | 11 | /* Add two special markers: one cursor and one end marker. This way, we know 12 | * that we've already called listeners on the left of the cursor and that we 13 | * don't want to call listeners on the right of the end marker. The 'it' 14 | * function can remove any element it wants from the list without troubles. 15 | * wl_list_for_each_safe tries to be safe but it fails: it works fine 16 | * if the current item is removed, but not if the next one is. */ 17 | wl_list_insert(&signal->listener_list, &cursor.link); 18 | cursor.notify = handle_noop; 19 | wl_list_insert(signal->listener_list.prev, &end.link); 20 | end.notify = handle_noop; 21 | 22 | while (cursor.link.next != &end.link) { 23 | struct wl_list *pos = cursor.link.next; 24 | struct wl_listener *l = wl_container_of(pos, l, link); 25 | 26 | wl_list_remove(&cursor.link); 27 | wl_list_insert(pos, &cursor.link); 28 | 29 | l->notify(l, data); 30 | } 31 | 32 | wl_list_remove(&cursor.link); 33 | wl_list_remove(&end.link); 34 | } 35 | -------------------------------------------------------------------------------- /util/signal.h: -------------------------------------------------------------------------------- 1 | #ifndef UTIL_SIGNAL_H 2 | #define UTIL_SIGNAL_H 3 | 4 | #include 5 | 6 | void wlr_signal_emit_safe(struct wl_signal *signal, void *data); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /xfway-protocols-uninstalled.pc.in: -------------------------------------------------------------------------------- 1 | pkgdatadir=@abs_top_srcdir@ 2 | 3 | Name: Wayland Protocols 4 | Description: Wayland protocol files (not installed) 5 | Version: @XFWAY_PROTOCOLS_VERSION@ 6 | -------------------------------------------------------------------------------- /xfway-protocols.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | datarootdir=@datarootdir@ 3 | pkgdatadir=${pc_sysrootdir}@datadir@/@PACKAGE@ 4 | 5 | Name: Wayland Protocols 6 | Description: Wayland protocol files 7 | Version: @XFWAY_PROTOCOLS_VERSION@ 8 | --------------------------------------------------------------------------------