+2004-08-20 Bill Haneman <bill.haneman@sun.com>
+
+ * registryd/registry-main.c:
+ (main): Set the reg_env to use AT_SPI_DISPLAY instead of
+ $DISPLAY.
+
+ * cspi/bonobo/cspi-bonobo.c:
+ (cspi_display_name): New convenience method, gets DISPLAY with
+ screen number stripped, if AT_SPI_DISPLAY isn't already set.
+ (cspi_init): Set the activation env value above before getting
+ the registry.
+
+ * atk-bridge/bridge.c:
+ (spi_display_name): Create the AT_SPI_DISPLAY activation
+ environment for an app, based on the DISPLAY environment with the
+ screen number stripped off.
+ (atk_bridge_init): Allow redirection of error messages to a log.
+ (spi_atk_bridge_get_registry): Call
+ bonobo_activation_set_activation_env_value for AT_SPI_DISPLAY.
+
+ Fixes for bugs #149962, #136986, #144086.
+
2004-08-16 Christian Rose <menthos@menthos.com>
* configure.in: Added "bs" to ALL_LINGUAS.
atk_bridge_init (gint *argc, gchar **argv[])
{
const char *debug_env_string = g_getenv ("AT_SPI_DEBUG");
+ gchar *fname;
if (atk_bridge_initialized)
{
}
atk_bridge_initialized = TRUE;
- if (debug_env_string)
- _dbg = (int) g_ascii_strtod (debug_env_string, NULL);
+ if (g_getenv ("ATK_BRIDGE_REDIRECT_LOG"))
+ {
+ fname = g_strconcat ("/tmp/", g_get_prgname (), ".at-spi-log");
+ freopen (fname, "w", stderr);
+ g_free (fname);
+ }
+
+ if (debug_env_string)
+ _dbg = (int) g_ascii_strtod (debug_env_string, NULL);
if (!bonobo_init (argc, argv ? *argv : NULL))
{
&ev);
}
+/*
+ * Returns a 'canonicalized' value for DISPLAY,
+ * with the screen number stripped off if present.
+ */
+static const gchar*
+spi_display_name (void)
+{
+ static const char *canonical_display_name = NULL;
+ if (!canonical_display_name)
+ {
+ const gchar *display_env = g_getenv ("AT_SPI_DISPLAY");
+ if (!display_env)
+ {
+ display_env = g_getenv ("DISPLAY");
+ if (!display_env || !display_env[0])
+ canonical_display_name = ":0";
+ else
+ {
+ canonical_display_name = g_strdup (display_env);
+ gchar *display_p = strrchr (canonical_display_name, ':');
+ gchar *screen_p = strrchr (canonical_display_name, '.');
+ if (screen_p && display_p && ((guint) screen_p > (guint) display_p))
+ {
+ *screen_p = '\0';
+ }
+ }
+ }
+ else
+ {
+ canonical_display_name = display_env;
+ }
+ }
+ return canonical_display_name;
+}
+
static Accessibility_Registry
spi_atk_bridge_get_registry (void)
{
CORBA_exception_init (&ev);
if (registry_died)
DBG (1, g_warning ("registry died! restarting..."));
+
+ bonobo_activation_set_activation_env_value ("AT_SPI_DISPLAY", spi_display_name ());
+
registry = bonobo_activation_activate_from_id (
"OAFIID:Accessibility_Registry:1.0", 0, NULL, &ev);
return ret;
}
+/*
+ * Returns a 'canonicalized' value for DISPLAY,
+ * with the screen number stripped off if present.
+ */
+static const gchar*
+cspi_display_name (void)
+{
+ static const char *canonical_display_name = NULL;
+ if (!canonical_display_name)
+ {
+ const gchar *display_env = g_getenv ("AT_SPI_DISPLAY");
+ if (!display_env)
+ {
+ display_env = g_getenv ("DISPLAY");
+ if (!display_env || !display_env[0])
+ canonical_display_name = ":0";
+ else
+ {
+ canonical_display_name = g_strdup (display_env);
+ gchar *display_p = strrchr (canonical_display_name, ':');
+ gchar *screen_p = strrchr (canonical_display_name, '.');
+ if (screen_p && display_p && ((guint) screen_p > (guint) display_p))
+ {
+ *screen_p = '\0';
+ }
+ }
+ }
+ else
+ {
+ canonical_display_name = display_env;
+ }
+ }
+ return canonical_display_name;
+}
+
CORBA_Object
cspi_init (void)
{
CORBA_exception_init (&ev);
+ bonobo_activation_set_activation_env_value ("AT_SPI_DISPLAY",
+ cspi_display_name ());
+
registry = bonobo_activation_activate_from_id (
obj_id, 0, NULL, &ev);
{
int ret;
char *obj_id, *display_name;
+ char *cp, *dp;
SpiRegistry *registry;
GSList *reg_env = NULL;
registry = spi_registry_new ();
- display_name = gdk_display_get_name (gdk_display_get_default ());
- reg_env = bonobo_activation_registration_env_set ( reg_env, "DISPLAY",
+ display_name = g_getenv ("AT_SPI_DISPLAY");
+ if (!display_name)
+ {
+ display_name = g_strdup (gdk_display_get_name (gdk_display_get_default ()));
+ cp = strrchr (display_name, '.');
+ dp = strrchr (display_name, ':');
+ if (cp && dp && ((guint) cp > (guint) dp)) *cp = '\0';
+ }
+
+ reg_env = bonobo_activation_registration_env_set ( reg_env, "AT_SPI_DISPLAY",
display_name);
ret = bonobo_activation_register_active_server (
obj_id,
g_print ("starting stress test...\n");
CORBA_exception_init (&ev);
-
+
registry = bonobo_activation_activate_from_id (
"OAFIID:Accessibility_Registry:1.0", 0, NULL, &ev);