diff options
author | Erwann Chenede - <erwann.chenede@sun.com> | 2002-05-02 16:18:24 +0000 |
---|---|---|
committer | Erwann Chenede <erwannc@src.gnome.org> | 2002-05-02 16:18:24 +0000 |
commit | 1258d179430b08a2e0fbf421b886e6fb119c7107 (patch) | |
tree | 91408a32d9a35c05588de941f19a210cddc58c4d /gdk/gdkscreen.c | |
parent | 94076bc35380525ad04a9b00c9fddd6b155a3fd1 (diff) | |
download | gtk+-1258d179430b08a2e0fbf421b886e6fb119c7107.tar.gz |
make gdk_screen_get_monitor_at_point cross platform instead of backend
2002-05-02 Erwann Chenede - <erwann.chenede@sun.com>
* gdk/gdkscreen.c (gdk_screen_get_monitor_at_point):
* gdk/gdkscreen.h :
* gdk/x11/gdkscreen-x11.c :
make gdk_screen_get_monitor_at_point cross platform instead
of backend dependant. #80480
* tests/testxinerama.c (main):
changed the warning message.
Diffstat (limited to 'gdk/gdkscreen.c')
-rw-r--r-- | gdk/gdkscreen.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gdk/gdkscreen.c b/gdk/gdkscreen.c index 25b633ec78..415ff27229 100644 --- a/gdk/gdkscreen.c +++ b/gdk/gdkscreen.c @@ -294,9 +294,26 @@ gdk_screen_get_monitor_at_point (GdkScreen *screen, gint x, gint y) { + gint num_monitors, i; + g_return_val_if_fail (GDK_IS_SCREEN (screen), -1); + + num_monitors = gdk_screen_get_n_monitors (screen); - return GDK_SCREEN_GET_CLASS (screen)->get_monitor_at_point (screen, x,y); + for (i=0;i<num_monitors;i++) + { + GdkRectangle monitor; + + gdk_screen_get_monitor_geometry (screen, i, &monitor); + + if (x >= monitor.x && + x < monitor.x + monitor.width && + y >= monitor.y && + y < (monitor.y + monitor.height)) + return i; + } + + return -1; } /** |