[geary/wip/remove_present_workaround] Remove workaround for gtk_window_present_with_time() under Wayland



commit 160934b56bb2324d0ffc36aa48a4c8c0be3f95db
Author: Michael Gratton <mike vee net>
Date:   Mon Mar 25 18:42:30 2019 +1100

    Remove workaround for gtk_window_present_with_time() under Wayland
    
    See GNOME/gtk#624

 meson.build                                   |   2 +-
 src/client/application/geary-application.vala | 110 ++++++++++++--------------
 src/client/application/geary-controller.vala  |   6 +-
 src/client/composer/composer-container.vala   |   7 +-
 4 files changed, 53 insertions(+), 72 deletions(-)
---
diff --git a/meson.build b/meson.build
index 479e5743..777a873f 100644
--- a/meson.build
+++ b/meson.build
@@ -42,7 +42,7 @@ add_project_arguments([
 #
 
 target_glib = '2.54' # Also passed to valac, so don't include a point rev
-target_gtk = '3.22.26'
+target_gtk = '3.24.7'
 target_webkit = '2.20'
 
 # Primary deps
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index b891af11..3d551e21 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -216,67 +216,6 @@ public class GearyApplication : Gtk.Application {
             create_async.begin();
     }
 
-    public bool present() {
-        if (controller == null || controller.main_window == null)
-            return false;
-
-        // Use present_with_time and a synthesised time so the present
-        // actually works, as a work around for Bug 766284
-        // <https://bugzilla.gnome.org/show_bug.cgi?id=766284>.
-        // Subtract 1000ms from the current time to avoid the main
-        // window stealing the focus when presented just before
-        // showing a dialog (issue #43, bgo 726282).
-        this.controller.main_window.present_with_time(
-            (uint32) (get_monotonic_time() / 1000) - 1000
-        );
-
-        return true;
-    }
-
-    private async void create_async() {
-        // Manually keep the main loop around for the duration of this call.
-        // Without this, the main loop will exit as soon as we hit the yield
-        // below, before we create the main window.
-        hold();
-
-        // do *after* parsing args, as they dicate where logging is sent to, if anywhere, and only
-        // after activate (which means this is only logged for the one user-visible instance, not
-        // the other instances called when sending commands to the app via the command-line)
-        message("%s %s prefix=%s exec_dir=%s is_installed=%s", NAME, VERSION, INSTALL_PREFIX,
-            exec_dir.get_path(), is_installed().to_string());
-
-        config = new Configuration(APP_ID);
-
-        // Application accels
-        add_app_accelerators(ACTION_COMPOSE, { "<Ctrl>N" });
-        add_app_accelerators(ACTION_HELP, { "F1" });
-        add_app_accelerators(ACTION_QUIT, { "<Ctrl>Q" });
-
-        // Common window accels
-        add_window_accelerators(ACTION_CLOSE, { "<Ctrl>W" });
-        add_window_accelerators(ACTION_COPY, { "<Ctrl>C" });
-        add_window_accelerators(ACTION_HELP_OVERLAY, { "<Ctrl>F1", "<Ctrl>question" });
-        add_window_accelerators(ACTION_REDO, { "<Ctrl><Shift>Z" });
-        add_window_accelerators(ACTION_UNDO, { "<Ctrl>Z" });
-
-        ComposerWidget.add_window_accelerators(this);
-
-        yield controller.open_async(null);
-
-        release();
-    }
-
-    private async void destroy_async() {
-        // see create_async() for reasoning hold/release is used
-        hold();
-
-        yield controller.close_async();
-
-        release();
-
-        is_destroyed = true;
-    }
-
     public void add_window_accelerators(string action,
                                         string[] accelerators,
                                         Variant? param = null) {
@@ -440,6 +379,55 @@ public class GearyApplication : Gtk.Application {
         set_accels_for_action("app." + action, accelerators);
     }
 
+    private bool present() {
+        if (controller == null || controller.main_window == null)
+            return false;
+
+        this.controller.main_window.present();
+        return true;
+    }
+
+    private async void create_async() {
+        // Manually keep the main loop around for the duration of this call.
+        // Without this, the main loop will exit as soon as we hit the yield
+        // below, before we create the main window.
+        hold();
+
+        // do *after* parsing args, as they dicate where logging is sent to, if anywhere, and only
+        // after activate (which means this is only logged for the one user-visible instance, not
+        // the other instances called when sending commands to the app via the command-line)
+        message("%s %s prefix=%s exec_dir=%s is_installed=%s", NAME, VERSION, INSTALL_PREFIX,
+            exec_dir.get_path(), is_installed().to_string());
+
+        config = new Configuration(APP_ID);
+
+        // Application accels
+        add_app_accelerators(ACTION_COMPOSE, { "<Ctrl>N" });
+        add_app_accelerators(ACTION_HELP, { "F1" });
+        add_app_accelerators(ACTION_QUIT, { "<Ctrl>Q" });
+
+        // Common window accels
+        add_window_accelerators(ACTION_CLOSE, { "<Ctrl>W" });
+        add_window_accelerators(ACTION_COPY, { "<Ctrl>C" });
+        add_window_accelerators(ACTION_HELP_OVERLAY, { "<Ctrl>F1", "<Ctrl>question" });
+        add_window_accelerators(ACTION_REDO, { "<Ctrl><Shift>Z" });
+        add_window_accelerators(ACTION_UNDO, { "<Ctrl>Z" });
+
+        ComposerWidget.add_window_accelerators(this);
+
+        yield controller.open_async(null);
+
+        release();
+    }
+
+    private async void destroy_async() {
+        // see create_async() for reasoning hold/release is used
+        hold();
+        yield controller.close_async();
+        release();
+        is_destroyed = true;
+    }
+
     private void on_activate_about() {
         Gtk.show_about_dialog(get_active_window(),
             "program-name", NAME,
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index f08f7991..b0f6fde2 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -764,7 +764,6 @@ public class GearyController : Geary.BaseObject {
             context.authentication_prompting = false;
         } else {
             context.authentication_prompting = true;
-            this.application.present();
             PasswordDialog password_dialog = new PasswordDialog(
                 this.application.get_active_window(),
                 account,
@@ -1255,7 +1254,7 @@ public class GearyController : Geary.BaseObject {
     }
 
     private void on_indicator_activated_application(uint32 timestamp) {
-        this.application.present();
+        this.main_window.present();
     }
 
     private void on_indicator_activated_composer(uint32 timestamp) {
@@ -2225,8 +2224,8 @@ public class GearyController : Geary.BaseObject {
 
         // Find out what to do with the inline composers.
         // TODO: Remove this in favor of automatically saving drafts
-        this.application.present();
         Gee.List<ComposerWidget> composers_to_destroy = new Gee.ArrayList<ComposerWidget>();
+        this.main_window.present();
         foreach (ComposerWidget cw in composer_widgets) {
             if (cw.state != ComposerWidget.ComposerState.DETACHED)
                 composers_to_destroy.add(cw);
@@ -2408,7 +2407,6 @@ public class GearyController : Geary.BaseObject {
     }
 
     private bool confirm_delete(int num_messages) {
-        this.application.present();
         ConfirmationDialog dialog = new ConfirmationDialog(main_window, ngettext(
             "Do you want to permanently delete this message?",
             "Do you want to permanently delete these messages?", num_messages),
diff --git a/src/client/composer/composer-container.vala b/src/client/composer/composer-container.vala
index 466e8166..fe79d653 100644
--- a/src/client/composer/composer-container.vala
+++ b/src/client/composer/composer-container.vala
@@ -19,12 +19,7 @@ public interface ComposerContainer {
     public abstract Gtk.ApplicationWindow top_window { get; }
 
     public virtual void present() {
-        // Use present_with_time and a synthesised time so the present
-        // actually works, as a work around for Bug 766284
-        // <https://bugzilla.gnome.org/show_bug.cgi?id=766284>.
-        this.top_window.present_with_time(
-            (uint32) (get_monotonic_time() / 1000)
-        );
+        this.top_window.present();
     }
 
     public virtual unowned Gtk.Widget get_focus() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]