[gnome-panel/wip/geiger/geometry: 3/6] panel-monitor: add get_geometry



commit 45175b944a5816b4e2e5f11483a1b786c7b2150c
Author: Sebastian Geiger <sbastig gmx net>
Date:   Sun Feb 18 00:07:25 2018 +0100

    panel-monitor: add get_geometry

 gnome-panel/panel-monitor.c |   19 +++++++++++++++++++
 gnome-panel/panel-monitor.h |    6 ++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/gnome-panel/panel-monitor.c b/gnome-panel/panel-monitor.c
index 42708e1..0c09f11 100644
--- a/gnome-panel/panel-monitor.c
+++ b/gnome-panel/panel-monitor.c
@@ -17,6 +17,25 @@
 
 #include "panel-monitor.h"
 
+void
+panel_monitor_get_geometry (int monitor_index,
+                            int *x,
+                            int *y,
+                            int *height,
+                            int *width)
+{
+  GdkMonitor *monitor = gdk_display_get_monitor (gdk_display_get_default (), monitor_index);
+
+  GdkRectangle geometry;
+
+  gdk_monitor_get_geometry (monitor, &geometry);
+
+  if (x) *x = geometry.x;
+  if (y) *y = geometry.y;
+  if (height) *height = geometry.height;
+  if (width) *width = geometry.width;
+}
+
 guint
 panel_monitor_get_index (GdkMonitor *monitor)
 {
diff --git a/gnome-panel/panel-monitor.h b/gnome-panel/panel-monitor.h
index 682cb4d..1671d76 100644
--- a/gnome-panel/panel-monitor.h
+++ b/gnome-panel/panel-monitor.h
@@ -20,6 +20,12 @@
 
 #include <gtk/gtk.h>
 
+void panel_monitor_get_geometry (int monitor_index,
+                                 int *x,
+                                 int *y,
+                                 int *height,
+                                 int *width);
+
 guint panel_monitor_get_index (GdkMonitor *monitor);
 
 #endif //PANEL_MONITOR_H


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]