Let the MetaWindow calculate its main logical monitor itself
There is no point in going via a MetaScreen API to calculate the "main monitor" of a window, so let the window do that calculation itself. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
5a8509f895
commit
98ee85ce82
@ -130,9 +130,6 @@ void meta_screen_hide_tile_preview (MetaScreen *screen);
|
||||
MetaWindow* meta_screen_get_mouse_window (MetaScreen *screen,
|
||||
MetaWindow *not_this_one);
|
||||
|
||||
MetaLogicalMonitor * meta_screen_calculate_logical_monitor_for_window (MetaScreen *screen,
|
||||
MetaWindow *window);
|
||||
|
||||
MetaLogicalMonitor * meta_screen_get_monitor_neighbor (MetaScreen *screen,
|
||||
int which_monitor,
|
||||
MetaScreenDirection dir);
|
||||
|
@ -1401,21 +1401,6 @@ meta_screen_get_mouse_window (MetaScreen *screen,
|
||||
return window;
|
||||
}
|
||||
|
||||
MetaLogicalMonitor *
|
||||
meta_screen_calculate_logical_monitor_for_window (MetaScreen *screen,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaRectangle window_rect;
|
||||
|
||||
meta_window_get_frame_rect (window, &window_rect);
|
||||
|
||||
return meta_monitor_manager_get_logical_monitor_from_rect (monitor_manager,
|
||||
&window_rect);
|
||||
}
|
||||
|
||||
int
|
||||
meta_screen_get_monitor_index_for_rect (MetaScreen *screen,
|
||||
MetaRectangle *rect)
|
||||
|
@ -829,6 +829,19 @@ meta_window_main_monitor_changed (MetaWindow *window,
|
||||
window->monitor->number, window);
|
||||
}
|
||||
|
||||
MetaLogicalMonitor *
|
||||
meta_window_calculate_main_logical_monitor (MetaWindow *window)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaRectangle window_rect;
|
||||
|
||||
meta_window_get_frame_rect (window, &window_rect);
|
||||
return meta_monitor_manager_get_logical_monitor_from_rect (monitor_manager,
|
||||
&window_rect);
|
||||
}
|
||||
|
||||
MetaWindow *
|
||||
_meta_window_shared_new (MetaDisplay *display,
|
||||
MetaScreen *screen,
|
||||
@ -1026,8 +1039,7 @@ _meta_window_shared_new (MetaDisplay *display,
|
||||
|
||||
window->compositor_private = NULL;
|
||||
|
||||
window->monitor =
|
||||
meta_screen_calculate_logical_monitor_for_window (window->screen, window);
|
||||
window->monitor = meta_window_calculate_main_logical_monitor (window);
|
||||
window->preferred_output_winsys_id = window->monitor->winsys_id;
|
||||
|
||||
window->tile_match = NULL;
|
||||
|
@ -361,7 +361,7 @@ meta_window_wayland_update_main_monitor (MetaWindow *window)
|
||||
* needed to avoid jumping back and forth between the new and the old, since
|
||||
* changing main monitor may cause the window to be resized so that it no
|
||||
* longer have that same new main monitor. */
|
||||
to = meta_screen_calculate_logical_monitor_for_window (window->screen, window);
|
||||
to = meta_window_calculate_main_logical_monitor (window);
|
||||
|
||||
if (from == to)
|
||||
return;
|
||||
|
@ -1457,8 +1457,7 @@ meta_window_x11_update_icon (MetaWindow *window,
|
||||
static void
|
||||
meta_window_x11_update_main_monitor (MetaWindow *window)
|
||||
{
|
||||
window->monitor =
|
||||
meta_screen_calculate_logical_monitor_for_window (window->screen, window);
|
||||
window->monitor = meta_window_calculate_main_logical_monitor (window);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user