Commit 7d0331a6 authored by Tim Janik's avatar Tim Janik Committed by Tim Janik
Browse files

new function gdk_window_at_pointer() to retrive the current GdkWindow the

Wed Jun 17 03:47:40 1998  Tim Janik  <timj@gtk.org>

        * gdk/gdk.h:
        * gdk/gdkwindow.c: new function gdk_window_at_pointer() to retrive
        the current GdkWindow the pointer is on if there is any.

        * gtk/gtktable.c (gtk_table_init): preallocate a table with one row
        and one column, so we don't construction logic at all. changed a few
        (x < y - 1) to (x + 1 < y), to avoid failing evaluations due to
        unsigned int wraps.

        * gtk/gtkwidget.c (gtk_widget_set_parent): removed left over code
        portion, added an additional check for parent != widget.

        * more GtkType and macro fixups.
parent 7bb4d7d9
Wed Jun 17 03:47:40 1998 Tim Janik <timj@gtk.org>
* gdk/gdk.h:
* gdk/gdkwindow.c: new function gdk_window_at_pointer() to retrive
the current GdkWindow the pointer is on if there is any.
* gtk/gtktable.c (gtk_table_init): preallocate a table with one row
and one column, so we don't construction logic at all. changed a few
(x < y - 1) to (x + 1 < y), to avoid failing evaluations due to
unsigned int wraps.
* gtk/gtkwidget.c (gtk_widget_set_parent): removed left over code
portion, added an additional check for parent != widget.
* more GtkType and macro fixups.
1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
......
Wed Jun 17 03:47:40 1998 Tim Janik <timj@gtk.org>
* gdk/gdk.h:
* gdk/gdkwindow.c: new function gdk_window_at_pointer() to retrive
the current GdkWindow the pointer is on if there is any.
* gtk/gtktable.c (gtk_table_init): preallocate a table with one row
and one column, so we don't construction logic at all. changed a few
(x < y - 1) to (x + 1 < y), to avoid failing evaluations due to
unsigned int wraps.
* gtk/gtkwidget.c (gtk_widget_set_parent): removed left over code
portion, added an additional check for parent != widget.
* more GtkType and macro fixups.
1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
......
Wed Jun 17 03:47:40 1998 Tim Janik <timj@gtk.org>
* gdk/gdk.h:
* gdk/gdkwindow.c: new function gdk_window_at_pointer() to retrive
the current GdkWindow the pointer is on if there is any.
* gtk/gtktable.c (gtk_table_init): preallocate a table with one row
and one column, so we don't construction logic at all. changed a few
(x < y - 1) to (x + 1 < y), to avoid failing evaluations due to
unsigned int wraps.
* gtk/gtkwidget.c (gtk_widget_set_parent): removed left over code
portion, added an additional check for parent != widget.
* more GtkType and macro fixups.
1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
......
Wed Jun 17 03:47:40 1998 Tim Janik <timj@gtk.org>
* gdk/gdk.h:
* gdk/gdkwindow.c: new function gdk_window_at_pointer() to retrive
the current GdkWindow the pointer is on if there is any.
* gtk/gtktable.c (gtk_table_init): preallocate a table with one row
and one column, so we don't construction logic at all. changed a few
(x < y - 1) to (x + 1 < y), to avoid failing evaluations due to
unsigned int wraps.
* gtk/gtkwidget.c (gtk_widget_set_parent): removed left over code
portion, added an additional check for parent != widget.
* more GtkType and macro fixups.
1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
......
Wed Jun 17 03:47:40 1998 Tim Janik <timj@gtk.org>
* gdk/gdk.h:
* gdk/gdkwindow.c: new function gdk_window_at_pointer() to retrive
the current GdkWindow the pointer is on if there is any.
* gtk/gtktable.c (gtk_table_init): preallocate a table with one row
and one column, so we don't construction logic at all. changed a few
(x < y - 1) to (x + 1 < y), to avoid failing evaluations due to
unsigned int wraps.
* gtk/gtkwidget.c (gtk_widget_set_parent): removed left over code
portion, added an additional check for parent != widget.
* more GtkType and macro fixups.
1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
......
Wed Jun 17 03:47:40 1998 Tim Janik <timj@gtk.org>
* gdk/gdk.h:
* gdk/gdkwindow.c: new function gdk_window_at_pointer() to retrive
the current GdkWindow the pointer is on if there is any.
* gtk/gtktable.c (gtk_table_init): preallocate a table with one row
and one column, so we don't construction logic at all. changed a few
(x < y - 1) to (x + 1 < y), to avoid failing evaluations due to
unsigned int wraps.
* gtk/gtkwidget.c (gtk_widget_set_parent): removed left over code
portion, added an additional check for parent != widget.
* more GtkType and macro fixups.
1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
......
Wed Jun 17 03:47:40 1998 Tim Janik <timj@gtk.org>
* gdk/gdk.h:
* gdk/gdkwindow.c: new function gdk_window_at_pointer() to retrive
the current GdkWindow the pointer is on if there is any.
* gtk/gtktable.c (gtk_table_init): preallocate a table with one row
and one column, so we don't construction logic at all. changed a few
(x < y - 1) to (x + 1 < y), to avoid failing evaluations due to
unsigned int wraps.
* gtk/gtkwidget.c (gtk_widget_set_parent): removed left over code
portion, added an additional check for parent != widget.
* more GtkType and macro fixups.
1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra
......
......@@ -126,11 +126,13 @@ GdkWindow* gdk_window_new (GdkWindow *parent,
GdkWindowAttr *attributes,
gint attributes_mask);
GdkWindow * gdk_window_foreign_new (guint32 anid);
GdkWindow* gdk_window_foreign_new (guint32 anid);
void gdk_window_destroy (GdkWindow *window);
GdkWindow* gdk_window_ref (GdkWindow *window);
void gdk_window_unref (GdkWindow *window);
GdkWindow* gdk_window_at_pointer (gint *win_x,
gint *win_y);
void gdk_window_show (GdkWindow *window);
void gdk_window_hide (GdkWindow *window);
void gdk_window_withdraw (GdkWindow *window);
......
......@@ -61,44 +61,56 @@ int event_mask_table[20] =
/* internal function created for and used by gdk_window_xid_at_coords */
Window
gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y,
GList *excludes, gboolean excl_child)
gdk_window_xid_at (Window base,
gint bx,
gint by,
gint x,
gint y,
GList *excludes,
gboolean excl_child)
{
GdkWindow *window;
GdkWindowPrivate *private;
Display *disp;
Window *list=NULL;
Window child=0,parent_win=0,root_win=0;
Window *list = NULL;
Window child = 0, parent_win = 0, root_win = 0;
int i;
unsigned int ww, wh, wb, wd, num;
int wx,wy;
int wx, wy;
window=(GdkWindow*)&gdk_root_parent;
private=(GdkWindowPrivate*)window;
disp=private->xdisplay;
if (!XGetGeometry(disp,base,&root_win,&wx,&wy,&ww,&wh,&wb,&wd))
window = (GdkWindow*) &gdk_root_parent;
private = (GdkWindowPrivate*) window;
disp = private->xdisplay;
if (!XGetGeometry (disp, base, &root_win, &wx, &wy, &ww, &wh, &wb, &wd))
return 0;
wx+=bx;wy+=by;
if (!((x>=wx)&&(y>=wy)&&(x<(int)(wx+ww))&&(y<(int)(wy+wh))))
wx += bx;
wy += by;
if (!((x >= wx) &&
(y >= wy) &&
(x < (int) (wx + ww)) &&
(y < (int) (wy + wh))))
return 0;
if (!XQueryTree(disp,base,&root_win,&parent_win,&list,&num))
if (!XQueryTree (disp, base, &root_win, &parent_win, &list, &num))
return base;
if (list)
{
for (i=num-1;;i--)
for (i = num - 1; ; i--)
{
if ((!excl_child)||(!g_list_find(excludes,(gpointer *)list[i])))
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)
if ((child = gdk_window_xid_at (list[i], wx, wy, x, y, excludes, excl_child)) != 0)
{
XFree(list);
XFree (list);
return child;
}
}
if (!i) break;
if (!i)
break;
}
XFree(list);
XFree (list);
}
return base;
}
......@@ -117,24 +129,31 @@ gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y,
* those X,Y co-ordinates.
*/
Window
gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child)
gdk_window_xid_at_coords (gint x,
gint y,
GList *excludes,
gboolean excl_child)
{
GdkWindow *window;
GdkWindowPrivate *private;
Display *disp;
Window *list=NULL;
Window root,child=0,parent_win=0,root_win=0;
Window *list = NULL;
Window root, child = 0, parent_win = 0, root_win = 0;
unsigned int num;
int i;
window=(GdkWindow*)&gdk_root_parent;
private=(GdkWindowPrivate*)window;
disp=private->xdisplay;
root=private->xwindow;
XGrabServer(disp);
num=g_list_length(excludes);
if (!XQueryTree(disp,root,&root_win,&parent_win,&list,&num))
return root;
window = (GdkWindow*) &gdk_root_parent;
private = (GdkWindowPrivate*) window;
disp = private->xdisplay;
root = private->xwindow;
num = g_list_length (excludes);
XGrabServer (disp);
if (!XQueryTree (disp, root, &root_win, &parent_win, &list, &num))
{
XUngrabServer(disp);
return root;
}
if (list)
{
i = num - 1;
......@@ -147,7 +166,7 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child)
if (xwa.map_state != IsViewable)
continue;
if (excl_child && g_list_find(excludes,(gpointer *)list[i]))
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)
......@@ -155,23 +174,23 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child)
if (excludes)
{
if (!g_list_find(excludes,(gpointer *)child))
if (!g_list_find (excludes, (gpointer *) child))
{
XFree(list);
XUngrabServer(disp);
XFree (list);
XUngrabServer (disp);
return child;
}
}
else
{
XFree(list);
XUngrabServer(disp);
XFree (list);
XUngrabServer (disp);
return child;
}
} while (--i > 0);
XFree(list);
XFree (list);
}
XUngrabServer(disp);
XUngrabServer (disp);
return root;
}
......@@ -1326,6 +1345,46 @@ gdk_window_get_pointer (GdkWindow *window,
return return_val;
}
GdkWindow*
gdk_window_at_pointer (gint *win_x,
gint *win_y)
{
GdkWindowPrivate *private;
GdkWindow *window;
Window root;
Window xwindow;
Window xwindow_last = 0;
int rootx = -1, rooty = -1;
int winx, winy;
unsigned int xmask;
private = &gdk_root_parent;
xwindow = private->xwindow;
XGrabServer (private->xdisplay);
while (xwindow)
{
xwindow_last = xwindow;
XQueryPointer (private->xdisplay,
xwindow,
&root, &xwindow,
&rootx, &rooty,
&winx, &winy,
&xmask);
}
XUngrabServer (private->xdisplay);
window = gdk_window_lookup (xwindow_last);
if (win_x)
*win_x = window ? winx : -1;
if (win_y)
*win_y = window ? winy : -1;
return window;
}
GdkWindow*
gdk_window_get_parent (GdkWindow *window)
{
......
......@@ -61,44 +61,56 @@ int event_mask_table[20] =
/* internal function created for and used by gdk_window_xid_at_coords */
Window
gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y,
GList *excludes, gboolean excl_child)
gdk_window_xid_at (Window base,
gint bx,
gint by,
gint x,
gint y,
GList *excludes,
gboolean excl_child)
{
GdkWindow *window;
GdkWindowPrivate *private;
Display *disp;
Window *list=NULL;
Window child=0,parent_win=0,root_win=0;
Window *list = NULL;
Window child = 0, parent_win = 0, root_win = 0;
int i;
unsigned int ww, wh, wb, wd, num;
int wx,wy;
int wx, wy;
window=(GdkWindow*)&gdk_root_parent;
private=(GdkWindowPrivate*)window;
disp=private->xdisplay;
if (!XGetGeometry(disp,base,&root_win,&wx,&wy,&ww,&wh,&wb,&wd))
window = (GdkWindow*) &gdk_root_parent;
private = (GdkWindowPrivate*) window;
disp = private->xdisplay;
if (!XGetGeometry (disp, base, &root_win, &wx, &wy, &ww, &wh, &wb, &wd))
return 0;
wx+=bx;wy+=by;
if (!((x>=wx)&&(y>=wy)&&(x<(int)(wx+ww))&&(y<(int)(wy+wh))))
wx += bx;
wy += by;
if (!((x >= wx) &&
(y >= wy) &&
(x < (int) (wx + ww)) &&
(y < (int) (wy + wh))))
return 0;
if (!XQueryTree(disp,base,&root_win,&parent_win,&list,&num))
if (!XQueryTree (disp, base, &root_win, &parent_win, &list, &num))
return base;
if (list)
{
for (i=num-1;;i--)
for (i = num - 1; ; i--)
{
if ((!excl_child)||(!g_list_find(excludes,(gpointer *)list[i])))
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)
if ((child = gdk_window_xid_at (list[i], wx, wy, x, y, excludes, excl_child)) != 0)
{
XFree(list);
XFree (list);
return child;
}
}
if (!i) break;
if (!i)
break;
}
XFree(list);
XFree (list);
}
return base;
}
......@@ -117,24 +129,31 @@ gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y,
* those X,Y co-ordinates.
*/
Window
gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child)
gdk_window_xid_at_coords (gint x,
gint y,
GList *excludes,
gboolean excl_child)
{
GdkWindow *window;
GdkWindowPrivate *private;
Display *disp;
Window *list=NULL;
Window root,child=0,parent_win=0,root_win=0;
Window *list = NULL;
Window root, child = 0, parent_win = 0, root_win = 0;
unsigned int num;
int i;
window=(GdkWindow*)&gdk_root_parent;
private=(GdkWindowPrivate*)window;
disp=private->xdisplay;
root=private->xwindow;
XGrabServer(disp);
num=g_list_length(excludes);
if (!XQueryTree(disp,root,&root_win,&parent_win,&list,&num))
return root;
window = (GdkWindow*) &gdk_root_parent;
private = (GdkWindowPrivate*) window;
disp = private->xdisplay;
root = private->xwindow;
num = g_list_length (excludes);
XGrabServer (disp);
if (!XQueryTree (disp, root, &root_win, &parent_win, &list, &num))
{
XUngrabServer(disp);
return root;
}
if (list)
{
i = num - 1;
......@@ -147,7 +166,7 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child)
if (xwa.map_state != IsViewable)
continue;
if (excl_child && g_list_find(excludes,(gpointer *)list[i]))
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)
......@@ -155,23 +174,23 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child)
if (excludes)
{
if (!g_list_find(excludes,(gpointer *)child))
if (!g_list_find (excludes, (gpointer *) child))
{
XFree(list);
XUngrabServer(disp);
XFree (list);
XUngrabServer (disp);
return child;
}
}
else
{
XFree(list);
XUngrabServer(disp);
XFree (list);
XUngrabServer (disp);
return child;
}
} while (--i > 0);
XFree(list);
XFree (list);
}
XUngrabServer(disp);
XUngrabServer (disp);
return root;
}
......@@ -1326,6 +1345,46 @@ gdk_window_get_pointer (GdkWindow *window,
return return_val;
}
GdkWindow*
gdk_window_at_pointer (gint *win_x,
gint *win_y)
{
GdkWindowPrivate *private;
GdkWindow *window;
Window root;
Window xwindow;
Window xwindow_last = 0;
int rootx = -1, rooty = -1;
int winx, winy;
unsigned int xmask;
private = &gdk_root_parent;
xwindow = private->xwindow;
XGrabServer (private->xdisplay);
while (xwindow)
{
xwindow_last = xwindow;
XQueryPointer (private->xdisplay,
xwindow,
&root, &xwindow,
&rootx, &rooty,
&winx, &winy,
&xmask);
}
XUngrabServer (private->xdisplay);
window = gdk_window_lookup (xwindow_last);
if (win_x)
*win_x = window ? winx : -1;
if (win_y)
*win_y = window ? winy : -1;
return window;
}
GdkWindow*
gdk_window_get_parent (GdkWindow *window)
{
......
......@@ -68,10 +68,10 @@ static GtkType gtk_box_child_type (GtkContainer *container);
static GtkContainerClass *parent_class = NULL;
guint
GtkType
gtk_box_get_type (void)
{
static guint box_type = 0;
static GtkType box_type = 0;
if (!box_type)
{
......@@ -86,7 +86,7 @@ gtk_box_get_type (void)
(GtkArgGetFunc) gtk_box_get_arg,
};
box_type = gtk_type_unique (gtk_container_get_type (), &box_info);
box_type = gtk_type_unique (GTK_TYPE_CONTAINER, &box_info);
}
return box_type;
......@@ -103,7 +103,7 @@ gtk_box_class_init (GtkBoxClass *class)
widget_class = (GtkWidgetClass*) class;
container_class = (GtkContainerClass*) class;
parent_class = gtk_type_class (gtk_container_get_type ());
parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
gtk_object_add_arg_type ("GtkBox::spacing", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_SPACING);
gtk_object_add_arg_type ("GtkBox::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS);
......
......@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
...