[gtk+/wip/matthiasc/monitor] Add primary as convenience api
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/monitor] Add primary as convenience api
- Date: Sun, 3 Apr 2016 14:51:34 +0000 (UTC)
commit 08fef8929e190310ee32a6175566acfa7bed1ed9
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Apr 2 19:06:28 2016 -0400
Add primary as convenience api
gdk/gdkmonitor.c | 10 ++++++++--
gdk/gdkmonitor.h | 22 ++++++++++++----------
2 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/gdk/gdkmonitor.c b/gdk/gdkmonitor.c
index f432790..1701a79 100644
--- a/gdk/gdkmonitor.c
+++ b/gdk/gdkmonitor.c
@@ -27,11 +27,9 @@
/*
* TODO:
- * - primary
* - workarea
* - monitor type (laptop, projector, ...)
* - consider vfuncs instead of baseclass storage
- * - consider array instead of list
* - provide a persistent id (if the backend allows)
*/
enum {
@@ -285,6 +283,14 @@ gdk_monitor_get_subpixel_layout (GdkMonitor *monitor)
return monitor->subpixel_layout;
}
+gboolean
+gdk_monitor_is_primary (GdkMonitor *monitor)
+{
+ g_return_val_if_fail (GDK_IS_MONITOR (monitor), FALSE);
+
+ return monitor == gdk_display_get_primary_monitor (monitor->display);
+}
+
GdkMonitor *
gdk_monitor_new (GdkDisplay *display)
{
diff --git a/gdk/gdkmonitor.h b/gdk/gdkmonitor.h
index 1540427..1407b7f 100644
--- a/gdk/gdkmonitor.h
+++ b/gdk/gdkmonitor.h
@@ -49,27 +49,29 @@ typedef enum {
} GdkSubpixelLayout;
GDK_AVAILABLE_IN_3_22
-GType gdk_monitor_get_type (void) G_GNUC_CONST;
+GType gdk_monitor_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_3_22
-GdkDisplay *gdk_monitor_get_display (GdkMonitor *monitor);
+GdkDisplay * gdk_monitor_get_display (GdkMonitor *monitor);
GDK_AVAILABLE_IN_3_22
-void gdk_monitor_get_geometry (GdkMonitor *monitor,
- GdkRectangle *geometry);
+void gdk_monitor_get_geometry (GdkMonitor *monitor,
+ GdkRectangle *geometry);
GDK_AVAILABLE_IN_3_22
-int gdk_monitor_get_width_mm (GdkMonitor *monitor);
+int gdk_monitor_get_width_mm (GdkMonitor *monitor);
GDK_AVAILABLE_IN_3_22
-int gdk_monitor_get_height_mm (GdkMonitor *monitor);
+int gdk_monitor_get_height_mm (GdkMonitor *monitor);
GDK_AVAILABLE_IN_3_22
-const char * gdk_monitor_get_manufacturer (GdkMonitor *monitor);
+const char * gdk_monitor_get_manufacturer (GdkMonitor *monitor);
GDK_AVAILABLE_IN_3_22
-const char * gdk_monitor_get_model (GdkMonitor *monitor);
+const char * gdk_monitor_get_model (GdkMonitor *monitor);
GDK_AVAILABLE_IN_3_22
-int gdk_monitor_get_scale_factor (GdkMonitor *monitor);
+int gdk_monitor_get_scale_factor (GdkMonitor *monitor);
GDK_AVAILABLE_IN_3_22
-int gdk_monitor_get_refresh_rate (GdkMonitor *monitor);
+int gdk_monitor_get_refresh_rate (GdkMonitor *monitor);
GDK_AVAILABLE_IN_3_22
GdkSubpixelLayout gdk_monitor_get_subpixel_layout (GdkMonitor *monitor);
+GDK_AVAILABLE_IN_3_22
+gboolean gdk_monitor_is_primary (GdkMonitor *monitor);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]