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.
This commit is contained in:
Tim Janik 1998-06-17 08:48:22 +00:00 committed by Tim Janik
parent 7bb4d7d961
commit 7d0331a679
22 changed files with 415 additions and 170 deletions

View File

@ -1,3 +1,19 @@
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> 1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra

View File

@ -1,3 +1,19 @@
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> 1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra

View File

@ -1,3 +1,19 @@
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> 1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra

View File

@ -1,3 +1,19 @@
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> 1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra

View File

@ -1,3 +1,19 @@
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> 1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra

View File

@ -1,3 +1,19 @@
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> 1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra

View File

@ -1,3 +1,19 @@
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> 1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra

View File

@ -126,11 +126,13 @@ GdkWindow* gdk_window_new (GdkWindow *parent,
GdkWindowAttr *attributes, GdkWindowAttr *attributes,
gint attributes_mask); gint attributes_mask);
GdkWindow * gdk_window_foreign_new (guint32 anid); GdkWindow* gdk_window_foreign_new (guint32 anid);
void gdk_window_destroy (GdkWindow *window); void gdk_window_destroy (GdkWindow *window);
GdkWindow* gdk_window_ref (GdkWindow *window); GdkWindow* gdk_window_ref (GdkWindow *window);
void gdk_window_unref (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_show (GdkWindow *window);
void gdk_window_hide (GdkWindow *window); void gdk_window_hide (GdkWindow *window);
void gdk_window_withdraw (GdkWindow *window); void gdk_window_withdraw (GdkWindow *window);

View File

@ -61,44 +61,56 @@ int event_mask_table[20] =
/* internal function created for and used by gdk_window_xid_at_coords */ /* internal function created for and used by gdk_window_xid_at_coords */
Window Window
gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y, gdk_window_xid_at (Window base,
GList *excludes, gboolean excl_child) gint bx,
gint by,
gint x,
gint y,
GList *excludes,
gboolean excl_child)
{ {
GdkWindow *window; GdkWindow *window;
GdkWindowPrivate *private; GdkWindowPrivate *private;
Display *disp; Display *disp;
Window *list=NULL; Window *list = NULL;
Window child=0,parent_win=0,root_win=0; Window child = 0, parent_win = 0, root_win = 0;
int i; int i;
unsigned int ww, wh, wb, wd, num; unsigned int ww, wh, wb, wd, num;
int wx,wy; int wx, wy;
window=(GdkWindow*)&gdk_root_parent; window = (GdkWindow*) &gdk_root_parent;
private=(GdkWindowPrivate*)window; private = (GdkWindowPrivate*) window;
disp=private->xdisplay; disp = private->xdisplay;
if (!XGetGeometry(disp,base,&root_win,&wx,&wy,&ww,&wh,&wb,&wd)) if (!XGetGeometry (disp, base, &root_win, &wx, &wy, &ww, &wh, &wb, &wd))
return 0; return 0;
wx+=bx;wy+=by; wx += bx;
if (!((x>=wx)&&(y>=wy)&&(x<(int)(wx+ww))&&(y<(int)(wy+wh)))) wy += by;
if (!((x >= wx) &&
(y >= wy) &&
(x < (int) (wx + ww)) &&
(y < (int) (wy + wh))))
return 0; return 0;
if (!XQueryTree(disp,base,&root_win,&parent_win,&list,&num))
if (!XQueryTree (disp, base, &root_win, &parent_win, &list, &num))
return base; return base;
if (list) 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; return child;
} }
} }
if (!i) break; if (!i)
break;
} }
XFree(list); XFree (list);
} }
return base; 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. * those X,Y co-ordinates.
*/ */
Window 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; GdkWindow *window;
GdkWindowPrivate *private; GdkWindowPrivate *private;
Display *disp; Display *disp;
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; unsigned int num;
int i; int i;
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); num = g_list_length (excludes);
num=g_list_length(excludes);
if (!XQueryTree(disp,root,&root_win,&parent_win,&list,&num)) XGrabServer (disp);
return root; if (!XQueryTree (disp, root, &root_win, &parent_win, &list, &num))
{
XUngrabServer(disp);
return root;
}
if (list) if (list)
{ {
i = num - 1; 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) if (xwa.map_state != IsViewable)
continue; continue;
if (excl_child && g_list_find(excludes,(gpointer *)list[i])) if (excl_child && g_list_find (excludes, (gpointer *) list[i]))
continue; continue;
if ((child = gdk_window_xid_at (list[i], 0, 0, x, y, excludes, excl_child)) == 0) 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 (excludes)
{ {
if (!g_list_find(excludes,(gpointer *)child)) if (!g_list_find (excludes, (gpointer *) child))
{ {
XFree(list); XFree (list);
XUngrabServer(disp); XUngrabServer (disp);
return child; return child;
} }
} }
else else
{ {
XFree(list); XFree (list);
XUngrabServer(disp); XUngrabServer (disp);
return child; return child;
} }
} while (--i > 0); } while (--i > 0);
XFree(list); XFree (list);
} }
XUngrabServer(disp); XUngrabServer (disp);
return root; return root;
} }
@ -1326,6 +1345,46 @@ gdk_window_get_pointer (GdkWindow *window,
return return_val; 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* GdkWindow*
gdk_window_get_parent (GdkWindow *window) gdk_window_get_parent (GdkWindow *window)
{ {

View File

@ -61,44 +61,56 @@ int event_mask_table[20] =
/* internal function created for and used by gdk_window_xid_at_coords */ /* internal function created for and used by gdk_window_xid_at_coords */
Window Window
gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y, gdk_window_xid_at (Window base,
GList *excludes, gboolean excl_child) gint bx,
gint by,
gint x,
gint y,
GList *excludes,
gboolean excl_child)
{ {
GdkWindow *window; GdkWindow *window;
GdkWindowPrivate *private; GdkWindowPrivate *private;
Display *disp; Display *disp;
Window *list=NULL; Window *list = NULL;
Window child=0,parent_win=0,root_win=0; Window child = 0, parent_win = 0, root_win = 0;
int i; int i;
unsigned int ww, wh, wb, wd, num; unsigned int ww, wh, wb, wd, num;
int wx,wy; int wx, wy;
window=(GdkWindow*)&gdk_root_parent; window = (GdkWindow*) &gdk_root_parent;
private=(GdkWindowPrivate*)window; private = (GdkWindowPrivate*) window;
disp=private->xdisplay; disp = private->xdisplay;
if (!XGetGeometry(disp,base,&root_win,&wx,&wy,&ww,&wh,&wb,&wd)) if (!XGetGeometry (disp, base, &root_win, &wx, &wy, &ww, &wh, &wb, &wd))
return 0; return 0;
wx+=bx;wy+=by; wx += bx;
if (!((x>=wx)&&(y>=wy)&&(x<(int)(wx+ww))&&(y<(int)(wy+wh)))) wy += by;
if (!((x >= wx) &&
(y >= wy) &&
(x < (int) (wx + ww)) &&
(y < (int) (wy + wh))))
return 0; return 0;
if (!XQueryTree(disp,base,&root_win,&parent_win,&list,&num))
if (!XQueryTree (disp, base, &root_win, &parent_win, &list, &num))
return base; return base;
if (list) 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; return child;
} }
} }
if (!i) break; if (!i)
break;
} }
XFree(list); XFree (list);
} }
return base; 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. * those X,Y co-ordinates.
*/ */
Window 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; GdkWindow *window;
GdkWindowPrivate *private; GdkWindowPrivate *private;
Display *disp; Display *disp;
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; unsigned int num;
int i; int i;
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); num = g_list_length (excludes);
num=g_list_length(excludes);
if (!XQueryTree(disp,root,&root_win,&parent_win,&list,&num)) XGrabServer (disp);
return root; if (!XQueryTree (disp, root, &root_win, &parent_win, &list, &num))
{
XUngrabServer(disp);
return root;
}
if (list) if (list)
{ {
i = num - 1; 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) if (xwa.map_state != IsViewable)
continue; continue;
if (excl_child && g_list_find(excludes,(gpointer *)list[i])) if (excl_child && g_list_find (excludes, (gpointer *) list[i]))
continue; continue;
if ((child = gdk_window_xid_at (list[i], 0, 0, x, y, excludes, excl_child)) == 0) 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 (excludes)
{ {
if (!g_list_find(excludes,(gpointer *)child)) if (!g_list_find (excludes, (gpointer *) child))
{ {
XFree(list); XFree (list);
XUngrabServer(disp); XUngrabServer (disp);
return child; return child;
} }
} }
else else
{ {
XFree(list); XFree (list);
XUngrabServer(disp); XUngrabServer (disp);
return child; return child;
} }
} while (--i > 0); } while (--i > 0);
XFree(list); XFree (list);
} }
XUngrabServer(disp); XUngrabServer (disp);
return root; return root;
} }
@ -1326,6 +1345,46 @@ gdk_window_get_pointer (GdkWindow *window,
return return_val; 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* GdkWindow*
gdk_window_get_parent (GdkWindow *window) gdk_window_get_parent (GdkWindow *window)
{ {

View File

@ -68,10 +68,10 @@ static GtkType gtk_box_child_type (GtkContainer *container);
static GtkContainerClass *parent_class = NULL; static GtkContainerClass *parent_class = NULL;
guint GtkType
gtk_box_get_type (void) gtk_box_get_type (void)
{ {
static guint box_type = 0; static GtkType box_type = 0;
if (!box_type) if (!box_type)
{ {
@ -86,7 +86,7 @@ gtk_box_get_type (void)
(GtkArgGetFunc) gtk_box_get_arg, (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; return box_type;
@ -103,7 +103,7 @@ gtk_box_class_init (GtkBoxClass *class)
widget_class = (GtkWidgetClass*) class; widget_class = (GtkWidgetClass*) class;
container_class = (GtkContainerClass*) 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::spacing", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_SPACING);
gtk_object_add_arg_type ("GtkBox::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS); gtk_object_add_arg_type ("GtkBox::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS);

View File

@ -8,7 +8,7 @@
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * Library General Public License for more details.
* *
* You should have received a copy of the GNU Library General Public * You should have received a copy of the GNU Library General Public
@ -26,22 +26,25 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#pragma }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define GTK_BOX(obj) GTK_CHECK_CAST (obj, gtk_box_get_type (), GtkBox) #define GTK_TYPE_BOX (gtk_box_get_type ())
#define GTK_BOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_box_get_type (), GtkBoxClass) #define GTK_BOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_BOX, GtkBox))
#define GTK_IS_BOX(obj) GTK_CHECK_TYPE (obj, gtk_box_get_type ()) #define GTK_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_BOX, GtkBoxClass))
#define GTK_IS_BOX(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_BOX))
#define GTK_IS_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BOX))
typedef struct _GtkBox GtkBox; typedef struct _GtkBox GtkBox;
typedef struct _GtkBoxClass GtkBoxClass; typedef struct _GtkBoxClass GtkBoxClass;
typedef struct _GtkBoxChild GtkBoxChild; typedef struct _GtkBoxChild GtkBoxChild;
struct _GtkBox struct _GtkBox
{ {
GtkContainer container; GtkContainer container;
GList *children; GList *children;
gint16 spacing; gint16 spacing;
guint homogeneous : 1; guint homogeneous : 1;
@ -62,39 +65,39 @@ struct _GtkBoxChild
}; };
guint gtk_box_get_type (void); GtkType gtk_box_get_type (void);
void gtk_box_pack_start (GtkBox *box, void gtk_box_pack_start (GtkBox *box,
GtkWidget *child, GtkWidget *child,
gboolean expand, gboolean expand,
gboolean fill, gboolean fill,
guint padding); guint padding);
void gtk_box_pack_end (GtkBox *box, void gtk_box_pack_end (GtkBox *box,
GtkWidget *child, GtkWidget *child,
gboolean expand, gboolean expand,
gboolean fill, gboolean fill,
guint padding); guint padding);
void gtk_box_pack_start_defaults (GtkBox *box, void gtk_box_pack_start_defaults (GtkBox *box,
GtkWidget *widget); GtkWidget *widget);
void gtk_box_pack_end_defaults (GtkBox *box, void gtk_box_pack_end_defaults (GtkBox *box,
GtkWidget *widget); GtkWidget *widget);
void gtk_box_set_homogeneous (GtkBox *box, void gtk_box_set_homogeneous (GtkBox *box,
gboolean homogeneous); gboolean homogeneous);
void gtk_box_set_spacing (GtkBox *box, void gtk_box_set_spacing (GtkBox *box,
gint spacing); gint spacing);
void gtk_box_reorder_child (GtkBox *box, void gtk_box_reorder_child (GtkBox *box,
GtkWidget *child, GtkWidget *child,
gint position); gint position);
void gtk_box_query_child_packing (GtkBox *box, void gtk_box_query_child_packing (GtkBox *box,
GtkWidget *child, GtkWidget *child,
gboolean *expand, gboolean *expand,
gboolean *fill, gboolean *fill,
guint *padding, guint *padding,
GtkPackType *pack_type); GtkPackType *pack_type);
void gtk_box_set_child_packing (GtkBox *box, void gtk_box_set_child_packing (GtkBox *box,
GtkWidget *child, GtkWidget *child,
gboolean expand, gboolean expand,
gboolean fill, gboolean fill,
guint padding, guint padding,
GtkPackType pack_type); GtkPackType pack_type);

View File

@ -27,10 +27,10 @@ static void gtk_hbox_size_allocate (GtkWidget *widget,
GtkAllocation *allocation); GtkAllocation *allocation);
guint GtkType
gtk_hbox_get_type (void) gtk_hbox_get_type (void)
{ {
static guint hbox_type = 0; static GtkType hbox_type = 0;
if (!hbox_type) if (!hbox_type)
{ {
@ -45,7 +45,7 @@ gtk_hbox_get_type (void)
(GtkArgGetFunc) NULL, (GtkArgGetFunc) NULL,
}; };
hbox_type = gtk_type_unique (gtk_box_get_type (), &hbox_info); hbox_type = gtk_type_unique (GTK_TYPE_BOX, &hbox_info);
} }
return hbox_type; return hbox_type;

View File

@ -8,7 +8,7 @@
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * Library General Public License for more details.
* *
* You should have received a copy of the GNU Library General Public * You should have received a copy of the GNU Library General Public
@ -26,15 +26,18 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#pragma }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define GTK_HBOX(obj) GTK_CHECK_CAST (obj, gtk_hbox_get_type (), GtkHBox) #define GTK_TYPE_HBOX (gtk_hbox_get_type ())
#define GTK_HBOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_hbox_get_type (), GtkHBoxClass) #define GTK_HBOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_HBOX, GtkHBox))
#define GTK_IS_HBOX(obj) GTK_CHECK_TYPE (obj, gtk_hbox_get_type ()) #define GTK_HBOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_HBOX, GtkHBoxClass))
#define GTK_IS_HBOX(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_HBOX))
#define GTK_IS_HBOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HBOX))
typedef struct _GtkHBox GtkHBox; typedef struct _GtkHBox GtkHBox;
typedef struct _GtkHBoxClass GtkHBoxClass; typedef struct _GtkHBoxClass GtkHBoxClass;
struct _GtkHBox struct _GtkHBox
@ -48,8 +51,8 @@ struct _GtkHBoxClass
}; };
guint gtk_hbox_get_type (void); GtkType gtk_hbox_get_type (void);
GtkWidget* gtk_hbox_new (gint homogeneous, GtkWidget* gtk_hbox_new (gint homogeneous,
gint spacing); gint spacing);

View File

@ -39,10 +39,10 @@ static void gtk_misc_get_arg (GtkMisc *misc,
guint arg_id); guint arg_id);
guint GtkType
gtk_misc_get_type (void) gtk_misc_get_type (void)
{ {
static guint misc_type = 0; static GtkType misc_type = 0;
if (!misc_type) if (!misc_type)
{ {
@ -57,7 +57,7 @@ gtk_misc_get_type (void)
(GtkArgGetFunc) gtk_misc_get_arg, (GtkArgGetFunc) gtk_misc_get_arg,
}; };
misc_type = gtk_type_unique (gtk_widget_get_type (), &misc_info); misc_type = gtk_type_unique (GTK_TYPE_WIDGET, &misc_info);
} }
return misc_type; return misc_type;

View File

@ -8,7 +8,7 @@
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * Library General Public License for more details.
* *
* You should have received a copy of the GNU Library General Public * You should have received a copy of the GNU Library General Public
@ -26,24 +26,27 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#pragma }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define GTK_MISC(obj) GTK_CHECK_CAST (obj, gtk_misc_get_type (), GtkMisc) #define GTK_TYPE_MISC (gtk_misc_get_type ())
#define GTK_MISC_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_misc_get_type (), GtkMiscClass) #define GTK_MISC(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MISC, GtkMisc))
#define GTK_IS_MISC(obj) GTK_CHECK_TYPE (obj, gtk_misc_get_type ()) #define GTK_MISC_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MISC, GtkMiscClass))
#define GTK_IS_MISC(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MISC))
#define GTK_IS_MISC_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MISC))
typedef struct _GtkMisc GtkMisc; typedef struct _GtkMisc GtkMisc;
typedef struct _GtkMiscClass GtkMiscClass; typedef struct _GtkMiscClass GtkMiscClass;
struct _GtkMisc struct _GtkMisc
{ {
GtkWidget widget; GtkWidget widget;
gfloat xalign; gfloat xalign;
gfloat yalign; gfloat yalign;
guint16 xpad; guint16 xpad;
guint16 ypad; guint16 ypad;
}; };
@ -54,13 +57,13 @@ struct _GtkMiscClass
}; };
guint gtk_misc_get_type (void); GtkType gtk_misc_get_type (void);
void gtk_misc_set_alignment (GtkMisc *misc, void gtk_misc_set_alignment (GtkMisc *misc,
gfloat xalign, gfloat xalign,
gfloat yalign); gfloat yalign);
void gtk_misc_set_padding (GtkMisc *misc, void gtk_misc_set_padding (GtkMisc *misc,
gint xpad, gint xpad,
gint ypad); gint ypad);
#ifdef __cplusplus #ifdef __cplusplus
@ -68,4 +71,4 @@ void gtk_misc_set_padding (GtkMisc *misc,
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* __GTK_LABEL_H__ */ #endif /* __GTK_MISC_H__ */

View File

@ -28,10 +28,10 @@ static void gtk_pixmap_finalize (GtkObject *object);
static GtkWidgetClass *parent_class; static GtkWidgetClass *parent_class;
guint GtkType
gtk_pixmap_get_type (void) gtk_pixmap_get_type (void)
{ {
static guint pixmap_type = 0; static GtkType pixmap_type = 0;
if (!pixmap_type) if (!pixmap_type)
{ {
@ -46,7 +46,7 @@ gtk_pixmap_get_type (void)
(GtkArgGetFunc) NULL, (GtkArgGetFunc) NULL,
}; };
pixmap_type = gtk_type_unique (gtk_misc_get_type (), &pixmap_info); pixmap_type = gtk_type_unique (GTK_TYPE_MISC, &pixmap_info);
} }
return pixmap_type; return pixmap_type;

View File

@ -8,7 +8,7 @@
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * Library General Public License for more details.
* *
* You should have received a copy of the GNU Library General Public * You should have received a copy of the GNU Library General Public
@ -26,21 +26,24 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#pragma }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define GTK_PIXMAP(obj) GTK_CHECK_CAST (obj, gtk_pixmap_get_type (), GtkPixmap) #define GTK_TYPE_PIXMAP (gtk_pixmap_get_type ())
#define GTK_PIXMAP_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_pixmap_get_type (), GtkPixmapClass) #define GTK_PIXMAP(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_PIXMAP, GtkPixmap))
#define GTK_IS_PIXMAP(obj) GTK_CHECK_TYPE (obj, gtk_pixmap_get_type ()) #define GTK_PIXMAP_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_PIXMAP, GtkPixmapClass))
#define GTK_IS_PIXMAP(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_PIXMAP))
#define GTK_IS_PIXMAP_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PIXMAP))
typedef struct _GtkPixmap GtkPixmap; typedef struct _GtkPixmap GtkPixmap;
typedef struct _GtkPixmapClass GtkPixmapClass; typedef struct _GtkPixmapClass GtkPixmapClass;
struct _GtkPixmap struct _GtkPixmap
{ {
GtkMisc misc; GtkMisc misc;
GdkPixmap *pixmap; GdkPixmap *pixmap;
GdkBitmap *mask; GdkBitmap *mask;
}; };
@ -51,13 +54,13 @@ struct _GtkPixmapClass
}; };
guint gtk_pixmap_get_type (void); GtkType gtk_pixmap_get_type (void);
GtkWidget* gtk_pixmap_new (GdkPixmap *pixmap, GtkWidget* gtk_pixmap_new (GdkPixmap *pixmap,
GdkBitmap *mask); GdkBitmap *mask);
void gtk_pixmap_set (GtkPixmap *pixmap, void gtk_pixmap_set (GtkPixmap *pixmap,
GdkPixmap *val, GdkPixmap *val,
GdkBitmap *mask); GdkBitmap *mask);
void gtk_pixmap_get (GtkPixmap *pixmap, void gtk_pixmap_get (GtkPixmap *pixmap,
GdkPixmap **val, GdkPixmap **val,
GdkBitmap **mask); GdkBitmap **mask);

View File

@ -367,6 +367,8 @@ gtk_table_init (GtkTable *table)
table->column_spacing = 0; table->column_spacing = 0;
table->row_spacing = 0; table->row_spacing = 0;
table->homogeneous = FALSE; table->homogeneous = FALSE;
gtk_table_resize (table, 1, 1);
} }
GtkWidget* GtkWidget*
@ -544,8 +546,7 @@ gtk_table_set_row_spacing (GtkTable *table,
{ {
g_return_if_fail (table != NULL); g_return_if_fail (table != NULL);
g_return_if_fail (GTK_IS_TABLE (table)); g_return_if_fail (GTK_IS_TABLE (table));
/* g_return_if_fail ((row >= 0) && (row < (table->nrows - 1))); */ g_return_if_fail (row + 1 < table->nrows);
g_return_if_fail (row < table->nrows - 1);
if (table->rows[row].spacing != spacing) if (table->rows[row].spacing != spacing)
{ {
@ -563,8 +564,7 @@ gtk_table_set_col_spacing (GtkTable *table,
{ {
g_return_if_fail (table != NULL); g_return_if_fail (table != NULL);
g_return_if_fail (GTK_IS_TABLE (table)); g_return_if_fail (GTK_IS_TABLE (table));
/* g_return_if_fail ((column >= 0) && (column < (table->ncols - 1))); */ g_return_if_fail (column + 1 < table->ncols);
g_return_if_fail (column < table->ncols - 1);
if (table->cols[column].spacing != spacing) if (table->cols[column].spacing != spacing)
{ {
@ -585,7 +585,7 @@ gtk_table_set_row_spacings (GtkTable *table,
g_return_if_fail (GTK_IS_TABLE (table)); g_return_if_fail (GTK_IS_TABLE (table));
table->row_spacing = spacing; table->row_spacing = spacing;
for (row = 0; row < table->nrows - 1; row++) for (row = 0; row + 1 < table->nrows; row++)
table->rows[row].spacing = spacing; table->rows[row].spacing = spacing;
if (GTK_WIDGET_VISIBLE (table)) if (GTK_WIDGET_VISIBLE (table))
@ -602,7 +602,7 @@ gtk_table_set_col_spacings (GtkTable *table,
g_return_if_fail (GTK_IS_TABLE (table)); g_return_if_fail (GTK_IS_TABLE (table));
table->column_spacing = spacing; table->column_spacing = spacing;
for (col = 0; col < table->ncols - 1; col++) for (col = 0; col + 1 < table->ncols; col++)
table->cols[col].spacing = spacing; table->cols[col].spacing = spacing;
if (GTK_WIDGET_VISIBLE (table)) if (GTK_WIDGET_VISIBLE (table))
@ -777,12 +777,12 @@ gtk_table_size_request (GtkWidget *widget,
for (col = 0; col < table->ncols; col++) for (col = 0; col < table->ncols; col++)
requisition->width += table->cols[col].requisition; requisition->width += table->cols[col].requisition;
for (col = 0; col < table->ncols - 1; col++) for (col = 0; col + 1 < table->ncols; col++)
requisition->width += table->cols[col].spacing; requisition->width += table->cols[col].spacing;
for (row = 0; row < table->nrows; row++) for (row = 0; row < table->nrows; row++)
requisition->height += table->rows[row].requisition; requisition->height += table->rows[row].requisition;
for (row = 0; row < table->nrows - 1; row++) for (row = 0; row + 1 < table->nrows; row++)
requisition->height += table->rows[row].spacing; requisition->height += table->rows[row].spacing;
requisition->width += GTK_CONTAINER (table)->border_width * 2; requisition->width += GTK_CONTAINER (table)->border_width * 2;
@ -1244,7 +1244,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
{ {
width = real_width; width = real_width;
for (col = 0; col < table->ncols - 1; col++) for (col = 0; col + 1 < table->ncols; col++)
width -= table->cols[col].spacing; width -= table->cols[col].spacing;
for (col = 0; col < table->ncols; col++) for (col = 0; col < table->ncols; col++)
@ -1269,7 +1269,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
if (table->cols[col].shrink) if (table->cols[col].shrink)
nshrink += 1; nshrink += 1;
} }
for (col = 0; col < table->ncols - 1; col++) for (col = 0; col + 1 < table->ncols; col++)
width += table->cols[col].spacing; width += table->cols[col].spacing;
/* Check to see if we were allocated more width than we requested. /* Check to see if we were allocated more width than we requested.
@ -1321,7 +1321,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
{ {
height = real_height; height = real_height;
for (row = 0; row < table->nrows - 1; row++) for (row = 0; row + 1 < table->nrows; row++)
height -= table->rows[row].spacing; height -= table->rows[row].spacing;
@ -1347,7 +1347,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
if (table->rows[row].shrink) if (table->rows[row].shrink)
nshrink += 1; nshrink += 1;
} }
for (row = 0; row < table->nrows - 1; row++) for (row = 0; row + 1 < table->nrows; row++)
height += table->rows[row].spacing; height += table->rows[row].spacing;
/* Check to see if we were allocated more height than we requested. /* Check to see if we were allocated more height than we requested.

View File

@ -27,10 +27,10 @@ static void gtk_vbox_size_allocate (GtkWidget *widget,
GtkAllocation *allocation); GtkAllocation *allocation);
guint GtkType
gtk_vbox_get_type (void) gtk_vbox_get_type (void)
{ {
static guint vbox_type = 0; static GtkType vbox_type = 0;
if (!vbox_type) if (!vbox_type)
{ {
@ -45,7 +45,7 @@ gtk_vbox_get_type (void)
(GtkArgGetFunc) NULL, (GtkArgGetFunc) NULL,
}; };
vbox_type = gtk_type_unique (gtk_box_get_type (), &vbox_info); vbox_type = gtk_type_unique (GTK_TYPE_BOX, &vbox_info);
} }
return vbox_type; return vbox_type;

View File

@ -8,7 +8,7 @@
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * Library General Public License for more details.
* *
* You should have received a copy of the GNU Library General Public * You should have received a copy of the GNU Library General Public
@ -26,15 +26,18 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#pragma }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define GTK_VBOX(obj) GTK_CHECK_CAST (obj, gtk_vbox_get_type (), GtkVBox) #define GTK_TYPE_VBOX (gtk_vbox_get_type ())
#define GTK_VBOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_vbox_get_type (), GtkVBoxClass) #define GTK_VBOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_VBOX, GtkVBox))
#define GTK_IS_VBOX(obj) GTK_CHECK_TYPE (obj, gtk_vbox_get_type ()) #define GTK_VBOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_VBOX, GtkVBoxClass))
#define GTK_IS_VBOX(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_VBOX))
#define GTK_IS_VBOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VBOX))
typedef struct _GtkVBox GtkVBox; typedef struct _GtkVBox GtkVBox;
typedef struct _GtkVBoxClass GtkVBoxClass; typedef struct _GtkVBoxClass GtkVBoxClass;
struct _GtkVBox struct _GtkVBox
@ -48,8 +51,8 @@ struct _GtkVBoxClass
}; };
guint gtk_vbox_get_type (void); GtkType gtk_vbox_get_type (void);
GtkWidget* gtk_vbox_new (gint homogeneous, GtkWidget* gtk_vbox_new (gint homogeneous,
gint spacing); gint spacing);

View File

@ -2532,6 +2532,7 @@ gtk_widget_set_parent (GtkWidget *widget,
g_return_if_fail (widget->parent == NULL); g_return_if_fail (widget->parent == NULL);
g_return_if_fail (!GTK_WIDGET_TOPLEVEL (widget)); g_return_if_fail (!GTK_WIDGET_TOPLEVEL (widget));
g_return_if_fail (parent != NULL); g_return_if_fail (parent != NULL);
g_return_if_fail (widget != parent);
/* keep this function in sync with gtk_menu_attach_to_widget() /* keep this function in sync with gtk_menu_attach_to_widget()
*/ */
@ -2549,9 +2550,6 @@ gtk_widget_set_parent (GtkWidget *widget,
gtk_widget_propagate_state (widget, &data); gtk_widget_propagate_state (widget, &data);
while (parent->parent != NULL)
parent = parent->parent;
gtk_widget_set_style_recurse (widget, NULL); gtk_widget_set_style_recurse (widget, NULL);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], NULL); gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], NULL);