diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-06-20 18:19:34 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-06-20 18:19:34 +0000 |
commit | 6e30650fe40a12844718fe8e6b571b514e40d8e5 (patch) | |
tree | 00d85dcb25164f316cfd2698bd267167ec15925e /gtk/gtkwindow.c | |
parent | ae80a9bec39638dfd48638237649db88f4e37844 (diff) | |
download | gtk+-6e30650fe40a12844718fe8e6b571b514e40d8e5.tar.gz |
Variant of gtk_window_present which takes a timestamp. (#166379, Elijah
2005-06-20 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk.symbols:
* gtk/gtkwindow.h:
* gtk/gtkwindow.c (gtk_window_present_with_time): Variant of
gtk_window_present which takes a timestamp. (#166379, Elijah Newren)
Diffstat (limited to 'gtk/gtkwindow.c')
-rw-r--r-- | gtk/gtkwindow.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 5f7f4f499f..47f5601805 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -5999,11 +5999,43 @@ gtk_window_set_frame_dimensions (GtkWindow *window, * currently open, and the user chooses Preferences from the menu * a second time; use gtk_window_present() to move the already-open dialog * where the user can see it. + * + * If you are calling this function in response to a user interaction, + * it is preferable to use gdk_window_present_with_time(). * **/ void gtk_window_present (GtkWindow *window) { + guint32 timestamp; +#ifdef GDK_WINDOWING_X11 + GdkDisplay *display; + + display = gtk_widget_get_display (GTK_WIDGET (window)); + timestamp = gdk_x11_display_get_user_time (display); +#else + timestamp = gtk_get_current_event_time (); +#endif + + gtk_window_present_with_time (window, timestamp); +} + +/** + * gtk_window_present_with_time: + * @window: a #GtkWindow + * @timestamp: the timestamp of the user interaction (typically a + * button or key press event) which triggered this call + * + * Presents a window to the user in response to a user interaction. + * If you need to present a window without a timestamp, use + * gtk_window_present(). See gtk_window_present() for details. + * + * Since: 2.8 + **/ +void +gtk_window_present_with_time (GtkWindow *window, + guint32 timestamp) +{ GtkWidget *widget; g_return_if_fail (GTK_IS_WINDOW (window)); @@ -6019,13 +6051,7 @@ gtk_window_present (GtkWindow *window) /* note that gdk_window_focus() will also move the window to * the current desktop, for WM spec compliant window managers. */ -#ifdef GDK_WINDOWING_X11 - gdk_window_focus (widget->window, - gdk_x11_display_get_user_time (gtk_widget_get_display (widget))); -#else - gdk_window_focus (widget->window, - gtk_get_current_event_time ()); -#endif + gdk_window_focus (widget->window, timestamp); } else { |