summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>1998-09-04 15:02:08 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-09-04 15:02:08 +0000
commite9c260180cd03a12c44807a81f236d43fbaf3cc0 (patch)
treed7ce46f49efc480622558ed75353cc998b9231d4
parent9d4587fc545fb576c065cc1a01e55e8a6ff531a3 (diff)
downloadgtk+-e9c260180cd03a12c44807a81f236d43fbaf3cc0.tar.gz
Merges from HEAD.
Thu Sep 3 19:45:34 1998 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.c: Use g_module instead of dlopen() Thu Sep 3 19:30:11 1998 Owen Taylor <otaylor@redhat.com> * gtk/gtktooltips.c (gtk_tooltips_expose): Check if we've changed widgets since the expose event was queued.
-rw-r--r--ChangeLog192
-rw-r--r--ChangeLog.pre-2-0192
-rw-r--r--ChangeLog.pre-2-10192
-rw-r--r--ChangeLog.pre-2-2192
-rw-r--r--ChangeLog.pre-2-4192
-rw-r--r--ChangeLog.pre-2-6192
-rw-r--r--ChangeLog.pre-2-8192
-rw-r--r--TODO1
-rw-r--r--docs/gtk.texi356
-rw-r--r--gdk/gdkcolor.c8
-rw-r--r--gdk/gdkrgb.c419
-rw-r--r--gdk/gdkrgb.h13
-rw-r--r--gdk/gdkwindow.c1
-rw-r--r--gdk/x11/gdkcolor-x11.c8
-rw-r--r--gdk/x11/gdkwindow-x11.c1
-rw-r--r--gtk/.cvsignore1
-rw-r--r--gtk/Makefile.am4
-rw-r--r--gtk/gtk.defs1
-rw-r--r--gtk/gtkaccelgroup.c6
-rw-r--r--gtk/gtkbin.c12
-rw-r--r--gtk/gtkbox.c12
-rw-r--r--gtk/gtkclist.c120
-rw-r--r--gtk/gtkclist.h440
-rw-r--r--gtk/gtkcolorsel.c20
-rw-r--r--gtk/gtkcontainer.c136
-rw-r--r--gtk/gtkcontainer.h6
-rw-r--r--gtk/gtkctree.c38
-rw-r--r--gtk/gtkctree.h8
-rw-r--r--gtk/gtkfixed.c26
-rw-r--r--gtk/gtkfixed.h11
-rw-r--r--gtk/gtkitem.c8
-rw-r--r--gtk/gtkitem.h17
-rw-r--r--gtk/gtkitemfactory.c7
-rw-r--r--gtk/gtklabel.c5
-rw-r--r--gtk/gtklist.c20
-rw-r--r--gtk/gtklistitem.c3
-rw-r--r--gtk/gtkmenu.c52
-rw-r--r--gtk/gtkmenuitem.c56
-rw-r--r--gtk/gtkmenushell.c29
-rw-r--r--gtk/gtknotebook.c83
-rw-r--r--gtk/gtknotebook.h4
-rw-r--r--gtk/gtkoptionmenu.c106
-rw-r--r--gtk/gtkpacker.c14
-rw-r--r--gtk/gtkpaned.c152
-rw-r--r--gtk/gtkscrolledwindow.c27
-rw-r--r--gtk/gtktable.c12
-rw-r--r--gtk/gtkthemes.c28
-rw-r--r--gtk/gtktoolbar.c28
-rw-r--r--gtk/gtktooltips.c62
-rw-r--r--gtk/gtktooltips.h40
-rw-r--r--gtk/gtktree.c15
-rw-r--r--gtk/gtktreeitem.c202
-rw-r--r--gtk/gtktypebuiltins.h2
-rw-r--r--gtk/gtktypebuiltins_evals.c1
-rw-r--r--gtk/gtkwidget.c144
-rw-r--r--gtk/gtkwidget.h24
-rw-r--r--gtk/testgtkrc2
-rw-r--r--gtk/testrgb.c237
-rw-r--r--gtk/testthreads.c1
-rw-r--r--tests/testgtkrc2
-rw-r--r--tests/testrgb.c237
-rw-r--r--tests/testthreads.c1
62 files changed, 3634 insertions, 979 deletions
diff --git a/ChangeLog b/ChangeLog
index c7523f59ee..21a19f895f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Thu Sep 3 19:45:34 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkthemes.c: Use g_module instead of dlopen();
+
+Thu Sep 3 19:30:11 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c (gtk_tooltips_expose): Check
+ if we've changed widgets since the expose event
+ was queued.
+
Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkprogress.c (gtk_progress_finalize): Unref
@@ -109,6 +119,188 @@ Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
* made gtkrc scanner append dir that gtkrc is read from to pixmap path.
+Thu Sep 3 07:16:54 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkctree.h:
+ * gtk/gtkctree.c: `const' fixups.
+
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: `const' fixups and some coding style adaptions.
+
+ * gtk/gtkctree.c (gtk_ctree_insert_node): don't dereference *text
+ if it is passed as NULL.
+
+Wed Sep 2 22:41:40 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Fixed 32bpp image depth
+ big-endian cases. Added a 4bpp packed gray mode (somewhat
+ incorrectly hardwired to MSB), which should take care of
+ Stric's hardware.
+
+Thu Sep 3 04:45:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): plug another small
+ GtkSIgnalQuery leak.
+
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
+1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
+ constructs by more forgiving ones. (Does anyone else feel like
+ the color selector need rewriting?).
+
+Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkprogress.c (gtk_progress_finalize): Unref
+ the adjustment.
+
+ * gtk/gtkmenu.c: Modified reference counting so
+ that the reference count from the toplevel that
+ the menu creates to the menu is invisible to the
+ application.
+
+Mon Aug 31 21:36:31 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Improved the 24bpp
+ conversion selection logic, so Suns and other big-endian
+ machines should get faster conv routines. This is also the
+ point where 4bpp gray and 1bpp are checked in, although I
+ wouldn't be surprised if 1bpp is a little buggy. This is
+ synchronized with the 0.0.7 release of GdkRgb.
+
+ * gtk/Makefile.am:
+ * gtk/testrgb.c: Checked in testrgb.c to CVS, and made the
+ appropriate change to the Makefile.am
+
+Mon Aug 31 15:18:19 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.[ch]: Added a gdk_draw_rgb_image_dithalign function,
+ which is good for images that scroll (makes the dither patterns
+ align correctly)
+
+Sat Aug 29 14:50:56 PDT 1998 Manish Singh <yosh@gimp.org>
+
+ * gdk/gdkcolor.c:
+ (gdk_colormap_new) (gdk_colormap_get_system):
+ quell some warnings with g_hash_table_new
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): free the GtkSignalQuery
+ when we're done with it
+
+ * gtk/itemfactory.c:
+ (gtk_item_factory_from_path):
+ (gtk_item_factory_create_item): free some strings
+
+ * gtk/gtklabel.c:
+ (gtk_label_finalize): free label->pattern when done
+ (gtk_label_parse_uline): null terminate pattern string, delete
+ some duplicated code
+
+ * gtk/testthreads.c: add #include <unistd.h> for sleep()
+
Mon Aug 24 18:37:15 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Reference count the fonts used in
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index c7523f59ee..21a19f895f 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,13 @@
+Thu Sep 3 19:45:34 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkthemes.c: Use g_module instead of dlopen();
+
+Thu Sep 3 19:30:11 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c (gtk_tooltips_expose): Check
+ if we've changed widgets since the expose event
+ was queued.
+
Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkprogress.c (gtk_progress_finalize): Unref
@@ -109,6 +119,188 @@ Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
* made gtkrc scanner append dir that gtkrc is read from to pixmap path.
+Thu Sep 3 07:16:54 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkctree.h:
+ * gtk/gtkctree.c: `const' fixups.
+
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: `const' fixups and some coding style adaptions.
+
+ * gtk/gtkctree.c (gtk_ctree_insert_node): don't dereference *text
+ if it is passed as NULL.
+
+Wed Sep 2 22:41:40 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Fixed 32bpp image depth
+ big-endian cases. Added a 4bpp packed gray mode (somewhat
+ incorrectly hardwired to MSB), which should take care of
+ Stric's hardware.
+
+Thu Sep 3 04:45:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): plug another small
+ GtkSIgnalQuery leak.
+
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
+1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
+ constructs by more forgiving ones. (Does anyone else feel like
+ the color selector need rewriting?).
+
+Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkprogress.c (gtk_progress_finalize): Unref
+ the adjustment.
+
+ * gtk/gtkmenu.c: Modified reference counting so
+ that the reference count from the toplevel that
+ the menu creates to the menu is invisible to the
+ application.
+
+Mon Aug 31 21:36:31 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Improved the 24bpp
+ conversion selection logic, so Suns and other big-endian
+ machines should get faster conv routines. This is also the
+ point where 4bpp gray and 1bpp are checked in, although I
+ wouldn't be surprised if 1bpp is a little buggy. This is
+ synchronized with the 0.0.7 release of GdkRgb.
+
+ * gtk/Makefile.am:
+ * gtk/testrgb.c: Checked in testrgb.c to CVS, and made the
+ appropriate change to the Makefile.am
+
+Mon Aug 31 15:18:19 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.[ch]: Added a gdk_draw_rgb_image_dithalign function,
+ which is good for images that scroll (makes the dither patterns
+ align correctly)
+
+Sat Aug 29 14:50:56 PDT 1998 Manish Singh <yosh@gimp.org>
+
+ * gdk/gdkcolor.c:
+ (gdk_colormap_new) (gdk_colormap_get_system):
+ quell some warnings with g_hash_table_new
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): free the GtkSignalQuery
+ when we're done with it
+
+ * gtk/itemfactory.c:
+ (gtk_item_factory_from_path):
+ (gtk_item_factory_create_item): free some strings
+
+ * gtk/gtklabel.c:
+ (gtk_label_finalize): free label->pattern when done
+ (gtk_label_parse_uline): null terminate pattern string, delete
+ some duplicated code
+
+ * gtk/testthreads.c: add #include <unistd.h> for sleep()
+
Mon Aug 24 18:37:15 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Reference count the fonts used in
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index c7523f59ee..21a19f895f 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,13 @@
+Thu Sep 3 19:45:34 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkthemes.c: Use g_module instead of dlopen();
+
+Thu Sep 3 19:30:11 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c (gtk_tooltips_expose): Check
+ if we've changed widgets since the expose event
+ was queued.
+
Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkprogress.c (gtk_progress_finalize): Unref
@@ -109,6 +119,188 @@ Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
* made gtkrc scanner append dir that gtkrc is read from to pixmap path.
+Thu Sep 3 07:16:54 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkctree.h:
+ * gtk/gtkctree.c: `const' fixups.
+
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: `const' fixups and some coding style adaptions.
+
+ * gtk/gtkctree.c (gtk_ctree_insert_node): don't dereference *text
+ if it is passed as NULL.
+
+Wed Sep 2 22:41:40 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Fixed 32bpp image depth
+ big-endian cases. Added a 4bpp packed gray mode (somewhat
+ incorrectly hardwired to MSB), which should take care of
+ Stric's hardware.
+
+Thu Sep 3 04:45:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): plug another small
+ GtkSIgnalQuery leak.
+
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
+1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
+ constructs by more forgiving ones. (Does anyone else feel like
+ the color selector need rewriting?).
+
+Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkprogress.c (gtk_progress_finalize): Unref
+ the adjustment.
+
+ * gtk/gtkmenu.c: Modified reference counting so
+ that the reference count from the toplevel that
+ the menu creates to the menu is invisible to the
+ application.
+
+Mon Aug 31 21:36:31 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Improved the 24bpp
+ conversion selection logic, so Suns and other big-endian
+ machines should get faster conv routines. This is also the
+ point where 4bpp gray and 1bpp are checked in, although I
+ wouldn't be surprised if 1bpp is a little buggy. This is
+ synchronized with the 0.0.7 release of GdkRgb.
+
+ * gtk/Makefile.am:
+ * gtk/testrgb.c: Checked in testrgb.c to CVS, and made the
+ appropriate change to the Makefile.am
+
+Mon Aug 31 15:18:19 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.[ch]: Added a gdk_draw_rgb_image_dithalign function,
+ which is good for images that scroll (makes the dither patterns
+ align correctly)
+
+Sat Aug 29 14:50:56 PDT 1998 Manish Singh <yosh@gimp.org>
+
+ * gdk/gdkcolor.c:
+ (gdk_colormap_new) (gdk_colormap_get_system):
+ quell some warnings with g_hash_table_new
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): free the GtkSignalQuery
+ when we're done with it
+
+ * gtk/itemfactory.c:
+ (gtk_item_factory_from_path):
+ (gtk_item_factory_create_item): free some strings
+
+ * gtk/gtklabel.c:
+ (gtk_label_finalize): free label->pattern when done
+ (gtk_label_parse_uline): null terminate pattern string, delete
+ some duplicated code
+
+ * gtk/testthreads.c: add #include <unistd.h> for sleep()
+
Mon Aug 24 18:37:15 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Reference count the fonts used in
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index c7523f59ee..21a19f895f 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,13 @@
+Thu Sep 3 19:45:34 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkthemes.c: Use g_module instead of dlopen();
+
+Thu Sep 3 19:30:11 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c (gtk_tooltips_expose): Check
+ if we've changed widgets since the expose event
+ was queued.
+
Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkprogress.c (gtk_progress_finalize): Unref
@@ -109,6 +119,188 @@ Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
* made gtkrc scanner append dir that gtkrc is read from to pixmap path.
+Thu Sep 3 07:16:54 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkctree.h:
+ * gtk/gtkctree.c: `const' fixups.
+
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: `const' fixups and some coding style adaptions.
+
+ * gtk/gtkctree.c (gtk_ctree_insert_node): don't dereference *text
+ if it is passed as NULL.
+
+Wed Sep 2 22:41:40 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Fixed 32bpp image depth
+ big-endian cases. Added a 4bpp packed gray mode (somewhat
+ incorrectly hardwired to MSB), which should take care of
+ Stric's hardware.
+
+Thu Sep 3 04:45:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): plug another small
+ GtkSIgnalQuery leak.
+
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
+1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
+ constructs by more forgiving ones. (Does anyone else feel like
+ the color selector need rewriting?).
+
+Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkprogress.c (gtk_progress_finalize): Unref
+ the adjustment.
+
+ * gtk/gtkmenu.c: Modified reference counting so
+ that the reference count from the toplevel that
+ the menu creates to the menu is invisible to the
+ application.
+
+Mon Aug 31 21:36:31 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Improved the 24bpp
+ conversion selection logic, so Suns and other big-endian
+ machines should get faster conv routines. This is also the
+ point where 4bpp gray and 1bpp are checked in, although I
+ wouldn't be surprised if 1bpp is a little buggy. This is
+ synchronized with the 0.0.7 release of GdkRgb.
+
+ * gtk/Makefile.am:
+ * gtk/testrgb.c: Checked in testrgb.c to CVS, and made the
+ appropriate change to the Makefile.am
+
+Mon Aug 31 15:18:19 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.[ch]: Added a gdk_draw_rgb_image_dithalign function,
+ which is good for images that scroll (makes the dither patterns
+ align correctly)
+
+Sat Aug 29 14:50:56 PDT 1998 Manish Singh <yosh@gimp.org>
+
+ * gdk/gdkcolor.c:
+ (gdk_colormap_new) (gdk_colormap_get_system):
+ quell some warnings with g_hash_table_new
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): free the GtkSignalQuery
+ when we're done with it
+
+ * gtk/itemfactory.c:
+ (gtk_item_factory_from_path):
+ (gtk_item_factory_create_item): free some strings
+
+ * gtk/gtklabel.c:
+ (gtk_label_finalize): free label->pattern when done
+ (gtk_label_parse_uline): null terminate pattern string, delete
+ some duplicated code
+
+ * gtk/testthreads.c: add #include <unistd.h> for sleep()
+
Mon Aug 24 18:37:15 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Reference count the fonts used in
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index c7523f59ee..21a19f895f 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,13 @@
+Thu Sep 3 19:45:34 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkthemes.c: Use g_module instead of dlopen();
+
+Thu Sep 3 19:30:11 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c (gtk_tooltips_expose): Check
+ if we've changed widgets since the expose event
+ was queued.
+
Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkprogress.c (gtk_progress_finalize): Unref
@@ -109,6 +119,188 @@ Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
* made gtkrc scanner append dir that gtkrc is read from to pixmap path.
+Thu Sep 3 07:16:54 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkctree.h:
+ * gtk/gtkctree.c: `const' fixups.
+
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: `const' fixups and some coding style adaptions.
+
+ * gtk/gtkctree.c (gtk_ctree_insert_node): don't dereference *text
+ if it is passed as NULL.
+
+Wed Sep 2 22:41:40 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Fixed 32bpp image depth
+ big-endian cases. Added a 4bpp packed gray mode (somewhat
+ incorrectly hardwired to MSB), which should take care of
+ Stric's hardware.
+
+Thu Sep 3 04:45:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): plug another small
+ GtkSIgnalQuery leak.
+
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
+1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
+ constructs by more forgiving ones. (Does anyone else feel like
+ the color selector need rewriting?).
+
+Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkprogress.c (gtk_progress_finalize): Unref
+ the adjustment.
+
+ * gtk/gtkmenu.c: Modified reference counting so
+ that the reference count from the toplevel that
+ the menu creates to the menu is invisible to the
+ application.
+
+Mon Aug 31 21:36:31 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Improved the 24bpp
+ conversion selection logic, so Suns and other big-endian
+ machines should get faster conv routines. This is also the
+ point where 4bpp gray and 1bpp are checked in, although I
+ wouldn't be surprised if 1bpp is a little buggy. This is
+ synchronized with the 0.0.7 release of GdkRgb.
+
+ * gtk/Makefile.am:
+ * gtk/testrgb.c: Checked in testrgb.c to CVS, and made the
+ appropriate change to the Makefile.am
+
+Mon Aug 31 15:18:19 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.[ch]: Added a gdk_draw_rgb_image_dithalign function,
+ which is good for images that scroll (makes the dither patterns
+ align correctly)
+
+Sat Aug 29 14:50:56 PDT 1998 Manish Singh <yosh@gimp.org>
+
+ * gdk/gdkcolor.c:
+ (gdk_colormap_new) (gdk_colormap_get_system):
+ quell some warnings with g_hash_table_new
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): free the GtkSignalQuery
+ when we're done with it
+
+ * gtk/itemfactory.c:
+ (gtk_item_factory_from_path):
+ (gtk_item_factory_create_item): free some strings
+
+ * gtk/gtklabel.c:
+ (gtk_label_finalize): free label->pattern when done
+ (gtk_label_parse_uline): null terminate pattern string, delete
+ some duplicated code
+
+ * gtk/testthreads.c: add #include <unistd.h> for sleep()
+
Mon Aug 24 18:37:15 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Reference count the fonts used in
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index c7523f59ee..21a19f895f 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,13 @@
+Thu Sep 3 19:45:34 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkthemes.c: Use g_module instead of dlopen();
+
+Thu Sep 3 19:30:11 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c (gtk_tooltips_expose): Check
+ if we've changed widgets since the expose event
+ was queued.
+
Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkprogress.c (gtk_progress_finalize): Unref
@@ -109,6 +119,188 @@ Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
* made gtkrc scanner append dir that gtkrc is read from to pixmap path.
+Thu Sep 3 07:16:54 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkctree.h:
+ * gtk/gtkctree.c: `const' fixups.
+
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: `const' fixups and some coding style adaptions.
+
+ * gtk/gtkctree.c (gtk_ctree_insert_node): don't dereference *text
+ if it is passed as NULL.
+
+Wed Sep 2 22:41:40 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Fixed 32bpp image depth
+ big-endian cases. Added a 4bpp packed gray mode (somewhat
+ incorrectly hardwired to MSB), which should take care of
+ Stric's hardware.
+
+Thu Sep 3 04:45:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): plug another small
+ GtkSIgnalQuery leak.
+
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
+1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
+ constructs by more forgiving ones. (Does anyone else feel like
+ the color selector need rewriting?).
+
+Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkprogress.c (gtk_progress_finalize): Unref
+ the adjustment.
+
+ * gtk/gtkmenu.c: Modified reference counting so
+ that the reference count from the toplevel that
+ the menu creates to the menu is invisible to the
+ application.
+
+Mon Aug 31 21:36:31 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Improved the 24bpp
+ conversion selection logic, so Suns and other big-endian
+ machines should get faster conv routines. This is also the
+ point where 4bpp gray and 1bpp are checked in, although I
+ wouldn't be surprised if 1bpp is a little buggy. This is
+ synchronized with the 0.0.7 release of GdkRgb.
+
+ * gtk/Makefile.am:
+ * gtk/testrgb.c: Checked in testrgb.c to CVS, and made the
+ appropriate change to the Makefile.am
+
+Mon Aug 31 15:18:19 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.[ch]: Added a gdk_draw_rgb_image_dithalign function,
+ which is good for images that scroll (makes the dither patterns
+ align correctly)
+
+Sat Aug 29 14:50:56 PDT 1998 Manish Singh <yosh@gimp.org>
+
+ * gdk/gdkcolor.c:
+ (gdk_colormap_new) (gdk_colormap_get_system):
+ quell some warnings with g_hash_table_new
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): free the GtkSignalQuery
+ when we're done with it
+
+ * gtk/itemfactory.c:
+ (gtk_item_factory_from_path):
+ (gtk_item_factory_create_item): free some strings
+
+ * gtk/gtklabel.c:
+ (gtk_label_finalize): free label->pattern when done
+ (gtk_label_parse_uline): null terminate pattern string, delete
+ some duplicated code
+
+ * gtk/testthreads.c: add #include <unistd.h> for sleep()
+
Mon Aug 24 18:37:15 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Reference count the fonts used in
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index c7523f59ee..21a19f895f 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,13 @@
+Thu Sep 3 19:45:34 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkthemes.c: Use g_module instead of dlopen();
+
+Thu Sep 3 19:30:11 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c (gtk_tooltips_expose): Check
+ if we've changed widgets since the expose event
+ was queued.
+
Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkprogress.c (gtk_progress_finalize): Unref
@@ -109,6 +119,188 @@ Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
Thu Aug 20 18:27:29 EDT 1998 The Rasterman <raster@redhat.com>
* made gtkrc scanner append dir that gtkrc is read from to pixmap path.
+Thu Sep 3 07:16:54 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkctree.h:
+ * gtk/gtkctree.c: `const' fixups.
+
+ * gtk/gtkclist.h:
+ * gtk/gtkclist.c: `const' fixups and some coding style adaptions.
+
+ * gtk/gtkctree.c (gtk_ctree_insert_node): don't dereference *text
+ if it is passed as NULL.
+
+Wed Sep 2 22:41:40 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Fixed 32bpp image depth
+ big-endian cases. Added a 4bpp packed gray mode (somewhat
+ incorrectly hardwired to MSB), which should take care of
+ Stric's hardware.
+
+Thu Sep 3 04:45:57 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): plug another small
+ GtkSIgnalQuery leak.
+
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
+1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
+ constructs by more forgiving ones. (Does anyone else feel like
+ the color selector need rewriting?).
+
+Tue Sep 1 10:53:52 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkprogress.c (gtk_progress_finalize): Unref
+ the adjustment.
+
+ * gtk/gtkmenu.c: Modified reference counting so
+ that the reference count from the toplevel that
+ the menu creates to the menu is invisible to the
+ application.
+
+Mon Aug 31 21:36:31 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.c (gdk_rgb_select_conv): Improved the 24bpp
+ conversion selection logic, so Suns and other big-endian
+ machines should get faster conv routines. This is also the
+ point where 4bpp gray and 1bpp are checked in, although I
+ wouldn't be surprised if 1bpp is a little buggy. This is
+ synchronized with the 0.0.7 release of GdkRgb.
+
+ * gtk/Makefile.am:
+ * gtk/testrgb.c: Checked in testrgb.c to CVS, and made the
+ appropriate change to the Makefile.am
+
+Mon Aug 31 15:18:19 1998 Raph Levien <raph@gimp.org>
+
+ * gdk/gdkrgb.[ch]: Added a gdk_draw_rgb_image_dithalign function,
+ which is good for images that scroll (makes the dither patterns
+ align correctly)
+
+Sat Aug 29 14:50:56 PDT 1998 Manish Singh <yosh@gimp.org>
+
+ * gdk/gdkcolor.c:
+ (gdk_colormap_new) (gdk_colormap_get_system):
+ quell some warnings with g_hash_table_new
+
+ * gtk/gtkaccelgroup.c (gtk_accel_group_add): free the GtkSignalQuery
+ when we're done with it
+
+ * gtk/itemfactory.c:
+ (gtk_item_factory_from_path):
+ (gtk_item_factory_create_item): free some strings
+
+ * gtk/gtklabel.c:
+ (gtk_label_finalize): free label->pattern when done
+ (gtk_label_parse_uline): null terminate pattern string, delete
+ some duplicated code
+
+ * gtk/testthreads.c: add #include <unistd.h> for sleep()
+
Mon Aug 24 18:37:15 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Reference count the fonts used in
diff --git a/TODO b/TODO
index 90cd38b85e..f85f400a1d 100644
--- a/TODO
+++ b/TODO
@@ -279,3 +279,4 @@ Themes
non-window portion, not the whole area.
+
diff --git a/docs/gtk.texi b/docs/gtk.texi
index 618418e78e..6cfe7d568f 100644
--- a/docs/gtk.texi
+++ b/docs/gtk.texi
@@ -1,5 +1,6 @@
\input texinfo @c -*-texinfo-*-
@c Copyright (C) 1996 by Peter Mattis. All rights reserved.
+@c Portions Copyright (C) 1998 Marius Vollmer
@c
@c %**start of header
@setfilename gtk.info
@@ -9,8 +10,8 @@
@c %**end of header
@set edition 1.0
-@set update-date 29 January 1998
-@set update-month January 1998
+@set update-date 23 August 1998
+@set update-month August 1998
@ifinfo
This file documents GTK, the GIMP Toolkit
@@ -44,7 +45,7 @@ approved by Peter Mattis.
@title The GIMP Toolkit
@subtitle Version @value{edition}
@subtitle @value{update-month}
-@author by Peter Mattis
+@author by Peter Mattis and the GTK+ team
@page
@vskip 0pt plus 1filll
@@ -83,7 +84,7 @@ This is edition @value{edition} of the GTK documentation,
@menu
* Copying:: Your rights.
* Overview:: What is GTK?
-* Objects:: Object overview.
+* Types and Objects::
* Signals:: Signals overview.
* Widgets:: Widget overview.
* Other Objects:: Utility objects.
@@ -120,17 +121,17 @@ copies of GTK, you must give the recipients all the rights that you
have. You must make sure that they, too, receive or can get the source
code. And you must tell them their rights.
-Also, for my own protection, we must make certain that everyone finds
+Also, for our own protection, we must make certain that everyone finds
out that there is no warranty for GTK. If GTK is modified by someone
else and passed on, we want their recipients to know that what they have
is not what we distributed, so that any problems introduced by others
will no reflect on our reputation.
The precise conditions of the licenses for GTK are found in the General
-Public Licenses that accompanies it.
+Public Licenses that accompany it.
-@node Overview, Objects, Copying, Top
+@node Overview, Types and Objects, Copying, Top
@comment node-name, next, previous, up
@chapter What is GTK?
@cindex Overview
@@ -151,11 +152,32 @@ label. However, the child widget can also be a pixmap, image or any
combination possible the programmer desires. This flexibility is adhered
to throughout the library.
-
-@node Objects, Signals, Overview, Top
+@c I think the next paragraph takes unproportionally much space for
+@c the thing it wants to say (compared to the rest of this overview).
+@c So Somebody please extend this overview with more generally interesting
+@c stuff. - mvo
+
+To make life easier for you, GTK presents this flexibility in a uniform
+framework. Specifically, it implements its own support for object
+oriented programming that is well adapted to the purposes of a user
+interface toolkit and it aims at providing a reasonable sane and
+disciplined programming interface. This uniformity and discipline is
+intended to make it easy and reliable to access GTK from languages other
+than C. Especially more dynamic languages like Perl, Python or Scheme
+will find amble support, and in fact, bindings to these languages
+already exist.
+
+@node Types and Objects, Signals, Overview, Top
@comment node-name, next, previous, up
-@chapter Object Overview
-@cindex Objects
+@chapter Types and Object Overview
+@cindex object, type, type system, class
+
+@flushright
+Other kid's games are all such a bore!
+They've gotta have rules and they gotta keep score!
+
+-- Calvin about CalvinBall(tm)
+@end flushright
GTK implements a semi-simple class mechanism and an associated class
hierarchy for widgets and several other useful objects. The GtkObject
@@ -163,14 +185,212 @@ type is the root of the class hierarchy. It provides a few items needed
by all classes, the foundation for the signal (@pxref{Signals})
mechanism and the ``destroy'' method.
-The class hierarchy is defined by a type hierarchy. This hierarchy
-allows queries to be made in regards to a type. The basic query that can
-be performed is asking whether a given type has an ``is a'' relation
-with another type. For instance, it is common to ask whether a general
-widget pointer is a type of specific widget so that runtime sanity
-checks can be made.
+This class hierarchy is part of a slightly more general type system.
+The classes for the individual widgets are by far the most important
+part of this type system, but before we get to them, we describe the
+basics of the type system itself. This is mostly of interest for widget
+writers, so you might want to skip ahead to the Object section.
+
+@menu
+* Type introduction::
+* Basics::
+* Simple types::
+* Enumerations and flags::
+* Strings::
+* Callbacks::
+* Composite types::
+* Objects::
+@end menu
+
+@node Type introduction, Basics, Types and Objects, Types and Objects
+@section Introduction to the Type System
+
+Gtk defines its own system of types, much like a computer language
+defines what types it supports. Of course, the Gtk type system is build
+on top of the types that C provides, so it includes members like
+@samp{int}, @samp{long} and @samp{float}. But, compared to C, it allows
+only few carefully selected types and specifies a lot of restrictions on
+the way you can use values of these types. For example, there is no
+general facility for specifying @emph{pointer to X}. Instead, we take a
+more higher level approach and define such things as @samp{string},
+which is just like a @code{char*} but with additional rules about how to
+manage the memory that it points to.
+
+The type system has two purposes: to define a formal system with which
+to describe the various exported features of Gtk; and to implement this
+system at run-time so that we get sound and flexible @dfn{dynamic} types
+for the dynamic languages that want to interface with Gtk.
+
+Let me restate this with different words, because I think it is
+important to understand this idea. We will see in a moment that the
+type system is indeed weel defined and all this detail is implemented
+with functions and data structures in Gtk. For example, every type (and
+there can be any number of them) can be represented with a unique
+integer and Gtk has support for the necessary bookkeeping for this.
+Every type also has a name and there are functions for converting
+between the name of a type and its unique number. Maybe more useful,
+there is a big discriminated union that can be used to pass around a
+value of any representable type, together with its precise type.
+
+This is the run-time or dynamic side of the type system. Mostly, you do
+not need to use it when you don't want to. The compile-time or static
+side of the type system can is used to statically define the programming
+interface of Gtk. For example, suppose there is function @code{gtk_foo}
+in the Gtk API that has a prototype
+
+@example
+char *gtk_foo (char *);
+@end example
+
+This looks like it does something with strings. But what does it do
+with the memory of the string that has been passed in, and what are we
+supposed or allowed to do with the string that is returned? The more
+restricted type @samp{string} from the Gtk type system can be used to be
+more precise. In fact, the definition of @samp{string} below includes
+the rule that when a @samp{string} is passed to a function, that
+function is not allowed to retain a pointer into the string beyond the
+life time of that function call. Se we are safe to deallocate it or
+override it when the function has returned. Likewise, the definition
+specifies that the memory of a @samp{string} that is returned from a
+function becomes the sole property of the calling function. The calling
+function is responsible for deallocating it eventually and it can be
+sure that nobody else scribbles in it. When @samp{gtk_foo} really obeys
+these rules, we can say that it takes one argument, which is a
+@samp{string}, and it returns a @samp{string}.
+
+Now we can understand why it makes sense to have a more restrictive type
+system than that of C. With it, it is possible to be more precise and
+we actually have a framework where we can be sure that as long as we
+stay inside this framework we are not gratitously causing trouble for
+languages that are more disciplined than C. Of course, you are not
+restricted to making all your interfaces expressible within the
+framework. There are valid reasons for breaking it, for performance or
+simply for convenience. But please try to provide all the functionality
+of your module in such a way that it can be described with this type
+system and treat the non-conforming functions as additional goodies that
+are nice to have but not essential. The reward is an instant
+accessibility of your code from a huge number of scripting and extension
+languages such as Perl, Python, and Guile.
+
+These formal specifications of the Gtk interface are contained in
+special declarations in the header files of Gtk. They are ignored by
+the C compiler, but can be used by other language processors. For extra
+convenience, these declarations are also available in a more condensed
+form that is easier to parse. Tools for generating bindings of Gtk to
+other languages can read these declarations and---because all the
+important details are defined---automatically generate the bulk of the
+needed glue code. It is also possible to feed these declarations into a
+running application (a interface builder, say) and thus make it aware of
+new widgets and functions without recompiling anything.
+
+The run-time side of the type system is also somewhat introspective.
+This means that you can query Gtk about all the members of an
+enumeration for example. Gtk provides tools that help you provide this
+introspection for your definitions also.
+
+Types are not enough to completely specify an interface, so GTK also has
+@dfn{modes}. A mode specifies what happens to a value when it crosses a
+module boundary; it can be @samp{in}, @samp{out}, or @samp{inout}. Most
+fundamental types (and their derived types) support only mode @samp{in}.
+The modes @samp{out} and @samp{inout} can only be used with the
+composite types: lists and vectors. When argument of these types are
+marked as @samp{out} or @samp{inout} it means that the called module is
+allowed to change the contents of the composite value and that these
+changes need to be propagated back to the originator of the value. Mode
+@samp{out} means that the argument has no meaningful value at the
+beginning and should not be read. Mode @samp{in} specifies that the
+called module is not allowed to change the value in any way.
+
+The type system allows for an unbounded number of types. Every widget
+is a type for example and you can add new widget types at any time
+without confusing the run-time implementation of the type system.
+Nevertheless, all types are derived from a certain @dfn{fundamental}
+type, and there are only a small and finite number of fundamental types.
+We only specify rules for the fundamental types and all other types
+inherit these rules from their fundamental type. For example,
+@samp{int} is a fundamental type, as is @samp{GtkObject}. All widgets
+derive from @samp{GtkObject} and so the rules for @samp{GtkObject} apply
+to all widgets as well.
+
+This derivation defines a type hierachy, but this hierachy is not
+completely general. You can't derive from @samp{int} for example, and
+you can only have one level of derivation from @samp{enum}. The
+fundamental type @samp{GtkObject}, however, is the basis for the large
+and deep hierarchy of widget types.
+
+The individual fundamental types are defined and explained in the
+following sections. Here is a complete list of them:
+
+@table @samp
+@item none
+The not-a-value type, similar to @samp{void}.
+@item char
+A character. Internationalization issues are still undecided.
+@item bool
+True or false.
+@item byte, ubyte, int, uint, long, ulong, float, double
+The usual assortment of scalar types.
+@item string
+A string. Internationalization issues are still undecided.
+@item enum, flags
+Enumerations with a fixed set of literals. Either used to express a
+single choice from this set or to individually turn on and off several
+flags.
+@item boxed
+A pointer to an opaque structure that can be copied and destroyed.
+@item callback
+A pointer to a function with enough extra information so that it can
+also be used for functions written in languages completely different
+from C.
+@item GtkObject
+A pointer to a GtkObject or derived type. The fun starts here.
+@item args, slist, dlist, cvec, tvec
+An assortment of composite types like linked lists and counted or
+zero-terminated arrays.
+@item pointer, signal, c_callback
+Obsolete types.
+@end table
+
+@node Basics, Simple types, Type introduction, Types and Objects
+@section Basic Concepts
+
+The basis for the type system are the fundamental types. At run-time,
+they are represented by members of the @code{GtkFundamentalType}
+enumeration. For the static declarations, they are identified with a
+unique name.
+
+@deftp {Enumeration} GtkFundamentalType
+This enumeration contains a member for each defined fundamental type.
+Most members are listed along with the description if their semantics,
+but two are simple enough to list them here:
+@table @code
+@item GTK_TYPE_INVALID
+No valid type is derived from this. Use @code{GTK_TYPE_INVALID} to
+express exceptional situations. This member does not correspond to a
+fundamental type and thus there is no name for it.
+@item GTK_TYPE_NONE
+The type without value.
+@end table
+@end deftp
+
+@deftp {Data type} GtkType
+The type @code{GtkType} holds the run-time representation of a type. It
+is a integer of a certain size. The follwing macros are defined to
+access the basic properties of a @code{GtkType}:
+
+@deftypefn {Macro} {unsigned int} GTK_TYPE_SEQNO (GtkType type)
+Returns the sequence number of @var{type}. The sequence numbers are
+guaranteed to be dense, i.e., you can use them to index a table and the
+table need not be much larger than the number of different GtkTypes that
+you might encounter.
+@end deftypefn
-@section Type utility functions
+@deftypefn {Macro} GtkFundamentalType GTK_FUNDAMENTAL_TYPE (GtkType type)
+Returns the fundamental type of @var{type}.
+@end deftypefn
+Both macros simply access different bit-fields of a @code{GtkType}, so
+they are very efficient.
+@end deftp
The @code{GtkTypeInfo} structure is used to communicate information to
@code{gtk_type_unique} as opposed to passing in large numbers of
@@ -297,6 +517,44 @@ is_a @var{is_a_type} is true.
@deftypefun void gtk_type_set_arg (GtkObject *@var{object}, GtkType @var{type}, GtkArg *@var{arg}, guint @var{arg_id})
@end deftypefun
+@node Simple types, Enumerations and flags, Basics, Types and Objects
+@section Simple Types
+
+@node Enumerations and flags, Strings, Simple types, Types and Objects
+@section Enumerations and Flags
+
+@node Strings, Callbacks, Enumerations and flags, Types and Objects
+@section Strings
+
+@node Callbacks, Composite types, Strings, Types and Objects
+@section Callbacks
+
+@node Composite types, Objects, Callbacks, Types and Objects
+@section Composite Types
+
+@node Objects, , Composite types, Types and Objects
+@section Objects and Classes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@section Object functions
The GtkObject type is the root of the type hierarchy used by GTK. It
@@ -423,7 +681,7 @@ return @code{FALSE}. On success it will return @code{TRUE}.
@end deftypefun
-@node Signals, Widgets, Objects, Top
+@node Signals, Widgets, Types and Objects, Top
@comment node-name, next, previous, up
@chapter Signals Overview
@cindex Signals
@@ -751,37 +1009,37 @@ The available widgets (in alphabetical order):
@menu
* GtkAlignment:: The alignment widget.
* GtkArrow:: The arrow widget.
-* GtkAspectFrame:: The aspect frame widget.
+* GtkAspectFrame:: The aspect frame widget.
* GtkBin:: The bin widget.
* GtkBox:: The box widget.
-* GtkButtonBox:: The button box widget.
+* GtkButtonBox:: The button box widget.
* GtkButton:: The button widget.
* GtkCheckButton:: The check button widget.
* GtkCheckMenuItem:: The check menu item widget.
-* GtkCList:: The compound list widget.
-* GtkColorSelection:: The color selector widget.
-* GtkCombo:: The combo box widget.
+* GtkCList:: The compound list widget.
+* GtkColorSelection:: The color selector widget.
+* GtkCombo:: The combo box widget.
* GtkContainer:: The container widget.
* GtkCTree:: The multi-column tree widget.
-* GtkCurve:: The curve widget.
-* GtkGammaCurve:: The gamma curve widget.
+* GtkCurve:: The curve widget.
+* GtkGammaCurve:: The gamma curve widget.
* GtkDialog:: The dialog widget.
* GtkDrawingArea:: The drawing area widget.
* GtkEntry:: The entry widget.
-* GtkEventBox:: The event box widget.
+* GtkEventBox:: The event box widget.
* GtkFileSelection:: The file selection dialog widget.
-* GtkFixed:: The fixed widget.
+* GtkFixed:: The fixed widget.
* GtkFrame:: The frame widget.
-* GtkGamma:: The gamma widget.
+* GtkGamma:: The gamma widget.
* GtkHBox:: The horizontal box widget.
-* GtkHButtonBox:: The horizontal button box widget.
-* GtkHPaned:: The horizontal paned widget.
+* GtkHButtonBox:: The horizontal button box widget.
+* GtkHPaned:: The horizontal paned widget.
* GtkHRuler:: The horizontal ruler widget.
* GtkHScale:: The horizontal scale widget.
* GtkHScrollbar:: The horizontal scrollbar widget.
* GtkHSeparator:: The horizontal separator widget.
* GtkImage:: The image widget.
-* GtkInputDialog:: The input dialog widget.
+* GtkInputDialog:: The input dialog widget.
* GtkItem:: The item widget.
* GtkLabel:: The label widget.
* GtkList:: The list widget.
@@ -793,7 +1051,7 @@ The available widgets (in alphabetical order):
* GtkMisc:: The misc widget.
* GtkNotebook:: The notebook widget.
* GtkOptionMenu:: The option menu widget.
-* GtkPaned:: The paned widget.
+* GtkPaned:: The paned widget.
* GtkPixmap:: The pixmap widget.
* GtkPreview:: The preview widget.
* GtkProgressBar:: The progress bar widget.
@@ -805,18 +1063,18 @@ The available widgets (in alphabetical order):
* GtkScrollbar:: The scrollbar widget.
* GtkScrolledWindow:: The scrolled window widget.
* GtkSeparator:: The separator widget.
-* GtkStatusbar:: The statusbar widget.
+* GtkStatusbar:: The statusbar widget.
* GtkTable:: The table widget.
* GtkText:: The text widget.
* GtkToggleButton:: The toggle button widget.
-* GtkToolbar:: The tool bar widget.
-* GtkTooltips:: The tool tips widget.
+* GtkToolbar:: The tool bar widget.
+* GtkTooltips:: The tool tips widget.
* GtkTree:: The tree widget.
* GtkTreeItem:: The tree item widget.
* GtkVBox:: The vertical box widget.
-* GtkVButtonBox:: The vertical button box widget.
+* GtkVButtonBox:: The vertical button box widget.
* GtkViewport:: The viewport widget.
-* GtkVPaned:: The vertical paned widget.
+* GtkVPaned:: The vertical paned widget.
* GtkVRuler:: The vertical ruler widget.
* GtkVScale:: The vertical scale widget.
* GtkVScrollbar:: The vertical scrollbar widget.
@@ -1434,7 +1692,7 @@ values @var{label}. The new widget is returned as a pointer to a
@gtkstdmacros{CheckButton, CHECK_BUTTON}
@page
-@node GtkCheckMenuItem, GtkCList, GtkCheckButton, Widgets,
+@node GtkCheckMenuItem, GtkCList, GtkCheckButton, Widgets
@comment node-name, next, previous, up
@section The check menu item widget
@@ -4528,7 +4786,7 @@ Returns the @code{GtkWidget} type identifier.
@page
-@node GtkWindow, , GtkWidget, Widgets
+@node GtkWindow, , GtkWidget, Widgets
@comment node-name, next, previous, up
@section The window widget
@@ -4677,11 +4935,11 @@ above.
@menu
-* GtkAcceleratorTable:: The accelerator table object.
+* GtkAcceleratorTable:: The accelerator table object.
* GtkAdjustment:: The adjustment object.
-* GtkGC:: The GC object.
+* GtkGC:: The GC object.
* GtkData:: The data object.
-* GtkStyle:: The style object.
+* GtkStyle:: The style object.
@end menu
@@ -4764,7 +5022,7 @@ Returns the @code{GtkData} type identifier.
@gtkstdmacros{Data, DATA}
@page
-@node GtkStyle, ,GtkData, Other Objects
+@node GtkStyle, , GtkData, Other Objects
@section The style object
@subsection Description
@@ -4779,7 +5037,7 @@ Returns the @code{GtkData} type identifier.
@menu
* Initialization and exit:: Initializing and exiting GTK.
-* Customization:: Customizing the library.
+* Customization:: Customizing the library.
* Menu Factories:: Simplified menu creation.
* Tree Factories:: Simplified tree creation.
* Tool Tips:: Pop up help mechanism.
@@ -4889,7 +5147,7 @@ you.
@section Resource Files
@page
-@node Standard Macros, , Resource Files, Miscellaneous
+@node Standard Macros, , Resource Files, Miscellaneous
@comment node-name, next, previous, up
@section Macros defined by all objects
@@ -4919,7 +5177,7 @@ Cast a generic pointer to @code{Gtk<ObjectType>Class*}. Like
@deftypefun gint GTK_IS_<ObjectType> (gpointer @var{obj})
Determine if a generic pointer refers to a @code{Gtk<ObjectType>}
object. This function is, in reality, a macro wrapper around the
-@code{gtk_type_is_a} function (@pxref{Objects}).
+@code{gtk_type_is_a} function (@pxref{Types and Objects}).
@end deftypefun
@@ -5075,7 +5333,7 @@ main (int argc, char *argv[])
@end example
-@node Hello World III, , Hello World II, Examples
+@node Hello World III, , Hello World II, Examples
@comment node-name, next, previous, up
@section Making Hello World II robust
@@ -5263,7 +5521,7 @@ array instead of a linked list. This would shrink the overhead of the
@printindex fn
-@node Concept Index, , Function Index, Top
+@node Concept Index, , Function Index, Top
@comment node-name, next, previous, up
@unnumbered Concept Index
diff --git a/gdk/gdkcolor.c b/gdk/gdkcolor.c
index fa810473e6..36b6c8593c 100644
--- a/gdk/gdkcolor.c
+++ b/gdk/gdkcolor.c
@@ -71,8 +71,8 @@ gdk_colormap_new (GdkVisual *visual,
private->info = g_new0 (GdkColorInfo, colormap->size);
colormap->colors = g_new (GdkColor, colormap->size);
- private->hash = g_hash_table_new (gdk_color_hash,
- gdk_color_equal);
+ private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
+ (GCompareFunc) gdk_color_equal);
private->private_val = private_cmap;
private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
@@ -259,8 +259,8 @@ gdk_colormap_get_system (void)
private->info = g_new0 (GdkColorInfo, colormap->size);
colormap->colors = g_new (GdkColor, colormap->size);
- private->hash = g_hash_table_new (gdk_color_hash,
- gdk_color_equal);
+ private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
+ (GCompareFunc) gdk_color_equal);
gdk_colormap_sync (colormap, TRUE);
}
diff --git a/gdk/gdkrgb.c b/gdk/gdkrgb.c
index a4f11de5d9..e91e4c514e 100644
--- a/gdk/gdkrgb.c
+++ b/gdk/gdkrgb.c
@@ -87,6 +87,9 @@ struct _GdkRgbInfo
gboolean dith_default;
+ gboolean bitmap; /* set true if in 1 bit per pixel mode */
+ GdkGC *own_gc;
+
/* Convert functions */
GdkRgbConvFunc conv;
GdkRgbConvFunc conv_d;
@@ -539,7 +542,7 @@ gdk_rgb_init (void)
g_error ("gdk_rgb_init: WORDS_BIGENDIAN is defined, but this is a little endian machine.\n\n");
#else
if (((char *)byte_order)[0] != 1)
- g_error ("gdk_rgb_init: WORDS_BIGENDIAN is not defined, but this is a little endian machine.\n\n");
+ g_error ("gdk_rgb_init: WORDS_BIGENDIAN is not defined, but this is a big endian machine.\n\n");
#endif
if (image_info == NULL)
@@ -565,10 +568,16 @@ gdk_rgb_init (void)
image_info->stage_buf = NULL;
+ image_info->own_gc = NULL;
+
gdk_rgb_choose_visual ();
- if (image_info->visual->depth == 4)
+ if ((image_info->visual->type == GDK_VISUAL_PSEUDO_COLOR ||
+ image_info->visual->type == GDK_VISUAL_STATIC_COLOR) &&
+ image_info->visual->depth < 8 &&
+ image_info->visual->depth >= 3)
{
+ image_info->cmap = gdk_colormap_get_system ();
gdk_rgb_colorcube_222 ();
}
else if (image_info->visual->type == GDK_VISUAL_PSEUDO_COLOR)
@@ -615,10 +624,17 @@ gdk_rgb_init (void)
}
}
+ image_info->bitmap = (image_info->visual->depth == 1);
+
for (i = 0; i < N_IMAGES; i++)
- static_image[i] = gdk_image_new (GDK_IMAGE_FASTEST,
- image_info->visual,
- IMAGE_WIDTH, IMAGE_HEIGHT);
+ if (image_info->bitmap)
+ static_image[i] = gdk_image_new_bitmap (image_info->visual,
+ g_malloc (IMAGE_WIDTH * IMAGE_HEIGHT >> 3),
+ IMAGE_WIDTH, IMAGE_HEIGHT);
+ else
+ static_image[i] = gdk_image_new (GDK_IMAGE_FASTEST,
+ image_info->visual,
+ IMAGE_WIDTH, IMAGE_HEIGHT);
image_info->bpp = static_image[0]->bpp;
@@ -637,7 +653,7 @@ gdk_rgb_xpixel_from_rgb (guint32 rgb)
pixel = colorcube[((rgb & 0xf00000) >> 12) |
((rgb & 0xf000) >> 8) |
((rgb & 0xf0) >> 4)];
- else if (image_info->visual->depth == 4 &&
+ else if (image_info->visual->depth < 8 &&
image_info->visual->type == GDK_VISUAL_STATIC_COLOR)
{
pixel = colorcube_d[((rgb & 0x800000) >> 17) |
@@ -1872,6 +1888,37 @@ gdk_rgb_convert_0888_br (GdkImage *image,
}
}
+static void
+gdk_rgb_convert_8880_br (GdkImage *image,
+ gint x0, gint y0, gint width, gint height,
+ guchar *buf, int rowstride,
+ gint x_align, gint y_align, GdkRgbCmap *cmap)
+{
+ int x, y;
+ guchar *obuf;
+ gint bpl;
+ guchar *bptr, *bp2;
+ int r, g, b;
+
+ bptr = buf;
+ bpl = image->bpl;
+ obuf = ((guchar *)image->mem) + y0 * bpl + x0 * 4;
+ for (y = 0; y < height; y++)
+ {
+ bp2 = bptr;
+ for (x = 0; x < width; x++)
+ {
+ r = bp2[0];
+ g = bp2[1];
+ b = bp2[2];
+ ((unsigned long *)obuf)[x] = (b << 16) | (g << 8) | r;
+ bp2 += 3;
+ }
+ bptr += rowstride;
+ obuf += bpl;
+ }
+}
+
/* Generic truecolor/directcolor conversion function. Slow, but these
are oddball modes. */
static void
@@ -2108,7 +2155,7 @@ gdk_rgb_convert_truecolor_msb_d (GdkImage *image,
}
}
-#define IMAGE_8BPP
+/* This actually works for depths from 3 to 7 */
static void
gdk_rgb_convert_4 (GdkImage *image,
gint x0, gint y0, gint width, gint height,
@@ -2132,7 +2179,6 @@ gdk_rgb_convert_4 (GdkImage *image,
dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
bp2 = bptr;
obptr = obuf;
-#ifdef IMAGE_8BPP
for (x = 0; x < width; x += 1)
{
r = *bp2++;
@@ -2144,32 +2190,221 @@ gdk_rgb_convert_4 (GdkImage *image,
(((b + dith) & 0x100) >> 8)];
obptr++;
}
-#else
+ bptr += rowstride;
+ obuf += bpl;
+ }
+}
+
+/* This actually works for depths from 3 to 7 */
+static void
+gdk_rgb_convert_gray4 (GdkImage *image,
+ gint x0, gint y0, gint width, gint height,
+ guchar *buf, int rowstride,
+ gint x_align, gint y_align, GdkRgbCmap *cmap)
+{
+ int x, y;
+ gint bpl;
+ guchar *obuf, *obptr;
+ guchar *bptr, *bp2;
+ gint r, g, b;
+ gint shift;
+
+ bptr = buf;
+ bpl = image->bpl;
+ obuf = ((guchar *)image->mem) + y0 * bpl + x0;
+ shift = 9 - image_info->visual->depth;
+ for (y = 0; y < height; y++)
+ {
+ bp2 = bptr;
+ obptr = obuf;
+ for (x = 0; x < width; x++)
+ {
+ r = *bp2++;
+ g = *bp2++;
+ b = *bp2++;
+ obptr[0] = (g + ((b + r) >> 1)) >> shift;
+ obptr++;
+ }
+ bptr += rowstride;
+ obuf += bpl;
+ }
+}
+
+static void
+gdk_rgb_convert_gray4_pack (GdkImage *image,
+ gint x0, gint y0, gint width, gint height,
+ guchar *buf, int rowstride,
+ gint x_align, gint y_align, GdkRgbCmap *cmap)
+{
+ int x, y;
+ gint bpl;
+ guchar *obuf, *obptr;
+ guchar *bptr, *bp2;
+ gint r, g, b;
+ gint shift;
+ guchar pix0, pix1;
+ /* todo: this is hardcoded to big-endian. Make endian-agile. */
+
+ bptr = buf;
+ bpl = image->bpl;
+ obuf = ((guchar *)image->mem) + y0 * bpl + (x0 >> 1);
+ shift = 9 - image_info->visual->depth;
+ for (y = 0; y < height; y++)
+ {
+ bp2 = bptr;
+ obptr = obuf;
for (x = 0; x < width; x += 2)
{
r = *bp2++;
g = *bp2++;
b = *bp2++;
- dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) | 3;
- pix0 = colorcube_d[(((r + dith) & 0x100) >> 2) |
- (((g + dith) & 0x100) >> 5) |
- (((b + dith) & 0x100) >> 8)];
+ pix0 = (g + ((b + r) >> 1)) >> shift;
r = *bp2++;
g = *bp2++;
b = *bp2++;
- dith = (dmp[(x_align + x + 1) & (DM_WIDTH - 1)] << 2) | 3;
- pix1 = colorcube_d[(((r + dith) & 0x100) >> 2) |
- (((g + dith) & 0x100) >> 5) |
- (((b + dith) & 0x100) >> 8)];
+ pix1 = (g + ((b + r) >> 1)) >> shift;
+ obptr[0] = (pix0 << 4) | pix1;
+ obptr++;
+ }
+ bptr += rowstride;
+ obuf += bpl;
+ }
+}
+
+/* This actually works for depths from 3 to 7 */
+static void
+gdk_rgb_convert_gray4_d (GdkImage *image,
+ gint x0, gint y0, gint width, gint height,
+ guchar *buf, int rowstride,
+ gint x_align, gint y_align, GdkRgbCmap *cmap)
+{
+ int x, y;
+ gint bpl;
+ guchar *obuf, *obptr;
+ guchar *bptr, *bp2;
+ gint r, g, b;
+ guchar *dmp;
+ gint prec, right;
+ gint gray;
+
+ bptr = buf;
+ bpl = image->bpl;
+ obuf = ((guchar *)image->mem) + y0 * bpl + x0;
+ prec = image_info->visual->depth;
+ right = 8 - prec;
+ for (y = 0; y < height; y++)
+ {
+ bp2 = bptr;
+ obptr = obuf;
+ dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
+ for (x = 0; x < width; x++)
+ {
+ r = *bp2++;
+ g = *bp2++;
+ b = *bp2++;
+ gray = (g + ((b + r) >> 1)) >> 1;
+ gray += (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) >> prec;
+ obptr[0] = (gray - (gray >> prec)) >> right;
+ obptr++;
+ }
+ bptr += rowstride;
+ obuf += bpl;
+ }
+}
+
+static void
+gdk_rgb_convert_gray4_d_pack (GdkImage *image,
+ gint x0, gint y0, gint width, gint height,
+ guchar *buf, int rowstride,
+ gint x_align, gint y_align, GdkRgbCmap *cmap)
+{
+ int x, y;
+ gint bpl;
+ guchar *obuf, *obptr;
+ guchar *bptr, *bp2;
+ gint r, g, b;
+ guchar *dmp;
+ gint prec, right;
+ gint gray;
+ guchar pix0, pix1;
+ /* todo: this is hardcoded to big-endian. Make endian-agile. */
+
+ bptr = buf;
+ bpl = image->bpl;
+ obuf = ((guchar *)image->mem) + y0 * bpl + (x0 >> 1);
+ prec = image_info->visual->depth;
+ right = 8 - prec;
+ for (y = 0; y < height; y++)
+ {
+ bp2 = bptr;
+ obptr = obuf;
+ dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
+ for (x = 0; x < width; x += 2)
+ {
+ r = *bp2++;
+ g = *bp2++;
+ b = *bp2++;
+ gray = (g + ((b + r) >> 1)) >> 1;
+ gray += (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) >> prec;
+ pix0 = (gray - (gray >> prec)) >> right;
+ r = *bp2++;
+ g = *bp2++;
+ b = *bp2++;
+ gray = (g + ((b + r) >> 1)) >> 1;
+ gray += (dmp[(x_align + x + 1) & (DM_WIDTH - 1)] << 2) >> prec;
+ pix1 = (gray - (gray >> prec)) >> right;
obptr[0] = (pix0 << 4) | pix1;
obptr++;
}
-#endif
bptr += rowstride;
obuf += bpl;
}
}
+static void
+gdk_rgb_convert_1 (GdkImage *image,
+ gint x0, gint y0, gint width, gint height,
+ guchar *buf, int rowstride,
+ gint x_align, gint y_align,
+ GdkRgbCmap *cmap)
+{
+ int x, y;
+ gint bpl;
+ guchar *obuf, *obptr;
+ guchar *bptr, *bp2;
+ gint r, g, b;
+ guchar *dmp;
+ gint dith;
+ guchar byte;
+
+ bptr = buf;
+ bpl = image->bpl;
+ obuf = ((guchar *)image->mem) + y0 * bpl + (x0 >> 3);
+ byte = 0; /* unnecessary, but it keeps gcc from complaining */
+ for (y = 0; y < height; y++)
+ {
+ dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
+ bp2 = bptr;
+ obptr = obuf;
+ for (x = 0; x < width; x++)
+ {
+ r = *bp2++;
+ g = *bp2++;
+ b = *bp2++;
+ dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 4) | 4;
+ byte += byte + (r + g + g + b + dith > 1020);
+ if ((x & 7) == 7)
+ {
+ obptr[0] = byte;
+ obptr++;
+ }
+ }
+ if (x & 7)
+ obptr[0] = byte << (8 - (x & 7));
+ bptr += rowstride;
+ obuf += bpl;
+ }
+}
/* Returns a pointer to the stage buffer. */
static guchar *
@@ -2386,11 +2621,16 @@ gdk_rgb_select_conv (GdkImage *image)
GdkRgbConvFunc conv_32, conv_32_d;
GdkRgbConvFunc conv_gray, conv_gray_d;
GdkRgbConvFunc conv_indexed, conv_indexed_d;
+ gboolean mask_rgb, mask_bgr;
depth = image_info->visual->depth;
- bpp = image->bpp;
+ bpp = ((GdkImagePrivate *)image)->ximage->bits_per_pixel;
byte_order = image->byte_order;
+ if (gdk_rgb_verbose)
+ g_print ("Chose visual 0x%x, image bpp=%d, %s first\n",
+ (gint)(((GdkVisualPrivate *)image_info->visual)->xvisual->visualid),
+ bpp, byte_order == GDK_LSB_FIRST ? "lsb" : "msb");
#ifdef WORDS_BIGENDIAN
byterev = (byte_order == GDK_LSB_FIRST);
@@ -2406,6 +2646,9 @@ gdk_rgb_select_conv (GdkImage *image)
green_mask = image_info->visual->green_mask;
blue_mask = image_info->visual->blue_mask;
+ mask_rgb = red_mask == 0xff0000 && green_mask == 0xff00 && blue_mask == 0xff;
+ mask_bgr = red_mask == 0xff && green_mask == 0xff00 && blue_mask == 0xff0000;
+
conv = NULL;
conv_d = NULL;
@@ -2420,7 +2663,9 @@ gdk_rgb_select_conv (GdkImage *image)
image_info->dith_default = FALSE;
- if (bpp == 2 && depth == 16 && !byterev &&
+ if (image_info->bitmap)
+ conv = gdk_rgb_convert_1;
+ else if (bpp == 16 && depth == 16 && !byterev &&
red_mask == 0xf800 && green_mask == 0x7e0 && blue_mask == 0x1f)
{
conv = gdk_rgb_convert_565;
@@ -2428,38 +2673,51 @@ gdk_rgb_select_conv (GdkImage *image)
conv_gray = gdk_rgb_convert_565_gray;
gdk_rgb_preprocess_dm_565 ();
}
- else if (bpp == 2 && depth == 16 &&
+ else if (bpp == 16 && depth == 16 &&
vtype == GDK_VISUAL_TRUE_COLOR && byterev &&
red_mask == 0xf800 && green_mask == 0x7e0 && blue_mask == 0x1f)
conv = gdk_rgb_convert_565_br;
- else if (bpp == 2 && depth == 15 &&
+ else if (bpp == 16 && depth == 15 &&
vtype == GDK_VISUAL_TRUE_COLOR && !byterev &&
red_mask == 0x7c00 && green_mask == 0x3e0 && blue_mask == 0x1f)
conv = gdk_rgb_convert_555;
- else if (bpp == 2 && depth == 15 &&
+ else if (bpp == 16 && depth == 15 &&
vtype == GDK_VISUAL_TRUE_COLOR && byterev &&
red_mask == 0x7c00 && green_mask == 0x3e0 && blue_mask == 0x1f)
conv = gdk_rgb_convert_555_br;
- /* I'm not 100% sure about the 24bpp tests */
- else if (bpp == 3 && depth == 24 &&
- vtype == GDK_VISUAL_TRUE_COLOR && byte_order == GDK_LSB_FIRST &&
- red_mask == 0xff0000 && green_mask == 0xff00 && blue_mask == 0xff)
+ /* I'm not 100% sure about the 24bpp tests - but testing will show*/
+ else if (bpp == 24 && depth == 24 && vtype == GDK_VISUAL_TRUE_COLOR &&
+ ((mask_rgb && byte_order == GDK_LSB_FIRST) ||
+ (mask_bgr && byte_order == GDK_MSB_FIRST)))
conv = gdk_rgb_convert_888_lsb;
- else if (bpp == 3 && depth == 24 &&
- vtype == GDK_VISUAL_TRUE_COLOR && byte_order == GDK_MSB_FIRST &&
- red_mask == 0xff0000 && green_mask == 0xff00 && blue_mask == 0xff)
+ else if (bpp == 24 && depth == 24 && vtype == GDK_VISUAL_TRUE_COLOR &&
+ ((mask_rgb && byte_order == GDK_MSB_FIRST) ||
+ (mask_bgr && byte_order == GDK_LSB_FIRST)))
conv = gdk_rgb_convert_888_msb;
- else if (bpp == 4 && depth == 24 &&
- vtype == GDK_VISUAL_TRUE_COLOR && !byterev &&
- red_mask == 0xff0000 && green_mask == 0xff00 && blue_mask == 0xff)
+#ifdef WORDS_BIGENDIAN
+ else if (bpp == 32 && depth == 24 && vtype == GDK_VISUAL_TRUE_COLOR &&
+ (mask_rgb && byte_order == GDK_LSB_FIRST))
+ conv = gdk_rgb_convert_0888_br;
+ else if (bpp == 32 && depth == 24 && vtype == GDK_VISUAL_TRUE_COLOR &&
+ (mask_rgb && byte_order == GDK_MSB_FIRST))
conv = gdk_rgb_convert_0888;
- else if (bpp == 4 && depth == 24 &&
- vtype == GDK_VISUAL_TRUE_COLOR && byterev &&
- red_mask == 0xff0000 && green_mask == 0xff00 && blue_mask == 0xff)
+ else if (bpp == 32 && depth == 24 && vtype == GDK_VISUAL_TRUE_COLOR &&
+ (mask_bgr && byte_order == GDK_MSB_FIRST))
+ conv = gdk_rgb_convert_8880_br;
+#else
+ else if (bpp == 32 && depth == 24 && vtype == GDK_VISUAL_TRUE_COLOR &&
+ (mask_rgb && byte_order == GDK_MSB_FIRST))
conv = gdk_rgb_convert_0888_br;
+ else if (bpp == 32 && depth == 24 && vtype == GDK_VISUAL_TRUE_COLOR &&
+ (mask_rgb && byte_order == GDK_LSB_FIRST))
+ conv = gdk_rgb_convert_0888;
+ else if (bpp == 32 && depth == 24 && vtype == GDK_VISUAL_TRUE_COLOR &&
+ (mask_bgr && byte_order == GDK_LSB_FIRST))
+ conv = gdk_rgb_convert_8880_br;
+#endif
else if (vtype == GDK_VISUAL_TRUE_COLOR && byte_order == GDK_LSB_FIRST)
{
@@ -2471,7 +2729,7 @@ gdk_rgb_select_conv (GdkImage *image)
conv = gdk_rgb_convert_truecolor_msb;
conv_d = gdk_rgb_convert_truecolor_msb_d;
}
- else if (bpp == 1 && depth == 8 && (vtype == GDK_VISUAL_PSEUDO_COLOR
+ else if (bpp == 8 && depth == 8 && (vtype == GDK_VISUAL_PSEUDO_COLOR
#ifdef ENABLE_GRAYSCALE
|| vtype == GDK_VISUAL_GRAYSCALE
#endif
@@ -2491,7 +2749,7 @@ gdk_rgb_select_conv (GdkImage *image)
conv_indexed = gdk_rgb_convert_8_indexed;
conv_gray = gdk_rgb_convert_gray_cmap;
}
- else if (bpp == 1 && depth == 8 && (vtype == GDK_VISUAL_STATIC_GRAY
+ else if (bpp == 8 && depth == 8 && (vtype == GDK_VISUAL_STATIC_GRAY
#ifdef not_ENABLE_GRAYSCALE
|| vtype == GDK_VISUAL_GRAYSCALE
#endif
@@ -2500,10 +2758,24 @@ gdk_rgb_select_conv (GdkImage *image)
conv = gdk_rgb_convert_gray8;
conv_gray = gdk_rgb_convert_gray8_gray;
}
- else if (depth == 4)
+ else if (bpp == 8 && depth < 8 && depth >= 2 &&
+ (vtype == GDK_VISUAL_STATIC_GRAY
+ || vtype == GDK_VISUAL_GRAYSCALE))
+ {
+ conv = gdk_rgb_convert_gray4;
+ conv_d = gdk_rgb_convert_gray4_d;
+ }
+ else if (bpp == 8 && depth < 8 && depth >= 3)
{
conv = gdk_rgb_convert_4;
}
+ else if (bpp == 4 && depth <= 4 && depth >= 2 &&
+ (vtype == GDK_VISUAL_STATIC_GRAY
+ || vtype == GDK_VISUAL_GRAYSCALE))
+ {
+ conv = gdk_rgb_convert_gray4_pack;
+ conv_d = gdk_rgb_convert_gray4_d_pack;
+ }
if (conv_d == NULL)
conv_d = conv;
@@ -2566,7 +2838,6 @@ gdk_rgb_alloc_scratch (gint width, gint height, gint *x0, gint *y0)
GdkImage *image;
gint idx;
-
if (width >= (IMAGE_WIDTH >> 1))
{
if (height >= (IMAGE_HEIGHT >> 1))
@@ -2600,7 +2871,9 @@ gdk_rgb_alloc_scratch (gint width, gint height, gint *x0, gint *y0)
idx = vert_idx;
*x0 = vert_x;
*y0 = 0;
- vert_x += (width + 3) & -4;
+ /* using 3 and -4 would be slightly more efficient on 32-bit machines
+ with > 1bpp displays */
+ vert_x += (width + 7) & -8;
}
else
{
@@ -2621,7 +2894,7 @@ gdk_rgb_alloc_scratch (gint width, gint height, gint *x0, gint *y0)
idx = tile_idx;
*x0 = tile_x;
*y0 = tile_y1;
- tile_x += (width + 3) & -4;
+ tile_x += (width + 7) & -8;
}
}
image = static_image[idx];
@@ -2643,7 +2916,9 @@ gdk_draw_rgb_image_core (GdkDrawable *drawable,
gint pixstride,
gint rowstride,
GdkRgbConvFunc conv,
- GdkRgbCmap *cmap)
+ GdkRgbCmap *cmap,
+ gint xdith,
+ gint ydith)
{
gint y0, x0;
gint xs0, ys0;
@@ -2651,6 +2926,20 @@ gdk_draw_rgb_image_core (GdkDrawable *drawable,
gint width1, height1;
guchar *buf_ptr;
+ if (image_info->bitmap)
+ {
+ if (image_info->own_gc == NULL)
+ {
+ GdkColor color;
+
+ image_info->own_gc = gdk_gc_new (drawable);
+ gdk_color_white (image_info->cmap, &color);
+ gdk_gc_set_foreground (image_info->own_gc, &color);
+ gdk_color_black (image_info->cmap, &color);
+ gdk_gc_set_background (image_info->own_gc, &color);
+ }
+ gc = image_info->own_gc;
+ }
for (y0 = 0; y0 < height; y0 += IMAGE_HEIGHT)
{
height1 = MIN (height - y0, IMAGE_HEIGHT);
@@ -2662,7 +2951,7 @@ gdk_draw_rgb_image_core (GdkDrawable *drawable,
image = gdk_rgb_alloc_scratch (width1, height1, &xs0, &ys0);
conv (image, xs0, ys0, width1, height1, buf_ptr, rowstride,
- x + x0, y + y0, cmap);
+ x + x0 + xdith, y + y0 + ydith, cmap);
#ifndef DONT_ACTUALLY_DRAW
gdk_draw_image (drawable, gc,
@@ -2687,10 +2976,36 @@ gdk_draw_rgb_image (GdkDrawable *drawable,
if (dith == GDK_RGB_DITHER_NONE || (dith == GDK_RGB_DITHER_NORMAL &&
!image_info->dith_default))
gdk_draw_rgb_image_core (drawable, gc, x, y, width, height,
- rgb_buf, 3, rowstride, image_info->conv, NULL);
+ rgb_buf, 3, rowstride, image_info->conv, NULL,
+ 0, 0);
+ else
+ gdk_draw_rgb_image_core (drawable, gc, x, y, width, height,
+ rgb_buf, 3, rowstride, image_info->conv_d, NULL,
+ 0, 0);
+}
+
+void
+gdk_draw_rgb_image_dithalign (GdkDrawable *drawable,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ GdkRgbDither dith,
+ guchar *rgb_buf,
+ gint rowstride,
+ gint xdith,
+ gint ydith)
+{
+ if (dith == GDK_RGB_DITHER_NONE || (dith == GDK_RGB_DITHER_NORMAL &&
+ !image_info->dith_default))
+ gdk_draw_rgb_image_core (drawable, gc, x, y, width, height,
+ rgb_buf, 3, rowstride, image_info->conv, NULL,
+ xdith, ydith);
else
gdk_draw_rgb_image_core (drawable, gc, x, y, width, height,
- rgb_buf, 3, rowstride, image_info->conv_d, NULL);
+ rgb_buf, 3, rowstride, image_info->conv_d, NULL,
+ xdith, ydith);
}
void
@@ -2708,11 +3023,11 @@ gdk_draw_rgb_32_image (GdkDrawable *drawable,
!image_info->dith_default))
gdk_draw_rgb_image_core (drawable, gc, x, y, width, height,
buf, 4, rowstride,
- image_info->conv_32, NULL);
+ image_info->conv_32, NULL, 0, 0);
else
gdk_draw_rgb_image_core (drawable, gc, x, y, width, height,
buf, 4, rowstride,
- image_info->conv_32_d, NULL);
+ image_info->conv_32_d, NULL, 0, 0);
}
static void
@@ -2747,11 +3062,11 @@ gdk_draw_gray_image (GdkDrawable *drawable,
!image_info->dith_default))
gdk_draw_rgb_image_core (drawable, gc, x, y, width, height,
buf, 1, rowstride,
- image_info->conv_gray, NULL);
+ image_info->conv_gray, NULL, 0, 0);
else
gdk_draw_rgb_image_core (drawable, gc, x, y, width, height,
buf, 1, rowstride,
- image_info->conv_gray_d, NULL);
+ image_info->conv_gray_d, NULL, 0, 0);
}
GdkRgbCmap *
@@ -2804,11 +3119,11 @@ gdk_draw_indexed_image (GdkDrawable *drawable,
!image_info->dith_default))
gdk_draw_rgb_image_core (drawable, gc, x, y, width, height,
buf, 1, rowstride,
- image_info->conv_indexed, cmap);
+ image_info->conv_indexed, cmap, 0, 0);
else
gdk_draw_rgb_image_core (drawable, gc, x, y, width, height,
buf, 1, rowstride,
- image_info->conv_indexed_d, cmap);
+ image_info->conv_indexed_d, cmap, 0, 0);
}
gboolean
diff --git a/gdk/gdkrgb.h b/gdk/gdkrgb.h
index 4b12a32698..ee6f74ad4d 100644
--- a/gdk/gdkrgb.h
+++ b/gdk/gdkrgb.h
@@ -61,6 +61,19 @@ gdk_draw_rgb_image (GdkDrawable *drawable,
gint rowstride);
void
+gdk_draw_rgb_image_dithalign (GdkDrawable *drawable,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ GdkRgbDither dith,
+ guchar *rgb_buf,
+ gint rowstride,
+ gint xdith,
+ gint ydith);
+
+void
gdk_draw_rgb_32_image (GdkDrawable *drawable,
GdkGC *gc,
gint x,
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 275ca3aa98..0655f3c198 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -2579,4 +2579,3 @@ gdk_drawable_set_data (GdkDrawable *drawable,
{
g_dataset_set_data_full (drawable, key, data, destroy_func);
}
-
diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c
index fa810473e6..36b6c8593c 100644
--- a/gdk/x11/gdkcolor-x11.c
+++ b/gdk/x11/gdkcolor-x11.c
@@ -71,8 +71,8 @@ gdk_colormap_new (GdkVisual *visual,
private->info = g_new0 (GdkColorInfo, colormap->size);
colormap->colors = g_new (GdkColor, colormap->size);
- private->hash = g_hash_table_new (gdk_color_hash,
- gdk_color_equal);
+ private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
+ (GCompareFunc) gdk_color_equal);
private->private_val = private_cmap;
private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
@@ -259,8 +259,8 @@ gdk_colormap_get_system (void)
private->info = g_new0 (GdkColorInfo, colormap->size);
colormap->colors = g_new (GdkColor, colormap->size);
- private->hash = g_hash_table_new (gdk_color_hash,
- gdk_color_equal);
+ private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
+ (GCompareFunc) gdk_color_equal);
gdk_colormap_sync (colormap, TRUE);
}
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 275ca3aa98..0655f3c198 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -2579,4 +2579,3 @@ gdk_drawable_set_data (GdkDrawable *drawable,
{
g_dataset_set_data_full (drawable, key, data, destroy_func);
}
-
diff --git a/gtk/.cvsignore b/gtk/.cvsignore
index 967962f4be..db4097b014 100644
--- a/gtk/.cvsignore
+++ b/gtk/.cvsignore
@@ -8,6 +8,7 @@ libgtk-1.1.la
testgtk
testinput
testselection
+testrgb
simple
testtree
gtkfeatures.h
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index e417d5fe82..fc29412ec7 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -305,7 +305,7 @@ INCLUDES = \
-DGTK_DATA_PREFIX=\"$(prefix)\" \
-I$(top_srcdir) @GLIB_CFLAGS@ @x_cflags@
-noinst_PROGRAMS = testgtk testinput testselection testthreads simple
+noinst_PROGRAMS = testgtk testinput testselection testthreads testrgb simple
DEPS = \
libgtk.la \
@@ -323,12 +323,14 @@ testgtk_DEPENDENCIES = $(DEPS)
testinput_DEPENDENCIES = $(DEPS)
testthreads_DEPENDENCIES = $(DEPS)
testselection_DEPENDENCIES = $(DEPS)
+testrgb_DEPENDENCIES = $(DEPS)
simple_DEPENDENCIES = $(DEPS)
testgtk_LDADD = $(LDADDS)
testinput_LDADD = $(LDADDS)
testthreads_LDADD = $(LDADDS)
testselection_LDADD = $(LDADDS)
+testrgb_LDADD = $(LDADDS)
simple_LDADD = $(LDADDS)
.PHONY: files test test-debug
diff --git a/gtk/gtk.defs b/gtk/gtk.defs
index 3183345398..e8d0092a33 100644
--- a/gtk/gtk.defs
+++ b/gtk/gtk.defs
@@ -412,6 +412,7 @@
(has-default GTK_HAS_DEFAULT)
(has-grab GTK_HAS_GRAB)
(rc-style GTK_RC_STYLE)
+ (composite-child GTK_COMPOSITE_CHILD)
(basic GTK_BASIC))
; enumerations from "../gdk/gdkprivate.h"
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 16895e79b7..06d2cc37ff 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -376,9 +376,13 @@ gtk_accel_group_add (GtkAccelGroup *accel_group,
"cannot be used as accelerator signal",
accel_signal,
gtk_type_name (GTK_OBJECT_TYPE (object)));
+ if (query)
+ g_free (query);
+
return;
}
-
+ g_free (query);
+
/* prematurely abort if the group/entry is already locked
*/
if (accel_group->lock_count > 0)
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index b464b98b8e..e3bdab1fcc 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -31,7 +31,8 @@ static void gtk_bin_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_bin_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_bin_foreach (GtkContainer *container,
+static void gtk_bin_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static GtkType gtk_bin_child_type (GtkContainer*container);
@@ -85,7 +86,7 @@ gtk_bin_class_init (GtkBinClass *class)
container_class->add = gtk_bin_add;
container_class->remove = gtk_bin_remove;
- container_class->foreach = gtk_bin_foreach;
+ container_class->forall = gtk_bin_forall;
container_class->child_type = gtk_bin_child_type;
}
@@ -257,9 +258,10 @@ gtk_bin_remove (GtkContainer *container,
}
static void
-gtk_bin_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_bin_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkBin *bin;
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 7d63e616bc..c092c0bb00 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -51,7 +51,8 @@ static void gtk_box_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_box_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_box_foreach (GtkContainer *container,
+static void gtk_box_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_box_set_child_arg (GtkContainer *container,
@@ -124,7 +125,7 @@ gtk_box_class_init (GtkBoxClass *class)
container_class->add = gtk_box_add;
container_class->remove = gtk_box_remove;
- container_class->foreach = gtk_box_foreach;
+ container_class->forall = gtk_box_forall;
container_class->child_type = gtk_box_child_type;
container_class->set_child_arg = gtk_box_set_child_arg;
container_class->get_child_arg = gtk_box_get_child_arg;
@@ -746,9 +747,10 @@ gtk_box_remove (GtkContainer *container,
}
static void
-gtk_box_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_box_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkBox *box;
GtkBoxChild *child;
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 371eae1ece..fb82be1ca4 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -194,9 +194,10 @@ static gint get_selection_info (GtkCList * clist,
gint * column);
/* GtkContainer Methods */
-static void gtk_clist_foreach (GtkContainer * container,
- GtkCallback callback,
- gpointer callback_data);
+static void gtk_clist_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
/* Drawing */
static void draw_row (GtkCList * clist,
@@ -284,23 +285,23 @@ static void hadjustment_value_changed (GtkAdjustment * adjustment,
/* Memory Allocation/Distruction Routines */
static GtkCListColumn *columns_new (GtkCList * clist);
-static void column_title_new (GtkCList * clist,
- gint column,
- gchar * title);
+static void column_title_new (GtkCList *clist,
+ gint column,
+ const gchar *title);
static void columns_delete (GtkCList * clist);
static GtkCListRow *row_new (GtkCList * clist);
static void row_delete (GtkCList * clist,
GtkCListRow * clist_row);
-static void set_cell_contents (GtkCList * clist,
- GtkCListRow * clist_row,
- gint column,
- GtkCellType type,
- gchar * text,
- guint8 spacing,
- GdkPixmap * pixmap,
- GdkBitmap * mask);
+static void set_cell_contents (GtkCList *clist,
+ GtkCListRow *clist_row,
+ gint column,
+ GtkCellType type,
+ const gchar *text,
+ guint8 spacing,
+ GdkPixmap *pixmap,
+ GdkBitmap *mask);
static gint real_insert_row (GtkCList * clist,
gint row,
gchar * text[]);
@@ -533,7 +534,7 @@ gtk_clist_class_init (GtkCListClass * klass)
/* container_class->add = NULL; use the default GtkContainerClass warning */
/* container_class->remove = NULL; use the default GtkContainerClass warning */
- container_class->foreach = gtk_clist_foreach;
+ container_class->forall = gtk_clist_forall;
container_class->focus = gtk_clist_focus;
container_class->set_focus_child = gtk_clist_set_focus_child;
@@ -1077,9 +1078,9 @@ gtk_clist_column_titles_passive (GtkCList * clist)
}
void
-gtk_clist_set_column_title (GtkCList * clist,
- gint column,
- gchar * title)
+gtk_clist_set_column_title (GtkCList *clist,
+ gint column,
+ const gchar *title)
{
gint new_button = 0;
GtkWidget *old_widget;
@@ -1351,10 +1352,10 @@ gtk_clist_get_cell_type (GtkCList * clist,
}
void
-gtk_clist_set_text (GtkCList * clist,
- gint row,
- gint column,
- gchar * text)
+gtk_clist_set_text (GtkCList *clist,
+ gint row,
+ gint column,
+ const gchar *text)
{
GtkCListRow *clist_row;
@@ -1474,13 +1475,13 @@ gtk_clist_get_pixmap (GtkCList * clist,
}
void
-gtk_clist_set_pixtext (GtkCList * clist,
- gint row,
- gint column,
- gchar * text,
- guint8 spacing,
- GdkPixmap * pixmap,
- GdkBitmap * mask)
+gtk_clist_set_pixtext (GtkCList *clist,
+ gint row,
+ gint column,
+ const gchar *text,
+ guint8 spacing,
+ GdkPixmap *pixmap,
+ GdkBitmap *mask)
{
GtkCListRow *clist_row;
@@ -3369,14 +3370,14 @@ gtk_clist_size_allocate (GtkWidget * widget,
/*
* GTKCONTAINER
- * gtk_clist_foreach
+ * gtk_clist_forall
*/
static void
-gtk_clist_foreach (GtkContainer * container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_clist_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
- gint i;
GtkCList *clist;
g_return_if_fail (container != NULL);
@@ -3384,17 +3385,22 @@ gtk_clist_foreach (GtkContainer * container,
g_return_if_fail (callback != NULL);
clist = GTK_CLIST (container);
-
- /* callback for the column buttons */
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].button)
- (*callback) (clist->column[i].button, callback_data);
-
- /* callbacks for the scrollbars */
- if (clist->vscrollbar)
- (*callback) (clist->vscrollbar, callback_data);
- if (clist->hscrollbar)
- (*callback) (clist->hscrollbar, callback_data);
+
+ if (include_internals)
+ {
+ guint i;
+
+ /* callback for the column buttons */
+ for (i = 0; i < clist->columns; i++)
+ if (clist->column[i].button)
+ (*callback) (clist->column[i].button, callback_data);
+
+ /* callbacks for the scrollbars */
+ if (clist->vscrollbar)
+ (*callback) (clist->vscrollbar, callback_data);
+ if (clist->hscrollbar)
+ (*callback) (clist->hscrollbar, callback_data);
+ }
}
/*
@@ -4213,9 +4219,9 @@ column_button_create (GtkCList * clist,
GtkWidget *button;
button = clist->column[column].button = gtk_button_new ();
- gtk_widget_set_parent (button, GTK_WIDGET (clist));
if (GTK_WIDGET_REALIZED (clist) && clist->title_window)
gtk_widget_set_parent_window (clist->column[column].button, clist->title_window);
+ gtk_widget_set_parent (button, GTK_WIDGET (clist));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) column_button_clicked,
@@ -4704,9 +4710,9 @@ columns_new (GtkCList * clist)
}
static void
-column_title_new (GtkCList * clist,
- gint column,
- gchar * title)
+column_title_new (GtkCList *clist,
+ gint column,
+ const gchar *title)
{
if (clist->column[column].title)
g_free (clist->column[column].title);
@@ -4769,14 +4775,14 @@ row_delete (GtkCList * clist,
}
static void
-set_cell_contents (GtkCList * clist,
- GtkCListRow * clist_row,
- gint column,
- GtkCellType type,
- gchar * text,
- guint8 spacing,
- GdkPixmap * pixmap,
- GdkBitmap * mask)
+set_cell_contents (GtkCList *clist,
+ GtkCListRow *clist_row,
+ gint column,
+ GtkCellType type,
+ const gchar *text,
+ guint8 spacing,
+ GdkPixmap *pixmap,
+ GdkBitmap *mask)
{
g_return_if_fail (clist_row != NULL);
diff --git a/gtk/gtkclist.h b/gtk/gtkclist.h
index f5a1326774..9a57955f1e 100644
--- a/gtk/gtkclist.h
+++ b/gtk/gtkclist.h
@@ -30,9 +30,9 @@
#include <gtk/gtkenums.h>
#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
/* clist flags */
enum
@@ -106,15 +106,15 @@ struct _GtkCList
GtkContainer container;
guint16 flags;
-
+
/* mem chunks */
GMemChunk *row_mem_chunk;
GMemChunk *cell_mem_chunk;
-
+
/* allocation rectangle after the conatiner_border_width
* and the width of the shadow border */
GdkRectangle internal_allocation;
-
+
/* rows */
gint rows;
gint row_center_offset;
@@ -145,37 +145,37 @@ struct _GtkCList
/* the list's selection mode (gtkenums.h) */
GtkSelectionMode selection_mode;
-
+
/* list of selected rows */
GList *selection;
GList *selection_end;
-
+
GList *undo_selection;
GList *undo_unselection;
gint undo_anchor;
-
+
/* scrollbars */
GtkWidget *vscrollbar;
GtkWidget *hscrollbar;
guint8 vscrollbar_policy;
guint8 hscrollbar_policy;
-
+
/* xor GC for the vertical drag line */
GdkGC *xor_gc;
-
+
/* gc for drawing unselected cells */
GdkGC *fg_gc;
GdkGC *bg_gc;
-
+
/* cursor used to indicate dragging */
GdkCursor *cursor_drag;
-
+
/* the current x-pixel location of the xor-drag line */
gint x_drag;
-
+
/* focus handling */
gint focus_row;
-
+
/* dragging the selection */
gint anchor;
GtkStateType anchor_state;
@@ -194,61 +194,61 @@ struct _GtkCListClass
{
GtkContainerClass parent_class;
- void (*select_row) (GtkCList * clist,
- gint row,
- gint column,
- GdkEvent * event);
- void (*unselect_row) (GtkCList * clist,
- gint row,
- gint column,
- GdkEvent * event);
- void (*click_column) (GtkCList * clist,
- gint column);
- void (*toggle_focus_row) (GtkCList * clist);
- void (*select_all) (GtkCList * clist);
- void (*unselect_all) (GtkCList * clist);
- void (*undo_selection) (GtkCList * clist);
- void (*start_selection) (GtkCList * clist);
- void (*end_selection) (GtkCList * clist);
- void (*extend_selection) (GtkCList * clist,
- GtkScrollType scroll_type,
- gfloat position,
- gboolean auto_start_selection);
- void (*scroll_horizontal) (GtkCList * clist,
- GtkScrollType scroll_type,
- gfloat position);
- void (*scroll_vertical) (GtkCList * clist,
- GtkScrollType scroll_type,
- gfloat position);
- void (*toggle_add_mode) (GtkCList * clist);
- void (*abort_column_resize) (GtkCList * clist);
- void (*resync_selection) (GtkCList * clist,
- GdkEvent * event);
- GList * (*selection_find) (GtkCList *clist,
- gint row_number,
- GList *row_list_element);
- void (*draw_row) (GtkCList * clist,
- GdkRectangle * area,
- gint row,
- GtkCListRow * clist_row);
- void (*clear) (GtkCList * clist);
- void (*fake_unselect_all) (GtkCList * clist,
- gint row);
- void (*sort_list) (GtkCList * clist);
- gint (*insert_row) (GtkCList * clist,
- gint row,
- gchar * text[]);
- void (*remove_row) (GtkCList * clist,
- gint row);
- void (*set_cell_contents) (GtkCList * clist,
- GtkCListRow * clist_row,
- gint column,
- GtkCellType type,
- gchar * text,
- guint8 spacing,
- GdkPixmap * pixmap,
- GdkBitmap * mask);
-
+ void (*select_row) (GtkCList *clist,
+ gint row,
+ gint column,
+ GdkEvent *event);
+ void (*unselect_row) (GtkCList *clist,
+ gint row,
+ gint column,
+ GdkEvent *event);
+ void (*click_column) (GtkCList *clist,
+ gint column);
+ void (*toggle_focus_row) (GtkCList *clist);
+ void (*select_all) (GtkCList *clist);
+ void (*unselect_all) (GtkCList *clist);
+ void (*undo_selection) (GtkCList *clist);
+ void (*start_selection) (GtkCList *clist);
+ void (*end_selection) (GtkCList *clist);
+ void (*extend_selection) (GtkCList *clist,
+ GtkScrollType scroll_type,
+ gfloat position,
+ gboolean auto_start_selection);
+ void (*scroll_horizontal) (GtkCList *clist,
+ GtkScrollType scroll_type,
+ gfloat position);
+ void (*scroll_vertical) (GtkCList *clist,
+ GtkScrollType scroll_type,
+ gfloat position);
+ void (*toggle_add_mode) (GtkCList *clist);
+ void (*abort_column_resize) (GtkCList *clist);
+ void (*resync_selection) (GtkCList *clist,
+ GdkEvent *event);
+ GList* (*selection_find) (GtkCList *clist,
+ gint row_number,
+ GList *row_list_element);
+ void (*draw_row) (GtkCList *clist,
+ GdkRectangle *area,
+ gint row,
+ GtkCListRow *clist_row);
+ void (*clear) (GtkCList *clist);
+ void (*fake_unselect_all) (GtkCList *clist,
+ gint row);
+ void (*sort_list) (GtkCList *clist);
+ gint (*insert_row) (GtkCList *clist,
+ gint row,
+ gchar *text[]);
+ void (*remove_row) (GtkCList *clist,
+ gint row);
+ void (*set_cell_contents) (GtkCList *clist,
+ GtkCListRow *clist_row,
+ gint column,
+ GtkCellType type,
+ const gchar *text,
+ guint8 spacing,
+ GdkPixmap *pixmap,
+ GdkBitmap *mask);
+
gint scrollbar_spacing;
};
@@ -259,10 +259,10 @@ struct _GtkCListColumn
GtkWidget *button;
GdkWindow *window;
-
+
gint width;
GtkJustification justification;
-
+
gint width_set : 1;
};
@@ -270,13 +270,13 @@ struct _GtkCListRow
{
GtkCell *cell;
GtkStateType state;
-
+
GdkColor foreground;
GdkColor background;
-
+
gpointer data;
GtkDestroyNotify destroy;
-
+
gint fg_set : 1;
gint bg_set : 1;
};
@@ -329,25 +329,25 @@ struct _GtkCellWidget
struct _GtkCell
{
GtkCellType type;
-
+
gint vertical;
gint horizontal;
-
+
union {
gchar *text;
-
+
struct {
GdkPixmap *pixmap;
GdkBitmap *mask;
} pm;
-
+
struct {
gchar *text;
guint8 spacing;
GdkPixmap *pixmap;
GdkBitmap *mask;
} pt;
-
+
GtkWidget *widget;
} u;
};
@@ -355,219 +355,233 @@ struct _GtkCell
GtkType gtk_clist_get_type (void);
/* constructers useful for gtk-- wrappers */
-void gtk_clist_construct (GtkCList * clist,
- gint columns,
- gchar * titles[]);
+void gtk_clist_construct (GtkCList *clist,
+ gint columns,
+ gchar *titles[]);
/* create a new GtkCList */
-GtkWidget *gtk_clist_new (gint columns);
-GtkWidget *gtk_clist_new_with_titles (gint columns,
- gchar * titles[]);
+GtkWidget *gtk_clist_new (gint columns);
+GtkWidget *gtk_clist_new_with_titles (gint columns,
+ gchar *titles[]);
/* set the border style of the clist */
-void gtk_clist_set_border (GtkCList * clist,
+void gtk_clist_set_border (GtkCList *clist,
GtkShadowType border);
/* set the clist's selection mode */
-void gtk_clist_set_selection_mode (GtkCList * clist,
+void gtk_clist_set_selection_mode (GtkCList *clist,
GtkSelectionMode mode);
/* set policy on the scrollbar, to either show them all the time
* or show them only when they are needed, ie., when there is more than one page
- * of information */
-void gtk_clist_set_policy (GtkCList * clist,
+ * of information
+ */
+void gtk_clist_set_policy (GtkCList *clist,
GtkPolicyType vscrollbar_policy,
GtkPolicyType hscrollbar_policy);
/* freeze all visual updates of the list, and then thaw the list after you have made
* a number of changes and the updates wil occure in a more efficent mannor than if
- * you made them on a unfrozen list */
-void gtk_clist_freeze (GtkCList * clist);
-void gtk_clist_thaw (GtkCList * clist);
+ * you made them on a unfrozen list
+ */
+void gtk_clist_freeze (GtkCList *clist);
+void gtk_clist_thaw (GtkCList *clist);
/* show and hide the column title buttons */
-void gtk_clist_column_titles_show (GtkCList * clist);
-void gtk_clist_column_titles_hide (GtkCList * clist);
+void gtk_clist_column_titles_show (GtkCList *clist);
+void gtk_clist_column_titles_hide (GtkCList *clist);
/* set the column title to be a active title (responds to button presses,
* prelights, and grabs keyboard focus), or passive where it acts as just
- * a title */
-void gtk_clist_column_title_active (GtkCList * clist,
- gint column);
-void gtk_clist_column_title_passive (GtkCList * clist,
- gint column);
-void gtk_clist_column_titles_active (GtkCList * clist);
-void gtk_clist_column_titles_passive (GtkCList * clist);
+ * a title
+ */
+void gtk_clist_column_title_active (GtkCList *clist,
+ gint column);
+void gtk_clist_column_title_passive (GtkCList *clist,
+ gint column);
+void gtk_clist_column_titles_active (GtkCList *clist);
+void gtk_clist_column_titles_passive (GtkCList *clist);
/* set the title in the column title button */
-void gtk_clist_set_column_title (GtkCList * clist,
- gint column,
- gchar * title);
+void gtk_clist_set_column_title (GtkCList *clist,
+ gint column,
+ const gchar *title);
/* set a widget instead of a title for the column title button */
-void gtk_clist_set_column_widget (GtkCList * clist,
- gint column,
- GtkWidget * widget);
+void gtk_clist_set_column_widget (GtkCList *clist,
+ gint column,
+ GtkWidget *widget);
/* set the justification on a column */
-void gtk_clist_set_column_justification (GtkCList * clist,
- gint column,
+void gtk_clist_set_column_justification (GtkCList *clist,
+ gint column,
GtkJustification justification);
/* set the pixel width of a column; this is a necessary step in
* creating a CList because otherwise the column width is chozen from
- * the width of the column title, which will never be right */
-void gtk_clist_set_column_width (GtkCList * clist,
- gint column,
- gint width);
+ * the width of the column title, which will never be right
+ */
+void gtk_clist_set_column_width (GtkCList *clist,
+ gint column,
+ gint width);
-/* change the height of the rows, the default is the hight of the current
- * font */
-void gtk_clist_set_row_height (GtkCList * clist,
- gint height);
+/* change the height of the rows, the default is the hight
+ * of the current font
+ */
+void gtk_clist_set_row_height (GtkCList *clist,
+ gint height);
/* scroll the viewing area of the list to the given column
* and row; row_align and col_align are between 0-1 representing the
* location the row should appear on the screnn, 0.0 being top or left,
* 1.0 being bottom or right; if row or column is -1 then then there
- * is no change */
-void gtk_clist_moveto (GtkCList * clist,
- gint row,
- gint column,
- gfloat row_align,
- gfloat col_align);
+ * is no change
+ */
+void gtk_clist_moveto (GtkCList *clist,
+ gint row,
+ gint column,
+ gfloat row_align,
+ gfloat col_align);
/* returns whether the row is visible */
-GtkVisibility gtk_clist_row_is_visible (GtkCList * clist,
- gint row);
+GtkVisibility gtk_clist_row_is_visible (GtkCList *clist,
+ gint row);
/* returns the cell type */
-GtkCellType gtk_clist_get_cell_type (GtkCList * clist,
- gint row,
- gint column);
+GtkCellType gtk_clist_get_cell_type (GtkCList *clist,
+ gint row,
+ gint column);
/* sets a given cell's text, replacing it's current contents */
-void gtk_clist_set_text (GtkCList * clist,
- gint row,
- gint column,
- gchar * text);
+void gtk_clist_set_text (GtkCList *clist,
+ gint row,
+ gint column,
+ const gchar *text);
/* for the "get" functions, any of the return pointer can be
- * NULL if you are not interested */
-gint gtk_clist_get_text (GtkCList * clist,
- gint row,
- gint column,
- gchar ** text);
+ * NULL if you are not interested
+ */
+gint gtk_clist_get_text (GtkCList *clist,
+ gint row,
+ gint column,
+ gchar **text);
/* sets a given cell's pixmap, replacing it's current contents */
-void gtk_clist_set_pixmap (GtkCList * clist,
- gint row,
- gint column,
- GdkPixmap * pixmap,
- GdkBitmap * mask);
-
-gint gtk_clist_get_pixmap (GtkCList * clist,
- gint row,
- gint column,
- GdkPixmap ** pixmap,
- GdkBitmap ** mask);
+void gtk_clist_set_pixmap (GtkCList *clist,
+ gint row,
+ gint column,
+ GdkPixmap *pixmap,
+ GdkBitmap *mask);
+
+gint gtk_clist_get_pixmap (GtkCList *clist,
+ gint row,
+ gint column,
+ GdkPixmap **pixmap,
+ GdkBitmap **mask);
/* sets a given cell's pixmap and text, replacing it's current contents */
-void gtk_clist_set_pixtext (GtkCList * clist,
- gint row,
- gint column,
- gchar * text,
- guint8 spacing,
- GdkPixmap * pixmap,
- GdkBitmap * mask);
-
-gint gtk_clist_get_pixtext (GtkCList * clist,
- gint row,
- gint column,
- gchar ** text,
- guint8 * spacing,
- GdkPixmap ** pixmap,
- GdkBitmap ** mask);
+void gtk_clist_set_pixtext (GtkCList *clist,
+ gint row,
+ gint column,
+ const gchar *text,
+ guint8 spacing,
+ GdkPixmap *pixmap,
+ GdkBitmap *mask);
+
+gint gtk_clist_get_pixtext (GtkCList *clist,
+ gint row,
+ gint column,
+ gchar **text,
+ guint8 *spacing,
+ GdkPixmap **pixmap,
+ GdkBitmap **mask);
/* sets the foreground color of a row, the colar must already
- * be allocated */
-void gtk_clist_set_foreground (GtkCList * clist,
- gint row,
- GdkColor * color);
+ * be allocated
+ */
+void gtk_clist_set_foreground (GtkCList *clist,
+ gint row,
+ GdkColor *color);
/* sets the background color of a row, the colar must already
- * be allocated */
-void gtk_clist_set_background (GtkCList * clist,
- gint row,
- GdkColor * color);
+ * be allocated
+ */
+void gtk_clist_set_background (GtkCList *clist,
+ gint row,
+ GdkColor *color);
/* this sets a horizontal and vertical shift for drawing
* the contents of a cell; it can be positive or negitive; this is
- * partuculary useful for indenting items in a column */
-void gtk_clist_set_shift (GtkCList * clist,
- gint row,
- gint column,
- gint vertical,
- gint horizontal);
+ * particulary useful for indenting items in a column
+ */
+void gtk_clist_set_shift (GtkCList *clist,
+ gint row,
+ gint column,
+ gint vertical,
+ gint horizontal);
/* append returns the index of the row you just added, making
- * it easier to append and modify a row */
-gint gtk_clist_append (GtkCList * clist,
- gchar * text[]);
+ * it easier to append and modify a row
+ */
+gint gtk_clist_append (GtkCList *clist,
+ gchar *text[]);
/* inserts a row at index row and returns the row where it was actually
-inserted (may be different from "row" in auto_sort mode) */
-gint gtk_clist_insert (GtkCList * clist,
- gint row,
- gchar * text[]);
+ * inserted (may be different from "row" in auto_sort mode)
+ */
+gint gtk_clist_insert (GtkCList *clist,
+ gint row,
+ gchar *text[]);
/* removes row at index row */
-void gtk_clist_remove (GtkCList * clist,
- gint row);
+void gtk_clist_remove (GtkCList *clist,
+ gint row);
/* sets a arbitrary data pointer for a given row */
-void gtk_clist_set_row_data (GtkCList * clist,
- gint row,
- gpointer data);
+void gtk_clist_set_row_data (GtkCList *clist,
+ gint row,
+ gpointer data);
/* sets a data pointer for a given row with destroy notification */
-void gtk_clist_set_row_data_full (GtkCList * clist,
- gint row,
- gpointer data,
+void gtk_clist_set_row_data_full (GtkCList *clist,
+ gint row,
+ gpointer data,
GtkDestroyNotify destroy);
/* returns the data set for a row */
-gpointer gtk_clist_get_row_data (GtkCList * clist,
- gint row);
+gpointer gtk_clist_get_row_data (GtkCList *clist,
+ gint row);
/* givin a data pointer, find the first (and hopefully only!)
- * row that points to that data, or -1 if none do */
-gint gtk_clist_find_row_from_data (GtkCList * clist,
- gpointer data);
+ * row that points to that data, or -1 if none do
+ */
+gint gtk_clist_find_row_from_data (GtkCList *clist,
+ gpointer data);
/* force selection of a row */
-void gtk_clist_select_row (GtkCList * clist,
- gint row,
- gint column);
+void gtk_clist_select_row (GtkCList *clist,
+ gint row,
+ gint column);
/* force unselection of a row */
-void gtk_clist_unselect_row (GtkCList * clist,
- gint row,
- gint column);
+void gtk_clist_unselect_row (GtkCList *clist,
+ gint row,
+ gint column);
/* undo the last select/unselect operation */
void gtk_clist_undo_selection (GtkCList *clist);
/* clear the entire list -- this is much faster than removing each item
- * with gtk_clist_remove */
-void gtk_clist_clear (GtkCList * clist);
+ * with gtk_clist_remove
+ */
+void gtk_clist_clear (GtkCList *clist);
/* return the row column corresponding to the x and y coordinates */
-gint gtk_clist_get_selection_info (GtkCList * clist,
- gint x,
- gint y,
- gint * row,
- gint * column);
+gint gtk_clist_get_selection_info (GtkCList *clist,
+ gint x,
+ gint y,
+ gint *row,
+ gint *column);
/* in multiple or extended mode, select all rows */
void gtk_clist_select_all (GtkCList *clist);
@@ -576,7 +590,9 @@ void gtk_clist_select_all (GtkCList *clist);
void gtk_clist_unselect_all (GtkCList *clist);
/* swap the position of two rows */
-void gtk_clist_swap_rows (GtkCList * clist, gint row1, gint row2);
+void gtk_clist_swap_rows (GtkCList *clist,
+ gint row1,
+ gint row2);
/* sets a compare function different to the default */
void gtk_clist_set_compare_func (GtkCList *clist,
diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c
index 6407d1a4e2..60e8933983 100644
--- a/gtk/gtkcolorsel.c
+++ b/gtk/gtkcolorsel.c
@@ -465,7 +465,7 @@ gtk_color_selection_set_color (GtkColorSelection *colorsel,
colorsel->values[n] = color[i++];
}
- if (colorsel->use_opacity == TRUE)
+ if (colorsel->use_opacity)
{
colorsel->old_values[OPACITY] = colorsel->values[OPACITY];
colorsel->values[OPACITY] = color[i];
@@ -494,7 +494,7 @@ gtk_color_selection_get_color (GtkColorSelection *colorsel,
for (n = RED; n <= BLUE; n++)
color[i++] = colorsel->values[n];
- if (colorsel->use_opacity == TRUE)
+ if (colorsel->use_opacity)
color[i] = colorsel->values[OPACITY];
}
@@ -776,13 +776,13 @@ gtk_color_selection_set_opacity (GtkColorSelection *colorsel,
colorsel->use_opacity = use_opacity;
- if (use_opacity == FALSE && GTK_WIDGET_VISIBLE (colorsel->scales[OPACITY]))
+ if (!use_opacity && GTK_WIDGET_VISIBLE (colorsel->scales[OPACITY]))
{
gtk_widget_hide (colorsel->opacity_label);
gtk_widget_hide (colorsel->scales[OPACITY]);
gtk_widget_hide (colorsel->entries[OPACITY]);
}
- else if (use_opacity == TRUE && !GTK_WIDGET_VISIBLE (colorsel->scales[OPACITY]))
+ else if (use_opacity && !GTK_WIDGET_VISIBLE (colorsel->scales[OPACITY]))
{
gtk_widget_show (colorsel->opacity_label);
gtk_widget_show (colorsel->scales[OPACITY]);
@@ -973,7 +973,7 @@ gtk_color_selection_value_events (GtkWidget *area,
break;
case GDK_BUTTON_RELEASE:
gtk_grab_remove (area);
- if (colorsel->timer_active == TRUE)
+ if (colorsel->timer_active)
gtk_timeout_remove (colorsel->timer_tag);
colorsel->timer_active = FALSE;
@@ -997,7 +997,7 @@ gtk_color_selection_value_events (GtkWidget *area,
gtk_color_selection_color_changed (colorsel);
break;
case GTK_UPDATE_DELAYED:
- if (colorsel->timer_active == TRUE)
+ if (colorsel->timer_active)
gtk_timeout_remove (colorsel->timer_tag);
colorsel->timer_tag = gtk_timeout_add (TIMER_DELAY,
@@ -1062,7 +1062,7 @@ gtk_color_selection_wheel_events (GtkWidget *area,
break;
case GDK_BUTTON_RELEASE:
gtk_grab_remove (area);
- if (colorsel->timer_active == TRUE)
+ if (colorsel->timer_active)
gtk_timeout_remove (colorsel->timer_tag);
colorsel->timer_active = FALSE;
@@ -1089,7 +1089,7 @@ gtk_color_selection_wheel_events (GtkWidget *area,
gtk_color_selection_color_changed (colorsel);
break;
case GTK_UPDATE_DELAYED:
- if (colorsel->timer_active == TRUE)
+ if (colorsel->timer_active)
gtk_timeout_remove (colorsel->timer_tag);
colorsel->timer_tag = gtk_timeout_add (TIMER_DELAY,
(GtkFunction) gtk_color_selection_wheel_timeout,
@@ -1206,7 +1206,7 @@ gtk_color_selection_draw_wheel (GtkColorSelection *colorsel,
i = 0;
for (x = 0; x < wid; x++)
{
- if (gtk_color_selection_eval_wheel (x, y, cx, cy, &h, &s) == TRUE)
+ if (gtk_color_selection_eval_wheel (x, y, cx, cy, &h, &s))
{
for (n = 0; n < 3; n++)
colorsel->wheel_buf[i++] = bg[n];
@@ -1284,7 +1284,7 @@ gtk_color_selection_draw_sample (GtkColorSelection *colorsel,
c[n + 3] = (guchar) (255.0 * colorsel->values[i++]);
}
- if (colorsel->use_opacity == TRUE)
+ if (colorsel->use_opacity)
{
o = colorsel->values[OPACITY];
oldo = colorsel->old_values[OPACITY];
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 2bcc30b83f..80e770115f 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -28,7 +28,6 @@ enum {
ADD,
REMOVE,
CHECK_RESIZE,
- FOREACH,
FOCUS,
SET_FOCUS_CHILD,
LAST_SIGNAL
@@ -178,14 +177,6 @@ gtk_container_class_init (GtkContainerClass *class)
GTK_SIGNAL_OFFSET (GtkContainerClass, check_resize),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
- container_signals[FOREACH] =
- gtk_signal_new ("foreach",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkContainerClass, foreach),
- gtk_marshal_NONE__C_CALLBACK,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_C_CALLBACK);
container_signals[FOCUS] =
gtk_signal_new ("focus",
GTK_RUN_LAST,
@@ -207,18 +198,14 @@ gtk_container_class_init (GtkContainerClass *class)
object_class->get_arg = gtk_container_get_arg;
object_class->set_arg = gtk_container_set_arg;
object_class->destroy = gtk_container_destroy;
-
- /* Other container classes should overwrite show_all and hide_all,
- * for the purpose of showing internal children also, which are not
- * accessable through gtk_container_foreach.
- */
+
widget_class->show_all = gtk_container_show_all;
widget_class->hide_all = gtk_container_hide_all;
-
+
class->add = gtk_container_add_unimplemented;
class->remove = gtk_container_remove_unimplemented;
class->check_resize = gtk_container_real_check_resize;
- class->foreach = NULL;
+ class->forall = NULL;
class->focus = gtk_container_real_focus;
class->set_focus_child = gtk_container_real_set_focus_child;
class->child_type = NULL;
@@ -621,8 +608,7 @@ gtk_container_destroy (GtkObject *object)
}
gtk_container_clear_resize_widgets (container);
- gtk_container_foreach (container,
- (GtkCallback) gtk_widget_destroy, NULL);
+ gtk_container_foreach (container, (GtkCallback) gtk_widget_destroy, NULL);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -1103,17 +1089,37 @@ gtk_container_resize_children (GtkContainer *container)
}
void
+gtk_container_forall (GtkContainer *container,
+ GtkCallback callback,
+ gpointer callback_data)
+{
+ GtkContainerClass *class;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ g_return_if_fail (callback != NULL);
+
+ class = GTK_CONTAINER_CLASS (GTK_OBJECT (container)->klass);
+
+ if (class->forall)
+ class->forall (container, TRUE, callback, callback_data);
+}
+
+void
gtk_container_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data)
{
+ GtkContainerClass *class;
+
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (callback != NULL);
- gtk_signal_emit (GTK_OBJECT (container),
- container_signals[FOREACH],
- callback, callback_data);
+ class = GTK_CONTAINER_CLASS (GTK_OBJECT (container)->klass);
+
+ if (class->forall)
+ class->forall (container, FALSE, callback, callback_data);
}
typedef struct _GtkForeachData GtkForeachData;
@@ -1292,9 +1298,10 @@ gtk_container_real_focus (GtkContainer *container,
g_return_val_if_fail (container != NULL, FALSE);
g_return_val_if_fail (GTK_IS_CONTAINER (container), FALSE);
- /* Fail if the container is insensitive
+ /* Fail if the container is inappropriate for focus movement
*/
- if (!GTK_WIDGET_SENSITIVE (container))
+ if (!GTK_WIDGET_DRAWABLE (container) ||
+ !GTK_WIDGET_SENSITIVE (container))
return FALSE;
return_val = FALSE;
@@ -1308,25 +1315,32 @@ gtk_container_real_focus (GtkContainer *container,
{
/* Get a list of the containers children
*/
- children = gtk_container_children (container);
+ children = NULL;
+ gtk_container_forall (container,
+ gtk_container_children_callback,
+ &children);
+ children = g_list_reverse (children);
+ /* children = gtk_container_children (container); */
if (children)
{
- /* Remove any children which are insensitive
+ /* Remove any children which are inappropriate for focus movement
*/
tmp_list = children;
while (tmp_list)
{
- if (!GTK_WIDGET_SENSITIVE (tmp_list->data))
+ if (GTK_WIDGET_SENSITIVE (tmp_list->data) &&
+ GTK_WIDGET_DRAWABLE (tmp_list->data) &&
+ (GTK_IS_CONTAINER (tmp_list->data) || GTK_WIDGET_CAN_FOCUS (tmp_list->data)))
+ tmp_list = tmp_list->next;
+ else
{
tmp_list2 = tmp_list;
tmp_list = tmp_list->next;
-
+
children = g_list_remove_link (children, tmp_list2);
g_list_free_1 (tmp_list2);
}
- else
- tmp_list = tmp_list->next;
}
switch (direction)
@@ -1668,14 +1682,14 @@ gtk_container_focus_move (GtkContainer *container,
{
focus_child = NULL;
- if (GTK_WIDGET_VISIBLE (child) &&
+ if (GTK_WIDGET_DRAWABLE (child) &&
GTK_IS_CONTAINER (child) &&
!GTK_WIDGET_HAS_FOCUS (child))
if (gtk_container_focus (GTK_CONTAINER (child), direction))
return TRUE;
}
}
- else if (GTK_WIDGET_VISIBLE (child))
+ else if (GTK_WIDGET_DRAWABLE (child))
{
if (GTK_IS_CONTAINER (child))
{
@@ -1704,41 +1718,6 @@ gtk_container_children_callback (GtkWidget *widget,
*children = g_list_prepend (*children, widget);
}
-static void
-gtk_container_show_all (GtkWidget *widget)
-{
- GtkContainer *container;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CONTAINER (widget));
- container = GTK_CONTAINER (widget);
-
- /* First show children, then self.
- This makes sure that toplevel windows get shown as last widget.
- Otherwise the user would see the widgets get
- visible one after another.
- */
- gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
- gtk_widget_show (widget);
-}
-
-
-static void
-gtk_container_hide_all (GtkWidget *widget)
-{
- GtkContainer *container;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CONTAINER (widget));
- container = GTK_CONTAINER (widget);
-
- /* First hide self, then children.
- This is the reverse order of gtk_container_show_all.
- */
- gtk_widget_hide (widget);
- gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
-}
-
void
gtk_container_set_focus_vadjustment (GtkContainer *container,
GtkAdjustment *adjustment)
@@ -1774,3 +1753,28 @@ gtk_container_set_focus_hadjustment (GtkContainer *container,
adjustment,
(GtkDestroyNotify) gtk_object_unref);
}
+
+
+static void
+gtk_container_show_all (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (widget));
+
+ gtk_container_foreach (GTK_CONTAINER (widget),
+ (GtkCallback) gtk_widget_show_all,
+ NULL);
+ gtk_widget_show (widget);
+}
+
+static void
+gtk_container_hide_all (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (widget));
+
+ gtk_widget_hide (widget);
+ gtk_container_foreach (GTK_CONTAINER (widget),
+ (GtkCallback) gtk_widget_hide_all,
+ NULL);
+}
diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h
index aecd268f48..0f79446cb6 100644
--- a/gtk/gtkcontainer.h
+++ b/gtk/gtkcontainer.h
@@ -71,7 +71,8 @@ struct _GtkContainerClass
void (* remove) (GtkContainer *container,
GtkWidget *widget);
void (* check_resize) (GtkContainer *container);
- void (* foreach) (GtkContainer *container,
+ void (* forall) (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callbabck_data);
gint (* focus) (GtkContainer *container,
@@ -206,6 +207,9 @@ gchar* gtk_container_child_args_collect (GtkType object_type,
gchar* gtk_container_child_arg_get_info (GtkType object_type,
const gchar *arg_name,
GtkArgInfo **info_p);
+void gtk_container_forall (GtkContainer *container,
+ GtkCallback callback,
+ gpointer callback_data);
/* Deprecated methods */
diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c
index 2702abf815..b8b2ea3810 100644
--- a/gtk/gtkctree.c
+++ b/gtk/gtkctree.c
@@ -74,13 +74,13 @@ static void set_cell_contents (GtkCList *clist,
GtkCListRow *clist_row,
gint column,
GtkCellType type,
- gchar *text,
+ const gchar *text,
guint8 spacing,
GdkPixmap *pixmap,
GdkBitmap *mask);
static void set_node_info (GtkCTree *ctree,
GtkCTreeNode *node,
- gchar *text,
+ const gchar *text,
guint8 spacing,
GdkPixmap *pixmap_closed,
GdkBitmap *mask_closed,
@@ -3018,14 +3018,14 @@ real_tree_collapse (GtkCTree *ctree,
}
static void
-set_cell_contents (GtkCList * clist,
- GtkCListRow * clist_row,
- gint column,
- GtkCellType type,
- gchar * text,
- guint8 spacing,
- GdkPixmap * pixmap,
- GdkBitmap * mask)
+set_cell_contents (GtkCList *clist,
+ GtkCListRow *clist_row,
+ gint column,
+ GtkCellType type,
+ const gchar *text,
+ guint8 spacing,
+ GdkPixmap *pixmap,
+ GdkBitmap *mask)
{
GtkCTree *ctree;
@@ -3133,7 +3133,7 @@ set_cell_contents (GtkCList * clist,
static void
set_node_info (GtkCTree *ctree,
GtkCTreeNode *node,
- gchar *text,
+ const gchar *text,
guint8 spacing,
GdkPixmap *pixmap_closed,
GdkBitmap *mask_closed,
@@ -3803,7 +3803,7 @@ gtk_ctree_insert_node (GtkCTree *ctree,
GTK_CLIST_CLASS_FW (clist)->set_cell_contents
(clist, &(new_row->row), i, GTK_CELL_TEXT, text[i], 0, NULL, NULL);
- set_node_info (ctree, node, text[ctree->tree_column], spacing, pixmap_closed,
+ set_node_info (ctree, node, text ? text[ctree->tree_column] : NULL, spacing, pixmap_closed,
mask_closed, pixmap_opened, mask_opened, is_leaf, expanded);
/* sorted insertion */
@@ -4641,7 +4641,7 @@ void
gtk_ctree_node_set_text (GtkCTree *ctree,
GtkCTreeNode *node,
gint column,
- gchar *text)
+ const gchar *text)
{
GtkCList *clist;
@@ -4695,7 +4695,7 @@ void
gtk_ctree_node_set_pixtext (GtkCTree *ctree,
GtkCTreeNode *node,
gint column,
- gchar *text,
+ const gchar *text,
guint8 spacing,
GdkPixmap *pixmap,
GdkBitmap *mask)
@@ -4729,7 +4729,7 @@ gtk_ctree_node_set_pixtext (GtkCTree *ctree,
void
gtk_ctree_set_node_info (GtkCTree *ctree,
GtkCTreeNode *node,
- gchar *text,
+ const gchar *text,
guint8 spacing,
GdkPixmap *pixmap_closed,
GdkBitmap *mask_closed,
@@ -5068,6 +5068,8 @@ gtk_ctree_show_stub (GtkCTree *ctree,
g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
+ show_stub = show_stub != FALSE;
+
if (show_stub != ctree->show_stub)
{
GtkCList *clist;
@@ -5089,10 +5091,12 @@ gtk_ctree_set_reorderable (GtkCTree *ctree,
g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
- if (ctree->reorderable == (reorderable != 0))
+ reorderable = reorderable != FALSE;
+
+ if (ctree->reorderable == reorderable)
return;
- ctree->reorderable = (reorderable != 0);
+ ctree->reorderable = reorderable;
if (GTK_WIDGET_REALIZED (ctree))
{
diff --git a/gtk/gtkctree.h b/gtk/gtkctree.h
index 5854e57b96..01774921c6 100644
--- a/gtk/gtkctree.h
+++ b/gtk/gtkctree.h
@@ -293,7 +293,7 @@ void gtk_ctree_real_select_recursive (GtkCTree *ctree,
void gtk_ctree_node_set_text (GtkCTree *ctree,
GtkCTreeNode *node,
gint column,
- gchar *text);
+ const gchar *text);
void gtk_ctree_node_set_pixmap (GtkCTree *ctree,
GtkCTreeNode *node,
gint column,
@@ -302,13 +302,13 @@ void gtk_ctree_node_set_pixmap (GtkCTree *ctree,
void gtk_ctree_node_set_pixtext (GtkCTree *ctree,
GtkCTreeNode *node,
gint column,
- gchar *text,
+ const gchar *text,
guint8 spacing,
GdkPixmap *pixmap,
GdkBitmap *mask);
void gtk_ctree_set_node_info (GtkCTree *ctree,
GtkCTreeNode *node,
- gchar *text,
+ const gchar *text,
guint8 spacing,
GdkPixmap *pixmap_closed,
GdkBitmap *mask_closed,
@@ -388,7 +388,7 @@ void gtk_ctree_set_use_drag_icons (GtkCTree *ctree,
void gtk_ctree_set_line_style (GtkCTree *ctree,
GtkCTreeLineStyle line_style);
void gtk_ctree_set_drag_compare_func (GtkCTree *ctree,
- GtkCTreeCompareDragFunc cmp_func);
+ GtkCTreeCompareDragFunc cmp_func);
/***********************************************************
* Tree sorting functions *
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index 7c56639eae..726a94b2ee 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -38,19 +38,20 @@ static void gtk_fixed_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_fixed_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_fixed_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
+static void gtk_fixed_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
static GtkType gtk_fixed_child_type (GtkContainer *container);
static GtkContainerClass *parent_class = NULL;
-guint
+GtkType
gtk_fixed_get_type (void)
{
- static guint fixed_type = 0;
+ static GtkType fixed_type = 0;
if (!fixed_type)
{
@@ -66,7 +67,7 @@ gtk_fixed_get_type (void)
(GtkClassInitFunc) NULL,
};
- fixed_type = gtk_type_unique (gtk_container_get_type (), &fixed_info);
+ fixed_type = gtk_type_unique (GTK_TYPE_CONTAINER, &fixed_info);
}
return fixed_type;
@@ -83,7 +84,7 @@ gtk_fixed_class_init (GtkFixedClass *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);
widget_class->map = gtk_fixed_map;
widget_class->unmap = gtk_fixed_unmap;
@@ -95,7 +96,7 @@ gtk_fixed_class_init (GtkFixedClass *class)
container_class->add = gtk_fixed_add;
container_class->remove = gtk_fixed_remove;
- container_class->foreach = gtk_fixed_foreach;
+ container_class->forall = gtk_fixed_forall;
container_class->child_type = gtk_fixed_child_type;
}
@@ -119,7 +120,7 @@ gtk_fixed_new (void)
{
GtkFixed *fixed;
- fixed = gtk_type_new (gtk_fixed_get_type ());
+ fixed = gtk_type_new (GTK_TYPE_FIXED);
return GTK_WIDGET (fixed);
}
@@ -465,9 +466,10 @@ gtk_fixed_remove (GtkContainer *container,
}
static void
-gtk_fixed_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_fixed_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkFixed *fixed;
GtkFixedChild *child;
diff --git a/gtk/gtkfixed.h b/gtk/gtkfixed.h
index a2b6868080..cffbc5e7b9 100644
--- a/gtk/gtkfixed.h
+++ b/gtk/gtkfixed.h
@@ -26,12 +26,15 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_FIXED(obj) GTK_CHECK_CAST (obj, gtk_fixed_get_type (), GtkFixed)
-#define GTK_FIXED_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_fixed_get_type (), GtkFixedClass)
-#define GTK_IS_FIXED(obj) GTK_CHECK_TYPE (obj, gtk_fixed_get_type ())
+#define GTK_TYPE_FIXED (gtk_fixed_get_type ())
+#define GTK_FIXED(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_FIXED, GtkFixed))
+#define GTK_FIXED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_FIXED, GtkFixedClass))
+#define GTK_IS_FIXED(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_FIXED))
+#define GTK_IS_FIXED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FIXED))
typedef struct _GtkFixed GtkFixed;
@@ -58,7 +61,7 @@ struct _GtkFixedChild
};
-guint gtk_fixed_get_type (void);
+GtkType gtk_fixed_get_type (void);
GtkWidget* gtk_fixed_new (void);
void gtk_fixed_put (GtkFixed *fixed,
GtkWidget *widget,
diff --git a/gtk/gtkitem.c b/gtk/gtkitem.c
index 4ac00afcaf..9613263442 100644
--- a/gtk/gtkitem.c
+++ b/gtk/gtkitem.c
@@ -42,10 +42,10 @@ static gint gtk_item_leave (GtkWidget *widget,
static guint item_signals[LAST_SIGNAL] = { 0 };
-guint
+GtkType
gtk_item_get_type (void)
{
- static guint item_type = 0;
+ static GtkType item_type = 0;
if (!item_type)
{
@@ -61,7 +61,7 @@ gtk_item_get_type (void)
(GtkClassInitFunc) NULL,
};
- item_type = gtk_type_unique (gtk_bin_get_type (), &item_info);
+ item_type = gtk_type_unique (GTK_TYPE_BIN, &item_info);
}
return item_type;
@@ -146,6 +146,7 @@ gtk_item_map (GtkWidget *widget)
g_return_if_fail (GTK_IS_ITEM (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
+
gdk_window_show (widget->window);
bin = GTK_BIN (widget);
@@ -163,6 +164,7 @@ gtk_item_unmap (GtkWidget *widget)
g_return_if_fail (GTK_IS_ITEM (widget));
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
+
gdk_window_hide (widget->window);
}
diff --git a/gtk/gtkitem.h b/gtk/gtkitem.h
index f607a1550a..1c036d1ecc 100644
--- a/gtk/gtkitem.h
+++ b/gtk/gtkitem.h
@@ -26,12 +26,15 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_ITEM(obj) GTK_CHECK_CAST (obj, gtk_item_get_type (), GtkItem)
-#define GTK_ITEM_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_item_get_type (), GtkItemClass)
-#define GTK_IS_ITEM(obj) GTK_CHECK_TYPE (obj, gtk_item_get_type ())
+#define GTK_TYPE_ITEM (gtk_item_get_type ())
+#define GTK_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ITEM, GtkItem))
+#define GTK_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ITEM, GtkItemClass))
+#define GTK_IS_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ITEM))
+#define GTK_IS_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ITEM))
typedef struct _GtkItem GtkItem;
@@ -52,10 +55,10 @@ struct _GtkItemClass
};
-guint gtk_item_get_type (void);
-void gtk_item_select (GtkItem *item);
-void gtk_item_deselect (GtkItem *item);
-void gtk_item_toggle (GtkItem *item);
+GtkType gtk_item_get_type (void);
+void gtk_item_select (GtkItem *item);
+void gtk_item_deselect (GtkItem *item);
+void gtk_item_toggle (GtkItem *item);
#ifdef __cplusplus
diff --git a/gtk/gtkitemfactory.c b/gtk/gtkitemfactory.c
index 74054e8b22..6a592a7f86 100644
--- a/gtk/gtkitemfactory.c
+++ b/gtk/gtkitemfactory.c
@@ -628,6 +628,9 @@ gtk_item_factory_from_path (const gchar *path)
fname[i + 1] = 0;
item = g_hash_table_lookup (class->item_ht, fname);
+
+ g_free (fname);
+
if (item && item->widgets)
return gtk_item_factory_from_widget (item->widgets->data);
@@ -1006,7 +1009,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
if (!gtk_item_factory_parse_path (entry->path,
&path, &parent_path, &name))
return;
-
+
parent = gtk_item_factory_get_widget (ifactory, parent_path);
if (!parent)
{
@@ -1104,6 +1107,8 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
callback_type,
item_type_path,
widget);
+
+ g_free (path);
}
void
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 864fc02bc5..962f22285e 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -295,6 +295,7 @@ gtk_label_finalize (GtkObject *object)
label = GTK_LABEL (object);
g_free (label->label);
+ if (label->pattern) g_free (label->pattern);
gtk_label_free_rows (label);
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
@@ -530,7 +531,6 @@ gtk_label_parse_uline (GtkLabel *label,
p = string;
q = name;
r = pattern;
- underscore = FALSE;
while (*p)
{
@@ -561,7 +561,8 @@ gtk_label_parse_uline (GtkLabel *label,
p++;
}
*q = 0;
-
+ *r = 0;
+
gtk_label_set (label, name);
gtk_label_set_pattern (label, pattern);
diff --git a/gtk/gtklist.c b/gtk/gtklist.c
index 1889f361a7..6ce42f7308 100644
--- a/gtk/gtklist.c
+++ b/gtk/gtklist.c
@@ -56,7 +56,8 @@ static void gtk_list_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_list_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_list_foreach (GtkContainer *container,
+static void gtk_list_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
@@ -102,7 +103,7 @@ static guint hadjustment_key_id = 0;
GtkType
gtk_list_get_type (void)
{
- static guint list_type = 0;
+ static GtkType list_type = 0;
if (!list_type)
{
@@ -118,7 +119,7 @@ gtk_list_get_type (void)
(GtkClassInitFunc) NULL,
};
- list_type = gtk_type_unique (gtk_container_get_type (), &list_info);
+ list_type = gtk_type_unique (GTK_TYPE_CONTAINER, &list_info);
}
return list_type;
@@ -135,7 +136,7 @@ gtk_list_class_init (GtkListClass *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);
vadjustment_key_id = g_quark_from_static_string (vadjustment_key);
hadjustment_key_id = g_quark_from_static_string (hadjustment_key);
@@ -182,7 +183,7 @@ gtk_list_class_init (GtkListClass *class)
container_class->add = gtk_list_add;
container_class->remove = gtk_list_remove;
- container_class->foreach = gtk_list_foreach;
+ container_class->forall = gtk_list_forall;
container_class->child_type = gtk_list_child_type;
container_class->set_focus_child = gtk_list_set_focus_child;
container_class->focus = gtk_list_focus;
@@ -225,7 +226,7 @@ gtk_list_init (GtkList *list)
GtkWidget*
gtk_list_new (void)
{
- return GTK_WIDGET (gtk_type_new (gtk_list_get_type ()));
+ return GTK_WIDGET (gtk_type_new (GTK_TYPE_LIST));
}
static void
@@ -1285,9 +1286,10 @@ gtk_list_remove (GtkContainer *container,
}
static void
-gtk_list_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_list_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkList *list;
GtkWidget *child;
diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c
index ab0a4db9f0..91563ae416 100644
--- a/gtk/gtklistitem.c
+++ b/gtk/gtklistitem.c
@@ -623,7 +623,6 @@ gtk_real_list_item_select (GtkItem *item)
g_return_if_fail (GTK_IS_LIST_ITEM (item));
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_SELECTED);
- gtk_widget_queue_draw (GTK_WIDGET (item));
}
static void
@@ -636,7 +635,6 @@ gtk_real_list_item_deselect (GtkItem *item)
return;
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_NORMAL);
- gtk_widget_queue_draw (GTK_WIDGET (item));
}
static void
@@ -659,7 +657,6 @@ gtk_real_list_item_toggle (GtkItem *item)
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_NORMAL);
else
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_SELECTED);
- gtk_widget_queue_draw (GTK_WIDGET (item));
}
}
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index ebd0ae110a..4876162e78 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -57,8 +57,8 @@ static gint gtk_menu_key_press (GtkWidget *widget,
static gint gtk_menu_motion_notify (GtkWidget *widget,
GdkEventMotion *event);
static void gtk_menu_deactivate (GtkMenuShell *menu_shell);
-static void gtk_menu_show_all (GtkWidget *widget);
-static void gtk_menu_hide_all (GtkWidget *widget);
+static void gtk_menu_show_all (GtkWidget *widget);
+static void gtk_menu_hide_all (GtkWidget *widget);
static void gtk_menu_position (GtkMenu *menu);
static void gtk_menu_reparent (GtkMenu *menu,
GtkWidget *new_parent,
@@ -119,7 +119,7 @@ gtk_menu_class_init (GtkMenuClass *class)
widget_class->key_press_event = gtk_menu_key_press;
widget_class->motion_notify_event = gtk_menu_motion_notify;
widget_class->show_all = gtk_menu_show_all;
- widget_class->hide_all = gtk_menu_hide_all;
+ widget_class->hide_all = gtk_menu_hide_all;
menu_shell_class->submenu_placement = GTK_LEFT_RIGHT;
menu_shell_class->deactivate = gtk_menu_deactivate;
@@ -989,33 +989,6 @@ gtk_menu_deactivate (GtkMenuShell *menu_shell)
static void
-gtk_menu_show_all (GtkWidget *widget)
-{
- GtkContainer *container;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
- container = GTK_CONTAINER (widget);
-
- /* Show children, but not self. */
- gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
-}
-
-
-static void
-gtk_menu_hide_all (GtkWidget *widget)
-{
- GtkContainer *container;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
- container = GTK_CONTAINER (widget);
-
- /* Hide children, but not self. */
- gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
-}
-
-static void
gtk_menu_position (GtkMenu *menu)
{
GtkWidget *widget;
@@ -1072,8 +1045,8 @@ gtk_menu_reparent (GtkMenu *menu,
{
GtkObject *object = GTK_OBJECT (menu);
GtkWidget *widget = GTK_WIDGET (menu);
-
gboolean was_floating = GTK_OBJECT_FLOATING (object);
+
gtk_object_ref (object);
gtk_object_sink (object);
@@ -1093,7 +1066,24 @@ gtk_menu_reparent (GtkMenu *menu,
gtk_object_unref (object);
}
+static void
+gtk_menu_show_all (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_MENU (widget));
+ /* Show children, but not self. */
+ gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_show_all, NULL);
+}
+static void
+gtk_menu_hide_all (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_MENU (widget));
+
+ /* Hide children, but not self. */
+ gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_hide_all, NULL);
+}
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 67c2136f6d..823d99c420 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -61,6 +61,10 @@ static void gtk_menu_item_position_menu (GtkMenu *menu,
gpointer user_data);
static void gtk_menu_item_show_all (GtkWidget *widget);
static void gtk_menu_item_hide_all (GtkWidget *widget);
+static void gtk_menu_item_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
static GtkItemClass *parent_class;
static guint menu_item_signals[LAST_SIGNAL] = { 0 };
@@ -97,10 +101,12 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
+ GtkContainerClass *container_class;
GtkItemClass *item_class;
object_class = (GtkObjectClass*) klass;
widget_class = (GtkWidgetClass*) klass;
+ container_class = (GtkContainerClass*) klass;
item_class = (GtkItemClass*) klass;
parent_class = gtk_type_class (gtk_item_get_type ());
@@ -131,7 +137,9 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
widget_class->draw = gtk_menu_item_draw;
widget_class->expose_event = gtk_menu_item_expose;
widget_class->show_all = gtk_menu_item_show_all;
- widget_class->hide_all = gtk_menu_item_hide_all;
+ widget_class->hide_all = gtk_menu_item_hide_all;
+
+ container_class->forall = gtk_menu_item_forall;
item_class->select = gtk_real_menu_item_select;
item_class->deselect = gtk_real_menu_item_deselect;
@@ -713,39 +721,61 @@ gtk_menu_item_right_justify(GtkMenuItem *menuitem)
menuitem->right_justify = 1;
}
+
static void
gtk_menu_item_show_all (GtkWidget *widget)
{
- GtkContainer *container;
- GtkMenuItem *menu_item;
+ GtkMenuItem *menu_item;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
- container = GTK_CONTAINER (widget);
+
menu_item = GTK_MENU_ITEM (widget);
- /* Show children, traverse to submenu, show self. */
- gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
+ /* show children including submenu */
if (menu_item->submenu)
gtk_widget_show_all (menu_item->submenu);
+ gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_show_all, NULL);
+
gtk_widget_show (widget);
}
-
static void
gtk_menu_item_hide_all (GtkWidget *widget)
{
- GtkContainer *container;
- GtkMenuItem *menu_item;
+ GtkMenuItem *menu_item;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
- container = GTK_CONTAINER (widget);
- menu_item = GTK_MENU_ITEM (widget);
- /* Reverse order of gtk_menu_item_show_all */
gtk_widget_hide (widget);
+
+ menu_item = GTK_MENU_ITEM (widget);
+
+ /* hide children including submenu */
+ gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_hide_all, NULL);
if (menu_item->submenu)
gtk_widget_hide_all (menu_item->submenu);
- gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
+}
+
+static void
+gtk_menu_item_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
+{
+ GtkBin *bin;
+ GtkMenuItem *menu_item;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_MENU_ITEM (container));
+ g_return_if_fail (callback != NULL);
+
+ bin = GTK_BIN (container);
+ menu_item = GTK_MENU_ITEM (container);
+
+ if (bin->child)
+ (* callback) (bin->child, callback_data);
+ if (include_internals && menu_item->submenu)
+ (* callback) (menu_item->submenu, callback_data);
}
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index 333e1c1297..a6a3bb20df 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -118,7 +118,8 @@ static void gtk_menu_shell_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_menu_shell_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_menu_shell_foreach (GtkContainer *container,
+static void gtk_menu_shell_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_real_menu_shell_deactivate (GtkMenuShell *menu_shell);
@@ -229,7 +230,7 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
container_class->add = gtk_menu_shell_add;
container_class->remove = gtk_menu_shell_remove;
- container_class->foreach = gtk_menu_shell_foreach;
+ container_class->forall = gtk_menu_shell_forall;
container_class->child_type = gtk_menu_shell_child_type;
klass->submenu_placement = GTK_TOP_BOTTOM;
@@ -692,9 +693,10 @@ gtk_menu_shell_remove (GtkContainer *container,
}
static void
-gtk_menu_shell_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_menu_shell_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkMenuShell *menu_shell;
GtkWidget *child;
@@ -897,6 +899,9 @@ gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
GtkMenuDirectionType direction)
{
GtkMenuShell *parent_menu_shell = NULL;
+ gboolean had_selection;
+
+ had_selection = menu_shell->active_menu_item != NULL;
if (menu_shell->parent_menu_shell)
parent_menu_shell = GTK_MENU_SHELL (menu_shell->parent_menu_shell);
@@ -915,7 +920,8 @@ gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
break;
case GTK_MENU_DIR_CHILD:
- if (GTK_BIN (menu_shell->active_menu_item)->child &&
+ if (menu_shell->active_menu_item &&
+ GTK_BIN (menu_shell->active_menu_item)->child &&
GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu)
{
menu_shell = GTK_MENU_SHELL (GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu);
@@ -934,14 +940,23 @@ gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
gtk_menu_shell_move_selected (parent_menu_shell, 1);
}
break;
-
+
case GTK_MENU_DIR_PREV:
gtk_menu_shell_move_selected (menu_shell, -1);
+ if (!had_selection &&
+ !menu_shell->active_menu_item &&
+ menu_shell->children)
+ gtk_menu_shell_select_item (menu_shell, g_list_last (menu_shell->children)->data);
break;
case GTK_MENU_DIR_NEXT:
gtk_menu_shell_move_selected (menu_shell, 1);
+ if (!had_selection &&
+ !menu_shell->active_menu_item &&
+ menu_shell->children)
+ gtk_menu_shell_select_item (menu_shell, menu_shell->children->data);
break;
}
+
}
static void
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 2af7af9aab..ae46a4fe7d 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -112,7 +112,8 @@ static void gtk_notebook_remove (GtkContainer *container,
static void gtk_notebook_real_remove (GtkNotebook *notebook,
GList *list,
guint page_num);
-static void gtk_notebook_foreach (GtkContainer *container,
+static void gtk_notebook_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_notebook_switch_page (GtkNotebook *notebook,
@@ -149,7 +150,7 @@ static void gtk_notebook_calc_tabs (GtkNotebook *notebook,
static void gtk_notebook_expose_tabs (GtkNotebook *notebook);
static void gtk_notebook_switch_focus_tab (GtkNotebook *notebook,
GList *new_child);
-static void gtk_real_notebook_switch_page (GtkNotebook *notebook,
+static void gtk_notebook_real_switch_page (GtkNotebook *notebook,
GtkNotebookPage *page,
guint page_num);
static void gtk_notebook_menu_switch_page (GtkWidget *widget,
@@ -259,14 +260,14 @@ gtk_notebook_class_init (GtkNotebookClass *class)
container_class->add = gtk_notebook_add;
container_class->remove = gtk_notebook_remove;
- container_class->foreach = gtk_notebook_foreach;
+ container_class->forall = gtk_notebook_forall;
container_class->focus = gtk_notebook_focus;
container_class->set_focus_child = gtk_notebook_set_focus_child;
container_class->get_child_arg = gtk_notebook_get_child_arg;
container_class->set_child_arg = gtk_notebook_set_child_arg;
container_class->child_type = gtk_notebook_child_type;
- class->switch_page = gtk_real_notebook_switch_page;
+ class->switch_page = gtk_notebook_real_switch_page;
}
static void
@@ -783,6 +784,33 @@ gtk_notebook_remove (GtkContainer *container,
}
}
+gint
+gtk_notebook_page_num (GtkNotebook *notebook,
+ GtkWidget *child)
+{
+ GList *children;
+ gint num;
+
+ g_return_val_if_fail (notebook != NULL, -1);
+ g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), -1);
+
+ num = 0;
+ children = notebook->children;
+ while (children)
+ {
+ GtkNotebookPage *page;
+
+ page = children->data;
+ if (page->child == child)
+ return num;
+
+ children = children->next;
+ num++;
+ }
+
+ return -1;
+}
+
static void
gtk_notebook_real_remove (GtkNotebook *notebook,
GList *list,
@@ -1064,12 +1092,12 @@ gtk_notebook_reorder_child (GtkNotebook *notebook,
}
static void
-gtk_notebook_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_notebook_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkNotebook *notebook;
- GtkNotebookPage *page;
GList *children;
g_return_if_fail (container != NULL);
@@ -1077,13 +1105,22 @@ gtk_notebook_foreach (GtkContainer *container,
g_return_if_fail (callback != NULL);
notebook = GTK_NOTEBOOK (container);
-
+
children = notebook->children;
while (children)
{
+ GtkNotebookPage *page;
+
page = children->data;
children = children->next;
(* callback) (page->child, callback_data);
+ if (include_internals)
+ {
+ if (page->tab_label)
+ (* callback) (page->tab_label, callback_data);
+ if (page->menu_label)
+ (* callback) (page->menu_label, callback_data);
+ }
}
}
@@ -1149,15 +1186,12 @@ gtk_notebook_set_tab_pos (GtkNotebook *notebook,
if (GTK_WIDGET_VISIBLE (notebook))
gtk_widget_queue_resize (GTK_WIDGET (notebook));
-
- if (GTK_WIDGET_DRAWABLE (notebook) && notebook->panel)
- gdk_window_clear (notebook->panel);
}
}
void
gtk_notebook_set_show_tabs (GtkNotebook *notebook,
- gint show_tabs)
+ gboolean show_tabs)
{
GtkNotebookPage *page;
GList *children;
@@ -1165,6 +1199,8 @@ gtk_notebook_set_show_tabs (GtkNotebook *notebook,
g_return_if_fail (notebook != NULL);
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
+ show_tabs = show_tabs != FALSE;
+
if (notebook->show_tabs == show_tabs)
return;
@@ -2181,7 +2217,7 @@ gtk_notebook_draw_arrow (GtkNotebook *notebook, guint arrow)
}
static void
-gtk_real_notebook_switch_page (GtkNotebook *notebook,
+gtk_notebook_real_switch_page (GtkNotebook *notebook,
GtkNotebookPage *page,
guint page_num)
{
@@ -2203,7 +2239,7 @@ gtk_real_notebook_switch_page (GtkNotebook *notebook,
g_list_find (notebook->children, notebook->cur_page);
gtk_notebook_pages_allocate (notebook, &GTK_WIDGET (notebook)->allocation);
-
+
if (GTK_WIDGET_MAPPED (notebook))
{
if (GTK_WIDGET_REALIZED (notebook->cur_page->child))
@@ -2838,7 +2874,9 @@ gtk_notebook_focus (GtkContainer *container,
notebook = GTK_NOTEBOOK (container);
- if (!GTK_WIDGET_SENSITIVE (container) || !notebook->children)
+ if (!GTK_WIDGET_DRAWABLE (notebook) ||
+ !GTK_WIDGET_SENSITIVE (container) ||
+ !notebook->children)
return FALSE;
focus_child = container->focus_child;
@@ -2846,12 +2884,12 @@ gtk_notebook_focus (GtkContainer *container,
if (!notebook->show_tabs)
{
- if (GTK_WIDGET_VISIBLE (notebook->cur_page->child))
+ if (GTK_WIDGET_DRAWABLE (notebook->cur_page->child) &&
+ GTK_WIDGET_SENSITIVE (notebook->cur_page->child))
{
if (GTK_IS_CONTAINER (notebook->cur_page->child))
{
- if (gtk_container_focus
- (GTK_CONTAINER (notebook->cur_page->child), direction))
+ if (gtk_container_focus (GTK_CONTAINER (notebook->cur_page->child), direction))
return TRUE;
}
else if (GTK_WIDGET_CAN_FOCUS (notebook->cur_page->child))
@@ -2874,7 +2912,7 @@ gtk_notebook_focus (GtkContainer *container,
if (focus_child && old_page && focus_child == old_page->child &&
notebook->child_has_focus)
{
- if (GTK_WIDGET_VISIBLE (old_page->child))
+ if (GTK_WIDGET_DRAWABLE (old_page->child))
{
if (GTK_IS_CONTAINER (old_page->child) &&
!GTK_WIDGET_HAS_FOCUS (old_page->child))
@@ -2913,8 +2951,7 @@ gtk_notebook_focus (GtkContainer *container,
case GTK_DIR_LEFT:
case GTK_DIR_UP:
if (!notebook->focus_tab)
- gtk_notebook_switch_focus_tab
- (notebook, g_list_last (notebook->children));
+ gtk_notebook_switch_focus_tab (notebook, g_list_last (notebook->children));
else
gtk_notebook_switch_focus_tab (notebook, notebook->focus_tab->prev);
@@ -2931,7 +2968,7 @@ gtk_notebook_focus (GtkContainer *container,
if (return_val)
{
- if (!GTK_WIDGET_HAS_FOCUS (container) )
+ if (!GTK_WIDGET_HAS_FOCUS (container))
gtk_widget_grab_focus (GTK_WIDGET (container));
if (GTK_WIDGET_MAPPED (page->tab_label))
diff --git a/gtk/gtknotebook.h b/gtk/gtknotebook.h
index 6a77f7bb7a..c5c3cac721 100644
--- a/gtk/gtknotebook.h
+++ b/gtk/gtknotebook.h
@@ -117,6 +117,8 @@ void gtk_notebook_insert_page_menu (GtkNotebook *notebook,
void gtk_notebook_remove_page (GtkNotebook *notebook,
gint page_num);
gint gtk_notebook_current_page (GtkNotebook *notebook);
+gint gtk_notebook_page_num (GtkNotebook *notebook,
+ GtkWidget *child);
void gtk_notebook_set_page (GtkNotebook *notebook,
gint page_num);
void gtk_notebook_next_page (GtkNotebook *notebook);
@@ -127,7 +129,7 @@ void gtk_notebook_reorder_child (GtkNotebook *notebook,
void gtk_notebook_set_tab_pos (GtkNotebook *notebook,
GtkPositionType pos);
void gtk_notebook_set_show_tabs (GtkNotebook *notebook,
- gint show_tabs);
+ gboolean show_tabs);
void gtk_notebook_set_show_border (GtkNotebook *notebook,
gint show_border);
void gtk_notebook_set_scrollable (GtkNotebook *notebook,
diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c
index b8bcb05080..5e15501366 100644
--- a/gtk/gtkoptionmenu.c
+++ b/gtk/gtkoptionmenu.c
@@ -20,6 +20,7 @@
#include "gtkmenuitem.h"
#include "gtkoptionmenu.h"
#include "gtksignal.h"
+#include "gdk/gdkkeysyms.h"
#define CHILD_LEFT_SPACING 5
@@ -46,6 +47,8 @@ static gint gtk_option_menu_expose (GtkWidget *widget,
GdkEventExpose *event);
static gint gtk_option_menu_button_press (GtkWidget *widget,
GdkEventButton *event);
+static gint gtk_option_menu_key_press (GtkWidget *widget,
+ GdkEventKey *event);
static void gtk_option_menu_deactivate (GtkMenuShell *menu_shell,
GtkOptionMenu *option_menu);
static void gtk_option_menu_update_contents (GtkOptionMenu *option_menu);
@@ -59,6 +62,7 @@ static void gtk_option_menu_show_all (GtkWidget *widget);
static void gtk_option_menu_hide_all (GtkWidget *widget);
static GtkType gtk_option_menu_child_type (GtkContainer *container);
+
static GtkButtonClass *parent_class = NULL;
@@ -106,11 +110,11 @@ gtk_option_menu_class_init (GtkOptionMenuClass *class)
object_class->destroy = gtk_option_menu_destroy;
widget_class->draw = gtk_option_menu_draw;
- widget_class->draw_focus = NULL;
widget_class->size_request = gtk_option_menu_size_request;
widget_class->size_allocate = gtk_option_menu_size_allocate;
widget_class->expose_event = gtk_option_menu_expose;
widget_class->button_press_event = gtk_option_menu_button_press;
+ widget_class->key_press_event = gtk_option_menu_key_press;
widget_class->show_all = gtk_option_menu_show_all;
widget_class->hide_all = gtk_option_menu_hide_all;
@@ -126,7 +130,8 @@ gtk_option_menu_child_type (GtkContainer *container)
static void
gtk_option_menu_init (GtkOptionMenu *option_menu)
{
- GTK_WIDGET_UNSET_FLAGS (option_menu, GTK_CAN_FOCUS);
+ GTK_WIDGET_SET_FLAGS (option_menu, GTK_CAN_FOCUS);
+ GTK_WIDGET_UNSET_FLAGS (option_menu, GTK_CAN_DEFAULT);
option_menu->menu = NULL;
option_menu->menu_item = NULL;
@@ -267,11 +272,11 @@ gtk_option_menu_size_request (GtkWidget *widget,
option_menu->width +
OPTION_INDICATOR_WIDTH +
OPTION_INDICATOR_SPACING * 5 +
- CHILD_LEFT_SPACING + CHILD_RIGHT_SPACING);
+ CHILD_LEFT_SPACING + CHILD_RIGHT_SPACING + 2);
requisition->height = ((GTK_CONTAINER (widget)->border_width +
GTK_WIDGET (widget)->style->klass->ythickness) * 2 +
option_menu->height +
- CHILD_TOP_SPACING + CHILD_BOTTOM_SPACING);
+ CHILD_TOP_SPACING + CHILD_BOTTOM_SPACING + 2);
tmp = (requisition->height - option_menu->height +
OPTION_INDICATOR_HEIGHT + OPTION_INDICATOR_SPACING * 2);
@@ -299,14 +304,14 @@ gtk_option_menu_size_allocate (GtkWidget *widget,
if (child && GTK_WIDGET_VISIBLE (child))
{
child_allocation.x = (GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->xthickness);
+ GTK_WIDGET (widget)->style->klass->xthickness) + 1;
child_allocation.y = (GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->ythickness);
+ GTK_WIDGET (widget)->style->klass->ythickness) + 1;
child_allocation.width = (allocation->width - child_allocation.x * 2 -
OPTION_INDICATOR_WIDTH - OPTION_INDICATOR_SPACING * 5 -
- CHILD_LEFT_SPACING - CHILD_RIGHT_SPACING);
+ CHILD_LEFT_SPACING - CHILD_RIGHT_SPACING) - 2;
child_allocation.height = (allocation->height - child_allocation.y * 2 -
- CHILD_TOP_SPACING - CHILD_BOTTOM_SPACING);
+ CHILD_TOP_SPACING - CHILD_BOTTOM_SPACING) - 2;
child_allocation.x += CHILD_LEFT_SPACING;
child_allocation.y += CHILD_RIGHT_SPACING;
@@ -318,8 +323,7 @@ static void
gtk_option_menu_paint (GtkWidget *widget,
GdkRectangle *area)
{
- GdkRectangle restrict_area;
- GdkRectangle new_area;
+ GdkRectangle button_area;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_OPTION_MENU (widget));
@@ -327,27 +331,39 @@ gtk_option_menu_paint (GtkWidget *widget,
if (GTK_WIDGET_DRAWABLE (widget))
{
- restrict_area.x = GTK_CONTAINER (widget)->border_width;
- restrict_area.y = GTK_CONTAINER (widget)->border_width;
- restrict_area.width = widget->allocation.width - restrict_area.x * 2;
- restrict_area.height = widget->allocation.height - restrict_area.y * 2;
-
- if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
- {
- gtk_paint_box(widget->style, widget->window,
- GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
- &new_area, widget, "optionmenu",
- restrict_area.x, restrict_area.y,
- restrict_area.width, restrict_area.height);
-
- gtk_paint_tab (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
- &new_area, widget, "optionmenutab",
- restrict_area.x + restrict_area.width - restrict_area.x -
- OPTION_INDICATOR_WIDTH - OPTION_INDICATOR_SPACING * 4,
- restrict_area.y + (restrict_area.height - OPTION_INDICATOR_HEIGHT) / 2,
- OPTION_INDICATOR_WIDTH, OPTION_INDICATOR_HEIGHT);
- }
+ button_area.x = GTK_CONTAINER (widget)->border_width + 1;
+ button_area.y = GTK_CONTAINER (widget)->border_width + 1;
+ button_area.width = widget->allocation.width - button_area.x * 2;
+ button_area.height = widget->allocation.height - button_area.y * 2;
+
+ /* This is evil, and should be elimated here and in the button
+ * code. The point is to clear the focus, and make it
+ * sort of transparent if it isn't there.
+ */
+ gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+ gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
+
+ gtk_paint_box(widget->style, widget->window,
+ GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
+ area, widget, "optionmenu",
+ button_area.x, button_area.y,
+ button_area.width, button_area.height);
+
+ gtk_paint_tab (widget->style, widget->window,
+ GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
+ area, widget, "optionmenutab",
+ button_area.x + button_area.width - button_area.x -
+ OPTION_INDICATOR_WIDTH - OPTION_INDICATOR_SPACING * 4,
+ button_area.y + (button_area.height - OPTION_INDICATOR_HEIGHT) / 2,
+ OPTION_INDICATOR_WIDTH, OPTION_INDICATOR_HEIGHT);
+
+ if (GTK_WIDGET_HAS_FOCUS (widget))
+ gtk_paint_focus (widget->style, widget->window,
+ area, widget, "button",
+ button_area.x - 1,
+ button_area.y - 1,
+ button_area.width + 1,
+ button_area.height + 1);
}
}
@@ -446,10 +462,11 @@ gtk_option_menu_button_press (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_OPTION_MENU (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
+ option_menu = GTK_OPTION_MENU (widget);
+
if ((event->type == GDK_BUTTON_PRESS) &&
(event->button == 1))
{
- option_menu = GTK_OPTION_MENU (widget);
gtk_option_menu_remove_contents (option_menu);
gtk_menu_popup (GTK_MENU (option_menu->menu), NULL, NULL,
gtk_option_menu_position, option_menu,
@@ -459,6 +476,31 @@ gtk_option_menu_button_press (GtkWidget *widget,
return FALSE;
}
+static gint
+gtk_option_menu_key_press (GtkWidget *widget,
+ GdkEventKey *event)
+{
+ GtkOptionMenu *option_menu;
+
+ g_return_val_if_fail (widget != NULL, FALSE);
+ g_return_val_if_fail (GTK_IS_OPTION_MENU (widget), FALSE);
+ g_return_val_if_fail (event != NULL, FALSE);
+
+ option_menu = GTK_OPTION_MENU (widget);
+
+ switch (event->keyval)
+ {
+ case GDK_space:
+ gtk_option_menu_remove_contents (option_menu);
+ gtk_menu_popup (GTK_MENU (option_menu->menu), NULL, NULL,
+ gtk_option_menu_position, option_menu,
+ 0, event->time);
+ break;
+ }
+
+ return FALSE;
+}
+
static void
gtk_option_menu_deactivate (GtkMenuShell *menu_shell,
GtkOptionMenu *option_menu)
diff --git a/gtk/gtkpacker.c b/gtk/gtkpacker.c
index 83f0eb2ac3..6d30b5ae38 100644
--- a/gtk/gtkpacker.c
+++ b/gtk/gtkpacker.c
@@ -131,7 +131,8 @@ static void gtk_packer_container_add (GtkContainer *container,
GtkWidget *child);
static void gtk_packer_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_packer_foreach (GtkContainer *container,
+static void gtk_packer_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_packer_set_arg (GtkObject *object,
@@ -223,7 +224,7 @@ gtk_packer_class_init (GtkPackerClass *klass)
container_class->add = gtk_packer_container_add;
container_class->remove = gtk_packer_remove;
- container_class->foreach = gtk_packer_foreach;
+ container_class->forall = gtk_packer_forall;
container_class->child_type = gtk_packer_child_type;
container_class->get_child_arg = gtk_packer_get_child_arg;
container_class->set_child_arg = gtk_packer_set_child_arg;
@@ -1272,9 +1273,10 @@ gtk_packer_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
}
static void
-gtk_packer_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_packer_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkPacker *packer;
GtkPackerChild *child;
@@ -1286,7 +1288,7 @@ gtk_packer_foreach (GtkContainer *container,
packer = GTK_PACKER (container);
- children = g_list_first(packer->children);
+ children = g_list_first (packer->children);
while (children != NULL)
{
child = children->data;
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index ba47b6e96e..8786402231 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -26,12 +26,13 @@ static void gtk_paned_map (GtkWidget *widget);
static void gtk_paned_unmap (GtkWidget *widget);
static void gtk_paned_unrealize (GtkWidget *widget);
static gint gtk_paned_expose (GtkWidget *widget,
- GdkEventExpose *event);
+ GdkEventExpose *event);
static void gtk_paned_add (GtkContainer *container,
- GtkWidget *widget);
+ GtkWidget *widget);
static void gtk_paned_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_paned_foreach (GtkContainer *container,
+ GtkWidget *widget);
+static void gtk_paned_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static GtkType gtk_paned_child_type (GtkContainer *container);
@@ -40,11 +41,11 @@ static GtkType gtk_paned_child_type (GtkContainer *container);
static GtkContainerClass *parent_class = NULL;
-guint
+GtkType
gtk_paned_get_type (void)
{
- static guint paned_type = 0;
-
+ static GtkType paned_type = 0;
+
if (!paned_type)
{
GtkTypeInfo paned_info =
@@ -58,10 +59,10 @@ gtk_paned_get_type (void)
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
- paned_type = gtk_type_unique (gtk_container_get_type (), &paned_info);
+
+ paned_type = gtk_type_unique (GTK_TYPE_CONTAINER, &paned_info);
}
-
+
return paned_type;
}
@@ -71,22 +72,22 @@ gtk_paned_class_init (GtkPanedClass *class)
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
-
+
object_class = (GtkObjectClass*) 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);
+
widget_class->realize = gtk_paned_realize;
widget_class->map = gtk_paned_map;
widget_class->unmap = gtk_paned_unmap;
widget_class->unrealize = gtk_paned_unrealize;
widget_class->expose_event = gtk_paned_expose;
-
+
container_class->add = gtk_paned_add;
container_class->remove = gtk_paned_remove;
- container_class->foreach = gtk_paned_foreach;
+ container_class->forall = gtk_paned_forall;
container_class->child_type = gtk_paned_child_type;
}
@@ -103,17 +104,17 @@ static void
gtk_paned_init (GtkPaned *paned)
{
GTK_WIDGET_UNSET_FLAGS (paned, GTK_NO_WINDOW);
-
+
paned->child1 = NULL;
paned->child2 = NULL;
paned->handle = NULL;
paned->xor_gc = NULL;
-
+
paned->handle_size = 10;
paned->gutter_size = 6;
paned->position_set = FALSE;
paned->in_drag = FALSE;
-
+
paned->handle_xpos = -1;
paned->handle_ypos = -1;
}
@@ -125,13 +126,13 @@ gtk_paned_realize (GtkWidget *widget)
GtkPaned *paned;
GdkWindowAttr attributes;
gint attributes_mask;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_PANED (widget));
-
+
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
paned = GTK_PANED (widget);
-
+
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
@@ -142,11 +143,11 @@ gtk_paned_realize (GtkWidget *widget)
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
+
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (widget->window, paned);
-
+
attributes.x = paned->handle_xpos;
attributes.y = paned->handle_ypos;
attributes.width = paned->handle_size;
@@ -157,13 +158,13 @@ gtk_paned_realize (GtkWidget *widget)
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK);
attributes_mask |= GDK_WA_CURSOR;
-
+
paned->handle = gdk_window_new (widget->window,
&attributes, attributes_mask);
gdk_window_set_user_data (paned->handle, paned);
-
+
widget->style = gtk_style_attach (widget->style, widget->window);
-
+
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
gtk_style_set_background (widget->style, paned->handle, GTK_STATE_NORMAL);
@@ -171,20 +172,20 @@ gtk_paned_realize (GtkWidget *widget)
gdk_window_show (paned->handle);
}
-
+
static void
gtk_paned_map (GtkWidget *widget)
{
GtkPaned *paned;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_PANED (widget));
-
+
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
paned = GTK_PANED (widget);
-
+
gdk_window_show (widget->window);
-
+
if (paned->child1 &&
GTK_WIDGET_VISIBLE (paned->child1) &&
!GTK_WIDGET_MAPPED (paned->child1))
@@ -200,9 +201,9 @@ gtk_paned_unmap (GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_PANED (widget));
-
+
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
+
gdk_window_hide (widget->window);
}
@@ -210,18 +211,18 @@ static void
gtk_paned_unrealize (GtkWidget *widget)
{
GtkPaned *paned;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_PANED (widget));
-
+
paned = GTK_PANED (widget);
-
+
if (paned->xor_gc)
{
gdk_gc_destroy (paned->xor_gc);
paned->xor_gc = NULL;
}
-
+
if (paned->handle)
{
gdk_window_set_user_data (paned->handle, NULL);
@@ -230,7 +231,7 @@ gtk_paned_unrealize (GtkWidget *widget)
gdk_cursor_destroy (paned->cursor);
paned->cursor = NULL;
}
-
+
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
}
@@ -241,15 +242,15 @@ gtk_paned_expose (GtkWidget *widget,
{
GtkPaned *paned;
GdkEventExpose child_event;
-
+
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_PANED (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
-
+
if (GTK_WIDGET_DRAWABLE (widget))
{
paned = GTK_PANED (widget);
-
+
/* An expose event for the handle */
if (event->window == paned->handle)
{
@@ -267,12 +268,12 @@ gtk_paned_expose (GtkWidget *widget,
GTK_WIDGET_NO_WINDOW (paned->child1) &&
gtk_widget_intersect (paned->child1, &event->area, &child_event.area))
gtk_widget_event (paned->child1, (GdkEvent*) &child_event);
-
+
if (paned->child2 &&
GTK_WIDGET_NO_WINDOW (paned->child2) &&
gtk_widget_intersect (paned->child2, &event->area, &child_event.area))
gtk_widget_event (paned->child2, (GdkEvent*) &child_event);
-
+
/* redraw the groove if necessary */
if (gdk_rectangle_intersect (&paned->groove_rectangle,
&event->area,
@@ -288,11 +289,11 @@ gtk_paned_add1 (GtkPaned *paned,
GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
-
+
if (!paned->child1)
{
gtk_widget_set_parent (widget, GTK_WIDGET (paned));
-
+
if (GTK_WIDGET_VISIBLE (widget->parent))
{
if (GTK_WIDGET_REALIZED (widget->parent) &&
@@ -303,9 +304,9 @@ gtk_paned_add1 (GtkPaned *paned,
!GTK_WIDGET_MAPPED (widget))
gtk_widget_map (widget);
}
-
+
paned->child1 = widget;
-
+
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (paned))
gtk_widget_queue_resize (widget);
}
@@ -316,11 +317,11 @@ gtk_paned_add2 (GtkPaned *paned,
GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
-
+
if (!paned->child2)
{
gtk_widget_set_parent (widget, GTK_WIDGET (paned));
-
+
if (GTK_WIDGET_VISIBLE (widget->parent))
{
if (GTK_WIDGET_REALIZED (widget->parent) &&
@@ -331,9 +332,9 @@ gtk_paned_add2 (GtkPaned *paned,
!GTK_WIDGET_MAPPED (widget))
gtk_widget_map (widget);
}
-
+
paned->child2 = widget;
-
+
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (paned))
gtk_widget_queue_resize (widget);
}
@@ -344,13 +345,13 @@ gtk_paned_add (GtkContainer *container,
GtkWidget *widget)
{
GtkPaned *paned;
-
+
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_PANED (container));
g_return_if_fail (widget != NULL);
-
+
paned = GTK_PANED (container);
-
+
if (!paned->child1)
gtk_paned_add1 (GTK_PANED (container),widget);
else if (!paned->child2)
@@ -363,47 +364,48 @@ gtk_paned_remove (GtkContainer *container,
{
GtkPaned *paned;
gboolean was_visible;
-
+
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_PANED (container));
g_return_if_fail (widget != NULL);
-
+
paned = GTK_PANED (container);
was_visible = GTK_WIDGET_VISIBLE (widget);
if (paned->child1 == widget)
{
gtk_widget_unparent (widget);
-
+
paned->child1 = NULL;
-
+
if (was_visible && GTK_WIDGET_VISIBLE (container))
gtk_widget_queue_resize (GTK_WIDGET (container));
}
else if (paned->child2 == widget)
{
gtk_widget_unparent (widget);
-
+
paned->child2 = NULL;
-
+
if (was_visible && GTK_WIDGET_VISIBLE (container))
gtk_widget_queue_resize (GTK_WIDGET (container));
}
}
static void
-gtk_paned_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_paned_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkPaned *paned;
-
+
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_PANED (container));
g_return_if_fail (callback != NULL);
-
+
paned = GTK_PANED (container);
-
+
if (paned->child1)
(* callback) (paned->child1, callback_data);
if (paned->child2)
@@ -411,9 +413,13 @@ gtk_paned_foreach (GtkContainer *container,
}
void
-gtk_paned_handle_size (GtkPaned *paned, guint16 size)
+gtk_paned_handle_size (GtkPaned *paned,
+ guint16 size)
{
gint x,y;
+
+ g_return_if_fail (paned != NULL);
+ g_return_if_fail (GTK_IS_PANED (paned));
if (paned->handle)
{
@@ -423,16 +429,18 @@ gtk_paned_handle_size (GtkPaned *paned, guint16 size)
y + paned->handle_size / 2 - size / 2,
size, size);
}
-
paned->handle_size = size;
}
void
-gtk_paned_gutter_size (GtkPaned *paned, guint16 size)
+gtk_paned_gutter_size (GtkPaned *paned,
+ guint16 size)
{
- paned->gutter_size = size;
+ g_return_if_fail (paned != NULL);
+ g_return_if_fail (GTK_IS_PANED (paned));
+ paned->gutter_size = size;
+
if (GTK_WIDGET_VISIBLE (GTK_WIDGET (paned)))
gtk_widget_queue_resize (GTK_WIDGET (paned));
}
-
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index eddc77831c..944cc81ec2 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -52,7 +52,8 @@ static void gtk_scrolled_window_add (GtkContainer *cont
GtkWidget *widget);
static void gtk_scrolled_window_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_scrolled_window_foreach (GtkContainer *container,
+static void gtk_scrolled_window_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_scrolled_window_viewport_allocate (GtkWidget *widget,
@@ -127,7 +128,7 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
container_class->add = gtk_scrolled_window_add;
container_class->remove = gtk_scrolled_window_remove;
- container_class->foreach = gtk_scrolled_window_foreach;
+ container_class->forall = gtk_scrolled_window_forall;
class->scrollbar_spacing = 5;
}
@@ -594,9 +595,10 @@ gtk_scrolled_window_remove (GtkContainer *container,
}
static void
-gtk_scrolled_window_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_scrolled_window_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkScrolledWindow *scrolled_window;
@@ -606,11 +608,16 @@ gtk_scrolled_window_foreach (GtkContainer *container,
scrolled_window = GTK_SCROLLED_WINDOW (container);
- if (scrolled_window->viewport)
- (* callback) (scrolled_window->viewport, callback_data);
-
- (* callback) (scrolled_window->vscrollbar, callback_data);
- (* callback) (scrolled_window->hscrollbar, callback_data);
+ if (include_internals)
+ {
+ if (scrolled_window->viewport)
+ (* callback) (scrolled_window->viewport, callback_data);
+
+ (* callback) (scrolled_window->vscrollbar, callback_data);
+ (* callback) (scrolled_window->hscrollbar, callback_data);
+ }
+ else if (scrolled_window->viewport)
+ gtk_container_foreach (GTK_CONTAINER (scrolled_window->viewport), callback, callback_data);
}
static void
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
index dfc782c07d..08e048f266 100644
--- a/gtk/gtktable.c
+++ b/gtk/gtktable.c
@@ -59,7 +59,8 @@ static void gtk_table_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_table_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_table_foreach (GtkContainer *container,
+static void gtk_table_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_table_get_arg (GtkObject *object,
@@ -157,7 +158,7 @@ gtk_table_class_init (GtkTableClass *class)
container_class->add = gtk_table_add;
container_class->remove = gtk_table_remove;
- container_class->foreach = gtk_table_foreach;
+ container_class->forall = gtk_table_forall;
container_class->child_type = gtk_table_child_type;
container_class->set_child_arg = gtk_table_set_child_arg;
container_class->get_child_arg = gtk_table_get_child_arg;
@@ -860,9 +861,10 @@ gtk_table_remove (GtkContainer *container,
}
static void
-gtk_table_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_table_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkTable *table;
GtkTableChild *child;
diff --git a/gtk/gtkthemes.c b/gtk/gtkthemes.c
index 4602cfd972..29d6ac23b9 100644
--- a/gtk/gtkthemes.c
+++ b/gtk/gtkthemes.c
@@ -19,6 +19,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
+#include <gmodule.h>
#include "gtkthemes.h"
#include "gtkmain.h"
#include "gtkrc.h"
@@ -33,7 +34,7 @@ typedef struct _GtkThemeEnginePrivate GtkThemeEnginePrivate;
struct _GtkThemeEnginePrivate {
GtkThemeEngine engine;
- void *library;
+ GModule *library;
void *name;
void (*init) (GtkThemeEngine *);
@@ -56,12 +57,11 @@ gtk_theme_engine_get (gchar *name)
result = g_hash_table_lookup (engine_hash, name);
-#ifdef HAVE_LIBDL
if (!result)
{
gchar fullname[1024];
gchar *engine_path;
- void *library;
+ GModule *library;
g_snprintf (fullname, 1024, "lib%s.so", name);
engine_path = gtk_rc_find_module_in_path(NULL, fullname);
@@ -73,10 +73,10 @@ gtk_theme_engine_get (gchar *name)
printf ("Loading Theme %s\n", engine_path);
- library = dlopen(engine_path, RTLD_NOW);
+ library = g_module_open (engine_path, 0);
g_free(engine_path);
if (!library)
- g_error(dlerror());
+ g_error(g_module_error());
else
{
result = g_new (GtkThemeEnginePrivate, 1);
@@ -85,9 +85,16 @@ gtk_theme_engine_get (gchar *name)
result->name = g_strdup (name);
result->library = library;
- /* extract symbols from the lib */
- result->init=dlsym(library, "theme_init");
- result->exit=dlsym(library ,"theme_exit");
+ /* extract symbols from the lib */
+ if (!g_module_symbol (library, "theme_init",
+ (gpointer *)&result->init) ||
+ !g_module_symbol (library, "theme_exit",
+ (gpointer *)&result->exit))
+ {
+ g_error (g_module_error());
+ g_free (result);
+ return NULL;
+ }
/* call the theme's init (theme_init) function to let it */
/* setup anything it needs to set up. */
@@ -96,7 +103,6 @@ gtk_theme_engine_get (gchar *name)
g_hash_table_insert (engine_hash, name, result);
}
}
-#endif HAVE_LIBDL
return (GtkThemeEngine *)result;
}
@@ -123,9 +129,7 @@ gtk_theme_engine_unref (GtkThemeEngine *engine)
{
g_hash_table_remove (engine_hash, private);
-#ifdef HAVE_LIBDL
- dlclose (private->library);
-#endif /* HAVE_LIBDL */
+ g_module_close (private->library);
g_free (private->name);
g_free (private);
}
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 6e62117ad3..8457d6c7de 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -52,7 +52,8 @@ static void gtk_toolbar_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_toolbar_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_toolbar_foreach (GtkContainer *container,
+static void gtk_toolbar_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_real_toolbar_orientation_changed (GtkToolbar *toolbar,
@@ -134,7 +135,7 @@ gtk_toolbar_class_init (GtkToolbarClass *class)
container_class->add = gtk_toolbar_add;
container_class->remove = gtk_toolbar_remove;
- container_class->foreach = gtk_toolbar_foreach;
+ container_class->forall = gtk_toolbar_forall;
container_class->focus = NULL;
class->orientation_changed = gtk_real_toolbar_orientation_changed;
@@ -543,9 +544,10 @@ gtk_toolbar_remove (GtkContainer *container,
}
static void
-gtk_toolbar_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_toolbar_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkToolbar *toolbar;
GList *children;
@@ -736,7 +738,13 @@ gtk_toolbar_insert_element (GtkToolbar *toolbar,
g_return_val_if_fail (toolbar != NULL, NULL);
g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), NULL);
- g_return_val_if_fail ((type != GTK_TOOLBAR_CHILD_WIDGET) || (widget != NULL), NULL);
+ if (type == GTK_TOOLBAR_CHILD_WIDGET)
+ {
+ g_return_val_if_fail (widget != NULL, NULL);
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+ }
+ else
+ g_return_val_if_fail (widget == NULL, NULL);
child = g_new (GtkToolbarChild, 1);
child->type = type;
@@ -841,6 +849,9 @@ void
gtk_toolbar_set_orientation (GtkToolbar *toolbar,
GtkOrientation orientation)
{
+ g_return_if_fail (toolbar != NULL);
+ g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
+
gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[ORIENTATION_CHANGED], orientation);
}
@@ -848,6 +859,9 @@ void
gtk_toolbar_set_style (GtkToolbar *toolbar,
GtkToolbarStyle style)
{
+ g_return_if_fail (toolbar != NULL);
+ g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
+
gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[STYLE_CHANGED], style);
}
@@ -904,7 +918,7 @@ gtk_toolbar_set_button_relief (GtkToolbar *toolbar,
}
GtkReliefStyle
-gtk_toolbar_get_button_relief (GtkToolbar *toolbar)
+gtk_toolbar_get_button_relief (GtkToolbar *toolbar)
{
g_return_val_if_fail (toolbar != NULL, GTK_RELIEF_NORMAL);
g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_RELIEF_NORMAL);
diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c
index f3e6508918..9a4d769b7c 100644
--- a/gtk/gtktooltips.c
+++ b/gtk/gtktooltips.c
@@ -44,7 +44,6 @@ static void gtk_tooltips_widget_remove (GtkWidget *widget,
static void gtk_tooltips_set_active_widget (GtkTooltips *tooltips,
GtkWidget *widget);
static gint gtk_tooltips_timeout (gpointer data);
-static void gtk_tooltips_create_window (GtkTooltips *tooltips);
static gint gtk_tooltips_expose (GtkTooltips *tooltips,
GdkEventExpose *event);
@@ -53,10 +52,10 @@ static void gtk_tooltips_draw_tips (GtkTooltips *tooltips);
static GtkDataClass *parent_class;
static const gchar *tooltips_data_key = "_GtkTooltipsData";
-guint
+GtkType
gtk_tooltips_get_type (void)
{
- static guint tooltips_type = 0;
+ static GtkType tooltips_type = 0;
if (!tooltips_type)
{
@@ -72,7 +71,7 @@ gtk_tooltips_get_type (void)
(GtkClassInitFunc) NULL,
};
- tooltips_type = gtk_type_unique (gtk_data_get_type (), &tooltips_info);
+ tooltips_type = gtk_type_unique (GTK_TYPE_DATA, &tooltips_info);
}
return tooltips_type;
@@ -84,7 +83,7 @@ gtk_tooltips_class_init (GtkTooltipsClass *class)
GtkObjectClass *object_class;
object_class = (GtkObjectClass*) class;
- parent_class = gtk_type_class (gtk_data_get_type ());
+ parent_class = gtk_type_class (GTK_TYPE_DATA);
object_class->destroy = gtk_tooltips_destroy;
}
@@ -107,7 +106,7 @@ gtk_tooltips_init (GtkTooltips *tooltips)
GtkTooltips *
gtk_tooltips_new (void)
{
- return gtk_type_new (gtk_tooltips_get_type ());
+ return gtk_type_new (GTK_TYPE_TOOLTIPS);
}
static void
@@ -158,12 +157,8 @@ gtk_tooltips_destroy (GtkObject *object)
}
}
- if (tooltips->tip_window != NULL)
- {
- gtk_widget_destroy (tooltips->tip_window);
- gtk_widget_unref (tooltips->tip_window);
- tooltips->tip_window = NULL;
- }
+ if (tooltips->tip_window)
+ gtk_widget_destroy (tooltips->tip_window);
if (tooltips->gc != NULL)
{
@@ -172,22 +167,33 @@ gtk_tooltips_destroy (GtkObject *object)
}
}
-static void
-gtk_tooltips_create_window (GtkTooltips *tooltips)
+void
+gtk_tooltips_force_window (GtkTooltips *tooltips)
{
GtkWidget *darea;
-
- tooltips->tip_window = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_widget_ref (tooltips->tip_window);
- gtk_window_set_policy (GTK_WINDOW (tooltips->tip_window), FALSE, FALSE, TRUE);
- darea = gtk_drawing_area_new ();
- gtk_container_add (GTK_CONTAINER (tooltips->tip_window), darea);
- gtk_widget_show (darea);
+ g_return_if_fail (tooltips != NULL);
+ g_return_if_fail (GTK_IS_TOOLTIPS (tooltips));
- gtk_signal_connect_object (GTK_OBJECT (darea), "expose_event",
- GTK_SIGNAL_FUNC (gtk_tooltips_expose),
- GTK_OBJECT (tooltips));
+ if (!tooltips->tip_window)
+ {
+ tooltips->tip_window = gtk_window_new (GTK_WINDOW_POPUP);
+ gtk_widget_ref (tooltips->tip_window);
+ gtk_window_set_policy (GTK_WINDOW (tooltips->tip_window), FALSE, FALSE, TRUE);
+
+ darea = gtk_drawing_area_new ();
+ gtk_container_add (GTK_CONTAINER (tooltips->tip_window), darea);
+ gtk_widget_show (darea);
+
+ gtk_signal_connect_object (GTK_OBJECT (darea), "expose_event",
+ GTK_SIGNAL_FUNC (gtk_tooltips_expose),
+ GTK_OBJECT (tooltips));
+
+ gtk_signal_connect (GTK_OBJECT (tooltips->tip_window),
+ "destroy",
+ gtk_widget_destroyed,
+ &tooltips->tip_window);
+ }
}
static void
@@ -197,8 +203,8 @@ gtk_tooltips_layout_text (GtkTooltips *tooltips, GtkTooltipsData *data)
gint i, row_width, window_width = 0;
size_t len;
- if (tooltips->tip_window == NULL)
- gtk_tooltips_create_window (tooltips);
+ if (!tooltips->tip_window)
+ gtk_tooltips_force_window (tooltips);
g_list_foreach (data->row, gtk_tooltips_free_string, 0);
if (data->row)
@@ -405,6 +411,8 @@ gtk_tooltips_expose (GtkTooltips *tooltips, GdkEventExpose *event)
baseline_skip = style->font->ascent + style->font->descent + gap;
data = tooltips->active_tips_data;
+ if (!data)
+ return FALSE;
gtk_paint_flat_box(style, darea->window,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
@@ -442,7 +450,7 @@ gtk_tooltips_draw_tips (GtkTooltips * tooltips)
GList *el;
if (!tooltips->tip_window)
- gtk_tooltips_create_window (tooltips);
+ gtk_tooltips_force_window (tooltips);
else if (GTK_WIDGET_VISIBLE (tooltips->tip_window))
gtk_widget_hide (tooltips->tip_window);
diff --git a/gtk/gtktooltips.h b/gtk/gtktooltips.h
index 77ffc92eee..85aaa366cc 100644
--- a/gtk/gtktooltips.h
+++ b/gtk/gtktooltips.h
@@ -25,11 +25,14 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_TOOLTIPS(obj) GTK_CHECK_CAST (obj, gtk_tooltips_get_type (), GtkTooltips)
-#define GTK_TOOLTIPS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_tooltips_get_type (), GtkTooltipsClass)
-#define GTK_IS_TOOLTIPS(obj) GTK_CHECK_TYPE (obj, gtk_tooltips_get_type ())
+#define GTK_TYPE_TOOLTIPS (gtk_tooltips_get_type ())
+#define GTK_TOOLTIPS(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TOOLTIPS, GtkTooltips))
+#define GTK_TOOLTIPS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOOLTIPS, GtkTooltipsClass))
+#define GTK_IS_TOOLTIPS(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TOOLTIPS))
+#define GTK_IS_TOOLTIPS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOOLTIPS))
typedef struct _GtkTooltips GtkTooltips;
typedef struct _GtkTooltipsClass GtkTooltipsClass;
@@ -68,21 +71,22 @@ struct _GtkTooltipsClass
GtkDataClass parent_class;
};
-GtkType gtk_tooltips_get_type (void);
-GtkTooltips* gtk_tooltips_new (void);
-
-void gtk_tooltips_enable (GtkTooltips *tooltips);
-void gtk_tooltips_disable (GtkTooltips *tooltips);
-void gtk_tooltips_set_delay (GtkTooltips *tooltips,
- guint delay);
-void gtk_tooltips_set_tip (GtkTooltips *tooltips,
- GtkWidget *widget,
- const gchar *tip_text,
- const gchar *tip_private);
-void gtk_tooltips_set_colors (GtkTooltips *tooltips,
- GdkColor *background,
- GdkColor *foreground);
-GtkTooltipsData* gtk_tooltips_data_get (GtkWidget *widget);
+GtkType gtk_tooltips_get_type (void);
+GtkTooltips* gtk_tooltips_new (void);
+
+void gtk_tooltips_enable (GtkTooltips *tooltips);
+void gtk_tooltips_disable (GtkTooltips *tooltips);
+void gtk_tooltips_set_delay (GtkTooltips *tooltips,
+ guint delay);
+void gtk_tooltips_set_tip (GtkTooltips *tooltips,
+ GtkWidget *widget,
+ const gchar *tip_text,
+ const gchar *tip_private);
+void gtk_tooltips_set_colors (GtkTooltips *tooltips,
+ GdkColor *background,
+ GdkColor *foreground);
+GtkTooltipsData* gtk_tooltips_data_get (GtkWidget *widget);
+void gtk_tooltips_force_window (GtkTooltips *tooltips);
diff --git a/gtk/gtktree.c b/gtk/gtktree.c
index 6b7ad8a238..2f70b4c7f2 100644
--- a/gtk/gtktree.c
+++ b/gtk/gtktree.c
@@ -51,7 +51,8 @@ static void gtk_tree_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_tree_add (GtkContainer *container,
GtkWidget *widget);
-static void gtk_tree_foreach (GtkContainer *container,
+static void gtk_tree_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
@@ -145,7 +146,7 @@ gtk_tree_class_init (GtkTreeClass *class)
container_class->add = gtk_tree_add;
container_class->remove =
(void (*)(GtkContainer *, GtkWidget *)) gtk_tree_remove_item;
- container_class->foreach = gtk_tree_foreach;
+ container_class->forall = gtk_tree_forall;
container_class->child_type = gtk_tree_child_type;
class->selection_changed = NULL;
@@ -521,9 +522,10 @@ gtk_tree_expose (GtkWidget *widget,
}
static void
-gtk_tree_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_tree_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkTree *tree;
GtkWidget *child;
@@ -543,9 +545,6 @@ gtk_tree_foreach (GtkContainer *container,
children = children->next;
(* callback) (child, callback_data);
-
- if(GTK_TREE_ITEM(child)->subtree)
- (* callback)(GTK_TREE_ITEM(child)->subtree, callback_data);
}
}
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c
index e63d51f992..9a678307b3 100644
--- a/gtk/gtktreeitem.c
+++ b/gtk/gtktreeitem.c
@@ -67,6 +67,11 @@ static gint gtk_tree_item_focus_in (GtkWidget *widget,
GdkEventFocus *event);
static gint gtk_tree_item_focus_out (GtkWidget *widget,
GdkEventFocus *event);
+static void gtk_tree_item_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
+
static void gtk_real_tree_item_select (GtkItem *item);
static void gtk_real_tree_item_deselect (GtkItem *item);
static void gtk_real_tree_item_toggle (GtkItem *item);
@@ -85,7 +90,6 @@ static void gtk_tree_item_add_pixmaps (GtkTreeItem *tree_item);
static void gtk_tree_item_remove_pixmaps (GtkTreeItem *tree_item);
static GtkItemClass *parent_class = NULL;
-static GtkContainerClass *container_class = NULL;
static guint tree_item_signals[LAST_SIGNAL] = { 0 };
GtkType
@@ -118,6 +122,7 @@ gtk_tree_item_class_init (GtkTreeItemClass *class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
+ GtkContainerClass *container_class;
GtkItemClass *item_class;
object_class = (GtkObjectClass*) class;
@@ -158,14 +163,14 @@ gtk_tree_item_class_init (GtkTreeItemClass *class)
widget_class->map = gtk_tree_item_map;
widget_class->unmap = gtk_tree_item_unmap;
+ container_class->forall = gtk_tree_item_forall;
+
item_class->select = gtk_real_tree_item_select;
item_class->deselect = gtk_real_tree_item_deselect;
item_class->toggle = gtk_real_tree_item_toggle;
class->expand = gtk_real_tree_item_expand;
class->collapse = gtk_real_tree_item_collapse;
-
- container_class = (GtkContainerClass*) parent_class;
}
/* callback for event box mouse event */
@@ -303,7 +308,7 @@ gtk_tree_item_set_subtree (GtkTreeItem *tree_item,
/* show subtree button */
if (tree_item->pixmaps_box)
- gtk_widget_show(tree_item->pixmaps_box);
+ gtk_widget_show (tree_item->pixmaps_box);
/* set parent widget */
gtk_widget_set_parent(subtree, GTK_WIDGET(tree_item)->parent);
@@ -319,7 +324,7 @@ gtk_tree_item_set_subtree (GtkTreeItem *tree_item,
gtk_widget_map (GTK_WIDGET(subtree));
}
- if(tree_item->expanded)
+ if (tree_item->expanded)
gtk_widget_show(subtree);
else
gtk_widget_hide(subtree);
@@ -501,8 +506,8 @@ gtk_tree_item_size_request (GtkWidget *widget,
requisition->width += item->pixmaps_box->requisition.width + DEFAULT_DELTA +
GTK_TREE(widget->parent)->current_indent;
- requisition->height += MAX(bin->child->requisition.height,
- item->pixmaps_box->requisition.height);
+ requisition->height += MAX (bin->child->requisition.height,
+ item->pixmaps_box->requisition.height);
}
}
@@ -557,7 +562,7 @@ gtk_tree_item_size_allocate (GtkWidget *widget,
}
static void
-gtk_tree_item_draw_lines(GtkWidget *widget)
+gtk_tree_item_draw_lines (GtkWidget *widget)
{
GtkTreeItem* item;
GtkTree* tree;
@@ -571,17 +576,16 @@ gtk_tree_item_draw_lines(GtkWidget *widget)
/* draw vertical line */
lx1 = item->pixmaps_box->allocation.width;
- lx1 = lx2 = ( lx1 / 2 ) + ( lx1 % 2 ) +
- GTK_CONTAINER(widget)->border_width + 1 + tree->current_indent;
+ lx1 = lx2 = ((lx1 / 2) + (lx1 % 2) +
+ GTK_CONTAINER (widget)->border_width + 1 + tree->current_indent);
ly1 = 0;
ly2 = widget->allocation.height;
- if(g_list_last(tree->children)->data == (gpointer)widget)
+ if (g_list_last (tree->children)->data == widget)
ly2 = (ly2 / 2) + (ly2 % 2);
- if(tree != tree->root_tree)
- gdk_draw_line(widget->window, widget->style->black_gc,
- lx1, ly1, lx2, ly2);
+ if (tree != tree->root_tree)
+ gdk_draw_line (widget->window, widget->style->black_gc, lx1, ly1, lx2, ly2);
/* draw vertical line for subtree connecting */
if(g_list_last(tree->children)->data != (gpointer)widget)
@@ -589,34 +593,34 @@ gtk_tree_item_draw_lines(GtkWidget *widget)
lx2 += DEFAULT_DELTA;
- if(item->subtree && item->expanded)
- gdk_draw_line(widget->window, widget->style->black_gc,
- lx2, ly2, lx2, widget->allocation.height);
+ if (item->subtree && item->expanded)
+ gdk_draw_line (widget->window, widget->style->black_gc,
+ lx2, ly2, lx2, widget->allocation.height);
/* draw horizontal line */
ly1 = ly2;
lx2 += 2;
- gdk_draw_line(widget->window, widget->style->black_gc,
- lx1, ly1, lx2, ly2);
+ gdk_draw_line (widget->window, widget->style->black_gc,
+ lx1, ly1, lx2, ly2);
lx2 -= DEFAULT_DELTA+2;
ly1 = 0;
ly2 = widget->allocation.height;
- if(tree != tree->root_tree)
+ if (tree != tree->root_tree)
{
- item = GTK_TREE_ITEM(tree->tree_owner);
- tree = GTK_TREE(GTK_WIDGET(tree)->parent);
- while(tree != tree->root_tree) {
- lx1 = lx2 -= tree->indent_value;
-
- if(g_list_last(tree->children)->data != (gpointer)item)
- gdk_draw_line(widget->window, widget->style->black_gc,
- lx1, ly1, lx2, ly2);
- item = GTK_TREE_ITEM(tree->tree_owner);
- tree = GTK_TREE(GTK_WIDGET(tree)->parent);
- }
+ item = GTK_TREE_ITEM (tree->tree_owner);
+ tree = GTK_TREE (GTK_WIDGET (tree)->parent);
+ while (tree != tree->root_tree)
+ {
+ lx1 = lx2 -= tree->indent_value;
+
+ if (g_list_last (tree->children)->data != item)
+ gdk_draw_line (widget->window, widget->style->black_gc, lx1, ly1, lx2, ly2);
+ item = GTK_TREE_ITEM (tree->tree_owner);
+ tree = GTK_TREE (GTK_WIDGET (tree)->parent);
+ }
}
}
@@ -638,20 +642,21 @@ gtk_tree_item_draw (GtkWidget *widget,
tree_item = GTK_TREE_ITEM(widget);
/* draw left size of tree item */
- item_area.x = 0; item_area.y = 0;
- item_area.width = tree_item->pixmaps_box->allocation.width+DEFAULT_DELTA +
- (GTK_TREE(widget->parent)->current_indent + 2);
+ item_area.x = 0;
+ item_area.y = 0;
+ item_area.width = (tree_item->pixmaps_box->allocation.width + DEFAULT_DELTA +
+ GTK_TREE (widget->parent)->current_indent + 2);
item_area.height = widget->allocation.height;
- if(gdk_rectangle_intersect(&item_area, area, &child_area)) {
-
- if (widget->state == GTK_STATE_NORMAL)
- {
+ if(gdk_rectangle_intersect(&item_area, area, &child_area))
+ {
+ if (widget->state == GTK_STATE_NORMAL)
+ {
gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
- }
- else
- {
+ }
+ else
+ {
if (!GTK_WIDGET_IS_SENSITIVE (widget))
gtk_paint_flat_box(widget->style, widget->window,
widget->state, GTK_STATE_INSENSITIVE,
@@ -662,7 +667,7 @@ gtk_tree_item_draw (GtkWidget *widget,
widget->state, GTK_SHADOW_ETCHED_OUT,
area, widget, "treeitem",
0, 0, -1, -1);
- }
+ }
/*
else if(GTK_TREE(widget->parent)->view_mode == GTK_TREE_VIEW_LINE &&
widget->state == GTK_STATE_SELECTED)
@@ -675,16 +680,17 @@ gtk_tree_item_draw (GtkWidget *widget,
child_area.x, child_area.y,
child_area.width, child_area.height);
*/
- gtk_tree_item_draw_lines(widget);
-
- if (tree_item->pixmaps_box &&
- GTK_WIDGET_VISIBLE(tree_item->pixmaps_box) &&
- gtk_widget_intersect (tree_item->pixmaps_box, area, &child_area))
- gtk_widget_draw (tree_item->pixmaps_box, &child_area);
- }
-
+ gtk_tree_item_draw_lines(widget);
+
+ if (tree_item->pixmaps_box &&
+ GTK_WIDGET_VISIBLE(tree_item->pixmaps_box) &&
+ gtk_widget_intersect (tree_item->pixmaps_box, area, &child_area))
+ gtk_widget_draw (tree_item->pixmaps_box, &child_area);
+ }
+
/* draw right side */
- if(gtk_widget_intersect (bin->child, area, &child_area)) {
+ if(gtk_widget_intersect (bin->child, area, &child_area))
+ {
/*
if (!GTK_WIDGET_IS_SENSITIVE (widget))
gtk_style_set_background (widget->style, widget->window,
@@ -697,18 +703,20 @@ gtk_tree_item_draw (GtkWidget *widget,
gdk_window_clear_area (widget->window, child_area.x, child_area.y,
child_area.width+1, child_area.height);
*/
- if (bin->child &&
- GTK_WIDGET_VISIBLE(bin->child) &&
- gtk_widget_intersect (bin->child, area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
+
+ if (bin->child &&
+ GTK_WIDGET_VISIBLE(bin->child) &&
+ gtk_widget_intersect (bin->child, area, &child_area))
+ gtk_widget_draw (bin->child, &child_area);
}
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gtk_paint_focus (widget->style, widget->window,
- NULL, widget, "treeitem",
- 0, 0,
- widget->allocation.width - 1,
- widget->allocation.height - 1);
+ if (GTK_WIDGET_HAS_FOCUS (widget))
+ gtk_paint_focus (widget->style, widget->window,
+ NULL, widget, "treeitem",
+ 0, 0,
+ widget->allocation.width - 1,
+ widget->allocation.height - 1);
+
}
}
@@ -788,39 +796,37 @@ gtk_tree_item_focus_out (GtkWidget *widget,
static void
gtk_real_tree_item_select (GtkItem *item)
{
+ GtkTreeItem *tree_item;
+ GtkWidget *widget;
+
g_return_if_fail (item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (item));
- if (GTK_WIDGET (item)->state == GTK_STATE_SELECTED
- || !GTK_WIDGET_IS_SENSITIVE(item))
- return;
-
- if(GTK_TREE(GTK_WIDGET(item)->parent)->view_mode == GTK_TREE_VIEW_LINE)
- gtk_widget_set_state (GTK_TREE_ITEM (item)->pixmaps_box, GTK_STATE_SELECTED);
+ tree_item = GTK_TREE_ITEM (item);
+ widget = GTK_WIDGET (item);
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_SELECTED);
- gtk_widget_queue_draw (GTK_WIDGET (item));
+ if (!widget->parent || GTK_TREE (widget->parent)->view_mode == GTK_TREE_VIEW_LINE)
+ gtk_widget_set_state (GTK_TREE_ITEM (item)->pixmaps_box, GTK_STATE_SELECTED);
}
static void
gtk_real_tree_item_deselect (GtkItem *item)
{
+ GtkTreeItem *tree_item;
+ GtkWidget *widget;
+
g_return_if_fail (item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (item));
- if (GTK_WIDGET (item)->state == GTK_STATE_NORMAL)
- return;
+ tree_item = GTK_TREE_ITEM (item);
+ widget = GTK_WIDGET (item);
- if(GTK_WIDGET_MAPPED(GTK_WIDGET (item)))
- {
- gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_NORMAL);
-
- if(GTK_TREE(GTK_WIDGET(item)->parent)->view_mode == GTK_TREE_VIEW_LINE)
- gtk_widget_set_state (GTK_TREE_ITEM (item)->pixmaps_box, GTK_STATE_NORMAL);
+ gtk_widget_set_state (widget, GTK_STATE_NORMAL);
- gtk_widget_queue_draw (GTK_WIDGET (item));
- }
+ if (!widget->parent || GTK_TREE (widget->parent)->view_mode == GTK_TREE_VIEW_LINE)
+ gtk_widget_set_state (tree_item->pixmaps_box, GTK_STATE_NORMAL);
}
static void
@@ -846,7 +852,6 @@ gtk_real_tree_item_toggle (GtkItem *item)
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_NORMAL);
else
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_SELECTED);
- gtk_widget_queue_draw (GTK_WIDGET (item));
}
}
@@ -1023,14 +1028,12 @@ gtk_tree_item_map (GtkWidget *widget)
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (widget));
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
bin = GTK_BIN (widget);
item = GTK_TREE_ITEM(widget);
- if (!GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_show (widget->window);
- else
- gtk_widget_queue_draw (widget);
+ GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
+
+ gdk_window_show (widget->window);
if(item->pixmaps_box &&
GTK_WIDGET_VISIBLE (item->pixmaps_box) &&
@@ -1056,14 +1059,7 @@ gtk_tree_item_unmap (GtkWidget *widget)
bin = GTK_BIN (widget);
item = GTK_TREE_ITEM(widget);
- if (GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_clear_area (widget->window,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
- else
- gdk_window_hide (widget->window);
+ gdk_window_hide (widget->window);
if(item->pixmaps_box &&
GTK_WIDGET_VISIBLE (item->pixmaps_box) &&
@@ -1075,3 +1071,25 @@ gtk_tree_item_unmap (GtkWidget *widget)
GTK_WIDGET_MAPPED (bin->child))
gtk_widget_unmap (bin->child);
}
+
+static void
+gtk_tree_item_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
+{
+ GtkBin *bin;
+ GtkTreeItem *tree_item;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_TREE_ITEM (container));
+ g_return_if_fail (callback != NULL);
+
+ bin = GTK_BIN (container);
+ tree_item = GTK_TREE_ITEM (container);
+
+ if (bin->child)
+ (* callback) (bin->child, callback_data);
+ if (include_internals && tree_item->subtree)
+ (* callback) (tree_item->subtree, callback_data);
+}
diff --git a/gtk/gtktypebuiltins.h b/gtk/gtktypebuiltins.h
index d8afc47183..369591c68c 100644
--- a/gtk/gtktypebuiltins.h
+++ b/gtk/gtktypebuiltins.h
@@ -109,4 +109,4 @@ extern GtkType GTK_TYPE_GDK_WINDOW;
extern GtkType GTK_TYPE_GDK_EVENT;
extern GtkType GTK_TYPE_GDK_COLOR;
-#define GTK_TYPE_NUM_BUILTINS (107)
+#define GTK_TYPE_NUM_BUILTINS (108)
diff --git a/gtk/gtktypebuiltins_evals.c b/gtk/gtktypebuiltins_evals.c
index 6bbef5a4b2..2d75813265 100644
--- a/gtk/gtktypebuiltins_evals.c
+++ b/gtk/gtktypebuiltins_evals.c
@@ -435,6 +435,7 @@ static GtkEnumValue _gtk_widget_flags_values[] = {
{ GTK_HAS_DEFAULT, "GTK_HAS_DEFAULT", "has-default" },
{ GTK_HAS_GRAB, "GTK_HAS_GRAB", "has-grab" },
{ GTK_RC_STYLE, "GTK_RC_STYLE", "rc-style" },
+ { GTK_COMPOSITE_CHILD, "GTK_COMPOSITE_CHILD", "composite-child" },
{ GTK_BASIC, "GTK_BASIC", "basic" },
{ 0, NULL, NULL }
};
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 105f731f27..2747c06463 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -103,6 +103,7 @@ enum {
ARG_HAS_FOCUS,
ARG_CAN_DEFAULT,
ARG_HAS_DEFAULT,
+ ARG_COMPOSITE_CHILD,
ARG_STYLE,
ARG_EVENTS,
ARG_EXTENSION_EVENTS
@@ -115,6 +116,7 @@ struct _GtkStateData
GtkStateType state;
guint state_restoration : 1;
guint parent_sensitive : 1;
+ guint use_forall : 1;
};
static void gtk_widget_class_init (GtkWidgetClass *klass);
@@ -178,7 +180,7 @@ static GtkStyle *gtk_default_style = NULL;
static GSList *colormap_stack = NULL;
static GSList *visual_stack = NULL;
static GSList *style_stack = NULL;
-
+static guint composite_child_stack = 0;
static GSList *gtk_widget_redraw_queue = NULL;
static const gchar *aux_info_key = "gtk-aux-info";
@@ -266,6 +268,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
gtk_object_add_arg_type ("GtkWidget::has_focus", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_FOCUS);
gtk_object_add_arg_type ("GtkWidget::can_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CAN_DEFAULT);
gtk_object_add_arg_type ("GtkWidget::has_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_DEFAULT);
+ gtk_object_add_arg_type ("GtkWidget::composite_child", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_COMPOSITE_CHILD);
gtk_object_add_arg_type ("GtkWidget::style", GTK_TYPE_STYLE, GTK_ARG_READWRITE, ARG_STYLE);
gtk_object_add_arg_type ("GtkWidget::events", GTK_TYPE_GDK_EVENT_MASK, GTK_ARG_READWRITE, ARG_EVENTS);
gtk_object_add_arg_type ("GtkWidget::extension_events", GTK_TYPE_GDK_EVENT_MASK, GTK_ARG_READWRITE, ARG_EXTENSION_EVENTS);
@@ -664,9 +667,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->activate_signal = 0;
klass->show = gtk_widget_real_show;
+ klass->show_all = gtk_widget_show;
klass->hide = gtk_widget_real_hide;
- klass->show_all = gtk_widget_real_show;
- klass->hide_all = gtk_widget_real_hide;
+ klass->hide_all = gtk_widget_hide;
klass->map = gtk_widget_real_map;
klass->unmap = gtk_widget_real_unmap;
klass->realize = gtk_widget_real_realize;
@@ -780,6 +783,12 @@ gtk_widget_set_arg (GtkObject *object,
if (GTK_VALUE_BOOL (*arg))
gtk_widget_grab_default (widget);
break;
+ case ARG_COMPOSITE_CHILD:
+ if (GTK_VALUE_BOOL(*arg))
+ GTK_WIDGET_SET_FLAGS (widget, GTK_COMPOSITE_CHILD);
+ else
+ GTK_WIDGET_UNSET_FLAGS (widget, GTK_COMPOSITE_CHILD);
+ break;
case ARG_STYLE:
gtk_widget_set_style (widget, (GtkStyle*) GTK_VALUE_BOXED (*arg));
break;
@@ -873,6 +882,9 @@ gtk_widget_get_arg (GtkObject *object,
case ARG_HAS_DEFAULT:
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_HAS_DEFAULT (widget) != FALSE);
break;
+ case ARG_COMPOSITE_CHILD:
+ GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_COMPOSITE_CHILD (widget) != FALSE);
+ break;
case ARG_STYLE:
GTK_VALUE_BOXED (*arg) = (gpointer) gtk_widget_get_style (widget);
break;
@@ -923,7 +935,10 @@ gtk_widget_init (GtkWidget *widget)
widget->window = NULL;
widget->parent = NULL;
- GTK_WIDGET_SET_FLAGS (widget, GTK_SENSITIVE | GTK_PARENT_SENSITIVE);
+ GTK_WIDGET_SET_FLAGS (widget,
+ GTK_SENSITIVE |
+ GTK_PARENT_SENSITIVE |
+ (composite_child_stack ? GTK_COMPOSITE_CHILD : 0));
widget->style = gtk_widget_peek_style ();
gtk_style_ref (widget->style);
@@ -1399,54 +1414,32 @@ gtk_widget_hide_on_delete (GtkWidget *widget)
return TRUE;
}
-/*****************************************
- * gtk_widget_show_all:
- *
- * Shows the widget and all children.
- *
- * Container classes overwrite
- * show_all and hide_all to call
- * show_all (hide_all) on both themselves
- * and on their child widgets.
- *
- * arguments:
- *
- * results:
- *****************************************/
-
void
gtk_widget_show_all (GtkWidget *widget)
{
- GtkWidgetClass *widget_class;
-
+ GtkWidgetClass *class;
+
g_return_if_fail (widget != NULL);
-
- /* show_all shouldn't be invoked through a signal,
- because in this case it would be quite slow - there would
- be a show and show_all signal emitted for every child widget.
- */
- widget_class = GTK_WIDGET_CLASS(GTK_OBJECT(widget)->klass);
- widget_class->show_all (widget);
-}
+ g_return_if_fail (GTK_IS_WIDGET (widget));
-/*****************************************
- * gtk_widget_hide_all:
- *
- * Hides the widget and all children.
- * See gtk_widget_show_all.
- *
- * arguments:
- *
- * results:
- *****************************************/
+ class = GTK_WIDGET_CLASS (GTK_OBJECT (widget)->klass);
+
+ if (class->show_all)
+ class->show_all (widget);
+}
void
gtk_widget_hide_all (GtkWidget *widget)
{
+ GtkWidgetClass *class;
+
g_return_if_fail (widget != NULL);
- g_assert (widget->parent);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ class = GTK_WIDGET_CLASS (GTK_OBJECT (widget)->klass);
- GTK_WIDGET_CLASS (GTK_OBJECT (widget)->klass)->hide_all (widget);
+ if (class->hide_all)
+ class->hide_all (widget);
}
/*****************************************
@@ -2124,9 +2117,9 @@ gtk_widget_draw_children (GtkWidget *widget)
g_return_if_fail (widget != NULL);
if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- gtk_widget_draw_children_recurse,
- NULL);
+ gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_widget_draw_children_recurse,
+ NULL);
}
/*****************************************
@@ -2565,9 +2558,9 @@ gtk_widget_reparent_container_child(GtkWidget *widget,
gdk_window_ref (widget->window);
if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- gtk_widget_reparent_container_child,
- client_data);
+ gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_widget_reparent_container_child,
+ client_data);
}
else
gdk_window_reparent (widget->window,
@@ -2616,9 +2609,9 @@ gtk_widget_reparent (GtkWidget *widget,
if (GTK_WIDGET_NO_WINDOW (widget))
{
if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- gtk_widget_reparent_container_child,
- gtk_widget_get_parent_window (widget));
+ gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_widget_reparent_container_child,
+ gtk_widget_get_parent_window (widget));
else
{
GdkWindow *parent_window;
@@ -2875,6 +2868,7 @@ gtk_widget_set_state (GtkWidget *widget,
data.state = state;
data.state_restoration = FALSE;
+ data.use_forall = FALSE;
if (widget->parent)
data.parent_sensitive = (GTK_WIDGET_IS_SENSITIVE (widget->parent) != FALSE);
else
@@ -2922,6 +2916,7 @@ gtk_widget_set_sensitive (GtkWidget *widget,
data.state = GTK_WIDGET_STATE (widget);
}
data.state_restoration = TRUE;
+ data.use_forall = TRUE;
if (widget->parent)
data.parent_sensitive = (GTK_WIDGET_IS_SENSITIVE (widget->parent) != FALSE);
@@ -2966,6 +2961,7 @@ gtk_widget_set_parent (GtkWidget *widget,
data.state = GTK_WIDGET_STATE (widget);
data.state_restoration = FALSE;
data.parent_sensitive = (GTK_WIDGET_IS_SENSITIVE (parent) != FALSE);
+ data.use_forall = GTK_WIDGET_IS_SENSITIVE (parent) != GTK_WIDGET_IS_SENSITIVE (widget);
gtk_widget_propagate_state (widget, &data);
@@ -3156,9 +3152,9 @@ gtk_widget_set_style_recurse (GtkWidget *widget,
gtk_widget_set_rc_style (widget);
if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- gtk_widget_set_style_recurse,
- NULL);
+ gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_widget_set_style_recurse,
+ NULL);
}
void
@@ -3681,6 +3677,19 @@ gtk_widget_push_visual (GdkVisual *visual)
visual_stack = g_slist_prepend (visual_stack, visual);
}
+void
+gtk_widget_push_composite (void)
+{
+ composite_child_stack++;
+}
+
+void
+gtk_widget_pop_composite (void)
+{
+ if (composite_child_stack)
+ composite_child_stack--;
+}
+
/*****************************************
* gtk_widget_pop_colormap:
*
@@ -4032,9 +4041,9 @@ gtk_widget_real_unrealize (GtkWidget *widget)
/* Unrealize afterwards to improve visual effect */
if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- (GtkCallback) gtk_widget_unrealize,
- NULL);
+ gtk_container_forall (GTK_CONTAINER (widget),
+ (GtkCallback) gtk_widget_unrealize,
+ NULL);
}
/*****************************************
@@ -4140,18 +4149,6 @@ gtk_widget_peek_visual (void)
return gtk_widget_get_default_visual ();
}
-/*************************************************************
- * gtk_widget_propagate_state:
- * Propagate a change in the widgets state down the tree
- *
- * arguments:
- * widget
- * GtkStateData: state
- * parent_sensitive
- *
- * results:
- *************************************************************/
-
static void
gtk_widget_propagate_state (GtkWidget *widget,
GtkStateData *data)
@@ -4214,9 +4211,14 @@ gtk_widget_propagate_state (GtkWidget *widget,
{
data->parent_sensitive = (GTK_WIDGET_IS_SENSITIVE (widget) != FALSE);
data->state = GTK_WIDGET_STATE (widget);
- gtk_container_foreach (GTK_CONTAINER (widget),
- (GtkCallback) gtk_widget_propagate_state,
- data);
+ if (data->use_forall)
+ gtk_container_forall (GTK_CONTAINER (widget),
+ (GtkCallback) gtk_widget_propagate_state,
+ data);
+ else
+ gtk_container_foreach (GTK_CONTAINER (widget),
+ (GtkCallback) gtk_widget_propagate_state,
+ data);
}
gtk_widget_unref (widget);
}
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index a7e73470f7..284458b428 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -49,7 +49,8 @@ typedef enum
GTK_HAS_DEFAULT = 1 << 14,
GTK_HAS_GRAB = 1 << 15,
GTK_RC_STYLE = 1 << 16,
- GTK_BASIC = 1 << 17
+ GTK_COMPOSITE_CHILD = 1 << 17,
+ GTK_BASIC = 1 << 18
} GtkWidgetFlags;
/* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
@@ -85,8 +86,9 @@ typedef enum
#define GTK_WIDGET_CAN_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) != 0)
#define GTK_WIDGET_HAS_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) != 0)
#define GTK_WIDGET_HAS_GRAB(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
-#define GTK_WIDGET_BASIC(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_BASIC) != 0)
#define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
+#define GTK_WIDGET_COMPOSITE_CHILD(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0)
+#define GTK_WIDGET_BASIC(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_BASIC) != 0)
/* Macros for setting and clearing widget flags.
*/
@@ -236,9 +238,9 @@ struct _GtkWidgetClass
/* basics */
void (* show) (GtkWidget *widget);
+ void (* show_all) (GtkWidget *widget);
void (* hide) (GtkWidget *widget);
- void (* show_all) (GtkWidget *widget);
- void (* hide_all) (GtkWidget *widget);
+ void (* hide_all) (GtkWidget *widget);
void (* map) (GtkWidget *widget);
void (* unmap) (GtkWidget *widget);
void (* realize) (GtkWidget *widget);
@@ -515,12 +517,14 @@ void gtk_widget_reset_rc_styles (GtkWidget *widget);
* This will override the values that got set by the
* gtk_widget_set_default_* () functions.
*/
-void gtk_widget_push_style (GtkStyle *style);
-void gtk_widget_push_colormap (GdkColormap *cmap);
-void gtk_widget_push_visual (GdkVisual *visual);
-void gtk_widget_pop_style (void);
-void gtk_widget_pop_colormap (void);
-void gtk_widget_pop_visual (void);
+void gtk_widget_push_style (GtkStyle *style);
+void gtk_widget_push_colormap (GdkColormap *cmap);
+void gtk_widget_push_visual (GdkVisual *visual);
+void gtk_widget_push_composite_flag (void);
+void gtk_widget_pop_composite_flag (void);
+void gtk_widget_pop_style (void);
+void gtk_widget_pop_colormap (void);
+void gtk_widget_pop_visual (void);
/* Set certain default values to be used at widget creation time.
*/
diff --git a/gtk/testgtkrc b/gtk/testgtkrc
index a38958063c..7c20f5f153 100644
--- a/gtk/testgtkrc
+++ b/gtk/testgtkrc
@@ -10,7 +10,7 @@
# widget <widget_set> style <style_name>
# widget_class <widget_class_set> style <style_name>
-include "/home/raster/.themes/Stone/gtk/gtkrc"
+#include "/opt/themes/share/gtk/themes/metal/gtkrc"
binding "test1"
{
diff --git a/gtk/testrgb.c b/gtk/testrgb.c
new file mode 100644
index 0000000000..b125bf7649
--- /dev/null
+++ b/gtk/testrgb.c
@@ -0,0 +1,237 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* Note: these #includes differ slightly from the testrgb.c file included
+ in the GdkRgb release. */
+
+/* For gettimeofday */
+#include <sys/time.h>
+#include <unistd.h>
+
+#include "gtk.h"
+
+static void
+quit_func (GtkWidget *widget, gpointer dummy)
+{
+ gtk_main_quit ();
+}
+
+#define WIDTH 320
+#define HEIGHT 200
+
+gdouble
+get_time (void)
+{
+ struct timeval tv;
+ struct timezone tz;
+
+ gettimeofday (&tv, &tz);
+
+ return tv.tv_sec + 1e-6 * tv.tv_usec;
+}
+
+#define NUM_ITERS 100
+
+static void
+testrgb_rgb_test (GtkWidget *drawing_area)
+{
+ guchar buf[WIDTH * HEIGHT * 6];
+ gint i, j;
+ gint offset;
+ guchar val;
+ gdouble start_time, total_time;
+ gint x, y;
+ gboolean dither;
+ int dith_max;
+
+ val = 0;
+ for (j = 0; j < WIDTH * HEIGHT * 6; j++)
+ {
+ val = (val + ((val + (rand () & 0xff)) >> 1)) >> 1;
+ buf[j] = val;
+ }
+
+ /* Let's warm up the cache, and also wait for the window manager
+ to settle. */
+ for (i = 0; i < NUM_ITERS; i++)
+ {
+ offset = (rand () % (WIDTH * HEIGHT * 3)) & -4;
+ gdk_draw_rgb_image (drawing_area->window,
+ drawing_area->style->white_gc,
+ 0, 0, WIDTH, HEIGHT,
+ GDK_RGB_DITHER_NONE,
+ buf + offset, WIDTH * 3);
+ }
+
+ if (gdk_rgb_ditherable ())
+ dith_max = 2;
+ else
+ dith_max = 1;
+
+ for (dither = 0; dither < dith_max; dither++)
+ {
+ start_time = get_time ();
+ for (i = 0; i < NUM_ITERS; i++)
+ {
+ offset = (rand () % (WIDTH * HEIGHT * 3)) & -4;
+ gdk_draw_rgb_image (drawing_area->window,
+ drawing_area->style->white_gc,
+ 0, 0, WIDTH, HEIGHT,
+ dither ? GDK_RGB_DITHER_MAX :
+ GDK_RGB_DITHER_NONE,
+ buf + offset, WIDTH * 3);
+ }
+ total_time = get_time () - start_time;
+ g_print ("Color test%s time elapsed: %.2fs, %.1f fps, %.2f megapixels/s\n",
+ dither ? " (dithered)" : "",
+ total_time,
+ NUM_ITERS / total_time,
+ NUM_ITERS * (WIDTH * HEIGHT * 1e-6) / total_time);
+ }
+
+ for (dither = 0; dither < dith_max; dither++)
+ {
+ start_time = get_time ();
+ for (i = 0; i < NUM_ITERS; i++)
+ {
+ offset = (rand () % (WIDTH * HEIGHT)) & -4;
+ gdk_draw_gray_image (drawing_area->window,
+ drawing_area->style->white_gc,
+ 0, 0, WIDTH, HEIGHT,
+ dither ? GDK_RGB_DITHER_MAX :
+ GDK_RGB_DITHER_NONE,
+ buf + offset, WIDTH);
+ }
+ total_time = get_time () - start_time;
+ g_print ("Grayscale test%s time elapsed: %.2fs, %.1f fps, %.2f megapixels/s\n",
+ dither ? " (dithered)" : "",
+ total_time,
+ NUM_ITERS / total_time,
+ NUM_ITERS * (WIDTH * HEIGHT * 1e-6) / total_time);
+ }
+
+#if 1
+ for (x = 0; x < WIDTH; x++)
+ {
+ int cindex;
+
+ cindex = (x * 8) / WIDTH;
+ buf[x * 3] = cindex & 4 ? 0 : 255;
+ buf[x * 3 + 1] = cindex & 2 ? 0 : 255;
+ buf[x * 3 + 2] = cindex & 1 ? 0 : 255;
+ }
+ for (y = 1; y < (HEIGHT * 3) / 4; y++)
+ {
+ memcpy (buf + y * WIDTH * 3, buf, WIDTH * 3);
+ }
+ for (; y < (HEIGHT * 13) / 16; y++)
+ {
+ for (x = 0; x < WIDTH; x++)
+ {
+ guchar gray;
+
+ gray = (x * 255) / (WIDTH - 1);
+ buf[y * WIDTH * 3 + x * 3] = gray;
+ buf[y * WIDTH * 3 + x * 3 + 1] = gray;
+ buf[y * WIDTH * 3 + x * 3 + 2] = gray;
+ }
+ }
+
+ for (; y < HEIGHT; y++)
+ {
+ for (x = 0; x < WIDTH; x++)
+ {
+ int cindex;
+ guchar gray;
+
+ cindex = (x * 16) / WIDTH;
+ gray = cindex < 3 ? 0 :
+ cindex < 5 ? 255 :
+ cindex < 7 ? 128 :
+ 0;
+ buf[y * WIDTH * 3 + x * 3] = gray;
+ buf[y * WIDTH * 3 + x * 3 + 1] = gray;
+ buf[y * WIDTH * 3 + x * 3 + 2] = gray;
+ }
+ }
+ gdk_draw_rgb_image (drawing_area->window,
+ drawing_area->style->white_gc,
+ 0, 0, WIDTH, HEIGHT, GDK_RGB_DITHER_MAX,
+ buf, WIDTH * 3);
+#endif
+}
+
+void
+new_testrgb_window (void)
+{
+ GtkWidget *window;
+ GtkWidget *vbox;
+ GtkWidget *button;
+ GtkWidget *drawing_area;
+
+ window = gtk_widget_new (gtk_window_get_type (),
+ "GtkObject::user_data", NULL,
+ "GtkWindow::type", GTK_WINDOW_TOPLEVEL,
+ "GtkWindow::title", "testrgb",
+ "GtkWindow::allow_shrink", FALSE,
+ NULL);
+ gtk_signal_connect (GTK_OBJECT (window), "destroy",
+ (GtkSignalFunc) quit_func, NULL);
+
+ vbox = gtk_vbox_new (FALSE, 0);
+
+ drawing_area = gtk_drawing_area_new ();
+
+ gtk_widget_set_usize (drawing_area, WIDTH, HEIGHT);
+ gtk_box_pack_start (GTK_BOX (vbox), drawing_area, FALSE, FALSE, 0);
+ gtk_widget_show (drawing_area);
+
+ button = gtk_button_new_with_label ("Quit");
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+ gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
+ (GtkSignalFunc) gtk_widget_destroy,
+ GTK_OBJECT (window));
+
+ gtk_widget_show (button);
+
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+ gtk_widget_show (vbox);
+
+ gtk_widget_show (window);
+
+ testrgb_rgb_test (drawing_area);
+}
+
+int
+main (int argc, char **argv)
+{
+ gtk_init (&argc, &argv);
+
+ gdk_rgb_set_verbose (TRUE);
+
+ gdk_rgb_init ();
+
+ gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
+ gtk_widget_set_default_visual (gdk_rgb_get_visual ());
+ new_testrgb_window ();
+
+ gtk_main ();
+
+ return 0;
+}
diff --git a/gtk/testthreads.c b/gtk/testthreads.c
index 71527d13d1..6ce38f369c 100644
--- a/gtk/testthreads.c
+++ b/gtk/testthreads.c
@@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
+#include <unistd.h>
#include <gtk/gtk.h>
#include "../config.h"
diff --git a/tests/testgtkrc b/tests/testgtkrc
index a38958063c..7c20f5f153 100644
--- a/tests/testgtkrc
+++ b/tests/testgtkrc
@@ -10,7 +10,7 @@
# widget <widget_set> style <style_name>
# widget_class <widget_class_set> style <style_name>
-include "/home/raster/.themes/Stone/gtk/gtkrc"
+#include "/opt/themes/share/gtk/themes/metal/gtkrc"
binding "test1"
{
diff --git a/tests/testrgb.c b/tests/testrgb.c
new file mode 100644
index 0000000000..b125bf7649
--- /dev/null
+++ b/tests/testrgb.c
@@ -0,0 +1,237 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* Note: these #includes differ slightly from the testrgb.c file included
+ in the GdkRgb release. */
+
+/* For gettimeofday */
+#include <sys/time.h>
+#include <unistd.h>
+
+#include "gtk.h"
+
+static void
+quit_func (GtkWidget *widget, gpointer dummy)
+{
+ gtk_main_quit ();
+}
+
+#define WIDTH 320
+#define HEIGHT 200
+
+gdouble
+get_time (void)
+{
+ struct timeval tv;
+ struct timezone tz;
+
+ gettimeofday (&tv, &tz);
+
+ return tv.tv_sec + 1e-6 * tv.tv_usec;
+}
+
+#define NUM_ITERS 100
+
+static void
+testrgb_rgb_test (GtkWidget *drawing_area)
+{
+ guchar buf[WIDTH * HEIGHT * 6];
+ gint i, j;
+ gint offset;
+ guchar val;
+ gdouble start_time, total_time;
+ gint x, y;
+ gboolean dither;
+ int dith_max;
+
+ val = 0;
+ for (j = 0; j < WIDTH * HEIGHT * 6; j++)
+ {
+ val = (val + ((val + (rand () & 0xff)) >> 1)) >> 1;
+ buf[j] = val;
+ }
+
+ /* Let's warm up the cache, and also wait for the window manager
+ to settle. */
+ for (i = 0; i < NUM_ITERS; i++)
+ {
+ offset = (rand () % (WIDTH * HEIGHT * 3)) & -4;
+ gdk_draw_rgb_image (drawing_area->window,
+ drawing_area->style->white_gc,
+ 0, 0, WIDTH, HEIGHT,
+ GDK_RGB_DITHER_NONE,
+ buf + offset, WIDTH * 3);
+ }
+
+ if (gdk_rgb_ditherable ())
+ dith_max = 2;
+ else
+ dith_max = 1;
+
+ for (dither = 0; dither < dith_max; dither++)
+ {
+ start_time = get_time ();
+ for (i = 0; i < NUM_ITERS; i++)
+ {
+ offset = (rand () % (WIDTH * HEIGHT * 3)) & -4;
+ gdk_draw_rgb_image (drawing_area->window,
+ drawing_area->style->white_gc,
+ 0, 0, WIDTH, HEIGHT,
+ dither ? GDK_RGB_DITHER_MAX :
+ GDK_RGB_DITHER_NONE,
+ buf + offset, WIDTH * 3);
+ }
+ total_time = get_time () - start_time;
+ g_print ("Color test%s time elapsed: %.2fs, %.1f fps, %.2f megapixels/s\n",
+ dither ? " (dithered)" : "",
+ total_time,
+ NUM_ITERS / total_time,
+ NUM_ITERS * (WIDTH * HEIGHT * 1e-6) / total_time);
+ }
+
+ for (dither = 0; dither < dith_max; dither++)
+ {
+ start_time = get_time ();
+ for (i = 0; i < NUM_ITERS; i++)
+ {
+ offset = (rand () % (WIDTH * HEIGHT)) & -4;
+ gdk_draw_gray_image (drawing_area->window,
+ drawing_area->style->white_gc,
+ 0, 0, WIDTH, HEIGHT,
+ dither ? GDK_RGB_DITHER_MAX :
+ GDK_RGB_DITHER_NONE,
+ buf + offset, WIDTH);
+ }
+ total_time = get_time () - start_time;
+ g_print ("Grayscale test%s time elapsed: %.2fs, %.1f fps, %.2f megapixels/s\n",
+ dither ? " (dithered)" : "",
+ total_time,
+ NUM_ITERS / total_time,
+ NUM_ITERS * (WIDTH * HEIGHT * 1e-6) / total_time);
+ }
+
+#if 1
+ for (x = 0; x < WIDTH; x++)
+ {
+ int cindex;
+
+ cindex = (x * 8) / WIDTH;
+ buf[x * 3] = cindex & 4 ? 0 : 255;
+ buf[x * 3 + 1] = cindex & 2 ? 0 : 255;
+ buf[x * 3 + 2] = cindex & 1 ? 0 : 255;
+ }
+ for (y = 1; y < (HEIGHT * 3) / 4; y++)
+ {
+ memcpy (buf + y * WIDTH * 3, buf, WIDTH * 3);
+ }
+ for (; y < (HEIGHT * 13) / 16; y++)
+ {
+ for (x = 0; x < WIDTH; x++)
+ {
+ guchar gray;
+
+ gray = (x * 255) / (WIDTH - 1);
+ buf[y * WIDTH * 3 + x * 3] = gray;
+ buf[y * WIDTH * 3 + x * 3 + 1] = gray;
+ buf[y * WIDTH * 3 + x * 3 + 2] = gray;
+ }
+ }
+
+ for (; y < HEIGHT; y++)
+ {
+ for (x = 0; x < WIDTH; x++)
+ {
+ int cindex;
+ guchar gray;
+
+ cindex = (x * 16) / WIDTH;
+ gray = cindex < 3 ? 0 :
+ cindex < 5 ? 255 :
+ cindex < 7 ? 128 :
+ 0;
+ buf[y * WIDTH * 3 + x * 3] = gray;
+ buf[y * WIDTH * 3 + x * 3 + 1] = gray;
+ buf[y * WIDTH * 3 + x * 3 + 2] = gray;
+ }
+ }
+ gdk_draw_rgb_image (drawing_area->window,
+ drawing_area->style->white_gc,
+ 0, 0, WIDTH, HEIGHT, GDK_RGB_DITHER_MAX,
+ buf, WIDTH * 3);
+#endif
+}
+
+void
+new_testrgb_window (void)
+{
+ GtkWidget *window;
+ GtkWidget *vbox;
+ GtkWidget *button;
+ GtkWidget *drawing_area;
+
+ window = gtk_widget_new (gtk_window_get_type (),
+ "GtkObject::user_data", NULL,
+ "GtkWindow::type", GTK_WINDOW_TOPLEVEL,
+ "GtkWindow::title", "testrgb",
+ "GtkWindow::allow_shrink", FALSE,
+ NULL);
+ gtk_signal_connect (GTK_OBJECT (window), "destroy",
+ (GtkSignalFunc) quit_func, NULL);
+
+ vbox = gtk_vbox_new (FALSE, 0);
+
+ drawing_area = gtk_drawing_area_new ();
+
+ gtk_widget_set_usize (drawing_area, WIDTH, HEIGHT);
+ gtk_box_pack_start (GTK_BOX (vbox), drawing_area, FALSE, FALSE, 0);
+ gtk_widget_show (drawing_area);
+
+ button = gtk_button_new_with_label ("Quit");
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+ gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
+ (GtkSignalFunc) gtk_widget_destroy,
+ GTK_OBJECT (window));
+
+ gtk_widget_show (button);
+
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+ gtk_widget_show (vbox);
+
+ gtk_widget_show (window);
+
+ testrgb_rgb_test (drawing_area);
+}
+
+int
+main (int argc, char **argv)
+{
+ gtk_init (&argc, &argv);
+
+ gdk_rgb_set_verbose (TRUE);
+
+ gdk_rgb_init ();
+
+ gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
+ gtk_widget_set_default_visual (gdk_rgb_get_visual ());
+ new_testrgb_window ();
+
+ gtk_main ();
+
+ return 0;
+}
diff --git a/tests/testthreads.c b/tests/testthreads.c
index 71527d13d1..6ce38f369c 100644
--- a/tests/testthreads.c
+++ b/tests/testthreads.c
@@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
+#include <unistd.h>
#include <gtk/gtk.h>
#include "../config.h"