Compare commits

..

76 Commits

Author SHA1 Message Date
CDT 1998 Shawn T. Amundson
e8358c9845 Released GTK+ 1.0.4
Mon Jun  1 22:14:33 CDT 1998 Shawn T. Amundson <amundson@gtk.org>

        * Released GTK+ 1.0.4
1998-06-02 05:01:09 +00:00
Jay Painter
b975c992ba fixed pixmap clipping in gtkclist 1998-06-02 03:22:28 +00:00
BST 1998 Tony Gale
a66b9ecba3 [1-1-0-Merge]
Mon Jun  1 12:47:56 BST 1998  Tony Gale  <gale@gtk.org>
        [1-1-0-Merge]

        * docs/gtk_tut_it.sgml: Update of Italian Tutorial
          to Tutorial of 24th May, from Daniele Canazza <dcanazz@tin.it>
1998-06-01 11:55:37 +00:00
BST 1998 Tony Gale
fe487d27d3 [1-1-0-Merge]
Fri May 29 13:53:57 BST 1998  Tony Gale  <gale@gtk.org>
        [1-1-0-Merge]

        * docs/gtk_tut.sgml:
          - new section on Events
          - change all delete_event callbacks to include
            a GdkEvent parameter
          - clean up the formatting

        * examples - helloworld.c, helloworld2.c, notebook.c,
          packbox.c, pixmap.c, progressbar.c, radiobuttons.c,
          rulers.c, table.c, wheelbarrow.c: change all delete_event
           callbacks to include a GdkEvent parameter.
1998-06-01 11:46:58 +00:00
Owen Taylor
ffefc931cb x_libs=, not $x_libs=. Enough said. (Case only hit for --disable-xshm)
Mon May 25 19:54:20 1998  Owen Taylor  <otaylor@gtk.org>

	* configure.in: x_libs=, not $x_libs=. Enough said.
          (Case only hit for --disable-xshm)
1998-05-25 23:53:51 +00:00
Owen Taylor
936a9bb82f Add to $CFLAGS and $LDFLAGS when testing for X libraries, don't replace
Mon May 25 12:08:14 1998  Owen Taylor  <otaylor@gtk.org>

	* configure.in (LDFLAGS): Add to $CFLAGS and $LDFLAGS
	  when testing for X libraries, don't replace them. Because
	  the user might have specified the path to the X libraries
	  themself before running configure.

	* examples/**.c: Changed all gpointer * to gpointer
1998-05-25 17:01:39 +00:00
PDT 1998 Shawn T. Amundson
2cf9cfc70e Released GTK+ 1.0.3
Sun May 24 12:07:55 PDT 1998 Shawn T. Amundson <amundson@gtk.org>

        * Released GTK+ 1.0.3
1998-05-24 20:35:19 +00:00
BST 1998 Tony Gale
8e1f6f269d [1-1-0-Merge]
Sun May 24 12:11:38 BST 1998  Tony Gale  <gale@gtk.org>
        [1-1-0-Merge]

        * docs/gtk_tut.sgml:
           - GtkTooltips, update to current API
           - change all 'gpointer *data' to 'gpointer data'
           - other minor changes
1998-05-24 11:27:33 +00:00
Owen Taylor
4a666956be Bombo out with a moderately helpful message if detection of X libraries
Sat May 23 21:54:05 1998  Owen Taylor  <otaylor@gtk.org>

	* configure.in (LDFLAGS): Bombo out with a moderately
	  helpful message if detection of X libraries fails.
1998-05-24 02:02:20 +00:00
BST 1998 Tony Gale
ed9c2e8b44 [1-1-0-Merge]
Thu May 21 12:33:15 BST 1998 Tony Gale  <gale@gtk.org>
        [1-1-0-Merge]

        * gtkfaq.sgml: add question on multi-threading,
          minor URL cleanups.
1998-05-21 11:36:57 +00:00
Owen Taylor
d5e1327f9e Fill lookup arrays _after_ possibly changing the selected visuals. (Fixes
Tue May 19 23:38:36 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkpreview.c (gtk_preview_get_visuals): Fill lookup
	arrays _after_ possibly changing the selected visuals.
	(Fixes problem with reversed red and blue on SGI's)
1998-05-20 03:45:53 +00:00
Tim Janik
f25b333e33 conditionally define NULL, FALSE and TRUE. added G_GNUC_FORMAT(),
Wed May 20 05:02:26 1998  Tim Janik  <timj@gtk.org>

        * glib.h: conditionally define NULL, FALSE and TRUE.
        added G_GNUC_FORMAT(), G_GNUC_NORETURN and G_GNUC_CONST macros to
        feature more function arguments.
        (g_mem_chunk_create): new convenience macro as a short hand for
        g_mem_chunk_new().
        (g_chunk_free): new convenience macro to be consistent with g_chunk_new.

        * glist.c: backmerged g_list_nth_data().
        * gslist.c: backmerged g_slist_nth_data().
1998-05-20 03:30:23 +00:00
Owen Taylor
510541dd5b Added a cast (in code scheduled for removal ;-) to suppress a warning on
Mon May 18 22:26:33 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkwindow.c (gtk_window_style_set_event): Added a
	cast (in code scheduled for removal ;-) to suppress a
	warning on 64 bit machines.
1998-05-19 02:29:38 +00:00
Owen Taylor
7c9cc2cf39 (Yasuhiro SHIRASAKI <joke@awa.tohoku.ac.jp> : gtk-joke-980517-0.patch)
Mon May 18 22:14:39 1998  Owen Taylor  <otaylor@gtk.org>
(Yasuhiro SHIRASAKI <joke@awa.tohoku.ac.jp> : gtk-joke-980517-0.patch)

	* gutils.c: Restored a missing prototype for g_vsprintf.
1998-05-19 02:27:46 +00:00
Manish Singh
b252a7fffd sigh... this keeps coming back....
-Yosh
1998-05-18 20:35:40 +00:00
Tim Janik
b26728291a changed "proximity-in-event", "drop-data-available-event",
Mon May 18 04:01:41 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkwidget.c (gtk_widget_class_init): changed "proximity-in-event",
        "drop-data-available-event", "drop-enter-event" and "drop-leave-event"
        to be of runtype GTK_RUN_LAST.

        * gtk/gtkcontainer.c (gtk_container_class_init): likewise for
        "need-resize".

        * gtk/gtktipsquery.c (gtk_tips_query_class_init): likewise for
        "widget-selected".
1998-05-18 04:23:06 +00:00
PDT 1998 Shawn T. Amundson
b62fc60de7 Released GTK+ 1.0.2
Fri May 15 21:20:40 PDT 1998 Shawn T. Amundson <amundson@gtk.org>

        * Released GTK+ 1.0.2

	* Fixed an error in configure.in introduced since 1.0.1
1998-05-16 15:48:38 +00:00
Manish Singh
7defce053a ignore autogened file
-Yosh
1998-05-16 01:19:05 +00:00
Manish Singh
f322097971 bye bye autogenerated file
-Yosh
1998-05-15 22:35:27 +00:00
rodo
8d312b1d4f (Merged from HEAD)
Fri May 15 12:31:27 1998  rodo  <doulik@karlin.mff.cuni.cz>

	* gdk/gdk.c: include gdkkeysyms.h always

NEWS wording changes. Updated gtk+.spec to 1.0.2 version no.
1998-05-15 16:24:36 +00:00
Owen Taylor
3b0e9baee5 A few more GPOINTER_TO_UINT fixes.
Wed May 13 00:53:52 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtktypeutils.c gtk/gtksignal.c gdk/gdkdnd.c: A few more
	  GPOINTER_TO_UINT fixes.

	* gtk/gtksignal.c: Include <string.h> for memset.

Tue May 12 19:19:29 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkinputdialog.c gtk/gtkgamma.c gtk/gtkrc.c
	  gtk/gtkcolorsel.c gtk/gtkclist.c gtk/testgtk.c: Use
	GPOINTER_TO_INT/GINT_TO_POINTER macros where appropriate.

	* gdk/gdk.c: Print sizeof() results
	as g_print("%ld", (glong)sizeof(foo)), to deal with
	sizeof() being long on Alpha's.

	* gtk/testgtk.c: include <string.h> for strlen

Tue May 12 19:22:58 1998  Owen Taylor  <otaylor@gtk.org>

 	* glib/glib.h: Added macros G[U]INT_TO_POINTER() and
	GPOINTER_TO_[U]INT for storing small integers integers
	inside pointers.

	* glib/testglib.c: Print sizeof() results
	as g_print("%ld", (glong)sizeof(foo)), to deal with
	size_t being long on Alpha's.

Tue May 12 16:54:15 1998  Owen Taylor  <otaylor@gtk.org>
	(James A <jamesa@demon.net> : gtk-jamesa-980511-4.patch)

	* glib.h gstring.c gmessages.c: Added some missing
	const to arguments.

	* gutils.c (g_strsignal.c): Added missing return statements.
1998-05-13 06:17:47 +00:00
Owen Taylor
0b1b179e45 Fixed a couple of warnings. 1998-05-13 03:28:04 +00:00
Owen Taylor
6c6b244015 Initialize a variable so that invalid inputs don't pass garbage to X.
Tue May 12 12:35:34 1998  Owen Taylor  <otaylor@gtk.org>

	* gdk/gdkregion.c: Initialize a variable so that invalid
	inputs don't pass garbage to X.

Tue May 12 16:56:35 1998  Owen Taylor  <otaylor@gtk.org>
	(James A <jamesa@demon.net> : gtk-jamesa-980511-4.patch)

	* gtk/gtkbbox.h gtk/gtkcolorsel.h gtk/gtkvbbox.h:
	Changed #include "gtkfoo.h" to #include <gtk/gtkfoo.h>

	* gtk/gtkwindow.[ch]: Added const to gtk_window_set_wmclass

Tue May 12 16:54:15 1998  Owen Taylor  <otaylor@gtk.org>
	(James A <jamesa@demon.net> : gtk-jamesa-980511-4.patch)

	* glib.h gstring.c gmessages.c: Added some missing
	const to arguments.

	* gutils.c (g_strsignal.c): Added missing return statements.
1998-05-13 00:32:41 +00:00
Owen Taylor
725300f5f2 Rewritten and hopefully improved.
Tue May 12 00:24:59 1998  Owen Taylor  <otaylor@gtk.org>

	* docs/gtk-config.1: Rewritten and hopefully improved.
1998-05-12 04:23:33 +00:00
Manish Singh
7d56ba7b0c Added man page for gtk-config from Ben Gertzfield
-Yosh
1998-05-12 03:30:35 +00:00
Federico Mena Quintero
832e096207 Create the window using GtkPreview's visual and colormap, otherwise things
1998-05-11  Federico Mena Quintero  <federico@nuclecu.unam.mx>

	* gtk/gtkpreview.c (gtk_preview_realize): Create the window using
	GtkPreview's visual and colormap, otherwise things can BadMatch.

	* gtk/testgtk.c (create_color_preview):
	(create_gray_preview): Removed pushing/popping of visual/colormap
	now that GtkPreview does things correctly.

	* gtk/gtkcolorsel.c (gtk_color_selection_draw_wheel_frame):
	(gtk_color_selection_draw_wheel): Pick the style from the correct
	place (the colorsel->wheel_area widget) so that the GCs will match
	with where we are going to paint to.

	* gtk/testgtk.c (create_color_selection): Removed pushing/popping
	of visual/colormap now that GtkColorSelection does things the
	right way.
1998-05-12 03:27:54 +00:00
Owen Taylor
063c490570 Moved g_error, g_warning, g_message and g_print from gutils.c to new file
Mon May 11 21:11:54 1998  Owen Taylor  <otaylor@gtk.org>

	* gutils.c gmessages.c: Moved g_error, g_warning, g_message and
	g_print from gutils.c to new file gmessages.c, to avoid having to
	include <unistd.h> in gutils.c which was causing problems for the
	g_strsignal implementation on FreeBSD boxes.

Mon May 11 21:04:51 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkwindow.c (gtk_real_window_move_resize): Use the
	previously unused window->need_resize flag to mark if a window's
	descendents changed size while the window was not visible. In this
	case, when the window becomes visible, we reallocate everything,
	since we didn't keep track of what actually changed.

	(Fixes bug where changing the popdown strings of a
	combo to something of the same length caused them to
	blank out, as reported by Todd Dukes <tdukes@ibmoto.com>)
1998-05-12 02:05:39 +00:00
Tim Janik
8d55a9d665 [security audit by Alan Cox]
Tue May 12 02:17:19 1998  Tim Janik  <timj@gtk.org>

        [security audit by Alan Cox]

        * gtk/gtkobject.c (gtk_object_get_arg_type): check for arg_name to not
        exceed maximum assumed size.

        * gtk/gtkmenufactory.c (gtk_menu_factory_create): check that `path' does
        not exceed maximum assumed size.
        (gtk_menu_factory_remove): likewise.
        (gtk_menu_factory_find_recurse): likewise.
1998-05-12 00:24:35 +00:00
Tim Janik
6c21fc646d queue the idle_sizer with GTK_PRIORITY_INTERNAL - 1, so widgets get first
Tue May 12 00:21:33 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkwidget.c (gtk_widget_queue_resize): queue the idle_sizer with
        GTK_PRIORITY_INTERNAL - 1, so widgets get first resized and then
        redrawn if that is still neccessary. don't allow queueing of already
        destructed objects.
        (gtk_widget_idle_sizer): proccess the resize queue in a save manner, so
        widgets which are in the queue can be destroyed savely, handle
        requeueing properly.
        (gtk_widget_idle_draw): proccess the redraw queue in a save manner, so
        widgets which are in the queue can be destroyed/unrealized savely.
1998-05-11 22:33:00 +00:00
Tim Janik
0847bed69f compilation fixups 1998-05-11 15:29:00 +00:00
Tim Janik
f3f8304436 preserve automake CFLAGS setup.
Mon May 11 07:20:39 1998  Tim Janik  <timj@gtk.org>

        * configure.in: preserve automake CFLAGS setup.

        * gtk/gtkobject.h (gtk_trace_referencing): compile time check the type
        of the first argument to be of type GtkObject. unconditionally compile
        this function. removed __GNUC__ dependancy of the gtk_object_ref and
        gtk_object_unref macro wrappers for this function.

Mon May 11 07:22:36 1998  Tim Janik  <timj@gtk.org>

        * glib.h: provide G_GNUC_FUNCTION and G_GNUC_PRETTY_FUNCTION to
        avoid conditionals. unconditionally define NULL, TRUE, FALSE, MAX,
        MIN, ABS and CLAMP, these macros might be screwed from other headers.
1998-05-11 08:33:25 +00:00
Tim Janik
7e6c3c0df7 merging hassle. most is caused by func() -> func(void) converions. else
merging hassle.
most is caused by func() -> func(void) converions.
else than that, you don't want me to put the ChangeLog entries in here ;)
1998-05-10 07:37:50 +00:00
Tim Janik
25f9fd2958 hmmmm 1998-05-10 06:03:15 +00:00
Tim Janik
b3e0707899 shit, those are added locally to their branch ;( 1998-05-10 05:46:10 +00:00
Tim Janik
aa505f0ff4 creation 1998-05-10 05:44:41 +00:00
Owen Taylor
66dd08d2e8 Work around inability of HP/UX to sscanf from a readonly string.
Sun May 10 00:16:44 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk.m4: Work around inability of HP/UX to
	sscanf from a readonly string.

Sat May  9 23:14:39 1998  Owen Taylor  <otaylor@gtk.org>

	* gdk/gdk.c: Fixed one more XLookupString location. (For KeyRelease)

Fri May  8 21:31:50 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkwidget.c (gtk_widget_queue_draw): Free the
	draw-queue when we are done.

	(gtk_widget_queue_draw/_queu_resize): Always return
	FALSE and avoid having two idles at the same time.

Fri May  8 21:04:00 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtktext.c: Various fixes to make sure cache
	lines are freed if line_start_cache doesn't point to the
	beginning of the cache.
1998-05-10 04:17:28 +00:00
Tim Janik
8555c23889 GtkTooltips is a GtkData 1998-05-07 08:03:28 +00:00
Federico Mena Quintero
98d997b105 Fixed incorrect painting of row background (fg_set -> bg_set confusion).
1998-05-06  Federico Mena Quintero  <federico@nuclecu.unam.mx>

	* gtk/gtkclist.c (draw_row): Fixed incorrect painting of row
	background (fg_set -> bg_set confusion).
1998-05-06 23:50:09 +00:00
Owen Taylor
5cb538d805 A guint * was being passed where X expected a Keysym *, and keysyms are
Tue May  5 17:04:14 1998  Owen Taylor  <otaylor@gtk.org>

	* gdk/gdk.c (gdk_event_translate): A guint * was
	being passed where X expected a Keysym *, and
	keysyms are long's on Alpha Linux. This was causing
	segfaults in Xlib, apparently because of alignment.
1998-05-05 21:22:35 +00:00
Owen Taylor
7d6aff77e5 Fixed reversed conditionals that caused segfault on some platforms.
Tue May  5 11:03:00 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkselection.c (gtk_selection_clear): Fixed
	reversed conditionals that caused segfault on some
	platforms.

Tue May  5 00:44:47 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkcontainer.c (gtk_container_set_focus_[hv]adjustment):
	cast to GTK_OBJECT for gtk_object_ref.
1998-05-05 15:38:02 +00:00
PDT 1998 Shawn T. Amundson
668c7604a9 Released GTK 1.0.1
Mon May  4 21:07:36 PDT 1998 Shawn T. Amundson <amundson@gtk.org>

        * Released GTK 1.0.1
1998-05-05 04:10:51 +00:00
rhlabs
e8cf1d552b autoconf test for shape extension should really find it, now 1998-05-04 22:12:44 +00:00
Owen Taylor
5266d6322a GtkTooltips is an object, not a Boxed now.
Mon May  4 00:32:20 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtk.defs (GtkContainer): GtkTooltips is an
	object, not a Boxed now.
1998-05-04 05:14:20 +00:00
PDT 1998 Shawn T. Amundson
52d2e1b6a1 Version number changed to 1.0.1, along with a more automatic changing of
Sun May  3 20:43:27 PDT 1998 Shawn T. Amundson <amundson@gtk.org>

        * Version number changed to 1.0.1, along with a more automatic
	  changing of version numbers in the Makefile.am files
1998-05-04 03:46:38 +00:00
Owen Taylor
4aa965149c Draw the areas between the default and the button always in
Fri May  1 22:32:47 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkbutton.c (gtk_button_paint): Draw the areas
	between the default and the button always in GTK_STATE_NORMAL.

Sun May  3 16:55:43 1998  Tim Janik  <timj@gtk.org>

	* gtk/gtkcontainer.c (gtk_container_set_focus_child): new function to
	set the current focus_child of a container, does proper referencing and
	adjusts the vadjustment/hadjustment associated with the focus widget.

	* gtk/gtkwidget.c (gtk_widget_grab_focus): set the focused child on
	containers via gtk_container_set_focus_child.

	* gtk/gtknotebook.c: modifications to use gtk_container_set_focus_child
 	where appropriate.

	* gtk/gtkcontainer.c (gtk_container_remove): removed unsetting of focus
 	child since not every child removal goes through this function (this
	showed up after gtk_container_set_focus_child() started to reference the
 	focus_child of a container).

	* gtk/gtkwidget.c (gtk_widget_unparent): moved unsetting the focus_child
	of a container from gtk_container_remove into this place.
1998-05-04 02:54:17 +00:00
Owen Taylor
ab40e71ec9 Don't force a clear until the widget is actually on screen.
Sun May  3 19:04:46 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtklabel.c (gtk_label_state_changed): Don't
	force a clear until the widget is actually on
	screen.
1998-05-03 23:38:58 +00:00
Owen Taylor
d8e88af7d0 configure.in acheader.h gdk/gdkwindow.c Check for Shape extension both on
Sun May  3 17:20:50 1998  Owen Taylor  <otaylor@gtk.org>

	* configure.in acheader.h gdk/gdkwindow.c
	Check for Shape extension both on the client and server
	side. (And, more importantly, check for the shape extension
	so we may include -lXext even when compiling with --disable-xshm)

	* gdk/gdkwindow.c: Set ->colormap to NULL for root
	and foreign windows. Use this to check if we
	need to get the colormap from X.

Fri May  1 16:40:57 1998  Owen Taylor  <otaylor@gtk.org>
	[ security-audit changes from Alan Cox ]

	* gdk/gdkpixmap.c (gdk_pixmap_colormap_create_from_xpmp[_d]):
	  Fix a buffer overflow on pixmaps that claim to have
	  more than 31 characters per pixel.

	  (gdk_pixmap_read_string): Don't wrap around strings longer
 	  than half of address space ;-)

	* gtk/gtk[vh]ruler.c gtk/gtkinputdialog.c: Expand some buffers
	that were used for printing integers.

	* gdk/gxid.c (handle_claim_device): Some extra checks.
	It isn't safe against being fed bad X id's, but at
	least it should be safe against deleting all your
	files.

Sat May  2 23:14:34 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkcurve.c (gtk_curve_graph_events): Ignore
	Configure events that would result in a negative
	size.

Sat May  2 00:14:05 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkpreview.c (gtk_trim_cmap): Make sure the
	parameters to log are doubles. Digital Unix apparently
	is missing the argument in its prototype.
1998-05-03 22:17:05 +00:00
Owen Taylor
1a7acfef50 Added a FAQ entry about "glibconfig.h" and another about writing another
Sun May  3 14:55:34 1998  Owen Taylor  <otaylor@gtk.org>

	* docs/gtkfaq.sgml (CPPFLAGS): Added a FAQ entry about
	"glibconfig.h" and another about writing another IRC
	client.
1998-05-03 18:55:03 +00:00
Owen Taylor
f8116014c1 Always show the scrollbars when the policy is GTK_POLICY_ALWAYS...
Fri May  1 22:45:55 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkscrolledwindow.c (gtk_scrolled_window_size_allocate):
	Always show the scrollbars when the policy is
	GTK_POLICY_ALWAYS...
1998-05-02 02:55:02 +00:00
Tim Janik
eedaab9236 ok this will fix the gimp's channel & layers refcounting wiredness,
but the gimp really ougtha fixed in dealing with gtklists.
BTW: i *hate* backporting bugfixes!

Fri May  1 10:05:44 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtklist.c (gtk_list_add): let gtk_list_append_items do the work
                for us.
                        (gtk_list_clear_items): use gtk_list_unselect_child() for unselection of
                                children.
                                        (gtk_list_shutdown): remove all children from the list.
                                                (gtk_real_list_unselect_child):
                                                        (gtk_real_list_select_child): *always* put our internal structures into
                                                                sane state *before* signal emisions (i.e. list->selection updates prior
                                                                        to gtk_list_item_[de]select() calls).
1998-05-01 17:28:55 +00:00
Owen Taylor
2117f4ac7e Fix up getting colormap for FOREIGN windows to go along with Raster's fix
Fri May  1 00:42:25 1998  Owen Taylor  <otaylor@gtk.org>

	* gdk/gdkwindow.c (gdk_window_get_colormap): Fix up
	getting colormap for FOREIGN windows to go along with
	Raster's fix for visuals.
1998-05-01 04:53:18 +00:00
Owen Taylor
6349f7cb2c Check to catch the case when the viewport fits in either direction or
Thu Apr 30 23:32:51 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkscrolledwindow.c (gtk_scrolled_window_size_allocate):
	Check to catch the case when the viewport fits in either
 	direction or both, instead of flip-flopping infinitely.

	Only show/hide the scrollbars once at the end.

Thu Apr 30 21:56:07 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkscrolledwindow.c (gtk_scrolled_window_foreach):
	Include the scrollbars in the foreach call.
	(gtk-fortier-980405-0.patch;
 	 Patrice Fortier <Patrice.Fortier@aquarel.fr>).

	The notebook widget
	really should also include its tabs, but that might cause
	problems for programs if they
1998-05-01 03:37:01 +00:00
Owen Taylor
8435d34838 Check arguments more carefully, (gtk-draco-980423-1.patch;
Thu Apr 30 21:41:30 1998  Owen Taylor  <otaylor@gtk.org>

	* gstring.c : Check arguments more carefully,
	(gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
1998-05-01 01:41:06 +00:00
rhlabs
0f0ede22ad <raster@redhat.com> fixed gdk_window_get_visual() to check for a foreign
<raster@redhat.com>
fixed gdk_window_get_visual() to check for a foreign window and if so return
the visual the old-way (which worked) the new way only works for gdk created
windows. Now wfixed - keeping owen's optimisations and allowing backwards
compatability.
1998-04-30 23:52:57 +00:00
Owen Taylor
43ef2e2394 Changed Log 1998-04-30 20:46:28 +00:00
Owen Taylor
b94559a288 ltmain.sh ltconfig config.sub config.guess:
Thu Apr 30 10:22:59 1998  Owen Taylor  <otaylor@gtk.org>

	* glib/ltmain.sh glib/ltconfig glib/config.sub glib/config.guess:
	  ltmain.sh ltconfig config.sub config.guess:

	Reverted back to libtool-1.2 (plus minor patches) so as not to
	force the issue for everyone else.
1998-04-30 20:45:30 +00:00
Owen Taylor
a3cfbc84cf Update log. Mention new libtool version. 1998-04-30 15:08:58 +00:00
Owen Taylor
4143e106cc Updated to libtool 1.2a.
Thu Apr 30 10:22:59 1998  Owen Taylor  <otaylor@gtk.org>

	* glib/ltmain.sh glib/ltconfig glib/config.sub glib/config.guess:
	Updated to libtool 1.2a.

	* gtk/gtkclist.c: Draw the in-between lines with style->base
	instead of style->white.
1998-04-30 14:53:02 +00:00
Manish Singh
d0a29b40d6 don't die when naughty people remove parts of the filesystem under you (fix
from Josh)

-Yosh
1998-04-30 09:44:07 +00:00
Tim Janik
1b7fc490af check if the viewport already exists before iterating over it, maybe we
Thu Apr 30 09:49:14 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkscrolledwindow.c (gtk_scrolled_window_foreach): check
                if the viewport already exists before iterating over it, maybe we
                        haven't been constructed yet.
1998-04-30 08:08:02 +00:00
Owen Taylor
8c66060a8e Cache the colormap and children of a window locally instead of fetching
Wed Apr 29 15:46:13 1998  Owen Taylor  <otaylor@gtk.org>

	* gdk/gdkprivate.h gdk/gdkwindow.c gdk/gdkpixmap.c:
	Cache the colormap and children of a window locally
	instead of fetching them from the server when needed.
	Huge performance difference for creating/destroying
	windows.

	* gtk/gtkstyle.c: Find the depth from the cached
	visual, instead of asking the server.

	* gtk.m4: Distribute the new version which tries to
	figure out what went wrong and give helpful error
	messages.

	* ltmain.sh ltconfig config.sub config.sh:
	Updated to libtool 1.2a

	* gtk/gtktext.c: Fixed a bug where the drawn level
	was being messed up when the text was scrolled
	during a deletion.
1998-04-30 05:26:57 +00:00
Tim Janik
e94d12f926 made this function issue a warning if the GtkBin widget already has a
Thu Apr 30 01:51:00 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkbin.c (gtk_bin_add): made this function issue a warning if
                the GtkBin widget already has a child.

                        * gtk/gtkbox.c (gtk_box_pack_{start|end}):
                                check that child->parent == NULL;
1998-04-30 04:03:06 +00:00
Arturo Espinosa
cde57dc1d2 Apply the drag and drop fix to the 1.0 branch as well -mig 1998-04-29 03:08:13 +00:00
Owen Taylor
42a7da51fc Only return FALSE when the clear event is been rejected, not when widget
Tue Apr 28 22:13:54 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkselection.c (gtk_selection_clear): Only return
	FALSE when the clear event is been rejected, not when
	widget has already lost the selection. (Which should
	only happen when we are setting the selection to another
	widget ourself.)
1998-04-29 02:50:40 +00:00
Tim Janik
2bec3fad18 allow the inclusion of other rc-files.
Tue Apr 28 15:46:41 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkrc.c (gtk_rc_parse_statement): allow the inclusion of other
                rc-files.
1998-04-28 13:49:05 +00:00
Tim Janik
2f6ee99191 only allow grabbing of focus for CAN_FOCUS widgets.
Mon Apr 27 15:11:52 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkwidget.c (gtk_widget_grab_focus): only allow grabbing of focus
                for CAN_FOCUS widgets.

                        * gtk/testgtk.c (create_scrolled_windows): feature h/v focus
                                adjustments for the table.
                                        (create_list): feature automatic adjustment of the scrolled window to
                                                always contain the focused child.
                                                        (create_main_window): keep the focussed button always inside of the
                                                                scrolled windoww.

                                                                        * gtk/gtkcontainer.c (gtk_real_container_focus): set the h/v focus
                                                                                adjustments, to contain the allocation of the currently focused child.
                                                                                        (gtk_container_set_focus_hadjustment): new functin to set the
                                                                                                horizontal focus adjustment.
                                                                                                        (gtk_container_set_focus_vadjustment): new functin to set the vertical
                                                                                                                focus adjustment.

                                                                                                                        * gtk/gtkadjustment.c (gtk_adjustment_clamp_page): new fucntion to
                                                                                                                                clamp the currents adjustment page into a specific range.

                                                                                                                                        * random GtkType fixups for gtk_*_get_type() functions.



this bug-fix (feature? ;) is fully binary compatible, so just invoke
touch *.h -r gtkbutton.h; make; make install-exec
and you are all set ;)
(devoted to yosh ;)))
1998-04-27 13:46:54 +00:00
Owen Taylor
9a1db40746 Removed the "check visibility after gtk_widget_unparent" bug in hopefully
Fri Apr 24 19:07:32 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkfixed.c gtk/gtkpaned.c gtk/gtktable.c:

	Removed the "check visibility after gtk_widget_unparent" bug
	in hopefully the last three places.
1998-04-24 23:13:43 +00:00
Owen Taylor
37bedcc07a Account for the fact that gtk_tree_item_remove_subtree will be called
Fri Apr 24 18:37:16 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtktreeitem.c (gtk_tree_item_remove_subtree):
	Account for the fact that gtk_tree_item_remove_subtree
	will be called recursively.

	Handle removing a collapsed subtree.

	(From Andy Dustman <adustman@comstar.net>)

	* gtk/gtktree.c (gtk_tree_remove_items): Look for the
	root tree when removing items from a non-previously
	mapped tree.

	* gtk/testgtk.c: Added a remove_subtree button.
1998-04-24 22:52:15 +00:00
Owen Taylor
302aaa2802 Notify all weak references before object removing data. This change fixes
Thu Apr 23 23:44:17 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkobject.c (gtk_object_finalize): Notify all weak references
	before object removing data. This change fixes a bug where
	removing the last weak references would cause it to be
	triggered.
1998-04-24 17:14:45 +00:00
Tim Janik
9829d1ee03 merging changes from me and quartic back into the old tree. 1998-04-24 00:57:36 +00:00
Tim Janik
aa6097e255 haha! got it merged!
/me wins over cvs (this time...)
1998-04-24 00:46:27 +00:00
Tim Janik
1d8aed6816 prepend the running_timeouts list with the tmp_list link itself, not with
Wed Apr 22 04:15:26 1998  Tim Janik  <timj@gtk.org>

	* gtk/gtkmain.c (gtk_handle_current_timeouts): prepend the
 	running_timeouts list with the tmp_list link itself, not with a new
	GList structure pointing to our link. that would fill up memory and
	causes the GList.data fields of the running_timeouts list to point to
	GList structures and not GtkTimeoutFunction structures which is a
 	*really* bad thing.
	(gtk_handle_current_idles): likewise (exchange "timout" with "idle" in
	the above entry ;).
1998-04-22 03:33:50 +00:00
Tim Janik
49680fed32 corrected a brace position (Damon Chaplin), which i got wrong when
Wed Apr 15 05:13:09 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtklabel.c (gtk_label_size_request): corrected a brace position
                (Damon Chaplin), which i got wrong when applying Damon's patch the last
                        time.

hm, first -j use...
1998-04-17 01:18:30 +00:00
Owen Taylor
4a7d355898 Make sure that when we are running with a non-installed colormap, in 8-bit
Wed Apr 15 20:42:46 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkpreview.c (gtk_preview_get_visuals): Make sure
	that when we are running with a non-installed colormap,
        in 8-bit pseudo-color, we actually are using the system
	visual. (Fixes *Bad Match* errors on Digital Unix machines
	with multiple 8-bit pseudo-color visuals)

	* gdk/Makefile.am: Removed mostly useless dependency that
	was causing problems for SGI's make, when used with
	the 'make dist' form of GTK+. (Dependency caused dependencies
        to be redone when BUILT_SOURCES changed)
1998-04-16 01:01:04 +00:00
Arturo Espinosa
0982f71b98 Put the gdkwindow.c fix here too 1998-04-15 03:40:58 +00:00
Shawn Amundson
7363897409 Makefile.am: add gtk+.spec, removed gtk+.prj
Makefile.am: add gtk+.spec, removed gtk+.prj
1998-04-14 03:08:50 +00:00
392 changed files with 79792 additions and 149830 deletions

View File

@@ -10,3 +10,4 @@ aclocal.m4
configure
gtk-config
config.cache

View File

@@ -14,7 +14,6 @@ Lars Hamann <lars@gtk.org>
Tim Janik <timj@gtk.org>
Stefan Jeske <stefan@gtk.org>
Elliot Lee <sopwith@gtk.org>
Raph Levien <raph@gtk.org>
Ian Main <imain@gtk.org>
Fedrerico Mena <quartic@gtk.org>
Paolo Molaro <lupus@lettere.unipd.it>

9594
ChangeLog

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

21
HACKING
View File

@@ -4,30 +4,26 @@ to have the following packages installed:
- GNU autoconf 2.12
- GNU automake 1.3
(Beta releases are at ftp://ftp.cygnus.com/pub/tromey)
- GNU libtool 1.2b
- indent (GNU indent 1.9.1 is known good)
- GNU libtool 1.2
These should be available by ftp from ftp.gnu.org or any of the
fine GNU mirrors. Beta software can be found at alpha.gnu.org.
In order to get CVS gtk+ installed on your system, you need to have
the most recent CVS version of glib installed as well.
The installation process of glib is similar to that of gtk+, but
needs to be fulfilled prior to installation of gtk+.
To compile a CVS version of gtk+ on your system, you will need to take
several steps to setup the tree for compilation. You can do all these
steps at once by running:
If you are accessing gtk+ via CVS, then you will need to take several
steps to get it to compile. You can do all these steps at once
by running:
cvsroot/gtk+# ./autogen.sh
Basically this does the following for you:
cvsroot/gtk+# aclocal; automake; autoconf
cvsroot/gtk+/glib# aclocal; automake; autoconf
The above commands create the "configure" script. Now you
can run the configure script in cvsroot/gtk+ to create all
the Makefiles.
the Makefiles. You only need to call "configure" in cvsroot/gtk+
as the one in glib will be invoked automatically.
Before running autogen.sh or configure, make sure you have libtool
in your path.
@@ -37,12 +33,11 @@ options like --prefix=/usr to configure you can give those options
to autogen.sh and they will be passed on to configure.
If at all possible, please use CVS to get the latest development version of
gtk+ and glib. You can do the following to get glib and gtk+ from cvs:
gtk+. You can do the following to get gtk+ from cvs:
$ export CVSROOT=':pserver:anonymous@cvs.gimp.org:/debian/home/gnomecvs'
$ cvs login
(there is no password, just hit return)
$ cvs -z9 checkout glib
$ cvs -z9 checkout gtk+
Please submit patches to the gtk-list@redhat.com mailing list (you must

23
INSTALL
View File

@@ -1,14 +1,8 @@
Prerequisites
=============
GTK+ requires the GLIB library, available at the same location as
you got this package.
Simple install procedure
========================
% gzip -cd gtk+-1.1.3.tar.gz | tar xvf - # unpack the sources
% cd gtk+-1.1.3 # change to the toplevel directory
% gzip -cd gtk+-1.0.4.tar.gz | tar xvf - # unpack the sources
% cd gtk+-1.0.4 # change to the toplevel directory
% ./configure # run the `configure' script
% make # build GTK
[ Become root if necessary ]
@@ -85,19 +79,6 @@ or,
setenv CFLAGS -O2 ; ./configure # csh and variants
Using an uninstalled copy of GLIB
=================================
You can compile GTK+ against a copy of GLIB that you have not
yet installed. To do this, give the --with-glib=DIR options
to ./configure. For instance:
./configure --with-glib=../glib-1.1.4
This, however, will not work if you built GLIB with different
source and build directories.
Installation directories
========================

View File

@@ -1,28 +1,20 @@
## Process this file with automake to produce Makefile.in
SRC_SUBDIRS = gdk gtk
SRC_SUBDIRS = glib gdk gtk
SUBDIRS = $(SRC_SUBDIRS) docs
bin_SCRIPTS = gtk-config
EXTRA_DIST = \
HACKING \
gtk+.spec \
gtk.m4 \
makecopyright \
TODO \
NEWS.pre-1-0 \
ChangeLog.pre-1-0 \
README.cvs-commits \
examples/README.1ST \
examples/extract.awk \
examples/extract.sh \
examples/aspectframe/Makefile \
examples/aspectframe/aspectframe.c \
examples/buttons/Makefile \
examples/buttons/buttons.c \
examples/buttons/info.xpm \
examples/clist/clist.c \
examples/entry/Makefile \
examples/entry/entry.c \
examples/eventbox/Makefile \
@@ -47,8 +39,6 @@ EXTRA_DIST = \
examples/menu/mfmain.h \
examples/notebook/Makefile \
examples/notebook/notebook.c \
examples/packer/Makefile \
examples/packer/pack.c \
examples/packbox/Makefile \
examples/packbox/packbox.c \
examples/paned/Makefile \

222
NEWS
View File

@@ -1,91 +1,153 @@
What is new in GTK+ 1.1.2:
Overview of Changes in GTK+ 1.0.4:
* Gtk+ is now featuring runtime loading of dynamic modules via the
--gtk-modules= command line switch. such modules have to export a
G_MODULE_EXPORT void gtk_module_init (gint *argc, gchar ***argv);
function which will be invoked to initialize the module. since such
modules may create new widget types, they are always resident.
* The tutorial has been updated again.
* Changes to menus including tearoff menus and accelerators.
* Better support for modal dialogs.
* Removed CAN_FOCUS by default from scrollbars and button children of toolbar.
* More improvements and fixes for GtkCList and GtkCTree (i.e. row sorting).
* GtkCTree rows can be unselectable now.
* The GtkCTree API has undergone major renames (see ChangeLog entry from Lars
Hamann on Tue Aug 18 00:29:13 1998).
* A bunch of varargs functions changed to get va_lists working on systems that
implement va_lists as arrays.
* Improvements to the gdkrgb code.
* Improvements to Gdk color handling so we greatly reduce server traffic and
don't leak colors anymore.
* Improved internal widget tree iterators (the GtkContainer::foreach signal
vanished because of this).
* Option menus can have the keyboard focus now.
* More fixups to the text widget.
* GtkFileSelection should behave much more nicely in combination with AFS now.
* Support for label underlining.
* Support for GLib 1.1.3 log domains.
* Documentation improvements.
* Configuration fixes on various platforms.
* Miscellaneous fixes to XInput support.
* Build with shared library dependencies on Linux
* Fix for a major bug in the type systems memory allocation code that could
cause random crashes.
* Libtool update to version 1.2b.
* Lots of bugfixes and cleanups again ;)
* Documentation changes (Thanks to Tony Gale!)
* autoconf fix for x_lib variable
* fixed pixmap clipping in gtkclist
Overview of Changes in GTK+ 1.0.3:
What is new in GTK+ 1.1.1:
* Bug fixes, including fix for visuals on SGI machines
* Tutorial updates and additions.
* Key binding support for GtkListItems and GtkList.
* Extended selection mode and autoscrolling for GtkLists.
* A GtkCtree now operates on GtkCTreeNode* structures rather than GList*.
* GtkCTreeNodes can now be created from GNode trees.
* Bug fixes for GtkNotebook, GtkCList, GtkCombo and GdkWindow reparentation.
Overview of Changes in GTK+ 1.0.2:
What is new in GTK+ 1.1.0:
* New widget GtkFontSelector.
* New featurefull progress bar.
* New container widget GtkPacker.
* New object GtkItemFactory, GtkMenuFactory is deprecated.
* New key binding system, configurable via rcfiles, similar to styles.
* New widget GtkCTree with drag selections and keyboard movement and
and horizontal scrolling. Features also implemented for GtkCList.
* Significant speedups to widget creation and destruction through caching
colormap and visual queries to the XServer.
* Speedups for type creation and especially gtk_type_is_a() checks.
* Speedups in signal lookup, creation and emissions and connection handling.
* Minor speedups with object data allocation and destruction.
* Additions to the signal handling API (e.g. *_emitv).
* Support for rc-file reparsing.
* Resizing logic is now implemented on container widget basis, rather than
for toplevel GtkWindows only.
* Buttons support relief styles now.
* Some widgets are now allocated through memchunks to behave more memory wise.
* Minor speedups with object data allocation and destruction.
* Newly included file gtkfeatures.h which defines compatibility macros to
test for certain API features upon program compilation.
* Child arguments support for container widgets.
* Far better support for object arguments, revamp of the underlying
mechanism for speed and reusability. Child/object arguments don't
need to be preceeded by the "GtkType::" portion anymore.
* Removed GtkAcceleratorTable in favour of GtkAccelGroup, accelerator display
is now performed by a new widget GtkAccelLabel.
* Overhaul of the resizing code. Resizing behaviour can now be specified
on GtkContainer basis, so the underlying algorithm isn't only available
for GtkWindows.
* GtkTables are now fully resizable.
* The GtkType system now supports an additional base class initialization
function.
* GtkStyles and key bindings can now be looked up depending on the base
types of a widget, through a new keyword `class' in rc files.
* GtkButton derives from GtkBin (finally).
* More descriptive error messages on rc parsing.
* Runtime information is available to query enum/flag definition values.
* Cleanups to give less warnings on 64-bit platforms.
* Many bugs fixed, including:
- A segfault with selections on Solaris and IRIX.
- A segfault that occured for all keypresses on Linux/Alpha.
Overview of Changes in GTK+ 1.0.1:
* Significant speedups to widget creation and destruction
* Upgrade to libtool-1.2
* Legions of bug fixes, memory leaks, segfaults, of-by-something errors...
including those that already went into the 1.0.x branch.
* A big bunch of features and cosmetic fixups that just got lost in
the masses of changes.
* Lots of bug fixes, including one that fixed a major memory leak
in 1.0.0.
Overview of Changes in GTK+ 1.0.0:
* A few bug fixes.
Overview of Changes in GTK+ 0.99.10:
* Lots of bug fixes
* Documentation improvements
* Better looking handlebox
* A few convenience functions
Overview of Changes in GTK+ 0.99.9:
* Added examples directory, even more examples soon
* Added optional word wrap to gtktext
* Changes to gtkhandlebox
* Lots of bug fixes
Overview of Changes in GTK+ 0.99.8:
* Compilation and configuration fixes
* DND Fixes
* New test in testgtk: cursors
* Tutorial updates/additions
* Few more FAQ additions
* More prep for 1.0
Overview of Changes in GTK+ 0.99.7:
* This release is mainly because 0.99.6 did not compile completely
due to a missing file.
* Fixes to Gtk's quit handlers.
Overview of Changes in GTK+ 0.99.6:
* Intermediate release to become 1.0.
* More signedness corrections for handler functions in gtkmain.h.
* Semantics of GtkWidget::delete_event changed.
* Documentation updates.
* Inclusion of Gtk tutorial.
* Implementation of a new shutdown method for GtkObject's executed prior to
actual destruction. WARNING: this breaks binary compatibility, programs using
Gtk need to be recompiled.
* Clean ups due to compiler warnings.
* Various widget fixes.
Overview of Fixes in GTK+ 0.99.5:
* Signal signedness and naming corrections
* rc/style fixes
* text, entry widget fixes
* gtkeditable fixes
* scrollbar flickering fixed
* check casts are more descriptive
* DND fixes
* FAQ updates
* Bug fixes
Overview of Changes in GTK+ 0.99.4:
* Reference counting revolution integrated.
Refer to docs/refcounting.txt on this issue.
* Implementation of a decent debugging system, you would want
to export GTK_DEBUG=objects if you are going to develop gtk applications,
refer to docs/debugging.txt for further information.
* Additions on the signal code for querying information about certain signals,
and pending handlers of signals.
* Support for user signals, and major changes to internal signal handler
handling for proper signal removal and invokation of after signals.
* Additional signals for various widgets e.g, GtkHandleBox::child_attached,
GtkHandleBox::child_detached, GtkWidget::style_set, GtkWidget::parent_set.
* GtkTooltips became a true descendant of GtkObject via derivation from
GtkData and facilitates an extra tip string which can be used as e.g. an
index into context help.
* Split up of the widget/object flags into a private and a public portion,
consult docs/widget_system.txt on this.
* Support for hot keys on gtk programs via gtk_key_snooper_install().
* Reimplementation of the *_interp functions as *_full functions to provide
simple callback functions as well.
* Idle functions are now prioritized.
* Many enhancements to GtkNotebook.
* New widget GtkSpinButton, check out testgtk.
* New widget GtkTipsQuery for letting the user query tooltips of widgets.
* Addition of GtkEditable base widget to encapsulate selection and
clipboard handling. (GtkEntry and GtkText use this)
* Text widget more complete.
* Additions to GtkStatusBar to make it complete.
* Gdk now supports regions.
* Access masks for widget arguments (GTK_ARG_READABLE/GTK_ARG_WRITABLE).
* Function replacements:
g_string_hash() -> g_str_hash()
g_string_equal() -> g_str_equal()
gtk_tooltips_set_tips() -> gtk_tooltips_set_tip()
* Support for quit handlers in gtk_main().
* Motif window mangaer hints support.
* Widget arguments are now flagged for readability/writability.
* Additions to documentation.
* Various FAQ updates. (FAQ now included)
* Clean ups and many many bug fixes by a lot of people all over the place.
* New, long and descriptive ChangeLog entries for bored readers ;)
Overview of Changes in GTK+ 0.99.3:
* Filesel enhancement / stability changes
* New widget, gtkcombo
* Widgets in the toolbar do not get the focus
* New widget, gtkstatusbar (still in-progress)
* g_string_equal renamed g_str_equal
* g_string_hash renamed g_str_hash
* new gtkbox functions to allow modification of the child
linkage after the widget tree is setup
* gtk_*_get_arg() and gtk_*_set_arg() fixes and implementations
* DND changes/fixes
* Entry widget now has set_max_length function
* Handlebox widget changes/fixes
* Some work on text widget (still in-progress)
* Now the toolbar supports arbitrary widgets as well
* CList has resizable columns again
* CList now looks consistant with scrolled windows
* Remove flickering from entry widget
* Added switch_page signal to notebook widget
* Documentation additions
* Other bug fixes...

View File

@@ -1,124 +0,0 @@
Overview of Changes in GTK+ 1.0.0:
* A few bug fixes.
Overview of Changes in GTK+ 0.99.10:
* Lots of bug fixes
* Documentation improvements
* Better looking handlebox
* A few convenience functions
Overview of Changes in GTK+ 0.99.9:
* Added examples directory, even more examples soon
* Added optional word wrap to gtktext
* Changes to gtkhandlebox
* Lots of bug fixes
Overview of Changes in GTK+ 0.99.8:
* Compilation and configuration fixes
* DND Fixes
* New test in testgtk: cursors
* Tutorial updates/additions
* Few more FAQ additions
* More prep for 1.0
Overview of Changes in GTK+ 0.99.7:
* This release is mainly because 0.99.6 did not compile completely
due to a missing file.
* Fixes to Gtk's quit handlers.
Overview of Changes in GTK+ 0.99.6:
* Intermediate release to become 1.0.
* More signedness corrections for handler functions in gtkmain.h.
* Semantics of GtkWidget::delete_event changed.
* Documentation updates.
* Inclusion of Gtk tutorial.
* Implementation of a new shutdown method for GtkObject's executed prior to
actual destruction. WARNING: this breaks binary compatibility, programs using
Gtk need to be recompiled.
* Clean ups due to compiler warnings.
* Various widget fixes.
Overview of Fixes in GTK+ 0.99.5:
* Signal signedness and naming corrections
* rc/style fixes
* text, entry widget fixes
* gtkeditable fixes
* scrollbar flickering fixed
* check casts are more descriptive
* DND fixes
* FAQ updates
* Bug fixes
Overview of Changes in GTK+ 0.99.4:
* Reference counting revolution integrated.
Refer to docs/refcounting.txt on this issue.
* Implementation of a decent debugging system, you would want
to export GTK_DEBUG=objects if you are going to develop gtk applications,
refer to docs/debugging.txt for further information.
* Additions on the signal code for querying information about certain signals,
and pending handlers of signals.
* Support for user signals, and major changes to internal signal handler
handling for proper signal removal and invokation of after signals.
* Additional signals for various widgets e.g, GtkHandleBox::child_attached,
GtkHandleBox::child_detached, GtkWidget::style_set, GtkWidget::parent_set.
* GtkTooltips became a true descendant of GtkObject via derivation from
GtkData and facilitates an extra tip string which can be used as e.g. an
index into context help.
* Split up of the widget/object flags into a private and a public portion,
consult docs/widget_system.txt on this.
* Support for hot keys on gtk programs via gtk_key_snooper_install().
* Reimplementation of the *_interp functions as *_full functions to provide
simple callback functions as well.
* Idle functions are now prioritized.
* Many enhancements to GtkNotebook.
* New widget GtkSpinButton, check out testgtk.
* New widget GtkTipsQuery for letting the user query tooltips of widgets.
* Addition of GtkEditable base widget to encapsulate selection and
clipboard handling. (GtkEntry and GtkText use this)
* Text widget more complete.
* Additions to GtkStatusBar to make it complete.
* Gdk now supports regions.
* Access masks for widget arguments (GTK_ARG_READABLE/GTK_ARG_WRITABLE).
* Function replacements:
g_string_hash() -> g_str_hash()
g_string_equal() -> g_str_equal()
gtk_tooltips_set_tips() -> gtk_tooltips_set_tip()
* Support for quit handlers in gtk_main().
* Motif window mangaer hints support.
* Widget arguments are now flagged for readability/writability.
* Additions to documentation.
* Various FAQ updates. (FAQ now included)
* Clean ups and many many bug fixes by a lot of people all over the place.
* New, long and descriptive ChangeLog entries for bored readers ;)
Overview of Changes in GTK+ 0.99.3:
* Filesel enhancement / stability changes
* New widget, gtkcombo
* Widgets in the toolbar do not get the focus
* New widget, gtkstatusbar (still in-progress)
* g_string_equal renamed g_str_equal
* g_string_hash renamed g_str_hash
* new gtkbox functions to allow modification of the child
linkage after the widget tree is setup
* gtk_*_get_arg() and gtk_*_set_arg() fixes and implementations
* DND changes/fixes
* Entry widget now has set_max_length function
* Handlebox widget changes/fixes
* Some work on text widget (still in-progress)
* Now the toolbar supports arbitrary widgets as well
* CList has resizable columns again
* CList now looks consistant with scrolled windows
* Remove flickering from entry widget
* Added switch_page signal to notebook widget
* Documentation additions
* Other bug fixes...

2
README
View File

@@ -1,7 +1,7 @@
General Information
===================
This is GTK+ version 1.1.2. GTK+, which stands for the Gimp ToolKit,
This is GTK+ version 1.0.4. GTK+, which stands for the Gimp ToolKit,
is a library for creating graphical user interfaces for the X Window
System. It is designed to be small, efficient, and flexible. GTK+ is
written in C with a very object-oriented approach.

View File

@@ -1,52 +0,0 @@
GTK+ is part of the GNOME CVS repository. At the current time, any
person with write access to the GNOME repository, can make changes to
GTK+. This is a good thing, in that it encourages many people to work
on GTK+, and progress can be made quickly. However, GTK+ is a fairly
large and complicated package that many other things depend on, so to
avoid unnecessary breakage, and to take advantage of the knowledge
about GTK+ that has been built up over the last 18 months, we'd like
to ask people commiting to GTK+ to follow a few rules:
0) Ask first. If your changes are major, or could possibly break existing
code, you should always ask. If your change is minor and you've
been working on GTK+ for a while it probably isn't necessary
to ask. But when in doubt, ask. Even if your change is correct,
somebody may know a better way to do things.
If you are making changes to GTK+, you should be subscribed
to gtk-devel-list@redhat.com. (Subscription address:
gtk-devel-list-request@redhat.com.) This is a good place to ask
about intended changes.
If you just want to make a trivial change, and don't want to subscribe,
you can also mail gtk-bugs@gtk.org. Or, alternatively, you can look in
the ChangeLog for somebody who has been making changes to the file
you want to change and email them.
#gimp on byxnet (irc.gimp.org, irc2.gimp.org, irc3.gimp.org,
irc.germany.gimp.org...)s also a good place to find GTK+ developers to
discuss changes with, however, email to gtk-devel-list is the most
certain and preferred method.
1) Ask _first_.
2) There must be a ChangeLog for every commit. (If you discover that
you only committed half the files you meant to and need to fix that
up, or something, you don't need a new ChangeLog entry. But in general,
ChangeLog entries are mandatory.) Changes with out ChangeLog entries
will be reverted.
3) There _must_ be a ChangeLog for every commit.
Notes:
* If you are going to be changing many files in an experimental fashion,
it probably is a good idea to create a separate branch for your changes.
Owen Taylor
13 Aug 1998

136
TODO
View File

@@ -1,29 +1,49 @@
For 1.2.0 release:
- remove deprecated functions from *.[hc] files, especially the
non-functional ones.
Bugs:
* Scrolled windows (GtkList?) get cought in an endless reallocation loop
under certain (rare) circumstances.
* Widget redrawing when the window resizes sometimes messes up.
GtkLabels sometimes redraw without clearing up the underlying background on
window resizes.
* delay dnd settings to take effect once a widget is realized, this is
to avoid force realizations. i think this goes along with owens dnd
changes?
-timj
The way DND data types are set in GtkWidget really needs to be fixed.
This is pretty high on my priority list, and I'll get to it as soon as
the column list widget is done. The correct way dnd data needs to be set
is to have a additional keyed data type with GtkWidget, which is applied to
the widget's window upon realize.
There also needs to be a way to set dnd-data on widget windows which are
not the main window (for widgets that create more than one window).
-Jay Painter
DnD seems to work for me, but yes, there needs to be some sort of
gtk_widget layer that makes it easier... Also, adding support for drop
zones might be nice.
-Elliot
This one is reproducabel for me:
testgtk --sync
popup colorselection
drag/drop works
start up preview color
drag works but not dropping
end preview color
drag/drop works
start up prewiev color
segfault in malloc
-timj
* Change bitfields to guints from enums, or vice versa?
* MappingNotify events produce warnings.
* gtk_widget_set_uposition can't handle negative x,y coordinates!
* the type system (gtktypeutils.c) has to handle creations of fundamental
types seperatedly from derived types, so we don't screw foreign
fundamental types with an already extensively increased seqno.
* A filter function which destroys the GDK window it is filtering
events on is bad news.
* Expose events aren't being generated correctly for DND demo
Additions:
* focus handling for GtkOptionMenu (needs the previous)
* GScanner: it might be good to ues stdio and getch() instead of 1-character
reads. so one can take advantage of buffering. Currently each read() takes
a separate syscall.
* implement gtk_default_draw_oval and other missing things in gtkstyle.c.
* implement gtk_default_draw_oval
* Lists should scroll to center the recently selected item if it isn't
visible.
@@ -37,10 +57,15 @@ Additions:
allocate GtkTooltipsData from memchunks
look into incorporation of outdated/gtk-dairiki-971208-[01].patch.gz
* Make widget attributes configurable after the widget is created (timj).
* Change gtk_widget_propagate_default_style() mechanism to
void gtk_rc_string_export (const gchar *rc_additions,
gboolean override_rc_styles);
* Should release grab before activating menu item (and remove
menu from screen?)
* Make all widget attributes configurable after the widget is created (timj).
* Widgets dervied from GtkButton need to be able to override
@@ -52,8 +77,8 @@ Additions:
* GtkCList improvements. (Jay Painter)
* Seperate GtkObject, type and signaling system from Gdk dependancies,
by moving them into a seperate libgtkobj.
* Seperate GtkObject and signaling system from Gdk dependancies?
* move *_input_add (wrappers for select(2)) mechanism into glib.
* Make sure a widget added to a list is a list item and a widget added
@@ -91,7 +116,7 @@ Additions:
retrieve X values, and so they don't have to know the value of the
XNxxx character constants.
* The "--geometry" option should be supported
* The "-geometry" option should be supported
- Having gdk_init() parse the geometry option. (putting it into
GDK means you can use XParseGeometry() without wrapping it)
@@ -162,19 +187,25 @@ Additions:
* Generic ScrolledWindow interface, which provide automatic scrollbar
capability to Viewport, Text, and CList widgets.
* GTK_POLICY_NEVER for scrolled windows.
GTK_POLICY_NEVER for scrolled windows.
* Consider caching more state in GdkWindowPrivate. Currently,
every widget realization involves a XGetGeometry and a
XGetWindowAttributes. And every GdkWindow destruction
involves a XQueryTree.
* Scrolled windows need to be smarter about when they size-request/allocate
their children. In particular, we should not be queuing the resizes
on the toplevel window, but on the Viewport.
* Should all the default handlers really return FALSE? This can
cause confusing presses to be sent to containers that actually
want to get events on themselves.
* New signals to handle accelerators: accel_before and accel_after (or
somesuch) to pre and post process accelerator calls. [Yosh]
* Fix block_resize, disable_resize.
* Buttons's should derive from Bin's. (GTK 2.0 change, breaks
lots of stuff)
Text/Edit widget:
@@ -247,62 +278,3 @@ Text/Edit widget:
- "changed" emitted when doing deletes on empty Text widget.
- Delete IC in editable->unrealize, not editable->finalize?
Themes
======
- When a scale gets shown/hidden only queue a redraw on the
non-window portion, not the whole area.
- In various places, to avoid shaping windows excessively,
we set parent relative backgrounds. This is an ugly
hack and needs a better solution. Plus, I don't think
these parent-relative backgrounds always persist to
when they are actually needed.
Such calls exist in: GtkButton, GtkHandeBox, GtkItem,
GtkListItem, GtkMenu, GtkMenuItem, GtkMisc,
GtkNoteBook, GtkOptionMenu, GtkPaned, GtkPreview,
GtkSpinButton and GtkTreeItem.
- For menus and for GtkWindow's, the realize() function
calls paint(), so that background pixmaps can be set
ahead of time, and prevent flashing when the window is
shown. This is an ugly hack and needs a better solution.
=======
Calendar Widget:
- The widget should be nicely resizeable vertical too.
- CALENDAR_MARGIN should be removed, uses INNER_BORDER and
style->class->[xy]thickness insted.
- Flag to choose between using standard three letter abbreviated
weekday name or just the first character from it. It looks like
that is what most other calendar-widgets do.
- Arrows should resize with the header-font.
- The keyboard support has to be finished.
DND
===
- Use a cursor instead of an ICON when over Motif windows,
to get rid of the current junk that Motif leaves because
of it's XCopyArea stupidity for doing highlighting.
- Add a GTK_DRAG_VERIFY target flag and a "drag_data_verify"
signal so that apps can easily check if a, say,
text/uri-list URL looks OK during the drop.
- Check more for memory leaks.
- Drag and drop for Entry and Text widgets.
- Send synthetic motion events on structure changes so
drag_enter/leave get sent properly. (See the popup
in testdnd)

View File

@@ -15,14 +15,11 @@
/* Other stuff */
#undef GTK_COMPILED_WITH_DEBUGGING
#undef HAVE_IPC_H
#undef HAVE_SHM_H
#undef HAVE_XSHM_H
#undef HAVE_SHAPE_EXT
#undef HAVE_SYS_SELECT_H
#undef HAVE_XCONVERTCASE
/* some systems do not allow to ipcrm pages prior to
* actual usage, namely: OSF1 V3.2, SunOS 4.1.1, 5.5, 5.5.1, 5.6,
@@ -34,9 +31,6 @@
#undef RESOURCE_BASE
/* Define to enable POSIX threading awareness */
#undef USE_PTHREADS
#undef XINPUT_NONE
#undef XINPUT_GXI
#undef XINPUT_XFREE

View File

@@ -1,259 +0,0 @@
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
## Copyright (C) 1996-1998 Free Software Foundation, Inc.
## Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program 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
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
## As a special exception to the GNU General Public License, if you
## distribute this file as part of a program that contains a
## configuration script generated by Autoconf, you may include it under
## the same distribution terms that you use for the rest of that program.
# serial 24 AM_PROG_LIBTOOL
AC_DEFUN(AM_PROG_LIBTOOL,
[AC_REQUIRE([AM_ENABLE_SHARED])dnl
AC_REQUIRE([AM_ENABLE_STATIC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AM_PROG_LD])dnl
AC_REQUIRE([AM_PROG_NM])dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
dnl
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
# Check for any special flags to pass to ltconfig.
libtool_flags=
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case "$host" in
*-*-irix6*)
# Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
;;
*N32*)
LD="${LD-ld} -n32"
;;
*64-bit*)
LD="${LD-ld} -64"
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
CFLAGS="$CFLAGS -belf"
;;
esac
# Actually configure libtool. ac_aux_dir is where install-sh is found.
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|| AC_MSG_ERROR([libtool configure failed])
])
# AM_ENABLE_SHARED - implement the --enable-shared flag
# Usage: AM_ENABLE_SHARED[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AM_ENABLE_SHARED,
[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(shared,
changequote(<<, >>)dnl
<< --enable-shared build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
changequote([, ])dnl
[ --enable-shared=PKGS only build shared libraries if the current package
appears as an element in the PKGS list],
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
])
# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
AC_DEFUN(AM_DISABLE_SHARED,
[AM_ENABLE_SHARED(no)])
# AM_DISABLE_STATIC - set the default static flag to --disable-static
AC_DEFUN(AM_DISABLE_STATIC,
[AM_ENABLE_STATIC(no)])
# AM_ENABLE_STATIC - implement the --enable-static flag
# Usage: AM_ENABLE_STATIC[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AM_ENABLE_STATIC,
[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(static,
changequote(<<, >>)dnl
<< --enable-static build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
changequote([, ])dnl
[ --enable-static=PKGS only build shared libraries if the current package
appears as an element in the PKGS list],
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
])
# AM_PROG_LD - find the path to the GNU or non-GNU linker
AC_DEFUN(AM_PROG_LD,
[AC_ARG_WITH(gnu-ld,
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
AC_REQUIRE([AC_PROG_CC])
ac_prog=ld
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by GCC])
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
/* | [A-Za-z]:\\*)
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(ac_cv_path_LD,
[if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog"; then
ac_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
test "$with_gnu_ld" != yes && break
fi
fi
done
IFS="$ac_save_ifs"
else
ac_cv_path_LD="$LD" # Let the user override the test with a path.
fi])
LD="$ac_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT($LD)
else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_SUBST(LD)
AM_PROG_LD_GNU
])
AC_DEFUN(AM_PROG_LD_GNU,
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
ac_cv_prog_gnu_ld=yes
else
ac_cv_prog_gnu_ld=no
fi])
])
# AM_PROG_NM - find the path to a BSD-compatible name lister
AC_DEFUN(AM_PROG_NM,
[AC_MSG_CHECKING([for BSD-compatible nm])
AC_CACHE_VAL(ac_cv_path_NM,
[case "$NM" in
/* | [A-Za-z]:\\*)
ac_cv_path_NM="$NM" # Let the user override the test with a path.
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/nm; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -B"
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -p"
else
ac_cv_path_NM="$ac_dir/nm"
fi
break
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
;;
esac])
NM="$ac_cv_path_NM"
AC_MSG_RESULT([$NM])
AC_SUBST(NM)
])

View File

@@ -1,15 +1,11 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
PROJECT=Gtk+
TEST_TYPE=-d
FILE=gdk
DIE=0
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $PROJECT."
echo "You must have autoconf installed to compile GTK+."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
@@ -17,15 +13,15 @@ DIE=0
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have libtool installed to compile $PROJECT."
echo "Get ftp://alpha.gnu.org/gnu/libtool-1.2b.tar.gz"
echo "You must have libtool installed to compile GTK+."
echo "Get ftp://alpha.gnu.org/gnu/libtool-1.0h.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have automake installed to compile $PROJECT."
echo "You must have automake installed to compile GTK+."
echo "Get ftp://ftp.cygnus.com/pub/home/tromey/automake-1.2d.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
@@ -35,8 +31,8 @@ if test "$DIE" -eq 1; then
exit 1
fi
test $TEST_TYPE $FILE || {
echo "You must run this script in the top-level $PROJECT directory"
(test -d gtk && test -d glib) || {
echo "You must run this script in the top-level GTK+ directory"
exit 1
}
@@ -45,19 +41,12 @@ if test -z "$*"; then
echo "to pass any to it, please specify them on the $0 command line."
fi
case $CC in
*xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;;
esac
aclocal $ACLOCAL_FLAGS
# optionally feature autoheader
(autoheader --version) < /dev/null > /dev/null 2>&1 && autoheader
automake $am_opt
autoconf
for i in glib .
do
echo processing $i
(cd $i; aclocal; automake; autoconf)
done
./configure "$@"
echo
echo "Now type 'make' to compile $PROJECT."
echo "Now type 'make' to compile GTK+."

13
config.guess vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -478,10 +478,10 @@ EOF
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin32
echo i386-pc-cygwin32
exit 0 ;;
i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
echo i386-pc-mingw32
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin32
@@ -493,12 +493,6 @@ EOF
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
# uname on the ARM produces all sorts of strangeness, and we need to
# filter it out.
case "$UNAME_MACHINE" in
arm* | sa110*) UNAME_MACHINE="arm" ;;
esac
# The BFD linker knows what the default object file format is, so
# first see if it will tell us.
ld_help_string=`ld --help 2>&1`
@@ -512,7 +506,6 @@ EOF
i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
esac

View File

@@ -16,15 +16,11 @@
#undef X_DISPLAY_MISSING
/* Other stuff */
#undef GTK_COMPILED_WITH_DEBUGGING
#undef HAVE_IPC_H
#undef HAVE_LIBDL
#undef HAVE_SHM_H
#undef HAVE_XSHM_H
#undef HAVE_SHAPE_EXT
#undef HAVE_SYS_SELECT_H
#undef HAVE_XCONVERTCASE
/* some systems do not allow to ipcrm pages prior to
* actual usage, namely: OSF1 V3.2, SunOS 4.1.1, 5.5, 5.5.1, 5.6,
@@ -36,9 +32,6 @@
#undef RESOURCE_BASE
/* Define to enable POSIX threading awareness */
#undef USE_PTHREADS
#undef XINPUT_NONE
#undef XINPUT_GXI
#undef XINPUT_XFREE
@@ -46,17 +39,8 @@
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define if you have the broken_wctype function. */
#undef HAVE_BROKEN_WCTYPE
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H

38
config.sub vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Configuration validation subroutine script, version 1.1.
# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
# Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
@@ -162,7 +162,7 @@ case $basic_machine in
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i[34567]86)
i[3456]86)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
@@ -171,7 +171,7 @@ case $basic_machine in
exit 1
;;
# Recognize the basic CPU types with company name.
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
@@ -350,19 +350,19 @@ case $basic_machine in
os=-mvs
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i[34567]86v32)
i[3456]86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i[34567]86v4*)
i[3456]86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i[34567]86v)
i[3456]86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i[34567]86sol2)
i[3456]86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
@@ -469,23 +469,25 @@ case $basic_machine in
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium | p5 | k5 | nexen)
basic_machine=i586-pc
pentium | p5)
basic_machine=i586-intel
;;
pentiumpro | p6 | k6 | 6x86)
basic_machine=i686-pc
pentiumpro | p6)
basic_machine=i686-intel
;;
pentiumii | pentium2)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | nexen-*)
pentium-* | p5-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | k6-* | 6x86-*)
pentiumpro-* | p6-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
k5)
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
basic_machine=i586-amd
;;
nexen)
# We don't have specific support for Nexgen yet, so just call it a Pentium
basic_machine=i586-nexgen
;;
pn)
basic_machine=pn-gould

View File

@@ -4,47 +4,29 @@ AC_INIT(gdk/gdktypes.h)
# Save this value here, since automake will set cflags later
cflags_set=${CFLAGS+set}
# Making releases:
# GTK_MICRO_VERSION += 1;
# GTK_INTERFACE_AGE += 1;
# GTK_BINARY_AGE += 1;
# if any functions have been added, set GTK_INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
#
GTK_MAJOR_VERSION=1
GTK_MINOR_VERSION=1
GTK_MICRO_VERSION=3
GTK_INTERFACE_AGE=0
GTK_BINARY_AGE=0
GTK_MINOR_VERSION=0
GTK_MICRO_VERSION=4
GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
AC_SUBST(GTK_MAJOR_VERSION)
AC_SUBST(GTK_MINOR_VERSION)
AC_SUBST(GTK_MICRO_VERSION)
AC_SUBST(GTK_INTERFACE_AGE)
AC_SUBST(GTK_BINARY_AGE)
AC_SUBST(GTK_VERSION)
# libtool versioning
LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
LT_REVISION=$GTK_INTERFACE_AGE
LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
# For automake.
VERSION=$GTK_VERSION
PACKAGE=gtk+
# Save this value here, since automake will set cflags later
cflags_set=${CFLAGS+set}
# Configure glib
AC_CONFIG_SUBDIRS(glib)
dnl Initialize automake stuff
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
AC_SUBST(GTK_MAJOR_VERSION)
AC_SUBST(GTK_MINOR_VERSION)
AC_SUBST(GTK_MICRO_VERSION)
AC_SUBST(GTK_VERSION)
# Save this value here, since automake will set cflags later
cflags_set=${CFLAGS+set}
# Specify a configuration file
AM_CONFIG_HEADER(config.h)
@@ -61,13 +43,11 @@ AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available
AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
, enable_ansi=no)
AC_ARG_WITH(glib, [ --with-glib=DIR Use uninstalled copy of glib])
AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
echo $enable_xim, enable_xim="yes")
AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
AC_ARG_WITH(threads, [ --with-threads=[posix] support threading ])
if test "x$enable_debug" = "xyes"; then
test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
@@ -80,8 +60,6 @@ else
fi
fi
AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}")
# Build time sanity check...
AM_SANITY_CHECK
@@ -91,138 +69,36 @@ AM_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
changequote(,)dnl
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
CFLAGS="$CFLAGS -Wall"
fi
if test "x$enable_ansi" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ansi" ;;
esac
if test -z "`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`" ; then
CFLAGS="$CFLAGS -ansi"
fi
case " $CFLAGS " in
*[\ \ ]-pedantic[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -pedantic" ;;
esac
if test -z "`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`" ; then
CFLAGS="$CFLAGS -pedantic"
fi
fi
fi
changequote([,])dnl
# define a MAINT-like variable REBUILD which is set if Perl
# and awk are found, so autogenerated sources can be rebuilt
AC_PROG_AWK
AC_CHECK_PROGS(PERL, perl5 perl)
# We would like indent, but don't require it.
AC_CHECK_PROG(INDENT, indent, indent)
REBUILD=\#
if test -n "$PERL" && perl -v | grep 'version 5.' > /dev/null ; then
if test -n "$AWK" ; then
REBUILD=
fi
fi
AC_SUBST(REBUILD)
dnl The DU4 header files don't provide library prototypes unless
dnl -std1 is given to the native cc.
AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
gtk_save_LIBS=$LIBS
LIBS="$LIBS -lm"
AC_TRY_RUN([#include <math.h>
int main (void) { return (log(1) != log(1.)); }],
AC_MSG_RESULT(none needed),
gtk_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -std1"
AC_TRY_RUN([#include <math.h>
int main (void) { return (log(1) != log(1.)); }],
AC_MSG_RESULT(-std1),
AC_MSG_RESULT()
CFLAGS=$gtk_save_CFLAGS
AC_MSG_WARN(
[No ANSI prototypes found in library. (-std1 didn't work.)])
)
)
LIBS=$gtk_save_LIBS
dnl NeXTStep cc seems to need this
AC_MSG_CHECKING([for extra flags for POSIX compliance])
AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
AC_MSG_RESULT(none needed),
gtk_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -posix"
AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
AC_MSG_RESULT(-posix),
AC_MSG_RESULT()
CFLAGS=$gtk_save_CFLAGS
AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
if test "x$enable_xim" = "xyes"; then
CFLAGS="$CFLAGS -DUSE_XIM"
fi
if test x$with_glib = xyes ; then
AC_MSG_ERROR([
*** Directory must be specified for --with-glib])
fi
if test x$with_glib = x ; then
# Look for separately installed glib
AM_PATH_GLIB(1.1.4,,
AC_MSG_ERROR([
*** GLIB 1.1.4 or better is required. The latest version of GLIB
*** is always available from ftp://ftp.gtk.org.]),
gmodule)
glib_cflags=$GLIB_CFLAGS
glib_libs=$GLIB_LIBS
else
# Use uninstalled glib (assume they got the version right)
GLIB_CONFIG=$with_glib/glib-config
if test -x $GLIB_CONFIG ; then
:
else
AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
fi
# For use in gtk-config
glib_cflags=`$GLIB_CONFIG --cflags`
glib_libs=`$GLIB_CONFIG --libs`
glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
# canonicalize relative paths
case $with_glib in
/*)
glib_dir=$with_glib
;;
*)
glib_dir="\$(top_builddir)/$with_glib"
;;
esac
GLIB_CFLAGS="-I$glib_dir"
GLIB_LIBS=$glib_dir/libglib-$glib_release.la
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
fi
AC_SUBST(glib_cflags)
AC_SUBST(glib_libs)
# Find the X11 include and library directories
AC_PATH_X
AC_PATH_XTRA
if test "x$no_x" = "xyes"; then
AC_MSG_ERROR([
*** X libraries or include files not found. Check 'config.log' for
*** more details.])
fi
if test "x$x_includes" = "x"; then
x_includes="/usr/include"
fi
@@ -233,15 +109,9 @@ saved_ldflags="$LDFLAGS"
CFLAGS="$CFLAGS $X_CFLAGS"
LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
if test "x$no_x" = "xyes"; then
AC_MSG_ERROR([
*** X libraries or include files not found. Check 'config.log' for
*** more details.])
fi
# Checks for libraries.
# Check for the X11 library
AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS",
AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS",
AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
$X_EXTRA_LIBS)
@@ -262,16 +132,7 @@ AC_CHECK_LIB(Xext, XShapeCombineMask,
if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
x_libs="-lXext $x_libs"
fi
AC_DEFINE(HAVE_SHAPE_EXT),
,
$x_libs)
# Check for XConvertCase (X11R6 specific)
AC_CHECK_LIB(X11, XConvertCase,
AC_DEFINE(HAVE_XCONVERTCASE),
,
$x_libs)
AC_DEFINE(HAVE_SHAPE_EXT),, $x_libs)
x_cflags="$X_CFLAGS"
x_ldflags="$X_LDFLAGS $X_LIBS"
@@ -289,29 +150,15 @@ else
AC_DEFINE(XINPUT_NONE)
fi
# Threads
CFLAGS="$saved_cflags"
LDFLAGS="$saved_ldflags"
if test "x$with_threads" = "xposix" || test "x$with_threads" = "xyes"; then
AC_CHECK_LIB(pthread, pthread_attr_init,
[AC_DEFINE(USE_PTHREADS)
x_libs="$x_libs -lpthread"
CFLAGS="$CFLAGS -D_REENTRANT"],
# AIX has libpthreads, cause they're special. Special friends (TM)
AC_CHECK_LIB(pthreads, pthread_attr_init,
[AC_DEFINE(USE_PTHREADS)
x_libs="$x_libs -lpthreads"
CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE"]))
fi
AC_SUBST(x_cflags)
AC_SUBST(x_includes)
AC_SUBST(x_ldflags)
AC_SUBST(x_libs)
AC_SUBST(xinput_progs)
CFLAGS="$saved_cflags"
LDFLAGS="$saved_ldflags"
if test "x$enable_shm" = "xyes"; then
# Check for shared memory
AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
@@ -417,81 +264,21 @@ AC_C_CONST
AC_TYPE_SIGNAL
AC_FUNC_MMAP
# Check if <sys/select.h> needs to be included for fd_set
AC_MSG_CHECKING([for fd_set])
# Check for sys/select.h
AC_MSG_CHECKING([fd_set and sys/select])
AC_TRY_COMPILE([#include <sys/types.h>],
[fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
if test $gtk_ok = yes; then
AC_MSG_RESULT([yes, found in sys/types.h])
else
if test $gtk_ok = no; then
AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
if test $gtk_ok = yes; then
AC_DEFINE(HAVE_SYS_SELECT_H)
AC_MSG_RESULT([yes, found in sys/select.h])
else
AC_DEFINE(NO_FD_SET)
AC_MSG_RESULT(no)
fi
fi
# Duplicate `widechar' tests from `glib'.
# Check for wchar.h
if test x = y; then
# will not be executed
# hack so as not to update `acconfig.h'
AC_CHECK_HEADERS(wchar.h wctype.h)
AC_CHECK_FUNCS(broken_wctype)
fi
AC_MSG_CHECKING(for wchar.h)
AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
if test $gtk_ok = yes; then
ac_kludge=HAVE_WCHAR_H
AC_DEFINE($ac_kludge)
fi
AC_MSG_RESULT($gtk_ok)
# Check for wctype.h (for iswalnum)
AC_MSG_CHECKING(for wctype.h)
AC_TRY_CPP([#include <wctype.h>], gtk_ok=yes, gtk_ok=no)
if test $gtk_ok = yes; then
ac_kludge=HAVE_WCTYPE_H
AC_DEFINE($ac_kludge)
fi
AC_MSG_RESULT($gtk_ok)
# in Solaris 2.5, `iswalnum' is in -lw
GDK_WLIBS=
AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
# The following is necessary for Linux libc-5.4.38
oLIBS="$LIBS"
LIBS="$LIBS $GDK_WLIBS"
AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
AC_TRY_LINK([#include <stdlib.h>],[
#if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
# ifdef HAVE_WCTYPE_H
# include <wctype.h>
# else
# ifdef HAVE_WCHAR_H
# include <wchar.h>
# endif
# endif
#else
# define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
#endif
iswalnum((wchar_t) 0);
], gtk_ok=yes, gtk_ok=no)
LIBS="$oLIBS"
if test $gtk_ok = no; then
ac_kludge=HAVE_BROKEN_WCTYPE
AC_DEFINE($ac_kludge)
GDK_WLIBS=
AC_DEFINE(NO_FD_SET)
fi
AC_MSG_RESULT($gtk_ok)
AC_SUBST(GDK_WLIBS)
AC_OUTPUT([
Makefile
@@ -500,4 +287,5 @@ docs/Makefile
gdk/Makefile
gtk/Makefile
gtk/gtkfeatures.h
], [chmod +x gtk-config])
],
[chmod +x gtk-config])

View File

@@ -1,64 +0,0 @@
Incompatible Changes from GTK+-1.0 to GTK+-1.2:
* GtkAcceleratorTable has been replaced with GtkAccelGroup
* GtkMenuFactory has been replaced with GtkItemFactory, although
a version of GtkMenuFactory is provided to ease compatibility.
* GtkButton has been changed to derive from GtkBin.
To access a button's child, use GTK_BIN (button)->child, instead
of the old GTK_BUTTON (button)->child.
* The selection API has been slightly modified:
gtk_selection_add_handler() and gtk_selection_add_handler_full()
have been removed. To supply the selection, one now register
the targets one is interested in with:
void gtk_selection_add_target (GtkWidget *widget,
GdkAtom selection,
GdkAtom target,
guint info);
or:
void gtk_selection_add_targets (GtkWidget *widget,
GdkAtom selection,
GtkTargetEntry *targets,
guint ntargets);
When a request for a selection is received, the new "selection_get"
signal will be called:
void "selection_get" (GtkWidget *widget,
GtkSelectionData *selection_data,
guint info,
guint time);
A "time" parameter has also been added to the "selection_received"
signal.
void "selection_received" (GtkWidget *widget,
GtkSelectionData *selection_data,
guint time);
* The old drag and drop API has been completely removed and replaced.
See the reference documentation for details on the new API.
* Support for Themes has been added. In general, this does
not affect application code, however, a few new rules should
be observed:
- To set a shape for a window, you must use
gtk_widget_shape_combine_mask() instead of
gdk_window_shape_combine_mask(), or the shape will be
reset when switching themes.
- It is no longer permissable to draw directly on an arbitrary
widget, or to set an arbitrary widget's background pixmap.
If you need to do that, use a GtkDrawingArea or (for a
toplevel) the new GtkDrawWindow widget.

View File

@@ -13,7 +13,6 @@ EXTRA_DIST = \
gtk-config.txt \
gtk_tut.sgml \
gtk_tut_it.sgml \
gtk_tut_fr.sgml \
debugging.txt \
developers.txt \
refcounting.txt \

View File

@@ -1,210 +0,0 @@
This document describes some of the internals of the DND handling
code.
Organization
============
The DND code is split between a lowlevel part - gdkdnd.c and a
highlevel part - gtkdnd.c. To put it simply, gdkdnd.c contain the
portions of DND code that are easiest to do in raw X, while gtkdnd.c
contains the portions of DND that are easiest to do with an event loop
and high level selection handling.
Except for a few details of selection handling, most of the
dependencies on the DND protocol are confined to gdkdnd.c.
There are two or three supported protocols - Motif DND,
Xdnd and a pseudo-protocol ROOTWIN, which is used for drops
on root windows that aren't really accepting drops.
gdkdnd.c divides into 4 pieces:
1) Utility functions (finding client windows)
2) Motif specific code (the biggest chunk)
3) Xdnd specific code
4) The public interfaces
The code in gtkdnd.c roughly consists of three parts
1) General utility functions
2) Destination side code
3) Source side code.
Both on the source and dest side, there is some division
between the low level layers and the default handlers,
though they are rather mixed in many cases.
Structures and Memory Management
================================
Information about source sites and drop sites is stored
in the structures GtkSourceSite and GtkDestSite.
Information about in-progress drags and drops is stored
in the structures GtkSourceInfo and GtkDestInfo.
The GtkSourceInfo structure is created when the drag
begins, and persists until the drag either completes
or times out. A pointer to it is stored in
dataset-data for the GdkDragContext, however there
is no ownership. If the SourceInfo is destroyed
before the context, the field is simply cleared.
A GtkDestInfo is attached to each GdkDragContext
that is received for an incoming drag. In contrast
to the SourceInfo the DestInfo is "owned" by the
context, and when the context is destroyed, destroyed.
The GDK API
===========
It is expect that the GDK DND API will never be
used by anything other than the DND code in GTK+.
/* Drag and Drop */
GdkDragContext * gdk_drag_context_new (void);
void gdk_drag_context_ref (GdkDragContext *context);
void gdk_drag_context_unref (GdkDragContext *context);
These create and refcount GdkDragContexts in a
straightforward manner.
/* Destination side */
void gdk_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time);
void gdk_drop_reply (GdkDragContext *context,
gboolean ok,
guint32 time);
void gdk_drop_finish (GdkDragContext *context,
gboolean success,
guint32 time);
GdkAtom gdk_drag_get_selection (GdkDragContext *context);
/* Source side */
GdkDragContext * gdk_drag_begin (GdkWindow *window,
GList *targets,
GdkDragAction actions);
gboolean gdk_drag_get_protocol (guint32 xid,
GdkDragProtocol *protocol);
void gdk_drag_find_window (GdkDragContext *context,
GdkWindow *drag_window,
gint x_root,
gint y_root,
GdkWindow **dest_window,
GdkDragProtocol *protocol);
gboolean gdk_drag_motion (GdkDragContext *context,
GdkWindow *dest_window,
GdkDragProtocol protocol,
gint x_root,
gint y_root,
GdkDragAction action,
guint32 time);
void gdk_drag_drop (GdkDragContext *context,
guint32 time);
void gdk_drag_abort (GdkDragContext *context,
guint32 time);
GdkAtom gdk_drag_get_selection (GdkDragContext *context);
Retrieves the selection that will be used to communicate
the data for the drag context (valid on both source
and dest sides)
Cursors and window heirarchies
==============================
The DND code, when possible (and it isn't possible over
Motif window) uses a shaped window as a drag icon.
Because the cursor may fall inside this window during the
drag, we actually have to figure out which window
the cursor is in _ourselves_ so we can ignore the
drag icon properly. (Oh for OutputOnly windows!)
To avoid obscene amounts of server traffic (which are only
slighly observerable locally, but would really kill a
session over a slow link), the code in GDK does
XGetWindowAttributes for every child of the root window at
the beginning of the drag, then selects with
SubstructureNotifyMask on the root window, so that
it can update this list.
It probably would be easier to just reread the entire
list when one of these events occurs, instead of
incrementally updating, but updating the list in
sync was sort of fun code, so I did it that way ;-)
There is also a problem of trying to follow the
mouse cursor as well as possible. Currently, the
code uses PointerMotionHint, and an XQueryPointer
on MotionNotify events. This results in pretty
good syncing, but may result in somewhat poor
accuracy for drops. (Because the coordinates of
the drop are the coordinates when the server receives
the button press, which might actually be before
the XQueryPointer for the previous MotionNotify
event is done.)
Probably better is doing MotionNotify compression
and discarding MotionNotify events when there
are more on the queue before the next ButtonPress/Release.
Proxying
========
A perhaps rather unusual feature of GTK's DND is proxying. A
dest site can be specified as a proxy drop site for another
window. This is most needed for the plug-socket code - the
socket needs to pass on drags to the plug since the original
source only sees toplevel windows. However, it can also be
used as a user visible proxy - i.e., dragging to buttons on
the taskbar.
Internally, when the outer drag enters a proxy dest site, a
new source drag is created, with SourceInfo and
GdkDragContext. From the GDK side, it looks much like a
normal source drag; on the GTK+ side, most of the code is
disjoint. The need to pass in a specific target window
is the reason why the GDK DND API splits
gdk_drag_find_window() and gdk_drag_motion().
For proxy drags, the GtkDestInfo and GtkSourceInfo for the
drag point at each other.
Because the abstraction of the drag protocol is at the GDK
level, a proxy drag from Motif to Xdnd or vice versa happens
pretty much automatically during the drag, though the
drop can get complicated. For Xdnd <-> Motif,
Motif <-> Xdnd, or Motif <-> Motif drags, it is necessary to
for the Proxy to retrieve the data and pass it on to
the true destination, since either the selection names
differ or (Motif<->Motif), the proxy needs to know
about the XmDRAG_SUCCESS/FAILURE selection targets.
Further Reading:
================
Xdnd:
The spec is at:
http://www.cco.caltech.edu/~jafl/xdnd/
Motif:
The Motif DND protocol is best described in the
Hungry Programmers _Inside Lesstif_ book, available
from:
http://www.igpm.rwth-aachen.de/~albrecht/hungry.html
Harald Albrecht and Mitch Miers have done a far
better job at documenting the DND protocol then
anything the OpenGroup has produced.
Owen Taylor
otaylor@redhat.com
Oct 18, 1998

View File

@@ -8,9 +8,7 @@
<!-- NOTE: Use only one author tag, otherwise sgml2txt barfs - TRG -->
<author>Nathan Froyd, Tony Gale, Shawn T. Amundson.
<date>July 6th 1998
<date>May 11th 1998
<abstract>
This document is intended to answer questions that are likely to be
frequently asked by programmers using GTK+ or people who are just
@@ -365,7 +363,7 @@ using the following steps:
<itemize>
<item> In a bourne shell descendant (e.g. bash) type:
<verb>
export CVSROOT=':pserver:anonymous@anoncvs.gimp.org:/debian/home/gnomecvs'
export CVSROOT=':pserver:anonymous@cvs.gimp.org:/debian/home/gnomecvs'
</verb>
<item>Next, the first time the source tree is checked out, a cvs login
is needed.
@@ -376,16 +374,8 @@ This will ask you for a password. There is no password for cvs.gimp.org,
so just enter a carriage return.
<item>To get the tree and place it in a subdir of your current working directory, issue the command:
<verb>
cvs -z3 get gtk+
cvs -z9 get gtk+
</verb>
Note that with the GTK+ 1.1 tree, glib has been moved to a separate CVS
module, so if you don't have glib installed you will need to get that
as well:
<verb>
cvs -z3 get glib
</verb>
</itemize>
<!-- ----------------------------------------------------------------- -->
<sect1>How can I contribute to GTK+?

View File

@@ -1,198 +0,0 @@
<!doctype linuxdoc system>
<article>
<!-- Title information -->
<title>The GTK+ Drawing Kit Programming Manual
<author>Shawn T. Amundson, Peter Mattis
<date>July 26, 1998
<abstract>
This document aims at teaching user how to effectively program in
GDK, the GTK+ Drawing Kit, and to serve as a reference guide to
more experienced GTK+ programmers. It is a work in progress.
<!-- Table of contents -->
<toc>
<!-- Begin the document -->
<!-- ***************************************************************** -->
<sect>Introduction
<p>
GDK is designed as a wrapper library that lies on top of Xlib. It
performs many common and desired operations for a programmer instead
of the programmer having to explicitly ask for such functionality from
Xlib directly. For example, GDK provides a common interface to both
regular and shared memory XImage types. By doing so, an application
can nearly transparently use the fastest image type available. GDK
also provides routines for determining the best available color depth
and the best available visual which is not always the default visual
for a screen.
GDK is distributed and developed with GTK+, and is licensed under the
GNU Library General Public Licence (LGPL).
<sect>Getting Started
<sect1>Initialization
<p>
Initialization of GDK is easy. Simply call gdk_init() passing
in the argc and argv parameters.
<tscreen><verb>
int main (int argc, char *argv[])
{
/* Initialize GDK. */
gdk_init (&amp;argc, &amp;argv);
/* Cleanup of GDK is done automatically when the program exits. */
return 0;
}
</verb></tscreen>
Generally, GDK initialization is done by gtk_init() in GTK+. This means
that when using GTK+, you do not need to directly call gdk_init().
<sect1>An Example using GDK with GTK+
<p>
This example demonstrates drawing a line using the foreground
color of the GtkDrawArea widget it is drawn inside. The example
will end when you click inside the window, which is filled by the
GtkDrawingArea widget.
The line is drawn during the expose event so that when the window
drawing is done whenever it is needed.
<tscreen><verb>
#include <gtk/gtk.h>
/* The expose callback does the drawing of the line */
int
expose_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
GdkGC *gc;
printf("expose...\n");
/* The GC is the Graphics Context. Here it is borrowed from the widget */
gc = widget->style->fg_gc[GTK_STATE_NORMAL];
gdk_draw_line (widget->window, /* GDK Window of GtkDrawingArea widget */
gc, /* Graphics Context */
0, /* x1, left */
0, /* y1, top */
200, /* x2, right */
200); /* y2, bottom */
}
/* This quits GTK+ */
void destroy (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
int main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *darea;
int events;
/* This initializes both GTK+ and GDK */
gtk_init (&amp;argc, &amp;argv);
/* Create a window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (destroy), NULL);
/* Create a drawing area widget. This widget actually is just a
simple widget which provides us an GDK window to draw on and
takes care of all the toolkit integration, like providing the
ability to add it to the window with gtk_contianer_add() */
darea = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), darea);
/* Set the width and height (arguments are in that order) */
gtk_drawing_area_size (GTK_DRAWING_AREA (darea), 200, 200);
/* Drawing in the expose event is important to keep the
draw line always on the GDK window */
gtk_signal_connect (GTK_OBJECT (darea), "expose_event",
GTK_SIGNAL_FUNC (expose_callback), NULL);
/* We get the events, then add in button press. If we did not
do this, we would not be notified of button press events in
the GtkDrawingArea widget */
events = gtk_widget_get_events (darea);
gtk_widget_set_events (darea, events | GDK_BUTTON_PRESS_MASK);
/* If we click on the darea, the application will exit */
gtk_signal_connect_object (GTK_OBJECT (darea), "button_press_event",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (window));
gtk_widget_show (darea);
gtk_widget_show (window);
/* The GTK+ main idle loop */
gtk_main();
/* Cleanup of GDK is done automatically when the program exits. */
return 0;
}
</verb></tscreen>
<sect>The Graphics Context
<p>
The Graphics Context, or GC, defines how things should be drawn,
including color, font, fill, tile, stipple, clipping mask, line
width, line style, and join style.
<sect1>Color
<p>
Changing color is done by changing the forground or background color
of the GC.
<sect>Drawing Commands
<sect>Event Handling
<sect>Understanding and Using Visuals
<sect>Creating and Using New Windows
<sect>Pixmaps
<sect>Images
<sect>Fonts
<sect>
<sect>About this Document
<sect1>History
<P>
This document was originially written by Peter Mattis and entitled
"The General Drawing Kit". It was meant as a reference guide.
This version of the document has been renamed and is meant as a general
programming guide.
<sect1>Copying
<p>
Copyright (c) 1996 Peter Mattis
<p>
Copyright (c) 1998 Shawn T. Amundson
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by Peter Mattis.
</article>

View File

@@ -40,7 +40,7 @@ and \-\-libs options. This option must be specified before any
.BR gimp (1),
.BR gimptool (1)
.SH COPYRIGHT
Copyright \(co 1998 Owen Taylor
Copyright \(co 1995 Spencer Kimball and Peter Mattis
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,

View File

@@ -1,6 +1,5 @@
\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
@@ -10,8 +9,8 @@
@c %**end of header
@set edition 1.0
@set update-date 23 August 1998
@set update-month August 1998
@set update-date 29 January 1998
@set update-month January 1998
@ifinfo
This file documents GTK, the GIMP Toolkit
@@ -45,7 +44,7 @@ approved by Peter Mattis.
@title The GIMP Toolkit
@subtitle Version @value{edition}
@subtitle @value{update-month}
@author by Peter Mattis and the GTK+ team
@author by Peter Mattis
@page
@vskip 0pt plus 1filll
@@ -84,8 +83,7 @@ This is edition @value{edition} of the GTK documentation,
@menu
* Copying:: Your rights.
* Overview:: What is GTK?
* Types::
* Objects::
* Objects:: Object overview.
* Signals:: Signals overview.
* Widgets:: Widget overview.
* Other Objects:: Utility objects.
@@ -122,17 +120,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 our own protection, we must make certain that everyone finds
Also, for my 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 accompany it.
Public Licenses that accompanies it.
@node Overview, Types, Copying, Top
@node Overview, Objects, Copying, Top
@comment node-name, next, previous, up
@chapter What is GTK?
@cindex Overview
@@ -153,261 +151,26 @@ 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.
@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, Objects, Overview, Top
@node Objects, Signals, Overview, Top
@comment node-name, next, previous, up
@chapter Types
@cindex type
@cindex type system
@cindex class
@chapter Object Overview
@cindex Objects
@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
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.
GTK implements a semi-simple type system with an associated class
mechanism for widgets and several other useful objects. This type
system is intended to be general enough to allow both a smooth binding
of dynamically typed languages to Gtk, as well as to serve for a
rigorous and formalistic definition of the larger part of the Gtk API.
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.
@c The GtkObject
@c type is the root of the class hierarchy. It provides a few items needed
@c by all classes, the foundation for the signal (@pxref{Signals})
@c mechanism and the ``destroy'' method.
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 and language binders, so you might want to skip ahead to the
next chapter, which talks about the object oriented stuff.
@menu
* Type introduction::
* Basics::
* Simple types::
* Enumerations and flags::
* Strings::
* Boxed types::
* Callbacks::
* Composite types::
@end menu
@node Type introduction, Basics, Types, Types
@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 well 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 memory that the returned pointer
points to? 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. So 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 gratuitously 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
@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 of their semantics,
but one is listed 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 really correspond
to a fundamental type and thus there is no name for it.
@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
@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
New types are registered with the @code{gtk_type_unique} function. Any
kind oftype can be registered with @code{gtk_type_unique} but there are
convenience functions for most fundamental types. Each fundamental type
has its own interpretation of the rules below and these convenience
functions should be used to automatically get the type registration
right. So, don't be put off by the apparent complexity of the interface
to @code{gtk_type_unique}. You will be using it only for new widgets,
and there the rules are simple.
@section Type utility functions
The @code{GtkTypeInfo} structure is used to communicate information to
@code{gtk_type_unique} as opposed to passing in large numbers of
@@ -423,257 +186,123 @@ struct _GtkTypeInfo
guint class_size;
GtkClassInitFunc class_init_func;
GtkObjectInitFunc object_init_func;
gpointer reserved_1;
gpointer reserved_2;
GtkClassInitFunc base_class_init_func;
GtkArgSetFunc arg_set_func;
GtkArgGetFunc arg_get_func;
@}
@end example
@itemize @bullet
@item
The @code{type_name} field refers to the name of the type. This is the
same name that is used in the static definitions. It is convention for
the type name to be closely related to the name of the underlying C
type. For example, the type name of the @code{GtkObject} structure is
``GtkObject'', and the name of the @code{GtkWindowType} enumeration is
``GtkWindowType''. Note that the C type corresponding to ``GtkObject''
is really a pointer to a @code{GtkObject} struct, but the name has no
``*'' in it.
The @code{type_name} field refers to the name of the type. It is
convention for the type name to be the same as the C structure type. For
example, the type name of the @code{GtkObject} structure is
``GtkObject''.
@item
The @code{object_size} field refers to the size in bytes of the C
structure for types that have such a structure. The easiest (and
portable) means of computing this size is by using the C @code{sizeof}
operator. For instance, the sizeof of the @code{GtkObject} structure is
computed by doing @code{sizeof (GtkObject)}. When the type has no
associated structure or when you do not want to support the
@code{gtk_type_new} function for the new type, set @code{object_size} to
0. Only types derived from GTK_TYPE_OBJECT can be handled by
@code{gtk_type_new}, anyway.
structure. The easiest (and portable) means of computing this size is by
using the C @code{sizeof} operator. For instance, the sizeof of the
@code{GtkObject} structure is computed by doing @code{sizeof
(GtkObject)}.
@item
The @code{class_size} field refers to the size in bytes of the C
structure for the class. Again, the @code{sizeof} operator should be
used to compute this value. If you don't want to have a class structure
for this type, set the field to 0. @code{gtk_type_class} will then
always return @code{NULL}.
structure for the class. Again, the @code{sizeof} operator should be
used to compute this value.
@item
The @code{class_init_func} and @code{base_class_init_func} fields are
callbacks which are used by the type mechanism to initialize class
specific fields. The single argument these function taks is a pointer to
a class structure. When you do not need one or both of them, set the
corresponding field to @code{NULL}. The @code{class_init_func} will be
called at most once, right after the class structure of size
@code{class_size} has been allocated. The interaction between
@code{class_init_func} and @code{base_class_init_func} is only really
useful for the full-fledged object system. It is described there
@pxref{Objects}.
The @code{class_init_func} field is a callback which is used by the type
mechanism to initialize class specific fields. The single argument this
function takes is a pointer to a class structure.
@item
The @code{object_init_func} field is a callback which is used by the
type mechanism to initialize object specific fields for structures that
have been allocated via @code{gtk_type_new}. The single argument this
functions takes is a pointer to an object structure. If you do not want
any special object initialization to take place, set this to
@code{NULL}. All object initialization functions for all types that are
part of the inheritance chain are called, starting with the most basic
type.
type mechanism to initialize object specific fields. The single argument
this functions takes is a pointer to an object structure.
@c FIXME!! Document the arg_set_func and arg_get_func..
@end itemize
@deftypefun guint gtk_type_unique (GtkType @var{parent_type}, GtkTypeInfo *@var{type_info})
The @var{parent_type} is simply the new types parent type. If
@var{parent_type} is GTK_TYPE_INVALID, then the new type is a new
fundamental type. You should @b{never} register new fundamental types.
@var{type_info} is a pointer to a structure which contains necessary
information for construction of the new type.
You can only register a specific name once.
@deftypefun guint gtk_type_unique (guint @var{parent_type}, GtkTypeInfo *@var{type_info})
The @var{parent_type} is simply the value of the new types parent
type. If @var{parent_type} is 0, then the new type is the root of the
type hierarchy. @var{type_info} is a pointer to a structure which
contains necessary information for construction of the new
type. Specifically, the @code{type_name}, @code{object_size} and
@code{class_size} fields are required. The @code{class_init_func},
@code{object_init_func} and @code{value_init_func} fields may be NULL.
@end deftypefun
@deftypefun gchar* gtk_type_name (GtkType @var{type})
@deftypefun gchar* gtk_type_name (guint @var{type})
The returned string is the name of @var{type} as specified to
@code{gtk_type_unique}.
@end deftypefun
@deftypefun GtkType gtk_type_from_name (guchar *@var{name})
@deftypefun guint gtk_type_from_name (guchar *@var{name})
Return the type associated with @var{name}. If there is no type
associated with @var{name}, then GTK_TYPE_INVALID will be returned.
associated with @var{name}, then 0 will be returned.
@end deftypefun
@deftypefun GtkType gtk_type_parent (GtkType @var{type})
Returns the parent type of @var{type} or GTK_TYPE_INVALID if @var{type}
is a fundamental type.
@deftypefun guint gtk_type_parent (guint @var{type})
Returns the parent type of @var{type} or 0 if @var{type} is the root of
the type hierarchy.
@end deftypefun
@deftypefun gpointer gtk_type_class (GtkType @var{type})
@deftypefun gpointer gtk_type_class (guint @var{type})
Returns the initialized class structure for @var{type}. The class
structure is actually created and initialized the first time it is
needed. Refer to @pxref{Objects} for details on how this initialization works for GTK_TYPE_OBJECT derived types.
@c If creation and initialization occurs, the @code{class_size}
@c field of the @code{GtkTypeInfo} structure used to initialize this type
@c is used to determine how large the class structure is. The
@c @code{class_init_func} field from the @code{GtkTypeInfo} structure is
@c called for all the members in the types ancestry, including the
@c type. The order of this invocation proceeds from the root on down. For
@c example, the @code{GtkWidgetClass} is first initialized as an
@c @code{GtkObjectClass} by the object class initialization routine and
@c then by the widget class initialization routine. This allows the widget
@c class initialization routine to override values set by the object class
@c initialization routine.
The returned structure is shared by all objects of @var{type} and, as
such, should not be modified.
needed. If creation and initialization occurs, the @code{class_size}
field of the @code{GtkTypeInfo} structure used to initialize this type
is used to determine how large the class structure is. The
@code{class_init_func} field from the @code{GtkTypeInfo} structure is
called for all the members in the types ancestry, including the
type. The order of this invocation proceeds from the root on down. For
example, the @code{GtkWidgetClass} is first initialized as an
@code{GtkObjectClass} by the object class initialization routine and
then by the widget class initialization routine. This allows the widget
class initialization routine to override values set by the object class
initialization routine. The returned structure is shared by all objects
of @var{type} and, as such, should not be modified.
@end deftypefun
@deftypefun gpointer gtk_type_new (GtkType @var{type})
Returns a new instance of an @var{type} object. This works only for GTK_TYPE_OBJECT derived types. Please see @pxref{Objects}.
@c The @code{object_size}
@c and @code{object_init_func} fields of the @code{GtkTypeInfo} structure
@c are used to determine the objects allocated size and the object specific
@c initialization routine. Similarly to the class initialization, all the
@c object initialization routines from the root on down to the particular
@c type being created are invoked.
@deftypefun gpointer gtk_type_new (guint @var{type})
Returns a new instance of an @var{type} object. The object structure is
created and initialized similarly to the class structure (as described
above). The @code{object_size} and @code{object_init_func} fields of the
@code{GtkTypeInfo} structure are used to determine the objects allocated
size and the object specific initialization routine. Similarly to the
class initialization, all the object initialization routines from the
root on down to the particular type being created are invoked.
@end deftypefun
@deftypefun void gtk_type_describe_heritage (GtkType @var{type})
@deftypefun void gtk_type_describe_heritage (guint @var{type})
Prints the type heritage for @var{type}. The heritage for a type
includes the type and all its parent types up the type tree.
@end deftypefun
@deftypefun void gtk_type_describe_tree (GtkType @var{type}, gboolean @var{show_size})
@deftypefun void gtk_type_describe_tree (guint @var{type}, gint @var{show_size})
Prints the type tree which starts at @var{type}. @var{show_size} is a
boolean which determines whether type sizes are printed.
@end deftypefun
@deftypefun gboolean gtk_type_is_a (GtkType @var{type}, GtkType @var{is_a_type})
@deftypefun gint gtk_type_is_a (guint @var{type}, guint @var{is_a_type})
A predicate function which determines whether the relation @var{type}
is_a @var{is_a_type} is true.
@end deftypefun
@c @deftypefun void gtk_type_get_arg (GtkObject *@var{object}, GtkType @var{type}, GtkArg *@var{arg}, guint @var{arg_id})
@c @end deftypefun
@c @deftypefun void gtk_type_set_arg (GtkObject *@var{object}, GtkType @var{type}, GtkArg *@var{arg}, guint @var{arg_id})
@c @end deftypefun
Values of all types can be handled uniformly by storing them into a
@code{GtkArg} structure. The @code{GtkArg} has the following fields:
@table @code
@item gchar *name
This can be used to give the value represented by this @code{GtkArg}
structure a name. It is not used much.
@item GtkType type
The type of this value.
@item union d
A big union that has (at least conceptually) one member for each
fundamental type. You should not access these members directly.
Rather, use the @code{GTK_VALUE_*} macros. There is one macro for each
fundamental type, and its name is derived from the name of the
GtkFundamentalType enumeration members simply by replacing ``Gtk_TYPE''
with ``GTK_VALUE''. All @code{GTK_VALUE_*} macros take a @code{GtkArg}
structure as their only parameter (@emph{not} a pointer) and evaluate to
a lvalue.
@end table
For example, the accessor for the fundamental type GTK_TYPE_INT is
called GTK_VALUE_INT and you could use it like this:
@example
GtkArg value;
value.name = NULL;
value.type = GTK_TYPE_INT;
GTK_VALUE_INT(value) = 7;
@end example
@node Simple types, Enumerations and flags, Basics, Types
@section Simple Types
The Gtk type system has a full set of the usual simple types: integers,
floating point numbers, but also boolean and character. You can not
derive new types from these.
@multitable {GTK_TYPE_POINTER} {"gpointer"} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
@item Enum @tab Name @tab Description
@item GTK_TYPE_NONE @tab "void"
@tab A type without value.
@item GTK_TYPE_CHAR @tab "char"
@tab A 8-bit unsigned number representing a character. Numbers
between 0 and 127 are ASCII, the rest is undefined.
@item GTK_TYPE_BOOL @tab "gboolean"
@tab The boolean type. It is some small integer where the number 0
represents false and 1 is true. No other values are allowed.
@item GTK_TYPE_INT @tab "gint"
@tab A signed integer with at least 32 bits.
@item GTK_TYPE_UINT @tab "guint"
@tab A unsigned integer with at least 32 bits.
@item GTK_TYPE_LONG @tab "glong"
@tab A signed integer with at least 32 bits.
@item GTK_TYPE_ULONG @tab "gulong"
@tab A unsigned integer with at least 32 bits. This is large enough to
hold a coerced pointer.
@item GTK_TYPE_FLOAT @tab "gfloat"
@tab A single precision floating point number.
@item GTK_TYPE_DOUBLE @tab "gfloat"
@tab A souble precision floating point number.
@item GTK_TYPE_POINTER @tab "gpointer"
@tab A untyped pointer. Do not use this if you can avoid it.
@end multitable
The values of these types are all represented `directly' with the C
types that are indicated in the `name' column above. @pxref{Boxed
types} for a discussion of this.
@node Enumerations and flags, Strings, Simple types, Types
@section Enumerations and Flags
@node Strings, Boxed types, Enumerations and flags, Types
@section Strings
@node Boxed types, Callbacks, Strings, Types
@section Boxed Types
@node Callbacks, Composite types, Boxed types, Types
@section Callbacks
@node Composite types, , Callbacks, Types
@section Composite Types
@node Objects, Signals, Types, Top
@chapter Objects
@deftypefun void gtk_type_get_arg (GtkObject *@var{object}, GtkType @var{type}, GtkArg *@var{arg}, guint @var{arg_id})
@end deftypefun
@deftypefun void gtk_type_set_arg (GtkObject *@var{object}, GtkType @var{type}, GtkArg *@var{arg}, guint @var{arg_id})
@end deftypefun
@section Object functions
The GtkObject type is the root of the type hierarchy used by GTK. It
provides a minimal set of fields used to implement the actual object,
class and signal mechanisms, as well as several utility routines which
make dealing with objects easier.
provides a minimal set of fields used to implement the actual
object, class and signal mechanisms, as well as several utility routines
which make dealing with objects easier.
For the adventurous, see @ref{Object Implementation}.
@@ -1122,37 +751,36 @@ 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.
@@ -1164,7 +792,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.
@@ -1176,18 +804,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.
@@ -1805,7 +1433,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
@@ -2146,7 +1774,7 @@ a @code{GtkWidget} object. @code{NULL} is returned on failure.
@gtkstdmacros{Combo, COMBO}
@page
@node GtkContainer, GtkCTree, GtkCombo, Widgets
@node GtkContainer, GtkCurve, GtkCombo, Widgets
@comment node-name, next, previous, up
@section The container widget
@@ -2225,111 +1853,8 @@ Remove @var{widget} from @var{container}.
@gtkstdmacros{Container, CONTAINER}
@page
@node GtkCTree, GtkCurve, GtkContainer, Widgets
@comment node-name, next, previous, up
@section The multi-column tree widget
@subsection Description
The GtkCTree widget is a multi-columned list with a designated column, the
@code{tree column}, to display hierarchically-organized data. Each node is
either a folder (a branch of the tree) or a leaf. Nodes can be
(recursively) expanded, collapsed, (un)selected, removed, moved, sorted etc.
GtkCTree is a descendant of @pxref{GtkCList}. Therefore, a cell in a column
other than the tree column can only contain a string, a pixmap, both or
nothing. A node in the tree column can contain a string and up to two pixmaps
and masks, indicating the "folder openend" and "folder closed" status.
Compared to GtkCList, there is no concept of row numbers. Therefore, a number
of GtkCList methods had to be re-implemented taking @code{GList *node}
arguments instead of @code{gint row}.
@subsection Options
@subsection Signals
@deftypefn Signal void GtkCTree::tree_expand (GtkCTree *@var{ctree}, GList *@var{node})
@end deftypefn
@deftypefn Signal void GtkCTree::tree_collapse (GtkCTree *@var{ctree}, GList *@var{node})
@end deftypefn
@deftypefn Signal void GtkCTree::tree_move (GtkCTree *@var{ctree}, GList *@var{node}, GList *@var{new_parent}, GList *@var{new_sibling})
@end deftypefn
@deftypefn Signal void GtkCTree::tree_select_row (GtkCTree *@var{ctree}, GList *@var{row}, gint @var{column})
@end deftypefn
@deftypefn Signal void GtkCTree::tree_unselect_row (GtkCTree *@var{ctree}, GList *@var{row}, gint @var{column})
@end deftypefn
@subsection Functions
@deftypefun GtkType gtk_ctree_get_type (void)
Returns the @code{GtkCTree} type identifier.
@end deftypefun
@deftypefun GtkWidget* gtk_ctree_new (gint @var{columns}, gint @var{tree_column})
Creates a new GtkCTree widget with the given number of columns and the given tree column.
On success, a pointer to the newly created widget is returned, and @code{NULL} otherwise.
@end deftypefun
@deftypefun GtkWidget* gtk_ctree_new_with_titles (gint @var{columns}, gint @var{tree_column}, gchar *@var{titles[]})
Creates a new GtkCTree widget with the given number of columns and the given tree column. The column titles are initialized to the strings of the array @var{titles}.
On success, a pointer to the newly created widget is returned, and @code{NULL} otherwise.
@end deftypefun
@deftypefun GList* gtk_ctree_insert (GtkCTree *@var{ctree}, GList *@var{parent}, GList *@var{sibling}, gchar *@var{text[]}, guint8 @var{spacing}, GdkPixmap *@var{pixmap_closed}, GdkPixmap *@var{mask_closed}, GdkPixmap *@var{pixmap_opened}, GdkPixmap *@var{mask_opened}, gboolean @var{is_leaf}, gboolean @var{expanded})
Inserts a new node at the given position. If @var{parent} == NULL, the node is
inserted at root level. If @var{sibling} == NULL, the node is appended to the
existing list of siblings. Otherwise, the node is inserted before @var{sibling}.
If not NULL, the two pixmaps/masks are used to indicate the opened/closed status
of the node. @var{spacing} is the number of pixels between pixmap and text.
If @var{is_leaf} == TRUE, the node cannot have any children.
The initial expanded/collapsed status is given by @var{expanded}.
On success, the pointer to the newly inserted node is returned, and NULL
otherwise.
@end deftypefun
@deftypefun void gtk_ctree_remove (GtkCTree *@var{ctree}, GList *@var{node})
Removes the given node and all its children.
@end deftypefun
@deftypefun void gtk_ctree_clear (GtkCTree *@var{ctree})
Removes all nodes of @var{ctree}.
@end deftypefun
@deftypefun void gtk_ctree_post_recursive (GtkCTree *@var{ctree}, GList *@var{node}, GtkCTreeFunc @var{func}, gpointer @var{data})
Apply @var{func} to @var{node} and all its children, traversing @var{ctree} in
post-order.
@end deftypefun
@deftypefun void gtk_ctree_pre_recursive (GtkCTree *@var{ctree}, GList *@var{node}, GtkCTreeFunc @var{func}, gpointer @var{data})
Apply @var{func} to @var{node} and all its children, traversing @var{ctree} in
pre-order.
@end deftypefun
@deftypefun gboolean gtk_ctree_is_visible (GtkCTree *@var{ctree}, GList *@var{node})
Returns the visibility status of the given node. A node is said to be visible
if in the chain of parent nodes every node is expanded. Or : the node is
currently being displayed (but not necessarily inside the viewing area).
@end deftypefun
@c @deftypefun void gtk_ctree_scroll_to (GtkCTree *@var{ctree}, gint @var{row}, gint@var{column}, gfloat @var{row_align}, gfloat @var{col_align})
@c Scroll the viewing area of the @code{GtkCtree} in @var{ctree} to @var{column}
@c and @var{row}. The @var{row_align} and @var{col_align} are between zero and
@c one, representing the location the row should appear on screen. Setting
@c @var{row_align} or the @var{col_align} to 0.0 will be the top or left of the
@c viewing area. Setting the @var{row_align} or @var{col_align} to 1.0 will
@c be the bottom or right of the viewing area. If the @var{row} or @var{column}
@c is -1 then there is no change.
@c @end deftypefun
@gtkstdmacros{CTree, CTREE}
@page
@node GtkCurve, GtkGammaCurve, GtkCTree, Widgets
@node GtkCurve, GtkGammaCurve, GtkContainer, Widgets
@comment node-name, next, previous, up
@section The curve widget
@@ -4899,7 +4424,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
@@ -5048,11 +4573,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
@@ -5135,7 +4660,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
@@ -5150,7 +4675,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.
@@ -5260,7 +4785,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
@@ -5290,7 +4815,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{Types}).
@code{gtk_type_is_a} function (@pxref{Objects}).
@end deftypefun
@@ -5446,7 +4971,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
@@ -5634,7 +5159,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
@@ -5644,5 +5169,3 @@ array instead of a linked list. This would shrink the overhead of the
@summarycontents
@contents
@bye
@c LocalWords: Gtk API formalistic

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -8,9 +8,7 @@
<!-- NOTE: Use only one author tag, otherwise sgml2txt barfs - TRG -->
<author>Nathan Froyd, Tony Gale, Shawn T. Amundson.
<date>July 6th 1998
<date>May 11th 1998
<abstract>
This document is intended to answer questions that are likely to be
frequently asked by programmers using GTK+ or people who are just
@@ -365,7 +363,7 @@ using the following steps:
<itemize>
<item> In a bourne shell descendant (e.g. bash) type:
<verb>
export CVSROOT=':pserver:anonymous@anoncvs.gimp.org:/debian/home/gnomecvs'
export CVSROOT=':pserver:anonymous@cvs.gimp.org:/debian/home/gnomecvs'
</verb>
<item>Next, the first time the source tree is checked out, a cvs login
is needed.
@@ -376,16 +374,8 @@ This will ask you for a password. There is no password for cvs.gimp.org,
so just enter a carriage return.
<item>To get the tree and place it in a subdir of your current working directory, issue the command:
<verb>
cvs -z3 get gtk+
cvs -z9 get gtk+
</verb>
Note that with the GTK+ 1.1 tree, glib has been moved to a separate CVS
module, so if you don't have glib installed you will need to get that
as well:
<verb>
cvs -z3 get glib
</verb>
</itemize>
<!-- ----------------------------------------------------------------- -->
<sect1>How can I contribute to GTK+?

View File

@@ -1,242 +0,0 @@
=head1 NAME
gtk_button - GTK+ push button widget
=head1 SYNOPSIS
#include <gtk/gtkbutton.h>
GtkType gtk_button_get_type (void);
GtkWidget* gtk_button_new (void);
GtkWidget* gtk_button_new_with_label (const gchar *label);
void gtk_button_pressed (GtkButton *button);
void gtk_button_released (GtkButton *button);
void gtk_button_clicked (GtkButton *button);
void gtk_button_enter (GtkButton *button);
void gtk_button_leave (GtkButton *button);
void gtk_button_set_relief (GtkButton *button,
GtkReliefStyle style);
GtkReliefStyle gtk_button_get_relief (GtkButton *button);
=head1 DESCRIPTION
This widget is a standard push button widget. Push button widgets
are generally used for allowing the user to click on them to initiate
a command.
This widget is a container widget which contains one child.
=head1 OBJECT HIERARCHY
gtk_object
gtk_widget
gtk_container
gtk_button
=head1 SIGNAL PROTOTYPES
"clicked" void user_function (GtkWidget *widget, gpointer data);
"pressed" void user_function (GtkWidget *widget, gpointer data);
"released" void user_function (GtkWidget *widget, gpointer data);
"enter" void user_function (GtkWidget *widget, gpointer data);
"leave" void user_function (GtkWidget *widget, gpointer data);
=head1 USAGE
=head2 Creation
The most common way to create a button is with a label in it, which
contains text for the user to read. The child of the button will then
be a L<gtk_label(3)> widget with the text you passwd in. You can
do this in one command:
GtkWidget *button;
button = gtk_button_new_with_label ("This is a button");
To create a gtk_button widget which does not already have a child,
use gtk_button_new():
GtkWidget *button;
button = gtk_button_new ();
After you have created a button you can then add a widget to the
button (such as a label or pixmap) using gtk_container_add(). See
L<gtk_container(3)> for more information on adding widgets to
containers.
=head2 Creating a pixmap in a button in a window
After we have an empty gtk_button, such as above, and we have a gtk_pixmap,
we can simply add the gtk_pixmap to the gtk_button with gtk_container_add().
The following code will open the file "gimp.xpm" and place it in a
button.
#include <gtk/gtk.h>
int main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *pixmap;
GtkStyle *style;
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
char *filename = "gimp.xpm";
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (window), button);
/* The button is realized now, which creates button->window
used below to create the pixmap. */
gtk_widget_realize (button);
style = gtk_widget_get_style (button);
gdkpixmap = gdk_pixmap_create_from_xpm (button->window, &mask,
&style->bg[GTK_STATE_NORMAL],
filename);
pixmap = gtk_pixmap_new (gdkpixmap, mask);
gtk_container_add (GTK_CONTAINER (button), pixmap);
gtk_widget_show (pixmap);
gtk_widget_show (button);
gtk_widget_show (window);
gtk_main ();
return 0;
}
=head2 Different reliefs
Reliefs affect how the shadowing of the button is drawn. The different
types of relief styles are:
GTK_RELIEF_NORMAL
GTK_RELIEF_HALF
GTK_RELIEF_NONE
When set to a normal relief, the widget looks and acts like a normal
button. When half or none relief is used, shadowing is only drawn when the
mouse cursor is over the widget.
To set the relief, use gtk_button_set_relief(), like:
gtk_button_set_relief (button, GTK_RELIEF_HALF);
To get the current relief of a button, use gtk_button_get_relief():
GtkReliefStyle relief;
relief = gtk_button_get_relief (GTK_BUTTON (button));
=head2 Executing a command when the button is pressed
To execute a function when a button is pressed, use
gtk_signal_connect() to connect to the "clicked" signal.
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (user_function),
NULL);
user_function is a user defined function, like the following:
void user_function (GtkWidget *button, gpointer data)
{
printf("clicked\n");
}
=head1 FUNCTIONS
GtkType gtk_button_get_type (void);
This function returns the GtkType which is assigned to the
object class for gtk_button.
GtkWidget* gtk_button_new (void);
This functions returns a new button widget which can then be
used as a container for another widget.
GtkWidget* gtk_button_new_with_label (const gchar *label);
This function returns a new button widget with a label widget
as a child. The label widget will have the text passed into
the commant.
void gtk_button_pressed (GtkButton *button);
This function sends a "pressed" signal to the button.
void gtk_button_released (GtkButton *button);
This function sends a "released" signal to the button.
void gtk_button_clicked (GtkButton *button);
This function sends a "clicked" signal to the button.
void gtk_button_enter (GtkButton *button);
This function sends a "enter" signal to the button.
void gtk_button_leave (GtkButton *button);
This function sends a "leave" signal to the button.
void gtk_button_set_relief (GtkButton *button, GtkReliefStyle style);
This function is sets the GtkReliefStyle of the button. The
relief style is one of: GTK_RELIEF_NORMAL, GTK_RELIEF_HALF,
or GTK_RELIEF_NONE. The relief determines when the shadow of
the button is drawn.
GtkReliefStyle gtk_button_get_relief (GtkButton *button);
This function returns the current relief of the button.
=head1 SIGNALS
"clicked"
void user_function (GtkWidget *widget, gpointer data);
Gets emitted when the button is clicked. A click is
a press and release of the button when the cursor is
inside the button on release.
"pressed"
void user_function (GtkWidget *widget, gpointer data);
Gets emitted when the left mouse button is pressed.
"released"
void user_function (GtkWidget *widget, gpointer data);
Gets emitted when the left mouse button is released and
the widget was previously pressed.
"enter"
void user_function (GtkWidget *widget, gpointer data);
Emitted when the mouse cursor enters the button.
"leave"
void user_function (GtkWidget *widget, gpointer data);
Emitted when the mouse cursor leaves the button.
=head1 AUTHORS
The author of this man page is Shawn T. Amundson E<lt>amundson@gtk.orgE<gt>.
For the authors of GTK+, see the AUTHORS file in the GTK+ distribution.

View File

@@ -25,17 +25,13 @@ gtk_widget_set_rc_style ()
restore the default style otherwise.
This will override a previously set user style or rc style.
gtk_widget_reset_rc_styles ()
Descends through a widget heirarchy and sets the rc style
on all widgets that don't have a user style set.
gtk_widget_restore_default_style ()
Reset the widget's style to the default style, this is only usefull if
the widgets default style had been saved by previous calls to
gtk_widget_set_style() or gtk_widget_set_rc_style().
gtk_widget_ensure_style ()
Ensure that the widget either has a user style set, or an rc lookup
Ensure taht the widget either has a user style set, or an rc lookup
has been performed.
gtk_rc_get_style ()
@@ -59,7 +55,7 @@ gtk_widget_set_parent ()
that do not have a user style set.
gtk_style_copy ()
This function can be used to copy a widget's style.
This function can be used to copy a widgets style.
The style can subsequntly be changed (e.g., by modifications to the
red/green/blue values of a certain color) and then be applied to the
widget via gtk_widget_set_style().

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -391,7 +391,7 @@ When a widget receives the unmap signal, it must:
2) If the widget does not have a window, unmap all child widgets
3) Do any other functions related to taking the widget offscreen
(for instance, removing popup windows...)
4) Unset GTK_MAPPED
3) Unset GTK_MAPPED
The Unrealize signal

View File

@@ -1,41 +0,0 @@
GTK Example Code - Tony Gale <gale@gtk.org> 980623
--------------------------------------------------
I have written an awk script to automatically extract the code
examples from the GTK Tutorial (in sgml), so they only have to be
changed in one place.
It's called 'extract.awk', and there is a shell wrapper to invoke
it called 'extract.sh'
It takes the following switches:
-c : Just do checking rather than output files
-f <filename> : Extract a specific file
-d : Extract file(s) to current directory
Without the -d switch, the code will be placed in the appropriate
sub-directory. Those sub-directories will be created if they do not
exist.
Without the -f switch, all code examples will be extracted.
The shell wrapper assumes that the GTK Tutorial is in the
file "../docs/gtk_tut.sgml"
It works by looking for sections of text in the tutorial surrounded
by, for example:
/* example-start helloworld helloworld.c */
and
/* example-end */
Where "helloworld" is the directory into which the file will be
placed (which can also be a directory spec like hello/hello1), and
"helloworld.c" is the file name for the code.
So, the code between these lines would be extracted to the file
helloworld/helloworld.c
It also handles replacing the sgml tag '&amp;' with '&'

View File

@@ -1,8 +0,0 @@
CC = gcc
gcalendar: gcalendar.c
$(CC) `gtk-config --cflags` `gtk-config --libs` gcalendar.c -o gcalendar
clean:
rm -f gcalendar

View File

@@ -1,362 +0,0 @@
/* G Calendar
* Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson, Mattias Grönlund
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gtk/gtk.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#define DEF_PAD 10
#define DEF_PAD_SMALL 5
#define TM_YEAR_BASE 1900
typedef struct _CalendarData {
GtkWidget *flag_checkboxes[5];
gboolean settings[5];
gchar *font;
GtkWidget *font_dialog;
GtkWidget *window;
GtkWidget *selected;
GtkWidget *selected_double_click;
GtkWidget *month;
} CalendarData;
void create_calendar();
gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data);
void destroy (GtkWidget *widget, gpointer data);
void day_selected_double_click (GtkWidget *widget, gpointer data);
int main(int argc, char *argv[]);
void calendar_month_changed (GtkWidget *widget, CalendarData *data);
void calendar_day_selected (GtkWidget *widget, CalendarData *data);
void calendar_day_selected_double_click (GtkWidget *widget, CalendarData *data);
void calendar_set_flags(CalendarData *calendar);
void calendar_toggle_flag(GtkWidget * toggle, CalendarData *calendar);
void calendar_font_selection_ok(GtkWidget * button, CalendarData *calendar);
void calendar_font_selection_destroy(GtkWidget * button, GtkWidget widget);
void calendar_select_font(GtkWidget * button, CalendarData *calendar);
void calendar_create_window_destroy(GtkWidget * ignore, CalendarData *calendar);
void calendar_create_window(GtkWidget * ignored, CalendarData * calendar);
void calendar_window_destroy(GtkWidget * ignore, CalendarData *calendar);
void create_calendar();
/*
* GtkCalendar
*/
void
calendar_month_changed (GtkWidget *widget, CalendarData *data)
{
char buffer[256];
struct tm tm;
time_t time;
memset (&tm, 0, sizeof (tm));
gtk_calendar_get_date (GTK_CALENDAR(data->window), &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
tm.tm_year -= TM_YEAR_BASE;
time = mktime(&tm);
strftime (buffer, 255, "%x", gmtime(&time));
gtk_label_set (GTK_LABEL (data->month), buffer);
}
void
calendar_day_selected (GtkWidget *widget, CalendarData *data)
{
char buffer[256];
struct tm tm;
time_t time;
memset (&tm, 0, sizeof (tm));
gtk_calendar_get_date (GTK_CALENDAR(data->window), &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
tm.tm_year -= TM_YEAR_BASE;
time = mktime(&tm);
strftime (buffer, 255, "%x", gmtime(&time));
gtk_label_set (GTK_LABEL (data->selected), buffer);
}
void
calendar_day_selected_double_click (GtkWidget *widget, CalendarData *data)
{
char buffer[256];
struct tm tm;
time_t time;
memset (&tm, 0, sizeof (tm));
gtk_calendar_get_date (GTK_CALENDAR(data->window), &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
tm.tm_year -= TM_YEAR_BASE;
time = mktime(&tm);
strftime (buffer, 255, "%x", gmtime(&time));
gtk_label_set (GTK_LABEL (data->selected_double_click), buffer);
}
enum {
calendar_show_header,
calendar_show_days,
calendar_month_change,
calendar_show_week,
calendar_monday_first
};
void
calendar_set_flags(CalendarData *calendar)
{
gint i;
gint options=0;
for (i=0;i<5;i++)
if (calendar->settings[i])
{
options=options + (1<<i);
}
if (calendar->window)
gtk_calendar_display_options (GTK_CALENDAR (calendar->window), options);
}
void
calendar_toggle_flag(GtkWidget * toggle, CalendarData *calendar)
{
gint i;
gint j;
j=0;
for (i=0; i<5; i++)
if (calendar->flag_checkboxes[i] == toggle)
j = i;
calendar->settings[j]=!calendar->settings[j];
calendar_set_flags(calendar);
}
void
calendar_font_selection_ok(GtkWidget * button, CalendarData *calendar)
{
GtkStyle *style;
GdkFont *font;
calendar->font = gtk_font_selection_dialog_get_font_name (GTK_FONT_SELECTION_DIALOG (calendar->font_dialog));
if (calendar->window)
{
font = gtk_font_selection_dialog_get_font(GTK_FONT_SELECTION_DIALOG(calendar->font_dialog));
if (font)
{
style = gtk_style_copy (gtk_widget_get_style (calendar->window));
gdk_font_unref (style->font);
style->font = font;
gdk_font_ref (style->font);
gtk_widget_set_style (calendar->window, style);
}
}
}
void
calendar_select_font(GtkWidget * button, CalendarData *calendar)
{
GtkWidget *window;
if (!calendar->font_dialog) {
window = gtk_font_selection_dialog_new ("Font Selection Dialog");
g_return_if_fail(GTK_IS_FONT_SELECTION_DIALOG(window));
calendar->font_dialog = window;
gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&calendar->font_dialog);
gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button),
"clicked", GTK_SIGNAL_FUNC(calendar_font_selection_ok),
calendar);
gtk_signal_connect_object (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button),
"clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (calendar->font_dialog));
}
window=calendar->font_dialog;
if (!GTK_WIDGET_VISIBLE (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
}
void
create_calendar()
{
GtkWidget *window;
GtkWidget *vbox, *vbox2, *vbox3;
GtkWidget *hbox;
GtkWidget *hbbox;
GtkWidget *calendar;
GtkWidget *toggle;
GtkWidget *button;
GtkWidget *frame;
GtkWidget *separator;
GtkWidget *label;
GtkWidget *bbox;
static CalendarData calendar_data;
gint i;
struct {
char *label;
} flags[] =
{
{ "Show Heading" },
{ "Show Day Names" },
{ "No Month Change" },
{ "Show Week Numbers" },
{ "Week Start Monday" }
};
calendar_data.window = NULL;
calendar_data.font = NULL;
calendar_data.font_dialog = NULL;
for (i=0; i<5; i++) {
calendar_data.settings[i]=0;
}
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_border_width (GTK_CONTAINER (window), 5);
gtk_signal_connect(GTK_OBJECT(window), "destroy",
GTK_SIGNAL_FUNC(gtk_main_quit),
NULL);
gtk_signal_connect(GTK_OBJECT(window), "delete-event",
GTK_SIGNAL_FUNC(gtk_false),
NULL);
gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE);
vbox = gtk_vbox_new(FALSE, DEF_PAD);
gtk_container_add (GTK_CONTAINER (window), vbox);
/*
* The top part of the window, Calendar, flags and fontsel.
*/
hbox = gtk_hbox_new(FALSE, DEF_PAD);
gtk_box_pack_start (GTK_BOX(vbox), hbox, TRUE, TRUE, DEF_PAD);
hbbox = gtk_hbutton_box_new();
gtk_box_pack_start(GTK_BOX(hbox), hbbox, FALSE, FALSE, DEF_PAD);
gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_SPREAD);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbbox), 5);
/* Calendar widget */
frame = gtk_frame_new("Calendar");
gtk_box_pack_start(GTK_BOX(hbbox), frame, TRUE, TRUE, DEF_PAD);
calendar=gtk_calendar_new();
calendar_data.window = calendar;
calendar_set_flags(&calendar_data);
gtk_calendar_mark_day ( GTK_CALENDAR(calendar), 19);
gtk_container_add( GTK_CONTAINER( frame), calendar);
gtk_signal_connect (GTK_OBJECT (calendar), "month_changed",
GTK_SIGNAL_FUNC (calendar_month_changed),
&calendar_data);
gtk_signal_connect (GTK_OBJECT (calendar), "day_selected",
GTK_SIGNAL_FUNC (calendar_day_selected),
&calendar_data);
gtk_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click",
GTK_SIGNAL_FUNC (calendar_day_selected_double_click),
&calendar_data);
separator = gtk_vseparator_new ();
gtk_box_pack_start (GTK_BOX (hbox), separator, FALSE, TRUE, 0);
vbox2 = gtk_vbox_new(FALSE, DEF_PAD);
gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, DEF_PAD);
/* Build the Right frame with the flags in */
frame = gtk_frame_new("Flags");
gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, DEF_PAD);
vbox3 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
gtk_container_add(GTK_CONTAINER(frame), vbox3);
for (i = 0; i < 5; i++)
{
toggle = gtk_check_button_new_with_label(flags[i].label);
gtk_signal_connect (GTK_OBJECT (toggle),
"toggled",
GTK_SIGNAL_FUNC(calendar_toggle_flag),
&calendar_data);
gtk_box_pack_start (GTK_BOX (vbox3), toggle, TRUE, TRUE, 0);
calendar_data.flag_checkboxes[i]=toggle;
}
/* Build the right font-button */
button = gtk_button_new_with_label("Font...");
gtk_signal_connect (GTK_OBJECT (button),
"clicked",
GTK_SIGNAL_FUNC(calendar_select_font),
&calendar_data);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
/*
* Build the Signal-event part.
*/
frame = gtk_frame_new("Signal events");
gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, DEF_PAD);
vbox2 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
gtk_container_add(GTK_CONTAINER(frame), vbox2);
hbox = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
label = gtk_label_new ("Day selected:");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
calendar_data.selected = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.selected, FALSE, TRUE, 0);
hbox = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
label = gtk_label_new ("Day selected double click:");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
calendar_data.selected_double_click = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.selected_double_click, FALSE, TRUE, 0);
hbox = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
label = gtk_label_new ("Month change:");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
calendar_data.month = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.month, FALSE, TRUE, 0);
bbox = gtk_hbutton_box_new ();
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
button = gtk_button_new_with_label ("Close");
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_main_quit),
NULL);
gtk_container_add (GTK_CONTAINER (bbox), button);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
gtk_widget_show_all(window);
}
int
main(int argc, char *argv[])
{
gtk_set_locale ();
gtk_init (&argc, &argv);
create_calendar();
gtk_main ();
return 0;
}

View File

@@ -1,8 +0,0 @@
CC = gcc
clist: clist.c
$(CC) `gtk-config --cflags` `gtk-config --libs` clist.c -o clist
clean:
rm -f *.o clist

View File

@@ -1,173 +0,0 @@
/* example-start clist clist.c */
#include <gtk/gtk.h>
#include <glib.h>
/* These are just the prototypes of the various callbacks */
void button_add_clicked( GtkWidget *button, gpointer data);
void button_clear_clicked( GtkWidget *button, gpointer data);
void button_hide_show_clicked( GtkWidget *button, gpointer data);
void selection_made( GtkWidget *clist, gint row, gint column,
GdkEventButton *event, gpointer data);
gint main (int argc, gchar *argv[])
{
GtkWidget *window;
GtkWidget *vbox, *hbox;
GtkWidget *clist;
GtkWidget *button_add, *button_clear, *button_hide_show;
gchar *titles[2] = {"Ingredients","Amount"};
gtk_init(&argc, &argv);
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize(GTK_WIDGET(window), 300, 150);
gtk_window_set_title(GTK_WINDOW(window), "GtkCList Example");
gtk_signal_connect(GTK_OBJECT(window),
"destroy",
GTK_SIGNAL_FUNC(gtk_main_quit),
NULL);
vbox=gtk_vbox_new(FALSE, 5);
gtk_container_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(window), vbox);
gtk_widget_show(vbox);
/* Create the GtkCList. For this example we use 2 columns */
clist = gtk_clist_new_with_titles( 2, titles);
/* When a selection is made, we want to know about it. The callback
* used is selection_made, and it's code can be found further down */
gtk_signal_connect(GTK_OBJECT(clist), "select_row",
GTK_SIGNAL_FUNC(selection_made),
NULL);
/* It isn't necessary to shadow the border, but it looks nice :) */
gtk_clist_set_border(GTK_CLIST(clist), GTK_SHADOW_OUT);
/* What however is important, is that we set the column widths as
* they will never be right otherwise. Note that the columns are
* numbered from 0 and up (to 1 in this case).
*/
gtk_clist_set_column_width (GTK_CLIST(clist), 0, 150);
/* Scollbars _only when needed_ */
gtk_clist_set_policy(GTK_CLIST(clist), GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
/* Add the GtkCList widget to the vertical box and show it. */
gtk_box_pack_start(GTK_BOX(vbox), clist, TRUE, TRUE, 0);
gtk_widget_show(clist);
/* Create the buttons and add them to the window. See the button
* tutorial for more examples and comments on this.
*/
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
gtk_widget_show(hbox);
button_add = gtk_button_new_with_label("Add List");
button_clear = gtk_button_new_with_label("Clear List");
button_hide_show = gtk_button_new_with_label("Hide/Show titles");
gtk_box_pack_start(GTK_BOX(hbox), button_add, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(hbox), button_clear, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(hbox), button_hide_show, TRUE, TRUE, 0);
/* Connect our callbacks to the three buttons */
gtk_signal_connect_object(GTK_OBJECT(button_add), "clicked",
GTK_SIGNAL_FUNC(button_add_clicked),
(gpointer) clist);
gtk_signal_connect_object(GTK_OBJECT(button_clear), "clicked",
GTK_SIGNAL_FUNC(button_clear_clicked),
(gpointer) clist);
gtk_signal_connect_object(GTK_OBJECT(button_hide_show), "clicked",
GTK_SIGNAL_FUNC(button_hide_show_clicked),
(gpointer) clist);
gtk_widget_show(button_add);
gtk_widget_show(button_clear);
gtk_widget_show(button_hide_show);
/* The interface is completely set up so we show the window and
* enter the gtk_main loop.
*/
gtk_widget_show(window);
gtk_main();
return 0;
}
/* User clicked the "Add List" button. */
void button_add_clicked( GtkWidget *button, gpointer data)
{
int indx;
/* Something silly to add to the list. 4 rows of 2 columns each */
gchar *drink[4][2] = {{"Milk", "3 Oz"},
{"Water", "6 l"},
{"Carrots", "2"},
{"Snakes", "55"}};
/* Here we do the actual adding of the text. It's done once for
* each row.
*/
for( indx=0; indx < 4; indx++)
gtk_clist_append( (GtkCList*) data, drink[indx]);
return;
}
/* User clicked the "Clear List" button. */
void button_clear_clicked( GtkWidget *button, gpointer data)
{
/* Clear the list using gtk_clist_clear. This is much faster than
* calling gtk_clist_remove once for each row.
*/
gtk_clist_clear((GtkCList*) data);
return;
}
/* The user clicked the "Hide/Show titles" button. */
void button_hide_show_clicked( GtkWidget *button, gpointer data)
{
/* Just a flag to remember the status. 0 = currently visible */
static short int flag = 0;
if (flag == 0)
{
/* Hide the titles and set the flag to 1 */
gtk_clist_column_titles_hide((GtkCList*) data);
flag++;
}
else
{
/* Show the titles and reset flag to 0 */
gtk_clist_column_titles_show((GtkCList*) data);
flag--;
}
return;
}
/* If we come here, then the user has selected a row in the list. */
void selection_made( GtkWidget *clist, gint row, gint column,
GdkEventButton *event, gpointer data)
{
gchar *text;
/* Get the text that is stored in the selected row and column
* which was clicked in. We will receive it as a pointer in the
* argument text.
*/
gtk_clist_get_text(GTK_CLIST(clist), row, column, &text);
/* Just prints some information about the selected row */
g_print("You selected row %d. More specifically you clicked in column %d, and the text in this cell is %s\n\n", row, column, text);
return;
}
/* example-end */

View File

@@ -1,57 +0,0 @@
# extract - extract C source files from GTK Tutorial
# Copyright (C) Tony Gale 1998
# Contact: gale@gtk.org
#
# Command Switches:
# -c : Just do checking rather than output files
# -f <filename> : Extract a specific file
# -d : Extract files to current directory
BEGIN {in_example=0; check=0; spec_example=""; do_output=0; flatten=0
for (i=0 ; i < ARGC ; i++) {
if ( ARGV[i] == "-c" ) {
check = 1;
ARGV[i]="";
} else if ( ARGV[i] == "-f" ) {
spec_example=ARGV[i+1];
ARGV[i]="";
ARGV[i+1]="";
if ( length(spec_example) == 0 ) {
print "usage: -f <filename>";
exit;
}
} else if ( ARGV[i] == "-d" ) {
flatten = 1;
ARGV[i]="";
}
}
}
$2 == "example-start" && in_example == 1 { printf("\nERROR: nested example at line %d\n", NR) > "/dev/stderr";
exit}
$2 == "example-start" { in_example=1 }
$2 == "example-start" && check == 0 \
{ if ( (spec_example == "") || (spec_example == $4) ) {
if ( flatten == 0 ) {
file_name = sprintf("%s/%s",$3, $4);
command = sprintf("mkdir -p %s", $3);
system(command);
} else {
file_name = $4;
}
do_output=1;
}
}
in_example==1 && check==0 && do_output==1 { gsub(/&amp;/, "\\&", $0);
print $0 >file_name }
$2 == "example-end" && in_example == 0 { printf("\nERROR: multiple ends at line %d\n", NR) > "/dev/stderr";
exit}
$2 == "example-end" { in_example=0; do_output=0 }
END {}

View File

@@ -1,2 +0,0 @@
#! /bin/sh
awk -f extract.awk ../docs/gtk_tut.sgml $1 $2 $3 $4 $5

View File

@@ -1,3 +1,4 @@
CC = gcc
filesel: filesel.c

View File

@@ -6,13 +6,13 @@
/* Our new improved callback. The data passed to this function is printed
* to stdout. */
void callback (GtkWidget *widget, gpointer data)
void callback (GtkWidget *widget, gpointer *data)
{
g_print ("Hello again - %s was pressed\n", (char *) data);
}
/* another callback */
void delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
void delete_event (GtkWidget *widget, GdkEvent *event, gpointer *data)
{
gtk_main_quit ();
}

View File

@@ -1,11 +1,17 @@
/* example-start menu menufactory.c */
/* This file extracted from the GTK tutorial. */
/* menufactory.c */
#include <gtk/gtk.h>
#include <strings.h>
#include "mfmain.h"
static void print_hello(GtkWidget *widget, gpointer data);
static void menus_remove_accel(GtkWidget * widget, gchar * signal_name, gchar * path);
static gint menus_install_accel(GtkWidget * widget, gchar * signal_name, gchar key, gchar modifiers, gchar * path);
void menus_init(void);
void menus_create(GtkMenuEntry * entries, int nmenu_entries);
/* this is the GtkMenuEntry structure used to create new menus. The
@@ -18,37 +24,128 @@ static void print_hello(GtkWidget *widget, gpointer data);
static GtkMenuEntry menu_items[] =
{
{"<Main>/File/New", "<control>N", print_hello, NULL},
{"<Main>/File/Open", "<control>O", print_hello, NULL},
{"<Main>/File/Save", "<control>S", print_hello, NULL},
{"<Main>/File/Save as", NULL, NULL, NULL},
{"<Main>/File/<separator>", NULL, NULL, NULL},
{"<Main>/File/Quit", "<control>Q", file_quit_cmd_callback, "OK, I'll quit"},
{"<Main>/Options/Test", NULL, NULL, NULL}
{"<Main>/File/New", "<control>N", NULL, NULL},
{"<Main>/File/Open", "<control>O", NULL, NULL},
{"<Main>/File/Save", "<control>S", NULL, NULL},
{"<Main>/File/Save as", NULL, NULL, NULL},
{"<Main>/File/<separator>", NULL, NULL, NULL},
{"<Main>/File/Quit", "<control>Q", file_quit_cmd_callback, "OK, I'll quit"},
{"<Main>/Options/Test", NULL, NULL, NULL}
};
/* calculate the number of menu_item's */
static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
static void
print_hello(GtkWidget *widget, gpointer data)
static int initialize = TRUE;
static GtkMenuFactory *factory = NULL;
static GtkMenuFactory *subfactory[1];
static GHashTable *entry_ht = NULL;
void get_main_menu(GtkWidget ** menubar, GtkAcceleratorTable ** table)
{
printf("hello!\n");
}
void get_main_menu(GtkWidget *window, GtkWidget ** menubar)
{
int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
GtkMenuFactory *factory;
GtkMenuFactory *subfactory;
factory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
subfactory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
gtk_menu_factory_add_subfactory(factory, subfactory, "<Main>");
gtk_menu_factory_add_entries(factory, menu_items, nmenu_items);
gtk_window_add_accelerator_table(GTK_WINDOW(window), subfactory->table);
if (initialize)
menus_init();
if (menubar)
*menubar = subfactory->widget;
*menubar = subfactory[0]->widget;
if (table)
*table = subfactory[0]->table;
}
/* example-end */
void menus_init(void)
{
if (initialize) {
initialize = FALSE;
factory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
subfactory[0] = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
gtk_menu_factory_add_subfactory(factory, subfactory[0], "<Main>");
menus_create(menu_items, nmenu_items);
}
}
void menus_create(GtkMenuEntry * entries, int nmenu_entries)
{
char *accelerator;
int i;
if (initialize)
menus_init();
if (entry_ht)
for (i = 0; i < nmenu_entries; i++) {
accelerator = g_hash_table_lookup(entry_ht, entries[i].path);
if (accelerator) {
if (accelerator[0] == '\0')
entries[i].accelerator = NULL;
else
entries[i].accelerator = accelerator;
}
}
gtk_menu_factory_add_entries(factory, entries, nmenu_entries);
for (i = 0; i < nmenu_entries; i++)
if (entries[i].widget) {
gtk_signal_connect(GTK_OBJECT(entries[i].widget), "install_accelerator",
(GtkSignalFunc) menus_install_accel,
entries[i].path);
gtk_signal_connect(GTK_OBJECT(entries[i].widget), "remove_accelerator",
(GtkSignalFunc) menus_remove_accel,
entries[i].path);
}
}
static gint menus_install_accel(GtkWidget * widget, gchar * signal_name, gchar key, gchar modifiers, gchar * path)
{
char accel[64];
char *t1, t2[2];
accel[0] = '\0';
if (modifiers & GDK_CONTROL_MASK)
strcat(accel, "<control>");
if (modifiers & GDK_SHIFT_MASK)
strcat(accel, "<shift>");
if (modifiers & GDK_MOD1_MASK)
strcat(accel, "<alt>");
t2[0] = key;
t2[1] = '\0';
strcat(accel, t2);
if (entry_ht) {
t1 = g_hash_table_lookup(entry_ht, path);
g_free(t1);
} else
entry_ht = g_hash_table_new(g_str_hash, g_str_equal);
g_hash_table_insert(entry_ht, path, g_strdup(accel));
return TRUE;
}
static void menus_remove_accel(GtkWidget * widget, gchar * signal_name, gchar * path)
{
char *t;
if (entry_ht) {
t = g_hash_table_lookup(entry_ht, path);
g_free(t);
g_hash_table_insert(entry_ht, path, g_strdup(""));
}
}
void menus_set_sensitive(char *path, int sensitive)
{
GtkMenuPath *menu_path;
if (initialize)
menus_init();
menu_path = gtk_menu_factory_find(factory, path);
if (menu_path)
gtk_widget_set_sensitive(menu_path->widget, sensitive);
else
g_warning("Unable to set sensitivity for menu which doesn't exist: %s", path);
}

View File

@@ -1,4 +1,6 @@
/* example-start menu menufactory.h */
/* This file extracted from the GTK tutorial. */
/* menufactory.h */
#ifndef __MENUFACTORY_H__
#define __MENUFACTORY_H__
@@ -7,12 +9,11 @@
extern "C" {
#endif /* __cplusplus */
void get_main_menu (GtkWidget *, GtkWidget **menubar);
void get_main_menu (GtkWidget **menubar, GtkAcceleratorTable **table);
void menus_create(GtkMenuEntry *entries, int nmenu_entries);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __MENUFACTORY_H__ */
/* example-end */

View File

@@ -1,16 +1,21 @@
/* example-start menu mfmain.c */
/* This file extracted from the GTK tutorial. */
/* mfmain.c */
#include <gtk/gtk.h>
#include "mfmain.h"
#include "menufactory.h"
int main(int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *main_vbox;
GtkWidget *menubar;
GtkAcceleratorTable *accel;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -25,7 +30,8 @@ int main(int argc, char *argv[])
gtk_container_add(GTK_CONTAINER(window), main_vbox);
gtk_widget_show(main_vbox);
get_main_menu(window, &menubar);
get_main_menu(&menubar, &accel);
gtk_window_add_accelerator_table(GTK_WINDOW(window), accel);
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0);
gtk_widget_show(menubar);
@@ -44,5 +50,3 @@ void file_quit_cmd_callback (GtkWidget *widget, gpointer data)
g_print ("%s\n", (char *) data);
gtk_exit(0);
}
/* example-end */

View File

@@ -1,4 +1,6 @@
/* example-start menu mfmain.h */
/* This file extracted from the GTK tutorial. */
/* mfmain.h */
#ifndef __MFMAIN_H__
#define __MFMAIN_H__
@@ -15,5 +17,3 @@ void file_quit_cmd_callback(GtkWidget *widget, gpointer data);
#endif /* __cplusplus */
#endif /* __MFMAIN_H__ */
/* example-end */

View File

@@ -36,7 +36,7 @@ void remove_book (GtkButton *button, GtkNotebook *notebook)
gtk_widget_draw(GTK_WIDGET(notebook), NULL);
}
void delete (GtkWidget *widget, GdkEvent *event, gpointer data)
void delete (GtkWidget *widget, GdkEvent *event, gpointer *data)
{
gtk_main_quit ();
}

View File

@@ -2,12 +2,10 @@
/* packbox.c */
#include <stdio.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include "gtk/gtk.h"
void
delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
delete_event (GtkWidget *widget, GdkEvent *event, gpointer *data)
{
gtk_main_quit ();
}

View File

@@ -1,8 +0,0 @@
CC = gcc
pack: pack.c
$(CC) `gtk-config --cflags` `gtk-config --libs` pack.c -o pack
clean:
rm -f pack

View File

@@ -1,664 +0,0 @@
/*
* This is a demo of gtkpacker.
*/
#include <gtk/gtk.h>
void add_widget (GtkWidget *widget, gpointer data);
void toggle_side (GtkWidget *widget, gpointer data);
void toggle_anchor (GtkWidget *widget, gpointer data);
void toggle_options (GtkWidget *widget, gpointer data);
typedef struct {
GList *widgets;
GtkWidget *packer;
GtkWidget *current;
GtkPackerChild *pchild;
GtkWidget *button_top;
GtkWidget *button_bottom;
GtkWidget *button_left;
GtkWidget *button_right;
GtkWidget *button_n;
GtkWidget *button_ne;
GtkWidget *button_nw;
GtkWidget *button_e;
GtkWidget *button_w;
GtkWidget *button_s;
GtkWidget *button_se;
GtkWidget *button_sw;
GtkWidget *button_center;
GtkWidget *button_fillx;
GtkWidget *button_filly;
GtkWidget *button_expand;
} Info;
void destroy (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
int
main (int argv, char **argc)
{
GtkWidget *window;
GtkWidget *window_pack;
GtkWidget *top_pack;
GtkWidget *frame;
GtkWidget *packer;
GtkWidget *button_pack;
GtkWidget *button_add;
GtkWidget *button_quit;
GtkWidget *bottom_pack;
GtkWidget *side_frame;
GtkWidget *side_pack;
GtkWidget *button_top;
GtkWidget *button_bottom;
GtkWidget *button_left;
GtkWidget *button_right;
GtkWidget *anchor_table;
GtkWidget *anchor_frame;
GtkWidget *button_n;
GtkWidget *button_ne;
GtkWidget *button_nw;
GtkWidget *button_e;
GtkWidget *button_w;
GtkWidget *button_center;
GtkWidget *button_s;
GtkWidget *button_se;
GtkWidget *button_sw;
GtkWidget *button_expand;
GtkWidget *button_fillx;
GtkWidget *button_filly;
GtkWidget *options_pack;
GtkWidget *options_frame;
GtkWidget *anchor_pack;
Info *info;
gtk_init(&argv, &argc);
info = g_malloc(sizeof(Info));
window = gtk_window_new(GTK_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (destroy), NULL);
window_pack = gtk_packer_new();
gtk_container_add(GTK_CONTAINER(window), window_pack);
gtk_container_border_width(GTK_CONTAINER(window), 4);
top_pack = gtk_packer_new();
gtk_packer_add_defaults(GTK_PACKER(window_pack),
top_pack,
GTK_SIDE_TOP,
GTK_ANCHOR_CENTER,
GTK_FILL_X | GTK_FILL_Y | GTK_EXPAND);
frame = gtk_frame_new("Packing Area");
gtk_widget_set_usize(frame, 400, 400);
gtk_packer_add(GTK_PACKER(top_pack),
frame,
GTK_SIDE_LEFT,
GTK_ANCHOR_CENTER,
GTK_FILL_X | GTK_FILL_Y | GTK_EXPAND,
0, 8, 8, 0, 0);
packer = gtk_packer_new();
gtk_container_add(GTK_CONTAINER(frame), packer);
button_pack = gtk_packer_new();
gtk_packer_add(GTK_PACKER(top_pack),
button_pack,
GTK_SIDE_LEFT,
GTK_ANCHOR_N,
0,
0, 0, 0, 0, 0);
button_add = gtk_button_new_with_label("Add Button");
gtk_packer_add(GTK_PACKER(top_pack),
button_add,
GTK_SIDE_TOP,
GTK_ANCHOR_CENTER,
GTK_FILL_X,
0, 8, 8, 8, 0);
gtk_signal_connect (GTK_OBJECT (button_add), "clicked",
GTK_SIGNAL_FUNC (add_widget), (gpointer) info);
button_quit = gtk_button_new_with_label("Quit");
gtk_packer_add(GTK_PACKER(top_pack),
button_quit,
GTK_SIDE_TOP,
GTK_ANCHOR_CENTER,
GTK_FILL_X,
0, 8, 8, 0, 0);
gtk_signal_connect_object (GTK_OBJECT (button_quit), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (window));
bottom_pack = gtk_packer_new();
gtk_packer_add_defaults(GTK_PACKER(window_pack),
bottom_pack,
GTK_SIDE_TOP,
GTK_ANCHOR_CENTER,
GTK_FILL_X);
side_frame = gtk_frame_new("Side");
gtk_packer_add(GTK_PACKER(window_pack),
side_frame,
GTK_SIDE_LEFT,
GTK_ANCHOR_W,
GTK_FILL_Y,
0, 10, 10, 0, 0);
side_pack = gtk_packer_new();
gtk_container_add(GTK_CONTAINER(side_frame), side_pack);
button_top = gtk_toggle_button_new_with_label("Top");
button_bottom = gtk_toggle_button_new_with_label("Bottom");
button_left = gtk_toggle_button_new_with_label("Left");
button_right = gtk_toggle_button_new_with_label("Right");
gtk_object_set_data(GTK_OBJECT(button_top), "side", (gpointer) GTK_SIDE_TOP);
gtk_object_set_data(GTK_OBJECT(button_bottom), "side", (gpointer) GTK_SIDE_BOTTOM);
gtk_object_set_data(GTK_OBJECT(button_left), "side", (gpointer) GTK_SIDE_LEFT);
gtk_object_set_data(GTK_OBJECT(button_right), "side", (gpointer) GTK_SIDE_RIGHT);
gtk_widget_set_usize(button_top, 50, -1);
gtk_widget_set_usize(button_bottom, 50, -1);
gtk_widget_set_usize(button_left, 50, -1);
gtk_widget_set_usize(button_right, 50, -1);
gtk_packer_add(GTK_PACKER(side_pack),
button_top,
GTK_SIDE_TOP,
GTK_ANCHOR_CENTER,
0,
0, 5, 5, 0, 0);
gtk_packer_add(GTK_PACKER(side_pack),
button_bottom,
GTK_SIDE_BOTTOM,
GTK_ANCHOR_CENTER,
0,
0, 5, 5, 0, 0);
gtk_packer_add(GTK_PACKER(side_pack),
button_left,
GTK_SIDE_LEFT,
GTK_ANCHOR_CENTER,
0,
0, 10, 5, 0, 0);
gtk_packer_add(GTK_PACKER(side_pack),
button_right,
GTK_SIDE_RIGHT,
GTK_ANCHOR_CENTER,
0,
0, 10, 5, 0, 0);
gtk_signal_connect (GTK_OBJECT (button_top), "toggled",
GTK_SIGNAL_FUNC (toggle_side), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_bottom), "toggled",
GTK_SIGNAL_FUNC (toggle_side), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_left), "toggled",
GTK_SIGNAL_FUNC (toggle_side), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_right), "toggled",
GTK_SIGNAL_FUNC (toggle_side), (gpointer) info);
anchor_frame = gtk_frame_new("Anchor");
gtk_packer_add(GTK_PACKER(window_pack),
anchor_frame,
GTK_SIDE_LEFT,
GTK_ANCHOR_W,
GTK_FILL_Y,
0, 10, 10, 0, 0);
anchor_pack = gtk_packer_new();
gtk_container_add(GTK_CONTAINER(anchor_frame), anchor_pack);
anchor_table = gtk_table_new(3,3,TRUE);
gtk_packer_add(GTK_PACKER(anchor_pack),
anchor_table,
GTK_SIDE_TOP,
GTK_ANCHOR_CENTER,
GTK_FILL_Y | GTK_FILL_X | GTK_PACK_EXPAND,
0, 10, 5, 0, 0);
button_n = gtk_toggle_button_new_with_label("N");
button_s = gtk_toggle_button_new_with_label("S");
button_w = gtk_toggle_button_new_with_label("W");
button_e = gtk_toggle_button_new_with_label("E");
button_ne = gtk_toggle_button_new_with_label("NE");
button_nw = gtk_toggle_button_new_with_label("NW");
button_se = gtk_toggle_button_new_with_label("SE");
button_sw = gtk_toggle_button_new_with_label("SW");
button_center = gtk_toggle_button_new_with_label("");
gtk_object_set_data(GTK_OBJECT(button_n), "anchor", (gpointer) GTK_ANCHOR_N);
gtk_object_set_data(GTK_OBJECT(button_nw), "anchor", (gpointer) GTK_ANCHOR_NW);
gtk_object_set_data(GTK_OBJECT(button_ne), "anchor", (gpointer) GTK_ANCHOR_NE);
gtk_object_set_data(GTK_OBJECT(button_s), "anchor", (gpointer) GTK_ANCHOR_S);
gtk_object_set_data(GTK_OBJECT(button_sw), "anchor", (gpointer) GTK_ANCHOR_SW);
gtk_object_set_data(GTK_OBJECT(button_se), "anchor", (gpointer) GTK_ANCHOR_SE);
gtk_object_set_data(GTK_OBJECT(button_w), "anchor", (gpointer) GTK_ANCHOR_W);
gtk_object_set_data(GTK_OBJECT(button_e), "anchor", (gpointer) GTK_ANCHOR_E);
gtk_object_set_data(GTK_OBJECT(button_center), "anchor", (gpointer) GTK_ANCHOR_CENTER);
gtk_signal_connect (GTK_OBJECT (button_n), "toggled",
GTK_SIGNAL_FUNC (toggle_anchor), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_nw), "toggled",
GTK_SIGNAL_FUNC (toggle_anchor), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_ne), "toggled",
GTK_SIGNAL_FUNC (toggle_anchor), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_s), "toggled",
GTK_SIGNAL_FUNC (toggle_anchor), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_sw), "toggled",
GTK_SIGNAL_FUNC (toggle_anchor), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_se), "toggled",
GTK_SIGNAL_FUNC (toggle_anchor), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_w), "toggled",
GTK_SIGNAL_FUNC (toggle_anchor), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_e), "toggled",
GTK_SIGNAL_FUNC (toggle_anchor), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_center), "toggled",
GTK_SIGNAL_FUNC (toggle_anchor), (gpointer) info);
gtk_table_attach_defaults(GTK_TABLE(anchor_table),
button_nw,
0, 1, 0, 1);
gtk_table_attach_defaults(GTK_TABLE(anchor_table),
button_n,
1, 2, 0, 1);
gtk_table_attach_defaults(GTK_TABLE(anchor_table),
button_ne,
2, 3, 0, 1);
gtk_table_attach_defaults(GTK_TABLE(anchor_table),
button_w,
0, 1, 1, 2);
gtk_table_attach_defaults(GTK_TABLE(anchor_table),
button_center,
1, 2, 1, 2);
gtk_table_attach_defaults(GTK_TABLE(anchor_table),
button_e,
2, 3, 1, 2);
gtk_table_attach_defaults(GTK_TABLE(anchor_table),
button_sw,
0, 1, 2, 3);
gtk_table_attach_defaults(GTK_TABLE(anchor_table),
button_s,
1, 2, 2, 3);
gtk_table_attach_defaults(GTK_TABLE(anchor_table),
button_se,
2, 3, 2, 3);
options_frame = gtk_frame_new("Options");
gtk_packer_add(GTK_PACKER(window_pack),
options_frame,
GTK_SIDE_LEFT,
GTK_ANCHOR_W,
GTK_FILL_Y,
0, 10, 10, 0, 0);
options_pack = gtk_packer_new();
gtk_container_add(GTK_CONTAINER(options_frame), options_pack);
button_fillx = gtk_toggle_button_new_with_label("Fill X");
button_filly = gtk_toggle_button_new_with_label("Fill Y");
button_expand = gtk_toggle_button_new_with_label("Expand");
gtk_packer_add(GTK_PACKER(options_pack),
button_fillx,
GTK_SIDE_TOP,
GTK_ANCHOR_N,
GTK_FILL_X | GTK_PACK_EXPAND,
0, 10, 5, 0, 0);
gtk_packer_add(GTK_PACKER(options_pack),
button_filly,
GTK_SIDE_TOP,
GTK_ANCHOR_CENTER,
GTK_FILL_X | GTK_PACK_EXPAND,
0, 10, 5, 0, 0);
gtk_packer_add(GTK_PACKER(options_pack),
button_expand,
GTK_SIDE_TOP,
GTK_ANCHOR_S,
GTK_FILL_X | GTK_PACK_EXPAND,
0, 10, 5, 0, 0);
gtk_object_set_data(GTK_OBJECT(button_fillx), "option", (gpointer) GTK_FILL_X);
gtk_object_set_data(GTK_OBJECT(button_filly), "option", (gpointer) GTK_FILL_Y);
gtk_object_set_data(GTK_OBJECT(button_expand), "option", (gpointer) GTK_PACK_EXPAND);
gtk_signal_connect (GTK_OBJECT (button_fillx), "toggled",
GTK_SIGNAL_FUNC (toggle_options), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_filly), "toggled",
GTK_SIGNAL_FUNC (toggle_options), (gpointer) info);
gtk_signal_connect (GTK_OBJECT (button_expand), "toggled",
GTK_SIGNAL_FUNC (toggle_options), (gpointer) info);
info->widgets = NULL;
info->packer = packer;
info->button_top = button_top;
info->button_bottom = button_bottom;
info->button_left = button_left;
info->button_right = button_right;
info->button_n = button_n;
info->button_nw = button_nw;
info->button_ne = button_ne;
info->button_e = button_e;
info->button_w = button_w;
info->button_center = button_center;
info->button_s = button_s;
info->button_sw = button_sw;
info->button_se = button_se;
info->button_fillx = button_fillx;
info->button_filly = button_filly;
info->button_expand = button_expand;
add_widget(NULL, (gpointer) info);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
void
toggle_options (GtkWidget *widget, gpointer data)
{
Info *info;
gint option;
GList *list;
GtkPackerChild *pchild;
gint fillx, filly, expand;
info = (Info*) data;
option = (gint) gtk_object_get_data(GTK_OBJECT(widget), "option");
pchild = info->pchild;
if (pchild == NULL) {
abort();
};
fillx = filly = expand = 0;
if (GTK_TOGGLE_BUTTON(info->button_fillx)->active)
fillx = GTK_FILL_X;
if (GTK_TOGGLE_BUTTON(info->button_filly)->active)
filly = GTK_FILL_Y;
if (GTK_TOGGLE_BUTTON(info->button_expand)->active)
expand = GTK_PACK_EXPAND;
gtk_packer_configure(GTK_PACKER(info->packer),
info->current,
pchild->side,
pchild->anchor,
fillx | filly | expand,
pchild->border_width,
pchild->pad_x,
pchild->pad_y,
pchild->i_pad_x,
pchild->i_pad_y);
}
void
toggle_anchor (GtkWidget *widget, gpointer data)
{
Info *info;
gint anchor;
GList *list;
GtkPackerChild *pchild;
info = (Info*) data;
if (GTK_TOGGLE_BUTTON(widget)->active) {
anchor = (gint) gtk_object_get_data(GTK_OBJECT(widget), "anchor");
pchild = info->pchild;
if (pchild == NULL) {
abort();
};
gtk_packer_configure(GTK_PACKER(info->packer),
info->current,
pchild->side,
anchor,
pchild->options,
pchild->border_width,
pchild->pad_x,
pchild->pad_y,
pchild->i_pad_x,
pchild->i_pad_y);
if (info->button_n != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_n),0);
gtk_widget_set_sensitive(info->button_n, 1);
}
if (info->button_nw != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_nw),0);
gtk_widget_set_sensitive(info->button_nw, 1);
}
if (info->button_ne != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_ne),0);
gtk_widget_set_sensitive(info->button_ne, 1);
}
if (info->button_s != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_s),0);
gtk_widget_set_sensitive(info->button_s, 1);
}
if (info->button_sw != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_sw),0);
gtk_widget_set_sensitive(info->button_sw, 1);
}
if (info->button_se != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_se),0);
gtk_widget_set_sensitive(info->button_se, 1);
}
if (info->button_e != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_e),0);
gtk_widget_set_sensitive(info->button_e, 1);
}
if (info->button_w != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_w),0);
gtk_widget_set_sensitive(info->button_w, 1);
}
if (info->button_center != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_center),0);
gtk_widget_set_sensitive(info->button_center, 1);
}
gtk_widget_set_sensitive(widget, 0);
}
}
void
toggle_side (GtkWidget *widget, gpointer data)
{
Info *info;
gint side;
GList *list;
GtkPackerChild *pchild;
info = (Info*) data;
if (GTK_TOGGLE_BUTTON(widget)->active) {
side = (gint) gtk_object_get_data(GTK_OBJECT(widget), "side");
pchild = info->pchild;
if (pchild == NULL) {
abort();
};
gtk_packer_configure(GTK_PACKER(info->packer),
info->current,
side,
pchild->anchor,
pchild->options,
pchild->border_width,
pchild->pad_x,
pchild->pad_y,
pchild->i_pad_x,
pchild->i_pad_y);
if (info->button_top != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_top),0);
gtk_widget_set_sensitive(info->button_top, 1);
}
if (info->button_bottom != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_bottom),0);
gtk_widget_set_sensitive(info->button_bottom, 1);
}
if (info->button_left != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_left),0);
gtk_widget_set_sensitive(info->button_left, 1);
}
if (info->button_right != widget) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_right),0);
gtk_widget_set_sensitive(info->button_right, 1);
}
gtk_widget_set_sensitive(widget, 0);
}
}
void
set_widget (GtkWidget *w, gpointer data) {
Info *info;
GList *list;
GtkWidget *widget;
GtkPackerChild *pchild;
gint options;
if (GTK_TOGGLE_BUTTON(w)->active) {
info = (Info*) data;
info->current = w;
pchild = NULL;
list = g_list_first(GTK_PACKER(info->packer)->children);
while (list) {
if (((GtkPackerChild*)(list->data))->widget == info->current) {
pchild = (GtkPackerChild*)(list->data);
break;
}
list = g_list_next(list);
}
if (pchild == NULL) {
abort();
};
info->pchild = pchild;
switch (pchild->side) {
case GTK_SIDE_TOP:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_top),1);
break;
case GTK_SIDE_BOTTOM:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_bottom),1);
break;
case GTK_SIDE_LEFT:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_left),1);
break;
case GTK_SIDE_RIGHT:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_right),1);
break;
default:
printf("foo... side == %d\n", pchild->side);
};
switch (pchild->anchor) {
case GTK_ANCHOR_N:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_n),1);
break;
case GTK_ANCHOR_NW:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_nw),1);
break;
case GTK_ANCHOR_NE:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_ne),1);
break;
case GTK_ANCHOR_S:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_s),1);
break;
case GTK_ANCHOR_SW:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_sw),1);
break;
case GTK_ANCHOR_SE:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_se),1);
break;
case GTK_ANCHOR_W:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_w),1);
break;
case GTK_ANCHOR_E:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_e),1);
break;
case GTK_ANCHOR_CENTER:
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_center),1);
break;
default:
};
options = pchild->options;
if (options & GTK_PACK_EXPAND) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_expand),1);
} else {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_expand),0);
}
if (options & GTK_FILL_X) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_fillx),1);
} else {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_fillx),0);
}
if (options & GTK_FILL_Y) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_filly),1);
} else {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(info->button_filly),0);
}
gtk_widget_set_sensitive(w, 0);
list = g_list_first(info->widgets);
while (list) {
widget = (GtkWidget*)(list->data);
if (widget != info->current) {
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(widget),0);
gtk_widget_set_sensitive(widget, 1);
}
list = g_list_next(list);
}
}
}
void
add_widget (GtkWidget *w, gpointer data)
{
static gint n = 0;
GtkPacker *packer;
GtkWidget *widget;
gchar str[255];
Info *info;
info = (Info*) data;
packer = GTK_PACKER(info->packer);
sprintf(str, "%d", n);
widget = gtk_toggle_button_new_with_label(str);
gtk_widget_set_usize(widget, 50, 50);
gtk_container_add(GTK_CONTAINER(packer), widget);
gtk_widget_show(widget);
gtk_signal_connect (GTK_OBJECT (widget), "toggled",
GTK_SIGNAL_FUNC (set_widget), (gpointer) info);
info->widgets = g_list_append(info->widgets, (gpointer) widget);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(widget),1);
set_widget(widget, info);
n++;
}

View File

@@ -31,15 +31,14 @@ static const char * xpm_data[] = {
/* when invoked (via signal delete_event), terminates the application.
*/
void close_application( GtkWidget *widget, GdkEvent *event, gpointer data )
{
void close_application( GtkWidget *widget, GdkEvent *event, gpointer *data ) {
gtk_main_quit();
}
/* is invoked when the button is clicked. It just prints a message.
*/
void button_clicked( GtkWidget *widget, gpointer data ) {
void button_clicked( GtkWidget *widget, gpointer *data ) {
printf( "button clicked\n" );
}

View File

@@ -33,7 +33,7 @@ void progress_r (void)
pstat = FALSE;
}
void destroy (GtkWidget *widget, GdkEvent *event, gpointer data)
void destroy (GtkWidget *widget, GdkEvent *event, gpointer *data)
{
gtk_main_quit ();
}

View File

@@ -5,8 +5,7 @@
#include <gtk/gtk.h>
#include <glib.h>
void close_application( GtkWidget *widget, GdkEvent *event, gpointer data )
{
void close_application( GtkWidget *widget, GdkEvent *event, gpointer *data ) {
gtk_main_quit();
}

View File

@@ -1,8 +0,0 @@
CC = gcc
rangewidgets: rangewidgets.c
$(CC) `gtk-config --cflags` `gtk-config --libs` rangewidgets.c -o rangewidgets
clean:
rm -f *.o rangewidgets

View File

@@ -1,287 +0,0 @@
/* example-start rangewidgets rangewidgets.c */
#include <gtk/gtk.h>
GtkWidget *hscale, *vscale;
void cb_pos_menu_select (GtkWidget *item, GtkPositionType pos)
{
/* set the value position on both scale widgets */
gtk_scale_set_value_pos (GTK_SCALE (hscale), pos);
gtk_scale_set_value_pos (GTK_SCALE (vscale), pos);
}
void cb_update_menu_select (GtkWidget *item, GtkUpdateType policy)
{
/* set the update policy for both scale widgets */
gtk_range_set_update_policy (GTK_RANGE (hscale), policy);
gtk_range_set_update_policy (GTK_RANGE (vscale), policy);
}
void cb_digits_scale (GtkAdjustment *adj)
{
/* set the number of decimal places to which adj->vaule is rounded
*/
gtk_scale_set_digits (GTK_SCALE (hscale), (gint) adj->value);
gtk_scale_set_digits (GTK_SCALE (vscale), (gint) adj->value);
}
void cb_page_size (GtkAdjustment *get, GtkAdjustment *set)
{
/* set the page size and page increment size of the sample
adjustment to the value specified by the "Page Size" scale */
set->page_size = get->value;
set->page_increment = get->value;
/* now emit the "changed" signal to reconfigure all the widgets that
are attached to this adjustment */
gtk_signal_emit_by_name (GTK_OBJECT (set), "changed");
}
void cb_draw_value (GtkToggleButton *button)
{
/* turn the value display on the scale widgets off or on depending
on the state of the checkbutton */
gtk_scale_set_draw_value (GTK_SCALE (hscale), button->active);
gtk_scale_set_draw_value (GTK_SCALE (vscale), button->active);
}
/* convenience functions */
GtkWidget *make_menu_item (gchar *name, GtkSignalFunc callback,
gpointer data)
{
GtkWidget *item;
item = gtk_menu_item_new_with_label (name);
gtk_signal_connect (GTK_OBJECT (item), "activate",
callback, data);
gtk_widget_show (item);
return item;
}
void scale_set_default_values (GtkScale *scale)
{
gtk_range_set_update_policy (GTK_RANGE (scale),
GTK_UPDATE_CONTINUOUS);
gtk_scale_set_digits (scale, 1);
gtk_scale_set_value_pos (scale, GTK_POS_TOP);
gtk_scale_set_draw_value (scale, TRUE);
}
/* makes the sample window */
void create_range_controls (void)
{
GtkWidget *window;
GtkWidget *box1, *box2, *box3;
GtkWidget *button;
GtkWidget *scrollbar;
GtkWidget *separator;
GtkWidget *opt, *menu, *item;
GtkWidget *label;
GtkWidget *scale;
GtkObject *adj1, *adj2;
/* standard window-creating stuff */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC(gtk_main_quit),
NULL);
gtk_window_set_title (GTK_WINDOW (window), "range controls");
box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1);
gtk_widget_show (box1);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
/* value, lower, upper, step_increment, page_increment, page_size */
/* note that the page_size value only makes a difference for
scrollbar widgets, and the highest value you'll get is actually
(upper - page_size). */
adj1 = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);
vscale = gtk_vscale_new (GTK_ADJUSTMENT (adj1));
scale_set_default_values (GTK_SCALE (vscale));
gtk_box_pack_start (GTK_BOX (box2), vscale, TRUE, TRUE, 0);
gtk_widget_show (vscale);
box3 = gtk_vbox_new (FALSE, 10);
gtk_box_pack_start (GTK_BOX (box2), box3, TRUE, TRUE, 0);
gtk_widget_show (box3);
/* reuse the same adjustment */
hscale = gtk_hscale_new (GTK_ADJUSTMENT (adj1));
gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 30);
scale_set_default_values (GTK_SCALE (hscale));
gtk_box_pack_start (GTK_BOX (box3), hscale, TRUE, TRUE, 0);
gtk_widget_show (hscale);
/* reuse the same adjustment again */
scrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (adj1));
/* notice how this causes the scales to always be updated
continuously when the scrollbar is moved */
gtk_range_set_update_policy (GTK_RANGE (scrollbar),
GTK_UPDATE_CONTINUOUS);
gtk_box_pack_start (GTK_BOX (box3), scrollbar, TRUE, TRUE, 0);
gtk_widget_show (scrollbar);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
/* a checkbutton to control whether the value is displayed or not */
button = gtk_check_button_new_with_label
("Display value on scale widgets");
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC
(cb_draw_value), NULL);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
gtk_widget_show (button);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
/* an option menu to change the position of the value */
label = gtk_label_new ("Scale Value Position:");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
opt = gtk_option_menu_new();
menu = gtk_menu_new();
item = make_menu_item ("Top", GTK_SIGNAL_FUNC (cb_pos_menu_select),
GINT_TO_POINTER (GTK_POS_TOP));
gtk_menu_append (GTK_MENU (menu), item);
item = make_menu_item ("Bottom", GTK_SIGNAL_FUNC (cb_pos_menu_select),
GINT_TO_POINTER (GTK_POS_BOTTOM));
gtk_menu_append (GTK_MENU (menu), item);
item = make_menu_item ("Left", GTK_SIGNAL_FUNC (cb_pos_menu_select),
GINT_TO_POINTER (GTK_POS_LEFT));
gtk_menu_append (GTK_MENU (menu), item);
item = make_menu_item ("Right", GTK_SIGNAL_FUNC (cb_pos_menu_select),
GINT_TO_POINTER (GTK_POS_RIGHT));
gtk_menu_append (GTK_MENU (menu), item);
gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu);
gtk_box_pack_start (GTK_BOX (box2), opt, TRUE, TRUE, 0);
gtk_widget_show (opt);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
/* yet another option menu, this time for the update policy of the
scale widgets */
label = gtk_label_new ("Scale Update Policy:");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
opt = gtk_option_menu_new();
menu = gtk_menu_new();
item = make_menu_item ("Continuous",
GTK_SIGNAL_FUNC (cb_update_menu_select),
GINT_TO_POINTER (GTK_UPDATE_CONTINUOUS));
gtk_menu_append (GTK_MENU (menu), item);
item = make_menu_item ("Discontinuous",
GTK_SIGNAL_FUNC (cb_update_menu_select),
GINT_TO_POINTER (GTK_UPDATE_DISCONTINUOUS));
gtk_menu_append (GTK_MENU (menu), item);
item = make_menu_item ("Delayed",
GTK_SIGNAL_FUNC (cb_update_menu_select),
GINT_TO_POINTER (GTK_UPDATE_DELAYED));
gtk_menu_append (GTK_MENU (menu), item);
gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu);
gtk_box_pack_start (GTK_BOX (box2), opt, TRUE, TRUE, 0);
gtk_widget_show (opt);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
/* a GtkHScale widget for adjusting the number of digits on the
sample scales. */
label = gtk_label_new ("Scale Digits:");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
adj2 = gtk_adjustment_new (1.0, 0.0, 5.0, 1.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adj2), "value_changed",
GTK_SIGNAL_FUNC (cb_digits_scale), NULL);
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2));
gtk_scale_set_digits (GTK_SCALE (scale), 0);
gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0);
gtk_widget_show (scale);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
/* And, one last GtkHScale widget for adjusting the page size of the
scrollbar. */
label = gtk_label_new ("Scrollbar Page Size:");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
adj2 = gtk_adjustment_new (1.0, 1.0, 101.0, 1.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adj2), "value_changed",
GTK_SIGNAL_FUNC (cb_page_size), adj1);
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2));
gtk_scale_set_digits (GTK_SCALE (scale), 0);
gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0);
gtk_widget_show (scale);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
gtk_widget_show (separator);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
gtk_widget_show (box2);
button = gtk_button_new_with_label ("Quit");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC(gtk_main_quit),
NULL);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
gtk_widget_show (button);
gtk_widget_show (window);
}
int main (int argc, char *argv[])
{
gtk_init(&argc, &argv);
create_range_controls();
gtk_main();
return 0;
}
/* example-end */

View File

@@ -11,8 +11,7 @@
/* this routine gets control when the close button is clicked
*/
void close_application( GtkWidget *widget, GdkEvent *event, gpointer data )
{
void close_application( GtkWidget *widget, GdkEvent *event, gpointer *data ) {
gtk_main_quit();
}

View File

@@ -5,13 +5,13 @@
/* our callback.
* the data passed to this function is printed to stdout */
void callback (GtkWidget *widget, gpointer data)
void callback (GtkWidget *widget, gpointer *data)
{
g_print ("Hello again - %s was pressed\n", (char *) data);
}
/* this callback quits the program */
void delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
void delete_event (GtkWidget *widget, GdkEvent *event, gpointer *data)
{
gtk_main_quit ();
}

View File

@@ -1,8 +0,0 @@
CC = gcc
text: text.c
$(CC) `gtk-config --cflags` `gtk-config --libs` text.c -o text
clean:
rm -f *.o text

View File

@@ -1,181 +0,0 @@
/* example-start text text.c */
/* text.c */
#include <stdio.h>
#include <gtk/gtk.h>
void text_toggle_editable (GtkWidget *checkbutton,
GtkWidget *text)
{
gtk_text_set_editable(GTK_TEXT(text),
GTK_TOGGLE_BUTTON(checkbutton)->active);
}
void text_toggle_word_wrap (GtkWidget *checkbutton,
GtkWidget *text)
{
gtk_text_set_word_wrap(GTK_TEXT(text),
GTK_TOGGLE_BUTTON(checkbutton)->active);
}
void close_application( GtkWidget *widget, gpointer data )
{
gtk_main_quit();
}
int main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *box1;
GtkWidget *box2;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *check;
GtkWidget *separator;
GtkWidget *table;
GtkWidget *vscrollbar;
GtkWidget *text;
GdkColormap *cmap;
GdkColor colour;
GdkFont *fixed_font;
FILE *infile;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize (window, 600, 500);
gtk_window_set_policy (GTK_WINDOW(window), TRUE, TRUE, FALSE);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC(close_application),
NULL);
gtk_window_set_title (GTK_WINDOW (window), "Text Widget Example");
gtk_container_border_width (GTK_CONTAINER (window), 0);
box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1);
gtk_widget_show (box1);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
table = gtk_table_new (2, 2, FALSE);
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
gtk_box_pack_start (GTK_BOX (box2), table, TRUE, TRUE, 0);
gtk_widget_show (table);
/* Create the GtkText widget */
text = gtk_text_new (NULL, NULL);
gtk_text_set_editable (GTK_TEXT (text), TRUE);
gtk_table_attach (GTK_TABLE (table), text, 0, 1, 0, 1,
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (text);
/* Add a vertical scrollbar to the GtkText widget */
vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
gtk_table_attach (GTK_TABLE (table), vscrollbar, 1, 2, 0, 1,
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (vscrollbar);
/* Get the system colour map and allocate the colour red */
cmap = gdk_colormap_get_system();
colour.red = 0xffff;
colour.green = 0;
colour.blue = 0;
if (!gdk_color_alloc(cmap, &colour)) {
g_error("couldn't allocate colour");
}
/* Load a fixed font */
fixed_font = gdk_font_load ("-misc-fixed-medium-r-*-*-*-140-*-*-*-*-*-*");
/* Realizing a widget creates a window for it, ready for us to insert some text */
gtk_widget_realize (text);
/* Freeze the text widget, ready for multiple updates */
gtk_text_freeze (GTK_TEXT (text));
/* Insert some coloured text */
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"Supports ", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &colour, NULL,
"colored ", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"text and different ", -1);
gtk_text_insert (GTK_TEXT (text), fixed_font, &text->style->black, NULL,
"fonts\n\n", -1);
/* Load the file text.c into the text window */
infile = fopen("text.c", "r");
if (infile) {
char buffer[1024];
int nchars;
while (1)
{
nchars = fread(buffer, 1, 1024, infile);
gtk_text_insert (GTK_TEXT (text), fixed_font, NULL,
NULL, buffer, nchars);
if (nchars < 1024)
break;
}
fclose (infile);
}
/* Thaw the text widget, allowing the updates to become visible */
gtk_text_thaw (GTK_TEXT (text));
hbox = gtk_hbutton_box_new ();
gtk_box_pack_start (GTK_BOX (box2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
check = gtk_check_button_new_with_label("Editable");
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(check), "toggled",
GTK_SIGNAL_FUNC(text_toggle_editable), text);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), TRUE);
gtk_widget_show (check);
check = gtk_check_button_new_with_label("Wrap Words");
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(check), "toggled",
GTK_SIGNAL_FUNC(text_toggle_word_wrap), text);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), FALSE);
gtk_widget_show (check);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
gtk_widget_show (separator);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
gtk_widget_show (box2);
button = gtk_button_new_with_label ("close");
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC(close_application),
NULL);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
gtk_widget_show (button);
gtk_widget_show (window);
gtk_main ();
return 0;
}
/* example-end */

View File

@@ -1,8 +0,0 @@
CC = gcc
tree: tree.c
$(CC) `gtk-config --cflags` `gtk-config --libs` tree.c -o tree
clean:
rm -f *.o tree

View File

@@ -1,178 +0,0 @@
/* example-start tree tree.c */
#include <gtk/gtk.h>
/* for all the GtkItem:: and GtkTreeItem:: signals */
static void cb_itemsignal (GtkWidget *item, gchar *signame)
{
gchar *name;
GtkLabel *label;
/* It's a GtkBin, so it has one child, which we know to be a
label, so get that */
label = GTK_LABEL (GTK_BIN (item)->child);
/* Get the text of the label */
gtk_label_get (label, &name);
/* Get the level of the tree which the item is in */
g_print ("%s called for item %s->%p, level %d\n", signame, name,
item, GTK_TREE (item->parent)->level);
}
/* Note that this is never called */
static void cb_unselect_child (GtkWidget *root_tree, GtkWidget *child,
GtkWidget *subtree)
{
g_print ("unselect_child called for root tree %p, subtree %p, child %p\n",
root_tree, subtree, child);
}
/* Note that this is called every time the user clicks on an item,
whether it is already selected or not. */
static void cb_select_child (GtkWidget *root_tree, GtkWidget *child,
GtkWidget *subtree)
{
g_print ("select_child called for root tree %p, subtree %p, child %p\n",
root_tree, subtree, child);
}
static void cb_selection_changed (GtkWidget *tree)
{
GList *i;
g_print ("selection_change called for tree %p\n", tree);
g_print ("selected objects are:\n");
i = GTK_TREE_SELECTION(tree);
while (i){
gchar *name;
GtkLabel *label;
GtkWidget *item;
/* Get a GtkWidget pointer from the list node */
item = GTK_WIDGET (i->data);
label = GTK_LABEL (GTK_BIN (item)->child);
gtk_label_get (label, &name);
g_print ("\t%s on level %d\n", name, GTK_TREE
(item->parent)->level);
i = i->next;
}
}
int main (int argc, char *argv[])
{
GtkWidget *window, *scrolled_win, *tree;
static gchar *itemnames[] = {"Foo", "Bar", "Baz", "Quux",
"Maurice"};
gint i;
gtk_init (&argc, &argv);
/* a generic toplevel window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
gtk_container_border_width (GTK_CONTAINER(window), 5);
/* A generic scrolled window */
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_set_usize (scrolled_win, 150, 200);
gtk_container_add (GTK_CONTAINER(window), scrolled_win);
gtk_widget_show (scrolled_win);
/* Create the root tree */
tree = gtk_tree_new();
g_print ("root tree is %p\n", tree);
/* connect all GtkTree:: signals */
gtk_signal_connect (GTK_OBJECT(tree), "select_child",
GTK_SIGNAL_FUNC(cb_select_child), tree);
gtk_signal_connect (GTK_OBJECT(tree), "unselect_child",
GTK_SIGNAL_FUNC(cb_unselect_child), tree);
gtk_signal_connect (GTK_OBJECT(tree), "selection_changed",
GTK_SIGNAL_FUNC(cb_selection_changed), tree);
/* Add it to the scrolled window */
gtk_container_add (GTK_CONTAINER(scrolled_win), tree);
/* Set the selection mode */
gtk_tree_set_selection_mode (GTK_TREE(tree),
GTK_SELECTION_MULTIPLE);
/* Show it */
gtk_widget_show (tree);
for (i = 0; i < 5; i++){
GtkWidget *subtree, *item;
gint j;
/* Create a tree item */
item = gtk_tree_item_new_with_label (itemnames[i]);
/* Connect all GtkItem:: and GtkTreeItem:: signals */
gtk_signal_connect (GTK_OBJECT(item), "select",
GTK_SIGNAL_FUNC(cb_itemsignal), "select");
gtk_signal_connect (GTK_OBJECT(item), "deselect",
GTK_SIGNAL_FUNC(cb_itemsignal), "deselect");
gtk_signal_connect (GTK_OBJECT(item), "toggle",
GTK_SIGNAL_FUNC(cb_itemsignal), "toggle");
gtk_signal_connect (GTK_OBJECT(item), "expand",
GTK_SIGNAL_FUNC(cb_itemsignal), "expand");
gtk_signal_connect (GTK_OBJECT(item), "collapse",
GTK_SIGNAL_FUNC(cb_itemsignal), "collapse");
/* Add it to the parent tree */
gtk_tree_append (GTK_TREE(tree), item);
/* Show it - this can be done at any time */
gtk_widget_show (item);
/* Create this item's subtree */
subtree = gtk_tree_new();
g_print ("-> item %s->%p, subtree %p\n", itemnames[i], item,
subtree);
/* This is still necesary if you want these signals to be called
for the subtree's children. Note that selection_change will be
signalled for the root tree regardless. */
gtk_signal_connect (GTK_OBJECT(subtree), "select_child",
GTK_SIGNAL_FUNC(cb_select_child), subtree);
gtk_signal_connect (GTK_OBJECT(subtree), "unselect_child",
GTK_SIGNAL_FUNC(cb_unselect_child), subtree);
/* This has absolutely no effect, because it is completely ignored
in subtrees */
gtk_tree_set_selection_mode (GTK_TREE(subtree),
GTK_SELECTION_SINGLE);
/* Neither does this, but for a rather different reason - the
view_mode and view_line values of a tree are propagated to
subtrees when they are mapped. So, setting it later on would
actually have a (somewhat unpredictable) effect */
gtk_tree_set_view_mode (GTK_TREE(subtree), GTK_TREE_VIEW_ITEM);
/* Set this item's subtree - note that you cannot do this until
AFTER the item has been added to its parent tree! */
gtk_tree_item_set_subtree (GTK_TREE_ITEM(item), subtree);
for (j = 0; j < 5; j++){
GtkWidget *subitem;
/* Create a subtree item, in much the same way */
subitem = gtk_tree_item_new_with_label (itemnames[j]);
/* Connect all GtkItem:: and GtkTreeItem:: signals */
gtk_signal_connect (GTK_OBJECT(subitem), "select",
GTK_SIGNAL_FUNC(cb_itemsignal), "select");
gtk_signal_connect (GTK_OBJECT(subitem), "deselect",
GTK_SIGNAL_FUNC(cb_itemsignal), "deselect");
gtk_signal_connect (GTK_OBJECT(subitem), "toggle",
GTK_SIGNAL_FUNC(cb_itemsignal), "toggle");
gtk_signal_connect (GTK_OBJECT(subitem), "expand",
GTK_SIGNAL_FUNC(cb_itemsignal), "expand");
gtk_signal_connect (GTK_OBJECT(subitem), "collapse",
GTK_SIGNAL_FUNC(cb_itemsignal), "collapse");
g_print ("-> -> item %s->%p\n", itemnames[j], subitem);
/* Add it to its parent tree */
gtk_tree_append (GTK_TREE(subtree), subitem);
/* Show it */
gtk_widget_show (subitem);
}
}
/* Show the window and loop endlessly */
gtk_widget_show (window);
gtk_main();
return 0;
}
/* example-end */

View File

@@ -123,7 +123,7 @@ static char * WheelbarrowFull_xpm[] = {
/* when invoked (via signal delete_event), terminates the application.
*/
void close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) {
void close_application( GtkWidget *widget, GdkEvent *event, gpointer *data ) {
gtk_main_quit();
}

View File

@@ -4,7 +4,6 @@ Makefile.in
.deps
_libs
.libs
libgdk-1.1.la
libgdk.la
gdkcursors.h
gdkkeysyms.h
libgdk.la

View File

@@ -3,7 +3,6 @@
gdkincludedir = $(includedir)/gdk
lib_LTLIBRARIES = libgdk.la
DEFS += -DG_LOG_DOMAIN=\"Gdk\"
libgdk_la_SOURCES = \
gdk.c \
@@ -24,11 +23,9 @@ libgdk_la_SOURCES = \
gdkinputxfree.h \
gdkpixmap.c \
gdkproperty.c \
gdkrgb.c \
gdkrectangle.c \
gdkregion.c \
gdkselection.c \
gdkthreads.c \
gdkvisual.c \
gdkwindow.c \
gdkxid.c \
@@ -43,18 +40,16 @@ libgdk_la_SOURCES = \
gdkinclude_HEADERS = \
gdk.h \
gdkcursors.h \
gdkrgb.h \
gdki18n.h \
gdkkeysyms.h \
gdkprivate.h \
gdktypes.h \
gdkx.h
libgdk_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) \
@x_ldflags@ @x_libs@
libgdk_la_LDFLAGS = -version-info $(GTK_MAJOR_VERSION):$(GTK_MICRO_VERSION):0 \
@x_ldflags@ @x_libs@
INCLUDES = -I$(top_srcdir) @GLIB_CFLAGS@ @x_cflags@
INCLUDES = -I$(top_srcdir) -I../glib -I$(top_srcdir)/glib @x_cflags@
EXTRA_PROGRAMS = gxid
@@ -67,14 +62,15 @@ gxid_LDADD = \
@x_libs@ \
-lm
X-derived-headers:
sed -e 's/^#define[ ]*XC\([^ ]*\)[ ]*\([^ ]*\)[ ]*.*$$/GDK\1 = \2,/' \
-e 'tb' -e 'd' -e ':b' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
< @x_includes@/X11/cursorfont.h > gdkcursors.h ; \
sed -e 's/^#define[ ]*XK\([^ ]*\)[ ]*\([^ ]*\)[ ]*.*$$/#define GDK\1 \2/' \
-e 'tb' -e 'd' -e ':b' -e 's/ 0X/ 0x/' \
< @x_includes@/X11/keysymdef.h > gdkkeysyms.h
BUILT_SOURCES = gdkcursors.h gdkkeysyms.h
EXTRA_DIST = makecursors.awk makekeysyms.awk
gdkcursors.h:
awk -f $(srcdir)/makecursors.awk @x_includes@/X11/cursorfont.h > $@
gdkkeysyms.h:
awk -f $(srcdir)/makekeysyms.awk @x_includes@/X11/keysymdef.h > $@
.PHONY: files

3122
gdk/gdk.c

File diff suppressed because it is too large Load Diff

305
gdk/gdk.h
View File

@@ -40,9 +40,8 @@ GdkEvent *gdk_event_get (void);
GdkEvent *gdk_event_get_graphics_expose (GdkWindow *window);
void gdk_event_put (GdkEvent *event);
GdkEvent *gdk_event_copy (GdkEvent *event);
void gdk_event_free (GdkEvent *event);
guint32 gdk_event_get_time (GdkEvent *event);
GdkEvent *gdk_event_copy (GdkEvent *event);
void gdk_event_free (GdkEvent *event);
void gdk_set_show_events (gint show_events);
void gdk_set_use_xshm (gint use_xshm);
@@ -87,9 +86,6 @@ gint gdk_pointer_is_grabbed (void);
gint gdk_screen_width (void);
gint gdk_screen_height (void);
gint gdk_screen_width_mm (void);
gint gdk_screen_height_mm (void);
void gdk_flush (void);
void gdk_beep (void);
@@ -126,13 +122,11 @@ GdkWindow* gdk_window_new (GdkWindow *parent,
GdkWindowAttr *attributes,
gint attributes_mask);
GdkWindow* gdk_window_foreign_new (guint32 anid);
GdkWindow * gdk_window_foreign_new (guint32 anid);
void gdk_window_destroy (GdkWindow *window);
GdkWindow* gdk_window_ref (GdkWindow *window);
void gdk_window_unref (GdkWindow *window);
GdkWindow* gdk_window_at_pointer (gint *win_x,
gint *win_y);
void gdk_window_show (GdkWindow *window);
void gdk_window_hide (GdkWindow *window);
void gdk_window_withdraw (GdkWindow *window);
@@ -196,79 +190,52 @@ void gdk_window_shape_combine_mask (GdkWindow *window,
GdkBitmap *shape_mask,
gint offset_x,
gint offset_y);
/*
* This routine allows you to quickly take the shapes of all the child windows
* of a window and use their shapes as the shape mask for this window - useful
* for container windows that dont want to look like a big box
*
* - Raster
/*
* Drag & Drop
* Algorithm (drop source):
* A window being dragged will be sent a GDK_DRAG_BEGIN message.
* It will then do gdk_dnd_drag_addwindow() for any other windows that are to be
* dragged.
* When we get a DROP_ENTER incoming, we send it on to the window in question.
* That window needs to use gdk_dnd_drop_enter_reply() to indicate the state of
* things (it must call that even if it's not going to accept the drop)
*
* These two turn on/off drag or drop, and if enabling it also
* sets the list of types supported. The list of types passed in
* should be in order of decreasing preference.
*/
void gdk_window_set_child_shapes (GdkWindow *window);
void gdk_window_dnd_drag_set (GdkWindow *window,
guint8 drag_enable,
gchar **typelist,
guint numtypes);
/*
* This routine allows you to merge (ie ADD) child shapes to your
* own window's shape keeping its current shape and ADDING the shild
* shapes to it.
*
* - Raster
/*
*XXX todo: add a GDK_DROP_ENTER which can look at actual data
*/
void gdk_window_merge_child_shapes (GdkWindow *window);
void gdk_window_dnd_drop_set (GdkWindow *window,
guint8 drop_enable,
gchar **typelist,
guint numtypes,
guint8 destructive_op);
/*
* The following function adds a global filter for all client
* messages of type message_type
/*
* This is used by the GDK_DRAG_BEGIN handler. An example of usage would be a
* file manager where multiple icons were selected and the drag began.
* The icon that the drag actually began on would gdk_dnd_drag_addwindow
* for all the other icons that were being dragged...
*/
void gdk_add_client_message_filter (GdkAtom message_type,
GdkFilterFunc func,
gpointer data);
/* Drag and Drop */
GdkDragContext * gdk_drag_context_new (void);
void gdk_drag_context_ref (GdkDragContext *context);
void gdk_drag_context_unref (GdkDragContext *context);
/* Destination side */
void gdk_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time);
void gdk_drop_reply (GdkDragContext *context,
gboolean ok,
guint32 time);
void gdk_drop_finish (GdkDragContext *context,
gboolean success,
guint32 time);
GdkAtom gdk_drag_get_selection (GdkDragContext *context);
/* Source side */
GdkDragContext * gdk_drag_begin (GdkWindow *window,
GList *targets,
GdkDragAction actions);
gboolean gdk_drag_get_protocol (guint32 xid,
GdkDragProtocol *protocol);
void gdk_drag_find_window (GdkDragContext *context,
GdkWindow *drag_window,
gint x_root,
gint y_root,
GdkWindow **dest_window,
GdkDragProtocol *protocol);
gboolean gdk_drag_motion (GdkDragContext *context,
GdkWindow *dest_window,
GdkDragProtocol protocol,
gint x_root,
gint y_root,
GdkDragAction action,
guint32 time);
void gdk_drag_drop (GdkDragContext *context,
guint32 time);
void gdk_drag_abort (GdkDragContext *context,
guint32 time);
GdkAtom gdk_drag_get_selection (GdkDragContext *context);
/* GdkWindow */
void gdk_dnd_drag_addwindow (GdkWindow *window);
void gdk_window_dnd_data_set (GdkWindow *window,
GdkEvent *event,
gpointer data,
gulong data_numbytes);
void gdk_dnd_set_drag_cursors(GdkCursor *default_cursor,
GdkCursor *goahead_cursor);
void gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
GdkPoint *default_hotspot,
GdkWindow *goahead_pixmapwin,
GdkPoint *goahead_hotspot);
void gdk_window_set_hints (GdkWindow *window,
gint x,
@@ -309,9 +276,6 @@ GdkWindowType gdk_window_get_type (GdkWindow *window);
gint gdk_window_get_origin (GdkWindow *window,
gint *x,
gint *y);
void gdk_window_get_root_origin (GdkWindow *window,
gint *x,
gint *y);
GdkWindow* gdk_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
@@ -335,15 +299,6 @@ void gdk_window_set_decorations (GdkWindow *window,
GdkWMDecoration decorations);
void gdk_window_set_functions (GdkWindow *window,
GdkWMFunction functions);
GList * gdk_window_get_toplevels (void);
void gdk_window_register_dnd (GdkWindow *window);
void gdk_drawable_set_data (GdkDrawable *drawable,
const gchar *key,
gpointer data,
GDestroyNotify destroy_func);
/* Cursors
*/
@@ -403,10 +358,6 @@ void gdk_gc_set_line_attributes (GdkGC *gc,
GdkLineStyle line_style,
GdkCapStyle cap_style,
GdkJoinStyle join_style);
void gdk_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gchar dash_list[],
gint n);
void gdk_gc_copy (GdkGC *dst_gc,
GdkGC *src_gc);
@@ -457,10 +408,10 @@ void gdk_bitmap_unref (GdkBitmap *pixmap);
/* Images
*/
GdkImage* gdk_image_new_bitmap(GdkVisual *visual,
gpointer data,
gint width,
gint height);
GdkImage* gdk_image_new_bitmap(GdkVisual *,
gpointer,
gint,
gint);
GdkImage* gdk_image_new (GdkImageType type,
GdkVisual *visual,
gint width,
@@ -492,36 +443,6 @@ gint gdk_colormap_get_system_size (void);
void gdk_colormap_change (GdkColormap *colormap,
gint ncolors);
gint gdk_colormap_alloc_colors (GdkColormap *colormap,
GdkColor *colors,
gint ncolors,
gboolean writeable,
gboolean best_match,
gboolean *success);
gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
GdkColor *color,
gboolean writeable,
gboolean best_match);
void gdk_colormap_free_colors (GdkColormap *colormap,
GdkColor *colors,
gint ncolors);
GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
GdkColor *gdk_color_copy (GdkColor *color);
void gdk_color_free (GdkColor *color);
gint gdk_color_parse (const gchar *spec,
GdkColor *color);
guint gdk_color_hash (const GdkColor *colora,
const GdkColor *colorb);
gint gdk_color_equal (const GdkColor *colora,
const GdkColor *colorb);
/* The following functions are deprecated */
void gdk_colors_store (GdkColormap *colormap,
GdkColor *colors,
gint ncolors);
@@ -539,58 +460,40 @@ gint gdk_color_white (GdkColormap *colormap,
GdkColor *color);
gint gdk_color_black (GdkColormap *colormap,
GdkColor *color);
gint gdk_color_parse (const gchar *spec,
GdkColor *color);
gint gdk_color_alloc (GdkColormap *colormap,
GdkColor *color);
gint gdk_color_change (GdkColormap *colormap,
GdkColor *color);
gint gdk_color_equal (GdkColor *colora,
GdkColor *colorb);
/* Fonts
*/
GdkFont* gdk_font_load (const gchar *font_name);
GdkFont* gdk_fontset_load (gchar *fontset_name);
GdkFont* gdk_font_ref (GdkFont *font);
void gdk_font_unref (GdkFont *font);
gint gdk_font_id (const GdkFont *font);
gint gdk_font_equal (const GdkFont *fonta,
const GdkFont *fontb);
gint gdk_string_width (GdkFont *font,
GdkFont* gdk_fontset_load (gchar *fontset_name);
GdkFont* gdk_font_ref (GdkFont *font);
void gdk_font_unref (GdkFont *font);
gint gdk_font_id (GdkFont *font);
gint gdk_font_equal (GdkFont *fonta,
GdkFont *fontb);
gint gdk_string_width (GdkFont *font,
const gchar *string);
gint gdk_text_width (GdkFont *font,
gint gdk_text_width (GdkFont *font,
const gchar *text,
gint text_length);
gint gdk_char_width (GdkFont *font,
gchar character);
gint gdk_string_measure (GdkFont *font,
gint text_length);
gint gdk_char_width (GdkFont *font,
gchar character);
gint gdk_string_measure (GdkFont *font,
const gchar *string);
gint gdk_text_measure (GdkFont *font,
gint gdk_text_measure (GdkFont *font,
const gchar *text,
gint text_length);
gint gdk_char_measure (GdkFont *font,
gchar character);
gint gdk_string_height (GdkFont *font,
const gchar *string);
gint gdk_text_height (GdkFont *font,
const gchar *text,
gint text_length);
gint gdk_char_height (GdkFont *font,
gchar character);
gint text_length);
gint gdk_char_measure (GdkFont *font,
gchar character);
void gdk_text_extents (GdkFont *font,
const gchar *text,
gint text_length,
gint *lbearing,
gint *rbearing,
gint *width,
gint *ascent,
gint *descent);
void gdk_string_extents (GdkFont *font,
const gchar *string,
gint *lbearing,
gint *rbearing,
gint *width,
gint *ascent,
gint *descent);
/* Drawing
*/
@@ -743,9 +646,6 @@ void gdk_property_delete (GdkWindow *window,
gint gdk_rectangle_intersect (GdkRectangle *src1,
GdkRectangle *src2,
GdkRectangle *dest);
void gdk_rectangle_union (GdkRectangle *src1,
GdkRectangle *src2,
GdkRectangle *dest);
/* XInput support
*/
@@ -784,27 +684,25 @@ GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
/* International Input Method Support Functions
*/
gint gdk_im_ready (void);
gint gdk_im_ready (void);
void gdk_im_begin (GdkIC ic,
GdkWindow* window);
void gdk_im_end (void);
GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style);
GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style);
GdkIC gdk_ic_new (GdkWindow* client_window,
GdkWindow* focus_window,
GdkIMStyle style, ...);
void gdk_ic_destroy (GdkIC ic);
GdkIMStyle gdk_ic_get_style (GdkIC ic);
void gdk_ic_set_values (GdkIC ic,
...);
void gdk_ic_get_values (GdkIC ic,
...);
void gdk_ic_set_attr (GdkIC ic,
const char *target, ...);
void gdk_ic_get_attr (GdkIC ic,
const char *target, ...);
GdkEventMask gdk_ic_get_events (GdkIC ic);
void gdk_im_begin (GdkIC ic, GdkWindow* window);
void gdk_im_end (void);
GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style);
GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style);
GdkIC gdk_ic_new (GdkWindow* client_window,
GdkWindow* focus_window,
GdkIMStyle style, ...);
void gdk_ic_destroy (GdkIC ic);
GdkIMStyle gdk_ic_get_style (GdkIC ic);
void gdk_ic_set_values (GdkIC ic, ...);
void gdk_ic_get_values (GdkIC ic, ...);
void gdk_ic_set_attr (GdkIC ic, const char *target, ...);
void gdk_ic_get_attr (GdkIC ic, const char *target, ...);
GdkEventMask gdk_ic_get_events (GdkIC ic);
/* Miscellaneous */
void gdk_event_send_clientmessage_toall(GdkEvent *event);
/* Color Context */
@@ -866,9 +764,6 @@ guchar gdk_color_context_get_index_from_palette (GdkColorContext *cc,
GdkRegion* gdk_region_new (void);
void gdk_region_destroy (GdkRegion *region);
void gdk_region_get_clipbox(GdkRegion *region,
GdkRectangle *rectangle);
gboolean gdk_region_empty (GdkRegion *region);
gboolean gdk_region_equal (GdkRegion *region1,
GdkRegion *region2);
@@ -900,34 +795,6 @@ GdkRegion* gdk_regions_subtract (GdkRegion *source1,
GdkRegion* gdk_regions_xor (GdkRegion *source1,
GdkRegion *source2);
/* Threads
*/
gboolean gdk_threads_init (void);
void gdk_threads_enter (void);
void gdk_threads_leave (void);
/* If the mainloop thread is in its select, wake it up.
* For GTK's idle handling
*/
void gdk_threads_wake (void);
/* Miscellaneous */
void gdk_event_send_clientmessage_toall (GdkEvent *event);
gboolean gdk_event_send_client_message (GdkEvent *event,
guint32 xid);
/* Key values
*/
gchar* gdk_keyval_name (guint keyval);
guint gdk_keyval_from_name (const gchar *keyval_name);
guint gdk_keyval_to_upper (guint keyval);
guint gdk_keyval_to_lower (guint keyval);
gboolean gdk_keyval_is_upper (guint keyval);
gboolean gdk_keyval_is_lower (guint keyval);
#include <gdk/gdkrgb.h>
#ifdef __cplusplus
}

File diff suppressed because it is too large Load Diff

View File

@@ -16,11 +16,9 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <time.h>
#include <X11/Xlib.h>
#include "gdk.h"
#include "gdkprivate.h"
#include "gdkx.h"
static gint gdk_colormap_match_color (GdkColormap *cmap,
@@ -53,12 +51,8 @@ gdk_colormap_new (GdkVisual *visual,
private->xdisplay = gdk_display;
private->visual = visual;
private->next_color = 0;
private->ref_count = 1;
private->hash = NULL;
private->last_sync_time = 0;
private->info = NULL;
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
colormap->size = visual->colormap_size;
@@ -68,12 +62,6 @@ gdk_colormap_new (GdkVisual *visual,
{
case GDK_VISUAL_GRAYSCALE:
case GDK_VISUAL_PSEUDO_COLOR:
private->info = g_new0 (GdkColorInfo, colormap->size);
colormap->colors = g_new (GdkColor, colormap->size);
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,
xvisual, (private_cmap) ? (AllocAll) : (AllocNone));
@@ -145,15 +133,12 @@ gdk_colormap_real_destroy (GdkColormap *colormap)
GdkColormapPrivate *private = (GdkColormapPrivate*) colormap;
g_return_if_fail (colormap != NULL);
g_return_if_fail (private->ref_count > 0);
if (private->ref_count > 0)
return;
gdk_colormap_remove (colormap);
XFreeColormap (private->xdisplay, private->xcolormap);
if (private->hash)
g_hash_table_destroy (private->hash);
g_free (private->info);
g_free (colormap->colors);
g_free (colormap);
}
@@ -179,73 +164,13 @@ gdk_colormap_unref (GdkColormap *cmap)
gdk_colormap_real_destroy (cmap);
}
GdkVisual *
gdk_colormap_get_visual (GdkColormap *colormap)
{
GdkColormapPrivate *private;
g_return_val_if_fail (colormap != NULL, NULL);
private = (GdkColormapPrivate *)colormap;
return private->visual;
}
#define MIN_SYNC_TIME 2
void
gdk_colormap_sync (GdkColormap *colormap,
gboolean force)
{
time_t current_time;
GdkColormapPrivate *private = (GdkColormapPrivate *)colormap;
XColor *xpalette;
gint nlookup;
gint i;
g_return_if_fail (colormap != NULL);
current_time = time (NULL);
if (!force && ((current_time - private->last_sync_time) < MIN_SYNC_TIME))
return;
private->last_sync_time = current_time;
nlookup = 0;
xpalette = g_new (XColor, colormap->size);
for (i = 0; i < colormap->size; i++)
{
if (private->info[i].ref_count == 0)
{
xpalette[nlookup].pixel = i;
xpalette[nlookup].red = 0;
xpalette[nlookup].green = 0;
xpalette[nlookup].blue = 0;
nlookup++;
}
}
XQueryColors (gdk_display, private->xcolormap, xpalette, nlookup);
for (i = 0; i < nlookup; i++)
{
gulong pixel = xpalette[i].pixel;
colormap->colors[pixel].pixel = pixel;
colormap->colors[pixel].red = xpalette[i].red;
colormap->colors[pixel].green = xpalette[i].green;
colormap->colors[pixel].blue = xpalette[i].blue;
}
g_free (xpalette);
}
GdkColormap*
gdk_colormap_get_system (void)
{
static GdkColormap *colormap = NULL;
GdkColormapPrivate *private;
XColor *xpalette;
gint i;
if (!colormap)
{
@@ -256,25 +181,37 @@ gdk_colormap_get_system (void)
private->xcolormap = DefaultColormap (gdk_display, gdk_screen);
private->visual = gdk_visual_get_system ();
private->private_val = FALSE;
private->next_color = 0;
private->ref_count = 1;
private->hash = NULL;
private->last_sync_time = 0;
private->info = NULL;
colormap->colors = NULL;
colormap->size = private->visual->colormap_size;
colormap->colors = g_new (GdkColor, colormap->size);
if ((private->visual->type == GDK_VISUAL_GRAYSCALE) ||
(private->visual->type == GDK_VISUAL_PSEUDO_COLOR))
{
private->info = g_new0 (GdkColorInfo, colormap->size);
colormap->colors = g_new (GdkColor, colormap->size);
xpalette = g_new (XColor, colormap->size);
private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
(GCompareFunc) gdk_color_equal);
for (i = 0; i < colormap->size; i++)
{
xpalette[i].pixel = i;
xpalette[i].red = 0;
xpalette[i].green = 0;
xpalette[i].blue = 0;
}
XQueryColors (gdk_display, private->xcolormap, xpalette,
colormap->size);
for (i = 0; i < colormap->size; i++)
{
colormap->colors[i].pixel = xpalette[i].pixel;
colormap->colors[i].red = xpalette[i].red;
colormap->colors[i].green = xpalette[i].green;
colormap->colors[i].blue = xpalette[i].blue;
}
gdk_colormap_sync (colormap, TRUE);
g_free (xpalette);
}
gdk_colormap_add (colormap);
@@ -320,6 +257,7 @@ gdk_colormap_change (GdkColormap *colormap,
}
XStoreColors (private->xdisplay, private->xcolormap, palette, ncolors);
private->next_color = MAX (private->next_color, ncolors);
break;
case GDK_VISUAL_DIRECT_COLOR:
@@ -390,7 +328,7 @@ gdk_colors_store (GdkColormap *colormap,
gdk_colormap_change (colormap, ncolors);
}
gboolean
gint
gdk_colors_alloc (GdkColormap *colormap,
gint contiguous,
gulong *planes,
@@ -400,7 +338,6 @@ gdk_colors_alloc (GdkColormap *colormap,
{
GdkColormapPrivate *private;
gint return_val;
gint i;
g_return_val_if_fail (colormap != NULL, 0);
@@ -409,121 +346,23 @@ gdk_colors_alloc (GdkColormap *colormap,
return_val = XAllocColorCells (private->xdisplay, private->xcolormap,
contiguous, planes, nplanes, pixels, npixels);
if (return_val)
{
for (i=0; i<npixels; i++)
{
private->info[pixels[i]].ref_count++;
private->info[pixels[i]].flags |= GDK_COLOR_WRITEABLE;
}
}
return return_val;
}
/* This is almost identical to gdk_colormap_free_colors.
* Keep them in sync!
*/
void
gdk_colors_free (GdkColormap *colormap,
gulong *in_pixels,
gint in_npixels,
gulong *pixels,
gint npixels,
gulong planes)
{
GdkColormapPrivate *private;
gulong *pixels;
gint npixels = 0;
gint i;
g_return_if_fail (colormap != NULL);
g_return_if_fail (in_pixels != NULL);
private = (GdkColormapPrivate*) colormap;
if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
(private->visual->type != GDK_VISUAL_GRAYSCALE))
return;
pixels = g_new (gulong, in_npixels);
for (i=0; i<in_npixels; i++)
{
gulong pixel = in_pixels[i];
if (private->info[pixel].ref_count)
{
private->info[pixel].ref_count--;
if (private->info[pixel].ref_count == 0)
{
pixels[npixels++] = pixel;
if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE))
g_hash_table_remove (private->hash, &colormap->colors[in_pixels[i]]);
private->info[pixel].flags = 0;
}
}
}
if (npixels)
XFreeColors (private->xdisplay, private->xcolormap,
pixels, npixels, planes);
g_free (pixels);
}
/*
*--------------------------------------------------------------
* gdk_color_copy
*
* Copy a color structure into new storage.
*
* Arguments:
* "color" is the color struct to copy.
*
* Results:
* A new color structure. Free it with gdk_color_free.
*
*--------------------------------------------------------------
*/
static GMemChunk *color_chunk;
GdkColor*
gdk_color_copy (GdkColor *color)
{
GdkColor *new_color;
g_return_val_if_fail (color != NULL, NULL);
if (color_chunk == NULL)
color_chunk = g_mem_chunk_new ("colors",
sizeof (GdkColor),
4096,
G_ALLOC_AND_FREE);
new_color = g_chunk_new (GdkColor, color_chunk);
*new_color = *color;
return new_color;
}
/*
*--------------------------------------------------------------
* gdk_color_free
*
* Free a color structure obtained from gdk_color_copy. Do not use
* with other color structures.
*
* Arguments:
* "color" is the color struct to free.
*
*-------------------------------------------------------------- */
void
gdk_color_free (GdkColor *color)
{
g_assert (color_chunk != NULL);
g_return_if_fail (color != NULL);
g_mem_chunk_free (color_chunk, color);
XFreeColors (private->xdisplay, private->xcolormap,
pixels, npixels, planes);
}
gint
@@ -572,13 +411,13 @@ gdk_color_black (GdkColormap *colormap,
return return_val;
}
gboolean
gint
gdk_color_parse (const gchar *spec,
GdkColor *color)
{
Colormap xcolormap;
XColor xcolor;
gboolean return_val;
gint return_val;
g_return_val_if_fail (spec != NULL, FALSE);
g_return_val_if_fail (color != NULL, FALSE);
@@ -598,22 +437,19 @@ gdk_color_parse (const gchar *spec,
return return_val;
}
/********************
* Color allocation *
********************/
/* Try to allocate a single color using XAllocColor. If it succeeds,
* cache the result in our colormap, and store in ret.
*/
static gboolean
gdk_colormap_alloc1 (GdkColormap *colormap,
GdkColor *color,
GdkColor *ret)
gint
gdk_color_alloc (GdkColormap *colormap,
GdkColor *color)
{
GdkColormapPrivate *private;
GdkVisual *visual;
XColor xcolor;
gchar *available = NULL;
gint return_val;
gint i, index;
private = (GdkColormapPrivate*) colormap;
g_return_val_if_fail (colormap != NULL, FALSE);
g_return_val_if_fail (color != NULL, FALSE);
xcolor.red = color->red;
xcolor.green = color->green;
@@ -621,461 +457,116 @@ gdk_colormap_alloc1 (GdkColormap *colormap,
xcolor.pixel = color->pixel;
xcolor.flags = DoRed | DoGreen | DoBlue;
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
{
ret->pixel = xcolor.pixel;
ret->red = xcolor.red;
ret->green = xcolor.green;
ret->blue = xcolor.blue;
if (ret->pixel < colormap->size)
{
if (private->info[ret->pixel].ref_count) /* got a duplicate */
{
XFreeColors (private->xdisplay, private->xcolormap,
&ret->pixel, 1, 0);
}
else
{
colormap->colors[ret->pixel] = *color;
private->info[ret->pixel].ref_count = 1;
g_hash_table_insert (private->hash,
&colormap->colors[ret->pixel],
&colormap->colors[ret->pixel]);
}
}
return TRUE;
}
else
{
return FALSE;
}
}
static gint
gdk_colormap_alloc_colors_writeable (GdkColormap *colormap,
GdkColor *colors,
gint ncolors,
gboolean writeable,
gboolean best_match,
gboolean *success)
{
GdkColormapPrivate *private;
gulong *pixels;
Status status;
gint i, index;
return_val = FALSE;
private = (GdkColormapPrivate*) colormap;
if (private->private_val)
{
index = 0;
for (i=0; i<ncolors; i++)
{
while ((index < colormap->size) && (private->info[index].ref_count != 0))
index++;
if (index < colormap->size)
{
colors[i].pixel = index;
success[i] = TRUE;
private->info[index].ref_count++;
private->info[i].flags |= GDK_COLOR_WRITEABLE;
}
else
break;
}
return i;
}
else
{
pixels = g_new (gulong, ncolors);
/* Allocation of a writeable color cells */
status = XAllocColorCells (private->xdisplay, private->xcolormap,
FALSE, NULL, 0, pixels, ncolors);
if (status)
{
for (i=0; i<ncolors; i++)
{
colors[i].pixel = pixels[i];
private->info[pixels[i]].ref_count++;
private->info[pixels[i]].flags |= GDK_COLOR_WRITEABLE;
}
}
g_free (pixels);
return status ? ncolors : 0;
}
}
static gint
gdk_colormap_alloc_colors_private (GdkColormap *colormap,
GdkColor *colors,
gint ncolors,
gboolean writeable,
gboolean best_match,
gboolean *success)
{
GdkColormapPrivate *private;
gint i, index;
XColor *store = g_new (XColor, ncolors);
gint nstore = 0;
gint nremaining = 0;
private = (GdkColormapPrivate*) colormap;
index = -1;
/* First, store the colors we have room for */
index = 0;
for (i=0; i<ncolors; i++)
{
if (!success[i])
{
while ((index < colormap->size) && (private->info[index].ref_count != 0))
index++;
if (index < colormap->size)
{
store[nstore].red = colors[i].red;
store[nstore].blue = colors[i].blue;
store[nstore].green = colors[i].green;
store[nstore].pixel = index;
nstore++;
success[i] = TRUE;
colors[i].pixel = index;
private->info[index].ref_count++;
}
else
nremaining++;
}
}
XStoreColors (private->xdisplay, private->xcolormap, store, nstore);
g_free (store);
if (nremaining > 0 && best_match)
{
/* Get best matches for remaining colors */
gchar *available = g_new (gchar, colormap->size);
for (i = 0; i < colormap->size; i++)
available[i] = TRUE;
for (i=0; i<ncolors; i++)
{
if (!success[i])
{
index = gdk_colormap_match_color (colormap,
&colors[i],
available);
if (index != -1)
{
colors[i] = colormap->colors[index];
private->info[index].ref_count++;
success[i] = TRUE;
nremaining--;
}
}
}
g_free (available);
}
return (ncolors - nremaining);
}
static gint
gdk_colormap_alloc_colors_shared (GdkColormap *colormap,
GdkColor *colors,
gint ncolors,
gboolean writeable,
gboolean best_match,
gboolean *success)
{
GdkColormapPrivate *private;
gint i, index;
gint nremaining = 0;
gint nfailed = 0;
private = (GdkColormapPrivate*) colormap;
index = -1;
for (i=0; i<ncolors; i++)
{
if (!success[i])
{
if (gdk_colormap_alloc1 (colormap, &colors[i], &colors[i]))
success[i] = TRUE;
else
nremaining++;
}
}
if (nremaining > 0 && best_match)
{
gchar *available = g_new (gchar, colormap->size);
for (i = 0; i < colormap->size; i++)
available[i] = ((private->info[i].ref_count == 0) ||
!(private->info[i].flags && GDK_COLOR_WRITEABLE));
gdk_colormap_sync (colormap, FALSE);
while (nremaining > 0)
{
for (i=0; i<ncolors; i++)
{
if (!success[i])
{
index = gdk_colormap_match_color (colormap, &colors[i], available);
if (index != -1)
{
if (private->info[index].ref_count)
{
private->info[index].ref_count++;
colors[i] = colormap->colors[index];
success[i] = TRUE;
nremaining--;
}
else
{
if (gdk_colormap_alloc1 (colormap,
&colormap->colors[index],
&colors[i]))
{
success[i] = TRUE;
nremaining--;
break;
}
else
{
available[index] = FALSE;
}
}
}
else
{
nfailed++;
nremaining--;
success[i] = 2; /* flag as permanent failure */
}
}
}
}
g_free (available);
}
/* Change back the values we flagged as permanent failures */
if (nfailed > 0)
{
for (i=0; i<ncolors; i++)
if (success[i] == 2)
success[i] = FALSE;
nremaining = nfailed;
}
return (ncolors - nremaining);
}
static gint
gdk_colormap_alloc_colors_pseudocolor (GdkColormap *colormap,
GdkColor *colors,
gint ncolors,
gboolean writeable,
gboolean best_match,
gboolean *success)
{
GdkColormapPrivate *private;
GdkColor *lookup_color;
gint i;
gint nremaining = 0;
private = (GdkColormapPrivate*) colormap;
/* Check for an exact match among previously allocated colors */
for (i=0; i<ncolors; i++)
{
if (!success[i])
{
lookup_color = g_hash_table_lookup (private->hash, &colors[i]);
if (lookup_color)
{
private->info[lookup_color->pixel].ref_count++;
colors[i].pixel = lookup_color->pixel;
success[i] = TRUE;
}
else
nremaining++;
}
}
/* If that failed, we try to allocate a new color, or approxmiate
* with what we can get if best_match is TRUE.
*/
if (nremaining > 0)
{
if (private->private_val)
return gdk_colormap_alloc_colors_private (colormap, colors, ncolors, writeable, best_match, success);
else
return gdk_colormap_alloc_colors_shared (colormap, colors, ncolors, writeable, best_match, success);
}
else
return 0;
}
gint
gdk_colormap_alloc_colors (GdkColormap *colormap,
GdkColor *colors,
gint ncolors,
gboolean writeable,
gboolean best_match,
gboolean *success)
{
GdkColormapPrivate *private;
GdkVisual *visual;
gint i;
gint nremaining = 0;
XColor xcolor;
g_return_val_if_fail (colormap != NULL, FALSE);
g_return_val_if_fail (colors != NULL, FALSE);
private = (GdkColormapPrivate*) colormap;
for (i=0; i<ncolors; i++)
{
success[i] = FALSE;
}
switch (private->visual->type)
{
case GDK_VISUAL_PSEUDO_COLOR:
case GDK_VISUAL_GRAYSCALE:
if (writeable)
return gdk_colormap_alloc_colors_writeable (colormap, colors, ncolors,
writeable, best_match, success);
case GDK_VISUAL_PSEUDO_COLOR:
if (private->private_val)
{
if (private->next_color >= colormap->size)
{
available = g_new (gchar, colormap->size);
for (i = 0; i < colormap->size; i++)
available[i] = TRUE;
index = gdk_colormap_match_color (colormap, color, available);
if (index != -1)
{
available[index] = FALSE;
*color = colormap->colors[index];
return_val = TRUE;
}
else
{
return_val = FALSE;
}
}
else
{
xcolor.pixel = colormap->size - 1 -private->next_color;
color->pixel = xcolor.pixel;
private->next_color += 1;
XStoreColor (private->xdisplay, private->xcolormap, &xcolor);
return_val = TRUE;
}
}
else
return gdk_colormap_alloc_colors_pseudocolor (colormap, colors, ncolors,
writeable, best_match, success);
{
while (1)
{
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
{
color->pixel = xcolor.pixel;
color->red = xcolor.red;
color->green = xcolor.green;
color->blue = xcolor.blue;
if (color->pixel < colormap->size)
colormap->colors[color->pixel] = *color;
return_val = TRUE;
break;
}
else
{
if (available == NULL)
{
available = g_new (gchar, colormap->size);
for (i = 0; i < colormap->size; i++)
available[i] = TRUE;
}
index = gdk_colormap_match_color (colormap, color, available);
if (index != -1)
{
available[index] = FALSE;
xcolor.red = colormap->colors[index].red;
xcolor.green = colormap->colors[index].green;
xcolor.blue = colormap->colors[index].blue;
}
else
{
return_val = FALSE;
break;
}
}
}
}
break;
case GDK_VISUAL_DIRECT_COLOR:
case GDK_VISUAL_TRUE_COLOR:
visual = private->visual;
for (i=0; i<ncolors; i++)
{
colors[i].pixel = (((colors[i].red >> (16 - visual->red_prec)) << visual->red_shift) +
((colors[i].green >> (16 - visual->green_prec)) << visual->green_shift) +
((colors[i].blue >> (16 - visual->blue_prec)) << visual->blue_shift));
success[i] = TRUE;
}
xcolor.pixel = (((xcolor.red >> (16 - visual->red_prec)) << visual->red_shift) +
((xcolor.green >> (16 - visual->green_prec)) << visual->green_shift) +
((xcolor.blue >> (16 - visual->blue_prec)) << visual->blue_shift));
color->pixel = xcolor.pixel;
return_val = TRUE;
break;
case GDK_VISUAL_STATIC_GRAY:
case GDK_VISUAL_STATIC_COLOR:
for (i=0; i<ncolors; i++)
case GDK_VISUAL_TRUE_COLOR:
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
{
xcolor.red = colors[i].red;
xcolor.green = colors[i].green;
xcolor.blue = colors[i].blue;
xcolor.pixel = colors[i].pixel;
xcolor.flags = DoRed | DoGreen | DoBlue;
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
{
colors[i].pixel = xcolor.pixel;
success[i] = TRUE;
}
else
nremaining++;
color->pixel = xcolor.pixel;
return_val = TRUE;
}
else
return_val = FALSE;
break;
}
return nremaining;
if (available)
g_free (available);
return return_val;
}
gboolean
gdk_colormap_alloc_color (GdkColormap *colormap,
GdkColor *color,
gboolean writeable,
gboolean best_match)
{
gboolean success;
gdk_colormap_alloc_colors (colormap, color, 1, writeable, best_match,
&success);
return success;
}
/* This is almost identical to gdk_colors_free.
* Keep them in sync!
*/
void
gdk_colormap_free_colors (GdkColormap *colormap,
GdkColor *colors,
gint ncolors)
{
GdkColormapPrivate *private;
gulong *pixels;
gint npixels = 0;
gint i;
g_return_if_fail (colormap != NULL);
g_return_if_fail (colors != NULL);
private = (GdkColormapPrivate*) colormap;
if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
(private->visual->type != GDK_VISUAL_GRAYSCALE))
return;
pixels = g_new (gulong, ncolors);
for (i=0; i<ncolors; i++)
{
gulong pixel = colors[i].pixel;
if (private->info[pixel].ref_count)
{
private->info[pixel].ref_count--;
if (private->info[pixel].ref_count == 0)
{
pixels[npixels++] = pixel;
if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE))
g_hash_table_remove (private->hash, &colors[i]);
private->info[pixel].flags = 0;
}
}
}
if (npixels)
XFreeColors (private->xdisplay, private->xcolormap,
pixels, npixels, 0);
g_free (pixels);
}
gboolean
gdk_color_alloc (GdkColormap *colormap,
GdkColor *color)
{
gboolean success;
gdk_colormap_alloc_colors (colormap, color, 1, FALSE, TRUE, &success);
return success;
}
gboolean
gint
gdk_color_change (GdkColormap *colormap,
GdkColor *color)
{
@@ -1097,19 +588,9 @@ gdk_color_change (GdkColormap *colormap,
return TRUE;
}
guint
gdk_color_hash (const GdkColor *colora,
const GdkColor *colorb)
{
return ((colora->red) +
(colora->green << 11) +
(colora->blue << 22) +
(colora->blue >> 6));
}
gint
gdk_color_equal (const GdkColor *colora,
const GdkColor *colorb)
gdk_color_equal (GdkColor *colora,
GdkColor *colorb)
{
g_return_val_if_fail (colora != NULL, FALSE);
g_return_val_if_fail (colorb != NULL, FALSE);
@@ -1119,9 +600,6 @@ gdk_color_equal (const GdkColor *colora,
(colora->blue == colorb->blue));
}
/* XXX: Do not use this function until it is fixed. An X Colormap
* is useless unless we also have the visual.
*/
GdkColormap*
gdkx_colormap_get (Colormap xcolormap)
{
@@ -1142,6 +620,7 @@ gdkx_colormap_get (Colormap xcolormap)
private->xcolormap = xcolormap;
private->visual = NULL;
private->private_val = TRUE;
private->next_color = 0;
/* To do the following safely, we would have to have some way of finding
* out what the size or visual of the given colormap is. It seems

View File

@@ -1,3 +1,21 @@
/* GDK - The GIMP Drawing Kit
* 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.
*/
GDK_NUM_GLYPHS = 154,
GDK_X_CURSOR = 0,
GDK_ARROW = 2,

File diff suppressed because it is too large Load Diff

View File

@@ -72,9 +72,9 @@ gdk_fontset_load (gchar *fontset_name)
if (missing_charset_count)
{
gint i;
g_message ("Missing charsets in FontSet creation\n");
g_print ("Missing charsets in FontSet creation\n");
for (i=0;i<missing_charset_count;i++)
g_message (" %s\n", missing_charset_list[i]);
g_print (" %s\n", missing_charset_list[i]);
XFreeStringList (missing_charset_list);
}
@@ -149,13 +149,13 @@ gdk_font_unref (GdkFont *font)
}
gint
gdk_font_id (const GdkFont *font)
gdk_font_id (GdkFont *font)
{
const GdkFontPrivate *font_private;
GdkFontPrivate *font_private;
g_return_val_if_fail (font != NULL, 0);
font_private = (const GdkFontPrivate*) font;
font_private = (GdkFontPrivate*) font;
if (font->type == GDK_FONT_FONT)
{
@@ -168,17 +168,17 @@ gdk_font_id (const GdkFont *font)
}
gint
gdk_font_equal (const GdkFont *fonta,
const GdkFont *fontb)
gdk_font_equal (GdkFont *fonta,
GdkFont *fontb)
{
const GdkFontPrivate *privatea;
const GdkFontPrivate *privateb;
GdkFontPrivate *privatea;
GdkFontPrivate *privateb;
g_return_val_if_fail (fonta != NULL, FALSE);
g_return_val_if_fail (fontb != NULL, FALSE);
privatea = (const GdkFontPrivate*) fonta;
privateb = (const GdkFontPrivate*) fontb;
privatea = (GdkFontPrivate*) fonta;
privateb = (GdkFontPrivate*) fontb;
if (fonta->type == GDK_FONT_FONT && fontb->type == GDK_FONT_FONT)
{
@@ -328,92 +328,6 @@ gdk_string_measure (GdkFont *font,
return gdk_text_measure (font, string, strlen (string));
}
void
gdk_text_extents (GdkFont *font,
const gchar *text,
gint text_length,
gint *lbearing,
gint *rbearing,
gint *width,
gint *ascent,
gint *descent)
{
GdkFontPrivate *private;
XCharStruct overall;
XFontStruct *xfont;
XFontSet fontset;
XRectangle ink, logical;
int direction;
int font_ascent;
int font_descent;
g_return_if_fail (font != NULL);
g_return_if_fail (text != NULL);
private = (GdkFontPrivate*) font;
switch (font->type)
{
case GDK_FONT_FONT:
xfont = (XFontStruct *) private->xfont;
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
{
XTextExtents (xfont, text, text_length,
&direction, &font_ascent, &font_descent,
&overall);
}
else
{
XTextExtents16 (xfont, (XChar2b *) text, text_length / 2,
&direction, &font_ascent, &font_descent,
&overall);
}
if (lbearing)
*lbearing = overall.lbearing;
if (rbearing)
*rbearing = overall.rbearing;
if (width)
*width = overall.width;
if (ascent)
*ascent = overall.ascent;
if (descent)
*descent = overall.descent;
break;
case GDK_FONT_FONTSET:
fontset = (XFontSet) private->xfont;
XmbTextExtents (fontset, text, text_length, &ink, &logical);
if (lbearing)
*lbearing = -ink.x;
if (rbearing)
*rbearing = ink.y;
if (width)
*width = logical.width;
if (ascent)
*ascent = ink.height;
if (descent)
*descent = -ink.y;
break;
}
}
void
gdk_string_extents (GdkFont *font,
const gchar *string,
gint *lbearing,
gint *rbearing,
gint *width,
gint *ascent,
gint *descent)
{
g_return_if_fail (font != NULL);
g_return_if_fail (string != NULL);
gdk_text_extents (font, string, strlen (string),
lbearing, rbearing, width, ascent, descent);
}
gint
gdk_text_measure (GdkFont *font,
const gchar *text,
@@ -471,71 +385,3 @@ gdk_char_measure (GdkFont *font,
return gdk_text_measure (font, &character, 1);
}
gint
gdk_string_height (GdkFont *font,
const gchar *string)
{
g_return_val_if_fail (font != NULL, -1);
g_return_val_if_fail (string != NULL, -1);
return gdk_text_height (font, string, strlen (string));
}
gint
gdk_text_height (GdkFont *font,
const gchar *text,
gint text_length)
{
GdkFontPrivate *private;
XCharStruct overall;
XFontStruct *xfont;
XFontSet fontset;
XRectangle ink, log;
int direction;
int font_ascent;
int font_descent;
gint height;
g_return_val_if_fail (font != NULL, -1);
g_return_val_if_fail (text != NULL, -1);
private = (GdkFontPrivate*) font;
switch (font->type)
{
case GDK_FONT_FONT:
xfont = (XFontStruct *) private->xfont;
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
{
XTextExtents (xfont, text, text_length,
&direction, &font_ascent, &font_descent,
&overall);
}
else
{
XTextExtents16 (xfont, (XChar2b *) text, text_length / 2,
&direction, &font_ascent, &font_descent,
&overall);
}
height = overall.ascent + overall.descent;
break;
case GDK_FONT_FONTSET:
fontset = (XFontSet) private->xfont;
XmbTextExtents (fontset, text, text_length, &ink, &log);
height = log.height;
break;
default:
height = 0;
}
return height;
}
gint
gdk_char_height (GdkFont *font,
gchar character)
{
g_return_val_if_fail (font != NULL, -1);
return gdk_text_height (font, &character, 1);
}

View File

@@ -88,42 +88,6 @@ gdk_gc_new_with_values (GdkWindow *window,
case GDK_XOR:
xvalues.function = GXxor;
break;
case GDK_CLEAR:
xvalues.function = GXclear;
break;
case GDK_AND:
xvalues.function = GXand;
break;
case GDK_AND_REVERSE:
xvalues.function = GXandReverse;
break;
case GDK_AND_INVERT:
xvalues.function = GXandInverted;
break;
case GDK_NOOP:
xvalues.function = GXnoop;
break;
case GDK_OR:
xvalues.function = GXor;
break;
case GDK_EQUIV:
xvalues.function = GXequiv;
break;
case GDK_OR_REVERSE:
xvalues.function = GXorReverse;
break;
case GDK_COPY_INVERT:
xvalues.function = GXcopyInverted;
break;
case GDK_OR_INVERT:
xvalues.function = GXorInverted;
break;
case GDK_NAND:
xvalues.function = GXnand;
break;
case GDK_SET:
xvalues.function = GXset;
break;
}
xvalues_mask |= GCFunction;
}
@@ -325,42 +289,6 @@ gdk_gc_get_values (GdkGC *gc,
case GXxor:
values->function = GDK_XOR;
break;
case GXclear:
values->function = GDK_CLEAR;
break;
case GXand:
values->function = GDK_AND;
break;
case GXandReverse:
values->function = GDK_AND_REVERSE;
break;
case GXandInverted:
values->function = GDK_AND_INVERT;
break;
case GXnoop:
values->function = GDK_NOOP;
break;
case GXor:
values->function = GDK_OR;
break;
case GXequiv:
values->function = GDK_EQUIV;
break;
case GXorReverse:
values->function = GDK_OR_REVERSE;
break;
case GXcopyInverted:
values->function =GDK_COPY_INVERT;
break;
case GXorInverted:
values->function = GDK_OR_INVERT;
break;
case GXnand:
values->function = GDK_NAND;
break;
case GXset:
values->function = GDK_SET;
break;
}
switch (xvalues.fill_style)
@@ -505,42 +433,6 @@ gdk_gc_set_function (GdkGC *gc,
case GDK_XOR:
XSetFunction (private->xdisplay, private->xgc, GXxor);
break;
case GDK_CLEAR:
XSetFunction (private->xdisplay, private->xgc, GXclear);
break;
case GDK_AND:
XSetFunction (private->xdisplay, private->xgc, GXand);
break;
case GDK_AND_REVERSE:
XSetFunction (private->xdisplay, private->xgc, GXandReverse);
break;
case GDK_AND_INVERT:
XSetFunction (private->xdisplay, private->xgc, GXandInverted);
break;
case GDK_NOOP:
XSetFunction (private->xdisplay, private->xgc, GXnoop);
break;
case GDK_OR:
XSetFunction (private->xdisplay, private->xgc, GXor);
break;
case GDK_EQUIV:
XSetFunction (private->xdisplay, private->xgc, GXequiv);
break;
case GDK_OR_REVERSE:
XSetFunction (private->xdisplay, private->xgc, GXorReverse);
break;
case GDK_COPY_INVERT:
XSetFunction (private->xdisplay, private->xgc, GXcopyInverted);
break;
case GDK_OR_INVERT:
XSetFunction (private->xdisplay, private->xgc, GXorInverted);
break;
case GDK_NAND:
XSetFunction (private->xdisplay, private->xgc, GXnand);
break;
case GDK_SET:
XSetFunction (private->xdisplay, private->xgc, GXset);
break;
}
}
@@ -676,7 +568,7 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
{
GdkGCPrivate *private;
XRectangle xrectangle;
g_return_if_fail (gc != NULL);
private = (GdkGCPrivate*) gc;
@@ -810,22 +702,6 @@ gdk_gc_set_line_attributes (GdkGC *gc,
xline_style, xcap_style, xjoin_style);
}
void
gdk_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gchar dash_list[],
gint n)
{
GdkGCPrivate *private;
g_return_if_fail (gc != NULL);
g_return_if_fail (dash_list != NULL);
private = (GdkGCPrivate*) gc;
XSetDashes (private->xdisplay, private->xgc, dash_offset, dash_list, n);
}
void
gdk_gc_copy (GdkGC *dst_gc, GdkGC *src_gc)
{

View File

@@ -20,7 +20,6 @@
#include <X11/Xlib.h>
#include "gdktypes.h"
#include "gdkprivate.h"
#include "../config.h"
guint gdk_debug_flags = 0;
gint gdk_use_xshm = TRUE;
@@ -29,7 +28,7 @@ Display *gdk_display = NULL;
gint gdk_screen;
Window gdk_root_window;
Window gdk_leader_window;
GdkWindowPrivate gdk_root_parent = { { NULL, }, NULL, };
GdkWindowPrivate gdk_root_parent;
Atom gdk_wm_delete_window;
Atom gdk_wm_take_focus;
Atom gdk_wm_protocols;
@@ -48,18 +47,9 @@ GdkDndGlobals gdk_dnd = {None,None,None,
{0,0},
{0,0}, {0,0},
{0,0,0,0}, NULL, None, 0};
gchar *gdk_progname = NULL;
gchar *gdk_progclass = NULL;
gint gdk_error_code;
gint gdk_error_warnings = TRUE;
gint gdk_null_window_warnings = TRUE;
GList *gdk_default_filters = NULL;
gboolean gdk_using_threads = FALSE;
/* Used to signal the mainloop thread from its select() */
#ifdef USE_PTHREADS
gint gdk_threads_pipe[2];
gboolean gdk_select_waiting = FALSE;
#endif

View File

@@ -146,11 +146,11 @@ extern int _g_mbtowc (wchar_t *wstr, const char *str, size_t len);
#endif /* X_LOCALE */
#if !defined(G_HAVE_BROKEN_WCTYPE) && (defined(G_HAVE_WCTYPE_H) || defined(G_HAVE_WCHAR_H)) && !defined(X_LOCALE)
# ifdef G_HAVE_WCTYPE_H
#if !defined(HAVE_BROKEN_WCTYPE) && (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H)) && !defined(X_LOCALE)
# ifdef HAVE_WCTYPE_H
# include <wctype.h>
# else
# ifdef G_HAVE_WCHAR_H
# ifdef HAVE_WCHAR_H
# include <wchar.h>
# endif
# endif

View File

@@ -18,7 +18,6 @@
*/
#include "../config.h"
#include <stdlib.h>
#include <sys/types.h>
#if defined (HAVE_IPC_H) && defined (HAVE_SHM_H) && defined (HAVE_XSHM_H)
@@ -280,10 +279,7 @@ gdk_image_new (GdkImageType type,
private->ximage = XCreateImage (private->xdisplay, xvisual, visual->depth,
ZPixmap, 0, 0, width, height, 32, 0);
/* Use malloc, not g_malloc here, because X will call free()
* on this data
*/
private->ximage->data = malloc (private->ximage->bytes_per_line *
private->ximage->data = g_new (char, private->ximage->bytes_per_line *
private->ximage->height);
break;
@@ -353,8 +349,7 @@ gdk_image_get (GdkWindow *window,
image->mem = private->ximage->data;
image->bpl = private->ximage->bytes_per_line;
image->bpp = private->ximage->bits_per_pixel;
image->byte_order = private->ximage->byte_order;
image->bpp = 1;
return image;
}
@@ -410,8 +405,6 @@ gdk_image_destroy (GdkImage *image)
case GDK_IMAGE_SHARED:
#ifdef USE_SHM
gdk_flush();
XShmDetach (private->xdisplay, private->x_shm_info);
XDestroyImage (private->ximage);

View File

@@ -147,7 +147,7 @@ gdk_input_motion_events (GdkWindow *window,
coords[i].ytilt = 0.0;
}
XFree (xcoords);
XFree(xcoords);
return coords;
}

View File

@@ -186,7 +186,7 @@ gdk_input_device_new(XDeviceInfo *device, gint include_core)
if ((xki->min_keycode == 8) && (xki->max_keycode == 32))
{
gdkdev->info.num_keys = 32;
gdkdev->min_keycode = 1;
gdkdev->min_keycode = 0;
}
else
{

View File

@@ -591,35 +591,23 @@ gdk_input_gxi_grab_pointer (GdkWindow * window,
GdkWindow * confine_to,
guint32 time)
{
GdkInputWindow *input_window, *new_window;
GList *tmp_list;
GdkInputWindow *input_window;
GdkDevicePrivate *gdkdev;
tmp_list = gdk_input_windows;
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
if (input_window->grabbed)
return AlreadyGrabbed;
if (input_window->window == window)
input_window->grabbed = TRUE;
else if (input_window->grabbed)
input_window->grabbed = FALSE;
tmp_list = tmp_list->next;
}
tmp_list = gdk_input_devices;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
gdkdev->xdevice &&
(gdkdev->button_state != 0))
gdkdev->button_state = 0;
new_window = input_window;
tmp_list = tmp_list->next;
}
new_window->grabbed = TRUE;
return Success;
}

View File

@@ -173,7 +173,7 @@ gdk_input_xfree_configure_event (XConfigureEvent *xevent, GdkWindow *window)
static void
gdk_input_xfree_enter_event (XCrossingEvent *xevent,
GdkWindow *window)
GdkWindow *window)
{
GdkInputWindow *input_window;
gint root_x, root_y;
@@ -257,7 +257,6 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
guint32 time)
{
GdkInputWindow *input_window, *new_window;
gboolean need_ungrab;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
@@ -266,70 +265,47 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
tmp_list = gdk_input_windows;
new_window = NULL;
need_ungrab = FALSE;
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
if (input_window->grabbed)
return AlreadyGrabbed;
if (input_window->window == window)
new_window = input_window;
else if (input_window->grabbed)
{
input_window->grabbed = FALSE;
need_ungrab = TRUE;
}
tmp_list = tmp_list->next;
}
g_return_val_if_fail (new_window != NULL, Success); /* shouldn't happen */
new_window->grabbed = TRUE;
if (new_window)
tmp_list = gdk_input_devices;
while (tmp_list)
{
new_window->grabbed = TRUE;
tmp_list = gdk_input_devices;
while (tmp_list)
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
gdkdev->xdevice)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
gdkdev->xdevice)
{
gdk_input_common_find_events (window, gdkdev,
event_mask,
event_classes, &num_classes);
result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
GDK_WINDOW_XWINDOW (window),
owner_events, num_classes, event_classes,
GrabModeAsync, GrabModeAsync, time);
/* FIXME: if failure occurs on something other than the first
device, things will be badly inconsistent */
if (result != Success)
return result;
}
tmp_list = tmp_list->next;
}
}
else
{
tmp_list = gdk_input_devices;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice &&
((gdkdev->button_state != 0) || need_ungrab))
{
XUngrabDevice( gdk_display, gdkdev->xdevice, time);
gdkdev->button_state = 0;
}
tmp_list = tmp_list->next;
}
}
gdk_input_common_find_events (window, gdkdev,
event_mask,
event_classes, &num_classes);
result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
GDK_WINDOW_XWINDOW (window),
owner_events, num_classes, event_classes,
GrabModeAsync, GrabModeAsync, time);
/* FIXME: if failure occurs on something other than the first
device, things will be badly inconsistent */
if (result != Success)
return result;
}
tmp_list = tmp_list->next;
}
return Success;
}
static void

View File

@@ -1,3 +1,21 @@
/* GDK - The GIMP Drawing Kit
* 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.
*/
#define GDK_VoidSymbol 0xFFFFFF
#define GDK_BackSpace 0xFF08
#define GDK_Tab 0xFF09
@@ -10,9 +28,6 @@
#define GDK_Escape 0xFF1B
#define GDK_Delete 0xFFFF
#define GDK_Multi_key 0xFF20
#define GDK_SingleCandidate 0xFF3C
#define GDK_MultipleCandidate 0xFF3D
#define GDK_PreviousCandidate 0xFF3E
#define GDK_Kanji 0xFF21
#define GDK_Muhenkan 0xFF22
#define GDK_Henkan_Mode 0xFF23
@@ -30,8 +45,6 @@
#define GDK_Kana_Shift 0xFF2E
#define GDK_Eisu_Shift 0xFF2F
#define GDK_Eisu_toggle 0xFF30
#define GDK_Zen_Koho 0xFF3D
#define GDK_Mae_Koho 0xFF3E
#define GDK_Home 0xFF50
#define GDK_Left 0xFF51
#define GDK_Up 0xFF52
@@ -221,23 +234,11 @@
#define GDK_dead_iota 0xFE5D
#define GDK_dead_voiced_sound 0xFE5E
#define GDK_dead_semivoiced_sound 0xFE5F
#define GDK_dead_belowdot 0xFE60
#define GDK_First_Virtual_Screen 0xFED0
#define GDK_Prev_Virtual_Screen 0xFED1
#define GDK_Next_Virtual_Screen 0xFED2
#define GDK_Last_Virtual_Screen 0xFED4
#define GDK_Terminate_Server 0xFED5
#define GDK_AccessX_Enable 0xFE70
#define GDK_AccessX_Feedback_Enable 0xFE71
#define GDK_RepeatKeys_Enable 0xFE72
#define GDK_SlowKeys_Enable 0xFE73
#define GDK_BounceKeys_Enable 0xFE74
#define GDK_StickyKeys_Enable 0xFE75
#define GDK_MouseKeys_Enable 0xFE76
#define GDK_MouseKeys_Accel_Enable 0xFE77
#define GDK_Overlay1_Enable 0xFE78
#define GDK_Overlay2_Enable 0xFE79
#define GDK_AudibleBell_Enable 0xFE7A
#define GDK_Pointer_Left 0xFEE0
#define GDK_Pointer_Right 0xFEE1
#define GDK_Pointer_Up 0xFEE2
@@ -263,7 +264,6 @@
#define GDK_Pointer_Drag2 0xFEF6
#define GDK_Pointer_Drag3 0xFEF7
#define GDK_Pointer_Drag4 0xFEF8
#define GDK_Pointer_Drag5 0xFEFD
#define GDK_Pointer_EnableKeys 0xFEF9
#define GDK_Pointer_Accelerate 0xFEFA
#define GDK_Pointer_DfltBtnNext 0xFEFB

View File

@@ -34,13 +34,6 @@ typedef struct
gint transparent;
} _GdkPixmapColor;
typedef struct
{
guint ncolors;
GdkColormap *colormap;
gulong pixels[1];
} _GdkPixmapInfo;
GdkPixmap*
gdk_pixmap_new (GdkWindow *window,
gint width,
@@ -182,7 +175,7 @@ gdk_pixmap_create_from_data (GdkWindow *window,
return pixmap;
}
static gint
gint
gdk_pixmap_seek_string (FILE *infile,
const gchar *str,
gint skip_comments)
@@ -206,7 +199,7 @@ gdk_pixmap_seek_string (FILE *infile,
return FALSE;
}
static gint
gint
gdk_pixmap_seek_char (FILE *infile,
gchar c)
{
@@ -238,21 +231,18 @@ gdk_pixmap_seek_char (FILE *infile,
return FALSE;
}
static gint
gint
gdk_pixmap_read_string (FILE *infile,
gchar **buffer,
guint *buffer_size)
{
gint c;
guint cnt = 0, bufsiz, ret = FALSE;
gchar *buf;
guint cnt = 0;
buf = *buffer;
bufsiz = *buffer_size;
if (buf == NULL)
if ((*buffer) == NULL)
{
bufsiz = 10 * sizeof (gchar);
buf = g_new(gchar, bufsiz);
(*buffer_size) = 10 * sizeof (gchar);
(*buffer) = g_new(gchar, *buffer_size);
}
do
@@ -260,40 +250,34 @@ gdk_pixmap_read_string (FILE *infile,
while (c != EOF && c != '"');
if (c != '"')
goto out;
return FALSE;
while ((c = getc(infile)) != EOF)
{
if (cnt == bufsiz)
if (cnt == (*buffer_size))
{
guint new_size = bufsiz * 2;
if (new_size > bufsiz)
bufsiz = new_size;
guint new_size = (*buffer_size) * 2;
if (new_size > (*buffer_size))
*buffer_size = new_size;
else
goto out;
return FALSE;
buf = (gchar *) g_realloc (buf, bufsiz);
buf[bufsiz-1] = '\0';
(*buffer) = (gchar *) g_realloc ((*buffer), *buffer_size);
}
if (c != '"')
buf[cnt++] = c;
(*buffer)[cnt++] = c;
else
{
buf[cnt] = 0;
ret = TRUE;
break;
(*buffer)[cnt++] = 0;
return TRUE;
}
}
out:
buf[bufsiz-1] = '\0'; /* ensure null termination for errors */
*buffer = buf;
*buffer_size = bufsiz;
return ret;
return FALSE;
}
static gchar*
gchar*
gdk_pixmap_skip_whitespaces (gchar *buffer)
{
gint32 index = 0;
@@ -304,7 +288,7 @@ gdk_pixmap_skip_whitespaces (gchar *buffer)
return &buffer[index];
}
static gchar*
gchar*
gdk_pixmap_skip_string (gchar *buffer)
{
gint32 index = 0;
@@ -318,7 +302,7 @@ gdk_pixmap_skip_string (gchar *buffer)
/* Xlib crashed ince at a color name lengths around 125 */
#define MAX_COLOR_LEN 120
static gchar*
gchar*
gdk_pixmap_extract_color (gchar *buffer)
{
gint counter, numnames;
@@ -347,18 +331,7 @@ gdk_pixmap_extract_color (gchar *buffer)
return NULL;
else if (ptr[0] == '#')
{
counter = 1;
while (ptr[counter] != 0 &&
((ptr[counter] >= '0' && ptr[counter] <= '9') ||
(ptr[counter] >= 'a' && ptr[counter] <= 'f') ||
(ptr[counter] >= 'A' && ptr[counter] <= 'F')))
counter++;
retcol = g_new (gchar, counter+1);
strncpy (retcol, ptr, counter);
retcol[counter] = 0;
retcol = g_strdup (ptr);
return retcol;
}
@@ -383,8 +356,11 @@ gdk_pixmap_extract_color (gchar *buffer)
space -= 1;
strcat (color, " ");
}
strncat (color, temp, space);
space -= MIN (space, strlen (temp));
if (space > 0)
{
strncat (color, temp, space);
space -= MIN (space, strlen (temp));
}
ptr = gdk_pixmap_skip_string (ptr);
ptr = gdk_pixmap_skip_whitespaces (ptr);
numnames++;
@@ -395,272 +371,6 @@ gdk_pixmap_extract_color (gchar *buffer)
return retcol;
}
enum buffer_op
{
op_header,
op_cmap,
op_body
};
static void
gdk_xpm_destroy_notify (gpointer data)
{
_GdkPixmapInfo *info = (_GdkPixmapInfo *)data;
GdkColor color;
int i;
for (i=0; i<info->ncolors; i++)
{
color.pixel = info->pixels[i];
gdk_colormap_free_colors (info->colormap, &color, 1);
}
gdk_colormap_unref (info->colormap);
g_free (info);
}
static GdkPixmap *
_gdk_pixmap_create_from_xpm (GdkWindow *window,
GdkColormap *colormap,
GdkBitmap **mask,
GdkColor *transparent_color,
gchar * (*get_buf) (enum buffer_op op,
gpointer handle),
gpointer handle)
{
GdkPixmap *pixmap = NULL;
GdkImage *image = NULL;
GdkVisual *visual;
GdkGC *gc = NULL;
GdkColor tmp_color;
gint width, height, num_cols, cpp, n, ns, cnt, xcnt, ycnt, wbytes;
gchar *buffer, pixel_str[32];
gchar *name_buf;
_GdkPixmapColor *color = NULL, *fallbackcolor = NULL;
_GdkPixmapColor *colors = NULL;
gulong index;
GHashTable *color_hash = NULL;
_GdkPixmapInfo *color_info = NULL;
if ((window == NULL) && (colormap == NULL))
g_warning ("Creating pixmap from xpm with NULL window and colormap");
if (window == NULL)
window = (GdkWindow *)&gdk_root_parent;
if (colormap == NULL)
{
colormap = gdk_window_get_colormap (window);
visual = gdk_window_get_visual (window);
}
else
visual = ((GdkColormapPrivate *)colormap)->visual;
buffer = (*get_buf) (op_header, handle);
if (buffer == NULL)
return NULL;
sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
if (cpp >= 32)
{
g_warning ("Pixmap has more than 31 characters per color\n");
return NULL;
}
color_hash = g_hash_table_new (g_str_hash, g_str_equal);
if (transparent_color == NULL)
{
gdk_color_white (colormap, &tmp_color);
transparent_color = &tmp_color;
}
/* For pseudo-color and grayscale visuals, we have to remember
* the colors we allocated, so we can free them later.
*/
if ((visual->type == GDK_VISUAL_PSEUDO_COLOR) ||
(visual->type == GDK_VISUAL_GRAYSCALE))
{
color_info = g_malloc (sizeof (_GdkPixmapInfo) +
sizeof(gulong) * (num_cols - 1));
color_info->ncolors = num_cols;
color_info->colormap = colormap;
gdk_colormap_ref (colormap);
}
name_buf = g_new (gchar, num_cols * (cpp+1));
colors = g_new (_GdkPixmapColor, num_cols);
for (cnt = 0; cnt < num_cols; cnt++)
{
gchar *color_name;
buffer = (*get_buf) (op_cmap, handle);
if (buffer == NULL)
goto error;
color = &colors[cnt];
color->color_string = &name_buf [cnt * (cpp + 1)];
strncpy (color->color_string, buffer, cpp);
color->color_string[cpp] = 0;
buffer += strlen (color->color_string);
color->transparent = FALSE;
color_name = gdk_pixmap_extract_color (buffer);
if (color_name == NULL ||
gdk_color_parse (color_name, &color->color) == FALSE)
{
color->color = *transparent_color;
color->transparent = TRUE;
}
g_free (color_name);
/* FIXME: The remaining slowness appears to happen in this
function. */
gdk_color_alloc (colormap, &color->color);
if (color_info)
color_info->pixels[cnt] = color->color.pixel;
g_hash_table_insert (color_hash, color->color_string, color);
if (cnt == 0)
fallbackcolor = color;
}
index = 0;
image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
if (mask)
{
/* The pixmap mask is just a bits pattern.
* Color 0 is used for background and 1 for foreground.
* We don't care about the colormap, we just need 0 and 1.
*/
GdkColor mask_pattern;
*mask = gdk_pixmap_new (window, width, height, 1);
gc = gdk_gc_new (*mask);
mask_pattern.pixel = 0;
gdk_gc_set_foreground (gc, &mask_pattern);
gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
mask_pattern.pixel = 1;
gdk_gc_set_foreground (gc, &mask_pattern);
}
wbytes = width * cpp;
for (ycnt = 0; ycnt < height; ycnt++)
{
buffer = (*get_buf) (op_body, handle);
/* FIXME: this slows things down a little - it could be
* integrated into the strncpy below, perhaps. OTOH, strlen
* is fast.
*/
if ((buffer == NULL) || strlen (buffer) < wbytes)
continue;
for (n = 0, cnt = 0, xcnt = 0; n < wbytes; n += cpp, xcnt++)
{
strncpy (pixel_str, &buffer[n], cpp);
pixel_str[cpp] = 0;
ns = 0;
color = g_hash_table_lookup (color_hash, pixel_str);
if (!color) /* screwed up XPM file */
color = fallbackcolor;
gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
if (mask && color->transparent)
{
if (cnt < xcnt)
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
cnt = xcnt + 1;
}
}
if (mask && (cnt < xcnt))
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
}
error:
if (mask)
gdk_gc_destroy (gc);
if (image != NULL)
{
pixmap = gdk_pixmap_new (window, width, height, visual->depth);
if (color_info)
gdk_drawable_set_data (pixmap, "gdk-xpm", color_info,
gdk_xpm_destroy_notify);
gc = gdk_gc_new (pixmap);
gdk_gc_set_foreground (gc, transparent_color);
gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
gdk_gc_destroy (gc);
gdk_image_destroy (image);
}
else if (color_info)
gdk_xpm_destroy_notify (color_info);
if (color_hash != NULL)
g_hash_table_destroy (color_hash);
if (colors != NULL)
g_free (colors);
if (name_buf != NULL)
g_free (name_buf);
return pixmap;
}
struct file_handle
{
FILE *infile;
gchar *buffer;
guint buffer_size;
};
static gchar *
file_buffer (enum buffer_op op, gpointer handle)
{
struct file_handle *h = handle;
switch (op)
{
case op_header:
if (gdk_pixmap_seek_string (h->infile, "XPM", FALSE) != TRUE)
break;
if (gdk_pixmap_seek_char (h->infile,'{') != TRUE)
break;
/* Fall through to the next gdk_pixmap_seek_char. */
case op_cmap:
gdk_pixmap_seek_char (h->infile, '"');
fseek (h->infile, -1, SEEK_CUR);
/* Fall through to the gdk_pixmap_read_string. */
case op_body:
gdk_pixmap_read_string (h->infile, &h->buffer, &h->buffer_size);
return h->buffer;
}
return 0;
}
GdkPixmap*
gdk_pixmap_colormap_create_from_xpm (GdkWindow *window,
GdkColormap *colormap,
@@ -668,18 +378,174 @@ gdk_pixmap_colormap_create_from_xpm (GdkWindow *window,
GdkColor *transparent_color,
const gchar *filename)
{
struct file_handle h;
FILE *infile = NULL;
GdkPixmap *pixmap = NULL;
GdkImage *image = NULL;
GdkVisual *visual;
GdkGC *gc;
GdkColor tmp_color;
gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt;
gchar *buffer = NULL, pixel_str[32];
guint buffer_size = 0;
_GdkPixmapColor *colors = NULL, *color = NULL;
gulong index;
memset (&h, 0, sizeof (h));
h.infile = fopen (filename, "rb");
if (h.infile != NULL)
if ((window == NULL) && (colormap == NULL))
g_warning ("Creating pixmap from xpm with NULL window and colormap");
if (window == NULL)
window = (GdkWindow *)&gdk_root_parent;
if (colormap == NULL)
{
pixmap = _gdk_pixmap_create_from_xpm (window, colormap, mask,
transparent_color,
file_buffer, &h);
fclose (h.infile);
g_free (h.buffer);
colormap = gdk_window_get_colormap (window);
visual = gdk_window_get_visual (window);
}
else
visual = ((GdkColormapPrivate *)colormap)->visual;
infile = fopen (filename, "rb");
if (infile != NULL)
{
if (gdk_pixmap_seek_string (infile, "XPM", FALSE) == TRUE)
{
if (gdk_pixmap_seek_char (infile,'{') == TRUE)
{
gdk_pixmap_seek_char (infile, '"');
fseek (infile, -1, SEEK_CUR);
gdk_pixmap_read_string (infile, &buffer, &buffer_size);
sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
if (cpp >= 32)
{
g_warning ("Pixmap has more than 31 characters per color\n");
return NULL;
}
colors = g_new(_GdkPixmapColor, num_cols);
if (transparent_color == NULL)
{
gdk_color_white (colormap, &tmp_color);
transparent_color = &tmp_color;
}
for (cnt = 0; cnt < num_cols; cnt++)
{
gchar *color_name;
gdk_pixmap_seek_char (infile, '"');
fseek (infile, -1, SEEK_CUR);
gdk_pixmap_read_string (infile, &buffer, &buffer_size);
colors[cnt].color_string = g_new(gchar, cpp + 1);
for (n = 0; n < cpp; n++)
colors[cnt].color_string[n] = buffer[n];
colors[cnt].color_string[n] = 0;
colors[cnt].transparent = FALSE;
color_name = gdk_pixmap_extract_color (&buffer[cpp]);
if (color_name != NULL)
{
if (gdk_color_parse (color_name, &colors[cnt].color) == FALSE)
{
colors[cnt].color = *transparent_color;
colors[cnt].transparent = TRUE;
}
}
else
{
colors[cnt].color = *transparent_color;
colors[cnt].transparent = TRUE;
}
g_free (color_name);
gdk_color_alloc (colormap, &colors[cnt].color);
}
index = 0;
image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
gc = NULL;
if (mask)
{
/* The pixmap mask is just a bits pattern.
* Color 0 is used for background and 1 for foreground.
* We don't care about the colormap, we just need 0 and 1.
*/
GdkColor mask_pattern;
*mask = gdk_pixmap_new (window, width, height, 1);
gc = gdk_gc_new (*mask);
mask_pattern.pixel = 0;
gdk_gc_set_foreground (gc, &mask_pattern);
gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
mask_pattern.pixel = 1;
gdk_gc_set_foreground (gc, &mask_pattern);
}
for (ycnt = 0; ycnt < height; ycnt++)
{
gdk_pixmap_read_string (infile, &buffer, &buffer_size);
for (n = 0, cnt = 0, xcnt = 0; n < (width * cpp); n += cpp, xcnt++)
{
strncpy (pixel_str, &buffer[n], cpp);
pixel_str[cpp] = 0;
color = NULL;
ns = 0;
while ((color == NULL) && (ns < num_cols))
{
if (strcmp (pixel_str, colors[ns].color_string) == 0)
color = &colors[ns];
else
ns++;
}
if (!color) /* screwed up XPM file */
color = &colors[0];
gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
if (mask && color->transparent)
{
if (cnt < xcnt)
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
cnt = xcnt + 1;
}
}
if (mask && (cnt < xcnt))
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
}
if (mask)
gdk_gc_destroy (gc);
pixmap = gdk_pixmap_new (window, width, height, visual->depth);
gc = gdk_gc_new (pixmap);
gdk_gc_set_foreground (gc, transparent_color);
gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
gdk_gc_destroy (gc);
gdk_image_destroy (image);
}
}
fclose (infile);
free (buffer);
if (colors != NULL)
{
for (cnt = 0; cnt < num_cols; cnt++)
g_free (colors[cnt].color_string);
g_free (colors);
}
}
return pixmap;
@@ -691,34 +557,11 @@ gdk_pixmap_create_from_xpm (GdkWindow *window,
GdkColor *transparent_color,
const gchar *filename)
{
return gdk_pixmap_colormap_create_from_xpm (window, NULL, mask,
return gdk_pixmap_colormap_create_from_xpm (window, NULL, mask,
transparent_color, filename);
}
struct mem_handle
{
gchar **data;
int offset;
};
static gchar *
mem_buffer (enum buffer_op op, gpointer handle)
{
struct mem_handle *h = handle;
switch (op)
{
case op_header:
case op_cmap:
case op_body:
if (h->data[h->offset])
return h->data[h->offset ++];
}
return 0;
}
GdkPixmap*
gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
GdkColormap *colormap,
@@ -726,18 +569,160 @@ gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
GdkColor *transparent_color,
gchar **data)
{
struct mem_handle h;
GdkPixmap *pixmap = NULL;
GdkImage *image = NULL;
GdkVisual *visual;
GdkGC *gc;
GdkColor tmp_color;
gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt, i;
gchar *buffer, pixel_str[32];
_GdkPixmapColor *colors = NULL, *color = NULL;
gulong index;
if ((window == NULL) && (colormap == NULL))
g_warning ("Creating pixmap from xpm with NULL window and colormap");
if (window == NULL)
window = (GdkWindow *)&gdk_root_parent;
if (colormap == NULL)
{
colormap = gdk_window_get_colormap (window);
visual = gdk_window_get_visual (window);
}
else
visual = ((GdkColormapPrivate *)colormap)->visual;
i = 0;
buffer = data[i++];
sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
if (cpp >= 32)
{
g_warning ("Pixmap has more than 31 characters per color\n");
return NULL;
}
colors = g_new(_GdkPixmapColor, num_cols);
if (transparent_color == NULL)
{
gdk_color_white (colormap, &tmp_color);
transparent_color = &tmp_color;
}
for (cnt = 0; cnt < num_cols; cnt++)
{
gchar *color_name;
buffer = data[i++];
colors[cnt].color_string = g_new(gchar, cpp + 1);
for (n = 0; n < cpp; n++)
colors[cnt].color_string[n] = buffer[n];
colors[cnt].color_string[n] = 0;
colors[cnt].transparent = FALSE;
color_name = gdk_pixmap_extract_color (&buffer[cpp]);
if (color_name != NULL)
{
if (gdk_color_parse (color_name, &colors[cnt].color) == FALSE)
{
colors[cnt].color = *transparent_color;
colors[cnt].transparent = TRUE;
}
}
else
{
colors[cnt].color = *transparent_color;
colors[cnt].transparent = TRUE;
}
g_free (color_name);
gdk_color_alloc (colormap, &colors[cnt].color);
}
index = 0;
image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
gc = NULL;
if (mask)
{
/* The pixmap mask is just a bits pattern.
* Color 0 is used for background and 1 for foreground.
* We don't care about the colormap, we just need 0 and 1.
*/
GdkColor mask_pattern;
*mask = gdk_pixmap_new (window, width, height, 1);
gc = gdk_gc_new (*mask);
mask_pattern.pixel = 0;
gdk_gc_set_foreground (gc, &mask_pattern);
gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
mask_pattern.pixel = 1;
gdk_gc_set_foreground (gc, &mask_pattern);
}
for (ycnt = 0; ycnt < height; ycnt++)
{
buffer = data[i++];
for (n = 0, cnt = 0, xcnt = 0; n < (width * cpp); n += cpp, xcnt++)
{
strncpy (pixel_str, &buffer[n], cpp);
pixel_str[cpp] = 0;
color = NULL;
ns = 0;
while ((color == NULL) && (ns < num_cols))
{
if (strcmp (pixel_str, colors[ns].color_string) == 0)
color = &colors[ns];
else
ns++;
}
if (!color) /* screwed up XPM file */
color = &colors[0];
gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
if (mask && color->transparent)
{
if (cnt < xcnt)
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
cnt = xcnt + 1;
}
}
if (mask && (cnt < xcnt))
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
}
if (mask)
gdk_gc_destroy (gc);
pixmap = gdk_pixmap_new (window, width, height, visual->depth);
gc = gdk_gc_new (pixmap);
gdk_gc_set_foreground (gc, transparent_color);
gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
gdk_gc_destroy (gc);
gdk_image_destroy (image);
if (colors != NULL)
{
for (cnt = 0; cnt < num_cols; cnt++)
g_free (colors[cnt].color_string);
g_free (colors);
}
memset (&h, 0, sizeof (h));
h.data = data;
pixmap = _gdk_pixmap_create_from_xpm (window, colormap, mask,
transparent_color,
mem_buffer, &h);
return pixmap;
}
GdkPixmap*
gdk_pixmap_create_from_xpm_d (GdkWindow *window,
GdkBitmap **mask,
@@ -769,7 +754,6 @@ gdk_pixmap_unref (GdkPixmap *pixmap)
{
XFreePixmap (private->xdisplay, private->xwindow);
gdk_xid_table_remove (private->xwindow);
g_dataset_destroy (private);
g_free (private);
}
}

View File

@@ -24,6 +24,8 @@
#include <X11/Xutil.h>
#include <gdk/gdktypes.h>
#define DND_PROTOCOL_VERSION 0
#define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
#define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
#define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup (xid))
@@ -39,12 +41,10 @@ typedef struct _GdkWindowPrivate GdkPixmapPrivate;
typedef struct _GdkImagePrivate GdkImagePrivate;
typedef struct _GdkGCPrivate GdkGCPrivate;
typedef struct _GdkColormapPrivate GdkColormapPrivate;
typedef struct _GdkColorInfo GdkColorInfo;
typedef struct _GdkVisualPrivate GdkVisualPrivate;
typedef struct _GdkFontPrivate GdkFontPrivate;
typedef struct _GdkCursorPrivate GdkCursorPrivate;
typedef struct _GdkEventFilter GdkEventFilter;
typedef struct _GdkClientFilter GdkClientFilter;
typedef struct _GdkColorContextPrivate GdkColorContextPrivate;
typedef struct _GdkRegionPrivate GdkRegionPrivate;
@@ -63,6 +63,20 @@ struct _GdkWindowPrivate
guint8 window_type;
guint ref_count;
guint destroyed : 2;
guint dnd_drag_enabled : 1,
dnd_drag_datashow : 1,
dnd_drag_destructive_op : 1,
dnd_drag_accepted : 1,
dnd_drop_enabled : 1,
dnd_drop_destructive_op : 1;
GdkAtom dnd_drag_data_type, *dnd_drag_data_typesavail;
guint dnd_drag_data_numtypesavail;
/* We have to turn on MotionMask/EnterWindowMask/LeaveWindowMask
during drags, then set it back to what it was after */
glong dnd_drag_savedeventmask, dnd_drag_eventmask;
GdkAtom *dnd_drop_data_typesavail;
guint dnd_drop_data_numtypesavail;
/* need to allow custom drag/drop cursors */
gint extension_events;
@@ -97,16 +111,6 @@ struct _GdkGCPrivate
guint ref_count;
};
typedef enum {
GDK_COLOR_WRITEABLE = 1 << 0
} GdkColorInfoFlags;
struct _GdkColorInfo
{
GdkColorInfoFlags flags;
guint ref_count;
};
struct _GdkColormapPrivate
{
GdkColormap colormap;
@@ -114,11 +118,7 @@ struct _GdkColormapPrivate
Display *xdisplay;
GdkVisual *visual;
gint private_val;
GHashTable *hash;
GdkColorInfo *info;
time_t last_sync_time;
gint next_color;
guint ref_count;
};
@@ -178,12 +178,6 @@ struct _GdkEventFilter {
gpointer data;
};
struct _GdkClientFilter {
GdkAtom type;
GdkFilterFunc function;
gpointer data;
};
#ifdef USE_XIM
struct _GdkICPrivate
@@ -210,16 +204,15 @@ struct _GdkRegionPrivate
};
typedef enum {
GDK_DEBUG_MISC = 1 << 0,
GDK_DEBUG_EVENTS = 1 << 1,
GDK_DEBUG_DND = 1 << 2,
GDK_DEBUG_COLOR_CONTEXT = 1 << 3,
GDK_DEBUG_XIM = 1 << 4
GDK_DEBUG_MISC = 1<<0,
GDK_DEBUG_EVENTS = 1 << 1,
GDK_DEBUG_DND = 1<<2,
GDK_DEBUG_COLOR_CONTEXT = 1<<3,
GDK_DEBUG_XIM = 1<<4
} GdkDebugFlag;
void gdk_window_init (void);
void gdk_visual_init (void);
void gdk_dnd_init (void);
void gdk_image_init (void);
void gdk_image_exit (void);
@@ -269,18 +262,12 @@ extern Atom gdk_wm_window_protocols[];
extern Atom gdk_selection_property;
extern GdkDndGlobals gdk_dnd;
extern GdkWindow *selection_owner[];
extern gchar *gdk_progname;
extern gchar *gdk_progclass;
extern gint gdk_error_code;
extern gint gdk_error_warnings;
extern gint gdk_null_window_warnings;
extern GList *gdk_default_filters;
extern gboolean gdk_using_threads;
/* Threading stuff */
#ifdef USE_PTHREADS
extern gint gdk_threads_pipe[2];
extern gboolean gdk_select_waiting;
#endif
/* Debugging support */

View File

@@ -22,21 +22,12 @@
#include "gdk.h"
#include "gdkprivate.h"
GdkAtom
gdk_atom_intern (const gchar *atom_name,
gint only_if_exists)
{
GdkAtom retval;
static GHashTable *atom_hash = NULL;
if (!atom_hash)
atom_hash = g_hash_table_new (g_str_hash, g_str_equal);
retval = GPOINTER_TO_UINT (g_hash_table_lookup (atom_hash, atom_name));
if (!retval)
retval = XInternAtom (gdk_display, atom_name, only_if_exists);
return retval;
return XInternAtom (gdk_display, atom_name, only_if_exists);
}
gchar *
@@ -44,29 +35,23 @@ gdk_atom_name (GdkAtom atom)
{
gchar *t;
gchar *name;
gint old_error_warnings;
/* If this atom doesn't exist, we'll die with an X error unless
we take precautions */
old_error_warnings = gdk_error_warnings;
gdk_error_warnings = 0;
gdk_error_code = 0;
t = XGetAtomName (gdk_display, atom);
gdk_error_warnings = old_error_warnings;
gdk_error_warnings = 1;
if (gdk_error_code == -1)
{
if (t)
XFree (t);
return NULL;
}
else
{
name = g_strdup (t);
if (t)
XFree (t);
XFree (t);
return name;
}
@@ -110,7 +95,6 @@ gdk_property_get (GdkWindow *window,
xwindow = gdk_root_window;
}
ret_data = NULL;
XGetWindowProperty (xdisplay, xwindow, property,
offset, (length + 3) / 4, pdelete,
type, &ret_prop_type, &ret_format,
@@ -126,10 +110,9 @@ gdk_property_get (GdkWindow *window,
if (actual_format_type)
*actual_format_type = ret_format;
if ((type != AnyPropertyType) && (ret_prop_type != type))
if (ret_prop_type != type)
{
gchar *rn, *pn;
XFree (ret_data);
rn = gdk_atom_name(ret_prop_type);
pn = gdk_atom_name(type);

View File

@@ -19,20 +19,6 @@
#include "gdk.h"
void
gdk_rectangle_union (GdkRectangle *src1,
GdkRectangle *src2,
GdkRectangle *dest)
{
dest->x = MIN (src1->x, src2->x);
dest->y = MIN (src1->y, src2->y);
dest->width =
MAX (src1->x + src1->width, src2->x + src2->width) - dest->x;
dest->height =
MAX (src1->y + src1->height, src2->y + src2->height) - dest->y;
}
gint
gdk_rectangle_intersect (GdkRectangle *src1,
GdkRectangle *src2,

View File

@@ -82,25 +82,6 @@ gdk_region_equal (GdkRegion *region1,
return XEqualRegion (private1->xregion, private2->xregion);
}
void
gdk_region_get_clipbox(GdkRegion *region,
GdkRectangle *rectangle)
{
GdkRegionPrivate *rp;
XRectangle r;
g_return_if_fail(region != NULL);
g_return_if_fail(rectangle != NULL);
rp = (GdkRegionPrivate *)region;
XClipBox(rp->xregion, &r);
rectangle->x = r.x;
rectangle->y = r.y;
rectangle->width = r.width;
rectangle->height = r.height;
}
gboolean
gdk_region_point_in (GdkRegion *region,
gint x,

File diff suppressed because it is too large Load Diff

View File

@@ -1,143 +0,0 @@
/* 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.
*/
#ifndef __GDK_RGB_H__
#define __GDK_RGB_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef struct _GdkRgbCmap GdkRgbCmap;
struct _GdkRgbCmap {
guint32 colors[256];
guchar lut[256]; /* for 8-bit modes */
};
void
gdk_rgb_init (void);
gulong
gdk_rgb_xpixel_from_rgb (guint32 rgb);
void
gdk_rgb_gc_set_foreground (GdkGC *gc, guint32 rgb);
void
gdk_rgb_gc_set_background (GdkGC *gc, guint32 rgb);
typedef enum
{
GDK_RGB_DITHER_NONE,
GDK_RGB_DITHER_NORMAL,
GDK_RGB_DITHER_MAX
} GdkRgbDither;
void
gdk_draw_rgb_image (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
guchar *rgb_buf,
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,
gint y,
gint width,
gint height,
GdkRgbDither dith,
guchar *buf,
gint rowstride);
void
gdk_draw_gray_image (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
guchar *buf,
gint rowstride);
GdkRgbCmap *
gdk_rgb_cmap_new (guint32 *colors, gint n_colors);
void
gdk_rgb_cmap_free (GdkRgbCmap *cmap);
void
gdk_draw_indexed_image (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
guchar *buf,
gint rowstride,
GdkRgbCmap *cmap);
/* Below are some functions which are primarily useful for debugging
and experimentation. */
gboolean
gdk_rgb_ditherable (void);
void
gdk_rgb_set_verbose (gboolean verbose);
/* experimental colormap stuff */
void
gdk_rgb_set_install (gboolean install);
void
gdk_rgb_set_min_colors (gint min_colors);
GdkColormap *
gdk_rgb_get_cmap (void);
GdkVisual *
gdk_rgb_get_visual (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GDK_RGB_H__ */

View File

@@ -109,7 +109,6 @@ gdk_selection_property_get (GdkWindow *requestor,
if (private->destroyed)
return 0;
t = NULL;
XGetWindowProperty (private->xdisplay, private->xwindow,
gdk_selection_property, 0, 0, False,
AnyPropertyType, &prop_type, &prop_format,
@@ -126,11 +125,7 @@ gdk_selection_property_get (GdkWindow *requestor,
return 0;
}
if (t)
{
t = NULL;
XFree (t);
}
XFree (t);
/* Add on an extra byte to handle null termination. X guarantees
that t will be 1 longer than nbytes and null terminated */
@@ -149,8 +144,7 @@ gdk_selection_property_get (GdkWindow *requestor,
{
*data = g_new (guchar, length);
memcpy (*data, t, length);
if (t)
XFree (t);
XFree (t);
return length-1;
}
else
@@ -211,8 +205,6 @@ gdk_text_property_to_text_list (GdkAtom encoding, gint format,
void
gdk_free_text_list (gchar **list)
{
g_return_if_fail (list != NULL);
XFreeStringList (list);
}

View File

@@ -1,68 +0,0 @@
/* GDK - The GIMP Drawing Kit
* 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.
*/
#include "../config.h"
#include "gdk.h"
#include "gdkprivate.h"
#ifdef USE_PTHREADS
#include <unistd.h>
#include <pthread.h>
pthread_mutex_t gdk_threads_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif /* USE_PTHREADS */
gboolean
gdk_threads_init (void)
{
#ifdef USE_PTHREADS
pipe (gdk_threads_pipe);
gdk_using_threads = TRUE;
return TRUE;
#else
return FALSE;
#endif
}
void
gdk_threads_enter (void)
{
#ifdef USE_PTHREADS
pthread_mutex_lock (&gdk_threads_mutex);
#endif
}
void
gdk_threads_leave (void)
{
#ifdef USE_PTHREADS
pthread_mutex_unlock (&gdk_threads_mutex);
#endif
}
void
gdk_threads_wake (void)
{
#ifdef USE_PTHREADS
if (gdk_select_waiting)
{
gdk_select_waiting = FALSE;
write (gdk_threads_pipe[1], "A", 1);
}
#endif
}

View File

@@ -60,7 +60,6 @@ typedef struct _GdkFont GdkFont;
typedef struct _GdkCursor GdkCursor;
typedef struct _GdkColorContextDither GdkColorContextDither;
typedef struct _GdkColorContext GdkColorContext;
typedef struct _GdkDragContext GdkDragContext;
typedef struct _GdkEventAny GdkEventAny;
typedef struct _GdkEventExpose GdkEventExpose;
@@ -75,12 +74,14 @@ typedef struct _GdkEventConfigure GdkEventConfigure;
typedef struct _GdkEventProperty GdkEventProperty;
typedef struct _GdkEventSelection GdkEventSelection;
typedef struct _GdkEventProximity GdkEventProximity;
typedef struct _GdkEventOther GdkEventOther;
typedef struct _GdkEventDragBegin GdkEventDragBegin;
typedef struct _GdkEventDragRequest GdkEventDragRequest;
typedef struct _GdkEventDropEnter GdkEventDropEnter;
typedef struct _GdkEventDropDataAvailable GdkEventDropDataAvailable;
typedef struct _GdkEventDropLeave GdkEventDropLeave;
typedef struct _GdkEventClient GdkEventClient;
typedef struct _GdkEventDND GdkEventDND;
typedef union _GdkEvent GdkEvent;
typedef struct _GdkDeviceKey GdkDeviceKey;
typedef struct _GdkDeviceInfo GdkDeviceInfo;
typedef struct _GdkTimeCoord GdkTimeCoord;
@@ -216,37 +217,12 @@ typedef enum
* Copy: Overwrites destination pixels with the source pixels.
* Invert: Inverts the destination pixels.
* Xor: Xor's the destination pixels with the source pixels.
* Clear: set pixels to 0
* And: source AND destination
* And Reverse: source AND (NOT destination)
* And Invert: (NOT source) AND destination
* Noop: destination
* Or: source OR destination
* Nor: (NOT source) AND (NOT destination)
* Equiv: (NOT source) XOR destination
* Xor Reverse: source OR (NOT destination)
* Copy Inverted: NOT source
* Xor Inverted: (NOT source) OR destination
* Nand: (NOT source) OR (NOT destination)
* Set: set pixels to 1
*/
typedef enum
{
GDK_COPY,
GDK_INVERT,
GDK_XOR,
GDK_CLEAR,
GDK_AND,
GDK_AND_REVERSE,
GDK_AND_INVERT,
GDK_NOOP,
GDK_OR,
GDK_EQUIV,
GDK_OR_REVERSE,
GDK_COPY_INVERT,
GDK_OR_INVERT,
GDK_NAND,
GDK_SET
GDK_XOR
} GdkFunction;
/* GC fill types.
@@ -379,15 +355,15 @@ typedef enum
GDK_SELECTION_NOTIFY = 19,
GDK_PROXIMITY_IN = 20,
GDK_PROXIMITY_OUT = 21,
GDK_DRAG_ENTER = 22,
GDK_DRAG_LEAVE = 23,
GDK_DRAG_MOTION = 24,
GDK_DRAG_STATUS = 25,
GDK_DROP_START = 26,
GDK_DROP_FINISHED = 27,
GDK_CLIENT_EVENT = 28,
GDK_VISIBILITY_NOTIFY = 29,
GDK_NO_EXPOSE = 30
GDK_DRAG_BEGIN = 22,
GDK_DRAG_REQUEST = 23,
GDK_DROP_ENTER = 24,
GDK_DROP_LEAVE = 25,
GDK_DROP_DATA_AVAIL = 26,
GDK_CLIENT_EVENT = 27,
GDK_VISIBILITY_NOTIFY = 28,
GDK_NO_EXPOSE = 29,
GDK_OTHER_EVENT = 9999 /* Deprecated, use filters instead */
} GdkEventType;
/* Event masks. (Used to select what types of events a window
@@ -414,8 +390,7 @@ typedef enum
GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
GDK_PROXIMITY_IN_MASK = 1 << 18,
GDK_PROXIMITY_OUT_MASK = 1 << 19,
GDK_SUBSTRUCTURE_MASK = 1 << 20,
GDK_ALL_EVENTS_MASK = 0x0FFFFF
GDK_ALL_EVENTS_MASK = 0x07FFFF
} GdkEventMask;
/* Types of enter/leave notifications.
@@ -436,18 +411,6 @@ typedef enum
GDK_NOTIFY_UNKNOWN = 5
} GdkNotifyType;
/* Enter/leave event modes.
* NotifyNormal
* NotifyGrab
* NotifyUngrab
*/
typedef enum
{
GDK_CROSSING_NORMAL,
GDK_CROSSING_GRAB,
GDK_CROSSING_UNGRAB
} GdkCrossingMode;
/* Types of modifiers.
*/
typedef enum
@@ -464,9 +427,7 @@ typedef enum
GDK_BUTTON2_MASK = 1 << 9,
GDK_BUTTON3_MASK = 1 << 10,
GDK_BUTTON4_MASK = 1 << 11,
GDK_BUTTON5_MASK = 1 << 12,
GDK_RELEASE_MASK = 1 << 13,
GDK_MODIFIER_MASK = 0x3fff
GDK_BUTTON5_MASK = 1 << 12
} GdkModifierType;
typedef enum
@@ -538,6 +499,24 @@ typedef enum
GDK_PROP_MODE_APPEND
} GdkPropMode;
/* These definitions are for version 1 of the OffiX D&D protocol,
taken from <OffiX/DragAndDropTypes.h> */
typedef enum
{
GDK_DNDTYPE_NOTDND = -1,
GDK_DNDTYPE_UNKNOWN = 0,
GDK_DNDTYPE_RAWDATA = 1,
GDK_DNDTYPE_FILE = 2,
GDK_DNDTYPE_FILES = 3,
GDK_DNDTYPE_TEXT = 4,
GDK_DNDTYPE_DIR = 5,
GDK_DNDTYPE_LINK = 6,
GDK_DNDTYPE_EXE = 7,
GDK_DNDTYPE_URL = 8,
GDK_DNDTYPE_MIME = 9,
GDK_DNDTYPE_END = 10
} GdkDndType;
/* Enums for XInput support */
typedef enum
@@ -597,20 +576,17 @@ typedef enum
GDK_EXTENSION_EVENTS_CURSOR
} GdkExtensionMode;
typedef enum /*< flags >*/
typedef enum
{
GDK_IM_PREEDIT_AREA = 0x0001,
GDK_IM_PREEDIT_CALLBACKS = 0x0002,
GDK_IM_PREEDIT_POSITION = 0x0004,
GDK_IM_PREEDIT_NOTHING = 0x0008,
GDK_IM_PREEDIT_NONE = 0x0010,
GDK_IM_PREEDIT_MASK = 0x001f,
GDK_IM_STATUS_AREA = 0x0100,
GDK_IM_STATUS_CALLBACKS = 0x0200,
GDK_IM_STATUS_NOTHING = 0x0400,
GDK_IM_STATUS_NONE = 0x0800,
GDK_IM_STATUS_MASK = 0x0f00
GdkIMPreeditArea = 0x0001L,
GdkIMPreeditCallbacks = 0x0002L,
GdkIMPreeditPosition = 0x0004L,
GdkIMPreeditNothing = 0x0008L,
GdkIMPreeditNone = 0x0010L,
GdkIMStatusArea = 0x0100L,
GdkIMStatusCallbacks = 0x0200L,
GdkIMStatusNothing = 0x0400L,
GdkIMStatusNone = 0x0800L
} GdkIMStyle;
/* The next two enumeration values current match the
@@ -639,6 +615,15 @@ typedef enum
GDK_FUNC_CLOSE = 1 << 5
} GdkWMFunction;
#define GdkIMPreeditMask \
( GdkIMPreeditArea | GdkIMPreeditCallbacks | \
GdkIMPreeditPosition | GdkIMPreeditNothing | \
GdkIMPreeditNone )
#define GdkIMStatusMask \
( GdkIMStatusArea | GdkIMStatusCallbacks | \
GdkIMStatusNothing | GdkIMStatusNone )
typedef void (*GdkInputFunction) (gpointer data,
gint source,
GdkInputCondition condition);
@@ -678,22 +663,6 @@ typedef enum
GDK_OVERLAP_RECTANGLE_PART
} GdkOverlapType;
typedef enum {
GDK_ACTION_DEFAULT = 1 << 0,
GDK_ACTION_COPY = 1 << 1,
GDK_ACTION_MOVE = 1 << 2,
GDK_ACTION_LINK = 1 << 3,
GDK_ACTION_PRIVATE = 1 << 4,
GDK_ACTION_ASK = 1 << 5
} GdkDragAction;
typedef enum {
GDK_DRAG_PROTO_MOTIF,
GDK_DRAG_PROTO_XDND,
GDK_DRAG_PROTO_ROOTWIN /* A root window with nobody claiming
* drags */
} GdkDragProtocol;
/* The color type.
* A color consists of red, green and blue values in the
* range 0-65535 and a pixel value. The pixel value is highly
@@ -935,25 +904,6 @@ struct _GdkTimeCoord
gdouble ytilt;
};
/* Structure that holds information about a drag in progress.
* this is used on both source and destination sides.
*/
struct _GdkDragContext {
GdkDragProtocol protocol;
gboolean is_source;
GdkWindow *source_window;
GdkWindow *dest_window;
GList *targets;
GdkDragAction actions;
GdkDragAction suggested_action;
GdkDragAction action;
guint32 start_time;
};
/* Event filtering */
typedef void GdkXEvent; /* Can be cast to XEvent */
@@ -1048,15 +998,7 @@ struct _GdkEventCrossing
GdkWindow *window;
gint8 send_event;
GdkWindow *subwindow;
guint32 time;
gdouble x;
gdouble y;
gdouble x_root;
gdouble y_root;
GdkCrossingMode mode;
GdkNotifyType detail;
gboolean focus;
guint state;
};
struct _GdkEventFocus
@@ -1112,6 +1054,100 @@ struct _GdkEventProximity
guint32 deviceid;
};
struct _GdkEventDragRequest
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
guint32 requestor;
union {
struct {
guint protocol_version:4;
guint sendreply:1;
guint willaccept:1;
guint delete_data:1; /* Do *not* delete if link is sent, only
if data is sent */
guint senddata:1;
guint reserved:22;
} flags;
glong allflags;
} u;
guint8 isdrop; /* This gdk event can be generated by a couple of
X events - this lets the app know whether the
drop really occurred or we just set the data */
GdkPoint drop_coords;
gchar *data_type;
guint32 timestamp;
};
struct _GdkEventDragBegin
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
union {
struct {
guint protocol_version:4;
guint reserved:28;
} flags;
glong allflags;
} u;
};
struct _GdkEventDropEnter
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
guint32 requestor;
union {
struct {
guint protocol_version:4;
guint sendreply:1;
guint extended_typelist:1;
guint reserved:26;
} flags;
glong allflags;
} u;
};
struct _GdkEventDropLeave
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
guint32 requestor;
union {
struct {
guint protocol_version:4;
guint reserved:28;
} flags;
glong allflags;
} u;
};
struct _GdkEventDropDataAvailable
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
guint32 requestor;
union {
struct {
guint protocol_version:4;
guint isdrop:1;
guint reserved:25;
} flags;
glong allflags;
} u;
gchar *data_type; /* MIME type */
gulong data_numbytes;
gpointer data;
guint32 timestamp;
GdkPoint coords;
};
struct _GdkEventClient
{
GdkEventType type;
@@ -1126,16 +1162,12 @@ struct _GdkEventClient
} data;
};
/* Event types for DND */
struct _GdkEventDND {
struct _GdkEventOther
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
GdkDragContext *context;
guint32 time;
gshort x_root, y_root;
GdkXEvent *xevent;
};
union _GdkEvent
@@ -1154,8 +1186,13 @@ union _GdkEvent
GdkEventProperty property;
GdkEventSelection selection;
GdkEventProximity proximity;
GdkEventDragBegin dragbegin;
GdkEventDragRequest dragrequest;
GdkEventDropEnter dropenter;
GdkEventDropLeave dropleave;
GdkEventDropDataAvailable dropdataavailable;
GdkEventClient client;
GdkEventDND dnd;
GdkEventOther other;
};
struct _GdkRegion

View File

@@ -20,7 +20,6 @@
#include <X11/Xutil.h>
#include "gdk.h"
#include "gdkprivate.h"
#include "gdkx.h"
static void gdk_visual_add (GdkVisual *visual);
@@ -36,7 +35,7 @@ static GdkVisualPrivate *system_visual;
static GdkVisualPrivate *visuals;
static gint nvisuals;
static gint available_depths[7];
static gint available_depths[4];
static gint navailable_depths;
static GdkVisualType available_types[6];
@@ -61,7 +60,7 @@ static GHashTable *visual_hash = NULL;
void
gdk_visual_init (void)
{
static gint possible_depths[7] = { 32, 24, 16, 15, 8, 4, 1 };
static gint possible_depths[6] = { 32, 24, 16, 15, 8, 1 };
static GdkVisualType possible_types[6] =
{
GDK_VISUAL_DIRECT_COLOR,
@@ -72,7 +71,7 @@ gdk_visual_init (void)
GDK_VISUAL_STATIC_GRAY
};
static gint npossible_depths = 7;
static gint npossible_depths = 6;
static gint npossible_types = 6;
XVisualInfo *visual_list;
@@ -164,8 +163,7 @@ gdk_visual_init (void)
}
}
if (visual_list)
XFree (visual_list);
XFree (visual_list);
for (i = 0; i < nvisuals; i++)
{
@@ -211,9 +209,9 @@ gdk_visual_init (void)
#ifdef G_ENABLE_DEBUG
if (gdk_debug_flags & GDK_DEBUG_MISC)
for (i = 0; i < nvisuals; i++)
g_message ("visual: %s: %d",
visual_names[visuals[i].visual.type],
visuals[i].visual.depth);
g_print ("Gdk: visual: %s: %d\n",
visual_names[visuals[i].visual.type],
visuals[i].visual.depth);
#endif /* G_ENABLE_DEBUG */
navailable_depths = 0;

File diff suppressed because it is too large Load Diff

View File

@@ -39,8 +39,6 @@
GdkVisual* gdkx_visual_get (VisualID xvisualid);
/* XXX: Do not use this function until it is fixed. An X Colormap
* is useless unless we also have the visual. */
GdkColormap* gdkx_colormap_get (Colormap xcolormap);
/* Utility function in gdk.c - not sure where it belongs, but it's
needed in more than one place, so make it public */

Some files were not shown because too many files have changed in this diff Show More