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



commit e5775bb67428fd4fd109c9449ca0622774d815a4
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 | 29 ++++++++++-----------------
 src/client/application/geary-controller.vala  |  6 ++----
 src/client/composer/composer-container.vala   |  7 +------
 4 files changed, 15 insertions(+), 29 deletions(-)
---
diff --git a/meson.build b/meson.build
index 23162d87..feefd259 100644
--- a/meson.build
+++ b/meson.build
@@ -43,7 +43,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 1032e510..3d0e3aba 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -426,23 +426,6 @@ public class GearyApplication : Gtk.Application {
         }
     }
 
-    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
@@ -728,7 +711,17 @@ public class GearyApplication : Gtk.Application {
         return -1;
     }
 
-    /** Removes and re-adds the austostart file if needed. */
+    private bool present() {
+        bool ret = false;
+        if (this.controller != null &&
+            this.controller.main_window != null) {
+            this.controller.main_window.present();
+            ret = true;
+        }
+        return ret;
+    }
+
+    /** Removes and re-adds the autostart file if needed. */
     private async void update_autostart_file() {
         try {
             this.autostart.delete_startup_file();
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index a624362b..82cc170c 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -805,7 +805,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,
@@ -1289,7 +1288,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) {
@@ -2245,8 +2244,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);
@@ -2427,7 +2426,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]