Make gtkclipboard.c:clipboard_get_timestamp multi-backend safe

We can't just check for the backend defines, we have to do runtime checks too.
This commit is contained in:
Alexander Larsson 2011-04-07 20:19:30 +02:00
parent d12a9a5e99
commit 9db4accf9c

View File

@ -34,6 +34,10 @@
#include "x11/gdkx.h"
#endif
#ifdef GDK_WINDOWING_BROADWAY
#include "broadway/gdkbroadway.h"
#endif
#ifdef GDK_WINDOWING_WIN32
#include "win32/gdkwin32.h"
#endif
@ -412,14 +416,35 @@ clipboard_get_timestamp (GtkClipboard *clipboard)
{
GtkWidget *clipboard_widget = get_clipboard_widget (clipboard->display);
guint32 timestamp = gtk_get_current_event_time ();
GdkWindow *window;
if (timestamp == GDK_CURRENT_TIME)
{
window = gtk_widget_get_window (clipboard_widget);
#ifdef GDK_WINDOWING_X11
timestamp = gdk_x11_get_server_time (gtk_widget_get_window (clipboard_widget));
#elif defined GDK_WINDOWING_WIN32
timestamp = GetMessageTime ();
if (GDK_IS_X11_WINDOW (window))
{
timestamp = gdk_x11_get_server_time (gtk_widget_get_window (clipboard_widget));
}
else
#endif
#if defined GDK_WINDOWING_WIN32
if (GDK_IS_WIN32_WINDOW (window))
{
timestamp = GetMessageTime ();
}
else
#endif
#if defined GDK_WINDOWING_BROADWAY
if (GDK_IS_BROADWAY_WINDOW (window))
{
timestamp = gdk_broadway_get_last_seen_time (window);
}
else
#endif
{
/* No implementation */
}
}
else
{