[geary/geary-0.12] Work around present() not actually raising windows under Wayland.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/geary-0.12] Work around present() not actually raising windows under Wayland.
- Date: Wed, 11 Apr 2018 02:30:01 +0000 (UTC)
commit 287fb888bae915b2d356d96424a7b9d46439c075
Author: Michael James Gratton <mike vee net>
Date: Wed Feb 7 15:01:34 2018 +1100
Work around present() not actually raising windows under Wayland.
This uses the method of using present_with_time() with value instead of
Gdk.CURRENT_TIME as the arg value, as suggested in Bug 766284.
Fixes Bug 776881 under Wayland, maybe also under X11.
* src/client/application/geary-application.vala (GearyApplication),
src/client/composer/composer-container.vala (ComposerContainer):
Use workaround in present().
* src/client/application/geary-controller.vala (GearyController),
src/client/application/secret-mediator.vala (SecretMediator):
Use GearyApplication.present() instead of calling it directly on the
main window, as needed.
* src/client/composer/composer-embed.vala (ComposerEmbed): Just use the
base class's present rather that duplicating the old implementation.
src/client/application/geary-application.vala | 8 +++++++-
src/client/application/geary-controller.vala | 16 ++++++++--------
src/client/application/secret-mediator.vala | 2 +-
src/client/composer/composer-container.vala | 7 ++++++-
src/client/composer/composer-embed.vala | 4 ----
5 files changed, 22 insertions(+), 15 deletions(-)
---
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index fecacf6..54f6ab6 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -226,7 +226,13 @@ public class GearyApplication : Gtk.Application {
// When the app is started hidden, show_all() never gets
// called, do so here to prevent an empty window appearing.
controller.main_window.show_all();
- controller.main_window.present();
+
+ // Use present_with_time and a made up time so the present
+ // actually works, as a work around for Bug 766284
+ // <https://bugzilla.gnome.org/show_bug.cgi?id=766284>.
+ this.controller.main_window.present_with_time(
+ (uint32) (get_real_time() / 1000)
+ );
return true;
}
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 3012403..8998fcd 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -1519,14 +1519,14 @@ public class GearyController : Geary.BaseObject {
if (conversation != null)
main_window.conversation_list_view.select_conversation(conversation);
}
-
+
private void on_indicator_activated_application(uint32 timestamp) {
// When the app is started hidden, show_all() never gets
// called, do so here to prevent an empty window appearing.
main_window.show_all();
- main_window.present_with_time(timestamp);
+ this.application.present();
}
-
+
private void on_indicator_activated_composer(uint32 timestamp) {
on_indicator_activated_application(timestamp);
on_new_message();
@@ -2375,7 +2375,7 @@ public class GearyController : Geary.BaseObject {
// Find out what to do with the inline composers.
// TODO: Remove this in favor of automatically saving drafts
- main_window.present();
+ this.application.present();
ConfirmationDialog dialog = new ConfirmationDialog(main_window, _("Close open draft messages?"),
null, Stock._CLOSE, "destructive-action");
if (dialog.run() == Gtk.ResponseType.OK) {
@@ -2544,17 +2544,17 @@ public class GearyController : Geary.BaseObject {
&& !current_folder.properties.is_local_only && current_account != null
&& (current_folder as Geary.FolderSupport.Move) != null);
}
-
+
public bool confirm_delete(int num_messages) {
- main_window.present();
+ 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),
null, _("Delete"), "destructive-action");
-
+
return (dialog.run() == Gtk.ResponseType.OK);
}
-
+
private async void archive_or_delete_selection_async(bool archive, bool trash,
Cancellable? cancellable) throws Error {
if (!can_switch_conversation_view())
diff --git a/src/client/application/secret-mediator.vala b/src/client/application/secret-mediator.vala
index 7f45248..3f5bd00 100644
--- a/src/client/application/secret-mediator.vala
+++ b/src/client/application/secret-mediator.vala
@@ -114,7 +114,7 @@ public class SecretMediator : Geary.CredentialsMediator, Object {
Gtk.Window? main_window = GearyApplication.instance.controller.main_window;
if (main_window != null && !main_window.visible) {
main_window.show_all();
- main_window.present_with_time(Gdk.CURRENT_TIME);
+ GearyApplication.instance.present();
}
PasswordDialog password_dialog = new PasswordDialog(main_window, services.has_smtp(),
diff --git a/src/client/composer/composer-container.vala b/src/client/composer/composer-container.vala
index da82724..5091fb9 100644
--- a/src/client/composer/composer-container.vala
+++ b/src/client/composer/composer-container.vala
@@ -25,7 +25,12 @@ public interface ComposerContainer {
public abstract Gtk.ApplicationWindow top_window { get; }
public virtual void present() {
- this.top_window.present();
+ // Use present_with_time and a made up 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_real_time() / 1000)
+ );
}
public virtual unowned Gtk.Widget get_focus() {
diff --git a/src/client/composer/composer-embed.vala b/src/client/composer/composer-embed.vala
index 37d67bc..460e164 100644
--- a/src/client/composer/composer-embed.vala
+++ b/src/client/composer/composer-embed.vala
@@ -186,10 +186,6 @@ public class ComposerEmbed : Gtk.EventBox, ComposerContainer {
return ret;
}
- public void present() {
- top_window.present();
- }
-
public void vanish() {
hide();
this.composer.state = ComposerWidget.ComposerState.DETACHED;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]