[gtk/issue-1961: 1/3] Add private getter for a monitor connector
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/issue-1961: 1/3] Add private getter for a monitor connector
- Date: Thu, 20 Jun 2019 14:57:40 +0000 (UTC)
commit 14750970b4e5f135c22f380690ad38822aadf4b8
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Jun 20 14:52:41 2019 +0100
Add private getter for a monitor connector
The migration from GdkScreen's monitor API to GdkMonitor left out a way
to get the connector's name of a monitor. While there's no real
guarantee that the connector's name is stable, some system components
used it to uniquely identify a monitor until the next plug in/out event.
Since GTK 3 is API stable, we can only add a private setter and getter
functions pair, without a property.
gdk/gdkmonitor.c | 27 +++++++++++++++++++++++++++
gdk/gdkmonitorprivate.h | 4 ++++
2 files changed, 31 insertions(+)
---
diff --git a/gdk/gdkmonitor.c b/gdk/gdkmonitor.c
index a768b591d0..9777cfcf85 100644
--- a/gdk/gdkmonitor.c
+++ b/gdk/gdkmonitor.c
@@ -155,6 +155,7 @@ gdk_monitor_finalize (GObject *object)
{
GdkMonitor *monitor = GDK_MONITOR (object);
+ g_free (monitor->connector);
g_free (monitor->manufacturer);
g_free (monitor->model);
@@ -354,6 +355,22 @@ gdk_monitor_get_height_mm (GdkMonitor *monitor)
return monitor->height_mm;
}
+/*< private >
+ * gdk_monitor_get_connector:
+ * @monitor: a #GdkMonitor
+ *
+ * Gets the name of the monitor's connector, if available.
+ *
+ * Returns: (transfer none) (nullable): the name of the connector
+ */
+const char *
+gdk_monitor_get_connector (GdkMonitor *monitor)
+{
+ g_return_val_if_fail (GDK_IS_MONITOR (monitor), NULL);
+
+ return monitor->connector;
+}
+
/**
* gdk_monitor_get_manufacturer:
* @monitor: a #GdkMonitor
@@ -493,6 +510,16 @@ gdk_monitor_set_model (GdkMonitor *monitor,
g_object_notify (G_OBJECT (monitor), "model");
}
+void
+gdk_monitor_set_connector (GdkMonitor *monitor,
+ const char *connector)
+{
+ g_free (monitor->connector);
+ monitor->connector = g_strdup (connector);
+
+ /* g_object_notify (G_OBJECT (monitor), "connector"); */
+}
+
void
gdk_monitor_set_position (GdkMonitor *monitor,
int x,
diff --git a/gdk/gdkmonitorprivate.h b/gdk/gdkmonitorprivate.h
index c76b59ce90..91219b2262 100644
--- a/gdk/gdkmonitorprivate.h
+++ b/gdk/gdkmonitorprivate.h
@@ -36,6 +36,7 @@ struct _GdkMonitor {
GdkDisplay *display;
char *manufacturer;
char *model;
+ char *connector;
GdkRectangle geometry;
int width_mm;
int height_mm;
@@ -57,6 +58,9 @@ void gdk_monitor_set_manufacturer (GdkMonitor *monitor,
const char *manufacturer);
void gdk_monitor_set_model (GdkMonitor *monitor,
const char *model);
+void gdk_monitor_set_connector (GdkMonitor *monitor,
+ const char *connector);
+const char * gdk_monitor_get_connector (GdkMonitor *monitor);
void gdk_monitor_set_position (GdkMonitor *monitor,
int x,
int y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]