2003-01-27 Padraig O'Briain <padraig.obriain@sun.com
authorpadraigo <padraigo@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Mon, 27 Jan 2003 14:00:28 +0000 (14:00 +0000)
committerpadraigo <padraigo@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Mon, 27 Jan 2003 14:00:28 +0000 (14:00 +0000)
* registryd/desktop.c: Implement AccessibleComponent for SpiDesktop.
This is done by implementing AtkComponent for SpiAtkDesktop, which is
the AtkObject within an SpiDesktop.
This addresses bug #101524.

* registryd/deviceeventcontroller.c (spi_device_event_controller_init):
Remove call to gdk_init().

* registryd/registry.c (spi_registry_init): Add call to gdk_init()
so that Display is set when SpiDesktop is created.

git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@397 e2bd861d-eb25-0410-b326-f6ed22b6b98c

ChangeLog
registryd/desktop.c
registryd/deviceeventcontroller.c
registryd/registry.c

index dd16439..d2b2ca4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2003-01-27  Padraig O'Briain <padraig.obriain@sun.com
+
+       * registryd/desktop.c: Implement AccessibleComponent for SpiDesktop.
+       This is done by implementing AtkComponent for SpiAtkDesktop, which is
+       the AtkObject within an SpiDesktop.
+       This addresses bug #101524.
+
+       * registryd/deviceeventcontroller.c (spi_device_event_controller_init):
+       Remove call to gdk_init().
+
+       * registryd/registry.c (spi_registry_init): Add call to gdk_init()
+       so that Display is set when SpiDesktop is created.
+
 2003-01-21  Padraig O'Briain <padraig.obriain@sun.com
 
        * registryd/deviceeventcontroller.c: Add include of <sys/time.h>
 2003-01-21  Padraig O'Briain <padraig.obriain@sun.com
 
        * registryd/deviceeventcontroller.c: Add include of <sys/time.h>
index fe52c70..4d278dc 100644 (file)
@@ -27,6 +27,9 @@
 #include <stdio.h>
 #include <libbonobo.h>
 #include "desktop.h"
 #include <stdio.h>
 #include <libbonobo.h>
 #include "desktop.h"
+#include <atk/atkcomponent.h>
+#include <gdk/gdkscreen.h>
+#include <gdk/gdkx.h>
 
 /* SpiDesktop signals */
 enum {
 
 /* SpiDesktop signals */
 enum {
@@ -48,15 +51,104 @@ typedef struct {
 /* A pointer to our parent object class */
 static SpiAccessibleClass *parent_class;
 
 /* A pointer to our parent object class */
 static SpiAccessibleClass *parent_class;
 
+#define SPI_TYPE_ATK_DESKTOP           (spi_atk_desktop_get_type ())
+#define SPI_ATK_DESKTOP(o)             (G_TYPE_CHECK_INSTANCE_CAST ((o), SPI_TYPE_ATK_DESKTOP, SpiAtkDesktop))
+#define SPI_IS_ATK_DESKTOP(o)          (G_TYPE_CHECK_INSTANCE_TYPE ((o), SPI_TYPE_ATK_DESKTOP))
+
+typedef struct {
+       AtkObject parent;
+
+       GdkScreen *screen;
+} SpiAtkDesktop;
+
+typedef struct {
+       AtkObjectClass parent;
+} SpiAtkDesktopClass;
+
+static void spi_atk_desktop_init (SpiAtkDesktop *desktop);
+static void atk_component_interface_init (AtkComponentIface *iface);
+static void spi_atk_desktop_get_extents         (AtkComponent    *component,
+                                          gint            *x,
+                                          gint            *y,
+                                          gint            *width,
+                                          gint            *height,
+                                          AtkCoordType    coord_type);
+
+static GType 
+spi_atk_desktop_get_type ()
+{
+  static GType type = 0;
+
+  if (!type)
+    {
+      static const GTypeInfo typeInfo =
+      {
+       sizeof (SpiAtkDesktopClass),
+       (GBaseInitFunc) NULL,
+       (GBaseFinalizeFunc) NULL,
+       (GClassInitFunc) NULL,
+       (GClassFinalizeFunc) NULL,
+       NULL,
+       sizeof (SpiAtkDesktop),
+       0,
+       (GInstanceInitFunc) spi_atk_desktop_init,
+      } ;
+      static const GInterfaceInfo atk_component_info =
+       {
+        (GInterfaceInitFunc) atk_component_interface_init,
+       (GInterfaceFinalizeFunc) NULL,
+       NULL
+      };
+
+      type = g_type_register_static (ATK_TYPE_OBJECT,
+                                     "SpiAtkDesktop", &typeInfo, 0);
+      g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
+                                   &atk_component_info);
+    }
+  return type;
+}
+
+static void 
+spi_atk_desktop_init (SpiAtkDesktop *desktop)
+{
+  GdkDisplay *display;
+
+  atk_object_set_name (ATK_OBJECT (desktop), "main");
+  display = gdk_x11_lookup_xdisplay (GDK_DISPLAY ());
+  desktop->screen = gdk_display_get_default_screen (display);
+}
+
 static void
 static void
-spi_desktop_init (SpiDesktop *desktop)
+atk_component_interface_init (AtkComponentIface *iface)
 {
 {
-  spi_base_construct (SPI_BASE (desktop), g_object_new (ATK_TYPE_OBJECT, NULL));
+  g_return_if_fail (iface != NULL);
 
 
+  iface->get_extents = spi_atk_desktop_get_extents;
+}
+
+static void 
+spi_atk_desktop_get_extents (AtkComponent *component,
+                             gint         *x,
+                             gint        *y,
+                             gint        *width,
+                             gint        *height,
+                             AtkCoordType coord_type)
+{
+  SpiAtkDesktop *desktop;
+
+  g_return_if_fail (SPI_IS_ATK_DESKTOP (component));
+  desktop = SPI_ATK_DESKTOP (component);
+  *x = 0;
+  *y = 0;
+  *width = gdk_screen_get_width (desktop->screen);
+  *height = gdk_screen_get_height (desktop->screen);
+}
+
+static void
+spi_desktop_init (SpiDesktop *desktop)
+{
   desktop->applications = NULL;
   bonobo_object_set_immortal (BONOBO_OBJECT (desktop), TRUE);
   desktop->applications = NULL;
   bonobo_object_set_immortal (BONOBO_OBJECT (desktop), TRUE);
-
-  atk_object_set_name (ATK_OBJECT (SPI_BASE (desktop)->gobj), "main");
 }
 
 static void
 }
 
 static void
@@ -158,9 +250,14 @@ BONOBO_TYPE_FUNC_FULL (SpiDesktop,
 SpiDesktop *
 spi_desktop_new (void)
 {
 SpiDesktop *
 spi_desktop_new (void)
 {
-  SpiDesktop *retval = g_object_new (SPI_DESKTOP_TYPE, NULL);
+  SpiDesktop *desktop; 
+  SpiAccessible *accessible; 
+
+  accessible = spi_accessible_construct (SPI_DESKTOP_TYPE, g_object_new (SPI_TYPE_ATK_DESKTOP, NULL));
+  g_assert (SPI_IS_DESKTOP (accessible));
+  desktop = SPI_DESKTOP (accessible);
 
 
-  return retval;
+  return desktop;
 }
 
 static void
 }
 
 static void
index 469616c..9171c5b 100644 (file)
@@ -1961,13 +1961,6 @@ spi_device_event_controller_init (SpiDEController *device_event_controller)
   device_event_controller->mouse_listeners = NULL;
   device_event_controller->keygrabs_list   = NULL;
 
   device_event_controller->mouse_listeners = NULL;
   device_event_controller->keygrabs_list   = NULL;
 
-  /*
-   * TODO: fixme, this module makes the foolish assumptions that
-   * registryd uses the same display as the apps, and that the
-   * DISPLAY environment variable is set.
-   */
-  gdk_init (NULL, NULL);
-  
   private = g_new0 (DEControllerPrivateData, 1);
   gettimeofday (&private->last_press_time, NULL);
   gettimeofday (&private->last_release_time, NULL);
   private = g_new0 (DEControllerPrivateData, 1);
   gettimeofday (&private->last_press_time, NULL);
   gettimeofday (&private->last_release_time, NULL);
index 6ae9ed2..68380dc 100644 (file)
@@ -676,6 +676,13 @@ static void
 spi_registry_init (SpiRegistry *registry)
 {
   spi_registry_set_debug (g_getenv ("AT_SPI_DEBUG"));
 spi_registry_init (SpiRegistry *registry)
 {
   spi_registry_set_debug (g_getenv ("AT_SPI_DEBUG"));
+  /*
+   * TODO: fixme, this module makes the foolish assumptions that
+   * registryd uses the same display as the apps, and that the
+   * DISPLAY environment variable is set.
+   */
+  gdk_init (NULL, NULL);
+
   registry->object_listeners = NULL;
   registry->window_listeners = NULL;
   registry->toolkit_listeners = NULL;
   registry->object_listeners = NULL;
   registry->window_listeners = NULL;
   registry->toolkit_listeners = NULL;