[gnome-flashback] end-session-dialog: use x11 server time when displaying dialog
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] end-session-dialog: use x11 server time when displaying dialog
- Date: Mon, 14 Sep 2015 00:30:11 +0000 (UTC)
commit bc63ac5dd2488e4706394bad20e3a694da15bed3
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Sep 13 22:41:22 2015 +0300
end-session-dialog: use x11 server time when displaying dialog
https://bugzilla.gnome.org/show_bug.cgi?id=754965
.../flashback-inhibit-dialog.c | 28 ++++++++++++++++++++
.../flashback-inhibit-dialog.h | 4 +++
.../libend-session-dialog/gf-end-session-dialog.c | 16 +++++------
3 files changed, 39 insertions(+), 9 deletions(-)
---
diff --git a/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.c
b/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.c
index f3f8f60..c78600f 100644
--- a/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.c
+++ b/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.c
@@ -889,3 +889,31 @@ flashback_inhibit_dialog_close (FlashbackInhibitDialog *dialog)
gtk_window_close (GTK_WINDOW (dialog));
}
+
+void
+flashback_inhibit_dialog_present (FlashbackInhibitDialog *dialog,
+ guint32 timestamp)
+{
+ GtkWidget *widget;
+ GdkWindow *window;
+ guint32 server_time;
+
+ if (timestamp != 0)
+ {
+ gtk_window_present_with_time (GTK_WINDOW (dialog), timestamp);
+
+ return;
+ }
+
+ widget = GTK_WIDGET (dialog);
+
+ gtk_widget_show (widget);
+
+ window = gtk_widget_get_window (widget);
+ server_time = GDK_CURRENT_TIME;
+
+ if (window != NULL)
+ server_time = gdk_x11_get_server_time (window);
+
+ gtk_window_present_with_time (GTK_WINDOW (dialog), server_time);
+}
diff --git a/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.h
b/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.h
index 64831a3..3a5f235 100644
--- a/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.h
+++ b/gnome-flashback/libend-session-dialog/flashback-inhibit-dialog.h
@@ -68,6 +68,10 @@ GtkWidget *flashback_inhibit_dialog_new (gint action,
void flashback_inhibit_dialog_response (FlashbackInhibitDialog *dialog,
gint response_id);
void flashback_inhibit_dialog_close (FlashbackInhibitDialog *dialog);
+
+void flashback_inhibit_dialog_present (FlashbackInhibitDialog *dialog,
+ guint32 timestamp);
+
G_END_DECLS
#endif
diff --git a/gnome-flashback/libend-session-dialog/gf-end-session-dialog.c
b/gnome-flashback/libend-session-dialog/gf-end-session-dialog.c
index 15cd24b..b09564d 100644
--- a/gnome-flashback/libend-session-dialog/gf-end-session-dialog.c
+++ b/gnome-flashback/libend-session-dialog/gf-end-session-dialog.c
@@ -109,19 +109,19 @@ handle_open (DBusEndSessionDialog *object,
gpointer user_data)
{
GfEndSessionDialog *dialog;
+ FlashbackInhibitDialog *inhibit_dialog;
dialog = GF_END_SESSION_DIALOG (user_data);
if (dialog->dialog != NULL)
{
+ inhibit_dialog = FLASHBACK_INHIBIT_DIALOG (dialog->dialog);
+
g_object_set (dialog->dialog,
"inhibitor-paths", inhibitor_object_paths,
NULL);
- if (timestamp != 0)
- gtk_window_present_with_time (GTK_WINDOW (dialog->dialog), timestamp);
- else
- gtk_window_present (GTK_WINDOW (dialog->dialog));
+ flashback_inhibit_dialog_present (inhibit_dialog, timestamp);
dbus_end_session_dialog_complete_open (object, invocation);
@@ -131,6 +131,8 @@ handle_open (DBusEndSessionDialog *object,
dialog->dialog = flashback_inhibit_dialog_new (type, seconds_to_stay_open,
inhibitor_object_paths);
+ inhibit_dialog = FLASHBACK_INHIBIT_DIALOG (dialog->dialog);
+
g_signal_connect (dialog->dialog, "response",
G_CALLBACK (inhibit_dialog_response), object);
g_signal_connect (dialog->dialog, "destroy",
@@ -141,11 +143,7 @@ handle_open (DBusEndSessionDialog *object,
g_signal_connect (object, "closed",
G_CALLBACK (closed), dialog);
- if (timestamp != 0)
- gtk_window_present_with_time (GTK_WINDOW (dialog->dialog), timestamp);
- else
- gtk_window_present (GTK_WINDOW (dialog->dialog));
-
+ flashback_inhibit_dialog_present (inhibit_dialog, timestamp);
dbus_end_session_dialog_complete_open (object, invocation);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]