From d6f0d2c64ce7342e770a071a3ca8b24df2c140e7 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 28 Feb 2011 15:21:35 +0100 Subject: [PATCH] Add API to get the monitor of a window https://bugzilla.gnome.org/show_bug.cgi?id=609258 --- src/core/window.c | 14 ++++++++++++++ src/meta/window.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/core/window.c b/src/core/window.c index 1bf47997f..5c845c29e 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -3995,6 +3995,20 @@ move_attached_dialog (MetaWindow *window, return FALSE; } +/** + * meta_window_get_monitor: + * @window: a #MetaWindow + * + * Gets index of the monitor that this window is on. + * + * Return Value: The index of the monitor in the screens monitor list + */ +int +meta_window_get_monitor (MetaWindow *window) +{ + return window->monitor->number; +} + void meta_window_update_monitor (MetaWindow *window) { diff --git a/src/meta/window.h b/src/meta/window.h index 467434f55..060cc1e96 100644 --- a/src/meta/window.h +++ b/src/meta/window.h @@ -81,6 +81,7 @@ Window meta_window_get_xwindow (MetaWindow *window); MetaWindowType meta_window_get_window_type (MetaWindow *window); Atom meta_window_get_window_type_atom (MetaWindow *window); MetaWorkspace *meta_window_get_workspace (MetaWindow *window); +int meta_window_get_monitor (MetaWindow *window); gboolean meta_window_is_on_all_workspaces (MetaWindow *window); gboolean meta_window_is_hidden (MetaWindow *window); void meta_window_activate (MetaWindow *window,guint32 current_time);