summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2015-03-22 14:41:54 +0100
committerFlorian Müllner <fmuellner@gnome.org>2015-04-14 23:13:19 +0200
commit2e3086e2aa59d3cea5e0814516b3d5cb04143302 (patch)
tree9374c1bcd71c6d146d49a21d83aa494630546dab
parentf424056feaccd5ed0ef526211b0cc33fdc879f63 (diff)
screen: Add public method to get neighboring monitor
The existing private get_monitor_neighbor() function returns a MetaMonitorInfo, which is private as well. Add a public wrapper that returns a monitor index instead, as we do for other public monitor-related methods. https://bugzilla.gnome.org/show_bug.cgi?id=633994
-rw-r--r--src/core/screen-private.h8
-rw-r--r--src/core/screen.c10
-rw-r--r--src/meta/screen.h19
3 files changed, 29 insertions, 8 deletions
diff --git a/src/core/screen-private.h b/src/core/screen-private.h
index 322dfb46..bc3b5ac2 100644
--- a/src/core/screen-private.h
+++ b/src/core/screen-private.h
@@ -41,14 +41,6 @@
typedef void (* MetaScreenWindowFunc) (MetaWindow *window,
gpointer user_data);
-typedef enum
-{
- META_SCREEN_UP,
- META_SCREEN_DOWN,
- META_SCREEN_LEFT,
- META_SCREEN_RIGHT
-} MetaScreenDirection;
-
#define META_WIREFRAME_XOR_LINE_WIDTH 2
struct _MetaScreen
diff --git a/src/core/screen.c b/src/core/screen.c
index e515072f..49df7116 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1490,6 +1490,16 @@ meta_screen_get_monitor_neighbor (MetaScreen *screen,
return NULL;
}
+int
+meta_screen_get_monitor_neighbor_index (MetaScreen *screen,
+ int which_monitor,
+ MetaScreenDirection direction)
+{
+ const MetaMonitorInfo *monitor;
+ monitor = meta_screen_get_monitor_neighbor (screen, which_monitor, direction);
+ return monitor ? monitor->number : -1;
+}
+
void
meta_screen_get_natural_monitor_list (MetaScreen *screen,
int** monitors_list,
diff --git a/src/meta/screen.h b/src/meta/screen.h
index 500871b6..a1835cd0 100644
--- a/src/meta/screen.h
+++ b/src/meta/screen.h
@@ -66,6 +66,21 @@ int meta_screen_get_active_workspace_index (MetaScreen *screen);
MetaWorkspace * meta_screen_get_active_workspace (MetaScreen *screen);
+/**
+ * MetaScreenDirection:
+ * @META_SCREEN_UP: up
+ * @META_SCREEN_DOWN: down
+ * @META_SCREEN_LEFT: left
+ * @META_SCREEN_RIGHT: right
+ */
+typedef enum
+{
+ META_SCREEN_UP,
+ META_SCREEN_DOWN,
+ META_SCREEN_LEFT,
+ META_SCREEN_RIGHT
+} MetaScreenDirection;
+
int meta_screen_get_n_monitors (MetaScreen *screen);
int meta_screen_get_primary_monitor (MetaScreen *screen);
int meta_screen_get_current_monitor (MetaScreen *screen);
@@ -82,6 +97,10 @@ gboolean meta_screen_get_monitor_in_fullscreen (MetaScreen *screen,
int meta_screen_get_monitor_index_for_rect (MetaScreen *screen,
MetaRectangle *rect);
+int meta_screen_get_monitor_neighbor_index (MetaScreen *screen,
+ int which_monitor,
+ MetaScreenDirection dir);
+
void meta_screen_focus_default_window (MetaScreen *screen,
guint32 timestamp);