From 24965a78dad106037a94dddaa8d1828f7040257c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 3 Aug 2022 22:55:56 +0200 Subject: [PATCH] window: Make monitor from rect finder helper more clearly named The function finds a suitable logical monitor given the window rectangle; this wasn't all that clear from the name "calculate_main_logical_monitor". This is in preparation for finding a new logical monitor using things other than the geometry of the window. Part-of: --- src/core/window-private.h | 2 +- src/core/window.c | 4 ++-- src/tests/test-runner.c | 2 +- src/wayland/meta-window-wayland.c | 2 +- src/x11/window-x11.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/window-private.h b/src/core/window-private.h index 8d2d4a020..fce2a4727 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -849,7 +849,7 @@ void meta_window_activate_full (MetaWindow *window, MetaWorkspace *workspace); META_EXPORT_TEST -MetaLogicalMonitor * meta_window_calculate_main_logical_monitor (MetaWindow *window); +MetaLogicalMonitor * meta_window_find_monitor_from_frame_rect (MetaWindow *window); MetaLogicalMonitor * meta_window_get_main_logical_monitor (MetaWindow *window); void meta_window_update_monitor (MetaWindow *window, diff --git a/src/core/window.c b/src/core/window.c index 98306291c..ee5ba67de 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -934,7 +934,7 @@ meta_window_main_monitor_changed (MetaWindow *window, } MetaLogicalMonitor * -meta_window_calculate_main_logical_monitor (MetaWindow *window) +meta_window_find_monitor_from_frame_rect (MetaWindow *window) { MetaBackend *backend = meta_get_backend (); MetaMonitorManager *monitor_manager = @@ -1160,7 +1160,7 @@ _meta_window_shared_new (MetaDisplay *display, window->compositor_private = NULL; if (window->rect.width > 0 && window->rect.height > 0) - window->monitor = meta_window_calculate_main_logical_monitor (window); + window->monitor = meta_window_find_monitor_from_frame_rect (window); else window->monitor = meta_backend_get_current_logical_monitor (backend); diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c index e3c5d1636..9a9fb9631 100644 --- a/src/tests/test-runner.c +++ b/src/tests/test-runner.c @@ -443,7 +443,7 @@ parse_window_size (MetaWindow *window, MetaRectangle logical_monitor_layout; int value; - logical_monitor = meta_window_calculate_main_logical_monitor (window); + logical_monitor = meta_window_find_monitor_from_frame_rect (window); g_assert_nonnull (logical_monitor); logical_monitor_layout = meta_logical_monitor_get_layout (logical_monitor); diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c index 2b389bfbf..53a007803 100644 --- a/src/wayland/meta-window-wayland.c +++ b/src/wayland/meta-window-wayland.c @@ -497,7 +497,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_window_calculate_main_logical_monitor (window); + to = meta_window_find_monitor_from_frame_rect (window); if (from == to) return; diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index 617a1dfaa..0c528c17a 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -1860,7 +1860,7 @@ static void meta_window_x11_update_main_monitor (MetaWindow *window, MetaWindowUpdateMonitorFlags flags) { - window->monitor = meta_window_calculate_main_logical_monitor (window); + window->monitor = meta_window_find_monitor_from_frame_rect (window); } static void