diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt index 0ae697f894..fa1b832a4f 100644 --- a/docs/reference/gdk/gdk4-sections.txt +++ b/docs/reference/gdk/gdk4-sections.txt @@ -95,7 +95,6 @@ gdk_display_list_seats gdk_display_get_n_monitors gdk_display_get_monitor gdk_display_get_primary_monitor -gdk_display_get_monitor_at_point gdk_display_get_monitor_at_surface gdk_display_get_clipboard gdk_display_get_primary_clipboard diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index c657d66133..4244490894 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -1614,66 +1614,6 @@ gdk_display_get_primary_monitor (GdkDisplay *display) return GDK_DISPLAY_GET_CLASS (display)->get_primary_monitor (display); } -/** - * gdk_display_get_monitor_at_point: - * @display: a #GdkDisplay - * @x: the x coordinate of the point - * @y: the y coordinate of the point - * - * Gets the monitor in which the point (@x, @y) is located, - * or a nearby monitor if the point is not in any monitor. - * - * Returns: (transfer none): the monitor containing the point - */ -GdkMonitor * -gdk_display_get_monitor_at_point (GdkDisplay *display, - int x, - int y) -{ - GdkMonitor *nearest = NULL; - int nearest_dist = G_MAXINT; - int n_monitors, i; - - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - - n_monitors = gdk_display_get_n_monitors (display); - for (i = 0; i < n_monitors; i++) - { - GdkMonitor *monitor; - GdkRectangle geometry; - int dist_x, dist_y, dist; - - monitor = gdk_display_get_monitor (display, i); - gdk_monitor_get_geometry (monitor, &geometry); - - if (x < geometry.x) - dist_x = geometry.x - x; - else if (geometry.x + geometry.width <= x) - dist_x = x - (geometry.x + geometry.width) + 1; - else - dist_x = 0; - - if (y < geometry.y) - dist_y = geometry.y - y; - else if (geometry.y + geometry.height <= y) - dist_y = y - (geometry.y + geometry.height) + 1; - else - dist_y = 0; - - dist = dist_x + dist_y; - if (dist < nearest_dist) - { - nearest_dist = dist; - nearest = monitor; - } - - if (nearest_dist == 0) - break; - } - - return nearest; -} - /** * gdk_display_get_monitor_at_surface: * @display: a #GdkDisplay @@ -1727,12 +1667,7 @@ gdk_display_get_monitor_at_surface (GdkDisplay *display, } } - if (best) - return best; - - return gdk_display_get_monitor_at_point (display, - win.x + win.width / 2, - win.y + win.height / 2); + return best; } void diff --git a/gdk/gdkdisplay.h b/gdk/gdkdisplay.h index 547e2a10de..aa17eab9bb 100644 --- a/gdk/gdkdisplay.h +++ b/gdk/gdkdisplay.h @@ -114,10 +114,6 @@ GdkMonitor * gdk_display_get_monitor (GdkDisplay *display, GDK_AVAILABLE_IN_ALL GdkMonitor * gdk_display_get_primary_monitor (GdkDisplay *display); GDK_AVAILABLE_IN_ALL -GdkMonitor * gdk_display_get_monitor_at_point (GdkDisplay *display, - int x, - int y); -GDK_AVAILABLE_IN_ALL GdkMonitor * gdk_display_get_monitor_at_surface (GdkDisplay *display, GdkSurface *surface); diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index a65e5bcaea..4e5620ff07 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -146,8 +146,6 @@ get_monitor_for_rect (GdkDisplay *display, GdkMonitor *monitor; GdkRectangle workarea; GdkRectangle intersection; - gint x; - gint y; gint i; for (i = 0; i < gdk_display_get_n_monitors (display); i++) @@ -165,13 +163,7 @@ get_monitor_for_rect (GdkDisplay *display, } } - if (best_monitor) - return best_monitor; - - x = rect->x + rect->width / 2; - y = rect->y + rect->height / 2; - - return gdk_display_get_monitor_at_point (display, x, y); + return best_monitor; } static gint