From 63955ec2e2c8f43daa6f4832b9f535adbdecd34f Mon Sep 17 00:00:00 2001 From: Federico Mena Date: Tue, 17 Mar 1998 04:20:47 +0000 Subject: [PATCH] Use signed integers so that testing will not fail for windows that are Mon Mar 16 22:31:02 1998 Federico Mena * gdk/gdkwindow.c (gdk_window_xid_at): Use signed integers so that testing will not fail for windows that are off-screen. (gdk_window_xid_at_coords): Only considers visible windows. --- ChangeLog | 8 +++++ ChangeLog.pre-2-0 | 8 +++++ ChangeLog.pre-2-10 | 8 +++++ ChangeLog.pre-2-2 | 8 +++++ ChangeLog.pre-2-4 | 8 +++++ ChangeLog.pre-2-6 | 8 +++++ ChangeLog.pre-2-8 | 8 +++++ gdk/gdkwindow.c | 72 +++++++++++++++++++++++------------------ gdk/x11/gdkwindow-x11.c | 72 +++++++++++++++++++++++------------------ 9 files changed, 136 insertions(+), 64 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b3ee76aa7..b967ebfc7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Mar 16 22:31:02 1998 Federico Mena + + * gdk/gdkwindow.c (gdk_window_xid_at): Use signed integers so that + testing will not fail for windows that are off-screen. + + (gdk_window_xid_at_coords): Only considers visible windows. + Tue Mar 17 03:56:13 1998 Tim Janik * gtk/gtkspinbutton.h: exported gtk_spin_button_spin since it is @@ -13,6 +20,7 @@ Mon Mar 16 18:19:31 GMT 1998 Tony Gale - new question on updating progressbars - update all the links to gtk.org +>>>>>>> 1.255 Mon Mar 16 09:15:03 GMT 1998 Tony Gale * docs/gtk_tut.sgml: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 2b3ee76aa7..b967ebfc7f 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +Mon Mar 16 22:31:02 1998 Federico Mena + + * gdk/gdkwindow.c (gdk_window_xid_at): Use signed integers so that + testing will not fail for windows that are off-screen. + + (gdk_window_xid_at_coords): Only considers visible windows. + Tue Mar 17 03:56:13 1998 Tim Janik * gtk/gtkspinbutton.h: exported gtk_spin_button_spin since it is @@ -13,6 +20,7 @@ Mon Mar 16 18:19:31 GMT 1998 Tony Gale - new question on updating progressbars - update all the links to gtk.org +>>>>>>> 1.255 Mon Mar 16 09:15:03 GMT 1998 Tony Gale * docs/gtk_tut.sgml: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 2b3ee76aa7..b967ebfc7f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Mon Mar 16 22:31:02 1998 Federico Mena + + * gdk/gdkwindow.c (gdk_window_xid_at): Use signed integers so that + testing will not fail for windows that are off-screen. + + (gdk_window_xid_at_coords): Only considers visible windows. + Tue Mar 17 03:56:13 1998 Tim Janik * gtk/gtkspinbutton.h: exported gtk_spin_button_spin since it is @@ -13,6 +20,7 @@ Mon Mar 16 18:19:31 GMT 1998 Tony Gale - new question on updating progressbars - update all the links to gtk.org +>>>>>>> 1.255 Mon Mar 16 09:15:03 GMT 1998 Tony Gale * docs/gtk_tut.sgml: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 2b3ee76aa7..b967ebfc7f 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Mon Mar 16 22:31:02 1998 Federico Mena + + * gdk/gdkwindow.c (gdk_window_xid_at): Use signed integers so that + testing will not fail for windows that are off-screen. + + (gdk_window_xid_at_coords): Only considers visible windows. + Tue Mar 17 03:56:13 1998 Tim Janik * gtk/gtkspinbutton.h: exported gtk_spin_button_spin since it is @@ -13,6 +20,7 @@ Mon Mar 16 18:19:31 GMT 1998 Tony Gale - new question on updating progressbars - update all the links to gtk.org +>>>>>>> 1.255 Mon Mar 16 09:15:03 GMT 1998 Tony Gale * docs/gtk_tut.sgml: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 2b3ee76aa7..b967ebfc7f 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Mon Mar 16 22:31:02 1998 Federico Mena + + * gdk/gdkwindow.c (gdk_window_xid_at): Use signed integers so that + testing will not fail for windows that are off-screen. + + (gdk_window_xid_at_coords): Only considers visible windows. + Tue Mar 17 03:56:13 1998 Tim Janik * gtk/gtkspinbutton.h: exported gtk_spin_button_spin since it is @@ -13,6 +20,7 @@ Mon Mar 16 18:19:31 GMT 1998 Tony Gale - new question on updating progressbars - update all the links to gtk.org +>>>>>>> 1.255 Mon Mar 16 09:15:03 GMT 1998 Tony Gale * docs/gtk_tut.sgml: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 2b3ee76aa7..b967ebfc7f 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Mon Mar 16 22:31:02 1998 Federico Mena + + * gdk/gdkwindow.c (gdk_window_xid_at): Use signed integers so that + testing will not fail for windows that are off-screen. + + (gdk_window_xid_at_coords): Only considers visible windows. + Tue Mar 17 03:56:13 1998 Tim Janik * gtk/gtkspinbutton.h: exported gtk_spin_button_spin since it is @@ -13,6 +20,7 @@ Mon Mar 16 18:19:31 GMT 1998 Tony Gale - new question on updating progressbars - update all the links to gtk.org +>>>>>>> 1.255 Mon Mar 16 09:15:03 GMT 1998 Tony Gale * docs/gtk_tut.sgml: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 2b3ee76aa7..b967ebfc7f 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Mon Mar 16 22:31:02 1998 Federico Mena + + * gdk/gdkwindow.c (gdk_window_xid_at): Use signed integers so that + testing will not fail for windows that are off-screen. + + (gdk_window_xid_at_coords): Only considers visible windows. + Tue Mar 17 03:56:13 1998 Tim Janik * gtk/gtkspinbutton.h: exported gtk_spin_button_spin since it is @@ -13,6 +20,7 @@ Mon Mar 16 18:19:31 GMT 1998 Tony Gale - new question on updating progressbars - update all the links to gtk.org +>>>>>>> 1.255 Mon Mar 16 09:15:03 GMT 1998 Tony Gale * docs/gtk_tut.sgml: diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index a9ec5f783f..3ce3beccbb 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -63,7 +63,7 @@ gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y, Display *disp; Window *list=NULL; Window child=0,parent_win=0,root_win=0; - unsigned int num,i,ww,wh,wb,wd; + int num,i,ww,wh,wb,wd; int wx,wy; window=(GdkWindow*)&gdk_root_parent; @@ -82,11 +82,11 @@ gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y, { if ((!excl_child)||(!g_list_find(excludes,(gpointer *)list[i]))) { - if ((child=gdk_window_xid_at(list[i],wx,wy,x,y,excludes,excl_child))!=0) - { - XFree(list); - return child; - } + if ((child=gdk_window_xid_at(list[i],wx,wy,x,y,excludes,excl_child))!=0) + { + XFree(list); + return child; + } } if (!i) break; } @@ -116,7 +116,8 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child) Display *disp; Window *list=NULL; Window root,child=0,parent_win=0,root_win=0; - unsigned int num,i; + unsigned int num; + int i; GList *gl; window=(GdkWindow*)&gdk_root_parent; @@ -129,31 +130,38 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child) return root; if (list) { - for (i=num-1;;i--) - { - if ((!excl_child)||(!g_list_find(excludes,(gpointer *)list[i]))) - { - if ((child=gdk_window_xid_at(list[i],0,0,x,y,excludes,excl_child))!=0) - { - if (excludes) - { - if (!g_list_find(excludes,(gpointer *)child)) - { - XFree(list); - XUngrabServer(disp); - return child; - } - } - else - { - XFree(list); - XUngrabServer(disp); - return child; - } - } - } - if (!i) break; - } + i = num - 1; + do + { + XWindowAttributes xwa; + + XGetWindowAttributes (disp, list [i], &xwa); + + if (xwa.map_state != IsViewable) + continue; + + if (excl_child && g_list_find(excludes,(gpointer *)list[i])) + continue; + + if ((child = gdk_window_xid_at (list[i], 0, 0, x, y, excludes, excl_child)) == 0) + continue; + + if (excludes) + { + if (!g_list_find(excludes,(gpointer *)child)) + { + XFree(list); + XUngrabServer(disp); + return child; + } + } + else + { + XFree(list); + XUngrabServer(disp); + return child; + } + } while (--i > 0); XFree(list); } XUngrabServer(disp); diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index a9ec5f783f..3ce3beccbb 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -63,7 +63,7 @@ gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y, Display *disp; Window *list=NULL; Window child=0,parent_win=0,root_win=0; - unsigned int num,i,ww,wh,wb,wd; + int num,i,ww,wh,wb,wd; int wx,wy; window=(GdkWindow*)&gdk_root_parent; @@ -82,11 +82,11 @@ gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y, { if ((!excl_child)||(!g_list_find(excludes,(gpointer *)list[i]))) { - if ((child=gdk_window_xid_at(list[i],wx,wy,x,y,excludes,excl_child))!=0) - { - XFree(list); - return child; - } + if ((child=gdk_window_xid_at(list[i],wx,wy,x,y,excludes,excl_child))!=0) + { + XFree(list); + return child; + } } if (!i) break; } @@ -116,7 +116,8 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child) Display *disp; Window *list=NULL; Window root,child=0,parent_win=0,root_win=0; - unsigned int num,i; + unsigned int num; + int i; GList *gl; window=(GdkWindow*)&gdk_root_parent; @@ -129,31 +130,38 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child) return root; if (list) { - for (i=num-1;;i--) - { - if ((!excl_child)||(!g_list_find(excludes,(gpointer *)list[i]))) - { - if ((child=gdk_window_xid_at(list[i],0,0,x,y,excludes,excl_child))!=0) - { - if (excludes) - { - if (!g_list_find(excludes,(gpointer *)child)) - { - XFree(list); - XUngrabServer(disp); - return child; - } - } - else - { - XFree(list); - XUngrabServer(disp); - return child; - } - } - } - if (!i) break; - } + i = num - 1; + do + { + XWindowAttributes xwa; + + XGetWindowAttributes (disp, list [i], &xwa); + + if (xwa.map_state != IsViewable) + continue; + + if (excl_child && g_list_find(excludes,(gpointer *)list[i])) + continue; + + if ((child = gdk_window_xid_at (list[i], 0, 0, x, y, excludes, excl_child)) == 0) + continue; + + if (excludes) + { + if (!g_list_find(excludes,(gpointer *)child)) + { + XFree(list); + XUngrabServer(disp); + return child; + } + } + else + { + XFree(list); + XUngrabServer(disp); + return child; + } + } while (--i > 0); XFree(list); } XUngrabServer(disp);