smithay-client-toolkit-0.16.1/.cargo_vcs_info.json0000644000000001360000000000100155360ustar { "git": { "sha1": "c7427062938c066b36477d97969669336ffcd0dc" }, "path_in_vcs": "" }smithay-client-toolkit-0.16.1/.cirrus.yml000064400000000000000000000010761046102023000164420ustar 00000000000000task: only_if: $CIRRUS_BRANCH == 'master' || $CIRRUS_PR != '' matrix: - name: FreeBSD 12.1 freebsd_instance: image_family: freebsd-12-1-snap - name: FreeBSD 13.0 freebsd_instance: image_family: freebsd-13-0-snap # Install Rust setup_script: - fetch https://sh.rustup.rs -o rustup.sh - sh rustup.sh -y --profile=minimal --default-toolchain stable - pkg install -y cmake fontconfig pkgconf test_script: - . $HOME/.cargo/env - mkdir -p $HOME/sockets - export XDG_RUNTIME_DIR="$HOME/sockets" - cargo test smithay-client-toolkit-0.16.1/.github/workflows/ci.yml000064400000000000000000000030141046102023000210370ustar 00000000000000name: Continuous Integration on: push: branches: - master pull_request: jobs: ci: strategy: fail-fast: false matrix: rust: ['1.61.0', 'stable', 'beta'] runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v2 - name: Cargo cache uses: actions/cache@v1 with: path: ~/.cargo key: cargo-${{ matrix.rust }} - name: Rust toolchain uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.rust }} override: true - name: Install libxkbcommon run: sudo apt-get install libxkbcommon-dev - name: Test lib no features uses: actions-rs/cargo@v1 with: command: test args: --no-default-features --lib - name: Test doc no features uses: actions-rs/cargo@v1 with: command: test args: --no-default-features --doc - name: Test full features uses: actions-rs/cargo@v1 with: command: test args: --all-features lint: runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v2 - name: Rust toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable override: true components: rustfmt, clippy - name: Cargo fmt run: cargo fmt --all -- --check - name: Clippy run: cargo clippy -- -D warnings smithay-client-toolkit-0.16.1/.github/workflows/docs.yml000064400000000000000000000015541046102023000214030ustar 00000000000000name: Deploy Docs to GitHub Pages on: push: branches: - master jobs: doc: name: Documentation on Github Pages runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v2 - name: Cargo cache uses: actions/cache@v1 with: path: ~/.cargo key: cargo-stable - name: Rust toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable override: true - name: Build Documentation uses: actions-rs/cargo@v1 with: command: doc args: --no-deps - name: Setup index run: cp ./doc_index.html ./target/doc/index.html - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./target/doc smithay-client-toolkit-0.16.1/.gitignore000064400000000000000000000000431046102023000163130ustar 00000000000000/rls /target **/*.rs.bk Cargo.lock smithay-client-toolkit-0.16.1/CHANGELOG.md000064400000000000000000000304101046102023000161350ustar 00000000000000# Change Log ## Unreleased ## 0.16.1 - 2023-09-18 #### Bugfixes - Restrict `SimpleGlobal` bindings to our max API version ## 0.16.0 - 2022-06-18 #### Breaking changes - `calloop` is updated to version 0.10, and the keyboard handling API is slightly changed as a result. #### Additions - `DataDevice::with_dnd` and `DataOffer::receive_to_fd` allow more flexible interfaction with the data device abstraction - the output integration now supports version `4` of `wl_output` ## 0.15.4 - 2022-04-10 #### Bugfixes - `Window`'s `wl_pointer` not being relased on `Drop`. ## 0.15.3 - 2021-12-27 #### Bugfixes - SCTK now correctly interacts with the wayland socket being conccurently poolled from other threads. ## 0.15.2 - 2021-10-27 - Most types are now `Debug` ## 0.15.1 - 2021-08-23 #### Bugfixes - when not using `dlopen` feature, `xkbdcommon` library is linked using `pkg-config` ## 0.15.0 - 2021-08-10 #### Breaking Changes - Update `wayland-client` to 0.29 #### Additions - `AutoMemPool` now guarantees a minimum alignment of returned buffers ## 0.14.0 - 2021-05-07 #### Breaking Changes - `ConceptFrame` is removed, as well as the `frames` cargo feature, and replaced by a more minimalistic `FallbackFrame`. Dependency on `andrew` and `fontconfig` is dropped in the process. If fancier decorations are needed, they should be implemented using the `Frame` trait. - Update to calloop 0.7: `calloop::Source` is replaced by `calloop::RegistrationToken` #### Additions - `AutoMemPool` added as an alternative to the existing SHM pools ## 0.13.0 - 2021-03-04 #### Breaking Changes - Mark OutputInfo as `#[non_exhaustive]` to allow future expansion without breaking API. - Batch output information updates instead of potentially making multiple callbacks for one logical change - Add name and description fields to OutputInfo. #### Additions - `Window::start_interactive_move` to enable dragging the window with a user action #### Bugfixes - `ConceptFrame` now correctly loads fonts using fontconfig ## 0.12.2 -- 2020-12-30 #### Changes - Dependency on `byteorder` was replaced with `u32::from_ne_bytes()` #### Bugfixes - Don't crash when the font cannot be loaded to draw decorations ## 0.12.1 -- 2020-12-08 #### Changes - Unmaintained `memmap` dependency is replaced with `memmap2` ## 0.12.0 -- 2020-09-30 #### Breaking Changes - Update `wayland-client` to version 0.28 - `Environment::init` was renamed to `Environment::new_pending` - `init_default_environment!` macro was renamed to `new_default_environment!` #### Additions - `Environment::new` method to fully bootstrap environment ## 0.11.0 -- 2020-08-30 #### Breaking Changes - `window.set_decorate` is now taking mutable reference - Added `show_window_menu` on a `Frame` trait to request a window menu for a window. - `ShowMenu` enum variant to `FrameRequest` - `create_window` now also takes `Option` - `Frame::init` now also takes `Option` to reuse users' `ThemeManager` #### Additions - `WaylandSource::queue` to access the `EventQueue` underlying a `WaylandSource` - A window menu could be shown on right click on decorations for `ConceptFrame` - `ConceptFrame` will no longer change cursor over base surface if `ThemeManager` was provided #### Changes - `Window::set_title` now truncates the provided string to 1024 bytes, to avoid blowing up the Wayland connection - `ConceptFrame` is now hiding decorations for `State::Fullscreen` - Restore original size of fullscreened window on unfullscreen - Explicitly setting `ClientSide` decorations will result in `ServerSide` ones being destroyed - Requesting `ServerSide` decorations in `set_decorate` will now fallback to `ClientSide` if the former are not available - Requesting `None` decorations if `ServerSide` are presented will result in setting `ClientSide` decorations with hidden frame - `ConceptFrame` will use `Disabled` style for maximized button for non-resizeable frame - `ConceptFrame` will create subsurfaces for client side decorations only if a frame is visible - `Window` will restore original size after being tiled #### Bugfixes - Toggling between `ServerSide` and `None` decorations raising protocol error - Precision in a rate of key repeat events - `ThemeManager` not being clone-able even if it was stated in docs - Repeat rate not being disabled when receiving zero for `rate` in `wl_keyboard.repeat_info` ## 0.10.0 -- 2020-07-10 #### Breaking Changes - `create_surface` and `create_surface_with_scale_callback` now return `Attached` - Update `wayland-client` to `0.27` #### Changes - `andrew` is updated to `0.3`. #### Bugfixes - seat: Seats with an empty name are no longer filtered out ## 0.9.1 -- 2020-05-03 #### Additions - keyboard: Update the keysyms list with new symbols - Add primary selection helpers, which are included as part of default `Environment`. #### Changes - surfaces: dpi-aware surface will no longer believe their DPI factor reverts to 1 when they become hidden. #### BugFixes - keyboard: Remove the unnecessary type parameter of `map_keyboard` ## 0.9.0 -- 2020-04-22 #### Breaking Changes - `AutoThemer` is removed as it is no longer necessary with `wayland-cursor` 0.26 - `calloop` is updated to 0.6, and the adapters are modified in consequence #### Additions - Add `clone_seat_data()` method as a shorthand to get `SeatData` #### Bugfixes - Surface lock held across scale factor callback deadlocks scale factor API. ## 0.8.1 -- 2020-04-09 #### Additions - Add `listen_for_outputs()` which calls a provided callback on creation/removal of outputs. - Add an `OutputHandling` trait making `listen_for_outputs()` available on `Environment`. - Introduce the `calloop` cargo feature, enabled by default, controlling the support for the calloop event loop - Introduce the `frames` cargo feature, enabled by default, controlling the existence of provided `Frame` implementations (currently `ConceptFrame`) and the dependency on `andrew` ## 0.8.0 -- 2020-02-27 #### Breaking Changes - `Frame` configuration is now done through a `Frame::Config` associated type and the `Theme` trait is removed. - Merge `Frame::set_active` and `Frame::set_maximized` into `Frame::set_states` #### Additions - HiDPI scaling for decorations #### Bugfixes - HiDPI cursor icon position - Fix graphical glitches in `ConceptFrame` decoration drawing - Black pixel on left-bottom corner on CSD - Remove a deadlock when trying to access the seat data from within the seat callback ## 0.7.0 -- 2020-02-07 #### Breaking changes - Upgrade to `wayland-client` 0.25. This changes the prototype of most callbacks by adding the `DispatchData` mechanism for state sharing - Re-structure the lib API around the new `Environment` type as an entry point (breaks a lot of things). This makes the crate follow a monolithic-modular structure centered on this type. - `keyboard` is now a submodule of `seat` - `keyboard` key repetition is now handled as a calloop event source - `pointer` is now a submodule of `seat` - The initialization of `pointer` theming utilities now require a `ThemeSpec` argument instead of just a theme name, allowing control over the size of the cursors as well - Pointer theming utilities can no longer be shared across threads, as it was racy. - `Window` now tracks new seats automatically (the `new_seat` method is removed) - `Window` can no longer be shared across threads, as it was racy. - Decorations management is now handled with the `Decorations` enum, for full control to clients. #### Additions - The `pointer` theming will now read the `XCURSOR_THEME` and `XCURSOR_SIZE` environment variables to figure the default theme - `pointer` theming utilities now handle HiDPI monitors - SCTK now uses the `log` crate to log its warning and error messages - Data offers `ReadPipe`scan be inserted in a calloop event loop as an event source - The `WaylandSource` wrapper allows a `wayland-client` `EventQueue` to be inserted into a calloop event source. ## 0.6.4 -- 2019-08-27 #### Bugfixes - Keyboard input breaking when `LC_ALL`, `LC_CTYPE` or `LANG` are set to an empty string - UTF8 interpretation no longer stops working if loading the compose table failed ## 0.6.3 -- 2019-06-29 - Keyboard: fix extra key repeat when using also releasing a modifier ## 0.6.2 -- 2019-06-13 - Update `Nix` to 0.14 ## 0.6.1 -- 2019-04-07 - Additional theming capability on `ConceptFrame` via the `Theme` trait: optional methods `get__button_icon_color` allows the stroke color on the buttons to be customized beyond what the secondary color allows. Button color methods now affect the `ConceptFrame`'s fill behind the buttons. - Fix the firing of `Configure` events in window abstraction. ## 0.6.0 -- 2019-02-18 #### Breaking changes - Upgrade to `wayland-client` version 0.23 ## 0.5.0 -- 2019-02-05 #### Breaking changes - Update the crate to `wayland-client` version 0.22 - Window: `set_title()` now requires a manual `refresh()` for the change to take effect #### Bugfixes - Keyboard: fix system repeat rate as repeats per second rather then millisecond delay between repeats - Surface: fix panic in `compute_dpi_factor()` by only computing the dpi factor on surfaces known to the OutputMgr ## 0.4.4 -- 2018-12-27 - Shell: expose shell interface and add `create_shell_surface` to `Environment`. - Fix build failure on big endian targets ## 0.4.3 -- 2018-12-03 - Update dependencies: rand, memmap, nix and image - Surface: `create_surface` and `get_dpi_factor` utilities for creating dpi aware surfaces. ## 0.4.2 -- 2018-11-14 - Fix compilation on BSD systems ## 0.4.1 -- 2018-11-06 - Window: always request server-side decorations if available, otherwise ther compositor never configures us - keyboard: only compute utf8 value on keypress, not key release. Otherwise it confuses `xkb_compose`. ## 0.4.0 -- 2018-10-09 - BasicFrame: Display the title of the window in the window header - Pass `set_selection()` `Option` and `AutoThemer::init()` `Proxy` by reference - Window: add `set_theme()` function which takes an object implementing the trait `Theme` to adjust the look of window decorations - Window: add new `ConceptFrame` which provides an alternative to the `BasicFrame` window decorations - MemPool: add `mmap` method - **[Breaking]** Keyboard: remove `modifiers` field from `keyboard::Event::Enter`, `keyboard::Event::Key` and `keyboard::KeyRepeatEvent` - **[Breaking]** Keyboard: add `keyboard::Event::Modifiers` - **[Breaking]** Upgrade to wayland-rs 0.21 - Keyboard: end key repetition when the keyboard loses focus ## 0.3.0 -- 2018-08-17 - Window: the minimum window width is set to 2 pixels to circumvent a bug in mutter - https://gitlab.gnome.org/GNOME/mutter/issues/259 - **[Breaking]** MemPool: MemPool now requires an implementation to be called when the pool becomes free - **[Breaking]** DoubleMemPool: DoubleMemPool now requires an implementation to be called when one of its pools becomes free - **[Breaking]** DoubleMemPool: `swap()` is removed as `pool()` will now automatically track and return any free pools avaliable or return None - Keyboard: add key repetition with 'map_keyboard_auto_with_repeat' and 'map_keyboard_rmlvo_with_repeat' - Window: add `init_with_decorations` to allow the use of server-side decorations ## 0.2.6 -- 2018-07-14 Big thanks to @trimental for improving the visual look of the window decorations: - BasicFrame: remove side and bottom border decorations - BasicFrame: round window corners ## 0.2.5 -- 2018-07-10 - Keyboard: try to load `libxkbcommon.so.0` as well to improve compatibility ## 0.2.4 -- 2018-06-26 - Window: notify the compositor of our dimensions to avoid placement glitches ## 0.2.3 -- 2018-06-08 - Update `nix` dependency to be fix build on FreeBSD (even if we can't run) ## 0.2.2 -- 2018-06-08 - BasicFrame: don't desync the subsurface from the main one. This avoids graphical glitches where the borders are not drawn exactly the same size as the contents. - Window: add `set_resizable`, (minor **breaking change** of the `Frame` trait by adding a new method) ## 0.2.1 -- 2018-05-03 - Add `DoubleMemPool` for double buffering, and use it to improve the drawing performance of `BasicFrame`. ## 0.2.0 -- 2018-04-29 - *Breaking* OutputMgr: expose wl_output global id ## 0.1.0 -- 2018-04-26 Initial version, including: - basic environment manager - keyboard keymap handling - basic window decoration smithay-client-toolkit-0.16.1/CONTRIBUTING.md000064400000000000000000000044021046102023000165570ustar 00000000000000# Contributing Smithay's Client ToolKit (SCTK) is open to contributions from anyone. ## Coordination Most discussion about features and their implementations takes place on github. If you have questions, suggestions, ideas, you can open an issue to discuss it, or add your message in an already existing issue if it fits its scope. If you want a more realtime discussion there is a a Matrix room dedicated to the Smithay project: [#smithay:matrix.org](https://matrix.to/#/#smithay:matrix.org). If you don't want to use matrix, this room is also bridged to gitter: https://gitter.im/smithay/Lobby. ## Scope & Structure SCTK aims to provide generic building blocks to write wayland clients, abstracting away the boilerplate of the wayland protocol while allowing direct control when wanted. As such, it is composed of several loosely-coupled modules, which can be used independenly of each other. This given, if you want to contribute a new feature to SCTK, please consider these design points: - The feature should be designed it is most general form, allowing it to be used by other projects, probaby different from the exact use-case you have in mind. - This new feature should not heavily depend on the other parts of SCTK if it can avoid it. As much as possible, SCTK users should be able to use your feature alone. ## Pull requests & commits organisation The development branch is the `master` branch, and it should be the target of your pull requests. In general, single-purpose pull requests are prefered. If you have two independent contributions to make, please open two different pull requests. On the other hand, if you have changes that could technically be separated, but really belong together (for example a new feature, that first require some refactoring before being introduced), it is okay to ship them in the same pull request. However, to simplify the review work (and future reference to the commit history), these changes should be separated in different commits. This will allow the reviewers to review each commit independently, reducing the cognitive load. At merge time, pull requests consisting of a single commit or of a few well-scoped commits will be rebased on master. Pull requests which have accumulated several review-addressing commits will be squashed. smithay-client-toolkit-0.16.1/Cargo.lock0000644000000442640000000000100135230ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "adler" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bit_field" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bytemuck" version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "calloop" version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a59225be45a478d772ce015d9743e49e92798ece9e34eda9a6aa2a6a7f40192" dependencies = [ "log", "nix 0.25.1", "slotmap", "thiserror", "vec_map", ] [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "color_quant" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "crc32fast" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" dependencies = [ "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" version = "0.9.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", "memoffset 0.8.0", "scopeguard", ] [[package]] name = "crossbeam-utils" version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" dependencies = [ "cfg-if", ] [[package]] name = "crunchy" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "dlib" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" dependencies = [ "libloading", ] [[package]] name = "downcast-rs" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "either" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "exr" version = "1.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "832a761f35ab3e6664babfbdc6cef35a4860e816ec3916dcfd0882954e98a8a8" dependencies = [ "bit_field", "flume", "half", "lebe", "miniz_oxide 0.7.1", "rayon-core", "smallvec", "zune-inflate", ] [[package]] name = "flate2" version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", "miniz_oxide 0.6.2", ] [[package]] name = "flume" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ "spin", ] [[package]] name = "gif" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045" dependencies = [ "color_quant", "weezl", ] [[package]] name = "half" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02b4af3693f1b705df946e9fe5631932443781d0aabb423b62fcd4d73f6d2fd0" dependencies = [ "crunchy", ] [[package]] name = "hermit-abi" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" dependencies = [ "libc", ] [[package]] name = "image" version = "0.24.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711" dependencies = [ "bytemuck", "byteorder", "color_quant", "exr", "gif", "jpeg-decoder", "num-rational", "num-traits", "png", "qoi", "tiff", ] [[package]] name = "jpeg-decoder" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e" dependencies = [ "rayon", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lebe" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" version = "0.2.140" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" [[package]] name = "libloading" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ "cfg-if", "winapi", ] [[package]] name = "lock_api" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" dependencies = [ "autocfg", "scopeguard", ] [[package]] name = "log" version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if", ] [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" dependencies = [ "libc", ] [[package]] name = "memoffset" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] [[package]] name = "memoffset" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" dependencies = [ "autocfg", ] [[package]] name = "minimal-lexical" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] [[package]] name = "miniz_oxide" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", ] [[package]] name = "nix" version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags", "cfg-if", "libc", "memoffset 0.6.5", ] [[package]] name = "nix" version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", "bitflags", "cfg-if", "libc", "memoffset 0.6.5", ] [[package]] name = "nom" version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", ] [[package]] name = "num-integer" version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", "num-traits", ] [[package]] name = "num-rational" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-traits" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ "hermit-abi", "libc", ] [[package]] name = "once_cell" version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "pkg-config" version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "png" version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638" dependencies = [ "bitflags", "crc32fast", "flate2", "miniz_oxide 0.6.2", ] [[package]] name = "proc-macro2" version = "1.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba466839c78239c09faf015484e5cc04860f88242cff4d03eb038f04b4699b73" dependencies = [ "unicode-ident", ] [[package]] name = "qoi" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" dependencies = [ "bytemuck", ] [[package]] name = "quote" version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] [[package]] name = "rayon" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" dependencies = [ "either", "rayon-core", ] [[package]] name = "rayon-core" version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" dependencies = [ "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", "num_cpus", ] [[package]] name = "scoped-tls" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "simd-adler32" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "slotmap" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" dependencies = [ "version_check", ] [[package]] name = "smallvec" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "smithay-client-toolkit" version = "0.16.1" dependencies = [ "bitflags", "calloop", "dlib", "image", "lazy_static", "log", "memmap2", "nix 0.24.3", "pkg-config", "wayland-client", "wayland-cursor", "wayland-protocols", ] [[package]] name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" dependencies = [ "lock_api", ] [[package]] name = "syn" version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ece519cfaf36269ea69d16c363fa1d59ceba8296bbfbfc003c3176d01f2816ee" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "thiserror" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "tiff" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d172b0f4d3fba17ba89811858b9d3d97f928aece846475bbda076ca46736211" dependencies = [ "flate2", "jpeg-decoder", "weezl", ] [[package]] name = "unicode-ident" version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wayland-client" version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" dependencies = [ "bitflags", "downcast-rs", "libc", "nix 0.24.3", "scoped-tls", "wayland-commons", "wayland-scanner", "wayland-sys", ] [[package]] name = "wayland-commons" version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" dependencies = [ "nix 0.24.3", "once_cell", "smallvec", "wayland-sys", ] [[package]] name = "wayland-cursor" version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" dependencies = [ "nix 0.24.3", "wayland-client", "xcursor", ] [[package]] name = "wayland-protocols" version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" dependencies = [ "bitflags", "wayland-client", "wayland-commons", "wayland-scanner", ] [[package]] name = "wayland-scanner" version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" dependencies = [ "proc-macro2", "quote", "xml-rs", ] [[package]] name = "wayland-sys" version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" dependencies = [ "dlib", "lazy_static", "pkg-config", ] [[package]] name = "weezl" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xcursor" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7" dependencies = [ "nom", ] [[package]] name = "xml-rs" version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bab77e97b50aee93da431f2cee7cd0f43b4d1da3c408042f2d7d164187774f0a" [[package]] name = "zune-inflate" version = "0.2.54" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" dependencies = [ "simd-adler32", ] smithay-client-toolkit-0.16.1/Cargo.toml0000644000000031230000000000100135330ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "smithay-client-toolkit" version = "0.16.1" authors = ["Victor Berger "] description = "Toolkit for making client wayland applications." documentation = "https://smithay.github.io/client-toolkit" readme = "README.md" keywords = [ "wayland", "client", ] categories = ["gui"] license = "MIT" repository = "https://github.com/smithay/client-toolkit" [dependencies.bitflags] version = "1.0" [dependencies.calloop] version = "0.10" optional = true [dependencies.dlib] version = "0.5" [dependencies.lazy_static] version = "1.0" [dependencies.log] version = "0.4" [dependencies.memmap2] version = "0.5.0" [dependencies.nix] version = "0.24" features = [ "mman", "fs", ] default-features = false [dependencies.wayland-client] version = "0.29" [dependencies.wayland-cursor] version = "0.29" [dependencies.wayland-protocols] version = "0.29" features = [ "client", "unstable_protocols", ] [dev-dependencies.image] version = "0.24" [build-dependencies.pkg-config] version = "0.3" [features] default = [ "calloop", "dlopen", ] dlopen = ["wayland-client/dlopen"] smithay-client-toolkit-0.16.1/Cargo.toml.orig000064400000000000000000000016231046102023000172170ustar 00000000000000[package] name = "smithay-client-toolkit" version = "0.16.1" authors = ["Victor Berger "] documentation = "https://smithay.github.io/client-toolkit" repository = "https://github.com/smithay/client-toolkit" license = "MIT" edition = "2018" categories = ["gui"] keywords = ["wayland", "client"] description = "Toolkit for making client wayland applications." readme = "README.md" [dependencies] bitflags = "1.0" nix = { version = "0.24", default-features = false, features = ["mman", "fs"] } dlib = "0.5" lazy_static = "1.0" memmap2 = "0.5.0" log = "0.4" wayland-client = "0.29" wayland-protocols = { version = "0.29" , features = ["client", "unstable_protocols"] } wayland-cursor = "0.29" calloop = { version = "0.10", optional = true } [features] default = ["calloop", "dlopen"] dlopen = ["wayland-client/dlopen"] [build-dependencies] pkg-config = "0.3" [dev-dependencies] image = "0.24" smithay-client-toolkit-0.16.1/LICENSE.txt000064400000000000000000000020401046102023000161450ustar 00000000000000Copyright (c) 2018 Victor Berger Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.smithay-client-toolkit-0.16.1/README.md000064400000000000000000000025431046102023000156110ustar 00000000000000[![crates.io](https://img.shields.io/crates/v/smithay-client-toolkit.svg)](https://crates.io/crates/smithay-client-toolkit) [![docs.rs](https://docs.rs/smithay-client-toolkit/badge.svg)](https://docs.rs/smithay-client-toolkit) [![Build Status](https://github.com/Smithay/client-toolkit/workflows/Continuous%20Integration/badge.svg)](https://github.com/Smithay/client-toolkit/actions?query=workflow%3A%22Continuous+Integration%22) # Smithay's Client Toolkit This crate is a toolkit for writing wayland clients in rust, on top of [wayland-client](https://crates.io/crates/wayland-client). Currently a work in progress, it currently provides the following utilities: - Automatic binding of general wayland globals (`wl_compositor`, `wl_shm`, etc..) - Abstraction to create windows (aka toplevel surfaces), abstracting the interaction with the shell (`xdg_shell` or `wl_shell`) and the drawing of decorations - Wrapper for `wl_keyboard` for automatic keymap interpretation using `libxkbcommon.so`. - Utilites for creating dpi aware surfaces. ## Documentation The documentation for the master branch is [available online](https://smithay.github.io/client-toolkit/). The documentation for the releases can be found on [docs.rs](https://docs.rs/smithay-client-toolkit). ## Requirements Requires at least rust 1.61 to be used and version 1.12 of the wayland system libraries. smithay-client-toolkit-0.16.1/build.rs000064400000000000000000000002061046102023000157710ustar 00000000000000extern crate pkg_config; fn main() { #[cfg(not(feature = "dlopen"))] pkg_config::Config::new().find("xkbcommon").unwrap(); } smithay-client-toolkit-0.16.1/doc_index.html000064400000000000000000000002121046102023000171430ustar 00000000000000 smithay-client-toolkit-0.16.1/examples/compositor_info.rs000064400000000000000000000050731046102023000217300ustar 00000000000000extern crate smithay_client_toolkit as sctk; use sctk::shell::Shell; // This is a small program that queries the compositor for // various information and prints them on the console before exiting. sctk::default_environment!(CompInfo, desktop); fn main() -> Result<(), ()> { let (env, _display, _queue) = sctk::new_default_environment!(CompInfo, desktop) .expect("Unable to connect to a Wayland compositor"); println!("== Smithay's compositor info tool ==\n"); // print the best supported shell println!( "-> Most recent shell supported by the compositor is {}.", match env.get_shell() { Some(Shell::Wl(_)) => "the legacy wl_shell", Some(Shell::Zxdg(_)) => "the old unstable xdg_shell (zxdg_shell_v6)", Some(Shell::Xdg(_)) => "the current xdg_shell", None => "nothing", } ); println!(); // print the outputs let outputs = env.get_all_outputs(); println!("-> Compositor advertised {} outputs:", outputs.len()); for output in outputs { sctk::output::with_output_info(&output, |info| { println!( " -> #{}: {} ({}), with scale factor of {}", info.id, info.model, info.make, info.scale_factor ); println!(" Possible modes are:"); for mode in &info.modes { println!( " -> [{}{}] {} x {} @ {}.{} Hz", if mode.is_preferred { "p" } else { " " }, if mode.is_current { "c" } else { " " }, mode.dimensions.0, mode.dimensions.1, mode.refresh_rate / 1000, mode.refresh_rate % 1000 ); } }); } println!(); // print the seats let seats = env.get_all_seats(); println!("-> Compositor advertised {} seats:", seats.len()); for seat in seats { sctk::seat::with_seat_data(&seat, |data| { print!(" -> {} with capabilities: ", data.name); if data.has_pointer { print!("pointer "); } if data.has_keyboard { print!("keyboard "); } if data.has_touch { print!("touch "); } println!(); }); } /* if env.decorations_mgr.is_some() { println!("-> Compositor supports server-side decorations.") } else { println!("-> Compositor does not support server-side decorations.") } */ Ok(()) } smithay-client-toolkit-0.16.1/examples/image_viewer.rs000064400000000000000000000314151046102023000211610ustar 00000000000000extern crate image; extern crate smithay_client_toolkit as sctk; use std::env; use sctk::reexports::client::protocol::{wl_shm, wl_surface}; use sctk::shm::AutoMemPool; use sctk::window::{Event as WEvent, FallbackFrame, State}; sctk::default_environment!(ImViewerExample, desktop); fn main() { // First of all, retrieve the path from the program arguments: let path = match env::args_os().nth(1) { Some(p) => p, None => { println!("USAGE: ./image_wiewer "); return; } }; // now, try to open the image // the image crate will take care of auto-detecting the file format let image = match image::open(&path) { Ok(i) => i, Err(e) => { println!("Failed to open image {}.", path.to_string_lossy()); println!("Error was: {:?}", e); return; } }; // We'll need the image in RGBA for drawing it let image = image.to_rgba8(); /* * Initalize the wayland connection */ let (env, _display, mut queue) = sctk::new_default_environment!(ImViewerExample, desktop) .expect("Unable to connect to a Wayland compositor"); // Use the compositor global to create a new surface let surface = env .create_surface_with_scale_callback(|dpi, _surface, _dispatch_data| { println!("dpi changed to {}", dpi); }) .detach(); /* * Init the window */ // First of all, this Option will store // any event from the window that we'll need to process. We // store them and will process them later in the event loop // rather that process them directly because in a batch of // generated events, often only the last one needs to actually // be processed, and some events may render other obsoletes. // See the closure a few lines below for details let mut next_action = None::; // Now we actually create the window. The type parameter `ConceptFrame` here // specifies the type we want to use to draw the borders. To create your own // decorations you just need an object to implement the `Frame` trait. let mut window = env .create_window::( surface, // the wl_surface that serves as the basis of this window None, // None for theme_manager, since we don't theme pointer outself image.dimensions(), // the initial internal dimensions of the window move |evt, mut dispatch_data| { // This is the closure that process the Window events. // There are 3 possible events: // - Close: the user requested the window to be closed, we'll then quit // - Configure: the server suggested a new state for the window (possibly // a new size if a resize is in progress). We'll likely need to redraw // our contents // - Refresh: the frame itself needs to be redrawn. SCTK does not do this // automatically because it has a cost and should only be done in periods // of the event loop where the client actually wants to draw // Here we actually only keep the last event receive according to a priority // order of Close > Configure > Refresh. // Indeed, if we received a Close, there is not point drawing anything more as // we will exit. A new Configure overrides a previous one, and if we received // a Configure we will refresh the frame anyway. // We access the next_action Option via the dispatch_data provided by wayland-rs. let next_action = dispatch_data.get::>().unwrap(); // Check if we need to replace the old event by the new one let replace = matches!( (&evt, &*next_action), // replace if there is no old event (_, &None) // or the old event is refresh | (_, &Some(WEvent::Refresh)) // or we had a configure and received a new one | (&WEvent::Configure { .. }, &Some(WEvent::Configure { .. })) // or the new event is close | (&WEvent::Close, _) ); if replace { *next_action = Some(evt); } }, // creating the window may fail if the code drawing the frame // fails to initialize itself. For ConceptFrame this should not happen // unless the system is utterly broken, though. ) .expect("Failed to create a window !"); // Setting the windows title allows the compositor to know what your // window should be called and the title will be display on the header bar // of the windows decorations window.set_title("Image Viewer".to_string()); /* * Initialization of the memory pool */ let mut pool = env.create_auto_pool().expect("Failed to create the memory pool."); /* * Event Loop preparation and running */ // First, we initialize a few boolean flags that we'll use to track our state: // - the window needs to be redrawn let mut need_redraw = false; // - are we currently in the process of being resized? (to draw the image or // black content) let mut resizing = false; // - the size of our contents let mut dimensions = image.dimensions(); // if our shell does not need to wait for a configure event, we draw right away. // // Note that this is only the case for the old wl_shell protocol, which is now // deprecated. This code is only for compatibility with old server that do not // support the new standard xdg_shell protocol. // // But if we have fallbacked to wl_shell, we need to draw right away because we'll // never receive a configure event if we don't draw something... if !env.get_shell().unwrap().needs_configure() { // initial draw to bootstrap on wl_shell redraw(&mut pool, window.surface(), dimensions, if resizing { None } else { Some(&image) }) .expect("Failed to draw"); window.refresh(); } // We can now actually enter the event loop! loop { // First, check if any pending action was received by the // Window implementation: match next_action.take() { // We received a Close event, just break from the loop // and let the app quit Some(WEvent::Close) => break, // We receive a Refresh event, store that we need to refresh the // frame Some(WEvent::Refresh) => { window.refresh(); window.surface().commit(); } // We received a configure event, our action depends on its // contents Some(WEvent::Configure { new_size, states }) => { // the configure event contains a suggested size, // if it is different from our current size, we need to // update it and redraw if let Some((w, h)) = new_size { if dimensions != (w, h) { dimensions = (w, h); } } window.resize(dimensions.0, dimensions.1); window.refresh(); // Are we currently resizing ? // We check if a resizing just started or stopped, // because in this case we'll swap between drawing black // and drawing the window (or the reverse), and thus we need to // redraw let new_resizing = states.contains(&State::Resizing); resizing = new_resizing; need_redraw = true; } // No event, nothing new to do. None => {} } if need_redraw { // We don't need to redraw or refresh anymore =) need_redraw = false; redraw( &mut pool, window.surface(), dimensions, if resizing { None } else { Some(&image) }, ) .expect("Failed to draw") } // Finally, dispatch the event queue. This method blocks until a message // sends all our request to the server, then blocks until an event arrives // from it. It then processes all events by calling the implementation of // the target object for each, and only return once all pending messages // have been processed. queue.dispatch(&mut next_action, |_, _, _| {}).unwrap(); } } // The draw function, which drawn `base_image` in the provided `MemPool`, // at given dimensions. // // If `base_image` is `None`, it'll just draw black contents. This is to // improve performance during resizing: we need to redraw the window frequently // so that its dimensions follow the pointer during the resizing, but resizing the // image is costly and long. So during an interactive resize of the window we'll // just draw black contents to not feel laggy. fn redraw( pool: &mut AutoMemPool, surface: &wl_surface::WlSurface, (buf_x, buf_y): (u32, u32), base_image: Option<&image::ImageBuffer, Vec>>, ) -> Result<(), ::std::io::Error> { // We allocate a new buffer from the memory pool with the appropriate dimensions // This function automatically finds an unused space of the correct size in the memory // pool and returns it as a `&mut [u8]`, as well as a `wl_buffer` matching it. let (canvas, new_buffer) = pool.buffer( buf_x as i32, // width of the buffer, in pixels buf_y as i32, // height of the buffer, in pixels 4 * buf_x as i32, // stride: number of bytes between the start of two // consecutive rows of pixels wl_shm::Format::Argb8888, // the pixel format we wrote in )?; if let Some(base_image) = base_image { // We have an image to draw // first, resize it to the requested size. We just use the function provided // by the image crate here. let image = image::imageops::resize(base_image, buf_x, buf_y, image::imageops::FilterType::Nearest); // Now, we'll write the pixels of the image to the MemPool. // // We do this in an horribly inefficient manner, for the sake of simplicity. // We'll send pixels to the server in ARGB8888 format (this is one of the only // formats that are guaranteed to be supported), but image provides it in // RGBA8888, so we need to do the conversion. // // Additionally, if the image has some transparent parts, we'll blend them into // a white background, otherwise the server will draw our window with a // transparent background! for (src_pixel, dst_pixel) in image.pixels().zip(canvas.chunks_exact_mut(4)) { // retrieve the pixel values let r = src_pixel.0[0] as u32; let g = src_pixel.0[1] as u32; let b = src_pixel.0[2] as u32; let a = src_pixel.0[3] as u32; // blend them let r = ::std::cmp::min(0xFF, (0xFF * (0xFF - a) + a * r) / 0xFF); let g = ::std::cmp::min(0xFF, (0xFF * (0xFF - a) + a * g) / 0xFF); let b = ::std::cmp::min(0xFF, (0xFF * (0xFF - a) + a * b) / 0xFF); // write the pixel let pixel: [u8; 4] = ((0xFF << 24) + (r << 16) + (g << 8) + b).to_ne_bytes(); dst_pixel[0] = pixel[0]; dst_pixel[1] = pixel[1]; dst_pixel[2] = pixel[2]; dst_pixel[3] = pixel[3]; } } else { // We do not have any image to draw, so we draw black contents for dst_pixel in canvas.chunks_exact_mut(4) { dst_pixel[0] = 0x00; dst_pixel[1] = 0x00; dst_pixel[2] = 0x00; dst_pixel[3] = 0xFF; } } surface.attach(Some(&new_buffer), 0, 0); // damage the surface so that the compositor knows it needs to redraw it if surface.as_ref().version() >= 4 { // If our server is recent enough and supports at least version 4 of the // wl_surface interface, we can specify the damage in buffer coordinates. // This is obviously the best and do that if possible. surface.damage_buffer(0, 0, buf_x as i32, buf_y as i32); } else { // Otherwise, we fallback to compatilibity mode. Here we specify damage // in surface coordinates, which would have been different if we had drawn // our buffer at HiDPI resolution. We didn't though, so it is ok. // Using `damage_buffer` in general is better though. surface.damage(0, 0, buf_x as i32, buf_y as i32); } surface.commit(); Ok(()) } smithay-client-toolkit-0.16.1/examples/kbd_input.rs000064400000000000000000000175321046102023000205010ustar 00000000000000extern crate smithay_client_toolkit as sctk; use std::cmp::min; use sctk::reexports::calloop; use sctk::reexports::client::protocol::{wl_keyboard, wl_shm, wl_surface}; use sctk::seat::keyboard::{map_keyboard_repeat, Event as KbEvent, RepeatKind}; use sctk::shm::AutoMemPool; use sctk::window::{Event as WEvent, FallbackFrame}; sctk::default_environment!(KbdInputExample, desktop); fn main() { /* * Initial setup */ let (env, display, queue) = sctk::new_default_environment!(KbdInputExample, desktop) .expect("Unable to connect to a Wayland compositor"); /* * Prepare a calloop event loop to handle key repetion */ // Here `Option` is the type of a global value that will be shared by // all callbacks invoked by the event loop. let mut event_loop = calloop::EventLoop::>::try_new().unwrap(); /* * Create a buffer with window contents */ let mut dimensions = (320u32, 240u32); /* * Init wayland objects */ let surface = env.create_surface().detach(); let mut window = env .create_window::( surface, None, dimensions, move |evt, mut dispatch_data| { let next_action = dispatch_data.get::>().unwrap(); // Keep last event in priority order : Close > Configure > Refresh let replace = matches!( (&evt, &*next_action), (_, &None) | (_, &Some(WEvent::Refresh)) | (&WEvent::Configure { .. }, &Some(WEvent::Configure { .. })) | (&WEvent::Close, _) ); if replace { *next_action = Some(evt); } }, ) .expect("Failed to create a window !"); window.set_title("Kbd Input".to_string()); let mut pool = env.create_auto_pool().expect("Failed to create a memory pool !"); /* * Keyboard initialization */ let mut seats = Vec::<(String, Option)>::new(); // first process already existing seats for seat in env.get_all_seats() { if let Some((has_kbd, name)) = sctk::seat::with_seat_data(&seat, |seat_data| { (seat_data.has_keyboard && !seat_data.defunct, seat_data.name.clone()) }) { if has_kbd { let seat_name = name.clone(); match map_keyboard_repeat( event_loop.handle(), &seat, None, RepeatKind::System, move |event, _, _| print_keyboard_event(event, &seat_name), ) { Ok(kbd) => { seats.push((name, Some(kbd))); } Err(e) => { eprintln!("Failed to map keyboard on seat {} : {:?}.", name, e); seats.push((name, None)); } } } else { seats.push((name, None)); } } } // then setup a listener for changes let loop_handle = event_loop.handle(); let _seat_listener = env.listen_for_seats(move |seat, seat_data, _| { // find the seat in the vec of seats, or insert it if it is unknown let idx = seats.iter().position(|(name, _)| name == &seat_data.name); let idx = idx.unwrap_or_else(|| { seats.push((seat_data.name.clone(), None)); seats.len() - 1 }); let (_, ref mut opt_kbd) = &mut seats[idx]; // we should map a keyboard if the seat has the capability & is not defunct if seat_data.has_keyboard && !seat_data.defunct { if opt_kbd.is_none() { // we should initalize a keyboard let seat_name = seat_data.name.clone(); match map_keyboard_repeat( loop_handle.clone(), &seat, None, RepeatKind::System, move |event, _, _| print_keyboard_event(event, &seat_name), ) { Ok(kbd) => { *opt_kbd = Some(kbd); } Err(e) => { eprintln!("Failed to map keyboard on seat {} : {:?}.", seat_data.name, e) } } } } else if let Some(kbd) = opt_kbd.take() { // the keyboard has been removed, cleanup kbd.release(); } }); if !env.get_shell().unwrap().needs_configure() { // initial draw to bootstrap on wl_shell redraw(&mut pool, window.surface(), dimensions).expect("Failed to draw"); window.refresh(); } let mut next_action = None; sctk::WaylandSource::new(queue).quick_insert(event_loop.handle()).unwrap(); loop { match next_action.take() { Some(WEvent::Close) => break, Some(WEvent::Refresh) => { window.refresh(); window.surface().commit(); } Some(WEvent::Configure { new_size, states }) => { if let Some((w, h)) = new_size { window.resize(w, h); dimensions = (w, h) } println!("Window states: {:?}", states); window.refresh(); redraw(&mut pool, window.surface(), dimensions).expect("Failed to draw"); } None => {} } // always flush the connection before going to sleep waiting for events display.flush().unwrap(); event_loop.dispatch(None, &mut next_action).unwrap(); } } fn print_keyboard_event(event: KbEvent, seat_name: &str) { match event { KbEvent::Enter { keysyms, .. } => { println!("Gained focus on seat '{}' while {} keys pressed.", seat_name, keysyms.len(),); } KbEvent::Leave { .. } => { println!("Lost focus on seat '{}'.", seat_name); } KbEvent::Key { keysym, state, utf8, .. } => { println!("Key {:?}: {:x} on seat '{}'.", state, keysym, seat_name); if let Some(txt) = utf8 { println!(" -> Received text \"{}\".", txt); } } KbEvent::Modifiers { modifiers } => { println!("Modifiers changed to {:?} on seat '{}'.", modifiers, seat_name); } KbEvent::Repeat { keysym, utf8, .. } => { println!("Key repetition {:x} on seat '{}'.", keysym, seat_name); if let Some(txt) = utf8 { println!(" -> Received text \"{}\".", txt); } } } } #[allow(clippy::many_single_char_names)] fn redraw( pool: &mut AutoMemPool, surface: &wl_surface::WlSurface, (buf_x, buf_y): (u32, u32), ) -> Result<(), ::std::io::Error> { let (canvas, new_buffer) = pool.buffer(buf_x as i32, buf_y as i32, 4 * buf_x as i32, wl_shm::Format::Argb8888)?; for (i, dst_pixel) in canvas.chunks_exact_mut(4).enumerate() { let x = i as u32 % buf_x; let y = i as u32 / buf_x; let r: u32 = min(((buf_x - x) * 0xFF) / buf_x, ((buf_y - y) * 0xFF) / buf_y); let g: u32 = min((x * 0xFF) / buf_x, ((buf_y - y) * 0xFF) / buf_y); let b: u32 = min(((buf_x - x) * 0xFF) / buf_x, (y * 0xFF) / buf_y); let pixel: [u8; 4] = ((0xFF << 24) + (r << 16) + (g << 8) + b).to_ne_bytes(); dst_pixel[0] = pixel[0]; dst_pixel[1] = pixel[1]; dst_pixel[2] = pixel[2]; dst_pixel[3] = pixel[3]; } surface.attach(Some(&new_buffer), 0, 0); if surface.as_ref().version() >= 4 { surface.damage_buffer(0, 0, buf_x as i32, buf_y as i32); } else { surface.damage(0, 0, buf_x as i32, buf_y as i32); } surface.commit(); Ok(()) } smithay-client-toolkit-0.16.1/examples/layer_shell.rs000064400000000000000000000144131046102023000210200ustar 00000000000000use smithay_client_toolkit::{ default_environment, environment::SimpleGlobal, new_default_environment, output::{with_output_info, OutputInfo}, reexports::{ calloop, client::protocol::{wl_output, wl_shm, wl_surface}, client::{Attached, Main}, protocols::wlr::unstable::layer_shell::v1::client::{ zwlr_layer_shell_v1, zwlr_layer_surface_v1, }, }, shm::AutoMemPool, WaylandSource, }; use std::cell::{Cell, RefCell}; use std::rc::Rc; default_environment!(Env, fields = [ layer_shell: SimpleGlobal, ], singles = [ zwlr_layer_shell_v1::ZwlrLayerShellV1 => layer_shell ], ); #[derive(PartialEq, Copy, Clone)] enum RenderEvent { Configure { width: u32, height: u32 }, Closed, } struct Surface { surface: wl_surface::WlSurface, layer_surface: Main, next_render_event: Rc>>, pool: AutoMemPool, dimensions: (u32, u32), } impl Surface { fn new( output: &wl_output::WlOutput, surface: wl_surface::WlSurface, layer_shell: &Attached, pool: AutoMemPool, ) -> Self { let layer_surface = layer_shell.get_layer_surface( &surface, Some(output), zwlr_layer_shell_v1::Layer::Overlay, "example".to_owned(), ); layer_surface.set_size(32, 32); // Anchor to the top left corner of the output layer_surface .set_anchor(zwlr_layer_surface_v1::Anchor::Top | zwlr_layer_surface_v1::Anchor::Left); let next_render_event = Rc::new(Cell::new(None::)); let next_render_event_handle = Rc::clone(&next_render_event); layer_surface.quick_assign(move |layer_surface, event, _| { match (event, next_render_event_handle.get()) { (zwlr_layer_surface_v1::Event::Closed, _) => { next_render_event_handle.set(Some(RenderEvent::Closed)); } (zwlr_layer_surface_v1::Event::Configure { serial, width, height }, next) if next != Some(RenderEvent::Closed) => { layer_surface.ack_configure(serial); next_render_event_handle.set(Some(RenderEvent::Configure { width, height })); } (_, _) => {} } }); // Commit so that the server will send a configure event surface.commit(); Self { surface, layer_surface, next_render_event, pool, dimensions: (0, 0) } } /// Handles any events that have occurred since the last call, redrawing if needed. /// Returns true if the surface should be dropped. fn handle_events(&mut self) -> bool { match self.next_render_event.take() { Some(RenderEvent::Closed) => true, Some(RenderEvent::Configure { width, height }) => { if self.dimensions != (width, height) { self.dimensions = (width, height); self.draw(); } false } None => false, } } fn draw(&mut self) { let stride = 4 * self.dimensions.0 as i32; let width = self.dimensions.0 as i32; let height = self.dimensions.1 as i32; // Note: unwrap() is only used here in the interest of simplicity of the example. // A "real" application should handle the case where both pools are still in use by the // compositor. let (canvas, buffer) = self.pool.buffer(width, height, stride, wl_shm::Format::Argb8888).unwrap(); for dst_pixel in canvas.chunks_exact_mut(4) { let pixel = 0xff00ff00u32.to_ne_bytes(); dst_pixel[0] = pixel[0]; dst_pixel[1] = pixel[1]; dst_pixel[2] = pixel[2]; dst_pixel[3] = pixel[3]; } // Attach the buffer to the surface and mark the entire surface as damaged self.surface.attach(Some(&buffer), 0, 0); self.surface.damage_buffer(0, 0, width as i32, height as i32); // Finally, commit the surface self.surface.commit(); } } impl Drop for Surface { fn drop(&mut self) { self.layer_surface.destroy(); self.surface.destroy(); } } fn main() { let (env, display, queue) = new_default_environment!(Env, fields = [layer_shell: SimpleGlobal::new(),]) .expect("Initial roundtrip failed!"); let surfaces = Rc::new(RefCell::new(Vec::new())); let layer_shell = env.require_global::(); let env_handle = env.clone(); let surfaces_handle = Rc::clone(&surfaces); let output_handler = move |output: wl_output::WlOutput, info: &OutputInfo| { if info.obsolete { // an output has been removed, release it surfaces_handle.borrow_mut().retain(|(i, _)| *i != info.id); output.release(); } else { // an output has been created, construct a surface for it let surface = env_handle.create_surface().detach(); let pool = env_handle.create_auto_pool().expect("Failed to create a memory pool!"); (*surfaces_handle.borrow_mut()) .push((info.id, Surface::new(&output, surface, &layer_shell.clone(), pool))); } }; // Process currently existing outputs for output in env.get_all_outputs() { if let Some(info) = with_output_info(&output, Clone::clone) { output_handler(output, &info); } } // Setup a listener for changes // The listener will live for as long as we keep this handle alive let _listner_handle = env.listen_for_outputs(move |output, info, _| output_handler(output, info)); let mut event_loop = calloop::EventLoop::<()>::try_new().unwrap(); WaylandSource::new(queue).quick_insert(event_loop.handle()).unwrap(); loop { { // Using a new scope so that `surfaces` reference gets dropped surfaces.borrow_mut().retain_mut(|surface| !surface.1.handle_events()); } display.flush().unwrap(); event_loop.dispatch(None, &mut ()).unwrap(); } } smithay-client-toolkit-0.16.1/examples/pointer_input.rs000064400000000000000000000203731046102023000214160ustar 00000000000000extern crate smithay_client_toolkit as sctk; use std::cmp::min; use sctk::reexports::client::protocol::{wl_pointer, wl_shm, wl_surface}; use sctk::shm::AutoMemPool; use sctk::window::{Event as WEvent, FallbackFrame}; #[derive(Debug)] enum NextAction { Refresh, Redraw, Exit, } struct WindowConfig { width: u32, height: u32, dpi_scale: i32, next_action: Option, has_drawn_once: bool, } impl WindowConfig { pub fn new() -> Self { WindowConfig { width: 320, height: 240, dpi_scale: 1, next_action: None, has_drawn_once: false, } } pub fn dimensions(&self) -> (u32, u32) { (self.width * self.dpi_scale as u32, self.height * self.dpi_scale as u32) } pub fn handle_action(&mut self, new_action: NextAction) { let replace = matches!( (&self.next_action, &new_action), (&None, _) | (&Some(NextAction::Refresh), _) | (&Some(NextAction::Redraw), &NextAction::Exit) ); if replace { self.next_action = Some(new_action); } } } sctk::default_environment!(PtrInputExample, desktop); fn main() { /* * Initial setup */ let (env, _display, mut queue) = sctk::new_default_environment!(PtrInputExample, desktop) .expect("Unable to connect to a Wayland compositor"); /* * Init wayland objects */ let mut window_config = WindowConfig::new(); let surface = env .create_surface_with_scale_callback(move |dpi, surface, mut dispatch_data| { let config = dispatch_data.get::().unwrap(); surface.set_buffer_scale(dpi); config.dpi_scale = dpi; config.handle_action(NextAction::Redraw); }) .detach(); let mut window = env .create_window::( surface, None, window_config.dimensions(), move |event, mut dispatch_data| { let mut config = dispatch_data.get::().unwrap(); match event { WEvent::Refresh => config.handle_action(NextAction::Refresh), WEvent::Configure { new_size: Some((w, h)), .. } => { if config.dimensions() != (w, h) || !config.has_drawn_once { config.width = w; config.height = h; config.handle_action(NextAction::Redraw); } else { config.handle_action(NextAction::Refresh); } } WEvent::Configure { new_size: None, .. } => { if config.has_drawn_once { config.handle_action(NextAction::Refresh) } else { config.handle_action(NextAction::Redraw) } } WEvent::Close => config.handle_action(NextAction::Exit), } }, ) .expect("Failed to create a window !"); let mut pool = env.create_auto_pool().expect("Failed to create a memory pool !"); /* * Pointer initialization */ let mut seats = Vec::<(String, Option)>::new(); // first process already existing seats for seat in env.get_all_seats() { if let Some((has_ptr, name)) = sctk::seat::with_seat_data(&seat, |seat_data| { (seat_data.has_pointer && !seat_data.defunct, seat_data.name.clone()) }) { if has_ptr { let seat_name = name.clone(); let pointer = seat.get_pointer(); let surface = window.surface().clone(); pointer.quick_assign(move |_, event, _| { print_pointer_event(event, &seat_name, &surface) }); } else { seats.push((name, None)); } } } // then setup a listener for changes let main_surface = window.surface().clone(); let _seat_listener = env.listen_for_seats(move |seat, seat_data, _| { // find the seat in the vec of seats, or insert it if it is unknown let idx = seats.iter().position(|(name, _)| name == &seat_data.name); let idx = idx.unwrap_or_else(|| { seats.push((seat_data.name.clone(), None)); seats.len() - 1 }); let (_, ref mut opt_ptr) = &mut seats[idx]; // we should map a keyboard if the seat has the capability & is not defunct if seat_data.has_keyboard && !seat_data.defunct { if opt_ptr.is_none() { // we should initalize a keyboard let seat_name = seat_data.name.clone(); let pointer = seat.get_pointer(); let surface = main_surface.clone(); pointer.quick_assign(move |_, event, _| { print_pointer_event(event, &seat_name, &surface) }); *opt_ptr = Some(pointer.detach()); } } else if let Some(ptr) = opt_ptr.take() { // the pointer has been removed, cleanup ptr.release(); } }); if !env.get_shell().unwrap().needs_configure() { window_config.handle_action(NextAction::Redraw); } loop { let next_action = window_config.next_action.take(); println!("{:?}", next_action); match next_action { Some(NextAction::Exit) => break, Some(NextAction::Refresh) => { window.refresh(); window.surface().commit(); } Some(NextAction::Redraw) => { window_config.has_drawn_once = true; let (w, h) = window_config.dimensions(); window.resize(w, h); window.refresh(); redraw(&mut pool, window.surface(), window_config.dimensions()) .expect("Failed to draw"); } None => {} } queue.dispatch(&mut window_config, |_, _, _| {}).unwrap(); } } #[allow(clippy::many_single_char_names)] fn redraw( pool: &mut AutoMemPool, surface: &wl_surface::WlSurface, (buf_x, buf_y): (u32, u32), ) -> Result<(), ::std::io::Error> { let (canvas, new_buffer) = pool.buffer(buf_x as i32, buf_y as i32, 4 * buf_x as i32, wl_shm::Format::Argb8888)?; for (i, dst_pixel) in canvas.chunks_exact_mut(4).enumerate() { let x = i as u32 % buf_x; let y = i as u32 / buf_x; let r: u32 = min(((buf_x - x) * 0xFF) / buf_x, ((buf_y - y) * 0xFF) / buf_y); let g: u32 = min((x * 0xFF) / buf_x, ((buf_y - y) * 0xFF) / buf_y); let b: u32 = min(((buf_x - x) * 0xFF) / buf_x, (y * 0xFF) / buf_y); let pixel: [u8; 4] = ((0xFF << 24) + (r << 16) + (g << 8) + b).to_ne_bytes(); dst_pixel[0] = pixel[0]; dst_pixel[1] = pixel[1]; dst_pixel[2] = pixel[2]; dst_pixel[3] = pixel[3]; } surface.attach(Some(&new_buffer), 0, 0); if surface.as_ref().version() >= 4 { surface.damage_buffer(0, 0, buf_x as i32, buf_y as i32); } else { surface.damage(0, 0, buf_x as i32, buf_y as i32); } surface.commit(); Ok(()) } fn print_pointer_event( event: wl_pointer::Event, seat_name: &str, main_surface: &wl_surface::WlSurface, ) { match event { wl_pointer::Event::Enter { surface, surface_x, surface_y, .. } => { if main_surface == &surface { println!( "Pointer of seat '{}' entered at ({}, {})", seat_name, surface_x, surface_y ); } } wl_pointer::Event::Leave { surface, .. } => { if main_surface == &surface { println!("Pointer of seat '{}' left", seat_name); } } wl_pointer::Event::Button { button, state, .. } => { println!("Button {:?} of seat '{}' was {:?}", button, seat_name, state); } wl_pointer::Event::Motion { surface_x, surface_y, .. } => { println!("Pointer motion to ({}, {}) on seat '{}'", surface_x, surface_y, seat_name) } _ => {} } } smithay-client-toolkit-0.16.1/examples/selection.rs000064400000000000000000000314661046102023000205110ustar 00000000000000extern crate smithay_client_toolkit as sctk; use std::io::{Read, Write}; use sctk::{ data_device::DataSourceEvent, environment::Environment, primary_selection::PrimarySelectionSourceEvent, seat::keyboard::{map_keyboard_repeat, Event as KbEvent, KeyState, RepeatKind}, shm::AutoMemPool, window::{Event as WEvent, FallbackFrame}, }; use sctk::reexports::{ calloop::{LoopHandle, RegistrationToken}, client::{ protocol::{wl_keyboard, wl_seat, wl_shm, wl_surface}, DispatchData, }, }; sctk::default_environment!(SelectionExample, desktop); // Here the type parameter is a global value that will be shared by // all callbacks invoked by the event loop. type DData = (Environment, Option, Option); fn main() { /* * Initial setup */ let (env, display, queue) = sctk::new_default_environment!(SelectionExample, desktop) .expect("Unable to connect to a Wayland compositor"); /* * Prepare a calloop event loop to handle clipboard reading */ let mut event_loop = sctk::reexports::calloop::EventLoop::::try_new().unwrap(); // we need a window to receive things actually let mut dimensions = (320u32, 240u32); let surface = env.create_surface().detach(); let mut window = env .create_window::( surface, None, dimensions, move |evt, mut dispatch_data| { let (_, next_action, _) = dispatch_data.get::().unwrap(); // Keep last event in priority order : Close > Configure > Refresh let replace = matches!( (&evt, &*next_action), (_, &None) | (_, &Some(WEvent::Refresh)) | (&WEvent::Configure { .. }, &Some(WEvent::Configure { .. })) | (&WEvent::Close, _) ); if replace { *next_action = Some(evt); } }, ) .expect("Failed to create a window !"); window.set_title("Selection example".to_string()); println!("Press c/C p/P to copy/paste from selection/primary clipboard respectively."); let mut pool = env.create_auto_pool().expect("Failed to create a memory pool !"); let mut seats = Vec::<(String, Option)>::new(); // first process already existing seats for seat in env.get_all_seats() { if let Some((has_kbd, name)) = sctk::seat::with_seat_data(&seat, |seat_data| { (seat_data.has_keyboard && !seat_data.defunct, seat_data.name.clone()) }) { if has_kbd { let my_seat = seat.clone(); let handle = event_loop.handle(); match map_keyboard_repeat( event_loop.handle(), &seat, None, RepeatKind::System, move |event, _, ddata| process_keyboard_event(event, &my_seat, &handle, ddata), ) { Ok(kbd) => { seats.push((name, Some(kbd))); } Err(e) => { eprintln!("Failed to map keyboard on seat {} : {:?}.", name, e); seats.push((name, None)); } } } else { seats.push((name, None)); } } } // then setup a listener for changes let loop_handle = event_loop.handle(); let _seat_listener = env.listen_for_seats(move |seat, seat_data, _| { // find the seat in the vec of seats, or insert it if it is unknown let idx = seats.iter().position(|(name, _)| name == &seat_data.name); let idx = idx.unwrap_or_else(|| { seats.push((seat_data.name.clone(), None)); seats.len() - 1 }); let (_, ref mut opt_kbd) = &mut seats[idx]; // we should map a keyboard if the seat has the capability & is not defunct if seat_data.has_keyboard && !seat_data.defunct { if opt_kbd.is_none() { // we should initalize a keyboard let my_seat = seat.clone(); let handle = loop_handle.clone(); match map_keyboard_repeat( handle.clone(), &seat, None, RepeatKind::System, move |event, _, ddata| process_keyboard_event(event, &my_seat, &handle, ddata), ) { Ok(kbd) => { *opt_kbd = Some(kbd); } Err(e) => { eprintln!("Failed to map keyboard on seat {} : {:?}.", seat_data.name, e) } } } } else if let Some(kbd) = opt_kbd.take() { // the keyboard has been removed, cleanup kbd.release(); } }); if !env.get_shell().unwrap().needs_configure() { // initial draw to bootstrap on wl_shell redraw(&mut pool, window.surface(), dimensions).expect("Failed to draw"); window.refresh(); } // the data that will be shared to all callbacks let mut data: DData = (env, None, None); sctk::WaylandSource::new(queue).quick_insert(event_loop.handle()).unwrap(); loop { match data.1.take() { Some(WEvent::Close) => break, Some(WEvent::Refresh) => { window.refresh(); window.surface().commit(); } Some(WEvent::Configure { new_size, .. }) => { if let Some((w, h)) = new_size { window.resize(w, h); dimensions = (w, h) } window.refresh(); redraw(&mut pool, window.surface(), dimensions).expect("Failed to draw"); } None => {} } // always flush the connection before going to sleep waiting for events display.flush().unwrap(); event_loop.dispatch(None, &mut data).unwrap(); } } fn process_keyboard_event( event: KbEvent, seat: &wl_seat::WlSeat, handle: &LoopHandle, mut ddata: DispatchData, ) { let (env, _, opt_source) = ddata.get::().unwrap(); if let KbEvent::Key { state, utf8: Some(text), serial, .. } = event { if text == "p" && state == KeyState::Pressed { // pressed the 'p' key, try to read contents ! env.with_data_device(seat, |device| { device.with_selection(|offer| { let offer = match offer { Some(offer) => offer, None => { println!("No current selection buffer!"); return; } }; let seat_name = sctk::seat::with_seat_data(seat, |data| data.name.clone()).unwrap(); print!("Current selection buffer mime types on seat '{}': [ ", seat_name); let mut has_text = false; offer.with_mime_types(|types| { for t in types { print!("\"{}\", ", t); if t == "text/plain;charset=utf-8" { has_text = true; } } }); println!("]"); if has_text { println!("Buffer contains text, going to read it..."); let reader = offer.receive("text/plain;charset=utf-8".into()).unwrap(); let src_handle = handle.clone(); let source = handle .insert_source(reader, move |(), file, ddata| { let mut txt = String::new(); file.read_to_string(&mut txt).unwrap(); println!("Selection contents are: \"{}\"", txt); if let Some(src) = ddata.2.take() { src_handle.remove(src); } }) .unwrap(); *opt_source = Some(source); } }); }) .unwrap(); } if text == "P" && state == KeyState::Pressed { env.with_primary_selection(seat, |primary_selection| { println!("In primary selection closure"); primary_selection.with_selection(|offer| { let offer = match offer { Some(offer) => offer, None => { println!("No current primary selection buffer!"); return; } }; let seat_name = sctk::seat::with_seat_data(seat, |data| data.name.clone()).unwrap(); print!( "Current primary selection buffer mime type on seat '{}': [ ", seat_name ); let mut has_text = false; offer.with_mime_types(|types| { for t in types { print!("\"{}\", ", t); if t == "text/plain;charset=utf-8" { has_text = true; } } }); println!("]"); if has_text { println!("Buffer contains text, going to read it..."); let reader = offer.receive("text/plain;charset=utf-8".into()).unwrap(); let src_handle = handle.clone(); let source = handle .insert_source(reader, move |(), file, ddata| { let mut txt = String::new(); file.read_to_string(&mut txt).unwrap(); println!("Selection contents are: \"{}\"", txt); if let Some(src) = ddata.2.take() { src_handle.remove(src); } }) .unwrap(); *opt_source = Some(source); } }) }) .unwrap() } if text == "c" && state == KeyState::Pressed { let data_source = env.new_data_source(vec!["text/plain;charset=utf-8".into()], move |event, _| { if let DataSourceEvent::Send { mut pipe, .. } = event { let contents = "Hello from clipboard"; println!("Setting clipboard to: {}", &contents); write!(pipe, "{}", contents).unwrap(); } }); env.with_data_device(seat, |device| { println!("Set selection source"); device.set_selection(&Some(data_source), serial); }) .unwrap(); } if text == "C" && state == KeyState::Pressed { let data_source = env.new_primary_selection_source( vec!["text/plain;charset=utf-8".into()], move |event, _| { if let PrimarySelectionSourceEvent::Send { mut pipe, .. } = event { let contents = "Hello from primary selection"; println!("Setting clipboard primary clipboard to {}", &contents); write!(pipe, "{}", contents).unwrap(); } }, ); env.with_primary_selection(seat, |device| { println!("Set primary selection source"); device.set_selection(&Some(data_source), serial); }) .unwrap(); } } } fn redraw( pool: &mut AutoMemPool, surface: &wl_surface::WlSurface, (buf_x, buf_y): (u32, u32), ) -> Result<(), ::std::io::Error> { let (canvas, new_buffer) = pool.buffer(buf_x as i32, buf_y as i32, 4 * buf_x as i32, wl_shm::Format::Argb8888)?; for dst_pixel in canvas.chunks_exact_mut(4) { dst_pixel[0] = 0x00; dst_pixel[1] = 0x00; dst_pixel[2] = 0x00; dst_pixel[3] = 0xFF; } surface.attach(Some(&new_buffer), 0, 0); if surface.as_ref().version() >= 4 { surface.damage_buffer(0, 0, buf_x as i32, buf_y as i32); } else { surface.damage(0, 0, buf_x as i32, buf_y as i32); } surface.commit(); Ok(()) } smithay-client-toolkit-0.16.1/rustfmt.toml000064400000000000000000000001451046102023000167270ustar 00000000000000use_small_heuristics = "Max" use_field_init_shorthand = true newline_style = "Unix" edition = "2018" smithay-client-toolkit-0.16.1/src/data_device/device.rs000064400000000000000000000165141046102023000211610ustar 00000000000000use wayland_client::{ protocol::{wl_data_device, wl_data_device_manager, wl_data_offer, wl_seat, wl_surface}, DispatchData, Main, }; use std::sync::{Arc, Mutex}; use super::{DataOffer, DataSource, DndAction}; #[derive(Debug)] struct Inner { selection: Option, current_dnd: Option, known_offers: Vec, } impl Inner { fn new_offer(&mut self, offer: Main) { self.known_offers.push(DataOffer::new(offer)); } fn set_selection(&mut self, offer: Option) { if let Some(offer) = offer { if let Some(id) = self.known_offers.iter().position(|o| o.offer == offer) { self.selection = Some(self.known_offers.swap_remove(id)); } else { panic!("Compositor set an unknown data_offer for selection."); } } else { // drop the current offer if any self.selection = None; } } fn set_dnd(&mut self, offer: Option) { if let Some(offer) = offer { if let Some(id) = self.known_offers.iter().position(|o| o.offer == offer) { self.current_dnd = Some(self.known_offers.swap_remove(id)); } else { panic!("Compositor set an unknown data_offer for selection."); } } else { // drop the current offer if any self.current_dnd = None; } } } /// Handle to support data exchange on a given seat /// /// This type provides you with functionality to send and receive /// data through drag'n'drop or copy/paste actions. It is associated /// with a seat upon creation. #[derive(Debug)] pub struct DataDevice { device: wl_data_device::WlDataDevice, inner: Arc>, } /// Possible events generated during a drag'n'drop session #[derive(Debug)] pub enum DndEvent<'a> { /// A new drag'n'drop entered your surfaces Enter { /// The associated data offer /// /// Is None if it is an internal drag'n'drop you started with /// no source. See `DataDevice::start_drag` for details. offer: Option<&'a DataOffer>, /// A serial associated with the entry of this dnd serial: u32, /// The entered surface surface: wl_surface::WlSurface, /// horizontal location on the surface x: f64, /// vertical location on the surface y: f64, }, /// The drag'n'drop offer moved on the surface Motion { /// The associated data offer /// /// Is None if it is an internal drag'n'drop you started with /// no source. See `DataDevice::start_drag` for details. offer: Option<&'a DataOffer>, /// The time of this motion time: u32, /// new horizontal location x: f64, /// new vertical location y: f64, }, /// The drag'n'drop offer left your surface Leave, /// The drag'n'drop was dropped on your surface Drop { /// The associated data offer /// /// Is None if it is an internal drag'n'drop you started with /// no source. See `DataDevice::start_drag` for details. offer: Option<&'a DataOffer>, }, } fn data_device_implem( event: wl_data_device::Event, inner: &mut Inner, implem: &mut F, ddata: DispatchData, ) where for<'a> F: FnMut(DndEvent<'a>, DispatchData), { use self::wl_data_device::Event; match event { Event::DataOffer { id } => inner.new_offer(id), Event::Enter { serial, surface, x, y, id } => { inner.set_dnd(id); implem( DndEvent::Enter { serial, surface, x, y, offer: inner.current_dnd.as_ref() }, ddata, ); } Event::Motion { time, x, y } => { implem(DndEvent::Motion { x, y, time, offer: inner.current_dnd.as_ref() }, ddata); } Event::Leave => implem(DndEvent::Leave, ddata), Event::Drop => { implem(DndEvent::Drop { offer: inner.current_dnd.as_ref() }, ddata); } Event::Selection { id } => inner.set_selection(id), _ => unreachable!(), } } impl DataDevice { /// Create the DataDevice helper for this seat. /// /// You need to provide an implementation that will handle drag'n'drop /// events. pub fn init_for_seat( manager: &wl_data_device_manager::WlDataDeviceManager, seat: &wl_seat::WlSeat, mut callback: F, ) -> DataDevice where for<'a> F: FnMut(DndEvent<'a>, DispatchData) + 'static, { let inner = Arc::new(Mutex::new(Inner { selection: None, current_dnd: None, known_offers: Vec::new(), })); let inner2 = inner.clone(); let device = manager.get_data_device(seat); device.quick_assign(move |_, evt, ddata| { let mut inner = inner2.lock().unwrap(); data_device_implem(evt, &mut *inner, &mut callback, ddata); }); DataDevice { device: device.detach(), inner } } /// Start a drag'n'drop offer /// /// You need to specify the origin surface, as well a serial associated /// to an implicit grab on this surface (for example received by a pointer click). /// /// An optional `DataSource` can be provided. If it is `None`, this drag'n'drop will /// be considered as internal to your application, and other applications will not be /// notified of it. You are then responsible for acting accordingly on drop. /// /// You also need to specify which possible drag'n'drop actions are associated to this /// drag (copy, move, or ask), the final action will be chosen by the target and/or /// compositor. /// /// You can finally provide a surface that will be used as an icon associated with /// this drag'n'drop for user visibility. pub fn start_drag( &self, origin: &wl_surface::WlSurface, source: Option, actions: DndAction, icon: Option<&wl_surface::WlSurface>, serial: u32, ) { if let Some(source) = source { source.source.set_actions(actions); self.device.start_drag(Some(&source.source), origin, icon, serial); } else { self.device.start_drag(None, origin, icon, serial); } } /// Provide a data source as the new content for the selection /// /// Correspond to traditional copy/paste behavior. Setting the /// source to `None` will clear the selection. pub fn set_selection(&self, source: &Option, serial: u32) { self.device.set_selection(source.as_ref().map(|s| &s.source), serial); } /// Access the `DataOffer` currently associated with the selection buffer pub fn with_selection(&self, f: F) -> T where F: FnOnce(Option<&DataOffer>) -> T, { let inner = self.inner.lock().unwrap(); f(inner.selection.as_ref()) } /// Access the `DataOffer` currently associated with current DnD pub fn with_dnd(&self, f: F) -> T where F: FnOnce(Option<&DataOffer>) -> T, { let inner = self.inner.lock().unwrap(); f(inner.current_dnd.as_ref()) } } impl Drop for DataDevice { fn drop(&mut self) { self.device.release(); } } smithay-client-toolkit-0.16.1/src/data_device/mod.rs000064400000000000000000000230471046102023000205000ustar 00000000000000//! Helpers to handle data device related actions use std::{cell::RefCell, fmt, rc::Rc}; use wayland_client::{ protocol::{wl_data_device_manager, wl_registry, wl_seat}, Attached, DispatchData, }; pub use wayland_client::protocol::wl_data_device_manager::DndAction; use crate::MissingGlobal; mod device; mod offer; mod source; pub use self::device::{DataDevice, DndEvent}; pub use self::offer::{DataOffer, ReadPipe}; pub use self::source::{DataSource, DataSourceEvent, WritePipe}; type DDCallback = dyn FnMut(wl_seat::WlSeat, DndEvent, DispatchData); enum DDInner { Ready { mgr: Attached, devices: Vec<(wl_seat::WlSeat, DataDevice)>, callback: Rc>>, }, Pending { seats: Vec, }, } impl DDInner { fn init_dd_mgr(&mut self, mgr: Attached) { let seats = if let DDInner::Pending { seats } = self { ::std::mem::take(seats) } else { log::warn!("Ignoring second wl_data_device_manager."); return; }; let mut devices = Vec::new(); let callback = Rc::new(RefCell::new(Box::new(|_, _: DndEvent, _: DispatchData| {}) as Box)); for seat in seats { let cb = callback.clone(); let my_seat = seat.clone(); let device = DataDevice::init_for_seat(&mgr, &seat, move |event, dispatch_data| { (cb.borrow_mut())(my_seat.clone(), event, dispatch_data); }); devices.push((seat.clone(), device)); } *self = DDInner::Ready { mgr, devices, callback }; } // A potential new seat is seen // // should do nothing if the seat is already known fn new_seat(&mut self, seat: &wl_seat::WlSeat) { match self { DDInner::Ready { mgr, devices, callback } => { if devices.iter().any(|(s, _)| s == seat) { // the seat already exists, nothing to do return; } let cb = callback.clone(); let my_seat = seat.clone(); let device = DataDevice::init_for_seat(mgr, seat, move |event, dispatch_data| { (cb.borrow_mut())(my_seat.clone(), event, dispatch_data); }); devices.push((seat.clone(), device)); } DDInner::Pending { seats } => { seats.push(seat.clone()); } } } fn remove_seat(&mut self, seat: &wl_seat::WlSeat) { match self { DDInner::Ready { devices, .. } => devices.retain(|(s, _)| s != seat), DDInner::Pending { seats } => seats.retain(|s| s != seat), } } fn get_mgr(&self) -> Option> { match self { DDInner::Ready { mgr, .. } => Some(mgr.clone()), DDInner::Pending { .. } => None, } } fn set_callback( &mut self, cb: F, ) -> Result<(), MissingGlobal> { match self { DDInner::Ready { callback, .. } => { *(callback.borrow_mut()) = Box::new(cb); Ok(()) } DDInner::Pending { .. } => Err(MissingGlobal), } } fn with_device( &self, seat: &wl_seat::WlSeat, f: F, ) -> Result<(), MissingGlobal> { match self { DDInner::Pending { .. } => Err(MissingGlobal), DDInner::Ready { devices, .. } => { for (s, device) in devices { if s == seat { f(device); return Ok(()); } } Err(MissingGlobal) } } } } impl fmt::Debug for DDInner { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Ready { mgr, devices, .. } => f .debug_struct("Ready") .field("mgr", mgr) .field("devices", devices) .field("callback", &"Fn() -> { ... }") .finish(), Self::Pending { seats } => f.debug_struct("Pending").field("seats", seats).finish(), } } } /// A handler for data devices /// /// It provides automatic tracking of data device for each available seat, /// allowing you to manipulate selection clipboard and drag&drop manipulations. /// /// It is automatically included in the [`default_environment!`](../macro.default_environment.html). #[derive(Debug)] pub struct DataDeviceHandler { inner: Rc>, _listener: crate::seat::SeatListener, } impl DataDeviceHandler { /// Initialize a data device handler /// /// It needs access to a seat handler in order to track /// the creation and removal of seats. pub fn init(seat_handler: &mut S) -> DataDeviceHandler where S: crate::seat::SeatHandling, { let inner = Rc::new(RefCell::new(DDInner::Pending { seats: Vec::new() })); let seat_inner = inner.clone(); let listener = seat_handler.listen(move |seat, seat_data, _| { if seat_data.defunct { seat_inner.borrow_mut().remove_seat(&seat); } else { seat_inner.borrow_mut().new_seat(&seat) } }); DataDeviceHandler { inner, _listener: listener } } } impl crate::environment::GlobalHandler for DataDeviceHandler { fn created( &mut self, registry: Attached, id: u32, version: u32, _: DispatchData, ) { // data device manager is supported until version 3 let version = std::cmp::min(version, 3); let ddmgr = registry.bind::(version, id); self.inner.borrow_mut().init_dd_mgr((*ddmgr).clone()); } fn get(&self) -> Option> { self.inner.borrow().get_mgr() } } /// An interface trait to forward the data device handler capability /// /// You need to implement this trait for your environment struct, by /// delegating it to its `DataDeviceHandler` field in order to get the /// associated methods on your [`Environment`](../environment/struct.environment.html). pub trait DataDeviceHandling { /// Set the global drag'n'drop callback /// /// Returns an error if the `wl_data_device_manager` global is missing. fn set_callback( &mut self, callback: F, ) -> Result<(), MissingGlobal>; /// Access the data device associated with a seat /// /// Returns an error if the seat is not found (for example if it has since been removed by /// the server) or if the `wl_data_device_manager` global is missing. fn with_device( &self, seat: &wl_seat::WlSeat, f: F, ) -> Result<(), MissingGlobal>; } impl DataDeviceHandling for DataDeviceHandler { fn set_callback( &mut self, callback: F, ) -> Result<(), MissingGlobal> { self.inner.borrow_mut().set_callback(callback) } fn with_device( &self, seat: &wl_seat::WlSeat, f: F, ) -> Result<(), MissingGlobal> { self.inner.borrow().with_device(seat, f) } } impl crate::environment::Environment where E: crate::environment::GlobalHandler, { /// Create a new data source /// /// This data source is the basic object for offering content to other clients, /// be it for clipboard selection or as drag'n'drop content. /// /// Once this source is created, you will need to give it to a /// [`DataDevice`](../data_device/struct.DataDevice.html) /// to start interaction. pub fn new_data_source(&self, mime_types: Vec, callback: F) -> DataSource where F: FnMut(DataSourceEvent, DispatchData) + 'static, { let ddmgr = self.require_global::(); DataSource::new(&ddmgr, mime_types, callback) } } impl crate::environment::Environment where E: DataDeviceHandling, { /// Set the data device callback /// /// This callback will be invoked whenever some drag'n'drop action is done onto one of /// your surfaces. /// /// You should set it before entering your main loop, to ensure you will not miss any events. /// /// Returns an error if the compositor did not advertise a data device capability. pub fn set_data_device_callback( &mut self, callback: F, ) -> Result<(), MissingGlobal> { self.with_inner(|inner| inner.set_callback(callback)) } /// Access the data device associated with a seat /// /// Returns an error if the seat is not found (for example if it has since been removed by /// the server) or if the `wl_data_device_manager` global is missing. pub fn with_data_device( &self, seat: &wl_seat::WlSeat, f: F, ) -> Result<(), MissingGlobal> { self.with_inner(|inner| inner.with_device(seat, f)) } } smithay-client-toolkit-0.16.1/src/data_device/offer.rs000064400000000000000000000173341046102023000210240ustar 00000000000000use std::{ fs, io, os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}, sync::{Arc, Mutex}, }; use wayland_client::protocol::wl_data_device_manager::DndAction; use wayland_client::protocol::wl_data_offer; use wayland_client::Main; #[derive(Debug)] struct Inner { mime_types: Vec, actions: DndAction, current_action: DndAction, serial: u32, } /// A data offer for receiving data though copy/paste or /// drag and drop #[derive(Debug)] pub struct DataOffer { pub(crate) offer: wl_data_offer::WlDataOffer, inner: Arc>, } impl DataOffer { pub(crate) fn new(offer: Main) -> DataOffer { let inner = Arc::new(Mutex::new(Inner { mime_types: Vec::new(), actions: DndAction::None, current_action: DndAction::None, serial: 0, })); let inner2 = inner.clone(); offer.quick_assign(move |_, event, _| { use self::wl_data_offer::Event; let mut inner = inner2.lock().unwrap(); match event { Event::Offer { mime_type } => { inner.mime_types.push(mime_type); } Event::SourceActions { source_actions } => { inner.actions = source_actions; } Event::Action { dnd_action } => { inner.current_action = dnd_action; } _ => unreachable!(), } }); DataOffer { offer: offer.detach(), inner } } /// Access the list of mime types proposed by this offer pub fn with_mime_types(&self, f: F) -> T where F: FnOnce(&[String]) -> T, { let inner = self.inner.lock().unwrap(); f(&inner.mime_types) } /// Get the list of available actions for this offer pub fn get_available_actions(&self) -> DndAction { self.inner.lock().unwrap().actions } /// Get the currently set final action for this offer pub fn get_current_action(&self) -> DndAction { self.inner.lock().unwrap().current_action } /// Accept a mime type for receiving data through this offer pub fn accept(&self, mime_type: Option) { let serial = self.inner.lock().unwrap().serial; self.offer.accept(serial, mime_type); } /// Request to receive the data of a given mime type /// /// You can do this several times, as a reaction to motion of /// the dnd cursor, or to inspect the data in order to choose your /// response. /// /// Note that you should *not* read the contents right away in a /// blocking way, as you may deadlock your application doing so. /// At least make sure you flush your events to the server before /// doing so. /// /// Fails if too many file descriptors were already open and a pipe /// could not be created. pub fn receive(&self, mime_type: String) -> std::io::Result { use nix::fcntl::OFlag; use nix::unistd::{close, pipe2}; // create a pipe let (readfd, writefd) = pipe2(OFlag::O_CLOEXEC)?; self.offer.receive(mime_type, writefd); if let Err(err) = close(writefd) { log::warn!("Failed to close write pipe: {}", err); } Ok(unsafe { FromRawFd::from_raw_fd(readfd) }) } /// Receive data to the write end of a raw file descriptor. If you have the read end, you can read from it. /// /// You can do this several times, as a reaction to motion of /// the dnd cursor, or to inspect the data in order to choose your /// response. /// /// Note that you should *not* read the contents right away in a /// blocking way, as you may deadlock your application doing so. /// At least make sure you flush your events to the server before /// doing so. /// /// # Safety /// /// The provided file destructor must be a valid FD for writing, and will be closed /// once the contents are written. pub unsafe fn receive_to_fd(&self, mime_type: String, writefd: RawFd) { use nix::unistd::close; self.offer.receive(mime_type, writefd); if let Err(err) = close(writefd) { log::warn!("Failed to close write pipe: {}", err); } } /// Notify the send and compositor of the dnd actions you accept /// /// You need to provide the set of supported actions, as well as /// a single preferred action. pub fn set_actions(&self, supported: DndAction, preferred: DndAction) { self.offer.set_actions(supported, preferred); } /// Notify that you are finished with this offer, and will no longer /// be using it /// /// Note that it is a protocol error to finish if no action or mime /// type was accepted. pub fn finish(&self) { self.offer.finish(); self.offer.destroy(); } } impl Drop for DataOffer { fn drop(&mut self) { self.offer.destroy(); } } /// A file descriptor that can only be read from /// /// If the `calloop` cargo feature is enabled, this can be used /// as an `EventSource` in a calloop event loop. #[derive(Debug)] pub struct ReadPipe { #[cfg(feature = "calloop")] file: calloop::generic::Generic, #[cfg(not(feature = "calloop"))] file: fs::File, } #[cfg(feature = "calloop")] impl io::Read for ReadPipe { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.file.file.read(buf) } } #[cfg(not(feature = "calloop"))] impl io::Read for ReadPipe { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.file.read(buf) } } #[cfg(feature = "calloop")] impl FromRawFd for ReadPipe { unsafe fn from_raw_fd(fd: RawFd) -> ReadPipe { ReadPipe { file: calloop::generic::Generic::new( FromRawFd::from_raw_fd(fd), calloop::Interest::READ, calloop::Mode::Level, ), } } } #[cfg(not(feature = "calloop"))] impl FromRawFd for ReadPipe { unsafe fn from_raw_fd(fd: RawFd) -> ReadPipe { ReadPipe { file: FromRawFd::from_raw_fd(fd) } } } #[cfg(feature = "calloop")] impl AsRawFd for ReadPipe { fn as_raw_fd(&self) -> RawFd { self.file.file.as_raw_fd() } } #[cfg(not(feature = "calloop"))] impl AsRawFd for ReadPipe { fn as_raw_fd(&self) -> RawFd { self.file.as_raw_fd() } } #[cfg(feature = "calloop")] impl IntoRawFd for ReadPipe { fn into_raw_fd(self) -> RawFd { self.file.file.into_raw_fd() } } #[cfg(not(feature = "calloop"))] impl IntoRawFd for ReadPipe { fn into_raw_fd(self) -> RawFd { self.file.into_raw_fd() } } #[cfg(feature = "calloop")] impl calloop::EventSource for ReadPipe { type Event = (); type Error = std::io::Error; type Metadata = fs::File; type Ret = (); fn process_events( &mut self, readiness: calloop::Readiness, token: calloop::Token, mut callback: F, ) -> std::io::Result where F: FnMut((), &mut fs::File), { self.file.process_events(readiness, token, |_, file| { callback((), file); Ok(calloop::PostAction::Continue) }) } fn register( &mut self, poll: &mut calloop::Poll, token_factory: &mut calloop::TokenFactory, ) -> calloop::Result<()> { self.file.register(poll, token_factory) } fn reregister( &mut self, poll: &mut calloop::Poll, token_factory: &mut calloop::TokenFactory, ) -> calloop::Result<()> { self.file.reregister(poll, token_factory) } fn unregister(&mut self, poll: &mut calloop::Poll) -> calloop::Result<()> { self.file.unregister(poll) } } smithay-client-toolkit-0.16.1/src/data_device/source.rs000064400000000000000000000120301046102023000212070ustar 00000000000000use wayland_client::{ protocol::{wl_data_device_manager, wl_data_source}, Attached, DispatchData, }; use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; use std::{fs, io}; /// A data source for sending data though copy/paste or /// drag and drop #[derive(Debug)] pub struct DataSource { pub(crate) source: wl_data_source::WlDataSource, } /// Possible events a data source needs to react to #[derive(Debug)] pub enum DataSourceEvent { /// Write the offered data for selected mime type /// /// This can happen several times during a dnd setup, /// and does not mean the action is finished. Send { /// Requested mime type mime_type: String, /// Pipe to write into pipe: WritePipe, }, /// Target mime type /// /// Notifies that the target accepted a given mime type. /// You can use it to provide feedback (changing the icon /// of the drag'n'drop for example). /// /// Can be `None` if the current target does not accept any of the /// proposed mime types. /// /// This event can be emitted several times during the process Target { /// The type accepted by the target mime_type: Option, }, /// Notifies of the current selected action for the drag'n'drop /// /// Can only happen for data sources used during a drag'n'drop. /// /// This can change several times, the last received defines which action /// should actually be taken. Action { /// The action chosen by the target action: wl_data_device_manager::DndAction, }, /// The action using this data source was cancelled. /// /// Once this event is received, the `DataSource` can not be used any more, /// and you should drop it for cleanup. /// /// Happens if the user cancels the current drag'n'drop, or replaces the /// selection buffer. Cancelled, /// The user performed the "drop" during a drag'n'drop /// /// This does not mean the operation is finished (the operation can still /// be cancelled afterwards). /// /// You are not guaranteed to receive this event at some point, as the compositor /// may cancel the action before the user drops. /// /// This event can only be generated on sources used for drag'n'drop, not /// selection sources. Dropped, /// The action is finished, this data source will not be used any more /// /// If the selected drag'n'drop action was "move", you can now delete the /// underlying resource. /// /// This event can only be generated on sources used for drag'n'drop, not /// selection sources. Finished, } fn data_source_impl( evt: wl_data_source::Event, source: &wl_data_source::WlDataSource, implem: &mut Impl, ddata: DispatchData, ) where Impl: FnMut(DataSourceEvent, DispatchData), { use self::wl_data_source::Event; let event = match evt { Event::Target { mime_type } => DataSourceEvent::Target { mime_type }, Event::Send { mime_type, fd } => { DataSourceEvent::Send { mime_type, pipe: unsafe { FromRawFd::from_raw_fd(fd) } } } Event::Action { dnd_action } => DataSourceEvent::Action { action: dnd_action }, Event::Cancelled => { source.destroy(); DataSourceEvent::Cancelled } Event::DndDropPerformed => DataSourceEvent::Dropped, Event::DndFinished => { source.destroy(); DataSourceEvent::Finished } _ => unreachable!(), }; implem(event, ddata); } impl DataSource { /// Create a new data source /// /// You'll then need to provide it to a data device to send it /// either via selection (aka copy/paste) or via a drag and drop. pub fn new( mgr: &Attached, mime_types: It, mut callback: F, ) -> DataSource where F: FnMut(DataSourceEvent, DispatchData) + 'static, S: Into, It: IntoIterator, { let source = mgr.create_data_source(); source.quick_assign(move |source, evt, dispatch_data| { data_source_impl(evt, &source, &mut callback, dispatch_data) }); for mime in mime_types { source.offer(mime.into()); } DataSource { source: source.detach() } } } /// A file descriptor that can only be written to #[derive(Debug)] pub struct WritePipe { file: fs::File, } impl io::Write for WritePipe { fn write(&mut self, buf: &[u8]) -> io::Result { self.file.write(buf) } fn flush(&mut self) -> io::Result<()> { self.file.flush() } } impl FromRawFd for WritePipe { unsafe fn from_raw_fd(fd: RawFd) -> WritePipe { WritePipe { file: FromRawFd::from_raw_fd(fd) } } } impl AsRawFd for WritePipe { fn as_raw_fd(&self) -> RawFd { self.file.as_raw_fd() } } impl IntoRawFd for WritePipe { fn into_raw_fd(self) -> RawFd { self.file.into_raw_fd() } } smithay-client-toolkit-0.16.1/src/environment.rs000064400000000000000000000366731046102023000200460ustar 00000000000000//! Environment management utilities //! //! This module provide the tools to automatically bind the wayland global objects you need in your program. //! //! At the heart of this is the `environment!` macro, which allows you to signal the globals you need //! and a struct to manage them as they are signaled in the registry. //! //! ## Global handlers //! //! Wayland globals are split in two kinds, that we will call here "single" globals and "multi" globals. //! //! - "single" globals represent a capability of the server. They are generally signaled in the registry //! from the start and never removed. They are signaled a single time. Examples of these globals are //! `wl_compositor`, `wl_shm` or `xdg_wm_base`. //! - "multi" globals represent a resource that the server gives you access to. These globals can be //! created or removed during the run of the program, and may exist as more than one instance, each //! representing a different physical resource. Examples of such globals are `wl_output` or `wl_seat`. //! //! The objects you need to handle these globals must implement one the two traits //! [`GlobalHandler`](trait.GlobalHandler.html) or [`MultiGlobalHandler`](trait.MultiGlobalHandler.html), //! depending on the kind of globals it will handle. These objects are responsible for binding the globals //! from the registry, and assigning them to filters to receive their events as necessary. //! //! This module provides a generic implementation of the [`GlobalHandler`](trait.GlobalHandler.html) trait //! as [`SimpleGlobal`](struct.SimpleGlobal.html). It can manage "single" globals that do not generate //! events, and thus require no filter. //! //! ## the `environment!` macro //! //! This macro is at the core of this module. See its documentation for details about how to //! use it: [`environment!`](../macro.environment.html). You can alternatively use the //! [`default_environment!`](../macro.default_environment.html) macro to quickly setup things and bring //! in all SCTK modules. use std::io::Result; use std::rc::Rc; use std::{cell::RefCell, fmt}; use wayland_client::{ protocol::{wl_display, wl_registry}, Attached, DispatchData, EventQueue, GlobalEvent, GlobalManager, Interface, Proxy, }; /* * Traits definitions */ /// Required trait for implementing a handler for "single" globals pub trait GlobalHandler { /// This global was created and signaled in the registry with given id and version fn created( &mut self, registry: Attached, id: u32, version: u32, ddata: DispatchData, ); /// Access the global if it was signaled fn get(&self) -> Option>; } /// Required trait for implementing a handler for "multi" globals pub trait MultiGlobalHandler { /// A new instance of this global was created with given id and version fn created( &mut self, registry: Attached, id: u32, version: u32, ddata: DispatchData, ); /// The instance with given id was removed fn removed(&mut self, id: u32, ddata: DispatchData); /// Access all the currently existing instances fn get_all(&self) -> Vec>; } /* * General Environment */ /// A Wayland Environment /// /// This struct is generated by the `environment!` macro, see module-level documentation /// for more details about this. /// /// This is the central point for accessing globals for your Wayland app. Any global that has /// previously been declared in the `environment!` macro can be access from this type via the /// `get_global`, `required_global` and `get_all_globals` methods. /// /// This `Environment` is a handle that can be cloned. pub struct Environment { /// The underlying `GlobalManager`, if you need to do manual interaction with the /// registry. See `wayland-client` documentation for details. pub manager: GlobalManager, inner: Rc>, } impl Environment { /// Create new `Environment` /// /// This requires access to a `wl_display` attached to the `event_queue`. /// You also need to provide an instance of the inner environment type declared /// using the [`environment!`](../macro.environment.html) macro. /// /// If you instead used the [`default_environment!`](../macro.default_environment.html), then /// you need to initialize your `Environment` using the /// [`new_default_environment!`](../macro.new_default_environment.html) macro. /// /// `std::io::Error` could be returned if initial roundtrips to the server failed. /// /// If this call indefinitely blocks when doing initial roundtrips this can only be /// caused by server bugs. pub fn new( display: &Attached, queue: &mut EventQueue, env: E, ) -> Result> { let environment = Self::new_pending(display, env); // Fully initialize the environment. queue.sync_roundtrip(&mut (), |event, _, _| { panic!( "Encountered unhandled event during initial roundtrip ({}::{})", event.interface, event.name ); })?; queue.sync_roundtrip(&mut (), |event, _, _| { panic!( "Encountered unhandled event during initial roundtrip ({}::{})", event.interface, event.name ); })?; Ok(environment) } /// Create new pending `Environment` /// /// This requires access to a `wl_display` attached to an event queue (on which the main SCTK logic /// will be attached). You also need to provide an instance of the inner environment type declared /// using the [`environment!`](../macro.environment.html) macro. /// /// If you instead used the [`default_environment!`](../macro.default_environment.html), then you need /// to initialize your `Environment` using the /// [`new_default_environment!`](../macro.new_default_environment.html) macro. /// /// You should prefer to use `Environment::new`, unless you want to control initialization /// manually or you create additional environment meaning that the initialization may be fine /// with just `dispatch_pending` of the event queue, instead of two roundtrips to /// fully initialize environment. If you manually initialize your environment two sync /// roundtrips are required. pub fn new_pending(display: &Attached, env: E) -> Environment { let inner = Rc::new(RefCell::new(env)); let my_inner = inner.clone(); let my_cb = move |event, registry, ddata: DispatchData| { let mut inner = my_inner.borrow_mut(); inner.process_event(event, registry, ddata); }; let manager = GlobalManager::new_with_cb(display, my_cb); Self { manager, inner } } } impl Environment { /// Access a "single" global /// /// This method allows you to access any "single" global that has previously /// been declared in the `environment!` macro. It is forwarded to the `get()` /// method of the appropriate `GlobalHandler`. /// /// It returns `None` if the global has not (yet) been signaled by the registry. pub fn get_global(&self) -> Option> where E: GlobalHandler, { self.inner.borrow().get() } /// Access a "single" global or panic /// /// This method is similar to `get_global`, but will panic with a detailed error /// message if the requested global was not advertized by the server. pub fn require_global(&self) -> Attached where E: GlobalHandler, { match self.inner.borrow().get() { Some(g) => g, None => panic!("[SCTK] A missing global was required: {}", I::NAME), } } /// Access all instances of a "multi" global /// /// This will return a `Vec` containing all currently existing instances of the /// requested "multi" global that has been previously declared in the `environment!` /// macro. It is forwarded to the `get_all()` method of the appropriate /// `MultiGlobalHandler`. pub fn get_all_globals(&self) -> Vec> where E: MultiGlobalHandler, { self.inner.borrow().get_all() } /// Access the inner environment /// /// This gives your access, via a closure, to the inner type you declared /// via the [`environment!`](../macro.environment.html) or /// [`default_environment!`](../macro.default_environment.html) macro. /// /// This method returns the return value of your closure. pub fn with_inner T>(&self, f: F) -> T { let mut inner = self.inner.borrow_mut(); f(&mut *inner) } } impl Clone for Environment { fn clone(&self) -> Environment { Environment { manager: self.manager.clone(), inner: self.inner.clone() } } } impl fmt::Debug for Environment where E: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Environment") .field("manager", &self.manager) .field("inner", &self.inner) .finish() } } /// Internal trait for the `Environment` logic /// /// This trait is automatically implemented by the [`environment!`](../macro.environment.html) /// macro, you should not implement it manually unless you seriously want to. pub trait InnerEnv { /// Process a `GlobalEvent` fn process_event( &mut self, event: GlobalEvent, registry: Attached, data: DispatchData, ); } /* * Simple handlers */ /// A minimalist global handler for "single" globals /// /// This handler will simply register the global as soon as the registry signals /// it, and do nothing more. /// /// It is appropriate for globals that never generate events, like `wl_compositor` /// or `wl_data_device_manager`. #[derive(Debug)] pub struct SimpleGlobal { global: Option>, } impl SimpleGlobal { /// Create a new handler pub fn new() -> SimpleGlobal { SimpleGlobal { global: None } } } impl> + AsRef>> GlobalHandler for SimpleGlobal { fn created( &mut self, registry: Attached, id: u32, version: u32, _: DispatchData, ) { let version = I::VERSION.min(version); self.global = Some((*registry.bind::(version, id)).clone()) } fn get(&self) -> Option> { self.global.clone() } } /* * environment! macro */ /// Macro for declaring an environment /// /// It needs to be used in conjunction with a a `struct` you declared, which will serve as the inner /// environment and hold the handlers for your globals. /// /// The macro is invoked as such: /// /// ```no_run /// # extern crate smithay_client_toolkit as sctk; /// # use sctk::reexports::client::protocol::{wl_compositor::WlCompositor, wl_subcompositor::WlSubcompositor, wl_output::WlOutput}; /// # use sctk::environment::SimpleGlobal; /// # use sctk::environment; /// # use sctk::output::OutputHandler; /// struct MyEnv { /// compositor: SimpleGlobal, /// subcompositor: SimpleGlobal, /// outputs: OutputHandler /// } /// /// environment!(MyEnv, /// singles = [ /// WlCompositor => compositor, /// WlSubcompositor => subcompositor, /// ], /// multis = [ /// WlOutput => outputs, /// ] /// ); /// ``` /// /// This will define how your `MyEnv` struct is able to manage the `WlCompositor`, `WlSubcompositor` and /// `WlOutput` globals. For each global, you need to provide a pattern /// `$type => $name` where: /// /// - `$type` is the type (implementing the `Interface` trait from `wayland-client`) representing a global /// - `$name` is the name of the field of `MyEnv` that is in charge of managing this global, implementing the /// appropriate `GlobalHandler` or `MultiGlobalHandler` trait /// /// It is possible to route several globals to the same field as long as it implements all the appropriate traits. #[macro_export] macro_rules! environment { ($env_name:ident, singles = [$($sty:ty => $sname:ident),* $(,)?], multis = [$($mty:ty => $mname:ident),* $(,)?]$(,)? ) => { impl $crate::environment::InnerEnv for $env_name { fn process_event( &mut self, event: $crate::reexports::client::GlobalEvent, registry: $crate::reexports::client::Attached<$crate::reexports::client::protocol::wl_registry::WlRegistry>, ddata: $crate::reexports::client::DispatchData, ) { match event { $crate::reexports::client::GlobalEvent::New { id, interface, version } => match &interface[..] { $( <$sty as $crate::reexports::client::Interface>::NAME => $crate::environment::GlobalHandler::<$sty>::created(&mut self.$sname, registry, id, version, ddata), )* $( <$mty as $crate::reexports::client::Interface>::NAME => $crate::environment::MultiGlobalHandler::<$mty>::created(&mut self.$mname, registry, id, version, ddata), )* _ => { /* ignore unkown globals */ } }, $crate::reexports::client::GlobalEvent::Removed { id, interface } => match &interface[..] { $( <$mty as $crate::reexports::client::Interface>::NAME => $crate::environment::MultiGlobalHandler::<$mty>::removed(&mut self.$mname, id, ddata), )* _ => { /* ignore unknown globals */ } } } } } $( impl $crate::environment::GlobalHandler<$sty> for $env_name { fn created(&mut self, registry: $crate::reexports::client::Attached<$crate::reexports::client::protocol::wl_registry::WlRegistry>, id: u32, version: u32, ddata: $crate::reexports::client::DispatchData) { $crate::environment::GlobalHandler::<$sty>::created(&mut self.$sname, registry, id, version, ddata) } fn get(&self) -> Option<$crate::reexports::client::Attached<$sty>> { $crate::environment::GlobalHandler::<$sty>::get(&self.$sname) } } )* $( impl $crate::environment::MultiGlobalHandler<$mty> for $env_name { fn created(&mut self, registry: $crate::reexports::client::Attached<$crate::reexports::client::protocol::wl_registry::WlRegistry>, id: u32, version: u32, ddata: $crate::reexports::client::DispatchData) { $crate::environment::MultiGlobalHandler::<$mty>::created(&mut self.$mname, registry, id, version, ddata) } fn removed(&mut self, id: u32, ddata: $crate::reexports::client::DispatchData) { $crate::environment::MultiGlobalHandler::<$mty>::removed(&mut self.$mname, id, ddata) } fn get_all(&self) -> Vec<$crate::reexports::client::Attached<$mty>> { $crate::environment::MultiGlobalHandler::<$mty>::get_all(&self.$mname) } } )* }; } smithay-client-toolkit-0.16.1/src/event_loop.rs000064400000000000000000000143741046102023000176460ustar 00000000000000use std::{io, os::unix::io::RawFd}; use calloop::{ generic::Generic, EventSource, InsertError, Interest, LoopHandle, Mode, PostAction, RegistrationToken, TokenFactory, }; use wayland_client::{EventQueue, ReadEventsGuard}; /// An adapter to insert a Wayland `EventQueue` into a calloop event loop /// /// This is a struct that implements `calloop::EventSource`. It generates an /// event whenever events need to be dispatched. At this point your calloop callback /// will be given access to the `EventQueue` and you should call `.dispatch_pending()` /// and forward its return value, allowing you to handle orphan events as you prefer. /// /// If you don't use orphan events, the `quick_insert` method will directly /// insert the source into a provided `LoopHandle` with an adapter which will panic /// whenever an oprhan event is encountered. #[derive(Debug)] pub struct WaylandSource { queue: EventQueue, fd: Generic, read_guard: Option, } impl WaylandSource { /// Wrap an `EventQueue` as a `WaylandSource`. pub fn new(queue: EventQueue) -> WaylandSource { let fd = queue.display().get_connection_fd(); WaylandSource { queue, fd: Generic::new(fd, Interest::READ, Mode::Level), read_guard: None } } /// Insert this source into given event loop with an adapter that panics on orphan events /// /// The adapter will pass the event loop's global shared data as `dispatch_data` too all /// callbacks. pub fn quick_insert( self, handle: LoopHandle, ) -> Result> { handle.insert_source(self, |(), queue, ddata| { queue.dispatch_pending(ddata, |event, object, _| { panic!( "[calloop] Encountered an orphan event: {}@{} : {}", event.interface, object.as_ref().id(), event.name ); }) }) } /// Access the underlying event queue /// /// This method can be used if you need to access the underlying `EventQueue` while this /// `WaylandSource` is currently inserted in an event loop. /// /// Note that you should be careful when interacting with it if you invoke methods that /// interact with the wayland socket (such as `dispatch()` or `prepare_read()`). These may /// interefere with the proper waking up of this event source in the event loop. pub fn queue(&mut self) -> &mut EventQueue { &mut self.queue } } impl EventSource for WaylandSource { type Event = (); type Error = std::io::Error; type Metadata = EventQueue; type Ret = std::io::Result; fn process_events( &mut self, readiness: calloop::Readiness, token: calloop::Token, mut callback: F, ) -> std::io::Result where F: FnMut((), &mut EventQueue) -> std::io::Result, { let queue = &mut self.queue; let read_guard = &mut self.read_guard; self.fd.process_events(readiness, token, |_, _| { // 1. read events from the socket if any are available if let Some(guard) = read_guard.take() { // might be None if some other thread read events before us, concurently if let Err(e) = guard.read_events() { if e.kind() != io::ErrorKind::WouldBlock { return Err(e); } } } // 2. dispatch any pending event in the queue (that's callback's job) loop { match queue.prepare_read() { Some(guard) => { *read_guard = Some(guard); break; } None => { callback((), queue)?; } } } // 3. Once dispatching is finished, flush the responses to the compositor if let Err(e) = queue.display().flush() { if e.kind() != io::ErrorKind::WouldBlock { // in case of error, forward it and fast-exit return Err(e); } // WouldBlock error means the compositor could not process all our messages // quickly. Either it is slowed down or we are a spammer. // Should not really happen, if it does we do nothing and will flush again later } Ok(PostAction::Continue) }) } fn register( &mut self, poll: &mut calloop::Poll, token_factory: &mut TokenFactory, ) -> calloop::Result<()> { self.fd.register(poll, token_factory) } fn reregister( &mut self, poll: &mut calloop::Poll, token_factory: &mut TokenFactory, ) -> calloop::Result<()> { self.fd.reregister(poll, token_factory) } fn unregister(&mut self, poll: &mut calloop::Poll) -> calloop::Result<()> { self.fd.unregister(poll) } fn pre_run(&mut self, mut callback: F) -> calloop::Result<()> where F: FnMut((), &mut EventQueue) -> std::io::Result, { debug_assert!(self.read_guard.is_none()); // flush the display before starting to poll if let Err(e) = self.queue.display().flush() { if e.kind() != io::ErrorKind::WouldBlock { // in case of error, don't prepare a read, if the error is persitent, // it'll trigger in other wayland methods anyway log::error!("Error trying to flush the wayland display: {}", e); return Err(e.into()); } } loop { match self.queue.prepare_read() { Some(guard) => { self.read_guard = Some(guard); break; } None => { callback((), &mut self.queue)?; } } } Ok(()) } fn post_run(&mut self, _: F) -> calloop::Result<()> where F: FnMut((), &mut EventQueue) -> std::io::Result, { // the destructor of ReadEventsGuard does the cleanup self.read_guard = None; Ok(()) } } smithay-client-toolkit-0.16.1/src/lazy_global.rs000064400000000000000000000003251046102023000177620ustar 00000000000000use wayland_client::{Attached, Interface}; /// An utility for lazy-loading globals. #[derive(Debug)] pub enum LazyGlobal { Unknown, Seen { id: u32, version: u32 }, Bound(Attached), } smithay-client-toolkit-0.16.1/src/lib.rs000064400000000000000000000416731046102023000162440ustar 00000000000000//! Smithay Client Toolkit //! //! Provides various utilities and abstractions for comunicating with various //! Wayland compositors. //! //! ## `Environment` //! //! The crate is structured around the [`Environment`](environment/struct.Environment.html) type, //! which binds the wayland globals for you using a set of modular handlers. This type is used in conjunction //! with the [`environment!`](macro.environment.html) if you want full control, or by using the //! [`default_environment!`](macro.default_environment.html) macro to automatically bring in all //! SCTK modules. //! //! The various modules work by adding methods to the [`Environment`](environment/struct.Environment.html) //! type, giving you more capabilities as more modules are activated. //! //! ## Event Loops //! //! SCTK integrates with `calloop` to provide an event loop abstraction. Indeed most Wayland //! apps will need to handle more event sources than the single Wayland connection. These are //! necessary to handle things like keyboard repetition, copy-paste, or animated cursors. //! //! [`WaylandSource`](struct.WaylandSource.html) is an adapter to insert a Wayland `EventQueue` into //! a calloop event loop. And some of the modules of SCTK will provide you with other event sources //! that you need to insert into calloop for them to work correctly. #![warn(missing_docs, missing_debug_implementations)] #![allow(clippy::new_without_default)] #[macro_use] extern crate dlib; /// Re-exports of some crates, for convenience pub mod reexports { #[cfg(feature = "calloop")] pub use calloop; pub use wayland_client as client; pub use wayland_protocols as protocols; } pub mod data_device; pub mod environment; mod lazy_global; pub mod output; pub mod primary_selection; pub mod seat; pub mod shell; pub mod shm; pub mod window; #[cfg(feature = "calloop")] mod event_loop; mod surface; #[cfg(feature = "calloop")] pub use event_loop::WaylandSource; pub use surface::{get_surface_outputs, get_surface_scale_factor}; #[macro_export] /// Declare a batteries-included SCTK environment /// /// Similar to the [`environment!`](macro.environment.html) macro, but creates the type for you and /// includes all the handlers provided by SCTK, for use with the rest of the library. Its sister /// macro [`new_default_environment!`](macro.new_default_environment.html) needs to be used to /// initialize it. /// /// This includes handlers for the following globals: /// /// - `wl_compositor` as a [`SimpleGlobal`](environment/struct.SimpleGlobal.html) /// - `wl_data_device_manager` as a [`DataDeviceHandler`](data_device/struct.DataDeviceHandler.html) /// - `wl_output` with the [`OutputHandler`](output/struct.OutputHandler.html) /// - `wl_seat` with the [`SeatHandler`](seat/struct.SeatHandler.html) /// - `wl_subcompositor` as a [`SimpleGlobal`](environment/struct.SimpleGlobal.html) /// - `wl_shm` as a [`ShmHandler`](shm/struct.ShmHandler.html) /// - `zwp` and `gtk` primary selection device manager as a [`PrimarySelectionHandler`](primary_selection/struct.PrimarySelectionHandler.html) /// /// If you don't need to add anything more, using it is as simple as: /// /// ```no_run /// # use smithay_client_toolkit::default_environment; /// default_environment!(MyEnv); /// ``` /// /// The macro also provides some presets including more globals depending on your use-case: /// /// - the `desktop` preset, invoked as `default_environment!(MyEnv, desktop);` additionally /// includes: /// - `xdg_shell` and `wl_shell` with the [`ShellHandler`](shell/struct.ShellHandler.html) /// - `xdg_decoration_manager` as a [`SimpleGlobal`](environment/struct.SimpleGlobal.html) /// /// You can also add the `fields` argument to add additional fields to the generated struct, and /// the `singles` and `multis` arguments to route additional globals like with the /// [`environment!`](macro.environment.html) macro. These three fields are optional, but they must /// appear in this order, and after the optional preset /// /// ```no_run /// # use smithay_client_toolkit::default_environment; /// default_environment!(MyEnv, /// desktop, // the chosen preset, can be ommited /// fields=[ /// somefield: u32, /// otherfield: String, /// ], /// singles=[ /// // Add some routing here /// ], /// multis=[ /// // add some routing here /// ] /// ); /// ``` macro_rules! default_environment { ($env_name:ident, desktop $(,fields = [$($fname:ident : $fty:ty),* $(,)?])? $(,singles = [$($sty:ty => $sname: ident),* $(,)?])? $(,multis = [$($mty:ty => $mname:ident),* $(,)?])? $(,)? ) => { $crate::default_environment!($env_name, fields=[ // shell sctk_shell: $crate::shell::ShellHandler, // decoration sctk_decoration_mgr: $crate::environment::SimpleGlobal<$crate::reexports::protocols::unstable::xdg_decoration::v1::client::zxdg_decoration_manager_v1::ZxdgDecorationManagerV1>, // others $($($fname : $fty,)*)? ], singles = [ // shell globals $crate::reexports::client::protocol::wl_shell::WlShell => sctk_shell, $crate::reexports::protocols::xdg_shell::client::xdg_wm_base::XdgWmBase => sctk_shell, $crate::reexports::protocols::unstable::xdg_shell::v6::client::zxdg_shell_v6::ZxdgShellV6 => sctk_shell, // decoration $crate::reexports::protocols::unstable::xdg_decoration::v1::client::zxdg_decoration_manager_v1::ZxdgDecorationManagerV1 => sctk_decoration_mgr, // others $($($sty => $sname,)*)? ], multis = [ $($($mty => $mname,)*)? ], ); // Shell utility impl $crate::shell::ShellHandling for $env_name { fn get_shell(&self) -> Option<$crate::shell::Shell> { self.sctk_shell.get_shell() } } }; ($env_name:ident $(,fields = [$($fname:ident : $fty:ty),* $(,)?])? $(,singles = [$($sty:ty => $sname:ident),* $(,)?])? $(,multis = [$($mty:ty => $mname:ident),* $(,)?])? $(,)? ) => { /* * Declare the type */ pub struct $env_name { // SimpleGlobals sctk_compositor: $crate::environment::SimpleGlobal<$crate::reexports::client::protocol::wl_compositor::WlCompositor>, sctk_subcompositor: $crate::environment::SimpleGlobal<$crate::reexports::client::protocol::wl_subcompositor::WlSubcompositor>, // shm sctk_shm: $crate::shm::ShmHandler, // output sctk_outputs: $crate::output::OutputHandler, // seat sctk_seats: $crate::seat::SeatHandler, // data device sctk_data_device_manager: $crate::data_device::DataDeviceHandler, // primary selection sctk_primary_selection_manager: $crate::primary_selection::PrimarySelectionHandler, // user added $($( $fname : $fty, )*)? } // SHM utility impl $crate::shm::ShmHandling for $env_name { fn shm_formats(&self) -> Vec<$crate::reexports::client::protocol::wl_shm::Format> { self.sctk_shm.shm_formats() } } // Seat utility impl $crate::seat::SeatHandling for $env_name { fn listen(&mut self, f: F) -> $crate::seat::SeatListener where F: FnMut( $crate::reexports::client::Attached<$crate::reexports::client::protocol::wl_seat::WlSeat>, &$crate::seat::SeatData, $crate::reexports::client::DispatchData ) + 'static { self.sctk_seats.listen(f) } } // Output utility impl $crate::output::OutputHandling for $env_name { fn listen(&mut self, f: F) -> $crate::output::OutputStatusListener where F: FnMut( $crate::reexports::client::protocol::wl_output::WlOutput, &$crate::output::OutputInfo, $crate::reexports::client::DispatchData, ) + 'static { self.sctk_outputs.listen(f) } } // Data device utility impl $crate::data_device::DataDeviceHandling for $env_name { fn set_callback(&mut self, callback: F) -> ::std::result::Result<(), $crate::MissingGlobal> where F: FnMut( $crate::reexports::client::protocol::wl_seat::WlSeat, $crate::data_device::DndEvent, $crate::reexports::client::DispatchData ) + 'static { self.sctk_data_device_manager.set_callback(callback) } fn with_device( &self, seat: &$crate::reexports::client::protocol::wl_seat::WlSeat, f: F ) -> ::std::result::Result<(), $crate::MissingGlobal> { self.sctk_data_device_manager.with_device(seat, f) } } // Primary selection utility impl $crate::primary_selection::PrimarySelectionHandling for $env_name { fn with_primary_selection( &self, seat: &$crate::reexports::client::protocol::wl_seat::WlSeat, f: F, ) -> ::std::result::Result<(), $crate::MissingGlobal> where F: FnOnce(&$crate::primary_selection::PrimarySelectionDevice) { self.sctk_primary_selection_manager.with_primary_selection(seat, f) } fn get_primary_selection_manager(&self) -> Option<$crate::primary_selection::PrimarySelectionDeviceManager> { self.sctk_primary_selection_manager.get_primary_selection_manager() } } // // Final macro delegation // $crate::environment!($env_name, singles = [ // SimpleGlobals $crate::reexports::client::protocol::wl_compositor::WlCompositor => sctk_compositor, $crate::reexports::client::protocol::wl_subcompositor::WlSubcompositor => sctk_subcompositor, // shm $crate::reexports::client::protocol::wl_shm::WlShm => sctk_shm, // data device $crate::reexports::client::protocol::wl_data_device_manager::WlDataDeviceManager => sctk_data_device_manager, // primary selection $crate::reexports::protocols::unstable::primary_selection::v1::client::zwp_primary_selection_device_manager_v1::ZwpPrimarySelectionDeviceManagerV1 => sctk_primary_selection_manager, $crate::reexports::protocols::misc::gtk_primary_selection::client::gtk_primary_selection_device_manager::GtkPrimarySelectionDeviceManager => sctk_primary_selection_manager, // user added $($($sty => $sname),*)? ], multis = [ // output globals $crate::reexports::client::protocol::wl_output::WlOutput => sctk_outputs, // seat globals $crate::reexports::client::protocol::wl_seat::WlSeat => sctk_seats, // user added $($($mty => $mname),*)? ] ); }; } #[macro_export] /// Initialize a batteries-included SCTK environment /// /// Sister macro of [`default_environment!`](macro.default_environment.html). You need /// to use it to initialize the environment instead of /// [`Envrionment::init`](environment/struct.Environment.html). It has the same semantics. /// /// If a preset was used for [`default_environment!`](macro.default_environment.html), it /// must be provided here as well. /// /// The macro will automatically setup a Wayland connection and evaluate to a `Result` /// containing either `Ok((env, display, queue))`, providing you the initialized `Environment` /// as well as the wayland `Display` and `EventQueue` associated to it, or to an error /// if the connection failed. /// /// ```no_run /// # use smithay_client_toolkit::{default_environment, new_default_environment}; /// # default_environment!(MyEnv, desktop, fields=[somefield: u32, otherfield: String]); /// let (env, display, queue) = new_default_environment!(MyEnv, /// desktop, // the optional preset /// /* initializers for your extra fields if any, can be ommited if no fields are added */ /// fields=[ /// somefield: 42, /// otherfield: String::from("Hello World"), /// ] /// ).expect("Unable to connect to the wayland compositor"); /// ``` /// /// If you instead want the macro to use some pre-existing display and event queue, you can /// add the `with` argument providing them. In that case the macro will evaluate to /// a `Result`, forwarding to you any error that may have occured /// during the initial roundtrips. /// /// ```no_run /// # use smithay_client_toolkit::{default_environment, new_default_environment}; /// # default_environment!(MyEnv, desktop, fields=[somefield: u32, otherfield: String]); /// # let display = smithay_client_toolkit::reexports::client::Display::connect_to_env().unwrap(); /// # let mut queue = display.create_event_queue(); /// let env = new_default_environment!(MyEnv, /// desktop, // the optional preset /// with=(display, queue), // the display and event queue to use /// /* initializers for your extra fields if any, can be ommited if no fields are added */ /// fields=[ /// somefield: 42, /// otherfield: String::from("Hello World"), /// ] /// ).expect("Initial roundtrips failed!"); /// ``` macro_rules! new_default_environment { ($env_name:ident, desktop $(, with=($display:expr, $queue:expr))? $(,fields = [$($fname:ident : $fval:expr),* $(,)?])? $(,)? ) => { $crate::new_default_environment!($env_name, $(with=($display, $queue),)? fields = [ sctk_shell: $crate::shell::ShellHandler::new(), sctk_decoration_mgr: $crate::environment::SimpleGlobal::new(), $($( $fname: $fval, )*)? ] ) }; ($env_name:ident, with=($display:expr, $queue:expr) $(,fields = [$($fname:ident : $fval:expr),* $(,)?])? $(,)? ) => { { let mut sctk_seats = $crate::seat::SeatHandler::new(); let sctk_data_device_manager = $crate::data_device::DataDeviceHandler::init(&mut sctk_seats); let sctk_primary_selection_manager = $crate::primary_selection::PrimarySelectionHandler::init(&mut sctk_seats); let display = $crate::reexports::client::Proxy::clone(&$display); let env = $crate::environment::Environment::new(&display.attach($queue.token()), &mut $queue,$env_name { sctk_compositor: $crate::environment::SimpleGlobal::new(), sctk_subcompositor: $crate::environment::SimpleGlobal::new(), sctk_shm: $crate::shm::ShmHandler::new(), sctk_outputs: $crate::output::OutputHandler::new(), sctk_seats, sctk_data_device_manager, sctk_primary_selection_manager, $($( $fname: $fval, )*)? }); if let Ok(env) = env.as_ref() { // Bind primary selection manager. let _psm = env.get_primary_selection_manager(); } env } }; ($env_name:ident $(,fields = [$($fname:ident : $fval:expr),* $(,)?])? $(,)? ) => { $crate::reexports::client::Display::connect_to_env().and_then(|display| { let mut queue = display.create_event_queue(); let ret = $crate::new_default_environment!( $env_name, with=(display, queue), fields=[$($($fname: $fval),*)?], ); match ret { Ok(env) => Ok((env, display, queue)), Err(e) => { if let Some(perr) = display.protocol_error() { panic!("[SCTK] A protocol error occured during initial setup: {}", perr); } else { // For some other reason the connection with the compositor was lost // This should not arrive unless maybe the compositor was shutdown during // the initial setup... Err($crate::reexports::client::ConnectError::NoCompositorListening) } } } }) }; } /// An error representing the fact that a required global was missing #[derive(Debug, Copy, Clone)] pub struct MissingGlobal; impl std::error::Error for MissingGlobal {} impl std::fmt::Display for MissingGlobal { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str("missing global") } } smithay-client-toolkit-0.16.1/src/output.rs000064400000000000000000000616021046102023000170300ustar 00000000000000//! Types and functions related to graphical outputs //! //! This modules provides two main elements. The first is the //! [`OutputHandler`](struct.OutputHandler.html) type, which is a //! [`MultiGlobalHandler`](../environment/trait.MultiGlobalHandler.html) for //! use with the [`init_environment!`](../macro.init_environment.html) macro. It is automatically //! included if you use the [`new_default_environment!`](../macro.new_default_environment.html). //! //! The second is the [`with_output_info`](fn.with_output_info.html) with allows you to //! access the information associated to this output, as an [`OutputInfo`](struct.OutputInfo.html). use std::{ cell::RefCell, fmt, rc::{self, Rc}, sync::{self, Arc, Mutex}, }; use wayland_client::{ protocol::{ wl_output::{self, Event, WlOutput}, wl_registry, }, Attached, DispatchData, Main, }; use wayland_protocols::unstable::xdg_output::v1::client::{ zxdg_output_manager_v1::ZxdgOutputManagerV1, zxdg_output_v1::{self, ZxdgOutputV1}, }; pub use wayland_client::protocol::wl_output::{Subpixel, Transform}; /// A possible mode for an output #[derive(Copy, Clone, Debug)] pub struct Mode { /// Number of pixels of this mode in format `(width, height)` /// /// for example `(1920, 1080)` pub dimensions: (i32, i32), /// Refresh rate for this mode, in mHz pub refresh_rate: i32, /// Whether this is the current mode for this output pub is_current: bool, /// Whether this is the preferred mode for this output pub is_preferred: bool, } #[derive(Clone, Debug)] #[non_exhaustive] /// Compiled information about an output pub struct OutputInfo { /// The ID of this output as a global pub id: u32, /// The model name of this output as advertised by the server pub model: String, /// The make name of this output as advertised by the server pub make: String, /// The name of this output as advertised by the server /// /// Each name is unique among all wl_output globals, but if a wl_output /// global is destroyed the same name may be reused later. The names will /// also remain consistent across sessions with the same hardware and /// software configuration. /// /// Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc. However, do /// not assume that the name is a reflection of an underlying DRM connector, /// X11 connection, etc. /// /// Note that this is not filled in by version 3 of the wl_output protocol, /// but it has been proposed for inclusion in version 4. Until then, it is /// only filled in if your environment has an [XdgOutputHandler] global /// handler for [ZxdgOutputManagerV1]. pub name: String, /// The description of this output as advertised by the server /// /// The description is a UTF-8 string with no convention defined for its /// contents. The description is not guaranteed to be unique among all /// wl_output globals. Examples might include 'Foocorp 11" Display' or /// 'Virtual X11 output via :1'. /// /// Note that this is not filled in by version 3 of the wl_output protocol, /// but it has been proposed for inclusion in version 4. Until then, it is /// only filled in if your environment has an [XdgOutputHandler] global /// handler for [ZxdgOutputManagerV1]. pub description: String, /// Location of the top-left corner of this output in compositor /// space /// /// Note that the compositor may decide to always report (0,0) if /// it decides clients are not allowed to know this information. pub location: (i32, i32), /// Physical dimensions of this output, in unspecified units pub physical_size: (i32, i32), /// The subpixel layout for this output pub subpixel: Subpixel, /// The current transformation applied to this output /// /// You can pre-render your buffers taking this information /// into account and advertising it via `wl_buffer.set_tranform` /// for better performances. pub transform: Transform, /// The scaling factor of this output /// /// Any buffer whose scaling factor does not match the one /// of the output it is displayed on will be rescaled accordingly. /// /// For example, a buffer of scaling factor 1 will be doubled in /// size if the output scaling factor is 2. pub scale_factor: i32, /// Possible modes for an output pub modes: Vec, /// Has this output been unadvertized by the registry /// /// If this is the case, it has become inert, you might want to /// call its `release()` method if you don't plan to use it any /// longer. pub obsolete: bool, } impl OutputInfo { fn new(id: u32) -> OutputInfo { OutputInfo { id, model: String::new(), make: String::new(), name: String::new(), description: String::new(), location: (0, 0), physical_size: (0, 0), subpixel: Subpixel::Unknown, transform: Transform::Normal, scale_factor: 1, modes: Vec::new(), obsolete: false, } } } type OutputCallback = dyn Fn(WlOutput, &OutputInfo, DispatchData) + Send + Sync; enum OutputData { Ready { info: OutputInfo, callbacks: Vec>, }, Pending { id: u32, has_xdg: bool, events: Vec, callbacks: Vec>, }, PendingXDG { info: OutputInfo, callbacks: Vec>, }, } type OutputStatusCallback = dyn FnMut(WlOutput, &OutputInfo, DispatchData) + 'static; /// A handler for `wl_output` /// /// This handler can be used for managing `wl_output` in the /// [`init_environment!`](../macro.init_environment.html) macro, and is automatically /// included in [`new_default_environment!`](../macro.new_default_environment.html). /// /// It aggregates the output information and makes it available via the /// [`with_output_info`](fn.with_output_info.html) function. pub struct OutputHandler { outputs: Vec<(u32, Attached)>, status_listeners: Rc>>>>, xdg_listener: Option>>, } impl OutputHandler { /// Create a new instance of this handler pub fn new() -> OutputHandler { OutputHandler { outputs: Vec::new(), status_listeners: Rc::new(RefCell::new(Vec::new())), xdg_listener: None, } } } impl crate::environment::MultiGlobalHandler for OutputHandler { fn created( &mut self, registry: Attached, id: u32, version: u32, _: DispatchData, ) { // We currently support wl_output up to version 4 let version = std::cmp::min(version, 4); let output = registry.bind::(version, id); let has_xdg = if let Some(xdg) = self.xdg_listener.as_ref().and_then(rc::Weak::upgrade) { xdg.borrow_mut().new_xdg_output(&output, &self.status_listeners) } else { false }; if version > 1 { // wl_output.done event was only added at version 2 // In case of an old version 1, we just behave as if it was send at the start output.as_ref().user_data().set_threadsafe(|| { Mutex::new(OutputData::Pending { id, has_xdg, events: vec![], callbacks: vec![] }) }); } else { output.as_ref().user_data().set_threadsafe(|| { Mutex::new(OutputData::Ready { info: OutputInfo::new(id), callbacks: vec![] }) }); } let status_listeners_handle = self.status_listeners.clone(); let xdg_listener_handle = self.xdg_listener.clone(); output.quick_assign(move |output, event, ddata| { process_output_event( output, event, ddata, &status_listeners_handle, &xdg_listener_handle, ) }); self.outputs.push((id, (*output).clone())); } fn removed(&mut self, id: u32, mut ddata: DispatchData) { let status_listeners_handle = &self.status_listeners; let xdg_listener_handle = &self.xdg_listener; self.outputs.retain(|(i, o)| { if *i != id { true } else { make_obsolete(o, ddata.reborrow(), status_listeners_handle, xdg_listener_handle); false } }); } fn get_all(&self) -> Vec> { self.outputs.iter().map(|(_, o)| o.clone()).collect() } } impl fmt::Debug for OutputHandler { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("OutputHandler") .field("outputs", &self.outputs) .field("status_listeners", &"Fn() -> { ... }") .field("xdg_listener", &self.xdg_listener) .finish() } } fn process_output_event( output: Main, event: Event, mut ddata: DispatchData, listeners: &Rc>>>>, xdg_listener: &Option>>, ) { let udata_mutex = output .as_ref() .user_data() .get::>() .expect("SCTK: wl_output has invalid UserData"); let mut udata = udata_mutex.lock().unwrap(); if let Event::Done = event { let (id, has_xdg, pending_events, mut callbacks) = match *udata { OutputData::Pending { id, has_xdg, events: ref mut v, callbacks: ref mut cb } => { (id, has_xdg, std::mem::take(v), std::mem::take(cb)) } OutputData::PendingXDG { ref mut info, ref mut callbacks } => { notify(&output, info, ddata.reborrow(), callbacks); notify_status_listeners(&output, info, ddata, listeners); let info = info.clone(); let callbacks = std::mem::take(callbacks); *udata = OutputData::Ready { info, callbacks }; return; } OutputData::Ready { ref mut info, ref mut callbacks } => { // a Done event on an output that is already ready was due to a // status change (which was already merged) notify(&output, info, ddata, callbacks); return; } }; let mut info = OutputInfo::new(id); for evt in pending_events { merge_event(&mut info, evt); } notify(&output, &info, ddata.reborrow(), &mut callbacks); if let Some(xdg) = xdg_listener.as_ref().and_then(rc::Weak::upgrade) { if has_xdg || xdg.borrow_mut().new_xdg_output(&output, listeners) { *udata = OutputData::PendingXDG { info, callbacks }; return; } } notify_status_listeners(&output, &info, ddata, listeners); *udata = OutputData::Ready { info, callbacks }; } else { match *udata { OutputData::Pending { events: ref mut v, .. } => v.push(event), OutputData::PendingXDG { ref mut info, .. } | OutputData::Ready { ref mut info, .. } => { merge_event(info, event); } } } } fn make_obsolete( output: &Attached, mut ddata: DispatchData, listeners: &RefCell>>>, xdg_listener: &Option>>, ) { let udata_mutex = output .as_ref() .user_data() .get::>() .expect("SCTK: wl_output has invalid UserData"); let mut udata = udata_mutex.lock().unwrap(); if let Some(xdg) = xdg_listener.as_ref().and_then(rc::Weak::upgrade) { xdg.borrow_mut().destroy_xdg_output(output); } let (id, mut callbacks) = match *udata { OutputData::PendingXDG { ref mut info, ref mut callbacks } | OutputData::Ready { ref mut info, ref mut callbacks } => { info.obsolete = true; notify(output, info, ddata.reborrow(), callbacks); notify_status_listeners(output, info, ddata, listeners); return; } OutputData::Pending { id, callbacks: ref mut cb, .. } => (id, std::mem::take(cb)), }; let mut info = OutputInfo::new(id); info.obsolete = true; notify(output, &info, ddata.reborrow(), &mut callbacks); notify_status_listeners(output, &info, ddata, listeners); *udata = OutputData::Ready { info, callbacks }; } fn merge_event(info: &mut OutputInfo, event: Event) { match event { Event::Geometry { x, y, physical_width, physical_height, subpixel, model, make, transform, } => { info.location = (x, y); info.physical_size = (physical_width, physical_height); info.subpixel = subpixel; info.transform = transform; info.model = model; info.make = make; } Event::Scale { factor } => { info.scale_factor = factor; } Event::Mode { width, height, refresh, flags } => { let mut found = false; if let Some(mode) = info .modes .iter_mut() .find(|m| m.dimensions == (width, height) && m.refresh_rate == refresh) { // this mode already exists, update it mode.is_preferred = flags.contains(wl_output::Mode::Preferred); mode.is_current = flags.contains(wl_output::Mode::Current); found = true; } if !found { // otherwise, add it info.modes.push(Mode { dimensions: (width, height), refresh_rate: refresh, is_preferred: flags.contains(wl_output::Mode::Preferred), is_current: flags.contains(wl_output::Mode::Current), }) } } Event::Name { name } => { info.name = name; } Event::Description { description } => { info.description = description; } // ignore all other events _ => (), } } fn notify( output: &WlOutput, info: &OutputInfo, mut ddata: DispatchData, callbacks: &mut Vec>, ) { callbacks.retain(|weak| { if let Some(arc) = sync::Weak::upgrade(weak) { (*arc)(output.clone(), info, ddata.reborrow()); true } else { false } }); } fn notify_status_listeners( output: &WlOutput, info: &OutputInfo, mut ddata: DispatchData, listeners: &RefCell>>>, ) { // Notify the callbacks listening for new outputs listeners.borrow_mut().retain(|lst| { if let Some(cb) = rc::Weak::upgrade(lst) { (cb.borrow_mut())(output.clone(), info, ddata.reborrow()); true } else { false } }) } /// Access the info associated with this output /// /// The provided closure is given the [`OutputInfo`](struct.OutputInfo.html) as argument, /// and its return value is returned from this function. /// /// If the provided `WlOutput` has not yet been initialized or is not managed by SCTK, `None` is returned. /// /// If the output has been removed by the compositor, the `obsolete` field of the `OutputInfo` /// will be set to `true`. This handler will not automatically detroy the output by calling its /// `release` method, to avoid interfering with your logic. pub fn with_output_info T>(output: &WlOutput, f: F) -> Option { if let Some(udata_mutex) = output.as_ref().user_data().get::>() { let udata = udata_mutex.lock().unwrap(); match *udata { OutputData::PendingXDG { ref info, .. } | OutputData::Ready { ref info, .. } => { Some(f(info)) } OutputData::Pending { .. } => None, } } else { None } } /// Add a listener to this output /// /// The provided closure will be called whenever a property of the output changes, /// including when it is removed by the compositor (in this case it'll be marked as /// obsolete). /// /// The returned [`OutputListener`](struct.OutputListener) keeps your callback alive, /// dropping it will disable the callback and free the closure. pub fn add_output_listener( output: &WlOutput, f: F, ) -> OutputListener { let arc = Arc::new(f) as Arc<_>; if let Some(udata_mutex) = output.as_ref().user_data().get::>() { let mut udata = udata_mutex.lock().unwrap(); match *udata { OutputData::Pending { ref mut callbacks, .. } | OutputData::PendingXDG { ref mut callbacks, .. } | OutputData::Ready { ref mut callbacks, .. } => { callbacks.push(Arc::downgrade(&arc)); } } } OutputListener { _cb: arc } } /// A handle to an output listener callback /// /// Dropping it disables the associated callback and frees the closure. pub struct OutputListener { _cb: Arc, } impl fmt::Debug for OutputListener { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("OutputListener").field("_cb", &"fn() -> { ... }").finish() } } /// A handle to an output status callback /// /// Dropping it disables the associated callback and frees the closure. pub struct OutputStatusListener { _cb: Rc>, } impl fmt::Debug for OutputStatusListener { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("OutputStatusListener").field("_cb", &"fn() -> { ... }").finish() } } /// Trait representing the OutputHandler functions /// /// Implementing this trait on your inner environment struct used with the /// [`environment!`](../macro.environment.html) by delegating it to its /// [`OutputHandler`](struct.OutputHandler.html) field will make available the output-associated /// method on your [`Environment`](../environment/struct.Environment.html). pub trait OutputHandling { /// Insert a listener for output creation and removal events fn listen( &mut self, f: F, ) -> OutputStatusListener; } impl OutputHandling for OutputHandler { fn listen( &mut self, f: F, ) -> OutputStatusListener { let rc = Rc::new(RefCell::new(f)) as Rc<_>; self.status_listeners.borrow_mut().push(Rc::downgrade(&rc)); OutputStatusListener { _cb: rc } } } impl crate::environment::Environment { /// Insert a new listener for outputs /// /// The provided closure will be invoked whenever a `wl_output` is created or removed. /// /// Note that if outputs already exist when this callback is setup, it'll not be invoked on them. /// For you to be notified of them as well, you need to first process them manually by calling /// `.get_all_outputs()`. /// /// The returned [`OutputStatusListener`](../output/struct.OutputStatusListener.hmtl) keeps your /// callback alive, dropping it will disable it. #[must_use = "the returned OutputStatusListener keeps your callback alive, dropping it will disable it"] pub fn listen_for_outputs( &self, f: F, ) -> OutputStatusListener { self.with_inner(move |inner| OutputHandling::listen(inner, f)) } } impl> crate::environment::Environment { /// Shorthand method to retrieve the list of outputs pub fn get_all_outputs(&self) -> Vec { self.get_all_globals::().into_iter().map(|o| o.detach()).collect() } } /// A handler for `zxdg_output_manager_v1` /// /// This handler adds additional information to the OutputInfo struct that is /// available through the xdg_output interface. Because this requires binding /// the two handlers together when they are being created, it does not work with /// [`new_default_environment!`](../macro.new_default_environment.html); you /// must use [`default_environment!`](../macro.default_environment.html) and /// create the [OutputHandler] outside the constructor. /// /// ```no_compile /// let (sctk_outputs, sctk_xdg_out) = smithay_client_toolkit::output::XdgOutputHandler::new_output_handlers(); /// /// let env = smithay_client_toolkit::environment::Environment::new(&wl_display, &mut wl_queue, Globals { /// sctk_compositor: SimpleGlobal::new(), /// sctk_shm: smithay_client_toolkit::shm::ShmHandler::new(), /// sctk_seats : smithay_client_toolkit::seat::SeatHandler::new(), /// sctk_shell : smithay_client_toolkit::shell::ShellHandler::new(), /// sctk_outputs, /// sctk_xdg_out, /// // ... /// })?; /// /// ``` #[derive(Debug)] pub struct XdgOutputHandler { inner: Rc>, } #[derive(Debug)] struct XdgOutputHandlerInner { xdg_manager: Option>, outputs: Vec<(WlOutput, Attached)>, } impl XdgOutputHandler { /// Create a new instance of this handler bound to the given OutputHandler. pub fn new(output_handler: &mut OutputHandler) -> Self { let inner = Rc::new(RefCell::new(XdgOutputHandlerInner { xdg_manager: None, outputs: Vec::new() })); output_handler.xdg_listener = Some(Rc::downgrade(&inner)); XdgOutputHandler { inner } } /// Helper function to create a bound pair of OutputHandler and XdgOutputHandler. pub fn new_output_handlers() -> (OutputHandler, Self) { let mut oh = OutputHandler::new(); let xh = XdgOutputHandler::new(&mut oh); (oh, xh) } } impl XdgOutputHandlerInner { fn new_xdg_output( &mut self, output: &WlOutput, listeners: &Rc>>>>, ) -> bool { if let Some(xdg_manager) = &self.xdg_manager { let xdg_main = xdg_manager.get_xdg_output(output); let wl_out = output.clone(); let listeners = listeners.clone(); xdg_main.quick_assign(move |_xdg_out, event, ddata| { process_xdg_event(&wl_out, event, ddata, &listeners) }); self.outputs.push((output.clone(), xdg_main.into())); true } else { false } } fn destroy_xdg_output(&mut self, output: &WlOutput) { self.outputs.retain(|(out, xdg_out)| { if out.as_ref().is_alive() && out != output { true } else { xdg_out.destroy(); false } }); } } fn process_xdg_event( wl_out: &WlOutput, event: zxdg_output_v1::Event, mut ddata: DispatchData, listeners: &RefCell>>>, ) { use zxdg_output_v1::Event; let udata_mutex = wl_out .as_ref() .user_data() .get::>() .expect("SCTK: wl_output has invalid UserData"); let mut udata = udata_mutex.lock().unwrap(); let (info, callbacks, pending) = match &mut *udata { OutputData::Ready { info, callbacks } => (info, callbacks, false), OutputData::PendingXDG { info, callbacks } => (info, callbacks, true), OutputData::Pending { .. } => unreachable!(), }; match event { Event::Name { name } => { info.name = name; } Event::Description { description } => { info.description = description; } Event::Done => { notify(wl_out, info, ddata.reborrow(), callbacks); if pending { notify_status_listeners(wl_out, info, ddata, listeners); let info = info.clone(); let callbacks = std::mem::take(callbacks); *udata = OutputData::Ready { info, callbacks }; } } _ => (), } } impl crate::environment::GlobalHandler for XdgOutputHandler { fn created( &mut self, registry: Attached, id: u32, version: u32, _: DispatchData, ) { let version = std::cmp::min(version, 3); let mut inner = self.inner.borrow_mut(); let xdg_manager: Main = registry.bind(version, id); inner.xdg_manager = Some(xdg_manager.into()); } fn get(&self) -> Option> { let inner = self.inner.borrow(); inner.xdg_manager.clone() } } smithay-client-toolkit-0.16.1/src/primary_selection/device.rs000064400000000000000000000137441046102023000224630ustar 00000000000000use std::sync::{Arc, Mutex}; use wayland_protocols::{ misc::gtk_primary_selection::client::gtk_primary_selection_device::{ self, GtkPrimarySelectionDevice, }, unstable::primary_selection::v1::client::zwp_primary_selection_device_v1::{ self, ZwpPrimarySelectionDeviceV1, }, }; use wayland_client::protocol::wl_seat::WlSeat; use crate::primary_selection::offer::PrimarySelectionOfferImpl; use crate::primary_selection::source::PrimarySelectionSourceImpl; use super::PrimarySelectionDeviceManager; use super::PrimarySelectionOffer; use super::PrimarySelectionSource; /// Handle to support primary selection on a given seat. /// /// This type provides you with copy/paste actions. It is associated with a seat upon creation. #[derive(Debug)] pub struct PrimarySelectionDevice { device: PrimarySelectionDeviceImpl, inner: Arc>, } /// Possible supported primary selection devices. #[derive(Debug)] enum PrimarySelectionDeviceImpl { Zwp(ZwpPrimarySelectionDeviceV1), Gtk(GtkPrimarySelectionDevice), } /// Inner state for `PrimarySelectionDevice`. #[derive(Debug)] struct PrimarySelectionDeviceInner { /// Current selection. selection: Option, /// List of known offers. know_offers: Vec, } impl PrimarySelectionDeviceInner { /// Provide a primary selection source as the new content for the primary selection. /// /// Correspond to traditional copy/paste behavior. Setting the source to `None` will clear /// the selection. fn set_selection(&mut self, offer: Option) { let offer = match offer { Some(offer) => offer, None => { // Drop the current offer if any. self.selection = None; return; } }; if let Some(id) = self.know_offers.iter().position(|o| o.offer == offer) { self.selection = Some(self.know_offers.swap_remove(id)); } else { panic!("Compositor set an unknown primary offer for a primary selection.") } } } impl Drop for PrimarySelectionDevice { fn drop(&mut self) { match self.device { PrimarySelectionDeviceImpl::Zwp(ref device) => device.destroy(), PrimarySelectionDeviceImpl::Gtk(ref device) => device.destroy(), } } } impl PrimarySelectionDevice { /// Create the `PrimarySelectionDevice` helper for this seat. pub fn init_for_seat(manager: &PrimarySelectionDeviceManager, seat: &WlSeat) -> Self { let inner = Arc::new(Mutex::new(PrimarySelectionDeviceInner { selection: None, know_offers: Vec::new(), })); let inner2 = inner.clone(); let device = match manager { PrimarySelectionDeviceManager::Zwp(zwp_manager) => { let device = zwp_manager.get_device(seat); device.quick_assign(move |_, event, _| { let mut inner = inner2.lock().unwrap(); use zwp_primary_selection_device_v1::Event; match event { Event::DataOffer { offer } => { inner.know_offers.push(PrimarySelectionOffer::from_zwp(offer)) } Event::Selection { id } => { let id = id.map(PrimarySelectionOfferImpl::Zwp); inner.set_selection(id); } _ => unreachable!(), } }); PrimarySelectionDeviceImpl::Zwp(device.detach()) } PrimarySelectionDeviceManager::Gtk(gtk_manager) => { let device = gtk_manager.get_device(seat); device.quick_assign(move |_, event, _| { let mut inner = inner2.lock().unwrap(); use gtk_primary_selection_device::Event; match event { Event::DataOffer { offer } => { inner.know_offers.push(PrimarySelectionOffer::from_gtk(offer)) } Event::Selection { id } => { let id = id.map(PrimarySelectionOfferImpl::Gtk); inner.set_selection(id); } _ => unreachable!(), } }); PrimarySelectionDeviceImpl::Gtk(device.detach()) } }; Self { device, inner } } /// Provide a primary selection source as the new content for the primary selection. /// /// Correspond to traditional copy/paste behavior. Setting the source to `None` will clear /// the selection. pub fn set_selection(&self, source: &Option, serial: u32) { match self.device { PrimarySelectionDeviceImpl::Zwp(ref device) => { let source = source.as_ref().map(|source| match source.source { PrimarySelectionSourceImpl::Zwp(ref source) => source, // We can't reach `Gtk` source in `Zwp`. _ => unreachable!(), }); device.set_selection(source, serial); } PrimarySelectionDeviceImpl::Gtk(ref device) => { let source = source.as_ref().map(|source| match source.source { PrimarySelectionSourceImpl::Gtk(ref source) => source, // We can't reach `Zwp` source in `Gtk`. _ => unreachable!(), }); device.set_selection(source, serial); } } } /// Access the `PrimarySelectionOffer` currently associated with the primary selection buffer. pub fn with_selection) -> T, T>(&self, f: F) -> T { let inner = self.inner.lock().unwrap(); f(inner.selection.as_ref()) } } smithay-client-toolkit-0.16.1/src/primary_selection/mod.rs000064400000000000000000000330031046102023000217710ustar 00000000000000//! Helpers to handle primary selection related actions. //! //! If you're not using [`default_environment!`](../macro.default_environment.html) you should //! call `get_primary_selection_manager` to bind proper primary selection manager. use std::{cell::RefCell, rc::Rc}; use wayland_protocols::misc::gtk_primary_selection::client::gtk_primary_selection_device_manager::GtkPrimarySelectionDeviceManager; use wayland_protocols::unstable::primary_selection::v1::client::zwp_primary_selection_device_manager_v1::ZwpPrimarySelectionDeviceManagerV1; use wayland_client::{ protocol::{wl_registry::WlRegistry, wl_seat::WlSeat}, Attached, DispatchData, }; use crate::lazy_global::LazyGlobal; use crate::seat::{SeatHandling, SeatListener}; use crate::{environment::GlobalHandler, MissingGlobal}; mod device; mod offer; mod source; pub use self::device::PrimarySelectionDevice; pub use self::offer::PrimarySelectionOffer; pub use self::source::{PrimarySelectionSource, PrimarySelectionSourceEvent}; /// A handler for primary selection. /// /// It provides automatic tracking of primary selection device for each available seat, /// allowing you to manipulate the primary selection clipboard. /// /// It's automatically included in the [`default_environment!`](../macro.default_environment.html). #[derive(Debug)] pub struct PrimarySelectionHandler { inner: Rc>, _listener: SeatListener, } /// Possible supported primary selection protocols #[derive(Debug)] pub enum PrimarySelectionDeviceManager { /// The current standard `primary_selection` protocol. Zwp(Attached), /// The old `gtk_primary_selection` protocol, which is still used by GTK. Gtk(Attached), } impl PrimarySelectionHandler { /// Initialize a primary selection handler. /// /// In requires the access to the seat handler in order to track the creation and removal of /// seats. pub fn init(seat_handler: &mut S) -> Self { let inner = Rc::new(RefCell::new(PrimarySelectionDeviceManagerInner { registry: None, zwp_mgr: LazyGlobal::Unknown, gtk_mgr: LazyGlobal::Unknown, state: PrimarySelectionDeviceManagerInitState::Pending { seats: Vec::new() }, })); // Listen for a new seat events to add new primary selection devices on the fly. let seat_inner = inner.clone(); let listener = seat_handler.listen(move |seat, seat_data, _| { if seat_data.defunct { seat_inner.borrow_mut().remove_seat(&seat); } else { seat_inner.borrow_mut().new_seat(&seat); } }); Self { inner, _listener: listener } } } /// An interface trait to forward the primary selection device handler capability. /// /// You need to implement this trait for your environment struct, by delegating it /// to its `PrimarySelectionHandler` field in order to get the associated methods /// on your [`Environment`](../environment/struct.environment.html). pub trait PrimarySelectionHandling { /// Access the primary selection associated with a seat. /// /// Returns an error if the seat is not found (for example if it has since been removed by /// the server) or if the `zwp_primary_selection_device_manager_v1` or /// `gtk_primary_selection_device_manager` globals are missing. fn with_primary_selection( &self, seat: &WlSeat, f: F, ) -> Result<(), MissingGlobal>; /// Get the best available primary selection device manager protocol. /// /// Returns `None` if no primary selection device manager was advertised. fn get_primary_selection_manager(&self) -> Option; } impl crate::environment::Environment { /// Get the best available primary selection device manager protocol. /// /// Returns `None` if no primary selection device manager was advertised. pub fn get_primary_selection_manager(&self) -> Option { self.with_inner(|manager| manager.get_primary_selection_manager()) } /// Access the primary selection associated with a seat. /// /// Returns an error if the seat is not found (for example if it has since been removed by /// the server) of if the `zwp_primary_selection_device_manager_v1` or /// `gtk_primary_selection_device_manager` globals are missing. pub fn with_primary_selection( &self, seat: &WlSeat, f: F, ) -> Result<(), MissingGlobal> { self.with_inner(|inner| inner.with_primary_selection(seat, f)) } /// Create a new primary selection source. /// /// This primary selection source is the basic object for offering primary selection clipboard /// to other clients. /// /// Once this source is created, you will need to give it to a /// [`PrimarySelectionDevice`](../primary_selection/struct.PrimarySelectionDevice.html) /// to start interaction. pub fn new_primary_selection_source( &self, mime_types: Vec, callback: F, ) -> PrimarySelectionSource where F: FnMut(PrimarySelectionSourceEvent, DispatchData) + 'static, { let manager = match self.get_primary_selection_manager() { Some(manager) => manager, None => panic!("[SCTK] primary selection was required"), }; PrimarySelectionSource::new(&manager, mime_types, callback) } } impl PrimarySelectionHandling for PrimarySelectionHandler { /// Get the best available primary selection device manager protocol. /// /// Returns `None` if no primary selection device manager was advertised. fn get_primary_selection_manager(&self) -> Option { GlobalHandler::::get(self) .map(PrimarySelectionDeviceManager::Zwp) .or_else(|| { GlobalHandler::::get(self) .map(PrimarySelectionDeviceManager::Gtk) }) } /// Access the primary selection associated with a seat. /// /// Returns an error if the seat is not found (for example if it has since been removed by /// the server) of if the `zwp_primary_selection_device_manager_v1` or /// `gtk_primary_selection_device_manager` globals are missing. fn with_primary_selection( &self, seat: &WlSeat, f: F, ) -> Result<(), MissingGlobal> { self.inner.borrow().with_primary_selection(seat, f) } } /// Initialization phase of `PrimarySelectionDeviceManagerInner`. #[derive(Debug)] enum PrimarySelectionDeviceManagerInitState { Ready { manager: PrimarySelectionDeviceManager, devices: Vec<(WlSeat, PrimarySelectionDevice)> }, Pending { seats: Vec }, } /// Inner mutable state for `PrimarySelectionHandler`. #[derive(Debug)] struct PrimarySelectionDeviceManagerInner { registry: Option>, zwp_mgr: LazyGlobal, gtk_mgr: LazyGlobal, pub state: PrimarySelectionDeviceManagerInitState, } impl PrimarySelectionDeviceManagerInner { /// Initialize `PrimarySelectionDeviceManager` and setup `PrimarySelectionDevice` for a /// registered seats, if we have pending `PrimarySelectionDeviceManager`. fn init_selection_manager(&mut self, manager: PrimarySelectionDeviceManager) { let seats = if let PrimarySelectionDeviceManagerInitState::Pending { seats } = &mut self.state { std::mem::take(seats) } else { log::warn!("Ignoring second primary selection manager."); return; }; let mut devices = Vec::new(); // Create primary selection devices for each seat. for seat in seats { let device = PrimarySelectionDevice::init_for_seat(&manager, &seat); devices.push((seat.clone(), device)); } // Mark the state as `Ready`, so we can use our primary selection manager. self.state = PrimarySelectionDeviceManagerInitState::Ready { devices, manager } } /// Handle addition of a new seat. fn new_seat(&mut self, seat: &WlSeat) { match &mut self.state { PrimarySelectionDeviceManagerInitState::Ready { devices, manager } => { if devices.iter().any(|(s, _)| s == seat) { // The seat already exists, nothing to do return; } // Initialize primary selection device for a new seat. let device = PrimarySelectionDevice::init_for_seat(manager, seat); devices.push((seat.clone(), device)); } PrimarySelectionDeviceManagerInitState::Pending { seats } => { seats.push(seat.clone()); } } } /// Handle removal of a seat. fn remove_seat(&mut self, seat: &WlSeat) { match &mut self.state { PrimarySelectionDeviceManagerInitState::Ready { devices, .. } => { devices.retain(|(s, _)| s != seat) } PrimarySelectionDeviceManagerInitState::Pending { seats } => { seats.retain(|s| s != seat) } } } /// Access the primary selection associated with a seat. /// /// Returns an error if the seat is not found (for example if it has since been removed by /// the server) of if the `zwp_primary_selection_device_manager_v1` or /// `gtk_primary_selection_device_manager` globals are missing. fn with_primary_selection( &self, seat: &WlSeat, f: F, ) -> Result<(), MissingGlobal> { match &self.state { PrimarySelectionDeviceManagerInitState::Pending { .. } => Err(MissingGlobal), PrimarySelectionDeviceManagerInitState::Ready { devices, .. } => { for (s, device) in devices { if s == seat { f(device); return Ok(()); } } Err(MissingGlobal) } } } } impl GlobalHandler for PrimarySelectionHandler { fn created(&mut self, registry: Attached, id: u32, version: u32, _: DispatchData) { let mut inner = self.inner.borrow_mut(); if inner.registry.is_none() { inner.registry = Some(registry); } if let LazyGlobal::Unknown = inner.zwp_mgr { // Mark global as seen. inner.zwp_mgr = LazyGlobal::Seen { id, version }; } else { log::warn!( "Compositor advertised zwp_primary_selection_device_manager_v1 multiple\ times, ignoring." ) } } fn get(&self) -> Option> { let mut inner = self.inner.borrow_mut(); match inner.zwp_mgr { LazyGlobal::Bound(ref mgr) => Some(mgr.clone()), LazyGlobal::Unknown => None, LazyGlobal::Seen { id, version } => { // Registry cannot be `None` if we've seen the global. let registry = inner.registry.as_ref().unwrap(); // Bind zwp primary selection. let version = std::cmp::min(1, version); let mgr = registry.bind::(version, id); let manager = PrimarySelectionDeviceManager::Zwp((*mgr).clone()); // Init zwp selection manager. inner.init_selection_manager(manager); inner.zwp_mgr = LazyGlobal::Bound((*mgr).clone()); Some((*mgr).clone()) } } } } impl GlobalHandler for PrimarySelectionHandler { fn created(&mut self, registry: Attached, id: u32, version: u32, _: DispatchData) { let mut inner = self.inner.borrow_mut(); if inner.registry.is_none() { inner.registry = Some(registry); } if let LazyGlobal::Unknown = inner.gtk_mgr { // Mark global as seen. inner.gtk_mgr = LazyGlobal::Seen { id, version }; } else { log::warn!( "Compositor advertised gtk_primary_selection_device_manager multiple times,\ ignoring." ) } } fn get(&self) -> Option> { let mut inner = self.inner.borrow_mut(); match inner.gtk_mgr { LazyGlobal::Bound(ref mgr) => Some(mgr.clone()), LazyGlobal::Unknown => None, LazyGlobal::Seen { id, version } => { // Registry cannot be `None` if we've seen the global. let registry = inner.registry.as_ref().unwrap(); // Bind gtk primary selection. let version = std::cmp::min(1, version); let mgr = registry.bind::(version, id); let manager = PrimarySelectionDeviceManager::Gtk((*mgr).clone()); // Init gtk selection manager. inner.init_selection_manager(manager); inner.gtk_mgr = LazyGlobal::Bound((*mgr).clone()); Some((*mgr).clone()) } } } } smithay-client-toolkit-0.16.1/src/primary_selection/offer.rs000064400000000000000000000074551046102023000223270ustar 00000000000000use std::os::unix::io::FromRawFd; use std::sync::{Arc, Mutex}; use wayland_client::Main; use wayland_protocols::{ misc::gtk_primary_selection::client::gtk_primary_selection_offer::{ self, GtkPrimarySelectionOffer, }, unstable::primary_selection::v1::client::zwp_primary_selection_offer_v1::{ self, ZwpPrimarySelectionOfferV1, }, }; use crate::data_device::ReadPipe; /// A primary selection offer for receiving data through copy/paste. #[derive(Debug)] pub struct PrimarySelectionOffer { pub(crate) offer: PrimarySelectionOfferImpl, inner: Arc>, } impl PrimarySelectionOffer { /// Access the list of mime types proposed by this offer. pub fn with_mime_types(&self, f: F) -> T where F: FnOnce(&[String]) -> T, { let inner = self.inner.lock().unwrap(); f(&inner.mime_types) } /// Request to receive the data of a given mime type. /// /// Note that you should **not** read the contents right away in a blocking way, /// as you may deadlock your application. pub fn receive(&self, mime_type: String) -> Result { use nix::fcntl::OFlag; use nix::unistd::{close, pipe2}; // create a pipe let (readfd, writefd) = pipe2(OFlag::O_CLOEXEC)?; match &self.offer { PrimarySelectionOfferImpl::Zwp(offer) => { offer.receive(mime_type, writefd); } PrimarySelectionOfferImpl::Gtk(offer) => { offer.receive(mime_type, writefd); } } if let Err(err) = close(writefd) { log::warn!("Failed to close write pipe: {}", err); } Ok(unsafe { FromRawFd::from_raw_fd(readfd) }) } /// Initialize `PrimarySelectionOffer` from the `Zwp` offer. pub(crate) fn from_zwp(offer: Main) -> Self { let inner = Arc::new(Mutex::new(PrimarySelectionOfferInner::new())); let inner2 = inner.clone(); offer.quick_assign(move |_, event, _| { use zwp_primary_selection_offer_v1::Event; let mut inner = inner2.lock().unwrap(); match event { Event::Offer { mime_type } => { inner.mime_types.push(mime_type); } _ => unreachable!(), } }); Self { offer: PrimarySelectionOfferImpl::Zwp(offer.detach()), inner } } /// Initialize `PrimarySelectionOffer` from the `Gtk` offer. pub(crate) fn from_gtk(offer: Main) -> Self { let inner = Arc::new(Mutex::new(PrimarySelectionOfferInner::new())); let inner2 = inner.clone(); offer.quick_assign(move |_, event, _| { use gtk_primary_selection_offer::Event; let mut inner = inner2.lock().unwrap(); match event { Event::Offer { mime_type } => { inner.mime_types.push(mime_type); } _ => unreachable!(), } }); Self { offer: PrimarySelectionOfferImpl::Gtk(offer.detach()), inner } } } impl Drop for PrimarySelectionOffer { fn drop(&mut self) { match &self.offer { PrimarySelectionOfferImpl::Zwp(offer) => offer.destroy(), PrimarySelectionOfferImpl::Gtk(offer) => offer.destroy(), } } } /// Inner state for `PrimarySelectionOffer`. #[derive(Debug, Default)] struct PrimarySelectionOfferInner { mime_types: Vec, } impl PrimarySelectionOfferInner { fn new() -> Self { Self::default() } } /// Possible supported primary selection offers. #[derive(Debug, Eq, PartialEq)] pub(crate) enum PrimarySelectionOfferImpl { Zwp(ZwpPrimarySelectionOfferV1), Gtk(GtkPrimarySelectionOffer), } smithay-client-toolkit-0.16.1/src/primary_selection/source.rs000064400000000000000000000103051046102023000225120ustar 00000000000000use wayland_protocols::unstable::primary_selection::v1::client::zwp_primary_selection_source_v1::{ self, ZwpPrimarySelectionSourceV1, }; use wayland_protocols::misc::gtk_primary_selection::client::gtk_primary_selection_source::{ self, GtkPrimarySelectionSource, }; use crate::data_device::WritePipe; use std::os::unix::io::FromRawFd; use wayland_client::DispatchData; use super::PrimarySelectionDeviceManager; /// A primary selection source for sending data through copy/paste. #[derive(Debug)] pub struct PrimarySelectionSource { pub(crate) source: PrimarySelectionSourceImpl, } /// Possible events a primary selection source needs to react to. #[derive(Debug)] pub enum PrimarySelectionSourceEvent { /// Write the offered data for selected mime type. Send { /// Requested mime type. mime_type: String, /// Pipe to write into. pipe: WritePipe, }, /// The action using the primary selection source was cancelled. /// /// Once this event is received, the `PrimarySelectionSource` can not be used any more, /// and you should drop it for cleanup. /// /// Happens if the user replaces primary selection buffer. Cancelled, } impl PrimarySelectionSource { /// Create a new primary selection source. /// /// You'll then need to provide a primary selection device to send via selection. pub fn new( manager: &PrimarySelectionDeviceManager, mime_types: It, mut callback: F, ) -> Self where F: FnMut(PrimarySelectionSourceEvent, DispatchData) + 'static, S: Into, It: IntoIterator, { match manager { PrimarySelectionDeviceManager::Zwp(ref manager) => { let source = manager.create_source(); source.quick_assign(move |source, event, dispatch_data| { zwp_primary_source_imp(&source, event, dispatch_data, &mut callback); }); for mime in mime_types { source.offer(mime.into()); } Self { source: PrimarySelectionSourceImpl::Zwp(source.detach()) } } PrimarySelectionDeviceManager::Gtk(ref manager) => { let source = manager.create_source(); source.quick_assign(move |source, event, dispatch_data| { gtk_primary_source_imp(&source, event, dispatch_data, &mut callback); }); for mime in mime_types { source.offer(mime.into()); } Self { source: PrimarySelectionSourceImpl::Gtk(source.detach()) } } } } } /// Possible supported primary selection sources. #[derive(Debug)] pub(crate) enum PrimarySelectionSourceImpl { Zwp(ZwpPrimarySelectionSourceV1), Gtk(GtkPrimarySelectionSource), } fn gtk_primary_source_imp( source: &GtkPrimarySelectionSource, event: gtk_primary_selection_source::Event, dispatch_data: DispatchData, implem: &mut Impl, ) where Impl: FnMut(PrimarySelectionSourceEvent, DispatchData), { use gtk_primary_selection_source::Event; let event = match event { Event::Send { mime_type, fd } => PrimarySelectionSourceEvent::Send { mime_type, pipe: unsafe { FromRawFd::from_raw_fd(fd) }, }, Event::Cancelled => { source.destroy(); PrimarySelectionSourceEvent::Cancelled } _ => unreachable!(), }; implem(event, dispatch_data); } fn zwp_primary_source_imp( source: &ZwpPrimarySelectionSourceV1, event: zwp_primary_selection_source_v1::Event, dispatch_data: DispatchData, implem: &mut Impl, ) where Impl: FnMut(PrimarySelectionSourceEvent, DispatchData), { use zwp_primary_selection_source_v1::Event; let event = match event { Event::Send { mime_type, fd } => PrimarySelectionSourceEvent::Send { mime_type, pipe: unsafe { FromRawFd::from_raw_fd(fd) }, }, Event::Cancelled => { source.destroy(); PrimarySelectionSourceEvent::Cancelled } _ => unreachable!(), }; implem(event, dispatch_data); } smithay-client-toolkit-0.16.1/src/seat/keyboard/ffi.rs000064400000000000000000000244131046102023000207670ustar 00000000000000#![allow(dead_code, non_camel_case_types, clippy::identity_op)] use std::os::raw::{c_char, c_int, c_void, c_uint}; pub const XKB_MOD_NAME_SHIFT : &[u8] = b"Shift\0"; pub const XKB_MOD_NAME_CAPS : &[u8] = b"Lock\0"; pub const XKB_MOD_NAME_CTRL : &[u8] = b"Control\0"; pub const XKB_MOD_NAME_ALT : &[u8] = b"Mod1\0"; pub const XKB_MOD_NAME_NUM : &[u8] = b"Mod2\0"; pub const XKB_MOD_NAME_LOGO : &[u8] = b"Mod4\0"; pub const XKB_LED_NAME_CAPS : &[u8] = b"Caps Lock\0"; pub const XKB_LED_NAME_NUM : &[u8] = b"Num Lock\0"; pub const XKB_LED_NAME_SCROLL : &[u8] = b"Scroll Lock\0"; pub struct xkb_context; pub struct xkb_keymap; pub struct xkb_state; pub struct xkb_compose_table; pub struct xkb_compose_state; pub type xkb_keycode_t = u32; pub type xkb_keysym_t = u32; pub type xkb_layout_index_t = u32; pub type xkb_layout_mask_t = u32; pub type xkb_level_index_t = u32; pub type xkb_mod_index_t = u32; pub type xkb_mod_mask_t = u32; pub type xkb_led_index_t = u32; pub type xkb_led_mask_t = u32; pub const XKB_KEYCODE_INVALID :u32 = 0xffff_ffff; pub const XKB_LAYOUT_INVALID :u32 = 0xffff_ffff; pub const XKB_LEVEL_INVALID :u32 = 0xffff_ffff; pub const XKB_MOD_INVALID :u32 = 0xffff_ffff; pub const XKB_LED_INVALID :u32 = 0xffff_ffff; pub const XKB_KEYCODE_MAX :u32 = 0xffff_fffe; #[repr(C)] #[derive(Copy, Clone)] pub struct xkb_rule_names { pub rules: *const c_char, pub model: *const c_char , pub layout: *const c_char, pub variant: *const c_char, pub options: *const c_char, } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum xkb_keysym_flags { /** Do not apply any flags. */ XKB_KEYSYM_NO_FLAGS = 0, /** Find keysym by case-insensitive search. */ XKB_KEYSYM_CASE_INSENSITIVE = 1 << 0 } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum xkb_context_flags { /** Do not apply any context flags. */ XKB_CONTEXT_NO_FLAGS = 0, /** Create this context with an empty include path. */ XKB_CONTEXT_NO_DEFAULT_INCLUDES = 1 << 0, /** * Don't take RMLVO names from the environment. * @since 0.3.0 */ XKB_CONTEXT_NO_ENVIRONMENT_NAMES = 1 << 1 } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum xkb_log_level { /** Log critical internal errors only. */ XKB_LOG_LEVEL_CRITICAL = 10, /** Log all errors. */ XKB_LOG_LEVEL_ERROR = 20, /** Log warnings and errors. */ XKB_LOG_LEVEL_WARNING = 30, /** Log information, warnings, and errors. */ XKB_LOG_LEVEL_INFO = 40, /** Log everything. */ XKB_LOG_LEVEL_DEBUG = 50 } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum xkb_keymap_compile_flags { /** Do not apply any flags. */ XKB_KEYMAP_COMPILE_NO_FLAGS = 0, } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum xkb_keymap_format { /** Cannot be used for creation */ XKB_KEYMAP_USE_ORIGINAL_FORMAT = 0, /** The current/classic XKB text format, as generated by xkbcomp -xkb. */ XKB_KEYMAP_FORMAT_TEXT_V1 = 1, } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum xkb_key_direction { /** The key was released. */ XKB_KEY_UP, /** The key was pressed. */ XKB_KEY_DOWN } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum xkb_compose_compile_flags { XKB_COMPOSE_COMPILE_NO_FLAGS = 0 } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum xkb_compose_format { XKB_COMPOSE_FORMAT_TEXT_V1 = 1 } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum xkb_compose_state_flags { XKB_COMPOSE_STATE_NO_FLAGS = 0 } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum xkb_compose_status { XKB_COMPOSE_NOTHING, XKB_COMPOSE_COMPOSING, XKB_COMPOSE_COMPOSED, XKB_COMPOSE_CANCELLED } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum xkb_compose_feed_result { XKB_COMPOSE_FEED_IGNORED, XKB_COMPOSE_FEED_ACCEPTED } bitflags::bitflags!( pub struct xkb_state_component: u32 { /** Depressed modifiers, i.e. a key is physically holding them. */ const XKB_STATE_MODS_DEPRESSED = (1 << 0); /** Latched modifiers, i.e. will be unset after the next non-modifier * key press. */ const XKB_STATE_MODS_LATCHED = (1 << 1); /** Locked modifiers, i.e. will be unset after the key provoking the * lock has been pressed again. */ const XKB_STATE_MODS_LOCKED = (1 << 2); /** Effective modifiers, i.e. currently active and affect key * processing (derived from the other state components). * Use this unless you explictly care how the state came about. */ const XKB_STATE_MODS_EFFECTIVE = (1 << 3); /** Depressed layout, i.e. a key is physically holding it. */ const XKB_STATE_LAYOUT_DEPRESSED = (1 << 4); /** Latched layout, i.e. will be unset after the next non-modifier * key press. */ const XKB_STATE_LAYOUT_LATCHED = (1 << 5); /** Locked layout, i.e. will be unset after the key provoking the lock * has been pressed again. */ const XKB_STATE_LAYOUT_LOCKED = (1 << 6); /** Effective layout, i.e. currently active and affects key processing * (derived from the other state components). * Use this unless you explictly care how the state came about. */ const XKB_STATE_LAYOUT_EFFECTIVE = (1 << 7); /** LEDs (derived from the other state components). */ const XKB_STATE_LEDS = (1 << 8); } ); external_library!(XkbCommon, "xkbcommon", functions: fn xkb_keysym_get_name(xkb_keysym_t, *mut c_char, usize) -> c_int, fn xkb_keysym_from_name(*const c_char, xkb_keysym_flags) -> xkb_keysym_t, fn xkb_keysym_to_utf8(xkb_keysym_t, *mut c_char, usize) -> c_int, fn xkb_keysym_to_utf32(xkb_keysym_t) -> u32, fn xkb_context_new(xkb_context_flags) -> *mut xkb_context, fn xkb_context_ref(*mut xkb_context) -> *mut xkb_context, fn xkb_context_unref(*mut xkb_context) -> (), fn xkb_context_set_user_data(*mut xkb_context, *mut c_void) -> (), fn xkb_context_get_user_data(*mut xkb_context) -> *mut c_void, fn xkb_context_include_path_append(*mut xkb_context, *const c_char) -> c_int, fn xkb_context_include_path_append_default(*mut xkb_context) -> c_int, fn xkb_context_include_path_reset_defaults(*mut xkb_context) -> c_int, fn xkb_context_include_path_clear(*mut xkb_context) -> (), fn xkb_context_num_include_paths(*mut xkb_context) -> c_uint, fn xkb_context_include_path_get(*mut xkb_context, c_uint) -> *const c_char, fn xkb_context_set_log_level(*mut xkb_context, xkb_log_level) -> (), fn xkb_context_get_log_level(*mut xkb_context) -> xkb_log_level, fn xkb_context_set_log_verbosity(*mut xkb_context, c_int) -> (), fn xkb_context_get_log_verbosity(*mut xkb_context) -> c_int, fn xkb_keymap_new_from_names(*mut xkb_context, *const xkb_rule_names, xkb_keymap_compile_flags ) -> *mut xkb_keymap, fn xkb_keymap_new_from_string(*mut xkb_context, *const c_char, xkb_keymap_format, xkb_keymap_compile_flags ) -> *mut xkb_keymap, fn xkb_keymap_new_from_buffer(*mut xkb_context, *const c_char, usize, xkb_keymap_format, xkb_keymap_compile_flags ) -> *mut xkb_keymap, fn xkb_keymap_ref(*mut xkb_keymap) -> *mut xkb_keymap, fn xkb_keymap_unref(*mut xkb_keymap) -> (), fn xkb_keymap_get_as_string(*mut xkb_keymap, xkb_keymap_format) -> *const c_char, fn xkb_keymap_key_repeats(*mut xkb_keymap, xkb_keycode_t) -> c_int, fn xkb_state_new(*mut xkb_keymap) -> *mut xkb_state, fn xkb_state_ref(*mut xkb_state) -> *mut xkb_state, fn xkb_state_unref(*mut xkb_state) -> (), fn xkb_state_update_mask(*mut xkb_state, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t ) -> xkb_state_component, fn xkb_state_update_key(*mut xkb_state, xkb_keycode_t, xkb_key_direction ) -> xkb_state_component, fn xkb_state_key_get_syms(*mut xkb_state, xkb_keycode_t, *const *mut xkb_keysym_t ) -> c_int, fn xkb_state_key_get_utf8(*mut xkb_state, xkb_keycode_t, *mut c_char, usize ) -> c_int, fn xkb_state_key_get_utf32(*mut xkb_state, xkb_keycode_t) -> u32, fn xkb_state_key_get_one_sym(*mut xkb_state, xkb_keycode_t) -> xkb_keysym_t, fn xkb_state_mod_name_is_active(*mut xkb_state, *const c_char, xkb_state_component) -> c_int, fn xkb_compose_table_new_from_locale(*mut xkb_context, *const c_char, xkb_compose_compile_flags) -> *mut xkb_compose_table, fn xkb_compose_table_unref(*mut xkb_compose_table) -> (), fn xkb_compose_state_new(*mut xkb_compose_table, xkb_compose_state_flags) -> *mut xkb_compose_state, fn xkb_compose_state_unref(*mut xkb_compose_state) -> (), fn xkb_compose_state_feed(*mut xkb_compose_state, xkb_keysym_t) -> xkb_compose_feed_result, fn xkb_compose_state_reset(*mut xkb_compose_state) -> (), fn xkb_compose_state_get_status(*mut xkb_compose_state) -> xkb_compose_status, fn xkb_compose_state_get_utf8(*mut xkb_compose_state, *mut c_char, usize) -> c_int, fn xkb_compose_state_get_one_sym(*mut xkb_compose_state) -> xkb_keysym_t, ); #[cfg(feature = "dlopen")] lazy_static::lazy_static!( pub static ref XKBCOMMON_OPTION: Option = unsafe { XkbCommon::open("libxkbcommon.so.0") .or_else(|_| XkbCommon::open("libxkbcommon.so")) .ok() }; pub static ref XKBCOMMON_HANDLE: &'static XkbCommon = { XKBCOMMON_OPTION.as_ref().expect("Library libxkbcommon.so could not be loaded.") }; ); smithay-client-toolkit-0.16.1/src/seat/keyboard/keysyms.rs000064400000000000000000007164331046102023000217410ustar 00000000000000// // This file was auto-generated using the update-keysyms.sh script. // #![allow(missing_docs, non_upper_case_globals, unused_parens, clippy::all)] /*********************************************************** Copyright 1987, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * The "X11 Window System Protocol" standard defines in Appendix A the * keysym codes. These 29-bit integer values identify characters or * functions associated with each key (e.g., via the visible * engraving) of a keyboard layout. This file assigns mnemonic macro * names for these keysyms. * * This file is also compiled (by src/util/makekeys.c in libX11) into * hash tables that can be accessed with X11 library functions such as * XStringToKeysym() and XKeysymToString(). * * Where a keysym corresponds one-to-one to an ISO 10646 / Unicode * character, this is noted in a comment that provides both the U+xxxx * Unicode position, as well as the official Unicode name of the * character. * * Where the correspondence is either not one-to-one or semantically * unclear, the Unicode position and name are enclosed in * parentheses. Such legacy keysyms should be considered deprecated * and are not recommended for use in future keyboard mappings. * * For any future extension of the keysyms with characters already * found in ISO 10646 / Unicode, the following algorithm shall be * used. The new keysym code position will simply be the character's * Unicode number plus :u32 = 0x01000000;. The keysym values in the range * :u32 = 0x01000100; to :u32 = 0x0110ffff; are reserved to represent Unicode * characters in the range U+0100 to U+10FFFF. * * While most newer Unicode-based X11 clients do already accept * Unicode-mapped keysyms in the range :u32 = 0x01000100; to :u32 = 0x0110ffff;, it * will remain necessary for clients -- in the interest of * compatibility with existing servers -- to also understand the * existing legacy keysym values in the range :u32 = 0x0100; to :u32 = 0x20ff;. * * Where several mnemonic names are defined for the same keysym in this * file, all but the first one listed should be considered deprecated. * * Mnemonic names for keysyms are defined in this file with lines * that match one of these Perl regular expressions: * * /^\pub const XKB_KEY_([a-zA-Z_0-9]+)\s+:u32 = 0x;([0-9a-f]+)\s*\/\* U+([0-9A-F]{4,6}) (.*) \*\/\s*$/ * /^\pub const XKB_KEY_([a-zA-Z_0-9]+)\s+:u32 = 0x;([0-9a-f]+)\s*\/\*\(U+([0-9A-F]{4,6}) (.*)\)\*\/\s*$/ * /^\pub const XKB_KEY_([a-zA-Z_0-9]+)\s+:u32 = 0x;([0-9a-f]+)\s*(\/\*\s*(.*)\s*\*\/)?\s*$/ * * Before adding new keysyms, please do consider the following: In * addition to the keysym names defined in this file, the * XStringToKeysym() and XKeysymToString() functions will also handle * any keysym string of the form "U0020" to "U007E" and "U00A0" to * "U10FFFF" for all possible Unicode characters. In other words, * every possible Unicode character has already a keysym string * defined algorithmically, even if it is not listed here. Therefore, * defining an additional keysym macro is only necessary where a * non-hexadecimal mnemonic name is needed, or where the new keysym * does not represent any existing Unicode character. * * When adding new keysyms to this file, do not forget to also update the * following as needed: * * - the mappings in src/KeyBind.c in the libX11 repo * https://gitlab.freedesktop.org/xorg/lib/libx11 * * - the protocol specification in specs/keysyms.xml in this repo * https://gitlab.freedesktop.org/xorg/proto/xorgproto * */ pub const XKB_KEY_VoidSymbol :u32 = 0xffffff; /* Void symbol */ /* * TTY function keys, cleverly chosen to map to ASCII, for convenience of * programming, but could have been arbitrary (at the cost of lookup * tables in client code). */ pub const XKB_KEY_BackSpace :u32 = 0xff08; /* Back space, back char */ pub const XKB_KEY_Tab :u32 = 0xff09; pub const XKB_KEY_Linefeed :u32 = 0xff0a; /* Linefeed, LF */ pub const XKB_KEY_Clear :u32 = 0xff0b; pub const XKB_KEY_Return :u32 = 0xff0d; /* Return, enter */ pub const XKB_KEY_Pause :u32 = 0xff13; /* Pause, hold */ pub const XKB_KEY_Scroll_Lock :u32 = 0xff14; pub const XKB_KEY_Sys_Req :u32 = 0xff15; pub const XKB_KEY_Escape :u32 = 0xff1b; pub const XKB_KEY_Delete :u32 = 0xffff; /* Delete, rubout */ /* International & multi-key character composition */ pub const XKB_KEY_Multi_key :u32 = 0xff20; /* Multi-key character compose */ pub const XKB_KEY_Codeinput :u32 = 0xff37; pub const XKB_KEY_SingleCandidate :u32 = 0xff3c; pub const XKB_KEY_MultipleCandidate :u32 = 0xff3d; pub const XKB_KEY_PreviousCandidate :u32 = 0xff3e; /* Japanese keyboard support */ pub const XKB_KEY_Kanji :u32 = 0xff21; /* Kanji, Kanji convert */ pub const XKB_KEY_Muhenkan :u32 = 0xff22; /* Cancel Conversion */ pub const XKB_KEY_Henkan_Mode :u32 = 0xff23; /* Start/Stop Conversion */ pub const XKB_KEY_Henkan :u32 = 0xff23; /* Alias for Henkan_Mode */ pub const XKB_KEY_Romaji :u32 = 0xff24; /* to Romaji */ pub const XKB_KEY_Hiragana :u32 = 0xff25; /* to Hiragana */ pub const XKB_KEY_Katakana :u32 = 0xff26; /* to Katakana */ pub const XKB_KEY_Hiragana_Katakana :u32 = 0xff27; /* Hiragana/Katakana toggle */ pub const XKB_KEY_Zenkaku :u32 = 0xff28; /* to Zenkaku */ pub const XKB_KEY_Hankaku :u32 = 0xff29; /* to Hankaku */ pub const XKB_KEY_Zenkaku_Hankaku :u32 = 0xff2a; /* Zenkaku/Hankaku toggle */ pub const XKB_KEY_Touroku :u32 = 0xff2b; /* Add to Dictionary */ pub const XKB_KEY_Massyo :u32 = 0xff2c; /* Delete from Dictionary */ pub const XKB_KEY_Kana_Lock :u32 = 0xff2d; /* Kana Lock */ pub const XKB_KEY_Kana_Shift :u32 = 0xff2e; /* Kana Shift */ pub const XKB_KEY_Eisu_Shift :u32 = 0xff2f; /* Alphanumeric Shift */ pub const XKB_KEY_Eisu_toggle :u32 = 0xff30; /* Alphanumeric toggle */ pub const XKB_KEY_Kanji_Bangou :u32 = 0xff37; /* Codeinput */ pub const XKB_KEY_Zen_Koho :u32 = 0xff3d; /* Multiple/All Candidate(s) */ pub const XKB_KEY_Mae_Koho :u32 = 0xff3e; /* Previous Candidate */ /* :u32 = 0xff31; thru :u32 = 0xff3f; are under XK_KOREAN */ /* Cursor control & motion */ pub const XKB_KEY_Home :u32 = 0xff50; pub const XKB_KEY_Left :u32 = 0xff51; /* Move left, left arrow */ pub const XKB_KEY_Up :u32 = 0xff52; /* Move up, up arrow */ pub const XKB_KEY_Right :u32 = 0xff53; /* Move right, right arrow */ pub const XKB_KEY_Down :u32 = 0xff54; /* Move down, down arrow */ pub const XKB_KEY_Prior :u32 = 0xff55; /* Prior, previous */ pub const XKB_KEY_Page_Up :u32 = 0xff55; pub const XKB_KEY_Next :u32 = 0xff56; /* Next */ pub const XKB_KEY_Page_Down :u32 = 0xff56; pub const XKB_KEY_End :u32 = 0xff57; /* EOL */ pub const XKB_KEY_Begin :u32 = 0xff58; /* BOL */ /* Misc functions */ pub const XKB_KEY_Select :u32 = 0xff60; /* Select, mark */ pub const XKB_KEY_Print :u32 = 0xff61; pub const XKB_KEY_Execute :u32 = 0xff62; /* Execute, run, do */ pub const XKB_KEY_Insert :u32 = 0xff63; /* Insert, insert here */ pub const XKB_KEY_Undo :u32 = 0xff65; pub const XKB_KEY_Redo :u32 = 0xff66; /* Redo, again */ pub const XKB_KEY_Menu :u32 = 0xff67; pub const XKB_KEY_Find :u32 = 0xff68; /* Find, search */ pub const XKB_KEY_Cancel :u32 = 0xff69; /* Cancel, stop, abort, exit */ pub const XKB_KEY_Help :u32 = 0xff6a; /* Help */ pub const XKB_KEY_Break :u32 = 0xff6b; pub const XKB_KEY_Mode_switch :u32 = 0xff7e; /* Character set switch */ pub const XKB_KEY_script_switch :u32 = 0xff7e; /* Alias for mode_switch */ pub const XKB_KEY_Num_Lock :u32 = 0xff7f; /* Keypad functions, keypad numbers cleverly chosen to map to ASCII */ pub const XKB_KEY_KP_Space :u32 = 0xff80; /* Space */ pub const XKB_KEY_KP_Tab :u32 = 0xff89; pub const XKB_KEY_KP_Enter :u32 = 0xff8d; /* Enter */ pub const XKB_KEY_KP_F1 :u32 = 0xff91; /* PF1, KP_A, ... */ pub const XKB_KEY_KP_F2 :u32 = 0xff92; pub const XKB_KEY_KP_F3 :u32 = 0xff93; pub const XKB_KEY_KP_F4 :u32 = 0xff94; pub const XKB_KEY_KP_Home :u32 = 0xff95; pub const XKB_KEY_KP_Left :u32 = 0xff96; pub const XKB_KEY_KP_Up :u32 = 0xff97; pub const XKB_KEY_KP_Right :u32 = 0xff98; pub const XKB_KEY_KP_Down :u32 = 0xff99; pub const XKB_KEY_KP_Prior :u32 = 0xff9a; pub const XKB_KEY_KP_Page_Up :u32 = 0xff9a; pub const XKB_KEY_KP_Next :u32 = 0xff9b; pub const XKB_KEY_KP_Page_Down :u32 = 0xff9b; pub const XKB_KEY_KP_End :u32 = 0xff9c; pub const XKB_KEY_KP_Begin :u32 = 0xff9d; pub const XKB_KEY_KP_Insert :u32 = 0xff9e; pub const XKB_KEY_KP_Delete :u32 = 0xff9f; pub const XKB_KEY_KP_Equal :u32 = 0xffbd; /* Equals */ pub const XKB_KEY_KP_Multiply :u32 = 0xffaa; pub const XKB_KEY_KP_Add :u32 = 0xffab; pub const XKB_KEY_KP_Separator :u32 = 0xffac; /* Separator, often comma */ pub const XKB_KEY_KP_Subtract :u32 = 0xffad; pub const XKB_KEY_KP_Decimal :u32 = 0xffae; pub const XKB_KEY_KP_Divide :u32 = 0xffaf; pub const XKB_KEY_KP_0 :u32 = 0xffb0; pub const XKB_KEY_KP_1 :u32 = 0xffb1; pub const XKB_KEY_KP_2 :u32 = 0xffb2; pub const XKB_KEY_KP_3 :u32 = 0xffb3; pub const XKB_KEY_KP_4 :u32 = 0xffb4; pub const XKB_KEY_KP_5 :u32 = 0xffb5; pub const XKB_KEY_KP_6 :u32 = 0xffb6; pub const XKB_KEY_KP_7 :u32 = 0xffb7; pub const XKB_KEY_KP_8 :u32 = 0xffb8; pub const XKB_KEY_KP_9 :u32 = 0xffb9; /* * Auxiliary functions; note the duplicate definitions for left and right * function keys; Sun keyboards and a few other manufacturers have such * function key groups on the left and/or right sides of the keyboard. * We've not found a keyboard with more than 35 function keys total. */ pub const XKB_KEY_F1 :u32 = 0xffbe; pub const XKB_KEY_F2 :u32 = 0xffbf; pub const XKB_KEY_F3 :u32 = 0xffc0; pub const XKB_KEY_F4 :u32 = 0xffc1; pub const XKB_KEY_F5 :u32 = 0xffc2; pub const XKB_KEY_F6 :u32 = 0xffc3; pub const XKB_KEY_F7 :u32 = 0xffc4; pub const XKB_KEY_F8 :u32 = 0xffc5; pub const XKB_KEY_F9 :u32 = 0xffc6; pub const XKB_KEY_F10 :u32 = 0xffc7; pub const XKB_KEY_F11 :u32 = 0xffc8; pub const XKB_KEY_L1 :u32 = 0xffc8; pub const XKB_KEY_F12 :u32 = 0xffc9; pub const XKB_KEY_L2 :u32 = 0xffc9; pub const XKB_KEY_F13 :u32 = 0xffca; pub const XKB_KEY_L3 :u32 = 0xffca; pub const XKB_KEY_F14 :u32 = 0xffcb; pub const XKB_KEY_L4 :u32 = 0xffcb; pub const XKB_KEY_F15 :u32 = 0xffcc; pub const XKB_KEY_L5 :u32 = 0xffcc; pub const XKB_KEY_F16 :u32 = 0xffcd; pub const XKB_KEY_L6 :u32 = 0xffcd; pub const XKB_KEY_F17 :u32 = 0xffce; pub const XKB_KEY_L7 :u32 = 0xffce; pub const XKB_KEY_F18 :u32 = 0xffcf; pub const XKB_KEY_L8 :u32 = 0xffcf; pub const XKB_KEY_F19 :u32 = 0xffd0; pub const XKB_KEY_L9 :u32 = 0xffd0; pub const XKB_KEY_F20 :u32 = 0xffd1; pub const XKB_KEY_L10 :u32 = 0xffd1; pub const XKB_KEY_F21 :u32 = 0xffd2; pub const XKB_KEY_R1 :u32 = 0xffd2; pub const XKB_KEY_F22 :u32 = 0xffd3; pub const XKB_KEY_R2 :u32 = 0xffd3; pub const XKB_KEY_F23 :u32 = 0xffd4; pub const XKB_KEY_R3 :u32 = 0xffd4; pub const XKB_KEY_F24 :u32 = 0xffd5; pub const XKB_KEY_R4 :u32 = 0xffd5; pub const XKB_KEY_F25 :u32 = 0xffd6; pub const XKB_KEY_R5 :u32 = 0xffd6; pub const XKB_KEY_F26 :u32 = 0xffd7; pub const XKB_KEY_R6 :u32 = 0xffd7; pub const XKB_KEY_F27 :u32 = 0xffd8; pub const XKB_KEY_R7 :u32 = 0xffd8; pub const XKB_KEY_F28 :u32 = 0xffd9; pub const XKB_KEY_R8 :u32 = 0xffd9; pub const XKB_KEY_F29 :u32 = 0xffda; pub const XKB_KEY_R9 :u32 = 0xffda; pub const XKB_KEY_F30 :u32 = 0xffdb; pub const XKB_KEY_R10 :u32 = 0xffdb; pub const XKB_KEY_F31 :u32 = 0xffdc; pub const XKB_KEY_R11 :u32 = 0xffdc; pub const XKB_KEY_F32 :u32 = 0xffdd; pub const XKB_KEY_R12 :u32 = 0xffdd; pub const XKB_KEY_F33 :u32 = 0xffde; pub const XKB_KEY_R13 :u32 = 0xffde; pub const XKB_KEY_F34 :u32 = 0xffdf; pub const XKB_KEY_R14 :u32 = 0xffdf; pub const XKB_KEY_F35 :u32 = 0xffe0; pub const XKB_KEY_R15 :u32 = 0xffe0; /* Modifiers */ pub const XKB_KEY_Shift_L :u32 = 0xffe1; /* Left shift */ pub const XKB_KEY_Shift_R :u32 = 0xffe2; /* Right shift */ pub const XKB_KEY_Control_L :u32 = 0xffe3; /* Left control */ pub const XKB_KEY_Control_R :u32 = 0xffe4; /* Right control */ pub const XKB_KEY_Caps_Lock :u32 = 0xffe5; /* Caps lock */ pub const XKB_KEY_Shift_Lock :u32 = 0xffe6; /* Shift lock */ pub const XKB_KEY_Meta_L :u32 = 0xffe7; /* Left meta */ pub const XKB_KEY_Meta_R :u32 = 0xffe8; /* Right meta */ pub const XKB_KEY_Alt_L :u32 = 0xffe9; /* Left alt */ pub const XKB_KEY_Alt_R :u32 = 0xffea; /* Right alt */ pub const XKB_KEY_Super_L :u32 = 0xffeb; /* Left super */ pub const XKB_KEY_Super_R :u32 = 0xffec; /* Right super */ pub const XKB_KEY_Hyper_L :u32 = 0xffed; /* Left hyper */ pub const XKB_KEY_Hyper_R :u32 = 0xffee; /* Right hyper */ /* * Keyboard (XKB) Extension function and modifier keys * (from Appendix C of "The X Keyboard Extension: Protocol Specification") * Byte 3 = :u32 = 0xfe; */ pub const XKB_KEY_ISO_Lock :u32 = 0xfe01; pub const XKB_KEY_ISO_Level2_Latch :u32 = 0xfe02; pub const XKB_KEY_ISO_Level3_Shift :u32 = 0xfe03; pub const XKB_KEY_ISO_Level3_Latch :u32 = 0xfe04; pub const XKB_KEY_ISO_Level3_Lock :u32 = 0xfe05; pub const XKB_KEY_ISO_Level5_Shift :u32 = 0xfe11; pub const XKB_KEY_ISO_Level5_Latch :u32 = 0xfe12; pub const XKB_KEY_ISO_Level5_Lock :u32 = 0xfe13; pub const XKB_KEY_ISO_Group_Shift :u32 = 0xff7e; /* Alias for mode_switch */ pub const XKB_KEY_ISO_Group_Latch :u32 = 0xfe06; pub const XKB_KEY_ISO_Group_Lock :u32 = 0xfe07; pub const XKB_KEY_ISO_Next_Group :u32 = 0xfe08; pub const XKB_KEY_ISO_Next_Group_Lock :u32 = 0xfe09; pub const XKB_KEY_ISO_Prev_Group :u32 = 0xfe0a; pub const XKB_KEY_ISO_Prev_Group_Lock :u32 = 0xfe0b; pub const XKB_KEY_ISO_First_Group :u32 = 0xfe0c; pub const XKB_KEY_ISO_First_Group_Lock :u32 = 0xfe0d; pub const XKB_KEY_ISO_Last_Group :u32 = 0xfe0e; pub const XKB_KEY_ISO_Last_Group_Lock :u32 = 0xfe0f; pub const XKB_KEY_ISO_Left_Tab :u32 = 0xfe20; pub const XKB_KEY_ISO_Move_Line_Up :u32 = 0xfe21; pub const XKB_KEY_ISO_Move_Line_Down :u32 = 0xfe22; pub const XKB_KEY_ISO_Partial_Line_Up :u32 = 0xfe23; pub const XKB_KEY_ISO_Partial_Line_Down :u32 = 0xfe24; pub const XKB_KEY_ISO_Partial_Space_Left :u32 = 0xfe25; pub const XKB_KEY_ISO_Partial_Space_Right :u32 = 0xfe26; pub const XKB_KEY_ISO_Set_Margin_Left :u32 = 0xfe27; pub const XKB_KEY_ISO_Set_Margin_Right :u32 = 0xfe28; pub const XKB_KEY_ISO_Release_Margin_Left :u32 = 0xfe29; pub const XKB_KEY_ISO_Release_Margin_Right :u32 = 0xfe2a; pub const XKB_KEY_ISO_Release_Both_Margins :u32 = 0xfe2b; pub const XKB_KEY_ISO_Fast_Cursor_Left :u32 = 0xfe2c; pub const XKB_KEY_ISO_Fast_Cursor_Right :u32 = 0xfe2d; pub const XKB_KEY_ISO_Fast_Cursor_Up :u32 = 0xfe2e; pub const XKB_KEY_ISO_Fast_Cursor_Down :u32 = 0xfe2f; pub const XKB_KEY_ISO_Continuous_Underline :u32 = 0xfe30; pub const XKB_KEY_ISO_Discontinuous_Underline :u32 = 0xfe31; pub const XKB_KEY_ISO_Emphasize :u32 = 0xfe32; pub const XKB_KEY_ISO_Center_Object :u32 = 0xfe33; pub const XKB_KEY_ISO_Enter :u32 = 0xfe34; pub const XKB_KEY_dead_grave :u32 = 0xfe50; pub const XKB_KEY_dead_acute :u32 = 0xfe51; pub const XKB_KEY_dead_circumflex :u32 = 0xfe52; pub const XKB_KEY_dead_tilde :u32 = 0xfe53; pub const XKB_KEY_dead_perispomeni :u32 = 0xfe53; /* alias for dead_tilde */ pub const XKB_KEY_dead_macron :u32 = 0xfe54; pub const XKB_KEY_dead_breve :u32 = 0xfe55; pub const XKB_KEY_dead_abovedot :u32 = 0xfe56; pub const XKB_KEY_dead_diaeresis :u32 = 0xfe57; pub const XKB_KEY_dead_abovering :u32 = 0xfe58; pub const XKB_KEY_dead_doubleacute :u32 = 0xfe59; pub const XKB_KEY_dead_caron :u32 = 0xfe5a; pub const XKB_KEY_dead_cedilla :u32 = 0xfe5b; pub const XKB_KEY_dead_ogonek :u32 = 0xfe5c; pub const XKB_KEY_dead_iota :u32 = 0xfe5d; pub const XKB_KEY_dead_voiced_sound :u32 = 0xfe5e; pub const XKB_KEY_dead_semivoiced_sound :u32 = 0xfe5f; pub const XKB_KEY_dead_belowdot :u32 = 0xfe60; pub const XKB_KEY_dead_hook :u32 = 0xfe61; pub const XKB_KEY_dead_horn :u32 = 0xfe62; pub const XKB_KEY_dead_stroke :u32 = 0xfe63; pub const XKB_KEY_dead_abovecomma :u32 = 0xfe64; pub const XKB_KEY_dead_psili :u32 = 0xfe64; /* alias for dead_abovecomma */ pub const XKB_KEY_dead_abovereversedcomma :u32 = 0xfe65; pub const XKB_KEY_dead_dasia :u32 = 0xfe65; /* alias for dead_abovereversedcomma */ pub const XKB_KEY_dead_doublegrave :u32 = 0xfe66; pub const XKB_KEY_dead_belowring :u32 = 0xfe67; pub const XKB_KEY_dead_belowmacron :u32 = 0xfe68; pub const XKB_KEY_dead_belowcircumflex :u32 = 0xfe69; pub const XKB_KEY_dead_belowtilde :u32 = 0xfe6a; pub const XKB_KEY_dead_belowbreve :u32 = 0xfe6b; pub const XKB_KEY_dead_belowdiaeresis :u32 = 0xfe6c; pub const XKB_KEY_dead_invertedbreve :u32 = 0xfe6d; pub const XKB_KEY_dead_belowcomma :u32 = 0xfe6e; pub const XKB_KEY_dead_currency :u32 = 0xfe6f; /* extra dead elements for German T3 layout */ pub const XKB_KEY_dead_lowline :u32 = 0xfe90; pub const XKB_KEY_dead_aboveverticalline :u32 = 0xfe91; pub const XKB_KEY_dead_belowverticalline :u32 = 0xfe92; pub const XKB_KEY_dead_longsolidusoverlay :u32 = 0xfe93; /* dead vowels for universal syllable entry */ pub const XKB_KEY_dead_a :u32 = 0xfe80; pub const XKB_KEY_dead_A :u32 = 0xfe81; pub const XKB_KEY_dead_e :u32 = 0xfe82; pub const XKB_KEY_dead_E :u32 = 0xfe83; pub const XKB_KEY_dead_i :u32 = 0xfe84; pub const XKB_KEY_dead_I :u32 = 0xfe85; pub const XKB_KEY_dead_o :u32 = 0xfe86; pub const XKB_KEY_dead_O :u32 = 0xfe87; pub const XKB_KEY_dead_u :u32 = 0xfe88; pub const XKB_KEY_dead_U :u32 = 0xfe89; pub const XKB_KEY_dead_small_schwa :u32 = 0xfe8a; pub const XKB_KEY_dead_capital_schwa :u32 = 0xfe8b; pub const XKB_KEY_dead_greek :u32 = 0xfe8c; pub const XKB_KEY_First_Virtual_Screen :u32 = 0xfed0; pub const XKB_KEY_Prev_Virtual_Screen :u32 = 0xfed1; pub const XKB_KEY_Next_Virtual_Screen :u32 = 0xfed2; pub const XKB_KEY_Last_Virtual_Screen :u32 = 0xfed4; pub const XKB_KEY_Terminate_Server :u32 = 0xfed5; pub const XKB_KEY_AccessX_Enable :u32 = 0xfe70; pub const XKB_KEY_AccessX_Feedback_Enable :u32 = 0xfe71; pub const XKB_KEY_RepeatKeys_Enable :u32 = 0xfe72; pub const XKB_KEY_SlowKeys_Enable :u32 = 0xfe73; pub const XKB_KEY_BounceKeys_Enable :u32 = 0xfe74; pub const XKB_KEY_StickyKeys_Enable :u32 = 0xfe75; pub const XKB_KEY_MouseKeys_Enable :u32 = 0xfe76; pub const XKB_KEY_MouseKeys_Accel_Enable :u32 = 0xfe77; pub const XKB_KEY_Overlay1_Enable :u32 = 0xfe78; pub const XKB_KEY_Overlay2_Enable :u32 = 0xfe79; pub const XKB_KEY_AudibleBell_Enable :u32 = 0xfe7a; pub const XKB_KEY_Pointer_Left :u32 = 0xfee0; pub const XKB_KEY_Pointer_Right :u32 = 0xfee1; pub const XKB_KEY_Pointer_Up :u32 = 0xfee2; pub const XKB_KEY_Pointer_Down :u32 = 0xfee3; pub const XKB_KEY_Pointer_UpLeft :u32 = 0xfee4; pub const XKB_KEY_Pointer_UpRight :u32 = 0xfee5; pub const XKB_KEY_Pointer_DownLeft :u32 = 0xfee6; pub const XKB_KEY_Pointer_DownRight :u32 = 0xfee7; pub const XKB_KEY_Pointer_Button_Dflt :u32 = 0xfee8; pub const XKB_KEY_Pointer_Button1 :u32 = 0xfee9; pub const XKB_KEY_Pointer_Button2 :u32 = 0xfeea; pub const XKB_KEY_Pointer_Button3 :u32 = 0xfeeb; pub const XKB_KEY_Pointer_Button4 :u32 = 0xfeec; pub const XKB_KEY_Pointer_Button5 :u32 = 0xfeed; pub const XKB_KEY_Pointer_DblClick_Dflt :u32 = 0xfeee; pub const XKB_KEY_Pointer_DblClick1 :u32 = 0xfeef; pub const XKB_KEY_Pointer_DblClick2 :u32 = 0xfef0; pub const XKB_KEY_Pointer_DblClick3 :u32 = 0xfef1; pub const XKB_KEY_Pointer_DblClick4 :u32 = 0xfef2; pub const XKB_KEY_Pointer_DblClick5 :u32 = 0xfef3; pub const XKB_KEY_Pointer_Drag_Dflt :u32 = 0xfef4; pub const XKB_KEY_Pointer_Drag1 :u32 = 0xfef5; pub const XKB_KEY_Pointer_Drag2 :u32 = 0xfef6; pub const XKB_KEY_Pointer_Drag3 :u32 = 0xfef7; pub const XKB_KEY_Pointer_Drag4 :u32 = 0xfef8; pub const XKB_KEY_Pointer_Drag5 :u32 = 0xfefd; pub const XKB_KEY_Pointer_EnableKeys :u32 = 0xfef9; pub const XKB_KEY_Pointer_Accelerate :u32 = 0xfefa; pub const XKB_KEY_Pointer_DfltBtnNext :u32 = 0xfefb; pub const XKB_KEY_Pointer_DfltBtnPrev :u32 = 0xfefc; /* Single-Stroke Multiple-Character N-Graph Keysyms For The X Input Method */ pub const XKB_KEY_ch :u32 = 0xfea0; pub const XKB_KEY_Ch :u32 = 0xfea1; pub const XKB_KEY_CH :u32 = 0xfea2; pub const XKB_KEY_c_h :u32 = 0xfea3; pub const XKB_KEY_C_h :u32 = 0xfea4; pub const XKB_KEY_C_H :u32 = 0xfea5; /* * 3270 Terminal Keys * Byte 3 = :u32 = 0xfd; */ pub const XKB_KEY_3270_Duplicate :u32 = 0xfd01; pub const XKB_KEY_3270_FieldMark :u32 = 0xfd02; pub const XKB_KEY_3270_Right2 :u32 = 0xfd03; pub const XKB_KEY_3270_Left2 :u32 = 0xfd04; pub const XKB_KEY_3270_BackTab :u32 = 0xfd05; pub const XKB_KEY_3270_EraseEOF :u32 = 0xfd06; pub const XKB_KEY_3270_EraseInput :u32 = 0xfd07; pub const XKB_KEY_3270_Reset :u32 = 0xfd08; pub const XKB_KEY_3270_Quit :u32 = 0xfd09; pub const XKB_KEY_3270_PA1 :u32 = 0xfd0a; pub const XKB_KEY_3270_PA2 :u32 = 0xfd0b; pub const XKB_KEY_3270_PA3 :u32 = 0xfd0c; pub const XKB_KEY_3270_Test :u32 = 0xfd0d; pub const XKB_KEY_3270_Attn :u32 = 0xfd0e; pub const XKB_KEY_3270_CursorBlink :u32 = 0xfd0f; pub const XKB_KEY_3270_AltCursor :u32 = 0xfd10; pub const XKB_KEY_3270_KeyClick :u32 = 0xfd11; pub const XKB_KEY_3270_Jump :u32 = 0xfd12; pub const XKB_KEY_3270_Ident :u32 = 0xfd13; pub const XKB_KEY_3270_Rule :u32 = 0xfd14; pub const XKB_KEY_3270_Copy :u32 = 0xfd15; pub const XKB_KEY_3270_Play :u32 = 0xfd16; pub const XKB_KEY_3270_Setup :u32 = 0xfd17; pub const XKB_KEY_3270_Record :u32 = 0xfd18; pub const XKB_KEY_3270_ChangeScreen :u32 = 0xfd19; pub const XKB_KEY_3270_DeleteWord :u32 = 0xfd1a; pub const XKB_KEY_3270_ExSelect :u32 = 0xfd1b; pub const XKB_KEY_3270_CursorSelect :u32 = 0xfd1c; pub const XKB_KEY_3270_PrintScreen :u32 = 0xfd1d; pub const XKB_KEY_3270_Enter :u32 = 0xfd1e; /* * Latin 1 * (ISO/IEC 8859-1 = Unicode U+0020..U+00FF) * Byte 3 = 0 */ pub const XKB_KEY_space :u32 = 0x0020; /* U+0020 SPACE */ pub const XKB_KEY_exclam :u32 = 0x0021; /* U+0021 EXCLAMATION MARK */ pub const XKB_KEY_quotedbl :u32 = 0x0022; /* U+0022 QUOTATION MARK */ pub const XKB_KEY_numbersign :u32 = 0x0023; /* U+0023 NUMBER SIGN */ pub const XKB_KEY_dollar :u32 = 0x0024; /* U+0024 DOLLAR SIGN */ pub const XKB_KEY_percent :u32 = 0x0025; /* U+0025 PERCENT SIGN */ pub const XKB_KEY_ampersand :u32 = 0x0026; /* U+0026 AMPERSAND */ pub const XKB_KEY_apostrophe :u32 = 0x0027; /* U+0027 APOSTROPHE */ pub const XKB_KEY_quoteright :u32 = 0x0027; /* deprecated */ pub const XKB_KEY_parenleft :u32 = 0x0028; /* U+0028 LEFT PARENTHESIS */ pub const XKB_KEY_parenright :u32 = 0x0029; /* U+0029 RIGHT PARENTHESIS */ pub const XKB_KEY_asterisk :u32 = 0x002a; /* U+002A ASTERISK */ pub const XKB_KEY_plus :u32 = 0x002b; /* U+002B PLUS SIGN */ pub const XKB_KEY_comma :u32 = 0x002c; /* U+002C COMMA */ pub const XKB_KEY_minus :u32 = 0x002d; /* U+002D HYPHEN-MINUS */ pub const XKB_KEY_period :u32 = 0x002e; /* U+002E FULL STOP */ pub const XKB_KEY_slash :u32 = 0x002f; /* U+002F SOLIDUS */ pub const XKB_KEY_0 :u32 = 0x0030; /* U+0030 DIGIT ZERO */ pub const XKB_KEY_1 :u32 = 0x0031; /* U+0031 DIGIT ONE */ pub const XKB_KEY_2 :u32 = 0x0032; /* U+0032 DIGIT TWO */ pub const XKB_KEY_3 :u32 = 0x0033; /* U+0033 DIGIT THREE */ pub const XKB_KEY_4 :u32 = 0x0034; /* U+0034 DIGIT FOUR */ pub const XKB_KEY_5 :u32 = 0x0035; /* U+0035 DIGIT FIVE */ pub const XKB_KEY_6 :u32 = 0x0036; /* U+0036 DIGIT SIX */ pub const XKB_KEY_7 :u32 = 0x0037; /* U+0037 DIGIT SEVEN */ pub const XKB_KEY_8 :u32 = 0x0038; /* U+0038 DIGIT EIGHT */ pub const XKB_KEY_9 :u32 = 0x0039; /* U+0039 DIGIT NINE */ pub const XKB_KEY_colon :u32 = 0x003a; /* U+003A COLON */ pub const XKB_KEY_semicolon :u32 = 0x003b; /* U+003B SEMICOLON */ pub const XKB_KEY_less :u32 = 0x003c; /* U+003C LESS-THAN SIGN */ pub const XKB_KEY_equal :u32 = 0x003d; /* U+003D EQUALS SIGN */ pub const XKB_KEY_greater :u32 = 0x003e; /* U+003E GREATER-THAN SIGN */ pub const XKB_KEY_question :u32 = 0x003f; /* U+003F QUESTION MARK */ pub const XKB_KEY_at :u32 = 0x0040; /* U+0040 COMMERCIAL AT */ pub const XKB_KEY_A :u32 = 0x0041; /* U+0041 LATIN CAPITAL LETTER A */ pub const XKB_KEY_B :u32 = 0x0042; /* U+0042 LATIN CAPITAL LETTER B */ pub const XKB_KEY_C :u32 = 0x0043; /* U+0043 LATIN CAPITAL LETTER C */ pub const XKB_KEY_D :u32 = 0x0044; /* U+0044 LATIN CAPITAL LETTER D */ pub const XKB_KEY_E :u32 = 0x0045; /* U+0045 LATIN CAPITAL LETTER E */ pub const XKB_KEY_F :u32 = 0x0046; /* U+0046 LATIN CAPITAL LETTER F */ pub const XKB_KEY_G :u32 = 0x0047; /* U+0047 LATIN CAPITAL LETTER G */ pub const XKB_KEY_H :u32 = 0x0048; /* U+0048 LATIN CAPITAL LETTER H */ pub const XKB_KEY_I :u32 = 0x0049; /* U+0049 LATIN CAPITAL LETTER I */ pub const XKB_KEY_J :u32 = 0x004a; /* U+004A LATIN CAPITAL LETTER J */ pub const XKB_KEY_K :u32 = 0x004b; /* U+004B LATIN CAPITAL LETTER K */ pub const XKB_KEY_L :u32 = 0x004c; /* U+004C LATIN CAPITAL LETTER L */ pub const XKB_KEY_M :u32 = 0x004d; /* U+004D LATIN CAPITAL LETTER M */ pub const XKB_KEY_N :u32 = 0x004e; /* U+004E LATIN CAPITAL LETTER N */ pub const XKB_KEY_O :u32 = 0x004f; /* U+004F LATIN CAPITAL LETTER O */ pub const XKB_KEY_P :u32 = 0x0050; /* U+0050 LATIN CAPITAL LETTER P */ pub const XKB_KEY_Q :u32 = 0x0051; /* U+0051 LATIN CAPITAL LETTER Q */ pub const XKB_KEY_R :u32 = 0x0052; /* U+0052 LATIN CAPITAL LETTER R */ pub const XKB_KEY_S :u32 = 0x0053; /* U+0053 LATIN CAPITAL LETTER S */ pub const XKB_KEY_T :u32 = 0x0054; /* U+0054 LATIN CAPITAL LETTER T */ pub const XKB_KEY_U :u32 = 0x0055; /* U+0055 LATIN CAPITAL LETTER U */ pub const XKB_KEY_V :u32 = 0x0056; /* U+0056 LATIN CAPITAL LETTER V */ pub const XKB_KEY_W :u32 = 0x0057; /* U+0057 LATIN CAPITAL LETTER W */ pub const XKB_KEY_X :u32 = 0x0058; /* U+0058 LATIN CAPITAL LETTER X */ pub const XKB_KEY_Y :u32 = 0x0059; /* U+0059 LATIN CAPITAL LETTER Y */ pub const XKB_KEY_Z :u32 = 0x005a; /* U+005A LATIN CAPITAL LETTER Z */ pub const XKB_KEY_bracketleft :u32 = 0x005b; /* U+005B LEFT SQUARE BRACKET */ pub const XKB_KEY_backslash :u32 = 0x005c; /* U+005C REVERSE SOLIDUS */ pub const XKB_KEY_bracketright :u32 = 0x005d; /* U+005D RIGHT SQUARE BRACKET */ pub const XKB_KEY_asciicircum :u32 = 0x005e; /* U+005E CIRCUMFLEX ACCENT */ pub const XKB_KEY_underscore :u32 = 0x005f; /* U+005F LOW LINE */ pub const XKB_KEY_grave :u32 = 0x0060; /* U+0060 GRAVE ACCENT */ pub const XKB_KEY_quoteleft :u32 = 0x0060; /* deprecated */ pub const XKB_KEY_a :u32 = 0x0061; /* U+0061 LATIN SMALL LETTER A */ pub const XKB_KEY_b :u32 = 0x0062; /* U+0062 LATIN SMALL LETTER B */ pub const XKB_KEY_c :u32 = 0x0063; /* U+0063 LATIN SMALL LETTER C */ pub const XKB_KEY_d :u32 = 0x0064; /* U+0064 LATIN SMALL LETTER D */ pub const XKB_KEY_e :u32 = 0x0065; /* U+0065 LATIN SMALL LETTER E */ pub const XKB_KEY_f :u32 = 0x0066; /* U+0066 LATIN SMALL LETTER F */ pub const XKB_KEY_g :u32 = 0x0067; /* U+0067 LATIN SMALL LETTER G */ pub const XKB_KEY_h :u32 = 0x0068; /* U+0068 LATIN SMALL LETTER H */ pub const XKB_KEY_i :u32 = 0x0069; /* U+0069 LATIN SMALL LETTER I */ pub const XKB_KEY_j :u32 = 0x006a; /* U+006A LATIN SMALL LETTER J */ pub const XKB_KEY_k :u32 = 0x006b; /* U+006B LATIN SMALL LETTER K */ pub const XKB_KEY_l :u32 = 0x006c; /* U+006C LATIN SMALL LETTER L */ pub const XKB_KEY_m :u32 = 0x006d; /* U+006D LATIN SMALL LETTER M */ pub const XKB_KEY_n :u32 = 0x006e; /* U+006E LATIN SMALL LETTER N */ pub const XKB_KEY_o :u32 = 0x006f; /* U+006F LATIN SMALL LETTER O */ pub const XKB_KEY_p :u32 = 0x0070; /* U+0070 LATIN SMALL LETTER P */ pub const XKB_KEY_q :u32 = 0x0071; /* U+0071 LATIN SMALL LETTER Q */ pub const XKB_KEY_r :u32 = 0x0072; /* U+0072 LATIN SMALL LETTER R */ pub const XKB_KEY_s :u32 = 0x0073; /* U+0073 LATIN SMALL LETTER S */ pub const XKB_KEY_t :u32 = 0x0074; /* U+0074 LATIN SMALL LETTER T */ pub const XKB_KEY_u :u32 = 0x0075; /* U+0075 LATIN SMALL LETTER U */ pub const XKB_KEY_v :u32 = 0x0076; /* U+0076 LATIN SMALL LETTER V */ pub const XKB_KEY_w :u32 = 0x0077; /* U+0077 LATIN SMALL LETTER W */ pub const XKB_KEY_x :u32 = 0x0078; /* U+0078 LATIN SMALL LETTER X */ pub const XKB_KEY_y :u32 = 0x0079; /* U+0079 LATIN SMALL LETTER Y */ pub const XKB_KEY_z :u32 = 0x007a; /* U+007A LATIN SMALL LETTER Z */ pub const XKB_KEY_braceleft :u32 = 0x007b; /* U+007B LEFT CURLY BRACKET */ pub const XKB_KEY_bar :u32 = 0x007c; /* U+007C VERTICAL LINE */ pub const XKB_KEY_braceright :u32 = 0x007d; /* U+007D RIGHT CURLY BRACKET */ pub const XKB_KEY_asciitilde :u32 = 0x007e; /* U+007E TILDE */ pub const XKB_KEY_nobreakspace :u32 = 0x00a0; /* U+00A0 NO-BREAK SPACE */ pub const XKB_KEY_exclamdown :u32 = 0x00a1; /* U+00A1 INVERTED EXCLAMATION MARK */ pub const XKB_KEY_cent :u32 = 0x00a2; /* U+00A2 CENT SIGN */ pub const XKB_KEY_sterling :u32 = 0x00a3; /* U+00A3 POUND SIGN */ pub const XKB_KEY_currency :u32 = 0x00a4; /* U+00A4 CURRENCY SIGN */ pub const XKB_KEY_yen :u32 = 0x00a5; /* U+00A5 YEN SIGN */ pub const XKB_KEY_brokenbar :u32 = 0x00a6; /* U+00A6 BROKEN BAR */ pub const XKB_KEY_section :u32 = 0x00a7; /* U+00A7 SECTION SIGN */ pub const XKB_KEY_diaeresis :u32 = 0x00a8; /* U+00A8 DIAERESIS */ pub const XKB_KEY_copyright :u32 = 0x00a9; /* U+00A9 COPYRIGHT SIGN */ pub const XKB_KEY_ordfeminine :u32 = 0x00aa; /* U+00AA FEMININE ORDINAL INDICATOR */ pub const XKB_KEY_guillemotleft :u32 = 0x00ab; /* U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ pub const XKB_KEY_notsign :u32 = 0x00ac; /* U+00AC NOT SIGN */ pub const XKB_KEY_hyphen :u32 = 0x00ad; /* U+00AD SOFT HYPHEN */ pub const XKB_KEY_registered :u32 = 0x00ae; /* U+00AE REGISTERED SIGN */ pub const XKB_KEY_macron :u32 = 0x00af; /* U+00AF MACRON */ pub const XKB_KEY_degree :u32 = 0x00b0; /* U+00B0 DEGREE SIGN */ pub const XKB_KEY_plusminus :u32 = 0x00b1; /* U+00B1 PLUS-MINUS SIGN */ pub const XKB_KEY_twosuperior :u32 = 0x00b2; /* U+00B2 SUPERSCRIPT TWO */ pub const XKB_KEY_threesuperior :u32 = 0x00b3; /* U+00B3 SUPERSCRIPT THREE */ pub const XKB_KEY_acute :u32 = 0x00b4; /* U+00B4 ACUTE ACCENT */ pub const XKB_KEY_mu :u32 = 0x00b5; /* U+00B5 MICRO SIGN */ pub const XKB_KEY_paragraph :u32 = 0x00b6; /* U+00B6 PILCROW SIGN */ pub const XKB_KEY_periodcentered :u32 = 0x00b7; /* U+00B7 MIDDLE DOT */ pub const XKB_KEY_cedilla :u32 = 0x00b8; /* U+00B8 CEDILLA */ pub const XKB_KEY_onesuperior :u32 = 0x00b9; /* U+00B9 SUPERSCRIPT ONE */ pub const XKB_KEY_masculine :u32 = 0x00ba; /* U+00BA MASCULINE ORDINAL INDICATOR */ pub const XKB_KEY_guillemotright :u32 = 0x00bb; /* U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ pub const XKB_KEY_onequarter :u32 = 0x00bc; /* U+00BC VULGAR FRACTION ONE QUARTER */ pub const XKB_KEY_onehalf :u32 = 0x00bd; /* U+00BD VULGAR FRACTION ONE HALF */ pub const XKB_KEY_threequarters :u32 = 0x00be; /* U+00BE VULGAR FRACTION THREE QUARTERS */ pub const XKB_KEY_questiondown :u32 = 0x00bf; /* U+00BF INVERTED QUESTION MARK */ pub const XKB_KEY_Agrave :u32 = 0x00c0; /* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE */ pub const XKB_KEY_Aacute :u32 = 0x00c1; /* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE */ pub const XKB_KEY_Acircumflex :u32 = 0x00c2; /* U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ pub const XKB_KEY_Atilde :u32 = 0x00c3; /* U+00C3 LATIN CAPITAL LETTER A WITH TILDE */ pub const XKB_KEY_Adiaeresis :u32 = 0x00c4; /* U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS */ pub const XKB_KEY_Aring :u32 = 0x00c5; /* U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE */ pub const XKB_KEY_AE :u32 = 0x00c6; /* U+00C6 LATIN CAPITAL LETTER AE */ pub const XKB_KEY_Ccedilla :u32 = 0x00c7; /* U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA */ pub const XKB_KEY_Egrave :u32 = 0x00c8; /* U+00C8 LATIN CAPITAL LETTER E WITH GRAVE */ pub const XKB_KEY_Eacute :u32 = 0x00c9; /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ pub const XKB_KEY_Ecircumflex :u32 = 0x00ca; /* U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ pub const XKB_KEY_Ediaeresis :u32 = 0x00cb; /* U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS */ pub const XKB_KEY_Igrave :u32 = 0x00cc; /* U+00CC LATIN CAPITAL LETTER I WITH GRAVE */ pub const XKB_KEY_Iacute :u32 = 0x00cd; /* U+00CD LATIN CAPITAL LETTER I WITH ACUTE */ pub const XKB_KEY_Icircumflex :u32 = 0x00ce; /* U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ pub const XKB_KEY_Idiaeresis :u32 = 0x00cf; /* U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS */ pub const XKB_KEY_ETH :u32 = 0x00d0; /* U+00D0 LATIN CAPITAL LETTER ETH */ pub const XKB_KEY_Eth :u32 = 0x00d0; /* deprecated */ pub const XKB_KEY_Ntilde :u32 = 0x00d1; /* U+00D1 LATIN CAPITAL LETTER N WITH TILDE */ pub const XKB_KEY_Ograve :u32 = 0x00d2; /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */ pub const XKB_KEY_Oacute :u32 = 0x00d3; /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */ pub const XKB_KEY_Ocircumflex :u32 = 0x00d4; /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ pub const XKB_KEY_Otilde :u32 = 0x00d5; /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */ pub const XKB_KEY_Odiaeresis :u32 = 0x00d6; /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */ pub const XKB_KEY_multiply :u32 = 0x00d7; /* U+00D7 MULTIPLICATION SIGN */ pub const XKB_KEY_Oslash :u32 = 0x00d8; /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ pub const XKB_KEY_Ooblique :u32 = 0x00d8; /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ pub const XKB_KEY_Ugrave :u32 = 0x00d9; /* U+00D9 LATIN CAPITAL LETTER U WITH GRAVE */ pub const XKB_KEY_Uacute :u32 = 0x00da; /* U+00DA LATIN CAPITAL LETTER U WITH ACUTE */ pub const XKB_KEY_Ucircumflex :u32 = 0x00db; /* U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ pub const XKB_KEY_Udiaeresis :u32 = 0x00dc; /* U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS */ pub const XKB_KEY_Yacute :u32 = 0x00dd; /* U+00DD LATIN CAPITAL LETTER Y WITH ACUTE */ pub const XKB_KEY_THORN :u32 = 0x00de; /* U+00DE LATIN CAPITAL LETTER THORN */ pub const XKB_KEY_Thorn :u32 = 0x00de; /* deprecated */ pub const XKB_KEY_ssharp :u32 = 0x00df; /* U+00DF LATIN SMALL LETTER SHARP S */ pub const XKB_KEY_agrave :u32 = 0x00e0; /* U+00E0 LATIN SMALL LETTER A WITH GRAVE */ pub const XKB_KEY_aacute :u32 = 0x00e1; /* U+00E1 LATIN SMALL LETTER A WITH ACUTE */ pub const XKB_KEY_acircumflex :u32 = 0x00e2; /* U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX */ pub const XKB_KEY_atilde :u32 = 0x00e3; /* U+00E3 LATIN SMALL LETTER A WITH TILDE */ pub const XKB_KEY_adiaeresis :u32 = 0x00e4; /* U+00E4 LATIN SMALL LETTER A WITH DIAERESIS */ pub const XKB_KEY_aring :u32 = 0x00e5; /* U+00E5 LATIN SMALL LETTER A WITH RING ABOVE */ pub const XKB_KEY_ae :u32 = 0x00e6; /* U+00E6 LATIN SMALL LETTER AE */ pub const XKB_KEY_ccedilla :u32 = 0x00e7; /* U+00E7 LATIN SMALL LETTER C WITH CEDILLA */ pub const XKB_KEY_egrave :u32 = 0x00e8; /* U+00E8 LATIN SMALL LETTER E WITH GRAVE */ pub const XKB_KEY_eacute :u32 = 0x00e9; /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ pub const XKB_KEY_ecircumflex :u32 = 0x00ea; /* U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX */ pub const XKB_KEY_ediaeresis :u32 = 0x00eb; /* U+00EB LATIN SMALL LETTER E WITH DIAERESIS */ pub const XKB_KEY_igrave :u32 = 0x00ec; /* U+00EC LATIN SMALL LETTER I WITH GRAVE */ pub const XKB_KEY_iacute :u32 = 0x00ed; /* U+00ED LATIN SMALL LETTER I WITH ACUTE */ pub const XKB_KEY_icircumflex :u32 = 0x00ee; /* U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX */ pub const XKB_KEY_idiaeresis :u32 = 0x00ef; /* U+00EF LATIN SMALL LETTER I WITH DIAERESIS */ pub const XKB_KEY_eth :u32 = 0x00f0; /* U+00F0 LATIN SMALL LETTER ETH */ pub const XKB_KEY_ntilde :u32 = 0x00f1; /* U+00F1 LATIN SMALL LETTER N WITH TILDE */ pub const XKB_KEY_ograve :u32 = 0x00f2; /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */ pub const XKB_KEY_oacute :u32 = 0x00f3; /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */ pub const XKB_KEY_ocircumflex :u32 = 0x00f4; /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */ pub const XKB_KEY_otilde :u32 = 0x00f5; /* U+00F5 LATIN SMALL LETTER O WITH TILDE */ pub const XKB_KEY_odiaeresis :u32 = 0x00f6; /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */ pub const XKB_KEY_division :u32 = 0x00f7; /* U+00F7 DIVISION SIGN */ pub const XKB_KEY_oslash :u32 = 0x00f8; /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ pub const XKB_KEY_ooblique :u32 = 0x00f8; /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ pub const XKB_KEY_ugrave :u32 = 0x00f9; /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */ pub const XKB_KEY_uacute :u32 = 0x00fa; /* U+00FA LATIN SMALL LETTER U WITH ACUTE */ pub const XKB_KEY_ucircumflex :u32 = 0x00fb; /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */ pub const XKB_KEY_udiaeresis :u32 = 0x00fc; /* U+00FC LATIN SMALL LETTER U WITH DIAERESIS */ pub const XKB_KEY_yacute :u32 = 0x00fd; /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */ pub const XKB_KEY_thorn :u32 = 0x00fe; /* U+00FE LATIN SMALL LETTER THORN */ pub const XKB_KEY_ydiaeresis :u32 = 0x00ff; /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ /* * Latin 2 * Byte 3 = 1 */ pub const XKB_KEY_Aogonek :u32 = 0x01a1; /* U+0104 LATIN CAPITAL LETTER A WITH OGONEK */ pub const XKB_KEY_breve :u32 = 0x01a2; /* U+02D8 BREVE */ pub const XKB_KEY_Lstroke :u32 = 0x01a3; /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ pub const XKB_KEY_Lcaron :u32 = 0x01a5; /* U+013D LATIN CAPITAL LETTER L WITH CARON */ pub const XKB_KEY_Sacute :u32 = 0x01a6; /* U+015A LATIN CAPITAL LETTER S WITH ACUTE */ pub const XKB_KEY_Scaron :u32 = 0x01a9; /* U+0160 LATIN CAPITAL LETTER S WITH CARON */ pub const XKB_KEY_Scedilla :u32 = 0x01aa; /* U+015E LATIN CAPITAL LETTER S WITH CEDILLA */ pub const XKB_KEY_Tcaron :u32 = 0x01ab; /* U+0164 LATIN CAPITAL LETTER T WITH CARON */ pub const XKB_KEY_Zacute :u32 = 0x01ac; /* U+0179 LATIN CAPITAL LETTER Z WITH ACUTE */ pub const XKB_KEY_Zcaron :u32 = 0x01ae; /* U+017D LATIN CAPITAL LETTER Z WITH CARON */ pub const XKB_KEY_Zabovedot :u32 = 0x01af; /* U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE */ pub const XKB_KEY_aogonek :u32 = 0x01b1; /* U+0105 LATIN SMALL LETTER A WITH OGONEK */ pub const XKB_KEY_ogonek :u32 = 0x01b2; /* U+02DB OGONEK */ pub const XKB_KEY_lstroke :u32 = 0x01b3; /* U+0142 LATIN SMALL LETTER L WITH STROKE */ pub const XKB_KEY_lcaron :u32 = 0x01b5; /* U+013E LATIN SMALL LETTER L WITH CARON */ pub const XKB_KEY_sacute :u32 = 0x01b6; /* U+015B LATIN SMALL LETTER S WITH ACUTE */ pub const XKB_KEY_caron :u32 = 0x01b7; /* U+02C7 CARON */ pub const XKB_KEY_scaron :u32 = 0x01b9; /* U+0161 LATIN SMALL LETTER S WITH CARON */ pub const XKB_KEY_scedilla :u32 = 0x01ba; /* U+015F LATIN SMALL LETTER S WITH CEDILLA */ pub const XKB_KEY_tcaron :u32 = 0x01bb; /* U+0165 LATIN SMALL LETTER T WITH CARON */ pub const XKB_KEY_zacute :u32 = 0x01bc; /* U+017A LATIN SMALL LETTER Z WITH ACUTE */ pub const XKB_KEY_doubleacute :u32 = 0x01bd; /* U+02DD DOUBLE ACUTE ACCENT */ pub const XKB_KEY_zcaron :u32 = 0x01be; /* U+017E LATIN SMALL LETTER Z WITH CARON */ pub const XKB_KEY_zabovedot :u32 = 0x01bf; /* U+017C LATIN SMALL LETTER Z WITH DOT ABOVE */ pub const XKB_KEY_Racute :u32 = 0x01c0; /* U+0154 LATIN CAPITAL LETTER R WITH ACUTE */ pub const XKB_KEY_Abreve :u32 = 0x01c3; /* U+0102 LATIN CAPITAL LETTER A WITH BREVE */ pub const XKB_KEY_Lacute :u32 = 0x01c5; /* U+0139 LATIN CAPITAL LETTER L WITH ACUTE */ pub const XKB_KEY_Cacute :u32 = 0x01c6; /* U+0106 LATIN CAPITAL LETTER C WITH ACUTE */ pub const XKB_KEY_Ccaron :u32 = 0x01c8; /* U+010C LATIN CAPITAL LETTER C WITH CARON */ pub const XKB_KEY_Eogonek :u32 = 0x01ca; /* U+0118 LATIN CAPITAL LETTER E WITH OGONEK */ pub const XKB_KEY_Ecaron :u32 = 0x01cc; /* U+011A LATIN CAPITAL LETTER E WITH CARON */ pub const XKB_KEY_Dcaron :u32 = 0x01cf; /* U+010E LATIN CAPITAL LETTER D WITH CARON */ pub const XKB_KEY_Dstroke :u32 = 0x01d0; /* U+0110 LATIN CAPITAL LETTER D WITH STROKE */ pub const XKB_KEY_Nacute :u32 = 0x01d1; /* U+0143 LATIN CAPITAL LETTER N WITH ACUTE */ pub const XKB_KEY_Ncaron :u32 = 0x01d2; /* U+0147 LATIN CAPITAL LETTER N WITH CARON */ pub const XKB_KEY_Odoubleacute :u32 = 0x01d5; /* U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */ pub const XKB_KEY_Rcaron :u32 = 0x01d8; /* U+0158 LATIN CAPITAL LETTER R WITH CARON */ pub const XKB_KEY_Uring :u32 = 0x01d9; /* U+016E LATIN CAPITAL LETTER U WITH RING ABOVE */ pub const XKB_KEY_Udoubleacute :u32 = 0x01db; /* U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */ pub const XKB_KEY_Tcedilla :u32 = 0x01de; /* U+0162 LATIN CAPITAL LETTER T WITH CEDILLA */ pub const XKB_KEY_racute :u32 = 0x01e0; /* U+0155 LATIN SMALL LETTER R WITH ACUTE */ pub const XKB_KEY_abreve :u32 = 0x01e3; /* U+0103 LATIN SMALL LETTER A WITH BREVE */ pub const XKB_KEY_lacute :u32 = 0x01e5; /* U+013A LATIN SMALL LETTER L WITH ACUTE */ pub const XKB_KEY_cacute :u32 = 0x01e6; /* U+0107 LATIN SMALL LETTER C WITH ACUTE */ pub const XKB_KEY_ccaron :u32 = 0x01e8; /* U+010D LATIN SMALL LETTER C WITH CARON */ pub const XKB_KEY_eogonek :u32 = 0x01ea; /* U+0119 LATIN SMALL LETTER E WITH OGONEK */ pub const XKB_KEY_ecaron :u32 = 0x01ec; /* U+011B LATIN SMALL LETTER E WITH CARON */ pub const XKB_KEY_dcaron :u32 = 0x01ef; /* U+010F LATIN SMALL LETTER D WITH CARON */ pub const XKB_KEY_dstroke :u32 = 0x01f0; /* U+0111 LATIN SMALL LETTER D WITH STROKE */ pub const XKB_KEY_nacute :u32 = 0x01f1; /* U+0144 LATIN SMALL LETTER N WITH ACUTE */ pub const XKB_KEY_ncaron :u32 = 0x01f2; /* U+0148 LATIN SMALL LETTER N WITH CARON */ pub const XKB_KEY_odoubleacute :u32 = 0x01f5; /* U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE */ pub const XKB_KEY_rcaron :u32 = 0x01f8; /* U+0159 LATIN SMALL LETTER R WITH CARON */ pub const XKB_KEY_uring :u32 = 0x01f9; /* U+016F LATIN SMALL LETTER U WITH RING ABOVE */ pub const XKB_KEY_udoubleacute :u32 = 0x01fb; /* U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE */ pub const XKB_KEY_tcedilla :u32 = 0x01fe; /* U+0163 LATIN SMALL LETTER T WITH CEDILLA */ pub const XKB_KEY_abovedot :u32 = 0x01ff; /* U+02D9 DOT ABOVE */ /* * Latin 3 * Byte 3 = 2 */ pub const XKB_KEY_Hstroke :u32 = 0x02a1; /* U+0126 LATIN CAPITAL LETTER H WITH STROKE */ pub const XKB_KEY_Hcircumflex :u32 = 0x02a6; /* U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX */ pub const XKB_KEY_Iabovedot :u32 = 0x02a9; /* U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE */ pub const XKB_KEY_Gbreve :u32 = 0x02ab; /* U+011E LATIN CAPITAL LETTER G WITH BREVE */ pub const XKB_KEY_Jcircumflex :u32 = 0x02ac; /* U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX */ pub const XKB_KEY_hstroke :u32 = 0x02b1; /* U+0127 LATIN SMALL LETTER H WITH STROKE */ pub const XKB_KEY_hcircumflex :u32 = 0x02b6; /* U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX */ pub const XKB_KEY_idotless :u32 = 0x02b9; /* U+0131 LATIN SMALL LETTER DOTLESS I */ pub const XKB_KEY_gbreve :u32 = 0x02bb; /* U+011F LATIN SMALL LETTER G WITH BREVE */ pub const XKB_KEY_jcircumflex :u32 = 0x02bc; /* U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX */ pub const XKB_KEY_Cabovedot :u32 = 0x02c5; /* U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE */ pub const XKB_KEY_Ccircumflex :u32 = 0x02c6; /* U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX */ pub const XKB_KEY_Gabovedot :u32 = 0x02d5; /* U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE */ pub const XKB_KEY_Gcircumflex :u32 = 0x02d8; /* U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX */ pub const XKB_KEY_Ubreve :u32 = 0x02dd; /* U+016C LATIN CAPITAL LETTER U WITH BREVE */ pub const XKB_KEY_Scircumflex :u32 = 0x02de; /* U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX */ pub const XKB_KEY_cabovedot :u32 = 0x02e5; /* U+010B LATIN SMALL LETTER C WITH DOT ABOVE */ pub const XKB_KEY_ccircumflex :u32 = 0x02e6; /* U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX */ pub const XKB_KEY_gabovedot :u32 = 0x02f5; /* U+0121 LATIN SMALL LETTER G WITH DOT ABOVE */ pub const XKB_KEY_gcircumflex :u32 = 0x02f8; /* U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX */ pub const XKB_KEY_ubreve :u32 = 0x02fd; /* U+016D LATIN SMALL LETTER U WITH BREVE */ pub const XKB_KEY_scircumflex :u32 = 0x02fe; /* U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX */ /* * Latin 4 * Byte 3 = 3 */ pub const XKB_KEY_kra :u32 = 0x03a2; /* U+0138 LATIN SMALL LETTER KRA */ pub const XKB_KEY_kappa :u32 = 0x03a2; /* deprecated */ pub const XKB_KEY_Rcedilla :u32 = 0x03a3; /* U+0156 LATIN CAPITAL LETTER R WITH CEDILLA */ pub const XKB_KEY_Itilde :u32 = 0x03a5; /* U+0128 LATIN CAPITAL LETTER I WITH TILDE */ pub const XKB_KEY_Lcedilla :u32 = 0x03a6; /* U+013B LATIN CAPITAL LETTER L WITH CEDILLA */ pub const XKB_KEY_Emacron :u32 = 0x03aa; /* U+0112 LATIN CAPITAL LETTER E WITH MACRON */ pub const XKB_KEY_Gcedilla :u32 = 0x03ab; /* U+0122 LATIN CAPITAL LETTER G WITH CEDILLA */ pub const XKB_KEY_Tslash :u32 = 0x03ac; /* U+0166 LATIN CAPITAL LETTER T WITH STROKE */ pub const XKB_KEY_rcedilla :u32 = 0x03b3; /* U+0157 LATIN SMALL LETTER R WITH CEDILLA */ pub const XKB_KEY_itilde :u32 = 0x03b5; /* U+0129 LATIN SMALL LETTER I WITH TILDE */ pub const XKB_KEY_lcedilla :u32 = 0x03b6; /* U+013C LATIN SMALL LETTER L WITH CEDILLA */ pub const XKB_KEY_emacron :u32 = 0x03ba; /* U+0113 LATIN SMALL LETTER E WITH MACRON */ pub const XKB_KEY_gcedilla :u32 = 0x03bb; /* U+0123 LATIN SMALL LETTER G WITH CEDILLA */ pub const XKB_KEY_tslash :u32 = 0x03bc; /* U+0167 LATIN SMALL LETTER T WITH STROKE */ pub const XKB_KEY_ENG :u32 = 0x03bd; /* U+014A LATIN CAPITAL LETTER ENG */ pub const XKB_KEY_eng :u32 = 0x03bf; /* U+014B LATIN SMALL LETTER ENG */ pub const XKB_KEY_Amacron :u32 = 0x03c0; /* U+0100 LATIN CAPITAL LETTER A WITH MACRON */ pub const XKB_KEY_Iogonek :u32 = 0x03c7; /* U+012E LATIN CAPITAL LETTER I WITH OGONEK */ pub const XKB_KEY_Eabovedot :u32 = 0x03cc; /* U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE */ pub const XKB_KEY_Imacron :u32 = 0x03cf; /* U+012A LATIN CAPITAL LETTER I WITH MACRON */ pub const XKB_KEY_Ncedilla :u32 = 0x03d1; /* U+0145 LATIN CAPITAL LETTER N WITH CEDILLA */ pub const XKB_KEY_Omacron :u32 = 0x03d2; /* U+014C LATIN CAPITAL LETTER O WITH MACRON */ pub const XKB_KEY_Kcedilla :u32 = 0x03d3; /* U+0136 LATIN CAPITAL LETTER K WITH CEDILLA */ pub const XKB_KEY_Uogonek :u32 = 0x03d9; /* U+0172 LATIN CAPITAL LETTER U WITH OGONEK */ pub const XKB_KEY_Utilde :u32 = 0x03dd; /* U+0168 LATIN CAPITAL LETTER U WITH TILDE */ pub const XKB_KEY_Umacron :u32 = 0x03de; /* U+016A LATIN CAPITAL LETTER U WITH MACRON */ pub const XKB_KEY_amacron :u32 = 0x03e0; /* U+0101 LATIN SMALL LETTER A WITH MACRON */ pub const XKB_KEY_iogonek :u32 = 0x03e7; /* U+012F LATIN SMALL LETTER I WITH OGONEK */ pub const XKB_KEY_eabovedot :u32 = 0x03ec; /* U+0117 LATIN SMALL LETTER E WITH DOT ABOVE */ pub const XKB_KEY_imacron :u32 = 0x03ef; /* U+012B LATIN SMALL LETTER I WITH MACRON */ pub const XKB_KEY_ncedilla :u32 = 0x03f1; /* U+0146 LATIN SMALL LETTER N WITH CEDILLA */ pub const XKB_KEY_omacron :u32 = 0x03f2; /* U+014D LATIN SMALL LETTER O WITH MACRON */ pub const XKB_KEY_kcedilla :u32 = 0x03f3; /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */ pub const XKB_KEY_uogonek :u32 = 0x03f9; /* U+0173 LATIN SMALL LETTER U WITH OGONEK */ pub const XKB_KEY_utilde :u32 = 0x03fd; /* U+0169 LATIN SMALL LETTER U WITH TILDE */ pub const XKB_KEY_umacron :u32 = 0x03fe; /* U+016B LATIN SMALL LETTER U WITH MACRON */ /* * Latin 8 */ pub const XKB_KEY_Wcircumflex :u32 = 0x1000174; /* U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX */ pub const XKB_KEY_wcircumflex :u32 = 0x1000175; /* U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX */ pub const XKB_KEY_Ycircumflex :u32 = 0x1000176; /* U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX */ pub const XKB_KEY_ycircumflex :u32 = 0x1000177; /* U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX */ pub const XKB_KEY_Babovedot :u32 = 0x1001e02; /* U+1E02 LATIN CAPITAL LETTER B WITH DOT ABOVE */ pub const XKB_KEY_babovedot :u32 = 0x1001e03; /* U+1E03 LATIN SMALL LETTER B WITH DOT ABOVE */ pub const XKB_KEY_Dabovedot :u32 = 0x1001e0a; /* U+1E0A LATIN CAPITAL LETTER D WITH DOT ABOVE */ pub const XKB_KEY_dabovedot :u32 = 0x1001e0b; /* U+1E0B LATIN SMALL LETTER D WITH DOT ABOVE */ pub const XKB_KEY_Fabovedot :u32 = 0x1001e1e; /* U+1E1E LATIN CAPITAL LETTER F WITH DOT ABOVE */ pub const XKB_KEY_fabovedot :u32 = 0x1001e1f; /* U+1E1F LATIN SMALL LETTER F WITH DOT ABOVE */ pub const XKB_KEY_Mabovedot :u32 = 0x1001e40; /* U+1E40 LATIN CAPITAL LETTER M WITH DOT ABOVE */ pub const XKB_KEY_mabovedot :u32 = 0x1001e41; /* U+1E41 LATIN SMALL LETTER M WITH DOT ABOVE */ pub const XKB_KEY_Pabovedot :u32 = 0x1001e56; /* U+1E56 LATIN CAPITAL LETTER P WITH DOT ABOVE */ pub const XKB_KEY_pabovedot :u32 = 0x1001e57; /* U+1E57 LATIN SMALL LETTER P WITH DOT ABOVE */ pub const XKB_KEY_Sabovedot :u32 = 0x1001e60; /* U+1E60 LATIN CAPITAL LETTER S WITH DOT ABOVE */ pub const XKB_KEY_sabovedot :u32 = 0x1001e61; /* U+1E61 LATIN SMALL LETTER S WITH DOT ABOVE */ pub const XKB_KEY_Tabovedot :u32 = 0x1001e6a; /* U+1E6A LATIN CAPITAL LETTER T WITH DOT ABOVE */ pub const XKB_KEY_tabovedot :u32 = 0x1001e6b; /* U+1E6B LATIN SMALL LETTER T WITH DOT ABOVE */ pub const XKB_KEY_Wgrave :u32 = 0x1001e80; /* U+1E80 LATIN CAPITAL LETTER W WITH GRAVE */ pub const XKB_KEY_wgrave :u32 = 0x1001e81; /* U+1E81 LATIN SMALL LETTER W WITH GRAVE */ pub const XKB_KEY_Wacute :u32 = 0x1001e82; /* U+1E82 LATIN CAPITAL LETTER W WITH ACUTE */ pub const XKB_KEY_wacute :u32 = 0x1001e83; /* U+1E83 LATIN SMALL LETTER W WITH ACUTE */ pub const XKB_KEY_Wdiaeresis :u32 = 0x1001e84; /* U+1E84 LATIN CAPITAL LETTER W WITH DIAERESIS */ pub const XKB_KEY_wdiaeresis :u32 = 0x1001e85; /* U+1E85 LATIN SMALL LETTER W WITH DIAERESIS */ pub const XKB_KEY_Ygrave :u32 = 0x1001ef2; /* U+1EF2 LATIN CAPITAL LETTER Y WITH GRAVE */ pub const XKB_KEY_ygrave :u32 = 0x1001ef3; /* U+1EF3 LATIN SMALL LETTER Y WITH GRAVE */ /* * Latin 9 * Byte 3 = :u32 = 0x13; */ pub const XKB_KEY_OE :u32 = 0x13bc; /* U+0152 LATIN CAPITAL LIGATURE OE */ pub const XKB_KEY_oe :u32 = 0x13bd; /* U+0153 LATIN SMALL LIGATURE OE */ pub const XKB_KEY_Ydiaeresis :u32 = 0x13be; /* U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS */ /* * Katakana * Byte 3 = 4 */ pub const XKB_KEY_overline :u32 = 0x047e; /* U+203E OVERLINE */ pub const XKB_KEY_kana_fullstop :u32 = 0x04a1; /* U+3002 IDEOGRAPHIC FULL STOP */ pub const XKB_KEY_kana_openingbracket :u32 = 0x04a2; /* U+300C LEFT CORNER BRACKET */ pub const XKB_KEY_kana_closingbracket :u32 = 0x04a3; /* U+300D RIGHT CORNER BRACKET */ pub const XKB_KEY_kana_comma :u32 = 0x04a4; /* U+3001 IDEOGRAPHIC COMMA */ pub const XKB_KEY_kana_conjunctive :u32 = 0x04a5; /* U+30FB KATAKANA MIDDLE DOT */ pub const XKB_KEY_kana_middledot :u32 = 0x04a5; /* deprecated */ pub const XKB_KEY_kana_WO :u32 = 0x04a6; /* U+30F2 KATAKANA LETTER WO */ pub const XKB_KEY_kana_a :u32 = 0x04a7; /* U+30A1 KATAKANA LETTER SMALL A */ pub const XKB_KEY_kana_i :u32 = 0x04a8; /* U+30A3 KATAKANA LETTER SMALL I */ pub const XKB_KEY_kana_u :u32 = 0x04a9; /* U+30A5 KATAKANA LETTER SMALL U */ pub const XKB_KEY_kana_e :u32 = 0x04aa; /* U+30A7 KATAKANA LETTER SMALL E */ pub const XKB_KEY_kana_o :u32 = 0x04ab; /* U+30A9 KATAKANA LETTER SMALL O */ pub const XKB_KEY_kana_ya :u32 = 0x04ac; /* U+30E3 KATAKANA LETTER SMALL YA */ pub const XKB_KEY_kana_yu :u32 = 0x04ad; /* U+30E5 KATAKANA LETTER SMALL YU */ pub const XKB_KEY_kana_yo :u32 = 0x04ae; /* U+30E7 KATAKANA LETTER SMALL YO */ pub const XKB_KEY_kana_tsu :u32 = 0x04af; /* U+30C3 KATAKANA LETTER SMALL TU */ pub const XKB_KEY_kana_tu :u32 = 0x04af; /* deprecated */ pub const XKB_KEY_prolongedsound :u32 = 0x04b0; /* U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK */ pub const XKB_KEY_kana_A :u32 = 0x04b1; /* U+30A2 KATAKANA LETTER A */ pub const XKB_KEY_kana_I :u32 = 0x04b2; /* U+30A4 KATAKANA LETTER I */ pub const XKB_KEY_kana_U :u32 = 0x04b3; /* U+30A6 KATAKANA LETTER U */ pub const XKB_KEY_kana_E :u32 = 0x04b4; /* U+30A8 KATAKANA LETTER E */ pub const XKB_KEY_kana_O :u32 = 0x04b5; /* U+30AA KATAKANA LETTER O */ pub const XKB_KEY_kana_KA :u32 = 0x04b6; /* U+30AB KATAKANA LETTER KA */ pub const XKB_KEY_kana_KI :u32 = 0x04b7; /* U+30AD KATAKANA LETTER KI */ pub const XKB_KEY_kana_KU :u32 = 0x04b8; /* U+30AF KATAKANA LETTER KU */ pub const XKB_KEY_kana_KE :u32 = 0x04b9; /* U+30B1 KATAKANA LETTER KE */ pub const XKB_KEY_kana_KO :u32 = 0x04ba; /* U+30B3 KATAKANA LETTER KO */ pub const XKB_KEY_kana_SA :u32 = 0x04bb; /* U+30B5 KATAKANA LETTER SA */ pub const XKB_KEY_kana_SHI :u32 = 0x04bc; /* U+30B7 KATAKANA LETTER SI */ pub const XKB_KEY_kana_SU :u32 = 0x04bd; /* U+30B9 KATAKANA LETTER SU */ pub const XKB_KEY_kana_SE :u32 = 0x04be; /* U+30BB KATAKANA LETTER SE */ pub const XKB_KEY_kana_SO :u32 = 0x04bf; /* U+30BD KATAKANA LETTER SO */ pub const XKB_KEY_kana_TA :u32 = 0x04c0; /* U+30BF KATAKANA LETTER TA */ pub const XKB_KEY_kana_CHI :u32 = 0x04c1; /* U+30C1 KATAKANA LETTER TI */ pub const XKB_KEY_kana_TI :u32 = 0x04c1; /* deprecated */ pub const XKB_KEY_kana_TSU :u32 = 0x04c2; /* U+30C4 KATAKANA LETTER TU */ pub const XKB_KEY_kana_TU :u32 = 0x04c2; /* deprecated */ pub const XKB_KEY_kana_TE :u32 = 0x04c3; /* U+30C6 KATAKANA LETTER TE */ pub const XKB_KEY_kana_TO :u32 = 0x04c4; /* U+30C8 KATAKANA LETTER TO */ pub const XKB_KEY_kana_NA :u32 = 0x04c5; /* U+30CA KATAKANA LETTER NA */ pub const XKB_KEY_kana_NI :u32 = 0x04c6; /* U+30CB KATAKANA LETTER NI */ pub const XKB_KEY_kana_NU :u32 = 0x04c7; /* U+30CC KATAKANA LETTER NU */ pub const XKB_KEY_kana_NE :u32 = 0x04c8; /* U+30CD KATAKANA LETTER NE */ pub const XKB_KEY_kana_NO :u32 = 0x04c9; /* U+30CE KATAKANA LETTER NO */ pub const XKB_KEY_kana_HA :u32 = 0x04ca; /* U+30CF KATAKANA LETTER HA */ pub const XKB_KEY_kana_HI :u32 = 0x04cb; /* U+30D2 KATAKANA LETTER HI */ pub const XKB_KEY_kana_FU :u32 = 0x04cc; /* U+30D5 KATAKANA LETTER HU */ pub const XKB_KEY_kana_HU :u32 = 0x04cc; /* deprecated */ pub const XKB_KEY_kana_HE :u32 = 0x04cd; /* U+30D8 KATAKANA LETTER HE */ pub const XKB_KEY_kana_HO :u32 = 0x04ce; /* U+30DB KATAKANA LETTER HO */ pub const XKB_KEY_kana_MA :u32 = 0x04cf; /* U+30DE KATAKANA LETTER MA */ pub const XKB_KEY_kana_MI :u32 = 0x04d0; /* U+30DF KATAKANA LETTER MI */ pub const XKB_KEY_kana_MU :u32 = 0x04d1; /* U+30E0 KATAKANA LETTER MU */ pub const XKB_KEY_kana_ME :u32 = 0x04d2; /* U+30E1 KATAKANA LETTER ME */ pub const XKB_KEY_kana_MO :u32 = 0x04d3; /* U+30E2 KATAKANA LETTER MO */ pub const XKB_KEY_kana_YA :u32 = 0x04d4; /* U+30E4 KATAKANA LETTER YA */ pub const XKB_KEY_kana_YU :u32 = 0x04d5; /* U+30E6 KATAKANA LETTER YU */ pub const XKB_KEY_kana_YO :u32 = 0x04d6; /* U+30E8 KATAKANA LETTER YO */ pub const XKB_KEY_kana_RA :u32 = 0x04d7; /* U+30E9 KATAKANA LETTER RA */ pub const XKB_KEY_kana_RI :u32 = 0x04d8; /* U+30EA KATAKANA LETTER RI */ pub const XKB_KEY_kana_RU :u32 = 0x04d9; /* U+30EB KATAKANA LETTER RU */ pub const XKB_KEY_kana_RE :u32 = 0x04da; /* U+30EC KATAKANA LETTER RE */ pub const XKB_KEY_kana_RO :u32 = 0x04db; /* U+30ED KATAKANA LETTER RO */ pub const XKB_KEY_kana_WA :u32 = 0x04dc; /* U+30EF KATAKANA LETTER WA */ pub const XKB_KEY_kana_N :u32 = 0x04dd; /* U+30F3 KATAKANA LETTER N */ pub const XKB_KEY_voicedsound :u32 = 0x04de; /* U+309B KATAKANA-HIRAGANA VOICED SOUND MARK */ pub const XKB_KEY_semivoicedsound :u32 = 0x04df; /* U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */ pub const XKB_KEY_kana_switch :u32 = 0xff7e; /* Alias for mode_switch */ /* * Arabic * Byte 3 = 5 */ pub const XKB_KEY_Farsi_0 :u32 = 0x10006f0; /* U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO */ pub const XKB_KEY_Farsi_1 :u32 = 0x10006f1; /* U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE */ pub const XKB_KEY_Farsi_2 :u32 = 0x10006f2; /* U+06F2 EXTENDED ARABIC-INDIC DIGIT TWO */ pub const XKB_KEY_Farsi_3 :u32 = 0x10006f3; /* U+06F3 EXTENDED ARABIC-INDIC DIGIT THREE */ pub const XKB_KEY_Farsi_4 :u32 = 0x10006f4; /* U+06F4 EXTENDED ARABIC-INDIC DIGIT FOUR */ pub const XKB_KEY_Farsi_5 :u32 = 0x10006f5; /* U+06F5 EXTENDED ARABIC-INDIC DIGIT FIVE */ pub const XKB_KEY_Farsi_6 :u32 = 0x10006f6; /* U+06F6 EXTENDED ARABIC-INDIC DIGIT SIX */ pub const XKB_KEY_Farsi_7 :u32 = 0x10006f7; /* U+06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN */ pub const XKB_KEY_Farsi_8 :u32 = 0x10006f8; /* U+06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT */ pub const XKB_KEY_Farsi_9 :u32 = 0x10006f9; /* U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE */ pub const XKB_KEY_Arabic_percent :u32 = 0x100066a; /* U+066A ARABIC PERCENT SIGN */ pub const XKB_KEY_Arabic_superscript_alef :u32 = 0x1000670; /* U+0670 ARABIC LETTER SUPERSCRIPT ALEF */ pub const XKB_KEY_Arabic_tteh :u32 = 0x1000679; /* U+0679 ARABIC LETTER TTEH */ pub const XKB_KEY_Arabic_peh :u32 = 0x100067e; /* U+067E ARABIC LETTER PEH */ pub const XKB_KEY_Arabic_tcheh :u32 = 0x1000686; /* U+0686 ARABIC LETTER TCHEH */ pub const XKB_KEY_Arabic_ddal :u32 = 0x1000688; /* U+0688 ARABIC LETTER DDAL */ pub const XKB_KEY_Arabic_rreh :u32 = 0x1000691; /* U+0691 ARABIC LETTER RREH */ pub const XKB_KEY_Arabic_comma :u32 = 0x05ac; /* U+060C ARABIC COMMA */ pub const XKB_KEY_Arabic_fullstop :u32 = 0x10006d4; /* U+06D4 ARABIC FULL STOP */ pub const XKB_KEY_Arabic_0 :u32 = 0x1000660; /* U+0660 ARABIC-INDIC DIGIT ZERO */ pub const XKB_KEY_Arabic_1 :u32 = 0x1000661; /* U+0661 ARABIC-INDIC DIGIT ONE */ pub const XKB_KEY_Arabic_2 :u32 = 0x1000662; /* U+0662 ARABIC-INDIC DIGIT TWO */ pub const XKB_KEY_Arabic_3 :u32 = 0x1000663; /* U+0663 ARABIC-INDIC DIGIT THREE */ pub const XKB_KEY_Arabic_4 :u32 = 0x1000664; /* U+0664 ARABIC-INDIC DIGIT FOUR */ pub const XKB_KEY_Arabic_5 :u32 = 0x1000665; /* U+0665 ARABIC-INDIC DIGIT FIVE */ pub const XKB_KEY_Arabic_6 :u32 = 0x1000666; /* U+0666 ARABIC-INDIC DIGIT SIX */ pub const XKB_KEY_Arabic_7 :u32 = 0x1000667; /* U+0667 ARABIC-INDIC DIGIT SEVEN */ pub const XKB_KEY_Arabic_8 :u32 = 0x1000668; /* U+0668 ARABIC-INDIC DIGIT EIGHT */ pub const XKB_KEY_Arabic_9 :u32 = 0x1000669; /* U+0669 ARABIC-INDIC DIGIT NINE */ pub const XKB_KEY_Arabic_semicolon :u32 = 0x05bb; /* U+061B ARABIC SEMICOLON */ pub const XKB_KEY_Arabic_question_mark :u32 = 0x05bf; /* U+061F ARABIC QUESTION MARK */ pub const XKB_KEY_Arabic_hamza :u32 = 0x05c1; /* U+0621 ARABIC LETTER HAMZA */ pub const XKB_KEY_Arabic_maddaonalef :u32 = 0x05c2; /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */ pub const XKB_KEY_Arabic_hamzaonalef :u32 = 0x05c3; /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */ pub const XKB_KEY_Arabic_hamzaonwaw :u32 = 0x05c4; /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */ pub const XKB_KEY_Arabic_hamzaunderalef :u32 = 0x05c5; /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */ pub const XKB_KEY_Arabic_hamzaonyeh :u32 = 0x05c6; /* U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE */ pub const XKB_KEY_Arabic_alef :u32 = 0x05c7; /* U+0627 ARABIC LETTER ALEF */ pub const XKB_KEY_Arabic_beh :u32 = 0x05c8; /* U+0628 ARABIC LETTER BEH */ pub const XKB_KEY_Arabic_tehmarbuta :u32 = 0x05c9; /* U+0629 ARABIC LETTER TEH MARBUTA */ pub const XKB_KEY_Arabic_teh :u32 = 0x05ca; /* U+062A ARABIC LETTER TEH */ pub const XKB_KEY_Arabic_theh :u32 = 0x05cb; /* U+062B ARABIC LETTER THEH */ pub const XKB_KEY_Arabic_jeem :u32 = 0x05cc; /* U+062C ARABIC LETTER JEEM */ pub const XKB_KEY_Arabic_hah :u32 = 0x05cd; /* U+062D ARABIC LETTER HAH */ pub const XKB_KEY_Arabic_khah :u32 = 0x05ce; /* U+062E ARABIC LETTER KHAH */ pub const XKB_KEY_Arabic_dal :u32 = 0x05cf; /* U+062F ARABIC LETTER DAL */ pub const XKB_KEY_Arabic_thal :u32 = 0x05d0; /* U+0630 ARABIC LETTER THAL */ pub const XKB_KEY_Arabic_ra :u32 = 0x05d1; /* U+0631 ARABIC LETTER REH */ pub const XKB_KEY_Arabic_zain :u32 = 0x05d2; /* U+0632 ARABIC LETTER ZAIN */ pub const XKB_KEY_Arabic_seen :u32 = 0x05d3; /* U+0633 ARABIC LETTER SEEN */ pub const XKB_KEY_Arabic_sheen :u32 = 0x05d4; /* U+0634 ARABIC LETTER SHEEN */ pub const XKB_KEY_Arabic_sad :u32 = 0x05d5; /* U+0635 ARABIC LETTER SAD */ pub const XKB_KEY_Arabic_dad :u32 = 0x05d6; /* U+0636 ARABIC LETTER DAD */ pub const XKB_KEY_Arabic_tah :u32 = 0x05d7; /* U+0637 ARABIC LETTER TAH */ pub const XKB_KEY_Arabic_zah :u32 = 0x05d8; /* U+0638 ARABIC LETTER ZAH */ pub const XKB_KEY_Arabic_ain :u32 = 0x05d9; /* U+0639 ARABIC LETTER AIN */ pub const XKB_KEY_Arabic_ghain :u32 = 0x05da; /* U+063A ARABIC LETTER GHAIN */ pub const XKB_KEY_Arabic_tatweel :u32 = 0x05e0; /* U+0640 ARABIC TATWEEL */ pub const XKB_KEY_Arabic_feh :u32 = 0x05e1; /* U+0641 ARABIC LETTER FEH */ pub const XKB_KEY_Arabic_qaf :u32 = 0x05e2; /* U+0642 ARABIC LETTER QAF */ pub const XKB_KEY_Arabic_kaf :u32 = 0x05e3; /* U+0643 ARABIC LETTER KAF */ pub const XKB_KEY_Arabic_lam :u32 = 0x05e4; /* U+0644 ARABIC LETTER LAM */ pub const XKB_KEY_Arabic_meem :u32 = 0x05e5; /* U+0645 ARABIC LETTER MEEM */ pub const XKB_KEY_Arabic_noon :u32 = 0x05e6; /* U+0646 ARABIC LETTER NOON */ pub const XKB_KEY_Arabic_ha :u32 = 0x05e7; /* U+0647 ARABIC LETTER HEH */ pub const XKB_KEY_Arabic_heh :u32 = 0x05e7; /* deprecated */ pub const XKB_KEY_Arabic_waw :u32 = 0x05e8; /* U+0648 ARABIC LETTER WAW */ pub const XKB_KEY_Arabic_alefmaksura :u32 = 0x05e9; /* U+0649 ARABIC LETTER ALEF MAKSURA */ pub const XKB_KEY_Arabic_yeh :u32 = 0x05ea; /* U+064A ARABIC LETTER YEH */ pub const XKB_KEY_Arabic_fathatan :u32 = 0x05eb; /* U+064B ARABIC FATHATAN */ pub const XKB_KEY_Arabic_dammatan :u32 = 0x05ec; /* U+064C ARABIC DAMMATAN */ pub const XKB_KEY_Arabic_kasratan :u32 = 0x05ed; /* U+064D ARABIC KASRATAN */ pub const XKB_KEY_Arabic_fatha :u32 = 0x05ee; /* U+064E ARABIC FATHA */ pub const XKB_KEY_Arabic_damma :u32 = 0x05ef; /* U+064F ARABIC DAMMA */ pub const XKB_KEY_Arabic_kasra :u32 = 0x05f0; /* U+0650 ARABIC KASRA */ pub const XKB_KEY_Arabic_shadda :u32 = 0x05f1; /* U+0651 ARABIC SHADDA */ pub const XKB_KEY_Arabic_sukun :u32 = 0x05f2; /* U+0652 ARABIC SUKUN */ pub const XKB_KEY_Arabic_madda_above :u32 = 0x1000653; /* U+0653 ARABIC MADDAH ABOVE */ pub const XKB_KEY_Arabic_hamza_above :u32 = 0x1000654; /* U+0654 ARABIC HAMZA ABOVE */ pub const XKB_KEY_Arabic_hamza_below :u32 = 0x1000655; /* U+0655 ARABIC HAMZA BELOW */ pub const XKB_KEY_Arabic_jeh :u32 = 0x1000698; /* U+0698 ARABIC LETTER JEH */ pub const XKB_KEY_Arabic_veh :u32 = 0x10006a4; /* U+06A4 ARABIC LETTER VEH */ pub const XKB_KEY_Arabic_keheh :u32 = 0x10006a9; /* U+06A9 ARABIC LETTER KEHEH */ pub const XKB_KEY_Arabic_gaf :u32 = 0x10006af; /* U+06AF ARABIC LETTER GAF */ pub const XKB_KEY_Arabic_noon_ghunna :u32 = 0x10006ba; /* U+06BA ARABIC LETTER NOON GHUNNA */ pub const XKB_KEY_Arabic_heh_doachashmee :u32 = 0x10006be; /* U+06BE ARABIC LETTER HEH DOACHASHMEE */ pub const XKB_KEY_Farsi_yeh :u32 = 0x10006cc; /* U+06CC ARABIC LETTER FARSI YEH */ pub const XKB_KEY_Arabic_farsi_yeh :u32 = 0x10006cc; /* U+06CC ARABIC LETTER FARSI YEH */ pub const XKB_KEY_Arabic_yeh_baree :u32 = 0x10006d2; /* U+06D2 ARABIC LETTER YEH BARREE */ pub const XKB_KEY_Arabic_heh_goal :u32 = 0x10006c1; /* U+06C1 ARABIC LETTER HEH GOAL */ pub const XKB_KEY_Arabic_switch :u32 = 0xff7e; /* Alias for mode_switch */ /* * Cyrillic * Byte 3 = 6 */ pub const XKB_KEY_Cyrillic_GHE_bar :u32 = 0x1000492; /* U+0492 CYRILLIC CAPITAL LETTER GHE WITH STROKE */ pub const XKB_KEY_Cyrillic_ghe_bar :u32 = 0x1000493; /* U+0493 CYRILLIC SMALL LETTER GHE WITH STROKE */ pub const XKB_KEY_Cyrillic_ZHE_descender :u32 = 0x1000496; /* U+0496 CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER */ pub const XKB_KEY_Cyrillic_zhe_descender :u32 = 0x1000497; /* U+0497 CYRILLIC SMALL LETTER ZHE WITH DESCENDER */ pub const XKB_KEY_Cyrillic_KA_descender :u32 = 0x100049a; /* U+049A CYRILLIC CAPITAL LETTER KA WITH DESCENDER */ pub const XKB_KEY_Cyrillic_ka_descender :u32 = 0x100049b; /* U+049B CYRILLIC SMALL LETTER KA WITH DESCENDER */ pub const XKB_KEY_Cyrillic_KA_vertstroke :u32 = 0x100049c; /* U+049C CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE */ pub const XKB_KEY_Cyrillic_ka_vertstroke :u32 = 0x100049d; /* U+049D CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE */ pub const XKB_KEY_Cyrillic_EN_descender :u32 = 0x10004a2; /* U+04A2 CYRILLIC CAPITAL LETTER EN WITH DESCENDER */ pub const XKB_KEY_Cyrillic_en_descender :u32 = 0x10004a3; /* U+04A3 CYRILLIC SMALL LETTER EN WITH DESCENDER */ pub const XKB_KEY_Cyrillic_U_straight :u32 = 0x10004ae; /* U+04AE CYRILLIC CAPITAL LETTER STRAIGHT U */ pub const XKB_KEY_Cyrillic_u_straight :u32 = 0x10004af; /* U+04AF CYRILLIC SMALL LETTER STRAIGHT U */ pub const XKB_KEY_Cyrillic_U_straight_bar :u32 = 0x10004b0; /* U+04B0 CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE */ pub const XKB_KEY_Cyrillic_u_straight_bar :u32 = 0x10004b1; /* U+04B1 CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE */ pub const XKB_KEY_Cyrillic_HA_descender :u32 = 0x10004b2; /* U+04B2 CYRILLIC CAPITAL LETTER HA WITH DESCENDER */ pub const XKB_KEY_Cyrillic_ha_descender :u32 = 0x10004b3; /* U+04B3 CYRILLIC SMALL LETTER HA WITH DESCENDER */ pub const XKB_KEY_Cyrillic_CHE_descender :u32 = 0x10004b6; /* U+04B6 CYRILLIC CAPITAL LETTER CHE WITH DESCENDER */ pub const XKB_KEY_Cyrillic_che_descender :u32 = 0x10004b7; /* U+04B7 CYRILLIC SMALL LETTER CHE WITH DESCENDER */ pub const XKB_KEY_Cyrillic_CHE_vertstroke :u32 = 0x10004b8; /* U+04B8 CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE */ pub const XKB_KEY_Cyrillic_che_vertstroke :u32 = 0x10004b9; /* U+04B9 CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE */ pub const XKB_KEY_Cyrillic_SHHA :u32 = 0x10004ba; /* U+04BA CYRILLIC CAPITAL LETTER SHHA */ pub const XKB_KEY_Cyrillic_shha :u32 = 0x10004bb; /* U+04BB CYRILLIC SMALL LETTER SHHA */ pub const XKB_KEY_Cyrillic_SCHWA :u32 = 0x10004d8; /* U+04D8 CYRILLIC CAPITAL LETTER SCHWA */ pub const XKB_KEY_Cyrillic_schwa :u32 = 0x10004d9; /* U+04D9 CYRILLIC SMALL LETTER SCHWA */ pub const XKB_KEY_Cyrillic_I_macron :u32 = 0x10004e2; /* U+04E2 CYRILLIC CAPITAL LETTER I WITH MACRON */ pub const XKB_KEY_Cyrillic_i_macron :u32 = 0x10004e3; /* U+04E3 CYRILLIC SMALL LETTER I WITH MACRON */ pub const XKB_KEY_Cyrillic_O_bar :u32 = 0x10004e8; /* U+04E8 CYRILLIC CAPITAL LETTER BARRED O */ pub const XKB_KEY_Cyrillic_o_bar :u32 = 0x10004e9; /* U+04E9 CYRILLIC SMALL LETTER BARRED O */ pub const XKB_KEY_Cyrillic_U_macron :u32 = 0x10004ee; /* U+04EE CYRILLIC CAPITAL LETTER U WITH MACRON */ pub const XKB_KEY_Cyrillic_u_macron :u32 = 0x10004ef; /* U+04EF CYRILLIC SMALL LETTER U WITH MACRON */ pub const XKB_KEY_Serbian_dje :u32 = 0x06a1; /* U+0452 CYRILLIC SMALL LETTER DJE */ pub const XKB_KEY_Macedonia_gje :u32 = 0x06a2; /* U+0453 CYRILLIC SMALL LETTER GJE */ pub const XKB_KEY_Cyrillic_io :u32 = 0x06a3; /* U+0451 CYRILLIC SMALL LETTER IO */ pub const XKB_KEY_Ukrainian_ie :u32 = 0x06a4; /* U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE */ pub const XKB_KEY_Ukranian_je :u32 = 0x06a4; /* deprecated */ pub const XKB_KEY_Macedonia_dse :u32 = 0x06a5; /* U+0455 CYRILLIC SMALL LETTER DZE */ pub const XKB_KEY_Ukrainian_i :u32 = 0x06a6; /* U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ pub const XKB_KEY_Ukranian_i :u32 = 0x06a6; /* deprecated */ pub const XKB_KEY_Ukrainian_yi :u32 = 0x06a7; /* U+0457 CYRILLIC SMALL LETTER YI */ pub const XKB_KEY_Ukranian_yi :u32 = 0x06a7; /* deprecated */ pub const XKB_KEY_Cyrillic_je :u32 = 0x06a8; /* U+0458 CYRILLIC SMALL LETTER JE */ pub const XKB_KEY_Serbian_je :u32 = 0x06a8; /* deprecated */ pub const XKB_KEY_Cyrillic_lje :u32 = 0x06a9; /* U+0459 CYRILLIC SMALL LETTER LJE */ pub const XKB_KEY_Serbian_lje :u32 = 0x06a9; /* deprecated */ pub const XKB_KEY_Cyrillic_nje :u32 = 0x06aa; /* U+045A CYRILLIC SMALL LETTER NJE */ pub const XKB_KEY_Serbian_nje :u32 = 0x06aa; /* deprecated */ pub const XKB_KEY_Serbian_tshe :u32 = 0x06ab; /* U+045B CYRILLIC SMALL LETTER TSHE */ pub const XKB_KEY_Macedonia_kje :u32 = 0x06ac; /* U+045C CYRILLIC SMALL LETTER KJE */ pub const XKB_KEY_Ukrainian_ghe_with_upturn :u32 = 0x06ad; /* U+0491 CYRILLIC SMALL LETTER GHE WITH UPTURN */ pub const XKB_KEY_Byelorussian_shortu :u32 = 0x06ae; /* U+045E CYRILLIC SMALL LETTER SHORT U */ pub const XKB_KEY_Cyrillic_dzhe :u32 = 0x06af; /* U+045F CYRILLIC SMALL LETTER DZHE */ pub const XKB_KEY_Serbian_dze :u32 = 0x06af; /* deprecated */ pub const XKB_KEY_numerosign :u32 = 0x06b0; /* U+2116 NUMERO SIGN */ pub const XKB_KEY_Serbian_DJE :u32 = 0x06b1; /* U+0402 CYRILLIC CAPITAL LETTER DJE */ pub const XKB_KEY_Macedonia_GJE :u32 = 0x06b2; /* U+0403 CYRILLIC CAPITAL LETTER GJE */ pub const XKB_KEY_Cyrillic_IO :u32 = 0x06b3; /* U+0401 CYRILLIC CAPITAL LETTER IO */ pub const XKB_KEY_Ukrainian_IE :u32 = 0x06b4; /* U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE */ pub const XKB_KEY_Ukranian_JE :u32 = 0x06b4; /* deprecated */ pub const XKB_KEY_Macedonia_DSE :u32 = 0x06b5; /* U+0405 CYRILLIC CAPITAL LETTER DZE */ pub const XKB_KEY_Ukrainian_I :u32 = 0x06b6; /* U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */ pub const XKB_KEY_Ukranian_I :u32 = 0x06b6; /* deprecated */ pub const XKB_KEY_Ukrainian_YI :u32 = 0x06b7; /* U+0407 CYRILLIC CAPITAL LETTER YI */ pub const XKB_KEY_Ukranian_YI :u32 = 0x06b7; /* deprecated */ pub const XKB_KEY_Cyrillic_JE :u32 = 0x06b8; /* U+0408 CYRILLIC CAPITAL LETTER JE */ pub const XKB_KEY_Serbian_JE :u32 = 0x06b8; /* deprecated */ pub const XKB_KEY_Cyrillic_LJE :u32 = 0x06b9; /* U+0409 CYRILLIC CAPITAL LETTER LJE */ pub const XKB_KEY_Serbian_LJE :u32 = 0x06b9; /* deprecated */ pub const XKB_KEY_Cyrillic_NJE :u32 = 0x06ba; /* U+040A CYRILLIC CAPITAL LETTER NJE */ pub const XKB_KEY_Serbian_NJE :u32 = 0x06ba; /* deprecated */ pub const XKB_KEY_Serbian_TSHE :u32 = 0x06bb; /* U+040B CYRILLIC CAPITAL LETTER TSHE */ pub const XKB_KEY_Macedonia_KJE :u32 = 0x06bc; /* U+040C CYRILLIC CAPITAL LETTER KJE */ pub const XKB_KEY_Ukrainian_GHE_WITH_UPTURN :u32 = 0x06bd; /* U+0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN */ pub const XKB_KEY_Byelorussian_SHORTU :u32 = 0x06be; /* U+040E CYRILLIC CAPITAL LETTER SHORT U */ pub const XKB_KEY_Cyrillic_DZHE :u32 = 0x06bf; /* U+040F CYRILLIC CAPITAL LETTER DZHE */ pub const XKB_KEY_Serbian_DZE :u32 = 0x06bf; /* deprecated */ pub const XKB_KEY_Cyrillic_yu :u32 = 0x06c0; /* U+044E CYRILLIC SMALL LETTER YU */ pub const XKB_KEY_Cyrillic_a :u32 = 0x06c1; /* U+0430 CYRILLIC SMALL LETTER A */ pub const XKB_KEY_Cyrillic_be :u32 = 0x06c2; /* U+0431 CYRILLIC SMALL LETTER BE */ pub const XKB_KEY_Cyrillic_tse :u32 = 0x06c3; /* U+0446 CYRILLIC SMALL LETTER TSE */ pub const XKB_KEY_Cyrillic_de :u32 = 0x06c4; /* U+0434 CYRILLIC SMALL LETTER DE */ pub const XKB_KEY_Cyrillic_ie :u32 = 0x06c5; /* U+0435 CYRILLIC SMALL LETTER IE */ pub const XKB_KEY_Cyrillic_ef :u32 = 0x06c6; /* U+0444 CYRILLIC SMALL LETTER EF */ pub const XKB_KEY_Cyrillic_ghe :u32 = 0x06c7; /* U+0433 CYRILLIC SMALL LETTER GHE */ pub const XKB_KEY_Cyrillic_ha :u32 = 0x06c8; /* U+0445 CYRILLIC SMALL LETTER HA */ pub const XKB_KEY_Cyrillic_i :u32 = 0x06c9; /* U+0438 CYRILLIC SMALL LETTER I */ pub const XKB_KEY_Cyrillic_shorti :u32 = 0x06ca; /* U+0439 CYRILLIC SMALL LETTER SHORT I */ pub const XKB_KEY_Cyrillic_ka :u32 = 0x06cb; /* U+043A CYRILLIC SMALL LETTER KA */ pub const XKB_KEY_Cyrillic_el :u32 = 0x06cc; /* U+043B CYRILLIC SMALL LETTER EL */ pub const XKB_KEY_Cyrillic_em :u32 = 0x06cd; /* U+043C CYRILLIC SMALL LETTER EM */ pub const XKB_KEY_Cyrillic_en :u32 = 0x06ce; /* U+043D CYRILLIC SMALL LETTER EN */ pub const XKB_KEY_Cyrillic_o :u32 = 0x06cf; /* U+043E CYRILLIC SMALL LETTER O */ pub const XKB_KEY_Cyrillic_pe :u32 = 0x06d0; /* U+043F CYRILLIC SMALL LETTER PE */ pub const XKB_KEY_Cyrillic_ya :u32 = 0x06d1; /* U+044F CYRILLIC SMALL LETTER YA */ pub const XKB_KEY_Cyrillic_er :u32 = 0x06d2; /* U+0440 CYRILLIC SMALL LETTER ER */ pub const XKB_KEY_Cyrillic_es :u32 = 0x06d3; /* U+0441 CYRILLIC SMALL LETTER ES */ pub const XKB_KEY_Cyrillic_te :u32 = 0x06d4; /* U+0442 CYRILLIC SMALL LETTER TE */ pub const XKB_KEY_Cyrillic_u :u32 = 0x06d5; /* U+0443 CYRILLIC SMALL LETTER U */ pub const XKB_KEY_Cyrillic_zhe :u32 = 0x06d6; /* U+0436 CYRILLIC SMALL LETTER ZHE */ pub const XKB_KEY_Cyrillic_ve :u32 = 0x06d7; /* U+0432 CYRILLIC SMALL LETTER VE */ pub const XKB_KEY_Cyrillic_softsign :u32 = 0x06d8; /* U+044C CYRILLIC SMALL LETTER SOFT SIGN */ pub const XKB_KEY_Cyrillic_yeru :u32 = 0x06d9; /* U+044B CYRILLIC SMALL LETTER YERU */ pub const XKB_KEY_Cyrillic_ze :u32 = 0x06da; /* U+0437 CYRILLIC SMALL LETTER ZE */ pub const XKB_KEY_Cyrillic_sha :u32 = 0x06db; /* U+0448 CYRILLIC SMALL LETTER SHA */ pub const XKB_KEY_Cyrillic_e :u32 = 0x06dc; /* U+044D CYRILLIC SMALL LETTER E */ pub const XKB_KEY_Cyrillic_shcha :u32 = 0x06dd; /* U+0449 CYRILLIC SMALL LETTER SHCHA */ pub const XKB_KEY_Cyrillic_che :u32 = 0x06de; /* U+0447 CYRILLIC SMALL LETTER CHE */ pub const XKB_KEY_Cyrillic_hardsign :u32 = 0x06df; /* U+044A CYRILLIC SMALL LETTER HARD SIGN */ pub const XKB_KEY_Cyrillic_YU :u32 = 0x06e0; /* U+042E CYRILLIC CAPITAL LETTER YU */ pub const XKB_KEY_Cyrillic_A :u32 = 0x06e1; /* U+0410 CYRILLIC CAPITAL LETTER A */ pub const XKB_KEY_Cyrillic_BE :u32 = 0x06e2; /* U+0411 CYRILLIC CAPITAL LETTER BE */ pub const XKB_KEY_Cyrillic_TSE :u32 = 0x06e3; /* U+0426 CYRILLIC CAPITAL LETTER TSE */ pub const XKB_KEY_Cyrillic_DE :u32 = 0x06e4; /* U+0414 CYRILLIC CAPITAL LETTER DE */ pub const XKB_KEY_Cyrillic_IE :u32 = 0x06e5; /* U+0415 CYRILLIC CAPITAL LETTER IE */ pub const XKB_KEY_Cyrillic_EF :u32 = 0x06e6; /* U+0424 CYRILLIC CAPITAL LETTER EF */ pub const XKB_KEY_Cyrillic_GHE :u32 = 0x06e7; /* U+0413 CYRILLIC CAPITAL LETTER GHE */ pub const XKB_KEY_Cyrillic_HA :u32 = 0x06e8; /* U+0425 CYRILLIC CAPITAL LETTER HA */ pub const XKB_KEY_Cyrillic_I :u32 = 0x06e9; /* U+0418 CYRILLIC CAPITAL LETTER I */ pub const XKB_KEY_Cyrillic_SHORTI :u32 = 0x06ea; /* U+0419 CYRILLIC CAPITAL LETTER SHORT I */ pub const XKB_KEY_Cyrillic_KA :u32 = 0x06eb; /* U+041A CYRILLIC CAPITAL LETTER KA */ pub const XKB_KEY_Cyrillic_EL :u32 = 0x06ec; /* U+041B CYRILLIC CAPITAL LETTER EL */ pub const XKB_KEY_Cyrillic_EM :u32 = 0x06ed; /* U+041C CYRILLIC CAPITAL LETTER EM */ pub const XKB_KEY_Cyrillic_EN :u32 = 0x06ee; /* U+041D CYRILLIC CAPITAL LETTER EN */ pub const XKB_KEY_Cyrillic_O :u32 = 0x06ef; /* U+041E CYRILLIC CAPITAL LETTER O */ pub const XKB_KEY_Cyrillic_PE :u32 = 0x06f0; /* U+041F CYRILLIC CAPITAL LETTER PE */ pub const XKB_KEY_Cyrillic_YA :u32 = 0x06f1; /* U+042F CYRILLIC CAPITAL LETTER YA */ pub const XKB_KEY_Cyrillic_ER :u32 = 0x06f2; /* U+0420 CYRILLIC CAPITAL LETTER ER */ pub const XKB_KEY_Cyrillic_ES :u32 = 0x06f3; /* U+0421 CYRILLIC CAPITAL LETTER ES */ pub const XKB_KEY_Cyrillic_TE :u32 = 0x06f4; /* U+0422 CYRILLIC CAPITAL LETTER TE */ pub const XKB_KEY_Cyrillic_U :u32 = 0x06f5; /* U+0423 CYRILLIC CAPITAL LETTER U */ pub const XKB_KEY_Cyrillic_ZHE :u32 = 0x06f6; /* U+0416 CYRILLIC CAPITAL LETTER ZHE */ pub const XKB_KEY_Cyrillic_VE :u32 = 0x06f7; /* U+0412 CYRILLIC CAPITAL LETTER VE */ pub const XKB_KEY_Cyrillic_SOFTSIGN :u32 = 0x06f8; /* U+042C CYRILLIC CAPITAL LETTER SOFT SIGN */ pub const XKB_KEY_Cyrillic_YERU :u32 = 0x06f9; /* U+042B CYRILLIC CAPITAL LETTER YERU */ pub const XKB_KEY_Cyrillic_ZE :u32 = 0x06fa; /* U+0417 CYRILLIC CAPITAL LETTER ZE */ pub const XKB_KEY_Cyrillic_SHA :u32 = 0x06fb; /* U+0428 CYRILLIC CAPITAL LETTER SHA */ pub const XKB_KEY_Cyrillic_E :u32 = 0x06fc; /* U+042D CYRILLIC CAPITAL LETTER E */ pub const XKB_KEY_Cyrillic_SHCHA :u32 = 0x06fd; /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ pub const XKB_KEY_Cyrillic_CHE :u32 = 0x06fe; /* U+0427 CYRILLIC CAPITAL LETTER CHE */ pub const XKB_KEY_Cyrillic_HARDSIGN :u32 = 0x06ff; /* U+042A CYRILLIC CAPITAL LETTER HARD SIGN */ /* * Greek * (based on an early draft of, and not quite identical to, ISO/IEC 8859-7) * Byte 3 = 7 */ pub const XKB_KEY_Greek_ALPHAaccent :u32 = 0x07a1; /* U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS */ pub const XKB_KEY_Greek_EPSILONaccent :u32 = 0x07a2; /* U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS */ pub const XKB_KEY_Greek_ETAaccent :u32 = 0x07a3; /* U+0389 GREEK CAPITAL LETTER ETA WITH TONOS */ pub const XKB_KEY_Greek_IOTAaccent :u32 = 0x07a4; /* U+038A GREEK CAPITAL LETTER IOTA WITH TONOS */ pub const XKB_KEY_Greek_IOTAdieresis :u32 = 0x07a5; /* U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ pub const XKB_KEY_Greek_IOTAdiaeresis :u32 = 0x07a5; /* old typo */ pub const XKB_KEY_Greek_OMICRONaccent :u32 = 0x07a7; /* U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS */ pub const XKB_KEY_Greek_UPSILONaccent :u32 = 0x07a8; /* U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS */ pub const XKB_KEY_Greek_UPSILONdieresis :u32 = 0x07a9; /* U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */ pub const XKB_KEY_Greek_OMEGAaccent :u32 = 0x07ab; /* U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS */ pub const XKB_KEY_Greek_accentdieresis :u32 = 0x07ae; /* U+0385 GREEK DIALYTIKA TONOS */ pub const XKB_KEY_Greek_horizbar :u32 = 0x07af; /* U+2015 HORIZONTAL BAR */ pub const XKB_KEY_Greek_alphaaccent :u32 = 0x07b1; /* U+03AC GREEK SMALL LETTER ALPHA WITH TONOS */ pub const XKB_KEY_Greek_epsilonaccent :u32 = 0x07b2; /* U+03AD GREEK SMALL LETTER EPSILON WITH TONOS */ pub const XKB_KEY_Greek_etaaccent :u32 = 0x07b3; /* U+03AE GREEK SMALL LETTER ETA WITH TONOS */ pub const XKB_KEY_Greek_iotaaccent :u32 = 0x07b4; /* U+03AF GREEK SMALL LETTER IOTA WITH TONOS */ pub const XKB_KEY_Greek_iotadieresis :u32 = 0x07b5; /* U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA */ pub const XKB_KEY_Greek_iotaaccentdieresis :u32 = 0x07b6; /* U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */ pub const XKB_KEY_Greek_omicronaccent :u32 = 0x07b7; /* U+03CC GREEK SMALL LETTER OMICRON WITH TONOS */ pub const XKB_KEY_Greek_upsilonaccent :u32 = 0x07b8; /* U+03CD GREEK SMALL LETTER UPSILON WITH TONOS */ pub const XKB_KEY_Greek_upsilondieresis :u32 = 0x07b9; /* U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA */ pub const XKB_KEY_Greek_upsilonaccentdieresis :u32 = 0x07ba; /* U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */ pub const XKB_KEY_Greek_omegaaccent :u32 = 0x07bb; /* U+03CE GREEK SMALL LETTER OMEGA WITH TONOS */ pub const XKB_KEY_Greek_ALPHA :u32 = 0x07c1; /* U+0391 GREEK CAPITAL LETTER ALPHA */ pub const XKB_KEY_Greek_BETA :u32 = 0x07c2; /* U+0392 GREEK CAPITAL LETTER BETA */ pub const XKB_KEY_Greek_GAMMA :u32 = 0x07c3; /* U+0393 GREEK CAPITAL LETTER GAMMA */ pub const XKB_KEY_Greek_DELTA :u32 = 0x07c4; /* U+0394 GREEK CAPITAL LETTER DELTA */ pub const XKB_KEY_Greek_EPSILON :u32 = 0x07c5; /* U+0395 GREEK CAPITAL LETTER EPSILON */ pub const XKB_KEY_Greek_ZETA :u32 = 0x07c6; /* U+0396 GREEK CAPITAL LETTER ZETA */ pub const XKB_KEY_Greek_ETA :u32 = 0x07c7; /* U+0397 GREEK CAPITAL LETTER ETA */ pub const XKB_KEY_Greek_THETA :u32 = 0x07c8; /* U+0398 GREEK CAPITAL LETTER THETA */ pub const XKB_KEY_Greek_IOTA :u32 = 0x07c9; /* U+0399 GREEK CAPITAL LETTER IOTA */ pub const XKB_KEY_Greek_KAPPA :u32 = 0x07ca; /* U+039A GREEK CAPITAL LETTER KAPPA */ pub const XKB_KEY_Greek_LAMDA :u32 = 0x07cb; /* U+039B GREEK CAPITAL LETTER LAMDA */ pub const XKB_KEY_Greek_LAMBDA :u32 = 0x07cb; /* U+039B GREEK CAPITAL LETTER LAMDA */ pub const XKB_KEY_Greek_MU :u32 = 0x07cc; /* U+039C GREEK CAPITAL LETTER MU */ pub const XKB_KEY_Greek_NU :u32 = 0x07cd; /* U+039D GREEK CAPITAL LETTER NU */ pub const XKB_KEY_Greek_XI :u32 = 0x07ce; /* U+039E GREEK CAPITAL LETTER XI */ pub const XKB_KEY_Greek_OMICRON :u32 = 0x07cf; /* U+039F GREEK CAPITAL LETTER OMICRON */ pub const XKB_KEY_Greek_PI :u32 = 0x07d0; /* U+03A0 GREEK CAPITAL LETTER PI */ pub const XKB_KEY_Greek_RHO :u32 = 0x07d1; /* U+03A1 GREEK CAPITAL LETTER RHO */ pub const XKB_KEY_Greek_SIGMA :u32 = 0x07d2; /* U+03A3 GREEK CAPITAL LETTER SIGMA */ pub const XKB_KEY_Greek_TAU :u32 = 0x07d4; /* U+03A4 GREEK CAPITAL LETTER TAU */ pub const XKB_KEY_Greek_UPSILON :u32 = 0x07d5; /* U+03A5 GREEK CAPITAL LETTER UPSILON */ pub const XKB_KEY_Greek_PHI :u32 = 0x07d6; /* U+03A6 GREEK CAPITAL LETTER PHI */ pub const XKB_KEY_Greek_CHI :u32 = 0x07d7; /* U+03A7 GREEK CAPITAL LETTER CHI */ pub const XKB_KEY_Greek_PSI :u32 = 0x07d8; /* U+03A8 GREEK CAPITAL LETTER PSI */ pub const XKB_KEY_Greek_OMEGA :u32 = 0x07d9; /* U+03A9 GREEK CAPITAL LETTER OMEGA */ pub const XKB_KEY_Greek_alpha :u32 = 0x07e1; /* U+03B1 GREEK SMALL LETTER ALPHA */ pub const XKB_KEY_Greek_beta :u32 = 0x07e2; /* U+03B2 GREEK SMALL LETTER BETA */ pub const XKB_KEY_Greek_gamma :u32 = 0x07e3; /* U+03B3 GREEK SMALL LETTER GAMMA */ pub const XKB_KEY_Greek_delta :u32 = 0x07e4; /* U+03B4 GREEK SMALL LETTER DELTA */ pub const XKB_KEY_Greek_epsilon :u32 = 0x07e5; /* U+03B5 GREEK SMALL LETTER EPSILON */ pub const XKB_KEY_Greek_zeta :u32 = 0x07e6; /* U+03B6 GREEK SMALL LETTER ZETA */ pub const XKB_KEY_Greek_eta :u32 = 0x07e7; /* U+03B7 GREEK SMALL LETTER ETA */ pub const XKB_KEY_Greek_theta :u32 = 0x07e8; /* U+03B8 GREEK SMALL LETTER THETA */ pub const XKB_KEY_Greek_iota :u32 = 0x07e9; /* U+03B9 GREEK SMALL LETTER IOTA */ pub const XKB_KEY_Greek_kappa :u32 = 0x07ea; /* U+03BA GREEK SMALL LETTER KAPPA */ pub const XKB_KEY_Greek_lamda :u32 = 0x07eb; /* U+03BB GREEK SMALL LETTER LAMDA */ pub const XKB_KEY_Greek_lambda :u32 = 0x07eb; /* U+03BB GREEK SMALL LETTER LAMDA */ pub const XKB_KEY_Greek_mu :u32 = 0x07ec; /* U+03BC GREEK SMALL LETTER MU */ pub const XKB_KEY_Greek_nu :u32 = 0x07ed; /* U+03BD GREEK SMALL LETTER NU */ pub const XKB_KEY_Greek_xi :u32 = 0x07ee; /* U+03BE GREEK SMALL LETTER XI */ pub const XKB_KEY_Greek_omicron :u32 = 0x07ef; /* U+03BF GREEK SMALL LETTER OMICRON */ pub const XKB_KEY_Greek_pi :u32 = 0x07f0; /* U+03C0 GREEK SMALL LETTER PI */ pub const XKB_KEY_Greek_rho :u32 = 0x07f1; /* U+03C1 GREEK SMALL LETTER RHO */ pub const XKB_KEY_Greek_sigma :u32 = 0x07f2; /* U+03C3 GREEK SMALL LETTER SIGMA */ pub const XKB_KEY_Greek_finalsmallsigma :u32 = 0x07f3; /* U+03C2 GREEK SMALL LETTER FINAL SIGMA */ pub const XKB_KEY_Greek_tau :u32 = 0x07f4; /* U+03C4 GREEK SMALL LETTER TAU */ pub const XKB_KEY_Greek_upsilon :u32 = 0x07f5; /* U+03C5 GREEK SMALL LETTER UPSILON */ pub const XKB_KEY_Greek_phi :u32 = 0x07f6; /* U+03C6 GREEK SMALL LETTER PHI */ pub const XKB_KEY_Greek_chi :u32 = 0x07f7; /* U+03C7 GREEK SMALL LETTER CHI */ pub const XKB_KEY_Greek_psi :u32 = 0x07f8; /* U+03C8 GREEK SMALL LETTER PSI */ pub const XKB_KEY_Greek_omega :u32 = 0x07f9; /* U+03C9 GREEK SMALL LETTER OMEGA */ pub const XKB_KEY_Greek_switch :u32 = 0xff7e; /* Alias for mode_switch */ /* * Technical * (from the DEC VT330/VT420 Technical Character Set, http://vt100.net/charsets/technical.html) * Byte 3 = 8 */ pub const XKB_KEY_leftradical :u32 = 0x08a1; /* U+23B7 RADICAL SYMBOL BOTTOM */ pub const XKB_KEY_topleftradical :u32 = 0x08a2; /*(U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT)*/ pub const XKB_KEY_horizconnector :u32 = 0x08a3; /*(U+2500 BOX DRAWINGS LIGHT HORIZONTAL)*/ pub const XKB_KEY_topintegral :u32 = 0x08a4; /* U+2320 TOP HALF INTEGRAL */ pub const XKB_KEY_botintegral :u32 = 0x08a5; /* U+2321 BOTTOM HALF INTEGRAL */ pub const XKB_KEY_vertconnector :u32 = 0x08a6; /*(U+2502 BOX DRAWINGS LIGHT VERTICAL)*/ pub const XKB_KEY_topleftsqbracket :u32 = 0x08a7; /* U+23A1 LEFT SQUARE BRACKET UPPER CORNER */ pub const XKB_KEY_botleftsqbracket :u32 = 0x08a8; /* U+23A3 LEFT SQUARE BRACKET LOWER CORNER */ pub const XKB_KEY_toprightsqbracket :u32 = 0x08a9; /* U+23A4 RIGHT SQUARE BRACKET UPPER CORNER */ pub const XKB_KEY_botrightsqbracket :u32 = 0x08aa; /* U+23A6 RIGHT SQUARE BRACKET LOWER CORNER */ pub const XKB_KEY_topleftparens :u32 = 0x08ab; /* U+239B LEFT PARENTHESIS UPPER HOOK */ pub const XKB_KEY_botleftparens :u32 = 0x08ac; /* U+239D LEFT PARENTHESIS LOWER HOOK */ pub const XKB_KEY_toprightparens :u32 = 0x08ad; /* U+239E RIGHT PARENTHESIS UPPER HOOK */ pub const XKB_KEY_botrightparens :u32 = 0x08ae; /* U+23A0 RIGHT PARENTHESIS LOWER HOOK */ pub const XKB_KEY_leftmiddlecurlybrace :u32 = 0x08af; /* U+23A8 LEFT CURLY BRACKET MIDDLE PIECE */ pub const XKB_KEY_rightmiddlecurlybrace :u32 = 0x08b0; /* U+23AC RIGHT CURLY BRACKET MIDDLE PIECE */ pub const XKB_KEY_topleftsummation :u32 = 0x08b1; pub const XKB_KEY_botleftsummation :u32 = 0x08b2; pub const XKB_KEY_topvertsummationconnector :u32 = 0x08b3; pub const XKB_KEY_botvertsummationconnector :u32 = 0x08b4; pub const XKB_KEY_toprightsummation :u32 = 0x08b5; pub const XKB_KEY_botrightsummation :u32 = 0x08b6; pub const XKB_KEY_rightmiddlesummation :u32 = 0x08b7; pub const XKB_KEY_lessthanequal :u32 = 0x08bc; /* U+2264 LESS-THAN OR EQUAL TO */ pub const XKB_KEY_notequal :u32 = 0x08bd; /* U+2260 NOT EQUAL TO */ pub const XKB_KEY_greaterthanequal :u32 = 0x08be; /* U+2265 GREATER-THAN OR EQUAL TO */ pub const XKB_KEY_integral :u32 = 0x08bf; /* U+222B INTEGRAL */ pub const XKB_KEY_therefore :u32 = 0x08c0; /* U+2234 THEREFORE */ pub const XKB_KEY_variation :u32 = 0x08c1; /* U+221D PROPORTIONAL TO */ pub const XKB_KEY_infinity :u32 = 0x08c2; /* U+221E INFINITY */ pub const XKB_KEY_nabla :u32 = 0x08c5; /* U+2207 NABLA */ pub const XKB_KEY_approximate :u32 = 0x08c8; /* U+223C TILDE OPERATOR */ pub const XKB_KEY_similarequal :u32 = 0x08c9; /* U+2243 ASYMPTOTICALLY EQUAL TO */ pub const XKB_KEY_ifonlyif :u32 = 0x08cd; /* U+21D4 LEFT RIGHT DOUBLE ARROW */ pub const XKB_KEY_implies :u32 = 0x08ce; /* U+21D2 RIGHTWARDS DOUBLE ARROW */ pub const XKB_KEY_identical :u32 = 0x08cf; /* U+2261 IDENTICAL TO */ pub const XKB_KEY_radical :u32 = 0x08d6; /* U+221A SQUARE ROOT */ pub const XKB_KEY_includedin :u32 = 0x08da; /* U+2282 SUBSET OF */ pub const XKB_KEY_includes :u32 = 0x08db; /* U+2283 SUPERSET OF */ pub const XKB_KEY_intersection :u32 = 0x08dc; /* U+2229 INTERSECTION */ pub const XKB_KEY_union :u32 = 0x08dd; /* U+222A UNION */ pub const XKB_KEY_logicaland :u32 = 0x08de; /* U+2227 LOGICAL AND */ pub const XKB_KEY_logicalor :u32 = 0x08df; /* U+2228 LOGICAL OR */ pub const XKB_KEY_partialderivative :u32 = 0x08ef; /* U+2202 PARTIAL DIFFERENTIAL */ pub const XKB_KEY_function :u32 = 0x08f6; /* U+0192 LATIN SMALL LETTER F WITH HOOK */ pub const XKB_KEY_leftarrow :u32 = 0x08fb; /* U+2190 LEFTWARDS ARROW */ pub const XKB_KEY_uparrow :u32 = 0x08fc; /* U+2191 UPWARDS ARROW */ pub const XKB_KEY_rightarrow :u32 = 0x08fd; /* U+2192 RIGHTWARDS ARROW */ pub const XKB_KEY_downarrow :u32 = 0x08fe; /* U+2193 DOWNWARDS ARROW */ /* * Special * (from the DEC VT100 Special Graphics Character Set) * Byte 3 = 9 */ pub const XKB_KEY_blank :u32 = 0x09df; pub const XKB_KEY_soliddiamond :u32 = 0x09e0; /* U+25C6 BLACK DIAMOND */ pub const XKB_KEY_checkerboard :u32 = 0x09e1; /* U+2592 MEDIUM SHADE */ pub const XKB_KEY_ht :u32 = 0x09e2; /* U+2409 SYMBOL FOR HORIZONTAL TABULATION */ pub const XKB_KEY_ff :u32 = 0x09e3; /* U+240C SYMBOL FOR FORM FEED */ pub const XKB_KEY_cr :u32 = 0x09e4; /* U+240D SYMBOL FOR CARRIAGE RETURN */ pub const XKB_KEY_lf :u32 = 0x09e5; /* U+240A SYMBOL FOR LINE FEED */ pub const XKB_KEY_nl :u32 = 0x09e8; /* U+2424 SYMBOL FOR NEWLINE */ pub const XKB_KEY_vt :u32 = 0x09e9; /* U+240B SYMBOL FOR VERTICAL TABULATION */ pub const XKB_KEY_lowrightcorner :u32 = 0x09ea; /* U+2518 BOX DRAWINGS LIGHT UP AND LEFT */ pub const XKB_KEY_uprightcorner :u32 = 0x09eb; /* U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT */ pub const XKB_KEY_upleftcorner :u32 = 0x09ec; /* U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT */ pub const XKB_KEY_lowleftcorner :u32 = 0x09ed; /* U+2514 BOX DRAWINGS LIGHT UP AND RIGHT */ pub const XKB_KEY_crossinglines :u32 = 0x09ee; /* U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ pub const XKB_KEY_horizlinescan1 :u32 = 0x09ef; /* U+23BA HORIZONTAL SCAN LINE-1 */ pub const XKB_KEY_horizlinescan3 :u32 = 0x09f0; /* U+23BB HORIZONTAL SCAN LINE-3 */ pub const XKB_KEY_horizlinescan5 :u32 = 0x09f1; /* U+2500 BOX DRAWINGS LIGHT HORIZONTAL */ pub const XKB_KEY_horizlinescan7 :u32 = 0x09f2; /* U+23BC HORIZONTAL SCAN LINE-7 */ pub const XKB_KEY_horizlinescan9 :u32 = 0x09f3; /* U+23BD HORIZONTAL SCAN LINE-9 */ pub const XKB_KEY_leftt :u32 = 0x09f4; /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ pub const XKB_KEY_rightt :u32 = 0x09f5; /* U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT */ pub const XKB_KEY_bott :u32 = 0x09f6; /* U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL */ pub const XKB_KEY_topt :u32 = 0x09f7; /* U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */ pub const XKB_KEY_vertbar :u32 = 0x09f8; /* U+2502 BOX DRAWINGS LIGHT VERTICAL */ /* * Publishing * (these are probably from a long forgotten DEC Publishing * font that once shipped with DECwrite) * Byte 3 = :u32 = 0x0a; */ pub const XKB_KEY_emspace :u32 = 0x0aa1; /* U+2003 EM SPACE */ pub const XKB_KEY_enspace :u32 = 0x0aa2; /* U+2002 EN SPACE */ pub const XKB_KEY_em3space :u32 = 0x0aa3; /* U+2004 THREE-PER-EM SPACE */ pub const XKB_KEY_em4space :u32 = 0x0aa4; /* U+2005 FOUR-PER-EM SPACE */ pub const XKB_KEY_digitspace :u32 = 0x0aa5; /* U+2007 FIGURE SPACE */ pub const XKB_KEY_punctspace :u32 = 0x0aa6; /* U+2008 PUNCTUATION SPACE */ pub const XKB_KEY_thinspace :u32 = 0x0aa7; /* U+2009 THIN SPACE */ pub const XKB_KEY_hairspace :u32 = 0x0aa8; /* U+200A HAIR SPACE */ pub const XKB_KEY_emdash :u32 = 0x0aa9; /* U+2014 EM DASH */ pub const XKB_KEY_endash :u32 = 0x0aaa; /* U+2013 EN DASH */ pub const XKB_KEY_signifblank :u32 = 0x0aac; /*(U+2423 OPEN BOX)*/ pub const XKB_KEY_ellipsis :u32 = 0x0aae; /* U+2026 HORIZONTAL ELLIPSIS */ pub const XKB_KEY_doubbaselinedot :u32 = 0x0aaf; /* U+2025 TWO DOT LEADER */ pub const XKB_KEY_onethird :u32 = 0x0ab0; /* U+2153 VULGAR FRACTION ONE THIRD */ pub const XKB_KEY_twothirds :u32 = 0x0ab1; /* U+2154 VULGAR FRACTION TWO THIRDS */ pub const XKB_KEY_onefifth :u32 = 0x0ab2; /* U+2155 VULGAR FRACTION ONE FIFTH */ pub const XKB_KEY_twofifths :u32 = 0x0ab3; /* U+2156 VULGAR FRACTION TWO FIFTHS */ pub const XKB_KEY_threefifths :u32 = 0x0ab4; /* U+2157 VULGAR FRACTION THREE FIFTHS */ pub const XKB_KEY_fourfifths :u32 = 0x0ab5; /* U+2158 VULGAR FRACTION FOUR FIFTHS */ pub const XKB_KEY_onesixth :u32 = 0x0ab6; /* U+2159 VULGAR FRACTION ONE SIXTH */ pub const XKB_KEY_fivesixths :u32 = 0x0ab7; /* U+215A VULGAR FRACTION FIVE SIXTHS */ pub const XKB_KEY_careof :u32 = 0x0ab8; /* U+2105 CARE OF */ pub const XKB_KEY_figdash :u32 = 0x0abb; /* U+2012 FIGURE DASH */ pub const XKB_KEY_leftanglebracket :u32 = 0x0abc; /*(U+27E8 MATHEMATICAL LEFT ANGLE BRACKET)*/ pub const XKB_KEY_decimalpoint :u32 = 0x0abd; /*(U+002E FULL STOP)*/ pub const XKB_KEY_rightanglebracket :u32 = 0x0abe; /*(U+27E9 MATHEMATICAL RIGHT ANGLE BRACKET)*/ pub const XKB_KEY_marker :u32 = 0x0abf; pub const XKB_KEY_oneeighth :u32 = 0x0ac3; /* U+215B VULGAR FRACTION ONE EIGHTH */ pub const XKB_KEY_threeeighths :u32 = 0x0ac4; /* U+215C VULGAR FRACTION THREE EIGHTHS */ pub const XKB_KEY_fiveeighths :u32 = 0x0ac5; /* U+215D VULGAR FRACTION FIVE EIGHTHS */ pub const XKB_KEY_seveneighths :u32 = 0x0ac6; /* U+215E VULGAR FRACTION SEVEN EIGHTHS */ pub const XKB_KEY_trademark :u32 = 0x0ac9; /* U+2122 TRADE MARK SIGN */ pub const XKB_KEY_signaturemark :u32 = 0x0aca; /*(U+2613 SALTIRE)*/ pub const XKB_KEY_trademarkincircle :u32 = 0x0acb; pub const XKB_KEY_leftopentriangle :u32 = 0x0acc; /*(U+25C1 WHITE LEFT-POINTING TRIANGLE)*/ pub const XKB_KEY_rightopentriangle :u32 = 0x0acd; /*(U+25B7 WHITE RIGHT-POINTING TRIANGLE)*/ pub const XKB_KEY_emopencircle :u32 = 0x0ace; /*(U+25CB WHITE CIRCLE)*/ pub const XKB_KEY_emopenrectangle :u32 = 0x0acf; /*(U+25AF WHITE VERTICAL RECTANGLE)*/ pub const XKB_KEY_leftsinglequotemark :u32 = 0x0ad0; /* U+2018 LEFT SINGLE QUOTATION MARK */ pub const XKB_KEY_rightsinglequotemark :u32 = 0x0ad1; /* U+2019 RIGHT SINGLE QUOTATION MARK */ pub const XKB_KEY_leftdoublequotemark :u32 = 0x0ad2; /* U+201C LEFT DOUBLE QUOTATION MARK */ pub const XKB_KEY_rightdoublequotemark :u32 = 0x0ad3; /* U+201D RIGHT DOUBLE QUOTATION MARK */ pub const XKB_KEY_prescription :u32 = 0x0ad4; /* U+211E PRESCRIPTION TAKE */ pub const XKB_KEY_permille :u32 = 0x0ad5; /* U+2030 PER MILLE SIGN */ pub const XKB_KEY_minutes :u32 = 0x0ad6; /* U+2032 PRIME */ pub const XKB_KEY_seconds :u32 = 0x0ad7; /* U+2033 DOUBLE PRIME */ pub const XKB_KEY_latincross :u32 = 0x0ad9; /* U+271D LATIN CROSS */ pub const XKB_KEY_hexagram :u32 = 0x0ada; pub const XKB_KEY_filledrectbullet :u32 = 0x0adb; /*(U+25AC BLACK RECTANGLE)*/ pub const XKB_KEY_filledlefttribullet :u32 = 0x0adc; /*(U+25C0 BLACK LEFT-POINTING TRIANGLE)*/ pub const XKB_KEY_filledrighttribullet :u32 = 0x0add; /*(U+25B6 BLACK RIGHT-POINTING TRIANGLE)*/ pub const XKB_KEY_emfilledcircle :u32 = 0x0ade; /*(U+25CF BLACK CIRCLE)*/ pub const XKB_KEY_emfilledrect :u32 = 0x0adf; /*(U+25AE BLACK VERTICAL RECTANGLE)*/ pub const XKB_KEY_enopencircbullet :u32 = 0x0ae0; /*(U+25E6 WHITE BULLET)*/ pub const XKB_KEY_enopensquarebullet :u32 = 0x0ae1; /*(U+25AB WHITE SMALL SQUARE)*/ pub const XKB_KEY_openrectbullet :u32 = 0x0ae2; /*(U+25AD WHITE RECTANGLE)*/ pub const XKB_KEY_opentribulletup :u32 = 0x0ae3; /*(U+25B3 WHITE UP-POINTING TRIANGLE)*/ pub const XKB_KEY_opentribulletdown :u32 = 0x0ae4; /*(U+25BD WHITE DOWN-POINTING TRIANGLE)*/ pub const XKB_KEY_openstar :u32 = 0x0ae5; /*(U+2606 WHITE STAR)*/ pub const XKB_KEY_enfilledcircbullet :u32 = 0x0ae6; /*(U+2022 BULLET)*/ pub const XKB_KEY_enfilledsqbullet :u32 = 0x0ae7; /*(U+25AA BLACK SMALL SQUARE)*/ pub const XKB_KEY_filledtribulletup :u32 = 0x0ae8; /*(U+25B2 BLACK UP-POINTING TRIANGLE)*/ pub const XKB_KEY_filledtribulletdown :u32 = 0x0ae9; /*(U+25BC BLACK DOWN-POINTING TRIANGLE)*/ pub const XKB_KEY_leftpointer :u32 = 0x0aea; /*(U+261C WHITE LEFT POINTING INDEX)*/ pub const XKB_KEY_rightpointer :u32 = 0x0aeb; /*(U+261E WHITE RIGHT POINTING INDEX)*/ pub const XKB_KEY_club :u32 = 0x0aec; /* U+2663 BLACK CLUB SUIT */ pub const XKB_KEY_diamond :u32 = 0x0aed; /* U+2666 BLACK DIAMOND SUIT */ pub const XKB_KEY_heart :u32 = 0x0aee; /* U+2665 BLACK HEART SUIT */ pub const XKB_KEY_maltesecross :u32 = 0x0af0; /* U+2720 MALTESE CROSS */ pub const XKB_KEY_dagger :u32 = 0x0af1; /* U+2020 DAGGER */ pub const XKB_KEY_doubledagger :u32 = 0x0af2; /* U+2021 DOUBLE DAGGER */ pub const XKB_KEY_checkmark :u32 = 0x0af3; /* U+2713 CHECK MARK */ pub const XKB_KEY_ballotcross :u32 = 0x0af4; /* U+2717 BALLOT X */ pub const XKB_KEY_musicalsharp :u32 = 0x0af5; /* U+266F MUSIC SHARP SIGN */ pub const XKB_KEY_musicalflat :u32 = 0x0af6; /* U+266D MUSIC FLAT SIGN */ pub const XKB_KEY_malesymbol :u32 = 0x0af7; /* U+2642 MALE SIGN */ pub const XKB_KEY_femalesymbol :u32 = 0x0af8; /* U+2640 FEMALE SIGN */ pub const XKB_KEY_telephone :u32 = 0x0af9; /* U+260E BLACK TELEPHONE */ pub const XKB_KEY_telephonerecorder :u32 = 0x0afa; /* U+2315 TELEPHONE RECORDER */ pub const XKB_KEY_phonographcopyright :u32 = 0x0afb; /* U+2117 SOUND RECORDING COPYRIGHT */ pub const XKB_KEY_caret :u32 = 0x0afc; /* U+2038 CARET */ pub const XKB_KEY_singlelowquotemark :u32 = 0x0afd; /* U+201A SINGLE LOW-9 QUOTATION MARK */ pub const XKB_KEY_doublelowquotemark :u32 = 0x0afe; /* U+201E DOUBLE LOW-9 QUOTATION MARK */ pub const XKB_KEY_cursor :u32 = 0x0aff; /* * APL * Byte 3 = :u32 = 0x0b; */ pub const XKB_KEY_leftcaret :u32 = 0x0ba3; /*(U+003C LESS-THAN SIGN)*/ pub const XKB_KEY_rightcaret :u32 = 0x0ba6; /*(U+003E GREATER-THAN SIGN)*/ pub const XKB_KEY_downcaret :u32 = 0x0ba8; /*(U+2228 LOGICAL OR)*/ pub const XKB_KEY_upcaret :u32 = 0x0ba9; /*(U+2227 LOGICAL AND)*/ pub const XKB_KEY_overbar :u32 = 0x0bc0; /*(U+00AF MACRON)*/ pub const XKB_KEY_downtack :u32 = 0x0bc2; /* U+22A4 DOWN TACK */ pub const XKB_KEY_upshoe :u32 = 0x0bc3; /*(U+2229 INTERSECTION)*/ pub const XKB_KEY_downstile :u32 = 0x0bc4; /* U+230A LEFT FLOOR */ pub const XKB_KEY_underbar :u32 = 0x0bc6; /*(U+005F LOW LINE)*/ pub const XKB_KEY_jot :u32 = 0x0bca; /* U+2218 RING OPERATOR */ pub const XKB_KEY_quad :u32 = 0x0bcc; /* U+2395 APL FUNCTIONAL SYMBOL QUAD */ pub const XKB_KEY_uptack :u32 = 0x0bce; /* U+22A5 UP TACK */ pub const XKB_KEY_circle :u32 = 0x0bcf; /* U+25CB WHITE CIRCLE */ pub const XKB_KEY_upstile :u32 = 0x0bd3; /* U+2308 LEFT CEILING */ pub const XKB_KEY_downshoe :u32 = 0x0bd6; /*(U+222A UNION)*/ pub const XKB_KEY_rightshoe :u32 = 0x0bd8; /*(U+2283 SUPERSET OF)*/ pub const XKB_KEY_leftshoe :u32 = 0x0bda; /*(U+2282 SUBSET OF)*/ pub const XKB_KEY_lefttack :u32 = 0x0bdc; /* U+22A3 LEFT TACK */ pub const XKB_KEY_righttack :u32 = 0x0bfc; /* U+22A2 RIGHT TACK */ /* * Hebrew * Byte 3 = :u32 = 0x0c; */ pub const XKB_KEY_hebrew_doublelowline :u32 = 0x0cdf; /* U+2017 DOUBLE LOW LINE */ pub const XKB_KEY_hebrew_aleph :u32 = 0x0ce0; /* U+05D0 HEBREW LETTER ALEF */ pub const XKB_KEY_hebrew_bet :u32 = 0x0ce1; /* U+05D1 HEBREW LETTER BET */ pub const XKB_KEY_hebrew_beth :u32 = 0x0ce1; /* deprecated */ pub const XKB_KEY_hebrew_gimel :u32 = 0x0ce2; /* U+05D2 HEBREW LETTER GIMEL */ pub const XKB_KEY_hebrew_gimmel :u32 = 0x0ce2; /* deprecated */ pub const XKB_KEY_hebrew_dalet :u32 = 0x0ce3; /* U+05D3 HEBREW LETTER DALET */ pub const XKB_KEY_hebrew_daleth :u32 = 0x0ce3; /* deprecated */ pub const XKB_KEY_hebrew_he :u32 = 0x0ce4; /* U+05D4 HEBREW LETTER HE */ pub const XKB_KEY_hebrew_waw :u32 = 0x0ce5; /* U+05D5 HEBREW LETTER VAV */ pub const XKB_KEY_hebrew_zain :u32 = 0x0ce6; /* U+05D6 HEBREW LETTER ZAYIN */ pub const XKB_KEY_hebrew_zayin :u32 = 0x0ce6; /* deprecated */ pub const XKB_KEY_hebrew_chet :u32 = 0x0ce7; /* U+05D7 HEBREW LETTER HET */ pub const XKB_KEY_hebrew_het :u32 = 0x0ce7; /* deprecated */ pub const XKB_KEY_hebrew_tet :u32 = 0x0ce8; /* U+05D8 HEBREW LETTER TET */ pub const XKB_KEY_hebrew_teth :u32 = 0x0ce8; /* deprecated */ pub const XKB_KEY_hebrew_yod :u32 = 0x0ce9; /* U+05D9 HEBREW LETTER YOD */ pub const XKB_KEY_hebrew_finalkaph :u32 = 0x0cea; /* U+05DA HEBREW LETTER FINAL KAF */ pub const XKB_KEY_hebrew_kaph :u32 = 0x0ceb; /* U+05DB HEBREW LETTER KAF */ pub const XKB_KEY_hebrew_lamed :u32 = 0x0cec; /* U+05DC HEBREW LETTER LAMED */ pub const XKB_KEY_hebrew_finalmem :u32 = 0x0ced; /* U+05DD HEBREW LETTER FINAL MEM */ pub const XKB_KEY_hebrew_mem :u32 = 0x0cee; /* U+05DE HEBREW LETTER MEM */ pub const XKB_KEY_hebrew_finalnun :u32 = 0x0cef; /* U+05DF HEBREW LETTER FINAL NUN */ pub const XKB_KEY_hebrew_nun :u32 = 0x0cf0; /* U+05E0 HEBREW LETTER NUN */ pub const XKB_KEY_hebrew_samech :u32 = 0x0cf1; /* U+05E1 HEBREW LETTER SAMEKH */ pub const XKB_KEY_hebrew_samekh :u32 = 0x0cf1; /* deprecated */ pub const XKB_KEY_hebrew_ayin :u32 = 0x0cf2; /* U+05E2 HEBREW LETTER AYIN */ pub const XKB_KEY_hebrew_finalpe :u32 = 0x0cf3; /* U+05E3 HEBREW LETTER FINAL PE */ pub const XKB_KEY_hebrew_pe :u32 = 0x0cf4; /* U+05E4 HEBREW LETTER PE */ pub const XKB_KEY_hebrew_finalzade :u32 = 0x0cf5; /* U+05E5 HEBREW LETTER FINAL TSADI */ pub const XKB_KEY_hebrew_finalzadi :u32 = 0x0cf5; /* deprecated */ pub const XKB_KEY_hebrew_zade :u32 = 0x0cf6; /* U+05E6 HEBREW LETTER TSADI */ pub const XKB_KEY_hebrew_zadi :u32 = 0x0cf6; /* deprecated */ pub const XKB_KEY_hebrew_qoph :u32 = 0x0cf7; /* U+05E7 HEBREW LETTER QOF */ pub const XKB_KEY_hebrew_kuf :u32 = 0x0cf7; /* deprecated */ pub const XKB_KEY_hebrew_resh :u32 = 0x0cf8; /* U+05E8 HEBREW LETTER RESH */ pub const XKB_KEY_hebrew_shin :u32 = 0x0cf9; /* U+05E9 HEBREW LETTER SHIN */ pub const XKB_KEY_hebrew_taw :u32 = 0x0cfa; /* U+05EA HEBREW LETTER TAV */ pub const XKB_KEY_hebrew_taf :u32 = 0x0cfa; /* deprecated */ pub const XKB_KEY_Hebrew_switch :u32 = 0xff7e; /* Alias for mode_switch */ /* * Thai * Byte 3 = :u32 = 0x0d; */ pub const XKB_KEY_Thai_kokai :u32 = 0x0da1; /* U+0E01 THAI CHARACTER KO KAI */ pub const XKB_KEY_Thai_khokhai :u32 = 0x0da2; /* U+0E02 THAI CHARACTER KHO KHAI */ pub const XKB_KEY_Thai_khokhuat :u32 = 0x0da3; /* U+0E03 THAI CHARACTER KHO KHUAT */ pub const XKB_KEY_Thai_khokhwai :u32 = 0x0da4; /* U+0E04 THAI CHARACTER KHO KHWAI */ pub const XKB_KEY_Thai_khokhon :u32 = 0x0da5; /* U+0E05 THAI CHARACTER KHO KHON */ pub const XKB_KEY_Thai_khorakhang :u32 = 0x0da6; /* U+0E06 THAI CHARACTER KHO RAKHANG */ pub const XKB_KEY_Thai_ngongu :u32 = 0x0da7; /* U+0E07 THAI CHARACTER NGO NGU */ pub const XKB_KEY_Thai_chochan :u32 = 0x0da8; /* U+0E08 THAI CHARACTER CHO CHAN */ pub const XKB_KEY_Thai_choching :u32 = 0x0da9; /* U+0E09 THAI CHARACTER CHO CHING */ pub const XKB_KEY_Thai_chochang :u32 = 0x0daa; /* U+0E0A THAI CHARACTER CHO CHANG */ pub const XKB_KEY_Thai_soso :u32 = 0x0dab; /* U+0E0B THAI CHARACTER SO SO */ pub const XKB_KEY_Thai_chochoe :u32 = 0x0dac; /* U+0E0C THAI CHARACTER CHO CHOE */ pub const XKB_KEY_Thai_yoying :u32 = 0x0dad; /* U+0E0D THAI CHARACTER YO YING */ pub const XKB_KEY_Thai_dochada :u32 = 0x0dae; /* U+0E0E THAI CHARACTER DO CHADA */ pub const XKB_KEY_Thai_topatak :u32 = 0x0daf; /* U+0E0F THAI CHARACTER TO PATAK */ pub const XKB_KEY_Thai_thothan :u32 = 0x0db0; /* U+0E10 THAI CHARACTER THO THAN */ pub const XKB_KEY_Thai_thonangmontho :u32 = 0x0db1; /* U+0E11 THAI CHARACTER THO NANGMONTHO */ pub const XKB_KEY_Thai_thophuthao :u32 = 0x0db2; /* U+0E12 THAI CHARACTER THO PHUTHAO */ pub const XKB_KEY_Thai_nonen :u32 = 0x0db3; /* U+0E13 THAI CHARACTER NO NEN */ pub const XKB_KEY_Thai_dodek :u32 = 0x0db4; /* U+0E14 THAI CHARACTER DO DEK */ pub const XKB_KEY_Thai_totao :u32 = 0x0db5; /* U+0E15 THAI CHARACTER TO TAO */ pub const XKB_KEY_Thai_thothung :u32 = 0x0db6; /* U+0E16 THAI CHARACTER THO THUNG */ pub const XKB_KEY_Thai_thothahan :u32 = 0x0db7; /* U+0E17 THAI CHARACTER THO THAHAN */ pub const XKB_KEY_Thai_thothong :u32 = 0x0db8; /* U+0E18 THAI CHARACTER THO THONG */ pub const XKB_KEY_Thai_nonu :u32 = 0x0db9; /* U+0E19 THAI CHARACTER NO NU */ pub const XKB_KEY_Thai_bobaimai :u32 = 0x0dba; /* U+0E1A THAI CHARACTER BO BAIMAI */ pub const XKB_KEY_Thai_popla :u32 = 0x0dbb; /* U+0E1B THAI CHARACTER PO PLA */ pub const XKB_KEY_Thai_phophung :u32 = 0x0dbc; /* U+0E1C THAI CHARACTER PHO PHUNG */ pub const XKB_KEY_Thai_fofa :u32 = 0x0dbd; /* U+0E1D THAI CHARACTER FO FA */ pub const XKB_KEY_Thai_phophan :u32 = 0x0dbe; /* U+0E1E THAI CHARACTER PHO PHAN */ pub const XKB_KEY_Thai_fofan :u32 = 0x0dbf; /* U+0E1F THAI CHARACTER FO FAN */ pub const XKB_KEY_Thai_phosamphao :u32 = 0x0dc0; /* U+0E20 THAI CHARACTER PHO SAMPHAO */ pub const XKB_KEY_Thai_moma :u32 = 0x0dc1; /* U+0E21 THAI CHARACTER MO MA */ pub const XKB_KEY_Thai_yoyak :u32 = 0x0dc2; /* U+0E22 THAI CHARACTER YO YAK */ pub const XKB_KEY_Thai_rorua :u32 = 0x0dc3; /* U+0E23 THAI CHARACTER RO RUA */ pub const XKB_KEY_Thai_ru :u32 = 0x0dc4; /* U+0E24 THAI CHARACTER RU */ pub const XKB_KEY_Thai_loling :u32 = 0x0dc5; /* U+0E25 THAI CHARACTER LO LING */ pub const XKB_KEY_Thai_lu :u32 = 0x0dc6; /* U+0E26 THAI CHARACTER LU */ pub const XKB_KEY_Thai_wowaen :u32 = 0x0dc7; /* U+0E27 THAI CHARACTER WO WAEN */ pub const XKB_KEY_Thai_sosala :u32 = 0x0dc8; /* U+0E28 THAI CHARACTER SO SALA */ pub const XKB_KEY_Thai_sorusi :u32 = 0x0dc9; /* U+0E29 THAI CHARACTER SO RUSI */ pub const XKB_KEY_Thai_sosua :u32 = 0x0dca; /* U+0E2A THAI CHARACTER SO SUA */ pub const XKB_KEY_Thai_hohip :u32 = 0x0dcb; /* U+0E2B THAI CHARACTER HO HIP */ pub const XKB_KEY_Thai_lochula :u32 = 0x0dcc; /* U+0E2C THAI CHARACTER LO CHULA */ pub const XKB_KEY_Thai_oang :u32 = 0x0dcd; /* U+0E2D THAI CHARACTER O ANG */ pub const XKB_KEY_Thai_honokhuk :u32 = 0x0dce; /* U+0E2E THAI CHARACTER HO NOKHUK */ pub const XKB_KEY_Thai_paiyannoi :u32 = 0x0dcf; /* U+0E2F THAI CHARACTER PAIYANNOI */ pub const XKB_KEY_Thai_saraa :u32 = 0x0dd0; /* U+0E30 THAI CHARACTER SARA A */ pub const XKB_KEY_Thai_maihanakat :u32 = 0x0dd1; /* U+0E31 THAI CHARACTER MAI HAN-AKAT */ pub const XKB_KEY_Thai_saraaa :u32 = 0x0dd2; /* U+0E32 THAI CHARACTER SARA AA */ pub const XKB_KEY_Thai_saraam :u32 = 0x0dd3; /* U+0E33 THAI CHARACTER SARA AM */ pub const XKB_KEY_Thai_sarai :u32 = 0x0dd4; /* U+0E34 THAI CHARACTER SARA I */ pub const XKB_KEY_Thai_saraii :u32 = 0x0dd5; /* U+0E35 THAI CHARACTER SARA II */ pub const XKB_KEY_Thai_saraue :u32 = 0x0dd6; /* U+0E36 THAI CHARACTER SARA UE */ pub const XKB_KEY_Thai_sarauee :u32 = 0x0dd7; /* U+0E37 THAI CHARACTER SARA UEE */ pub const XKB_KEY_Thai_sarau :u32 = 0x0dd8; /* U+0E38 THAI CHARACTER SARA U */ pub const XKB_KEY_Thai_sarauu :u32 = 0x0dd9; /* U+0E39 THAI CHARACTER SARA UU */ pub const XKB_KEY_Thai_phinthu :u32 = 0x0dda; /* U+0E3A THAI CHARACTER PHINTHU */ pub const XKB_KEY_Thai_maihanakat_maitho :u32 = 0x0dde; pub const XKB_KEY_Thai_baht :u32 = 0x0ddf; /* U+0E3F THAI CURRENCY SYMBOL BAHT */ pub const XKB_KEY_Thai_sarae :u32 = 0x0de0; /* U+0E40 THAI CHARACTER SARA E */ pub const XKB_KEY_Thai_saraae :u32 = 0x0de1; /* U+0E41 THAI CHARACTER SARA AE */ pub const XKB_KEY_Thai_sarao :u32 = 0x0de2; /* U+0E42 THAI CHARACTER SARA O */ pub const XKB_KEY_Thai_saraaimaimuan :u32 = 0x0de3; /* U+0E43 THAI CHARACTER SARA AI MAIMUAN */ pub const XKB_KEY_Thai_saraaimaimalai :u32 = 0x0de4; /* U+0E44 THAI CHARACTER SARA AI MAIMALAI */ pub const XKB_KEY_Thai_lakkhangyao :u32 = 0x0de5; /* U+0E45 THAI CHARACTER LAKKHANGYAO */ pub const XKB_KEY_Thai_maiyamok :u32 = 0x0de6; /* U+0E46 THAI CHARACTER MAIYAMOK */ pub const XKB_KEY_Thai_maitaikhu :u32 = 0x0de7; /* U+0E47 THAI CHARACTER MAITAIKHU */ pub const XKB_KEY_Thai_maiek :u32 = 0x0de8; /* U+0E48 THAI CHARACTER MAI EK */ pub const XKB_KEY_Thai_maitho :u32 = 0x0de9; /* U+0E49 THAI CHARACTER MAI THO */ pub const XKB_KEY_Thai_maitri :u32 = 0x0dea; /* U+0E4A THAI CHARACTER MAI TRI */ pub const XKB_KEY_Thai_maichattawa :u32 = 0x0deb; /* U+0E4B THAI CHARACTER MAI CHATTAWA */ pub const XKB_KEY_Thai_thanthakhat :u32 = 0x0dec; /* U+0E4C THAI CHARACTER THANTHAKHAT */ pub const XKB_KEY_Thai_nikhahit :u32 = 0x0ded; /* U+0E4D THAI CHARACTER NIKHAHIT */ pub const XKB_KEY_Thai_leksun :u32 = 0x0df0; /* U+0E50 THAI DIGIT ZERO */ pub const XKB_KEY_Thai_leknung :u32 = 0x0df1; /* U+0E51 THAI DIGIT ONE */ pub const XKB_KEY_Thai_leksong :u32 = 0x0df2; /* U+0E52 THAI DIGIT TWO */ pub const XKB_KEY_Thai_leksam :u32 = 0x0df3; /* U+0E53 THAI DIGIT THREE */ pub const XKB_KEY_Thai_leksi :u32 = 0x0df4; /* U+0E54 THAI DIGIT FOUR */ pub const XKB_KEY_Thai_lekha :u32 = 0x0df5; /* U+0E55 THAI DIGIT FIVE */ pub const XKB_KEY_Thai_lekhok :u32 = 0x0df6; /* U+0E56 THAI DIGIT SIX */ pub const XKB_KEY_Thai_lekchet :u32 = 0x0df7; /* U+0E57 THAI DIGIT SEVEN */ pub const XKB_KEY_Thai_lekpaet :u32 = 0x0df8; /* U+0E58 THAI DIGIT EIGHT */ pub const XKB_KEY_Thai_lekkao :u32 = 0x0df9; /* U+0E59 THAI DIGIT NINE */ /* * Korean * Byte 3 = :u32 = 0x0e; */ pub const XKB_KEY_Hangul :u32 = 0xff31; /* Hangul start/stop(toggle) */ pub const XKB_KEY_Hangul_Start :u32 = 0xff32; /* Hangul start */ pub const XKB_KEY_Hangul_End :u32 = 0xff33; /* Hangul end, English start */ pub const XKB_KEY_Hangul_Hanja :u32 = 0xff34; /* Start Hangul->Hanja Conversion */ pub const XKB_KEY_Hangul_Jamo :u32 = 0xff35; /* Hangul Jamo mode */ pub const XKB_KEY_Hangul_Romaja :u32 = 0xff36; /* Hangul Romaja mode */ pub const XKB_KEY_Hangul_Codeinput :u32 = 0xff37; /* Hangul code input mode */ pub const XKB_KEY_Hangul_Jeonja :u32 = 0xff38; /* Jeonja mode */ pub const XKB_KEY_Hangul_Banja :u32 = 0xff39; /* Banja mode */ pub const XKB_KEY_Hangul_PreHanja :u32 = 0xff3a; /* Pre Hanja conversion */ pub const XKB_KEY_Hangul_PostHanja :u32 = 0xff3b; /* Post Hanja conversion */ pub const XKB_KEY_Hangul_SingleCandidate :u32 = 0xff3c; /* Single candidate */ pub const XKB_KEY_Hangul_MultipleCandidate :u32 = 0xff3d; /* Multiple candidate */ pub const XKB_KEY_Hangul_PreviousCandidate :u32 = 0xff3e; /* Previous candidate */ pub const XKB_KEY_Hangul_Special :u32 = 0xff3f; /* Special symbols */ pub const XKB_KEY_Hangul_switch :u32 = 0xff7e; /* Alias for mode_switch */ /* Hangul Consonant Characters */ pub const XKB_KEY_Hangul_Kiyeog :u32 = 0x0ea1; pub const XKB_KEY_Hangul_SsangKiyeog :u32 = 0x0ea2; pub const XKB_KEY_Hangul_KiyeogSios :u32 = 0x0ea3; pub const XKB_KEY_Hangul_Nieun :u32 = 0x0ea4; pub const XKB_KEY_Hangul_NieunJieuj :u32 = 0x0ea5; pub const XKB_KEY_Hangul_NieunHieuh :u32 = 0x0ea6; pub const XKB_KEY_Hangul_Dikeud :u32 = 0x0ea7; pub const XKB_KEY_Hangul_SsangDikeud :u32 = 0x0ea8; pub const XKB_KEY_Hangul_Rieul :u32 = 0x0ea9; pub const XKB_KEY_Hangul_RieulKiyeog :u32 = 0x0eaa; pub const XKB_KEY_Hangul_RieulMieum :u32 = 0x0eab; pub const XKB_KEY_Hangul_RieulPieub :u32 = 0x0eac; pub const XKB_KEY_Hangul_RieulSios :u32 = 0x0ead; pub const XKB_KEY_Hangul_RieulTieut :u32 = 0x0eae; pub const XKB_KEY_Hangul_RieulPhieuf :u32 = 0x0eaf; pub const XKB_KEY_Hangul_RieulHieuh :u32 = 0x0eb0; pub const XKB_KEY_Hangul_Mieum :u32 = 0x0eb1; pub const XKB_KEY_Hangul_Pieub :u32 = 0x0eb2; pub const XKB_KEY_Hangul_SsangPieub :u32 = 0x0eb3; pub const XKB_KEY_Hangul_PieubSios :u32 = 0x0eb4; pub const XKB_KEY_Hangul_Sios :u32 = 0x0eb5; pub const XKB_KEY_Hangul_SsangSios :u32 = 0x0eb6; pub const XKB_KEY_Hangul_Ieung :u32 = 0x0eb7; pub const XKB_KEY_Hangul_Jieuj :u32 = 0x0eb8; pub const XKB_KEY_Hangul_SsangJieuj :u32 = 0x0eb9; pub const XKB_KEY_Hangul_Cieuc :u32 = 0x0eba; pub const XKB_KEY_Hangul_Khieuq :u32 = 0x0ebb; pub const XKB_KEY_Hangul_Tieut :u32 = 0x0ebc; pub const XKB_KEY_Hangul_Phieuf :u32 = 0x0ebd; pub const XKB_KEY_Hangul_Hieuh :u32 = 0x0ebe; /* Hangul Vowel Characters */ pub const XKB_KEY_Hangul_A :u32 = 0x0ebf; pub const XKB_KEY_Hangul_AE :u32 = 0x0ec0; pub const XKB_KEY_Hangul_YA :u32 = 0x0ec1; pub const XKB_KEY_Hangul_YAE :u32 = 0x0ec2; pub const XKB_KEY_Hangul_EO :u32 = 0x0ec3; pub const XKB_KEY_Hangul_E :u32 = 0x0ec4; pub const XKB_KEY_Hangul_YEO :u32 = 0x0ec5; pub const XKB_KEY_Hangul_YE :u32 = 0x0ec6; pub const XKB_KEY_Hangul_O :u32 = 0x0ec7; pub const XKB_KEY_Hangul_WA :u32 = 0x0ec8; pub const XKB_KEY_Hangul_WAE :u32 = 0x0ec9; pub const XKB_KEY_Hangul_OE :u32 = 0x0eca; pub const XKB_KEY_Hangul_YO :u32 = 0x0ecb; pub const XKB_KEY_Hangul_U :u32 = 0x0ecc; pub const XKB_KEY_Hangul_WEO :u32 = 0x0ecd; pub const XKB_KEY_Hangul_WE :u32 = 0x0ece; pub const XKB_KEY_Hangul_WI :u32 = 0x0ecf; pub const XKB_KEY_Hangul_YU :u32 = 0x0ed0; pub const XKB_KEY_Hangul_EU :u32 = 0x0ed1; pub const XKB_KEY_Hangul_YI :u32 = 0x0ed2; pub const XKB_KEY_Hangul_I :u32 = 0x0ed3; /* Hangul syllable-final (JongSeong) Characters */ pub const XKB_KEY_Hangul_J_Kiyeog :u32 = 0x0ed4; pub const XKB_KEY_Hangul_J_SsangKiyeog :u32 = 0x0ed5; pub const XKB_KEY_Hangul_J_KiyeogSios :u32 = 0x0ed6; pub const XKB_KEY_Hangul_J_Nieun :u32 = 0x0ed7; pub const XKB_KEY_Hangul_J_NieunJieuj :u32 = 0x0ed8; pub const XKB_KEY_Hangul_J_NieunHieuh :u32 = 0x0ed9; pub const XKB_KEY_Hangul_J_Dikeud :u32 = 0x0eda; pub const XKB_KEY_Hangul_J_Rieul :u32 = 0x0edb; pub const XKB_KEY_Hangul_J_RieulKiyeog :u32 = 0x0edc; pub const XKB_KEY_Hangul_J_RieulMieum :u32 = 0x0edd; pub const XKB_KEY_Hangul_J_RieulPieub :u32 = 0x0ede; pub const XKB_KEY_Hangul_J_RieulSios :u32 = 0x0edf; pub const XKB_KEY_Hangul_J_RieulTieut :u32 = 0x0ee0; pub const XKB_KEY_Hangul_J_RieulPhieuf :u32 = 0x0ee1; pub const XKB_KEY_Hangul_J_RieulHieuh :u32 = 0x0ee2; pub const XKB_KEY_Hangul_J_Mieum :u32 = 0x0ee3; pub const XKB_KEY_Hangul_J_Pieub :u32 = 0x0ee4; pub const XKB_KEY_Hangul_J_PieubSios :u32 = 0x0ee5; pub const XKB_KEY_Hangul_J_Sios :u32 = 0x0ee6; pub const XKB_KEY_Hangul_J_SsangSios :u32 = 0x0ee7; pub const XKB_KEY_Hangul_J_Ieung :u32 = 0x0ee8; pub const XKB_KEY_Hangul_J_Jieuj :u32 = 0x0ee9; pub const XKB_KEY_Hangul_J_Cieuc :u32 = 0x0eea; pub const XKB_KEY_Hangul_J_Khieuq :u32 = 0x0eeb; pub const XKB_KEY_Hangul_J_Tieut :u32 = 0x0eec; pub const XKB_KEY_Hangul_J_Phieuf :u32 = 0x0eed; pub const XKB_KEY_Hangul_J_Hieuh :u32 = 0x0eee; /* Ancient Hangul Consonant Characters */ pub const XKB_KEY_Hangul_RieulYeorinHieuh :u32 = 0x0eef; pub const XKB_KEY_Hangul_SunkyeongeumMieum :u32 = 0x0ef0; pub const XKB_KEY_Hangul_SunkyeongeumPieub :u32 = 0x0ef1; pub const XKB_KEY_Hangul_PanSios :u32 = 0x0ef2; pub const XKB_KEY_Hangul_KkogjiDalrinIeung :u32 = 0x0ef3; pub const XKB_KEY_Hangul_SunkyeongeumPhieuf :u32 = 0x0ef4; pub const XKB_KEY_Hangul_YeorinHieuh :u32 = 0x0ef5; /* Ancient Hangul Vowel Characters */ pub const XKB_KEY_Hangul_AraeA :u32 = 0x0ef6; pub const XKB_KEY_Hangul_AraeAE :u32 = 0x0ef7; /* Ancient Hangul syllable-final (JongSeong) Characters */ pub const XKB_KEY_Hangul_J_PanSios :u32 = 0x0ef8; pub const XKB_KEY_Hangul_J_KkogjiDalrinIeung :u32 = 0x0ef9; pub const XKB_KEY_Hangul_J_YeorinHieuh :u32 = 0x0efa; /* Korean currency symbol */ pub const XKB_KEY_Korean_Won :u32 = 0x0eff; /*(U+20A9 WON SIGN)*/ /* * Armenian */ pub const XKB_KEY_Armenian_ligature_ew :u32 = 0x1000587; /* U+0587 ARMENIAN SMALL LIGATURE ECH YIWN */ pub const XKB_KEY_Armenian_full_stop :u32 = 0x1000589; /* U+0589 ARMENIAN FULL STOP */ pub const XKB_KEY_Armenian_verjaket :u32 = 0x1000589; /* U+0589 ARMENIAN FULL STOP */ pub const XKB_KEY_Armenian_separation_mark :u32 = 0x100055d; /* U+055D ARMENIAN COMMA */ pub const XKB_KEY_Armenian_but :u32 = 0x100055d; /* U+055D ARMENIAN COMMA */ pub const XKB_KEY_Armenian_hyphen :u32 = 0x100058a; /* U+058A ARMENIAN HYPHEN */ pub const XKB_KEY_Armenian_yentamna :u32 = 0x100058a; /* U+058A ARMENIAN HYPHEN */ pub const XKB_KEY_Armenian_exclam :u32 = 0x100055c; /* U+055C ARMENIAN EXCLAMATION MARK */ pub const XKB_KEY_Armenian_amanak :u32 = 0x100055c; /* U+055C ARMENIAN EXCLAMATION MARK */ pub const XKB_KEY_Armenian_accent :u32 = 0x100055b; /* U+055B ARMENIAN EMPHASIS MARK */ pub const XKB_KEY_Armenian_shesht :u32 = 0x100055b; /* U+055B ARMENIAN EMPHASIS MARK */ pub const XKB_KEY_Armenian_question :u32 = 0x100055e; /* U+055E ARMENIAN QUESTION MARK */ pub const XKB_KEY_Armenian_paruyk :u32 = 0x100055e; /* U+055E ARMENIAN QUESTION MARK */ pub const XKB_KEY_Armenian_AYB :u32 = 0x1000531; /* U+0531 ARMENIAN CAPITAL LETTER AYB */ pub const XKB_KEY_Armenian_ayb :u32 = 0x1000561; /* U+0561 ARMENIAN SMALL LETTER AYB */ pub const XKB_KEY_Armenian_BEN :u32 = 0x1000532; /* U+0532 ARMENIAN CAPITAL LETTER BEN */ pub const XKB_KEY_Armenian_ben :u32 = 0x1000562; /* U+0562 ARMENIAN SMALL LETTER BEN */ pub const XKB_KEY_Armenian_GIM :u32 = 0x1000533; /* U+0533 ARMENIAN CAPITAL LETTER GIM */ pub const XKB_KEY_Armenian_gim :u32 = 0x1000563; /* U+0563 ARMENIAN SMALL LETTER GIM */ pub const XKB_KEY_Armenian_DA :u32 = 0x1000534; /* U+0534 ARMENIAN CAPITAL LETTER DA */ pub const XKB_KEY_Armenian_da :u32 = 0x1000564; /* U+0564 ARMENIAN SMALL LETTER DA */ pub const XKB_KEY_Armenian_YECH :u32 = 0x1000535; /* U+0535 ARMENIAN CAPITAL LETTER ECH */ pub const XKB_KEY_Armenian_yech :u32 = 0x1000565; /* U+0565 ARMENIAN SMALL LETTER ECH */ pub const XKB_KEY_Armenian_ZA :u32 = 0x1000536; /* U+0536 ARMENIAN CAPITAL LETTER ZA */ pub const XKB_KEY_Armenian_za :u32 = 0x1000566; /* U+0566 ARMENIAN SMALL LETTER ZA */ pub const XKB_KEY_Armenian_E :u32 = 0x1000537; /* U+0537 ARMENIAN CAPITAL LETTER EH */ pub const XKB_KEY_Armenian_e :u32 = 0x1000567; /* U+0567 ARMENIAN SMALL LETTER EH */ pub const XKB_KEY_Armenian_AT :u32 = 0x1000538; /* U+0538 ARMENIAN CAPITAL LETTER ET */ pub const XKB_KEY_Armenian_at :u32 = 0x1000568; /* U+0568 ARMENIAN SMALL LETTER ET */ pub const XKB_KEY_Armenian_TO :u32 = 0x1000539; /* U+0539 ARMENIAN CAPITAL LETTER TO */ pub const XKB_KEY_Armenian_to :u32 = 0x1000569; /* U+0569 ARMENIAN SMALL LETTER TO */ pub const XKB_KEY_Armenian_ZHE :u32 = 0x100053a; /* U+053A ARMENIAN CAPITAL LETTER ZHE */ pub const XKB_KEY_Armenian_zhe :u32 = 0x100056a; /* U+056A ARMENIAN SMALL LETTER ZHE */ pub const XKB_KEY_Armenian_INI :u32 = 0x100053b; /* U+053B ARMENIAN CAPITAL LETTER INI */ pub const XKB_KEY_Armenian_ini :u32 = 0x100056b; /* U+056B ARMENIAN SMALL LETTER INI */ pub const XKB_KEY_Armenian_LYUN :u32 = 0x100053c; /* U+053C ARMENIAN CAPITAL LETTER LIWN */ pub const XKB_KEY_Armenian_lyun :u32 = 0x100056c; /* U+056C ARMENIAN SMALL LETTER LIWN */ pub const XKB_KEY_Armenian_KHE :u32 = 0x100053d; /* U+053D ARMENIAN CAPITAL LETTER XEH */ pub const XKB_KEY_Armenian_khe :u32 = 0x100056d; /* U+056D ARMENIAN SMALL LETTER XEH */ pub const XKB_KEY_Armenian_TSA :u32 = 0x100053e; /* U+053E ARMENIAN CAPITAL LETTER CA */ pub const XKB_KEY_Armenian_tsa :u32 = 0x100056e; /* U+056E ARMENIAN SMALL LETTER CA */ pub const XKB_KEY_Armenian_KEN :u32 = 0x100053f; /* U+053F ARMENIAN CAPITAL LETTER KEN */ pub const XKB_KEY_Armenian_ken :u32 = 0x100056f; /* U+056F ARMENIAN SMALL LETTER KEN */ pub const XKB_KEY_Armenian_HO :u32 = 0x1000540; /* U+0540 ARMENIAN CAPITAL LETTER HO */ pub const XKB_KEY_Armenian_ho :u32 = 0x1000570; /* U+0570 ARMENIAN SMALL LETTER HO */ pub const XKB_KEY_Armenian_DZA :u32 = 0x1000541; /* U+0541 ARMENIAN CAPITAL LETTER JA */ pub const XKB_KEY_Armenian_dza :u32 = 0x1000571; /* U+0571 ARMENIAN SMALL LETTER JA */ pub const XKB_KEY_Armenian_GHAT :u32 = 0x1000542; /* U+0542 ARMENIAN CAPITAL LETTER GHAD */ pub const XKB_KEY_Armenian_ghat :u32 = 0x1000572; /* U+0572 ARMENIAN SMALL LETTER GHAD */ pub const XKB_KEY_Armenian_TCHE :u32 = 0x1000543; /* U+0543 ARMENIAN CAPITAL LETTER CHEH */ pub const XKB_KEY_Armenian_tche :u32 = 0x1000573; /* U+0573 ARMENIAN SMALL LETTER CHEH */ pub const XKB_KEY_Armenian_MEN :u32 = 0x1000544; /* U+0544 ARMENIAN CAPITAL LETTER MEN */ pub const XKB_KEY_Armenian_men :u32 = 0x1000574; /* U+0574 ARMENIAN SMALL LETTER MEN */ pub const XKB_KEY_Armenian_HI :u32 = 0x1000545; /* U+0545 ARMENIAN CAPITAL LETTER YI */ pub const XKB_KEY_Armenian_hi :u32 = 0x1000575; /* U+0575 ARMENIAN SMALL LETTER YI */ pub const XKB_KEY_Armenian_NU :u32 = 0x1000546; /* U+0546 ARMENIAN CAPITAL LETTER NOW */ pub const XKB_KEY_Armenian_nu :u32 = 0x1000576; /* U+0576 ARMENIAN SMALL LETTER NOW */ pub const XKB_KEY_Armenian_SHA :u32 = 0x1000547; /* U+0547 ARMENIAN CAPITAL LETTER SHA */ pub const XKB_KEY_Armenian_sha :u32 = 0x1000577; /* U+0577 ARMENIAN SMALL LETTER SHA */ pub const XKB_KEY_Armenian_VO :u32 = 0x1000548; /* U+0548 ARMENIAN CAPITAL LETTER VO */ pub const XKB_KEY_Armenian_vo :u32 = 0x1000578; /* U+0578 ARMENIAN SMALL LETTER VO */ pub const XKB_KEY_Armenian_CHA :u32 = 0x1000549; /* U+0549 ARMENIAN CAPITAL LETTER CHA */ pub const XKB_KEY_Armenian_cha :u32 = 0x1000579; /* U+0579 ARMENIAN SMALL LETTER CHA */ pub const XKB_KEY_Armenian_PE :u32 = 0x100054a; /* U+054A ARMENIAN CAPITAL LETTER PEH */ pub const XKB_KEY_Armenian_pe :u32 = 0x100057a; /* U+057A ARMENIAN SMALL LETTER PEH */ pub const XKB_KEY_Armenian_JE :u32 = 0x100054b; /* U+054B ARMENIAN CAPITAL LETTER JHEH */ pub const XKB_KEY_Armenian_je :u32 = 0x100057b; /* U+057B ARMENIAN SMALL LETTER JHEH */ pub const XKB_KEY_Armenian_RA :u32 = 0x100054c; /* U+054C ARMENIAN CAPITAL LETTER RA */ pub const XKB_KEY_Armenian_ra :u32 = 0x100057c; /* U+057C ARMENIAN SMALL LETTER RA */ pub const XKB_KEY_Armenian_SE :u32 = 0x100054d; /* U+054D ARMENIAN CAPITAL LETTER SEH */ pub const XKB_KEY_Armenian_se :u32 = 0x100057d; /* U+057D ARMENIAN SMALL LETTER SEH */ pub const XKB_KEY_Armenian_VEV :u32 = 0x100054e; /* U+054E ARMENIAN CAPITAL LETTER VEW */ pub const XKB_KEY_Armenian_vev :u32 = 0x100057e; /* U+057E ARMENIAN SMALL LETTER VEW */ pub const XKB_KEY_Armenian_TYUN :u32 = 0x100054f; /* U+054F ARMENIAN CAPITAL LETTER TIWN */ pub const XKB_KEY_Armenian_tyun :u32 = 0x100057f; /* U+057F ARMENIAN SMALL LETTER TIWN */ pub const XKB_KEY_Armenian_RE :u32 = 0x1000550; /* U+0550 ARMENIAN CAPITAL LETTER REH */ pub const XKB_KEY_Armenian_re :u32 = 0x1000580; /* U+0580 ARMENIAN SMALL LETTER REH */ pub const XKB_KEY_Armenian_TSO :u32 = 0x1000551; /* U+0551 ARMENIAN CAPITAL LETTER CO */ pub const XKB_KEY_Armenian_tso :u32 = 0x1000581; /* U+0581 ARMENIAN SMALL LETTER CO */ pub const XKB_KEY_Armenian_VYUN :u32 = 0x1000552; /* U+0552 ARMENIAN CAPITAL LETTER YIWN */ pub const XKB_KEY_Armenian_vyun :u32 = 0x1000582; /* U+0582 ARMENIAN SMALL LETTER YIWN */ pub const XKB_KEY_Armenian_PYUR :u32 = 0x1000553; /* U+0553 ARMENIAN CAPITAL LETTER PIWR */ pub const XKB_KEY_Armenian_pyur :u32 = 0x1000583; /* U+0583 ARMENIAN SMALL LETTER PIWR */ pub const XKB_KEY_Armenian_KE :u32 = 0x1000554; /* U+0554 ARMENIAN CAPITAL LETTER KEH */ pub const XKB_KEY_Armenian_ke :u32 = 0x1000584; /* U+0584 ARMENIAN SMALL LETTER KEH */ pub const XKB_KEY_Armenian_O :u32 = 0x1000555; /* U+0555 ARMENIAN CAPITAL LETTER OH */ pub const XKB_KEY_Armenian_o :u32 = 0x1000585; /* U+0585 ARMENIAN SMALL LETTER OH */ pub const XKB_KEY_Armenian_FE :u32 = 0x1000556; /* U+0556 ARMENIAN CAPITAL LETTER FEH */ pub const XKB_KEY_Armenian_fe :u32 = 0x1000586; /* U+0586 ARMENIAN SMALL LETTER FEH */ pub const XKB_KEY_Armenian_apostrophe :u32 = 0x100055a; /* U+055A ARMENIAN APOSTROPHE */ /* * Georgian */ pub const XKB_KEY_Georgian_an :u32 = 0x10010d0; /* U+10D0 GEORGIAN LETTER AN */ pub const XKB_KEY_Georgian_ban :u32 = 0x10010d1; /* U+10D1 GEORGIAN LETTER BAN */ pub const XKB_KEY_Georgian_gan :u32 = 0x10010d2; /* U+10D2 GEORGIAN LETTER GAN */ pub const XKB_KEY_Georgian_don :u32 = 0x10010d3; /* U+10D3 GEORGIAN LETTER DON */ pub const XKB_KEY_Georgian_en :u32 = 0x10010d4; /* U+10D4 GEORGIAN LETTER EN */ pub const XKB_KEY_Georgian_vin :u32 = 0x10010d5; /* U+10D5 GEORGIAN LETTER VIN */ pub const XKB_KEY_Georgian_zen :u32 = 0x10010d6; /* U+10D6 GEORGIAN LETTER ZEN */ pub const XKB_KEY_Georgian_tan :u32 = 0x10010d7; /* U+10D7 GEORGIAN LETTER TAN */ pub const XKB_KEY_Georgian_in :u32 = 0x10010d8; /* U+10D8 GEORGIAN LETTER IN */ pub const XKB_KEY_Georgian_kan :u32 = 0x10010d9; /* U+10D9 GEORGIAN LETTER KAN */ pub const XKB_KEY_Georgian_las :u32 = 0x10010da; /* U+10DA GEORGIAN LETTER LAS */ pub const XKB_KEY_Georgian_man :u32 = 0x10010db; /* U+10DB GEORGIAN LETTER MAN */ pub const XKB_KEY_Georgian_nar :u32 = 0x10010dc; /* U+10DC GEORGIAN LETTER NAR */ pub const XKB_KEY_Georgian_on :u32 = 0x10010dd; /* U+10DD GEORGIAN LETTER ON */ pub const XKB_KEY_Georgian_par :u32 = 0x10010de; /* U+10DE GEORGIAN LETTER PAR */ pub const XKB_KEY_Georgian_zhar :u32 = 0x10010df; /* U+10DF GEORGIAN LETTER ZHAR */ pub const XKB_KEY_Georgian_rae :u32 = 0x10010e0; /* U+10E0 GEORGIAN LETTER RAE */ pub const XKB_KEY_Georgian_san :u32 = 0x10010e1; /* U+10E1 GEORGIAN LETTER SAN */ pub const XKB_KEY_Georgian_tar :u32 = 0x10010e2; /* U+10E2 GEORGIAN LETTER TAR */ pub const XKB_KEY_Georgian_un :u32 = 0x10010e3; /* U+10E3 GEORGIAN LETTER UN */ pub const XKB_KEY_Georgian_phar :u32 = 0x10010e4; /* U+10E4 GEORGIAN LETTER PHAR */ pub const XKB_KEY_Georgian_khar :u32 = 0x10010e5; /* U+10E5 GEORGIAN LETTER KHAR */ pub const XKB_KEY_Georgian_ghan :u32 = 0x10010e6; /* U+10E6 GEORGIAN LETTER GHAN */ pub const XKB_KEY_Georgian_qar :u32 = 0x10010e7; /* U+10E7 GEORGIAN LETTER QAR */ pub const XKB_KEY_Georgian_shin :u32 = 0x10010e8; /* U+10E8 GEORGIAN LETTER SHIN */ pub const XKB_KEY_Georgian_chin :u32 = 0x10010e9; /* U+10E9 GEORGIAN LETTER CHIN */ pub const XKB_KEY_Georgian_can :u32 = 0x10010ea; /* U+10EA GEORGIAN LETTER CAN */ pub const XKB_KEY_Georgian_jil :u32 = 0x10010eb; /* U+10EB GEORGIAN LETTER JIL */ pub const XKB_KEY_Georgian_cil :u32 = 0x10010ec; /* U+10EC GEORGIAN LETTER CIL */ pub const XKB_KEY_Georgian_char :u32 = 0x10010ed; /* U+10ED GEORGIAN LETTER CHAR */ pub const XKB_KEY_Georgian_xan :u32 = 0x10010ee; /* U+10EE GEORGIAN LETTER XAN */ pub const XKB_KEY_Georgian_jhan :u32 = 0x10010ef; /* U+10EF GEORGIAN LETTER JHAN */ pub const XKB_KEY_Georgian_hae :u32 = 0x10010f0; /* U+10F0 GEORGIAN LETTER HAE */ pub const XKB_KEY_Georgian_he :u32 = 0x10010f1; /* U+10F1 GEORGIAN LETTER HE */ pub const XKB_KEY_Georgian_hie :u32 = 0x10010f2; /* U+10F2 GEORGIAN LETTER HIE */ pub const XKB_KEY_Georgian_we :u32 = 0x10010f3; /* U+10F3 GEORGIAN LETTER WE */ pub const XKB_KEY_Georgian_har :u32 = 0x10010f4; /* U+10F4 GEORGIAN LETTER HAR */ pub const XKB_KEY_Georgian_hoe :u32 = 0x10010f5; /* U+10F5 GEORGIAN LETTER HOE */ pub const XKB_KEY_Georgian_fi :u32 = 0x10010f6; /* U+10F6 GEORGIAN LETTER FI */ /* * Azeri (and other Turkic or Caucasian languages) */ /* latin */ pub const XKB_KEY_Xabovedot :u32 = 0x1001e8a; /* U+1E8A LATIN CAPITAL LETTER X WITH DOT ABOVE */ pub const XKB_KEY_Ibreve :u32 = 0x100012c; /* U+012C LATIN CAPITAL LETTER I WITH BREVE */ pub const XKB_KEY_Zstroke :u32 = 0x10001b5; /* U+01B5 LATIN CAPITAL LETTER Z WITH STROKE */ pub const XKB_KEY_Gcaron :u32 = 0x10001e6; /* U+01E6 LATIN CAPITAL LETTER G WITH CARON */ pub const XKB_KEY_Ocaron :u32 = 0x10001d1; /* U+01D1 LATIN CAPITAL LETTER O WITH CARON */ pub const XKB_KEY_Obarred :u32 = 0x100019f; /* U+019F LATIN CAPITAL LETTER O WITH MIDDLE TILDE */ pub const XKB_KEY_xabovedot :u32 = 0x1001e8b; /* U+1E8B LATIN SMALL LETTER X WITH DOT ABOVE */ pub const XKB_KEY_ibreve :u32 = 0x100012d; /* U+012D LATIN SMALL LETTER I WITH BREVE */ pub const XKB_KEY_zstroke :u32 = 0x10001b6; /* U+01B6 LATIN SMALL LETTER Z WITH STROKE */ pub const XKB_KEY_gcaron :u32 = 0x10001e7; /* U+01E7 LATIN SMALL LETTER G WITH CARON */ pub const XKB_KEY_ocaron :u32 = 0x10001d2; /* U+01D2 LATIN SMALL LETTER O WITH CARON */ pub const XKB_KEY_obarred :u32 = 0x1000275; /* U+0275 LATIN SMALL LETTER BARRED O */ pub const XKB_KEY_SCHWA :u32 = 0x100018f; /* U+018F LATIN CAPITAL LETTER SCHWA */ pub const XKB_KEY_schwa :u32 = 0x1000259; /* U+0259 LATIN SMALL LETTER SCHWA */ pub const XKB_KEY_EZH :u32 = 0x10001b7; /* U+01B7 LATIN CAPITAL LETTER EZH */ pub const XKB_KEY_ezh :u32 = 0x1000292; /* U+0292 LATIN SMALL LETTER EZH */ /* those are not really Caucasus */ /* For Inupiak */ pub const XKB_KEY_Lbelowdot :u32 = 0x1001e36; /* U+1E36 LATIN CAPITAL LETTER L WITH DOT BELOW */ pub const XKB_KEY_lbelowdot :u32 = 0x1001e37; /* U+1E37 LATIN SMALL LETTER L WITH DOT BELOW */ /* * Vietnamese */ pub const XKB_KEY_Abelowdot :u32 = 0x1001ea0; /* U+1EA0 LATIN CAPITAL LETTER A WITH DOT BELOW */ pub const XKB_KEY_abelowdot :u32 = 0x1001ea1; /* U+1EA1 LATIN SMALL LETTER A WITH DOT BELOW */ pub const XKB_KEY_Ahook :u32 = 0x1001ea2; /* U+1EA2 LATIN CAPITAL LETTER A WITH HOOK ABOVE */ pub const XKB_KEY_ahook :u32 = 0x1001ea3; /* U+1EA3 LATIN SMALL LETTER A WITH HOOK ABOVE */ pub const XKB_KEY_Acircumflexacute :u32 = 0x1001ea4; /* U+1EA4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE */ pub const XKB_KEY_acircumflexacute :u32 = 0x1001ea5; /* U+1EA5 LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE */ pub const XKB_KEY_Acircumflexgrave :u32 = 0x1001ea6; /* U+1EA6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE */ pub const XKB_KEY_acircumflexgrave :u32 = 0x1001ea7; /* U+1EA7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE */ pub const XKB_KEY_Acircumflexhook :u32 = 0x1001ea8; /* U+1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */ pub const XKB_KEY_acircumflexhook :u32 = 0x1001ea9; /* U+1EA9 LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */ pub const XKB_KEY_Acircumflextilde :u32 = 0x1001eaa; /* U+1EAA LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE */ pub const XKB_KEY_acircumflextilde :u32 = 0x1001eab; /* U+1EAB LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE */ pub const XKB_KEY_Acircumflexbelowdot :u32 = 0x1001eac; /* U+1EAC LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW */ pub const XKB_KEY_acircumflexbelowdot :u32 = 0x1001ead; /* U+1EAD LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW */ pub const XKB_KEY_Abreveacute :u32 = 0x1001eae; /* U+1EAE LATIN CAPITAL LETTER A WITH BREVE AND ACUTE */ pub const XKB_KEY_abreveacute :u32 = 0x1001eaf; /* U+1EAF LATIN SMALL LETTER A WITH BREVE AND ACUTE */ pub const XKB_KEY_Abrevegrave :u32 = 0x1001eb0; /* U+1EB0 LATIN CAPITAL LETTER A WITH BREVE AND GRAVE */ pub const XKB_KEY_abrevegrave :u32 = 0x1001eb1; /* U+1EB1 LATIN SMALL LETTER A WITH BREVE AND GRAVE */ pub const XKB_KEY_Abrevehook :u32 = 0x1001eb2; /* U+1EB2 LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE */ pub const XKB_KEY_abrevehook :u32 = 0x1001eb3; /* U+1EB3 LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE */ pub const XKB_KEY_Abrevetilde :u32 = 0x1001eb4; /* U+1EB4 LATIN CAPITAL LETTER A WITH BREVE AND TILDE */ pub const XKB_KEY_abrevetilde :u32 = 0x1001eb5; /* U+1EB5 LATIN SMALL LETTER A WITH BREVE AND TILDE */ pub const XKB_KEY_Abrevebelowdot :u32 = 0x1001eb6; /* U+1EB6 LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW */ pub const XKB_KEY_abrevebelowdot :u32 = 0x1001eb7; /* U+1EB7 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW */ pub const XKB_KEY_Ebelowdot :u32 = 0x1001eb8; /* U+1EB8 LATIN CAPITAL LETTER E WITH DOT BELOW */ pub const XKB_KEY_ebelowdot :u32 = 0x1001eb9; /* U+1EB9 LATIN SMALL LETTER E WITH DOT BELOW */ pub const XKB_KEY_Ehook :u32 = 0x1001eba; /* U+1EBA LATIN CAPITAL LETTER E WITH HOOK ABOVE */ pub const XKB_KEY_ehook :u32 = 0x1001ebb; /* U+1EBB LATIN SMALL LETTER E WITH HOOK ABOVE */ pub const XKB_KEY_Etilde :u32 = 0x1001ebc; /* U+1EBC LATIN CAPITAL LETTER E WITH TILDE */ pub const XKB_KEY_etilde :u32 = 0x1001ebd; /* U+1EBD LATIN SMALL LETTER E WITH TILDE */ pub const XKB_KEY_Ecircumflexacute :u32 = 0x1001ebe; /* U+1EBE LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE */ pub const XKB_KEY_ecircumflexacute :u32 = 0x1001ebf; /* U+1EBF LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE */ pub const XKB_KEY_Ecircumflexgrave :u32 = 0x1001ec0; /* U+1EC0 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE */ pub const XKB_KEY_ecircumflexgrave :u32 = 0x1001ec1; /* U+1EC1 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE */ pub const XKB_KEY_Ecircumflexhook :u32 = 0x1001ec2; /* U+1EC2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */ pub const XKB_KEY_ecircumflexhook :u32 = 0x1001ec3; /* U+1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */ pub const XKB_KEY_Ecircumflextilde :u32 = 0x1001ec4; /* U+1EC4 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE */ pub const XKB_KEY_ecircumflextilde :u32 = 0x1001ec5; /* U+1EC5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE */ pub const XKB_KEY_Ecircumflexbelowdot :u32 = 0x1001ec6; /* U+1EC6 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW */ pub const XKB_KEY_ecircumflexbelowdot :u32 = 0x1001ec7; /* U+1EC7 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW */ pub const XKB_KEY_Ihook :u32 = 0x1001ec8; /* U+1EC8 LATIN CAPITAL LETTER I WITH HOOK ABOVE */ pub const XKB_KEY_ihook :u32 = 0x1001ec9; /* U+1EC9 LATIN SMALL LETTER I WITH HOOK ABOVE */ pub const XKB_KEY_Ibelowdot :u32 = 0x1001eca; /* U+1ECA LATIN CAPITAL LETTER I WITH DOT BELOW */ pub const XKB_KEY_ibelowdot :u32 = 0x1001ecb; /* U+1ECB LATIN SMALL LETTER I WITH DOT BELOW */ pub const XKB_KEY_Obelowdot :u32 = 0x1001ecc; /* U+1ECC LATIN CAPITAL LETTER O WITH DOT BELOW */ pub const XKB_KEY_obelowdot :u32 = 0x1001ecd; /* U+1ECD LATIN SMALL LETTER O WITH DOT BELOW */ pub const XKB_KEY_Ohook :u32 = 0x1001ece; /* U+1ECE LATIN CAPITAL LETTER O WITH HOOK ABOVE */ pub const XKB_KEY_ohook :u32 = 0x1001ecf; /* U+1ECF LATIN SMALL LETTER O WITH HOOK ABOVE */ pub const XKB_KEY_Ocircumflexacute :u32 = 0x1001ed0; /* U+1ED0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE */ pub const XKB_KEY_ocircumflexacute :u32 = 0x1001ed1; /* U+1ED1 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE */ pub const XKB_KEY_Ocircumflexgrave :u32 = 0x1001ed2; /* U+1ED2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE */ pub const XKB_KEY_ocircumflexgrave :u32 = 0x1001ed3; /* U+1ED3 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE */ pub const XKB_KEY_Ocircumflexhook :u32 = 0x1001ed4; /* U+1ED4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */ pub const XKB_KEY_ocircumflexhook :u32 = 0x1001ed5; /* U+1ED5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */ pub const XKB_KEY_Ocircumflextilde :u32 = 0x1001ed6; /* U+1ED6 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE */ pub const XKB_KEY_ocircumflextilde :u32 = 0x1001ed7; /* U+1ED7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE */ pub const XKB_KEY_Ocircumflexbelowdot :u32 = 0x1001ed8; /* U+1ED8 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW */ pub const XKB_KEY_ocircumflexbelowdot :u32 = 0x1001ed9; /* U+1ED9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW */ pub const XKB_KEY_Ohornacute :u32 = 0x1001eda; /* U+1EDA LATIN CAPITAL LETTER O WITH HORN AND ACUTE */ pub const XKB_KEY_ohornacute :u32 = 0x1001edb; /* U+1EDB LATIN SMALL LETTER O WITH HORN AND ACUTE */ pub const XKB_KEY_Ohorngrave :u32 = 0x1001edc; /* U+1EDC LATIN CAPITAL LETTER O WITH HORN AND GRAVE */ pub const XKB_KEY_ohorngrave :u32 = 0x1001edd; /* U+1EDD LATIN SMALL LETTER O WITH HORN AND GRAVE */ pub const XKB_KEY_Ohornhook :u32 = 0x1001ede; /* U+1EDE LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE */ pub const XKB_KEY_ohornhook :u32 = 0x1001edf; /* U+1EDF LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE */ pub const XKB_KEY_Ohorntilde :u32 = 0x1001ee0; /* U+1EE0 LATIN CAPITAL LETTER O WITH HORN AND TILDE */ pub const XKB_KEY_ohorntilde :u32 = 0x1001ee1; /* U+1EE1 LATIN SMALL LETTER O WITH HORN AND TILDE */ pub const XKB_KEY_Ohornbelowdot :u32 = 0x1001ee2; /* U+1EE2 LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW */ pub const XKB_KEY_ohornbelowdot :u32 = 0x1001ee3; /* U+1EE3 LATIN SMALL LETTER O WITH HORN AND DOT BELOW */ pub const XKB_KEY_Ubelowdot :u32 = 0x1001ee4; /* U+1EE4 LATIN CAPITAL LETTER U WITH DOT BELOW */ pub const XKB_KEY_ubelowdot :u32 = 0x1001ee5; /* U+1EE5 LATIN SMALL LETTER U WITH DOT BELOW */ pub const XKB_KEY_Uhook :u32 = 0x1001ee6; /* U+1EE6 LATIN CAPITAL LETTER U WITH HOOK ABOVE */ pub const XKB_KEY_uhook :u32 = 0x1001ee7; /* U+1EE7 LATIN SMALL LETTER U WITH HOOK ABOVE */ pub const XKB_KEY_Uhornacute :u32 = 0x1001ee8; /* U+1EE8 LATIN CAPITAL LETTER U WITH HORN AND ACUTE */ pub const XKB_KEY_uhornacute :u32 = 0x1001ee9; /* U+1EE9 LATIN SMALL LETTER U WITH HORN AND ACUTE */ pub const XKB_KEY_Uhorngrave :u32 = 0x1001eea; /* U+1EEA LATIN CAPITAL LETTER U WITH HORN AND GRAVE */ pub const XKB_KEY_uhorngrave :u32 = 0x1001eeb; /* U+1EEB LATIN SMALL LETTER U WITH HORN AND GRAVE */ pub const XKB_KEY_Uhornhook :u32 = 0x1001eec; /* U+1EEC LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE */ pub const XKB_KEY_uhornhook :u32 = 0x1001eed; /* U+1EED LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE */ pub const XKB_KEY_Uhorntilde :u32 = 0x1001eee; /* U+1EEE LATIN CAPITAL LETTER U WITH HORN AND TILDE */ pub const XKB_KEY_uhorntilde :u32 = 0x1001eef; /* U+1EEF LATIN SMALL LETTER U WITH HORN AND TILDE */ pub const XKB_KEY_Uhornbelowdot :u32 = 0x1001ef0; /* U+1EF0 LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW */ pub const XKB_KEY_uhornbelowdot :u32 = 0x1001ef1; /* U+1EF1 LATIN SMALL LETTER U WITH HORN AND DOT BELOW */ pub const XKB_KEY_Ybelowdot :u32 = 0x1001ef4; /* U+1EF4 LATIN CAPITAL LETTER Y WITH DOT BELOW */ pub const XKB_KEY_ybelowdot :u32 = 0x1001ef5; /* U+1EF5 LATIN SMALL LETTER Y WITH DOT BELOW */ pub const XKB_KEY_Yhook :u32 = 0x1001ef6; /* U+1EF6 LATIN CAPITAL LETTER Y WITH HOOK ABOVE */ pub const XKB_KEY_yhook :u32 = 0x1001ef7; /* U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE */ pub const XKB_KEY_Ytilde :u32 = 0x1001ef8; /* U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE */ pub const XKB_KEY_ytilde :u32 = 0x1001ef9; /* U+1EF9 LATIN SMALL LETTER Y WITH TILDE */ pub const XKB_KEY_Ohorn :u32 = 0x10001a0; /* U+01A0 LATIN CAPITAL LETTER O WITH HORN */ pub const XKB_KEY_ohorn :u32 = 0x10001a1; /* U+01A1 LATIN SMALL LETTER O WITH HORN */ pub const XKB_KEY_Uhorn :u32 = 0x10001af; /* U+01AF LATIN CAPITAL LETTER U WITH HORN */ pub const XKB_KEY_uhorn :u32 = 0x10001b0; /* U+01B0 LATIN SMALL LETTER U WITH HORN */ pub const XKB_KEY_EcuSign :u32 = 0x10020a0; /* U+20A0 EURO-CURRENCY SIGN */ pub const XKB_KEY_ColonSign :u32 = 0x10020a1; /* U+20A1 COLON SIGN */ pub const XKB_KEY_CruzeiroSign :u32 = 0x10020a2; /* U+20A2 CRUZEIRO SIGN */ pub const XKB_KEY_FFrancSign :u32 = 0x10020a3; /* U+20A3 FRENCH FRANC SIGN */ pub const XKB_KEY_LiraSign :u32 = 0x10020a4; /* U+20A4 LIRA SIGN */ pub const XKB_KEY_MillSign :u32 = 0x10020a5; /* U+20A5 MILL SIGN */ pub const XKB_KEY_NairaSign :u32 = 0x10020a6; /* U+20A6 NAIRA SIGN */ pub const XKB_KEY_PesetaSign :u32 = 0x10020a7; /* U+20A7 PESETA SIGN */ pub const XKB_KEY_RupeeSign :u32 = 0x10020a8; /* U+20A8 RUPEE SIGN */ pub const XKB_KEY_WonSign :u32 = 0x10020a9; /* U+20A9 WON SIGN */ pub const XKB_KEY_NewSheqelSign :u32 = 0x10020aa; /* U+20AA NEW SHEQEL SIGN */ pub const XKB_KEY_DongSign :u32 = 0x10020ab; /* U+20AB DONG SIGN */ pub const XKB_KEY_EuroSign :u32 = 0x20ac; /* U+20AC EURO SIGN */ /* one, two and three are defined above. */ pub const XKB_KEY_zerosuperior :u32 = 0x1002070; /* U+2070 SUPERSCRIPT ZERO */ pub const XKB_KEY_foursuperior :u32 = 0x1002074; /* U+2074 SUPERSCRIPT FOUR */ pub const XKB_KEY_fivesuperior :u32 = 0x1002075; /* U+2075 SUPERSCRIPT FIVE */ pub const XKB_KEY_sixsuperior :u32 = 0x1002076; /* U+2076 SUPERSCRIPT SIX */ pub const XKB_KEY_sevensuperior :u32 = 0x1002077; /* U+2077 SUPERSCRIPT SEVEN */ pub const XKB_KEY_eightsuperior :u32 = 0x1002078; /* U+2078 SUPERSCRIPT EIGHT */ pub const XKB_KEY_ninesuperior :u32 = 0x1002079; /* U+2079 SUPERSCRIPT NINE */ pub const XKB_KEY_zerosubscript :u32 = 0x1002080; /* U+2080 SUBSCRIPT ZERO */ pub const XKB_KEY_onesubscript :u32 = 0x1002081; /* U+2081 SUBSCRIPT ONE */ pub const XKB_KEY_twosubscript :u32 = 0x1002082; /* U+2082 SUBSCRIPT TWO */ pub const XKB_KEY_threesubscript :u32 = 0x1002083; /* U+2083 SUBSCRIPT THREE */ pub const XKB_KEY_foursubscript :u32 = 0x1002084; /* U+2084 SUBSCRIPT FOUR */ pub const XKB_KEY_fivesubscript :u32 = 0x1002085; /* U+2085 SUBSCRIPT FIVE */ pub const XKB_KEY_sixsubscript :u32 = 0x1002086; /* U+2086 SUBSCRIPT SIX */ pub const XKB_KEY_sevensubscript :u32 = 0x1002087; /* U+2087 SUBSCRIPT SEVEN */ pub const XKB_KEY_eightsubscript :u32 = 0x1002088; /* U+2088 SUBSCRIPT EIGHT */ pub const XKB_KEY_ninesubscript :u32 = 0x1002089; /* U+2089 SUBSCRIPT NINE */ pub const XKB_KEY_partdifferential :u32 = 0x1002202; /* U+2202 PARTIAL DIFFERENTIAL */ pub const XKB_KEY_emptyset :u32 = 0x1002205; /* U+2205 NULL SET */ pub const XKB_KEY_elementof :u32 = 0x1002208; /* U+2208 ELEMENT OF */ pub const XKB_KEY_notelementof :u32 = 0x1002209; /* U+2209 NOT AN ELEMENT OF */ pub const XKB_KEY_containsas :u32 = 0x100220B; /* U+220B CONTAINS AS MEMBER */ pub const XKB_KEY_squareroot :u32 = 0x100221A; /* U+221A SQUARE ROOT */ pub const XKB_KEY_cuberoot :u32 = 0x100221B; /* U+221B CUBE ROOT */ pub const XKB_KEY_fourthroot :u32 = 0x100221C; /* U+221C FOURTH ROOT */ pub const XKB_KEY_dintegral :u32 = 0x100222C; /* U+222C DOUBLE INTEGRAL */ pub const XKB_KEY_tintegral :u32 = 0x100222D; /* U+222D TRIPLE INTEGRAL */ pub const XKB_KEY_because :u32 = 0x1002235; /* U+2235 BECAUSE */ pub const XKB_KEY_approxeq :u32 = 0x1002248; /* U+2245 ALMOST EQUAL TO */ pub const XKB_KEY_notapproxeq :u32 = 0x1002247; /* U+2247 NOT ALMOST EQUAL TO */ pub const XKB_KEY_notidentical :u32 = 0x1002262; /* U+2262 NOT IDENTICAL TO */ pub const XKB_KEY_stricteq :u32 = 0x1002263; /* U+2263 STRICTLY EQUIVALENT TO */ pub const XKB_KEY_braille_dot_1 :u32 = 0xfff1; pub const XKB_KEY_braille_dot_2 :u32 = 0xfff2; pub const XKB_KEY_braille_dot_3 :u32 = 0xfff3; pub const XKB_KEY_braille_dot_4 :u32 = 0xfff4; pub const XKB_KEY_braille_dot_5 :u32 = 0xfff5; pub const XKB_KEY_braille_dot_6 :u32 = 0xfff6; pub const XKB_KEY_braille_dot_7 :u32 = 0xfff7; pub const XKB_KEY_braille_dot_8 :u32 = 0xfff8; pub const XKB_KEY_braille_dot_9 :u32 = 0xfff9; pub const XKB_KEY_braille_dot_10 :u32 = 0xfffa; pub const XKB_KEY_braille_blank :u32 = 0x1002800; /* U+2800 BRAILLE PATTERN BLANK */ pub const XKB_KEY_braille_dots_1 :u32 = 0x1002801; /* U+2801 BRAILLE PATTERN DOTS-1 */ pub const XKB_KEY_braille_dots_2 :u32 = 0x1002802; /* U+2802 BRAILLE PATTERN DOTS-2 */ pub const XKB_KEY_braille_dots_12 :u32 = 0x1002803; /* U+2803 BRAILLE PATTERN DOTS-12 */ pub const XKB_KEY_braille_dots_3 :u32 = 0x1002804; /* U+2804 BRAILLE PATTERN DOTS-3 */ pub const XKB_KEY_braille_dots_13 :u32 = 0x1002805; /* U+2805 BRAILLE PATTERN DOTS-13 */ pub const XKB_KEY_braille_dots_23 :u32 = 0x1002806; /* U+2806 BRAILLE PATTERN DOTS-23 */ pub const XKB_KEY_braille_dots_123 :u32 = 0x1002807; /* U+2807 BRAILLE PATTERN DOTS-123 */ pub const XKB_KEY_braille_dots_4 :u32 = 0x1002808; /* U+2808 BRAILLE PATTERN DOTS-4 */ pub const XKB_KEY_braille_dots_14 :u32 = 0x1002809; /* U+2809 BRAILLE PATTERN DOTS-14 */ pub const XKB_KEY_braille_dots_24 :u32 = 0x100280a; /* U+280a BRAILLE PATTERN DOTS-24 */ pub const XKB_KEY_braille_dots_124 :u32 = 0x100280b; /* U+280b BRAILLE PATTERN DOTS-124 */ pub const XKB_KEY_braille_dots_34 :u32 = 0x100280c; /* U+280c BRAILLE PATTERN DOTS-34 */ pub const XKB_KEY_braille_dots_134 :u32 = 0x100280d; /* U+280d BRAILLE PATTERN DOTS-134 */ pub const XKB_KEY_braille_dots_234 :u32 = 0x100280e; /* U+280e BRAILLE PATTERN DOTS-234 */ pub const XKB_KEY_braille_dots_1234 :u32 = 0x100280f; /* U+280f BRAILLE PATTERN DOTS-1234 */ pub const XKB_KEY_braille_dots_5 :u32 = 0x1002810; /* U+2810 BRAILLE PATTERN DOTS-5 */ pub const XKB_KEY_braille_dots_15 :u32 = 0x1002811; /* U+2811 BRAILLE PATTERN DOTS-15 */ pub const XKB_KEY_braille_dots_25 :u32 = 0x1002812; /* U+2812 BRAILLE PATTERN DOTS-25 */ pub const XKB_KEY_braille_dots_125 :u32 = 0x1002813; /* U+2813 BRAILLE PATTERN DOTS-125 */ pub const XKB_KEY_braille_dots_35 :u32 = 0x1002814; /* U+2814 BRAILLE PATTERN DOTS-35 */ pub const XKB_KEY_braille_dots_135 :u32 = 0x1002815; /* U+2815 BRAILLE PATTERN DOTS-135 */ pub const XKB_KEY_braille_dots_235 :u32 = 0x1002816; /* U+2816 BRAILLE PATTERN DOTS-235 */ pub const XKB_KEY_braille_dots_1235 :u32 = 0x1002817; /* U+2817 BRAILLE PATTERN DOTS-1235 */ pub const XKB_KEY_braille_dots_45 :u32 = 0x1002818; /* U+2818 BRAILLE PATTERN DOTS-45 */ pub const XKB_KEY_braille_dots_145 :u32 = 0x1002819; /* U+2819 BRAILLE PATTERN DOTS-145 */ pub const XKB_KEY_braille_dots_245 :u32 = 0x100281a; /* U+281a BRAILLE PATTERN DOTS-245 */ pub const XKB_KEY_braille_dots_1245 :u32 = 0x100281b; /* U+281b BRAILLE PATTERN DOTS-1245 */ pub const XKB_KEY_braille_dots_345 :u32 = 0x100281c; /* U+281c BRAILLE PATTERN DOTS-345 */ pub const XKB_KEY_braille_dots_1345 :u32 = 0x100281d; /* U+281d BRAILLE PATTERN DOTS-1345 */ pub const XKB_KEY_braille_dots_2345 :u32 = 0x100281e; /* U+281e BRAILLE PATTERN DOTS-2345 */ pub const XKB_KEY_braille_dots_12345 :u32 = 0x100281f; /* U+281f BRAILLE PATTERN DOTS-12345 */ pub const XKB_KEY_braille_dots_6 :u32 = 0x1002820; /* U+2820 BRAILLE PATTERN DOTS-6 */ pub const XKB_KEY_braille_dots_16 :u32 = 0x1002821; /* U+2821 BRAILLE PATTERN DOTS-16 */ pub const XKB_KEY_braille_dots_26 :u32 = 0x1002822; /* U+2822 BRAILLE PATTERN DOTS-26 */ pub const XKB_KEY_braille_dots_126 :u32 = 0x1002823; /* U+2823 BRAILLE PATTERN DOTS-126 */ pub const XKB_KEY_braille_dots_36 :u32 = 0x1002824; /* U+2824 BRAILLE PATTERN DOTS-36 */ pub const XKB_KEY_braille_dots_136 :u32 = 0x1002825; /* U+2825 BRAILLE PATTERN DOTS-136 */ pub const XKB_KEY_braille_dots_236 :u32 = 0x1002826; /* U+2826 BRAILLE PATTERN DOTS-236 */ pub const XKB_KEY_braille_dots_1236 :u32 = 0x1002827; /* U+2827 BRAILLE PATTERN DOTS-1236 */ pub const XKB_KEY_braille_dots_46 :u32 = 0x1002828; /* U+2828 BRAILLE PATTERN DOTS-46 */ pub const XKB_KEY_braille_dots_146 :u32 = 0x1002829; /* U+2829 BRAILLE PATTERN DOTS-146 */ pub const XKB_KEY_braille_dots_246 :u32 = 0x100282a; /* U+282a BRAILLE PATTERN DOTS-246 */ pub const XKB_KEY_braille_dots_1246 :u32 = 0x100282b; /* U+282b BRAILLE PATTERN DOTS-1246 */ pub const XKB_KEY_braille_dots_346 :u32 = 0x100282c; /* U+282c BRAILLE PATTERN DOTS-346 */ pub const XKB_KEY_braille_dots_1346 :u32 = 0x100282d; /* U+282d BRAILLE PATTERN DOTS-1346 */ pub const XKB_KEY_braille_dots_2346 :u32 = 0x100282e; /* U+282e BRAILLE PATTERN DOTS-2346 */ pub const XKB_KEY_braille_dots_12346 :u32 = 0x100282f; /* U+282f BRAILLE PATTERN DOTS-12346 */ pub const XKB_KEY_braille_dots_56 :u32 = 0x1002830; /* U+2830 BRAILLE PATTERN DOTS-56 */ pub const XKB_KEY_braille_dots_156 :u32 = 0x1002831; /* U+2831 BRAILLE PATTERN DOTS-156 */ pub const XKB_KEY_braille_dots_256 :u32 = 0x1002832; /* U+2832 BRAILLE PATTERN DOTS-256 */ pub const XKB_KEY_braille_dots_1256 :u32 = 0x1002833; /* U+2833 BRAILLE PATTERN DOTS-1256 */ pub const XKB_KEY_braille_dots_356 :u32 = 0x1002834; /* U+2834 BRAILLE PATTERN DOTS-356 */ pub const XKB_KEY_braille_dots_1356 :u32 = 0x1002835; /* U+2835 BRAILLE PATTERN DOTS-1356 */ pub const XKB_KEY_braille_dots_2356 :u32 = 0x1002836; /* U+2836 BRAILLE PATTERN DOTS-2356 */ pub const XKB_KEY_braille_dots_12356 :u32 = 0x1002837; /* U+2837 BRAILLE PATTERN DOTS-12356 */ pub const XKB_KEY_braille_dots_456 :u32 = 0x1002838; /* U+2838 BRAILLE PATTERN DOTS-456 */ pub const XKB_KEY_braille_dots_1456 :u32 = 0x1002839; /* U+2839 BRAILLE PATTERN DOTS-1456 */ pub const XKB_KEY_braille_dots_2456 :u32 = 0x100283a; /* U+283a BRAILLE PATTERN DOTS-2456 */ pub const XKB_KEY_braille_dots_12456 :u32 = 0x100283b; /* U+283b BRAILLE PATTERN DOTS-12456 */ pub const XKB_KEY_braille_dots_3456 :u32 = 0x100283c; /* U+283c BRAILLE PATTERN DOTS-3456 */ pub const XKB_KEY_braille_dots_13456 :u32 = 0x100283d; /* U+283d BRAILLE PATTERN DOTS-13456 */ pub const XKB_KEY_braille_dots_23456 :u32 = 0x100283e; /* U+283e BRAILLE PATTERN DOTS-23456 */ pub const XKB_KEY_braille_dots_123456 :u32 = 0x100283f; /* U+283f BRAILLE PATTERN DOTS-123456 */ pub const XKB_KEY_braille_dots_7 :u32 = 0x1002840; /* U+2840 BRAILLE PATTERN DOTS-7 */ pub const XKB_KEY_braille_dots_17 :u32 = 0x1002841; /* U+2841 BRAILLE PATTERN DOTS-17 */ pub const XKB_KEY_braille_dots_27 :u32 = 0x1002842; /* U+2842 BRAILLE PATTERN DOTS-27 */ pub const XKB_KEY_braille_dots_127 :u32 = 0x1002843; /* U+2843 BRAILLE PATTERN DOTS-127 */ pub const XKB_KEY_braille_dots_37 :u32 = 0x1002844; /* U+2844 BRAILLE PATTERN DOTS-37 */ pub const XKB_KEY_braille_dots_137 :u32 = 0x1002845; /* U+2845 BRAILLE PATTERN DOTS-137 */ pub const XKB_KEY_braille_dots_237 :u32 = 0x1002846; /* U+2846 BRAILLE PATTERN DOTS-237 */ pub const XKB_KEY_braille_dots_1237 :u32 = 0x1002847; /* U+2847 BRAILLE PATTERN DOTS-1237 */ pub const XKB_KEY_braille_dots_47 :u32 = 0x1002848; /* U+2848 BRAILLE PATTERN DOTS-47 */ pub const XKB_KEY_braille_dots_147 :u32 = 0x1002849; /* U+2849 BRAILLE PATTERN DOTS-147 */ pub const XKB_KEY_braille_dots_247 :u32 = 0x100284a; /* U+284a BRAILLE PATTERN DOTS-247 */ pub const XKB_KEY_braille_dots_1247 :u32 = 0x100284b; /* U+284b BRAILLE PATTERN DOTS-1247 */ pub const XKB_KEY_braille_dots_347 :u32 = 0x100284c; /* U+284c BRAILLE PATTERN DOTS-347 */ pub const XKB_KEY_braille_dots_1347 :u32 = 0x100284d; /* U+284d BRAILLE PATTERN DOTS-1347 */ pub const XKB_KEY_braille_dots_2347 :u32 = 0x100284e; /* U+284e BRAILLE PATTERN DOTS-2347 */ pub const XKB_KEY_braille_dots_12347 :u32 = 0x100284f; /* U+284f BRAILLE PATTERN DOTS-12347 */ pub const XKB_KEY_braille_dots_57 :u32 = 0x1002850; /* U+2850 BRAILLE PATTERN DOTS-57 */ pub const XKB_KEY_braille_dots_157 :u32 = 0x1002851; /* U+2851 BRAILLE PATTERN DOTS-157 */ pub const XKB_KEY_braille_dots_257 :u32 = 0x1002852; /* U+2852 BRAILLE PATTERN DOTS-257 */ pub const XKB_KEY_braille_dots_1257 :u32 = 0x1002853; /* U+2853 BRAILLE PATTERN DOTS-1257 */ pub const XKB_KEY_braille_dots_357 :u32 = 0x1002854; /* U+2854 BRAILLE PATTERN DOTS-357 */ pub const XKB_KEY_braille_dots_1357 :u32 = 0x1002855; /* U+2855 BRAILLE PATTERN DOTS-1357 */ pub const XKB_KEY_braille_dots_2357 :u32 = 0x1002856; /* U+2856 BRAILLE PATTERN DOTS-2357 */ pub const XKB_KEY_braille_dots_12357 :u32 = 0x1002857; /* U+2857 BRAILLE PATTERN DOTS-12357 */ pub const XKB_KEY_braille_dots_457 :u32 = 0x1002858; /* U+2858 BRAILLE PATTERN DOTS-457 */ pub const XKB_KEY_braille_dots_1457 :u32 = 0x1002859; /* U+2859 BRAILLE PATTERN DOTS-1457 */ pub const XKB_KEY_braille_dots_2457 :u32 = 0x100285a; /* U+285a BRAILLE PATTERN DOTS-2457 */ pub const XKB_KEY_braille_dots_12457 :u32 = 0x100285b; /* U+285b BRAILLE PATTERN DOTS-12457 */ pub const XKB_KEY_braille_dots_3457 :u32 = 0x100285c; /* U+285c BRAILLE PATTERN DOTS-3457 */ pub const XKB_KEY_braille_dots_13457 :u32 = 0x100285d; /* U+285d BRAILLE PATTERN DOTS-13457 */ pub const XKB_KEY_braille_dots_23457 :u32 = 0x100285e; /* U+285e BRAILLE PATTERN DOTS-23457 */ pub const XKB_KEY_braille_dots_123457 :u32 = 0x100285f; /* U+285f BRAILLE PATTERN DOTS-123457 */ pub const XKB_KEY_braille_dots_67 :u32 = 0x1002860; /* U+2860 BRAILLE PATTERN DOTS-67 */ pub const XKB_KEY_braille_dots_167 :u32 = 0x1002861; /* U+2861 BRAILLE PATTERN DOTS-167 */ pub const XKB_KEY_braille_dots_267 :u32 = 0x1002862; /* U+2862 BRAILLE PATTERN DOTS-267 */ pub const XKB_KEY_braille_dots_1267 :u32 = 0x1002863; /* U+2863 BRAILLE PATTERN DOTS-1267 */ pub const XKB_KEY_braille_dots_367 :u32 = 0x1002864; /* U+2864 BRAILLE PATTERN DOTS-367 */ pub const XKB_KEY_braille_dots_1367 :u32 = 0x1002865; /* U+2865 BRAILLE PATTERN DOTS-1367 */ pub const XKB_KEY_braille_dots_2367 :u32 = 0x1002866; /* U+2866 BRAILLE PATTERN DOTS-2367 */ pub const XKB_KEY_braille_dots_12367 :u32 = 0x1002867; /* U+2867 BRAILLE PATTERN DOTS-12367 */ pub const XKB_KEY_braille_dots_467 :u32 = 0x1002868; /* U+2868 BRAILLE PATTERN DOTS-467 */ pub const XKB_KEY_braille_dots_1467 :u32 = 0x1002869; /* U+2869 BRAILLE PATTERN DOTS-1467 */ pub const XKB_KEY_braille_dots_2467 :u32 = 0x100286a; /* U+286a BRAILLE PATTERN DOTS-2467 */ pub const XKB_KEY_braille_dots_12467 :u32 = 0x100286b; /* U+286b BRAILLE PATTERN DOTS-12467 */ pub const XKB_KEY_braille_dots_3467 :u32 = 0x100286c; /* U+286c BRAILLE PATTERN DOTS-3467 */ pub const XKB_KEY_braille_dots_13467 :u32 = 0x100286d; /* U+286d BRAILLE PATTERN DOTS-13467 */ pub const XKB_KEY_braille_dots_23467 :u32 = 0x100286e; /* U+286e BRAILLE PATTERN DOTS-23467 */ pub const XKB_KEY_braille_dots_123467 :u32 = 0x100286f; /* U+286f BRAILLE PATTERN DOTS-123467 */ pub const XKB_KEY_braille_dots_567 :u32 = 0x1002870; /* U+2870 BRAILLE PATTERN DOTS-567 */ pub const XKB_KEY_braille_dots_1567 :u32 = 0x1002871; /* U+2871 BRAILLE PATTERN DOTS-1567 */ pub const XKB_KEY_braille_dots_2567 :u32 = 0x1002872; /* U+2872 BRAILLE PATTERN DOTS-2567 */ pub const XKB_KEY_braille_dots_12567 :u32 = 0x1002873; /* U+2873 BRAILLE PATTERN DOTS-12567 */ pub const XKB_KEY_braille_dots_3567 :u32 = 0x1002874; /* U+2874 BRAILLE PATTERN DOTS-3567 */ pub const XKB_KEY_braille_dots_13567 :u32 = 0x1002875; /* U+2875 BRAILLE PATTERN DOTS-13567 */ pub const XKB_KEY_braille_dots_23567 :u32 = 0x1002876; /* U+2876 BRAILLE PATTERN DOTS-23567 */ pub const XKB_KEY_braille_dots_123567 :u32 = 0x1002877; /* U+2877 BRAILLE PATTERN DOTS-123567 */ pub const XKB_KEY_braille_dots_4567 :u32 = 0x1002878; /* U+2878 BRAILLE PATTERN DOTS-4567 */ pub const XKB_KEY_braille_dots_14567 :u32 = 0x1002879; /* U+2879 BRAILLE PATTERN DOTS-14567 */ pub const XKB_KEY_braille_dots_24567 :u32 = 0x100287a; /* U+287a BRAILLE PATTERN DOTS-24567 */ pub const XKB_KEY_braille_dots_124567 :u32 = 0x100287b; /* U+287b BRAILLE PATTERN DOTS-124567 */ pub const XKB_KEY_braille_dots_34567 :u32 = 0x100287c; /* U+287c BRAILLE PATTERN DOTS-34567 */ pub const XKB_KEY_braille_dots_134567 :u32 = 0x100287d; /* U+287d BRAILLE PATTERN DOTS-134567 */ pub const XKB_KEY_braille_dots_234567 :u32 = 0x100287e; /* U+287e BRAILLE PATTERN DOTS-234567 */ pub const XKB_KEY_braille_dots_1234567 :u32 = 0x100287f; /* U+287f BRAILLE PATTERN DOTS-1234567 */ pub const XKB_KEY_braille_dots_8 :u32 = 0x1002880; /* U+2880 BRAILLE PATTERN DOTS-8 */ pub const XKB_KEY_braille_dots_18 :u32 = 0x1002881; /* U+2881 BRAILLE PATTERN DOTS-18 */ pub const XKB_KEY_braille_dots_28 :u32 = 0x1002882; /* U+2882 BRAILLE PATTERN DOTS-28 */ pub const XKB_KEY_braille_dots_128 :u32 = 0x1002883; /* U+2883 BRAILLE PATTERN DOTS-128 */ pub const XKB_KEY_braille_dots_38 :u32 = 0x1002884; /* U+2884 BRAILLE PATTERN DOTS-38 */ pub const XKB_KEY_braille_dots_138 :u32 = 0x1002885; /* U+2885 BRAILLE PATTERN DOTS-138 */ pub const XKB_KEY_braille_dots_238 :u32 = 0x1002886; /* U+2886 BRAILLE PATTERN DOTS-238 */ pub const XKB_KEY_braille_dots_1238 :u32 = 0x1002887; /* U+2887 BRAILLE PATTERN DOTS-1238 */ pub const XKB_KEY_braille_dots_48 :u32 = 0x1002888; /* U+2888 BRAILLE PATTERN DOTS-48 */ pub const XKB_KEY_braille_dots_148 :u32 = 0x1002889; /* U+2889 BRAILLE PATTERN DOTS-148 */ pub const XKB_KEY_braille_dots_248 :u32 = 0x100288a; /* U+288a BRAILLE PATTERN DOTS-248 */ pub const XKB_KEY_braille_dots_1248 :u32 = 0x100288b; /* U+288b BRAILLE PATTERN DOTS-1248 */ pub const XKB_KEY_braille_dots_348 :u32 = 0x100288c; /* U+288c BRAILLE PATTERN DOTS-348 */ pub const XKB_KEY_braille_dots_1348 :u32 = 0x100288d; /* U+288d BRAILLE PATTERN DOTS-1348 */ pub const XKB_KEY_braille_dots_2348 :u32 = 0x100288e; /* U+288e BRAILLE PATTERN DOTS-2348 */ pub const XKB_KEY_braille_dots_12348 :u32 = 0x100288f; /* U+288f BRAILLE PATTERN DOTS-12348 */ pub const XKB_KEY_braille_dots_58 :u32 = 0x1002890; /* U+2890 BRAILLE PATTERN DOTS-58 */ pub const XKB_KEY_braille_dots_158 :u32 = 0x1002891; /* U+2891 BRAILLE PATTERN DOTS-158 */ pub const XKB_KEY_braille_dots_258 :u32 = 0x1002892; /* U+2892 BRAILLE PATTERN DOTS-258 */ pub const XKB_KEY_braille_dots_1258 :u32 = 0x1002893; /* U+2893 BRAILLE PATTERN DOTS-1258 */ pub const XKB_KEY_braille_dots_358 :u32 = 0x1002894; /* U+2894 BRAILLE PATTERN DOTS-358 */ pub const XKB_KEY_braille_dots_1358 :u32 = 0x1002895; /* U+2895 BRAILLE PATTERN DOTS-1358 */ pub const XKB_KEY_braille_dots_2358 :u32 = 0x1002896; /* U+2896 BRAILLE PATTERN DOTS-2358 */ pub const XKB_KEY_braille_dots_12358 :u32 = 0x1002897; /* U+2897 BRAILLE PATTERN DOTS-12358 */ pub const XKB_KEY_braille_dots_458 :u32 = 0x1002898; /* U+2898 BRAILLE PATTERN DOTS-458 */ pub const XKB_KEY_braille_dots_1458 :u32 = 0x1002899; /* U+2899 BRAILLE PATTERN DOTS-1458 */ pub const XKB_KEY_braille_dots_2458 :u32 = 0x100289a; /* U+289a BRAILLE PATTERN DOTS-2458 */ pub const XKB_KEY_braille_dots_12458 :u32 = 0x100289b; /* U+289b BRAILLE PATTERN DOTS-12458 */ pub const XKB_KEY_braille_dots_3458 :u32 = 0x100289c; /* U+289c BRAILLE PATTERN DOTS-3458 */ pub const XKB_KEY_braille_dots_13458 :u32 = 0x100289d; /* U+289d BRAILLE PATTERN DOTS-13458 */ pub const XKB_KEY_braille_dots_23458 :u32 = 0x100289e; /* U+289e BRAILLE PATTERN DOTS-23458 */ pub const XKB_KEY_braille_dots_123458 :u32 = 0x100289f; /* U+289f BRAILLE PATTERN DOTS-123458 */ pub const XKB_KEY_braille_dots_68 :u32 = 0x10028a0; /* U+28a0 BRAILLE PATTERN DOTS-68 */ pub const XKB_KEY_braille_dots_168 :u32 = 0x10028a1; /* U+28a1 BRAILLE PATTERN DOTS-168 */ pub const XKB_KEY_braille_dots_268 :u32 = 0x10028a2; /* U+28a2 BRAILLE PATTERN DOTS-268 */ pub const XKB_KEY_braille_dots_1268 :u32 = 0x10028a3; /* U+28a3 BRAILLE PATTERN DOTS-1268 */ pub const XKB_KEY_braille_dots_368 :u32 = 0x10028a4; /* U+28a4 BRAILLE PATTERN DOTS-368 */ pub const XKB_KEY_braille_dots_1368 :u32 = 0x10028a5; /* U+28a5 BRAILLE PATTERN DOTS-1368 */ pub const XKB_KEY_braille_dots_2368 :u32 = 0x10028a6; /* U+28a6 BRAILLE PATTERN DOTS-2368 */ pub const XKB_KEY_braille_dots_12368 :u32 = 0x10028a7; /* U+28a7 BRAILLE PATTERN DOTS-12368 */ pub const XKB_KEY_braille_dots_468 :u32 = 0x10028a8; /* U+28a8 BRAILLE PATTERN DOTS-468 */ pub const XKB_KEY_braille_dots_1468 :u32 = 0x10028a9; /* U+28a9 BRAILLE PATTERN DOTS-1468 */ pub const XKB_KEY_braille_dots_2468 :u32 = 0x10028aa; /* U+28aa BRAILLE PATTERN DOTS-2468 */ pub const XKB_KEY_braille_dots_12468 :u32 = 0x10028ab; /* U+28ab BRAILLE PATTERN DOTS-12468 */ pub const XKB_KEY_braille_dots_3468 :u32 = 0x10028ac; /* U+28ac BRAILLE PATTERN DOTS-3468 */ pub const XKB_KEY_braille_dots_13468 :u32 = 0x10028ad; /* U+28ad BRAILLE PATTERN DOTS-13468 */ pub const XKB_KEY_braille_dots_23468 :u32 = 0x10028ae; /* U+28ae BRAILLE PATTERN DOTS-23468 */ pub const XKB_KEY_braille_dots_123468 :u32 = 0x10028af; /* U+28af BRAILLE PATTERN DOTS-123468 */ pub const XKB_KEY_braille_dots_568 :u32 = 0x10028b0; /* U+28b0 BRAILLE PATTERN DOTS-568 */ pub const XKB_KEY_braille_dots_1568 :u32 = 0x10028b1; /* U+28b1 BRAILLE PATTERN DOTS-1568 */ pub const XKB_KEY_braille_dots_2568 :u32 = 0x10028b2; /* U+28b2 BRAILLE PATTERN DOTS-2568 */ pub const XKB_KEY_braille_dots_12568 :u32 = 0x10028b3; /* U+28b3 BRAILLE PATTERN DOTS-12568 */ pub const XKB_KEY_braille_dots_3568 :u32 = 0x10028b4; /* U+28b4 BRAILLE PATTERN DOTS-3568 */ pub const XKB_KEY_braille_dots_13568 :u32 = 0x10028b5; /* U+28b5 BRAILLE PATTERN DOTS-13568 */ pub const XKB_KEY_braille_dots_23568 :u32 = 0x10028b6; /* U+28b6 BRAILLE PATTERN DOTS-23568 */ pub const XKB_KEY_braille_dots_123568 :u32 = 0x10028b7; /* U+28b7 BRAILLE PATTERN DOTS-123568 */ pub const XKB_KEY_braille_dots_4568 :u32 = 0x10028b8; /* U+28b8 BRAILLE PATTERN DOTS-4568 */ pub const XKB_KEY_braille_dots_14568 :u32 = 0x10028b9; /* U+28b9 BRAILLE PATTERN DOTS-14568 */ pub const XKB_KEY_braille_dots_24568 :u32 = 0x10028ba; /* U+28ba BRAILLE PATTERN DOTS-24568 */ pub const XKB_KEY_braille_dots_124568 :u32 = 0x10028bb; /* U+28bb BRAILLE PATTERN DOTS-124568 */ pub const XKB_KEY_braille_dots_34568 :u32 = 0x10028bc; /* U+28bc BRAILLE PATTERN DOTS-34568 */ pub const XKB_KEY_braille_dots_134568 :u32 = 0x10028bd; /* U+28bd BRAILLE PATTERN DOTS-134568 */ pub const XKB_KEY_braille_dots_234568 :u32 = 0x10028be; /* U+28be BRAILLE PATTERN DOTS-234568 */ pub const XKB_KEY_braille_dots_1234568 :u32 = 0x10028bf; /* U+28bf BRAILLE PATTERN DOTS-1234568 */ pub const XKB_KEY_braille_dots_78 :u32 = 0x10028c0; /* U+28c0 BRAILLE PATTERN DOTS-78 */ pub const XKB_KEY_braille_dots_178 :u32 = 0x10028c1; /* U+28c1 BRAILLE PATTERN DOTS-178 */ pub const XKB_KEY_braille_dots_278 :u32 = 0x10028c2; /* U+28c2 BRAILLE PATTERN DOTS-278 */ pub const XKB_KEY_braille_dots_1278 :u32 = 0x10028c3; /* U+28c3 BRAILLE PATTERN DOTS-1278 */ pub const XKB_KEY_braille_dots_378 :u32 = 0x10028c4; /* U+28c4 BRAILLE PATTERN DOTS-378 */ pub const XKB_KEY_braille_dots_1378 :u32 = 0x10028c5; /* U+28c5 BRAILLE PATTERN DOTS-1378 */ pub const XKB_KEY_braille_dots_2378 :u32 = 0x10028c6; /* U+28c6 BRAILLE PATTERN DOTS-2378 */ pub const XKB_KEY_braille_dots_12378 :u32 = 0x10028c7; /* U+28c7 BRAILLE PATTERN DOTS-12378 */ pub const XKB_KEY_braille_dots_478 :u32 = 0x10028c8; /* U+28c8 BRAILLE PATTERN DOTS-478 */ pub const XKB_KEY_braille_dots_1478 :u32 = 0x10028c9; /* U+28c9 BRAILLE PATTERN DOTS-1478 */ pub const XKB_KEY_braille_dots_2478 :u32 = 0x10028ca; /* U+28ca BRAILLE PATTERN DOTS-2478 */ pub const XKB_KEY_braille_dots_12478 :u32 = 0x10028cb; /* U+28cb BRAILLE PATTERN DOTS-12478 */ pub const XKB_KEY_braille_dots_3478 :u32 = 0x10028cc; /* U+28cc BRAILLE PATTERN DOTS-3478 */ pub const XKB_KEY_braille_dots_13478 :u32 = 0x10028cd; /* U+28cd BRAILLE PATTERN DOTS-13478 */ pub const XKB_KEY_braille_dots_23478 :u32 = 0x10028ce; /* U+28ce BRAILLE PATTERN DOTS-23478 */ pub const XKB_KEY_braille_dots_123478 :u32 = 0x10028cf; /* U+28cf BRAILLE PATTERN DOTS-123478 */ pub const XKB_KEY_braille_dots_578 :u32 = 0x10028d0; /* U+28d0 BRAILLE PATTERN DOTS-578 */ pub const XKB_KEY_braille_dots_1578 :u32 = 0x10028d1; /* U+28d1 BRAILLE PATTERN DOTS-1578 */ pub const XKB_KEY_braille_dots_2578 :u32 = 0x10028d2; /* U+28d2 BRAILLE PATTERN DOTS-2578 */ pub const XKB_KEY_braille_dots_12578 :u32 = 0x10028d3; /* U+28d3 BRAILLE PATTERN DOTS-12578 */ pub const XKB_KEY_braille_dots_3578 :u32 = 0x10028d4; /* U+28d4 BRAILLE PATTERN DOTS-3578 */ pub const XKB_KEY_braille_dots_13578 :u32 = 0x10028d5; /* U+28d5 BRAILLE PATTERN DOTS-13578 */ pub const XKB_KEY_braille_dots_23578 :u32 = 0x10028d6; /* U+28d6 BRAILLE PATTERN DOTS-23578 */ pub const XKB_KEY_braille_dots_123578 :u32 = 0x10028d7; /* U+28d7 BRAILLE PATTERN DOTS-123578 */ pub const XKB_KEY_braille_dots_4578 :u32 = 0x10028d8; /* U+28d8 BRAILLE PATTERN DOTS-4578 */ pub const XKB_KEY_braille_dots_14578 :u32 = 0x10028d9; /* U+28d9 BRAILLE PATTERN DOTS-14578 */ pub const XKB_KEY_braille_dots_24578 :u32 = 0x10028da; /* U+28da BRAILLE PATTERN DOTS-24578 */ pub const XKB_KEY_braille_dots_124578 :u32 = 0x10028db; /* U+28db BRAILLE PATTERN DOTS-124578 */ pub const XKB_KEY_braille_dots_34578 :u32 = 0x10028dc; /* U+28dc BRAILLE PATTERN DOTS-34578 */ pub const XKB_KEY_braille_dots_134578 :u32 = 0x10028dd; /* U+28dd BRAILLE PATTERN DOTS-134578 */ pub const XKB_KEY_braille_dots_234578 :u32 = 0x10028de; /* U+28de BRAILLE PATTERN DOTS-234578 */ pub const XKB_KEY_braille_dots_1234578 :u32 = 0x10028df; /* U+28df BRAILLE PATTERN DOTS-1234578 */ pub const XKB_KEY_braille_dots_678 :u32 = 0x10028e0; /* U+28e0 BRAILLE PATTERN DOTS-678 */ pub const XKB_KEY_braille_dots_1678 :u32 = 0x10028e1; /* U+28e1 BRAILLE PATTERN DOTS-1678 */ pub const XKB_KEY_braille_dots_2678 :u32 = 0x10028e2; /* U+28e2 BRAILLE PATTERN DOTS-2678 */ pub const XKB_KEY_braille_dots_12678 :u32 = 0x10028e3; /* U+28e3 BRAILLE PATTERN DOTS-12678 */ pub const XKB_KEY_braille_dots_3678 :u32 = 0x10028e4; /* U+28e4 BRAILLE PATTERN DOTS-3678 */ pub const XKB_KEY_braille_dots_13678 :u32 = 0x10028e5; /* U+28e5 BRAILLE PATTERN DOTS-13678 */ pub const XKB_KEY_braille_dots_23678 :u32 = 0x10028e6; /* U+28e6 BRAILLE PATTERN DOTS-23678 */ pub const XKB_KEY_braille_dots_123678 :u32 = 0x10028e7; /* U+28e7 BRAILLE PATTERN DOTS-123678 */ pub const XKB_KEY_braille_dots_4678 :u32 = 0x10028e8; /* U+28e8 BRAILLE PATTERN DOTS-4678 */ pub const XKB_KEY_braille_dots_14678 :u32 = 0x10028e9; /* U+28e9 BRAILLE PATTERN DOTS-14678 */ pub const XKB_KEY_braille_dots_24678 :u32 = 0x10028ea; /* U+28ea BRAILLE PATTERN DOTS-24678 */ pub const XKB_KEY_braille_dots_124678 :u32 = 0x10028eb; /* U+28eb BRAILLE PATTERN DOTS-124678 */ pub const XKB_KEY_braille_dots_34678 :u32 = 0x10028ec; /* U+28ec BRAILLE PATTERN DOTS-34678 */ pub const XKB_KEY_braille_dots_134678 :u32 = 0x10028ed; /* U+28ed BRAILLE PATTERN DOTS-134678 */ pub const XKB_KEY_braille_dots_234678 :u32 = 0x10028ee; /* U+28ee BRAILLE PATTERN DOTS-234678 */ pub const XKB_KEY_braille_dots_1234678 :u32 = 0x10028ef; /* U+28ef BRAILLE PATTERN DOTS-1234678 */ pub const XKB_KEY_braille_dots_5678 :u32 = 0x10028f0; /* U+28f0 BRAILLE PATTERN DOTS-5678 */ pub const XKB_KEY_braille_dots_15678 :u32 = 0x10028f1; /* U+28f1 BRAILLE PATTERN DOTS-15678 */ pub const XKB_KEY_braille_dots_25678 :u32 = 0x10028f2; /* U+28f2 BRAILLE PATTERN DOTS-25678 */ pub const XKB_KEY_braille_dots_125678 :u32 = 0x10028f3; /* U+28f3 BRAILLE PATTERN DOTS-125678 */ pub const XKB_KEY_braille_dots_35678 :u32 = 0x10028f4; /* U+28f4 BRAILLE PATTERN DOTS-35678 */ pub const XKB_KEY_braille_dots_135678 :u32 = 0x10028f5; /* U+28f5 BRAILLE PATTERN DOTS-135678 */ pub const XKB_KEY_braille_dots_235678 :u32 = 0x10028f6; /* U+28f6 BRAILLE PATTERN DOTS-235678 */ pub const XKB_KEY_braille_dots_1235678 :u32 = 0x10028f7; /* U+28f7 BRAILLE PATTERN DOTS-1235678 */ pub const XKB_KEY_braille_dots_45678 :u32 = 0x10028f8; /* U+28f8 BRAILLE PATTERN DOTS-45678 */ pub const XKB_KEY_braille_dots_145678 :u32 = 0x10028f9; /* U+28f9 BRAILLE PATTERN DOTS-145678 */ pub const XKB_KEY_braille_dots_245678 :u32 = 0x10028fa; /* U+28fa BRAILLE PATTERN DOTS-245678 */ pub const XKB_KEY_braille_dots_1245678 :u32 = 0x10028fb; /* U+28fb BRAILLE PATTERN DOTS-1245678 */ pub const XKB_KEY_braille_dots_345678 :u32 = 0x10028fc; /* U+28fc BRAILLE PATTERN DOTS-345678 */ pub const XKB_KEY_braille_dots_1345678 :u32 = 0x10028fd; /* U+28fd BRAILLE PATTERN DOTS-1345678 */ pub const XKB_KEY_braille_dots_2345678 :u32 = 0x10028fe; /* U+28fe BRAILLE PATTERN DOTS-2345678 */ pub const XKB_KEY_braille_dots_12345678 :u32 = 0x10028ff; /* U+28ff BRAILLE PATTERN DOTS-12345678 */ /* * Sinhala (http://unicode.org/charts/PDF/U0D80.pdf) * http://www.nongnu.org/sinhala/doc/transliteration/sinhala-transliteration_6.html */ pub const XKB_KEY_Sinh_ng :u32 = 0x1000d82; /* U+0D82 SINHALA ANUSVARAYA */ pub const XKB_KEY_Sinh_h2 :u32 = 0x1000d83; /* U+0D83 SINHALA VISARGAYA */ pub const XKB_KEY_Sinh_a :u32 = 0x1000d85; /* U+0D85 SINHALA AYANNA */ pub const XKB_KEY_Sinh_aa :u32 = 0x1000d86; /* U+0D86 SINHALA AAYANNA */ pub const XKB_KEY_Sinh_ae :u32 = 0x1000d87; /* U+0D87 SINHALA AEYANNA */ pub const XKB_KEY_Sinh_aee :u32 = 0x1000d88; /* U+0D88 SINHALA AEEYANNA */ pub const XKB_KEY_Sinh_i :u32 = 0x1000d89; /* U+0D89 SINHALA IYANNA */ pub const XKB_KEY_Sinh_ii :u32 = 0x1000d8a; /* U+0D8A SINHALA IIYANNA */ pub const XKB_KEY_Sinh_u :u32 = 0x1000d8b; /* U+0D8B SINHALA UYANNA */ pub const XKB_KEY_Sinh_uu :u32 = 0x1000d8c; /* U+0D8C SINHALA UUYANNA */ pub const XKB_KEY_Sinh_ri :u32 = 0x1000d8d; /* U+0D8D SINHALA IRUYANNA */ pub const XKB_KEY_Sinh_rii :u32 = 0x1000d8e; /* U+0D8E SINHALA IRUUYANNA */ pub const XKB_KEY_Sinh_lu :u32 = 0x1000d8f; /* U+0D8F SINHALA ILUYANNA */ pub const XKB_KEY_Sinh_luu :u32 = 0x1000d90; /* U+0D90 SINHALA ILUUYANNA */ pub const XKB_KEY_Sinh_e :u32 = 0x1000d91; /* U+0D91 SINHALA EYANNA */ pub const XKB_KEY_Sinh_ee :u32 = 0x1000d92; /* U+0D92 SINHALA EEYANNA */ pub const XKB_KEY_Sinh_ai :u32 = 0x1000d93; /* U+0D93 SINHALA AIYANNA */ pub const XKB_KEY_Sinh_o :u32 = 0x1000d94; /* U+0D94 SINHALA OYANNA */ pub const XKB_KEY_Sinh_oo :u32 = 0x1000d95; /* U+0D95 SINHALA OOYANNA */ pub const XKB_KEY_Sinh_au :u32 = 0x1000d96; /* U+0D96 SINHALA AUYANNA */ pub const XKB_KEY_Sinh_ka :u32 = 0x1000d9a; /* U+0D9A SINHALA KAYANNA */ pub const XKB_KEY_Sinh_kha :u32 = 0x1000d9b; /* U+0D9B SINHALA MAHA. KAYANNA */ pub const XKB_KEY_Sinh_ga :u32 = 0x1000d9c; /* U+0D9C SINHALA GAYANNA */ pub const XKB_KEY_Sinh_gha :u32 = 0x1000d9d; /* U+0D9D SINHALA MAHA. GAYANNA */ pub const XKB_KEY_Sinh_ng2 :u32 = 0x1000d9e; /* U+0D9E SINHALA KANTAJA NAASIKYAYA */ pub const XKB_KEY_Sinh_nga :u32 = 0x1000d9f; /* U+0D9F SINHALA SANYAKA GAYANNA */ pub const XKB_KEY_Sinh_ca :u32 = 0x1000da0; /* U+0DA0 SINHALA CAYANNA */ pub const XKB_KEY_Sinh_cha :u32 = 0x1000da1; /* U+0DA1 SINHALA MAHA. CAYANNA */ pub const XKB_KEY_Sinh_ja :u32 = 0x1000da2; /* U+0DA2 SINHALA JAYANNA */ pub const XKB_KEY_Sinh_jha :u32 = 0x1000da3; /* U+0DA3 SINHALA MAHA. JAYANNA */ pub const XKB_KEY_Sinh_nya :u32 = 0x1000da4; /* U+0DA4 SINHALA TAALUJA NAASIKYAYA */ pub const XKB_KEY_Sinh_jnya :u32 = 0x1000da5; /* U+0DA5 SINHALA TAALUJA SANYOOGA NAASIKYAYA */ pub const XKB_KEY_Sinh_nja :u32 = 0x1000da6; /* U+0DA6 SINHALA SANYAKA JAYANNA */ pub const XKB_KEY_Sinh_tta :u32 = 0x1000da7; /* U+0DA7 SINHALA TTAYANNA */ pub const XKB_KEY_Sinh_ttha :u32 = 0x1000da8; /* U+0DA8 SINHALA MAHA. TTAYANNA */ pub const XKB_KEY_Sinh_dda :u32 = 0x1000da9; /* U+0DA9 SINHALA DDAYANNA */ pub const XKB_KEY_Sinh_ddha :u32 = 0x1000daa; /* U+0DAA SINHALA MAHA. DDAYANNA */ pub const XKB_KEY_Sinh_nna :u32 = 0x1000dab; /* U+0DAB SINHALA MUURDHAJA NAYANNA */ pub const XKB_KEY_Sinh_ndda :u32 = 0x1000dac; /* U+0DAC SINHALA SANYAKA DDAYANNA */ pub const XKB_KEY_Sinh_tha :u32 = 0x1000dad; /* U+0DAD SINHALA TAYANNA */ pub const XKB_KEY_Sinh_thha :u32 = 0x1000dae; /* U+0DAE SINHALA MAHA. TAYANNA */ pub const XKB_KEY_Sinh_dha :u32 = 0x1000daf; /* U+0DAF SINHALA DAYANNA */ pub const XKB_KEY_Sinh_dhha :u32 = 0x1000db0; /* U+0DB0 SINHALA MAHA. DAYANNA */ pub const XKB_KEY_Sinh_na :u32 = 0x1000db1; /* U+0DB1 SINHALA DANTAJA NAYANNA */ pub const XKB_KEY_Sinh_ndha :u32 = 0x1000db3; /* U+0DB3 SINHALA SANYAKA DAYANNA */ pub const XKB_KEY_Sinh_pa :u32 = 0x1000db4; /* U+0DB4 SINHALA PAYANNA */ pub const XKB_KEY_Sinh_pha :u32 = 0x1000db5; /* U+0DB5 SINHALA MAHA. PAYANNA */ pub const XKB_KEY_Sinh_ba :u32 = 0x1000db6; /* U+0DB6 SINHALA BAYANNA */ pub const XKB_KEY_Sinh_bha :u32 = 0x1000db7; /* U+0DB7 SINHALA MAHA. BAYANNA */ pub const XKB_KEY_Sinh_ma :u32 = 0x1000db8; /* U+0DB8 SINHALA MAYANNA */ pub const XKB_KEY_Sinh_mba :u32 = 0x1000db9; /* U+0DB9 SINHALA AMBA BAYANNA */ pub const XKB_KEY_Sinh_ya :u32 = 0x1000dba; /* U+0DBA SINHALA YAYANNA */ pub const XKB_KEY_Sinh_ra :u32 = 0x1000dbb; /* U+0DBB SINHALA RAYANNA */ pub const XKB_KEY_Sinh_la :u32 = 0x1000dbd; /* U+0DBD SINHALA DANTAJA LAYANNA */ pub const XKB_KEY_Sinh_va :u32 = 0x1000dc0; /* U+0DC0 SINHALA VAYANNA */ pub const XKB_KEY_Sinh_sha :u32 = 0x1000dc1; /* U+0DC1 SINHALA TAALUJA SAYANNA */ pub const XKB_KEY_Sinh_ssha :u32 = 0x1000dc2; /* U+0DC2 SINHALA MUURDHAJA SAYANNA */ pub const XKB_KEY_Sinh_sa :u32 = 0x1000dc3; /* U+0DC3 SINHALA DANTAJA SAYANNA */ pub const XKB_KEY_Sinh_ha :u32 = 0x1000dc4; /* U+0DC4 SINHALA HAYANNA */ pub const XKB_KEY_Sinh_lla :u32 = 0x1000dc5; /* U+0DC5 SINHALA MUURDHAJA LAYANNA */ pub const XKB_KEY_Sinh_fa :u32 = 0x1000dc6; /* U+0DC6 SINHALA FAYANNA */ pub const XKB_KEY_Sinh_al :u32 = 0x1000dca; /* U+0DCA SINHALA AL-LAKUNA */ pub const XKB_KEY_Sinh_aa2 :u32 = 0x1000dcf; /* U+0DCF SINHALA AELA-PILLA */ pub const XKB_KEY_Sinh_ae2 :u32 = 0x1000dd0; /* U+0DD0 SINHALA AEDA-PILLA */ pub const XKB_KEY_Sinh_aee2 :u32 = 0x1000dd1; /* U+0DD1 SINHALA DIGA AEDA-PILLA */ pub const XKB_KEY_Sinh_i2 :u32 = 0x1000dd2; /* U+0DD2 SINHALA IS-PILLA */ pub const XKB_KEY_Sinh_ii2 :u32 = 0x1000dd3; /* U+0DD3 SINHALA DIGA IS-PILLA */ pub const XKB_KEY_Sinh_u2 :u32 = 0x1000dd4; /* U+0DD4 SINHALA PAA-PILLA */ pub const XKB_KEY_Sinh_uu2 :u32 = 0x1000dd6; /* U+0DD6 SINHALA DIGA PAA-PILLA */ pub const XKB_KEY_Sinh_ru2 :u32 = 0x1000dd8; /* U+0DD8 SINHALA GAETTA-PILLA */ pub const XKB_KEY_Sinh_e2 :u32 = 0x1000dd9; /* U+0DD9 SINHALA KOMBUVA */ pub const XKB_KEY_Sinh_ee2 :u32 = 0x1000dda; /* U+0DDA SINHALA DIGA KOMBUVA */ pub const XKB_KEY_Sinh_ai2 :u32 = 0x1000ddb; /* U+0DDB SINHALA KOMBU DEKA */ pub const XKB_KEY_Sinh_o2 :u32 = 0x1000ddc; /* U+0DDC SINHALA KOMBUVA HAA AELA-PILLA*/ pub const XKB_KEY_Sinh_oo2 :u32 = 0x1000ddd; /* U+0DDD SINHALA KOMBUVA HAA DIGA AELA-PILLA*/ pub const XKB_KEY_Sinh_au2 :u32 = 0x1000dde; /* U+0DDE SINHALA KOMBUVA HAA GAYANUKITTA */ pub const XKB_KEY_Sinh_lu2 :u32 = 0x1000ddf; /* U+0DDF SINHALA GAYANUKITTA */ pub const XKB_KEY_Sinh_ruu2 :u32 = 0x1000df2; /* U+0DF2 SINHALA DIGA GAETTA-PILLA */ pub const XKB_KEY_Sinh_luu2 :u32 = 0x1000df3; /* U+0DF3 SINHALA DIGA GAYANUKITTA */ pub const XKB_KEY_Sinh_kunddaliya :u32 = 0x1000df4; /* U+0DF4 SINHALA KUNDDALIYA */ /* * XFree86 vendor specific keysyms. * * The XFree86 keysym range is :u32 = 0x10080001; - :u32 = 0x1008FFFF;. * * X.Org will not be adding to the XF86 set of keysyms, though they have * been adopted and are considered a "standard" part of X keysym definitions. * XFree86 never properly commented these keysyms, so we have done our * best to explain the semantic meaning of these keys. * * XFree86 has removed their mail archives of the period, that might have * shed more light on some of these definitions. Until/unless we resurrect * these archives, these are from memory and usage. */ /* * ModeLock * * This one is old, and not really used any more since XKB offers this * functionality. */ pub const XKB_KEY_XF86ModeLock :u32 = 0x1008FF01; /* Mode Switch Lock */ /* Backlight controls. */ pub const XKB_KEY_XF86MonBrightnessUp :u32 = 0x1008FF02; /* Monitor/panel brightness */ pub const XKB_KEY_XF86MonBrightnessDown :u32 = 0x1008FF03; /* Monitor/panel brightness */ pub const XKB_KEY_XF86KbdLightOnOff :u32 = 0x1008FF04; /* Keyboards may be lit */ pub const XKB_KEY_XF86KbdBrightnessUp :u32 = 0x1008FF05; /* Keyboards may be lit */ pub const XKB_KEY_XF86KbdBrightnessDown :u32 = 0x1008FF06; /* Keyboards may be lit */ pub const XKB_KEY_XF86MonBrightnessCycle :u32 = 0x1008FF07; /* Monitor/panel brightness */ /* * Keys found on some "Internet" keyboards. */ pub const XKB_KEY_XF86Standby :u32 = 0x1008FF10; /* System into standby mode */ pub const XKB_KEY_XF86AudioLowerVolume :u32 = 0x1008FF11; /* Volume control down */ pub const XKB_KEY_XF86AudioMute :u32 = 0x1008FF12; /* Mute sound from the system */ pub const XKB_KEY_XF86AudioRaiseVolume :u32 = 0x1008FF13; /* Volume control up */ pub const XKB_KEY_XF86AudioPlay :u32 = 0x1008FF14; /* Start playing of audio > */ pub const XKB_KEY_XF86AudioStop :u32 = 0x1008FF15; /* Stop playing audio */ pub const XKB_KEY_XF86AudioPrev :u32 = 0x1008FF16; /* Previous track */ pub const XKB_KEY_XF86AudioNext :u32 = 0x1008FF17; /* Next track */ pub const XKB_KEY_XF86HomePage :u32 = 0x1008FF18; /* Display user's home page */ pub const XKB_KEY_XF86Mail :u32 = 0x1008FF19; /* Invoke user's mail program */ pub const XKB_KEY_XF86Start :u32 = 0x1008FF1A; /* Start application */ pub const XKB_KEY_XF86Search :u32 = 0x1008FF1B; /* Search */ pub const XKB_KEY_XF86AudioRecord :u32 = 0x1008FF1C; /* Record audio application */ /* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */ pub const XKB_KEY_XF86Calculator :u32 = 0x1008FF1D; /* Invoke calculator program */ pub const XKB_KEY_XF86Memo :u32 = 0x1008FF1E; /* Invoke Memo taking program */ pub const XKB_KEY_XF86ToDoList :u32 = 0x1008FF1F; /* Invoke To Do List program */ pub const XKB_KEY_XF86Calendar :u32 = 0x1008FF20; /* Invoke Calendar program */ pub const XKB_KEY_XF86PowerDown :u32 = 0x1008FF21; /* Deep sleep the system */ pub const XKB_KEY_XF86ContrastAdjust :u32 = 0x1008FF22; /* Adjust screen contrast */ pub const XKB_KEY_XF86RockerUp :u32 = 0x1008FF23; /* Rocker switches exist up */ pub const XKB_KEY_XF86RockerDown :u32 = 0x1008FF24; /* and down */ pub const XKB_KEY_XF86RockerEnter :u32 = 0x1008FF25; /* and let you press them */ /* Some more "Internet" keyboard symbols */ pub const XKB_KEY_XF86Back :u32 = 0x1008FF26; /* Like back on a browser */ pub const XKB_KEY_XF86Forward :u32 = 0x1008FF27; /* Like forward on a browser */ pub const XKB_KEY_XF86Stop :u32 = 0x1008FF28; /* Stop current operation */ pub const XKB_KEY_XF86Refresh :u32 = 0x1008FF29; /* Refresh the page */ pub const XKB_KEY_XF86PowerOff :u32 = 0x1008FF2A; /* Power off system entirely */ pub const XKB_KEY_XF86WakeUp :u32 = 0x1008FF2B; /* Wake up system from sleep */ pub const XKB_KEY_XF86Eject :u32 = 0x1008FF2C; /* Eject device (e.g. DVD) */ pub const XKB_KEY_XF86ScreenSaver :u32 = 0x1008FF2D; /* Invoke screensaver */ pub const XKB_KEY_XF86WWW :u32 = 0x1008FF2E; /* Invoke web browser */ pub const XKB_KEY_XF86Sleep :u32 = 0x1008FF2F; /* Put system to sleep */ pub const XKB_KEY_XF86Favorites :u32 = 0x1008FF30; /* Show favorite locations */ pub const XKB_KEY_XF86AudioPause :u32 = 0x1008FF31; /* Pause audio playing */ pub const XKB_KEY_XF86AudioMedia :u32 = 0x1008FF32; /* Launch media collection app */ pub const XKB_KEY_XF86MyComputer :u32 = 0x1008FF33; /* Display "My Computer" window */ pub const XKB_KEY_XF86VendorHome :u32 = 0x1008FF34; /* Display vendor home web site */ pub const XKB_KEY_XF86LightBulb :u32 = 0x1008FF35; /* Light bulb keys exist */ pub const XKB_KEY_XF86Shop :u32 = 0x1008FF36; /* Display shopping web site */ pub const XKB_KEY_XF86History :u32 = 0x1008FF37; /* Show history of web surfing */ pub const XKB_KEY_XF86OpenURL :u32 = 0x1008FF38; /* Open selected URL */ pub const XKB_KEY_XF86AddFavorite :u32 = 0x1008FF39; /* Add URL to favorites list */ pub const XKB_KEY_XF86HotLinks :u32 = 0x1008FF3A; /* Show "hot" links */ pub const XKB_KEY_XF86BrightnessAdjust :u32 = 0x1008FF3B; /* Invoke brightness adj. UI */ pub const XKB_KEY_XF86Finance :u32 = 0x1008FF3C; /* Display financial site */ pub const XKB_KEY_XF86Community :u32 = 0x1008FF3D; /* Display user's community */ pub const XKB_KEY_XF86AudioRewind :u32 = 0x1008FF3E; /* "rewind" audio track */ pub const XKB_KEY_XF86BackForward :u32 = 0x1008FF3F; /* ??? */ pub const XKB_KEY_XF86Launch0 :u32 = 0x1008FF40; /* Launch Application */ pub const XKB_KEY_XF86Launch1 :u32 = 0x1008FF41; /* Launch Application */ pub const XKB_KEY_XF86Launch2 :u32 = 0x1008FF42; /* Launch Application */ pub const XKB_KEY_XF86Launch3 :u32 = 0x1008FF43; /* Launch Application */ pub const XKB_KEY_XF86Launch4 :u32 = 0x1008FF44; /* Launch Application */ pub const XKB_KEY_XF86Launch5 :u32 = 0x1008FF45; /* Launch Application */ pub const XKB_KEY_XF86Launch6 :u32 = 0x1008FF46; /* Launch Application */ pub const XKB_KEY_XF86Launch7 :u32 = 0x1008FF47; /* Launch Application */ pub const XKB_KEY_XF86Launch8 :u32 = 0x1008FF48; /* Launch Application */ pub const XKB_KEY_XF86Launch9 :u32 = 0x1008FF49; /* Launch Application */ pub const XKB_KEY_XF86LaunchA :u32 = 0x1008FF4A; /* Launch Application */ pub const XKB_KEY_XF86LaunchB :u32 = 0x1008FF4B; /* Launch Application */ pub const XKB_KEY_XF86LaunchC :u32 = 0x1008FF4C; /* Launch Application */ pub const XKB_KEY_XF86LaunchD :u32 = 0x1008FF4D; /* Launch Application */ pub const XKB_KEY_XF86LaunchE :u32 = 0x1008FF4E; /* Launch Application */ pub const XKB_KEY_XF86LaunchF :u32 = 0x1008FF4F; /* Launch Application */ pub const XKB_KEY_XF86ApplicationLeft :u32 = 0x1008FF50; /* switch to application, left */ pub const XKB_KEY_XF86ApplicationRight :u32 = 0x1008FF51; /* switch to application, right*/ pub const XKB_KEY_XF86Book :u32 = 0x1008FF52; /* Launch bookreader */ pub const XKB_KEY_XF86CD :u32 = 0x1008FF53; /* Launch CD/DVD player */ pub const XKB_KEY_XF86Calculater :u32 = 0x1008FF54; /* Launch Calculater */ pub const XKB_KEY_XF86Clear :u32 = 0x1008FF55; /* Clear window, screen */ pub const XKB_KEY_XF86Close :u32 = 0x1008FF56; /* Close window */ pub const XKB_KEY_XF86Copy :u32 = 0x1008FF57; /* Copy selection */ pub const XKB_KEY_XF86Cut :u32 = 0x1008FF58; /* Cut selection */ pub const XKB_KEY_XF86Display :u32 = 0x1008FF59; /* Output switch key */ pub const XKB_KEY_XF86DOS :u32 = 0x1008FF5A; /* Launch DOS (emulation) */ pub const XKB_KEY_XF86Documents :u32 = 0x1008FF5B; /* Open documents window */ pub const XKB_KEY_XF86Excel :u32 = 0x1008FF5C; /* Launch spread sheet */ pub const XKB_KEY_XF86Explorer :u32 = 0x1008FF5D; /* Launch file explorer */ pub const XKB_KEY_XF86Game :u32 = 0x1008FF5E; /* Launch game */ pub const XKB_KEY_XF86Go :u32 = 0x1008FF5F; /* Go to URL */ pub const XKB_KEY_XF86iTouch :u32 = 0x1008FF60; /* Logitech iTouch- don't use */ pub const XKB_KEY_XF86LogOff :u32 = 0x1008FF61; /* Log off system */ pub const XKB_KEY_XF86Market :u32 = 0x1008FF62; /* ?? */ pub const XKB_KEY_XF86Meeting :u32 = 0x1008FF63; /* enter meeting in calendar */ pub const XKB_KEY_XF86MenuKB :u32 = 0x1008FF65; /* distinguish keyboard from PB */ pub const XKB_KEY_XF86MenuPB :u32 = 0x1008FF66; /* distinguish PB from keyboard */ pub const XKB_KEY_XF86MySites :u32 = 0x1008FF67; /* Favourites */ pub const XKB_KEY_XF86New :u32 = 0x1008FF68; /* New (folder, document... */ pub const XKB_KEY_XF86News :u32 = 0x1008FF69; /* News */ pub const XKB_KEY_XF86OfficeHome :u32 = 0x1008FF6A; /* Office home (old Staroffice)*/ pub const XKB_KEY_XF86Open :u32 = 0x1008FF6B; /* Open */ pub const XKB_KEY_XF86Option :u32 = 0x1008FF6C; /* ?? */ pub const XKB_KEY_XF86Paste :u32 = 0x1008FF6D; /* Paste */ pub const XKB_KEY_XF86Phone :u32 = 0x1008FF6E; /* Launch phone; dial number */ pub const XKB_KEY_XF86Q :u32 = 0x1008FF70; /* Compaq's Q - don't use */ pub const XKB_KEY_XF86Reply :u32 = 0x1008FF72; /* Reply e.g., mail */ pub const XKB_KEY_XF86Reload :u32 = 0x1008FF73; /* Reload web page, file, etc. */ pub const XKB_KEY_XF86RotateWindows :u32 = 0x1008FF74; /* Rotate windows e.g. xrandr */ pub const XKB_KEY_XF86RotationPB :u32 = 0x1008FF75; /* don't use */ pub const XKB_KEY_XF86RotationKB :u32 = 0x1008FF76; /* don't use */ pub const XKB_KEY_XF86Save :u32 = 0x1008FF77; /* Save (file, document, state */ pub const XKB_KEY_XF86ScrollUp :u32 = 0x1008FF78; /* Scroll window/contents up */ pub const XKB_KEY_XF86ScrollDown :u32 = 0x1008FF79; /* Scrool window/contentd down */ pub const XKB_KEY_XF86ScrollClick :u32 = 0x1008FF7A; /* Use XKB mousekeys instead */ pub const XKB_KEY_XF86Send :u32 = 0x1008FF7B; /* Send mail, file, object */ pub const XKB_KEY_XF86Spell :u32 = 0x1008FF7C; /* Spell checker */ pub const XKB_KEY_XF86SplitScreen :u32 = 0x1008FF7D; /* Split window or screen */ pub const XKB_KEY_XF86Support :u32 = 0x1008FF7E; /* Get support (??) */ pub const XKB_KEY_XF86TaskPane :u32 = 0x1008FF7F; /* Show tasks */ pub const XKB_KEY_XF86Terminal :u32 = 0x1008FF80; /* Launch terminal emulator */ pub const XKB_KEY_XF86Tools :u32 = 0x1008FF81; /* toolbox of desktop/app. */ pub const XKB_KEY_XF86Travel :u32 = 0x1008FF82; /* ?? */ pub const XKB_KEY_XF86UserPB :u32 = 0x1008FF84; /* ?? */ pub const XKB_KEY_XF86User1KB :u32 = 0x1008FF85; /* ?? */ pub const XKB_KEY_XF86User2KB :u32 = 0x1008FF86; /* ?? */ pub const XKB_KEY_XF86Video :u32 = 0x1008FF87; /* Launch video player */ pub const XKB_KEY_XF86WheelButton :u32 = 0x1008FF88; /* button from a mouse wheel */ pub const XKB_KEY_XF86Word :u32 = 0x1008FF89; /* Launch word processor */ pub const XKB_KEY_XF86Xfer :u32 = 0x1008FF8A; pub const XKB_KEY_XF86ZoomIn :u32 = 0x1008FF8B; /* zoom in view, map, etc. */ pub const XKB_KEY_XF86ZoomOut :u32 = 0x1008FF8C; /* zoom out view, map, etc. */ pub const XKB_KEY_XF86Away :u32 = 0x1008FF8D; /* mark yourself as away */ pub const XKB_KEY_XF86Messenger :u32 = 0x1008FF8E; /* as in instant messaging */ pub const XKB_KEY_XF86WebCam :u32 = 0x1008FF8F; /* Launch web camera app. */ pub const XKB_KEY_XF86MailForward :u32 = 0x1008FF90; /* Forward in mail */ pub const XKB_KEY_XF86Pictures :u32 = 0x1008FF91; /* Show pictures */ pub const XKB_KEY_XF86Music :u32 = 0x1008FF92; /* Launch music application */ pub const XKB_KEY_XF86Battery :u32 = 0x1008FF93; /* Display battery information */ pub const XKB_KEY_XF86Bluetooth :u32 = 0x1008FF94; /* Enable/disable Bluetooth */ pub const XKB_KEY_XF86WLAN :u32 = 0x1008FF95; /* Enable/disable WLAN */ pub const XKB_KEY_XF86UWB :u32 = 0x1008FF96; /* Enable/disable UWB */ pub const XKB_KEY_XF86AudioForward :u32 = 0x1008FF97; /* fast-forward audio track */ pub const XKB_KEY_XF86AudioRepeat :u32 = 0x1008FF98; /* toggle repeat mode */ pub const XKB_KEY_XF86AudioRandomPlay :u32 = 0x1008FF99; /* toggle shuffle mode */ pub const XKB_KEY_XF86Subtitle :u32 = 0x1008FF9A; /* cycle through subtitle */ pub const XKB_KEY_XF86AudioCycleTrack :u32 = 0x1008FF9B; /* cycle through audio tracks */ pub const XKB_KEY_XF86CycleAngle :u32 = 0x1008FF9C; /* cycle through angles */ pub const XKB_KEY_XF86FrameBack :u32 = 0x1008FF9D; /* video: go one frame back */ pub const XKB_KEY_XF86FrameForward :u32 = 0x1008FF9E; /* video: go one frame forward */ pub const XKB_KEY_XF86Time :u32 = 0x1008FF9F; /* display, or shows an entry for time seeking */ pub const XKB_KEY_XF86Select :u32 = 0x1008FFA0; /* Select button on joypads and remotes */ pub const XKB_KEY_XF86View :u32 = 0x1008FFA1; /* Show a view options/properties */ pub const XKB_KEY_XF86TopMenu :u32 = 0x1008FFA2; /* Go to a top-level menu in a video */ pub const XKB_KEY_XF86Red :u32 = 0x1008FFA3; /* Red button */ pub const XKB_KEY_XF86Green :u32 = 0x1008FFA4; /* Green button */ pub const XKB_KEY_XF86Yellow :u32 = 0x1008FFA5; /* Yellow button */ pub const XKB_KEY_XF86Blue :u32 = 0x1008FFA6; /* Blue button */ pub const XKB_KEY_XF86Suspend :u32 = 0x1008FFA7; /* Sleep to RAM */ pub const XKB_KEY_XF86Hibernate :u32 = 0x1008FFA8; /* Sleep to disk */ pub const XKB_KEY_XF86TouchpadToggle :u32 = 0x1008FFA9; /* Toggle between touchpad/trackstick */ pub const XKB_KEY_XF86TouchpadOn :u32 = 0x1008FFB0; /* The touchpad got switched on */ pub const XKB_KEY_XF86TouchpadOff :u32 = 0x1008FFB1; /* The touchpad got switched off */ pub const XKB_KEY_XF86AudioMicMute :u32 = 0x1008FFB2; /* Mute the Mic from the system */ pub const XKB_KEY_XF86Keyboard :u32 = 0x1008FFB3; /* User defined keyboard related action */ pub const XKB_KEY_XF86WWAN :u32 = 0x1008FFB4; /* Toggle WWAN (LTE, UMTS, etc.) radio */ pub const XKB_KEY_XF86RFKill :u32 = 0x1008FFB5; /* Toggle radios on/off */ pub const XKB_KEY_XF86AudioPreset :u32 = 0x1008FFB6; /* Select equalizer preset, e.g. theatre-mode */ pub const XKB_KEY_XF86RotationLockToggle :u32 = 0x1008FFB7; /* Toggle screen rotation lock on/off */ pub const XKB_KEY_XF86FullScreen :u32 = 0x1008FFB8; /* Toggle fullscreen */ /* Keys for special action keys (hot keys) */ /* Virtual terminals on some operating systems */ pub const XKB_KEY_XF86Switch_VT_1 :u32 = 0x1008FE01; pub const XKB_KEY_XF86Switch_VT_2 :u32 = 0x1008FE02; pub const XKB_KEY_XF86Switch_VT_3 :u32 = 0x1008FE03; pub const XKB_KEY_XF86Switch_VT_4 :u32 = 0x1008FE04; pub const XKB_KEY_XF86Switch_VT_5 :u32 = 0x1008FE05; pub const XKB_KEY_XF86Switch_VT_6 :u32 = 0x1008FE06; pub const XKB_KEY_XF86Switch_VT_7 :u32 = 0x1008FE07; pub const XKB_KEY_XF86Switch_VT_8 :u32 = 0x1008FE08; pub const XKB_KEY_XF86Switch_VT_9 :u32 = 0x1008FE09; pub const XKB_KEY_XF86Switch_VT_10 :u32 = 0x1008FE0A; pub const XKB_KEY_XF86Switch_VT_11 :u32 = 0x1008FE0B; pub const XKB_KEY_XF86Switch_VT_12 :u32 = 0x1008FE0C; pub const XKB_KEY_XF86Ungrab :u32 = 0x1008FE20; /* force ungrab */ pub const XKB_KEY_XF86ClearGrab :u32 = 0x1008FE21; /* kill application with grab */ pub const XKB_KEY_XF86Next_VMode :u32 = 0x1008FE22; /* next video mode available */ pub const XKB_KEY_XF86Prev_VMode :u32 = 0x1008FE23; /* prev. video mode available */ pub const XKB_KEY_XF86LogWindowTree :u32 = 0x1008FE24; /* print window tree to log */ pub const XKB_KEY_XF86LogGrabInfo :u32 = 0x1008FE25; /* print all active grabs to log */ /* * Copyright (c) 1991, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /************************************************************ Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ***********************************************************/ /* * Floating Accent */ pub const XKB_KEY_SunFA_Grave :u32 = 0x1005FF00; pub const XKB_KEY_SunFA_Circum :u32 = 0x1005FF01; pub const XKB_KEY_SunFA_Tilde :u32 = 0x1005FF02; pub const XKB_KEY_SunFA_Acute :u32 = 0x1005FF03; pub const XKB_KEY_SunFA_Diaeresis :u32 = 0x1005FF04; pub const XKB_KEY_SunFA_Cedilla :u32 = 0x1005FF05; /* * Miscellaneous Functions */ pub const XKB_KEY_SunF36 :u32 = 0x1005FF10; /* Labeled F11 */ pub const XKB_KEY_SunF37 :u32 = 0x1005FF11; /* Labeled F12 */ pub const XKB_KEY_SunSys_Req :u32 = 0x1005FF60; pub const XKB_KEY_SunPrint_Screen :u32 = 0x0000FF61; /* Same as XK_Print */ /* * International & Multi-Key Character Composition */ pub const XKB_KEY_SunCompose :u32 = 0x0000FF20; /* Same as XK_Multi_key */ pub const XKB_KEY_SunAltGraph :u32 = 0x0000FF7E; /* Same as XK_Mode_switch */ /* * Cursor Control */ pub const XKB_KEY_SunPageUp :u32 = 0x0000FF55; /* Same as XK_Prior */ pub const XKB_KEY_SunPageDown :u32 = 0x0000FF56; /* Same as XK_Next */ /* * Open Look Functions */ pub const XKB_KEY_SunUndo :u32 = 0x0000FF65; /* Same as XK_Undo */ pub const XKB_KEY_SunAgain :u32 = 0x0000FF66; /* Same as XK_Redo */ pub const XKB_KEY_SunFind :u32 = 0x0000FF68; /* Same as XK_Find */ pub const XKB_KEY_SunStop :u32 = 0x0000FF69; /* Same as XK_Cancel */ pub const XKB_KEY_SunProps :u32 = 0x1005FF70; pub const XKB_KEY_SunFront :u32 = 0x1005FF71; pub const XKB_KEY_SunCopy :u32 = 0x1005FF72; pub const XKB_KEY_SunOpen :u32 = 0x1005FF73; pub const XKB_KEY_SunPaste :u32 = 0x1005FF74; pub const XKB_KEY_SunCut :u32 = 0x1005FF75; pub const XKB_KEY_SunPowerSwitch :u32 = 0x1005FF76; pub const XKB_KEY_SunAudioLowerVolume :u32 = 0x1005FF77; pub const XKB_KEY_SunAudioMute :u32 = 0x1005FF78; pub const XKB_KEY_SunAudioRaiseVolume :u32 = 0x1005FF79; pub const XKB_KEY_SunVideoDegauss :u32 = 0x1005FF7A; pub const XKB_KEY_SunVideoLowerBrightness :u32 = 0x1005FF7B; pub const XKB_KEY_SunVideoRaiseBrightness :u32 = 0x1005FF7C; pub const XKB_KEY_SunPowerSwitchShift :u32 = 0x1005FF7D; /*********************************************************** Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * DEC private keysyms * (29th bit set) */ /* two-key compose sequence initiators, chosen to map to Latin1 characters */ pub const XKB_KEY_Dring_accent :u32 = 0x1000FEB0; pub const XKB_KEY_Dcircumflex_accent :u32 = 0x1000FE5E; pub const XKB_KEY_Dcedilla_accent :u32 = 0x1000FE2C; pub const XKB_KEY_Dacute_accent :u32 = 0x1000FE27; pub const XKB_KEY_Dgrave_accent :u32 = 0x1000FE60; pub const XKB_KEY_Dtilde :u32 = 0x1000FE7E; pub const XKB_KEY_Ddiaeresis :u32 = 0x1000FE22; /* special keysym for LK2** "Remove" key on editing keypad */ pub const XKB_KEY_DRemove :u32 = 0x1000FF00; /* Remove */ /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Hewlett Packard or Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material. */ pub const XKB_KEY_hpClearLine :u32 = 0x1000FF6F; pub const XKB_KEY_hpInsertLine :u32 = 0x1000FF70; pub const XKB_KEY_hpDeleteLine :u32 = 0x1000FF71; pub const XKB_KEY_hpInsertChar :u32 = 0x1000FF72; pub const XKB_KEY_hpDeleteChar :u32 = 0x1000FF73; pub const XKB_KEY_hpBackTab :u32 = 0x1000FF74; pub const XKB_KEY_hpKP_BackTab :u32 = 0x1000FF75; pub const XKB_KEY_hpModelock1 :u32 = 0x1000FF48; pub const XKB_KEY_hpModelock2 :u32 = 0x1000FF49; pub const XKB_KEY_hpReset :u32 = 0x1000FF6C; pub const XKB_KEY_hpSystem :u32 = 0x1000FF6D; pub const XKB_KEY_hpUser :u32 = 0x1000FF6E; pub const XKB_KEY_hpmute_acute :u32 = 0x100000A8; pub const XKB_KEY_hpmute_grave :u32 = 0x100000A9; pub const XKB_KEY_hpmute_asciicircum :u32 = 0x100000AA; pub const XKB_KEY_hpmute_diaeresis :u32 = 0x100000AB; pub const XKB_KEY_hpmute_asciitilde :u32 = 0x100000AC; pub const XKB_KEY_hplira :u32 = 0x100000AF; pub const XKB_KEY_hpguilder :u32 = 0x100000BE; pub const XKB_KEY_hpYdiaeresis :u32 = 0x100000EE; pub const XKB_KEY_hpIO :u32 = 0x100000EE; pub const XKB_KEY_hplongminus :u32 = 0x100000F6; pub const XKB_KEY_hpblock :u32 = 0x100000FC; pub const XKB_KEY_osfCopy :u32 = 0x1004FF02; pub const XKB_KEY_osfCut :u32 = 0x1004FF03; pub const XKB_KEY_osfPaste :u32 = 0x1004FF04; pub const XKB_KEY_osfBackTab :u32 = 0x1004FF07; pub const XKB_KEY_osfBackSpace :u32 = 0x1004FF08; pub const XKB_KEY_osfClear :u32 = 0x1004FF0B; pub const XKB_KEY_osfEscape :u32 = 0x1004FF1B; pub const XKB_KEY_osfAddMode :u32 = 0x1004FF31; pub const XKB_KEY_osfPrimaryPaste :u32 = 0x1004FF32; pub const XKB_KEY_osfQuickPaste :u32 = 0x1004FF33; pub const XKB_KEY_osfPageLeft :u32 = 0x1004FF40; pub const XKB_KEY_osfPageUp :u32 = 0x1004FF41; pub const XKB_KEY_osfPageDown :u32 = 0x1004FF42; pub const XKB_KEY_osfPageRight :u32 = 0x1004FF43; pub const XKB_KEY_osfActivate :u32 = 0x1004FF44; pub const XKB_KEY_osfMenuBar :u32 = 0x1004FF45; pub const XKB_KEY_osfLeft :u32 = 0x1004FF51; pub const XKB_KEY_osfUp :u32 = 0x1004FF52; pub const XKB_KEY_osfRight :u32 = 0x1004FF53; pub const XKB_KEY_osfDown :u32 = 0x1004FF54; pub const XKB_KEY_osfEndLine :u32 = 0x1004FF57; pub const XKB_KEY_osfBeginLine :u32 = 0x1004FF58; pub const XKB_KEY_osfEndData :u32 = 0x1004FF59; pub const XKB_KEY_osfBeginData :u32 = 0x1004FF5A; pub const XKB_KEY_osfPrevMenu :u32 = 0x1004FF5B; pub const XKB_KEY_osfNextMenu :u32 = 0x1004FF5C; pub const XKB_KEY_osfPrevField :u32 = 0x1004FF5D; pub const XKB_KEY_osfNextField :u32 = 0x1004FF5E; pub const XKB_KEY_osfSelect :u32 = 0x1004FF60; pub const XKB_KEY_osfInsert :u32 = 0x1004FF63; pub const XKB_KEY_osfUndo :u32 = 0x1004FF65; pub const XKB_KEY_osfMenu :u32 = 0x1004FF67; pub const XKB_KEY_osfCancel :u32 = 0x1004FF69; pub const XKB_KEY_osfHelp :u32 = 0x1004FF6A; pub const XKB_KEY_osfSelectAll :u32 = 0x1004FF71; pub const XKB_KEY_osfDeselectAll :u32 = 0x1004FF72; pub const XKB_KEY_osfReselect :u32 = 0x1004FF73; pub const XKB_KEY_osfExtend :u32 = 0x1004FF74; pub const XKB_KEY_osfRestore :u32 = 0x1004FF78; pub const XKB_KEY_osfDelete :u32 = 0x1004FFFF; /************************************************************** * The use of the following macros is deprecated. * They are listed below only for backwards compatibility. */ pub const XKB_KEY_Reset :u32 = 0x1000FF6C; pub const XKB_KEY_System :u32 = 0x1000FF6D; pub const XKB_KEY_User :u32 = 0x1000FF6E; pub const XKB_KEY_ClearLine :u32 = 0x1000FF6F; pub const XKB_KEY_InsertLine :u32 = 0x1000FF70; pub const XKB_KEY_DeleteLine :u32 = 0x1000FF71; pub const XKB_KEY_InsertChar :u32 = 0x1000FF72; pub const XKB_KEY_DeleteChar :u32 = 0x1000FF73; pub const XKB_KEY_BackTab :u32 = 0x1000FF74; pub const XKB_KEY_KP_BackTab :u32 = 0x1000FF75; pub const XKB_KEY_Ext16bit_L :u32 = 0x1000FF76; pub const XKB_KEY_Ext16bit_R :u32 = 0x1000FF77; pub const XKB_KEY_mute_acute :u32 = 0x100000a8; pub const XKB_KEY_mute_grave :u32 = 0x100000a9; pub const XKB_KEY_mute_asciicircum :u32 = 0x100000aa; pub const XKB_KEY_mute_diaeresis :u32 = 0x100000ab; pub const XKB_KEY_mute_asciitilde :u32 = 0x100000ac; pub const XKB_KEY_lira :u32 = 0x100000af; pub const XKB_KEY_guilder :u32 = 0x100000be; pub const XKB_KEY_IO :u32 = 0x100000ee; pub const XKB_KEY_longminus :u32 = 0x100000f6; pub const XKB_KEY_block :u32 = 0x100000fc; smithay-client-toolkit-0.16.1/src/seat/keyboard/mod.rs000064400000000000000000000507621046102023000210100ustar 00000000000000//! Utilities for keymap interpretation of keyboard input //! //! This module provides an implementation for `wl_keyboard` //! objects using `libxkbcommon` to interpret the keyboard input //! given the user keymap. //! //! The entry point of this module is the [`map_keyboard`](fn.map_keyboard.html) //! function which, given a `wl_seat` and a callback, setup keymap interpretation //! and key repetition for the `wl_keyboard` of this seat. //! //! Key repetition relies on an event source, that needs to be inserted in your //! calloop event loop. Not doing so will prevent key repetition to work //! (but the rest of the functionnality will not be affected). #[cfg(feature = "calloop")] use calloop::{timer::Timer, RegistrationToken}; #[cfg(feature = "calloop")] use std::num::NonZeroU32; #[cfg(feature = "calloop")] use std::time::Duration; use std::{ cell::{Cell, RefCell}, convert::TryInto, fs::File, os::unix::io::{FromRawFd, RawFd}, rc::Rc, time::Instant, }; pub use wayland_client::protocol::wl_keyboard::KeyState; use wayland_client::{ protocol::{wl_keyboard, wl_seat, wl_surface}, Attached, }; #[rustfmt::skip] mod ffi; mod state; #[rustfmt::skip] pub mod keysyms; use self::state::KbState; pub use self::state::{ModifiersState, RMLVO}; #[cfg(feature = "calloop")] const MICROS_IN_SECOND: u32 = 1000000; /// Possible kinds of key repetition #[derive(Debug)] pub enum RepeatKind { /// keys will be repeated at a set rate and delay Fixed { /// The number of repetitions per second that should occur. rate: u32, /// delay (in milliseconds) between a key press and the start of repetition delay: u32, }, /// keys will be repeated at a rate and delay set by the wayland server System, } #[derive(Debug)] /// An error that occurred while trying to initialize a mapped keyboard pub enum Error { /// libxkbcommon is not available XKBNotFound, /// Provided RMLVO specified a keymap that would not be loaded BadNames, /// The provided seat does not have the keyboard capability NoKeyboard, /// Failed to init timers for repetition TimerError(std::io::Error), } /// Events received from a mapped keyboard #[derive(Debug)] pub enum Event<'a> { /// The keyboard focus has entered a surface Enter { /// serial number of the event serial: u32, /// surface that was entered surface: wl_surface::WlSurface, /// raw values of the currently pressed keys rawkeys: &'a [u32], /// interpreted symbols of the currently pressed keys keysyms: &'a [u32], }, /// The keyboard focus has left a surface Leave { /// serial number of the event serial: u32, /// surface that was left surface: wl_surface::WlSurface, }, /// The key modifiers have changed state Modifiers { /// current state of the modifiers modifiers: ModifiersState, }, /// A key event occurred Key { /// serial number of the event serial: u32, /// time at which the keypress occurred time: u32, /// raw value of the key rawkey: u32, /// interpreted symbol of the key keysym: u32, /// new state of the key state: KeyState, /// utf8 interpretation of the entered text /// /// will always be `None` on key release events utf8: Option, }, /// A key repetition event Repeat { /// time at which the repetition occured time: u32, /// raw value of the key rawkey: u32, /// interpreted symbol of the key keysym: u32, /// utf8 interpretation of the entered text utf8: Option, }, } /// Implement a keyboard for keymap translation with key repetition /// /// This requires you to provide a callback to receive the events after they /// have been interpreted with the keymap. /// /// The keymap will be loaded from the provided RMLVO rules, or from the compositor /// provided keymap if `None`. /// /// Returns an error if xkbcommon could not be initialized, the RMLVO specification /// contained invalid values, or if the provided seat does not have keyboard capability. /// /// **Note:** This adapter does not handle key repetition. See `map_keyboard_repeat` for that. pub fn map_keyboard( seat: &Attached, rmlvo: Option, callback: F, ) -> Result where F: FnMut(Event<'_>, wl_keyboard::WlKeyboard, wayland_client::DispatchData<'_>) + 'static, { let has_kbd = super::with_seat_data(seat, |data| data.has_keyboard).unwrap_or(false); let keyboard = if has_kbd { seat.get_keyboard() } else { return Err(Error::NoKeyboard); }; let state = Rc::new(RefCell::new(rmlvo.map(KbState::from_rmlvo).unwrap_or_else(KbState::new)?)); let callback = Rc::new(RefCell::new(callback)) as Rc>; // prepare the handler let mut kbd_handler = KbdHandler { callback, state, #[cfg(feature = "calloop")] repeat: None, }; keyboard.quick_assign(move |keyboard, event, data| { kbd_handler.event(keyboard.detach(), event, data) }); Ok(keyboard.detach()) } /// Implement a keyboard for keymap translation with key repetition /// /// This requires you to provide a callback to receive the events after they /// have been interpreted with the keymap. /// /// The keymap will be loaded from the provided RMLVO rules, or from the compositor /// provided keymap if `None`. /// /// Returns an error if xkbcommon could not be initialized, the RMLVO specification /// contained invalid values, or if the provided seat does not have keyboard capability. /// /// **Note:** The keyboard repetition handling requires the `calloop` cargo feature. #[cfg(feature = "calloop")] pub fn map_keyboard_repeat( loop_handle: calloop::LoopHandle<'static, Data>, seat: &Attached, rmlvo: Option, repeatkind: RepeatKind, callback: F, ) -> Result where F: FnMut(Event<'_>, wl_keyboard::WlKeyboard, wayland_client::DispatchData<'_>) + 'static, { let has_kbd = super::with_seat_data(seat, |data| data.has_keyboard).unwrap_or(false); let keyboard = if has_kbd { seat.get_keyboard() } else { return Err(Error::NoKeyboard); }; let state = Rc::new(RefCell::new(rmlvo.map(KbState::from_rmlvo).unwrap_or_else(KbState::new)?)); let callback = Rc::new(RefCell::new(callback)) as Rc>; let repeat = match repeatkind { RepeatKind::System => RepeatDetails { locked: false, gap: None, delay: 200 }, RepeatKind::Fixed { rate, delay } => { let gap = rate_to_gap(rate as i32); RepeatDetails { locked: true, gap, delay } } }; // Prepare the repetition handling. let mut handler = KbdHandler { callback: callback.clone(), state, repeat: Some(KbdRepeat { start_timer: { let my_loop_handle = loop_handle.clone(); Box::new(move |source| { let my_callback = callback.clone(); my_loop_handle .insert_source(source, move |event, kbd, ddata| { (my_callback.borrow_mut())( event, kbd.clone(), wayland_client::DispatchData::wrap(ddata), ) }) .unwrap() }) }, stop_timer: Box::new(move |token| loop_handle.remove(token)), current_repeat: Rc::new(RefCell::new(None)), current_timer: Cell::new(None), details: repeat, }), }; keyboard .quick_assign(move |keyboard, event, data| handler.event(keyboard.detach(), event, data)); Ok(keyboard.detach()) } #[cfg(feature = "calloop")] fn rate_to_gap(rate: i32) -> Option { if rate <= 0 { None } else if MICROS_IN_SECOND < rate as u32 { NonZeroU32::new(1) } else { NonZeroU32::new(MICROS_IN_SECOND / rate as u32) } } /* * Classic handling */ type KbdCallback = dyn FnMut(Event<'_>, wl_keyboard::WlKeyboard, wayland_client::DispatchData<'_>); #[cfg(feature = "calloop")] struct RepeatDetails { locked: bool, /// Gap between key presses in microseconds. /// /// If the `gap` is `None`, it means that repeat is disabled. gap: Option, /// Delay before starting key repeat in milliseconds. delay: u32, } struct KbdHandler { state: Rc>, callback: Rc>, #[cfg(feature = "calloop")] repeat: Option, } #[cfg(feature = "calloop")] struct KbdRepeat { start_timer: Box RegistrationToken>, stop_timer: Box, current_timer: Cell>, current_repeat: Rc>>, details: RepeatDetails, } #[cfg(feature = "calloop")] impl KbdRepeat { fn start_repeat( &self, key: u32, keyboard: wl_keyboard::WlKeyboard, time: u32, state: Rc>, ) { // Start a new repetition, overwriting the previous ones if let Some(timer) = self.current_timer.replace(None) { (self.stop_timer)(timer); } // Handle disabled repeat rate. let gap = match self.details.gap { Some(gap) => Duration::from_micros(gap.get() as u64), None => return, }; let now = Instant::now(); *self.current_repeat.borrow_mut() = Some(RepeatData { keyboard, keycode: key, gap, start_protocol_time: time, start_instant: now, }); let token = (self.start_timer)(RepeatSource { timer: Timer::from_deadline(now + Duration::from_millis(self.details.delay as u64)), current_repeat: self.current_repeat.clone(), state, }); self.current_timer.set(Some(token)); } fn stop_repeat(&self, key: u32) { // only cancel if the released key is the currently repeating key let mut guard = self.current_repeat.borrow_mut(); let stop = (*guard).as_ref().map(|d| d.keycode == key).unwrap_or(false); if stop { if let Some(timer) = self.current_timer.replace(None) { (self.stop_timer)(timer); } *guard = None; } } fn stop_all_repeat(&self) { if let Some(timer) = self.current_timer.replace(None) { (self.stop_timer)(timer); } *self.current_repeat.borrow_mut() = None; } } #[cfg(feature = "calloop")] impl Drop for KbdRepeat { fn drop(&mut self) { self.stop_all_repeat(); } } impl KbdHandler { fn event( &mut self, kbd: wl_keyboard::WlKeyboard, event: wl_keyboard::Event, dispatch_data: wayland_client::DispatchData, ) { use wl_keyboard::Event; match event { Event::Keymap { format, fd, size } => self.keymap(kbd, format, fd, size), Event::Enter { serial, surface, keys } => { self.enter(kbd, serial, surface, keys, dispatch_data) } Event::Leave { serial, surface } => self.leave(kbd, serial, surface, dispatch_data), Event::Key { serial, time, key, state } => { self.key(kbd, serial, time, key, state, dispatch_data) } Event::Modifiers { mods_depressed, mods_latched, mods_locked, group, .. } => { self.modifiers(kbd, mods_depressed, mods_latched, mods_locked, group, dispatch_data) } Event::RepeatInfo { rate, delay } => self.repeat_info(kbd, rate, delay), _ => {} } } fn keymap( &mut self, _: wl_keyboard::WlKeyboard, format: wl_keyboard::KeymapFormat, fd: RawFd, size: u32, ) { let fd = unsafe { File::from_raw_fd(fd) }; let mut state = self.state.borrow_mut(); if state.locked() { // state is locked, ignore keymap updates return; } if state.ready() { // new keymap, we first deinit to free resources unsafe { state.de_init(); } } match format { wl_keyboard::KeymapFormat::XkbV1 => unsafe { state.init_with_fd(fd, size as usize); }, wl_keyboard::KeymapFormat::NoKeymap => { // TODO: how to handle this (hopefully never occuring) case? } _ => unreachable!(), } } fn enter( &mut self, object: wl_keyboard::WlKeyboard, serial: u32, surface: wl_surface::WlSurface, keys: Vec, dispatch_data: wayland_client::DispatchData, ) { let mut state = self.state.borrow_mut(); let rawkeys = keys .chunks_exact(4) .map(|c| u32::from_ne_bytes(c.try_into().unwrap())) .collect::>(); let keys: Vec = rawkeys.iter().map(|k| state.get_one_sym_raw(*k)).collect(); (self.callback.borrow_mut())( Event::Enter { serial, surface, rawkeys: &rawkeys, keysyms: &keys }, object, dispatch_data, ); } fn leave( &mut self, object: wl_keyboard::WlKeyboard, serial: u32, surface: wl_surface::WlSurface, dispatch_data: wayland_client::DispatchData, ) { #[cfg(feature = "calloop")] { if let Some(ref mut repeat) = self.repeat { repeat.stop_all_repeat(); } } (self.callback.borrow_mut())(Event::Leave { serial, surface }, object, dispatch_data); } #[cfg_attr(not(feature = "calloop"), allow(unused_variables))] fn key( &mut self, object: wl_keyboard::WlKeyboard, serial: u32, time: u32, key: u32, key_state: wl_keyboard::KeyState, dispatch_data: wayland_client::DispatchData, ) { let (sym, utf8, repeats) = { let mut state = self.state.borrow_mut(); // Get the values to generate a key event let sym = state.get_one_sym_raw(key); let utf8 = if key_state == wl_keyboard::KeyState::Pressed { match state.compose_feed(sym) { Some(ffi::xkb_compose_feed_result::XKB_COMPOSE_FEED_ACCEPTED) => { if let Some(status) = state.compose_status() { match status { ffi::xkb_compose_status::XKB_COMPOSE_COMPOSED => { state.compose_get_utf8() } ffi::xkb_compose_status::XKB_COMPOSE_NOTHING => { state.get_utf8_raw(key) } _ => None, } } else { state.get_utf8_raw(key) } } Some(_) => { // XKB_COMPOSE_FEED_IGNORED None } None => { // XKB COMPOSE is not initialized state.get_utf8_raw(key) } } } else { None }; let repeats = unsafe { state.key_repeats(key + 8) }; (sym, utf8, repeats) }; #[cfg(feature = "calloop")] { if let Some(ref mut repeat_handle) = self.repeat { if repeats { if key_state == wl_keyboard::KeyState::Pressed { repeat_handle.start_repeat(key, object.clone(), time, self.state.clone()); } else { repeat_handle.stop_repeat(key); } } } } (self.callback.borrow_mut())( Event::Key { serial, time, rawkey: key, keysym: sym, state: key_state, utf8 }, object, dispatch_data, ); } fn modifiers( &mut self, object: wl_keyboard::WlKeyboard, mods_depressed: u32, mods_latched: u32, mods_locked: u32, group: u32, dispatch_data: wayland_client::DispatchData, ) { { let mut state = self.state.borrow_mut(); state.update_modifiers(mods_depressed, mods_latched, mods_locked, group); (self.callback.borrow_mut())( Event::Modifiers { modifiers: state.mods_state() }, object, dispatch_data, ); } } #[cfg_attr(not(feature = "calloop"), allow(unused_variables))] fn repeat_info(&mut self, _: wl_keyboard::WlKeyboard, rate: i32, delay: i32) { #[cfg(feature = "calloop")] { if let Some(ref mut repeat_handle) = self.repeat { if !repeat_handle.details.locked { repeat_handle.details.gap = rate_to_gap(rate); repeat_handle.details.delay = delay as u32; } } } } } /* * Repeat handling */ #[derive(Debug)] #[cfg(feature = "calloop")] struct RepeatData { keyboard: wl_keyboard::WlKeyboard, keycode: u32, /// Gap between key presses gap: Duration, start_protocol_time: u32, start_instant: Instant, } /// An event source managing the key repetition of a keyboard /// /// It is given to you from [`map_keyboard`](fn.map_keyboard.html), and you need to /// insert it in your calloop event loop if you want to have functionning key repetition. /// /// If don't want key repetition you can just drop it. /// /// This source will not directly generate calloop events, and the callback provided to /// `EventLoopHandle::insert_source()` will be ignored. Instead it triggers the /// callback you provided to [`map_keyboard`](fn.map_keyboard.html). #[cfg(feature = "calloop")] #[derive(Debug)] pub struct RepeatSource { timer: calloop::timer::Timer, state: Rc>, current_repeat: Rc>>, } #[cfg(feature = "calloop")] impl calloop::EventSource for RepeatSource { type Event = Event<'static>; type Metadata = wl_keyboard::WlKeyboard; type Error = ::Error; type Ret = (); fn process_events( &mut self, readiness: calloop::Readiness, token: calloop::Token, mut callback: F, ) -> std::io::Result where F: FnMut(Event<'static>, &mut wl_keyboard::WlKeyboard), { let current_repeat = &self.current_repeat; let state = &self.state; self.timer.process_events(readiness, token, |last_trigger, &mut ()| { if let Some(ref mut data) = *current_repeat.borrow_mut() { // there is something to repeat let mut state = state.borrow_mut(); let keysym = state.get_one_sym_raw(data.keycode); let utf8 = state.get_utf8_raw(data.keycode); // Notify the callback. callback( Event::Repeat { time: data.start_protocol_time + (last_trigger - data.start_instant).as_millis() as u32, rawkey: data.keycode, keysym, utf8, }, &mut data.keyboard, ); // Schedule the next timeout. calloop::timer::TimeoutAction::ToInstant(last_trigger + data.gap) } else { calloop::timer::TimeoutAction::Drop } }) } fn register( &mut self, poll: &mut calloop::Poll, token_factory: &mut calloop::TokenFactory, ) -> calloop::Result<()> { self.timer.register(poll, token_factory) } fn reregister( &mut self, poll: &mut calloop::Poll, token_factory: &mut calloop::TokenFactory, ) -> calloop::Result<()> { self.timer.reregister(poll, token_factory) } fn unregister(&mut self, poll: &mut calloop::Poll) -> calloop::Result<()> { self.timer.unregister(poll) } } smithay-client-toolkit-0.16.1/src/seat/keyboard/state.rs000064400000000000000000000324221046102023000213420ustar 00000000000000use memmap2::MmapOptions; use std::{env, ffi::CString, fs::File, os::raw::c_char, os::unix::ffi::OsStringExt, ptr}; #[cfg(feature = "dlopen")] use super::ffi::XKBCOMMON_HANDLE as XKBH; #[cfg(not(feature = "dlopen"))] use super::ffi::*; use super::ffi::{self, xkb_state_component}; use super::Error; #[derive(Debug)] pub(crate) struct KbState { xkb_context: *mut ffi::xkb_context, xkb_keymap: *mut ffi::xkb_keymap, xkb_state: *mut ffi::xkb_state, xkb_compose_table: *mut ffi::xkb_compose_table, xkb_compose_state: *mut ffi::xkb_compose_state, mods_state: ModifiersState, locked: bool, } /// The RMLVO description of a keymap /// /// All fields are optional, and the system default /// will be used if set to `None`. #[derive(Debug)] #[allow(clippy::upper_case_acronyms)] pub struct RMLVO { /// The rules file to use pub rules: Option, /// The keyboard model by which to interpret keycodes and LEDs pub model: Option, /// A comma separated list of layouts (languages) to include in the keymap pub layout: Option, /// A comma separated list of variants, one per layout, which may modify or /// augment the respective layout in various ways pub variant: Option, /// A comma separated list of options, through which the user specifies /// non-layout related preferences, like which key combinations are /// used for switching layouts, or which key is the Compose key. pub options: Option, } /// Represents the current state of the keyboard modifiers /// /// Each field of this struct represents a modifier and is `true` if this modifier is active. /// /// For some modifiers, this means that the key is currently pressed, others are toggled /// (like caps lock). #[derive(Copy, Clone, Debug, Default)] pub struct ModifiersState { /// The "control" key pub ctrl: bool, /// The "alt" key pub alt: bool, /// The "shift" key pub shift: bool, /// The "Caps lock" key pub caps_lock: bool, /// The "logo" key /// /// Also known as the "windows" key on most keyboards pub logo: bool, /// The "Num lock" key pub num_lock: bool, } impl ModifiersState { fn new() -> ModifiersState { ModifiersState::default() } fn update_with(&mut self, state: *mut ffi::xkb_state) { self.ctrl = unsafe { ffi_dispatch!( XKBH, xkb_state_mod_name_is_active, state, ffi::XKB_MOD_NAME_CTRL.as_ptr() as *const c_char, xkb_state_component::XKB_STATE_MODS_EFFECTIVE ) > 0 }; self.alt = unsafe { ffi_dispatch!( XKBH, xkb_state_mod_name_is_active, state, ffi::XKB_MOD_NAME_ALT.as_ptr() as *const c_char, xkb_state_component::XKB_STATE_MODS_EFFECTIVE ) > 0 }; self.shift = unsafe { ffi_dispatch!( XKBH, xkb_state_mod_name_is_active, state, ffi::XKB_MOD_NAME_SHIFT.as_ptr() as *const c_char, xkb_state_component::XKB_STATE_MODS_EFFECTIVE ) > 0 }; self.caps_lock = unsafe { ffi_dispatch!( XKBH, xkb_state_mod_name_is_active, state, ffi::XKB_MOD_NAME_CAPS.as_ptr() as *const c_char, xkb_state_component::XKB_STATE_MODS_EFFECTIVE ) > 0 }; self.logo = unsafe { ffi_dispatch!( XKBH, xkb_state_mod_name_is_active, state, ffi::XKB_MOD_NAME_LOGO.as_ptr() as *const c_char, xkb_state_component::XKB_STATE_MODS_EFFECTIVE ) > 0 }; self.num_lock = unsafe { ffi_dispatch!( XKBH, xkb_state_mod_name_is_active, state, ffi::XKB_MOD_NAME_NUM.as_ptr() as *const c_char, xkb_state_component::XKB_STATE_MODS_EFFECTIVE ) > 0 }; } } impl KbState { pub(crate) fn update_modifiers( &mut self, mods_depressed: u32, mods_latched: u32, mods_locked: u32, group: u32, ) { if !self.ready() { return; } let mask = unsafe { ffi_dispatch!( XKBH, xkb_state_update_mask, self.xkb_state, mods_depressed, mods_latched, mods_locked, 0, 0, group ) }; if mask.contains(xkb_state_component::XKB_STATE_MODS_EFFECTIVE) { // effective value of mods have changed, we need to update our state self.mods_state.update_with(self.xkb_state); } } pub(crate) fn get_one_sym_raw(&mut self, keycode: u32) -> u32 { if !self.ready() { return 0; } unsafe { ffi_dispatch!(XKBH, xkb_state_key_get_one_sym, self.xkb_state, keycode + 8) } } pub(crate) fn get_utf8_raw(&mut self, keycode: u32) -> Option { if !self.ready() { return None; } let size = unsafe { ffi_dispatch!( XKBH, xkb_state_key_get_utf8, self.xkb_state, keycode + 8, ptr::null_mut(), 0 ) } + 1; if size <= 1 { return None; }; let mut buffer = vec![0; size as usize]; unsafe { ffi_dispatch!( XKBH, xkb_state_key_get_utf8, self.xkb_state, keycode + 8, buffer.as_mut_ptr() as *mut _, size as usize ); }; // remove the final `\0` buffer.pop(); // libxkbcommon will always provide valid UTF8 Some(unsafe { String::from_utf8_unchecked(buffer) }) } pub(crate) fn compose_feed(&mut self, keysym: u32) -> Option { if !self.ready() || self.xkb_compose_state.is_null() { return None; } Some(unsafe { ffi_dispatch!(XKBH, xkb_compose_state_feed, self.xkb_compose_state, keysym) }) } pub(crate) fn compose_status(&mut self) -> Option { if !self.ready() || self.xkb_compose_state.is_null() { return None; } Some(unsafe { ffi_dispatch!(XKBH, xkb_compose_state_get_status, self.xkb_compose_state) }) } pub(crate) fn compose_get_utf8(&mut self) -> Option { if !self.ready() || self.xkb_compose_state.is_null() { return None; } let size = unsafe { ffi_dispatch!( XKBH, xkb_compose_state_get_utf8, self.xkb_compose_state, ptr::null_mut(), 0 ) } + 1; if size <= 1 { return None; }; let mut buffer = vec![0; size as usize]; unsafe { buffer.set_len(size as usize); ffi_dispatch!( XKBH, xkb_compose_state_get_utf8, self.xkb_compose_state, buffer.as_mut_ptr() as *mut _, size as usize ); }; // remove the final `\0` buffer.pop(); // libxkbcommon will always provide valid UTF8 Some(unsafe { String::from_utf8_unchecked(buffer) }) } pub(crate) fn new() -> Result { #[cfg(feature = "dlopen")] { if ffi::XKBCOMMON_OPTION.as_ref().is_none() { return Err(Error::XKBNotFound); } } let context = unsafe { ffi_dispatch!(XKBH, xkb_context_new, ffi::xkb_context_flags::XKB_CONTEXT_NO_FLAGS) }; if context.is_null() { return Err(Error::XKBNotFound); } let mut me = KbState { xkb_context: context, xkb_keymap: ptr::null_mut(), xkb_state: ptr::null_mut(), xkb_compose_table: ptr::null_mut(), xkb_compose_state: ptr::null_mut(), mods_state: ModifiersState::new(), locked: false, }; unsafe { me.init_compose(); } Ok(me) } pub(crate) fn from_rmlvo(rmlvo: RMLVO) -> Result { fn to_cstring(s: Option) -> Result, Error> { s.map_or(Ok(None), |s| CString::new(s).map(Option::Some)).map_err(|_| Error::BadNames) } let mut state = KbState::new()?; let rules = to_cstring(rmlvo.rules)?; let model = to_cstring(rmlvo.model)?; let layout = to_cstring(rmlvo.layout)?; let variant = to_cstring(rmlvo.variant)?; let options = to_cstring(rmlvo.options)?; let xkb_names = ffi::xkb_rule_names { rules: rules.map_or(ptr::null(), |s| s.as_ptr()), model: model.map_or(ptr::null(), |s| s.as_ptr()), layout: layout.map_or(ptr::null(), |s| s.as_ptr()), variant: variant.map_or(ptr::null(), |s| s.as_ptr()), options: options.map_or(ptr::null(), |s| s.as_ptr()), }; unsafe { state.init_with_rmlvo(xkb_names)?; } state.locked = true; Ok(state) } pub(crate) unsafe fn init_compose(&mut self) { let locale = env::var_os("LC_ALL") .and_then(|v| if v.is_empty() { None } else { Some(v) }) .or_else(|| env::var_os("LC_CTYPE")) .and_then(|v| if v.is_empty() { None } else { Some(v) }) .or_else(|| env::var_os("LANG")) .and_then(|v| if v.is_empty() { None } else { Some(v) }) .unwrap_or_else(|| "C".into()); let locale = CString::new(locale.into_vec()).unwrap(); let compose_table = ffi_dispatch!( XKBH, xkb_compose_table_new_from_locale, self.xkb_context, locale.as_ptr(), ffi::xkb_compose_compile_flags::XKB_COMPOSE_COMPILE_NO_FLAGS ); if compose_table.is_null() { // init of compose table failed, continue without compose return; } let compose_state = ffi_dispatch!( XKBH, xkb_compose_state_new, compose_table, ffi::xkb_compose_state_flags::XKB_COMPOSE_STATE_NO_FLAGS ); if compose_state.is_null() { // init of compose state failed, continue without compose ffi_dispatch!(XKBH, xkb_compose_table_unref, compose_table); return; } self.xkb_compose_table = compose_table; self.xkb_compose_state = compose_state; } pub(crate) unsafe fn post_init(&mut self, keymap: *mut ffi::xkb_keymap) { let state = ffi_dispatch!(XKBH, xkb_state_new, keymap); self.xkb_keymap = keymap; self.xkb_state = state; self.mods_state.update_with(state); } pub(crate) unsafe fn de_init(&mut self) { ffi_dispatch!(XKBH, xkb_state_unref, self.xkb_state); self.xkb_state = ptr::null_mut(); ffi_dispatch!(XKBH, xkb_keymap_unref, self.xkb_keymap); self.xkb_keymap = ptr::null_mut(); } pub(crate) unsafe fn init_with_fd(&mut self, fd: File, size: usize) { let map = MmapOptions::new().len(size).map(&fd).unwrap(); let keymap = ffi_dispatch!( XKBH, xkb_keymap_new_from_string, self.xkb_context, map.as_ptr() as *const _, ffi::xkb_keymap_format::XKB_KEYMAP_FORMAT_TEXT_V1, ffi::xkb_keymap_compile_flags::XKB_KEYMAP_COMPILE_NO_FLAGS ); if keymap.is_null() { panic!("Received invalid keymap from compositor."); } self.post_init(keymap); } pub(crate) unsafe fn init_with_rmlvo( &mut self, names: ffi::xkb_rule_names, ) -> Result<(), Error> { let keymap = ffi_dispatch!( XKBH, xkb_keymap_new_from_names, self.xkb_context, &names, ffi::xkb_keymap_compile_flags::XKB_KEYMAP_COMPILE_NO_FLAGS ); if keymap.is_null() { return Err(Error::BadNames); } self.post_init(keymap); Ok(()) } pub(crate) unsafe fn key_repeats(&mut self, xkb_keycode_t: ffi::xkb_keycode_t) -> bool { ffi_dispatch!(XKBH, xkb_keymap_key_repeats, self.xkb_keymap, xkb_keycode_t) == 1 } #[inline] pub(crate) fn ready(&self) -> bool { !self.xkb_state.is_null() } #[inline] pub(crate) fn locked(&self) -> bool { self.locked } #[inline] pub(crate) fn mods_state(&self) -> ModifiersState { self.mods_state } } impl Drop for KbState { fn drop(&mut self) { unsafe { ffi_dispatch!(XKBH, xkb_compose_state_unref, self.xkb_compose_state); ffi_dispatch!(XKBH, xkb_compose_table_unref, self.xkb_compose_table); ffi_dispatch!(XKBH, xkb_state_unref, self.xkb_state); ffi_dispatch!(XKBH, xkb_keymap_unref, self.xkb_keymap); ffi_dispatch!(XKBH, xkb_context_unref, self.xkb_context); } } } smithay-client-toolkit-0.16.1/src/seat/mod.rs000064400000000000000000000254161046102023000172060ustar 00000000000000//! Types for automatically handling seats //! //! This modules provides a `SeatHandler` for use with the //! [`environment!`](../macro.environment.html) macro. It is automatically inserted //! in the [`default_environment!`](../macro.default_environment.html). //! //! This handler tracks the capability of the seats declared by the compositor, //! and gives you the possibility to register callbacks that will be invoked whenever //! a new seat is created of the state of a seat changes, via the //! [`Environment::listen_for_seats`](../environment/struct.Environment.html) method. //! //! **Note:** if you don't use the [`default_environment!`](../macro.default_environment.html), //! you'll need to implement the [`SeatHandling`](trait.SeatHandling.hmtl) on your //! environment struct to access the added methods on //! [`Environment`](../environment/struct.Environment.html). use std::{ cell::RefCell, fmt::{self, Debug, Formatter}, rc::{Rc, Weak}, sync::Mutex, }; use bitflags::bitflags; use wayland_client::{ protocol::{wl_registry, wl_seat}, Attached, DispatchData, Main, }; pub mod keyboard; pub mod pointer; type SeatCallback = dyn FnMut(Attached, &SeatData, DispatchData) + 'static; /// The metadata associated with a seat #[derive(Clone)] pub struct SeatData { /// The name of this seat /// /// It can be used as an identifier for the seat pub name: String, /// Whether this seat has a pointer available pub has_pointer: bool, /// Whether this seat has a keyboard available pub has_keyboard: bool, /// Whether this seat has a touchscreen available pub has_touch: bool, /// Whether this seat has been removed from the registry /// /// Once a seat is removed, you will no longer receive any /// event on any of its associated devices (pointer, keyboard or touch). /// /// You can thus cleanup all your state associated with this seat. pub defunct: bool, /// State of readiness of the data. state: SeatDataState, } bitflags! { struct SeatDataState: u8 { const NEW = 0b00000000; const GOT_NAME = 0b00000001; const GOT_CAPABILITIES = 0b00000010; const READY = Self::GOT_NAME.bits | Self::GOT_CAPABILITIES.bits; } } impl Debug for SeatData { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.debug_struct("SeatData") .field("name", &self.name) .field("has_pointer", &self.has_pointer) .field("has_keyboard", &self.has_keyboard) .field("has_touch", &self.has_touch) .field("defunct", &self.defunct) .finish() } } impl SeatData { fn new() -> SeatData { SeatData { name: String::new(), has_pointer: false, has_keyboard: false, has_touch: false, defunct: false, state: SeatDataState::NEW, } } } /// A simple handler for seats /// /// This handler will manage seats and track their capabilities. /// /// You can register callbacks using the [`SeatHandling::listen`](trait.SeatHandling.html) /// to be notified whenever a seat is created, destroyed, or its capabilities change. pub struct SeatHandler { seats: Vec<(u32, Attached)>, listeners: Rc>>>>, } impl SeatHandler { /// Create a new SeatHandler pub fn new() -> SeatHandler { SeatHandler { seats: Vec::new(), listeners: Rc::new(RefCell::new(Vec::new())) } } } impl fmt::Debug for SeatHandler { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.debug_struct("SeatHandler") .field("seats", &self.seats) .field("listeners", &"Fn(..) -> { ... }") .finish() } } /// A handle to an seat listener callback /// /// Dropping it disables the associated callback and frees the closure. pub struct SeatListener { _cb: Rc>, } impl crate::environment::MultiGlobalHandler for SeatHandler { fn created( &mut self, registry: Attached, id: u32, version: u32, _: DispatchData, ) { // Seat is supported up to version 6 let version = std::cmp::min(version, 6); let seat = registry.bind::(version, id); seat.as_ref().user_data().set_threadsafe(|| Mutex::new(SeatData::new())); let cb_listeners = self.listeners.clone(); seat.quick_assign(move |seat, event, ddata| { process_seat_event(seat, event, &cb_listeners, ddata) }); self.seats.push((id, (*seat).clone())); } fn removed(&mut self, id: u32, mut ddata: DispatchData) { let mut listeners = self.listeners.borrow_mut(); self.seats.retain(|&(i, ref seat)| { if i != id { true } else { // This data must be `Mutex` if this seat is in our vec let data = seat.as_ref().user_data().get::>().unwrap(); let mut guard = data.lock().unwrap(); guard.defunct = true; // notify the listeners that the seat is dead listeners.retain(|lst| { if let Some(cb) = Weak::upgrade(lst) { (cb.borrow_mut())(seat.clone(), &*guard, ddata.reborrow()); true } else { false } }); false } }); } fn get_all(&self) -> Vec> { self.seats.iter().map(|(_, s)| s.clone()).collect() } } impl fmt::Debug for SeatListener { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.debug_struct("SeatListener").field("_cb", &"Fn(..) -> { ... }").finish() } } fn process_seat_event( seat: Main, event: wl_seat::Event, listeners: &RefCell>>>, mut ddata: DispatchData, ) { let new_data = { let data = seat.as_ref().user_data().get::>().unwrap(); let mut guard = data.lock().unwrap(); match event { wl_seat::Event::Name { name } => { guard.state.set(SeatDataState::GOT_NAME, true); guard.name = name; } wl_seat::Event::Capabilities { capabilities } => { guard.state.set(SeatDataState::GOT_CAPABILITIES, true); guard.has_pointer = capabilities.contains(wl_seat::Capability::Pointer); guard.has_keyboard = capabilities.contains(wl_seat::Capability::Keyboard); guard.has_touch = capabilities.contains(wl_seat::Capability::Touch); } _ => unreachable!(), } guard.clone() }; if new_data.state.contains(SeatDataState::READY) { listeners.borrow_mut().retain(|lst| { if let Some(cb) = Weak::upgrade(lst) { (cb.borrow_mut())((*seat).clone(), &new_data, ddata.reborrow()); true } else { false } }); } } /// Get the copy of the data associated with this seat /// /// If the provided `WlSeat` has not yet been initialized or is not managed by SCTK, `None` is returned. /// /// If the seat has been removed by the compositor, the `defunct` field of the `SeatData` /// will be set to `true`. This handler will not automatically detroy the output by calling its /// `release` method, to avoid interfering with your logic. pub fn clone_seat_data(seat: &wl_seat::WlSeat) -> Option { if let Some(udata_mutex) = seat.as_ref().user_data().get::>() { let udata = udata_mutex.lock().unwrap(); Some(udata.clone()) } else { None } } /// Access the data associated with this seat /// /// The provided closure is given the [`SeatData`](struct.SeatData.html) as argument, /// and its return value is returned from this function. /// /// If the provided `WlSeat` has not yet been initialized or is not managed by SCTK, `None` is returned. /// /// If the seat has been removed by the compositor, the `defunct` field of the `SeatData` /// will be set to `true`. This handler will not automatically detroy the output by calling its /// `release` method, to avoid interfering with your logic. pub fn with_seat_data T>(seat: &wl_seat::WlSeat, f: F) -> Option { if let Some(udata_mutex) = seat.as_ref().user_data().get::>() { let udata = udata_mutex.lock().unwrap(); Some(f(&*udata)) } else { None } } /// Trait representing the SeatHandler functions /// /// Implementing this trait on your inner environment struct used with the /// [`environment!`](../macro.environment.html) by delegating it to its /// [`SeatHandler`](struct.SeatHandler.html) field will make available the seat-associated /// method on your [`Environment`](../environment/struct.Environment.html). pub trait SeatHandling { /// Insert a listener for seat events fn listen, &SeatData, DispatchData) + 'static>( &mut self, f: F, ) -> SeatListener; } impl SeatHandling for SeatHandler { fn listen, &SeatData, DispatchData) + 'static>( &mut self, f: F, ) -> SeatListener { let rc = Rc::new(RefCell::new(f)) as Rc<_>; self.listeners.borrow_mut().push(Rc::downgrade(&rc)); SeatListener { _cb: rc } } } impl crate::environment::Environment { /// Insert a new listener for seats /// /// The provided closure will be invoked whenever a `wl_seat` is made available, /// removed, or see its capabilities changed. /// /// Note that if seats already exist when this callback is setup, it'll not be invoked on them. /// For you to be notified of them as well, you need to first process them manually by calling /// `.get_all_seats()`. /// /// The returned [`SeatListener`](../seat/struct.SeatListener.hmtl) keeps your callback alive, /// dropping it will disable it. #[must_use = "the returned SeatListener keeps your callback alive, dropping it will disable it"] pub fn listen_for_seats< F: FnMut(Attached, &SeatData, DispatchData) + 'static, >( &self, f: F, ) -> SeatListener { self.with_inner(move |inner| SeatHandling::listen(inner, f)) } } impl> crate::environment::Environment { /// Shorthand method to retrieve the list of seats pub fn get_all_seats(&self) -> Vec> { self.get_all_globals::().into_iter().collect() } } smithay-client-toolkit-0.16.1/src/seat/pointer/mod.rs000064400000000000000000000002001046102023000206460ustar 00000000000000//! Utilities to work with pointers and their icons mod theme; pub use self::theme::{ThemeManager, ThemeSpec, ThemedPointer}; smithay-client-toolkit-0.16.1/src/seat/pointer/theme.rs000064400000000000000000000223451046102023000212070ustar 00000000000000use std::{ cell::RefCell, fmt, ops::Deref, rc::{Rc, Weak}, }; use wayland_client::{ protocol::{wl_compositor, wl_pointer, wl_seat, wl_shm, wl_surface}, Attached, DispatchData, }; use wayland_cursor::{Cursor, CursorTheme}; /// The specification of a cursor theme to be used by the ThemeManager #[derive(Debug)] pub enum ThemeSpec<'a> { /// Use this specific theme with given base size Precise { /// Name of the cursor theme to use name: &'a str, /// Base size of the cursor images /// /// This is the size that will be used on monitors with a scale /// factor of 1. Cursor images sizes will be multiples of this /// base size on HiDPI outputs. size: u32, }, /// Use the system provided theme /// /// In this case SCTK will read the `XCURSOR_THEME` and /// `XCURSOR_SIZE` environment variables to figure out the /// theme to use. System, } /// Wrapper managing a system theme for pointer images /// /// You can use it to initialize new pointers in order /// to theme them. /// /// Is is also clone-able in case you need to handle several /// pointer theming from different places. /// /// Note that it is however neither `Send` nor `Sync` #[derive(Debug, Clone)] pub struct ThemeManager { themes: Rc>, compositor: Attached, } impl ThemeManager { /// Load a system pointer theme /// /// Will use the default theme of the system if name is `None`. pub fn init( theme: ThemeSpec, compositor: Attached, shm: Attached, ) -> ThemeManager { ThemeManager { compositor, themes: Rc::new(RefCell::new(ScaledThemeList::new(theme, shm))) } } /// Wrap a pointer to theme it pub fn theme_pointer(&self, pointer: wl_pointer::WlPointer) -> ThemedPointer { let surface = self.compositor.create_surface(); let inner = Rc::new(RefCell::new(PointerInner { surface: surface.detach(), themes: self.themes.clone(), last_serial: 0, current_cursor: "left_ptr".into(), scale_factor: 1, })); let my_pointer = pointer.clone(); let winner = Rc::downgrade(&inner); crate::surface::setup_surface( surface, Some(move |scale_factor, _, _: DispatchData| { if let Some(inner) = Weak::upgrade(&winner) { let mut inner = inner.borrow_mut(); inner.scale_factor = scale_factor; // we can't handle errors here, so ignore it // worst that can happen is cursor drawn with the wrong // scale factor let _ = inner.update_cursor(&my_pointer); } }), ); ThemedPointer { pointer, inner } } /// Initialize a new pointer as a ThemedPointer with an adapter implementation /// /// You need to provide an implementation as if implementing a `wl_pointer`, but /// it will receive as `meta` argument a `ThemedPointer` wrapping your pointer, /// rather than a `WlPointer`. pub fn theme_pointer_with_impl( &self, seat: &Attached, mut callback: F, ) -> ThemedPointer where F: FnMut(wl_pointer::Event, ThemedPointer, DispatchData) + 'static, { let surface = self.compositor.create_surface(); let inner = Rc::new(RefCell::new(PointerInner { surface: surface.detach(), themes: self.themes.clone(), last_serial: 0, current_cursor: "left_ptr".into(), scale_factor: 1, })); let inner2 = inner.clone(); let pointer = seat.get_pointer(); pointer.quick_assign(move |ptr, event, ddata| { callback(event, ThemedPointer { pointer: ptr.detach(), inner: inner2.clone() }, ddata) }); let winner = Rc::downgrade(&inner); let my_pointer = pointer.clone(); crate::surface::setup_surface( surface, Some(move |scale_factor, _, _: DispatchData| { if let Some(inner) = Weak::upgrade(&winner) { let mut inner = inner.borrow_mut(); inner.scale_factor = scale_factor; // we can't handle errors here, so ignore it // worst that can happen is cursor drawn with the wrong // scale factor let _ = inner.update_cursor(&my_pointer); } }), ); ThemedPointer { pointer: pointer.detach(), inner } } } struct ScaledThemeList { shm: Attached, name: String, size: u32, themes: Vec<(u32, CursorTheme)>, } impl ScaledThemeList { fn new(theme: ThemeSpec, shm: Attached) -> ScaledThemeList { let (name, size) = match theme { ThemeSpec::Precise { name, size } => (name.into(), size), ThemeSpec::System => { let name = std::env::var("XCURSOR_THEME").ok().unwrap_or_else(|| "default".into()); let size = std::env::var("XCURSOR_SIZE").ok().and_then(|s| s.parse().ok()).unwrap_or(24); (name, size) } }; ScaledThemeList { shm, name, size, themes: vec![] } } fn get_cursor(&mut self, name: &str, scale: u32) -> Option<&Cursor> { // Check if we already loaded the theme for this scale factor let opt_index = self.themes.iter().position(|&(s, _)| s == scale); if let Some(idx) = opt_index { self.themes[idx].1.get_cursor(name) } else { let new_theme = CursorTheme::load_from_name(&self.name, self.size * scale, &self.shm); self.themes.push((scale, new_theme)); self.themes.last_mut().unwrap().1.get_cursor(name) } } } impl fmt::Debug for ScaledThemeList { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("ScaledThemeList") .field("shm", &self.shm) .field("name", &self.name) .field("size", &self.size) // Wayland-cursor needs to implement debug .field("themes", &"[...]") .finish() } } #[derive(Debug)] struct PointerInner { surface: wl_surface::WlSurface, themes: Rc>, current_cursor: String, last_serial: u32, scale_factor: i32, } impl PointerInner { fn update_cursor(&self, pointer: &wl_pointer::WlPointer) -> Result<(), CursorNotFound> { let mut themes = self.themes.borrow_mut(); let scale = self.scale_factor as u32; let cursor = themes.get_cursor(&self.current_cursor, scale).ok_or(CursorNotFound)?; let image = &cursor[0]; let (w, h) = image.dimensions(); let (hx, hy) = image.hotspot(); self.surface.set_buffer_scale(scale as i32); self.surface.attach(Some(image), 0, 0); if self.surface.as_ref().version() >= 4 { self.surface.damage_buffer(0, 0, w as i32, h as i32); } else { // surface is old and does not support damage_buffer, so we damage // in surface coordinates and hope it is not rescaled self.surface.damage(0, 0, w as i32 / scale as i32, h as i32 / scale as i32); } self.surface.commit(); pointer.set_cursor( self.last_serial, Some(&self.surface), hx as i32 / scale as i32, hy as i32 / scale as i32, ); Ok(()) } } /// Wrapper of a themed pointer /// /// You can access the underlying `wl_pointer::WlPointer` via /// deref. It will *not* release the proxy when dropped. /// /// Just like `Proxy`, this is a `Rc`-like wrapper. You can clone it /// to have several handles to the same theming machinery of a pointer. #[derive(Debug, Clone)] pub struct ThemedPointer { pointer: wl_pointer::WlPointer, inner: Rc>, } impl ThemedPointer { /// Change the cursor to the given cursor name /// /// Possible names depend on the theme. Does nothing and returns /// `Err` if given name is not available. /// /// If this is done as an answer to an input event, you need to provide /// the associated serial otherwise the server may ignore the request. pub fn set_cursor(&self, name: &str, serial: Option) -> Result<(), CursorNotFound> { let mut inner = self.inner.borrow_mut(); if let Some(s) = serial { inner.last_serial = s; } inner.current_cursor = name.into(); inner.update_cursor(&self.pointer) } } impl Deref for ThemedPointer { type Target = wl_pointer::WlPointer; fn deref(&self) -> &wl_pointer::WlPointer { &self.pointer } } impl Drop for PointerInner { fn drop(&mut self) { self.surface.destroy(); } } /// An error representing the fact that the required cursor was not found #[derive(Debug, Copy, Clone)] pub struct CursorNotFound; impl std::error::Error for CursorNotFound {} impl std::fmt::Display for CursorNotFound { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str("cursor not found") } } smithay-client-toolkit-0.16.1/src/shell/mod.rs000064400000000000000000000331571046102023000173620ustar 00000000000000//! Unified shell surface handling //! //! This module provides an abstraction unifying the various iterations of //! the shell surface protocols (`wl_shell`, `zxdg_shell_v6` and `xdg_shell`, //! the current standard). //! //! This abstraction only manages the protocol part of shell surfaces. If you're //! looking for a more battery-included abstraction for creating windows, //! consider the `Window` type. use std::{cell::RefCell, fmt}; use wayland_client::{ protocol::{wl_output, wl_registry, wl_seat, wl_shell, wl_surface}, Attached, DispatchData, }; pub use wayland_protocols::xdg_shell::client::xdg_toplevel::State; use wayland_protocols::{ unstable::xdg_shell::v6::client::zxdg_shell_v6, xdg_shell::client::{xdg_toplevel, xdg_wm_base}, }; use crate::environment::{Environment, GlobalHandler}; mod wl; mod xdg; mod zxdg; use crate::lazy_global::LazyGlobal; /// Possible events generated by a shell surface that you need to handle #[derive(Clone, Debug)] pub enum Event { /// The state of your window has been changed Configure { /// Optional new size for your shell surface /// /// This is the new size of the contents of your shell surface /// as suggested by the server. You can ignore it and choose /// a new size if you want better control on the possible /// sizes of your shell surface. /// /// In all cases, these events can be generated in large batches /// during an interactive resize, and you should buffer them before /// processing them. You only need to handle the last one of a batch. new_size: Option<(u32, u32)>, /// New combination of states of your window /// /// Typically tells you if your surface is active/inactive, maximized, /// etc... states: Vec, }, /// A close request has been received /// /// Most likely the user has clicked on the close button of the decorations /// or something equivalent Close, } #[derive(Debug)] /// Possible supported shell protocols pub enum Shell { /// The current standard `xdg_shell` protocol. Xdg(Attached), /// A previous iteration of the `xdg_shell` protocol. /// /// It has been replaced by the stable `xdg_shell`, and is only present here for /// compatibility purposes. Zxdg(Attached), /// The legacy `wl_shell`. /// /// It is deprecated and only present here for compatibility purposes. Wl(Attached), } impl Shell { /// Check if the shell in use needs you to wait for a `configure` event /// before you are allowed to draw. pub fn needs_configure(&self) -> bool { match self { Shell::Wl(_) => false, Shell::Xdg(_) => true, Shell::Zxdg(_) => true, } } } pub(crate) fn create_shell_surface( shell: &Shell, surface: &wl_surface::WlSurface, callback: F, ) -> Box where F: FnMut(Event, DispatchData) + 'static, { match *shell { Shell::Wl(ref shell) => Box::new(wl::Wl::create(surface, shell, callback)) as Box<_>, Shell::Xdg(ref shell) => Box::new(xdg::Xdg::create(surface, shell, callback)) as Box<_>, Shell::Zxdg(ref shell) => Box::new(zxdg::Zxdg::create(surface, shell, callback)) as Box<_>, } } /// Trait abstracting over shell surface protocols /// /// This trait's API is designed to reflect the behavior of the current standard /// shell surface protocol: `xdg_shell`. Compatibility implementations are /// provided for older protocols. pub trait ShellSurface: fmt::Debug + Send + Sync { /// Resizes the shell surface fn resize(&self, seat: &wl_seat::WlSeat, serial: u32, edges: xdg_toplevel::ResizeEdge); /// Moves the shell surface fn move_(&self, seat: &wl_seat::WlSeat, serial: u32); /// Set the title of the shell surface fn set_title(&self, title: String); /// Set the app id of the shell surface fn set_app_id(&self, app_id: String); /// Make fullscreen fn set_fullscreen(&self, output: Option<&wl_output::WlOutput>); /// Unset fullscreen fn unset_fullscreen(&self); /// Maximize surface fn set_maximized(&self); /// Unmaximize surface fn unset_maximized(&self); /// Minimize surface fn set_minimized(&self); /// Set geometry fn set_geometry(&self, x: i32, y: i32, width: i32, height: i32); /// Set minimum surface size fn set_min_size(&self, size: Option<(i32, i32)>); /// Set maximum surface size fn set_max_size(&self, size: Option<(i32, i32)>); /// Show window menu. fn show_window_menu(&self, seat: &wl_seat::WlSeat, serial: u32, x: i32, y: i32); /// Retrive the `XdgToplevel` proxy if the underlying shell surface /// uses the `xdg_shell` protocol. /// /// This allows interactions with other protocol extensions, like /// `xdg_decoratins` for example. fn get_xdg(&self) -> Option<&xdg_toplevel::XdgToplevel>; } #[derive(Debug)] struct ShellInner { registry: Option>, wl_shell: LazyGlobal, xdg_shell: LazyGlobal, zxdg_shell: LazyGlobal, } /// A handler for shells /// /// For use with the [`environment!`](../macro.environment.html) macro. It is already /// automatically included if you use the [`default_environment!`](../macro.default_environment.hmtl). /// /// To use it, you need to set it as a handler for the shells you want to support (`xdg_wm_base`, /// `zxdg_shell_v6` and/or `wl_shell`). You can then implement the /// [`ShellHandling`](trait.ShellHandling.html) by delegating it, to get the shell-related methods on /// [`Environment`](../environment/struct.environment.html) /// /// ```no_run /// # extern crate smithay_client_toolkit as sctk; /// # use sctk::environment; /// # use sctk::environment::Environment; /// # use sctk::shell::*; /// # use sctk::reexports::client::protocol::wl_shell; /// # use sctk::reexports::protocols::xdg_shell::client::xdg_wm_base; /// # use sctk::reexports::protocols::unstable::xdg_shell::v6::client::zxdg_shell_v6; /// # let display = sctk::reexports::client::Display::connect_to_env().unwrap(); /// # let mut queue = display.create_event_queue(); /// # let attached_display = display.attach(queue.token()); /// struct MyEnv { /// my_shell: ShellHandler /// } /// /// environment!(MyEnv, /// singles=[ /// wl_shell::WlShell => my_shell, /// xdg_wm_base::XdgWmBase => my_shell, /// zxdg_shell_v6::ZxdgShellV6 => my_shell /// ], /// multis=[], /// ); /// /// impl ShellHandling for MyEnv { /// fn get_shell(&self) -> Option { /// // delegate the impl to the stored handler /// self.my_shell.get_shell() /// } /// } /// /// let env = Environment::new(&attached_display, &mut queue, MyEnv { /// my_shell: ShellHandler::new() /// }); /// ``` #[derive(Debug)] pub struct ShellHandler { inner: RefCell, } impl ShellHandler { /// Create a new handler pub fn new() -> ShellHandler { ShellHandler { inner: RefCell::new(ShellInner { registry: None, wl_shell: LazyGlobal::Unknown, xdg_shell: LazyGlobal::Unknown, zxdg_shell: LazyGlobal::Unknown, }), } } } impl GlobalHandler for ShellHandler { fn created( &mut self, registry: Attached, id: u32, version: u32, _: DispatchData, ) { let mut inner = self.inner.borrow_mut(); if inner.registry.is_none() { inner.registry = Some(registry); } if let LazyGlobal::Unknown = inner.wl_shell { inner.wl_shell = LazyGlobal::Seen { id, version }; } else { log::warn!("Compositor advertised wl_shell multiple times, ignoring.") } } fn get(&self) -> Option> { let mut inner = self.inner.borrow_mut(); match inner.wl_shell { LazyGlobal::Bound(ref shell) => Some(shell.clone()), LazyGlobal::Unknown => None, LazyGlobal::Seen { id, .. } => { // registry cannot be None if we have seen the global let registry = inner.registry.as_ref().unwrap(); // only version 1 of wl_shell is supported let shell = registry.bind::(1, id); inner.wl_shell = LazyGlobal::Bound((*shell).clone()); Some((*shell).clone()) } } } } impl GlobalHandler for ShellHandler { fn created( &mut self, registry: Attached, id: u32, version: u32, _: DispatchData, ) { let mut inner = self.inner.borrow_mut(); if inner.registry.is_none() { inner.registry = Some(registry); } if let LazyGlobal::Unknown = inner.xdg_shell { inner.xdg_shell = LazyGlobal::Seen { id, version }; } else { log::warn!("Compositor advertised xdg_wm_base multiple times, ignoring.") } } fn get(&self) -> Option> { let mut inner = self.inner.borrow_mut(); match inner.xdg_shell { LazyGlobal::Bound(ref shell) => Some(shell.clone()), LazyGlobal::Unknown => None, LazyGlobal::Seen { version, id } => { // registry cannot be None if we have seen the global let registry = inner.registry.as_ref().unwrap(); // we currently support xdg_shell up to version 2 let version = std::cmp::min(2, version); let shell = registry.bind::(version, id); shell.quick_assign(|shell, event, _| { if let xdg_wm_base::Event::Ping { serial } = event { shell.pong(serial); } }); inner.xdg_shell = LazyGlobal::Bound((*shell).clone()); Some((*shell).clone()) } } } } impl GlobalHandler for ShellHandler { fn created( &mut self, registry: Attached, id: u32, version: u32, _: DispatchData, ) { let mut inner = self.inner.borrow_mut(); if inner.registry.is_none() { inner.registry = Some(registry); } if let LazyGlobal::Unknown = inner.zxdg_shell { inner.zxdg_shell = LazyGlobal::Seen { id, version }; } else { log::warn!("Compositor advertised zxdg_shell_v6 multiple times, ignoring.") } } fn get(&self) -> Option> { let mut inner = self.inner.borrow_mut(); match inner.zxdg_shell { LazyGlobal::Bound(ref shell) => Some(shell.clone()), LazyGlobal::Unknown => None, LazyGlobal::Seen { id, .. } => { // registry cannot be None if we have seen the global let registry = inner.registry.as_ref().unwrap(); // only version 1 of zxdg_shell_v6 is supported let shell = registry.bind::(1, id); shell.quick_assign(|shell, event, _| { if let zxdg_shell_v6::Event::Ping { serial } = event { shell.pong(serial); } }); inner.zxdg_shell = LazyGlobal::Bound((*shell).clone()); Some((*shell).clone()) } } } } impl ShellHandling for ShellHandler { fn get_shell(&self) -> Option { GlobalHandler::::get(self) .map(Shell::Xdg) .or_else(|| GlobalHandler::::get(self).map(Shell::Zxdg)) .or_else(|| GlobalHandler::::get(self).map(Shell::Wl)) } } /// A helper trait for delegating shell handling /// /// If you don't use [`declare_default_environment!`](../macro.declare_default_environment.html) but still /// want to use the shell helpers provided here, you need to implement this trait for your /// [`declare_environment!`](../macro.declare_environment.html)-generated type, by delegating it to one /// of the handlers you provided for the different shells. pub trait ShellHandling { /// Get the best available shell fn get_shell(&self) -> Option; } impl Environment { /// Get the best available shell protocol /// /// Returns `None` if no shell was advertised. pub fn get_shell(&self) -> Option { self.with_inner(|extras| extras.get_shell()) } /// Create a new shell surface for this surface /// /// This helper abstracts over the `xdg_shell` protocol and its precursors (`zxdg_shell_v6` /// and `wl_shell`) for retro-compatibility. It'll attempt to use them in this order. /// /// You need to provide a closure that will process the events generated by the shell surface. /// /// *Panic* /// /// This function will panic if no supported shell was advertised by the compositor. pub fn create_shell_surface( &self, surface: &wl_surface::WlSurface, f: F, ) -> Box where F: FnMut(Event, DispatchData) + 'static, { let shell = self .get_shell() .expect("SCTK: trying to create a shell surface without any supported shell."); create_shell_surface(&shell, surface, f) } } smithay-client-toolkit-0.16.1/src/shell/wl.rs000064400000000000000000000071671046102023000172270ustar 00000000000000use wayland_client::{ protocol::{wl_output, wl_seat, wl_shell, wl_shell_surface, wl_surface}, DispatchData, }; use wayland_protocols::xdg_shell::client::xdg_toplevel; use super::{Event, ShellSurface}; #[derive(Debug)] pub(crate) struct Wl { shell_surface: wl_shell_surface::WlShellSurface, } impl Wl { pub(crate) fn create( surface: &wl_surface::WlSurface, shell: &wl_shell::WlShell, mut implementation: Impl, ) -> Wl where Impl: FnMut(Event, DispatchData) + 'static, { let shell_surface = shell.get_shell_surface(surface); shell_surface.quick_assign(move |shell_surface, event, ddata| match event { wl_shell_surface::Event::Ping { serial } => { shell_surface.pong(serial); } wl_shell_surface::Event::Configure { width, height, .. } => { use std::cmp::max; implementation( Event::Configure { new_size: Some((max(width, 1) as u32, max(height, 1) as u32)), states: Vec::new(), }, ddata, ); } wl_shell_surface::Event::PopupDone => { unreachable!(); } _ => unreachable!(), }); shell_surface.set_toplevel(); Wl { shell_surface: shell_surface.detach() } } } impl ShellSurface for Wl { fn resize(&self, seat: &wl_seat::WlSeat, serial: u32, edges: xdg_toplevel::ResizeEdge) { let edges = match edges { xdg_toplevel::ResizeEdge::None => wl_shell_surface::Resize::None, xdg_toplevel::ResizeEdge::Top => wl_shell_surface::Resize::Top, xdg_toplevel::ResizeEdge::Left => wl_shell_surface::Resize::Left, xdg_toplevel::ResizeEdge::Right => wl_shell_surface::Resize::Right, xdg_toplevel::ResizeEdge::Bottom => wl_shell_surface::Resize::Bottom, xdg_toplevel::ResizeEdge::TopLeft => wl_shell_surface::Resize::TopLeft, xdg_toplevel::ResizeEdge::TopRight => wl_shell_surface::Resize::TopRight, xdg_toplevel::ResizeEdge::BottomLeft => wl_shell_surface::Resize::BottomLeft, xdg_toplevel::ResizeEdge::BottomRight => wl_shell_surface::Resize::BottomRight, _ => unreachable!(), }; self.shell_surface.resize(seat, serial, edges); } fn move_(&self, seat: &wl_seat::WlSeat, serial: u32) { self.shell_surface._move(seat, serial); } fn set_title(&self, title: String) { self.shell_surface.set_title(title); } fn set_app_id(&self, app_id: String) { self.shell_surface.set_class(app_id); } fn set_fullscreen(&self, output: Option<&wl_output::WlOutput>) { self.shell_surface.set_fullscreen(wl_shell_surface::FullscreenMethod::Default, 0, output) } fn unset_fullscreen(&self) { self.shell_surface.set_toplevel(); } fn set_maximized(&self) { self.shell_surface.set_maximized(None); } fn unset_maximized(&self) { self.shell_surface.set_toplevel(); } fn show_window_menu(&self, _: &wl_seat::WlSeat, _: u32, _: i32, _: i32) { /* not available */ } fn set_minimized(&self) { /* not available */ } fn set_geometry(&self, _: i32, _: i32, _: i32, _: i32) { /* not available */ } fn set_min_size(&self, _: Option<(i32, i32)>) { /* not available */ } fn set_max_size(&self, _: Option<(i32, i32)>) { /* not available */ } fn get_xdg(&self) -> Option<&xdg_toplevel::XdgToplevel> { None } } smithay-client-toolkit-0.16.1/src/shell/xdg.rs000064400000000000000000000104601046102023000173550ustar 00000000000000use std::{cell::RefCell, convert::TryInto, rc::Rc}; use wayland_client::{ protocol::{wl_output, wl_seat, wl_surface}, DispatchData, }; use wayland_protocols::xdg_shell::client::{xdg_surface, xdg_toplevel, xdg_wm_base}; use super::{Event, ShellSurface}; #[derive(Debug)] pub(crate) struct Xdg { surface: xdg_surface::XdgSurface, toplevel: xdg_toplevel::XdgToplevel, } impl Xdg { pub(crate) fn create( surface: &wl_surface::WlSurface, shell: &xdg_wm_base::XdgWmBase, implementation: Impl, ) -> Xdg where Impl: FnMut(Event, DispatchData) + 'static, { let pending_configure = Rc::new(RefCell::new(None)); let pending_configure_2 = pending_configure.clone(); let implementation = Rc::new(RefCell::new(implementation)); let implementation_2 = implementation.clone(); let xdgs = shell.get_xdg_surface(surface); xdgs.quick_assign(move |xdgs, evt, ddata| match evt { xdg_surface::Event::Configure { serial } => { xdgs.ack_configure(serial); if let Some((new_size, states)) = pending_configure_2.borrow_mut().take() { (implementation_2.borrow_mut())(Event::Configure { new_size, states }, ddata); } } _ => unreachable!(), }); let toplevel = xdgs.get_toplevel(); toplevel.quick_assign(move |_, evt, ddata| { match evt { xdg_toplevel::Event::Close => (implementation.borrow_mut())(Event::Close, ddata), xdg_toplevel::Event::Configure { width, height, states } => { use std::cmp::max; let new_size = if width == 0 || height == 0 { // if either w or h is zero, then we get to choose our size None } else { Some((max(width, 1) as u32, max(height, 1) as u32)) }; let translated_states = states .chunks_exact(4) .map(|c| u32::from_ne_bytes(c.try_into().unwrap())) .flat_map(xdg_toplevel::State::from_raw) .collect::>(); *pending_configure.borrow_mut() = Some((new_size, translated_states)); } _ => unreachable!(), } }); surface.commit(); Xdg { surface: xdgs.detach(), toplevel: toplevel.detach() } } } impl ShellSurface for Xdg { fn resize(&self, seat: &wl_seat::WlSeat, serial: u32, edges: xdg_toplevel::ResizeEdge) { self.toplevel.resize(seat, serial, edges); } fn move_(&self, seat: &wl_seat::WlSeat, serial: u32) { self.toplevel._move(seat, serial); } fn set_title(&self, title: String) { self.toplevel.set_title(title); } fn set_app_id(&self, app_id: String) { self.toplevel.set_app_id(app_id); } fn set_fullscreen(&self, output: Option<&wl_output::WlOutput>) { self.toplevel.set_fullscreen(output) } fn unset_fullscreen(&self) { self.toplevel.unset_fullscreen(); } fn set_maximized(&self) { self.toplevel.set_maximized(); } fn unset_maximized(&self) { self.toplevel.unset_maximized(); } fn set_minimized(&self) { self.toplevel.set_minimized(); } fn show_window_menu(&self, seat: &wl_seat::WlSeat, serial: u32, x: i32, y: i32) { self.toplevel.show_window_menu(seat, serial, x, y); } fn set_geometry(&self, x: i32, y: i32, width: i32, height: i32) { self.surface.set_window_geometry(x, y, width, height); } fn set_min_size(&self, size: Option<(i32, i32)>) { if let Some((w, h)) = size { self.toplevel.set_min_size(w, h); } else { self.toplevel.set_min_size(0, 0); } } fn set_max_size(&self, size: Option<(i32, i32)>) { if let Some((w, h)) = size { self.toplevel.set_max_size(w, h); } else { self.toplevel.set_max_size(0, 0); } } fn get_xdg(&self) -> Option<&xdg_toplevel::XdgToplevel> { Some(&self.toplevel) } } impl Drop for Xdg { fn drop(&mut self) { self.toplevel.destroy(); self.surface.destroy(); } } smithay-client-toolkit-0.16.1/src/shell/zxdg.rs000064400000000000000000000106701046102023000175520ustar 00000000000000use std::{cell::RefCell, convert::TryInto, rc::Rc}; use wayland_client::{ protocol::{wl_output, wl_seat, wl_surface}, DispatchData, }; use wayland_protocols::{ unstable::xdg_shell::v6::client::{zxdg_shell_v6, zxdg_surface_v6, zxdg_toplevel_v6}, xdg_shell::client::xdg_toplevel, }; use super::{Event, ShellSurface}; #[derive(Debug)] pub(crate) struct Zxdg { surface: zxdg_surface_v6::ZxdgSurfaceV6, toplevel: zxdg_toplevel_v6::ZxdgToplevelV6, } impl Zxdg { pub(crate) fn create( surface: &wl_surface::WlSurface, shell: &zxdg_shell_v6::ZxdgShellV6, implementation: Impl, ) -> Zxdg where Impl: FnMut(Event, DispatchData) + 'static, { let pending_configure = Rc::new(RefCell::new(None)); let pending_configure_2 = pending_configure.clone(); let implementation = Rc::new(RefCell::new(implementation)); let implementation_2 = implementation.clone(); let xdgs = shell.get_xdg_surface(surface); xdgs.quick_assign(move |xdgs, evt, ddata| match evt { zxdg_surface_v6::Event::Configure { serial } => { xdgs.ack_configure(serial); if let Some((new_size, states)) = pending_configure_2.borrow_mut().take() { (implementation_2.borrow_mut())(Event::Configure { new_size, states }, ddata); } } _ => unreachable!(), }); let toplevel = xdgs.get_toplevel(); toplevel.quick_assign(move |_, evt, ddata| { match evt { zxdg_toplevel_v6::Event::Close => { (implementation.borrow_mut())(Event::Close, ddata) } zxdg_toplevel_v6::Event::Configure { width, height, states } => { use std::cmp::max; let new_size = if width == 0 || height == 0 { // if either w or h is zero, then we get to choose our size None } else { Some((max(width, 1) as u32, max(height, 1) as u32)) }; let translated_states = states .chunks_exact(4) .map(|c| u32::from_ne_bytes(c.try_into().unwrap())) .flat_map(xdg_toplevel::State::from_raw) .collect::>(); *pending_configure.borrow_mut() = Some((new_size, translated_states)); } _ => unreachable!(), } }); surface.commit(); Zxdg { surface: xdgs.detach(), toplevel: toplevel.detach() } } } impl ShellSurface for Zxdg { fn resize(&self, seat: &wl_seat::WlSeat, serial: u32, edges: xdg_toplevel::ResizeEdge) { self.toplevel.resize(seat, serial, edges as u32); } fn move_(&self, seat: &wl_seat::WlSeat, serial: u32) { self.toplevel._move(seat, serial); } fn set_title(&self, title: String) { self.toplevel.set_title(title); } fn set_app_id(&self, app_id: String) { self.toplevel.set_app_id(app_id); } fn set_fullscreen(&self, output: Option<&wl_output::WlOutput>) { self.toplevel.set_fullscreen(output) } fn unset_fullscreen(&self) { self.toplevel.unset_fullscreen(); } fn set_maximized(&self) { self.toplevel.set_maximized(); } fn unset_maximized(&self) { self.toplevel.unset_maximized(); } fn set_minimized(&self) { self.toplevel.set_minimized(); } fn show_window_menu(&self, seat: &wl_seat::WlSeat, serial: u32, x: i32, y: i32) { self.toplevel.show_window_menu(seat, serial, x, y); } fn set_geometry(&self, x: i32, y: i32, width: i32, height: i32) { self.surface.set_window_geometry(x, y, width, height); } fn set_min_size(&self, size: Option<(i32, i32)>) { if let Some((w, h)) = size { self.toplevel.set_min_size(w, h); } else { self.toplevel.set_min_size(0, 0); } } fn set_max_size(&self, size: Option<(i32, i32)>) { if let Some((w, h)) = size { self.toplevel.set_max_size(w, h); } else { self.toplevel.set_max_size(0, 0); } } fn get_xdg(&self) -> Option<&xdg_toplevel::XdgToplevel> { None } } impl Drop for Zxdg { fn drop(&mut self) { self.toplevel.destroy(); self.surface.destroy(); } } smithay-client-toolkit-0.16.1/src/shm/mempool.rs000064400000000000000000000455271046102023000177370ustar 00000000000000use std::{ cell::RefCell, ffi::CStr, fmt, fs::File, io, os::unix::io::{FromRawFd, RawFd}, rc::Rc, time::SystemTime, time::UNIX_EPOCH, }; #[cfg(target_os = "linux")] use nix::sys::memfd; use nix::{ errno::Errno, fcntl, sys::{mman, stat}, unistd, }; use memmap2::MmapMut; use wayland_client::{ protocol::{wl_buffer, wl_shm, wl_shm_pool}, Attached, Main, }; /// A Double memory pool, for convenient double-buffering /// /// This type wraps two internal memory pool, and can be /// use for conveniently implementing double-buffering in your /// apps. /// /// DoubleMemPool requires a implementation that is called when /// one of the two internal memory pools becomes free after None /// was returned from the `pool()` method. #[derive(Debug)] pub struct DoubleMemPool { pool1: MemPool, pool2: MemPool, free: Rc>, } impl DoubleMemPool { /// Create a double memory pool pub fn new(shm: Attached, callback: F) -> io::Result where F: FnMut(wayland_client::DispatchData) + 'static, { let free = Rc::new(RefCell::new(true)); let callback = Rc::new(RefCell::new(callback)); let my_free = free.clone(); let my_callback = callback.clone(); let pool1 = MemPool::new(shm.clone(), move |ddata| { let signal = { let mut my_free = my_free.borrow_mut(); if !*my_free { *my_free = true; true } else { false } }; if signal { (my_callback.borrow_mut())(ddata); } })?; let my_free = free.clone(); let pool2 = MemPool::new(shm, move |ddata| { let signal = { let mut my_free = my_free.borrow_mut(); if !*my_free { *my_free = true; true } else { false } }; if signal { (callback.borrow_mut())(ddata); } })?; Ok(DoubleMemPool { pool1, pool2, free }) } /// This method checks both its internal memory pools and returns /// one if that pool does not contain any buffers that are still in use /// by the server. If both the memory pools contain buffers that are currently /// in use by the server None will be returned. pub fn pool(&mut self) -> Option<&mut MemPool> { if !self.pool1.is_used() { Some(&mut self.pool1) } else if !self.pool2.is_used() { Some(&mut self.pool2) } else { *self.free.borrow_mut() = false; None } } } #[derive(Debug)] struct Inner { file: File, len: usize, pool: Main, mmap: MmapMut, } impl Inner { fn new(shm: Attached) -> io::Result { let mem_fd = create_shm_fd()?; let mem_file = unsafe { File::from_raw_fd(mem_fd) }; mem_file.set_len(4096)?; let pool = shm.create_pool(mem_fd, 4096); let mmap = unsafe { MmapMut::map_mut(&mem_file).unwrap() }; Ok(Inner { file: mem_file, len: 4096, pool, mmap }) } fn resize(&mut self, newsize: usize) -> io::Result<()> { if newsize > self.len { self.file.set_len(newsize as u64)?; self.pool.resize(newsize as i32); self.len = newsize; self.mmap = unsafe { MmapMut::map_mut(&self.file).unwrap() }; } Ok(()) } } impl Drop for Inner { fn drop(&mut self) { self.pool.destroy(); } } /// A wrapper handling an SHM memory pool backed by a shared memory file /// /// This wrapper handles for you the creation of the shared memory file and its synchronization /// with the protocol. /// /// Mempool internally tracks the release of the buffers by the compositor. As such, creating a buffer /// that is not commited to a surface (and then never released by the server) would cause the Mempool /// to be stuck believing it is still in use. /// /// Mempool will also handle the destruction of buffers and as such the `destroy()` method should not /// be used on buffers created from Mempool. /// /// Overwriting the contents of the memory pool before it is completely freed may cause graphical /// glitches due to the possible corruption of data while the compositor is reading it. /// /// Mempool requires a callback that will be called when the pool becomes free, this /// happens when all the pools buffers are released by the server. pub struct MemPool { inner: Inner, buffer_count: Rc>, callback: Rc>, } impl MemPool { /// Create a new memory pool associated with given shm pub fn new(shm: Attached, callback: F) -> io::Result where F: FnMut(wayland_client::DispatchData) + 'static, { Ok(MemPool { inner: Inner::new(shm)?, buffer_count: Rc::new(RefCell::new(0)), callback: Rc::new(RefCell::new(callback)) as Rc>, }) } /// Resize the memory pool /// /// This affect the size as it is seen by the wayland server. Even /// if you extend the temporary file size by writing to it, you need to /// call this method otherwise the server won't see the new size. /// /// Memory pools can only be extented, as such this method will do nothing /// if the requested new size is smaller than the current size. /// /// This method allows you to ensure the underlying pool is large enough to /// hold what you want to write to it. pub fn resize(&mut self, newsize: usize) -> io::Result<()> { self.inner.resize(newsize) } /// Create a new buffer to this pool /// /// The parameters are: /// /// - `offset`: the offset (in bytes) from the beginning of the pool at which this /// buffer starts /// - `width`: the width of this buffer (in pixels) /// - `height`: the height of this buffer (in pixels) /// - `stride`: distance (in bytes) between the beginning of a row and the next one /// - `format`: the encoding format of the pixels. Using a format that was not /// advertised to the `wl_shm` global by the server is a protocol error and will /// terminate your connection pub fn buffer( &self, offset: i32, width: i32, height: i32, stride: i32, format: wl_shm::Format, ) -> wl_buffer::WlBuffer { *self.buffer_count.borrow_mut() += 1; let my_buffer_count = self.buffer_count.clone(); let my_callback = self.callback.clone(); let buffer = self.inner.pool.create_buffer(offset, width, height, stride, format); buffer.quick_assign(move |buffer, event, dispatch_data| match event { wl_buffer::Event::Release => { buffer.destroy(); let new_count = { // borrow the buffer_count for as short as possible, in case // the user wants to create a new buffer from the callback let mut my_buffer_count = my_buffer_count.borrow_mut(); *my_buffer_count -= 1; *my_buffer_count }; if new_count == 0 { (my_callback.borrow_mut())(dispatch_data); } } _ => unreachable!(), }); (*buffer).clone().detach() } /// Uses the memmap2 crate to map the underlying shared memory file pub fn mmap(&mut self) -> &mut MmapMut { &mut self.inner.mmap } /// Returns true if the pool contains buffers that are currently in use by the server pub fn is_used(&self) -> bool { *self.buffer_count.borrow() != 0 } } impl fmt::Debug for MemPool { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("MemPool") .field("inner", &self.inner) .field("buffer_count", &self.buffer_count) .field("callback", &"Fn() -> { ... }") .finish() } } impl io::Write for MemPool { fn write(&mut self, buf: &[u8]) -> io::Result { io::Write::write(&mut self.inner.file, buf) } fn flush(&mut self) -> io::Result<()> { io::Write::flush(&mut self.inner.file) } } impl io::Seek for MemPool { fn seek(&mut self, pos: io::SeekFrom) -> io::Result { io::Seek::seek(&mut self.inner.file, pos) } } /// A wrapper handling an SHM memory pool backed by a shared memory file /// /// This wrapper handles the creation of the shared memory file, its synchronization with the /// protocol, and the allocation of buffers within the pool. /// /// AutoMemPool internally tracks the release of the buffers by the compositor. As such, creating a /// buffer that is not committed to a surface (and then never released by the server) would result /// in that memory being unavailable for the rest of the pool's lifetime. /// /// AutoMemPool will also handle the destruction of buffers; do not call destroy() on the returned /// WlBuffer objects. /// /// The default alignment of returned buffers is 16 bytes; this can be changed by using the /// explicit with_min_align constructor. #[derive(Debug)] pub struct AutoMemPool { inner: Inner, align: usize, free_list: Rc>>, } impl AutoMemPool { /// Create a new memory pool associated with the given shm pub fn new(shm: Attached) -> io::Result { Self::with_min_align(shm, 16) } /// Create a new memory pool associated with the given shm. /// /// All buffers will be aligned to at least the value of (align), which must be a power of two /// not greater than 4096. pub fn with_min_align(shm: Attached, align: usize) -> io::Result { assert!(align.is_power_of_two()); assert!(align <= 4096); let inner = Inner::new(shm)?; let free_list = Rc::new(RefCell::new(vec![(0, inner.len)])); Ok(AutoMemPool { inner, align, free_list }) } /// Resize the memory pool /// /// This is normally done automatically, but can be used to avoid multiple resizes. pub fn resize(&mut self, new_size: usize) -> io::Result<()> { let old_size = self.inner.len; if old_size >= new_size { return Ok(()); } self.inner.resize(new_size)?; // add the new memory to the freelist let mut free = self.free_list.borrow_mut(); if let Some((off, len)) = free.last_mut() { if *off + *len == old_size { *len += new_size - old_size; return Ok(()); } } free.push((old_size, new_size - old_size)); Ok(()) } fn alloc(&mut self, size: usize) -> io::Result { let mut free = self.free_list.borrow_mut(); for (offset, len) in free.iter_mut() { if *len >= size { let rv = *offset; *len -= size; *offset += size; return Ok(rv); } } let mut rv = self.inner.len; let mut pop_tail = false; if let Some((start, len)) = free.last() { if start + len == self.inner.len { rv -= len; pop_tail = true; } } // resize like Vec::reserve, always at least doubling let target = std::cmp::max(rv + size, self.inner.len * 2); self.inner.resize(target)?; // adjust the end of the freelist here if pop_tail { free.pop(); } if target > rv + size { free.push((rv + size, target - rv - size)); } Ok(rv) } fn free(free_list: &RefCell>, mut offset: usize, mut len: usize) { let mut free = free_list.borrow_mut(); let mut nf = Vec::with_capacity(free.len() + 1); for &(ioff, ilen) in free.iter() { if ioff + ilen == offset { offset = ioff; len += ilen; continue; } if ioff == offset + len { len += ilen; continue; } if ioff > offset + len && len != 0 { nf.push((offset, len)); len = 0; } if ilen != 0 { nf.push((ioff, ilen)); } } if len != 0 { nf.push((offset, len)); } *free = nf; } /// Create a new buffer in this pool /// /// The parameters are: /// /// - `width`: the width of this buffer (in pixels) /// - `height`: the height of this buffer (in pixels) /// - `stride`: distance (in bytes) between the beginning of a row and the next one /// - `format`: the encoding format of the pixels. Using a format that was not /// advertised to the `wl_shm` global by the server is a protocol error and will /// terminate your connection pub fn buffer( &mut self, width: i32, height: i32, stride: i32, format: wl_shm::Format, ) -> io::Result<(&mut [u8], wl_buffer::WlBuffer)> { let len = (height as usize) * (stride as usize); let alloc_len = (len + self.align - 1) & !(self.align - 1); let offset = self.alloc(alloc_len)?; let offset_i = offset as i32; let buffer = self.inner.pool.create_buffer(offset_i, width, height, stride, format); let free_list = self.free_list.clone(); buffer.quick_assign(move |buffer, event, _| match event { wl_buffer::Event::Release => { buffer.destroy(); Self::free(&free_list, offset, alloc_len); } _ => unreachable!(), }); Ok((&mut self.inner.mmap[offset..][..len], buffer.detach())) } /// Try drawing with the given closure /// /// This is identical to buffer(), but will only actually create the WlBuffer if the draw /// closure succeeds. Otherwise, the buffer is freed immediately instead of waiting for a /// Release event that will never be sent if the WlBuffer is not used. pub fn try_draw( &mut self, width: i32, height: i32, stride: i32, format: wl_shm::Format, draw: F, ) -> Result where F: FnOnce(&mut [u8]) -> Result<(), E>, E: From, { let len = (height as usize) * (stride as usize); let alloc_len = (len + self.align - 1) & !(self.align - 1); let offset = self.alloc(alloc_len)?; let offset_i = offset as i32; if let Err(e) = draw(&mut self.inner.mmap[offset..][..len]) { Self::free(&self.free_list, offset, alloc_len); return Err(e); } let buffer = self.inner.pool.create_buffer(offset_i, width, height, stride, format); let free_list = self.free_list.clone(); buffer.quick_assign(move |buffer, event, _| match event { wl_buffer::Event::Release => { buffer.destroy(); Self::free(&free_list, offset, alloc_len); } _ => unreachable!(), }); Ok(buffer.detach()) } } fn create_shm_fd() -> io::Result { // Only try memfd on linux #[cfg(target_os = "linux")] loop { match memfd::memfd_create( CStr::from_bytes_with_nul(b"smithay-client-toolkit\0").unwrap(), memfd::MemFdCreateFlag::MFD_CLOEXEC | memfd::MemFdCreateFlag::MFD_ALLOW_SEALING, ) { Ok(fd) => { // this is only an optimization, so ignore errors let _ = fcntl::fcntl( fd, fcntl::F_ADD_SEALS( fcntl::SealFlag::F_SEAL_SHRINK | fcntl::SealFlag::F_SEAL_SEAL, ), ); return Ok(fd); } Err(Errno::EINTR) => continue, Err(Errno::ENOSYS) => break, Err(errno) => return Err(errno.into()), } } // Fallback to using shm_open let sys_time = SystemTime::now(); let mut mem_file_handle = format!( "/smithay-client-toolkit-{}", sys_time.duration_since(UNIX_EPOCH).unwrap().subsec_nanos() ); loop { match mman::shm_open( mem_file_handle.as_str(), fcntl::OFlag::O_CREAT | fcntl::OFlag::O_EXCL | fcntl::OFlag::O_RDWR | fcntl::OFlag::O_CLOEXEC, stat::Mode::S_IRUSR | stat::Mode::S_IWUSR, ) { Ok(fd) => match mman::shm_unlink(mem_file_handle.as_str()) { Ok(_) => return Ok(fd), Err(errno) => match unistd::close(fd) { Ok(_) => return Err(errno.into()), Err(errno) => return Err(errno.into()), }, }, Err(Errno::EEXIST) => { // If a file with that handle exists then change the handle mem_file_handle = format!( "/smithay-client-toolkit-{}", sys_time.duration_since(UNIX_EPOCH).unwrap().subsec_nanos() ); continue; } Err(Errno::EINTR) => continue, Err(errno) => return Err(errno.into()), } } } impl crate::environment::Environment where E: crate::environment::GlobalHandler, { /// Create a simple memory pool /// /// This memory pool track the usage of the buffers created from it, /// and invokes your callback when the compositor has finished using /// all of them. pub fn create_simple_pool(&self, callback: F) -> io::Result where F: FnMut(wayland_client::DispatchData) + 'static, { MemPool::new(self.require_global::(), callback) } /// Create a double memory pool /// /// This can be used for double-buffered drawing. The memory pool /// is backed by two different SHM segments, which are used in alternance. /// /// The provided callback is triggered when one of the pools becomes unused again /// after you tried to draw while both where in use. pub fn create_double_pool(&self, callback: F) -> io::Result where F: FnMut(wayland_client::DispatchData) + 'static, { DoubleMemPool::new(self.require_global::(), callback) } /// Create an automatic memory pool /// /// This pool will allocate more memory as needed in order to satisfy buffer requests, and will /// return memory to the pool when the compositor has finished using the memory. pub fn create_auto_pool(&self) -> io::Result { AutoMemPool::new(self.require_global::()) } } smithay-client-toolkit-0.16.1/src/shm/mod.rs000064400000000000000000000043631046102023000170370ustar 00000000000000//! Various small utilities helping you to write clients use std::{cell::RefCell, rc::Rc}; use wayland_client::{ protocol::{wl_registry, wl_shm}, Attached, DispatchData, }; mod mempool; pub use self::mempool::{AutoMemPool, DoubleMemPool, MemPool}; pub use wl_shm::Format; /// A handler for the `wl_shm` global /// /// This handler is automatically included in the /// [`default_environment!`](../macro.default_environment.html). #[derive(Debug)] pub struct ShmHandler { shm: Option>, formats: Rc>>, } impl ShmHandler { /// Create a new ShmHandler pub fn new() -> ShmHandler { ShmHandler { shm: None, formats: Rc::new(RefCell::new(vec![])) } } } impl crate::environment::GlobalHandler for ShmHandler { fn created( &mut self, registry: Attached, id: u32, _version: u32, _: DispatchData, ) { // only shm verison 1 is supported let shm = registry.bind::(1, id); let my_formats = self.formats.clone(); shm.quick_assign(move |_, event, _| match event { wl_shm::Event::Format { format } => { my_formats.borrow_mut().push(format); } _ => unreachable!(), }); self.shm = Some((*shm).clone()); } fn get(&self) -> Option> { self.shm.clone() } } /// An interface trait to forward the shm handler capability /// /// You need to implement this trait for you environment struct, by /// delegating it to its `ShmHandler` field in order to get the /// associated methods on your [`Environment`](../environment/struct.environment.html). pub trait ShmHandling { /// Access the list of SHM formats supported by the compositor fn shm_formats(&self) -> Vec; } impl ShmHandling for ShmHandler { fn shm_formats(&self) -> Vec { self.formats.borrow().clone() } } impl crate::environment::Environment where E: ShmHandling, { /// Access the list of SHM formats supported by the compositor pub fn shm_formats(&self) -> Vec { self.with_inner(|inner| inner.shm_formats()) } } smithay-client-toolkit-0.16.1/src/surface.rs000064400000000000000000000155221046102023000171200ustar 00000000000000use std::{cell::RefCell, rc::Rc, sync::Mutex}; use wayland_client::{ protocol::{wl_compositor, wl_output, wl_surface}, Attached, DispatchData, Main, }; use crate::output::{add_output_listener, with_output_info, OutputListener}; pub(crate) struct SurfaceUserData { scale_factor: i32, outputs: Vec<(wl_output::WlOutput, i32, OutputListener)>, } impl SurfaceUserData { fn new() -> Self { SurfaceUserData { scale_factor: 1, outputs: Vec::new() } } pub(crate) fn enter( &mut self, output: wl_output::WlOutput, surface: wl_surface::WlSurface, callback: &Option>>, ) where F: FnMut(i32, wl_surface::WlSurface, DispatchData) + 'static, { let output_scale = with_output_info(&output, |info| info.scale_factor).unwrap_or(1); let my_surface = surface.clone(); // Use a UserData to safely share the callback with the other thread let my_callback = wayland_client::UserData::new(); if let Some(ref cb) = callback { my_callback.set(|| cb.clone()); } let listener = add_output_listener(&output, move |output, info, ddata| { let mut user_data = my_surface .as_ref() .user_data() .get::>() .unwrap() .lock() .unwrap(); // update the scale factor of the relevant output for (ref o, ref mut factor, _) in user_data.outputs.iter_mut() { if o.as_ref().equals(output.as_ref()) { if info.obsolete { // an output that no longer exists is marked by a scale factor of -1 *factor = -1; } else { *factor = info.scale_factor; } break; } } // recompute the scale factor with the new info let callback = my_callback.get::>>().cloned(); let old_scale_factor = user_data.scale_factor; let new_scale_factor = user_data.recompute_scale_factor(); drop(user_data); if let Some(ref cb) = callback { if old_scale_factor != new_scale_factor { (cb.borrow_mut())(new_scale_factor, surface.clone(), ddata); } } }); self.outputs.push((output, output_scale, listener)); } pub(crate) fn leave(&mut self, output: &wl_output::WlOutput) { self.outputs.retain(|(ref output2, _, _)| !output.as_ref().equals(output2.as_ref())); } fn recompute_scale_factor(&mut self) -> i32 { let mut new_scale_factor = 1; self.outputs.retain(|&(_, output_scale, _)| { if output_scale > 0 { new_scale_factor = ::std::cmp::max(new_scale_factor, output_scale); true } else { // cleanup obsolete output false } }); if self.outputs.is_empty() { // don't update the scale factor if we are not displayed on any output return self.scale_factor; } self.scale_factor = new_scale_factor; new_scale_factor } } pub(crate) fn setup_surface( surface: Main, callback: Option, ) -> Attached where F: FnMut(i32, wl_surface::WlSurface, DispatchData) + 'static, { let callback = callback.map(|c| Rc::new(RefCell::new(c))); surface.quick_assign(move |surface, event, ddata| { let mut user_data = surface.as_ref().user_data().get::>().unwrap().lock().unwrap(); match event { wl_surface::Event::Enter { output } => { // Passing the callback to be added to output listener user_data.enter(output, surface.detach(), &callback); } wl_surface::Event::Leave { output } => { user_data.leave(&output); } _ => unreachable!(), }; let old_scale_factor = user_data.scale_factor; let new_scale_factor = user_data.recompute_scale_factor(); drop(user_data); if let Some(ref cb) = callback { if old_scale_factor != new_scale_factor { (cb.borrow_mut())(new_scale_factor, surface.detach(), ddata); } } }); surface.as_ref().user_data().set_threadsafe(|| Mutex::new(SurfaceUserData::new())); surface.into() } impl> crate::environment::Environment { /// Create a DPI-aware surface /// /// This surface will track the outputs it is being displayed on, and compute the /// optimal scale factor for these. You can access them using /// [`get_surface_scale_factor`](../fn.get_surface_scale_factor.html) and /// [`get_surface_outputs`](../fn.get_surface_outputs.html). pub fn create_surface(&self) -> Attached { let compositor = self.require_global::(); setup_surface(compositor.create_surface(), None::) } /// Create a DPI-aware surface with callbacks /// /// This method is like `create_surface`, but the provided callback will also be /// notified whenever the scale factor of this surface change, if you don't want to have to /// periodically check it. pub fn create_surface_with_scale_callback< F: FnMut(i32, wl_surface::WlSurface, DispatchData) + 'static, >( &self, f: F, ) -> Attached { let compositor = self.require_global::(); setup_surface(compositor.create_surface(), Some(f)) } } /// Returns the current suggested scale factor of a surface. /// /// Panics if the surface was not created using `Environment::create_surface` or /// `Environment::create_surface_with_dpi_callback`. pub fn get_surface_scale_factor(surface: &wl_surface::WlSurface) -> i32 { surface .as_ref() .user_data() .get::>() .expect("SCTK: Surface was not created by SCTK.") .lock() .unwrap() .scale_factor } /// Returns a list of outputs the surface is displayed on. /// /// Panics if the surface was not created using `Environment::create_surface` or /// `Environment::create_surface_with_dpi_callback`. pub fn get_surface_outputs(surface: &wl_surface::WlSurface) -> Vec { surface .as_ref() .user_data() .get::>() .expect("SCTK: Surface was not created by SCTK.") .lock() .unwrap() .outputs .iter() .map(|(ref output, _, _)| output.clone()) .collect() } smithay-client-toolkit-0.16.1/src/window/fallback_frame.rs000064400000000000000000001031751046102023000217120ustar 00000000000000use std::cell::RefCell; use std::fmt; use std::rc::Rc; use wayland_client::protocol::{ wl_compositor, wl_pointer, wl_seat, wl_shm, wl_subcompositor, wl_subsurface, wl_surface, }; use wayland_client::{Attached, DispatchData}; use log::error; use super::{ButtonState, Frame, FrameRequest, State, WindowState}; use crate::seat::pointer::{ThemeManager, ThemeSpec, ThemedPointer}; use crate::shm::AutoMemPool; /* * Drawing theme definitions */ const BORDER_SIZE: u32 = 4; const HEADER_SIZE: u32 = 24; const BTN_ICON_COLOR: u32 = 0xFF1E1E1E; const BTN_HOVER_BG: u32 = 0xFFA8A8A8; const PRIMARY_COLOR_ACTIVE: u32 = 0xFFE6E6E6; const PRIMARY_COLOR_INACTIVE: u32 = 0xFFDCDCDC; /* * Utilities */ const HEAD: usize = 0; const TOP: usize = 1; const BOTTOM: usize = 2; const LEFT: usize = 3; const RIGHT: usize = 4; #[derive(Debug, Copy, Clone, PartialEq, Eq)] enum Location { None, Head, Top, TopRight, Right, BottomRight, Bottom, BottomLeft, Left, TopLeft, Button(UIButton), } #[derive(Debug, Copy, Clone, PartialEq, Eq)] enum UIButton { Minimize, Maximize, Close, } #[derive(Debug)] struct Part { surface: wl_surface::WlSurface, subsurface: wl_subsurface::WlSubsurface, } impl Part { fn new( parent: &wl_surface::WlSurface, compositor: &Attached, subcompositor: &Attached, inner: Option>>, ) -> Part { let surface = if let Some(inner) = inner { crate::surface::setup_surface( compositor.create_surface(), Some(move |dpi, surface: wl_surface::WlSurface, ddata: DispatchData| { surface.set_buffer_scale(dpi); surface.commit(); (inner.borrow_mut().implem)(FrameRequest::Refresh, 0, ddata); }), ) } else { crate::surface::setup_surface( compositor.create_surface(), Some(move |dpi, surface: wl_surface::WlSurface, _ddata: DispatchData| { surface.set_buffer_scale(dpi); surface.commit(); }), ) }; let surface = surface.detach(); let subsurface = subcompositor.get_subsurface(&surface, parent); Part { surface, subsurface: subsurface.detach() } } } impl Drop for Part { fn drop(&mut self) { self.subsurface.destroy(); self.surface.destroy(); } } struct PointerUserData { location: Location, position: (f64, f64), seat: wl_seat::WlSeat, } /* * The core frame */ struct Inner { parts: Vec, size: (u32, u32), resizable: bool, theme_over_surface: bool, implem: Box, maximized: bool, fullscreened: bool, } impl Inner { fn find_surface(&self, surface: &wl_surface::WlSurface) -> Location { if self.parts.is_empty() { return Location::None; } if surface.as_ref().equals(self.parts[HEAD].surface.as_ref()) { Location::Head } else if surface.as_ref().equals(self.parts[TOP].surface.as_ref()) { Location::Top } else if surface.as_ref().equals(self.parts[BOTTOM].surface.as_ref()) { Location::Bottom } else if surface.as_ref().equals(self.parts[LEFT].surface.as_ref()) { Location::Left } else if surface.as_ref().equals(self.parts[RIGHT].surface.as_ref()) { Location::Right } else { Location::None } } } impl fmt::Debug for Inner { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Inner") .field("parts", &self.parts) .field("size", &self.size) .field("resizable", &self.resizable) .field("theme_over_surface", &self.theme_over_surface) .field("implem", &"FnMut(FrameRequest, u32, DispatchData) -> { ... }") .field("maximized", &self.maximized) .field("fullscreened", &self.fullscreened) .finish() } } fn precise_location(old: Location, width: u32, x: f64, y: f64) -> Location { match old { Location::Head | Location::Button(_) => find_button(x, y, width), Location::Top | Location::TopLeft | Location::TopRight => { if x <= f64::from(BORDER_SIZE) { Location::TopLeft } else if x >= f64::from(width + BORDER_SIZE) { Location::TopRight } else { Location::Top } } Location::Bottom | Location::BottomLeft | Location::BottomRight => { if x <= f64::from(BORDER_SIZE) { Location::BottomLeft } else if x >= f64::from(width + BORDER_SIZE) { Location::BottomRight } else { Location::Bottom } } other => other, } } fn find_button(x: f64, y: f64, w: u32) -> Location { if (w >= HEADER_SIZE) && (x >= f64::from(w - HEADER_SIZE)) && (x <= f64::from(w)) && (y <= f64::from(HEADER_SIZE)) && (y >= f64::from(0)) { // first button Location::Button(UIButton::Close) } else if (w >= 2 * HEADER_SIZE) && (x >= f64::from(w - 2 * HEADER_SIZE)) && (x <= f64::from(w - HEADER_SIZE)) && (y <= f64::from(HEADER_SIZE)) && (y >= f64::from(0)) { // second button Location::Button(UIButton::Maximize) } else if (w >= 3 * HEADER_SIZE) && (x >= f64::from(w - 3 * HEADER_SIZE)) && (x <= f64::from(w - 2 * HEADER_SIZE)) && (y <= f64::from(HEADER_SIZE)) && (y >= f64::from(0)) { // third button Location::Button(UIButton::Minimize) } else { Location::Head } } /// A simple set of decorations that can be used as a fallback /// /// This class drawn some simple and minimalistic decorations around /// a window so that it remains possible to interact with the window /// even when server-side decorations are not available. /// /// `FallbackFrame` is hiding its `ClientSide` decorations /// in a `Fullscreen` state and brings them back if those are /// visible when unsetting `Fullscreen` state. #[derive(Debug)] pub struct FallbackFrame { base_surface: wl_surface::WlSurface, compositor: Attached, subcompositor: Attached, inner: Rc>, pool: AutoMemPool, active: WindowState, hidden: bool, pointers: Vec, themer: ThemeManager, surface_version: u32, } impl Frame for FallbackFrame { type Error = ::std::io::Error; type Config = (); fn init( base_surface: &wl_surface::WlSurface, compositor: &Attached, subcompositor: &Attached, shm: &Attached, theme_manager: Option, implementation: Box, ) -> Result { let (themer, theme_over_surface) = if let Some(theme_manager) = theme_manager { (theme_manager, false) } else { (ThemeManager::init(ThemeSpec::System, compositor.clone(), shm.clone()), true) }; let inner = Rc::new(RefCell::new(Inner { parts: vec![], size: (1, 1), resizable: true, implem: implementation, theme_over_surface, maximized: false, fullscreened: false, })); let pool = AutoMemPool::new(shm.clone())?; Ok(FallbackFrame { base_surface: base_surface.clone(), compositor: compositor.clone(), subcompositor: subcompositor.clone(), inner, pool, active: WindowState::Inactive, hidden: true, pointers: Vec::new(), themer, surface_version: compositor.as_ref().version(), }) } fn new_seat(&mut self, seat: &Attached) { use self::wl_pointer::Event; let inner = self.inner.clone(); let pointer = self.themer.theme_pointer_with_impl( seat, move |event, pointer: ThemedPointer, ddata: DispatchData| { let data: &RefCell = pointer.as_ref().user_data().get().unwrap(); let mut data = data.borrow_mut(); let mut inner = inner.borrow_mut(); match event { Event::Enter { serial, surface, surface_x, surface_y } => { data.location = precise_location( inner.find_surface(&surface), inner.size.0, surface_x, surface_y, ); data.position = (surface_x, surface_y); change_pointer(&pointer, &inner, data.location, Some(serial)) } Event::Leave { serial, .. } => { data.location = Location::None; change_pointer(&pointer, &inner, data.location, Some(serial)); (inner.implem)(FrameRequest::Refresh, 0, ddata); } Event::Motion { surface_x, surface_y, .. } => { data.position = (surface_x, surface_y); let newpos = precise_location(data.location, inner.size.0, surface_x, surface_y); if newpos != data.location { match (newpos, data.location) { (Location::Button(_), _) | (_, Location::Button(_)) => { // pointer movement involves a button, request refresh (inner.implem)(FrameRequest::Refresh, 0, ddata); } _ => (), } // we changed of part of the decoration, pointer image // may need to be changed data.location = newpos; change_pointer(&pointer, &inner, data.location, None) } } Event::Button { serial, button, state, .. } => { if state == wl_pointer::ButtonState::Pressed { let request = match button { // Left mouse button. 0x110 => request_for_location_on_lmb( &data, inner.maximized, inner.resizable, ), // Right mouse button. 0x111 => request_for_location_on_rmb(&data), _ => None, }; if let Some(request) = request { (inner.implem)(request, serial, ddata); } } } _ => {} } }, ); pointer.as_ref().user_data().set(|| { RefCell::new(PointerUserData { location: Location::None, position: (0.0, 0.0), seat: seat.detach(), }) }); self.pointers.push(pointer); } fn remove_seat(&mut self, seat: &wl_seat::WlSeat) { self.pointers.retain(|pointer| { let user_data = pointer.as_ref().user_data().get::>().unwrap(); let guard = user_data.borrow_mut(); if &guard.seat == seat { pointer.release(); false } else { true } }); } fn set_states(&mut self, states: &[State]) -> bool { let mut inner = self.inner.borrow_mut(); let mut need_redraw = false; // Process active. let new_active = if states.contains(&State::Activated) { WindowState::Active } else { WindowState::Inactive }; need_redraw |= new_active != self.active; self.active = new_active; // Process maximized. let new_maximized = states.contains(&State::Maximized); need_redraw |= new_maximized != inner.maximized; inner.maximized = new_maximized; // Process fullscreened. let new_fullscreened = states.contains(&State::Fullscreen); need_redraw |= new_fullscreened != inner.fullscreened; inner.fullscreened = new_fullscreened; need_redraw } fn set_hidden(&mut self, hidden: bool) { self.hidden = hidden; let mut inner = self.inner.borrow_mut(); if !self.hidden { if inner.parts.is_empty() { inner.parts = vec![ Part::new( &self.base_surface, &self.compositor, &self.subcompositor, Some(Rc::clone(&self.inner)), ), Part::new(&self.base_surface, &self.compositor, &self.subcompositor, None), Part::new(&self.base_surface, &self.compositor, &self.subcompositor, None), Part::new(&self.base_surface, &self.compositor, &self.subcompositor, None), Part::new(&self.base_surface, &self.compositor, &self.subcompositor, None), ]; } } else { inner.parts.clear(); } } fn set_resizable(&mut self, resizable: bool) { self.inner.borrow_mut().resizable = resizable; } fn resize(&mut self, newsize: (u32, u32)) { self.inner.borrow_mut().size = newsize; } fn redraw(&mut self) { let inner = self.inner.borrow_mut(); // Don't draw borders if the frame explicitly hidden or fullscreened. if self.hidden || inner.fullscreened { // Don't draw the borders. for p in inner.parts.iter() { p.surface.attach(None, 0, 0); p.surface.commit(); } return; } // `parts` can't be empty here, since the initial state for `self.hidden` is true, and // they will be created once `self.hidden` will become `false`. let parts = &inner.parts; let scales: Vec = parts .iter() .map(|part| crate::surface::get_surface_scale_factor(&part.surface) as u32) .collect(); let (width, height) = inner.size; // Use header scale for all the thing. let header_scale = scales[HEAD]; let scaled_header_height = HEADER_SIZE * header_scale; let scaled_header_width = width * header_scale; { // Create the buffers and draw let color = if self.active == WindowState::Active { PRIMARY_COLOR_ACTIVE.to_ne_bytes() } else { PRIMARY_COLOR_INACTIVE.to_ne_bytes() }; // -> head-subsurface if let Ok((canvas, buffer)) = self.pool.buffer( scaled_header_width as i32, scaled_header_height as i32, 4 * scaled_header_width as i32, wl_shm::Format::Argb8888, ) { for pixel in canvas.chunks_exact_mut(4) { pixel[0] = color[0]; pixel[1] = color[1]; pixel[2] = color[2]; pixel[3] = color[3]; } draw_buttons( canvas, width, header_scale, inner.resizable, self.active, &self .pointers .iter() .flat_map(|p| { if p.as_ref().is_alive() { let data: &RefCell = p.as_ref().user_data().get().unwrap(); Some(data.borrow().location) } else { None } }) .collect::>(), ); parts[HEAD].subsurface.set_position(0, -(HEADER_SIZE as i32)); parts[HEAD].surface.attach(Some(&buffer), 0, 0); if self.surface_version >= 4 { parts[HEAD].surface.damage_buffer( 0, 0, scaled_header_width as i32, scaled_header_height as i32, ); } else { // surface is old and does not support damage_buffer, so we damage // in surface coordinates and hope it is not rescaled parts[HEAD].surface.damage(0, 0, width as i32, HEADER_SIZE as i32); } parts[HEAD].surface.commit(); } // -> top-subsurface if let Ok((canvas, buffer)) = self.pool.buffer( ((width + 2 * BORDER_SIZE) * scales[TOP]) as i32, (BORDER_SIZE * scales[TOP]) as i32, (4 * scales[TOP] * (width + 2 * BORDER_SIZE)) as i32, wl_shm::Format::Argb8888, ) { for pixel in canvas.chunks_exact_mut(4) { pixel[0] = color[0]; pixel[1] = color[1]; pixel[2] = color[2]; pixel[3] = color[3]; } parts[TOP].subsurface.set_position( -(BORDER_SIZE as i32), -(HEADER_SIZE as i32 + BORDER_SIZE as i32), ); parts[TOP].surface.attach(Some(&buffer), 0, 0); if self.surface_version >= 4 { parts[TOP].surface.damage_buffer( 0, 0, ((width + 2 * BORDER_SIZE) * scales[TOP]) as i32, (BORDER_SIZE * scales[TOP]) as i32, ); } else { // surface is old and does not support damage_buffer, so we damage // in surface coordinates and hope it is not rescaled parts[TOP].surface.damage( 0, 0, (width + 2 * BORDER_SIZE) as i32, BORDER_SIZE as i32, ); } parts[TOP].surface.commit(); } // -> bottom-subsurface if let Ok((canvas, buffer)) = self.pool.buffer( ((width + 2 * BORDER_SIZE) * scales[BOTTOM]) as i32, (BORDER_SIZE * scales[BOTTOM]) as i32, (4 * scales[BOTTOM] * (width + 2 * BORDER_SIZE)) as i32, wl_shm::Format::Argb8888, ) { for pixel in canvas.chunks_exact_mut(4) { pixel[0] = color[0]; pixel[1] = color[1]; pixel[2] = color[2]; pixel[3] = color[3]; } parts[BOTTOM].subsurface.set_position(-(BORDER_SIZE as i32), height as i32); parts[BOTTOM].surface.attach(Some(&buffer), 0, 0); if self.surface_version >= 4 { parts[BOTTOM].surface.damage_buffer( 0, 0, ((width + 2 * BORDER_SIZE) * scales[BOTTOM]) as i32, (BORDER_SIZE * scales[BOTTOM]) as i32, ); } else { // surface is old and does not support damage_buffer, so we damage // in surface coordinates and hope it is not rescaled parts[BOTTOM].surface.damage( 0, 0, (width + 2 * BORDER_SIZE) as i32, BORDER_SIZE as i32, ); } parts[BOTTOM].surface.commit(); } // -> left-subsurface if let Ok((canvas, buffer)) = self.pool.buffer( (BORDER_SIZE * scales[LEFT]) as i32, ((height + HEADER_SIZE) * scales[LEFT]) as i32, 4 * (BORDER_SIZE * scales[LEFT]) as i32, wl_shm::Format::Argb8888, ) { for pixel in canvas.chunks_exact_mut(4) { pixel[0] = color[0]; pixel[1] = color[1]; pixel[2] = color[2]; pixel[3] = color[3]; } parts[LEFT].subsurface.set_position(-(BORDER_SIZE as i32), -(HEADER_SIZE as i32)); parts[LEFT].surface.attach(Some(&buffer), 0, 0); if self.surface_version >= 4 { parts[LEFT].surface.damage_buffer( 0, 0, (BORDER_SIZE * scales[LEFT]) as i32, ((height + HEADER_SIZE) * scales[LEFT]) as i32, ); } else { // surface is old and does not support damage_buffer, so we damage // in surface coordinates and hope it is not rescaled parts[LEFT].surface.damage( 0, 0, BORDER_SIZE as i32, (height + HEADER_SIZE) as i32, ); } parts[LEFT].surface.commit(); } // -> right-subsurface if let Ok((canvas, buffer)) = self.pool.buffer( (BORDER_SIZE * scales[RIGHT]) as i32, ((height + HEADER_SIZE) * scales[RIGHT]) as i32, 4 * (BORDER_SIZE * scales[RIGHT]) as i32, wl_shm::Format::Argb8888, ) { for pixel in canvas.chunks_exact_mut(4) { pixel[0] = color[0]; pixel[1] = color[1]; pixel[2] = color[2]; pixel[3] = color[3]; } parts[RIGHT].subsurface.set_position(width as i32, -(HEADER_SIZE as i32)); parts[RIGHT].surface.attach(Some(&buffer), 0, 0); if self.surface_version >= 4 { parts[RIGHT].surface.damage_buffer( 0, 0, (BORDER_SIZE * scales[RIGHT]) as i32, ((height + HEADER_SIZE) * scales[RIGHT]) as i32, ); } else { // surface is old and does not support damage_buffer, so we damage // in surface coordinates and hope it is not rescaled parts[RIGHT].surface.damage( 0, 0, BORDER_SIZE as i32, (height + HEADER_SIZE) as i32, ); } parts[RIGHT].surface.commit(); } } } fn subtract_borders(&self, width: i32, height: i32) -> (i32, i32) { if self.hidden || self.inner.borrow().fullscreened { (width, height) } else { (width - 2 * BORDER_SIZE as i32, height - HEADER_SIZE as i32 - 2 * BORDER_SIZE as i32) } } fn add_borders(&self, width: i32, height: i32) -> (i32, i32) { if self.hidden || self.inner.borrow().fullscreened { (width, height) } else { (width + 2 * BORDER_SIZE as i32, height + HEADER_SIZE as i32 + 2 * BORDER_SIZE as i32) } } fn location(&self) -> (i32, i32) { if self.hidden || self.inner.borrow().fullscreened { (0, 0) } else { (-(BORDER_SIZE as i32), -(HEADER_SIZE as i32 + BORDER_SIZE as i32)) } } fn set_config(&mut self, _config: ()) {} fn set_title(&mut self, _title: String) {} } impl Drop for FallbackFrame { fn drop(&mut self) { for ptr in self.pointers.drain(..) { if ptr.as_ref().version() >= 3 { ptr.release(); } } } } fn change_pointer(pointer: &ThemedPointer, inner: &Inner, location: Location, serial: Option) { // Prevent theming of the surface if it was requested. if !inner.theme_over_surface && location == Location::None { return; } let name = match location { // If we can't resize a frame we shouldn't show resize cursors. _ if !inner.resizable => "left_ptr", Location::Top => "top_side", Location::TopRight => "top_right_corner", Location::Right => "right_side", Location::BottomRight => "bottom_right_corner", Location::Bottom => "bottom_side", Location::BottomLeft => "bottom_left_corner", Location::Left => "left_side", Location::TopLeft => "top_left_corner", _ => "left_ptr", }; if pointer.set_cursor(name, serial).is_err() { error!("Failed to set cursor"); } } fn request_for_location_on_lmb( pointer_data: &PointerUserData, maximized: bool, resizable: bool, ) -> Option { use wayland_protocols::xdg_shell::client::xdg_toplevel::ResizeEdge; match pointer_data.location { Location::Top if resizable => { Some(FrameRequest::Resize(pointer_data.seat.clone(), ResizeEdge::Top)) } Location::TopLeft if resizable => { Some(FrameRequest::Resize(pointer_data.seat.clone(), ResizeEdge::TopLeft)) } Location::Left if resizable => { Some(FrameRequest::Resize(pointer_data.seat.clone(), ResizeEdge::Left)) } Location::BottomLeft if resizable => { Some(FrameRequest::Resize(pointer_data.seat.clone(), ResizeEdge::BottomLeft)) } Location::Bottom if resizable => { Some(FrameRequest::Resize(pointer_data.seat.clone(), ResizeEdge::Bottom)) } Location::BottomRight if resizable => { Some(FrameRequest::Resize(pointer_data.seat.clone(), ResizeEdge::BottomRight)) } Location::Right if resizable => { Some(FrameRequest::Resize(pointer_data.seat.clone(), ResizeEdge::Right)) } Location::TopRight if resizable => { Some(FrameRequest::Resize(pointer_data.seat.clone(), ResizeEdge::TopRight)) } Location::Head => Some(FrameRequest::Move(pointer_data.seat.clone())), Location::Button(UIButton::Close) => Some(FrameRequest::Close), Location::Button(UIButton::Maximize) => { if maximized { Some(FrameRequest::UnMaximize) } else { Some(FrameRequest::Maximize) } } Location::Button(UIButton::Minimize) => Some(FrameRequest::Minimize), _ => None, } } fn request_for_location_on_rmb(pointer_data: &PointerUserData) -> Option { match pointer_data.location { Location::Head | Location::Button(_) => Some(FrameRequest::ShowMenu( pointer_data.seat.clone(), pointer_data.position.0 as i32, // We must offset it by header size for precise position. pointer_data.position.1 as i32 - HEADER_SIZE as i32, )), _ => None, } } fn draw_buttons( canvas: &mut [u8], width: u32, scale: u32, maximizable: bool, state: WindowState, mouses: &[Location], ) { let scale = scale as usize; if width >= HEADER_SIZE { // Draw the close button let btn_state = if mouses.iter().any(|&l| l == Location::Button(UIButton::Close)) { ButtonState::Hovered } else { ButtonState::Idle }; if state == WindowState::Active && btn_state == ButtonState::Hovered { draw_button(canvas, 0, scale, width as usize, BTN_HOVER_BG.to_ne_bytes()); } draw_icon(canvas, width as usize, 0, scale, BTN_ICON_COLOR.to_ne_bytes(), Icon::Close); } if width as usize >= 2 * HEADER_SIZE as usize { let btn_state = if !maximizable { ButtonState::Disabled } else if mouses.iter().any(|&l| l == Location::Button(UIButton::Maximize)) { ButtonState::Hovered } else { ButtonState::Idle }; if state == WindowState::Active && btn_state == ButtonState::Hovered { draw_button( canvas, HEADER_SIZE as usize, scale, width as usize, BTN_HOVER_BG.to_ne_bytes(), ); } draw_icon( canvas, width as usize, HEADER_SIZE as usize, scale, BTN_ICON_COLOR.to_ne_bytes(), Icon::Maximize, ); } if width as usize >= 3 * HEADER_SIZE as usize { let btn_state = if mouses.iter().any(|&l| l == Location::Button(UIButton::Minimize)) { ButtonState::Hovered } else { ButtonState::Idle }; if state == WindowState::Active && btn_state == ButtonState::Hovered { draw_button( canvas, 2 * HEADER_SIZE as usize, scale, width as usize, BTN_HOVER_BG.to_ne_bytes(), ); } draw_icon( canvas, width as usize, 2 * HEADER_SIZE as usize, scale, BTN_ICON_COLOR.to_ne_bytes(), Icon::Minimize, ); } } enum Icon { Close, Maximize, Minimize, } fn draw_button(canvas: &mut [u8], x_offset: usize, scale: usize, width: usize, btn_color: [u8; 4]) { let h = HEADER_SIZE as usize; let x_start = width - h - x_offset; // main square for y in 0..h * scale { let canvas = &mut canvas[(x_start + y * width) * 4 * scale..(x_start + y * width + h) * scale * 4]; for pixel in canvas.chunks_exact_mut(4) { pixel[0] = btn_color[0]; pixel[1] = btn_color[1]; pixel[2] = btn_color[2]; pixel[3] = btn_color[3]; } } } fn draw_icon( canvas: &mut [u8], width: usize, x_offset: usize, scale: usize, icon_color: [u8; 4], icon: Icon, ) { let h = HEADER_SIZE as usize; let sh = scale * h; let x_start = width - h - x_offset; match icon { Icon::Close => { // Draw black rectangle for y in sh / 4..3 * sh / 4 { let line = &mut canvas[(x_start + y * width + h / 4) * 4 * scale ..(x_start + y * width + 3 * h / 4) * 4 * scale]; for pixel in line.chunks_exact_mut(4) { pixel[0] = icon_color[0]; pixel[1] = icon_color[1]; pixel[2] = icon_color[2]; pixel[3] = icon_color[3]; } } } Icon::Maximize => { // Draw an empty rectangle for y in 2 * sh / 8..3 * sh / 8 { let line = &mut canvas[(x_start + y * width + h / 4) * 4 * scale ..(x_start + y * width + 3 * h / 4) * 4 * scale]; for pixel in line.chunks_exact_mut(4) { pixel[0] = icon_color[0]; pixel[1] = icon_color[1]; pixel[2] = icon_color[2]; pixel[3] = icon_color[3]; } } for y in 3 * sh / 8..5 * sh / 8 { let line = &mut canvas[(x_start + y * width + 2 * h / 8) * 4 * scale ..(x_start + y * width + 3 * h / 8) * 4 * scale]; for pixel in line.chunks_exact_mut(4) { pixel[0] = icon_color[0]; pixel[1] = icon_color[1]; pixel[2] = icon_color[2]; pixel[3] = icon_color[3]; } let line = &mut canvas[(x_start + y * width + 5 * h / 8) * 4 * scale ..(x_start + y * width + 6 * h / 8) * 4 * scale]; for pixel in line.chunks_exact_mut(4) { pixel[0] = icon_color[0]; pixel[1] = icon_color[1]; pixel[2] = icon_color[2]; pixel[3] = icon_color[3]; } } for y in 5 * sh / 8..6 * sh / 8 { let line = &mut canvas[(x_start + y * width + h / 4) * 4 * scale ..(x_start + y * width + 3 * h / 4) * 4 * scale]; for pixel in line.chunks_exact_mut(4) { pixel[0] = icon_color[0]; pixel[1] = icon_color[1]; pixel[2] = icon_color[2]; pixel[3] = icon_color[3]; } } } Icon::Minimize => { // Draw an underline for y in 5 * sh / 8..3 * sh / 4 { let line = &mut canvas[(x_start + y * width + h / 4) * 4 * scale ..(x_start + y * width + 3 * h / 4) * 4 * scale]; for pixel in line.chunks_exact_mut(4) { pixel[0] = icon_color[0]; pixel[1] = icon_color[1]; pixel[2] = icon_color[2]; pixel[3] = icon_color[3]; } } } } } smithay-client-toolkit-0.16.1/src/window/mod.rs000064400000000000000000001007601046102023000175550ustar 00000000000000//! Window abstraction use std::cell::RefCell; use std::fmt; use std::rc::Rc; use std::sync::Arc; use wayland_client::protocol::{ wl_compositor, wl_output, wl_seat, wl_shm, wl_subcompositor, wl_surface, }; use wayland_client::{Attached, DispatchData}; use wayland_protocols::xdg_shell::client::xdg_toplevel::ResizeEdge; pub use wayland_protocols::xdg_shell::client::xdg_toplevel::State; use wayland_protocols::unstable::xdg_decoration::v1::client::{ zxdg_decoration_manager_v1::ZxdgDecorationManagerV1, zxdg_toplevel_decoration_v1::{self, ZxdgToplevelDecorationV1}, }; use crate::{ environment::{Environment, GlobalHandler, MultiGlobalHandler}, seat::pointer::ThemeManager, shell, }; mod fallback_frame; pub use self::fallback_frame::FallbackFrame; // Defines the minimum window size. Minimum width is set to 2 pixels to circumvent // a bug in mutter - https://gitlab.gnome.org/GNOME/mutter/issues/259 const MIN_WINDOW_SIZE: (u32, u32) = (2, 1); /// Represents the status of a button #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum ButtonState { /// Button is being hovered over by pointer Hovered, /// Button is not being hovered over by pointer Idle, /// Button is disabled Disabled, } /// Represents the status of a window #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum WindowState { /// The window is active, in the foreground Active, /// The window is inactive, in the background Inactive, } impl From for WindowState { fn from(b: bool) -> WindowState { if b { WindowState::Active } else { WindowState::Inactive } } } impl From for bool { fn from(s: WindowState) -> bool { match s { WindowState::Active => true, WindowState::Inactive => false, } } } /// Possible events generated by a window that you need to handle #[derive(Clone, Debug)] pub enum Event { /// The state of your window has been changed Configure { /// Optional new size for your *inner* surface /// /// This is the new size of the contents of your window /// as suggested by the server. You can ignore it and choose /// a new size if you want better control on the possible /// sizes of your window. /// /// The size is expressed in logical pixels, you need to multiply it by /// your buffer scale to get the actual number of pixels to draw. /// /// In all cases, these events can be generated in large batches /// during an interactive resize, and you should buffer them before /// processing them. You only need to handle the last one of a batch. new_size: Option<(u32, u32)>, /// New combination of states of your window /// /// Typically tells you if your surface is active/inactive, maximized, /// etc... states: Vec, }, /// A close request has been received /// /// Most likely the user has clicked on the close button of the decorations /// or something equivalent Close, /// The decorations need to be refreshed Refresh, } /// Possible decoration modes for a Window /// /// This represents what your application requests from the server. /// /// In any case, the compositor may override your requests. In that case SCTK /// will follow its decision. /// /// If you don't care about it, you should use `FollowServer` (which is the /// SCTK default). It'd be the most ergonomic for your users. #[derive(Debug, PartialEq, Eq)] pub enum Decorations { /// Request server-side decorations ServerSide, /// Force using the client-side `Frame` ClientSide, /// Follow the preference of the compositor FollowServer, /// Don't decorate the Window None, } struct WindowInner { frame: Rc>, shell_surface: Arc>, user_impl: Box, min_size: (u32, u32), max_size: Option<(u32, u32)>, current_size: (u32, u32), old_size: Option<(u32, u32)>, decorated: bool, } impl fmt::Debug for WindowInner where F: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("WindowInner") .field("frame", &self.frame) .field("shell_surface", &self.shell_surface) .field("user_impl", &"Fn() -> { ... }") .field("min_size", &self.min_size) .field("max_size", &self.max_size) .field("current_size", &self.current_size) .field("old_size", &self.old_size) .field("decorated", &self.decorated) .finish() } } /// A window /// /// This wrapper handles for you the decoration of your window /// and the interaction with the server regarding the shell protocol. /// /// You are still entirely responsible for drawing the contents of your /// window. /// /// Note also that as the dimensions of wayland surfaces is defined by /// their attached buffer, you need to keep the decorations in sync with /// your contents via the `resize(..)` method. /// /// Different kind of decorations can be used by customizing the type /// parameter. A few are provided in this crate if the `frames` cargo feature /// is enabled, but any type implementing the `Frame` trait can do. pub struct Window { frame: Rc>, surface: wl_surface::WlSurface, decoration: Option, shell_surface: Arc>, inner: Rc>>>, _seat_listener: crate::seat::SeatListener, } impl Window { /// Create a new window wrapping a given wayland surface as its main content and /// following the compositor's preference regarding server-side decorations /// /// It can fail if the initialization of the frame fails (for example if the /// frame class fails to initialize its SHM). /// /// Providing non `None` value for `theme_manager` should prevent theming pointer /// over the `surface`. fn init_with_decorations( env: &crate::environment::Environment, surface: wl_surface::WlSurface, theme_manager: Option, initial_dims: (u32, u32), implementation: Impl, ) -> Result, F::Error> where Impl: FnMut(Event, DispatchData) + 'static, E: GlobalHandler + GlobalHandler + GlobalHandler + crate::shell::ShellHandling + MultiGlobalHandler + GlobalHandler + crate::seat::SeatHandling, { let compositor = env.require_global::(); let subcompositor = env.require_global::(); let shm = env.require_global::(); let shell = env .get_shell() .expect("[SCTK] Cannot create a window if the compositor advertized no shell."); let inner = Rc::new(RefCell::new(None::>)); let frame_inner = inner.clone(); let shell_inner = inner.clone(); let mut frame = F::init( &surface, &compositor, &subcompositor, &shm, theme_manager, Box::new(move |req, serial, ddata: DispatchData| { if let Some(ref mut inner) = *shell_inner.borrow_mut() { match req { FrameRequest::Minimize => inner.shell_surface.set_minimized(), FrameRequest::Maximize => inner.shell_surface.set_maximized(), FrameRequest::UnMaximize => inner.shell_surface.unset_maximized(), FrameRequest::Move(seat) => inner.shell_surface.move_(&seat, serial), FrameRequest::Resize(seat, edges) => { inner.shell_surface.resize(&seat, serial, edges) } FrameRequest::ShowMenu(seat, x, y) => { inner.shell_surface.show_window_menu(&seat, serial, x, y) } FrameRequest::Close => (inner.user_impl)(Event::Close, ddata), FrameRequest::Refresh => (inner.user_impl)(Event::Refresh, ddata), } } }) as Box<_>, )?; let decoration_mgr = env.get_global::(); if decoration_mgr.is_none() { // We don't have ServerSide decorations, so we'll be using CSD, and so should // mark frame as not hidden. frame.set_hidden(false); } frame.resize(initial_dims); let frame = Rc::new(RefCell::new(frame)); let shell_surface = Arc::new(shell::create_shell_surface( &shell, &surface, move |event, mut ddata: DispatchData| { let mut frame_inner = frame_inner.borrow_mut(); let mut inner = match frame_inner.as_mut() { Some(inner) => inner, None => return, }; match event { shell::Event::Configure { states, mut new_size } => { let mut frame = inner.frame.borrow_mut(); // Populate frame changes. We should do it before performing new_size // recalculation, since we should account for a fullscreen state. let need_refresh = frame.set_states(&states); // Clamp size. new_size = new_size.map(|(w, h)| { use std::cmp::{max, min}; let (mut w, mut h) = frame.subtract_borders(w as i32, h as i32); let (minw, minh) = inner.min_size; w = max(w, minw as i32); h = max(h, minh as i32); if let Some((maxw, maxh)) = inner.max_size { w = min(w, maxw as i32); h = min(h, maxh as i32); } (max(w, 1) as u32, max(h, 1) as u32) }); // Check whether we should save old size for later restoration. let should_stash_size = states .iter() .find(|s| { matches!( *s, State::Maximized | State::Fullscreen | State::TiledTop | State::TiledRight | State::TiledBottom | State::TiledLeft ) }) .map(|_| true) .unwrap_or(false); if should_stash_size { if inner.old_size.is_none() { // We are getting maximized/fullscreened, store the size for // restoration. inner.old_size = Some(inner.current_size); } } else if new_size.is_none() { // We are getting de-maximized/de-fullscreened/un-tiled, restore the // size, if we were not previously maximized/fullscreened, old_size is // None and this does nothing. new_size = inner.old_size.take(); } else { // We are neither maximized nor fullscreened, but are given a size, // respect it and forget about the old size. inner.old_size = None; } if need_refresh { (inner.user_impl)(Event::Refresh, ddata.reborrow()); } (inner.user_impl)(Event::Configure { states, new_size }, ddata); } shell::Event::Close => { (inner.user_impl)(Event::Close, ddata); } } }, )); // setup size and geometry { let frame = frame.borrow_mut(); let (minw, minh) = frame.add_borders(MIN_WINDOW_SIZE.0 as i32, MIN_WINDOW_SIZE.1 as i32); shell_surface.set_min_size(Some((minw, minh))); let (w, h) = frame.add_borders(initial_dims.0 as i32, initial_dims.1 as i32); let (x, y) = frame.location(); shell_surface.set_geometry(x, y, w, h); } // initial seat setup let mut seats = Vec::::new(); for seat in env.get_all_seats() { crate::seat::with_seat_data(&seat, |seat_data| { if seat_data.has_pointer && !seat_data.defunct { seats.push(seat.detach()); frame.borrow_mut().new_seat(&seat); } }); } // setup seat_listener let seat_frame = frame.clone(); let seat_listener = env.listen_for_seats(move |seat, seat_data, _| { let is_known = seats.contains(&seat); if !is_known && seat_data.has_pointer && !seat_data.defunct { seat_frame.borrow_mut().new_seat(&seat); seats.push(seat.detach()); } else if is_known && ((!seat_data.has_pointer) || seat_data.defunct) { seat_frame.borrow_mut().remove_seat(&seat); seats.retain(|s| s != &*seat); } }); *inner.borrow_mut() = Some(WindowInner { frame: frame.clone(), shell_surface: shell_surface.clone(), user_impl: Box::new(implementation) as Box<_>, min_size: (MIN_WINDOW_SIZE.0, MIN_WINDOW_SIZE.1), max_size: None, current_size: initial_dims, old_size: None, decorated: true, }); // Setup window decorations if applicable. let decoration = Self::setup_decorations_handler( &decoration_mgr, &shell_surface, frame.clone(), inner.clone(), ); let window = Window { frame, shell_surface, decoration, surface, inner, _seat_listener: seat_listener, }; Ok(window) } /// Setup handling for zxdg_toplevel_decoration_v1 in case protocol is available. fn setup_decorations_handler( decoration_mgr: &Option>, shell_surface: &Arc>, decoration_frame: Rc>, decoration_inner: Rc>>>, ) -> Option { let (toplevel, mgr) = match (shell_surface.get_xdg(), decoration_mgr) { (Some(toplevel), Some(ref mgr)) => (toplevel, mgr), _ => { return None; } }; let decoration = mgr.get_toplevel_decoration(toplevel); decoration.quick_assign(move |_, event, _| { use self::zxdg_toplevel_decoration_v1::{Event, Mode}; let mode = if let Event::Configure { mode } = event { mode } else { unreachable!() }; match mode { Mode::ServerSide => { decoration_frame.borrow_mut().set_hidden(true); } Mode::ClientSide => { let want_decorate = decoration_inner .borrow_mut() .as_ref() .map(|inner| inner.decorated) .unwrap_or(false); decoration_frame.borrow_mut().set_hidden(!want_decorate); } _ => unreachable!(), } }); Some(decoration.detach()) } /// Access the surface wrapped in this Window pub fn surface(&self) -> &wl_surface::WlSurface { &self.surface } /// Refreshes the frame /// /// Redraws the frame to match its requested state (dimensions, presence/ /// absence of decorations, ...) /// /// You need to call this method after every change to the dimensions or state /// of the decorations of your window, otherwise the drawn decorations may go /// out of sync with the state of your content. /// /// Your implementation will also receive `Refresh` events when the frame requests /// to be redrawn (to provide some frame animations for example). pub fn refresh(&mut self) { self.frame.borrow_mut().redraw(); } /// Set a short title for the window. /// /// This string may be used to identify the surface in a task bar, window list, or other /// user interface elements provided by the compositor. /// /// You need to call `refresh()` afterwards for this to properly /// take effect. pub fn set_title(&self, mut title: String) { // Truncate the title to at most 1024 bytes, so that it does not blow up the protocol // messages if title.len() > 1024 { let mut new_len = 1024; while !title.is_char_boundary(new_len) { new_len -= 1; } title.truncate(new_len); } self.frame.borrow_mut().set_title(title.clone()); self.shell_surface.set_title(title); } /// Set an app id for the surface. /// /// The surface class identifies the general class of applications to which the surface /// belongs. /// /// Several wayland compositors will try to find a `.desktop` file matching this name /// to find metadata about your apps. pub fn set_app_id(&self, app_id: String) { self.shell_surface.set_app_id(app_id); } /// Set whether the window should be decorated or not. /// /// If `zxdg_toplevel_decoration_v1` object is presented and alive, requesting `None` /// decorations will result in setting `ClientSide` decorations with hidden frame, and if /// `ClientSide` decorations were requested, it'll result in destroying /// `zxdg_toplevel_decoration_v1` object, meaning that you won't be able to get `ServerSide` /// decorations back. /// /// In case `zxdg_toplevel_decoration_v1` is not available or the corresponding object is not /// alive anymore, `decorate` with `ServerSide` or `FollowServer` values will always result in /// `ClientSide` decorations being used. /// /// You need to call `refresh()` afterwards for this to properly /// take effect. pub fn set_decorate(&mut self, decorate: Decorations) { use self::zxdg_toplevel_decoration_v1::Mode; // Update inner.decorated state. if let Some(inner) = self.inner.borrow_mut().as_mut() { if Decorations::None == decorate { inner.decorated = false; } else { inner.decorated = true; } } match self.decoration.as_ref() { // Server side decorations are there. Some(decoration) => { match decorate { Decorations::ClientSide => { // The user explicitly requested `ClientSide` decorations, we should destroy // the server side decorations if some are presented. decoration.destroy(); self.decoration = None; self.frame.borrow_mut().set_hidden(false); } Decorations::ServerSide => { decoration.set_mode(Mode::ServerSide); } Decorations::FollowServer => { decoration.unset_mode(); } Decorations::None => { // The user explicitly requested `None` decorations, however // since we can't destroy and recreate decoration object on the fly switch // them to `ClientSide` with the hidden frame. The server is free to ignore // us with such request, but not that we can do much about it. decoration.set_mode(Mode::ClientSide); self.frame.borrow_mut().set_hidden(true); } } } // Server side decorations are not presented or were destroyed. None => { match decorate { // We map `ServerSide` and `FollowServer` decorations to `ClientSide`, since // server side decorations are no longer available. Decorations::ClientSide | Decorations::ServerSide | Decorations::FollowServer => { self.frame.borrow_mut().set_hidden(false); } Decorations::None => { self.frame.borrow_mut().set_hidden(true); } } } } } /// Set whether the window should be resizeable by the user /// /// This is not an hard blocking, as the compositor can always /// resize you forcibly if it wants. However it signals it that /// you don't want this window to be resized. /// /// Additionally, the decorations will stop suggesting the user /// to resize by dragging the borders if you set the window as /// non-resizable. /// /// When re-activating resizability, any previously set min/max /// sizes are restored. pub fn set_resizable(&self, resizable: bool) { let mut frame = self.frame.borrow_mut(); frame.set_resizable(resizable); let mut inner = self.inner.borrow_mut(); if let Some(ref mut inner) = *inner { if resizable { // restore the min/max sizes self.shell_surface.set_min_size( Some(inner.min_size).map(|(w, h)| frame.add_borders(w as i32, h as i32)), ); self.shell_surface.set_max_size( inner.max_size.map(|(w, h)| frame.add_borders(w as i32, h as i32)), ); } else { // Lock the min/max sizes to current size. let (w, h) = inner.current_size; self.shell_surface.set_min_size(Some(frame.add_borders(w as i32, h as i32))); self.shell_surface.set_max_size(Some(frame.add_borders(w as i32, h as i32))); } } } /// Resize the decorations /// /// You should call this whenever you change the size of the contents /// of your window, with the new _inner size_ of your window. /// /// This size is expressed in logical pixels, like the one received /// in [`Event::Configure`](enum.Event.html). /// /// You need to call `refresh()` afterwards for this to properly /// take effect. pub fn resize(&mut self, w: u32, h: u32) { use std::cmp::max; let w = max(w, 1); let h = max(h, 1); if let Some(ref mut inner) = *self.inner.borrow_mut() { inner.current_size = (w, h); } let mut frame = self.frame.borrow_mut(); frame.resize((w, h)); let (w, h) = frame.add_borders(w as i32, h as i32); let (x, y) = frame.location(); self.shell_surface.set_geometry(x, y, w, h); } /// Request the window to be maximized pub fn set_maximized(&self) { self.shell_surface.set_maximized(); } /// Request the window to be un-maximized pub fn unset_maximized(&self) { self.shell_surface.unset_maximized(); } /// Request the window to be minimized pub fn set_minimized(&self) { self.shell_surface.set_minimized(); } /// Request the window to be set fullscreen /// /// Note: The decorations hiding behavior is `Frame` dependant. /// To check whether you need to hide them consult your frame documentation. pub fn set_fullscreen(&self, output: Option<&wl_output::WlOutput>) { self.shell_surface.set_fullscreen(output); } /// Request the window to quit fullscreen mode pub fn unset_fullscreen(&self) { self.shell_surface.unset_fullscreen(); } /// Sets the minimum possible size for this window /// /// Provide either a tuple `Some((width, height))` or `None` to unset the /// minimum size. /// /// Setting either value in the tuple to `0` means that this axis should not /// be limited. /// /// The provided size is the interior size, not counting decorations. /// /// This size is expressed in logical pixels, like the one received /// in [`Event::Configure`](enum.Event.html). pub fn set_min_size(&mut self, size: Option<(u32, u32)>) { let (w, h) = size.unwrap_or(MIN_WINDOW_SIZE); let (w, h) = self.frame.borrow_mut().add_borders(w as i32, h as i32); self.shell_surface.set_min_size(Some((w, h))); if let Some(ref mut inner) = *self.inner.borrow_mut() { inner.min_size = size.unwrap_or(MIN_WINDOW_SIZE) } } /// Sets the maximum possible size for this window /// /// Provide either a tuple `Some((width, height))` or `None` to unset the /// maximum size. /// /// Setting either value in the tuple to `0` means that this axis should not /// be limited. /// /// The provided size is the interior size, not counting decorations. /// /// This size is expressed in logical pixels, like the one received /// in [`Event::Configure`](enum.Event.html). pub fn set_max_size(&mut self, size: Option<(u32, u32)>) { let max_size = size.map(|(w, h)| self.frame.borrow_mut().add_borders(w as i32, h as i32)); self.shell_surface.set_max_size(max_size); if let Some(ref mut inner) = *self.inner.borrow_mut() { inner.max_size = size.map(|(w, h)| (w as u32, h as u32)); } } /// Sets the frame configuration for the window /// /// This allows to configure the frame at runtime if it supports /// it. See the documentation of your `Frame` implementation for /// details about what configuration it supports. pub fn set_frame_config(&mut self, config: F::Config) { self.frame.borrow_mut().set_config(config) } /// Start an interactive, user-driven move of the surface /// /// This request must be used in response to some sort of user action /// like a button press, key press, or touch down event. The passed /// serial is used to determine the type of interactive move (touch, /// pointer, etc). /// /// The server may ignore move requests depending on the state of /// the surface (e.g. fullscreen or maximized), or if the passed serial /// is no longer valid. pub fn start_interactive_move(&self, seat: &wl_seat::WlSeat, serial: u32) { self.shell_surface.move_(seat, serial); } } impl Drop for Window { fn drop(&mut self) { self.inner.borrow_mut().take(); // Destroy decorations manager, so the inner frame could be dropped. if let Some(decoration) = self.decoration.take() { decoration.destroy(); } } } impl fmt::Debug for Window where F: fmt::Debug, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Window") .field("frame", &self.frame) .field("surface", &self.surface) .field("decoration", &self.decoration) .field("shell_surface", &self.shell_surface) .field("inner", &self.inner) .field("_seat_listener", &self._seat_listener) .finish() } } /// Request generated by a Frame /// /// These requests are generated by a Frame and the Window will /// forward them appropriately to the server. #[derive(Debug)] pub enum FrameRequest { /// The window should be minimized Minimize, /// The window should be maximized Maximize, /// The window should be unmaximized UnMaximize, /// The window should be closed Close, /// An interactive move should be started Move(wl_seat::WlSeat), /// An interactive resize should be started Resize(wl_seat::WlSeat, ResizeEdge), /// Show window menu. ShowMenu(wl_seat::WlSeat, i32, i32), /// The frame requests to be refreshed Refresh, } /// Interface for defining the drawing of decorations /// /// A type implementing this trait can be used to define custom /// decorations additionnaly to the ones provided by this crate /// and be used with `Window`. pub trait Frame: Sized { /// Type of errors that may occur when attempting to create a frame type Error; /// Configuration for this frame type Config; /// Initialize the Frame. /// /// Providing non `None` to `theme_manager` should prevent `Frame` to theme pointer /// over `base_surface` surface. fn init( base_surface: &wl_surface::WlSurface, compositor: &Attached, subcompositor: &Attached, shm: &Attached, theme_manager: Option, callback: Box, ) -> Result; /// Set the Window XDG states for the frame /// /// This notably includes information about whether the window is /// maximized, active, or tiled, and can affect the way decorations /// are drawn. /// /// Calling this should *not* trigger a redraw, but return `true` if /// a redraw is needed. fn set_states(&mut self, states: &[State]) -> bool; /// Hide or show the decorations /// /// Calling this should *not* trigger a redraw fn set_hidden(&mut self, hidden: bool); /// Set whether interactive resize hints should be displayed /// and reacted to fn set_resizable(&mut self, resizable: bool); /// Notify that a new wl_seat should be handled /// /// This seat is guaranteed to have pointer capability fn new_seat(&mut self, seat: &Attached); /// Notify that this seat has lost the pointer capability or /// has been lost fn remove_seat(&mut self, seat: &wl_seat::WlSeat); /// Change the size of the decorations /// /// Calling this should *not* trigger a redraw fn resize(&mut self, newsize: (u32, u32)); /// Redraw the decorations fn redraw(&mut self); /// Subtracts the border dimensions from the given dimensions. fn subtract_borders(&self, width: i32, height: i32) -> (i32, i32); /// Adds the border dimensions to the given dimensions. fn add_borders(&self, width: i32, height: i32) -> (i32, i32); /// Returns the coordinates of the top-left corner of the borders relative to the content /// /// Values should thus be negative fn location(&self) -> (i32, i32) { (0, 0) } /// Sets the configuration for the frame fn set_config(&mut self, config: Self::Config); /// Sets the frames title fn set_title(&mut self, title: String); } impl Environment where E: GlobalHandler + GlobalHandler + GlobalHandler + crate::shell::ShellHandling + MultiGlobalHandler + GlobalHandler + crate::seat::SeatHandling, { /// Create a new window wrapping given surface /// /// This window handles decorations for you, this includes /// drawing them if the compositor doe snot support them, resizing interactions /// and moving the window. It also provides close/maximize/minimize buttons. /// /// Many interactions still require your input, and are given to you via the /// callback you need to provide. pub fn create_window( &self, surface: wl_surface::WlSurface, theme_manager: Option, initial_dims: (u32, u32), callback: CB, ) -> Result, F::Error> where CB: FnMut(Event, DispatchData) + 'static, { Window::::init_with_decorations(self, surface, theme_manager, initial_dims, callback) } } smithay-client-toolkit-0.16.1/travis_install_wayland.sh000075500000000000000000000007561046102023000214520ustar 00000000000000#!/bin/sh # download and compile the wayland libs for given version, they will be installed in ~/install wayland_version=$1 mkdir ~/temp/ ~/install # download and extract cd ~/temp/ wget https://github.com/wayland-project/wayland/archive/${wayland_version}.tar.gz -O wayland.tar.gz tar xf wayland.tar.gz cd wayland-${wayland_version} # compile and install ./autogen.sh --prefix=$HOME/install --disable-documentation --disable-dtd-validation --disable-dependency-tracking make make install smithay-client-toolkit-0.16.1/update_keysyms.sh000075500000000000000000000017641046102023000177430ustar 00000000000000#!/bin/bash X11_INCLUDEDIR="/usr/include/X11" KEYSYMDEFS="${X11_INCLUDEDIR}/keysymdef.h ${X11_INCLUDEDIR}/XF86keysym.h ${X11_INCLUDEDIR}/Sunkeysym.h ${X11_INCLUDEDIR}/DECkeysym.h ${X11_INCLUDEDIR}/HPkeysym.h" TARGET_FILE=src/seat/keyboard/keysyms.rs echo "//" > $TARGET_FILE echo "// This file was auto-generated using the update-keysyms.sh script." >> $TARGET_FILE echo "//" >> $TARGET_FILE echo "" >> $TARGET_FILE echo "#![allow(missing_docs, non_upper_case_globals, unused_parens, clippy::all)]" >> $TARGET_FILE echo "#![cfg_attr(rustfmt, rustfmt_skip)]" >> $TARGET_FILE echo "" >> $TARGET_FILE cat $KEYSYMDEFS | sed -e '/XK_Ydiaeresis\s*0x100000ee/d' \ -e '/#define _/d' \ -e 's/#define\s*\(\w*\)XK_/#define XKB_KEY_\1/' \ -e '/\(#ifdef\|#ifndef\|#endif\)/d' \ -e 's/#define/pub const/g' \ -e 's/0x\([0-9a-fA-F]*\)/:u32 = 0x\1;/g' >> $TARGET_FILE