gdk: Add a private method to get a server timestamp

This is needed in the clipboard code. We don't make
it public, since that code is destined to eventually
live in gdk anyway.
This commit is contained in:
Matthias Clasen 2017-11-17 15:39:08 -05:00
parent fc579b121a
commit dbb18ad5d8
6 changed files with 36 additions and 0 deletions

View File

@ -317,6 +317,12 @@ gdk_broadway_display_get_setting (GdkDisplay *display,
return FALSE;
}
static guint32
gdk_broadway_display_get_last_seen_time (GdkDisplay *display)
{
return _gdk_broadway_server_get_last_seen_time (GDK_BROADWAY_DISPLAY (display)->server);
}
static void
gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
{
@ -364,4 +370,5 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->get_monitor = gdk_broadway_display_get_monitor;
display_class->get_primary_monitor = gdk_broadway_display_get_primary_monitor;
display_class->get_setting = gdk_broadway_display_get_setting;
display_class->get_last_seen_time = gdk_broadway_display_get_last_seen_time;
}

View File

@ -39,4 +39,6 @@ void gdk_window_move_to_rect (GdkWindow *window,
GObject * gdk_event_get_user_data (const GdkEvent *event);
guint32 gdk_display_get_last_seen_time (GdkDisplay *display);
#endif /* __GDK__PRIVATE_H__ */

View File

@ -2013,3 +2013,15 @@ gdk_display_setting_changed (GdkDisplay *display,
{
g_signal_emit (display, signals[SETTING_CHANGED], 0, name);
}
guint32
gdk_display_get_last_seen_time (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), GDK_CURRENT_TIME);
if (GDK_DISPLAY_GET_CLASS (display)->get_last_seen_time)
return GDK_DISPLAY_GET_CLASS (display)->get_last_seen_time (display);
return GDK_CURRENT_TIME;
}

View File

@ -219,6 +219,7 @@ struct _GdkDisplayClass
gboolean (*get_setting) (GdkDisplay *display,
const char *name,
GValue *value);
guint32 (*get_last_seen_time) (GdkDisplay *display);
/* Signals */
void (*opened) (GdkDisplay *display);

View File

@ -1208,6 +1208,12 @@ gdk_win32_display_get_setting (GdkDisplay *display,
return _gdk_win32_get_setting (name, value);
}
static guint32
gdk_win32_display_get_last_seen_time (GdkDisplay *display)
{
return GetMessageTime ();
}
static void
gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
{
@ -1266,6 +1272,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
#endif
display_class->get_setting = gdk_win32_display_get_setting;
display_class->get_last_seen_time = gdk_win32_display_get_last_seen_time;
_gdk_win32_windowing_init ();
}

View File

@ -3158,6 +3158,12 @@ gdk_x11_display_get_toplevel_windows (GdkDisplay *display)
return GDK_X11_DISPLAY (display)->toplevels;
}
static guint32
gdk_x11_display_get_last_seen_time (GdkDisplay *display)
{
return gdk_x11_get_server_time (GDK_X11_DISPLAY (display)->leader_gdk_window);
}
static void
gdk_x11_display_class_init (GdkX11DisplayClass * class)
{
@ -3215,6 +3221,7 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
display_class->get_monitor = gdk_x11_display_get_monitor;
display_class->get_primary_monitor = gdk_x11_display_get_primary_monitor;
display_class->get_setting = gdk_x11_display_get_setting;
display_class->get_last_seen_time = gdk_x11_display_get_last_seen_time;
_gdk_x11_windowing_init ();
}