mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
Don't calculate the main window monitor every time it`s needed
The main monitor of a window is maintained as 'window->monitor' and is updated when the window is resized or moved. Lets avoid calculating it every time it`s needed. https://bugzilla.gnome.org/show_bug.cgi?id=744934
This commit is contained in:
parent
441efd17ce
commit
14b0a83f64
@ -3186,7 +3186,7 @@ handle_move_to_monitor (MetaDisplay *display,
|
||||
gint which = binding->handler->data;
|
||||
const MetaMonitorInfo *current, *new;
|
||||
|
||||
current = meta_screen_get_monitor_for_window (screen, window);
|
||||
current = window->monitor;
|
||||
new = meta_screen_get_monitor_neighbor (screen, current->number, which);
|
||||
|
||||
if (new == NULL)
|
||||
|
@ -149,8 +149,8 @@ const MetaMonitorInfo* meta_screen_get_current_monitor_info_for_pos (MetaScree
|
||||
int y);
|
||||
const MetaMonitorInfo* meta_screen_get_monitor_for_rect (MetaScreen *screen,
|
||||
MetaRectangle *rect);
|
||||
const MetaMonitorInfo* meta_screen_get_monitor_for_window (MetaScreen *screen,
|
||||
MetaWindow *window);
|
||||
const MetaMonitorInfo* meta_screen_calculate_monitor_for_window (MetaScreen *screen,
|
||||
MetaWindow *window);
|
||||
|
||||
|
||||
const MetaMonitorInfo* meta_screen_get_monitor_neighbor (MetaScreen *screen,
|
||||
|
@ -1439,8 +1439,8 @@ meta_screen_get_monitor_for_rect (MetaScreen *screen,
|
||||
}
|
||||
|
||||
const MetaMonitorInfo*
|
||||
meta_screen_get_monitor_for_window (MetaScreen *screen,
|
||||
MetaWindow *window)
|
||||
meta_screen_calculate_monitor_for_window (MetaScreen *screen,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaRectangle window_rect;
|
||||
|
||||
|
@ -288,8 +288,7 @@ windows_on_different_monitor (MetaWindow *a,
|
||||
if (a->screen != b->screen)
|
||||
return TRUE;
|
||||
|
||||
return meta_screen_get_monitor_for_window (a->screen, a) !=
|
||||
meta_screen_get_monitor_for_window (b->screen, b);
|
||||
return a->monitor != b->monitor;
|
||||
}
|
||||
|
||||
/* Get layer ignoring any transient or group relationships */
|
||||
|
@ -981,7 +981,8 @@ _meta_window_shared_new (MetaDisplay *display,
|
||||
|
||||
window->compositor_private = NULL;
|
||||
|
||||
window->monitor = meta_screen_get_monitor_for_window (window->screen, window);
|
||||
window->monitor = meta_screen_calculate_monitor_for_window (window->screen,
|
||||
window);
|
||||
window->preferred_output_winsys_id = window->monitor->winsys_id;
|
||||
|
||||
window->tile_match = NULL;
|
||||
@ -3546,7 +3547,8 @@ meta_window_update_monitor (MetaWindow *window,
|
||||
const MetaMonitorInfo *old;
|
||||
|
||||
old = window->monitor;
|
||||
window->monitor = meta_screen_get_monitor_for_window (window->screen, window);
|
||||
window->monitor = meta_screen_calculate_monitor_for_window (window->screen,
|
||||
window);
|
||||
if (old != window->monitor)
|
||||
{
|
||||
meta_window_on_all_workspaces_changed (window);
|
||||
@ -5638,7 +5640,7 @@ update_move (MetaWindow *window,
|
||||
int monitor;
|
||||
|
||||
window->tile_mode = META_TILE_NONE;
|
||||
wmonitor = meta_screen_get_monitor_for_window (window->screen, window);
|
||||
wmonitor = window->monitor;
|
||||
|
||||
for (monitor = 0; monitor < window->screen->n_monitor_infos; monitor++)
|
||||
{
|
||||
@ -6047,12 +6049,8 @@ void
|
||||
meta_window_get_work_area_current_monitor (MetaWindow *window,
|
||||
MetaRectangle *area)
|
||||
{
|
||||
const MetaMonitorInfo *monitor = NULL;
|
||||
monitor = meta_screen_get_monitor_for_window (window->screen,
|
||||
window);
|
||||
|
||||
meta_window_get_work_area_for_monitor (window,
|
||||
monitor->number,
|
||||
window->monitor->number,
|
||||
area);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user