[
  {
    "path": ".github/CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participation in our\ncommunity a harassment-free experience for everyone, regardless of age, body\nsize, visible or invisible disability, ethnicity, sex characteristics, gender\nidentity and expression, level of experience, education, socio-economic status,\nnationality, personal appearance, race, religion, or sexual identity\nand orientation.\n\nWe pledge to act and interact in ways that contribute to an open, welcoming,\ndiverse, inclusive, and healthy community.\n\n## Our Standards\n\nExamples of behavior that contributes to a positive environment for our\ncommunity include:\n\n* Demonstrating empathy and kindness toward other people\n* Being respectful of differing opinions, viewpoints, and experiences\n* Giving and gracefully accepting constructive feedback\n* Accepting responsibility and apologizing to those affected by our mistakes,\n  and learning from the experience\n* Focusing on what is best not just for us as individuals, but for the\n  overall community\n\nExamples of unacceptable behavior include:\n\n* The use of sexualized language or imagery, and sexual attention or\n  advances of any kind\n* Trolling, insulting or derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or email\n  address, without their explicit permission\n* Other conduct which could reasonably be considered inappropriate in a\n  professional setting\n\n## Enforcement Responsibilities\n\nCommunity leaders are responsible for clarifying and enforcing our standards of\nacceptable behavior and will take appropriate and fair corrective action in\nresponse to any behavior that they deem inappropriate, threatening, offensive,\nor harmful.\n\nCommunity leaders have the right and responsibility to remove, edit, or reject\ncomments, commits, code, wiki edits, issues, and other contributions that are\nnot aligned to this Code of Conduct, and will communicate reasons for moderation\ndecisions when appropriate.\n\n## Scope\n\nThis Code of Conduct applies within all community spaces, and also applies when\nan individual is officially representing the community in public spaces.\nExamples of representing our community include using an official e-mail address,\nposting via an official social media account, or acting as an appointed\nrepresentative at an online or offline event.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be\nreported to the community leaders responsible for enforcement at\nhexecute@thatother.dev.\nAll complaints will be reviewed and investigated promptly and fairly.\n\nAll community leaders are obligated to respect the privacy and security of the\nreporter of any incident.\n\n## Enforcement Guidelines\n\nCommunity leaders will follow these Community Impact Guidelines in determining\nthe consequences for any action they deem in violation of this Code of Conduct:\n\n### 1. Correction\n\n**Community Impact**: Use of inappropriate language or other behavior deemed\nunprofessional or unwelcome in the community.\n\n**Consequence**: A private, written warning from community leaders, providing\nclarity around the nature of the violation and an explanation of why the\nbehavior was inappropriate. A public apology may be requested.\n\n### 2. Warning\n\n**Community Impact**: A violation through a single incident or series\nof actions.\n\n**Consequence**: A warning with consequences for continued behavior. No\ninteraction with the people involved, including unsolicited interaction with\nthose enforcing the Code of Conduct, for a specified period of time. This\nincludes avoiding interactions in community spaces as well as external channels\nlike social media. Violating these terms may lead to a temporary or\npermanent ban.\n\n### 3. Temporary Ban\n\n**Community Impact**: A serious violation of community standards, including\nsustained inappropriate behavior.\n\n**Consequence**: A temporary ban from any sort of interaction or public\ncommunication with the community for a specified period of time. No public or\nprivate interaction with the people involved, including unsolicited interaction\nwith those enforcing the Code of Conduct, is allowed during this period.\nViolating these terms may lead to a permanent ban.\n\n### 4. Permanent Ban\n\n**Community Impact**: Demonstrating a pattern of violation of community\nstandards, including sustained inappropriate behavior,  harassment of an\nindividual, or aggression toward or disparagement of classes of individuals.\n\n**Consequence**: A permanent ban from any sort of public interaction within\nthe community.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage],\nversion 2.0, available at\nhttps://www.contributor-covenant.org/version/2/0/code_of_conduct.html.\n\nCommunity Impact Guidelines were inspired by [Mozilla's code of conduct\nenforcement ladder](https://github.com/mozilla/diversity).\n\n[homepage]: https://www.contributor-covenant.org\n\nFor answers to common questions about this code of conduct, see the FAQ at\nhttps://www.contributor-covenant.org/faq. Translations are available at\nhttps://www.contributor-covenant.org/translations.\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: ThatOtherAndrew\n"
  },
  {
    "path": ".github/SECURITY.md",
    "content": "# Security Policy\n\n## Supported Versions\n\nHexecute is maintained on a **rolling release basis** where only the latest release version is officially supported. Bugfixes and security patches **will not** be backported to previous versions.\n\n## Reporting a Vulnerability\n\nPlease report issues and vulnerabilities by [creating a new issue](https://github.com/ThatOtherAndrew/Hexecute/issues/new) on the repository, unless there is sensitive content where public disclosure of the issue is risky. In such cases, please use the contact method(s) listed in the [Code of Conduct](/CODE_OF_CONDUCT.md) instead.\n"
  },
  {
    "path": ".github/workflows/build.yml",
    "content": "name: Build hexecute\n\non:\n  push:\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    permissions:\n      id-token: \"write\"\n      contents: \"read\"\n    steps:\n      - uses: actions/checkout@v4\n      - uses: DeterminateSystems/nix-installer-action@main\n      - uses: DeterminateSystems/magic-nix-cache-action@main\n      - uses: DeterminateSystems/flake-checker-action@main\n      - name: Run `nix build`\n        run: nix build .\n      - name: Upload artifact\n        uses: actions/upload-artifact@v4\n        with:\n          name: hexecute\n          path: ./result/bin/\n"
  },
  {
    "path": ".gitignore",
    "content": "# go build -o bin ./...\nbin/\n\n# nix build (produces a symlink)\nresult\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "# Hexecute\n\nA gesture-based launcher for Wayland. Launch apps by casting spells! 🪄\n\n![Demo GIF](.github/assets/demo.gif)\n\n## Installation\n\n### Nix / NixOS\n\nIf you're a lucky [Nix](https://nixos.org/) user, you can:\n\n**Try it out without installing:**\n```bash\nnix run github:ThatOtherAndrew/Hexecute\n```\n\n**Install to your profile:**\n```bash\nnix profile install github:ThatOtherAndrew/Hexecute\n```\n\n**Add to your NixOS configuration:**\n```nix\n# flake.nix\n{\n  inputs.hexecute.url = \"github:ThatOtherAndrew/Hexecute\";\n}\n```\n```nix\n# configuration.nix\n{\n  environment.systemPackages = with pkgs; [\n    inputs.hexecute.packages.${pkgs.system}.default\n  ];\n}\n```\n\n### Executable download\n\nDownload the latest version from the [release page](https://github.com/ThatOtherAndrew/Hexecute/releases/latest), and place it somewhere in your `$PATH`.\n\n**Don't forget to rename the downloaded binary to `hexecute` and make it executable:**\n```bash\nmv hexecute-1.2.3-blah hexecute\nchmod +x hexecute\n```\n\n### Build from Source\n\nClone the repository:\n```bash\ngit clone https://github.com/ThatOtherAndrew/Hexecute\ncd Hexecute\n```\n\nIf you have [Nix](https://nixos.org/) installed, simply run `nix build`.\n\nOtherwise, make sure you have Go (and all dependent Wayland (and X11!?) libs) installed, then run:\n```bash\nmkdir -p bin\ngo build -o bin ./...\n./bin/hexecute\n```\n\n## Usage\n\n### Setting a Keybind\nThe recommended way to use Hexecute is to bind it to a keyboard shortcut in your compositor.\n\nListed below are some examples for popular compositors using the `SUPER` + `SPACE` keybind.\n\n#### Hyprland\n\nIf you're using Hyprland, add the following line to your `~/.config/hypr/hyprland.conf`:\n\n```\nbind = SUPER, SPACE, exec, hexecute\n```\n\n#### Sway\n\nIf you're using Sway, add the following line to your `~/.config/sway/config`:\n\n```\nbindsym $mod+space exec hexecute\n```\n\n### Learning a Gesture\n\nTo configure a gesture to launch an application, run `hexecute --learn [command]` in a terminal. Hexecute should launch - simply draw your chosen gesture **3 times** and it will be mapped to the command.\n\n![Gesture learning demo](assets/hexecute-learn.gif)\n\n### Managing Gestures\n\nTo view all your configured gestures, run `hexecute --list` in a terminal.\n\nTo delete a previously assigned gesture, use the `hexecute --remove [gesture]` command.\n\nAll gestures are saved in the `~/.config/hexecute/gestures.json` file. This file can be manually shared, edited, backed up, or swapped.\n"
  },
  {
    "path": "cmd/hexecute/main.go",
    "content": "package main\n\nimport (\n\t\"encoding/json\"\n\t\"flag\"\n\t\"log\"\n\t\"os\"\n\t\"runtime\"\n\t\"time\"\n\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/config\"\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/draw\"\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/execute\"\n\tgestures \"github.com/ThatOtherAndrew/Hexecute/internal/gesture\"\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/models\"\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/opengl\"\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/spawn\"\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/stroke\"\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/update\"\n\t\"github.com/ThatOtherAndrew/Hexecute/pkg/wayland\"\n\t\"github.com/go-gl/gl/v4.1-core/gl\"\n)\n\nfunc init() {\n\truntime.LockOSThread()\n}\n\ntype App struct {\n\t*models.App\n}\n\nfunc main() {\n\tlearnCommand := flag.String(\"learn\", \"\", \"Learn a new gesture for the specified command\")\n\tlistGestures := flag.Bool(\"list\", false, \"List all registered gestures\")\n\tremoveGesture := flag.String(\"remove\", \"\", \"Remove a gesture by command name\")\n\tflag.Parse()\n\n\tif flag.NArg() > 0 {\n\t\tlog.Fatalf(\"Unknown arguments: %v\", flag.Args())\n\t}\n\n\tif *listGestures {\n\t\tgestures, err := gestures.LoadGestures()\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Failed to load gestures:\", err)\n\t\t}\n\t\tif len(gestures) == 0 {\n\t\t\tprintln(\"No gestures registered\")\n\t\t} else {\n\t\t\tprintln(\"Registered gestures:\")\n\t\t\tfor _, g := range gestures {\n\t\t\t\tprintln(\"  \", g.Command)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\tif *removeGesture != \"\" {\n\t\tgestures, err := gestures.LoadGestures()\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Failed to load gestures:\", err)\n\t\t}\n\n\t\tfound := false\n\t\tfor i, g := range gestures {\n\t\t\tif g.Command == *removeGesture {\n\t\t\t\tgestures = append(gestures[:i], gestures[i+1:]...)\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !found {\n\t\t\tlog.Fatalf(\"Gesture not found: %s\", *removeGesture)\n\t\t}\n\n\t\tconfigFile, err := config.GetPath()\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Failed to get config path:\", err)\n\t\t}\n\n\t\tdata, err := json.Marshal(gestures)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Failed to marshal gestures:\", err)\n\t\t}\n\n\t\tif err := os.WriteFile(configFile, data, 0644); err != nil {\n\t\t\tlog.Fatal(\"Failed to save gestures:\", err)\n\t\t}\n\n\t\tprintln(\"Removed gesture:\", *removeGesture)\n\t\treturn\n\t}\n\n\twindow, err := wayland.NewWaylandWindow()\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to create Wayland window:\", err)\n\t}\n\tdefer window.Destroy()\n\n\tsettings, err := config.LoadSettings()\n\tif err != nil {\n\t\tlog.Fatal(\"Failed to load settings:\", err)\n\t}\n\n\tapp := &models.App{\n\t\tStartTime: time.Now(),\n\t\tSettings:  settings,\n\t}\n\n\tif *learnCommand != \"\" {\n\t\tapp.LearnMode = true\n\t\tapp.LearnCommand = *learnCommand\n\t\tlog.Printf(\"Learn mode: Draw the gesture 3 times for command '%s'\", *learnCommand)\n\t} else {\n\t\tgestures, err := gestures.LoadGestures()\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Failed to load gestures:\", err)\n\t\t}\n\t\tapp.SavedGestures = gestures\n\t\tlog.Printf(\"Loaded %d gesture(s)\", len(gestures))\n\t}\n\n\topengl := opengl.New(app)\n\tif err := opengl.InitGL(); err != nil {\n\t\tlog.Fatal(\"Failed to initialize OpenGL:\", err)\n\t}\n\n\tgl.ClearColor(0, 0, 0, 0)\n\n\tfor range 5 {\n\t\twindow.PollEvents()\n\t\tgl.Clear(gl.COLOR_BUFFER_BIT)\n\t\twindow.SwapBuffers()\n\t}\n\n\tx, y := window.GetCursorPos()\n\tapp.LastCursorX = float32(x)\n\tapp.LastCursorY = float32(y)\n\n\tlastTime := time.Now()\n\tvar wasPressed bool\n\n\tfor !window.ShouldClose() {\n\t\tnow := time.Now()\n\t\tdt := float32(now.Sub(lastTime).Seconds())\n\t\tlastTime = now\n\n\t\twindow.PollEvents()\n\t\tupdate := update.New(app)\n\t\tupdate.UpdateCursor(window)\n\n\t\tif key, state, hasKey := window.GetLastKey(); hasKey {\n\t\t\tif state == 1 && key == 0xff1b {\n\t\t\t\tif !app.IsExiting {\n\t\t\t\t\tif app.IsDrawing || len(app.Points) > 0 {\n\t\t\t\t\t\tlog.Println(\"Esc key pressed, aborting gesture\")\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Println(\"Esc key pressed, exiting\")\n\t\t\t\t\t}\n\t\t\t\t\tapp.IsExiting = true\n\t\t\t\t\tapp.ExitStartTime = time.Now()\n\t\t\t\t\tapp.Points = nil\n\t\t\t\t\twindow.DisableInput()\n\t\t\t\t\tx, y := window.GetCursorPos()\n\t\t\t\t\tspawn := spawn.New(app)\n\t\t\t\t\tspawn.SpawnExitWisps(float32(x), float32(y))\n\t\t\t\t}\n\t\t\t}\n\t\t\twindow.ClearLastKey()\n\t\t}\n\n\t\tif app.IsExiting {\n\t\t\tif time.Since(app.ExitStartTime).Seconds() > 0.8 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tisPressed := window.GetMouseButton()\n\t\tif isPressed && !wasPressed {\n\t\t\tapp.IsDrawing = true\n\t\t\tlog.Println(\"Gesture started\")\n\t\t} else if !isPressed && wasPressed {\n\t\t\tapp.IsDrawing = false\n\n\t\t\tif app.LearnMode && len(app.Points) > 0 {\n\t\t\t\tlog.Println(\"Gesture completed\")\n\t\t\t\tprocessed := stroke.ProcessStroke(app.Points)\n\t\t\t\tapp.LearnGestures = append(app.LearnGestures, processed)\n\t\t\t\tapp.LearnCount++\n\t\t\t\tlog.Printf(\"Captured gesture %d/3\", app.LearnCount)\n\n\t\t\t\tapp.Points = nil\n\n\t\t\t\tif app.LearnCount >= 3 {\n\t\t\t\t\tif err := gestures.SaveGesture(app.LearnCommand, app.LearnGestures); err != nil {\n\t\t\t\t\t\tlog.Fatal(\"Failed to save gesture:\", err)\n\t\t\t\t\t}\n\t\t\t\t\tlog.Printf(\"Gesture saved for command: %s\", app.LearnCommand)\n\n\t\t\t\t\tapp.IsExiting = true\n\t\t\t\t\tapp.ExitStartTime = time.Now()\n\t\t\t\t\twindow.DisableInput()\n\t\t\t\t\tx, y := window.GetCursorPos()\n\t\t\t\t\tspawn := spawn.New(app)\n\t\t\t\t\tspawn.SpawnExitWisps(float32(x), float32(y))\n\t\t\t\t}\n\t\t\t} else if !app.LearnMode && !app.IsExiting && len(app.Points) > 0 {\n\t\t\t\tlog.Println(\"Gesture completed\")\n\t\t\t\tx, y := window.GetCursorPos()\n\t\t\t\texec := execute.New(app)\n\t\t\t\texec.RecognizeAndExecute(window, float32(x), float32(y))\n\t\t\t\tapp.Points = nil\n\t\t\t}\n\t\t}\n\t\twasPressed = isPressed\n\n\t\tif app.IsDrawing {\n\t\t\tx, y := window.GetCursorPos()\n\t\t\tgesture := gestures.New(app)\n\t\t\tgesture.AddPoint(float32(x), float32(y))\n\n\t\t\tspawn := spawn.New(app)\n\t\t\tspawn.SpawnCursorSparkles(float32(x), float32(y))\n\t\t}\n\n\t\tupdate.UpdateParticles(dt)\n\t\tdrawer := draw.New(app)\n\t\tdrawer.Draw(window)\n\t\twindow.SwapBuffers()\n\t}\n}\n"
  },
  {
    "path": "flake.nix",
    "content": "{\n  description = \"Hexecute\";\n\n  inputs = {\n    nixpkgs.url = \"github:nixos/nixpkgs?ref=nixos-unstable\";\n  };\n\n  outputs =\n    inputs:\n    let\n      system = \"x86_64-linux\";\n      pkgs = inputs.nixpkgs.legacyPackages.${system};\n      hexecute = pkgs.buildGoModule {\n        pname = \"hexecute\";\n        version = \"0.1.0\";\n\n        src = ./.;\n\n        vendorHash = \"sha256-CIlYhcX7F08Xwrr3/0tkgrfuP68UU0CeQ+HV63b6Ddg=\";\n\n        nativeBuildInputs = with pkgs; [\n          pkg-config\n        ];\n\n        buildInputs = with pkgs; [\n          wayland\n          wayland-protocols\n          libxkbcommon\n          libGL\n          libGLU\n          mesa\n          xorg.libX11\n        ];\n\n        meta = {\n          description = \"Launch apps by casting spells! 🪄\";\n          homepage = \"https://github.com/ThatOtherAndrew/Hexecute\";\n          license = pkgs.lib.licenses.gpl3;\n          platforms = pkgs.lib.platforms.linux;\n        };\n      };\n    in\n    {\n      packages.${system} = {\n        inherit hexecute;\n        default = hexecute;\n      };\n\n      devShells.${system}.default = pkgs.mkShell {\n        name = \"hexecute\";\n\n        packages = with pkgs; [\n          go\n          pkg-config\n\n          # Wayland libraries\n          wayland\n          wayland-protocols\n          wayland-scanner\n          libxkbcommon\n\n          # EGL and OpenGL\n          libGL\n          libGLU\n          mesa\n\n          # Build tools\n          gcc\n        ];\n      };\n    };\n}\n"
  },
  {
    "path": "go.mod",
    "content": "module github.com/ThatOtherAndrew/Hexecute\n\ngo 1.25.1\n\nrequire github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71\n"
  },
  {
    "path": "go.sum",
    "content": "github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 h1:5BVwOaUSBTlVZowGO6VZGw2H/zl9nrd3eCZfYV+NfQA=\ngithub.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw=\n"
  },
  {
    "path": "internal/config/config.go",
    "content": "package config\n\nimport (\n\t\"encoding/json\"\n\t\"log\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"reflect\"\n\t\"strings\"\n)\n\n// TODO: migrate other settings\ntype Settings struct {\n\tOverlayAlpha float32 `json:\"overlay_alpha\"`\n}\n\nfunc GetPath() (string, error) {\n\thomeDir, err := os.UserHomeDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tconfigDir := filepath.Join(homeDir, \".config\", \"hexecute\")\n\tif err := os.MkdirAll(configDir, 0755); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn filepath.Join(configDir, \"gestures.json\"), nil\n}\n\nfunc GetSettingsPath() (string, error) {\n\thomeDir, err := os.UserHomeDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tconfigDir := filepath.Join(homeDir, \".config\", \"hexecute\")\n\tif err := os.MkdirAll(configDir, 0755); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn filepath.Join(configDir, \"settings.json\"), nil\n}\n\nfunc LoadSettings() (*Settings, error) {\n\tsettingsPath, err := GetSettingsPath()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefaultSettings := &Settings{\n\t\tOverlayAlpha: 0.75,\n\t}\n\n\tdata, err := os.ReadFile(settingsPath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tlog.Printf(\"Creating default settings file at %s\", settingsPath)\n\t\t\tif err := createDefaultSettings(settingsPath, defaultSettings); err != nil {\n\t\t\t\tlog.Printf(\"Failed to create default settings file: %v\", err)\n\t\t\t}\n\t\t\treturn defaultSettings, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\t// Check for unrecognised keys\n\tvar rawSettings map[string]interface{}\n\tif err := json.Unmarshal(data, &rawSettings); err != nil {\n\t\tlog.Printf(\"Invalid settings file, using defaults: %v\", err)\n\t\treturn defaultSettings, nil\n\t}\n\n\tknownKeys := getKnownKeys(Settings{})\n\tfor key := range rawSettings {\n\t\tif !knownKeys[key] {\n\t\t\tlog.Printf(\"Warning: unrecognised setting key '%s' in settings file\", key)\n\t\t}\n\t}\n\n\tsettings := &Settings{}\n\tif err := json.Unmarshal(data, settings); err != nil {\n\t\tlog.Printf(\"Invalid settings file, using defaults: %v\", err)\n\t\treturn defaultSettings, nil\n\t}\n\n\t// Validate and clamp overlay_alpha to [0, 1]\n\tif settings.OverlayAlpha < 0.0 || settings.OverlayAlpha > 1.0 {\n\t\tlog.Printf(\"Invalid overlay_alpha value %.2f, must be between 0.0 and 1.0, using default %.2f\",\n\t\t\tsettings.OverlayAlpha, defaultSettings.OverlayAlpha)\n\t\tsettings.OverlayAlpha = defaultSettings.OverlayAlpha\n\t}\n\n\treturn settings, nil\n}\n\nfunc createDefaultSettings(path string, settings *Settings) error {\n\tdata, err := json.MarshalIndent(settings, \"\", \"  \")\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn os.WriteFile(path, data, 0644)\n}\n\nfunc getKnownKeys(v interface{}) map[string]bool {\n\tkeys := make(map[string]bool)\n\tt := reflect.TypeOf(v)\n\tif t.Kind() == reflect.Ptr {\n\t\tt = t.Elem()\n\t}\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tfield := t.Field(i)\n\t\tif jsonTag := field.Tag.Get(\"json\"); jsonTag != \"\" {\n\t\t\t// Handle json tags like \"field,omitempty\"\n\t\t\ttagName := strings.Split(jsonTag, \",\")[0]\n\t\t\tif tagName != \"-\" {\n\t\t\t\tkeys[tagName] = true\n\t\t\t}\n\t\t}\n\t}\n\treturn keys\n}\n"
  },
  {
    "path": "internal/draw/draw.go",
    "content": "package draw\n\nimport (\n\t\"math\"\n\t\"time\"\n\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/models\"\n\t\"github.com/ThatOtherAndrew/Hexecute/pkg/wayland\"\n\t\"github.com/go-gl/gl/v4.1-core/gl\"\n)\n\ntype App struct {\n\tapp *models.App\n}\n\nfunc New(app *models.App) *App {\n\treturn &App{app: app}\n}\n\nfunc (a *App) Draw(window *wayland.WaylandWindow) {\n\tgl.Clear(gl.COLOR_BUFFER_BIT)\n\n\tcurrentTime := float32(time.Since(a.app.StartTime).Seconds())\n\n\ta.drawBackground(currentTime, window)\n\n\tx, y := window.GetCursorPos()\n\ta.drawCursorGlow(window, float32(x), float32(y), currentTime)\n\n\tfor pass := range 3 {\n\t\tthickness := float32(7 + pass*4)\n\t\talpha := float32(0.7 - float32(pass)*0.15)\n\t\ta.drawLine(window, thickness, alpha, currentTime)\n\t}\n\n\ta.drawParticles(window)\n}\n\nfunc (a *App) drawLine(\n\twindow *wayland.WaylandWindow,\n\tbaseThickness, baseAlpha, currentTime float32,\n) {\n\tif len(a.app.Points) < 2 {\n\t\treturn\n\t}\n\n\tvertices := make([]float32, 0, len(a.app.Points)*10)\n\n\tfor i := range a.app.Points {\n\t\tage := float32(time.Since(a.app.Points[i].BornTime).Seconds())\n\t\tfade := 1.0 - (age / 1.5)\n\t\tif fade < 0 {\n\t\t\tfade = 0\n\t\t}\n\t\talpha := fade * baseAlpha\n\n\t\tvar perpX, perpY float32\n\n\t\tif i == 0 {\n\t\t\tdx := a.app.Points[i+1].X - a.app.Points[i].X\n\t\t\tdy := a.app.Points[i+1].Y - a.app.Points[i].Y\n\t\t\tlength := float32(1.0) / float32(math.Sqrt(float64(dx*dx+dy*dy)))\n\t\t\tperpX = -dy * length\n\t\t\tperpY = dx * length\n\t\t} else if i == len(a.app.Points)-1 {\n\t\t\tdx := a.app.Points[i].X - a.app.Points[i-1].X\n\t\t\tdy := a.app.Points[i].Y - a.app.Points[i-1].Y\n\t\t\tlength := float32(1.0) / float32(math.Sqrt(float64(dx*dx+dy*dy)))\n\t\t\tperpX = -dy * length\n\t\t\tperpY = dx * length\n\t\t} else {\n\t\t\tdx1 := a.app.Points[i].X - a.app.Points[i-1].X\n\t\t\tdy1 := a.app.Points[i].Y - a.app.Points[i-1].Y\n\t\t\tlen1 := float32(math.Sqrt(float64(dx1*dx1 + dy1*dy1)))\n\t\t\tif len1 > 0 {\n\t\t\t\tdx1 /= len1\n\t\t\t\tdy1 /= len1\n\t\t\t}\n\n\t\t\tdx2 := a.app.Points[i+1].X - a.app.Points[i].X\n\t\t\tdy2 := a.app.Points[i+1].Y - a.app.Points[i].Y\n\t\t\tlen2 := float32(math.Sqrt(float64(dx2*dx2 + dy2*dy2)))\n\t\t\tif len2 > 0 {\n\t\t\t\tdx2 /= len2\n\t\t\t\tdy2 /= len2\n\t\t\t}\n\n\t\t\tavgDx := (dx1 + dx2) * 0.5\n\t\t\tavgDy := (dy1 + dy2) * 0.5\n\t\t\tavgLen := float32(math.Sqrt(float64(avgDx*avgDx + avgDy*avgDy)))\n\t\t\tif avgLen > 0 {\n\t\t\t\tavgDx /= avgLen\n\t\t\t\tavgDy /= avgLen\n\t\t\t}\n\n\t\t\tperpX = -avgDy\n\t\t\tperpY = avgDx\n\t\t}\n\n\t\tvertices = append(vertices, a.app.Points[i].X, a.app.Points[i].Y, perpX, perpY, alpha)\n\t\tvertices = append(vertices, a.app.Points[i].X, a.app.Points[i].Y, -perpX, -perpY, alpha)\n\t}\n\n\tcutoff := time.Now().Add(-1500 * time.Millisecond)\n\tfor len(a.app.Points) > 0 && a.app.Points[0].BornTime.Before(cutoff) {\n\t\ta.app.Points = a.app.Points[1:]\n\t}\n\n\tif len(vertices) == 0 {\n\t\treturn\n\t}\n\n\tgl.BindBuffer(gl.ARRAY_BUFFER, a.app.Vbo)\n\tgl.BufferData(gl.ARRAY_BUFFER, len(vertices)*4, gl.Ptr(vertices), gl.DYNAMIC_DRAW)\n\n\twidth, height := window.GetSize()\n\n\tgl.UseProgram(a.app.Program)\n\tresolutionLoc := gl.GetUniformLocation(a.app.Program, gl.Str(\"resolution\\x00\"))\n\tgl.Uniform2f(resolutionLoc, float32(width), float32(height))\n\tthicknessLoc := gl.GetUniformLocation(a.app.Program, gl.Str(\"thickness\\x00\"))\n\tgl.Uniform1f(thicknessLoc, baseThickness)\n\ttimeLoc := gl.GetUniformLocation(a.app.Program, gl.Str(\"time\\x00\"))\n\tgl.Uniform1f(timeLoc, currentTime)\n\n\tgl.BindVertexArray(a.app.Vao)\n\tgl.DrawArrays(gl.TRIANGLE_STRIP, 0, int32(len(a.app.Points)*2))\n\tgl.BindVertexArray(0)\n}\n\nfunc (a *App) drawParticles(window *wayland.WaylandWindow) {\n\tif len(a.app.Particles) == 0 {\n\t\treturn\n\t}\n\n\tvertices := make([]float32, 0, len(a.app.Particles)*6)\n\tfor _, p := range a.app.Particles {\n\t\tvertices = append(vertices, p.X, p.Y, p.Life, p.MaxLife, p.Size, p.Hue)\n\t}\n\n\tgl.BindBuffer(gl.ARRAY_BUFFER, a.app.ParticleVBO)\n\tgl.BufferData(gl.ARRAY_BUFFER, len(vertices)*4, gl.Ptr(vertices), gl.DYNAMIC_DRAW)\n\n\twidth, height := window.GetSize()\n\n\tgl.UseProgram(a.app.ParticleProgram)\n\tresolutionLoc := gl.GetUniformLocation(a.app.ParticleProgram, gl.Str(\"resolution\\x00\"))\n\tgl.Uniform2f(resolutionLoc, float32(width), float32(height))\n\n\tgl.BindVertexArray(a.app.ParticleVAO)\n\tgl.DrawArrays(gl.POINTS, 0, int32(len(a.app.Particles)))\n\tgl.BindVertexArray(0)\n}\n\nfunc (a *App) drawBackground(currentTime float32, window *wayland.WaylandWindow) {\n\tfadeDuration := float32(1.0)\n\ttargetAlpha := a.app.Settings.OverlayAlpha\n\n\tvar alpha float32\n\tif currentTime < fadeDuration {\n\t\tprogress := currentTime / fadeDuration\n\t\teasedProgress := 1.0 - (1.0-progress)*(1.0-progress)*(1.0-progress)*(1.0-progress)*(1.0-progress)\n\t\talpha = easedProgress * targetAlpha\n\t} else {\n\t\talpha = targetAlpha\n\t}\n\n\tif a.app.IsExiting {\n\t\texitDuration := float32(0.8)\n\t\telapsed := float32(time.Since(a.app.ExitStartTime).Seconds())\n\t\tif elapsed < exitDuration {\n\t\t\tprogress := elapsed / exitDuration\n\t\t\teasedProgress := 1.0 - (1.0-progress)*(1.0-progress)*(1.0-progress)*(1.0-progress)*(1.0-progress)\n\t\t\talpha *= (1.0 - easedProgress)\n\t\t} else {\n\t\t\talpha = 0\n\t\t}\n\t}\n\n\tx, y := window.GetCursorPos()\n\twidth, height := window.GetSize()\n\n\tgl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)\n\n\tgl.UseProgram(a.app.BgProgram)\n\n\talphaLoc := gl.GetUniformLocation(a.app.BgProgram, gl.Str(\"alpha\\x00\"))\n\tgl.Uniform1f(alphaLoc, alpha)\n\n\tcursorPosLoc := gl.GetUniformLocation(a.app.BgProgram, gl.Str(\"cursorPos\\x00\"))\n\tgl.Uniform2f(cursorPosLoc, float32(x), float32(float64(height)-y))\n\n\tresolutionLoc := gl.GetUniformLocation(a.app.BgProgram, gl.Str(\"resolution\\x00\"))\n\tgl.Uniform2f(resolutionLoc, float32(width), float32(height))\n\n\tgl.BindVertexArray(a.app.BgVAO)\n\tgl.DrawArrays(gl.TRIANGLE_STRIP, 0, 4)\n\tgl.BindVertexArray(0)\n\n\tgl.BlendFunc(gl.SRC_ALPHA, gl.ONE)\n}\n\nfunc (a *App) drawCursorGlow(window *wayland.WaylandWindow, cursorX, cursorY, currentTime float32) {\n\twidth, height := window.GetSize()\n\n\tgrowDuration := float32(1.2)\n\tvar scale float32\n\tif currentTime < growDuration {\n\t\tt := currentTime / growDuration\n\t\tc4 := (2.0 * math.Pi) / 3.0\n\t\tif t == 0 {\n\t\t\tscale = 0\n\t\t} else if t >= 1 {\n\t\t\tscale = 1\n\t\t} else {\n\t\t\tscale = float32(math.Pow(2, -10*float64(t))*math.Sin((float64(t)*10-0.75)*c4) + 1)\n\t\t}\n\t} else {\n\t\tscale = 1.0\n\t}\n\n\tvar exitProgress float32\n\tif a.app.IsExiting {\n\t\texitDuration := float32(0.8)\n\t\telapsed := float32(time.Since(a.app.ExitStartTime).Seconds())\n\t\tif elapsed < exitDuration {\n\t\t\tt := elapsed / exitDuration\n\t\t\texitProgress = t * t * t\n\t\t\tscale *= (1.0 - exitProgress)\n\t\t} else {\n\t\t\texitProgress = 1.0\n\t\t\tscale = 0\n\t\t}\n\t}\n\n\tgl.UseProgram(a.app.CursorGlowProgram)\n\n\tcursorPosLoc := gl.GetUniformLocation(a.app.CursorGlowProgram, gl.Str(\"cursorPos\\x00\"))\n\tgl.Uniform2f(cursorPosLoc, cursorX, cursorY)\n\n\tresolutionLoc := gl.GetUniformLocation(a.app.CursorGlowProgram, gl.Str(\"resolution\\x00\"))\n\tgl.Uniform2f(resolutionLoc, float32(width), float32(height))\n\n\tglowSizeLoc := gl.GetUniformLocation(a.app.CursorGlowProgram, gl.Str(\"glowSize\\x00\"))\n\tgl.Uniform1f(glowSizeLoc, 80.0*scale)\n\n\ttimeLoc := gl.GetUniformLocation(a.app.CursorGlowProgram, gl.Str(\"time\\x00\"))\n\tgl.Uniform1f(timeLoc, currentTime)\n\n\tvelocityLoc := gl.GetUniformLocation(a.app.CursorGlowProgram, gl.Str(\"velocity\\x00\"))\n\tgl.Uniform1f(velocityLoc, a.app.SmoothVelocity)\n\n\trotationLoc := gl.GetUniformLocation(a.app.CursorGlowProgram, gl.Str(\"rotation\\x00\"))\n\tgl.Uniform1f(rotationLoc, a.app.SmoothRotation)\n\n\tisDrawingLoc := gl.GetUniformLocation(a.app.CursorGlowProgram, gl.Str(\"isDrawing\\x00\"))\n\tgl.Uniform1f(isDrawingLoc, a.app.SmoothDrawing)\n\n\texitProgressLoc := gl.GetUniformLocation(a.app.CursorGlowProgram, gl.Str(\"exitProgress\\x00\"))\n\tgl.Uniform1f(exitProgressLoc, exitProgress)\n\n\tgl.BindVertexArray(a.app.CursorGlowVAO)\n\tgl.DrawArrays(gl.TRIANGLE_STRIP, 0, 4)\n\tgl.BindVertexArray(0)\n}\n"
  },
  {
    "path": "internal/execute/execute.go",
    "content": "package execute\n\nimport (\n\t\"log\"\n\t\"os/exec\"\n\t\"syscall\"\n\t\"time\"\n\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/models\"\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/spawn\"\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/stroke\"\n\t\"github.com/ThatOtherAndrew/Hexecute/pkg/wayland\"\n)\n\ntype App struct {\n\tapp *models.App\n}\n\nfunc New(app *models.App) *App {\n\treturn &App{app: app}\n}\n\nfunc Command(command string) error {\n\tif command == \"\" {\n\t\treturn nil\n\t}\n\n\tcmd := exec.Command(\"sh\", \"-c\", command)\n\tcmd.SysProcAttr = &syscall.SysProcAttr{\n\t\tSetsid: true,\n\t}\n\tcmd.Stdin = nil\n\tcmd.Stdout = nil\n\tcmd.Stderr = nil\n\n\treturn cmd.Start()\n}\n\nfunc (a *App) RecognizeAndExecute(window *wayland.WaylandWindow, x, y float32) {\n\tif len(a.app.Points) < 5 {\n\t\tlog.Println(\"Gesture too short, ignoring\")\n\t\treturn\n\t}\n\n\tprocessed := stroke.ProcessStroke(a.app.Points)\n\n\tbestMatch := -1\n\tbestScore := 0.0\n\n\tfor i, gesture := range a.app.SavedGestures {\n\t\tmatch, score := stroke.UnistrokeRecognise(processed, gesture.Templates)\n\t\tlog.Printf(\"Gesture %d (%s): template %d, score %.3f\", i, gesture.Command, match, score)\n\n\t\tif score > bestScore {\n\t\t\tbestScore = score\n\t\t\tbestMatch = i\n\t\t}\n\t}\n\n\tif bestMatch >= 0 && bestScore > 0.6 {\n\t\tcommand := a.app.SavedGestures[bestMatch].Command\n\t\tlog.Printf(\"Matched gesture: %s (score: %.3f)\", command, bestScore)\n\n\t\tif err := Command(command); err != nil {\n\t\t\tlog.Printf(\"Failed to execute command: %v\", err)\n\t\t} else {\n\t\t\tlog.Printf(\"Executed: %s\", command)\n\t\t}\n\n\t\ta.app.IsExiting = true\n\t\ta.app.ExitStartTime = time.Now()\n\t\twindow.DisableInput()\n\t\tspawn := spawn.New(a.app)\n\t\tspawn.SpawnExitWisps(x, y)\n\t} else {\n\t\tlog.Printf(\"No confident match (best score: %.3f)\", bestScore)\n\t}\n}\n"
  },
  {
    "path": "internal/gesture/gesture.go",
    "content": "package gestures\n\nimport (\n\t\"encoding/json\"\n\t\"math\"\n\t\"math/rand/v2\"\n\t\"os\"\n\t\"time\"\n\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/config\"\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/models\"\n)\n\ntype App struct {\n\tapp *models.App\n}\n\nfunc New(app *models.App) *App {\n\treturn &App{app: app}\n}\n\nfunc LoadGestures() ([]models.GestureConfig, error) {\n\tconfigFile, err := config.GetPath()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata, err := os.ReadFile(configFile)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn []models.GestureConfig{}, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tvar gestures []models.GestureConfig\n\tif err := json.Unmarshal(data, &gestures); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn gestures, nil\n}\n\nfunc SaveGesture(command string, templates [][]models.Point) error {\n\tconfigFile, err := config.GetPath()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar gestures []models.GestureConfig\n\tif data, err := os.ReadFile(configFile); err == nil {\n\t\tif err := json.Unmarshal(data, &gestures); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tnewGesture := models.GestureConfig{\n\t\tCommand:   command,\n\t\tTemplates: templates,\n\t}\n\n\tfound := false\n\tfor i, g := range gestures {\n\t\tif g.Command == command {\n\t\t\tgestures[i] = newGesture\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !found {\n\t\tgestures = append(gestures, newGesture)\n\t}\n\n\tdata, err := json.Marshal(gestures)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn os.WriteFile(configFile, data, 0644)\n}\n\nfunc (a *App) AddPoint(x, y float32) {\n\tnewPoint := models.Point{X: x, Y: y, BornTime: time.Now()}\n\n\tshouldAdd := false\n\tif len(a.app.Points) == 0 {\n\t\tshouldAdd = true\n\t} else {\n\t\tlastPoint := a.app.Points[len(a.app.Points)-1]\n\t\tdx := newPoint.X - lastPoint.X\n\t\tdy := newPoint.Y - lastPoint.Y\n\t\tif dx*dx+dy*dy > 4 {\n\t\t\tshouldAdd = true\n\n\t\t\tfor range 3 {\n\t\t\t\tangle := rand.Float64() * 2 * math.Pi\n\t\t\t\tspeed := rand.Float32()*50 + 20\n\t\t\t\ta.app.Particles = append(a.app.Particles, models.Particle{\n\t\t\t\t\tX:       x + (rand.Float32()-0.5)*10,\n\t\t\t\t\tY:       y + (rand.Float32()-0.5)*10,\n\t\t\t\t\tVX:      float32(math.Cos(angle)) * speed,\n\t\t\t\t\tVY:      float32(math.Sin(angle)) * speed,\n\t\t\t\t\tLife:    1.0,\n\t\t\t\t\tMaxLife: 1.0,\n\t\t\t\t\tSize:    rand.Float32()*15 + 10,\n\t\t\t\t\tHue:     rand.Float32(),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tconst MAX_POINTS = 2048\n\n\tif shouldAdd {\n\t\ta.app.Points = append(a.app.Points, newPoint)\n\t\tif len(a.app.Points) > MAX_POINTS {\n\t\t\ta.app.Points = a.app.Points[len(a.app.Points)-MAX_POINTS:]\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "internal/models/models.go",
    "content": "package models\n\nimport (\n\t\"time\"\n\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/config\"\n)\n\ntype Point struct {\n\tX, Y     float32\n\tBornTime time.Time `json:\"-\"`\n}\n\ntype Particle struct {\n\tX, Y    float32\n\tVX, VY  float32\n\tLife    float32\n\tMaxLife float32\n\tSize    float32\n\tHue     float32\n}\n\ntype GestureConfig struct {\n\tCommand   string    `json:\"command\"`\n\tTemplates [][]Point `json:\"templates\"`\n}\n\ntype App struct {\n\tPoints            []Point\n\tParticles         []Particle\n\tIsDrawing         bool\n\tVao               uint32\n\tVbo               uint32\n\tProgram           uint32\n\tParticleVAO       uint32\n\tParticleVBO       uint32\n\tParticleProgram   uint32\n\tBgVAO             uint32\n\tBgVBO             uint32\n\tBgProgram         uint32\n\tCursorGlowVAO     uint32\n\tCursorGlowVBO     uint32\n\tCursorGlowProgram uint32\n\tStartTime         time.Time\n\tLastCursorX       float32\n\tLastCursorY       float32\n\tCursorVelocity    float32\n\tSmoothVelocity    float32\n\tSmoothRotation    float32\n\tSmoothDrawing     float32\n\tIsExiting         bool\n\tExitStartTime     time.Time\n\tLearnMode         bool\n\tLearnCommand      string\n\tLearnGestures     [][]Point\n\tLearnCount        int\n\tSavedGestures     []GestureConfig\n\tSettings          *config.Settings\n}\n"
  },
  {
    "path": "internal/opengl/opengl.go",
    "content": "package opengl\n\nimport (\n\t\"log\"\n\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/models\"\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/shaders\"\n\t\"github.com/go-gl/gl/v4.1-core/gl\"\n)\n\ntype App struct {\n\tapp *models.App\n}\n\nfunc New(app *models.App) *App {\n\treturn &App{app: app}\n}\n\nfunc (a *App) InitGL() error {\n\tif err := gl.Init(); err != nil {\n\t\treturn err\n\t}\n\n\tvertShader, err := shaders.CompileShaderFromSource(shaders.LineVertex, gl.VERTEX_SHADER)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfragShader, err := shaders.CompileShaderFromSource(shaders.LineFragment, gl.FRAGMENT_SHADER)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ta.app.Program = gl.CreateProgram()\n\tgl.AttachShader(a.app.Program, vertShader)\n\tgl.AttachShader(a.app.Program, fragShader)\n\tgl.LinkProgram(a.app.Program)\n\n\tvar status int32\n\tgl.GetProgramiv(a.app.Program, gl.LINK_STATUS, &status)\n\tif status == gl.FALSE {\n\t\tvar logLength int32\n\t\tgl.GetProgramiv(a.app.Program, gl.INFO_LOG_LENGTH, &logLength)\n\t\tlogMsg := make([]byte, logLength)\n\t\tgl.GetProgramInfoLog(a.app.Program, logLength, nil, &logMsg[0])\n\t\tlog.Fatalf(\"Failed to link program: %s\", logMsg)\n\t}\n\n\tgl.DeleteShader(vertShader)\n\tgl.DeleteShader(fragShader)\n\n\tparticleVertShader, err := shaders.CompileShaderFromSource(\n\t\tshaders.ParticleVertex,\n\t\tgl.VERTEX_SHADER,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tparticleFragShader, err := shaders.CompileShaderFromSource(\n\t\tshaders.ParticleFragment,\n\t\tgl.FRAGMENT_SHADER,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ta.app.ParticleProgram = gl.CreateProgram()\n\tgl.AttachShader(a.app.ParticleProgram, particleVertShader)\n\tgl.AttachShader(a.app.ParticleProgram, particleFragShader)\n\tgl.LinkProgram(a.app.ParticleProgram)\n\n\tgl.GetProgramiv(a.app.ParticleProgram, gl.LINK_STATUS, &status)\n\tif status == gl.FALSE {\n\t\tvar logLength int32\n\t\tgl.GetProgramiv(a.app.ParticleProgram, gl.INFO_LOG_LENGTH, &logLength)\n\t\tlogMsg := make([]byte, logLength)\n\t\tgl.GetProgramInfoLog(a.app.ParticleProgram, logLength, nil, &logMsg[0])\n\t\tlog.Fatalf(\"Failed to link particle program: %s\", logMsg)\n\t}\n\n\tgl.DeleteShader(particleVertShader)\n\tgl.DeleteShader(particleFragShader)\n\n\tgl.GenVertexArrays(1, &a.app.Vao)\n\tgl.GenBuffers(1, &a.app.Vbo)\n\n\tgl.BindVertexArray(a.app.Vao)\n\tgl.BindBuffer(gl.ARRAY_BUFFER, a.app.Vbo)\n\n\tgl.VertexAttribPointer(0, 2, gl.FLOAT, false, 5*4, nil)\n\tgl.EnableVertexAttribArray(0)\n\tgl.VertexAttribPointerWithOffset(1, 2, gl.FLOAT, false, 5*4, 2*4)\n\tgl.EnableVertexAttribArray(1)\n\tgl.VertexAttribPointerWithOffset(2, 1, gl.FLOAT, false, 5*4, 4*4)\n\tgl.EnableVertexAttribArray(2)\n\n\tgl.BindVertexArray(0)\n\n\tgl.GenVertexArrays(1, &a.app.ParticleVAO)\n\tgl.GenBuffers(1, &a.app.ParticleVBO)\n\n\tgl.BindVertexArray(a.app.ParticleVAO)\n\tgl.BindBuffer(gl.ARRAY_BUFFER, a.app.ParticleVBO)\n\n\tgl.VertexAttribPointer(0, 2, gl.FLOAT, false, 6*4, nil)\n\tgl.EnableVertexAttribArray(0)\n\tgl.VertexAttribPointerWithOffset(1, 1, gl.FLOAT, false, 6*4, 2*4)\n\tgl.EnableVertexAttribArray(1)\n\tgl.VertexAttribPointerWithOffset(2, 1, gl.FLOAT, false, 6*4, 3*4)\n\tgl.EnableVertexAttribArray(2)\n\tgl.VertexAttribPointerWithOffset(3, 1, gl.FLOAT, false, 6*4, 4*4)\n\tgl.EnableVertexAttribArray(3)\n\tgl.VertexAttribPointerWithOffset(4, 1, gl.FLOAT, false, 6*4, 5*4)\n\tgl.EnableVertexAttribArray(4)\n\n\tgl.BindVertexArray(0)\n\n\tbgVertShader, err := shaders.CompileShaderFromSource(\n\t\tshaders.BackgroundVertex,\n\t\tgl.VERTEX_SHADER,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbgFragShader, err := shaders.CompileShaderFromSource(\n\t\tshaders.BackgroundFragment,\n\t\tgl.FRAGMENT_SHADER,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ta.app.BgProgram = gl.CreateProgram()\n\tgl.AttachShader(a.app.BgProgram, bgVertShader)\n\tgl.AttachShader(a.app.BgProgram, bgFragShader)\n\tgl.LinkProgram(a.app.BgProgram)\n\n\tgl.GetProgramiv(a.app.BgProgram, gl.LINK_STATUS, &status)\n\tif status == gl.FALSE {\n\t\tvar logLength int32\n\t\tgl.GetProgramiv(a.app.BgProgram, gl.INFO_LOG_LENGTH, &logLength)\n\t\tlogMsg := make([]byte, logLength)\n\t\tgl.GetProgramInfoLog(a.app.BgProgram, logLength, nil, &logMsg[0])\n\t\tlog.Fatalf(\"Failed to link background program: %s\", logMsg)\n\t}\n\n\tgl.DeleteShader(bgVertShader)\n\tgl.DeleteShader(bgFragShader)\n\n\tgl.GenVertexArrays(1, &a.app.BgVAO)\n\tgl.GenBuffers(1, &a.app.BgVBO)\n\n\tgl.BindVertexArray(a.app.BgVAO)\n\tgl.BindBuffer(gl.ARRAY_BUFFER, a.app.BgVBO)\n\n\tquadVertices := []float32{\n\t\t-1.0, -1.0,\n\t\t1.0, -1.0,\n\t\t-1.0, 1.0,\n\t\t1.0, 1.0,\n\t}\n\tgl.BufferData(gl.ARRAY_BUFFER, len(quadVertices)*4, gl.Ptr(quadVertices), gl.STATIC_DRAW)\n\n\tgl.VertexAttribPointer(0, 2, gl.FLOAT, false, 2*4, nil)\n\tgl.EnableVertexAttribArray(0)\n\n\tgl.BindVertexArray(0)\n\n\tcursorGlowVertShader, err := shaders.CompileShaderFromSource(\n\t\tshaders.CursorGlowVertex,\n\t\tgl.VERTEX_SHADER,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcursorGlowFragShader, err := shaders.CompileShaderFromSource(\n\t\tshaders.CursorGlowFragment,\n\t\tgl.FRAGMENT_SHADER,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ta.app.CursorGlowProgram = gl.CreateProgram()\n\tgl.AttachShader(a.app.CursorGlowProgram, cursorGlowVertShader)\n\tgl.AttachShader(a.app.CursorGlowProgram, cursorGlowFragShader)\n\tgl.LinkProgram(a.app.CursorGlowProgram)\n\n\tgl.GetProgramiv(a.app.CursorGlowProgram, gl.LINK_STATUS, &status)\n\tif status == gl.FALSE {\n\t\tvar logLength int32\n\t\tgl.GetProgramiv(a.app.CursorGlowProgram, gl.INFO_LOG_LENGTH, &logLength)\n\t\tlogMsg := make([]byte, logLength)\n\t\tgl.GetProgramInfoLog(a.app.CursorGlowProgram, logLength, nil, &logMsg[0])\n\t\tlog.Fatalf(\"Failed to link cursor glow program: %s\", logMsg)\n\t}\n\n\tgl.DeleteShader(cursorGlowVertShader)\n\tgl.DeleteShader(cursorGlowFragShader)\n\n\tgl.GenVertexArrays(1, &a.app.CursorGlowVAO)\n\tgl.GenBuffers(1, &a.app.CursorGlowVBO)\n\n\tgl.BindVertexArray(a.app.CursorGlowVAO)\n\tgl.BindBuffer(gl.ARRAY_BUFFER, a.app.CursorGlowVBO)\n\n\tglowQuadVertices := []float32{\n\t\t-1.0, -1.0,\n\t\t1.0, -1.0,\n\t\t-1.0, 1.0,\n\t\t1.0, 1.0,\n\t}\n\tgl.BufferData(\n\t\tgl.ARRAY_BUFFER,\n\t\tlen(glowQuadVertices)*4,\n\t\tgl.Ptr(glowQuadVertices),\n\t\tgl.STATIC_DRAW,\n\t)\n\n\tgl.VertexAttribPointer(0, 2, gl.FLOAT, false, 2*4, nil)\n\tgl.EnableVertexAttribArray(0)\n\n\tgl.BindVertexArray(0)\n\n\tgl.Enable(gl.BLEND)\n\tgl.BlendFunc(gl.SRC_ALPHA, gl.ONE)\n\tgl.Enable(gl.PROGRAM_POINT_SIZE)\n\n\treturn nil\n}\n"
  },
  {
    "path": "internal/shaders/background.frag.glsl",
    "content": "#version 410 core\nout vec4 FragColor;\n\nuniform float alpha;\nuniform vec2 cursorPos;\nuniform vec2 resolution;\n\nvoid main() {\n\tvec2 fragCoord = gl_FragCoord.xy;\n\tfloat dist = length(fragCoord - cursorPos);\n\tfloat glowFalloff = smoothstep(0.0, 300.0, dist);\n\tfloat cursorTransparency = mix(0.3, 1.0, glowFalloff);\n\n\tFragColor = vec4(0., 0., 0., alpha * cursorTransparency);\n}\n"
  },
  {
    "path": "internal/shaders/background.vert.glsl",
    "content": "#version 410 core\nlayout (location = 0) in vec2 position;\n\nvoid main() {\n\tgl_Position = vec4(position, 0.0, 1.0);\n}\n"
  },
  {
    "path": "internal/shaders/cursorGlow.frag.glsl",
    "content": "#version 410 core\nin vec2 vTexCoord;\nout vec4 FragColor;\n\nuniform float time;\nuniform float velocity;\nuniform float isDrawing;\nuniform float exitProgress;\n\nvec3 hsv2rgb(vec3 c) {\n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\nfloat smin(float a, float b, float k) {\n\tfloat h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0);\n\treturn mix(b, a, h) - k * h * (1.0 - h);\n}\n\nfloat hash(vec2 p) {\n\tp = fract(p * vec2(123.34, 456.21));\n\tp += dot(p, p + 45.32);\n\treturn fract(p.x * p.y);\n}\n\nfloat noise(vec2 p) {\n\tvec2 i = floor(p);\n\tvec2 f = fract(p);\n\tf = f * f * (3.0 - 2.0 * f);\n\n\tfloat a = hash(i);\n\tfloat b = hash(i + vec2(1.0, 0.0));\n\tfloat c = hash(i + vec2(0.0, 1.0));\n\tfloat d = hash(i + vec2(1.0, 1.0));\n\n\treturn mix(mix(a, b, f.x), mix(c, d, f.x), f.y);\n}\n\nfloat fbm(vec2 p) {\n\tfloat value = 0.0;\n\tfloat amplitude = 0.5;\n\tfloat frequency = 1.0;\n\n\tfor(int i = 0; i < 4; i++) {\n\t\tvalue += amplitude * noise(p * frequency);\n\t\tfrequency *= 2.0;\n\t\tamplitude *= 0.5;\n\t}\n\treturn value;\n}\n\nvoid main() {\n\tvec2 coord = vTexCoord * 2.0 - 1.0;\n\tfloat velocityNorm = clamp(velocity * 0.01, 0.0, 1.0);\n\tfloat energy = mix(0.3, 1.0, velocityNorm) + isDrawing * 0.7;\n\n\tfloat sdf = 1000.0;\n\tfloat centralSize = mix(0.15, 0.35, velocityNorm) + isDrawing * 0.05;\n\tfloat pulseSpeed = (3.0 + velocityNorm * 2.0) * (1.0 + isDrawing * 0.75);\n\tfloat pulseAmount = (0.1 * energy + isDrawing * 0.075);\n\tfloat pulse = sin(time * pulseSpeed) * pulseAmount + 0.9;\n\tfloat centralDist = length(coord) - centralSize * pulse;\n\tsdf = centralDist;\n\n\tfloat numBlobsFloat = mix(5.0, 9.0, velocityNorm) + isDrawing * 1.0;\n\tint numBlobs = int(numBlobsFloat);\n\tfloat blobFade = fract(numBlobsFloat);\n\n\tfor(int i = 0; i < 10; i++) {\n\t\tif(i > numBlobs) break;\n\t\tif(i == numBlobs && blobFade < 0.01) break;\n\t\tfloat baseRotation = time * 0.8;\n\t\tfloat velocityRotation = time * velocityNorm * 0.4;\n\t\tfloat angle = float(i) * 6.28 / float(numBlobs) + baseRotation + velocityRotation;\n\n\t\tfloat baseRadius = mix(0.2, 0.5, velocityNorm) + isDrawing * 0.075;\n\t\tfloat radiusVariation = sin(time * (1.5 + isDrawing * 0.5) + float(i) * 0.8) * mix(0.05, 0.15, velocityNorm);\n\t\tfloat chaoticRadius = sin(time * 4.0 + float(i) * 2.1) * cos(time * 3.5 + float(i) * 1.7) * 0.003 * isDrawing;\n\t\tfloat radius = baseRadius + radiusVariation + chaoticRadius;\n\t\tvec2 orbPos = vec2(cos(angle), sin(angle)) * radius;\n\n\t\tfloat baseBlobSize = mix(0.08, 0.18, velocityNorm) + isDrawing * 0.04;\n\t\tfloat sizeVariation = sin(time * (2.5 + isDrawing * 1.0) + float(i) * 0.6) * mix(0.02, 0.05, velocityNorm);\n\t\tfloat drawingGrowth = sin(time * 5.0 + float(i) * 1.3) * 0.03 * isDrawing;\n\t\tfloat blobSize = baseBlobSize + sizeVariation + drawingGrowth;\n\t\tfloat blobDist = length(coord - orbPos) - blobSize;\n\n\t\tif(i == numBlobs) {\n\t\t\tblobDist += (1.0 - blobFade) * 0.5;\n\t\t}\n\t\tfloat blendAmount = mix(0.15, 0.3, velocityNorm) + isDrawing * 0.075;\n\t\tsdf = smin(sdf, blobDist, blendAmount);\n\t}\n\n\tfloat noiseZoom = 3.0 + isDrawing * 0.5;\n\tvec2 noiseCoord = coord * noiseZoom;\n\tnoiseCoord += vec2(time * 0.3, time * 0.2);\n\tfloat swirl = fbm(noiseCoord) * 2.0 - 1.0;\n\n\tsdf += swirl * (0.1 * energy + exitProgress * 0.8);\n\tfloat intensity = exp(-max(sdf, 0.0) * 4.0);\n\tfloat outerGlow = exp(-max(sdf, 0.0) * 1.5) * 0.4 * energy;\n\tfloat innerGlow = exp(-max(sdf, 0.0) * 8.0) * 0.8;\n\n\tfloat totalIntensity = intensity + outerGlow + innerGlow;\n\n\ttotalIntensity *= smoothstep(1.0, 0.7, max(abs(coord.x), abs(coord.y)));\n\n\tfloat hueSpeed = mix(0.2, 0.6, velocityNorm);\n\tfloat hue = mod(time * hueSpeed + atan(coord.y, coord.x) / 6.28 + swirl * 0.3, 1.0);\n\tvec3 mainColor = hsv2rgb(vec3(hue, mix(0.7, 0.75, velocityNorm), 1.0));\n\tvec3 accentColor = hsv2rgb(vec3(mod(hue + 0.5, 1.0), 0.75, 1.2));\n\tvec3 finalColor = mainColor * intensity;\n\tfinalColor += accentColor * innerGlow;\n\tfinalColor += mainColor * 0.5 * outerGlow;\n\n\tfloat sparkle = smoothstep(0.85, 1.0, noise(coord * 20.0 + time * 5.0 * energy)) * totalIntensity * velocityNorm;\n\tfinalColor += sparkle;\n\n\tfloat edge = smoothstep(0.05, -0.05, sdf) - smoothstep(0.15, 0.05, sdf);\n\tfinalColor += accentColor * edge * energy;\n\n\tfinalColor *= sin(time * (2.5 + isDrawing * 0.75)) * (0.1 + velocityNorm * 0.1 + isDrawing * 0.075) + 0.9;\n\n\tfloat alpha = clamp(totalIntensity * mix(0.8, 1.3, velocityNorm), 0.0, 1.0) * (1.0 - exitProgress);\n\n\tFragColor = vec4(finalColor, alpha * 0.95);\n}\n"
  },
  {
    "path": "internal/shaders/cursorGlow.vert.glsl",
    "content": "#version 410 core\nlayout (location = 0) in vec2 position;\n\nuniform vec2 cursorPos;\nuniform vec2 resolution;\nuniform float glowSize;\nuniform float rotation;\n\nout vec2 vTexCoord;\n\nvoid main() {\n\tfloat c = cos(rotation);\n\tfloat s = sin(rotation);\n\tvec2 rotatedPos = vec2(position.x * c - position.y * s, position.x * s + position.y * c);\n\tvec2 worldPos = cursorPos + rotatedPos * glowSize;\n\tvec2 normalized = (worldPos / resolution) * 2.0 - 1.0;\n\tnormalized.y = -normalized.y;\n\tgl_Position = vec4(normalized, 0.0, 1.0);\n\tvTexCoord = rotatedPos * 0.5 + 0.5;\n}\n"
  },
  {
    "path": "internal/shaders/line.frag.glsl",
    "content": "#version 410 core\nin float vAlpha;\nin vec2 vPosition;\nout vec4 FragColor;\n\nuniform float time;\n\nvec3 hsv2rgb(vec3 c) {\n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\nvoid main() {\n\tfloat hue = mod(vPosition.x * 0.001 + vPosition.y * 0.001 + time * 0.5, 1.0);\n\tvec3 color = hsv2rgb(vec3(hue, 0.8, 1.0));\n\n\tfloat sparkle = sin(vPosition.x * 0.1 + time * 3.0) * sin(vPosition.y * 0.1 + time * 2.0);\n\tsparkle = smoothstep(0.7, 1.0, sparkle) * 0.5;\n\n\tFragColor = vec4(color * (1.0 + sparkle * 2.0), vAlpha);\n}\n"
  },
  {
    "path": "internal/shaders/line.vert.glsl",
    "content": "#version 410 core\nlayout (location = 0) in vec2 position;\nlayout (location = 1) in vec2 offset;\nlayout (location = 2) in float alpha;\n\nuniform vec2 resolution;\nuniform float thickness;\n\nout float vAlpha;\nout vec2 vPosition;\n\nvoid main() {\n\tvec2 pos = position + offset * thickness;\n\tvec2 normalized = (pos / resolution) * 2.0 - 1.0;\n\tnormalized.y = -normalized.y;\n\tgl_Position = vec4(normalized, 0.0, 1.0);\n\tvAlpha = alpha;\n\tvPosition = pos;\n}\n"
  },
  {
    "path": "internal/shaders/particle.frag.glsl",
    "content": "#version 410 core\nin float vLife;\nin float vHue;\nout vec4 FragColor;\n\nvec3 hsv2rgb(vec3 c) {\n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\nvoid main() {\n\tvec2 coord = gl_PointCoord - vec2(0.5);\n\tfloat dist = length(coord);\n\tif (dist > 0.5) discard;\n\n\tfloat alpha = smoothstep(0.5, 0.2, dist) * vLife;\n\tvec3 color = hsv2rgb(vec3(vHue, 0.9, 1.0)) * (1.0 + (1.0 - dist * 2.0) * 2.0);\n\n\tFragColor = vec4(color, alpha * 0.8);\n}\n"
  },
  {
    "path": "internal/shaders/particle.vert.glsl",
    "content": "#version 410 core\nlayout (location = 0) in vec2 position;\nlayout (location = 1) in float life;\nlayout (location = 2) in float maxLife;\nlayout (location = 3) in float size;\nlayout (location = 4) in float hue;\n\nuniform vec2 resolution;\n\nout float vLife;\nout float vHue;\n\nvoid main() {\n\tvec2 normalized = (position / resolution) * 2.0 - 1.0;\n\tnormalized.y = -normalized.y;\n\tgl_Position = vec4(normalized, 0.0, 1.0);\n\tgl_PointSize = size * (life / maxLife);\n\tvLife = life / maxLife;\n\tvHue = hue;\n}\n"
  },
  {
    "path": "internal/shaders/paths.go",
    "content": "package shaders\n\nimport _ \"embed\"\n\n// TODO: select one to choose embed the shaders or place like system files.\nconst BackgroundFragmentPath = \"internal/shaders/background.frag.glsl\"\nconst BackgroundVertexPath = \"internal/shaders/background.vert.glsl\"\nconst CursorGlowFragmentPath = \"internal/shaders/cursorGlow.frag.glsl\"\nconst CursorGlowVertexPath = \"internal/shaders/cursorGlow.vert.glsl\"\nconst LineFragmentPath = \"internal/shaders/line.frag.glsl\"\nconst LineVertexPath = \"internal/shaders/line.vert.glsl\"\nconst ParticleVertexPath = \"internal/shaders/particle.vert.glsl\"\nconst ParticleFragmentPath = \"internal/shaders/particle.frag.glsl\"\n\n// Vertex shaders\n//\n//go:embed background.vert.glsl\nvar BackgroundVertex string\n\n//go:embed cursorGlow.vert.glsl\nvar CursorGlowVertex string\n\n//go:embed line.vert.glsl\nvar LineVertex string\n\n//go:embed particle.vert.glsl\nvar ParticleVertex string\n\n// Fragment shaders\n//\n//go:embed background.frag.glsl\nvar BackgroundFragment string\n\n//go:embed cursorGlow.frag.glsl\nvar CursorGlowFragment string\n\n//go:embed line.frag.glsl\nvar LineFragment string\n\n//go:embed particle.frag.glsl\nvar ParticleFragment string\n"
  },
  {
    "path": "internal/shaders/shader.go",
    "content": "package shaders\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/go-gl/gl/v4.1-core/gl\"\n)\n\n// TODO: select either one or use both\nfunc CompileShaderFromFile(path string, shaderType uint32) (uint32, error) {\n\tsourceBytes, err := os.ReadFile(path)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"failed to read shader file %q: %v\", path, err)\n\t}\n\n\tsource := string(sourceBytes)\n\n\tif !strings.HasSuffix(source, \"\\x00\") {\n\t\tsource += \"\\x00\"\n\t}\n\n\tshader := gl.CreateShader(shaderType)\n\tcsources, free := gl.Strs(source)\n\tdefer free()\n\n\tgl.ShaderSource(shader, 1, csources, nil)\n\tgl.CompileShader(shader)\n\n\tvar status int32\n\tgl.GetShaderiv(shader, gl.COMPILE_STATUS, &status)\n\tif status == gl.FALSE {\n\t\tvar logLength int32\n\t\tgl.GetShaderiv(shader, gl.INFO_LOG_LENGTH, &logLength)\n\n\t\tlogMsg := strings.Repeat(\"\\x00\", int(logLength+1))\n\t\tgl.GetShaderInfoLog(shader, logLength, nil, gl.Str(logMsg))\n\n\t\tgl.DeleteShader(shader)\n\t\treturn 0, fmt.Errorf(\"failed to compile %s shader: %v\", path, strings.TrimSpace(logMsg))\n\t}\n\n\treturn shader, nil\n}\n\nfunc CompileShaderFromSource(source string, shaderType uint32) (uint32, error) {\n\tshader := gl.CreateShader(shaderType)\n\tcsources, free := gl.Strs(source + \"\\x00\")\n\tgl.ShaderSource(shader, 1, csources, nil)\n\tfree()\n\tgl.CompileShader(shader)\n\n\tvar status int32\n\tgl.GetShaderiv(shader, gl.COMPILE_STATUS, &status)\n\tif status == gl.FALSE {\n\t\tvar logLength int32\n\t\tgl.GetShaderiv(shader, gl.INFO_LOG_LENGTH, &logLength)\n\t\tlogMsg := make([]byte, logLength)\n\t\tgl.GetShaderInfoLog(shader, logLength, nil, &logMsg[0])\n\t\treturn 0, fmt.Errorf(\"failed to compile shader: %s\", logMsg)\n\t}\n\n\treturn shader, nil\n}\n"
  },
  {
    "path": "internal/spawn/spawn.go",
    "content": "package spawn\n\nimport (\n\t\"math\"\n\t\"math/rand/v2\"\n\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/models\"\n)\n\ntype App struct {\n\tapp *models.App\n}\n\nfunc New(app *models.App) *App {\n\treturn &App{app: app}\n}\n\nfunc (a *App) SpawnCursorSparkles(x, y float32) {\n\tfor range 3 {\n\t\tangle := rand.Float64() * 2 * math.Pi\n\t\tspeed := rand.Float32()*80 + 40\n\t\ta.app.Particles = append(a.app.Particles, models.Particle{\n\t\t\tX:       x + (rand.Float32()-0.5)*8,\n\t\t\tY:       y + (rand.Float32()-0.5)*8,\n\t\t\tVX:      float32(math.Cos(angle)) * speed,\n\t\t\tVY:      float32(math.Sin(angle))*speed - 30,\n\t\t\tLife:    0.8,\n\t\t\tMaxLife: 0.8,\n\t\t\tSize:    rand.Float32()*8 + 6,\n\t\t\tHue:     rand.Float32(),\n\t\t})\n\t}\n}\n\nfunc (a *App) SpawnExitWisps(x, y float32) {\n\tfor range 8 {\n\t\tangle := rand.Float64() * 2 * math.Pi\n\t\tspeed := rand.Float32()*150 + 80\n\t\ta.app.Particles = append(a.app.Particles, models.Particle{\n\t\t\tX:       x + (rand.Float32()-0.5)*30,\n\t\t\tY:       y + (rand.Float32()-0.5)*30,\n\t\t\tVX:      float32(math.Cos(angle)) * speed,\n\t\t\tVY:      float32(math.Sin(angle)) * speed,\n\t\t\tLife:    1.2,\n\t\t\tMaxLife: 1.2,\n\t\t\tSize:    rand.Float32()*12 + 8,\n\t\t\tHue:     rand.Float32(),\n\t\t})\n\t}\n}\n"
  },
  {
    "path": "internal/stroke/stroke.go",
    "content": "// https://depts.washington.edu/acelab/proj/dollar/dollar.pdf\n\npackage stroke\n\nimport (\n\t\"math\"\n\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/models\"\n)\n\n// Step 1\n\ntype Point = models.Point\n\nfunc resample(points []Point, n int) []Point {\n\tI := pathLength(points) / float32(n-1)\n\tD := float32(0)\n\tnewPoints := []Point{points[0]}\n\tfor i := 1; i < len(points); i++ {\n\t\td := distance(points[i-1], points[i])\n\t\tif D+d >= I {\n\t\t\tqx := points[i-1].X + ((I-D)/d)*(points[i].X-points[i-1].X)\n\t\t\tqy := points[i-1].Y + ((I-D)/d)*(points[i].Y-points[i-1].Y)\n\t\t\tq := Point{X: qx, Y: qy}\n\t\t\tnewPoints = append(newPoints, q)\n\t\t\tpoints = append(points[:i], append([]Point{q}, points[i:]...)...)\n\t\t\tD = 0\n\t\t} else {\n\t\t\tD += d\n\t\t}\n\t}\n\tfor len(newPoints) < n {\n\t\tnewPoints = append(newPoints, points[len(points)-1])\n\t}\n\treturn newPoints\n}\n\nfunc pathLength(A []Point) float32 {\n\td := float32(0)\n\tfor i := 1; i < len(A); i++ {\n\t\td += distance(A[i-1], A[i])\n\t}\n\treturn d\n}\n\nfunc distance(a Point, b Point) float32 {\n\tdx := a.X - b.X\n\tdy := a.Y - b.Y\n\treturn dx*dx + dy*dy\n}\n\n// Step 2\n\nfunc rotateBy(points []Point, angle float64) []Point {\n\tc := centroid(points)\n\tfor _, p := range points {\n\t\tqx := float64(p.X-c.X)*math.Cos(angle) - float64(p.Y-c.Y)*math.Sin(angle) + float64(c.X)\n\t\tqy := float64(p.X-c.X)*math.Sin(angle) + float64(p.Y-c.Y)*math.Cos(angle) + float64(c.Y)\n\t\tp.X = float32(qx)\n\t\tp.Y = float32(qy)\n\t}\n\treturn points\n}\n\n// Step 3\n\nfunc scaleTo(points []Point, size float32) []Point {\n\tB := boundingBox(points)\n\tfor i := range points {\n\t\tp := &points[i]\n\t\tp.X = p.X * (size / B.width)\n\t\tp.Y = p.Y * (size / B.height)\n\t}\n\treturn points\n}\n\nfunc translateTo(points []Point, k Point) []Point {\n\tc := centroid(points)\n\tfor i := range points {\n\t\tp := &points[i]\n\t\tp.X += k.X - c.X\n\t\tp.Y += k.Y - c.Y\n\t}\n\treturn points\n}\n\nfunc boundingBox(points []Point) struct{ width, height float32 } {\n\tminX, minY := points[0].X, points[0].Y\n\tmaxX, maxY := points[0].X, points[0].Y\n\tfor _, p := range points {\n\t\tif p.X < minX {\n\t\t\tminX = p.X\n\t\t}\n\t\tif p.Y < minY {\n\t\t\tminY = p.Y\n\t\t}\n\t\tif p.X > maxX {\n\t\t\tmaxX = p.X\n\t\t}\n\t\tif p.Y > maxY {\n\t\t\tmaxY = p.Y\n\t\t}\n\t}\n\treturn struct{ width, height float32 }{width: maxX - minX, height: maxY - minY}\n}\n\nfunc centroid(points []Point) Point {\n\tvar x, y float32\n\tfor _, p := range points {\n\t\tx += p.X\n\t\ty += p.Y\n\t}\n\tn := float32(len(points))\n\treturn Point{X: x / n, Y: y / n}\n}\n\n// Step 4\n\nfunc recognise(\n\tpoints []Point,\n\ttemplates [][]Point,\n\tsize float64,\n) (bestMatch int, bestScore float64) {\n\tb := math.Inf(1)\n\tfor i, T := range templates {\n\t\td := distanceAtBestAngle(points, T, -math.Pi/4, math.Pi/4, math.Pi/90)\n\t\tif d < b {\n\t\t\tb = d\n\t\t\tbestMatch = i\n\t\t}\n\t}\n\tbestScore = 1 - b/(0.5*math.Sqrt(2*size*size))\n\treturn bestMatch, bestScore\n}\n\nfunc distanceAtBestAngle(points, T []Point, a, b, delta float64) float64 {\n\tx1 := math.Phi*a + (1-math.Phi)*b\n\tf1 := distanceAtAngle(points, T, x1)\n\tx2 := (1-math.Phi)*a + math.Phi*b\n\tf2 := distanceAtAngle(points, T, x2)\n\tfor math.Abs(b-a) > delta {\n\t\tif f1 < f2 {\n\t\t\tb = x2\n\t\t\tx2 = x1\n\t\t\tf2 = f1\n\t\t\tx1 = math.Phi*a + (1-math.Phi)*b\n\t\t\tf1 = distanceAtAngle(points, T, x1)\n\t\t} else {\n\t\t\ta = x1\n\t\t\tx1 = x2\n\t\t\tf1 = f2\n\t\t\tx2 = (1-math.Phi)*a + math.Phi*b\n\t\t\tf2 = distanceAtAngle(points, T, x2)\n\t\t}\n\t}\n\treturn math.Min(f1, f2)\n}\n\nfunc distanceAtAngle(points, T []Point, angle float64) float64 {\n\tnewPoints := rotateBy(points, angle)\n\td := pathDistance(newPoints, T)\n\treturn d\n}\n\nfunc pathDistance(A, B []Point) float64 {\n\td := float64(0)\n\tfor i := range A {\n\t\td += math.Sqrt(float64(distance(A[i], B[i])))\n\t}\n\treturn d / float64(len(A))\n}\n\n// Entry points\n\nconst n = 64\nconst size = 250.\n\nfunc ProcessStroke(points []Point) []Point {\n\t// Step 1\n\tpoints = resample(points, n)\n\t// Step 3 (skipping rotation)\n\tpoints = scaleTo(points, size)\n\tpoints = translateTo(points, Point{X: 0, Y: 0})\n\n\treturn points\n}\n\nfunc UnistrokeRecognise(points []Point, templates [][]Point) (bestMatch int, bestScore float64) {\n\treturn recognise(points, templates, size)\n}\n"
  },
  {
    "path": "internal/update/update.go",
    "content": "package update\n\nimport (\n\t\"math\"\n\n\t\"github.com/ThatOtherAndrew/Hexecute/internal/models\"\n\t\"github.com/ThatOtherAndrew/Hexecute/pkg/wayland\"\n)\n\ntype App struct {\n\tapp *models.App\n}\n\nfunc New(app *models.App) *App {\n\treturn &App{app: app}\n}\n\nfunc (a *App) UpdateParticles(dt float32) {\n\tfor i := 0; i < len(a.app.Particles); i++ {\n\t\tp := &a.app.Particles[i]\n\t\tp.X += p.VX * dt\n\t\tp.Y += p.VY * dt\n\t\tp.VY += 100 * dt\n\t\tp.Life -= dt\n\n\t\tif p.Life <= 0 {\n\t\t\ta.app.Particles[i] = a.app.Particles[len(a.app.Particles)-1]\n\t\t\ta.app.Particles = a.app.Particles[:len(a.app.Particles)-1]\n\t\t\ti--\n\t\t}\n\t}\n}\n\nfunc (a *App) UpdateCursor(window *wayland.WaylandWindow) {\n\tx, y := window.GetCursorPos()\n\tfx, fy := float32(x), float32(y)\n\n\tdx := fx - a.app.LastCursorX\n\tdy := fy - a.app.LastCursorY\n\ta.app.CursorVelocity = float32(math.Sqrt(float64(dx*dx + dy*dy)))\n\n\tvelocityDiff := a.app.CursorVelocity - a.app.SmoothVelocity\n\ta.app.SmoothVelocity += velocityDiff * 0.2\n\n\tif a.app.CursorVelocity > 0.1 {\n\t\ttargetRotation := float32(math.Atan2(float64(dy), float64(dx)))\n\n\t\tangleDiff := targetRotation - a.app.SmoothRotation\n\t\tif angleDiff > math.Pi {\n\t\t\tangleDiff -= 2 * math.Pi\n\t\t} else if angleDiff < -math.Pi {\n\t\t\tangleDiff += 2 * math.Pi\n\t\t}\n\n\t\tvelocityFactor := float32(math.Min(float64(a.app.SmoothVelocity/5.0), 1.0))\n\t\tsmoothFactor := 0.03 + velocityFactor*0.08\n\t\ta.app.SmoothRotation += angleDiff * smoothFactor\n\t}\n\n\tvar targetDrawing float32\n\tif a.app.IsDrawing {\n\t\ttargetDrawing = 1.0\n\t} else {\n\t\ttargetDrawing = 0.0\n\t}\n\n\tdiff := targetDrawing - a.app.SmoothDrawing\n\ta.app.SmoothDrawing += diff * 0.0375\n\n\ta.app.LastCursorX = fx\n\ta.app.LastCursorY = fy\n}\n"
  },
  {
    "path": "pkg/wayland/.clangd",
    "content": "Diagnostics:\n  Suppress:\n    - keyword_as_parameter\n    - expected_expression\n"
  },
  {
    "path": "pkg/wayland/keyboard-shortcuts-inhibit-client.h",
    "content": "/* Generated by wayland-scanner 1.24.0 */\n\n#ifndef KEYBOARD_SHORTCUTS_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H\n#define KEYBOARD_SHORTCUTS_INHIBIT_UNSTABLE_V1_CLIENT_PROTOCOL_H\n\n#include \"wayland-client.h\"\n#include <stddef.h>\n#include <stdint.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/**\n * @page page_keyboard_shortcuts_inhibit_unstable_v1 The\n * keyboard_shortcuts_inhibit_unstable_v1 protocol Protocol for inhibiting the\n * compositor keyboard shortcuts\n *\n * @section page_desc_keyboard_shortcuts_inhibit_unstable_v1 Description\n *\n * This protocol specifies a way for a client to request the compositor\n * to ignore its own keyboard shortcuts for a given seat, so that all\n * key events from that seat get forwarded to a surface.\n *\n * Warning! The protocol described in this file is experimental and\n * backward incompatible changes may be made. Backward compatible\n * changes may be added together with the corresponding interface\n * version bump.\n * Backward incompatible changes are done by bumping the version\n * number in the protocol and interface names and resetting the\n * interface version. Once the protocol is to be declared stable,\n * the 'z' prefix and the version number in the protocol and\n * interface names are removed and the interface version number is\n * reset.\n *\n * @section page_ifaces_keyboard_shortcuts_inhibit_unstable_v1 Interfaces\n * - @subpage page_iface_zwp_keyboard_shortcuts_inhibit_manager_v1 - context\n * object for keyboard grab_manager\n * - @subpage page_iface_zwp_keyboard_shortcuts_inhibitor_v1 - context object\n * for keyboard shortcuts inhibitor\n * @section page_copyright_keyboard_shortcuts_inhibit_unstable_v1 Copyright\n * <pre>\n *\n * Copyright © 2017 Red Hat Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice (including the next\n * paragraph) shall be included in all copies or substantial portions of the\n * Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n * </pre>\n */\nstruct wl_seat;\nstruct wl_surface;\nstruct zwp_keyboard_shortcuts_inhibit_manager_v1;\nstruct zwp_keyboard_shortcuts_inhibitor_v1;\n\n#ifndef ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_INTERFACE\n#define ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_INTERFACE\n/**\n * @page page_iface_zwp_keyboard_shortcuts_inhibit_manager_v1\n * zwp_keyboard_shortcuts_inhibit_manager_v1\n * @section page_iface_zwp_keyboard_shortcuts_inhibit_manager_v1_desc\n * Description\n *\n * A global interface used for inhibiting the compositor keyboard shortcuts.\n * @section page_iface_zwp_keyboard_shortcuts_inhibit_manager_v1_api API\n * See @ref iface_zwp_keyboard_shortcuts_inhibit_manager_v1.\n */\n/**\n * @defgroup iface_zwp_keyboard_shortcuts_inhibit_manager_v1 The\n * zwp_keyboard_shortcuts_inhibit_manager_v1 interface\n *\n * A global interface used for inhibiting the compositor keyboard shortcuts.\n */\nextern const struct wl_interface\n    zwp_keyboard_shortcuts_inhibit_manager_v1_interface;\n#endif\n#ifndef ZWP_KEYBOARD_SHORTCUTS_INHIBITOR_V1_INTERFACE\n#define ZWP_KEYBOARD_SHORTCUTS_INHIBITOR_V1_INTERFACE\n/**\n * @page page_iface_zwp_keyboard_shortcuts_inhibitor_v1\n * zwp_keyboard_shortcuts_inhibitor_v1\n * @section page_iface_zwp_keyboard_shortcuts_inhibitor_v1_desc Description\n *\n * A keyboard shortcuts inhibitor instructs the compositor to ignore\n * its own keyboard shortcuts when the associated surface has keyboard\n * focus. As a result, when the surface has keyboard focus on the given\n * seat, it will receive all key events originating from the specified\n * seat, even those which would normally be caught by the compositor for\n * its own shortcuts.\n *\n * The Wayland compositor is however under no obligation to disable\n * all of its shortcuts, and may keep some special key combo for its own\n * use, including but not limited to one allowing the user to forcibly\n * restore normal keyboard events routing in the case of an unwilling\n * client. The compositor may also use the same key combo to reactivate\n * an existing shortcut inhibitor that was previously deactivated on\n * user request.\n *\n * When the compositor restores its own keyboard shortcuts, an\n * \"inactive\" event is emitted to notify the client that the keyboard\n * shortcuts inhibitor is not effectively active for the surface and\n * seat any more, and the client should not expect to receive all\n * keyboard events.\n *\n * When the keyboard shortcuts inhibitor is inactive, the client has\n * no way to forcibly reactivate the keyboard shortcuts inhibitor.\n *\n * The user can chose to re-enable a previously deactivated keyboard\n * shortcuts inhibitor using any mechanism the compositor may offer,\n * in which case the compositor will send an \"active\" event to notify\n * the client.\n *\n * If the surface is destroyed, unmapped, or loses the seat's keyboard\n * focus, the keyboard shortcuts inhibitor becomes irrelevant and the\n * compositor will restore its own keyboard shortcuts but no \"inactive\"\n * event is emitted in this case.\n * @section page_iface_zwp_keyboard_shortcuts_inhibitor_v1_api API\n * See @ref iface_zwp_keyboard_shortcuts_inhibitor_v1.\n */\n/**\n * @defgroup iface_zwp_keyboard_shortcuts_inhibitor_v1 The\n * zwp_keyboard_shortcuts_inhibitor_v1 interface\n *\n * A keyboard shortcuts inhibitor instructs the compositor to ignore\n * its own keyboard shortcuts when the associated surface has keyboard\n * focus. As a result, when the surface has keyboard focus on the given\n * seat, it will receive all key events originating from the specified\n * seat, even those which would normally be caught by the compositor for\n * its own shortcuts.\n *\n * The Wayland compositor is however under no obligation to disable\n * all of its shortcuts, and may keep some special key combo for its own\n * use, including but not limited to one allowing the user to forcibly\n * restore normal keyboard events routing in the case of an unwilling\n * client. The compositor may also use the same key combo to reactivate\n * an existing shortcut inhibitor that was previously deactivated on\n * user request.\n *\n * When the compositor restores its own keyboard shortcuts, an\n * \"inactive\" event is emitted to notify the client that the keyboard\n * shortcuts inhibitor is not effectively active for the surface and\n * seat any more, and the client should not expect to receive all\n * keyboard events.\n *\n * When the keyboard shortcuts inhibitor is inactive, the client has\n * no way to forcibly reactivate the keyboard shortcuts inhibitor.\n *\n * The user can chose to re-enable a previously deactivated keyboard\n * shortcuts inhibitor using any mechanism the compositor may offer,\n * in which case the compositor will send an \"active\" event to notify\n * the client.\n *\n * If the surface is destroyed, unmapped, or loses the seat's keyboard\n * focus, the keyboard shortcuts inhibitor becomes irrelevant and the\n * compositor will restore its own keyboard shortcuts but no \"inactive\"\n * event is emitted in this case.\n */\nextern const struct wl_interface zwp_keyboard_shortcuts_inhibitor_v1_interface;\n#endif\n\n#ifndef ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_ERROR_ENUM\n#define ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_ERROR_ENUM\nenum zwp_keyboard_shortcuts_inhibit_manager_v1_error {\n  /**\n   * the shortcuts are already inhibited for this surface\n   */\n  ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_ERROR_ALREADY_INHIBITED = 0,\n};\n#endif /* ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_ERROR_ENUM */\n\n#define ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_DESTROY 0\n#define ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_INHIBIT_SHORTCUTS 1\n\n/**\n * @ingroup iface_zwp_keyboard_shortcuts_inhibit_manager_v1\n */\n#define ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_DESTROY_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_keyboard_shortcuts_inhibit_manager_v1\n */\n#define ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_INHIBIT_SHORTCUTS_SINCE_VERSION \\\n  1\n\n/** @ingroup iface_zwp_keyboard_shortcuts_inhibit_manager_v1 */\nstatic inline void zwp_keyboard_shortcuts_inhibit_manager_v1_set_user_data(\n    struct zwp_keyboard_shortcuts_inhibit_manager_v1\n        *zwp_keyboard_shortcuts_inhibit_manager_v1,\n    void *user_data) {\n  wl_proxy_set_user_data(\n      (struct wl_proxy *)zwp_keyboard_shortcuts_inhibit_manager_v1, user_data);\n}\n\n/** @ingroup iface_zwp_keyboard_shortcuts_inhibit_manager_v1 */\nstatic inline void *zwp_keyboard_shortcuts_inhibit_manager_v1_get_user_data(\n    struct zwp_keyboard_shortcuts_inhibit_manager_v1\n        *zwp_keyboard_shortcuts_inhibit_manager_v1) {\n  return wl_proxy_get_user_data(\n      (struct wl_proxy *)zwp_keyboard_shortcuts_inhibit_manager_v1);\n}\n\nstatic inline uint32_t zwp_keyboard_shortcuts_inhibit_manager_v1_get_version(\n    struct zwp_keyboard_shortcuts_inhibit_manager_v1\n        *zwp_keyboard_shortcuts_inhibit_manager_v1) {\n  return wl_proxy_get_version(\n      (struct wl_proxy *)zwp_keyboard_shortcuts_inhibit_manager_v1);\n}\n\n/**\n * @ingroup iface_zwp_keyboard_shortcuts_inhibit_manager_v1\n *\n * Destroy the keyboard shortcuts inhibitor manager.\n */\nstatic inline void zwp_keyboard_shortcuts_inhibit_manager_v1_destroy(\n    struct zwp_keyboard_shortcuts_inhibit_manager_v1\n        *zwp_keyboard_shortcuts_inhibit_manager_v1) {\n  wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwp_keyboard_shortcuts_inhibit_manager_v1,\n      ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_DESTROY, NULL,\n      wl_proxy_get_version(\n          (struct wl_proxy *)zwp_keyboard_shortcuts_inhibit_manager_v1),\n      WL_MARSHAL_FLAG_DESTROY);\n}\n\n/**\n * @ingroup iface_zwp_keyboard_shortcuts_inhibit_manager_v1\n *\n * Create a new keyboard shortcuts inhibitor object associated with\n * the given surface for the given seat.\n *\n * If shortcuts are already inhibited for the specified seat and surface,\n * a protocol error \"already_inhibited\" is raised by the compositor.\n */\nstatic inline struct zwp_keyboard_shortcuts_inhibitor_v1 *\nzwp_keyboard_shortcuts_inhibit_manager_v1_inhibit_shortcuts(\n    struct zwp_keyboard_shortcuts_inhibit_manager_v1\n        *zwp_keyboard_shortcuts_inhibit_manager_v1,\n    struct wl_surface *surface, struct wl_seat *seat) {\n  struct wl_proxy *id;\n\n  id = wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwp_keyboard_shortcuts_inhibit_manager_v1,\n      ZWP_KEYBOARD_SHORTCUTS_INHIBIT_MANAGER_V1_INHIBIT_SHORTCUTS,\n      &zwp_keyboard_shortcuts_inhibitor_v1_interface,\n      wl_proxy_get_version(\n          (struct wl_proxy *)zwp_keyboard_shortcuts_inhibit_manager_v1),\n      0, NULL, surface, seat);\n\n  return (struct zwp_keyboard_shortcuts_inhibitor_v1 *)id;\n}\n\n/**\n * @ingroup iface_zwp_keyboard_shortcuts_inhibitor_v1\n * @struct zwp_keyboard_shortcuts_inhibitor_v1_listener\n */\nstruct zwp_keyboard_shortcuts_inhibitor_v1_listener {\n  /**\n   * shortcuts are inhibited\n   *\n   * This event indicates that the shortcut inhibitor is active.\n   *\n   * The compositor sends this event every time compositor shortcuts\n   * are inhibited on behalf of the surface. When active, the client\n   * may receive input events normally reserved by the compositor\n   * (see zwp_keyboard_shortcuts_inhibitor_v1).\n   *\n   * This occurs typically when the initial request\n   * \"inhibit_shortcuts\" first becomes active or when the user\n   * instructs the compositor to re-enable and existing shortcuts\n   * inhibitor using any mechanism offered by the compositor.\n   */\n  void (*active)(void *data, struct zwp_keyboard_shortcuts_inhibitor_v1\n                                 *zwp_keyboard_shortcuts_inhibitor_v1);\n  /**\n   * shortcuts are restored\n   *\n   * This event indicates that the shortcuts inhibitor is inactive,\n   * normal shortcuts processing is restored by the compositor.\n   */\n  void (*inactive)(void *data, struct zwp_keyboard_shortcuts_inhibitor_v1\n                                   *zwp_keyboard_shortcuts_inhibitor_v1);\n};\n\n/**\n * @ingroup iface_zwp_keyboard_shortcuts_inhibitor_v1\n */\nstatic inline int zwp_keyboard_shortcuts_inhibitor_v1_add_listener(\n    struct zwp_keyboard_shortcuts_inhibitor_v1\n        *zwp_keyboard_shortcuts_inhibitor_v1,\n    const struct zwp_keyboard_shortcuts_inhibitor_v1_listener *listener,\n    void *data) {\n  return wl_proxy_add_listener(\n      (struct wl_proxy *)zwp_keyboard_shortcuts_inhibitor_v1,\n      (void (**)(void))listener, data);\n}\n\n#define ZWP_KEYBOARD_SHORTCUTS_INHIBITOR_V1_DESTROY 0\n\n/**\n * @ingroup iface_zwp_keyboard_shortcuts_inhibitor_v1\n */\n#define ZWP_KEYBOARD_SHORTCUTS_INHIBITOR_V1_ACTIVE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_keyboard_shortcuts_inhibitor_v1\n */\n#define ZWP_KEYBOARD_SHORTCUTS_INHIBITOR_V1_INACTIVE_SINCE_VERSION 1\n\n/**\n * @ingroup iface_zwp_keyboard_shortcuts_inhibitor_v1\n */\n#define ZWP_KEYBOARD_SHORTCUTS_INHIBITOR_V1_DESTROY_SINCE_VERSION 1\n\n/** @ingroup iface_zwp_keyboard_shortcuts_inhibitor_v1 */\nstatic inline void zwp_keyboard_shortcuts_inhibitor_v1_set_user_data(\n    struct zwp_keyboard_shortcuts_inhibitor_v1\n        *zwp_keyboard_shortcuts_inhibitor_v1,\n    void *user_data) {\n  wl_proxy_set_user_data((struct wl_proxy *)zwp_keyboard_shortcuts_inhibitor_v1,\n                         user_data);\n}\n\n/** @ingroup iface_zwp_keyboard_shortcuts_inhibitor_v1 */\nstatic inline void *zwp_keyboard_shortcuts_inhibitor_v1_get_user_data(\n    struct zwp_keyboard_shortcuts_inhibitor_v1\n        *zwp_keyboard_shortcuts_inhibitor_v1) {\n  return wl_proxy_get_user_data(\n      (struct wl_proxy *)zwp_keyboard_shortcuts_inhibitor_v1);\n}\n\nstatic inline uint32_t zwp_keyboard_shortcuts_inhibitor_v1_get_version(\n    struct zwp_keyboard_shortcuts_inhibitor_v1\n        *zwp_keyboard_shortcuts_inhibitor_v1) {\n  return wl_proxy_get_version(\n      (struct wl_proxy *)zwp_keyboard_shortcuts_inhibitor_v1);\n}\n\n/**\n * @ingroup iface_zwp_keyboard_shortcuts_inhibitor_v1\n *\n * Remove the keyboard shortcuts inhibitor from the associated wl_surface.\n */\nstatic inline void zwp_keyboard_shortcuts_inhibitor_v1_destroy(\n    struct zwp_keyboard_shortcuts_inhibitor_v1\n        *zwp_keyboard_shortcuts_inhibitor_v1) {\n  wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwp_keyboard_shortcuts_inhibitor_v1,\n      ZWP_KEYBOARD_SHORTCUTS_INHIBITOR_V1_DESTROY, NULL,\n      wl_proxy_get_version(\n          (struct wl_proxy *)zwp_keyboard_shortcuts_inhibitor_v1),\n      WL_MARSHAL_FLAG_DESTROY);\n}\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "pkg/wayland/tablet-v2.c",
    "content": "/* Generated by wayland-scanner 1.24.0 */\n\n/*\n * Copyright 2014 © Stephen \"Lyude\" Chandler Paul\n * Copyright 2015-2024 © Red Hat, Inc.\n *\n * Permission is hereby granted, free of charge, to any person\n * obtaining a copy of this software and associated documentation files\n * (the \"Software\"), to deal in the Software without restriction,\n * including without limitation the rights to use, copy, modify, merge,\n * publish, distribute, sublicense, and/or sell copies of the Software,\n * and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice (including the\n * next paragraph) shall be included in all copies or substantial\n * portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n#include <stdbool.h>\n#include <stdlib.h>\n#include <stdint.h>\n#include \"wayland-util.h\"\n\n#ifndef __has_attribute\n# define __has_attribute(x) 0  /* Compatibility with non-clang compilers. */\n#endif\n\n#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)\n#define WL_PRIVATE __attribute__ ((visibility(\"hidden\")))\n#else\n#define WL_PRIVATE\n#endif\n\nextern const struct wl_interface wl_seat_interface;\nextern const struct wl_interface wl_surface_interface;\nextern const struct wl_interface zwp_tablet_pad_dial_v2_interface;\nextern const struct wl_interface zwp_tablet_pad_group_v2_interface;\nextern const struct wl_interface zwp_tablet_pad_ring_v2_interface;\nextern const struct wl_interface zwp_tablet_pad_strip_v2_interface;\nextern const struct wl_interface zwp_tablet_pad_v2_interface;\nextern const struct wl_interface zwp_tablet_seat_v2_interface;\nextern const struct wl_interface zwp_tablet_tool_v2_interface;\nextern const struct wl_interface zwp_tablet_v2_interface;\n\nstatic const struct wl_interface *tablet_v2_types[] = {\n\tNULL,\n\tNULL,\n\tNULL,\n\t&zwp_tablet_seat_v2_interface,\n\t&wl_seat_interface,\n\t&zwp_tablet_v2_interface,\n\t&zwp_tablet_tool_v2_interface,\n\t&zwp_tablet_pad_v2_interface,\n\tNULL,\n\t&wl_surface_interface,\n\tNULL,\n\tNULL,\n\tNULL,\n\t&zwp_tablet_v2_interface,\n\t&wl_surface_interface,\n\t&zwp_tablet_pad_ring_v2_interface,\n\t&zwp_tablet_pad_strip_v2_interface,\n\t&zwp_tablet_pad_dial_v2_interface,\n\t&zwp_tablet_pad_group_v2_interface,\n\tNULL,\n\t&zwp_tablet_v2_interface,\n\t&wl_surface_interface,\n\tNULL,\n\t&wl_surface_interface,\n};\n\nstatic const struct wl_message zwp_tablet_manager_v2_requests[] = {\n\t{ \"get_tablet_seat\", \"no\", tablet_v2_types + 3 },\n\t{ \"destroy\", \"\", tablet_v2_types + 0 },\n};\n\nWL_PRIVATE const struct wl_interface zwp_tablet_manager_v2_interface = {\n\t\"zwp_tablet_manager_v2\", 2,\n\t2, zwp_tablet_manager_v2_requests,\n\t0, NULL,\n};\n\nstatic const struct wl_message zwp_tablet_seat_v2_requests[] = {\n\t{ \"destroy\", \"\", tablet_v2_types + 0 },\n};\n\nstatic const struct wl_message zwp_tablet_seat_v2_events[] = {\n\t{ \"tablet_added\", \"n\", tablet_v2_types + 5 },\n\t{ \"tool_added\", \"n\", tablet_v2_types + 6 },\n\t{ \"pad_added\", \"n\", tablet_v2_types + 7 },\n};\n\nWL_PRIVATE const struct wl_interface zwp_tablet_seat_v2_interface = {\n\t\"zwp_tablet_seat_v2\", 2,\n\t1, zwp_tablet_seat_v2_requests,\n\t3, zwp_tablet_seat_v2_events,\n};\n\nstatic const struct wl_message zwp_tablet_tool_v2_requests[] = {\n\t{ \"set_cursor\", \"u?oii\", tablet_v2_types + 8 },\n\t{ \"destroy\", \"\", tablet_v2_types + 0 },\n};\n\nstatic const struct wl_message zwp_tablet_tool_v2_events[] = {\n\t{ \"type\", \"u\", tablet_v2_types + 0 },\n\t{ \"hardware_serial\", \"uu\", tablet_v2_types + 0 },\n\t{ \"hardware_id_wacom\", \"uu\", tablet_v2_types + 0 },\n\t{ \"capability\", \"u\", tablet_v2_types + 0 },\n\t{ \"done\", \"\", tablet_v2_types + 0 },\n\t{ \"removed\", \"\", tablet_v2_types + 0 },\n\t{ \"proximity_in\", \"uoo\", tablet_v2_types + 12 },\n\t{ \"proximity_out\", \"\", tablet_v2_types + 0 },\n\t{ \"down\", \"u\", tablet_v2_types + 0 },\n\t{ \"up\", \"\", tablet_v2_types + 0 },\n\t{ \"motion\", \"ff\", tablet_v2_types + 0 },\n\t{ \"pressure\", \"u\", tablet_v2_types + 0 },\n\t{ \"distance\", \"u\", tablet_v2_types + 0 },\n\t{ \"tilt\", \"ff\", tablet_v2_types + 0 },\n\t{ \"rotation\", \"f\", tablet_v2_types + 0 },\n\t{ \"slider\", \"i\", tablet_v2_types + 0 },\n\t{ \"wheel\", \"fi\", tablet_v2_types + 0 },\n\t{ \"button\", \"uuu\", tablet_v2_types + 0 },\n\t{ \"frame\", \"u\", tablet_v2_types + 0 },\n};\n\nWL_PRIVATE const struct wl_interface zwp_tablet_tool_v2_interface = {\n\t\"zwp_tablet_tool_v2\", 2,\n\t2, zwp_tablet_tool_v2_requests,\n\t19, zwp_tablet_tool_v2_events,\n};\n\nstatic const struct wl_message zwp_tablet_v2_requests[] = {\n\t{ \"destroy\", \"\", tablet_v2_types + 0 },\n};\n\nstatic const struct wl_message zwp_tablet_v2_events[] = {\n\t{ \"name\", \"s\", tablet_v2_types + 0 },\n\t{ \"id\", \"uu\", tablet_v2_types + 0 },\n\t{ \"path\", \"s\", tablet_v2_types + 0 },\n\t{ \"done\", \"\", tablet_v2_types + 0 },\n\t{ \"removed\", \"\", tablet_v2_types + 0 },\n\t{ \"bustype\", \"2u\", tablet_v2_types + 0 },\n};\n\nWL_PRIVATE const struct wl_interface zwp_tablet_v2_interface = {\n\t\"zwp_tablet_v2\", 2,\n\t1, zwp_tablet_v2_requests,\n\t6, zwp_tablet_v2_events,\n};\n\nstatic const struct wl_message zwp_tablet_pad_ring_v2_requests[] = {\n\t{ \"set_feedback\", \"su\", tablet_v2_types + 0 },\n\t{ \"destroy\", \"\", tablet_v2_types + 0 },\n};\n\nstatic const struct wl_message zwp_tablet_pad_ring_v2_events[] = {\n\t{ \"source\", \"u\", tablet_v2_types + 0 },\n\t{ \"angle\", \"f\", tablet_v2_types + 0 },\n\t{ \"stop\", \"\", tablet_v2_types + 0 },\n\t{ \"frame\", \"u\", tablet_v2_types + 0 },\n};\n\nWL_PRIVATE const struct wl_interface zwp_tablet_pad_ring_v2_interface = {\n\t\"zwp_tablet_pad_ring_v2\", 2,\n\t2, zwp_tablet_pad_ring_v2_requests,\n\t4, zwp_tablet_pad_ring_v2_events,\n};\n\nstatic const struct wl_message zwp_tablet_pad_strip_v2_requests[] = {\n\t{ \"set_feedback\", \"su\", tablet_v2_types + 0 },\n\t{ \"destroy\", \"\", tablet_v2_types + 0 },\n};\n\nstatic const struct wl_message zwp_tablet_pad_strip_v2_events[] = {\n\t{ \"source\", \"u\", tablet_v2_types + 0 },\n\t{ \"position\", \"u\", tablet_v2_types + 0 },\n\t{ \"stop\", \"\", tablet_v2_types + 0 },\n\t{ \"frame\", \"u\", tablet_v2_types + 0 },\n};\n\nWL_PRIVATE const struct wl_interface zwp_tablet_pad_strip_v2_interface = {\n\t\"zwp_tablet_pad_strip_v2\", 2,\n\t2, zwp_tablet_pad_strip_v2_requests,\n\t4, zwp_tablet_pad_strip_v2_events,\n};\n\nstatic const struct wl_message zwp_tablet_pad_group_v2_requests[] = {\n\t{ \"destroy\", \"\", tablet_v2_types + 0 },\n};\n\nstatic const struct wl_message zwp_tablet_pad_group_v2_events[] = {\n\t{ \"buttons\", \"a\", tablet_v2_types + 0 },\n\t{ \"ring\", \"n\", tablet_v2_types + 15 },\n\t{ \"strip\", \"n\", tablet_v2_types + 16 },\n\t{ \"modes\", \"u\", tablet_v2_types + 0 },\n\t{ \"done\", \"\", tablet_v2_types + 0 },\n\t{ \"mode_switch\", \"uuu\", tablet_v2_types + 0 },\n\t{ \"dial\", \"2n\", tablet_v2_types + 17 },\n};\n\nWL_PRIVATE const struct wl_interface zwp_tablet_pad_group_v2_interface = {\n\t\"zwp_tablet_pad_group_v2\", 2,\n\t1, zwp_tablet_pad_group_v2_requests,\n\t7, zwp_tablet_pad_group_v2_events,\n};\n\nstatic const struct wl_message zwp_tablet_pad_v2_requests[] = {\n\t{ \"set_feedback\", \"usu\", tablet_v2_types + 0 },\n\t{ \"destroy\", \"\", tablet_v2_types + 0 },\n};\n\nstatic const struct wl_message zwp_tablet_pad_v2_events[] = {\n\t{ \"group\", \"n\", tablet_v2_types + 18 },\n\t{ \"path\", \"s\", tablet_v2_types + 0 },\n\t{ \"buttons\", \"u\", tablet_v2_types + 0 },\n\t{ \"done\", \"\", tablet_v2_types + 0 },\n\t{ \"button\", \"uuu\", tablet_v2_types + 0 },\n\t{ \"enter\", \"uoo\", tablet_v2_types + 19 },\n\t{ \"leave\", \"uo\", tablet_v2_types + 22 },\n\t{ \"removed\", \"\", tablet_v2_types + 0 },\n};\n\nWL_PRIVATE const struct wl_interface zwp_tablet_pad_v2_interface = {\n\t\"zwp_tablet_pad_v2\", 2,\n\t2, zwp_tablet_pad_v2_requests,\n\t8, zwp_tablet_pad_v2_events,\n};\n\nstatic const struct wl_message zwp_tablet_pad_dial_v2_requests[] = {\n\t{ \"set_feedback\", \"su\", tablet_v2_types + 0 },\n\t{ \"destroy\", \"\", tablet_v2_types + 0 },\n};\n\nstatic const struct wl_message zwp_tablet_pad_dial_v2_events[] = {\n\t{ \"delta\", \"i\", tablet_v2_types + 0 },\n\t{ \"frame\", \"u\", tablet_v2_types + 0 },\n};\n\nWL_PRIVATE const struct wl_interface zwp_tablet_pad_dial_v2_interface = {\n\t\"zwp_tablet_pad_dial_v2\", 2,\n\t2, zwp_tablet_pad_dial_v2_requests,\n\t2, zwp_tablet_pad_dial_v2_events,\n};\n\n"
  },
  {
    "path": "pkg/wayland/tablet-v2.h",
    "content": "/* Generated by wayland-scanner 1.24.0 */\n\n#ifndef TABLET_V2_CLIENT_PROTOCOL_H\n#define TABLET_V2_CLIENT_PROTOCOL_H\n\n#include <stdint.h>\n#include <stddef.h>\n#include \"wayland-client.h\"\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/**\n * @page page_tablet_v2 The tablet_v2 protocol\n * Wayland protocol for graphics tablets\n *\n * @section page_desc_tablet_v2 Description\n *\n * This description provides a high-level overview of the interplay between\n * the interfaces defined this protocol. For details, see the protocol\n * specification.\n *\n * More than one tablet may exist, and device-specifics matter. Tablets are\n * not represented by a single virtual device like wl_pointer. A client\n * binds to the tablet manager object which is just a proxy object. From\n * that, the client requests wp_tablet_manager.get_tablet_seat(wl_seat)\n * and that returns the actual interface that has all the tablets. With\n * this indirection, we can avoid merging wp_tablet into the actual Wayland\n * protocol, a long-term benefit.\n *\n * The wp_tablet_seat sends a \"tablet added\" event for each tablet\n * connected. That event is followed by descriptive events about the\n * hardware; currently that includes events for name, vid/pid and\n * a wp_tablet.path event that describes a local path. This path can be\n * used to uniquely identify a tablet or get more information through\n * libwacom. Emulated or nested tablets can skip any of those, e.g. a\n * virtual tablet may not have a vid/pid. The sequence of descriptive\n * events is terminated by a wp_tablet.done event to signal that a client\n * may now finalize any initialization for that tablet.\n *\n * Events from tablets require a tool in proximity. Tools are also managed\n * by the tablet seat; a \"tool added\" event is sent whenever a tool is new\n * to the compositor. That event is followed by a number of descriptive\n * events about the hardware; currently that includes capabilities,\n * hardware id and serial number, and tool type. Similar to the tablet\n * interface, a wp_tablet_tool.done event is sent to terminate that initial\n * sequence.\n *\n * Any event from a tool happens on the wp_tablet_tool interface. When the\n * tool gets into proximity of the tablet, a proximity_in event is sent on\n * the wp_tablet_tool interface, listing the tablet and the surface. That\n * event is followed by a motion event with the coordinates. After that,\n * it's the usual motion, axis, button, etc. events. The protocol's\n * serialisation means events are grouped by wp_tablet_tool.frame events.\n *\n * Two special events (that don't exist in X) are down and up. They signal\n * \"tip touching the surface\". For tablets without real proximity\n * detection, the sequence is: proximity_in, motion, down, frame.\n *\n * When the tool leaves proximity, a proximity_out event is sent. If any\n * button is still down, a button release event is sent before this\n * proximity event. These button events are sent in the same frame as the\n * proximity event to signal to the client that the buttons were held when\n * the tool left proximity.\n *\n * If the tool moves out of the surface but stays in proximity (i.e.\n * between windows), compositor-specific grab policies apply. This usually\n * means that the proximity-out is delayed until all buttons are released.\n *\n * Moving a tool physically from one tablet to the other has no real effect\n * on the protocol, since we already have the tool object from the \"tool\n * added\" event. All the information is already there and the proximity\n * events on both tablets are all a client needs to reconstruct what\n * happened.\n *\n * Some extra axes are normalized, i.e. the client knows the range as\n * specified in the protocol (e.g. [0, 65535]), the granularity however is\n * unknown. The current normalized axes are pressure, distance, and slider.\n *\n * Other extra axes are in physical units as specified in the protocol.\n * The current extra axes with physical units are tilt, rotation and\n * wheel rotation.\n *\n * Since tablets work independently of the pointer controlled by the mouse,\n * the focus handling is independent too and controlled by proximity.\n * The wp_tablet_tool.set_cursor request sets a tool-specific cursor.\n * This cursor surface may be the same as the mouse cursor, and it may be\n * the same across tools but it is possible to be more fine-grained. For\n * example, a client may set different cursors for the pen and eraser.\n *\n * Tools are generally independent of tablets and it is\n * compositor-specific policy when a tool can be removed. Common approaches\n * will likely include some form of removing a tool when all tablets the\n * tool was used on are removed.\n *\n * @section page_ifaces_tablet_v2 Interfaces\n * - @subpage page_iface_zwp_tablet_manager_v2 - controller object for graphic tablet devices\n * - @subpage page_iface_zwp_tablet_seat_v2 - controller object for graphic tablet devices of a seat\n * - @subpage page_iface_zwp_tablet_tool_v2 - a physical tablet tool\n * - @subpage page_iface_zwp_tablet_v2 - graphics tablet device\n * - @subpage page_iface_zwp_tablet_pad_ring_v2 - pad ring\n * - @subpage page_iface_zwp_tablet_pad_strip_v2 - pad strip\n * - @subpage page_iface_zwp_tablet_pad_group_v2 - a set of buttons, rings and strips\n * - @subpage page_iface_zwp_tablet_pad_v2 - a set of buttons, rings, strips and dials\n * - @subpage page_iface_zwp_tablet_pad_dial_v2 - pad dial\n * @section page_copyright_tablet_v2 Copyright\n * <pre>\n *\n * Copyright 2014 © Stephen \"Lyude\" Chandler Paul\n * Copyright 2015-2024 © Red Hat, Inc.\n *\n * Permission is hereby granted, free of charge, to any person\n * obtaining a copy of this software and associated documentation files\n * (the \"Software\"), to deal in the Software without restriction,\n * including without limitation the rights to use, copy, modify, merge,\n * publish, distribute, sublicense, and/or sell copies of the Software,\n * and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice (including the\n * next paragraph) shall be included in all copies or substantial\n * portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n * </pre>\n */\nstruct wl_seat;\nstruct wl_surface;\nstruct zwp_tablet_manager_v2;\nstruct zwp_tablet_pad_dial_v2;\nstruct zwp_tablet_pad_group_v2;\nstruct zwp_tablet_pad_ring_v2;\nstruct zwp_tablet_pad_strip_v2;\nstruct zwp_tablet_pad_v2;\nstruct zwp_tablet_seat_v2;\nstruct zwp_tablet_tool_v2;\nstruct zwp_tablet_v2;\n\n#ifndef ZWP_TABLET_MANAGER_V2_INTERFACE\n#define ZWP_TABLET_MANAGER_V2_INTERFACE\n/**\n * @page page_iface_zwp_tablet_manager_v2 zwp_tablet_manager_v2\n * @section page_iface_zwp_tablet_manager_v2_desc Description\n *\n * An object that provides access to the graphics tablets available on this\n * system. All tablets are associated with a seat, to get access to the\n * actual tablets, use wp_tablet_manager.get_tablet_seat.\n * @section page_iface_zwp_tablet_manager_v2_api API\n * See @ref iface_zwp_tablet_manager_v2.\n */\n/**\n * @defgroup iface_zwp_tablet_manager_v2 The zwp_tablet_manager_v2 interface\n *\n * An object that provides access to the graphics tablets available on this\n * system. All tablets are associated with a seat, to get access to the\n * actual tablets, use wp_tablet_manager.get_tablet_seat.\n */\nextern const struct wl_interface zwp_tablet_manager_v2_interface;\n#endif\n#ifndef ZWP_TABLET_SEAT_V2_INTERFACE\n#define ZWP_TABLET_SEAT_V2_INTERFACE\n/**\n * @page page_iface_zwp_tablet_seat_v2 zwp_tablet_seat_v2\n * @section page_iface_zwp_tablet_seat_v2_desc Description\n *\n * An object that provides access to the graphics tablets available on this\n * seat. After binding to this interface, the compositor sends a set of\n * wp_tablet_seat.tablet_added and wp_tablet_seat.tool_added events.\n * @section page_iface_zwp_tablet_seat_v2_api API\n * See @ref iface_zwp_tablet_seat_v2.\n */\n/**\n * @defgroup iface_zwp_tablet_seat_v2 The zwp_tablet_seat_v2 interface\n *\n * An object that provides access to the graphics tablets available on this\n * seat. After binding to this interface, the compositor sends a set of\n * wp_tablet_seat.tablet_added and wp_tablet_seat.tool_added events.\n */\nextern const struct wl_interface zwp_tablet_seat_v2_interface;\n#endif\n#ifndef ZWP_TABLET_TOOL_V2_INTERFACE\n#define ZWP_TABLET_TOOL_V2_INTERFACE\n/**\n * @page page_iface_zwp_tablet_tool_v2 zwp_tablet_tool_v2\n * @section page_iface_zwp_tablet_tool_v2_desc Description\n *\n * An object that represents a physical tool that has been, or is\n * currently in use with a tablet in this seat. Each wp_tablet_tool\n * object stays valid until the client destroys it; the compositor\n * reuses the wp_tablet_tool object to indicate that the object's\n * respective physical tool has come into proximity of a tablet again.\n *\n * A wp_tablet_tool object's relation to a physical tool depends on the\n * tablet's ability to report serial numbers. If the tablet supports\n * this capability, then the object represents a specific physical tool\n * and can be identified even when used on multiple tablets.\n *\n * A tablet tool has a number of static characteristics, e.g. tool type,\n * hardware_serial and capabilities. These capabilities are sent in an\n * event sequence after the wp_tablet_seat.tool_added event before any\n * actual events from this tool. This initial event sequence is\n * terminated by a wp_tablet_tool.done event.\n *\n * Tablet tool events are grouped by wp_tablet_tool.frame events.\n * Any events received before a wp_tablet_tool.frame event should be\n * considered part of the same hardware state change.\n * @section page_iface_zwp_tablet_tool_v2_api API\n * See @ref iface_zwp_tablet_tool_v2.\n */\n/**\n * @defgroup iface_zwp_tablet_tool_v2 The zwp_tablet_tool_v2 interface\n *\n * An object that represents a physical tool that has been, or is\n * currently in use with a tablet in this seat. Each wp_tablet_tool\n * object stays valid until the client destroys it; the compositor\n * reuses the wp_tablet_tool object to indicate that the object's\n * respective physical tool has come into proximity of a tablet again.\n *\n * A wp_tablet_tool object's relation to a physical tool depends on the\n * tablet's ability to report serial numbers. If the tablet supports\n * this capability, then the object represents a specific physical tool\n * and can be identified even when used on multiple tablets.\n *\n * A tablet tool has a number of static characteristics, e.g. tool type,\n * hardware_serial and capabilities. These capabilities are sent in an\n * event sequence after the wp_tablet_seat.tool_added event before any\n * actual events from this tool. This initial event sequence is\n * terminated by a wp_tablet_tool.done event.\n *\n * Tablet tool events are grouped by wp_tablet_tool.frame events.\n * Any events received before a wp_tablet_tool.frame event should be\n * considered part of the same hardware state change.\n */\nextern const struct wl_interface zwp_tablet_tool_v2_interface;\n#endif\n#ifndef ZWP_TABLET_V2_INTERFACE\n#define ZWP_TABLET_V2_INTERFACE\n/**\n * @page page_iface_zwp_tablet_v2 zwp_tablet_v2\n * @section page_iface_zwp_tablet_v2_desc Description\n *\n * The wp_tablet interface represents one graphics tablet device. The\n * tablet interface itself does not generate events; all events are\n * generated by wp_tablet_tool objects when in proximity above a tablet.\n *\n * A tablet has a number of static characteristics, e.g. device name and\n * pid/vid. These capabilities are sent in an event sequence after the\n * wp_tablet_seat.tablet_added event. This initial event sequence is\n * terminated by a wp_tablet.done event.\n * @section page_iface_zwp_tablet_v2_api API\n * See @ref iface_zwp_tablet_v2.\n */\n/**\n * @defgroup iface_zwp_tablet_v2 The zwp_tablet_v2 interface\n *\n * The wp_tablet interface represents one graphics tablet device. The\n * tablet interface itself does not generate events; all events are\n * generated by wp_tablet_tool objects when in proximity above a tablet.\n *\n * A tablet has a number of static characteristics, e.g. device name and\n * pid/vid. These capabilities are sent in an event sequence after the\n * wp_tablet_seat.tablet_added event. This initial event sequence is\n * terminated by a wp_tablet.done event.\n */\nextern const struct wl_interface zwp_tablet_v2_interface;\n#endif\n#ifndef ZWP_TABLET_PAD_RING_V2_INTERFACE\n#define ZWP_TABLET_PAD_RING_V2_INTERFACE\n/**\n * @page page_iface_zwp_tablet_pad_ring_v2 zwp_tablet_pad_ring_v2\n * @section page_iface_zwp_tablet_pad_ring_v2_desc Description\n *\n * A circular interaction area, such as the touch ring on the Wacom Intuos\n * Pro series tablets.\n *\n * Events on a ring are logically grouped by the wl_tablet_pad_ring.frame\n * event.\n * @section page_iface_zwp_tablet_pad_ring_v2_api API\n * See @ref iface_zwp_tablet_pad_ring_v2.\n */\n/**\n * @defgroup iface_zwp_tablet_pad_ring_v2 The zwp_tablet_pad_ring_v2 interface\n *\n * A circular interaction area, such as the touch ring on the Wacom Intuos\n * Pro series tablets.\n *\n * Events on a ring are logically grouped by the wl_tablet_pad_ring.frame\n * event.\n */\nextern const struct wl_interface zwp_tablet_pad_ring_v2_interface;\n#endif\n#ifndef ZWP_TABLET_PAD_STRIP_V2_INTERFACE\n#define ZWP_TABLET_PAD_STRIP_V2_INTERFACE\n/**\n * @page page_iface_zwp_tablet_pad_strip_v2 zwp_tablet_pad_strip_v2\n * @section page_iface_zwp_tablet_pad_strip_v2_desc Description\n *\n * A linear interaction area, such as the strips found in Wacom Cintiq\n * models.\n *\n * Events on a strip are logically grouped by the wl_tablet_pad_strip.frame\n * event.\n * @section page_iface_zwp_tablet_pad_strip_v2_api API\n * See @ref iface_zwp_tablet_pad_strip_v2.\n */\n/**\n * @defgroup iface_zwp_tablet_pad_strip_v2 The zwp_tablet_pad_strip_v2 interface\n *\n * A linear interaction area, such as the strips found in Wacom Cintiq\n * models.\n *\n * Events on a strip are logically grouped by the wl_tablet_pad_strip.frame\n * event.\n */\nextern const struct wl_interface zwp_tablet_pad_strip_v2_interface;\n#endif\n#ifndef ZWP_TABLET_PAD_GROUP_V2_INTERFACE\n#define ZWP_TABLET_PAD_GROUP_V2_INTERFACE\n/**\n * @page page_iface_zwp_tablet_pad_group_v2 zwp_tablet_pad_group_v2\n * @section page_iface_zwp_tablet_pad_group_v2_desc Description\n *\n * A pad group describes a distinct (sub)set of buttons, rings and strips\n * present in the tablet. The criteria of this grouping is usually positional,\n * eg. if a tablet has buttons on the left and right side, 2 groups will be\n * presented. The physical arrangement of groups is undisclosed and may\n * change on the fly.\n *\n * Pad groups will announce their features during pad initialization. Between\n * the corresponding wp_tablet_pad.group event and wp_tablet_pad_group.done, the\n * pad group will announce the buttons, rings and strips contained in it,\n * plus the number of supported modes.\n *\n * Modes are a mechanism to allow multiple groups of actions for every element\n * in the pad group. The number of groups and available modes in each is\n * persistent across device plugs. The current mode is user-switchable, it\n * will be announced through the wp_tablet_pad_group.mode_switch event both\n * whenever it is switched, and after wp_tablet_pad.enter.\n *\n * The current mode logically applies to all elements in the pad group,\n * although it is at clients' discretion whether to actually perform different\n * actions, and/or issue the respective .set_feedback requests to notify the\n * compositor. See the wp_tablet_pad_group.mode_switch event for more details.\n * @section page_iface_zwp_tablet_pad_group_v2_api API\n * See @ref iface_zwp_tablet_pad_group_v2.\n */\n/**\n * @defgroup iface_zwp_tablet_pad_group_v2 The zwp_tablet_pad_group_v2 interface\n *\n * A pad group describes a distinct (sub)set of buttons, rings and strips\n * present in the tablet. The criteria of this grouping is usually positional,\n * eg. if a tablet has buttons on the left and right side, 2 groups will be\n * presented. The physical arrangement of groups is undisclosed and may\n * change on the fly.\n *\n * Pad groups will announce their features during pad initialization. Between\n * the corresponding wp_tablet_pad.group event and wp_tablet_pad_group.done, the\n * pad group will announce the buttons, rings and strips contained in it,\n * plus the number of supported modes.\n *\n * Modes are a mechanism to allow multiple groups of actions for every element\n * in the pad group. The number of groups and available modes in each is\n * persistent across device plugs. The current mode is user-switchable, it\n * will be announced through the wp_tablet_pad_group.mode_switch event both\n * whenever it is switched, and after wp_tablet_pad.enter.\n *\n * The current mode logically applies to all elements in the pad group,\n * although it is at clients' discretion whether to actually perform different\n * actions, and/or issue the respective .set_feedback requests to notify the\n * compositor. See the wp_tablet_pad_group.mode_switch event for more details.\n */\nextern const struct wl_interface zwp_tablet_pad_group_v2_interface;\n#endif\n#ifndef ZWP_TABLET_PAD_V2_INTERFACE\n#define ZWP_TABLET_PAD_V2_INTERFACE\n/**\n * @page page_iface_zwp_tablet_pad_v2 zwp_tablet_pad_v2\n * @section page_iface_zwp_tablet_pad_v2_desc Description\n *\n * A pad device is a set of buttons, rings, strips and dials\n * usually physically present on the tablet device itself. Some\n * exceptions exist where the pad device is physically detached, e.g. the\n * Wacom ExpressKey Remote.\n *\n * Pad devices have no axes that control the cursor and are generally\n * auxiliary devices to the tool devices used on the tablet surface.\n *\n * A pad device has a number of static characteristics, e.g. the number\n * of rings. These capabilities are sent in an event sequence after the\n * wp_tablet_seat.pad_added event before any actual events from this pad.\n * This initial event sequence is terminated by a wp_tablet_pad.done\n * event.\n *\n * All pad features (buttons, rings, strips and dials) are logically divided into\n * groups and all pads have at least one group. The available groups are\n * notified through the wp_tablet_pad.group event; the compositor will\n * emit one event per group before emitting wp_tablet_pad.done.\n *\n * Groups may have multiple modes. Modes allow clients to map multiple\n * actions to a single pad feature. Only one mode can be active per group,\n * although different groups may have different active modes.\n * @section page_iface_zwp_tablet_pad_v2_api API\n * See @ref iface_zwp_tablet_pad_v2.\n */\n/**\n * @defgroup iface_zwp_tablet_pad_v2 The zwp_tablet_pad_v2 interface\n *\n * A pad device is a set of buttons, rings, strips and dials\n * usually physically present on the tablet device itself. Some\n * exceptions exist where the pad device is physically detached, e.g. the\n * Wacom ExpressKey Remote.\n *\n * Pad devices have no axes that control the cursor and are generally\n * auxiliary devices to the tool devices used on the tablet surface.\n *\n * A pad device has a number of static characteristics, e.g. the number\n * of rings. These capabilities are sent in an event sequence after the\n * wp_tablet_seat.pad_added event before any actual events from this pad.\n * This initial event sequence is terminated by a wp_tablet_pad.done\n * event.\n *\n * All pad features (buttons, rings, strips and dials) are logically divided into\n * groups and all pads have at least one group. The available groups are\n * notified through the wp_tablet_pad.group event; the compositor will\n * emit one event per group before emitting wp_tablet_pad.done.\n *\n * Groups may have multiple modes. Modes allow clients to map multiple\n * actions to a single pad feature. Only one mode can be active per group,\n * although different groups may have different active modes.\n */\nextern const struct wl_interface zwp_tablet_pad_v2_interface;\n#endif\n#ifndef ZWP_TABLET_PAD_DIAL_V2_INTERFACE\n#define ZWP_TABLET_PAD_DIAL_V2_INTERFACE\n/**\n * @page page_iface_zwp_tablet_pad_dial_v2 zwp_tablet_pad_dial_v2\n * @section page_iface_zwp_tablet_pad_dial_v2_desc Description\n *\n * A rotary control, e.g. a dial or a wheel.\n *\n * Events on a dial are logically grouped by the wl_tablet_pad_dial.frame\n * event.\n * @section page_iface_zwp_tablet_pad_dial_v2_api API\n * See @ref iface_zwp_tablet_pad_dial_v2.\n */\n/**\n * @defgroup iface_zwp_tablet_pad_dial_v2 The zwp_tablet_pad_dial_v2 interface\n *\n * A rotary control, e.g. a dial or a wheel.\n *\n * Events on a dial are logically grouped by the wl_tablet_pad_dial.frame\n * event.\n */\nextern const struct wl_interface zwp_tablet_pad_dial_v2_interface;\n#endif\n\n#define ZWP_TABLET_MANAGER_V2_GET_TABLET_SEAT 0\n#define ZWP_TABLET_MANAGER_V2_DESTROY 1\n\n\n/**\n * @ingroup iface_zwp_tablet_manager_v2\n */\n#define ZWP_TABLET_MANAGER_V2_GET_TABLET_SEAT_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_manager_v2\n */\n#define ZWP_TABLET_MANAGER_V2_DESTROY_SINCE_VERSION 1\n\n/** @ingroup iface_zwp_tablet_manager_v2 */\nstatic inline void\nzwp_tablet_manager_v2_set_user_data(struct zwp_tablet_manager_v2 *zwp_tablet_manager_v2, void *user_data)\n{\n\twl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_manager_v2, user_data);\n}\n\n/** @ingroup iface_zwp_tablet_manager_v2 */\nstatic inline void *\nzwp_tablet_manager_v2_get_user_data(struct zwp_tablet_manager_v2 *zwp_tablet_manager_v2)\n{\n\treturn wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_manager_v2);\n}\n\nstatic inline uint32_t\nzwp_tablet_manager_v2_get_version(struct zwp_tablet_manager_v2 *zwp_tablet_manager_v2)\n{\n\treturn wl_proxy_get_version((struct wl_proxy *) zwp_tablet_manager_v2);\n}\n\n/**\n * @ingroup iface_zwp_tablet_manager_v2\n *\n * Get the wp_tablet_seat object for the given seat. This object\n * provides access to all graphics tablets in this seat.\n */\nstatic inline struct zwp_tablet_seat_v2 *\nzwp_tablet_manager_v2_get_tablet_seat(struct zwp_tablet_manager_v2 *zwp_tablet_manager_v2, struct wl_seat *seat)\n{\n\tstruct wl_proxy *tablet_seat;\n\n\ttablet_seat = wl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_manager_v2,\n\t\t\t ZWP_TABLET_MANAGER_V2_GET_TABLET_SEAT, &zwp_tablet_seat_v2_interface, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_manager_v2), 0, NULL, seat);\n\n\treturn (struct zwp_tablet_seat_v2 *) tablet_seat;\n}\n\n/**\n * @ingroup iface_zwp_tablet_manager_v2\n *\n * Destroy the wp_tablet_manager object. Objects created from this\n * object are unaffected and should be destroyed separately.\n */\nstatic inline void\nzwp_tablet_manager_v2_destroy(struct zwp_tablet_manager_v2 *zwp_tablet_manager_v2)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_manager_v2,\n\t\t\t ZWP_TABLET_MANAGER_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_manager_v2), WL_MARSHAL_FLAG_DESTROY);\n}\n\n/**\n * @ingroup iface_zwp_tablet_seat_v2\n * @struct zwp_tablet_seat_v2_listener\n */\nstruct zwp_tablet_seat_v2_listener {\n\t/**\n\t * new device notification\n\t *\n\t * This event is sent whenever a new tablet becomes available on\n\t * this seat. This event only provides the object id of the tablet,\n\t * any static information about the tablet (device name, vid/pid,\n\t * etc.) is sent through the wp_tablet interface.\n\t * @param id the newly added graphics tablet\n\t */\n\tvoid (*tablet_added)(void *data,\n\t\t\t     struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,\n\t\t\t     struct zwp_tablet_v2 *id);\n\t/**\n\t * a new tool has been used with a tablet\n\t *\n\t * This event is sent whenever a tool that has not previously\n\t * been used with a tablet comes into use. This event only provides\n\t * the object id of the tool; any static information about the tool\n\t * (capabilities, type, etc.) is sent through the wp_tablet_tool\n\t * interface.\n\t * @param id the newly added tablet tool\n\t */\n\tvoid (*tool_added)(void *data,\n\t\t\t   struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,\n\t\t\t   struct zwp_tablet_tool_v2 *id);\n\t/**\n\t * new pad notification\n\t *\n\t * This event is sent whenever a new pad is known to the system.\n\t * Typically, pads are physically attached to tablets and a\n\t * pad_added event is sent immediately after the\n\t * wp_tablet_seat.tablet_added. However, some standalone pad\n\t * devices logically attach to tablets at runtime, and the client\n\t * must wait for wp_tablet_pad.enter to know the tablet a pad is\n\t * attached to.\n\t *\n\t * This event only provides the object id of the pad. All further\n\t * features (buttons, strips, rings) are sent through the\n\t * wp_tablet_pad interface.\n\t * @param id the newly added pad\n\t */\n\tvoid (*pad_added)(void *data,\n\t\t\t  struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,\n\t\t\t  struct zwp_tablet_pad_v2 *id);\n};\n\n/**\n * @ingroup iface_zwp_tablet_seat_v2\n */\nstatic inline int\nzwp_tablet_seat_v2_add_listener(struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,\n\t\t\t\tconst struct zwp_tablet_seat_v2_listener *listener, void *data)\n{\n\treturn wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_seat_v2,\n\t\t\t\t     (void (**)(void)) listener, data);\n}\n\n#define ZWP_TABLET_SEAT_V2_DESTROY 0\n\n/**\n * @ingroup iface_zwp_tablet_seat_v2\n */\n#define ZWP_TABLET_SEAT_V2_TABLET_ADDED_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_seat_v2\n */\n#define ZWP_TABLET_SEAT_V2_TOOL_ADDED_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_seat_v2\n */\n#define ZWP_TABLET_SEAT_V2_PAD_ADDED_SINCE_VERSION 1\n\n/**\n * @ingroup iface_zwp_tablet_seat_v2\n */\n#define ZWP_TABLET_SEAT_V2_DESTROY_SINCE_VERSION 1\n\n/** @ingroup iface_zwp_tablet_seat_v2 */\nstatic inline void\nzwp_tablet_seat_v2_set_user_data(struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2, void *user_data)\n{\n\twl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_seat_v2, user_data);\n}\n\n/** @ingroup iface_zwp_tablet_seat_v2 */\nstatic inline void *\nzwp_tablet_seat_v2_get_user_data(struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2)\n{\n\treturn wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_seat_v2);\n}\n\nstatic inline uint32_t\nzwp_tablet_seat_v2_get_version(struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2)\n{\n\treturn wl_proxy_get_version((struct wl_proxy *) zwp_tablet_seat_v2);\n}\n\n/**\n * @ingroup iface_zwp_tablet_seat_v2\n *\n * Destroy the wp_tablet_seat object. Objects created from this\n * object are unaffected and should be destroyed separately.\n */\nstatic inline void\nzwp_tablet_seat_v2_destroy(struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_seat_v2,\n\t\t\t ZWP_TABLET_SEAT_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_seat_v2), WL_MARSHAL_FLAG_DESTROY);\n}\n\n#ifndef ZWP_TABLET_TOOL_V2_TYPE_ENUM\n#define ZWP_TABLET_TOOL_V2_TYPE_ENUM\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n * a physical tool type\n *\n * Describes the physical type of a tool. The physical type of a tool\n * generally defines its base usage.\n *\n * The mouse tool represents a mouse-shaped tool that is not a relative\n * device but bound to the tablet's surface, providing absolute\n * coordinates.\n *\n * The lens tool is a mouse-shaped tool with an attached lens to\n * provide precision focus.\n */\nenum zwp_tablet_tool_v2_type {\n\t/**\n\t * Pen\n\t */\n\tZWP_TABLET_TOOL_V2_TYPE_PEN = 0x140,\n\t/**\n\t * Eraser\n\t */\n\tZWP_TABLET_TOOL_V2_TYPE_ERASER = 0x141,\n\t/**\n\t * Brush\n\t */\n\tZWP_TABLET_TOOL_V2_TYPE_BRUSH = 0x142,\n\t/**\n\t * Pencil\n\t */\n\tZWP_TABLET_TOOL_V2_TYPE_PENCIL = 0x143,\n\t/**\n\t * Airbrush\n\t */\n\tZWP_TABLET_TOOL_V2_TYPE_AIRBRUSH = 0x144,\n\t/**\n\t * Finger\n\t */\n\tZWP_TABLET_TOOL_V2_TYPE_FINGER = 0x145,\n\t/**\n\t * Mouse\n\t */\n\tZWP_TABLET_TOOL_V2_TYPE_MOUSE = 0x146,\n\t/**\n\t * Lens\n\t */\n\tZWP_TABLET_TOOL_V2_TYPE_LENS = 0x147,\n};\n#endif /* ZWP_TABLET_TOOL_V2_TYPE_ENUM */\n\n#ifndef ZWP_TABLET_TOOL_V2_CAPABILITY_ENUM\n#define ZWP_TABLET_TOOL_V2_CAPABILITY_ENUM\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n * capability flags for a tool\n *\n * Describes extra capabilities on a tablet.\n *\n * Any tool must provide x and y values, extra axes are\n * device-specific.\n */\nenum zwp_tablet_tool_v2_capability {\n\t/**\n\t * Tilt axes\n\t */\n\tZWP_TABLET_TOOL_V2_CAPABILITY_TILT = 1,\n\t/**\n\t * Pressure axis\n\t */\n\tZWP_TABLET_TOOL_V2_CAPABILITY_PRESSURE = 2,\n\t/**\n\t * Distance axis\n\t */\n\tZWP_TABLET_TOOL_V2_CAPABILITY_DISTANCE = 3,\n\t/**\n\t * Z-rotation axis\n\t */\n\tZWP_TABLET_TOOL_V2_CAPABILITY_ROTATION = 4,\n\t/**\n\t * Slider axis\n\t */\n\tZWP_TABLET_TOOL_V2_CAPABILITY_SLIDER = 5,\n\t/**\n\t * Wheel axis\n\t */\n\tZWP_TABLET_TOOL_V2_CAPABILITY_WHEEL = 6,\n};\n#endif /* ZWP_TABLET_TOOL_V2_CAPABILITY_ENUM */\n\n#ifndef ZWP_TABLET_TOOL_V2_BUTTON_STATE_ENUM\n#define ZWP_TABLET_TOOL_V2_BUTTON_STATE_ENUM\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n * physical button state\n *\n * Describes the physical state of a button that produced the button event.\n */\nenum zwp_tablet_tool_v2_button_state {\n\t/**\n\t * button is not pressed\n\t */\n\tZWP_TABLET_TOOL_V2_BUTTON_STATE_RELEASED = 0,\n\t/**\n\t * button is pressed\n\t */\n\tZWP_TABLET_TOOL_V2_BUTTON_STATE_PRESSED = 1,\n};\n#endif /* ZWP_TABLET_TOOL_V2_BUTTON_STATE_ENUM */\n\n#ifndef ZWP_TABLET_TOOL_V2_ERROR_ENUM\n#define ZWP_TABLET_TOOL_V2_ERROR_ENUM\nenum zwp_tablet_tool_v2_error {\n\t/**\n\t * given wl_surface has another role\n\t */\n\tZWP_TABLET_TOOL_V2_ERROR_ROLE = 0,\n};\n#endif /* ZWP_TABLET_TOOL_V2_ERROR_ENUM */\n\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n * @struct zwp_tablet_tool_v2_listener\n */\nstruct zwp_tablet_tool_v2_listener {\n\t/**\n\t * tool type\n\t *\n\t * The tool type is the high-level type of the tool and usually\n\t * decides the interaction expected from this tool.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet_tool.done event.\n\t * @param tool_type the physical tool type\n\t */\n\tvoid (*type)(void *data,\n\t\t     struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t     uint32_t tool_type);\n\t/**\n\t * unique hardware serial number of the tool\n\t *\n\t * If the physical tool can be identified by a unique 64-bit\n\t * serial number, this event notifies the client of this serial\n\t * number.\n\t *\n\t * If multiple tablets are available in the same seat and the tool\n\t * is uniquely identifiable by the serial number, that tool may\n\t * move between tablets.\n\t *\n\t * Otherwise, if the tool has no serial number and this event is\n\t * missing, the tool is tied to the tablet it first comes into\n\t * proximity with. Even if the physical tool is used on multiple\n\t * tablets, separate wp_tablet_tool objects will be created, one\n\t * per tablet.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet_tool.done event.\n\t * @param hardware_serial_hi the unique serial number of the tool, most significant bits\n\t * @param hardware_serial_lo the unique serial number of the tool, least significant bits\n\t */\n\tvoid (*hardware_serial)(void *data,\n\t\t\t\tstruct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t\t\tuint32_t hardware_serial_hi,\n\t\t\t\tuint32_t hardware_serial_lo);\n\t/**\n\t * hardware id notification in Wacom's format\n\t *\n\t * This event notifies the client of a hardware id available on\n\t * this tool.\n\t *\n\t * The hardware id is a device-specific 64-bit id that provides\n\t * extra information about the tool in use, beyond the wl_tool.type\n\t * enumeration. The format of the id is specific to tablets made by\n\t * Wacom Inc. For example, the hardware id of a Wacom Grip Pen (a\n\t * stylus) is 0x802.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet_tool.done event.\n\t * @param hardware_id_hi the hardware id, most significant bits\n\t * @param hardware_id_lo the hardware id, least significant bits\n\t */\n\tvoid (*hardware_id_wacom)(void *data,\n\t\t\t\t  struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t\t\t  uint32_t hardware_id_hi,\n\t\t\t\t  uint32_t hardware_id_lo);\n\t/**\n\t * tool capability notification\n\t *\n\t * This event notifies the client of any capabilities of this\n\t * tool, beyond the main set of x/y axes and tip up/down detection.\n\t *\n\t * One event is sent for each extra capability available on this\n\t * tool.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet_tool.done event.\n\t * @param capability the capability\n\t */\n\tvoid (*capability)(void *data,\n\t\t\t   struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t\t   uint32_t capability);\n\t/**\n\t * tool description events sequence complete\n\t *\n\t * This event signals the end of the initial burst of descriptive\n\t * events. A client may consider the static description of the tool\n\t * to be complete and finalize initialization of the tool.\n\t */\n\tvoid (*done)(void *data,\n\t\t     struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2);\n\t/**\n\t * tool removed\n\t *\n\t * This event is sent when the tool is removed from the system\n\t * and will send no further events. Should the physical tool come\n\t * back into proximity later, a new wp_tablet_tool object will be\n\t * created.\n\t *\n\t * It is compositor-dependent when a tool is removed. A compositor\n\t * may remove a tool on proximity out, tablet removal or any other\n\t * reason. A compositor may also keep a tool alive until shutdown.\n\t *\n\t * If the tool is currently in proximity, a proximity_out event\n\t * will be sent before the removed event. See\n\t * wp_tablet_tool.proximity_out for the handling of any buttons\n\t * logically down.\n\t *\n\t * When this event is received, the client must\n\t * wp_tablet_tool.destroy the object.\n\t */\n\tvoid (*removed)(void *data,\n\t\t\tstruct zwp_tablet_tool_v2 *zwp_tablet_tool_v2);\n\t/**\n\t * proximity in event\n\t *\n\t * Notification that this tool is focused on a certain surface.\n\t *\n\t * This event can be received when the tool has moved from one\n\t * surface to another, or when the tool has come back into\n\t * proximity above the surface.\n\t *\n\t * If any button is logically down when the tool comes into\n\t * proximity, the respective button event is sent after the\n\t * proximity_in event but within the same frame as the proximity_in\n\t * event.\n\t * @param tablet The tablet the tool is in proximity of\n\t * @param surface The current surface the tablet tool is over\n\t */\n\tvoid (*proximity_in)(void *data,\n\t\t\t     struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t\t     uint32_t serial,\n\t\t\t     struct zwp_tablet_v2 *tablet,\n\t\t\t     struct wl_surface *surface);\n\t/**\n\t * proximity out event\n\t *\n\t * Notification that this tool has either left proximity, or is\n\t * no longer focused on a certain surface.\n\t *\n\t * When the tablet tool leaves proximity of the tablet, button\n\t * release events are sent for each button that was held down at\n\t * the time of leaving proximity. These events are sent before the\n\t * proximity_out event but within the same wp_tablet.frame.\n\t *\n\t * If the tool stays within proximity of the tablet, but the focus\n\t * changes from one surface to another, a button release event may\n\t * not be sent until the button is actually released or the tool\n\t * leaves the proximity of the tablet.\n\t */\n\tvoid (*proximity_out)(void *data,\n\t\t\t      struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2);\n\t/**\n\t * tablet tool is making contact\n\t *\n\t * Sent whenever the tablet tool comes in contact with the\n\t * surface of the tablet.\n\t *\n\t * If the tool is already in contact with the tablet when entering\n\t * the input region, the client owning said region will receive a\n\t * wp_tablet.proximity_in event, followed by a wp_tablet.down event\n\t * and a wp_tablet.frame event.\n\t *\n\t * Note that this event describes logical contact, not physical\n\t * contact. On some devices, a compositor may not consider a tool\n\t * in logical contact until a minimum physical pressure threshold\n\t * is exceeded.\n\t */\n\tvoid (*down)(void *data,\n\t\t     struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t     uint32_t serial);\n\t/**\n\t * tablet tool is no longer making contact\n\t *\n\t * Sent whenever the tablet tool stops making contact with the\n\t * surface of the tablet, or when the tablet tool moves out of the\n\t * input region and the compositor grab (if any) is dismissed.\n\t *\n\t * If the tablet tool moves out of the input region while in\n\t * contact with the surface of the tablet and the compositor does\n\t * not have an ongoing grab on the surface, the client owning said\n\t * region will receive a wp_tablet.up event, followed by a\n\t * wp_tablet.proximity_out event and a wp_tablet.frame event. If\n\t * the compositor has an ongoing grab on this device, this event\n\t * sequence is sent whenever the grab is dismissed in the future.\n\t *\n\t * Note that this event describes logical contact, not physical\n\t * contact. On some devices, a compositor may not consider a tool\n\t * out of logical contact until physical pressure falls below a\n\t * specific threshold.\n\t */\n\tvoid (*up)(void *data,\n\t\t   struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2);\n\t/**\n\t * motion event\n\t *\n\t * Sent whenever a tablet tool moves.\n\t * @param x surface-local x coordinate\n\t * @param y surface-local y coordinate\n\t */\n\tvoid (*motion)(void *data,\n\t\t       struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t       wl_fixed_t x,\n\t\t       wl_fixed_t y);\n\t/**\n\t * pressure change event\n\t *\n\t * Sent whenever the pressure axis on a tool changes. The value\n\t * of this event is normalized to a value between 0 and 65535.\n\t *\n\t * Note that pressure may be nonzero even when a tool is not in\n\t * logical contact. See the down and up events for more details.\n\t * @param pressure The current pressure value\n\t */\n\tvoid (*pressure)(void *data,\n\t\t\t struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t\t uint32_t pressure);\n\t/**\n\t * distance change event\n\t *\n\t * Sent whenever the distance axis on a tool changes. The value\n\t * of this event is normalized to a value between 0 and 65535.\n\t *\n\t * Note that distance may be nonzero even when a tool is not in\n\t * logical contact. See the down and up events for more details.\n\t * @param distance The current distance value\n\t */\n\tvoid (*distance)(void *data,\n\t\t\t struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t\t uint32_t distance);\n\t/**\n\t * tilt change event\n\t *\n\t * Sent whenever one or both of the tilt axes on a tool change.\n\t * Each tilt value is in degrees, relative to the z-axis of the\n\t * tablet. The angle is positive when the top of a tool tilts along\n\t * the positive x or y axis.\n\t * @param tilt_x The current value of the X tilt axis\n\t * @param tilt_y The current value of the Y tilt axis\n\t */\n\tvoid (*tilt)(void *data,\n\t\t     struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t     wl_fixed_t tilt_x,\n\t\t     wl_fixed_t tilt_y);\n\t/**\n\t * z-rotation change event\n\t *\n\t * Sent whenever the z-rotation axis on the tool changes. The\n\t * rotation value is in degrees clockwise from the tool's logical\n\t * neutral position.\n\t * @param degrees The current rotation of the Z axis\n\t */\n\tvoid (*rotation)(void *data,\n\t\t\t struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t\t wl_fixed_t degrees);\n\t/**\n\t * Slider position change event\n\t *\n\t * Sent whenever the slider position on the tool changes. The\n\t * value is normalized between -65535 and 65535, with 0 as the\n\t * logical neutral position of the slider.\n\t *\n\t * The slider is available on e.g. the Wacom Airbrush tool.\n\t * @param position The current position of slider\n\t */\n\tvoid (*slider)(void *data,\n\t\t       struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t       int32_t position);\n\t/**\n\t * Wheel delta event\n\t *\n\t * Sent whenever the wheel on the tool emits an event. This event\n\t * contains two values for the same axis change. The degrees value\n\t * is in the same orientation as the wl_pointer.vertical_scroll\n\t * axis. The clicks value is in discrete logical clicks of the\n\t * mouse wheel. This value may be zero if the movement of the wheel\n\t * was less than one logical click.\n\t *\n\t * Clients should choose either value and avoid mixing degrees and\n\t * clicks. The compositor may accumulate values smaller than a\n\t * logical click and emulate click events when a certain threshold\n\t * is met. Thus, wl_tablet_tool.wheel events with non-zero clicks\n\t * values may have different degrees values.\n\t * @param degrees The wheel delta in degrees\n\t * @param clicks The wheel delta in discrete clicks\n\t */\n\tvoid (*wheel)(void *data,\n\t\t      struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t      wl_fixed_t degrees,\n\t\t      int32_t clicks);\n\t/**\n\t * button event\n\t *\n\t * Sent whenever a button on the tool is pressed or released.\n\t *\n\t * If a button is held down when the tool moves in or out of\n\t * proximity, button events are generated by the compositor. See\n\t * wp_tablet_tool.proximity_in and wp_tablet_tool.proximity_out for\n\t * details.\n\t * @param button The button whose state has changed\n\t * @param state Whether the button was pressed or released\n\t */\n\tvoid (*button)(void *data,\n\t\t       struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t       uint32_t serial,\n\t\t       uint32_t button,\n\t\t       uint32_t state);\n\t/**\n\t * frame event\n\t *\n\t * Marks the end of a series of axis and/or button updates from\n\t * the tablet. The Wayland protocol requires axis updates to be\n\t * sent sequentially, however all events within a frame should be\n\t * considered one hardware event.\n\t * @param time The time of the event with millisecond granularity\n\t */\n\tvoid (*frame)(void *data,\n\t\t      struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t      uint32_t time);\n};\n\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\nstatic inline int\nzwp_tablet_tool_v2_add_listener(struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2,\n\t\t\t\tconst struct zwp_tablet_tool_v2_listener *listener, void *data)\n{\n\treturn wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_tool_v2,\n\t\t\t\t     (void (**)(void)) listener, data);\n}\n\n#define ZWP_TABLET_TOOL_V2_SET_CURSOR 0\n#define ZWP_TABLET_TOOL_V2_DESTROY 1\n\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_TYPE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_HARDWARE_SERIAL_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_HARDWARE_ID_WACOM_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_CAPABILITY_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_DONE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_REMOVED_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_PROXIMITY_IN_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_PROXIMITY_OUT_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_DOWN_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_UP_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_MOTION_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_PRESSURE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_DISTANCE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_TILT_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_ROTATION_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_SLIDER_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_WHEEL_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_BUTTON_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_FRAME_SINCE_VERSION 1\n\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_SET_CURSOR_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n */\n#define ZWP_TABLET_TOOL_V2_DESTROY_SINCE_VERSION 1\n\n/** @ingroup iface_zwp_tablet_tool_v2 */\nstatic inline void\nzwp_tablet_tool_v2_set_user_data(struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2, void *user_data)\n{\n\twl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_tool_v2, user_data);\n}\n\n/** @ingroup iface_zwp_tablet_tool_v2 */\nstatic inline void *\nzwp_tablet_tool_v2_get_user_data(struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2)\n{\n\treturn wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_tool_v2);\n}\n\nstatic inline uint32_t\nzwp_tablet_tool_v2_get_version(struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2)\n{\n\treturn wl_proxy_get_version((struct wl_proxy *) zwp_tablet_tool_v2);\n}\n\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n *\n * Sets the surface of the cursor used for this tool on the given\n * tablet. This request only takes effect if the tool is in proximity\n * of one of the requesting client's surfaces or the surface parameter\n * is the current pointer surface. If there was a previous surface set\n * with this request it is replaced. If surface is NULL, the cursor\n * image is hidden.\n *\n * The parameters hotspot_x and hotspot_y define the position of the\n * pointer surface relative to the pointer location. Its top-left corner\n * is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the\n * coordinates of the pointer location, in surface-local coordinates.\n *\n * On surface.attach requests to the pointer surface, hotspot_x and\n * hotspot_y are decremented by the x and y parameters passed to the\n * request. Attach must be confirmed by wl_surface.commit as usual.\n *\n * The hotspot can also be updated by passing the currently set pointer\n * surface to this request with new values for hotspot_x and hotspot_y.\n *\n * The current and pending input regions of the wl_surface are cleared,\n * and wl_surface.set_input_region is ignored until the wl_surface is no\n * longer used as the cursor. When the use as a cursor ends, the current\n * and pending input regions become undefined, and the wl_surface is\n * unmapped.\n *\n * This request gives the surface the role of a wp_tablet_tool cursor. A\n * surface may only ever be used as the cursor surface for one\n * wp_tablet_tool. If the surface already has another role or has\n * previously been used as cursor surface for a different tool, a\n * protocol error is raised.\n */\nstatic inline void\nzwp_tablet_tool_v2_set_cursor(struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2, uint32_t serial, struct wl_surface *surface, int32_t hotspot_x, int32_t hotspot_y)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_tool_v2,\n\t\t\t ZWP_TABLET_TOOL_V2_SET_CURSOR, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_tool_v2), 0, serial, surface, hotspot_x, hotspot_y);\n}\n\n/**\n * @ingroup iface_zwp_tablet_tool_v2\n *\n * This destroys the client's resource for this tool object.\n */\nstatic inline void\nzwp_tablet_tool_v2_destroy(struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_tool_v2,\n\t\t\t ZWP_TABLET_TOOL_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_tool_v2), WL_MARSHAL_FLAG_DESTROY);\n}\n\n#ifndef ZWP_TABLET_V2_BUSTYPE_ENUM\n#define ZWP_TABLET_V2_BUSTYPE_ENUM\n/**\n * @ingroup iface_zwp_tablet_v2\n * bus type \n *\n * Describes the bus types this tablet is connected to.\n */\nenum zwp_tablet_v2_bustype {\n\t/**\n\t * USB\n\t */\n\tZWP_TABLET_V2_BUSTYPE_USB = 3,\n\t/**\n\t * Bluetooth\n\t */\n\tZWP_TABLET_V2_BUSTYPE_BLUETOOTH = 5,\n\t/**\n\t * Virtual\n\t */\n\tZWP_TABLET_V2_BUSTYPE_VIRTUAL = 6,\n\t/**\n\t * Serial\n\t */\n\tZWP_TABLET_V2_BUSTYPE_SERIAL = 17,\n\t/**\n\t * I2C\n\t */\n\tZWP_TABLET_V2_BUSTYPE_I2C = 24,\n};\n#endif /* ZWP_TABLET_V2_BUSTYPE_ENUM */\n\n/**\n * @ingroup iface_zwp_tablet_v2\n * @struct zwp_tablet_v2_listener\n */\nstruct zwp_tablet_v2_listener {\n\t/**\n\t * tablet device name\n\t *\n\t * A descriptive name for the tablet device.\n\t *\n\t * If the device has no descriptive name, this event is not sent.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet.done event.\n\t * @param name the device name\n\t */\n\tvoid (*name)(void *data,\n\t\t     struct zwp_tablet_v2 *zwp_tablet_v2,\n\t\t     const char *name);\n\t/**\n\t * tablet device vendor/product id\n\t *\n\t * The vendor and product IDs for the tablet device.\n\t *\n\t * The interpretation of the id depends on the wp_tablet.bustype.\n\t * Prior to version v2 of this protocol, the id was implied to be a\n\t * USB vendor and product ID. If no wp_tablet.bustype is sent, the\n\t * ID is to be interpreted as USB vendor and product ID.\n\t *\n\t * If the device has no vendor/product ID, this event is not sent.\n\t * This can happen for virtual devices or non-USB devices, for\n\t * instance.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet.done event.\n\t * @param vid vendor id\n\t * @param pid product id\n\t */\n\tvoid (*id)(void *data,\n\t\t   struct zwp_tablet_v2 *zwp_tablet_v2,\n\t\t   uint32_t vid,\n\t\t   uint32_t pid);\n\t/**\n\t * path to the device\n\t *\n\t * A system-specific device path that indicates which device is\n\t * behind this wp_tablet. This information may be used to gather\n\t * additional information about the device, e.g. through libwacom.\n\t *\n\t * A device may have more than one device path. If so, multiple\n\t * wp_tablet.path events are sent. A device may be emulated and not\n\t * have a device path, and in that case this event will not be\n\t * sent.\n\t *\n\t * The format of the path is unspecified, it may be a device node,\n\t * a sysfs path, or some other identifier. It is up to the client\n\t * to identify the string provided.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet.done event.\n\t * @param path path to local device\n\t */\n\tvoid (*path)(void *data,\n\t\t     struct zwp_tablet_v2 *zwp_tablet_v2,\n\t\t     const char *path);\n\t/**\n\t * tablet description events sequence complete\n\t *\n\t * This event is sent immediately to signal the end of the\n\t * initial burst of descriptive events. A client may consider the\n\t * static description of the tablet to be complete and finalize\n\t * initialization of the tablet.\n\t */\n\tvoid (*done)(void *data,\n\t\t     struct zwp_tablet_v2 *zwp_tablet_v2);\n\t/**\n\t * tablet removed event\n\t *\n\t * Sent when the tablet has been removed from the system. When a\n\t * tablet is removed, some tools may be removed.\n\t *\n\t * When this event is received, the client must wp_tablet.destroy\n\t * the object.\n\t */\n\tvoid (*removed)(void *data,\n\t\t\tstruct zwp_tablet_v2 *zwp_tablet_v2);\n\t/**\n\t * tablet device bus type\n\t *\n\t * The bustype argument is one of the BUS_ defines in the Linux\n\t * kernel's linux/input.h\n\t *\n\t * If the device has no known bustype or the bustype cannot be\n\t * queried, this event is not sent.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet.done event.\n\t * @param bustype bus type\n\t * @since 2\n\t */\n\tvoid (*bustype)(void *data,\n\t\t\tstruct zwp_tablet_v2 *zwp_tablet_v2,\n\t\t\tuint32_t bustype);\n};\n\n/**\n * @ingroup iface_zwp_tablet_v2\n */\nstatic inline int\nzwp_tablet_v2_add_listener(struct zwp_tablet_v2 *zwp_tablet_v2,\n\t\t\t   const struct zwp_tablet_v2_listener *listener, void *data)\n{\n\treturn wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_v2,\n\t\t\t\t     (void (**)(void)) listener, data);\n}\n\n#define ZWP_TABLET_V2_DESTROY 0\n\n/**\n * @ingroup iface_zwp_tablet_v2\n */\n#define ZWP_TABLET_V2_NAME_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_v2\n */\n#define ZWP_TABLET_V2_ID_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_v2\n */\n#define ZWP_TABLET_V2_PATH_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_v2\n */\n#define ZWP_TABLET_V2_DONE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_v2\n */\n#define ZWP_TABLET_V2_REMOVED_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_v2\n */\n#define ZWP_TABLET_V2_BUSTYPE_SINCE_VERSION 2\n\n/**\n * @ingroup iface_zwp_tablet_v2\n */\n#define ZWP_TABLET_V2_DESTROY_SINCE_VERSION 1\n\n/** @ingroup iface_zwp_tablet_v2 */\nstatic inline void\nzwp_tablet_v2_set_user_data(struct zwp_tablet_v2 *zwp_tablet_v2, void *user_data)\n{\n\twl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_v2, user_data);\n}\n\n/** @ingroup iface_zwp_tablet_v2 */\nstatic inline void *\nzwp_tablet_v2_get_user_data(struct zwp_tablet_v2 *zwp_tablet_v2)\n{\n\treturn wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_v2);\n}\n\nstatic inline uint32_t\nzwp_tablet_v2_get_version(struct zwp_tablet_v2 *zwp_tablet_v2)\n{\n\treturn wl_proxy_get_version((struct wl_proxy *) zwp_tablet_v2);\n}\n\n/**\n * @ingroup iface_zwp_tablet_v2\n *\n * This destroys the client's resource for this tablet object.\n */\nstatic inline void\nzwp_tablet_v2_destroy(struct zwp_tablet_v2 *zwp_tablet_v2)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_v2,\n\t\t\t ZWP_TABLET_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_v2), WL_MARSHAL_FLAG_DESTROY);\n}\n\n#ifndef ZWP_TABLET_PAD_RING_V2_SOURCE_ENUM\n#define ZWP_TABLET_PAD_RING_V2_SOURCE_ENUM\n/**\n * @ingroup iface_zwp_tablet_pad_ring_v2\n * ring axis source\n *\n * Describes the source types for ring events. This indicates to the\n * client how a ring event was physically generated; a client may\n * adjust the user interface accordingly. For example, events\n * from a \"finger\" source may trigger kinetic scrolling.\n */\nenum zwp_tablet_pad_ring_v2_source {\n\t/**\n\t * finger\n\t */\n\tZWP_TABLET_PAD_RING_V2_SOURCE_FINGER = 1,\n};\n#endif /* ZWP_TABLET_PAD_RING_V2_SOURCE_ENUM */\n\n/**\n * @ingroup iface_zwp_tablet_pad_ring_v2\n * @struct zwp_tablet_pad_ring_v2_listener\n */\nstruct zwp_tablet_pad_ring_v2_listener {\n\t/**\n\t * ring event source\n\t *\n\t * Source information for ring events.\n\t *\n\t * This event does not occur on its own. It is sent before a\n\t * wp_tablet_pad_ring.frame event and carries the source\n\t * information for all events within that frame.\n\t *\n\t * The source specifies how this event was generated. If the source\n\t * is wp_tablet_pad_ring.source.finger, a wp_tablet_pad_ring.stop\n\t * event will be sent when the user lifts the finger off the\n\t * device.\n\t *\n\t * This event is optional. If the source is unknown for an\n\t * interaction, no event is sent.\n\t * @param source the event source\n\t */\n\tvoid (*source)(void *data,\n\t\t       struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2,\n\t\t       uint32_t source);\n\t/**\n\t * angle changed\n\t *\n\t * Sent whenever the angle on a ring changes.\n\t *\n\t * The angle is provided in degrees clockwise from the logical\n\t * north of the ring in the pad's current rotation.\n\t * @param degrees the current angle in degrees\n\t */\n\tvoid (*angle)(void *data,\n\t\t      struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2,\n\t\t      wl_fixed_t degrees);\n\t/**\n\t * interaction stopped\n\t *\n\t * Stop notification for ring events.\n\t *\n\t * For some wp_tablet_pad_ring.source types, a\n\t * wp_tablet_pad_ring.stop event is sent to notify a client that\n\t * the interaction with the ring has terminated. This enables the\n\t * client to implement kinetic scrolling. See the\n\t * wp_tablet_pad_ring.source documentation for information on when\n\t * this event may be generated.\n\t *\n\t * Any wp_tablet_pad_ring.angle events with the same source after\n\t * this event should be considered as the start of a new\n\t * interaction.\n\t */\n\tvoid (*stop)(void *data,\n\t\t     struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2);\n\t/**\n\t * end of a ring event sequence\n\t *\n\t * Indicates the end of a set of ring events that logically\n\t * belong together. A client is expected to accumulate the data in\n\t * all events within the frame before proceeding.\n\t *\n\t * All wp_tablet_pad_ring events before a wp_tablet_pad_ring.frame\n\t * event belong logically together. For example, on termination of\n\t * a finger interaction on a ring the compositor will send a\n\t * wp_tablet_pad_ring.source event, a wp_tablet_pad_ring.stop event\n\t * and a wp_tablet_pad_ring.frame event.\n\t *\n\t * A wp_tablet_pad_ring.frame event is sent for every logical event\n\t * group, even if the group only contains a single\n\t * wp_tablet_pad_ring event. Specifically, a client may get a\n\t * sequence: angle, frame, angle, frame, etc.\n\t * @param time timestamp with millisecond granularity\n\t */\n\tvoid (*frame)(void *data,\n\t\t      struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2,\n\t\t      uint32_t time);\n};\n\n/**\n * @ingroup iface_zwp_tablet_pad_ring_v2\n */\nstatic inline int\nzwp_tablet_pad_ring_v2_add_listener(struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2,\n\t\t\t\t    const struct zwp_tablet_pad_ring_v2_listener *listener, void *data)\n{\n\treturn wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_pad_ring_v2,\n\t\t\t\t     (void (**)(void)) listener, data);\n}\n\n#define ZWP_TABLET_PAD_RING_V2_SET_FEEDBACK 0\n#define ZWP_TABLET_PAD_RING_V2_DESTROY 1\n\n/**\n * @ingroup iface_zwp_tablet_pad_ring_v2\n */\n#define ZWP_TABLET_PAD_RING_V2_SOURCE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_ring_v2\n */\n#define ZWP_TABLET_PAD_RING_V2_ANGLE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_ring_v2\n */\n#define ZWP_TABLET_PAD_RING_V2_STOP_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_ring_v2\n */\n#define ZWP_TABLET_PAD_RING_V2_FRAME_SINCE_VERSION 1\n\n/**\n * @ingroup iface_zwp_tablet_pad_ring_v2\n */\n#define ZWP_TABLET_PAD_RING_V2_SET_FEEDBACK_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_ring_v2\n */\n#define ZWP_TABLET_PAD_RING_V2_DESTROY_SINCE_VERSION 1\n\n/** @ingroup iface_zwp_tablet_pad_ring_v2 */\nstatic inline void\nzwp_tablet_pad_ring_v2_set_user_data(struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2, void *user_data)\n{\n\twl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_pad_ring_v2, user_data);\n}\n\n/** @ingroup iface_zwp_tablet_pad_ring_v2 */\nstatic inline void *\nzwp_tablet_pad_ring_v2_get_user_data(struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2)\n{\n\treturn wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_pad_ring_v2);\n}\n\nstatic inline uint32_t\nzwp_tablet_pad_ring_v2_get_version(struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2)\n{\n\treturn wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_ring_v2);\n}\n\n/**\n * @ingroup iface_zwp_tablet_pad_ring_v2\n *\n * Request that the compositor use the provided feedback string\n * associated with this ring. This request should be issued immediately\n * after a wp_tablet_pad_group.mode_switch event from the corresponding\n * group is received, or whenever the ring is mapped to a different\n * action. See wp_tablet_pad_group.mode_switch for more details.\n *\n * Clients are encouraged to provide context-aware descriptions for\n * the actions associated with the ring; compositors may use this\n * information to offer visual feedback about the button layout\n * (eg. on-screen displays).\n *\n * The provided string 'description' is a UTF-8 encoded string to be\n * associated with this ring, and is considered user-visible; general\n * internationalization rules apply.\n *\n * The serial argument will be that of the last\n * wp_tablet_pad_group.mode_switch event received for the group of this\n * ring. Requests providing other serials than the most recent one will be\n * ignored.\n */\nstatic inline void\nzwp_tablet_pad_ring_v2_set_feedback(struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2, const char *description, uint32_t serial)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_ring_v2,\n\t\t\t ZWP_TABLET_PAD_RING_V2_SET_FEEDBACK, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_ring_v2), 0, description, serial);\n}\n\n/**\n * @ingroup iface_zwp_tablet_pad_ring_v2\n *\n * This destroys the client's resource for this ring object.\n */\nstatic inline void\nzwp_tablet_pad_ring_v2_destroy(struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_ring_v2,\n\t\t\t ZWP_TABLET_PAD_RING_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_ring_v2), WL_MARSHAL_FLAG_DESTROY);\n}\n\n#ifndef ZWP_TABLET_PAD_STRIP_V2_SOURCE_ENUM\n#define ZWP_TABLET_PAD_STRIP_V2_SOURCE_ENUM\n/**\n * @ingroup iface_zwp_tablet_pad_strip_v2\n * strip axis source\n *\n * Describes the source types for strip events. This indicates to the\n * client how a strip event was physically generated; a client may\n * adjust the user interface accordingly. For example, events\n * from a \"finger\" source may trigger kinetic scrolling.\n */\nenum zwp_tablet_pad_strip_v2_source {\n\t/**\n\t * finger\n\t */\n\tZWP_TABLET_PAD_STRIP_V2_SOURCE_FINGER = 1,\n};\n#endif /* ZWP_TABLET_PAD_STRIP_V2_SOURCE_ENUM */\n\n/**\n * @ingroup iface_zwp_tablet_pad_strip_v2\n * @struct zwp_tablet_pad_strip_v2_listener\n */\nstruct zwp_tablet_pad_strip_v2_listener {\n\t/**\n\t * strip event source\n\t *\n\t * Source information for strip events.\n\t *\n\t * This event does not occur on its own. It is sent before a\n\t * wp_tablet_pad_strip.frame event and carries the source\n\t * information for all events within that frame.\n\t *\n\t * The source specifies how this event was generated. If the source\n\t * is wp_tablet_pad_strip.source.finger, a wp_tablet_pad_strip.stop\n\t * event will be sent when the user lifts their finger off the\n\t * device.\n\t *\n\t * This event is optional. If the source is unknown for an\n\t * interaction, no event is sent.\n\t * @param source the event source\n\t */\n\tvoid (*source)(void *data,\n\t\t       struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2,\n\t\t       uint32_t source);\n\t/**\n\t * position changed\n\t *\n\t * Sent whenever the position on a strip changes.\n\t *\n\t * The position is normalized to a range of [0, 65535], the 0-value\n\t * represents the top-most and/or left-most position of the strip\n\t * in the pad's current rotation.\n\t * @param position the current position\n\t */\n\tvoid (*position)(void *data,\n\t\t\t struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2,\n\t\t\t uint32_t position);\n\t/**\n\t * interaction stopped\n\t *\n\t * Stop notification for strip events.\n\t *\n\t * For some wp_tablet_pad_strip.source types, a\n\t * wp_tablet_pad_strip.stop event is sent to notify a client that\n\t * the interaction with the strip has terminated. This enables the\n\t * client to implement kinetic scrolling. See the\n\t * wp_tablet_pad_strip.source documentation for information on when\n\t * this event may be generated.\n\t *\n\t * Any wp_tablet_pad_strip.position events with the same source\n\t * after this event should be considered as the start of a new\n\t * interaction.\n\t */\n\tvoid (*stop)(void *data,\n\t\t     struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2);\n\t/**\n\t * end of a strip event sequence\n\t *\n\t * Indicates the end of a set of events that represent one\n\t * logical hardware strip event. A client is expected to accumulate\n\t * the data in all events within the frame before proceeding.\n\t *\n\t * All wp_tablet_pad_strip events before a\n\t * wp_tablet_pad_strip.frame event belong logically together. For\n\t * example, on termination of a finger interaction on a strip the\n\t * compositor will send a wp_tablet_pad_strip.source event, a\n\t * wp_tablet_pad_strip.stop event and a wp_tablet_pad_strip.frame\n\t * event.\n\t *\n\t * A wp_tablet_pad_strip.frame event is sent for every logical\n\t * event group, even if the group only contains a single\n\t * wp_tablet_pad_strip event. Specifically, a client may get a\n\t * sequence: position, frame, position, frame, etc.\n\t * @param time timestamp with millisecond granularity\n\t */\n\tvoid (*frame)(void *data,\n\t\t      struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2,\n\t\t      uint32_t time);\n};\n\n/**\n * @ingroup iface_zwp_tablet_pad_strip_v2\n */\nstatic inline int\nzwp_tablet_pad_strip_v2_add_listener(struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2,\n\t\t\t\t     const struct zwp_tablet_pad_strip_v2_listener *listener, void *data)\n{\n\treturn wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_pad_strip_v2,\n\t\t\t\t     (void (**)(void)) listener, data);\n}\n\n#define ZWP_TABLET_PAD_STRIP_V2_SET_FEEDBACK 0\n#define ZWP_TABLET_PAD_STRIP_V2_DESTROY 1\n\n/**\n * @ingroup iface_zwp_tablet_pad_strip_v2\n */\n#define ZWP_TABLET_PAD_STRIP_V2_SOURCE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_strip_v2\n */\n#define ZWP_TABLET_PAD_STRIP_V2_POSITION_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_strip_v2\n */\n#define ZWP_TABLET_PAD_STRIP_V2_STOP_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_strip_v2\n */\n#define ZWP_TABLET_PAD_STRIP_V2_FRAME_SINCE_VERSION 1\n\n/**\n * @ingroup iface_zwp_tablet_pad_strip_v2\n */\n#define ZWP_TABLET_PAD_STRIP_V2_SET_FEEDBACK_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_strip_v2\n */\n#define ZWP_TABLET_PAD_STRIP_V2_DESTROY_SINCE_VERSION 1\n\n/** @ingroup iface_zwp_tablet_pad_strip_v2 */\nstatic inline void\nzwp_tablet_pad_strip_v2_set_user_data(struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2, void *user_data)\n{\n\twl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_pad_strip_v2, user_data);\n}\n\n/** @ingroup iface_zwp_tablet_pad_strip_v2 */\nstatic inline void *\nzwp_tablet_pad_strip_v2_get_user_data(struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2)\n{\n\treturn wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_pad_strip_v2);\n}\n\nstatic inline uint32_t\nzwp_tablet_pad_strip_v2_get_version(struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2)\n{\n\treturn wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_strip_v2);\n}\n\n/**\n * @ingroup iface_zwp_tablet_pad_strip_v2\n *\n * Requests the compositor to use the provided feedback string\n * associated with this strip. This request should be issued immediately\n * after a wp_tablet_pad_group.mode_switch event from the corresponding\n * group is received, or whenever the strip is mapped to a different\n * action. See wp_tablet_pad_group.mode_switch for more details.\n *\n * Clients are encouraged to provide context-aware descriptions for\n * the actions associated with the strip, and compositors may use this\n * information to offer visual feedback about the button layout\n * (eg. on-screen displays).\n *\n * The provided string 'description' is a UTF-8 encoded string to be\n * associated with this ring, and is considered user-visible; general\n * internationalization rules apply.\n *\n * The serial argument will be that of the last\n * wp_tablet_pad_group.mode_switch event received for the group of this\n * strip. Requests providing other serials than the most recent one will be\n * ignored.\n */\nstatic inline void\nzwp_tablet_pad_strip_v2_set_feedback(struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2, const char *description, uint32_t serial)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_strip_v2,\n\t\t\t ZWP_TABLET_PAD_STRIP_V2_SET_FEEDBACK, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_strip_v2), 0, description, serial);\n}\n\n/**\n * @ingroup iface_zwp_tablet_pad_strip_v2\n *\n * This destroys the client's resource for this strip object.\n */\nstatic inline void\nzwp_tablet_pad_strip_v2_destroy(struct zwp_tablet_pad_strip_v2 *zwp_tablet_pad_strip_v2)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_strip_v2,\n\t\t\t ZWP_TABLET_PAD_STRIP_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_strip_v2), WL_MARSHAL_FLAG_DESTROY);\n}\n\n/**\n * @ingroup iface_zwp_tablet_pad_group_v2\n * @struct zwp_tablet_pad_group_v2_listener\n */\nstruct zwp_tablet_pad_group_v2_listener {\n\t/**\n\t * buttons announced\n\t *\n\t * Sent on wp_tablet_pad_group initialization to announce the\n\t * available buttons in the group. Button indices start at 0, a\n\t * button may only be in one group at a time.\n\t *\n\t * This event is first sent in the initial burst of events before\n\t * the wp_tablet_pad_group.done event.\n\t *\n\t * Some buttons are reserved by the compositor. These buttons may\n\t * not be assigned to any wp_tablet_pad_group. Compositors may\n\t * broadcast this event in the case of changes to the mapping of\n\t * these reserved buttons. If the compositor happens to reserve all\n\t * buttons in a group, this event will be sent with an empty array.\n\t * @param buttons buttons in this group\n\t */\n\tvoid (*buttons)(void *data,\n\t\t\tstruct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,\n\t\t\tstruct wl_array *buttons);\n\t/**\n\t * ring announced\n\t *\n\t * Sent on wp_tablet_pad_group initialization to announce\n\t * available rings. One event is sent for each ring available on\n\t * this pad group.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet_pad_group.done event.\n\t */\n\tvoid (*ring)(void *data,\n\t\t     struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,\n\t\t     struct zwp_tablet_pad_ring_v2 *ring);\n\t/**\n\t * strip announced\n\t *\n\t * Sent on wp_tablet_pad initialization to announce available\n\t * strips. One event is sent for each strip available on this pad\n\t * group.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet_pad_group.done event.\n\t */\n\tvoid (*strip)(void *data,\n\t\t      struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,\n\t\t      struct zwp_tablet_pad_strip_v2 *strip);\n\t/**\n\t * mode-switch ability announced\n\t *\n\t * Sent on wp_tablet_pad_group initialization to announce that\n\t * the pad group may switch between modes. A client may use a mode\n\t * to store a specific configuration for buttons, rings and strips\n\t * and use the wl_tablet_pad_group.mode_switch event to toggle\n\t * between these configurations. Mode indices start at 0.\n\t *\n\t * Switching modes is compositor-dependent. See the\n\t * wp_tablet_pad_group.mode_switch event for more details.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet_pad_group.done event. This event is only sent when\n\t * more than more than one mode is available.\n\t * @param modes the number of modes\n\t */\n\tvoid (*modes)(void *data,\n\t\t      struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,\n\t\t      uint32_t modes);\n\t/**\n\t * tablet group description events sequence complete\n\t *\n\t * This event is sent immediately to signal the end of the\n\t * initial burst of descriptive events. A client may consider the\n\t * static description of the tablet to be complete and finalize\n\t * initialization of the tablet group.\n\t */\n\tvoid (*done)(void *data,\n\t\t     struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2);\n\t/**\n\t * mode switch event\n\t *\n\t * Notification that the mode was switched.\n\t *\n\t * A mode applies to all buttons, rings, strips and dials in a\n\t * group simultaneously, but a client is not required to assign\n\t * different actions for each mode. For example, a client may have\n\t * mode-specific button mappings but map the ring to vertical\n\t * scrolling in all modes. Mode indices start at 0.\n\t *\n\t * Switching modes is compositor-dependent. The compositor may\n\t * provide visual cues to the user about the mode, e.g. by toggling\n\t * LEDs on the tablet device. Mode-switching may be\n\t * software-controlled or controlled by one or more physical\n\t * buttons. For example, on a Wacom Intuos Pro, the button inside\n\t * the ring may be assigned to switch between modes.\n\t *\n\t * The compositor will also send this event after\n\t * wp_tablet_pad.enter on each group in order to notify of the\n\t * current mode. Groups that only feature one mode will use mode=0\n\t * when emitting this event.\n\t *\n\t * If a button action in the new mode differs from the action in\n\t * the previous mode, the client should immediately issue a\n\t * wp_tablet_pad.set_feedback request for each changed button.\n\t *\n\t * If a ring, strip or dial action in the new mode differs from the\n\t * action in the previous mode, the client should immediately issue\n\t * a wp_tablet_ring.set_feedback, wp_tablet_strip.set_feedback or\n\t * wp_tablet_dial.set_feedback request for each changed ring, strip\n\t * or dial.\n\t * @param time the time of the event with millisecond granularity\n\t * @param mode the new mode of the pad\n\t */\n\tvoid (*mode_switch)(void *data,\n\t\t\t    struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,\n\t\t\t    uint32_t time,\n\t\t\t    uint32_t serial,\n\t\t\t    uint32_t mode);\n\t/**\n\t * dial announced\n\t *\n\t * Sent on wp_tablet_pad initialization to announce available\n\t * dials. One event is sent for each dial available on this pad\n\t * group.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet_pad_group.done event.\n\t * @since 2\n\t */\n\tvoid (*dial)(void *data,\n\t\t     struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,\n\t\t     struct zwp_tablet_pad_dial_v2 *dial);\n};\n\n/**\n * @ingroup iface_zwp_tablet_pad_group_v2\n */\nstatic inline int\nzwp_tablet_pad_group_v2_add_listener(struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2,\n\t\t\t\t     const struct zwp_tablet_pad_group_v2_listener *listener, void *data)\n{\n\treturn wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_pad_group_v2,\n\t\t\t\t     (void (**)(void)) listener, data);\n}\n\n#define ZWP_TABLET_PAD_GROUP_V2_DESTROY 0\n\n/**\n * @ingroup iface_zwp_tablet_pad_group_v2\n */\n#define ZWP_TABLET_PAD_GROUP_V2_BUTTONS_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_group_v2\n */\n#define ZWP_TABLET_PAD_GROUP_V2_RING_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_group_v2\n */\n#define ZWP_TABLET_PAD_GROUP_V2_STRIP_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_group_v2\n */\n#define ZWP_TABLET_PAD_GROUP_V2_MODES_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_group_v2\n */\n#define ZWP_TABLET_PAD_GROUP_V2_DONE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_group_v2\n */\n#define ZWP_TABLET_PAD_GROUP_V2_MODE_SWITCH_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_group_v2\n */\n#define ZWP_TABLET_PAD_GROUP_V2_DIAL_SINCE_VERSION 2\n\n/**\n * @ingroup iface_zwp_tablet_pad_group_v2\n */\n#define ZWP_TABLET_PAD_GROUP_V2_DESTROY_SINCE_VERSION 1\n\n/** @ingroup iface_zwp_tablet_pad_group_v2 */\nstatic inline void\nzwp_tablet_pad_group_v2_set_user_data(struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2, void *user_data)\n{\n\twl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_pad_group_v2, user_data);\n}\n\n/** @ingroup iface_zwp_tablet_pad_group_v2 */\nstatic inline void *\nzwp_tablet_pad_group_v2_get_user_data(struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2)\n{\n\treturn wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_pad_group_v2);\n}\n\nstatic inline uint32_t\nzwp_tablet_pad_group_v2_get_version(struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2)\n{\n\treturn wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_group_v2);\n}\n\n/**\n * @ingroup iface_zwp_tablet_pad_group_v2\n *\n * Destroy the wp_tablet_pad_group object. Objects created from this object\n * are unaffected and should be destroyed separately.\n */\nstatic inline void\nzwp_tablet_pad_group_v2_destroy(struct zwp_tablet_pad_group_v2 *zwp_tablet_pad_group_v2)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_group_v2,\n\t\t\t ZWP_TABLET_PAD_GROUP_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_group_v2), WL_MARSHAL_FLAG_DESTROY);\n}\n\n#ifndef ZWP_TABLET_PAD_V2_BUTTON_STATE_ENUM\n#define ZWP_TABLET_PAD_V2_BUTTON_STATE_ENUM\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n * physical button state\n *\n * Describes the physical state of a button that caused the button\n * event.\n */\nenum zwp_tablet_pad_v2_button_state {\n\t/**\n\t * the button is not pressed\n\t */\n\tZWP_TABLET_PAD_V2_BUTTON_STATE_RELEASED = 0,\n\t/**\n\t * the button is pressed\n\t */\n\tZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED = 1,\n};\n#endif /* ZWP_TABLET_PAD_V2_BUTTON_STATE_ENUM */\n\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n * @struct zwp_tablet_pad_v2_listener\n */\nstruct zwp_tablet_pad_v2_listener {\n\t/**\n\t * group announced\n\t *\n\t * Sent on wp_tablet_pad initialization to announce available\n\t * groups. One event is sent for each pad group available.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet_pad.done event. At least one group will be announced.\n\t */\n\tvoid (*group)(void *data,\n\t\t      struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,\n\t\t      struct zwp_tablet_pad_group_v2 *pad_group);\n\t/**\n\t * path to the device\n\t *\n\t * A system-specific device path that indicates which device is\n\t * behind this wp_tablet_pad. This information may be used to\n\t * gather additional information about the device, e.g. through\n\t * libwacom.\n\t *\n\t * The format of the path is unspecified, it may be a device node,\n\t * a sysfs path, or some other identifier. It is up to the client\n\t * to identify the string provided.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet_pad.done event.\n\t * @param path path to local device\n\t */\n\tvoid (*path)(void *data,\n\t\t     struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,\n\t\t     const char *path);\n\t/**\n\t * buttons announced\n\t *\n\t * Sent on wp_tablet_pad initialization to announce the available\n\t * buttons.\n\t *\n\t * This event is sent in the initial burst of events before the\n\t * wp_tablet_pad.done event. This event is only sent when at least\n\t * one button is available.\n\t * @param buttons the number of buttons\n\t */\n\tvoid (*buttons)(void *data,\n\t\t\tstruct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,\n\t\t\tuint32_t buttons);\n\t/**\n\t * pad description event sequence complete\n\t *\n\t * This event signals the end of the initial burst of descriptive\n\t * events. A client may consider the static description of the pad\n\t * to be complete and finalize initialization of the pad.\n\t */\n\tvoid (*done)(void *data,\n\t\t     struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2);\n\t/**\n\t * physical button state\n\t *\n\t * Sent whenever the physical state of a button changes.\n\t * @param time the time of the event with millisecond granularity\n\t * @param button the index of the button that changed state\n\t */\n\tvoid (*button)(void *data,\n\t\t       struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,\n\t\t       uint32_t time,\n\t\t       uint32_t button,\n\t\t       uint32_t state);\n\t/**\n\t * enter event\n\t *\n\t * Notification that this pad is focused on the specified\n\t * surface.\n\t * @param serial serial number of the enter event\n\t * @param tablet the tablet the pad is attached to\n\t * @param surface surface the pad is focused on\n\t */\n\tvoid (*enter)(void *data,\n\t\t      struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,\n\t\t      uint32_t serial,\n\t\t      struct zwp_tablet_v2 *tablet,\n\t\t      struct wl_surface *surface);\n\t/**\n\t * leave event\n\t *\n\t * Notification that this pad is no longer focused on the\n\t * specified surface.\n\t * @param serial serial number of the leave event\n\t * @param surface surface the pad is no longer focused on\n\t */\n\tvoid (*leave)(void *data,\n\t\t      struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,\n\t\t      uint32_t serial,\n\t\t      struct wl_surface *surface);\n\t/**\n\t * pad removed event\n\t *\n\t * Sent when the pad has been removed from the system. When a\n\t * tablet is removed its pad(s) will be removed too.\n\t *\n\t * When this event is received, the client must destroy all rings,\n\t * strips and groups that were offered by this pad, and issue\n\t * wp_tablet_pad.destroy the pad itself.\n\t */\n\tvoid (*removed)(void *data,\n\t\t\tstruct zwp_tablet_pad_v2 *zwp_tablet_pad_v2);\n};\n\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n */\nstatic inline int\nzwp_tablet_pad_v2_add_listener(struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2,\n\t\t\t       const struct zwp_tablet_pad_v2_listener *listener, void *data)\n{\n\treturn wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_pad_v2,\n\t\t\t\t     (void (**)(void)) listener, data);\n}\n\n#define ZWP_TABLET_PAD_V2_SET_FEEDBACK 0\n#define ZWP_TABLET_PAD_V2_DESTROY 1\n\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n */\n#define ZWP_TABLET_PAD_V2_GROUP_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n */\n#define ZWP_TABLET_PAD_V2_PATH_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n */\n#define ZWP_TABLET_PAD_V2_BUTTONS_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n */\n#define ZWP_TABLET_PAD_V2_DONE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n */\n#define ZWP_TABLET_PAD_V2_BUTTON_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n */\n#define ZWP_TABLET_PAD_V2_ENTER_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n */\n#define ZWP_TABLET_PAD_V2_LEAVE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n */\n#define ZWP_TABLET_PAD_V2_REMOVED_SINCE_VERSION 1\n\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n */\n#define ZWP_TABLET_PAD_V2_SET_FEEDBACK_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n */\n#define ZWP_TABLET_PAD_V2_DESTROY_SINCE_VERSION 1\n\n/** @ingroup iface_zwp_tablet_pad_v2 */\nstatic inline void\nzwp_tablet_pad_v2_set_user_data(struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2, void *user_data)\n{\n\twl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_pad_v2, user_data);\n}\n\n/** @ingroup iface_zwp_tablet_pad_v2 */\nstatic inline void *\nzwp_tablet_pad_v2_get_user_data(struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2)\n{\n\treturn wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_pad_v2);\n}\n\nstatic inline uint32_t\nzwp_tablet_pad_v2_get_version(struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2)\n{\n\treturn wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_v2);\n}\n\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n *\n * Requests the compositor to use the provided feedback string\n * associated with this button. This request should be issued immediately\n * after a wp_tablet_pad_group.mode_switch event from the corresponding\n * group is received, or whenever a button is mapped to a different\n * action. See wp_tablet_pad_group.mode_switch for more details.\n *\n * Clients are encouraged to provide context-aware descriptions for\n * the actions associated with each button, and compositors may use\n * this information to offer visual feedback on the button layout\n * (e.g. on-screen displays).\n *\n * Button indices start at 0. Setting the feedback string on a button\n * that is reserved by the compositor (i.e. not belonging to any\n * wp_tablet_pad_group) does not generate an error but the compositor\n * is free to ignore the request.\n *\n * The provided string 'description' is a UTF-8 encoded string to be\n * associated with this ring, and is considered user-visible; general\n * internationalization rules apply.\n *\n * The serial argument will be that of the last\n * wp_tablet_pad_group.mode_switch event received for the group of this\n * button. Requests providing other serials than the most recent one will\n * be ignored.\n */\nstatic inline void\nzwp_tablet_pad_v2_set_feedback(struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2, uint32_t button, const char *description, uint32_t serial)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_v2,\n\t\t\t ZWP_TABLET_PAD_V2_SET_FEEDBACK, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_v2), 0, button, description, serial);\n}\n\n/**\n * @ingroup iface_zwp_tablet_pad_v2\n *\n * Destroy the wp_tablet_pad object. Objects created from this object\n * are unaffected and should be destroyed separately.\n */\nstatic inline void\nzwp_tablet_pad_v2_destroy(struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_v2,\n\t\t\t ZWP_TABLET_PAD_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_v2), WL_MARSHAL_FLAG_DESTROY);\n}\n\n/**\n * @ingroup iface_zwp_tablet_pad_dial_v2\n * @struct zwp_tablet_pad_dial_v2_listener\n */\nstruct zwp_tablet_pad_dial_v2_listener {\n\t/**\n\t * delta movement\n\t *\n\t * Sent whenever the position on a dial changes.\n\t *\n\t * This event carries the wheel delta as multiples or fractions of\n\t * 120 with each multiple of 120 representing one logical wheel\n\t * detent. For example, an axis_value120 of 30 is one quarter of a\n\t * logical wheel step in the positive direction, a value120 of -240\n\t * are two logical wheel steps in the negative direction within the\n\t * same hardware event. See the wl_pointer.axis_value120 for more\n\t * details.\n\t *\n\t * The value120 must not be zero.\n\t * @param value120 rotation distance as fraction of 120\n\t */\n\tvoid (*delta)(void *data,\n\t\t      struct zwp_tablet_pad_dial_v2 *zwp_tablet_pad_dial_v2,\n\t\t      int32_t value120);\n\t/**\n\t * end of a dial event sequence\n\t *\n\t * Indicates the end of a set of events that represent one\n\t * logical hardware dial event. A client is expected to accumulate\n\t * the data in all events within the frame before proceeding.\n\t *\n\t * All wp_tablet_pad_dial events before a wp_tablet_pad_dial.frame\n\t * event belong logically together.\n\t *\n\t * A wp_tablet_pad_dial.frame event is sent for every logical event\n\t * group, even if the group only contains a single\n\t * wp_tablet_pad_dial event. Specifically, a client may get a\n\t * sequence: delta, frame, delta, frame, etc.\n\t * @param time timestamp with millisecond granularity\n\t */\n\tvoid (*frame)(void *data,\n\t\t      struct zwp_tablet_pad_dial_v2 *zwp_tablet_pad_dial_v2,\n\t\t      uint32_t time);\n};\n\n/**\n * @ingroup iface_zwp_tablet_pad_dial_v2\n */\nstatic inline int\nzwp_tablet_pad_dial_v2_add_listener(struct zwp_tablet_pad_dial_v2 *zwp_tablet_pad_dial_v2,\n\t\t\t\t    const struct zwp_tablet_pad_dial_v2_listener *listener, void *data)\n{\n\treturn wl_proxy_add_listener((struct wl_proxy *) zwp_tablet_pad_dial_v2,\n\t\t\t\t     (void (**)(void)) listener, data);\n}\n\n#define ZWP_TABLET_PAD_DIAL_V2_SET_FEEDBACK 0\n#define ZWP_TABLET_PAD_DIAL_V2_DESTROY 1\n\n/**\n * @ingroup iface_zwp_tablet_pad_dial_v2\n */\n#define ZWP_TABLET_PAD_DIAL_V2_DELTA_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_dial_v2\n */\n#define ZWP_TABLET_PAD_DIAL_V2_FRAME_SINCE_VERSION 1\n\n/**\n * @ingroup iface_zwp_tablet_pad_dial_v2\n */\n#define ZWP_TABLET_PAD_DIAL_V2_SET_FEEDBACK_SINCE_VERSION 1\n/**\n * @ingroup iface_zwp_tablet_pad_dial_v2\n */\n#define ZWP_TABLET_PAD_DIAL_V2_DESTROY_SINCE_VERSION 1\n\n/** @ingroup iface_zwp_tablet_pad_dial_v2 */\nstatic inline void\nzwp_tablet_pad_dial_v2_set_user_data(struct zwp_tablet_pad_dial_v2 *zwp_tablet_pad_dial_v2, void *user_data)\n{\n\twl_proxy_set_user_data((struct wl_proxy *) zwp_tablet_pad_dial_v2, user_data);\n}\n\n/** @ingroup iface_zwp_tablet_pad_dial_v2 */\nstatic inline void *\nzwp_tablet_pad_dial_v2_get_user_data(struct zwp_tablet_pad_dial_v2 *zwp_tablet_pad_dial_v2)\n{\n\treturn wl_proxy_get_user_data((struct wl_proxy *) zwp_tablet_pad_dial_v2);\n}\n\nstatic inline uint32_t\nzwp_tablet_pad_dial_v2_get_version(struct zwp_tablet_pad_dial_v2 *zwp_tablet_pad_dial_v2)\n{\n\treturn wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_dial_v2);\n}\n\n/**\n * @ingroup iface_zwp_tablet_pad_dial_v2\n *\n * Requests the compositor to use the provided feedback string\n * associated with this dial. This request should be issued immediately\n * after a wp_tablet_pad_group.mode_switch event from the corresponding\n * group is received, or whenever the dial is mapped to a different\n * action. See wp_tablet_pad_group.mode_switch for more details.\n *\n * Clients are encouraged to provide context-aware descriptions for\n * the actions associated with the dial, and compositors may use this\n * information to offer visual feedback about the button layout\n * (eg. on-screen displays).\n *\n * The provided string 'description' is a UTF-8 encoded string to be\n * associated with this ring, and is considered user-visible; general\n * internationalization rules apply.\n *\n * The serial argument will be that of the last\n * wp_tablet_pad_group.mode_switch event received for the group of this\n * dial. Requests providing other serials than the most recent one will be\n * ignored.\n */\nstatic inline void\nzwp_tablet_pad_dial_v2_set_feedback(struct zwp_tablet_pad_dial_v2 *zwp_tablet_pad_dial_v2, const char *description, uint32_t serial)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_dial_v2,\n\t\t\t ZWP_TABLET_PAD_DIAL_V2_SET_FEEDBACK, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_dial_v2), 0, description, serial);\n}\n\n/**\n * @ingroup iface_zwp_tablet_pad_dial_v2\n *\n * This destroys the client's resource for this dial object.\n */\nstatic inline void\nzwp_tablet_pad_dial_v2_destroy(struct zwp_tablet_pad_dial_v2 *zwp_tablet_pad_dial_v2)\n{\n\twl_proxy_marshal_flags((struct wl_proxy *) zwp_tablet_pad_dial_v2,\n\t\t\t ZWP_TABLET_PAD_DIAL_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_tablet_pad_dial_v2), WL_MARSHAL_FLAG_DESTROY);\n}\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "pkg/wayland/wayland.c",
    "content": "#include \"wayland.h\"\n#include \"keyboard-shortcuts-inhibit-client.h\"\n#include \"tablet-v2.h\"\n#include \"wlr-layer-shell-client.h\"\n#include <stdbool.h>\n#include <stdint.h>\n#include <string.h>\n#include <sys/mman.h>\n#include <unistd.h>\n\n#ifndef __has_attribute\n#define __has_attribute(x) 0\n#endif\n\n#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)\n#define WL_PRIVATE __attribute__((visibility(\"hidden\")))\n#else\n#define WL_PRIVATE\n#endif\n\nextern const struct wl_interface wl_output_interface;\nextern const struct wl_interface wl_surface_interface;\nextern const struct wl_interface zwlr_layer_surface_v1_interface;\n\nstatic const struct wl_interface xdg_popup_interface = {\n    \"xdg_popup\", 0, 0, NULL, 0, NULL,\n};\n\nstatic const struct wl_interface *wlr_layer_shell_unstable_v1_types[] = {\n    NULL,\n    NULL,\n    NULL,\n    NULL,\n    &zwlr_layer_surface_v1_interface,\n    &wl_surface_interface,\n    &wl_output_interface,\n    NULL,\n    NULL,\n    &xdg_popup_interface,\n};\n\nstatic const struct wl_message zwlr_layer_shell_v1_requests[] = {\n    {\"get_layer_surface\", \"no?ous\", wlr_layer_shell_unstable_v1_types + 4},\n    {\"destroy\", \"3\", wlr_layer_shell_unstable_v1_types + 0},\n};\n\nWL_PRIVATE const struct wl_interface zwlr_layer_shell_v1_interface = {\n    \"zwlr_layer_shell_v1\", 4, 2, zwlr_layer_shell_v1_requests, 0, NULL,\n};\n\nstatic const struct wl_message zwlr_layer_surface_v1_requests[] = {\n    {\"set_size\", \"uu\", wlr_layer_shell_unstable_v1_types + 0},\n    {\"set_anchor\", \"u\", wlr_layer_shell_unstable_v1_types + 0},\n    {\"set_exclusive_zone\", \"i\", wlr_layer_shell_unstable_v1_types + 0},\n    {\"set_margin\", \"iiii\", wlr_layer_shell_unstable_v1_types + 0},\n    {\"set_keyboard_interactivity\", \"u\", wlr_layer_shell_unstable_v1_types + 0},\n    {\"get_popup\", \"o\", wlr_layer_shell_unstable_v1_types + 9},\n    {\"ack_configure\", \"u\", wlr_layer_shell_unstable_v1_types + 0},\n    {\"destroy\", \"\", wlr_layer_shell_unstable_v1_types + 0},\n    {\"set_layer\", \"2u\", wlr_layer_shell_unstable_v1_types + 0},\n};\n\nstatic const struct wl_message zwlr_layer_surface_v1_events[] = {\n    {\"configure\", \"uuu\", wlr_layer_shell_unstable_v1_types + 0},\n    {\"closed\", \"\", wlr_layer_shell_unstable_v1_types + 0},\n};\n\nWL_PRIVATE const struct wl_interface zwlr_layer_surface_v1_interface = {\n    \"zwlr_layer_surface_v1\",        4, 9,\n    zwlr_layer_surface_v1_requests, 2, zwlr_layer_surface_v1_events,\n};\n\nstatic const struct wl_interface\n    *keyboard_shortcuts_inhibit_unstable_v1_types[] = {\n        &zwp_keyboard_shortcuts_inhibitor_v1_interface,\n        &wl_surface_interface,\n        &wl_seat_interface,\n};\n\nstatic const struct wl_message\n    zwp_keyboard_shortcuts_inhibit_manager_v1_requests[] = {\n        {\"destroy\", \"\", keyboard_shortcuts_inhibit_unstable_v1_types + 0},\n        {\"inhibit_shortcuts\", \"noo\",\n         keyboard_shortcuts_inhibit_unstable_v1_types + 0},\n};\n\nWL_PRIVATE const struct wl_interface\n    zwp_keyboard_shortcuts_inhibit_manager_v1_interface = {\n        \"zwp_keyboard_shortcuts_inhibit_manager_v1\",        1, 2,\n        zwp_keyboard_shortcuts_inhibit_manager_v1_requests, 0, NULL,\n};\n\nstatic const struct wl_message zwp_keyboard_shortcuts_inhibitor_v1_requests[] =\n    {\n        {\"destroy\", \"\", keyboard_shortcuts_inhibit_unstable_v1_types + 0},\n};\n\nstatic const struct wl_message zwp_keyboard_shortcuts_inhibitor_v1_events[] = {\n    {\"active\", \"\", keyboard_shortcuts_inhibit_unstable_v1_types + 0},\n    {\"inactive\", \"\", keyboard_shortcuts_inhibit_unstable_v1_types + 0},\n};\n\nWL_PRIVATE const struct wl_interface\n    zwp_keyboard_shortcuts_inhibitor_v1_interface = {\n        \"zwp_keyboard_shortcuts_inhibitor_v1\",\n        1,\n        1,\n        zwp_keyboard_shortcuts_inhibitor_v1_requests,\n        2,\n        zwp_keyboard_shortcuts_inhibitor_v1_events,\n};\n\nstruct wl_compositor *compositor = NULL;\nstruct zwlr_layer_shell_v1 *layer_shell = NULL;\nstruct wl_seat *seat = NULL;\nstruct wl_pointer *pointer = NULL;\nstruct wl_touch *touch = NULL;\nstruct wl_keyboard *keyboard = NULL;\nstruct zwp_tablet_manager_v2 *tablet_manager = NULL;\nstruct zwp_tablet_tool_v2 *tablet_tool = NULL;\nstruct zwp_tablet_seat_v2 *tablet_seat = NULL;\nstruct zwp_keyboard_shortcuts_inhibit_manager_v1 *shortcuts_inhibit_manager =\n    NULL;\nstruct zwp_keyboard_shortcuts_inhibitor_v1 *shortcuts_inhibitor = NULL;\nstruct zwlr_layer_surface_v1 *layer_surface_global = NULL;\nstruct xkb_context *xkb_context;\nstruct xkb_keymap *xkb_keymap;\nstruct xkb_state *xkb_state;\nint32_t width_global = 0;\nint32_t height_global = 0;\n\nvoid layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface,\n                             uint32_t serial, uint32_t width, uint32_t height) {\n  width_global = width;\n  height_global = height;\n  zwlr_layer_surface_v1_ack_configure(surface, serial);\n}\n\nvoid layer_surface_closed(void *data, struct zwlr_layer_surface_v1 *surface) {}\n\nstatic struct zwlr_layer_surface_v1_listener layer_surface_listener = {\n    .configure = layer_surface_configure,\n    .closed = layer_surface_closed,\n};\n\n// Forward declarations for seat\nvoid seat_capabilities(void *data, struct wl_seat *seat, uint32_t capabilities);\nvoid seat_name(void *data, struct wl_seat *seat, const char *name);\n\nstatic const struct wl_seat_listener seat_listener = {\n    .capabilities = seat_capabilities,\n    .name = seat_name,\n};\n\nvoid registry_global(void *data, struct wl_registry *registry, uint32_t name,\n                     const char *interface, uint32_t version) {\n  if (strcmp(interface, \"wl_compositor\") == 0) {\n    compositor = wl_registry_bind(registry, name, &wl_compositor_interface, 4);\n  } else if (strcmp(interface, \"zwlr_layer_shell_v1\") == 0) {\n    layer_shell = (struct zwlr_layer_shell_v1 *)wl_registry_bind(\n        registry, name, &zwlr_layer_shell_v1_interface, 1);\n  } else if (strcmp(interface, \"wl_seat\") == 0) {\n    seat = wl_registry_bind(registry, name, &wl_seat_interface, 1);\n    wl_seat_add_listener(seat, &seat_listener, NULL);\n  } else if (strcmp(interface, \"zwp_keyboard_shortcuts_inhibit_manager_v1\") ==\n             0) {\n    shortcuts_inhibit_manager =\n        (struct zwp_keyboard_shortcuts_inhibit_manager_v1 *)wl_registry_bind(\n            registry, name,\n            &zwp_keyboard_shortcuts_inhibit_manager_v1_interface, 1);\n  } else if (strcmp(interface, zwp_tablet_manager_v2_interface.name) == 0) {\n    tablet_manager = (struct zwp_tablet_manager_v2 *)wl_registry_bind(\n        registry, name, &zwp_tablet_manager_v2_interface, 1);\n  }\n}\n\nvoid registry_global_remove(void *data, struct wl_registry *registry,\n                            uint32_t name) {}\n\nstatic const struct wl_registry_listener registry_listener = {\n    .global = registry_global,\n    .global_remove = registry_global_remove,\n};\n\nstruct wl_registry *get_registry(struct wl_display *display) {\n  return wl_display_get_registry(display);\n}\n\nvoid add_registry_listener(struct wl_registry *registry) {\n  wl_registry_add_listener(registry, &registry_listener, NULL);\n}\n\nstruct wl_surface *surface_global = NULL;\n\nstruct zwlr_layer_surface_v1 *create_layer_surface(struct wl_surface *surface) {\n  surface_global = surface;\n\n  layer_surface_global = zwlr_layer_shell_v1_get_layer_surface(\n      layer_shell, surface, NULL, ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY,\n      \"hexecute\");\n\n  zwlr_layer_surface_v1_set_anchor(layer_surface_global,\n                                   ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP |\n                                       ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM |\n                                       ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |\n                                       ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT);\n\n  zwlr_layer_surface_v1_set_exclusive_zone(layer_surface_global, -1);\n  zwlr_layer_surface_v1_set_keyboard_interactivity(\n      layer_surface_global,\n      ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE);\n\n  zwlr_layer_surface_v1_add_listener(layer_surface_global,\n                                     &layer_surface_listener, NULL);\n\n  wl_surface_commit(surface);\n\n  return layer_surface_global;\n}\n\nvoid set_input_region(int32_t width, int32_t height) {\n  if (surface_global) {\n    struct wl_region *region = wl_compositor_create_region(compositor);\n    wl_region_add(region, 0, 0, width, height);\n    wl_surface_set_input_region(surface_global, region);\n    wl_region_destroy(region);\n    wl_surface_commit(surface_global);\n  }\n}\n\nvoid disable_all_input() {\n  if (shortcuts_inhibitor) {\n    zwp_keyboard_shortcuts_inhibitor_v1_destroy(shortcuts_inhibitor);\n    shortcuts_inhibitor = NULL;\n  }\n\n  if (layer_surface_global) {\n    zwlr_layer_surface_v1_set_keyboard_interactivity(\n        layer_surface_global,\n        ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE);\n  }\n\n  if (surface_global) {\n    struct wl_region *region = wl_compositor_create_region(compositor);\n    wl_surface_set_input_region(surface_global, region);\n    wl_region_destroy(region);\n    wl_surface_commit(surface_global);\n  }\n}\n\nstatic int button_state = 0;\nstatic double mouse_x = 0;\nstatic double mouse_y = 0;\nstatic int32_t touch_id = -1;\n\nvoid pointer_enter(void *data, struct wl_pointer *pointer, uint32_t serial,\n                   struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y) {\n  mouse_x = wl_fixed_to_double(x);\n  mouse_y = wl_fixed_to_double(y);\n  wl_pointer_set_cursor(pointer, serial, NULL, 0, 0);\n}\n\nvoid pointer_leave(void *data, struct wl_pointer *pointer, uint32_t serial,\n                   struct wl_surface *surface) {}\n\nvoid pointer_motion(void *data, struct wl_pointer *pointer, uint32_t time,\n                    wl_fixed_t x, wl_fixed_t y) {\n  mouse_x = wl_fixed_to_double(x);\n  mouse_y = wl_fixed_to_double(y);\n}\n\nvoid pointer_button(void *data, struct wl_pointer *pointer, uint32_t serial,\n                    uint32_t time, uint32_t button, uint32_t state) {\n  if (button == 272) {\n    button_state = state;\n  }\n}\n\nvoid pointer_axis(void *data, struct wl_pointer *pointer, uint32_t time,\n                  uint32_t axis, wl_fixed_t value) {}\n\nvoid pointer_frame(void *data, struct wl_pointer *pointer) {}\n\nvoid pointer_axis_source(void *data, struct wl_pointer *pointer,\n                         uint32_t source) {}\n\nvoid pointer_axis_stop(void *data, struct wl_pointer *pointer, uint32_t time,\n                       uint32_t axis) {}\n\nvoid pointer_axis_discrete(void *data, struct wl_pointer *pointer,\n                           uint32_t axis, int32_t discrete) {}\n\nstatic const struct wl_pointer_listener pointer_listener = {\n    .enter = pointer_enter,\n    .leave = pointer_leave,\n    .motion = pointer_motion,\n    .button = pointer_button,\n    .axis = pointer_axis,\n    .frame = pointer_frame,\n    .axis_source = pointer_axis_source,\n    .axis_stop = pointer_axis_stop,\n    .axis_discrete = pointer_axis_discrete,\n};\n\nvoid tablet_tool_removed(void *data, struct zwp_tablet_tool_v2 *id) {\n  button_state = 0;\n}\n\nvoid tablet_tool_down(void *data, struct zwp_tablet_tool_v2 *id,\n                      unsigned int serial) {\n  button_state = 1;\n}\n\nvoid tablet_tool_up(void *data, struct zwp_tablet_tool_v2 *id) {\n  button_state = 0;\n}\n\nvoid tablet_tool_motion(void *data, struct zwp_tablet_tool_v2 *id, wl_fixed_t x,\n                        wl_fixed_t y) {\n  mouse_x = wl_fixed_to_double(x);\n  mouse_y = wl_fixed_to_double(y);\n}\n\nvoid tablet_tool_type(void *data, struct zwp_tablet_tool_v2 *id,\n                      uint32_t tool_type) {}\n\nvoid tablet_tool_serial(void *data, struct zwp_tablet_tool_v2 *id,\n                        uint32_t high, uint32_t low) {}\n\nvoid tablet_tool_id_wacom(void *data, struct zwp_tablet_tool_v2 *id,\n                          uint32_t high, uint32_t low) {}\n\nvoid tablet_tool_capability(void *data, struct zwp_tablet_tool_v2 *id,\n                            uint32_t capability) {}\n\nvoid tablet_tool_proximity_in(void *data, struct zwp_tablet_tool_v2 *id,\n                              uint32_t serial, struct zwp_tablet_v2 *tablet_id,\n                              struct wl_surface *surface) {}\n\nvoid tablet_tool_proximity_out(void *data, struct zwp_tablet_tool_v2 *id) {}\n\nvoid tablet_tool_pressure(void *data, struct zwp_tablet_tool_v2 *id,\n                          uint32_t pressure) {}\n\nvoid tablet_tool_distance(void *data, struct zwp_tablet_tool_v2 *id,\n                          uint32_t distance) {}\n\nvoid tablet_tool_tilt(void *data, struct zwp_tablet_tool_v2 *id, wl_fixed_t x,\n                      wl_fixed_t y) {}\n\nvoid tablet_tool_rotation(void *data, struct zwp_tablet_tool_v2 *id,\n                          wl_fixed_t rotation) {}\n\nvoid tablet_tool_slider(void *data, struct zwp_tablet_tool_v2 *id, int slider) {\n}\n\nvoid tablet_tool_wheel(void *data, struct zwp_tablet_tool_v2 *id,\n                       wl_fixed_t degree, int clicks) {}\n\nvoid tablet_tool_button(void *data, struct zwp_tablet_tool_v2 *id,\n                        uint32_t serial, uint32_t button, uint32_t state) {}\n\nvoid tablet_tool_frame(void *data, struct zwp_tablet_tool_v2 *id,\n                       uint32_t time) {}\n\nvoid tablet_tool_done(void *data, struct zwp_tablet_tool_v2 *id) { /* empty */ }\n\nstatic const struct zwp_tablet_tool_v2_listener tablet_tool_listener = {\n    .removed = tablet_tool_removed,\n    .down = tablet_tool_down,\n    .up = tablet_tool_up,\n    .motion = tablet_tool_motion,\n\n    .type = tablet_tool_type,\n    .hardware_serial = tablet_tool_serial,\n    .hardware_id_wacom = tablet_tool_id_wacom,\n    .capability = tablet_tool_capability,\n    .done = tablet_tool_done,\n\n    .proximity_in = tablet_tool_proximity_in,\n    .proximity_out = tablet_tool_proximity_out,\n    .pressure = tablet_tool_pressure,\n    .distance = tablet_tool_distance,\n    .tilt = tablet_tool_tilt,\n    .rotation = tablet_tool_rotation,\n    .slider = tablet_tool_slider,\n    .wheel = tablet_tool_wheel,\n    .button = tablet_tool_button,\n    .frame = tablet_tool_frame,\n};\n\nvoid tablet_added(void *data, struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,\n                  struct zwp_tablet_v2 *zwp_tablet_v2) {}\n\nvoid tool_added(void *data, struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,\n                struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2) {\n  tablet_tool = zwp_tablet_tool_v2;\n  zwp_tablet_tool_v2_add_listener(tablet_tool, &tablet_tool_listener, NULL);\n}\n\nvoid pad_added(void *data, struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,\n               struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2) {}\n\nstatic const struct zwp_tablet_seat_v2_listener tablet_seat_listener = {\n    .tablet_added = tablet_added,\n    .tool_added = tool_added,\n    .pad_added = pad_added,\n};\n\nvoid touch_down(void *data, struct wl_touch *wl_touch, uint serial, uint time,\n                struct wl_surface *surface, int id, wl_fixed_t x,\n                wl_fixed_t y) {\n  if (touch_id == -1) {\n    mouse_x = wl_fixed_to_double(x);\n    mouse_y = wl_fixed_to_double(y);\n    touch_id = id;\n    button_state = 1;\n  }\n}\n\nvoid touch_up(void *data, struct wl_touch *wl_touch, uint serial, uint time,\n              int id) {\n  if (touch_id == id) {\n    touch_id = -1;\n    button_state = 0;\n  }\n}\n\nvoid touch_motion(void *data, struct wl_touch *wl_touch, uint time, int id,\n                  wl_fixed_t x, wl_fixed_t y) {\n  if (touch_id == id) {\n    mouse_x = wl_fixed_to_double(x);\n    mouse_y = wl_fixed_to_double(y);\n  }\n}\n\nvoid touch_frame(void *data, struct wl_touch *wl_touch) {}\n\nvoid touch_cancel(void *data, struct wl_touch *wl_touch) {}\n\nvoid touch_shape(void *data, struct wl_touch *wl_touch, int32_t id,\n                 wl_fixed_t major, wl_fixed_t minor) {}\n\nvoid touch_orientation(void *data, struct wl_touch *wl_touch, int32_t id,\n                       wl_fixed_t orientation) {}\n\nstatic const struct wl_touch_listener touch_listener = {\n    .down = touch_down,\n    .up = touch_up,\n    .motion = touch_motion,\n    .frame = touch_frame,\n    .cancel = touch_cancel,\n    .shape = touch_shape,\n    .orientation = touch_orientation,\n};\n\nstatic uint32_t last_key = 0;\nstatic uint32_t last_key_state = 0;\n\nvoid keyboard_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format,\n                     int32_t fd, uint32_t size) {\n  if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {\n    close(fd);\n    return;\n  }\n\n  char *map_shm = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);\n  if (map_shm == MAP_FAILED) {\n    close(fd);\n    return;\n  }\n\n  xkb_keymap = xkb_keymap_new_from_string(xkb_context, map_shm,\n                                          XKB_KEYMAP_FORMAT_TEXT_V1,\n                                          XKB_KEYMAP_COMPILE_NO_FLAGS);\n  munmap(map_shm, size);\n  close(fd);\n\n  if (!xkb_keymap) {\n    return;\n  }\n\n  xkb_state = xkb_state_new(xkb_keymap);\n  if (!xkb_state) {\n    return;\n  }\n}\n\nvoid keyboard_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial,\n                    struct wl_surface *surface, struct wl_array *keys) {}\n\nvoid keyboard_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial,\n                    struct wl_surface *surface) {}\n\nvoid keyboard_key(void *data, struct wl_keyboard *keyboard, uint32_t serial,\n                  uint32_t time, uint32_t key, uint32_t state) {\n  if (xkb_state) {\n    xkb_keysym_t sym = xkb_state_key_get_one_sym(xkb_state, key + 8);\n    if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {\n      last_key = sym;\n      last_key_state = 1;\n    } else {\n      last_key = 0;\n      last_key_state = 0;\n    }\n  }\n}\n\nvoid keyboard_modifiers(void *data, struct wl_keyboard *keyboard,\n                        uint32_t serial, uint32_t mods_depressed,\n                        uint32_t mods_latched, uint32_t mods_locked,\n                        uint32_t group) {\n  if (xkb_state) {\n    xkb_state_update_mask(xkb_state, mods_depressed, mods_latched, mods_locked,\n                          0, 0, group);\n  }\n}\n\nvoid keyboard_repeat_info(void *data, struct wl_keyboard *keyboard,\n                          int32_t rate, int32_t delay) {}\n\nstatic const struct wl_keyboard_listener keyboard_listener = {\n    .keymap = keyboard_keymap,\n    .enter = keyboard_enter,\n    .leave = keyboard_leave,\n    .key = keyboard_key,\n    .modifiers = keyboard_modifiers,\n    .repeat_info = keyboard_repeat_info,\n};\n\n// Seat listener\nvoid seat_capabilities(void *data, struct wl_seat *seat,\n                       uint32_t capabilities) {\n  if (capabilities & WL_SEAT_CAPABILITY_POINTER) {\n    pointer = wl_seat_get_pointer(seat);\n    wl_pointer_add_listener(pointer, &pointer_listener, NULL);\n  }\n\n  if (capabilities & WL_SEAT_CAPABILITY_KEYBOARD) {\n    keyboard = wl_seat_get_keyboard(seat);\n    wl_keyboard_add_listener(keyboard, &keyboard_listener, NULL);\n\n    if (shortcuts_inhibit_manager && surface_global && !shortcuts_inhibitor) {\n      shortcuts_inhibitor =\n          zwp_keyboard_shortcuts_inhibit_manager_v1_inhibit_shortcuts(\n              shortcuts_inhibit_manager, surface_global, seat);\n    }\n  }\n  if (capabilities & WL_SEAT_CAPABILITY_TOUCH) {\n    touch = wl_seat_get_touch(seat);\n    wl_touch_add_listener(touch, &touch_listener, NULL);\n  }\n\n  tablet_seat = zwp_tablet_manager_v2_get_tablet_seat(tablet_manager, seat);\n  zwp_tablet_seat_v2_add_listener(tablet_seat, &tablet_seat_listener, seat);\n}\n\nvoid seat_name(void *data, struct wl_seat *seat, const char *name) {}\n\nint get_button_state() { return button_state; }\n\nvoid get_mouse_pos(double *x, double *y) {\n  *x = mouse_x;\n  *y = mouse_y;\n}\n\nvoid get_dimensions(int32_t *w, int32_t *h) {\n  *w = width_global;\n  *h = height_global;\n}\n\nuint32_t get_last_key() { return last_key; }\n\nuint32_t get_last_key_state() { return last_key_state; }\n\nvoid clear_last_key() {\n  last_key = 0;\n  last_key_state = 0;\n}\n\nEGLNativeWindowType native_window(struct wl_egl_window *egl_window) {\n  return (EGLNativeWindowType)egl_window;\n}\n"
  },
  {
    "path": "pkg/wayland/wayland.go",
    "content": "package wayland\n\n/*\n#cgo pkg-config: wayland-client wayland-egl egl gl xkbcommon\n#cgo LDFLAGS: -lwayland-client -lwayland-egl -lEGL -lGL -lxkbcommon\n#cgo CFLAGS: -I.\n#include \"wayland.h\"\n#include \"wayland-client.h\"\n*/\nimport \"C\"\nimport (\n\t\"fmt\"\n)\n\ntype WaylandError struct {\n\tmsg string\n}\n\nfunc (e *WaylandError) Error() string {\n\treturn e.msg\n}\n\ntype WaylandWindow struct {\n\tdisplay       *C.struct_wl_display\n\tregistry      *C.struct_wl_registry\n\tsurface       *C.struct_wl_surface\n\tlayerSurface  *C.struct_zwlr_layer_surface_v1\n\teglWindow     *C.struct_wl_egl_window\n\teglDisplay    C.EGLDisplay\n\teglContext    C.EGLContext\n\teglSurface    C.EGLSurface\n\twidth, height int32\n}\n\nfunc NewWaylandWindow() (*WaylandWindow, error) {\n\tw := &WaylandWindow{}\n\n\tC.xkb_context = C.xkb_context_new(C.XKB_CONTEXT_NO_FLAGS)\n\tif C.xkb_context == nil {\n\t\treturn nil, &WaylandError{\"failed to create xkb context\"}\n\t}\n\n\tw.display = C.wl_display_connect(nil)\n\tif w.display == nil {\n\t\treturn nil, &WaylandError{\"failed to connect to Wayland display\"}\n\t}\n\n\tw.registry = C.get_registry(w.display)\n\tC.add_registry_listener(w.registry)\n\tC.wl_display_roundtrip(w.display)\n\tif C.compositor == nil {\n\t\treturn nil, &WaylandError{\"compositor not available\"}\n\t}\n\tif C.layer_shell == nil {\n\t\treturn nil, &WaylandError{\"layer shell not available\"}\n\t}\n\n\tw.surface = C.wl_compositor_create_surface(C.compositor)\n\tif w.surface == nil {\n\t\treturn nil, &WaylandError{\"failed to create surface\"}\n\t}\n\n\tw.layerSurface = C.create_layer_surface(w.surface)\n\n\tC.wl_display_roundtrip(w.display)\n\n\tvar width, height C.int32_t\n\tC.get_dimensions(&width, &height)\n\tw.width = int32(width)\n\tw.height = int32(height)\n\n\tif w.width == 0 || w.height == 0 {\n\t\tw.width = 1920\n\t\tw.height = 1080\n\t}\n\n\tC.wl_display_roundtrip(w.display)\n\n\tC.set_input_region(C.int32_t(w.width), C.int32_t(w.height))\n\n\tif err := w.initEGL(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tC.wl_surface_commit(w.surface)\n\tC.wl_display_flush(w.display)\n\n\tC.wl_display_roundtrip(w.display)\n\tC.wl_display_roundtrip(w.display)\n\tC.wl_display_flush(w.display)\n\n\treturn w, nil\n}\n\nfunc (w *WaylandWindow) initEGL() error {\n\tw.eglWindow = C.wl_egl_window_create(w.surface, C.int(w.width), C.int(w.height))\n\tif w.eglWindow == nil {\n\t\treturn fmt.Errorf(\"failed to create EGL window\")\n\t}\n\n\tw.eglDisplay = C.eglGetDisplay(C.EGLNativeDisplayType(w.display))\n\tif w.eglDisplay == C.EGLDisplay(C.EGL_NO_DISPLAY) {\n\t\treturn fmt.Errorf(\"failed to get EGL display\")\n\t}\n\n\tvar major, minor C.EGLint\n\tif C.eglInitialize(w.eglDisplay, &major, &minor) == C.EGL_FALSE {\n\t\treturn fmt.Errorf(\"failed to initialize EGL\")\n\t}\n\n\tconfigAttribs := []C.EGLint{\n\t\tC.EGL_SURFACE_TYPE, C.EGL_WINDOW_BIT,\n\t\tC.EGL_RED_SIZE, 8,\n\t\tC.EGL_GREEN_SIZE, 8,\n\t\tC.EGL_BLUE_SIZE, 8,\n\t\tC.EGL_ALPHA_SIZE, 8,\n\t\tC.EGL_RENDERABLE_TYPE, C.EGL_OPENGL_BIT,\n\t\tC.EGL_NONE,\n\t}\n\n\tvar config C.EGLConfig\n\tvar numConfigs C.EGLint\n\tif C.eglChooseConfig(w.eglDisplay, &configAttribs[0], &config, 1, &numConfigs) == C.EGL_FALSE {\n\t\treturn fmt.Errorf(\"failed to choose EGL config\")\n\t}\n\n\tC.eglBindAPI(C.EGL_OPENGL_API)\n\tcontextAttribs := []C.EGLint{\n\t\tC.EGL_CONTEXT_MAJOR_VERSION, 4,\n\t\tC.EGL_CONTEXT_MINOR_VERSION, 1,\n\t\tC.EGL_CONTEXT_OPENGL_PROFILE_MASK, C.EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,\n\t\tC.EGL_NONE,\n\t}\n\n\tw.eglContext = C.eglCreateContext(w.eglDisplay, config, nil, &contextAttribs[0])\n\tif w.eglContext == nil {\n\t\treturn fmt.Errorf(\"failed to create EGL context\")\n\t}\n\n\tw.eglSurface = C.eglCreateWindowSurface(\n\t\tw.eglDisplay,\n\t\tconfig,\n\t\tC.native_window(w.eglWindow),\n\t\tnil,\n\t)\n\tif w.eglSurface == nil {\n\t\treturn fmt.Errorf(\"failed to create EGL surface\")\n\t}\n\n\tif C.eglMakeCurrent(w.eglDisplay, w.eglSurface, w.eglSurface, w.eglContext) == C.EGL_FALSE {\n\t\treturn fmt.Errorf(\"failed to make EGL context current\")\n\t}\n\n\treturn nil\n}\n\nfunc (w *WaylandWindow) GetSize() (int, int) {\n\tvar width, height C.int32_t\n\tC.get_dimensions(&width, &height)\n\tif width > 0 && height > 0 {\n\t\tw.width = int32(width)\n\t\tw.height = int32(height)\n\t}\n\treturn int(w.width), int(w.height)\n}\n\nfunc (w *WaylandWindow) ShouldClose() bool {\n\treturn false\n}\n\nfunc (w *WaylandWindow) SwapBuffers() {\n\tC.eglSwapBuffers(w.eglDisplay, w.eglSurface)\n}\n\nfunc (w *WaylandWindow) PollEvents() {\n\tC.wl_display_flush(w.display)\n\tC.wl_display_dispatch_pending(w.display)\n}\n\nfunc (w *WaylandWindow) GetCursorPos() (float64, float64) {\n\tvar x, y C.double\n\tC.get_mouse_pos(&x, &y)\n\treturn float64(x), float64(y)\n}\n\nfunc (w *WaylandWindow) GetMouseButton() bool {\n\tstate := C.get_button_state()\n\treturn state == 1\n}\n\nfunc (w *WaylandWindow) DisableInput() {\n\tC.disable_all_input()\n}\n\nfunc (w *WaylandWindow) GetLastKey() (uint32, uint32, bool) {\n\tkey := uint32(C.get_last_key())\n\tstate := uint32(C.get_last_key_state())\n\treturn key, state, key != 0\n}\n\nfunc (w *WaylandWindow) ClearLastKey() {\n\tC.clear_last_key()\n}\n\nfunc (w *WaylandWindow) Destroy() {\n\tif w.eglContext != C.EGLContext(C.EGL_NO_CONTEXT) {\n\t\tC.eglDestroyContext(w.eglDisplay, w.eglContext)\n\t}\n\tif w.eglSurface != C.EGLSurface(C.EGL_NO_SURFACE) {\n\t\tC.eglDestroySurface(w.eglDisplay, w.eglSurface)\n\t}\n\tif w.eglWindow != nil {\n\t\tC.wl_egl_window_destroy(w.eglWindow)\n\t}\n\tif w.eglDisplay != C.EGLDisplay(C.EGL_NO_DISPLAY) {\n\t\tC.eglTerminate(w.eglDisplay)\n\t}\n\tif w.surface != nil {\n\t\tC.wl_surface_destroy(w.surface)\n\t}\n\tif w.display != nil {\n\t\tC.wl_display_disconnect(w.display)\n\t}\n}\n"
  },
  {
    "path": "pkg/wayland/wayland.h",
    "content": "#ifndef WAYLAND_H\n#define WAYLAND_H\n\n#include \"tablet-v2.h\"\n#include \"wlr-layer-shell-client.h\"\n#include <EGL/egl.h>\n#include <stdlib.h>\n#include <wayland-client.h>\n#include <wayland-egl.h>\n#include <xkbcommon/xkbcommon.h>\n\nvoid layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface,\n                             uint32_t serial, uint32_t width, uint32_t height);\nvoid layer_surface_closed(void *data, struct zwlr_layer_surface_v1 *surface);\nvoid seat_capabilities(void *data, struct wl_seat *seat, uint32_t capabilities);\nvoid seat_name(void *data, struct wl_seat *seat, const char *name);\nvoid registry_global(void *data, struct wl_registry *registry, uint32_t name,\n                     const char *interface, uint32_t version);\nvoid registry_global_remove(void *data, struct wl_registry *registry,\n                            uint32_t name);\nstruct wl_registry *get_registry(struct wl_display *display);\nvoid add_registry_listener(struct wl_registry *registry);\nstruct zwlr_layer_surface_v1 *create_layer_surface(struct wl_surface *surface);\nvoid set_input_region(int32_t width, int32_t height);\nvoid disable_all_input();\nvoid pointer_enter(void *data, struct wl_pointer *pointer, uint32_t serial,\n                   struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y);\nvoid pointer_leave(void *data, struct wl_pointer *pointer, uint32_t serial,\n                   struct wl_surface *surface);\nvoid pointer_motion(void *data, struct wl_pointer *pointer, uint32_t time,\n                    wl_fixed_t x, wl_fixed_t y);\nvoid pointer_button(void *data, struct wl_pointer *pointer, uint32_t serial,\n                    uint32_t time, uint32_t button, uint32_t state);\nvoid pointer_axis(void *data, struct wl_pointer *pointer, uint32_t time,\n                  uint32_t axis, wl_fixed_t value);\nvoid pointer_frame(void *data, struct wl_pointer *pointer);\nvoid pointer_axis_source(void *data, struct wl_pointer *pointer,\n                         uint32_t source);\nvoid pointer_axis_stop(void *data, struct wl_pointer *pointer, uint32_t time,\n                       uint32_t axis);\nvoid pointer_axis_discrete(void *data, struct wl_pointer *pointer,\n                           uint32_t axis, int32_t discrete);\n\nvoid touch_down(void *data, struct wl_touch *wl_touch, uint serial, uint time,\n                struct wl_surface *surface, int id, wl_fixed_t x, wl_fixed_t y);\n\nvoid touch_up(void *data, struct wl_touch *wl_touch, uint serial, uint time,\n              int id);\n\nvoid touch_motion(void *data, struct wl_touch *wl_touch, uint time, int id,\n                  wl_fixed_t x, wl_fixed_t y);\n\nvoid touch_frame(void *data, struct wl_touch *wl_touch);\n\nvoid touch_cancel(void *data, struct wl_touch *wl_touch);\n\nvoid touch_shape(void *data, struct wl_touch *wl_touch, int32_t id,\n                 wl_fixed_t major, wl_fixed_t minor);\n\nvoid touch_orientation(void *data, struct wl_touch *wl_touch, int32_t id,\n                       wl_fixed_t orientation);\n\nvoid tablet_added(void *data, struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,\n                  struct zwp_tablet_v2 *zwp_tablet_v2);\n\nvoid tool_added(void *data, struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,\n                struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2);\n\nvoid pad_added(void *data, struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,\n               struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2);\n\nvoid tablet_tool_removed(void *data, struct zwp_tablet_tool_v2 *id);\n\nvoid tablet_tool_down(void *data, struct zwp_tablet_tool_v2 *id,\n                      unsigned int serial);\n\nvoid tablet_tool_up(void *data, struct zwp_tablet_tool_v2 *id);\n\nvoid tablet_tool_motion(void *data, struct zwp_tablet_tool_v2 *id, wl_fixed_t x,\n                        wl_fixed_t y);\n\nvoid tablet_tool_type(void *data, struct zwp_tablet_tool_v2 *id,\n                      uint32_t tool_type);\n\nvoid tablet_tool_serial(void *data, struct zwp_tablet_tool_v2 *id,\n                        uint32_t high, uint32_t low);\n\nvoid tablet_tool_id_wacom(void *data, struct zwp_tablet_tool_v2 *id,\n                          uint32_t high, uint32_t low);\n\nvoid tablet_tool_capability(void *data, struct zwp_tablet_tool_v2 *id,\n                            uint32_t capability);\n\nvoid tablet_tool_proximity_in(void *data, struct zwp_tablet_tool_v2 *id,\n                              uint32_t serial, struct zwp_tablet_v2 *tablet_id,\n                              struct wl_surface *surface);\n\nvoid tablet_tool_proximity_out(void *data, struct zwp_tablet_tool_v2 *id);\n\nvoid tablet_tool_pressure(void *data, struct zwp_tablet_tool_v2 *id,\n                          uint32_t pressure);\n\nvoid tablet_tool_distance(void *data, struct zwp_tablet_tool_v2 *id,\n                          uint32_t distance);\n\nvoid tablet_tool_tilt(void *data, struct zwp_tablet_tool_v2 *id, wl_fixed_t x,\n                      wl_fixed_t y);\n\nvoid tablet_tool_rotation(void *data, struct zwp_tablet_tool_v2 *id,\n                          wl_fixed_t rotation);\n\nvoid tablet_tool_slider(void *data, struct zwp_tablet_tool_v2 *id, int slider);\n\nvoid tablet_tool_wheel(void *data, struct zwp_tablet_tool_v2 *id,\n                       wl_fixed_t degree, int clicks);\n\nvoid tablet_tool_button(void *data, struct zwp_tablet_tool_v2 *id,\n                        uint32_t serial, uint32_t button, uint32_t state);\n\nvoid tablet_tool_frame(void *data, struct zwp_tablet_tool_v2 *id,\n                       uint32_t time);\n\nvoid tablet_tool_done(void *data, struct zwp_tablet_tool_v2 *id);\n\nvoid keyboard_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format,\n                     int32_t fd, uint32_t size);\nvoid keyboard_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial,\n                    struct wl_surface *surface, struct wl_array *keys);\nvoid keyboard_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial,\n                    struct wl_surface *surface);\nvoid keyboard_key(void *data, struct wl_keyboard *keyboard, uint32_t serial,\n                  uint32_t time, uint32_t key, uint32_t state);\nvoid keyboard_modifiers(void *data, struct wl_keyboard *keyboard,\n                        uint32_t serial, uint32_t mods_depressed,\n                        uint32_t mods_latched, uint32_t mods_locked,\n                        uint32_t group);\nvoid keyboard_repeat_info(void *data, struct wl_keyboard *keyboard,\n                          int32_t rate, int32_t delay);\nint get_button_state();\nvoid get_mouse_pos(double *x, double *y);\nvoid get_dimensions(int32_t *w, int32_t *h);\nuint32_t get_last_key();\nuint32_t get_last_key_state();\nvoid clear_last_key();\nEGLNativeWindowType native_window(struct wl_egl_window *egl_window);\n\nextern struct wl_compositor *compositor;\nextern struct zwlr_layer_shell_v1 *layer_shell;\nextern struct wl_seat *seat;\nextern struct wl_pointer *pointer;\nextern struct wl_touch *touch;\nextern struct zwp_tablet_manager_v2_interface *tablet_manager_interface;\nextern struct zwp_tablet_manager_v2 *tablet_manager;\nextern struct zwp_tablet_seat_v2 *tablet_seat;\nextern struct zwp_tablet_tool_v2 *tool;\nextern struct wl_keyboard *keyboard;\nextern struct zwp_keyboard_shortcuts_inhibit_manager_v1\n    *shortcuts_inhibit_manager;\nextern struct zwp_keyboard_shortcuts_inhibitor_v1 *shortcuts_inhibitor;\nextern struct zwlr_layer_surface_v1 *layer_surface_global;\nextern struct xkb_context *xkb_context;\nextern struct xkb_keymap *xkb_keymap;\nextern struct xkb_state *xkb_state;\n\n#endif // WAYLAND_H\n"
  },
  {
    "path": "pkg/wayland/wlr-layer-shell-client.h",
    "content": "/* Generated by wayland-scanner 1.24.0 */\n\n#ifndef WLR_LAYER_SHELL_UNSTABLE_V1_CLIENT_PROTOCOL_H\n#define WLR_LAYER_SHELL_UNSTABLE_V1_CLIENT_PROTOCOL_H\n\n#include \"wayland-client.h\"\n#include <stddef.h>\n#include <stdint.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/**\n * @page page_wlr_layer_shell_unstable_v1 The wlr_layer_shell_unstable_v1\n * protocol\n * @section page_ifaces_wlr_layer_shell_unstable_v1 Interfaces\n * - @subpage page_iface_zwlr_layer_shell_v1 - create surfaces that are layers\n * of the desktop\n * - @subpage page_iface_zwlr_layer_surface_v1 - layer metadata interface\n * @section page_copyright_wlr_layer_shell_unstable_v1 Copyright\n * <pre>\n *\n * Copyright © 2017 Drew DeVault\n *\n * Permission to use, copy, modify, distribute, and sell this\n * software and its documentation for any purpose is hereby granted\n * without fee, provided that the above copyright notice appear in\n * all copies and that both that copyright notice and this permission\n * notice appear in supporting documentation, and that the name of\n * the copyright holders not be used in advertising or publicity\n * pertaining to distribution of the software without specific,\n * written prior permission.  The copyright holders make no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied\n * warranty.\n *\n * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS\n * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY\n * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN\n * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\n * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\n * THIS SOFTWARE.\n * </pre>\n */\nstruct wl_output;\nstruct wl_surface;\nstruct xdg_popup;\nstruct zwlr_layer_shell_v1;\nstruct zwlr_layer_surface_v1;\n\n#ifndef ZWLR_LAYER_SHELL_V1_INTERFACE\n#define ZWLR_LAYER_SHELL_V1_INTERFACE\n/**\n * @page page_iface_zwlr_layer_shell_v1 zwlr_layer_shell_v1\n * @section page_iface_zwlr_layer_shell_v1_desc Description\n *\n * Clients can use this interface to assign the surface_layer role to\n * wl_surfaces. Such surfaces are assigned to a \"layer\" of the output and\n * rendered with a defined z-depth respective to each other. They may also be\n * anchored to the edges and corners of a screen and specify input handling\n * semantics. This interface should be suitable for the implementation of\n * many desktop shell components, and a broad number of other applications\n * that interact with the desktop.\n * @section page_iface_zwlr_layer_shell_v1_api API\n * See @ref iface_zwlr_layer_shell_v1.\n */\n/**\n * @defgroup iface_zwlr_layer_shell_v1 The zwlr_layer_shell_v1 interface\n *\n * Clients can use this interface to assign the surface_layer role to\n * wl_surfaces. Such surfaces are assigned to a \"layer\" of the output and\n * rendered with a defined z-depth respective to each other. They may also be\n * anchored to the edges and corners of a screen and specify input handling\n * semantics. This interface should be suitable for the implementation of\n * many desktop shell components, and a broad number of other applications\n * that interact with the desktop.\n */\nextern const struct wl_interface zwlr_layer_shell_v1_interface;\n#endif\n#ifndef ZWLR_LAYER_SURFACE_V1_INTERFACE\n#define ZWLR_LAYER_SURFACE_V1_INTERFACE\n/**\n * @page page_iface_zwlr_layer_surface_v1 zwlr_layer_surface_v1\n * @section page_iface_zwlr_layer_surface_v1_desc Description\n *\n * An interface that may be implemented by a wl_surface, for surfaces that\n * are designed to be rendered as a layer of a stacked desktop-like\n * environment.\n *\n * Layer surface state (layer, size, anchor, exclusive zone,\n * margin, interactivity) is double-buffered, and will be applied at the\n * time wl_surface.commit of the corresponding wl_surface is called.\n *\n * Attaching a null buffer to a layer surface unmaps it.\n *\n * Unmapping a layer_surface means that the surface cannot be shown by the\n * compositor until it is explicitly mapped again. The layer_surface\n * returns to the state it had right after layer_shell.get_layer_surface.\n * The client can re-map the surface by performing a commit without any\n * buffer attached, waiting for a configure event and handling it as usual.\n * @section page_iface_zwlr_layer_surface_v1_api API\n * See @ref iface_zwlr_layer_surface_v1.\n */\n/**\n * @defgroup iface_zwlr_layer_surface_v1 The zwlr_layer_surface_v1 interface\n *\n * An interface that may be implemented by a wl_surface, for surfaces that\n * are designed to be rendered as a layer of a stacked desktop-like\n * environment.\n *\n * Layer surface state (layer, size, anchor, exclusive zone,\n * margin, interactivity) is double-buffered, and will be applied at the\n * time wl_surface.commit of the corresponding wl_surface is called.\n *\n * Attaching a null buffer to a layer surface unmaps it.\n *\n * Unmapping a layer_surface means that the surface cannot be shown by the\n * compositor until it is explicitly mapped again. The layer_surface\n * returns to the state it had right after layer_shell.get_layer_surface.\n * The client can re-map the surface by performing a commit without any\n * buffer attached, waiting for a configure event and handling it as usual.\n */\nextern const struct wl_interface zwlr_layer_surface_v1_interface;\n#endif\n\n#ifndef ZWLR_LAYER_SHELL_V1_ERROR_ENUM\n#define ZWLR_LAYER_SHELL_V1_ERROR_ENUM\nenum zwlr_layer_shell_v1_error {\n  /**\n   * wl_surface has another role\n   */\n  ZWLR_LAYER_SHELL_V1_ERROR_ROLE = 0,\n  /**\n   * layer value is invalid\n   */\n  ZWLR_LAYER_SHELL_V1_ERROR_INVALID_LAYER = 1,\n  /**\n   * wl_surface has a buffer attached or committed\n   */\n  ZWLR_LAYER_SHELL_V1_ERROR_ALREADY_CONSTRUCTED = 2,\n};\n#endif /* ZWLR_LAYER_SHELL_V1_ERROR_ENUM */\n\n#ifndef ZWLR_LAYER_SHELL_V1_LAYER_ENUM\n#define ZWLR_LAYER_SHELL_V1_LAYER_ENUM\n/**\n * @ingroup iface_zwlr_layer_shell_v1\n * available layers for surfaces\n *\n * These values indicate which layers a surface can be rendered in. They\n * are ordered by z depth, bottom-most first. Traditional shell surfaces\n * will typically be rendered between the bottom and top layers.\n * Fullscreen shell surfaces are typically rendered at the top layer.\n * Multiple surfaces can share a single layer, and ordering within a\n * single layer is undefined.\n */\nenum zwlr_layer_shell_v1_layer {\n  ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND = 0,\n  ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM = 1,\n  ZWLR_LAYER_SHELL_V1_LAYER_TOP = 2,\n  ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY = 3,\n};\n#endif /* ZWLR_LAYER_SHELL_V1_LAYER_ENUM */\n\n#define ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE 0\n#define ZWLR_LAYER_SHELL_V1_DESTROY 1\n\n/**\n * @ingroup iface_zwlr_layer_shell_v1\n */\n#define ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwlr_layer_shell_v1\n */\n#define ZWLR_LAYER_SHELL_V1_DESTROY_SINCE_VERSION 3\n\n/** @ingroup iface_zwlr_layer_shell_v1 */\nstatic inline void zwlr_layer_shell_v1_set_user_data(\n    struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1, void *user_data) {\n  wl_proxy_set_user_data((struct wl_proxy *)zwlr_layer_shell_v1, user_data);\n}\n\n/** @ingroup iface_zwlr_layer_shell_v1 */\nstatic inline void *zwlr_layer_shell_v1_get_user_data(\n    struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1) {\n  return wl_proxy_get_user_data((struct wl_proxy *)zwlr_layer_shell_v1);\n}\n\nstatic inline uint32_t zwlr_layer_shell_v1_get_version(\n    struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1) {\n  return wl_proxy_get_version((struct wl_proxy *)zwlr_layer_shell_v1);\n}\n\n/**\n * @ingroup iface_zwlr_layer_shell_v1\n *\n * Create a layer surface for an existing surface. This assigns the role of\n * layer_surface, or raises a protocol error if another role is already\n * assigned.\n *\n * Creating a layer surface from a wl_surface which has a buffer attached\n * or committed is a client error, and any attempts by a client to attach\n * or manipulate a buffer prior to the first layer_surface.configure call\n * must also be treated as errors.\n *\n * After creating a layer_surface object and setting it up, the client\n * must perform an initial commit without any buffer attached.\n * The compositor will reply with a layer_surface.configure event.\n * The client must acknowledge it and is then allowed to attach a buffer\n * to map the surface.\n *\n * You may pass NULL for output to allow the compositor to decide which\n * output to use. Generally this will be the one that the user most\n * recently interacted with.\n *\n * Clients can specify a namespace that defines the purpose of the layer\n * surface.\n */\nstatic inline struct zwlr_layer_surface_v1 *\nzwlr_layer_shell_v1_get_layer_surface(\n    struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1, struct wl_surface *surface,\n    struct wl_output *output, uint32_t layer, const char *namespace) {\n  struct wl_proxy *id;\n\n  id = wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwlr_layer_shell_v1,\n      ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE, &zwlr_layer_surface_v1_interface,\n      wl_proxy_get_version((struct wl_proxy *)zwlr_layer_shell_v1), 0, NULL,\n      surface, output, layer, namespace);\n\n  return (struct zwlr_layer_surface_v1 *)id;\n}\n\n/**\n * @ingroup iface_zwlr_layer_shell_v1\n *\n * This request indicates that the client will not use the layer_shell\n * object any more. Objects that have been created through this instance\n * are not affected.\n */\nstatic inline void\nzwlr_layer_shell_v1_destroy(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1) {\n  wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwlr_layer_shell_v1, ZWLR_LAYER_SHELL_V1_DESTROY, NULL,\n      wl_proxy_get_version((struct wl_proxy *)zwlr_layer_shell_v1),\n      WL_MARSHAL_FLAG_DESTROY);\n}\n\n#ifndef ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ENUM\n#define ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ENUM\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n * types of keyboard interaction possible for a layer shell surface\n *\n * Types of keyboard interaction possible for layer shell surfaces. The\n * rationale for this is twofold: (1) some applications are not interested\n * in keyboard events and not allowing them to be focused can improve the\n * desktop experience; (2) some applications will want to take exclusive\n * keyboard focus.\n */\nenum zwlr_layer_surface_v1_keyboard_interactivity {\n  /**\n   * no keyboard focus is possible\n   *\n   * This value indicates that this surface is not interested in\n   * keyboard events and the compositor should never assign it the\n   * keyboard focus.\n   *\n   * This is the default value, set for newly created layer shell\n   * surfaces.\n   *\n   * This is useful for e.g. desktop widgets that display information\n   * or only have interaction with non-keyboard input devices.\n   */\n  ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE = 0,\n  /**\n   * request exclusive keyboard focus\n   *\n   * Request exclusive keyboard focus if this surface is above the\n   * shell surface layer.\n   *\n   * For the top and overlay layers, the seat will always give\n   * exclusive keyboard focus to the top-most layer which has\n   * keyboard interactivity set to exclusive. If this layer contains\n   * multiple surfaces with keyboard interactivity set to exclusive,\n   * the compositor determines the one receiving keyboard events in\n   * an implementation- defined manner. In this case, no guarantee is\n   * made when this surface will receive keyboard focus (if ever).\n   *\n   * For the bottom and background layers, the compositor is allowed\n   * to use normal focus semantics.\n   *\n   * This setting is mainly intended for applications that need to\n   * ensure they receive all keyboard events, such as a lock screen\n   * or a password prompt.\n   */\n  ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE = 1,\n  /**\n   * request regular keyboard focus semantics\n   *\n   * This requests the compositor to allow this surface to be\n   * focused and unfocused by the user in an implementation-defined\n   * manner. The user should be able to unfocus this surface even\n   * regardless of the layer it is on.\n   *\n   * Typically, the compositor will want to use its normal mechanism\n   * to manage keyboard focus between layer shell surfaces with this\n   * setting and regular toplevels on the desktop layer (e.g. click\n   * to focus). Nevertheless, it is possible for a compositor to\n   * require a special interaction to focus or unfocus layer shell\n   * surfaces (e.g. requiring a click even if focus follows the mouse\n   * normally, or providing a keybinding to switch focus between\n   * layers).\n   *\n   * This setting is mainly intended for desktop shell components\n   * (e.g. panels) that allow keyboard interaction. Using this option\n   * can allow implementing a desktop shell that can be fully usable\n   * without the mouse.\n   * @since 4\n   */\n  ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND = 2,\n};\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\n#define ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND_SINCE_VERSION 4\n#endif /* ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ENUM */\n\n#ifndef ZWLR_LAYER_SURFACE_V1_ERROR_ENUM\n#define ZWLR_LAYER_SURFACE_V1_ERROR_ENUM\nenum zwlr_layer_surface_v1_error {\n  /**\n   * provided surface state is invalid\n   */\n  ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SURFACE_STATE = 0,\n  /**\n   * size is invalid\n   */\n  ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SIZE = 1,\n  /**\n   * anchor bitfield is invalid\n   */\n  ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_ANCHOR = 2,\n  /**\n   * keyboard interactivity is invalid\n   */\n  ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_KEYBOARD_INTERACTIVITY = 3,\n};\n#endif /* ZWLR_LAYER_SURFACE_V1_ERROR_ENUM */\n\n#ifndef ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM\n#define ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM\nenum zwlr_layer_surface_v1_anchor {\n  /**\n   * the top edge of the anchor rectangle\n   */\n  ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP = 1,\n  /**\n   * the bottom edge of the anchor rectangle\n   */\n  ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM = 2,\n  /**\n   * the left edge of the anchor rectangle\n   */\n  ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT = 4,\n  /**\n   * the right edge of the anchor rectangle\n   */\n  ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT = 8,\n};\n#endif /* ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM */\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n * @struct zwlr_layer_surface_v1_listener\n */\nstruct zwlr_layer_surface_v1_listener {\n  /**\n   * suggest a surface change\n   *\n   * The configure event asks the client to resize its surface.\n   *\n   * Clients should arrange their surface for the new states, and\n   * then send an ack_configure request with the serial sent in this\n   * configure event at some point before committing the new surface.\n   *\n   * The client is free to dismiss all but the last configure event\n   * it received.\n   *\n   * The width and height arguments specify the size of the window in\n   * surface-local coordinates.\n   *\n   * The size is a hint, in the sense that the client is free to\n   * ignore it if it doesn't resize, pick a smaller size (to satisfy\n   * aspect ratio or resize in steps of NxM pixels). If the client\n   * picks a smaller size and is anchored to two opposite anchors\n   * (e.g. 'top' and 'bottom'), the surface will be centered on this\n   * axis.\n   *\n   * If the width or height arguments are zero, it means the client\n   * should decide its own window dimension.\n   */\n  void (*configure)(void *data,\n                    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1,\n                    uint32_t serial, uint32_t width, uint32_t height);\n  /**\n   * surface should be closed\n   *\n   * The closed event is sent by the compositor when the surface\n   * will no longer be shown. The output may have been destroyed or\n   * the user may have asked for it to be removed. Further changes to\n   * the surface will be ignored. The client should destroy the\n   * resource after receiving this event, and create a new surface if\n   * they so choose.\n   */\n  void (*closed)(void *data,\n                 struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1);\n};\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\nstatic inline int zwlr_layer_surface_v1_add_listener(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1,\n    const struct zwlr_layer_surface_v1_listener *listener, void *data) {\n  return wl_proxy_add_listener((struct wl_proxy *)zwlr_layer_surface_v1,\n                               (void (**)(void))listener, data);\n}\n\n#define ZWLR_LAYER_SURFACE_V1_SET_SIZE 0\n#define ZWLR_LAYER_SURFACE_V1_SET_ANCHOR 1\n#define ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE 2\n#define ZWLR_LAYER_SURFACE_V1_SET_MARGIN 3\n#define ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY 4\n#define ZWLR_LAYER_SURFACE_V1_GET_POPUP 5\n#define ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE 6\n#define ZWLR_LAYER_SURFACE_V1_DESTROY 7\n#define ZWLR_LAYER_SURFACE_V1_SET_LAYER 8\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\n#define ZWLR_LAYER_SURFACE_V1_CONFIGURE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\n#define ZWLR_LAYER_SURFACE_V1_CLOSED_SINCE_VERSION 1\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\n#define ZWLR_LAYER_SURFACE_V1_SET_SIZE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\n#define ZWLR_LAYER_SURFACE_V1_SET_ANCHOR_SINCE_VERSION 1\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\n#define ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\n#define ZWLR_LAYER_SURFACE_V1_SET_MARGIN_SINCE_VERSION 1\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\n#define ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY_SINCE_VERSION 1\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\n#define ZWLR_LAYER_SURFACE_V1_GET_POPUP_SINCE_VERSION 1\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\n#define ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE_SINCE_VERSION 1\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\n#define ZWLR_LAYER_SURFACE_V1_DESTROY_SINCE_VERSION 1\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n */\n#define ZWLR_LAYER_SURFACE_V1_SET_LAYER_SINCE_VERSION 2\n\n/** @ingroup iface_zwlr_layer_surface_v1 */\nstatic inline void zwlr_layer_surface_v1_set_user_data(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, void *user_data) {\n  wl_proxy_set_user_data((struct wl_proxy *)zwlr_layer_surface_v1, user_data);\n}\n\n/** @ingroup iface_zwlr_layer_surface_v1 */\nstatic inline void *zwlr_layer_surface_v1_get_user_data(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1) {\n  return wl_proxy_get_user_data((struct wl_proxy *)zwlr_layer_surface_v1);\n}\n\nstatic inline uint32_t zwlr_layer_surface_v1_get_version(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1) {\n  return wl_proxy_get_version((struct wl_proxy *)zwlr_layer_surface_v1);\n}\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n *\n * Sets the size of the surface in surface-local coordinates. The\n * compositor will display the surface centered with respect to its\n * anchors.\n *\n * If you pass 0 for either value, the compositor will assign it and\n * inform you of the assignment in the configure event. You must set your\n * anchor to opposite edges in the dimensions you omit; not doing so is a\n * protocol error. Both values are 0 by default.\n *\n * Size is double-buffered, see wl_surface.commit.\n */\nstatic inline void zwlr_layer_surface_v1_set_size(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t width,\n    uint32_t height) {\n  wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwlr_layer_surface_v1, ZWLR_LAYER_SURFACE_V1_SET_SIZE,\n      NULL, wl_proxy_get_version((struct wl_proxy *)zwlr_layer_surface_v1), 0,\n      width, height);\n}\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n *\n * Requests that the compositor anchor the surface to the specified edges\n * and corners. If two orthogonal edges are specified (e.g. 'top' and\n * 'left'), then the anchor point will be the intersection of the edges\n * (e.g. the top left corner of the output); otherwise the anchor point\n * will be centered on that edge, or in the center if none is specified.\n *\n * Anchor is double-buffered, see wl_surface.commit.\n */\nstatic inline void zwlr_layer_surface_v1_set_anchor(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t anchor) {\n  wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwlr_layer_surface_v1,\n      ZWLR_LAYER_SURFACE_V1_SET_ANCHOR, NULL,\n      wl_proxy_get_version((struct wl_proxy *)zwlr_layer_surface_v1), 0,\n      anchor);\n}\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n *\n * Requests that the compositor avoids occluding an area with other\n * surfaces. The compositor's use of this information is\n * implementation-dependent - do not assume that this region will not\n * actually be occluded.\n *\n * A positive value is only meaningful if the surface is anchored to one\n * edge or an edge and both perpendicular edges. If the surface is not\n * anchored, anchored to only two perpendicular edges (a corner), anchored\n * to only two parallel edges or anchored to all edges, a positive value\n * will be treated the same as zero.\n *\n * A positive zone is the distance from the edge in surface-local\n * coordinates to consider exclusive.\n *\n * Surfaces that do not wish to have an exclusive zone may instead specify\n * how they should interact with surfaces that do. If set to zero, the\n * surface indicates that it would like to be moved to avoid occluding\n * surfaces with a positive exclusive zone. If set to -1, the surface\n * indicates that it would not like to be moved to accommodate for other\n * surfaces, and the compositor should extend it all the way to the edges\n * it is anchored to.\n *\n * For example, a panel might set its exclusive zone to 10, so that\n * maximized shell surfaces are not shown on top of it. A notification\n * might set its exclusive zone to 0, so that it is moved to avoid\n * occluding the panel, but shell surfaces are shown underneath it. A\n * wallpaper or lock screen might set their exclusive zone to -1, so that\n * they stretch below or over the panel.\n *\n * The default value is 0.\n *\n * Exclusive zone is double-buffered, see wl_surface.commit.\n */\nstatic inline void zwlr_layer_surface_v1_set_exclusive_zone(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, int32_t zone) {\n  wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwlr_layer_surface_v1,\n      ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE, NULL,\n      wl_proxy_get_version((struct wl_proxy *)zwlr_layer_surface_v1), 0, zone);\n}\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n *\n * Requests that the surface be placed some distance away from the anchor\n * point on the output, in surface-local coordinates. Setting this value\n * for edges you are not anchored to has no effect.\n *\n * The exclusive zone includes the margin.\n *\n * Margin is double-buffered, see wl_surface.commit.\n */\nstatic inline void zwlr_layer_surface_v1_set_margin(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, int32_t top,\n    int32_t right, int32_t bottom, int32_t left) {\n  wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwlr_layer_surface_v1,\n      ZWLR_LAYER_SURFACE_V1_SET_MARGIN, NULL,\n      wl_proxy_get_version((struct wl_proxy *)zwlr_layer_surface_v1), 0, top,\n      right, bottom, left);\n}\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n *\n * Set how keyboard events are delivered to this surface. By default,\n * layer shell surfaces do not receive keyboard events; this request can\n * be used to change this.\n *\n * This setting is inherited by child surfaces set by the get_popup\n * request.\n *\n * Layer surfaces receive pointer, touch, and tablet events normally. If\n * you do not want to receive them, set the input region on your surface\n * to an empty region.\n *\n * Keyboard interactivity is double-buffered, see wl_surface.commit.\n */\nstatic inline void zwlr_layer_surface_v1_set_keyboard_interactivity(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1,\n    uint32_t keyboard_interactivity) {\n  wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwlr_layer_surface_v1,\n      ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY, NULL,\n      wl_proxy_get_version((struct wl_proxy *)zwlr_layer_surface_v1), 0,\n      keyboard_interactivity);\n}\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n *\n * This assigns an xdg_popup's parent to this layer_surface.  This popup\n * should have been created via xdg_surface::get_popup with the parent set\n * to NULL, and this request must be invoked before committing the popup's\n * initial state.\n *\n * See the documentation of xdg_popup for more details about what an\n * xdg_popup is and how it is used.\n */\nstatic inline void zwlr_layer_surface_v1_get_popup(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1,\n    struct xdg_popup *popup) {\n  wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwlr_layer_surface_v1, ZWLR_LAYER_SURFACE_V1_GET_POPUP,\n      NULL, wl_proxy_get_version((struct wl_proxy *)zwlr_layer_surface_v1), 0,\n      popup);\n}\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n *\n * When a configure event is received, if a client commits the\n * surface in response to the configure event, then the client\n * must make an ack_configure request sometime before the commit\n * request, passing along the serial of the configure event.\n *\n * If the client receives multiple configure events before it\n * can respond to one, it only has to ack the last configure event.\n *\n * A client is not required to commit immediately after sending\n * an ack_configure request - it may even ack_configure several times\n * before its next surface commit.\n *\n * A client may send multiple ack_configure requests before committing, but\n * only the last request sent before a commit indicates which configure\n * event the client really is responding to.\n */\nstatic inline void zwlr_layer_surface_v1_ack_configure(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t serial) {\n  wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwlr_layer_surface_v1,\n      ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE, NULL,\n      wl_proxy_get_version((struct wl_proxy *)zwlr_layer_surface_v1), 0,\n      serial);\n}\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n *\n * This request destroys the layer surface.\n */\nstatic inline void zwlr_layer_surface_v1_destroy(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1) {\n  wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwlr_layer_surface_v1, ZWLR_LAYER_SURFACE_V1_DESTROY,\n      NULL, wl_proxy_get_version((struct wl_proxy *)zwlr_layer_surface_v1),\n      WL_MARSHAL_FLAG_DESTROY);\n}\n\n/**\n * @ingroup iface_zwlr_layer_surface_v1\n *\n * Change the layer that the surface is rendered on.\n *\n * Layer is double-buffered, see wl_surface.commit.\n */\nstatic inline void zwlr_layer_surface_v1_set_layer(\n    struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t layer) {\n  wl_proxy_marshal_flags(\n      (struct wl_proxy *)zwlr_layer_surface_v1, ZWLR_LAYER_SURFACE_V1_SET_LAYER,\n      NULL, wl_proxy_get_version((struct wl_proxy *)zwlr_layer_surface_v1), 0,\n      layer);\n}\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  }
]