Trait gdk4::prelude::DisplayExtManual [−][src]
pub trait DisplayExtManual: 'static {
fn translate_key(
&self,
keycode: u32,
state: ModifierType,
group: i32
) -> Option<(Key, i32, i32, ModifierType)>;
fn get_setting(&self, name: &str) -> Option<Value>;
fn map_keyval(&self, keyval: Key) -> Option<Vec<KeymapKey>>;
fn map_keycode(&self, keycode: u32) -> Option<Vec<(KeymapKey, Key)>>;
fn put_event<P: AsRef<Event>>(&self, event: &P);
}
Required methods
fn translate_key(
&self,
keycode: u32,
state: ModifierType,
group: i32
) -> Option<(Key, i32, i32, ModifierType)>
fn translate_key(
&self,
keycode: u32,
state: ModifierType,
group: i32
) -> Option<(Key, i32, i32, ModifierType)>
Translates the contents of a GdkEventKey
into a keyval, effective group,
and level.
Modifiers that affected the translation and are thus unavailable for
application use are returned in consumed_modifiers
.
The effective_group
is the group that was actually used for the
translation; some keys such as Enter are not affected by the active
keyboard group. The level
is derived from state
.
consumed_modifiers
gives modifiers that should be masked out
from state
when comparing this key press to a keyboard shortcut.
For instance, on a US keyboard, the plus
symbol is shifted, so
when comparing a key press to a <Control>`plus` accelerator
This function should rarely be needed, since GdkEventKey
already
contains the translated keyval. It is exported for the benefit of
virtualized test environments.
keycode
a keycode
state
a modifier state
group
active keyboard group
Returns
true
if there was a keyval bound to keycode/state/group.
keyval
return location for keyval
effective_group
return location for effective group
level
return location for level
consumed
return location for modifiers that were used to determine the group or level
fn get_setting(&self, name: &str) -> Option<Value>
fn get_setting(&self, name: &str) -> Option<Value>
Obtains a list of keycode/group/level combinations that will
generate keyval
.
Groups and levels are two kinds of keyboard mode; in general, the level determines whether the top or bottom symbol on a key is used, and the group determines whether the left or right symbol is used.
On US keyboards, the shift key changes the keyboard level, and there are no groups. A group switch key might convert a keyboard between Hebrew to English modes, for example.
GdkEventKey
contains a group
field that indicates the active
keyboard group. The level is computed from the modifier mask.
The returned array should be freed with g_free()
.
keyval
a keyval, such as GDK_KEY_a
, GDK_KEY_Up
, GDK_KEY_Return
, etc.
Returns
true
if keys were found and returned
keys
return location
for an array of KeymapKey
Returns the keyvals bound to keycode
.
The Nth KeymapKey
in keys
is bound to the Nth keyval in keyvals
.
When a keycode is pressed by the user, the keyval from this list of entries is selected by considering the effective keyboard group and level.
Free the returned arrays with g_free()
.
keycode
a keycode
Returns
true
if there were any entries
keys
return
location for array of KeymapKey
keyvals
return location for array of keyvals