diff options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 16 | ||||
-rw-r--r-- | gdk/gdk.h | 4 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 135 | ||||
-rw-r--r-- | gdk/x11/gdkwindow-x11.c | 135 | ||||
-rw-r--r-- | gtk/gtkbox.c | 8 | ||||
-rw-r--r-- | gtk/gtkbox.h | 47 | ||||
-rw-r--r-- | gtk/gtkhbox.c | 6 | ||||
-rw-r--r-- | gtk/gtkhbox.h | 17 | ||||
-rw-r--r-- | gtk/gtkmisc.c | 6 | ||||
-rw-r--r-- | gtk/gtkmisc.h | 33 | ||||
-rw-r--r-- | gtk/gtkpixmap.c | 6 | ||||
-rw-r--r-- | gtk/gtkpixmap.h | 25 | ||||
-rw-r--r-- | gtk/gtktable.c | 24 | ||||
-rw-r--r-- | gtk/gtkvbox.c | 6 | ||||
-rw-r--r-- | gtk/gtkvbox.h | 17 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 4 |
22 files changed, 415 insertions, 170 deletions
@@ -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> * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 79e28b1e87..cdd2445df8 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -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> * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 79e28b1e87..cdd2445df8 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -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> * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 79e28b1e87..cdd2445df8 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -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> * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 79e28b1e87..cdd2445df8 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -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> * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 79e28b1e87..cdd2445df8 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -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> * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 79e28b1e87..cdd2445df8 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -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> * 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); diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 033427d58a..46211d1142 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -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; } @@ -1327,6 +1346,46 @@ gdk_window_get_pointer (GdkWindow *window, } 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) { g_return_val_if_fail (window != NULL, NULL); diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 033427d58a..46211d1142 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -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; } @@ -1327,6 +1346,46 @@ gdk_window_get_pointer (GdkWindow *window, } 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) { g_return_val_if_fail (window != NULL, NULL); diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 8ed7dc022b..0804b1d21d 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -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); diff --git a/gtk/gtkbox.h b/gtk/gtkbox.h index 223207f958..db7a26798d 100644 --- a/gtk/gtkbox.h +++ b/gtk/gtkbox.h @@ -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 @@ -26,22 +26,25 @@ #ifdef __cplusplus extern "C" { +#pragma } #endif /* __cplusplus */ -#define GTK_BOX(obj) GTK_CHECK_CAST (obj, gtk_box_get_type (), GtkBox) -#define GTK_BOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_box_get_type (), GtkBoxClass) -#define GTK_IS_BOX(obj) GTK_CHECK_TYPE (obj, gtk_box_get_type ()) +#define GTK_TYPE_BOX (gtk_box_get_type ()) +#define GTK_BOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_BOX, GtkBox)) +#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 _GtkBoxChild GtkBoxChild; struct _GtkBox { GtkContainer container; - + GList *children; gint16 spacing; guint homogeneous : 1; @@ -62,39 +65,39 @@ struct _GtkBoxChild }; -guint gtk_box_get_type (void); -void gtk_box_pack_start (GtkBox *box, +GtkType gtk_box_get_type (void); +void gtk_box_pack_start (GtkBox *box, GtkWidget *child, gboolean expand, gboolean fill, - guint padding); -void gtk_box_pack_end (GtkBox *box, + guint padding); +void gtk_box_pack_end (GtkBox *box, GtkWidget *child, gboolean expand, gboolean fill, - guint padding); -void gtk_box_pack_start_defaults (GtkBox *box, + guint padding); +void gtk_box_pack_start_defaults (GtkBox *box, GtkWidget *widget); -void gtk_box_pack_end_defaults (GtkBox *box, +void gtk_box_pack_end_defaults (GtkBox *box, GtkWidget *widget); -void gtk_box_set_homogeneous (GtkBox *box, +void gtk_box_set_homogeneous (GtkBox *box, gboolean homogeneous); -void gtk_box_set_spacing (GtkBox *box, - gint spacing); -void gtk_box_reorder_child (GtkBox *box, +void gtk_box_set_spacing (GtkBox *box, + gint spacing); +void gtk_box_reorder_child (GtkBox *box, GtkWidget *child, - gint position); -void gtk_box_query_child_packing (GtkBox *box, + gint position); +void gtk_box_query_child_packing (GtkBox *box, GtkWidget *child, gboolean *expand, gboolean *fill, - guint *padding, + guint *padding, GtkPackType *pack_type); -void gtk_box_set_child_packing (GtkBox *box, +void gtk_box_set_child_packing (GtkBox *box, GtkWidget *child, gboolean expand, gboolean fill, - guint padding, + guint padding, GtkPackType pack_type); diff --git a/gtk/gtkhbox.c b/gtk/gtkhbox.c index 98a4843b03..9b36dc7e1b 100644 --- a/gtk/gtkhbox.c +++ b/gtk/gtkhbox.c @@ -27,10 +27,10 @@ static void gtk_hbox_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -guint +GtkType gtk_hbox_get_type (void) { - static guint hbox_type = 0; + static GtkType hbox_type = 0; if (!hbox_type) { @@ -45,7 +45,7 @@ gtk_hbox_get_type (void) (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; diff --git a/gtk/gtkhbox.h b/gtk/gtkhbox.h index 7d0dd95c1e..1bf5cb088c 100644 --- a/gtk/gtkhbox.h +++ b/gtk/gtkhbox.h @@ -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 @@ -26,15 +26,18 @@ #ifdef __cplusplus extern "C" { +#pragma } #endif /* __cplusplus */ -#define GTK_HBOX(obj) GTK_CHECK_CAST (obj, gtk_hbox_get_type (), GtkHBox) -#define GTK_HBOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_hbox_get_type (), GtkHBoxClass) -#define GTK_IS_HBOX(obj) GTK_CHECK_TYPE (obj, gtk_hbox_get_type ()) +#define GTK_TYPE_HBOX (gtk_hbox_get_type ()) +#define GTK_HBOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_HBOX, GtkHBox)) +#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; struct _GtkHBox @@ -48,8 +51,8 @@ struct _GtkHBoxClass }; -guint gtk_hbox_get_type (void); -GtkWidget* gtk_hbox_new (gint homogeneous, +GtkType gtk_hbox_get_type (void); +GtkWidget* gtk_hbox_new (gint homogeneous, gint spacing); diff --git a/gtk/gtkmisc.c b/gtk/gtkmisc.c index 4c773b9773..bfe4d2fdcc 100644 --- a/gtk/gtkmisc.c +++ b/gtk/gtkmisc.c @@ -39,10 +39,10 @@ static void gtk_misc_get_arg (GtkMisc *misc, guint arg_id); -guint +GtkType gtk_misc_get_type (void) { - static guint misc_type = 0; + static GtkType misc_type = 0; if (!misc_type) { @@ -57,7 +57,7 @@ gtk_misc_get_type (void) (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; diff --git a/gtk/gtkmisc.h b/gtk/gtkmisc.h index bcb28d61b4..0e1de8e6eb 100644 --- a/gtk/gtkmisc.h +++ b/gtk/gtkmisc.h @@ -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 @@ -26,24 +26,27 @@ #ifdef __cplusplus extern "C" { +#pragma } #endif /* __cplusplus */ -#define GTK_MISC(obj) GTK_CHECK_CAST (obj, gtk_misc_get_type (), GtkMisc) -#define GTK_MISC_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_misc_get_type (), GtkMiscClass) -#define GTK_IS_MISC(obj) GTK_CHECK_TYPE (obj, gtk_misc_get_type ()) +#define GTK_TYPE_MISC (gtk_misc_get_type ()) +#define GTK_MISC(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MISC, GtkMisc)) +#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; struct _GtkMisc { GtkWidget widget; - + gfloat xalign; gfloat yalign; - + guint16 xpad; guint16 ypad; }; @@ -54,13 +57,13 @@ struct _GtkMiscClass }; -guint gtk_misc_get_type (void); -void gtk_misc_set_alignment (GtkMisc *misc, - gfloat xalign, - gfloat yalign); -void gtk_misc_set_padding (GtkMisc *misc, - gint xpad, - gint ypad); +GtkType gtk_misc_get_type (void); +void gtk_misc_set_alignment (GtkMisc *misc, + gfloat xalign, + gfloat yalign); +void gtk_misc_set_padding (GtkMisc *misc, + gint xpad, + gint ypad); #ifdef __cplusplus @@ -68,4 +71,4 @@ void gtk_misc_set_padding (GtkMisc *misc, #endif /* __cplusplus */ -#endif /* __GTK_LABEL_H__ */ +#endif /* __GTK_MISC_H__ */ diff --git a/gtk/gtkpixmap.c b/gtk/gtkpixmap.c index 06e9aa7312..eec55f0bf0 100644 --- a/gtk/gtkpixmap.c +++ b/gtk/gtkpixmap.c @@ -28,10 +28,10 @@ static void gtk_pixmap_finalize (GtkObject *object); static GtkWidgetClass *parent_class; -guint +GtkType gtk_pixmap_get_type (void) { - static guint pixmap_type = 0; + static GtkType pixmap_type = 0; if (!pixmap_type) { @@ -46,7 +46,7 @@ gtk_pixmap_get_type (void) (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; diff --git a/gtk/gtkpixmap.h b/gtk/gtkpixmap.h index 9a7d5ad6ac..fbcc74c6f0 100644 --- a/gtk/gtkpixmap.h +++ b/gtk/gtkpixmap.h @@ -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 @@ -26,21 +26,24 @@ #ifdef __cplusplus extern "C" { +#pragma } #endif /* __cplusplus */ -#define GTK_PIXMAP(obj) GTK_CHECK_CAST (obj, gtk_pixmap_get_type (), GtkPixmap) -#define GTK_PIXMAP_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_pixmap_get_type (), GtkPixmapClass) -#define GTK_IS_PIXMAP(obj) GTK_CHECK_TYPE (obj, gtk_pixmap_get_type ()) +#define GTK_TYPE_PIXMAP (gtk_pixmap_get_type ()) +#define GTK_PIXMAP(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_PIXMAP, GtkPixmap)) +#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 _GtkPixmapClass GtkPixmapClass; +typedef struct _GtkPixmap GtkPixmap; +typedef struct _GtkPixmapClass GtkPixmapClass; struct _GtkPixmap { GtkMisc misc; - + GdkPixmap *pixmap; GdkBitmap *mask; }; @@ -51,13 +54,13 @@ struct _GtkPixmapClass }; -guint gtk_pixmap_get_type (void); -GtkWidget* gtk_pixmap_new (GdkPixmap *pixmap, +GtkType gtk_pixmap_get_type (void); +GtkWidget* gtk_pixmap_new (GdkPixmap *pixmap, GdkBitmap *mask); -void gtk_pixmap_set (GtkPixmap *pixmap, +void gtk_pixmap_set (GtkPixmap *pixmap, GdkPixmap *val, GdkBitmap *mask); -void gtk_pixmap_get (GtkPixmap *pixmap, +void gtk_pixmap_get (GtkPixmap *pixmap, GdkPixmap **val, GdkBitmap **mask); diff --git a/gtk/gtktable.c b/gtk/gtktable.c index d3b3e36538..a62dc59385 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -367,6 +367,8 @@ gtk_table_init (GtkTable *table) table->column_spacing = 0; table->row_spacing = 0; table->homogeneous = FALSE; + + gtk_table_resize (table, 1, 1); } GtkWidget* @@ -544,8 +546,7 @@ gtk_table_set_row_spacing (GtkTable *table, { g_return_if_fail (table != NULL); g_return_if_fail (GTK_IS_TABLE (table)); - /* g_return_if_fail ((row >= 0) && (row < (table->nrows - 1))); */ - g_return_if_fail (row < table->nrows - 1); + g_return_if_fail (row + 1 < table->nrows); 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 (GTK_IS_TABLE (table)); - /* g_return_if_fail ((column >= 0) && (column < (table->ncols - 1))); */ - g_return_if_fail (column < table->ncols - 1); + g_return_if_fail (column + 1 < table->ncols); 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)); 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; if (GTK_WIDGET_VISIBLE (table)) @@ -602,7 +602,7 @@ gtk_table_set_col_spacings (GtkTable *table, g_return_if_fail (GTK_IS_TABLE (table)); 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; if (GTK_WIDGET_VISIBLE (table)) @@ -777,12 +777,12 @@ gtk_table_size_request (GtkWidget *widget, for (col = 0; col < table->ncols; col++) 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; for (row = 0; row < table->nrows; row++) 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->width += GTK_CONTAINER (table)->border_width * 2; @@ -1244,7 +1244,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table) { width = real_width; - for (col = 0; col < table->ncols - 1; col++) + for (col = 0; col + 1 < table->ncols; col++) width -= table->cols[col].spacing; for (col = 0; col < table->ncols; col++) @@ -1269,7 +1269,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table) if (table->cols[col].shrink) nshrink += 1; } - for (col = 0; col < table->ncols - 1; col++) + for (col = 0; col + 1 < table->ncols; col++) width += table->cols[col].spacing; /* 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; - for (row = 0; row < table->nrows - 1; row++) + for (row = 0; row + 1 < table->nrows; row++) height -= table->rows[row].spacing; @@ -1347,7 +1347,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table) if (table->rows[row].shrink) nshrink += 1; } - for (row = 0; row < table->nrows - 1; row++) + for (row = 0; row + 1 < table->nrows; row++) height += table->rows[row].spacing; /* Check to see if we were allocated more height than we requested. diff --git a/gtk/gtkvbox.c b/gtk/gtkvbox.c index 4e9cc7921d..b819700af4 100644 --- a/gtk/gtkvbox.c +++ b/gtk/gtkvbox.c @@ -27,10 +27,10 @@ static void gtk_vbox_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -guint +GtkType gtk_vbox_get_type (void) { - static guint vbox_type = 0; + static GtkType vbox_type = 0; if (!vbox_type) { @@ -45,7 +45,7 @@ gtk_vbox_get_type (void) (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; diff --git a/gtk/gtkvbox.h b/gtk/gtkvbox.h index dc9213639b..bf72719594 100644 --- a/gtk/gtkvbox.h +++ b/gtk/gtkvbox.h @@ -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 @@ -26,15 +26,18 @@ #ifdef __cplusplus extern "C" { +#pragma } #endif /* __cplusplus */ -#define GTK_VBOX(obj) GTK_CHECK_CAST (obj, gtk_vbox_get_type (), GtkVBox) -#define GTK_VBOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_vbox_get_type (), GtkVBoxClass) -#define GTK_IS_VBOX(obj) GTK_CHECK_TYPE (obj, gtk_vbox_get_type ()) +#define GTK_TYPE_VBOX (gtk_vbox_get_type ()) +#define GTK_VBOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_VBOX, GtkVBox)) +#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; struct _GtkVBox @@ -48,8 +51,8 @@ struct _GtkVBoxClass }; -guint gtk_vbox_get_type (void); -GtkWidget* gtk_vbox_new (gint homogeneous, +GtkType gtk_vbox_get_type (void); +GtkWidget* gtk_vbox_new (gint homogeneous, gint spacing); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 0737c20677..d428ce96ee 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -2532,6 +2532,7 @@ gtk_widget_set_parent (GtkWidget *widget, g_return_if_fail (widget->parent == NULL); g_return_if_fail (!GTK_WIDGET_TOPLEVEL (widget)); g_return_if_fail (parent != NULL); + g_return_if_fail (widget != parent); /* 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); - while (parent->parent != NULL) - parent = parent->parent; - gtk_widget_set_style_recurse (widget, NULL); gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], NULL); |