After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 563876 - [Regression] GTK_MODULES env var is no longer relevant
[Regression] GTK_MODULES env var is no longer relevant
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: .General
2.14.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on: 564751
Blocks:
 
 
Reported: 2008-12-09 16:34 UTC by Andrés G. Aragoneses (IRC: knocte)
Modified: 2012-08-07 09:04 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24



Description Andrés G. Aragoneses (IRC: knocte) 2008-12-09 16:34:43 UTC
Please describe the problem:
As the documentation says here [1], the GTK modules to be launched should be specified in the GTK_MODULES environment variable. However, with an empty $GTK_MODULES, I can testify that some modules are loaded.

[1] http://library.gnome.org/devel/gtk/2.14/gtk-running.html

This bug is reproducible on Gnome 2.24.1 (gtk+ 2.14.4), but not on Gnome 2.22.1 (gtk+ 2.12.9).

Steps to reproduce:
1. open a gnome terminal
2. launch the command 'unset GTK_MODULES'
3. check that now the env var is empty with echo $GTK_MODULES
4. launch a gtk application
5. launch accerciser

Actual results:
The application is accessible.

Expected results:
The application should not appear in accerciser because the modules gail:atk-bridge were not present in GTK_MODULES env var.

Does this happen every time?
Yes.

Other information:
This seems to be a feature instead of a bug, but it's also a bug depending on the point of view. Indeed, it affected Firefox and the workaround for it has been committed in ORCA (see bug 555466).

However, this is a horrible solution because it's done on the client side (we cannot patch every a11y client to workaround this) and it won't work with applications which are affected by this and whose name is not fixed like Firefox.

It seems that this bug/feature was introduced at some point with either bug 539840 or 535827. If this is a valid change, at least we should update the doc page here [1]. And we should provide a valid workaround to prevent the loading of unwanted modules.

For the accessibility bridge we are developing in my team, we need to be able to launch gtk_init without loading any module, because we launch atk-bridge on our own (after gtk_init).
Comment 1 Behdad Esfahbod 2008-12-09 16:41:28 UTC
Doesn't make sense to me.  GTK+ has no other way to know about modules.
Comment 2 Andrés G. Aragoneses (IRC: knocte) 2008-12-09 16:45:32 UTC
Thanks your comment Behdad.

(In reply to comment #1)
> Doesn't make sense to me.  GTK+ has no other way to know about modules.

Please look at the reference bugs (features) I pointed out.


It seems we need a similar workaround as the one Firefox implemented here: https://bugzilla.mozilla.org/show_bug.cgi?id=460926 . However, I don't think this bug should be closed when implementing that in our side, because it's a workaround (and anyway we need the docs [1] to be corrected).
Comment 3 Owen Taylor 2008-12-09 19:05:33 UTC
Are you complaining that:

 A) The GTK_MODULES docs don't explain that they are *supplementary* to the GtkSettings value. (Sure, give us a patch)

 B) That GTK_MODULES is supplementary to the GtkSettings values. That's the way it works. NOTABUG.

 C) That there should be some way of overriding the GtkSettings value application-local *for testing purposes*. Legitimate RFE, though low priority.

But the fact that Firefox is using 

  GTK_MODULES *OR* g_object_set_property(gtk_settings_get_default(), ...)

to disable the accesibility modules loaded by the desktop is indicative of Systematic Problems That Are Not GTK+'s Fault.

And if you feel the need to extend that to other apps, that's also Not GTK+'s Fault.

Comment 4 Andrés G. Aragoneses (IRC: knocte) 2008-12-10 15:19:55 UTC
Let's then keep this bug open for (A) and (C). Thanks Owen.
Comment 5 Matthias Clasen 2008-12-10 17:16:26 UTC
Took care of A)

        * gtk/running.sgml: Improve GTK_MODULES docs.
Comment 6 Andrés G. Aragoneses (IRC: knocte) 2008-12-10 17:46:43 UTC
(In reply to comment #5)
> Took care of A)
> 
>         * gtk/running.sgml: Improve GTK_MODULES docs.
> 

Thanks, but why only in the branch?
Comment 7 Matthias Clasen 2008-12-10 17:57:14 UTC
because I was using the wrong tree...
Comment 8 Andrés G. Aragoneses (IRC: knocte) 2008-12-11 05:28:51 UTC
(In reply to comment #7)
> because I was using the wrong tree...

Ok thanks.


By the way, I'm trying to use GtkSettings to override the gtk-modules setting and I keep getting accessibility with a hello world gtk app, any idea why?

This is the code:

#include <stdio.h>
// for drop_gtk_modules_conf()
#include <gtk/gtk.h>



on_destroy (GtkWidget * widget, gpointer data)
{
  gtk_main_quit ();
}

int main (int argc, char *argv[])
{
	g_type_init ();
    if (!gtk_parse_args(&argc, &argv))
     return 1;

    // display_name is owned by gdk.
    const char *display_name = gdk_get_display_arg_name();
	
	GdkDisplay* display = NULL;

	display = gdk_display_open(display_name);
	if (!display) {
		g_warning ("Error: cannot open display: %s\n", display_name);
		return;
	}
	
	GtkSettings* settings =
	  gtk_settings_get_for_screen (gdk_display_get_default_screen (display));
	gchar* gtk_modules_setting = NULL;
	g_object_get(settings, "gtk-modules", &gtk_modules_setting, NULL);
	if (gtk_modules_setting != NULL) {
		g_object_set(settings, "gtk-modules", "", NULL);
		g_free (gtk_modules_setting);
	}
	
     GtkWidget *window;
     GtkWidget *label;

     gtk_init (&argc, &argv);

     /* create the main, top level, window */
     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

     /* give the window a 20px wide border */
     gtk_container_set_border_width (GTK_CONTAINER (window), 20);

     /* give it the title */
     gtk_window_set_title (GTK_WINDOW (window), "dio cane");

     /* open it a bit wider so that both the label and title show up */
     gtk_window_set_default_size (GTK_WINDOW (window), 200, 50);

     /* Connect the destroy event of the window with our on_destroy function
      * When the window is about to be destroyed we get a notificaiton and
      * stop the main GTK loop
      */
     g_signal_connect (G_OBJECT (window), "destroy",
                       G_CALLBACK (on_destroy), NULL);

     /* Create the "Hello, World" label  */
     label = gtk_label_new ("Hello, World");

     /* and insert it into the main window  */
     gtk_container_add (GTK_CONTAINER (window), label);

     /* make sure that everything, window and label, are visible */
     gtk_widget_show_all (window);

     /* start the main loop */
     gtk_main ();

	return 0;
}
Comment 9 Andrés G. Aragoneses (IRC: knocte) 2008-12-16 17:11:30 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > because I was using the wrong tree...
> 
> Ok thanks.
> 
> 
> By the way, I'm trying to use GtkSettings to override the gtk-modules setting
> and I keep getting accessibility with a hello world gtk app, any idea why?

Ok, this is indeed (C) and has been filed as 564751 (sorry if there was no need to create another bug), which we think is not low priority, as it's affecting Firefox as well (NOTE: the bug https://bugzilla.mozilla.org/show_bug.cgi?id=460926 has been REOPENED).
Comment 10 Andrés G. Aragoneses (IRC: knocte) 2012-08-07 09:04:22 UTC
As (A) was fixed, and (C) was reported as bug 564751, which has just been closed as OBSOLETE, I'm closing this bug too.