summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog58
-rw-r--r--ChangeLog.pre-2-058
-rw-r--r--ChangeLog.pre-2-1058
-rw-r--r--ChangeLog.pre-2-258
-rw-r--r--ChangeLog.pre-2-458
-rw-r--r--ChangeLog.pre-2-658
-rw-r--r--ChangeLog.pre-2-858
-rw-r--r--docs/reference/ChangeLog15
-rw-r--r--docs/reference/gtk/Makefile.am3
-rw-r--r--docs/reference/gtk/gtk-docs.sgml272
-rw-r--r--docs/reference/gtk/gtk-sections.txt1
-rw-r--r--docs/reference/gtk/objects_grouped.sgml20
-rw-r--r--docs/reference/gtk/text_widget.sgml127
-rw-r--r--docs/reference/gtk/tmpl/gtktextbuffer.sgml11
-rw-r--r--docs/reference/gtk/tmpl/gtktextiter.sgml10
-rw-r--r--docs/reference/gtk/tmpl/gtktextmark.sgml41
-rw-r--r--docs/reference/gtk/tmpl/gtktexttag.sgml7
-rw-r--r--docs/reference/gtk/tmpl/gtktexttagtable.sgml7
-rw-r--r--docs/reference/gtk/tmpl/gtktextview.sgml10
-rw-r--r--gdk/gdkdraw.c91
-rw-r--r--gdk/gdkdrawable.h21
-rw-r--r--gdk/gdkimage.c16
-rw-r--r--gdk/gdkpixmap.c21
-rw-r--r--gdk/gdkwindow.c221
-rw-r--r--gdk/x11/gdkdrawable-x11.c25
-rw-r--r--gdk/x11/gdkgc-x11.c2
-rw-r--r--gdk/x11/gdkimage-x11.c33
-rw-r--r--gdk/x11/gdkpixmap-x11.c10
-rw-r--r--gdk/x11/gdkprivate-x11.h6
-rw-r--r--gtk/gtktreestore.c2
-rw-r--r--gtk/testgtk.c318
-rw-r--r--gtk/testtext.c10
-rw-r--r--tests/testgtk.c318
-rw-r--r--tests/testtext.c10
34 files changed, 1868 insertions, 166 deletions
diff --git a/ChangeLog b/ChangeLog
index d0acbc1d5b..2f0f46c7de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,61 @@
+2000-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/testtext.c: Re-enable the "find" dialog
+
+ * gtk/testgtk.c: Add test for gdk_drawable_get_image
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix bug where
+ the arguments to gdk_draw_drawable were in the wrong order
+ (gdk_window_paint_init_bg): This function was ignoring the
+ init_region, instead of clipping to it, so the entire backing
+ pixmap was cleared on every begin_paint()
+ (gdk_window_begin_paint_region): Hmm, the same list-walking bug
+ was in here again, the loop kept using the same GtkWindowPaint
+ over and over.
+ (gdk_window_begin_paint_region): Fix a bug where we had two
+ x_offset instead of x_offset and y_offset
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): get composite drawable
+ before we get the image.
+ (gdk_draw_drawable): get the composite before we draw the drawable.
+ (gdk_drawable_real_get_composite_drawable): default
+ get_composite_drawable implementation that returns the drawable
+ itself
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Add
+ get_composite_drawable virtual function
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix a cheesy
+ list-walking bug
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable): Add a hack to
+ make this work if the source drawable is a GdkDrawableImplX11
+ instead of a public drawable type. This is really broken; the
+ problem is that GdkDrawable needs a virtual method get_xid(), but
+ of course that doesn't work in practice. Enter RTTI.
+
+ Also, improve mismatched depth message.
+
+ * gdk/gdkpixmap.c (gdk_pixmap_get_image): Implement get_image for
+ GdkPixmap
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_class_init):
+ install _gdk_x11_get_image as our implementation of get_image
+
+ * gdk/x11/gdkimage-x11.c (gdk_image_get): Rename to
+ _gdk_x11_get_image and export for use in gdkdrawable-x11.c
+
+ * gdk/gdkimage.c (gdk_image_get): Make this just a wrapper around
+ gdk_drawable_get_image
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): call virtual get_image
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Virtualize
+ get_image
+
+ * gtk/gtktreestore.c (gtk_tree_store_get_node): remove weird
+ trailing semicolon after for loop
+
Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style_internal): Fix problem
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index d0acbc1d5b..2f0f46c7de 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,61 @@
+2000-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/testtext.c: Re-enable the "find" dialog
+
+ * gtk/testgtk.c: Add test for gdk_drawable_get_image
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix bug where
+ the arguments to gdk_draw_drawable were in the wrong order
+ (gdk_window_paint_init_bg): This function was ignoring the
+ init_region, instead of clipping to it, so the entire backing
+ pixmap was cleared on every begin_paint()
+ (gdk_window_begin_paint_region): Hmm, the same list-walking bug
+ was in here again, the loop kept using the same GtkWindowPaint
+ over and over.
+ (gdk_window_begin_paint_region): Fix a bug where we had two
+ x_offset instead of x_offset and y_offset
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): get composite drawable
+ before we get the image.
+ (gdk_draw_drawable): get the composite before we draw the drawable.
+ (gdk_drawable_real_get_composite_drawable): default
+ get_composite_drawable implementation that returns the drawable
+ itself
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Add
+ get_composite_drawable virtual function
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix a cheesy
+ list-walking bug
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable): Add a hack to
+ make this work if the source drawable is a GdkDrawableImplX11
+ instead of a public drawable type. This is really broken; the
+ problem is that GdkDrawable needs a virtual method get_xid(), but
+ of course that doesn't work in practice. Enter RTTI.
+
+ Also, improve mismatched depth message.
+
+ * gdk/gdkpixmap.c (gdk_pixmap_get_image): Implement get_image for
+ GdkPixmap
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_class_init):
+ install _gdk_x11_get_image as our implementation of get_image
+
+ * gdk/x11/gdkimage-x11.c (gdk_image_get): Rename to
+ _gdk_x11_get_image and export for use in gdkdrawable-x11.c
+
+ * gdk/gdkimage.c (gdk_image_get): Make this just a wrapper around
+ gdk_drawable_get_image
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): call virtual get_image
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Virtualize
+ get_image
+
+ * gtk/gtktreestore.c (gtk_tree_store_get_node): remove weird
+ trailing semicolon after for loop
+
Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style_internal): Fix problem
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index d0acbc1d5b..2f0f46c7de 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,61 @@
+2000-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/testtext.c: Re-enable the "find" dialog
+
+ * gtk/testgtk.c: Add test for gdk_drawable_get_image
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix bug where
+ the arguments to gdk_draw_drawable were in the wrong order
+ (gdk_window_paint_init_bg): This function was ignoring the
+ init_region, instead of clipping to it, so the entire backing
+ pixmap was cleared on every begin_paint()
+ (gdk_window_begin_paint_region): Hmm, the same list-walking bug
+ was in here again, the loop kept using the same GtkWindowPaint
+ over and over.
+ (gdk_window_begin_paint_region): Fix a bug where we had two
+ x_offset instead of x_offset and y_offset
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): get composite drawable
+ before we get the image.
+ (gdk_draw_drawable): get the composite before we draw the drawable.
+ (gdk_drawable_real_get_composite_drawable): default
+ get_composite_drawable implementation that returns the drawable
+ itself
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Add
+ get_composite_drawable virtual function
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix a cheesy
+ list-walking bug
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable): Add a hack to
+ make this work if the source drawable is a GdkDrawableImplX11
+ instead of a public drawable type. This is really broken; the
+ problem is that GdkDrawable needs a virtual method get_xid(), but
+ of course that doesn't work in practice. Enter RTTI.
+
+ Also, improve mismatched depth message.
+
+ * gdk/gdkpixmap.c (gdk_pixmap_get_image): Implement get_image for
+ GdkPixmap
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_class_init):
+ install _gdk_x11_get_image as our implementation of get_image
+
+ * gdk/x11/gdkimage-x11.c (gdk_image_get): Rename to
+ _gdk_x11_get_image and export for use in gdkdrawable-x11.c
+
+ * gdk/gdkimage.c (gdk_image_get): Make this just a wrapper around
+ gdk_drawable_get_image
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): call virtual get_image
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Virtualize
+ get_image
+
+ * gtk/gtktreestore.c (gtk_tree_store_get_node): remove weird
+ trailing semicolon after for loop
+
Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style_internal): Fix problem
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index d0acbc1d5b..2f0f46c7de 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,61 @@
+2000-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/testtext.c: Re-enable the "find" dialog
+
+ * gtk/testgtk.c: Add test for gdk_drawable_get_image
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix bug where
+ the arguments to gdk_draw_drawable were in the wrong order
+ (gdk_window_paint_init_bg): This function was ignoring the
+ init_region, instead of clipping to it, so the entire backing
+ pixmap was cleared on every begin_paint()
+ (gdk_window_begin_paint_region): Hmm, the same list-walking bug
+ was in here again, the loop kept using the same GtkWindowPaint
+ over and over.
+ (gdk_window_begin_paint_region): Fix a bug where we had two
+ x_offset instead of x_offset and y_offset
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): get composite drawable
+ before we get the image.
+ (gdk_draw_drawable): get the composite before we draw the drawable.
+ (gdk_drawable_real_get_composite_drawable): default
+ get_composite_drawable implementation that returns the drawable
+ itself
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Add
+ get_composite_drawable virtual function
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix a cheesy
+ list-walking bug
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable): Add a hack to
+ make this work if the source drawable is a GdkDrawableImplX11
+ instead of a public drawable type. This is really broken; the
+ problem is that GdkDrawable needs a virtual method get_xid(), but
+ of course that doesn't work in practice. Enter RTTI.
+
+ Also, improve mismatched depth message.
+
+ * gdk/gdkpixmap.c (gdk_pixmap_get_image): Implement get_image for
+ GdkPixmap
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_class_init):
+ install _gdk_x11_get_image as our implementation of get_image
+
+ * gdk/x11/gdkimage-x11.c (gdk_image_get): Rename to
+ _gdk_x11_get_image and export for use in gdkdrawable-x11.c
+
+ * gdk/gdkimage.c (gdk_image_get): Make this just a wrapper around
+ gdk_drawable_get_image
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): call virtual get_image
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Virtualize
+ get_image
+
+ * gtk/gtktreestore.c (gtk_tree_store_get_node): remove weird
+ trailing semicolon after for loop
+
Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style_internal): Fix problem
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index d0acbc1d5b..2f0f46c7de 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,61 @@
+2000-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/testtext.c: Re-enable the "find" dialog
+
+ * gtk/testgtk.c: Add test for gdk_drawable_get_image
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix bug where
+ the arguments to gdk_draw_drawable were in the wrong order
+ (gdk_window_paint_init_bg): This function was ignoring the
+ init_region, instead of clipping to it, so the entire backing
+ pixmap was cleared on every begin_paint()
+ (gdk_window_begin_paint_region): Hmm, the same list-walking bug
+ was in here again, the loop kept using the same GtkWindowPaint
+ over and over.
+ (gdk_window_begin_paint_region): Fix a bug where we had two
+ x_offset instead of x_offset and y_offset
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): get composite drawable
+ before we get the image.
+ (gdk_draw_drawable): get the composite before we draw the drawable.
+ (gdk_drawable_real_get_composite_drawable): default
+ get_composite_drawable implementation that returns the drawable
+ itself
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Add
+ get_composite_drawable virtual function
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix a cheesy
+ list-walking bug
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable): Add a hack to
+ make this work if the source drawable is a GdkDrawableImplX11
+ instead of a public drawable type. This is really broken; the
+ problem is that GdkDrawable needs a virtual method get_xid(), but
+ of course that doesn't work in practice. Enter RTTI.
+
+ Also, improve mismatched depth message.
+
+ * gdk/gdkpixmap.c (gdk_pixmap_get_image): Implement get_image for
+ GdkPixmap
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_class_init):
+ install _gdk_x11_get_image as our implementation of get_image
+
+ * gdk/x11/gdkimage-x11.c (gdk_image_get): Rename to
+ _gdk_x11_get_image and export for use in gdkdrawable-x11.c
+
+ * gdk/gdkimage.c (gdk_image_get): Make this just a wrapper around
+ gdk_drawable_get_image
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): call virtual get_image
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Virtualize
+ get_image
+
+ * gtk/gtktreestore.c (gtk_tree_store_get_node): remove weird
+ trailing semicolon after for loop
+
Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style_internal): Fix problem
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index d0acbc1d5b..2f0f46c7de 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,61 @@
+2000-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/testtext.c: Re-enable the "find" dialog
+
+ * gtk/testgtk.c: Add test for gdk_drawable_get_image
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix bug where
+ the arguments to gdk_draw_drawable were in the wrong order
+ (gdk_window_paint_init_bg): This function was ignoring the
+ init_region, instead of clipping to it, so the entire backing
+ pixmap was cleared on every begin_paint()
+ (gdk_window_begin_paint_region): Hmm, the same list-walking bug
+ was in here again, the loop kept using the same GtkWindowPaint
+ over and over.
+ (gdk_window_begin_paint_region): Fix a bug where we had two
+ x_offset instead of x_offset and y_offset
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): get composite drawable
+ before we get the image.
+ (gdk_draw_drawable): get the composite before we draw the drawable.
+ (gdk_drawable_real_get_composite_drawable): default
+ get_composite_drawable implementation that returns the drawable
+ itself
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Add
+ get_composite_drawable virtual function
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix a cheesy
+ list-walking bug
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable): Add a hack to
+ make this work if the source drawable is a GdkDrawableImplX11
+ instead of a public drawable type. This is really broken; the
+ problem is that GdkDrawable needs a virtual method get_xid(), but
+ of course that doesn't work in practice. Enter RTTI.
+
+ Also, improve mismatched depth message.
+
+ * gdk/gdkpixmap.c (gdk_pixmap_get_image): Implement get_image for
+ GdkPixmap
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_class_init):
+ install _gdk_x11_get_image as our implementation of get_image
+
+ * gdk/x11/gdkimage-x11.c (gdk_image_get): Rename to
+ _gdk_x11_get_image and export for use in gdkdrawable-x11.c
+
+ * gdk/gdkimage.c (gdk_image_get): Make this just a wrapper around
+ gdk_drawable_get_image
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): call virtual get_image
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Virtualize
+ get_image
+
+ * gtk/gtktreestore.c (gtk_tree_store_get_node): remove weird
+ trailing semicolon after for loop
+
Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style_internal): Fix problem
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index d0acbc1d5b..2f0f46c7de 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,61 @@
+2000-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/testtext.c: Re-enable the "find" dialog
+
+ * gtk/testgtk.c: Add test for gdk_drawable_get_image
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix bug where
+ the arguments to gdk_draw_drawable were in the wrong order
+ (gdk_window_paint_init_bg): This function was ignoring the
+ init_region, instead of clipping to it, so the entire backing
+ pixmap was cleared on every begin_paint()
+ (gdk_window_begin_paint_region): Hmm, the same list-walking bug
+ was in here again, the loop kept using the same GtkWindowPaint
+ over and over.
+ (gdk_window_begin_paint_region): Fix a bug where we had two
+ x_offset instead of x_offset and y_offset
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): get composite drawable
+ before we get the image.
+ (gdk_draw_drawable): get the composite before we draw the drawable.
+ (gdk_drawable_real_get_composite_drawable): default
+ get_composite_drawable implementation that returns the drawable
+ itself
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Add
+ get_composite_drawable virtual function
+
+ * gdk/gdkwindow.c (gdk_window_begin_paint_region): Fix a cheesy
+ list-walking bug
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable): Add a hack to
+ make this work if the source drawable is a GdkDrawableImplX11
+ instead of a public drawable type. This is really broken; the
+ problem is that GdkDrawable needs a virtual method get_xid(), but
+ of course that doesn't work in practice. Enter RTTI.
+
+ Also, improve mismatched depth message.
+
+ * gdk/gdkpixmap.c (gdk_pixmap_get_image): Implement get_image for
+ GdkPixmap
+
+ * gdk/x11/gdkdrawable-x11.c (gdk_drawable_impl_x11_class_init):
+ install _gdk_x11_get_image as our implementation of get_image
+
+ * gdk/x11/gdkimage-x11.c (gdk_image_get): Rename to
+ _gdk_x11_get_image and export for use in gdkdrawable-x11.c
+
+ * gdk/gdkimage.c (gdk_image_get): Make this just a wrapper around
+ gdk_drawable_get_image
+
+ * gdk/gdkdraw.c (gdk_drawable_get_image): call virtual get_image
+
+ * gdk/gdkdrawable.h (struct _GdkDrawableClass ): Virtualize
+ get_image
+
+ * gtk/gtktreestore.c (gtk_tree_store_get_node): remove weird
+ trailing semicolon after for loop
+
Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style_internal): Fix problem
diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog
index 8c50e48dd9..7fe274847a 100644
--- a/docs/reference/ChangeLog
+++ b/docs/reference/ChangeLog
@@ -1,3 +1,18 @@
+2000-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtk-sections.txt: remove GtkTextBTree
+
+ * gtk/text_widget.sgml: Overview of the text widget
+
+ * gtk/gtk-docs.sgml: Change to using categories for the toplevel
+ organization of the reference entries. We'll add an alphabetical
+ index eventually. The category way is a lot easier for people who
+ aren't familiar with the widgets. Removed objects_grouped.sgml
+ from gtk-docs.sgml for now, it doesn't seem useful anymore.
+
+ * gtk/objects_grouped.sgml: Add a section for deprecated
+ objects; add a section for the TextView object collection
+
Wed Oct 18 11:01:12 2000 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am gdk-pixbuf/Makefile.am: Fix typo
diff --git a/docs/reference/gtk/Makefile.am b/docs/reference/gtk/Makefile.am
index bc827b5587..c9052b21c6 100644
--- a/docs/reference/gtk/Makefile.am
+++ b/docs/reference/gtk/Makefile.am
@@ -62,7 +62,8 @@ GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)
content_files = \
- objects_grouped.sgml
+ objects_grouped.sgml \
+ text_widget.sgml
####################################
# Everything below here is generic #
diff --git a/docs/reference/gtk/gtk-docs.sgml b/docs/reference/gtk/gtk-docs.sgml
index 01f2a698a9..637531ddb5 100644
--- a/docs/reference/gtk/gtk-docs.sgml
+++ b/docs/reference/gtk/gtk-docs.sgml
@@ -120,6 +120,7 @@
<!entity index-Object-Tree SYSTEM "sgml/tree_index.sgml">
<!entity index-Objects-Grouped SYSTEM "objects_grouped.sgml">
+<!entity gtk-TextWidget SYSTEM "text_widget.sgml">
]>
<book id="index">
<bookinfo>
@@ -173,6 +174,7 @@ An advanced widget set.
</varlistentry>
</variablelist>
</para>
+
&gtk-General;
&gtk-Feature-Test-Macros;
&gtk-Graphics-Contexts;
@@ -188,120 +190,176 @@ An advanced widget set.
&gtk-Types;
&gtk-Bindings;
&gtk-Standard-Enumerations;
+
</chapter>
- <chapter id="gtkobjects" role="no-toc">
+ <chapter id="gtkobjects" role="no-toc">
<title>GTK+ Widgets and Objects</title>
- &index-Objects-Grouped;
- &GtkAccelLabel;
- &GtkAdjustment;
- &GtkAlignment;
- &GtkArrow;
- &GtkAspectFrame;
- &GtkButtonBox;
- &GtkBin;
- &GtkBox;
- &GtkButton;
- &GtkCalendar;
- &GtkCheckButton;
- &GtkCheckMenuItem;
- &GtkCList;
- &GtkColorSelection;
- &GtkColorSelectionDialog;
- &GtkCombo;
- &GtkContainer;
- &GtkCTree;
- &GtkCurve;
- &GtkData;
- &GtkDialog;
- &GtkDrawingArea;
- &GtkEditable;
- &GtkEntry;
- &GtkEventBox;
- &GtkFileSelection;
- &GtkFixed;
- &GtkFontSelection;
- &GtkFontSelectionDialog;
- &GtkFrame;
- &GtkGammaCurve;
- &GtkHandleBox;
- &GtkHButtonBox;
- &GtkHBox;
- &GtkHPaned;
- &GtkHRuler;
- &GtkHScale;
- &GtkHScrollbar;
- &GtkHSeparator;
- &GtkImage;
- &GtkIMContext;
- &GtkIMMulticontext;
- &GtkInputDialog;
- &GtkInvisible;
- &GtkItem;
- &GtkItemFactory;
- &GtkLabel;
- &GtkLayout;
- &GtkList;
- &GtkListItem;
- &GtkMenu;
- &GtkMenuBar;
- &GtkMenuItem;
- &GtkMenuShell;
- &GtkMisc;
- &GtkNotebook;
- &GtkObject;
- &GtkOptionMenu;
- &GtkPacker;
- &GtkPaned;
- &GtkPixmap;
- &GtkPlug;
- &GtkPreview;
- &GtkProgress;
- &GtkProgressBar;
- &GtkRadioButton;
- &GtkRadioMenuItem;
- &GtkRange;
- &GtkRuler;
- &GtkScale;
- &GtkScrollbar;
- &GtkScrolledWindow;
- &GtkSeparator;
- &GtkSocket;
- &GtkSpinButton;
- &GtkStatusbar;
- &GtkTable;
- &GtkTearoffMenuItem;
- &GtkText;
- &GtkTextBuffer;
- &gtk-GtkTextIter;
- &gtk-GtkTextMark;
- &GtkTextTag;
- &GtkTextTagTable;
- &GtkTextView;
- &GtkTipsQuery;
- &GtkToggleButton;
- &GtkToolbar;
- &GtkTooltips;
- &GtkTree;
- &GtkTreeItem;
- &GtkVButtonBox;
- &GtkVBox;
- &GtkViewport;
- &GtkVPaned;
- &GtkVRuler;
- &GtkVScale;
- &GtkVScrollbar;
- &GtkVSeparator;
- &GtkWidget;
- &GtkWindow;
- </chapter>
-
- <chapter id="gtk-index">
- <title>Index</title>
<sect1>
<title>Object Hierarchy</title>
&index-Object-Tree;
</sect1>
+
+ <sect1 id="WindowWidgets">
+ <title>Windows</title>
+ &GtkDialog;
+ &GtkInvisible;
+ &GtkPlug;
+ &GtkWindow;
+ </sect1>
+
+ <sect1 id="DisplayWidgets">
+ <title>Display Widgets</title>
+ &GtkAccelLabel;
+ &GtkImage;
+ &GtkLabel;
+ &GtkProgressBar;
+ &GtkStatusbar;
+ </sect1>
+
+ <sect1 id="ButtonWidgets">
+ <title>Buttons and Toggles</title>
+ &GtkButton;
+ &GtkCheckButton;
+ &GtkRadioButton;
+ &GtkToggleButton;
+ </sect1>
+
+ <sect1 id="NumericEntry">
+ <title>Numeric/Text Data Entry</title>
+ &GtkEntry;
+ &GtkHScale;
+ &GtkSpinButton;
+ &GtkVScale;
+ </sect1>
+
+ <sect1 id="TextWidgetObjects">
+ <title>Multiline Text Editor</title>
+ &gtk-TextWidget;
+ &gtk-GtkTextIter;
+ &gtk-GtkTextMark;
+ &GtkText;
+ &GtkTextBuffer;
+ &GtkTextTag;
+ &GtkTextTagTable;
+ &GtkTextView;
+ </sect1>
+
+
+ <sect1 id="MenusAndCombos">
+ <title>Menus, Combo Box, Toolbar</title>
+ &GtkCheckMenuItem;
+ &GtkCombo;
+ &GtkItemFactory;
+ &GtkMenu;
+ &GtkMenuBar;
+ &GtkMenuItem;
+ &GtkMenuShell;
+ &GtkOptionMenu;
+ &GtkRadioMenuItem;
+ &GtkTearoffMenuItem;
+ &GtkToolbar;
+ </sect1>
+
+ <sect1 id="SelectorWidgets">
+ <title>Selectors (File/Font/Color/Input Devices)</title>
+ &GtkColorSelection;
+ &GtkColorSelectionDialog;
+ &GtkFileSelection;
+ &GtkFontSelection;
+ &GtkFontSelectionDialog;
+ &GtkInputDialog;
+ </sect1>
+
+ <sect1 id="LayoutContainers">
+ <title>Layout Containers</title>
+ &GtkAlignment;
+ &GtkAspectFrame;
+ &GtkHBox;
+ &GtkHButtonBox;
+ &GtkFixed;
+ &GtkHPaned;
+ &GtkLayout;
+ &GtkNotebook;
+ &GtkTable;
+ &GtkVButtonBox;
+ &GtkVBox;
+ &GtkVPaned;
+ </sect1>
+
+ <sect1 id="Ornaments">
+ <title>Ornaments</title>
+ &GtkFrame;
+ &GtkHSeparator;
+ &GtkVSeparator;
+ </sect1>
+
+ <sect1 id="ScrollingWidgets">
+ <title>Scrolling</title>
+ &GtkHScrollbar;
+ &GtkScrolledWindow;
+ &GtkVScrollbar;
+ </sect1>
+
+ <sect1 id="MiscObjects">
+ <title>Miscellaneous</title>
+ &GtkAdjustment;
+ &GtkArrow;
+ &GtkCalendar;
+ &GtkDrawingArea;
+ &GtkEventBox;
+ &GtkHandleBox;
+ &GtkIMContext;
+ &GtkIMMulticontext;
+ &GtkTooltips;
+ &GtkViewport;
+ </sect1>
+
+ <sect1 id="AbstractObjects">
+ <title>Abstract Base Classes</title>
+ &GtkBin;
+ &GtkBox;
+ &GtkContainer;
+ &GtkEditable;
+ &GtkButtonBox;
+ &GtkMisc;
+ &GtkObject;
+ &GtkPaned;
+ &GtkRange;
+ &GtkScale;
+ &GtkScrollbar;
+ &GtkSeparator;
+ &GtkWidget;
+ </sect1>
+
+ <sect1 id="PlugSocket">
+ <title>Cross-process Embedding</title>
+ &GtkSocket;
+ </sect1>
+
+ <sect1 id="DeprecatedObjects">
+ <title>Deprecated</title>
+ &GtkCList;
+ &GtkCTree;
+ &GtkCurve;
+ &GtkData;
+ &GtkGammaCurve;
+ &GtkHRuler;
+ &GtkItem;
+ &GtkList;
+ &GtkListItem;
+ &GtkPacker;
+ &GtkPixmap;
+ &GtkPreview;
+ &GtkProgress;
+ &GtkRuler;
+ &GtkTipsQuery;
+ &GtkTree;
+ &GtkTreeItem;
+ &GtkVRuler;
+ </sect1>
+
</chapter>
+
</book>
diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt
index 44d27b38d3..7f419e6b7a 100644
--- a/docs/reference/gtk/gtk-sections.txt
+++ b/docs/reference/gtk/gtk-sections.txt
@@ -1951,7 +1951,6 @@ GTK_IS_TEXT_CLASS
<SECTION>
<FILE>gtktextbuffer</FILE>
-GtkTextBTree
<TITLE>GtkTextBuffer</TITLE>
gtk_text_buffer_new
gtk_text_buffer_get_line_count
diff --git a/docs/reference/gtk/objects_grouped.sgml b/docs/reference/gtk/objects_grouped.sgml
index 3b546dc9c3..db8f91d9b4 100644
--- a/docs/reference/gtk/objects_grouped.sgml
+++ b/docs/reference/gtk/objects_grouped.sgml
@@ -46,25 +46,31 @@
<emphasis>Data Entry Widgets</emphasis>
<link linkend="GtkEntry">GtkEntry</link>
- <link linkend="GtkText">GtkText</link>
<link linkend="GtkSpinButton">GtkSpinButton</link>
+ <link linkend="GtkTextView">GtkTextView</link>
<link linkend="GtkOptionMenu">GtkOptionMenu</link>
<link linkend="GtkCombo">GtkCombo</link>
<link linkend="GtkHScale">GtkHScale</link>
<link linkend="GtkVScale">GtkVScale</link>
+
<emphasis>Lists &amp; Trees</emphasis>
<link linkend="GtkCList">GtkCList</link>
<link linkend="GtkCTree">GtkCTree</link>
<link linkend="GtkList">GtkList</link>
<link linkend="GtkListItem">GtkListItem</link>
- <link linkend="GtkTree">GtkTree</link>
- <link linkend="GtkTreeItem">GtkTreeItem</link>
+
+<emphasis>Text Widget Objects</emphasis>
+ <link linkend="GtkTextBuffer">GtkTextBuffer</link>
+ <link linkend="GtkTextTag">GtkTextTag</link>
+ <link linkend="GtkTextTagTable">GtkTextTagTable</link>
+ <link linkend="GtkTextView">GtkTextView</link>
<emphasis>Tooltips</emphasis>
<link linkend="GtkTooltips">GtkTooltips</link>
<link linkend="GtkTipsQuery">GtkTipsQuery</link>
</literallayout></entry>
+
<entry><literallayout>
<emphasis>Menus &amp; Menu Bars</emphasis>
<link linkend="GtkMenuBar">GtkMenuBar</link>
@@ -96,6 +102,7 @@
<link linkend="GtkColorSelection">GtkColorSelection</link>
<link linkend="GtkFontSelection">GtkFontSelection</link>
</literallayout></entry>
+
<entry><literallayout>
<emphasis>Abstract Base Classes</emphasis>
<link linkend="GtkWidget">GtkWidget</link>
@@ -126,5 +133,12 @@
<link linkend="GtkItemFactory">GtkItemFactory</link>
<link linkend="GtkInvisible">GtkInvisible</link>
</literallayout></entry>
+
+<entry><literallayout>
+<emphasis>Deprecated Objects</emphasis>
+ <link linkend="GtkText">GtkText</link>
+ <link linkend="GtkTree">GtkTree</link>
+ <link linkend="GtkTreeItem">GtkTreeItem</link>
+</literallayout></entry>
</row>
</tbody></tgroup></informaltable>
diff --git a/docs/reference/gtk/text_widget.sgml b/docs/reference/gtk/text_widget.sgml
new file mode 100644
index 0000000000..776f079533
--- /dev/null
+++ b/docs/reference/gtk/text_widget.sgml
@@ -0,0 +1,127 @@
+<refentry id="TextWidget" revision="18 Oct 2000">
+<refmeta>
+<refentrytitle>Text Widget Overview</refentrytitle>
+<manvolnum>3</manvolnum>
+<refmiscinfo>GTK Library</refmiscinfo>
+</refmeta>
+
+<refnamediv>
+<refname>Text Widget Overview</refname><refpurpose>Overview of <link linkend="GtkTextBuffer">GtkTextBuffer</link>, <link linkend="GtkTextView">GtkTextView</link>, and friends</refpurpose>
+</refnamediv>
+
+<refsect1>
+<title>Conceptual Overview</title>
+
+<para>
+GTK+ has an extremely powerful framework for multiline text editing. The
+primary objects involved in the process are <link
+linkend="GtkTextBuffer">GtkTextBuffer</link>, which represents the text being
+edited, and <link linkend="GtkTextView">GtkTextView</link>, a widget which can
+display a <link linkend="GtkTextBuffer">GtkTextBuffer</link>. Each buffer can be
+displayed by any number of views.
+</para>
+
+<para>
+Text in a buffer can be marked with <firstterm>tags</firstterm>. A tag is an
+attribute that can be applied to some range of text. For example, a tag might be
+called "bold" and make the text inside the tag bold. However, the tag concept is
+more general than that; tags don't have to affect appearance. They can instead
+affect change the behavior of mouse and key presses, "lock" a range of text so
+the user can't edit it, or countless other things. A tag is represented by a
+<link linkend="GtkTextTag">GtkTextTag</link> object. One <link
+linkend="GtkTextTag">GtkTextTag</link> can be applied to any number of text
+ranges in any number of buffers.
+</para>
+
+<para>
+Each tag is stored in a <link
+linkend="GtkTextTagTable">GtkTextTagTable</link>. A tag table defines a set of
+tags that can be used together. Each buffer has one tag table associated with
+it; only tags from that tag table can be used with the buffer. A single tag
+table can be shared between multiple buffers, however.
+</para>
+
+<para>
+Tags can have names, which is convenient sometimes (for example, you can name
+your tag that makes things bold "bold"), but they can also be anonymous (which
+is convenient if you're creating tags on-the-fly).
+</para>
+
+<para>
+Most text manipulation is accomplished with <firstterm>iterators</firstterm>,
+represented by a <link linkend="GtkTextIter">GtkTextIter</link>. An iterator
+represents a position in the text buffer. <link
+linkend="GtkTextIter">GtkTextIter</link> is a struct designed to be allocated on
+the stack; it's guaranteed to be copiable by value and never contain any
+heap-allocated data. Iterators are not valid indefinitely; whenever the buffer
+is modified in a way that affects the number of characters in the buffer, all
+outstanding iterators become invalid. (Note that deleting 5 characters and then
+reinserting 5 still invalidates iterators, though you end up with the same
+number of characters).
+</para>
+
+<para>
+Because of this, iterators can't be used to preserve positions across buffer
+modifications. To preserve a position, the <link
+linkend="GtkTextMark">GtkTextMark</link> object is ideal. You can think of a
+mark as an invisible cursor or insertion point; it floats in the buffer, saving
+a position. If the text surrounding the mark is deleted, the mark remains in the
+position the text once occupied; if text is inserted at the mark, the mark ends
+up either to the left or to the right of the new text, depending on its
+<firstterm>gravity</firstterm>. The standard text cursor in left-to-right
+languages is a mark with right gravity, because it stays to the right of
+inserted text.
+</para>
+
+<para>
+Like tags, marks can be either named or anonymous. There are two marks built-in
+to <link linkend="GtkTextBuffer">GtkTextBuffer</link>; these are named
+<literal>"insert"</literal> and <literal>"selection_bound"</literal> and refer
+to the insertion point and the boundary of the selection which is not the
+insertion point, respectively. If no text is selected, these two marks will be
+in the same position. You can manipulate what is selected and where the cursor
+appears by moving these marks around.
+
+<footnote>
+<para>
+If you want to place the cursor in response to a user action, be sure to use
+gtk_text_buffer_place_cursor(), which moves both at once without causing a
+temporary selection (moving one then the other temporarily selects the range in
+between the old and new positions).
+</para>
+</footnote>
+</para>
+
+</refsect1>
+
+
+<refsect1>
+<title>Simple Example</title>
+
+<para>
+The simplest usage of <link linkend="GtkTextView">GtkTextView</link>
+might look like this:
+<programlisting>
+
+ /* Get a buffer (it's a GObject, not a GtkObject, so we own a reference
+ * after this). Passing NULL as argument causes an empty tag table to be
+ * automatically created.
+ */
+
+ buffer = gtk_text_buffer_new (NULL);
+
+ view = gtk_text_view_new_with_buffer (buffer);
+
+ /* view holds a reference now */
+ g_object_unref (G_OBJECT (buffer));
+
+ /* Now you might put the view in a container and display it on the
+ * screen; when the user edits the text, signals on the buffer
+ * will be emitted, such as "changed", "insert_text", and so on.
+ */
+</programlisting>
+</para>
+
+</refsect1>
+
+</refentry>
diff --git a/docs/reference/gtk/tmpl/gtktextbuffer.sgml b/docs/reference/gtk/tmpl/gtktextbuffer.sgml
index cd8a16a348..102d2f22cb 100644
--- a/docs/reference/gtk/tmpl/gtktextbuffer.sgml
+++ b/docs/reference/gtk/tmpl/gtktextbuffer.sgml
@@ -3,15 +3,24 @@ GtkTextBuffer
<!-- ##### SECTION Short_Description ##### -->
+Stores attributed text for display in a <link
+linkend="GtkTextView">GtkTextView</link>
<!-- ##### SECTION Long_Description ##### -->
+
+<para>
+You may wish to begin by reading the <link linkend="TextWidget">text widget
+conceptual overview</link> which gives an overview of all the objects and data
+types related to the text widget and how they work together.
+</para>
+
<para>
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
-
+#GtkTextView, #GtkTextIter, #GtkTextMark
</para>
<!-- ##### STRUCT GtkTextBTree ##### -->
diff --git a/docs/reference/gtk/tmpl/gtktextiter.sgml b/docs/reference/gtk/tmpl/gtktextiter.sgml
index bee274eb6e..eac93cacc8 100644
--- a/docs/reference/gtk/tmpl/gtktextiter.sgml
+++ b/docs/reference/gtk/tmpl/gtktextiter.sgml
@@ -1,11 +1,17 @@
<!-- ##### SECTION Title ##### -->
-gtktextiter
+GtkTextIter
<!-- ##### SECTION Short_Description ##### -->
-
+Text buffer iterator
<!-- ##### SECTION Long_Description ##### -->
<para>
+You may wish to begin by reading the <link linkend="TextWidget">text widget
+conceptual overview</link> which gives an overview of all the objects and data
+types related to the text widget and how they work together.
+</para>
+
+<para>
</para>
diff --git a/docs/reference/gtk/tmpl/gtktextmark.sgml b/docs/reference/gtk/tmpl/gtktextmark.sgml
index 1e7d2681a3..dccd4e46fe 100644
--- a/docs/reference/gtk/tmpl/gtktextmark.sgml
+++ b/docs/reference/gtk/tmpl/gtktextmark.sgml
@@ -1,12 +1,51 @@
<!-- ##### SECTION Title ##### -->
-gtktextmark
+GtkTextMark
<!-- ##### SECTION Short_Description ##### -->
+A position in the buffer preserved across buffer modifications
<!-- ##### SECTION Long_Description ##### -->
<para>
+You may wish to begin by reading the <link linkend="TextWidget">text widget
+conceptual overview</link> which gives an overview of all the objects and data
+types related to the text widget and how they work together.
+</para>
+<para>
+A #GtkTextMark is like a bookmark in a text buffer; it preserves a position in
+the text. You can convert the mark to an iterator using
+gtk_text_buffer_get_iter_at_mark(). Unlike iterators, marks remain valid across
+buffer mutations, because their behavior is defined when text is inserted or
+deleted. When text containing a mark is deleted, the mark remains in the
+position originally occupied by the deleted text. When text is inserted at a
+mark, a mark with <firstterm>left gravity</firstterm> will be moved to the
+beginning of the newly-inserted text, and a mark with <firstterm>right
+gravity</firstterm> will be moved to the end.
+
+<footnote>
+<para>
+"left" and "right" here refer to logical direction (left is the toward the start
+of the buffer); in some languages such as Hebrew the logically-leftmost text is
+not actually on the left when displayed.
+</para>
+</footnote>
+</para>
+
+<para>
+Marks are reference counted, but the reference count only controls the validity
+of the memory; marks can be deleted from the buffer at any time with
+gtk_text_buffer_delete_mark(). Once deleted from the buffer, a mark is
+essentially useless.
+</para>
+
+<para>
+Marks optionally have names; these can be convenient to avoid passing the
+#GtkTextMark object around.
+</para>
+
+<para>
+Marks are typically created using the gtk_text_buffer_create_mark() function.
</para>
<!-- ##### SECTION See_Also ##### -->
diff --git a/docs/reference/gtk/tmpl/gtktexttag.sgml b/docs/reference/gtk/tmpl/gtktexttag.sgml
index 6bf264242e..41e0a1b502 100644
--- a/docs/reference/gtk/tmpl/gtktexttag.sgml
+++ b/docs/reference/gtk/tmpl/gtktexttag.sgml
@@ -3,9 +3,16 @@ GtkTextTag
<!-- ##### SECTION Short_Description ##### -->
+A tag that can be applied to text in a <link linkend="GtkTextBuffer">GtkTextBuffer</link>
<!-- ##### SECTION Long_Description ##### -->
<para>
+You may wish to begin by reading the <link linkend="TextWidget">text widget
+conceptual overview</link> which gives an overview of all the objects and data
+types related to the text widget and how they work together.
+</para>
+
+<para>
</para>
diff --git a/docs/reference/gtk/tmpl/gtktexttagtable.sgml b/docs/reference/gtk/tmpl/gtktexttagtable.sgml
index 26f7ce2e39..be207363f4 100644
--- a/docs/reference/gtk/tmpl/gtktexttagtable.sgml
+++ b/docs/reference/gtk/tmpl/gtktexttagtable.sgml
@@ -3,9 +3,16 @@ GtkTextTagTable
<!-- ##### SECTION Short_Description ##### -->
+Collection of tags that can be used together
<!-- ##### SECTION Long_Description ##### -->
<para>
+You may wish to begin by reading the <link linkend="TextWidget">text widget
+conceptual overview</link> which gives an overview of all the objects and data
+types related to the text widget and how they work together.
+</para>
+
+<para>
</para>
diff --git a/docs/reference/gtk/tmpl/gtktextview.sgml b/docs/reference/gtk/tmpl/gtktextview.sgml
index 9f36a4eaec..e26818c40a 100644
--- a/docs/reference/gtk/tmpl/gtktextview.sgml
+++ b/docs/reference/gtk/tmpl/gtktextview.sgml
@@ -2,16 +2,22 @@
GtkTextView
<!-- ##### SECTION Short_Description ##### -->
-
+Widget that displays a <link linkend="GtkTextBuffer">GtkTextBuffer</link>
<!-- ##### SECTION Long_Description ##### -->
<para>
+You may wish to begin by reading the <link linkend="TextWidget">text widget
+conceptual overview</link> which gives an overview of all the objects and data
+types related to the text widget and how they work together.
+</para>
+
+<para>
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
-
+#GtkTextBuffer, #GtkTextIter
</para>
<!-- ##### STRUCT GtkTextView ##### -->
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index 79592c944e..d2c7e40164 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -28,6 +28,16 @@
#include "gdkinternals.h"
#include "gdkwindow.h"
+static GdkDrawable* gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint *composite_x_offset,
+ gint *composite_y_offset);
+
+static void gdk_drawable_class_init (GdkDrawableClass *klass);
+
GType
gdk_drawable_get_type (void)
{
@@ -40,7 +50,7 @@ gdk_drawable_get_type (void)
sizeof (GdkDrawableClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
- (GClassInitFunc) NULL,
+ (GClassInitFunc) gdk_drawable_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDrawable),
@@ -56,6 +66,12 @@ gdk_drawable_get_type (void)
return object_type;
}
+static void
+gdk_drawable_class_init (GdkDrawableClass *klass)
+{
+ klass->get_composite_drawable = gdk_drawable_real_get_composite_drawable;
+}
+
/* Manipulation of drawables
*/
@@ -323,6 +339,10 @@ gdk_draw_drawable (GdkDrawable *drawable,
gint width,
gint height)
{
+ GdkDrawable *composite;
+ gint composite_x_offset = 0;
+ gint composite_y_offset = 0;
+
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (src != NULL);
g_return_if_fail (GDK_IS_GC (gc));
@@ -340,9 +360,22 @@ gdk_draw_drawable (GdkDrawable *drawable,
height = real_height;
}
- GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc, src,
- xsrc, ysrc, xdest, ydest,
+
+ composite =
+ GDK_DRAWABLE_GET_CLASS (src)->get_composite_drawable (src,
+ xsrc, ysrc,
+ width, height,
+ &composite_x_offset,
+ &composite_y_offset);
+
+
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc, composite,
+ xsrc - composite_x_offset,
+ ysrc - composite_y_offset,
+ xdest, ydest,
width, height);
+
+ g_object_unref (G_OBJECT (composite));
}
void
@@ -430,7 +463,6 @@ gdk_draw_glyphs (GdkDrawable *drawable,
gint y,
PangoGlyphString *glyphs)
{
-
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (GDK_IS_GC (gc));
@@ -439,3 +471,54 @@ gdk_draw_glyphs (GdkDrawable *drawable,
}
+GdkImage*
+gdk_drawable_get_image (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ GdkDrawable *composite;
+ gint composite_x_offset = 0;
+ gint composite_y_offset = 0;
+ GdkImage *retval;
+
+ g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
+ g_return_val_if_fail (x >= 0, NULL);
+ g_return_val_if_fail (y >= 0, NULL);
+ g_return_val_if_fail (width >= 0, NULL);
+ g_return_val_if_fail (height >= 0, NULL);
+
+ composite =
+ GDK_DRAWABLE_GET_CLASS (drawable)->get_composite_drawable (drawable,
+ x, y,
+ width, height,
+ &composite_x_offset,
+ &composite_y_offset);
+
+ retval = GDK_DRAWABLE_GET_CLASS (composite)->get_image (composite,
+ x - composite_x_offset,
+ y - composite_y_offset,
+ width, height);
+
+ g_object_unref (G_OBJECT (composite));
+
+ return retval;
+}
+
+static GdkDrawable*
+gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint *composite_x_offset,
+ gint *composite_y_offset)
+{
+ g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
+
+ *composite_x_offset = 0;
+ *composite_y_offset = 0;
+
+ return GDK_DRAWABLE (g_object_ref (G_OBJECT (drawable)));
+}
diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h
index 0091858ef5..e177ca81a1 100644
--- a/gdk/gdkdrawable.h
+++ b/gdk/gdkdrawable.h
@@ -113,6 +113,21 @@ struct _GdkDrawableClass
GdkColormap* (*get_colormap) (GdkDrawable *drawable);
GdkVisual* (*get_visual) (GdkDrawable *drawable);
+
+ GdkImage* (*get_image) (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+
+ GdkDrawable* (*get_composite_drawable) (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint *composite_x_offset,
+ gint *composite_y_offset);
+
};
GType gdk_drawable_get_type (void);
@@ -239,6 +254,12 @@ void gdk_draw_layout (GdkDrawable *drawable,
gint y,
PangoLayout *layout);
+GdkImage* gdk_drawable_get_image (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/gdk/gdkimage.c b/gdk/gdkimage.c
index 7fcaf637ff..7438c51c6c 100644
--- a/gdk/gdkimage.c
+++ b/gdk/gdkimage.c
@@ -43,3 +43,19 @@ gdk_image_unref (GdkImage *image)
g_object_unref (G_OBJECT (image));
}
+
+GdkImage*
+gdk_image_get (GdkWindow *window,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ g_return_val_if_fail (GDK_IS_DRAWABLE (window), NULL);
+ g_return_val_if_fail (x >= 0, NULL);
+ g_return_val_if_fail (y >= 0, NULL);
+ g_return_val_if_fail (width >= 0, NULL);
+ g_return_val_if_fail (height >= 0, NULL);
+
+ return gdk_drawable_get_image (window, x, y, width, height);
+}
diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c
index 2a318651fd..8b44d87287 100644
--- a/gdk/gdkpixmap.c
+++ b/gdk/gdkpixmap.c
@@ -107,6 +107,13 @@ static void gdk_pixmap_real_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
+static GdkImage* gdk_pixmap_get_image (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+
+
static GdkVisual* gdk_pixmap_real_get_visual (GdkDrawable *drawable);
static gint gdk_pixmap_real_get_depth (GdkDrawable *drawable);
static void gdk_pixmap_real_set_colormap (GdkDrawable *drawable,
@@ -181,6 +188,7 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
drawable_class->set_colormap = gdk_pixmap_real_set_colormap;
drawable_class->get_colormap = gdk_pixmap_real_get_colormap;
drawable_class->get_visual = gdk_pixmap_real_get_visual;
+ drawable_class->get_image = gdk_pixmap_get_image;
}
static void
@@ -410,6 +418,19 @@ gdk_pixmap_real_get_colormap (GdkDrawable *drawable)
return gdk_drawable_get_colormap (((GdkPixmapObject*)drawable)->impl);
}
+static GdkImage*
+gdk_pixmap_get_image (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ g_return_val_if_fail (GDK_IS_PIXMAP (drawable), NULL);
+
+ return gdk_drawable_get_image (((GdkPixmapObject*)drawable)->impl,
+ x, y, width, height);
+}
+
#define PACKED_COLOR(c) ((((c)->red & 0xff) << 8) | ((c)->green & 0xff) | ((c)->blue >> 8))
static GdkPixmap *
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index d804aa2682..70851b01f5 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -28,6 +28,8 @@
#include "gdkinternals.h"
#include "gdk.h" /* For gdk_rectangle_union() */
#include "gdkpixmap.h"
+#include "gdkdrawable.h"
+#include "gdkpixmap.h"
#ifndef USE_BACKING_STORE
#ifndef GDK_WINDOWING_WIN32
@@ -120,6 +122,12 @@ static void gdk_window_draw_image (GdkDrawable *drawable,
gint width,
gint height);
+static GdkImage* gdk_window_get_image (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+
static void gdk_window_real_get_size (GdkDrawable *drawable,
gint *width,
@@ -130,7 +138,15 @@ static gint gdk_window_real_get_depth (GdkDrawable *drawable);
static void gdk_window_real_set_colormap (GdkDrawable *drawable,
GdkColormap *cmap);
static GdkColormap* gdk_window_real_get_colormap (GdkDrawable *drawable);
-
+
+static GdkDrawable* gdk_window_get_composite_drawable (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint *composite_x_offset,
+ gint *composite_y_offset);
+
static void gdk_window_free_paint_stack (GdkWindow *window);
static void gdk_window_init (GdkWindowObject *window);
@@ -204,6 +220,8 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
drawable_class->set_colormap = gdk_window_real_set_colormap;
drawable_class->get_colormap = gdk_window_real_get_colormap;
drawable_class->get_visual = gdk_window_real_get_visual;
+ drawable_class->get_image = gdk_window_get_image;
+ drawable_class->get_composite_drawable = gdk_window_get_composite_drawable;
}
static void
@@ -650,12 +668,20 @@ gdk_window_paint_init_bg (GdkWindow *window,
GdkRegion *init_region)
{
GdkGC *tmp_gc;
-
+
tmp_gc = gdk_window_get_bg_gc (window, paint);
+
+ gdk_region_offset (init_region,
+ - paint->x_offset,
+ - paint->y_offset);
+ gdk_gc_set_clip_region (tmp_gc, init_region);
+
gdk_draw_rectangle (paint->pixmap, tmp_gc, TRUE, 0, 0, -1, -1);
gdk_gc_unref (tmp_gc);
}
-
+
+
+#include "x11/gdkx.h"
void
gdk_window_begin_paint_region (GdkWindow *window,
GdkRegion *region)
@@ -697,11 +723,13 @@ gdk_window_begin_paint_region (GdkWindow *window,
if (new_rect.width > old_rect.width || new_rect.height > old_rect.height)
{
- paint->pixmap = gdk_pixmap_new (window, new_rect.width, new_rect.height, -1);
+ paint->pixmap = gdk_pixmap_new (window,
+ new_rect.width, new_rect.height, -1);
tmp_gc = gdk_gc_new (paint->pixmap);
gdk_draw_drawable (paint->pixmap, tmp_gc, tmp_paint->pixmap,
- 0, 0, old_rect.width, old_rect.height,
- old_rect.x - new_rect.x, old_rect.y - new_rect.y);
+ 0, 0,
+ old_rect.x - new_rect.x, old_rect.y - new_rect.y,
+ old_rect.width, old_rect.height);
gdk_gc_unref (tmp_gc);
gdk_drawable_unref (tmp_paint->pixmap);
@@ -711,13 +739,13 @@ gdk_window_begin_paint_region (GdkWindow *window,
tmp_list = private->paint_stack;
while (tmp_list)
{
- tmp_paint = private->paint_stack->data;
+ tmp_paint = tmp_list->data;
gdk_region_subtract (init_region, tmp_paint->region);
tmp_paint->pixmap = paint->pixmap;
tmp_paint->x_offset = paint->x_offset;
- tmp_paint->y_offset = paint->x_offset;
-
+ tmp_paint->y_offset = paint->y_offset;
+
tmp_list = tmp_list->next;
}
}
@@ -730,7 +758,7 @@ gdk_window_begin_paint_region (GdkWindow *window,
tmp_list = private->paint_stack;
while (tmp_list)
{
- tmp_paint = private->paint_stack->data;
+ tmp_paint = tmp_list->data;
gdk_region_subtract (init_region, tmp_paint->region);
tmp_list = tmp_list->next;
@@ -746,6 +774,7 @@ gdk_window_begin_paint_region (GdkWindow *window,
if (!gdk_region_empty (init_region))
gdk_window_paint_init_bg (window, paint, init_region);
+
gdk_region_destroy (init_region);
private->paint_stack = g_slist_prepend (private->paint_stack, paint);
@@ -796,7 +825,7 @@ gdk_window_end_paint (GdkWindow *window)
{
GdkWindowPaint *tmp_paint = tmp_list->data;
gdk_region_subtract (tmp_paint->region, paint->region);
-
+
tmp_list = tmp_list->next;
}
}
@@ -1048,6 +1077,138 @@ gdk_window_draw_text_wc (GdkDrawable *drawable,
RESTORE_GC (gc);
}
+static GdkDrawable*
+gdk_window_get_composite_drawable (GdkDrawable *window,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint *composite_x_offset,
+ gint *composite_y_offset)
+{
+ GdkWindowObject *private = (GdkWindowObject *)window;
+ GdkWindowPaint *paint;
+ GdkRegion *buffered_region;
+ GSList *tmp_list;
+ GdkPixmap *buffer;
+ GdkPixmap *tmp_pixmap;
+ GdkRectangle rect;
+ GdkRegion *rect_region;
+ GdkGC *tmp_gc;
+ gint windowing_x_offset, windowing_y_offset;
+ gint buffer_x_offset, buffer_y_offset;
+
+ if (GDK_WINDOW_DESTROYED (window) || private->paint_stack == NULL)
+ {
+ /* No backing store */
+ _gdk_windowing_window_get_offsets (window,
+ composite_x_offset,
+ composite_y_offset);
+
+ return GDK_DRAWABLE (g_object_ref (G_OBJECT (window)));
+ }
+
+ buffered_region = NULL;
+ buffer = NULL;
+
+ /* All GtkWindowPaint structs have the same pixmap and offsets, just
+ * get the first one. (should probably be cleaned up so that the
+ * pixmap is stored in the window)
+ */
+ paint = private->paint_stack->data;
+ buffer = paint->pixmap;
+ buffer_x_offset = paint->x_offset;
+ buffer_y_offset = paint->y_offset;
+
+ tmp_list = private->paint_stack;
+ while (tmp_list != NULL)
+ {
+ paint = tmp_list->data;
+
+ if (buffered_region == NULL)
+ buffered_region = gdk_region_copy (paint->region);
+ else
+ gdk_region_union (buffered_region, paint->region);
+
+ tmp_list = g_slist_next (tmp_list);
+ }
+
+ /* See if the buffered part is overlapping the part we want
+ * to get
+ */
+ rect.x = x;
+ rect.y = y;
+ rect.width = width;
+ rect.height = height;
+
+ rect_region = gdk_region_rectangle (&rect);
+
+ gdk_region_intersect (buffered_region, rect_region);
+
+ gdk_region_destroy (rect_region);
+
+ if (gdk_region_empty (buffered_region))
+ {
+ gdk_region_destroy (buffered_region);
+
+ _gdk_windowing_window_get_offsets (window,
+ composite_x_offset,
+ composite_y_offset);
+
+ return GDK_DRAWABLE (g_object_ref (G_OBJECT (window)));
+ }
+
+ tmp_pixmap = gdk_pixmap_new (window,
+ width, height,
+ -1);
+
+ tmp_gc = gdk_gc_new (tmp_pixmap);
+
+ _gdk_windowing_window_get_offsets (window,
+ &windowing_x_offset,
+ &windowing_y_offset);
+
+ /* Copy the current window contents */
+ gdk_draw_drawable (tmp_pixmap,
+ tmp_gc,
+ private->impl,
+ x - windowing_x_offset,
+ y - windowing_y_offset,
+ 0, 0,
+ width, height);
+
+ /* Make buffered_region relative to the tmp_pixmap */
+ gdk_region_offset (buffered_region,
+ - x,
+ - y);
+
+ /* Set the clip mask to avoid drawing over non-buffered areas of
+ * tmp_pixmap.
+ */
+
+ gdk_gc_set_clip_region (tmp_gc, buffered_region);
+ gdk_region_destroy (buffered_region);
+
+ /* Draw backing pixmap onto the tmp_pixmap, offsetting
+ * appropriately.
+ */
+ gdk_draw_drawable (tmp_pixmap,
+ tmp_gc,
+ buffer,
+ x - buffer_x_offset,
+ y - buffer_y_offset,
+ 0, 0,
+ width, height);
+
+ /* Set these to location of tmp_pixmap within the window */
+ *composite_x_offset = x;
+ *composite_y_offset = y;
+
+ g_object_unref (G_OBJECT (tmp_gc));
+
+ return tmp_pixmap;
+}
+
static void
gdk_window_draw_drawable (GdkDrawable *drawable,
GdkGC *gc,
@@ -1061,21 +1222,25 @@ gdk_window_draw_drawable (GdkDrawable *drawable,
{
GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
-
+
if (GDK_WINDOW_DESTROYED (drawable))
return;
-
+
+ /* If we have a backing pixmap draw to that */
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
- gdk_draw_drawable (paint->pixmap, gc, src, xsrc, ysrc,
+ gdk_draw_drawable (paint->pixmap, gc,
+ src, xsrc, ysrc,
xdest - x_offset, ydest - y_offset, width, height);
}
else
- gdk_draw_drawable (private->impl, gc, src, xsrc, ysrc,
+ gdk_draw_drawable (private->impl, gc,
+ src, xsrc, ysrc,
xdest - x_offset, ydest - y_offset,
width, height);
+
RESTORE_GC (gc);
}
@@ -1403,6 +1568,32 @@ gdk_window_real_get_colormap (GdkDrawable *drawable)
return gdk_drawable_get_colormap (((GdkWindowObject*)drawable)->impl);
}
+
+static GdkImage*
+gdk_window_get_image (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ gint x_offset, y_offset;
+
+ g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
+
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return NULL;
+
+ /* If we're here, a composite image was not necessary, so
+ * we can ignore the paint stack.
+ */
+
+ _gdk_windowing_window_get_offsets (drawable, &x_offset, &y_offset);
+
+ return gdk_drawable_get_image (((GdkWindowObject*)drawable)->impl,
+ x - x_offset,
+ y - y_offset,
+ width, height);
+}
/* Code for dirty-region queueing
*/
diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c
index 9ccf8b8117..058c447265 100644
--- a/gdk/x11/gdkdrawable-x11.c
+++ b/gdk/x11/gdkdrawable-x11.c
@@ -121,6 +121,8 @@ static GdkColormap* gdk_x11_get_colormap (GdkDrawable *drawable);
static gint gdk_x11_get_depth (GdkDrawable *drawable);
+static GdkVisual* gdk_x11_get_visual (GdkDrawable *drawable);
+
static void gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass);
static gpointer parent_class = NULL;
@@ -177,6 +179,9 @@ gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
drawable_class->get_colormap = gdk_x11_get_colormap;
drawable_class->get_depth = gdk_x11_get_depth;
+ drawable_class->get_visual = gdk_x11_get_visual;
+
+ drawable_class->get_image = _gdk_x11_get_image;
}
/*****************************************************
@@ -412,13 +417,19 @@ gdk_x11_draw_drawable (GdkDrawable *drawable,
int src_depth = gdk_drawable_get_depth (src);
int dest_depth = gdk_drawable_get_depth (drawable);
GdkDrawableImplX11 *impl;
-
+ GdkDrawableImplX11 *src_impl;
+
impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
+ if (GDK_IS_DRAWABLE_IMPL_X11 (src))
+ src_impl = GDK_DRAWABLE_IMPL_X11 (src);
+ else
+ src_impl = NULL;
if (src_depth == 1)
{
XCopyArea (impl->xdisplay,
- GDK_DRAWABLE_XID (src),
+ src_impl ? src_impl->xid : GDK_DRAWABLE_XID (src),
impl->xid,
GDK_GC_GET_XGC (gc),
xsrc, ysrc,
@@ -428,7 +439,7 @@ gdk_x11_draw_drawable (GdkDrawable *drawable,
else if (dest_depth != 0 && src_depth == dest_depth)
{
XCopyArea (impl->xdisplay,
- GDK_DRAWABLE_XID (src),
+ src_impl ? src_impl->xid : GDK_DRAWABLE_XID (src),
impl->xid,
GDK_GC_GET_XGC (gc),
xsrc, ysrc,
@@ -436,7 +447,8 @@ gdk_x11_draw_drawable (GdkDrawable *drawable,
xdest, ydest);
}
else
- g_warning ("Attempt to copy between drawables of mismatched depths!\n");
+ g_warning ("Attempt to draw a drawable with depth %d to a drawable with depth %d",
+ src_depth, dest_depth);
}
static void
@@ -603,3 +615,8 @@ gdk_x11_get_depth (GdkDrawable *drawable)
return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper);
}
+static GdkVisual*
+gdk_x11_get_visual (GdkDrawable *drawable)
+{
+ return gdk_drawable_get_visual (GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper);
+}
diff --git a/gdk/x11/gdkgc-x11.c b/gdk/x11/gdkgc-x11.c
index b5ec1d941e..1305004344 100644
--- a/gdk/x11/gdkgc-x11.c
+++ b/gdk/x11/gdkgc-x11.c
@@ -650,7 +650,7 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
gc->clip_y_origin = 0;
x11_gc->dirty_mask |= GDK_GC_DIRTY_CLIP;
-}
+}
void
gdk_gc_set_clip_region (GdkGC *gc,
diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c
index fea5c5bbfd..519ff27896 100644
--- a/gdk/x11/gdkimage-x11.c
+++ b/gdk/x11/gdkimage-x11.c
@@ -371,31 +371,44 @@ gdk_image_new (GdkImageType type,
}
GdkImage*
-gdk_image_get (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
+_gdk_x11_get_image (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
GdkImage *image;
GdkImagePrivateX11 *private;
+ GdkDrawableImplX11 *impl;
+ GdkVisual *visual;
+
+ g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL_X11 (drawable), NULL);
- g_return_val_if_fail (GDK_IS_DRAWABLE (window), NULL);
+ visual = gdk_drawable_get_visual (drawable);
- if (GDK_IS_WINDOW (window) && GDK_WINDOW_DESTROYED (window))
- return NULL;
+ if (visual == NULL)
+ {
+ g_warning ("To get the image from a drawable, the drawable "
+ "must have a visual and colormap; calling "
+ "gtk_drawable_set_colormap() on a drawable "
+ "created without a colormap should solve this problem");
+ return NULL;
+ }
+
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
image = g_object_new (gdk_image_get_type (), NULL);
private = PRIVATE_DATA (image);
private->xdisplay = gdk_display;
private->ximage = XGetImage (private->xdisplay,
- GDK_DRAWABLE_XID (window),
+ impl->xid,
x, y, width, height,
AllPlanes, ZPixmap);
image->type = GDK_IMAGE_NORMAL;
- image->visual = gdk_window_get_visual (window);
+ image->visual = visual;
image->width = width;
image->height = height;
image->depth = private->ximage->depth;
diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c
index 84fcc86c61..66d34562af 100644
--- a/gdk/x11/gdkpixmap-x11.c
+++ b/gdk/x11/gdkpixmap-x11.c
@@ -149,6 +149,7 @@ gdk_pixmap_new (GdkWindow *window,
GdkPixmap *pixmap;
GdkDrawableImplX11 *draw_impl;
GdkPixmapImplX11 *pix_impl;
+ GdkColormap *cmap;
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
@@ -177,9 +178,16 @@ gdk_pixmap_new (GdkWindow *window,
pix_impl->width = width;
pix_impl->height = height;
GDK_PIXMAP_OBJECT (pixmap)->depth = depth;
+
+ if (window)
+ {
+ cmap = gdk_drawable_get_colormap (window);
+ if (cmap)
+ gdk_drawable_set_colormap (pixmap, cmap);
+ }
gdk_xid_table_insert (&GDK_PIXMAP_XID (pixmap), pixmap);
-
+
return pixmap;
}
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index 8a600ee694..4653fd0ac9 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -49,6 +49,12 @@ GdkVisual * gdk_visual_lookup (Visual *xvisual);
void gdk_window_add_colormap_windows (GdkWindow *window);
+GdkImage* _gdk_x11_get_image (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+
/* Please see gdkwindow.c for comments on how to use */
Window gdk_window_xid_at (Window base,
gint bx,
diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c
index 24829803a3..a34015a6aa 100644
--- a/gtk/gtktreestore.c
+++ b/gtk/gtktreestore.c
@@ -267,7 +267,7 @@ gtk_tree_store_get_node (GtkTreeModel *tree_model,
indices[i]);
if (node == NULL)
return NULL;
- };
+ }
return (GtkTreeNode) node;
}
diff --git a/gtk/testgtk.c b/gtk/testgtk.c
index 0be8272288..9a256b5701 100644
--- a/gtk/testgtk.c
+++ b/gtk/testgtk.c
@@ -1670,6 +1670,323 @@ create_handle_box (void)
gtk_widget_destroy (window);
}
+/*
+ * Test for getting an image from a drawable
+ */
+
+struct GetImageData
+{
+ GtkWidget *src;
+ GtkWidget *snap;
+ GtkWidget *sw;
+};
+
+static void
+take_snapshot (GtkWidget *button,
+ gpointer data)
+{
+ struct GetImageData *gid = data;
+ GdkRectangle visible;
+ int width_fraction;
+ int height_fraction;
+ GdkGC *gc;
+ GdkGC *black_gc;
+ GdkColor color = { 0, 30000, 0, 0 };
+ GdkRectangle target;
+ GdkImage *shot;
+
+ /* Do some begin_paint_rect on some random rects, draw some
+ * distinctive stuff into those rects, then take the snapshot.
+ * figure out whether any rects were overlapped and report to
+ * user.
+ */
+
+ visible = gid->sw->allocation;
+
+ visible.x = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (gid->sw))->value;
+ visible.y = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (gid->sw))->value;
+
+ width_fraction = visible.width / 4;
+ height_fraction = visible.height / 4;
+
+ gc = gdk_gc_new (gid->src->window);
+ black_gc = gid->src->style->black_gc;
+
+ gdk_gc_set_rgb_fg_color (gc, &color);
+
+
+ target.x = visible.x + width_fraction;
+ target.y = visible.y + height_fraction * 3;
+ target.width = width_fraction;
+ target.height = height_fraction / 2;
+
+ gdk_window_begin_paint_rect (gid->src->window,
+ &target);
+
+ gdk_draw_rectangle (gid->src->window,
+ gc,
+ TRUE,
+ target.x, target.y,
+ target.width, target.height);
+
+ gdk_draw_rectangle (gid->src->window,
+ black_gc,
+ FALSE,
+ target.x + 10, target.y + 10,
+ target.width - 20, target.height - 20);
+
+ target.x = visible.x + width_fraction;
+ target.y = visible.y + height_fraction;
+ target.width = width_fraction;
+ target.height = height_fraction;
+
+ gdk_window_begin_paint_rect (gid->src->window,
+ &target);
+
+ gdk_draw_rectangle (gid->src->window,
+ gc,
+ TRUE,
+ target.x, target.y,
+ target.width, target.height);
+
+ gdk_draw_rectangle (gid->src->window,
+ black_gc,
+ FALSE,
+ target.x + 10, target.y + 10,
+ target.width - 20, target.height - 20);
+
+ target.x = visible.x + width_fraction * 3;
+ target.y = visible.y + height_fraction;
+ target.width = width_fraction / 2;
+ target.height = height_fraction;
+
+ gdk_window_begin_paint_rect (gid->src->window,
+ &target);
+
+ gdk_draw_rectangle (gid->src->window,
+ gc,
+ TRUE,
+ target.x, target.y,
+ target.width, target.height);
+
+ gdk_draw_rectangle (gid->src->window,
+ black_gc,
+ FALSE,
+ target.x + 10, target.y + 10,
+ target.width - 20, target.height - 20);
+
+ target.x = visible.x + width_fraction * 2;
+ target.y = visible.y + height_fraction * 2;
+ target.width = width_fraction / 4;
+ target.height = height_fraction / 4;
+
+ gdk_window_begin_paint_rect (gid->src->window,
+ &target);
+
+ gdk_draw_rectangle (gid->src->window,
+ gc,
+ TRUE,
+ target.x, target.y,
+ target.width, target.height);
+
+ gdk_draw_rectangle (gid->src->window,
+ black_gc,
+ FALSE,
+ target.x + 10, target.y + 10,
+ target.width - 20, target.height - 20);
+
+ target.x += target.width / 2;
+ target.y += target.width / 2;
+
+ gdk_window_begin_paint_rect (gid->src->window,
+ &target);
+
+ gdk_draw_rectangle (gid->src->window,
+ gc,
+ TRUE,
+ target.x, target.y,
+ target.width, target.height);
+
+ gdk_draw_rectangle (gid->src->window,
+ black_gc,
+ FALSE,
+ target.x + 10, target.y + 10,
+ target.width - 20, target.height - 20);
+
+ /* Screen shot area */
+
+ target.x = visible.x + width_fraction * 1.5;
+ target.y = visible.y + height_fraction * 1.5;
+ target.width = width_fraction * 2;
+ target.height = height_fraction * 2;
+
+ shot = gdk_drawable_get_image (gid->src->window,
+ target.x, target.y,
+ target.width, target.height);
+
+ gtk_image_set_from_image (GTK_IMAGE (gid->snap),
+ shot, NULL);
+
+ g_object_unref (G_OBJECT (shot));
+
+ gdk_window_end_paint (gid->src->window);
+ gdk_window_end_paint (gid->src->window);
+ gdk_window_end_paint (gid->src->window);
+ gdk_window_end_paint (gid->src->window);
+ gdk_window_end_paint (gid->src->window);
+
+ gdk_draw_rectangle (gid->src->window,
+ gid->src->style->black_gc,
+ FALSE,
+ target.x, target.y,
+ target.width, target.height);
+
+ g_object_unref (G_OBJECT (gc));
+}
+
+static gint
+image_source_expose (GtkWidget *da,
+ GdkEventExpose *event,
+ gpointer data)
+{
+ int x = event->area.x;
+ GdkColor red = { 0, 65535, 0, 0 };
+ GdkColor green = { 0, 0, 65535, 0 };
+ GdkColor blue = { 0, 0, 0, 65535 };
+ GdkGC *gc;
+
+ gc = gdk_gc_new (event->window);
+
+ while (x < (event->area.x + event->area.width))
+ {
+ switch (x % 7)
+ {
+ case 0:
+ case 1:
+ case 2:
+ gdk_gc_set_rgb_fg_color (gc, &red);
+ break;
+
+ case 3:
+ case 4:
+ case 5:
+ gdk_gc_set_rgb_fg_color (gc, &green);
+ break;
+
+ case 6:
+ case 7:
+ case 8:
+ gdk_gc_set_rgb_fg_color (gc, &blue);
+ break;
+
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ gdk_draw_line (event->window,
+ gc,
+ x, event->area.y,
+ x, event->area.y + event->area.height);
+
+ ++x;
+ }
+
+ g_object_unref (G_OBJECT (gc));
+
+ return TRUE;
+}
+
+static void
+create_get_image (void)
+{
+ static GtkWidget *window = NULL;
+
+ if (!window)
+ {
+ GtkWidget *sw;
+ GtkWidget *src;
+ GtkWidget *snap;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *button;
+ struct GetImageData *gid;
+
+ gid = g_new (struct GetImageData, 1);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ gtk_signal_connect (GTK_OBJECT (window),
+ "destroy",
+ GTK_SIGNAL_FUNC (gtk_widget_destroyed),
+ &window);
+
+ gtk_object_set_data_full (GTK_OBJECT (window),
+ "testgtk-get-image-data",
+ gid,
+ g_free);
+
+ vbox = gtk_vbox_new (FALSE, 0);
+
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+
+ sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+
+ gid->sw = sw;
+
+ gtk_widget_set_usize (sw, 400, 400);
+
+ src = gtk_drawing_area_new ();
+ gtk_widget_set_usize (src, 10000, 10000);
+
+ gtk_signal_connect (GTK_OBJECT (src),
+ "expose_event",
+ GTK_SIGNAL_FUNC (image_source_expose),
+ gid);
+
+ gid->src = src;
+
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw),
+ src);
+
+ gtk_box_pack_start (GTK_BOX (vbox),
+ sw, TRUE, TRUE, 0);
+
+
+ hbox = gtk_hbox_new (FALSE, 3);
+
+ snap = gtk_widget_new (GTK_TYPE_IMAGE, NULL);
+
+ gid->snap = snap;
+
+ sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gtk_widget_set_usize (sw, 300, 300);
+
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), snap);
+
+ gtk_box_pack_end (GTK_BOX (hbox), sw, FALSE, FALSE, 5);
+
+ button = gtk_button_new_with_label ("Get image from drawable");
+
+ gtk_signal_connect (GTK_OBJECT (button),
+ "clicked",
+ GTK_SIGNAL_FUNC (take_snapshot),
+ gid);
+
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+
+ gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
+ gtk_widget_show_all (window);
+ }
+}
+
/*
* Label Demo
*/
@@ -8738,6 +9055,7 @@ create_main_window (void)
{ "font selection", create_font_selection },
{ "gamma curve", create_gamma_curve },
{ "handle box", create_handle_box },
+ { "image from drawable", create_get_image },
{ "image", create_image },
{ "item factory", create_item_factory },
{ "labels", create_labels },
diff --git a/gtk/testtext.c b/gtk/testtext.c
index a362fd9be1..d813d6fed4 100644
--- a/gtk/testtext.c
+++ b/gtk/testtext.c
@@ -954,14 +954,13 @@ do_search (gpointer callback_data,
GtkWidget *search_text;
GtkTextBuffer *buffer;
-#if 0
-
dialog = gtk_dialog_new_with_buttons ("Search",
GTK_WINDOW (view->window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_BUTTON_CLOSE,
GTK_RESPONSE_NONE, NULL);
+
buffer = gtk_text_buffer_new (NULL);
/* FIXME memory leak once buffer is a GObject */
@@ -983,7 +982,6 @@ do_search (gpointer callback_data,
gtk_widget_grab_focus (search_text);
gtk_widget_show_all (dialog);
-#endif
}
static void
@@ -1300,6 +1298,7 @@ buffer_search_forward (Buffer *buffer, const char *str,
GtkTextIter iter;
GtkTextIter start, end;
GtkWidget *dialog;
+ int i;
/* remove tag from whole buffer */
gtk_text_buffer_get_bounds (buffer->buffer, &start, &end);
@@ -1310,7 +1309,7 @@ buffer_search_forward (Buffer *buffer, const char *str,
gtk_text_buffer_get_mark (buffer->buffer,
"insert"));
-
+ i = 0;
if (*str != '\0')
{
GtkTextIter match_start, match_end;
@@ -1318,6 +1317,7 @@ buffer_search_forward (Buffer *buffer, const char *str,
while (gtk_text_iter_forward_search (&iter, str, TRUE, FALSE,
&match_start, &match_end))
{
+ ++i;
gtk_text_buffer_apply_tag (buffer->buffer, buffer->found_text_tag,
&match_start, &match_end);
@@ -1325,7 +1325,6 @@ buffer_search_forward (Buffer *buffer, const char *str,
}
}
-#if 0
dialog = gtk_message_dialog_new (GTK_WINDOW (view->window),
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
@@ -1339,7 +1338,6 @@ buffer_search_forward (Buffer *buffer, const char *str,
GTK_OBJECT (dialog));
gtk_widget_show (dialog);
-#endif
}
static void
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 0be8272288..9a256b5701 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -1670,6 +1670,323 @@ create_handle_box (void)
gtk_widget_destroy (window);
}
+/*
+ * Test for getting an image from a drawable
+ */
+
+struct GetImageData
+{
+ GtkWidget *src;
+ GtkWidget *snap;
+ GtkWidget *sw;
+};
+
+static void
+take_snapshot (GtkWidget *button,
+ gpointer data)
+{
+ struct GetImageData *gid = data;
+ GdkRectangle visible;
+ int width_fraction;
+ int height_fraction;
+ GdkGC *gc;
+ GdkGC *black_gc;
+ GdkColor color = { 0, 30000, 0, 0 };
+ GdkRectangle target;
+ GdkImage *shot;
+
+ /* Do some begin_paint_rect on some random rects, draw some
+ * distinctive stuff into those rects, then take the snapshot.
+ * figure out whether any rects were overlapped and report to
+ * user.
+ */
+
+ visible = gid->sw->allocation;
+
+ visible.x = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (gid->sw))->value;
+ visible.y = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (gid->sw))->value;
+
+ width_fraction = visible.width / 4;
+ height_fraction = visible.height / 4;
+
+ gc = gdk_gc_new (gid->src->window);
+ black_gc = gid->src->style->black_gc;
+
+ gdk_gc_set_rgb_fg_color (gc, &color);
+
+
+ target.x = visible.x + width_fraction;
+ target.y = visible.y + height_fraction * 3;
+ target.width = width_fraction;
+ target.height = height_fraction / 2;
+
+ gdk_window_begin_paint_rect (gid->src->window,
+ &target);
+
+ gdk_draw_rectangle (gid->src->window,
+ gc,
+ TRUE,
+ target.x, target.y,
+ target.width, target.height);
+
+ gdk_draw_rectangle (gid->src->window,
+ black_gc,
+ FALSE,
+ target.x + 10, target.y + 10,
+ target.width - 20, target.height - 20);
+
+ target.x = visible.x + width_fraction;
+ target.y = visible.y + height_fraction;
+ target.width = width_fraction;
+ target.height = height_fraction;
+
+ gdk_window_begin_paint_rect (gid->src->window,
+ &target);
+
+ gdk_draw_rectangle (gid->src->window,
+ gc,
+ TRUE,
+ target.x, target.y,
+ target.width, target.height);
+
+ gdk_draw_rectangle (gid->src->window,
+ black_gc,
+ FALSE,
+ target.x + 10, target.y + 10,
+ target.width - 20, target.height - 20);
+
+ target.x = visible.x + width_fraction * 3;
+ target.y = visible.y + height_fraction;
+ target.width = width_fraction / 2;
+ target.height = height_fraction;
+
+ gdk_window_begin_paint_rect (gid->src->window,
+ &target);
+
+ gdk_draw_rectangle (gid->src->window,
+ gc,
+ TRUE,
+ target.x, target.y,
+ target.width, target.height);
+
+ gdk_draw_rectangle (gid->src->window,
+ black_gc,
+ FALSE,
+ target.x + 10, target.y + 10,
+ target.width - 20, target.height - 20);
+
+ target.x = visible.x + width_fraction * 2;
+ target.y = visible.y + height_fraction * 2;
+ target.width = width_fraction / 4;
+ target.height = height_fraction / 4;
+
+ gdk_window_begin_paint_rect (gid->src->window,
+ &target);
+
+ gdk_draw_rectangle (gid->src->window,
+ gc,
+ TRUE,
+ target.x, target.y,
+ target.width, target.height);
+
+ gdk_draw_rectangle (gid->src->window,
+ black_gc,
+ FALSE,
+ target.x + 10, target.y + 10,
+ target.width - 20, target.height - 20);
+
+ target.x += target.width / 2;
+ target.y += target.width / 2;
+
+ gdk_window_begin_paint_rect (gid->src->window,
+ &target);
+
+ gdk_draw_rectangle (gid->src->window,
+ gc,
+ TRUE,
+ target.x, target.y,
+ target.width, target.height);
+
+ gdk_draw_rectangle (gid->src->window,
+ black_gc,
+ FALSE,
+ target.x + 10, target.y + 10,
+ target.width - 20, target.height - 20);
+
+ /* Screen shot area */
+
+ target.x = visible.x + width_fraction * 1.5;
+ target.y = visible.y + height_fraction * 1.5;
+ target.width = width_fraction * 2;
+ target.height = height_fraction * 2;
+
+ shot = gdk_drawable_get_image (gid->src->window,
+ target.x, target.y,
+ target.width, target.height);
+
+ gtk_image_set_from_image (GTK_IMAGE (gid->snap),
+ shot, NULL);
+
+ g_object_unref (G_OBJECT (shot));
+
+ gdk_window_end_paint (gid->src->window);
+ gdk_window_end_paint (gid->src->window);
+ gdk_window_end_paint (gid->src->window);
+ gdk_window_end_paint (gid->src->window);
+ gdk_window_end_paint (gid->src->window);
+
+ gdk_draw_rectangle (gid->src->window,
+ gid->src->style->black_gc,
+ FALSE,
+ target.x, target.y,
+ target.width, target.height);
+
+ g_object_unref (G_OBJECT (gc));
+}
+
+static gint
+image_source_expose (GtkWidget *da,
+ GdkEventExpose *event,
+ gpointer data)
+{
+ int x = event->area.x;
+ GdkColor red = { 0, 65535, 0, 0 };
+ GdkColor green = { 0, 0, 65535, 0 };
+ GdkColor blue = { 0, 0, 0, 65535 };
+ GdkGC *gc;
+
+ gc = gdk_gc_new (event->window);
+
+ while (x < (event->area.x + event->area.width))
+ {
+ switch (x % 7)
+ {
+ case 0:
+ case 1:
+ case 2:
+ gdk_gc_set_rgb_fg_color (gc, &red);
+ break;
+
+ case 3:
+ case 4:
+ case 5:
+ gdk_gc_set_rgb_fg_color (gc, &green);
+ break;
+
+ case 6:
+ case 7:
+ case 8:
+ gdk_gc_set_rgb_fg_color (gc, &blue);
+ break;
+
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ gdk_draw_line (event->window,
+ gc,
+ x, event->area.y,
+ x, event->area.y + event->area.height);
+
+ ++x;
+ }
+
+ g_object_unref (G_OBJECT (gc));
+
+ return TRUE;
+}
+
+static void
+create_get_image (void)
+{
+ static GtkWidget *window = NULL;
+
+ if (!window)
+ {
+ GtkWidget *sw;
+ GtkWidget *src;
+ GtkWidget *snap;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *button;
+ struct GetImageData *gid;
+
+ gid = g_new (struct GetImageData, 1);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ gtk_signal_connect (GTK_OBJECT (window),
+ "destroy",
+ GTK_SIGNAL_FUNC (gtk_widget_destroyed),
+ &window);
+
+ gtk_object_set_data_full (GTK_OBJECT (window),
+ "testgtk-get-image-data",
+ gid,
+ g_free);
+
+ vbox = gtk_vbox_new (FALSE, 0);
+
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+
+ sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+
+ gid->sw = sw;
+
+ gtk_widget_set_usize (sw, 400, 400);
+
+ src = gtk_drawing_area_new ();
+ gtk_widget_set_usize (src, 10000, 10000);
+
+ gtk_signal_connect (GTK_OBJECT (src),
+ "expose_event",
+ GTK_SIGNAL_FUNC (image_source_expose),
+ gid);
+
+ gid->src = src;
+
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw),
+ src);
+
+ gtk_box_pack_start (GTK_BOX (vbox),
+ sw, TRUE, TRUE, 0);
+
+
+ hbox = gtk_hbox_new (FALSE, 3);
+
+ snap = gtk_widget_new (GTK_TYPE_IMAGE, NULL);
+
+ gid->snap = snap;
+
+ sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gtk_widget_set_usize (sw, 300, 300);
+
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), snap);
+
+ gtk_box_pack_end (GTK_BOX (hbox), sw, FALSE, FALSE, 5);
+
+ button = gtk_button_new_with_label ("Get image from drawable");
+
+ gtk_signal_connect (GTK_OBJECT (button),
+ "clicked",
+ GTK_SIGNAL_FUNC (take_snapshot),
+ gid);
+
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+
+ gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
+ gtk_widget_show_all (window);
+ }
+}
+
/*
* Label Demo
*/
@@ -8738,6 +9055,7 @@ create_main_window (void)
{ "font selection", create_font_selection },
{ "gamma curve", create_gamma_curve },
{ "handle box", create_handle_box },
+ { "image from drawable", create_get_image },
{ "image", create_image },
{ "item factory", create_item_factory },
{ "labels", create_labels },
diff --git a/tests/testtext.c b/tests/testtext.c
index a362fd9be1..d813d6fed4 100644
--- a/tests/testtext.c
+++ b/tests/testtext.c
@@ -954,14 +954,13 @@ do_search (gpointer callback_data,
GtkWidget *search_text;
GtkTextBuffer *buffer;
-#if 0
-
dialog = gtk_dialog_new_with_buttons ("Search",
GTK_WINDOW (view->window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_BUTTON_CLOSE,
GTK_RESPONSE_NONE, NULL);
+
buffer = gtk_text_buffer_new (NULL);
/* FIXME memory leak once buffer is a GObject */
@@ -983,7 +982,6 @@ do_search (gpointer callback_data,
gtk_widget_grab_focus (search_text);
gtk_widget_show_all (dialog);
-#endif
}
static void
@@ -1300,6 +1298,7 @@ buffer_search_forward (Buffer *buffer, const char *str,
GtkTextIter iter;
GtkTextIter start, end;
GtkWidget *dialog;
+ int i;
/* remove tag from whole buffer */
gtk_text_buffer_get_bounds (buffer->buffer, &start, &end);
@@ -1310,7 +1309,7 @@ buffer_search_forward (Buffer *buffer, const char *str,
gtk_text_buffer_get_mark (buffer->buffer,
"insert"));
-
+ i = 0;
if (*str != '\0')
{
GtkTextIter match_start, match_end;
@@ -1318,6 +1317,7 @@ buffer_search_forward (Buffer *buffer, const char *str,
while (gtk_text_iter_forward_search (&iter, str, TRUE, FALSE,
&match_start, &match_end))
{
+ ++i;
gtk_text_buffer_apply_tag (buffer->buffer, buffer->found_text_tag,
&match_start, &match_end);
@@ -1325,7 +1325,6 @@ buffer_search_forward (Buffer *buffer, const char *str,
}
}
-#if 0
dialog = gtk_message_dialog_new (GTK_WINDOW (view->window),
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
@@ -1339,7 +1338,6 @@ buffer_search_forward (Buffer *buffer, const char *str,
GTK_OBJECT (dialog));
gtk_widget_show (dialog);
-#endif
}
static void