Back to index

unity  6.0.0
Classes | Defines | Functions
unity-root-accessible.cpp File Reference
#include "unity-root-accessible.h"
#include "nux-base-window-accessible.h"
#include "unitya11y.h"
#include "UBusWrapper.h"
#include "UBusMessages.h"

Go to the source code of this file.

Classes

struct  _UnityRootAccessiblePrivate

Defines

#define UNITY_ROOT_ACCESSIBLE_GET_PRIVATE(obj)   (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UNITY_TYPE_ROOT_ACCESSIBLE, UnityRootAccessiblePrivate))

Functions

static void unity_root_accessible_class_init (UnityRootAccessibleClass *klass)
 SECTION:unity-accessible-root : Root object for the UNITY accessible support.
static void unity_root_accessible_init (UnityRootAccessible *root)
static void unity_root_accessible_finalize (GObject *object)
static void unity_root_accessible_initialize (AtkObject *accessible, gpointer data)
static gint unity_root_accessible_get_n_children (AtkObject *obj)
static AtkObject * unity_root_accessible_ref_child (AtkObject *obj, gint i)
static AtkObject * unity_root_accessible_get_parent (AtkObject *obj)
static void explore_children (AtkObject *obj)
static void check_active_window (UnityRootAccessible *self)
static void register_interesting_messages (UnityRootAccessible *self)
static void add_window (UnityRootAccessible *self, nux::BaseWindow *window)
static void remove_window (UnityRootAccessible *self, nux::BaseWindow *window)
AtkObject * unity_root_accessible_new (void)
static void set_active_window (UnityRootAccessible *self, nux::BaseWindow *window)
nux::BaseWindow * search_for_launcher_window (UnityRootAccessible *self)
static void ubus_launcher_register_interest_cb (GVariant *variant, UnityRootAccessible *self)
static void wc_change_visibility_window_cb (nux::BaseWindow *window, UnityRootAccessible *self, gboolean visible)

Class Documentation

struct _UnityRootAccessiblePrivate

Definition at line 62 of file unity-root-accessible.cpp.

Class Members
BaseWindow * active_window
BaseWindow * launcher_window
GSList * window_list

Define Documentation

#define UNITY_ROOT_ACCESSIBLE_GET_PRIVATE (   obj)    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), UNITY_TYPE_ROOT_ACCESSIBLE, UnityRootAccessiblePrivate))

Definition at line 57 of file unity-root-accessible.cpp.


Function Documentation

static void add_window ( UnityRootAccessible *  self,
nux::BaseWindow *  window 
) [static]

Definition at line 250 of file unity-root-accessible.cpp.

{
  AtkObject* window_accessible = NULL;
  gint index = 0;

  g_return_if_fail(UNITY_IS_ROOT_ACCESSIBLE(self));

  window_accessible =
    unity_a11y_get_accessible(window);

  /* FIXME: temporal */
  atk_object_set_name (window_accessible, window->GetWindowName().GetTCharPtr());

  if (g_slist_find(self->priv->window_list, window_accessible))
    return;

  self->priv->window_list =
    g_slist_append(self->priv->window_list, window_accessible);
  g_object_ref(window_accessible);

  index = g_slist_index(self->priv->window_list, window_accessible);

  explore_children(window_accessible);

  g_signal_emit_by_name(self, "children-changed::add",
                        index, window_accessible, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void check_active_window ( UnityRootAccessible *  self) [static]

Definition at line 231 of file unity-root-accessible.cpp.

{
  GSList* iter = NULL;
  NuxBaseWindowAccessible* window = NULL;

  for (iter = self->priv->window_list; iter != NULL; iter = g_slist_next(iter))
  {
    window = NUX_BASE_WINDOW_ACCESSIBLE(iter->data);
    nux_base_window_accessible_check_active(window, self->priv->active_window);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void explore_children ( AtkObject *  obj) [static]

Definition at line 208 of file unity-root-accessible.cpp.

{
  gint num = 0;
  gint i = 0;
  AtkObject* atk_child = NULL;

  g_return_if_fail(ATK_IS_OBJECT(obj));

  num = atk_object_get_n_accessible_children(obj);

  for (i = 0; i < num; i++)
  {
    atk_child = atk_object_ref_accessible_child(obj, i);
    explore_children(atk_child);
    g_object_unref(atk_child);
  }
}

Here is the caller graph for this function:

static void register_interesting_messages ( UnityRootAccessible *  self) [static]

Definition at line 390 of file unity-root-accessible.cpp.

{
  static unity::UBusManager ubus_manager;

  ubus_manager.RegisterInterest(UBUS_LAUNCHER_START_KEY_NAV,
                                sigc::bind(sigc::ptr_fun(ubus_launcher_register_interest_cb),
                                self));

  ubus_manager.RegisterInterest(UBUS_LAUNCHER_START_KEY_SWTICHER,
                                sigc::bind(sigc::ptr_fun(ubus_launcher_register_interest_cb),
                                self));

  nux::GetWindowCompositor().sigVisibleViewWindow.
  connect(sigc::bind(sigc::ptr_fun(wc_change_visibility_window_cb), self, TRUE));

  nux::GetWindowCompositor().sigHiddenViewWindow.
  connect(sigc::bind(sigc::ptr_fun(wc_change_visibility_window_cb), self, FALSE));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void remove_window ( UnityRootAccessible *  self,
nux::BaseWindow *  window 
) [static]

Definition at line 288 of file unity-root-accessible.cpp.

{
  AtkObject* window_accessible = NULL;
  gint index = 0;

  g_return_if_fail(UNITY_IS_ROOT_ACCESSIBLE(self));

  window_accessible =
    unity_a11y_get_accessible(window);

  return;
  
  if (!g_slist_find(self->priv->window_list, window_accessible))
    return;

  index = g_slist_index(self->priv->window_list, window_accessible);

  self->priv->window_list =
    g_slist_remove(self->priv->window_list, window_accessible);
  g_object_unref(window_accessible);

  g_signal_emit_by_name(self, "children-changed::remove",
                        index, window_accessible, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nux::BaseWindow* search_for_launcher_window ( UnityRootAccessible *  self)

Definition at line 326 of file unity-root-accessible.cpp.

{
  GSList*iter = NULL;
  nux::Object* nux_object = NULL;
  nux::BaseWindow* bwindow = NULL;
  NuxObjectAccessible* accessible = NULL;
  gboolean found = FALSE;

  for (iter = self->priv->window_list; iter != NULL; iter = g_slist_next(iter))
  {
    accessible = NUX_OBJECT_ACCESSIBLE(iter->data);

    nux_object = nux_object_accessible_get_object(accessible);
    bwindow = dynamic_cast<nux::BaseWindow*>(nux_object);

    if ((bwindow!= NULL) && (g_strcmp0(bwindow->GetWindowName().GetTCharPtr(), "LauncherWindow") == 0))
    {
      found = TRUE;
      break;
    }
  }

  if (found)
    return bwindow;
  else
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void set_active_window ( UnityRootAccessible *  self,
nux::BaseWindow *  window 
) [static]

Definition at line 315 of file unity-root-accessible.cpp.

{
  g_return_if_fail(UNITY_IS_ROOT_ACCESSIBLE(self));
  g_return_if_fail(window != NULL);

  self->priv->active_window = window;
  check_active_window(self);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void ubus_launcher_register_interest_cb ( GVariant *  variant,
UnityRootAccessible *  self 
) [static]

Definition at line 355 of file unity-root-accessible.cpp.

{
  //launcher window is the same during all the life of Unity
  if (self->priv->launcher_window == NULL)
    self->priv->launcher_window = search_for_launcher_window(self);

  //launcher window became the active window
  set_active_window(self, self->priv->launcher_window);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void unity_root_accessible_class_init ( UnityRootAccessibleClass *  klass) [static]

SECTION:unity-accessible-root : Root object for the UNITY accessible support.

UnityRootAccessible is the root object of the accessibility

tree-like hierarchy, exposing the application level. You can see it as the one exposing UnityScreen information to the a11y framework

Definition at line 72 of file unity-root-accessible.cpp.

{
  GObjectClass* gobject_class = G_OBJECT_CLASS(klass);
  AtkObjectClass* atk_class = ATK_OBJECT_CLASS(klass);

  gobject_class->finalize = unity_root_accessible_finalize;

  /* AtkObject */
  atk_class->get_n_children = unity_root_accessible_get_n_children;
  atk_class->ref_child = unity_root_accessible_ref_child;
  atk_class->get_parent = unity_root_accessible_get_parent;
  atk_class->initialize = unity_root_accessible_initialize;

  g_type_class_add_private(gobject_class, sizeof(UnityRootAccessiblePrivate));
}

Here is the call graph for this function:

static void unity_root_accessible_finalize ( GObject *  object) [static]

Definition at line 111 of file unity-root-accessible.cpp.

{
  UnityRootAccessible* root = UNITY_ROOT_ACCESSIBLE(object);

  g_return_if_fail(UNITY_IS_ROOT_ACCESSIBLE(object));

  if (root->priv->window_list)
  {
    g_slist_free_full(root->priv->window_list, g_object_unref);
    root->priv->window_list = NULL;
  }

  G_OBJECT_CLASS(unity_root_accessible_parent_class)->finalize(object);
}

Here is the caller graph for this function:

static gint unity_root_accessible_get_n_children ( AtkObject *  obj) [static]

Definition at line 145 of file unity-root-accessible.cpp.

{
  UnityRootAccessible* root = UNITY_ROOT_ACCESSIBLE(obj);

  return g_slist_length(root->priv->window_list);
}

Here is the caller graph for this function:

static AtkObject * unity_root_accessible_get_parent ( AtkObject *  obj) [static]

Definition at line 175 of file unity-root-accessible.cpp.

{
  return NULL;
}

Here is the caller graph for this function:

static void unity_root_accessible_init ( UnityRootAccessible *  root) [static]

Definition at line 89 of file unity-root-accessible.cpp.

{
  root->priv = UNITY_ROOT_ACCESSIBLE_GET_PRIVATE(root);

  root->priv->window_list = NULL;
  root->priv->active_window = NULL;
  root->priv->launcher_window = NULL;
}
static void unity_root_accessible_initialize ( AtkObject *  accessible,
gpointer  data 
) [static]

Definition at line 128 of file unity-root-accessible.cpp.

{
  accessible->role = ATK_ROLE_APPLICATION;

  // FIXME: compiz doesn't set the program name using g_set_prgname,
  // and AFAIK, there isn't a way to get it. Requires further investigation.
  // accessible->name = g_get_prgname();
  atk_object_set_name(accessible, "unity");
  atk_object_set_parent(accessible, NULL);

  register_interesting_messages(UNITY_ROOT_ACCESSIBLE(accessible));

  ATK_OBJECT_CLASS(unity_root_accessible_parent_class)->initialize(accessible, data);
}

Here is the call graph for this function:

Here is the caller graph for this function:

AtkObject* unity_root_accessible_new ( void  )

Definition at line 99 of file unity-root-accessible.cpp.

{
  AtkObject* accessible = NULL;

  accessible = ATK_OBJECT(g_object_new(UNITY_TYPE_ROOT_ACCESSIBLE, NULL));

  atk_object_initialize(accessible, NULL);

  return accessible;
}

Here is the caller graph for this function:

static AtkObject * unity_root_accessible_ref_child ( AtkObject *  obj,
gint  i 
) [static]

Definition at line 153 of file unity-root-accessible.cpp.

{
  UnityRootAccessible* root = NULL;
  gint num = 0;
  AtkObject* item = NULL;

  root = UNITY_ROOT_ACCESSIBLE(obj);
  num = atk_object_get_n_accessible_children(obj);
  g_return_val_if_fail((i < num) && (i >= 0), NULL);

  item = ATK_OBJECT(g_slist_nth_data(root->priv->window_list, i));

  if (!item)
    return NULL;

  g_object_ref(item);

  return item;
}

Here is the caller graph for this function:

static void wc_change_visibility_window_cb ( nux::BaseWindow *  window,
UnityRootAccessible *  self,
gboolean  visible 
) [static]

Definition at line 368 of file unity-root-accessible.cpp.

{
  if (visible)
  {
    add_window(self, window);
    //for the dash and quicklist
    set_active_window(self, window);
  }
  else
  {
    AtkObject* accessible = NULL;

    accessible = unity_a11y_get_accessible(window);
    nux_base_window_accessible_check_active(NUX_BASE_WINDOW_ACCESSIBLE(accessible),
                                            NULL);
    remove_window(self, window);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function: