Re: GdkLibrary

Mark McLoughlin <mark skynet ie> writes:

> Hi Owen,
> On Wed, 19 Jun 2002, Owen Taylor wrote:
> >
> > I've been working on notification for new displays and
> > for the default display.
> >
> > To do this, it was easiest to have a global singleton
> > object with a ::display-opened signal a ::default-display
> > property; and the following functions:
> >
> > ===
> > GdkLibrary *gdk_library_get                 (void);
> > GdkDisplay *gdk_library_get_default_display (GdkLibrary *library);
> > void        gdk_library_set_default_display (GdkLibrary *library,
> > 					     GdkDisplay *display);
> > GSList     *gdk_library_list_displays       (GdkLibrary *library);
> > ===
> 	I just noticed the need for something like this. I would have
> thought something like
> GdkDisplay *gdk_library_lookup_display (const gchar *display_name);
> 	would have been nice, or that the lookup would be implicit in
> gdk_open_display. Or maybe it should be lookup_screen, since that's
> the lowest denominator of DISPLAY really ...

Hmm, such a function gets into the really sticky question of
"when are two server strings the same", which is, in general
pretty much impossible to answer without opening up a connection
to the display, setting a root window property on one server
and seeing if you get it on the other...

What would you imagine using this for?

I've very occasionally had reason to open multiple connections to
the same X server in one app, that might a problem with making
it implicit in gdk_open_display(). [it isn't currnently].

(Actually, GDK and Pango both will open a second connection
behind the apps back on occasion to create server-persistant
> 	While we're on it, it might be nice to have a utility function
> which takes a GdkScreen and munges the display name with the screen
> number. This is a pain to do by hand and both the panel and nautilus
> needs this for launching apps on different screens.

Hmmm, so what you want is:


I don't have much of an sense of what to call this function 
or how to implement it, but it does sound somewhat generally useful
if a multihead-aware program is wanting to launch non-multihead

Bugzilla it; a patch would help if you want it in 2.2.

> 	Another thing I noticed was that there is a
> gtk_plug_new_for_display, but no gtk_window_new_for_display. How
> come?

gtk_plug_new() has an argument that doesn't make sense without
a GdkDisplay:

  GtkWidget*      gtk_plug_new    (GdkNativeWindow  socket_id);
So, the multihead variant needed a GdkDisplay; for a GtkWindow
it's fine to first create the window, then set the display,
so we can avoid cluttering the API.

> 	Anyway, I managed to answer without addressing your questions -
> how helpful of me :-)

I never really _expect_ to get feedback on these type of questions;
it's more like a vague hope. It's can encouraging to know that
people are even reading the mails. :-)


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