From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: Re: IBus and different GTK versions Date: Sun, 20 Sep 2015 20:25:54 +0200 Message-ID: <87bncx54nh.fsf@elephly.net> References: <87a8sqa7at.fsf@elephly.net> <87mvwq35c4.fsf@gmail.com> <87k2rt8kvp.fsf@elephly.net> <87twqv7as8.fsf@elephly.net> <87d1xd5828.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZdjJO-0003g7-Op for guix-devel@gnu.org; Sun, 20 Sep 2015 14:26:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZdjJJ-0003Bk-OC for guix-devel@gnu.org; Sun, 20 Sep 2015 14:26:06 -0400 Received: from sender163-mail.zoho.com ([74.201.84.163]:25945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZdjJJ-0003As-GL for guix-devel@gnu.org; Sun, 20 Sep 2015 14:26:01 -0400 In-reply-to: <87d1xd5828.fsf@elephly.net> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: =?utf-8?B?5a6L5paH5q2m?= Cc: guix-devel --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Ricardo Wurmus writes: > Ricardo Wurmus writes: > >> 宋文武 writes: >> >>>>> We can set 'GTK_EXE_PREFIX' to the '~/.guix-profile', and generate the >>>>> 'immodules.cache' files in a profile hook. It will work for both gtk2 >>>>> and gtk3 applications. >> >>>> Does this mean that GTK needs to be installed in the user’s profile for >>>> this to work? I thought ‘GTK_EXE_PREFIX’ would change the path of >>>> ‘$libdir’ for *all* of GTK’s libraries. It can only have one value, not >>>> a list of paths to look for libraries. >> >>> Yes, this require install GTK+ into user's profile. >>> Also, there is a 'GTK_DATA_PREFIX' in a same situation, which I think is >>> the only way to set the GTK+ 2 theme. >> >> Isn’t this a little too high a price to pay? One can only install one >> (major) version of GTK+ into a profile, so when we begin propagating the >> GTK inputs users will run into conflicts. >> >> I would really like to avoid propagating GTK+ (although it may be a bad >> idea to have software depend on different minor versions of GTK+). It >> would be very nice if only additional modules—such as explicitly >> installed themes and input method modules—would have to be installed to >> the profile. Those who do not need themes or input methods would not >> need to be bothered with this at all. > > I guess the question is: what would be the uglier fix? Do we prefer to > force users to have GTK+ installed in their profiles, or are we okay > with patching the GTK+ sources such that additional environment > variables would be respected, allowing users to specify different > module directories for version 2 and version 3? Looking at the GTK sources it occurred to me that there may be yet another way we could fix this. GTK3 no longer searches for modules in ~/.gtk-3.0 but GTK2 still looks in ~/.gtk-2.0 by default. Symlinking ‘~/.guix-profile/lib/gtk-2.0’ to ‘~/.gtk-2.0’ might be sufficient for GTK2 applications. For GTK3 we could use the attached (untested) patch, which makes GTK3 look for additional modules in the path specified by the optional environment variable “GTK3_PATH”. This way we could point “GTK3_PATH” at ‘~/.guix-profile/lib/gtk-3.0’, ensuring that only GTK3 applications load the GTK3 modules and GTK2 don’t crash. If we wanted symmetry we could patch GTK2 in a similar manner, making it respect a “GTK2_PATH” variable instead. What do you think? ~~ Ricardo --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=gtk3-respect-GTK3_PATH.patch This patch makes GTK+ look for additional modules in a list of directories specified by the environment variable "GTK3_PATH". This can be used instead of "GTK_PATH" to make GTK+ find modules that are incompatible with other major versions of GTK+. --- a/gtk/gtkmodules.c 2015-09-20 20:09:05.060590217 +0200 +++ b/gtk/gtkmodules.c 2015-09-20 20:10:33.423124833 +0200 @@ -52,6 +52,7 @@ get_module_path (void) { const gchar *module_path_env; + const gchar *module_gtk3_path_env; const gchar *exe_prefix; gchar *module_path; gchar *default_dir; @@ -61,6 +62,7 @@ return result; module_path_env = g_getenv ("GTK_PATH"); + module_gtk3_path_env = g_getenv ("GTK3_PATH"); exe_prefix = g_getenv ("GTK_EXE_PREFIX"); if (exe_prefix) @@ -68,7 +70,13 @@ else default_dir = g_build_filename (_gtk_get_libdir (), "gtk-3.0", NULL); - if (module_path_env) + if (module_gtk3_path_env && module_path_env) + module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S, + module_gtk3_path_env, module_path_env, default_dir, NULL); + else if (module_gtk3_path_env) + module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S, + module_gtk3_path_env, default_dir, NULL); + else if (module_path_env) module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S, module_path_env, default_dir, NULL); else --=-=-=--