mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
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
This commit is contained in:
parent
4e28a4d654
commit
74b97dcd14
@ -84,6 +84,8 @@ enum
|
|||||||
WORKSPACE_ADDED,
|
WORKSPACE_ADDED,
|
||||||
WORKSPACE_REMOVED,
|
WORKSPACE_REMOVED,
|
||||||
WORKSPACE_SWITCHED,
|
WORKSPACE_SWITCHED,
|
||||||
|
WINDOW_ENTERED_MONITOR,
|
||||||
|
WINDOW_LEFT_MONITOR,
|
||||||
STARTUP_SEQUENCE_CHANGED,
|
STARTUP_SEQUENCE_CHANGED,
|
||||||
WORKAREAS_CHANGED,
|
WORKAREAS_CHANGED,
|
||||||
MONITORS_CHANGED,
|
MONITORS_CHANGED,
|
||||||
@ -201,6 +203,28 @@ meta_screen_class_init (MetaScreenClass *klass)
|
|||||||
G_TYPE_INT,
|
G_TYPE_INT,
|
||||||
MUTTER_TYPE_MOTION_DIRECTION);
|
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] =
|
screen_signals[STARTUP_SEQUENCE_CHANGED] =
|
||||||
g_signal_new ("startup-sequence-changed",
|
g_signal_new ("startup-sequence-changed",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
@ -2822,6 +2846,21 @@ meta_screen_resize (MetaScreen *screen,
|
|||||||
screen->rect.width = width;
|
screen->rect.width = width;
|
||||||
screen->rect.height = height;
|
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);
|
reload_monitor_infos (screen);
|
||||||
set_desktop_geometry_hint (screen);
|
set_desktop_geometry_hint (screen);
|
||||||
|
|
||||||
|
@ -1085,6 +1085,8 @@ meta_window_new_with_attrs (MetaDisplay *display,
|
|||||||
meta_window_update_struts (window);
|
meta_window_update_struts (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_signal_emit_by_name (window->screen, "window-entered-monitor", window->monitor->number, window);
|
||||||
|
|
||||||
/* Must add window to stack before doing move/resize, since the
|
/* Must add window to stack before doing move/resize, since the
|
||||||
* window might have fullscreen size (i.e. should have been
|
* window might have fullscreen size (i.e. should have been
|
||||||
* fullscreen'd; acrobat is one such braindead case; it withdraws
|
* fullscreen'd; acrobat is one such braindead case; it withdraws
|
||||||
@ -1465,6 +1467,13 @@ meta_window_unmanage (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (window->monitor)
|
||||||
|
{
|
||||||
|
g_signal_emit_by_name (window->screen, "window-left-monitor",
|
||||||
|
window->monitor->number, window);
|
||||||
|
window->monitor = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!window->override_redirect)
|
if (!window->override_redirect)
|
||||||
meta_stack_remove (window->screen->stack, window);
|
meta_stack_remove (window->screen->stack, window);
|
||||||
|
|
||||||
@ -4104,6 +4113,10 @@ meta_window_update_monitor (MetaWindow *window)
|
|||||||
meta_window_is_on_primary_monitor (window) &&
|
meta_window_is_on_primary_monitor (window) &&
|
||||||
window->screen->active_workspace != window->workspace)
|
window->screen->active_workspace != window->workspace)
|
||||||
meta_window_change_workspace (window, window->screen->active_workspace);
|
meta_window_change_workspace (window, window->screen->active_workspace);
|
||||||
|
|
||||||
|
if (old)
|
||||||
|
g_signal_emit_by_name (window->screen, "window-left-monitor", old->number, window);
|
||||||
|
g_signal_emit_by_name (window->screen, "window-entered-monitor", window->monitor->number, window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1,2 @@
|
|||||||
VOID:INT,INT,ENUM
|
VOID:INT,INT,ENUM
|
||||||
|
VOID:INT,OBJECT
|
||||||
|
Loading…
Reference in New Issue
Block a user