multi display support for gdk



Hi.
I started to patch gdk to allow multi display support.
This is a preliminary patch against a version of gtk+
I retrieved from CVS about a week ago, hope gdk didn't change
that much:-)
This patch doesn't address gtk problems (you need to change
gtkselection.c to compile gtk with the patched version of gdk)
and I only tested the simple program included in the
tarball (I will have more time in the next weeks, I hope).
This release is intended mainly for comments from gtk/gdk gurus,
don't expect it to run without problems (yes there are bugs).

This is needed mainly to support printing for gtk applications
using the X Print Extension (I've already written the support
for this in gdk that let's us use the normal gdk_draw_* functions
to a GdkPrintable).

Luckily many gdk objects mantain a pointer to a Display* variable,
so this is simpler than it may seem. However a lot of *constructor*
functions (gdk_window_new, gdk_font_load ...) rely on global variables
such as gdk_display.
In my implementation gdk_init can be called multiple times (with different
"--display host:num" arguments) and returns a GdkContext structure that
holds the per display global variables (gdk_display, gdk_root_window,
xid_ht, etc...).
There is a gdk_current_context global variable that is used by the
constructor functions to know the display connection and a GList
holding the different GdkContexts.
All the functions that check for pending events and such will be
changed to iterate on the GList of contexts.
If the programmer wants to create a window in a display different from the
current, she should call a function such as gdk_context_change(GdkContext*).
In this way existing applications would work fine (they don't have to care
about multi display support), but applications needing it have to take
care of things like that (maybe in gtk 2.0 we can provide 
gdk_window_new(context, parent,...) type functions...).

My target here is mainly to allow printing using the Xprt server,
so I haven't looked at gtk support, maybe the next thing to do will
be that:-), ie one can use gdk_* calls to a different display, but
the widgets use the same GdkContext.
Maybe we need a GtkContext also?

One tricky problem is the handling of events: how one is supposed
to handle events such as that generated by a print server?
Do we need event filters not bound to windows in gdk_event_translate?

Any comments?
Thanks!

lupus

PS The tarball is available on:
	ftp://ftp.lettere.unipd.it/pub/linux/gdk_multi-0.1.tar.gz



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