diff --git a/src/core/place.c b/src/core/place.c index 7f21f6fc2..7a5eb0907 100644 --- a/src/core/place.c +++ b/src/core/place.c @@ -137,7 +137,7 @@ find_next_cascade (MetaWindow *window, */ current = meta_screen_get_current_monitor (window->screen); - meta_window_get_work_area_for_monitor (window, current->number, &work_area); + meta_window_get_work_area_for_monitor (window, current, &work_area); cascade_x = MAX (0, work_area.x); cascade_y = MAX (0, work_area.y); @@ -815,7 +815,7 @@ meta_window_place (MetaWindow *window, int w, h; /* Warning, this function is a round trip! */ - xi = meta_screen_get_current_monitor (window->screen); + xi = meta_screen_get_current_monitor_info (window->screen); w = xi->rect.width; h = xi->rect.height; @@ -860,7 +860,7 @@ meta_window_place (MetaWindow *window, } /* Warning, this is a round trip! */ - xi = meta_screen_get_current_monitor (window->screen); + xi = meta_screen_get_current_monitor_info (window->screen); /* "Origin" placement algorithm */ x = xi->rect.x; diff --git a/src/core/screen-private.h b/src/core/screen-private.h index bd1917bff..4576f2866 100644 --- a/src/core/screen-private.h +++ b/src/core/screen-private.h @@ -184,7 +184,7 @@ void meta_screen_tile_preview_hide (MetaScreen *screen); MetaWindow* meta_screen_get_mouse_window (MetaScreen *screen, MetaWindow *not_this_one); -const MetaMonitorInfo* meta_screen_get_current_monitor (MetaScreen *screen); +const MetaMonitorInfo* meta_screen_get_current_monitor_info (MetaScreen *screen); const MetaMonitorInfo* meta_screen_get_monitor_for_rect (MetaScreen *screen, MetaRectangle *rect); const MetaMonitorInfo* meta_screen_get_monitor_for_window (MetaScreen *screen, diff --git a/src/core/screen.c b/src/core/screen.c index 328328f4d..ec6169418 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -2054,7 +2054,7 @@ meta_screen_get_natural_monitor_list (MetaScreen *screen, visited[i] = FALSE; } - current = meta_screen_get_current_monitor (screen); + current = meta_screen_get_current_monitor_info (screen); monitor_queue = g_queue_new (); g_queue_push_tail (monitor_queue, (gpointer) current); visited[current->number] = TRUE; @@ -2121,6 +2121,22 @@ meta_screen_get_natural_monitor_list (MetaScreen *screen, } const MetaMonitorInfo* +meta_screen_get_current_monitor_info (MetaScreen *screen) +{ + int monitor_index; + monitor_index = meta_screen_get_current_monitor (screen); + return &screen->monitor_infos[monitor_index]; +} + +/** + * meta_screen_get_current_monitor: + * @screen: a #MetaScreen + * + * Gets the index of the monitor that currently has the mouse pointer. + * + * Return value: a monitor index + */ +int meta_screen_get_current_monitor (MetaScreen *screen) { if (screen->n_monitor_infos == 1) @@ -2166,7 +2182,7 @@ meta_screen_get_current_monitor (MetaScreen *screen) screen->last_monitor_index); } - return &screen->monitor_infos[screen->last_monitor_index]; + return screen->last_monitor_index; } /** diff --git a/src/core/window.c b/src/core/window.c index b0330246c..8da7d72d1 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -3682,7 +3682,7 @@ meta_window_can_tile_side_by_side (MetaWindow *window) return FALSE; monitor = meta_screen_get_current_monitor (window->screen); - meta_window_get_work_area_for_monitor (window, monitor->number, &tile_area); + meta_window_get_work_area_for_monitor (window, monitor, &tile_area); /* Do not allow tiling in portrait orientation */ if (tile_area.height > tile_area.width) @@ -8620,7 +8620,7 @@ update_move (MetaWindow *window, * refers to the monitor which contains the largest part of the window, * the latter to the one where the pointer is located. */ - monitor = meta_screen_get_current_monitor (window->screen); + monitor = meta_screen_get_current_monitor_info (window->screen); meta_window_get_work_area_for_monitor (window, monitor->number, &work_area); diff --git a/src/meta/screen.h b/src/meta/screen.h index 06297cc53..4fd239197 100644 --- a/src/meta/screen.h +++ b/src/meta/screen.h @@ -77,6 +77,7 @@ MetaWorkspace * meta_screen_get_active_workspace (MetaScreen *screen); int meta_screen_get_n_monitors (MetaScreen *screen); int meta_screen_get_primary_monitor (MetaScreen *screen); +int meta_screen_get_current_monitor (MetaScreen *screen); void meta_screen_get_monitor_geometry (MetaScreen *screen, int monitor, MetaRectangle *geometry);