client: Ensure keyboard focus is not lost when main window leaflets fold
See GNOME/libhandy#179
This commit is contained in:
parent
2222c6af87
commit
1667a7b2da
2 changed files with 29 additions and 4 deletions
|
|
@ -2113,10 +2113,33 @@ public class Application.MainWindow :
|
||||||
update_conversation_actions(
|
update_conversation_actions(
|
||||||
ConversationCount.for_size(selected)
|
ConversationCount.for_size(selected)
|
||||||
);
|
);
|
||||||
if (this.has_composer &&
|
if (this.outer_leaflet.folded) {
|
||||||
this.outer_leaflet.folded &&
|
// Ensure something useful gets the keyboard focus, given
|
||||||
(this.is_folder_list_shown || this.is_conversation_list_shown)) {
|
// GNOME/libhandy#179
|
||||||
close_composer(false, false);
|
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="hexpand_set">True</property>
|
||||||
<property name="can_swipe_back">True</property>
|
<property name="can_swipe_back">True</property>
|
||||||
<property name="transition_type">over</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>
|
<child>
|
||||||
<object class="GtkBox" id="folder_box">
|
<object class="GtkBox" id="folder_box">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue