-
-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
4,882 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Take a look at the license at the top of the repository in the LICENSE file. | ||
|
||
use crate::{keys::Key, Display, ModifierType}; | ||
use glib::translate::*; | ||
use std::mem; | ||
|
||
impl Display { | ||
#[doc(alias = "gdk_display_translate_key")] | ||
pub fn translate_key( | ||
&self, | ||
keycode: u32, | ||
state: ModifierType, | ||
group: i32, | ||
) -> Option<(Key, i32, i32, ModifierType)> { | ||
unsafe { | ||
let mut keyval = mem::MaybeUninit::uninit(); | ||
let mut effective_group = mem::MaybeUninit::uninit(); | ||
let mut level = mem::MaybeUninit::uninit(); | ||
let mut consumed = mem::MaybeUninit::uninit(); | ||
let ret = from_glib(ffi::gdk_display_translate_key( | ||
self.to_glib_none().0, | ||
keycode, | ||
state.to_glib(), | ||
group, | ||
keyval.as_mut_ptr(), | ||
effective_group.as_mut_ptr(), | ||
level.as_mut_ptr(), | ||
consumed.as_mut_ptr(), | ||
)); | ||
let keyval: Key = keyval.assume_init().into(); | ||
let effective_group = effective_group.assume_init(); | ||
let level = level.assume_init(); | ||
let consumed = consumed.assume_init(); | ||
if ret { | ||
Some((keyval, effective_group, level, from_glib(consumed))) | ||
} else { | ||
None | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Take a look at the license at the top of the repository in the LICENSE file. | ||
|
||
use crate::{keys::Key, KeyEvent}; | ||
use glib::translate::*; | ||
|
||
impl KeyEvent { | ||
#[doc(alias = "gdk_key_event_get_keyval")] | ||
pub fn get_keyval(&self) -> Key { | ||
unsafe { ffi::gdk_key_event_get_keyval(self.to_glib_none().0).into() } | ||
} | ||
} |
Oops, something went wrong.