diff options
author | Bastien Nocera <hadess@hadess.net> | 2018-07-25 17:43:02 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2018-07-25 17:51:48 +0200 |
commit | ce36eca5c802690cb785066467b05b36c0aeb661 (patch) | |
tree | 81d163c4c396f82f8de972288caf098c6409fa49 | |
parent | 48e73122fe6a61cc5473254ffd6bad3cabaa3ad9 (diff) | |
download | gtk+-ce36eca5c802690cb785066467b05b36c0aeb661.tar.gz |
window: Warn when gtk_window_present_with_time() is passed 0
When 0 or GDK_CURRENT_TIME is passed to gtk_window_present_with_time(),
print a warning so that the application developer knows that this isn't
a supported use of the function, but carry on working for now.
-rw-r--r-- | gtk/gtkwindow.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index a094626816..5f776b0503 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -10467,6 +10467,7 @@ gtk_window_present_with_time (GtkWindow *window, GtkWindowPrivate *priv; GtkWidget *widget; GdkWindow *gdk_window; + static gsize warned_current_time = FALSE; g_return_if_fail (GTK_IS_WINDOW (window)); @@ -10484,6 +10485,15 @@ gtk_window_present_with_time (GtkWindow *window, /* Translate a timestamp of GDK_CURRENT_TIME appropriately */ if (timestamp == GDK_CURRENT_TIME) { + if (g_once_init_enter (&warned_current_time)) + { + gboolean warned = TRUE; + g_warning ("gtk_window_present_with_time() should not be called with 0, or " + "GDK_CURRENT_TIME as a timestamp, the timestamp should instead be " + "gathered at the time the user initiated the request for the window " + "to be shown"); + g_once_init_leave (&warned_current_time, warned); + } #ifdef GDK_WINDOWING_X11 if (GDK_IS_X11_WINDOW(gdk_window)) { |