[gnome-games/wip/exalm/pause] display-view: Remove pause delay
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/pause] display-view: Remove pause delay
- Date: Tue, 2 Jun 2020 20:13:32 +0000 (UTC)
commit 8c9c790ab4b0305d6d61fcc526568628439da703
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Wed Jun 3 01:12:08 2020 +0500
display-view: Remove pause delay
It was initially added to prevent momentary pauses when changing volume or
brightness. However, that has since been fixed in gnome-shell, and now the
delay just makes the app seem less responsive.
src/ui/application-window.vala | 4 ++--
src/ui/display-view.vala | 24 +-----------------------
2 files changed, 3 insertions(+), 25 deletions(-)
---
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 42087885..6ea48723 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -163,7 +163,7 @@ private class Games.ApplicationWindow : Hdy.ApplicationWindow {
is_fullscreen = (bool) (event.new_window_state & Gdk.WindowState.FULLSCREEN);
if (current_view == display_view)
- display_view.update_pause (false);
+ display_view.update_pause ();
if (!(bool) (event.changed_mask & Gdk.WindowState.FOCUSED))
return true;
@@ -214,7 +214,7 @@ private class Games.ApplicationWindow : Hdy.ApplicationWindow {
[GtkCallback]
private void on_active_changed () {
if (current_view == display_view)
- display_view.update_pause (true);
+ display_view.update_pause ();
}
private Gdk.Rectangle? get_geometry () {
diff --git a/src/ui/display-view.vala b/src/ui/display-view.vala
index af4e23ea..423f9a5b 100644
--- a/src/ui/display-view.vala
+++ b/src/ui/display-view.vala
@@ -131,7 +131,6 @@ private class Games.DisplayView : Gtk.Box, UiView {
private QuitDialog quit_dialog;
private RestartDialog restart_dialog;
- private long focus_out_timeout_id;
private ulong extra_widget_notify_block_autohide_id;
private Game game;
@@ -146,8 +145,6 @@ private class Games.DisplayView : Gtk.Box, UiView {
construct {
settings = new Settings ("org.gnome.Games");
- focus_out_timeout_id = -1;
-
action_group = new SimpleActionGroup ();
action_group.add_action_entries (action_entries, this);
window.insert_action_group ("display", action_group);
@@ -595,12 +592,7 @@ private class Games.DisplayView : Gtk.Box, UiView {
}
}
- public void update_pause (bool with_delay) {
- if (focus_out_timeout_id != -1) {
- Source.remove ((uint) focus_out_timeout_id);
- focus_out_timeout_id = -1;
- }
-
+ public void update_pause () {
if (!can_update_pause ())
return;
@@ -610,24 +602,10 @@ private class Games.DisplayView : Gtk.Box, UiView {
runner.get_display ().grab_focus ();
}
}
- else if (with_delay)
- focus_out_timeout_id = Timeout.add (FOCUS_OUT_DELAY_MILLISECONDS,
on_focus_out_delay_elapsed);
else
runner.pause ();
}
- private bool on_focus_out_delay_elapsed () {
- focus_out_timeout_id = -1;
-
- if (!can_update_pause ())
- return false;
-
- if (!window.is_active)
- runner.pause ();
-
- return false;
- }
-
private bool can_update_pause () {
if (runner == null)
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]