Window system dependant parts of gtk (sources), Win32 integration



I have been told earlier that it's best to keep a separate gdk source
directory for each supported windowing system (X11, Win32, who knows
what later). The core developers don't want to look at #ifdefs (and I
agree). My current gdk sources are (being changed to be) like that, no
X11 code in the gdk source files.

Now, as for the gtk directory, it already *mostly* don't need any
window system specific conditional compilation at all. Except for
these (in my current sources):
	- gtkfilesel has some chunks of #ifdef code
	- gtkfontsel also
	- gtkeditable, gtkselection, gtkentry: currently no ifdefs
	- gdkdnd: just one ifdef so it compiles, but it doesn't do anything

I now try to emulate the X11 selection stuff for CLIPBOARD in gdk (so
the gtk code wouldn't need to have ifdefs), sending pseudo selection
request and notify messages, to make the flow of control mimic the one
on X11. It doesn't work very well, and really is an awful hack.

As the Win32 clipboard API is much simpler than the ICCM selection
protocol (basically you can just call a function to store stuff on the
clipboard, and another to get stuff from there), it really would be
much simpler to call some gdk_clipboard_set and gdk_clipboard_get
functions. Probably I will do that, put all the ICCM specific stuff in
ifdefs.

Drag-and-drop too will be quite different I assume, haven't looked at
it yet.

Anyway, the main point of this message is: How strong is the aversion
to having ifdefs in the gtk files?  Should the windowing system
dependant parts of gtk sources be split off into a separate directory?
Or should I keep parallell copies of the handful of affected gtk
files, to be copied into the main gtk directory by Win32 developers
who want to compile?

When would be a good time to start thinking about integrating the
Win32 stuff in the main gtk+ sources? Basically it would mean a new
gdk-win32 directory and some portability changes (use G_DIR_SEPARATOR
where appropriate, check HAVE_UNISTD_H, use GLib functions instead of
doing things "by hand", etc) to gtk files Just a handful of gtk files
would need some conditional code as outlined above.

I haven't really looked at the newest additions gtklayout, gtkplug and
gtksocket yet, just quickly #ifdeffed out the X11 parts to get them to
compile.

(I haven't had the time to look at Owen's glib main loop stuff yet
either, sorry)



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