From 87fe770a9b17116a44f0d5ed5ed15d40f807a82f Mon Sep 17 00:00:00 2001 From: William Wold Date: Thu, 20 Jun 2019 16:48:57 +0000 Subject: Add panel_multimonitor_get_bounds () --- mate-panel/panel-multimonitor.c | 18 ++++++++++++++++++ mate-panel/panel-multimonitor.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/mate-panel/panel-multimonitor.c b/mate-panel/panel-multimonitor.c index 1a262746..5d8c63ef 100644 --- a/mate-panel/panel-multimonitor.c +++ b/mate-panel/panel-multimonitor.c @@ -670,3 +670,21 @@ panel_multimonitor_is_at_visible_extreme (int n_monitor, } } +void +panel_multimonitor_get_bounds (GdkPoint *min, + GdkPoint *max) +{ + int i; + + g_return_if_fail (monitor_count > 0); + + min->x = min->y = INT_MAX; + max->x = max->y = INT_MIN; + + for (i = 0; i < monitor_count; i++) { + min->x = MIN (min->x, geometries[i].x); + min->y = MIN (min->y, geometries[i].y); + max->x = MAX (max->x, geometries[i].x + geometries[i].width); + max->y = MAX (max->y, geometries[i].y + geometries[i].height); + } +} diff --git a/mate-panel/panel-multimonitor.h b/mate-panel/panel-multimonitor.h index ea262b17..8829a5f3 100644 --- a/mate-panel/panel-multimonitor.h +++ b/mate-panel/panel-multimonitor.h @@ -45,5 +45,7 @@ void panel_multimonitor_is_at_visible_extreme (int monitor_id, gboolean *rightmost, gboolean *topmost, gboolean *bottommost); +void panel_multimonitor_get_bounds (GdkPoint *min, + GdkPoint *max); #endif /* __PANEL_MULTIMONITOR_H__ */ -- cgit v1.2.1