source: trunk/third/gtk/docs/developers.txt @ 14482

Revision 14482, 2.5 KB checked in by ghudson, 25 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r14481, which included commits to RCS files with non-trunk default branches.
Line 
1Things to care about when using/programing for GTK+
2===================================================
3
4This file is meant to collect some frequently triggered failures when
5programming for/with Gtk, having the spirit of a developers FAQ.
6It is also the correct place to list up things that programmers should
7care about in general.
8
9In the hope that this text might be usefull to someone,
10
11        - Tim Janik <timj@gimp.org>
12          1998/02/11
13
14
15Automatic destruction of widgets on removal from parent
16-------------------------------------------------------
17
18This is a reference counting issue, you would want to refer
19to refcounting.txt on it.
20
21
22What are all the widget flags about?
23------------------------------------
24
25Refer to the file widget_system.txt which covers widget flags and the
26resulting invariants in a detailed way.
27
28
29GdkWindow pointers may be NULL in GdkEvents
30-------------------------------------------
31
32The notification nature of the signal mechanism might cause events to
33be emitted that have their GdkWindow pointer set to NULL.
34This is due to the fact that certain events need to be emitted after the
35real GdkWindow of a widget is not any longer pertinent.
36It's up to the signal handling function (application) to check for the
37window field of the event structure to be != NULL, if it is going to
38perform any operations through Gdk calls on it.
39Events that a likely to trigger a missing check for the window pointer
40currently are (and correspond to the trailing signals):
41
42GDK_SELECTION_CLEAR     GtkWidget::selection_clear_event
43GDK_FOCUS_CHANGE        GtkWidget::focus_in_event
44                        GtkWidget::focus_out_event
45
46Events that are asured to have a valid GdkEvent.any.window field are
47
48GDK_EXPOSE              GtkWidget::expose_event
49
50
51gtk_widget_ref() vs. gtk_object_ref()
52-------------------------------------
53
54The widget referencing functions gtk_widget_ref() and gtk_widget_unref()
55are currently just wrappers about the corresponding referencing functions
56for objects. Still you should use the widget referencing functions if you
57are sure the referenced object is of type GTK_WIDGET_TYPE.
58
59
60Writing Gdk functions
61---------------------
62
63When writing Gdk functions that operate on GdkWindow structures in any
64maeningfull sense, that is casting to a GdkWindowPrivate structure for
65access to fields other then GdkWindow.user_data, the programmer is
66recommended to check for the GdkWindowPrivate.destroyed field to be ==
67FALSE, especially if the GdkWindowPrivate.xwindow field is used.
68Silent abortion of the Gdk function is the correct behaviour if this
69condition isn't met.
Note: See TracBrowser for help on using the repository browser.