<raster@redhat.com>

<raster@redhat.com>

final fixes to STUPId comparison of types of loop end - i missed the
unsigned bit! i will NEVEr use unsigned ints ever again!
This commit is contained in:
rhlabs 1998-03-11 21:44:22 +00:00
parent ffc1084029
commit b7a6cd6750
2 changed files with 46 additions and 8 deletions

View File

@ -77,13 +77,15 @@ gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y)
return base; return base;
if (list) if (list)
{ {
for (i=num-1;i>=0;i--) for (i=num-1;;i--)
{ {
if ((child=gdk_window_xid_at(list[i],wx,wy,x,y))!=0) if ((child=gdk_window_xid_at(list[i],wx,wy,x,y))!=0)
{ {
printf("-> %x\n",child);
XFree(list); XFree(list);
return child; return child;
} }
if (!i) break;
} }
XFree(list); XFree(list);
} }
@ -112,26 +114,39 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes)
Window *list=NULL; Window *list=NULL;
Window root,child=0,parent_win=0,root_win=0; Window root,child=0,parent_win=0,root_win=0;
unsigned int num,i; unsigned int num,i;
GList *gl;
window=(GdkWindow*)&gdk_root_parent; window=(GdkWindow*)&gdk_root_parent;
private=(GdkWindowPrivate*)window; private=(GdkWindowPrivate*)window;
disp=private->xdisplay; disp=private->xdisplay;
root=private->xwindow; root=private->xwindow;
XGrabServer(disp); XGrabServer(disp);
num=g_list_length(excludes);
printf("coords %i %i\n",x,y);
for(i=0;i<num;i++)
{
gl=g_list_nth(excludes,i);
printf("excludes %x\n",gl->data);
}
if (!XQueryTree(disp,root,&root_win,&parent_win,&list,&num)) if (!XQueryTree(disp,root,&root_win,&parent_win,&list,&num))
return root; {
printf("Mouse in %x\n",root);
return root;
}
if (list) if (list)
{ {
for (i=num-1;i>=0;i--) for (i=num-1;;i--)
{ {
if ((child=gdk_window_xid_at(list[i],0,0,x,y))!=0) if ((child=gdk_window_xid_at(list[i],0,0,x,y))!=0)
{ {
printf("%x\n",child);
if (excludes) if (excludes)
{ {
if (!g_list_find(excludes,(gpointer)child)) if (!g_list_find(excludes,(gpointer)child))
{ {
XUngrabServer(disp);
XFree(list); XFree(list);
XUngrabServer(disp);
printf("Mouse in %x\n",child);
return child; return child;
} }
} }
@ -139,12 +154,16 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes)
{ {
XFree(list); XFree(list);
XUngrabServer(disp); XUngrabServer(disp);
printf("Mouse in %x\n",child);
return child; return child;
} }
} }
if (!i) break;
} }
XFree(list);
} }
XUngrabServer(disp); XUngrabServer(disp);
printf("Mouse in %x\n",root);
return root; return root;
} }

View File

@ -77,13 +77,15 @@ gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y)
return base; return base;
if (list) if (list)
{ {
for (i=num-1;i>=0;i--) for (i=num-1;;i--)
{ {
if ((child=gdk_window_xid_at(list[i],wx,wy,x,y))!=0) if ((child=gdk_window_xid_at(list[i],wx,wy,x,y))!=0)
{ {
printf("-> %x\n",child);
XFree(list); XFree(list);
return child; return child;
} }
if (!i) break;
} }
XFree(list); XFree(list);
} }
@ -112,26 +114,39 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes)
Window *list=NULL; Window *list=NULL;
Window root,child=0,parent_win=0,root_win=0; Window root,child=0,parent_win=0,root_win=0;
unsigned int num,i; unsigned int num,i;
GList *gl;
window=(GdkWindow*)&gdk_root_parent; window=(GdkWindow*)&gdk_root_parent;
private=(GdkWindowPrivate*)window; private=(GdkWindowPrivate*)window;
disp=private->xdisplay; disp=private->xdisplay;
root=private->xwindow; root=private->xwindow;
XGrabServer(disp); XGrabServer(disp);
num=g_list_length(excludes);
printf("coords %i %i\n",x,y);
for(i=0;i<num;i++)
{
gl=g_list_nth(excludes,i);
printf("excludes %x\n",gl->data);
}
if (!XQueryTree(disp,root,&root_win,&parent_win,&list,&num)) if (!XQueryTree(disp,root,&root_win,&parent_win,&list,&num))
return root; {
printf("Mouse in %x\n",root);
return root;
}
if (list) if (list)
{ {
for (i=num-1;i>=0;i--) for (i=num-1;;i--)
{ {
if ((child=gdk_window_xid_at(list[i],0,0,x,y))!=0) if ((child=gdk_window_xid_at(list[i],0,0,x,y))!=0)
{ {
printf("%x\n",child);
if (excludes) if (excludes)
{ {
if (!g_list_find(excludes,(gpointer)child)) if (!g_list_find(excludes,(gpointer)child))
{ {
XUngrabServer(disp);
XFree(list); XFree(list);
XUngrabServer(disp);
printf("Mouse in %x\n",child);
return child; return child;
} }
} }
@ -139,12 +154,16 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes)
{ {
XFree(list); XFree(list);
XUngrabServer(disp); XUngrabServer(disp);
printf("Mouse in %x\n",child);
return child; return child;
} }
} }
if (!i) break;
} }
XFree(list);
} }
XUngrabServer(disp); XUngrabServer(disp);
printf("Mouse in %x\n",root);
return root; return root;
} }