mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
draft key navigation controller
This commit is contained in:
parent
085e28ae0d
commit
16dcd19cd0
1 changed files with 20 additions and 3 deletions
|
|
@ -38,13 +38,30 @@ impl Request {
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Detect primary icon on construct
|
|
||||||
update_primary_icon(&entry, profile);
|
update_primary_icon(&entry, profile);
|
||||||
|
|
||||||
// Init additional features
|
|
||||||
let suggestion = Rc::new(Suggestion::build(profile, &entry));
|
let suggestion = Rc::new(Suggestion::build(profile, &entry));
|
||||||
|
|
||||||
// Connect events
|
entry.add_controller({
|
||||||
|
use gtk::{gdk::Key, glib::Propagation};
|
||||||
|
let controller = gtk::EventControllerKey::builder().build();
|
||||||
|
controller.connect_key_pressed(|_, k, _, _| {
|
||||||
|
if k == Key::Down
|
||||||
|
|| k == Key::KP_Down
|
||||||
|
|| k == Key::Page_Down
|
||||||
|
|| k == Key::KP_Page_Down
|
||||||
|
|| k == Key::Up
|
||||||
|
|| k == Key::KP_Up
|
||||||
|
|| k == Key::Page_Up
|
||||||
|
|| k == Key::KP_Page_Up
|
||||||
|
{
|
||||||
|
return Propagation::Stop; // @TODO
|
||||||
|
}
|
||||||
|
Propagation::Proceed
|
||||||
|
});
|
||||||
|
controller
|
||||||
|
});
|
||||||
|
|
||||||
entry.connect_icon_release({
|
entry.connect_icon_release({
|
||||||
let profile = profile.clone();
|
let profile = profile.clone();
|
||||||
move |this, position| match position {
|
move |this, position| match position {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue