Struct dummy_rustwlc::xkb::Keysym [] [src]

pub struct Keysym(_);

An xkb keysym.

From xkb

A number used to represent the symbols generated from a key on a keyboard.

A key, represented by a keycode, may generate different symbols according to keyboard state. For example, on a QWERTY keyboard, pressing the key labled <A> generates the symbol 'a'. If the Shift key is held, it generates the symbol 'A'. If a different layout is used, say Greek, it generates the symbol 'α'. And so on.

Each such symbol is represented by a keysym. Note that keysyms are somewhat more general, in that they can also represent some "function", such as "Left" or "Right" for the arrow keys. For more information, see: http://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#keysym_encoding

Specifically named keysyms can be found in the xkbcommon/xkbcommon-keysyms.h header file. Their name does not include the XKB_KEY_ prefix.

Besides those, any Unicode/ISO 10646 character in the range U0100 to U10FFFF can be represented by a keysym value in the range 0x01000100 to 0x0110FFFF. The name of Unicode keysyms is "U", e.g. "UA1B2".

The name of other unnamed keysyms is the hexadecimal representation of their value, e.g. "0xabcd1234". Keysym names are case-sensitive.

Methods

impl Keysym
[src]

Whether this keysym is a valid keysym.

This checks whether the Keysym's value isn't 0 or 0xffffffff.

Tested on libxkbcommon 0.5.0-1, keysyms less than 0x20000000 stopped having meaningful names (.get_name() returned None).

Validity

If a call to Keysym::from_name(some_name) returns a Some(named_sym) , named_sym.is_valid() will return true.

In general, whenever a Keysym sym passes sym.is_valid(), sym.get_name() will be a Some (for keysyms less than 0x20000000).

In addition, if sym.get_name() is a Some(name), Keysym::from_name(name) will also return a valid Keysym.

Examples

use rustwlc::xkb::Keysym;

let sym = Keysym::from(0x41); // Something
assert!(sym.is_valid());

Whether a Keysym is invalid.

See is_valid().

Gets the Keysym as a u32.

Gets the Keysym for the given name.

Arguments

name: The name of a keysym. See docs for get_name. This function will accept any name returned by that function.

flags: A set of flags controlling how the search is done. If the KeyboardFlags::CaseInsensitive flag is used and two keysym names differ only by case, then the lower-case keysym is returned. For instance, for KEY_a and KEY_A, this function would return KEY_a for the case-insensitive search. If this functionality is needed, it is recommended to first call this function without this flag, and if that fails, only then to try with this flag, while possibly warning the user that they have misspelled the name, and might get wrong results.

returns: The keysym. If the name is invalid, returns None.

Examples

use rustwlc::xkb::{Keysym, NameFlags};

let key_match_a = Keysym::from_name("a".to_string(), NameFlags::None);
assert!(key_match_a.is_some());

let key_a = key_match_a.unwrap();
assert!(key_a.is_valid());

Gets name name of the keysym.

Examples

use rustwlc::xkb::{Keysym, NameFlags};

let key = Keysym::from_name("a".to_string(), NameFlags::None).unwrap();

assert_eq!(key.get_name(), Some("a".to_string()));

Gets the Unicode/UTF8 representation of this keysym.

Gets the Unicode/UTF32 representation of this keysym.

Trait Implementations

impl Debug for Keysym
[src]

Formats the value using the given formatter.

impl Clone for Keysym
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Keysym
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Keysym
[src]

impl Hash for Keysym
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

impl From<u32> for Keysym
[src]

Performs the conversion.