GObject merged



Hi,

I've merged the convert-stuff-to-GObject branch. This means some 
stuff is probably broken, but the X11 port should still compile and
work as it did before.

An overview of how things have changed, for those working on GDK
ports:


GdkDrawable has become purely virtual; the base class implements
nothing whatsoever. 

There are two cross-platform subclasses of GdkDrawable, GdkWindow and
GdkPixmap. These work in the same way; they contain a pointer to a
platform-specific GdkDrawable subclass that implements the real
functionality. This is the "Impl" object. Note that the Impl object 
is not a subclass of GdkWindow/GdkPixmap; it's only a subclass of
GdkDrawable.

The X port uses GdkWindowImplX11 and GdkPixmapImplX11 to implement
these Impl objects. The X port has a GdkDrawableImplX11 base class to
share code between GdkWindowImplX11 and GdkPixmapImplX11, but this
base class is purely an implementation detail, and other ports don't
need to provide it.


GdkGC is also purely virtual now. A GDK port should provide a subclass
of GdkGC for use with its drawables.

gdk_gc_new() should actually be called gdk_drawable_create_gc(); it
returns a GC appropriate for the drawable you pass in. So your GDK
port's drawable subclasses should return your platform-specific GC
subclass.


GdkDragContext, GdkImage, and GdkColormap are implemented in
platform-specific code. To keep the object instance/class structs the
same size across all platforms, they contain a 'gpointer
windowing_data' where platform-specific data should be stored. User
code can thus legitimately subclass these objects.

For data types that have been converted to GObject, the GdkFooPrivate
struct has gone away. You use either the Impl object or the 'gpointer
windowing_data' to store what used to be contained in the Private
struct. (The exception is GdkGC, where you have a subclass you can
store the platform-specific data in.)


Typically, converting code to this new GObject stuff is a simple
matter of replacing all casts to GdkFooPrivate with a different
conversion, for example to the platform-specific subclass of GdkGC.


I just realized that GdkFont hasn't been converted to GObject yet, 
I was waiting on Pango. I'm not sure if it's worth converting, since
it's deprecated, but maybe we should.


Not relevant to ports, but maybe of interest: in GTK, GtkStyle is now
a GObject, and xthickness/ythickness are in the instance rather than
the class. This breaks themes rather badly, and probably some other
code (though the fix is a trivial s/klass->xthickness/xthickness/g for
the most part).


Anyway, that's the general overview. The ChangeLog has some more
specifics, and feel free to ask me questions.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]