Re: [gtk-list] Re: Gdk support for multiple Screens
- From: Paolo Molaro <lupus lettere unipd it>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Gdk support for multiple Screens
- Date: Sat, 27 Jun 1998 12:26:14 +0200
On Fri, Jun 26, 1998 at 04:59:08PM -0400, Owen Taylor wrote:
> Paolo Molaro <lupus@lettere.unipd.it> writes:
>
> Of course, the global context should be used for very little -
> basically just when creating new objects. In other circumstances, the
> display or context should be stored on a per-object basis.
Yes, the global context is used only for the APIs that don't
have any means to get the display or the context so:
gdk_font_load() and gdk_window_new(NULL,...) use the global
context, while gdk_window_new(my_window,...) does not.
> > With my patch you call gdk_init() for every new connection:
> > gdk_init returns a pointer to a GdkContext structure you can
> > use later with gdk_context_push().
>
> Hmmm, I'm not sure that this is the right appoach. gdk_init()
> initializes a lot of stuff which is global to all displays.
The gdk_init() function is changed to initialize global stuff
only once :-)
> I'd rather see:
>
> gdk_init(&argc, &argv);
> GdkContext *gdk_context_get_default();
> GdkContext *gdk_context_new (const gchar *display);
With that you loose the ability to handle gdk options on a per-display
basis: think of enabling/disabling xshm or any other per-display
option we may add later...
> > GTK would require few changes: the problem is to make this work
> > flawlessly with threads...
>
> There are three ways to deal with global data structures and
> threads:
>
> 1) Lock global data.
> 2) Avoid global data.
> 3) Make global data per-thread.
>
> 1) doesn't work here - the locking is in place, the problem
> is that the different threads shouldn't change what the
> other threads set.
>
> 2) Hard to do and maintain backwards compatibility.
>
> 3) I think this is probably the right approach here. This probably
> requires a call to gdk_threads_init_thread() for each
> new thread.
I was thinking mainly about APIs that are not multi-display savvy:
we'll have replacements for that anyway, so people using threads
should use those replacements. ie
gdk_context_load_font(GdkContext *, gchar*);
instead of
gdk_load_font();
lupus
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]