X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=cspi%2Fbonobo%2Fcspi-bonobo.c;h=0ab14a8c9fc642f1148f51036378080ae7fbed15;hb=5694c35edb56bb605fa38c906221bd1e1e1d65c0;hp=0d9405784242b7a284795b7d0ebe67da8045f41f;hpb=b209e0d34fc6a02b46a8e518e7c9caf8bcbbe4be;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/cspi/bonobo/cspi-bonobo.c b/cspi/bonobo/cspi-bonobo.c index 0d94057..0ab14a8 100644 --- a/cspi/bonobo/cspi-bonobo.c +++ b/cspi/bonobo/cspi-bonobo.c @@ -2,7 +2,9 @@ * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * - * Copyright 2001 Sun Microsystems Inc. + * Copyright 2001, 2002 Sun Microsystems Inc., + * Copyright 2001, 2002 Ximian, Inc. + * 2002 Ximian Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -27,19 +29,19 @@ CORBA_Object cspi_dup_ref (CORBA_Object object) { - return bonobo_object_dup_ref (object, NULL); + return bonobo_object_dup_ref (object, cspi_ev ()); } void cspi_release_unref (CORBA_Object object) { - bonobo_object_release_unref (object, NULL); + bonobo_object_release_unref (object, NULL); } SPIBoolean cspi_check_ev (const char *error_string) { - CORBA_Environment *ev = cspi_ev (); + CORBA_Environment *ev = cspi_peek_ev (); if (ev->_major != CORBA_NO_EXCEPTION) { @@ -47,8 +49,10 @@ cspi_check_ev (const char *error_string) err = bonobo_exception_get_text (ev); - fprintf (stderr, "Warning: AT-SPI error: %s: %s\n", - error_string, err); + if (!_cspi_exception_throw (ev, (char *) error_string)) { + fprintf (stderr, "Warning: AT-SPI error: %s: %s\n", + error_string, err); + } g_free (err); @@ -74,6 +78,42 @@ cspi_exception_get_text (void) 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 + { + gchar *display_p, *screen_p; + canonical_display_name = g_strdup (display_env); + display_p = strrchr (canonical_display_name, ':'); + 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) { @@ -90,6 +130,9 @@ 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);