Blame docs/developers.txt

Packit 98cdb6
Things to care about when using/programing for GTK+
Packit 98cdb6
===================================================
Packit 98cdb6
Packit 98cdb6
This file is meant to collect some frequently triggered failures when
Packit 98cdb6
programming for/with Gtk, having the spirit of a developers FAQ.
Packit 98cdb6
It is also the correct place to list up things that programmers should
Packit 98cdb6
care about in general.
Packit 98cdb6
Packit 98cdb6
In the hope that this text might be useful to someone,
Packit 98cdb6
Packit 98cdb6
        - Tim Janik <timj@gimp.org>
Packit 98cdb6
          1998/02/11
Packit 98cdb6
Packit 98cdb6
Packit 98cdb6
Automatic destruction of widgets on removal from parent
Packit 98cdb6
-------------------------------------------------------
Packit 98cdb6
Packit 98cdb6
This is a reference counting issue, you would want to refer
Packit 98cdb6
to refcounting.txt on it.
Packit 98cdb6
Packit 98cdb6
Packit 98cdb6
What are all the widget flags about?
Packit 98cdb6
------------------------------------
Packit 98cdb6
Packit 98cdb6
Refer to the file widget_system.txt which covers widget flags and the
Packit 98cdb6
resulting invariants in a detailed way.
Packit 98cdb6
Packit 98cdb6
Packit 98cdb6
GdkWindow pointers may be NULL in GdkEvents
Packit 98cdb6
-------------------------------------------
Packit 98cdb6
Packit 98cdb6
The notification nature of the signal mechanism might cause events to
Packit 98cdb6
be emitted that have their GdkWindow pointer set to NULL.
Packit 98cdb6
This is due to the fact that certain events need to be emitted after the
Packit 98cdb6
real GdkWindow of a widget is not any longer pertinent.
Packit 98cdb6
It's up to the signal handling function (application) to check for the
Packit 98cdb6
window field of the event structure to be != NULL, if it is going to
Packit 98cdb6
perform any operations through Gdk calls on it.
Packit 98cdb6
Events that a likely to trigger a missing check for the window pointer
Packit 98cdb6
currently are (and correspond to the trailing signals):
Packit 98cdb6
Packit 98cdb6
GDK_SELECTION_CLEAR     GtkWidget::selection_clear_event
Packit 98cdb6
GDK_FOCUS_CHANGE        GtkWidget::focus_in_event
Packit 98cdb6
                        GtkWidget::focus_out_event
Packit 98cdb6
Packit 98cdb6
Events that are assured to have a valid GdkEvent.any.window field are
Packit 98cdb6
Packit 98cdb6
GDK_EXPOSE		GtkWidget::expose_event
Packit 98cdb6
Packit 98cdb6
Packit 98cdb6
Writing Gdk functions
Packit 98cdb6
---------------------
Packit 98cdb6
Packit 98cdb6
When writing Gdk functions that operate on GdkWindow structures in any
Packit 98cdb6
meaningful sense, that is casting to a GdkWindowPrivate structure for
Packit 98cdb6
access to fields other then GdkWindow.user_data, the programmer is
Packit 98cdb6
recommended to check for the GdkWindowPrivate.destroyed field to be ==
Packit 98cdb6
FALSE, especially if the GdkWindowPrivate.xwindow field is used.
Packit 98cdb6
Silent abortion of the Gdk function is the correct behaviour if this
Packit 98cdb6
condition isn't met.