summaryrefslogtreecommitdiff
path: root/atk
diff options
context:
space:
mode:
authorPadraig O'Briain <padraig.obriain@sun.com>2003-11-26 17:13:29 +0000
committerPadraig O'Briain <padraigo@src.gnome.org>2003-11-26 17:13:29 +0000
commit28cb9499b8c268e1e50608f90ae09417599de293 (patch)
treecf47335fd8c47310b04aa51e60d52b77be9564a4 /atk
parentf3f15d1b08f403f5e4f1c93e6661af34f0e4aae2 (diff)
downloadatk-28cb9499b8c268e1e50608f90ae09417599de293.tar.gz
Add state FOCUSED if object is focus object.
2003-11-26 Padraig O'Briain <padraig.obriain@sun.com> * atk/atkobject.c (atk_object_real_ref_state_set): Add state FOCUSED if object is focus object. * atk/atkutil.[ch] (atk_get_focus_object): New function which returns the last object reported by the application as focused. * docs/atk-sections.txt, docs/tmpl/atkutil.sgml: Add atk_get_focus_object. Fixes bug #127400.
Diffstat (limited to 'atk')
-rwxr-xr-xatk/atkobject.c4
-rwxr-xr-xatk/atkutil.c17
-rwxr-xr-xatk/atkutil.h2
3 files changed, 21 insertions, 2 deletions
diff --git a/atk/atkobject.c b/atk/atkobject.c
index 7cdd3c6..6b302e5 100755
--- a/atk/atkobject.c
+++ b/atk/atkobject.c
@@ -1112,6 +1112,7 @@ atk_object_real_ref_state_set (AtkObject *accessible)
{
AtkStateSet *state_set;
AtkObject *ap;
+ AtkObject *focus_object;
state_set = atk_state_set_new ();
@@ -1128,6 +1129,9 @@ atk_object_real_ref_state_set (AtkObject *accessible)
if (atk_selection_is_child_selected(ATK_SELECTION (ap), i))
atk_state_set_add_state (state_set, ATK_STATE_SELECTED);
}
+ focus_object = atk_get_focus_object ();
+ if (focus_object == accessible)
+ atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
return state_set;
}
diff --git a/atk/atkutil.c b/atk/atkutil.c
index 7089782..5e4cdab 100755
--- a/atk/atkutil.c
+++ b/atk/atkutil.c
@@ -20,9 +20,10 @@
#include "atkutil.h"
#include "atkmarshal.c"
-
static void atk_util_class_init (AtkUtilClass *klass);
+static AtkObject *previous_focus_object = NULL;
+
GType
atk_util_get_type (void)
{
@@ -174,7 +175,6 @@ void
atk_focus_tracker_notify (AtkObject *object)
{
FocusTracker *item;
- static AtkObject *previous_focus_object = NULL;
guint i;
if (trackers == NULL)
@@ -318,6 +318,19 @@ atk_get_root (void)
}
/**
+ * atk_get_focus_object:
+ *
+ * Gets the currently focused object.
+ *
+ * Returns: the currently focused object for the current application
+ **/
+AtkObject*
+atk_get_focus_object (void)
+{
+ return previous_focus_object;
+}
+
+/**
* atk_get_toolkit_name:
*
* Gets name string for the GUI toolkit implementing ATK for this application.
diff --git a/atk/atkutil.h b/atk/atkutil.h
index 7654156..042d610 100755
--- a/atk/atkutil.h
+++ b/atk/atkutil.h
@@ -163,6 +163,8 @@ void atk_remove_key_event_listener (guint listener_id);
*/
AtkObject* atk_get_root(void);
+AtkObject* atk_get_focus_object (void);
+
/*
* Returns name string for the GUI toolkit.
*/