Commit 7dfb0193 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Fix get_nearest_monitor

svn path=/trunk/; revision=22582
parent e0045d59
2009-03-24 Matthias Clasen <mclasen@redhat.com>
Bug 576306 – gdkscreen.c: get_nearest_monitor too simple, gives wrong
result, mispositioning tooltips
* gdk/gdkscreen.c (get_nearest_monitor): Make this function work.
Problem reported by Dave Gilbert.
2009-03-23 Hiroyuki Ikezoe <poincare@ikezoe.net>
Bug 576254 - <object> requires attribute "id"
......
......@@ -213,7 +213,7 @@ get_nearest_monitor (GdkScreen *screen,
gint num_monitors, i;
gint nearest_dist = G_MAXINT;
gint nearest_monitor = 0;
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
num_monitors = gdk_screen_get_n_monitors (screen);
......@@ -221,7 +221,7 @@ get_nearest_monitor (GdkScreen *screen,
for (i = 0; i < num_monitors; i++)
{
GdkRectangle monitor;
gint dist_x, dist_y;
gint dist_x, dist_y, dist;
gdk_screen_get_monitor_geometry (screen, i, &monitor);
......@@ -239,9 +239,10 @@ get_nearest_monitor (GdkScreen *screen,
else
dist_y = 0;
if (MIN (dist_x, dist_y) < nearest_dist)
dist = dist_x + dist_y;
if (dist < nearest_dist)
{
nearest_dist = MIN (dist_x, dist_y);
nearest_dist = dist;
nearest_monitor = i;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment