Commit 1667a7b2 authored by Michael Gratton's avatar Michael Gratton 🍸 Committed by Michael Gratton
Browse files

client: Ensure keyboard focus is not lost when main window leaflets fold

See libhandy#179
parent 2222c6af
......@@ -2113,10 +2113,33 @@ public class Application.MainWindow :
update_conversation_actions(
ConversationCount.for_size(selected)
);
if (this.has_composer &&
this.outer_leaflet.folded &&
(this.is_folder_list_shown || this.is_conversation_list_shown)) {
close_composer(false, false);
if (this.outer_leaflet.folded) {
// Ensure something useful gets the keyboard focus, given
// GNOME/libhandy#179
if (this.is_conversation_list_shown) {
this.conversation_list_view.grab_focus();
} else if (this.is_folder_list_shown) {
this.folder_list.grab_focus();
}
// Close any open composer that is no longer visible
if (this.has_composer &&
(this.is_folder_list_shown || this.is_conversation_list_shown)) {
close_composer(false, false);
}
}
}
[GtkCallback]
private void on_inner_leaflet_changed() {
if (this.inner_leaflet.folded) {
// Ensure something useful gets the keyboard focus, given
// GNOME/libhandy#179
if (this.is_conversation_list_shown) {
this.conversation_list_view.grab_focus();
} else if (this.is_folder_list_shown) {
this.folder_list.grab_focus();
}
}
}
......
......@@ -30,6 +30,8 @@
<property name="hexpand_set">True</property>
<property name="can_swipe_back">True</property>
<property name="transition_type">over</property>
<signal name="notify::folded" handler="on_inner_leaflet_changed" swapped="no"/>
<signal name="notify::visible-child" handler="on_inner_leaflet_changed" swapped="no"/>
<child>
<object class="GtkBox" id="folder_box">
<property name="visible">True</property>
......
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