summaryrefslogtreecommitdiff
path: root/src/core/screen.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2011-02-28 21:26:11 +0100
committerAlexander Larsson <alexl@redhat.com>2011-03-17 13:48:54 +0100
commit74b97dcd141c0c5a8c722369c9875d2880f144c6 (patch)
treed6010a3cbe9f1700f38ef30745b591e2cc91ddcb /src/core/screen.c
parent4e28a4d65444dedd74350b9319a4bb174b9d41bd (diff)
downloadmutter-74b97dcd141c0c5a8c722369c9875d2880f144c6.tar.gz
Add signals for when windows change monitors
This is useful in order to track e.g. which windows are on the primary monitor. https://bugzilla.gnome.org/show_bug.cgi?id=609258
Diffstat (limited to 'src/core/screen.c')
-rw-r--r--src/core/screen.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/core/screen.c b/src/core/screen.c
index 8affdd041..59dd254a1 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -84,6 +84,8 @@ enum
WORKSPACE_ADDED,
WORKSPACE_REMOVED,
WORKSPACE_SWITCHED,
+ WINDOW_ENTERED_MONITOR,
+ WINDOW_LEFT_MONITOR,
STARTUP_SEQUENCE_CHANGED,
WORKAREAS_CHANGED,
MONITORS_CHANGED,
@@ -201,6 +203,28 @@ meta_screen_class_init (MetaScreenClass *klass)
G_TYPE_INT,
MUTTER_TYPE_MOTION_DIRECTION);
+ screen_signals[WINDOW_ENTERED_MONITOR] =
+ g_signal_new ("window-entered-monitor",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _mutter_marshal_VOID__INT_OBJECT,
+ G_TYPE_NONE, 2,
+ G_TYPE_INT,
+ META_TYPE_WINDOW);
+
+ screen_signals[WINDOW_LEFT_MONITOR] =
+ g_signal_new ("window-left-monitor",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _mutter_marshal_VOID__INT_OBJECT,
+ G_TYPE_NONE, 2,
+ G_TYPE_INT,
+ META_TYPE_WINDOW);
+
screen_signals[STARTUP_SEQUENCE_CHANGED] =
g_signal_new ("startup-sequence-changed",
G_TYPE_FROM_CLASS (klass),
@@ -2822,6 +2846,21 @@ meta_screen_resize (MetaScreen *screen,
screen->rect.width = width;
screen->rect.height = height;
+ /* Clear monitor for all windows on this screen, as it will become
+ * invalid. */
+ windows = meta_display_list_windows (screen->display,
+ META_LIST_INCLUDE_OVERRIDE_REDIRECT);
+ for (tmp = windows; tmp != NULL; tmp = tmp->next)
+ {
+ MetaWindow *window = tmp->data;
+
+ if (window->screen == screen)
+ {
+ g_signal_emit_by_name (screen, "window-left-monitor", window->monitor->number, window);
+ window->monitor = NULL;
+ }
+ }
+
reload_monitor_infos (screen);
set_desktop_geometry_hint (screen);