fix keys
This commit is contained in:
parent
9fd576e48c
commit
47f3d82265
15
src/lib.rs
15
src/lib.rs
|
|
@ -227,10 +227,17 @@ pub fn build_ui(app: >k::Application, config: &Arc<Config>) {
|
|||
log_area.get_buffer().expect("Couldn't get window").set_text("");
|
||||
None
|
||||
})),
|
||||
"send_entry_activate" => Box::new(clone!(@weak config, @weak bar => @default-return None, move |a| {
|
||||
let ent = a[0].get::<gtk::Entry>().unwrap().unwrap();
|
||||
putil::send_text(&config, &ent, &bar);
|
||||
None
|
||||
"send_entry_key_press_event" => Box::new(clone!(@weak config, @weak bar => @default-return None, move |a| {
|
||||
let ev = a[1].get::<gdk::Event>().unwrap().unwrap();
|
||||
if let Some(val) = ev.get_keyval() {
|
||||
if let Some(val) = gdk::keys::keyval_name(val) {
|
||||
if val == "Return" {
|
||||
let ent = a[0].get::<gtk::Entry>().unwrap().unwrap();
|
||||
putil::send_text(&config, &ent, &bar);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(false.to_value())
|
||||
})),
|
||||
"send_btn_clicked" => Box::new(clone!(@weak config, @weak bar, @weak send_entry => @default-return None, move |_| {
|
||||
putil::send_text(&config, &send_entry, &bar);
|
||||
|
|
|
|||
2
ui.glade
2
ui.glade
|
|
@ -663,7 +663,7 @@
|
|||
<object class="GtkEntry" id="send_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<signal name="activate" handler="send_entry_activate" swapped="no"/>
|
||||
<signal name="key-press-event" handler="send_entry_key_press_event" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
|
|
|||
Loading…
Reference in New Issue