mirror of
https://github.com/brl/mutter.git
synced 2025-01-23 09:59:03 +00:00
core/place: Use logical monitor references instead of indices
Don't rely on the API exposing implementation details and replace it with the API that takes direct references. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
79fd91ec35
commit
0a4fb008f3
@ -90,7 +90,7 @@ find_next_cascade (MetaWindow *window,
|
|||||||
int window_width, window_height;
|
int window_width, window_height;
|
||||||
int cascade_stage;
|
int cascade_stage;
|
||||||
MetaRectangle work_area;
|
MetaRectangle work_area;
|
||||||
int current;
|
MetaLogicalMonitor *current;
|
||||||
|
|
||||||
sorted = g_list_copy (windows);
|
sorted = g_list_copy (windows);
|
||||||
sorted = g_list_sort (sorted, northwestcmp);
|
sorted = g_list_sort (sorted, northwestcmp);
|
||||||
@ -114,8 +114,8 @@ find_next_cascade (MetaWindow *window,
|
|||||||
* of NW corner of window frame.
|
* of NW corner of window frame.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
current = meta_screen_get_current_monitor (window->screen);
|
current = meta_screen_get_current_logical_monitor (window->screen);
|
||||||
meta_window_get_work_area_for_monitor (window, current, &work_area);
|
meta_window_get_work_area_for_logical_monitor (window, current, &work_area);
|
||||||
|
|
||||||
cascade_x = MAX (0, work_area.x);
|
cascade_x = MAX (0, work_area.x);
|
||||||
cascade_y = MAX (0, work_area.y);
|
cascade_y = MAX (0, work_area.y);
|
||||||
@ -479,14 +479,14 @@ center_tile_rect_in_area (MetaRectangle *rect,
|
|||||||
* don't want to create a 1x1 Emacs.
|
* don't want to create a 1x1 Emacs.
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
find_first_fit (MetaWindow *window,
|
find_first_fit (MetaWindow *window,
|
||||||
/* visible windows on relevant workspaces */
|
/* visible windows on relevant workspaces */
|
||||||
GList *windows,
|
GList *windows,
|
||||||
int monitor,
|
MetaLogicalMonitor *logical_monitor,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int *new_x,
|
int *new_x,
|
||||||
int *new_y)
|
int *new_y)
|
||||||
{
|
{
|
||||||
/* This algorithm is limited - it just brute-force tries
|
/* This algorithm is limited - it just brute-force tries
|
||||||
* to fit the window in a small number of locations that are aligned
|
* to fit the window in a small number of locations that are aligned
|
||||||
@ -518,16 +518,9 @@ find_first_fit (MetaWindow *window,
|
|||||||
|
|
||||||
#ifdef WITH_VERBOSE_MODE
|
#ifdef WITH_VERBOSE_MODE
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_get_backend ();
|
|
||||||
MetaMonitorManager *monitor_manager =
|
|
||||||
meta_backend_get_monitor_manager (backend);
|
|
||||||
MetaLogicalMonitor *logical_monitors;
|
|
||||||
char monitor_location_string[RECT_LENGTH];
|
char monitor_location_string[RECT_LENGTH];
|
||||||
|
|
||||||
logical_monitors =
|
meta_rectangle_to_string (&logical_monitor->rect,
|
||||||
meta_monitor_manager_get_logical_monitors (monitor_manager, NULL);
|
|
||||||
|
|
||||||
meta_rectangle_to_string (&logical_monitors[monitor].rect,
|
|
||||||
monitor_location_string);
|
monitor_location_string);
|
||||||
meta_topic (META_DEBUG_XINERAMA,
|
meta_topic (META_DEBUG_XINERAMA,
|
||||||
"Natural monitor is %s\n",
|
"Natural monitor is %s\n",
|
||||||
@ -535,7 +528,9 @@ find_first_fit (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
meta_window_get_work_area_for_monitor (window, monitor, &work_area);
|
meta_window_get_work_area_for_logical_monitor (window,
|
||||||
|
logical_monitor,
|
||||||
|
&work_area);
|
||||||
|
|
||||||
center_tile_rect_in_area (&rect, &work_area);
|
center_tile_rect_in_area (&rect, &work_area);
|
||||||
|
|
||||||
@ -877,9 +872,9 @@ meta_window_place (MetaWindow *window,
|
|||||||
MetaRectangle workarea;
|
MetaRectangle workarea;
|
||||||
MetaRectangle frame_rect;
|
MetaRectangle frame_rect;
|
||||||
|
|
||||||
meta_window_get_work_area_for_monitor (window,
|
meta_window_get_work_area_for_logical_monitor (window,
|
||||||
logical_monitor->number,
|
logical_monitor,
|
||||||
&workarea);
|
&workarea);
|
||||||
meta_window_get_frame_rect (window, &frame_rect);
|
meta_window_get_frame_rect (window, &frame_rect);
|
||||||
|
|
||||||
/* If the window is bigger than the screen, then automaximize. Do NOT
|
/* If the window is bigger than the screen, then automaximize. Do NOT
|
||||||
@ -897,7 +892,7 @@ meta_window_place (MetaWindow *window,
|
|||||||
y = logical_monitor->rect.y;
|
y = logical_monitor->rect.y;
|
||||||
|
|
||||||
if (find_first_fit (window, windows,
|
if (find_first_fit (window, windows,
|
||||||
logical_monitor->number,
|
logical_monitor,
|
||||||
x, y, &x, &y))
|
x, y, &x, &y))
|
||||||
goto done_check_denied_focus;
|
goto done_check_denied_focus;
|
||||||
|
|
||||||
@ -934,7 +929,7 @@ meta_window_place (MetaWindow *window,
|
|||||||
y = logical_monitor->rect.y;
|
y = logical_monitor->rect.y;
|
||||||
|
|
||||||
found_fit = find_first_fit (window, focus_window_list,
|
found_fit = find_first_fit (window, focus_window_list,
|
||||||
logical_monitor->number,
|
logical_monitor,
|
||||||
x, y, &x, &y);
|
x, y, &x, &y);
|
||||||
g_list_free (focus_window_list);
|
g_list_free (focus_window_list);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user