[gnome-games] ui: Update pause/resume when window change toplevel focus
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] ui: Update pause/resume when window change toplevel focus
- Date: Fri, 19 Aug 2016 19:59:00 +0000 (UTC)
commit 4bd031f4ef5cf040ec1b17f6be715818fbea2a8d
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri Aug 19 21:47:55 2016 +0200
ui: Update pause/resume when window change toplevel focus
Pause or resume the game when the window gains or looses toplevel focus rather than when the window's
state changes.
This avoids bugs not resuming the game when quickly switcing back to the
window with Alt+Tab.
https://bugzilla.gnome.org/show_bug.cgi?id=770142
data/ui/application-window.ui | 1 +
src/ui/application-window.vala | 5 ++---
2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/application-window.ui b/data/ui/application-window.ui
index b6593ca..107ecc7 100644
--- a/data/ui/application-window.ui
+++ b/data/ui/application-window.ui
@@ -10,6 +10,7 @@
<signal name="delete-event" after="yes" handler="on_delete_event"/>
<signal name="key-press-event" after="yes" handler="on_key_pressed"/>
<signal name="window-state-event" after="yes" handler="on_window_state_event"/>
+ <signal name="notify::has-toplevel-focus" after="yes" handler="on_toplevel_focus"/>
<child>
<object class="GtkStack" id="content_box">
<property name="visible">True</property>
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 76984d8..19fa571 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -155,8 +155,6 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
public bool on_window_state_event (Gdk.EventWindowState event) {
is_fullscreen = (bool) (event.new_window_state & Gdk.WindowState.FULLSCREEN);
- update_toplevel_focus ();
-
return false;
}
@@ -312,7 +310,8 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
return false;
}
- private void update_toplevel_focus () {
+ [GtkCallback]
+ private void on_toplevel_focus () {
if (ui_state != UiState.DISPLAY)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]