[gnome-panel/wip/geiger/geometry: 1/6] Add panel-monitor



commit 5ad3a5b9ef7d10171c3f268f087854ca46cd4764
Author: Sebastian Geiger <sbastig gmx net>
Date:   Fri Feb 16 23:22:52 2018 +0100

    Add panel-monitor

 gnome-panel/Makefile.am     |    2 ++
 gnome-panel/panel-monitor.c |   34 ++++++++++++++++++++++++++++++++++
 gnome-panel/panel-monitor.h |   25 +++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 0 deletions(-)
---
diff --git a/gnome-panel/Makefile.am b/gnome-panel/Makefile.am
index 1df0258..63b3ffb 100644
--- a/gnome-panel/Makefile.am
+++ b/gnome-panel/Makefile.am
@@ -46,6 +46,7 @@ panel_sources =                       \
        panel-toplevel.c        \
        panel-struts.c          \
        panel-xutils.c          \
+       panel-monitor.c \
        panel-multiscreen.c     \
        panel-a11y.c            \
        panel-bindings.c        \
@@ -84,6 +85,7 @@ panel_headers =                       \
        panel-toplevel.h        \
        panel-struts.h          \
        panel-xutils.h          \
+       panel-monitor.h \
        panel-multiscreen.h     \
        panel-a11y.h            \
        panel-bindings.h        \
diff --git a/gnome-panel/panel-monitor.c b/gnome-panel/panel-monitor.c
new file mode 100644
index 0000000..42708e1
--- /dev/null
+++ b/gnome-panel/panel-monitor.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2018 Sebastian Geiger
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "panel-monitor.h"
+
+guint
+panel_monitor_get_index (GdkMonitor *monitor)
+{
+  GdkDisplay *display;
+
+  g_assert (monitor);
+
+  display = gdk_display_get_default ();
+
+  for (guint i = 0; i < gdk_display_get_n_monitors (display); i++)
+    {
+      if (monitor == gdk_display_get_monitor (display, i))
+        return i;
+    }
+}
diff --git a/gnome-panel/panel-monitor.h b/gnome-panel/panel-monitor.h
new file mode 100644
index 0000000..682cb4d
--- /dev/null
+++ b/gnome-panel/panel-monitor.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2018 Sebastian Geiger
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef PANEL_MONITOR_H
+#define PANEL_MONITOR_H
+
+#include <gtk/gtk.h>
+
+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]