Focus on message entry after clicking on a username

Fix #182
parent b26ffa94
......@@ -1221,12 +1221,16 @@ impl AppOp {
{
let mb = widgets::MessageBox::new(r, &msg, &self);
let entry = msg_entry.clone();
mb.username_event_box.set_focus_on_click(false);
mb.username_event_box.connect_button_press_event(move |eb, _| {
if let Some(label) = eb.get_children().iter().nth(0) {
if let Ok(l) = label.clone().downcast::<gtk::Label>() {
if let Some(t) = l.get_text() {
let mut pos = entry.get_position();
entry.insert_text(&t[..], &mut pos);
pos = entry.get_text_length() as i32;
entry.set_position(pos);
entry.grab_focus_without_selecting();
}
}
}
......@@ -1239,6 +1243,8 @@ impl AppOp {
}
}
m.set_focus_on_click(false);
match msgpos {
MsgPos::Bottom => messages.add(&m),
MsgPos::Top => messages.insert(&m, 1),
......@@ -2135,6 +2141,9 @@ impl AppOp {
if let Some(ref a) = m.alias {
let mut pos = msg.get_position();
msg.insert_text(&a.clone(), &mut pos);
pos = msg.get_text_length() as i32;
msg.grab_focus_without_selecting();
msg.set_position(pos);
}
glib::signal::Inhibit(true)
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment