[gtk+] gdk: Add a private method to get a server timestamp
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk: Add a private method to get a server timestamp
- Date: Fri, 17 Nov 2017 20:41:38 +0000 (UTC)
commit dbb18ad5d88584b14bffea31bd9f8327d2d859dd
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Nov 17 15:39:08 2017 -0500
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.
gdk/broadway/gdkdisplay-broadway.c | 7 +++++++
gdk/gdk-private.h | 2 ++
gdk/gdkdisplay.c | 12 ++++++++++++
gdk/gdkdisplayprivate.h | 1 +
gdk/win32/gdkdisplay-win32.c | 7 +++++++
gdk/x11/gdkdisplay-x11.c | 7 +++++++
6 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index 0d8dbc8..c5eede1 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -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;
}
diff --git a/gdk/gdk-private.h b/gdk/gdk-private.h
index 1455464..0c7ca66 100644
--- a/gdk/gdk-private.h
+++ b/gdk/gdk-private.h
@@ -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__ */
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index dfe9e3e..ae09c25 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -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;
+}
+
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index f2927ab..d35f484 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -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);
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index b3b6013..4643f16 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -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 ();
}
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index a9d30fc..4e022c6 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -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 ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]