Adding xsetting indirection to GtkRC parsing.



(This is about the open API bugs #55110, 55727)

We have a number of outstanding problems relating to the
way GtkRC files work:

 - There is no way to set a default theme for the system because
   anything in /etc/gtk/gtkrc will always be read, even if the user
   specifies a different theme.

 - There is no way to specify gtkrc settings on a per-display
   basis; if I have multiple displays running from the same
   home directory, they will get the same settings, even
   if they differ widely in resolution, visual capabilities,
   etc.

 - Once we have multi-head support, we will have no way of
   supporting different RC file settings on different screens
   in a single running application.

One possible solution to this problem would be reading RC data
directly from a property on the display; this approach, however,
suffers from:

 - RC files contain references to image files. Different 
   applications on a display may well not share the same
   filesystem.

 - There is no integration between this an the XSETTINGS mechanism
   we use for other per-screen configurable properties.

Instead, I want to do things a little differently:

 * Extend the 'global-setting = value' syntax we have currently
   to include a form for only setting the value if not already
   set - possible 'global-setting ?= value' (better suggestions
   for syntax based on existing practice appreciated.)

 * Add a global setting for the default theme 'gtk-theme'

 * Add a directive to search ~/.themes/ and /usr/share/themes/
   for '${gtk-theme}/gtk/gtkrc' and include that.
 
    include_theme
 
   Alternative is to actually allow variable substitutions for
   global settings when parsing gtkrc files and have, literally:

    include_theme ${gtk-theme}

A normal /etc/gtk/gtkrc would then look something like:

 gtk-theme ?= "redhat"
 include_theme

To handle switching themes by changing the XSETTING:

 *  when a change of the gtk-theme setting was notified, an idle 
    is queued to reread all RC files. However, if RC file
    is parsing is currently in progress, no idle would be
    queued.

To handle multi-head:

 * All globals in GtkRC would be moved into a per-screen
   structure. 

   The set of RC files are parsed once for each screen, with
   the global settings for that screen in effect during
   parsing.

I wouldn't consider this proposal the most elegant of schemes -
but I think it covers all the use cases quite well.

Comments, better ideas would be appreciated. If someone wants
to volunteer to work on it, that would also be appreciated;
it's not a huge project, but does require a fair bit
of comfort with GScanner and the workings of gtkrc.c.

If nobody volunteers, I'll probably get to it in a week or so.

Regards,
                                        Owen




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