[mutter] core/place: Use logical monitor references instead of indices
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] core/place: Use logical monitor references instead of indices
- Date: Wed, 25 Jan 2017 08:30:48 +0000 (UTC)
commit 0a4fb008f3d84a97c0e697696eb4732e76453d91
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Nov 29 11:51:15 2016 +0800
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
src/core/place.c | 43 +++++++++++++++++++------------------------
1 files changed, 19 insertions(+), 24 deletions(-)
---
diff --git a/src/core/place.c b/src/core/place.c
index 38118cf..6e6f1eb 100644
--- a/src/core/place.c
+++ b/src/core/place.c
@@ -90,7 +90,7 @@ find_next_cascade (MetaWindow *window,
int window_width, window_height;
int cascade_stage;
MetaRectangle work_area;
- int current;
+ MetaLogicalMonitor *current;
sorted = g_list_copy (windows);
sorted = g_list_sort (sorted, northwestcmp);
@@ -114,8 +114,8 @@ find_next_cascade (MetaWindow *window,
* of NW corner of window frame.
*/
- current = meta_screen_get_current_monitor (window->screen);
- meta_window_get_work_area_for_monitor (window, current, &work_area);
+ current = meta_screen_get_current_logical_monitor (window->screen);
+ meta_window_get_work_area_for_logical_monitor (window, current, &work_area);
cascade_x = MAX (0, work_area.x);
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.
*/
static gboolean
-find_first_fit (MetaWindow *window,
+find_first_fit (MetaWindow *window,
/* visible windows on relevant workspaces */
- GList *windows,
- int monitor,
- int x,
- int y,
- int *new_x,
- int *new_y)
+ GList *windows,
+ MetaLogicalMonitor *logical_monitor,
+ int x,
+ int y,
+ int *new_x,
+ int *new_y)
{
/* This algorithm is limited - it just brute-force tries
* 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
{
- MetaBackend *backend = meta_get_backend ();
- MetaMonitorManager *monitor_manager =
- meta_backend_get_monitor_manager (backend);
- MetaLogicalMonitor *logical_monitors;
char monitor_location_string[RECT_LENGTH];
- logical_monitors =
- meta_monitor_manager_get_logical_monitors (monitor_manager, NULL);
-
- meta_rectangle_to_string (&logical_monitors[monitor].rect,
+ meta_rectangle_to_string (&logical_monitor->rect,
monitor_location_string);
meta_topic (META_DEBUG_XINERAMA,
"Natural monitor is %s\n",
@@ -535,7 +528,9 @@ find_first_fit (MetaWindow *window,
}
#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);
@@ -877,9 +872,9 @@ meta_window_place (MetaWindow *window,
MetaRectangle workarea;
MetaRectangle frame_rect;
- meta_window_get_work_area_for_monitor (window,
- logical_monitor->number,
- &workarea);
+ meta_window_get_work_area_for_logical_monitor (window,
+ logical_monitor,
+ &workarea);
meta_window_get_frame_rect (window, &frame_rect);
/* 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;
if (find_first_fit (window, windows,
- logical_monitor->number,
+ logical_monitor,
x, y, &x, &y))
goto done_check_denied_focus;
@@ -934,7 +929,7 @@ meta_window_place (MetaWindow *window,
y = logical_monitor->rect.y;
found_fit = find_first_fit (window, focus_window_list,
- logical_monitor->number,
+ logical_monitor,
x, y, &x, &y);
g_list_free (focus_window_list);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]