Fix MainWindow shift button detection
Ensure shift button is assumed to be up on both focus in and focus out, so when e.g. invoking the inspector the button is assumed to be released. Remove the signal in preference for using notifiy when needed, and ensure main toolbar state is updated on focus changes as well.
This commit is contained in:
parent
ce86e3aa50
commit
f9cf70cc0e
2 changed files with 10 additions and 10 deletions
|
|
@ -258,9 +258,6 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
|
|||
/** Fired when the user requests an account status be retried. */
|
||||
public signal void retry_service_problem(Geary.ClientService.Status problem);
|
||||
|
||||
/** Fired when the shift key is pressed or released. */
|
||||
public signal void on_shift_key(bool pressed);
|
||||
|
||||
|
||||
public MainWindow(GearyApplication application) {
|
||||
Object(
|
||||
|
|
@ -1247,6 +1244,13 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
|
|||
}
|
||||
}
|
||||
|
||||
private void set_shift_key_down(bool down) {
|
||||
this.is_shift_down = down;
|
||||
this.main_toolbar.update_trash_button(
|
||||
!down && this.selected_folder_supports_trash
|
||||
);
|
||||
}
|
||||
|
||||
private inline void check_shift_event(Gdk.EventKey event) {
|
||||
// FIXME: it's possible the user will press two shift keys. We want
|
||||
// the shift key to report as released when they release ALL of them.
|
||||
|
|
@ -1255,12 +1259,7 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
|
|||
Gtk.Widget? focus = get_focus();
|
||||
if (focus == null ||
|
||||
(!(focus is Gtk.Entry) && !(focus is ComposerWebView))) {
|
||||
this.is_shift_down = (event.type == Gdk.EventType.KEY_PRESS);
|
||||
this.main_toolbar.update_trash_button(
|
||||
!this.is_shift_down &&
|
||||
selected_folder_supports_trash()
|
||||
);
|
||||
on_shift_key(this.is_shift_down);
|
||||
set_shift_key_down(event.type == Gdk.EventType.KEY_PRESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1308,7 +1307,7 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
|
|||
|
||||
[GtkCallback]
|
||||
private bool on_focus_event() {
|
||||
on_shift_key(false);
|
||||
this.set_shift_key_down(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
<property name="show_menubar">False</property>
|
||||
<signal name="delete-event" handler="on_delete_event" swapped="no"/>
|
||||
<signal name="focus-in-event" handler="on_focus_event" swapped="no"/>
|
||||
<signal name="focus-out-event" handler="on_focus_event" swapped="no"/>
|
||||
<signal name="map" handler="on_map" swapped="no"/>
|
||||
<signal name="unmap" handler="on_unmap" swapped="no"/>
|
||||
<child type="titlebar">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue