Getting rid of GdkDisplayManager

I've basically finished going through most of the "boring bits" in the
GDK part of the multihead patch, and have gotten it down to a few
thousand lines of some structural issues I'm not entirely happy with.

The first one of these is GdkDisplayManager... I don't think this
object does much for us compared to the amount of API, code and
clumsiness that it introduces.

 * Calling methods on GdkDisplayManager is really clumsy:

   gdk_display_manager_open_display (gdk_get_display_manager (), "localhost:0");

   [ So, there are various convenience functions in the current diff
     that seem there mostly to get around this clumsiness, like
     gdk_get_default_display () ]

 * It introduces two extra object types, including one that has to
   be implemented by every backend.

 * There are no real benefits to having this object there in
   the current API... there are no signals on it, and it's a singleton
   with a infinite lifespan.

I can see some uses for a global singleton, mainly notification when
the set of open displays changes.

But if we had such an object, I wouldn't want to call it GdkDisplayManager;
it would be better off as GdkApplication. But in the absence of any 
practical use for such an object, I think we can just leave it out
for now.

The API I want to go with is something like:

 GdkDisplay *gdk_open_display        (const char *display_name);
 GSList     *gdk_list_displays       (void);
 void        gdk_set_default_display (GdkDisplay *display);
 GdkDisplay  gdk_get_default_display (void);

 void        gdk_parse_args          (gint       *argc,
                                      gchar      *argv);

gtk_init_check() would be defined as:

 gdk_parse_args (argc, argv);

 display = gdk_open_display (NULL);
 if (display)
     gdk_set_default_display (display);
     return TRUE;
   return FALSE;


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