Commit 6466da0049a188cf67b3ea0828029a9e271ec9fa

Authored by ksamak
1 parent d57a3ed7
Exists in master

refactored project

AccessibileFiller.cpp
... ... @@ -1,15 +0,0 @@
1   -#include <iostream>
2   -#include <unistd.h>
3   -
4   -#include "AccessibileFiller.h"
5   -
6   -AccessibleFiller::AccessibleFiller(AccessibleComponent* parent, std::string text) : AccessibleComponent(parent) {
7   - _atk_obj = (AtkObject*)g_object_new (
8   - MY_TYPE_ATK_OBJECT,
9   - "accessible-name", text.c_str(),
10   - "accessible-description", "description of the filler",
11   - "accessible-role", ATK_ROLE_FILLER,
12   - NULL);
13   -
14   -}
15   -
AccessibileFiller.h
... ... @@ -1,13 +0,0 @@
1   -#ifndef ACCESSIBLE_FILLER_H
2   -#define ACCESSIBLE_FILLER_H
3   -
4   -#include "atk-defs.h"
5   -#include "AccessibleComponent.h"
6   -
7   -class AccessibleFiller : public AccessibleComponent {
8   - public:
9   - AccessibleFiller(AccessibleComponent*, std::string);
10   -};
11   -
12   -#endif
13   -
AccessibileWindow.cpp
... ... @@ -1,28 +0,0 @@
1   -#include <iostream>
2   -#include <unistd.h>
3   -
4   -#include "AccessibileWindow.h"
5   -
6   -AccessibleWindow::AccessibleWindow(AccessibleComponent* parent) : AccessibleComponent(parent) {
7   - _atk_obj = (AtkObject*)g_object_new (
8   - MY_TYPE_ATK_OBJECT,
9   - "accessible-name", "no name",
10   - "accessible-description", "a simple window",
11   - "accessible-role", ATK_ROLE_WINDOW,
12   - NULL);
13   -
14   -}
15   -
16   -//void AccessibleWindow::set_active(bool act) {
17   -// if (act) {
18   -// //g_signal_emit_by_name (_atk_obj, "window:create", NULL, NULL);
19   -// usleep(10);
20   -// //g_signal_emit_by_name (_atk_obj, "window:activate", NULL, NULL);
21   -// g_signal_emit_by_name (_atk_obj, "create", NULL, NULL);
22   -// } else {
23   -// g_signal_emit_by_name (_atk_obj, "deactivate", NULL, NULL, NULL, "window title");
24   -// }
25   -//}
26   -//
27   -//void AccessibleWindow::set_showing(bool show) {
28   -//}
AccessibileWindow.h
... ... @@ -1,16 +0,0 @@
1   -#ifndef ACCESSIBLE_WINDOW_H
2   -#define ACCESSIBLE_WINDOW_H
3   -
4   -#include "atk-defs.h"
5   -#include "AccessibleComponent.h"
6   -
7   -class AccessibleWindow : public AccessibleComponent {
8   - public:
9   - AccessibleWindow(AccessibleComponent*);
10   -
11   - //void set_active(bool);
12   - //void set_showing(bool);
13   -};
14   -
15   -#endif
16   -
AccessibilityControler.cpp
... ... @@ -1,189 +0,0 @@
1   -
2   -#include <atk/atk.h>
3   -#include <atk-bridge.h>
4   -
5   -#include <iostream>
6   -#include <unistd.h>
7   -
8   -#include "AccessibilityControler.h"
9   -
10   -const gchar* get_toolkit_name() {
11   - return "AccessibilityController";
12   -}
13   -
14   -const gchar* get_toolkit_version() {
15   - return "1.0";
16   -}
17   -
18   -static AtkObject* get_root() {
19   - return AccessibilityController::get_instance()->get_root_obj();
20   -}
21   -
22   -guint add_key_event_listener(AtkKeySnoopFunc snooper, gpointer datum) {
23   - return AccessibilityController::add_key_listener(snooper, datum);
24   -}
25   -
26   -
27   -
28   -AccessibilityController* AccessibilityController::_instance = NULL;
29   -GSList* AccessibilityController::_key_listeners = NULL;
30   -
31   -AccessibilityController::AccessibilityController() : _access_root(), _thread(NULL), _mutex() {
32   -}
33   -
34   -void AccessibilityController::init() {
35   - std::cout << "begin funct: " << __func__ << std::endl;
36   - setup_atk_classes();
37   - get_root_obj(); // init the root DOM object
38   - setup_atk (0, NULL); //setup_atk (&argc, &argv);
39   -
40   - // start thread with glib::mainloop
41   - _thread = Glib::Thread::create(sigc::mem_fun(*this, &AccessibilityController::startEventLoop), true);
42   -}
43   -
44   -AccessibilityController* AccessibilityController::get_instance() {
45   - std::cout << "begin funct: " << __func__ << std::endl;
46   - std::cout << "_instance bfore: { " << _instance << " }" << std::endl;
47   - if(_instance == NULL) {
48   - std::cout << "passing through instanciation: ";
49   - _instance = new AccessibilityController();
50   - _instance->init_mainloop();
51   - }
52   - std::cout << "_instance after { " << _instance << " }" << std::endl;
53   - return _instance;
54   -}
55   -
56   -void AccessibilityController::setup_atk_classes() {
57   - std::cout << "begin funct: " << __func__ << std::endl;
58   - AtkUtilClass *klass;
59   -
60   - klass = (AtkUtilClass*)g_type_class_ref (ATK_TYPE_UTIL);
61   - klass->get_root = ::get_root;
62   - klass->get_toolkit_name = ::get_toolkit_name;
63   - klass->get_toolkit_version = ::get_toolkit_version;
64   - klass->add_key_event_listener = add_key_event_listener;
65   - g_type_class_unref (klass);
66   -}
67   -
68   -void AccessibilityController::setup_atk (int *argc, char ***argv) {
69   - std::cout << "begin funct: " << __func__ << std::endl;
70   - // Ensure the Atk interface types are registered, otherwise
71   - // the AtkDocument signal handlers below won't get registered.
72   - GObject* dummyAxObject = G_OBJECT(g_object_new(ATK_TYPE_OBJECT, 0));
73   - AtkObject* dummyNoOpAxObject = atk_no_op_object_new(dummyAxObject);
74   - g_object_unref(G_OBJECT(dummyNoOpAxObject));
75   - g_object_unref(dummyAxObject);
76   -
77   - // int result = atk_add_key_event_listener (my_silly_key_snooper, NULL);
78   - // fprintf (stderr, "Did atk_add_key_event_listener succeed? %s\n", result ? "yes" : "NO");
79   -
80   - atk_bridge_adaptor_init (NULL, NULL);
81   - fprintf (stderr, "OK-D 2000: initialized bridge\n");
82   -}
83   -
84   -GSList* AccessibilityController::get_key_snoopers() {
85   - return _key_listeners;
86   -}
87   -
88   -AtkObject* AccessibilityController::get_root_obj() {
89   - return _access_root.atk_obj();
90   -}
91   -
92   -AccessibleWindow* AccessibilityController::create_window() {
93   - return _access_root.create_window();
94   -}
95   -
96   -AccessibleStatusbar* AccessibilityController::create_statusbar() {
97   - return _access_root.create_statusbar();
98   -}
99   -
100   -AccessibleLabel* AccessibilityController::create_label(std::string text) {
101   - return _access_root.create_label(text);
102   -}
103   -
104   -
105   -guint AccessibilityController::add_key_listener(AtkKeySnoopFunc snooper, gpointer datum) {
106   - std::cout << "begin funct: " << __func__ << std::endl;
107   - //pthread_mutex_lock (& mutex);
108   - static guint res = 0;
109   - res ++;
110   - //fprintf (stderr, "@@@@@@@@ %s (%p, %p) --> %i\n", __func__, snooper, datum, (int)res);
111   -
112   - key_listener_struct *s = g_slice_new0 (key_listener_struct);
113   - s->id = res;
114   - s->snooper = snooper;
115   - s->datum = datum;
116   - _key_listeners = g_slist_append (_key_listeners, s);
117   -
118   - //pthread_mutex_unlock (& mutex);
119   - return res;
120   -}
121   -
122   -void AccessibilityController::init_mainloop() {
123   - std::cout << "begin funct: " << __func__ << std::endl;
124   - ctx = Glib::MainContext::get_default();
125   - _mainloop = Glib::MainLoop::create (ctx, false);
126   -// sighupSource = CompSignalSource::create (SIGHUP, boost::bind (&EventManager::handleSignal, this, _1));
127   -// sigintSource = CompSignalSource::create (SIGINT, boost::bind (&EventManager::handleSignal, this, _1));
128   -// sigtermSource = CompSignalSource::create (SIGTERM, boost::bind (&EventManager::handleSignal, this, _1));
129   -}
130   -
131   -void AccessibilityController::startEventLoop() {
132   - _mainloop->run();
133   -}
134   -
135   -void AccessibilityController::handleSignal (int signum) {
136   - switch (signum)
137   - {
138   - case SIGINT:
139   - case SIGTERM:
140   - _mainloop->quit ();
141   - break;
142   - case SIGHUP:
143   - _restartSignal = true;
144   - _mainloop->quit ();
145   - break;
146   - default:
147   - break;
148   - }
149   - _mainloop->quit ();
150   -}
151   -
152   -void AccessibilityController::manage_timings(bool man) {
153   - _access_root.manage_timings(man);
154   -}
155   -
156   -int main (int argc, char **argv) {
157   - Glib::init();
158   -
159   - std::cout << "DEBUG - " << "Creating controller" << std::endl;
160   - auto controller = AccessibilityController::get_instance();
161   - controller->manage_timings(true);
162   - controller->init();
163   - usleep(10000);
164   -
165   -
166   - std::cout << "DEBUG - " << "Creating elements" << std::endl;
167   - auto window = controller->create_window();
168   - window->set_accessible_name("compiz main");
169   - auto statusbar = window->create_statusbar();
170   - statusbar->set_accessible_name("app switcher");
171   - auto filler1 = statusbar->create_filler("icedove");
172   - auto filler2 = statusbar->create_filler("iceweasel");
173   - sleep(1);
174   -
175   - std::cout << "DEBUG - " << "statusbar focusing" << std::endl;
176   - //window->focus();
177   - //statusbar->focus();
178   - filler1->focus();
179   - filler2->unfocus();
180   -
181   - std::cout << "DEBUG - " << "waiting 40sec" << std::endl;
182   - sleep(40);
183   -
184   -
185   - printf ("Exiting program.\n");
186   - return 0;
187   -}
188   -
189   - //std::cout << "begin funct: " << __func__ << std::endl;
AccessibilityControler.h
... ... @@ -1,62 +0,0 @@
1   -#ifndef ATK_CONTROLLER_H
2   -#define ATK_CONTROLLER_H
3   -
4   -#include <glibmm.h>
5   -#include <glibmm/main.h>
6   -
7   -#include "atk-defs.h"
8   -#include "AccessibleComponent.h"
9   -#include "AccessibleRoot.h"
10   -#include "AccessibileWindow.h"
11   -#include "AccessibleLabel.h"
12   -#include "AccessibileFiller.h"
13   -
14   -typedef struct {
15   - guint id;
16   - AtkKeySnoopFunc snooper;
17   - gpointer datum;
18   -} key_listener_struct;
19   -
20   -
21   -class AccessibilityController {
22   - public:
23   - static AccessibilityController* get_instance();
24   - ~AccessibilityController() {};
25   -
26   - void init();
27   - void handleSignal (int signum);
28   - void manage_timings(bool);
29   - void quit() { _mainloop->quit(); }
30   -
31   - AtkObject* get_root_obj();
32   -
33   - static GSList* _key_listeners;
34   - static GSList* get_key_snoopers();
35   - static guint add_key_listener(AtkKeySnoopFunc snooper, gpointer datum);
36   -
37   - AccessibleWindow* create_window();
38   - AccessibleStatusbar* create_statusbar();
39   - AccessibleLabel* create_label(std::string);
40   - AccessibleFiller* create_filler(std::string);
41   -
42   - private:
43   - AccessibilityController();
44   - static AccessibilityController* _instance;
45   -
46   - Glib::Thread* _thread;
47   - Glib::Mutex _mutex;
48   -
49   - AccessibleRoot _access_root;
50   -
51   - void setup_atk_classes();
52   - void setup_atk(int *argc, char ***argv);
53   -
54   - void init_mainloop();
55   - void startEventLoop();
56   - Glib::RefPtr <Glib::MainContext> ctx;
57   - Glib::RefPtr <Glib::MainLoop> _mainloop;
58   - bool _restartSignal;
59   - //mutable Glib::Threads::Mutex m_Mutex;
60   -};
61   -
62   -#endif
AccessibleComponent.cpp
... ... @@ -1,118 +0,0 @@
1   -
2   -#include <iostream>
3   -#include <vector>
4   -#include <unistd.h>
5   -
6   -#include "AccessibleComponent.h"
7   -#include "AccessibileWindow.h"
8   -#include "AccessibleRoot.h"
9   -#include "AccessibleStatusbar.h"
10   -#include "AccessibleLabel.h"
11   -#include "AccessibileFiller.h"
12   -
13   -AccessibleComponent::AccessibleComponent() :
14   - _manage_timings(false),
15   - _atk_obj(NULL),
16   - _parent(NULL),
17   - _children()
18   -{
19   -};
20   -
21   -AccessibleComponent::AccessibleComponent(AccessibleComponent* parent) :
22   - _manage_timings(false),
23   - _atk_obj(NULL),
24   - _parent(parent)
25   -{
26   -};
27   -
28   -AccessibleComponent::~AccessibleComponent() {
29   - std::cout << "destroying " << __func__ << std::endl;
30   - for (auto child = _children.begin(); child != _children.end(); child++) {
31   - delete *child;
32   - }
33   -};
34   -
35   -AtkObject* AccessibleComponent::atk_obj() {
36   - return _atk_obj;
37   -}
38   -
39   -void AccessibleComponent::manage_timings(bool val) {
40   - _manage_timings = val;
41   -}
42   -
43   -void AccessibleComponent::update() {
44   - _parent->update(this);
45   -}
46   -
47   -void AccessibleComponent::update(AccessibleComponent* comp) {
48   -}
49   -
50   -void AccessibleComponent::focus() {
51   - focus(true);
52   -}
53   -
54   -void AccessibleComponent::unfocus() {
55   - focus(false);
56   -}
57   -
58   -void AccessibleComponent::focus(bool active) {
59   - if (_manage_timings) {usleep(3);} // if we don't wait here, dbus has no time to realise a previous change.
60   - g_signal_emit_by_name (_atk_obj, "state-change", "focused", (active)? 1 : 0);
61   - //update();
62   -}
63   -
64   -void AccessibleComponent::set_visible(bool vis) {
65   - g_signal_emit_by_name (_atk_obj, "state-change", "visible", (vis)? 1 : 0);
66   -}
67   -
68   -void AccessibleComponent::set_accessible_name(std::string name) {
69   - if (_manage_timings) {
70   - usleep(3000); // time to wait to insure previous name change is acquired (and spoken)
71   - }
72   - g_object_set(_atk_obj, "accessible-name", name.c_str(), NULL);
73   - g_signal_emit_by_name (_atk_obj, "visible-data-changed", NULL); // TODO is this right? useless?
74   -}
75   -
76   -void AccessibleComponent::set_accessible_description(std::string desc) {
77   -}
78   -
79   -void AccessibleComponent::add_child_relation(AccessibleComponent* component) {
80   - my_atk_object_add_child (MY_ATK_OBJECT (_atk_obj), MY_ATK_OBJECT (component->atk_obj()));
81   - g_signal_emit_by_name(_atk_obj, "children-changed", "add", NULL, _children.size(), NULL, component->atk_obj());
82   -}
83   -
84   -AccessibleWindow* AccessibleComponent::create_window() {
85   - auto window = new AccessibleWindow(this);
86   - _children.push_back(window);
87   - add_child_relation(window);
88   - window->init();
89   -
90   - return window;
91   -}
92   -
93   -AccessibleStatusbar* AccessibleComponent::create_statusbar() {
94   - auto statusbar = new AccessibleStatusbar(this);
95   - _children.push_back(statusbar);
96   - add_child_relation(statusbar);
97   - statusbar->init();
98   -
99   - return statusbar;
100   -}
101   -
102   -AccessibleLabel* AccessibleComponent::create_label(std::string text) {
103   - auto label = new AccessibleLabel(this, text);
104   - _children.push_back(label);
105   - add_child_relation(label);
106   - label->init();
107   -
108   - return label;
109   -}
110   -
111   -AccessibleFiller* AccessibleComponent::create_filler(std::string text) {
112   - auto filler = new AccessibleFiller(this, text);
113   - _children.push_back(filler);
114   - add_child_relation(filler);
115   - filler->init();
116   -
117   - return filler;
118   -}
AccessibleComponent.h
... ... @@ -1,49 +0,0 @@
1   -#ifndef ATK_COMPONENT_H
2   -#define ATK_COMPONENT_H
3   -
4   -#include <vector>
5   -#include "atk-defs.h"
6   -
7   -class AccessibleRoot;
8   -class AccessibleLabel;
9   -class AccessibleFiller;
10   -class AccessibleStatusbar;
11   -class AccessibleWindow;
12   -
13   -class AccessibleComponent {
14   - public:
15   - ~AccessibleComponent();
16   -
17   - AtkObject* atk_obj();
18   - void manage_timings(bool);
19   -
20   - void init(){};
21   - void update();
22   - void update(AccessibleComponent*);
23   - void focus();
24   - void unfocus();
25   - void focus(bool active);
26   - void set_visible(bool);
27   - void set_accessible_name(std::string);
28   - void set_accessible_description(std::string);
29   -
30   - // factories
31   - AccessibleWindow* create_window();
32   - AccessibleStatusbar* create_statusbar();
33   - AccessibleLabel* create_label(std::string);
34   - AccessibleFiller* create_filler(std::string);
35   -
36   -
37   - protected:
38   - AccessibleComponent();
39   - AccessibleComponent(AccessibleComponent*);
40   -
41   - bool _manage_timings; // to manage DBus update timings
42   - AtkObject* _atk_obj;
43   - AccessibleComponent* _parent;
44   - std::vector<AccessibleComponent*> _children;
45   -
46   - void add_child_relation(AccessibleComponent*);
47   -};
48   -
49   -#endif
AccessibleLabel.cpp
... ... @@ -1,14 +0,0 @@
1   -#include <iostream>
2   -#include <unistd.h>
3   -
4   -#include "AccessibleLabel.h"
5   -
6   -AccessibleLabel::AccessibleLabel(AccessibleComponent* parent, std::string text) : AccessibleComponent(parent) {
7   - _atk_obj = (AtkObject*)g_object_new (
8   - MY_TYPE_ATK_OBJECT,
9   - "accessible-name", text.c_str(),
10   - "accessible-description", "description of the label",
11   - "accessible-role", ATK_ROLE_LABEL,
12   - NULL);
13   -
14   -}
AccessibleLabel.h
... ... @@ -1,12 +0,0 @@
1   -#ifndef ACCESSIBLE_LABEL_H
2   -#define ACCESSIBLE_LABEL_H
3   -
4   -#include "atk-defs.h"
5   -#include "AccessibleComponent.h"
6   -
7   -class AccessibleLabel : public AccessibleComponent {
8   - public:
9   - AccessibleLabel(AccessibleComponent*, std::string);
10   -};
11   -
12   -#endif
AccessibleRoot.cpp
... ... @@ -1,18 +0,0 @@
1   -#include <iostream>
2   -
3   -#include "AccessibleRoot.h"
4   -
5   -AccessibleRoot::AccessibleRoot() : AccessibleComponent(NULL) {
6   - std::cout << "begin funct: " << __func__ << std::endl;
7   - _atk_obj = (AtkObject*)g_object_new (
8   - MY_TYPE_ATK_OBJECT,
9   - "accessible-name", "the-root-object",
10   - "accessible-description", "the very beautiful root object",
11   - "accessible-role", ATK_ROLE_APPLICATION,
12   - NULL);
13   -}
14   -
15   - // DE-ACTIVATED TILL YOU UNDERSTAND BETTER
16   -// g_signal_emit_by_name (_atk_obj, "children-changed", -1, label->atk_obj(), NULL, NULL);
17   -// g_signal_emit_by_name (_atk_obj, "object:active-descendant-changed", label->atk_obj(), NULL, NULL);
18   -// g_signal_emit_by_name (_atk_obj, "active-descendant-changed", label->atk_obj(), NULL, NULL);
AccessibleRoot.h
... ... @@ -1,15 +0,0 @@
1   -#ifndef ACCESSIBLE_ROOT_H
2   -#define ACCESSIBLE_ROOT_H
3   -
4   -
5   -#include "atk-defs.h"
6   -#include "AccessibleComponent.h"
7   -#include "AccessibleLabel.h"
8   -#include "AccessibleStatusbar.h"
9   -
10   -class AccessibleRoot : public AccessibleComponent {
11   - public:
12   - AccessibleRoot();
13   -};
14   -
15   -#endif
AccessibleStatusbar.cpp
... ... @@ -1,20 +0,0 @@
1   -#include <iostream>
2   -
3   -#include "AccessibleStatusbar.h"
4   -
5   -AccessibleStatusbar::AccessibleStatusbar(AccessibleComponent* parent) : AccessibleComponent(parent) {
6   - _atk_obj = (AtkObject*)g_object_new (
7   - MY_TYPE_ATK_OBJECT,
8   - "accessible-name", "status_bar",
9   - "accessible-description", "status_bar",
10   - "accessible-role", ATK_ROLE_STATUSBAR,
11   - NULL);
12   -
13   -}
14   -
15   -//void AccessibleStatusbar::init() {
16   -// std::cout << "funct: " << __func__ << std::endl;
17   -// //g_signal_emit_by_name (_atk_obj, "state-change", "visible", 1);
18   -//
19   -//// update();
20   -//}
AccessibleStatusbar.h
... ... @@ -1,12 +0,0 @@
1   -#ifndef ACCESSIBLE_STATUSBAR_H
2   -#define ACCESSIBLE_STATUSBAR_H
3   -
4   -#include "atk-defs.h"
5   -#include "AccessibleComponent.h"
6   -
7   -class AccessibleStatusbar : public AccessibleComponent {
8   - public:
9   - AccessibleStatusbar(AccessibleComponent*);
10   -};
11   -
12   -#endif
atk-defs.h
... ... @@ -1,37 +0,0 @@
1   -
2   -#ifndef ATK_DEFS
3   -#define ATK_DEFS
4   -
5   -extern "C"{
6   -
7   -#include "my-atk/my-atk.h"
8   -
9   -#define ACCESSIBLE_NODE ((const xmlChar *) "accessible")
10   -#define ACC_ACTION_NODE ((const xmlChar *) "accessible_action")
11   -#define ACC_COMPONENT_NODE ((const xmlChar *) "accessible_component")
12   -#define ACTION_NODE ((const xmlChar *) "action")
13   -#define INTERFACE_NODE ((const xmlChar *) "interface")
14   -#define RELATION_NODE ((const xmlChar *) "relation")
15   -#define STATE_NODE ((const xmlChar *) "state")
16   -#define COMPONENT_NODE ((const xmlChar *) "component")
17   -
18   -#define NAME_ATTR ((const xmlChar *) "name")
19   -#define DESC_ATTR ((const xmlChar *) "description")
20   -#define ROLE_ATTR ((const xmlChar *) "role")
21   -#define TYPE_ATTR ((const xmlChar *) "type")
22   -#define RELATION_TYPE_ATTR ((const xmlChar *) "relation_type")
23   -#define RELATION_TARGET_NAME_ATTR ((const xmlChar *) "target_name")
24   -#define STATE_TYPE_ATTR ((const xmlChar *) "state_enum")
25   -#define ACTION_NAME_ATTR ((const xmlChar *) "action_name")
26   -#define ACTION_DES_ATTR ((const xmlChar *) "action_description")
27   -#define ACTION_KEY_BIND_ATTR ((const xmlChar *) "key_binding")
28   -#define COMP_X_ATTR ((const xmlChar *) "x")
29   -#define COMP_Y_ATTR ((const xmlChar *) "y")
30   -#define COMP_WIDTH_ATTR ((const xmlChar *) "width")
31   -#define COMP_HEIGHT_ATTR ((const xmlChar *) "height")
32   -#define COMP_LAYER_ATTR ((const xmlChar *) "layer")
33   -#define COMP_ZORDER_ATTR ((const xmlChar *) "zorder")
34   -#define COMP_ALPHA_ATTR ((const xmlChar *) "alpha")
35   -
36   -}
37   -#endif
include/AccessibileFiller.h 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +#ifndef ACCESSIBLE_FILLER_H
  2 +#define ACCESSIBLE_FILLER_H
  3 +
  4 +#include "atk-defs.h"
  5 +#include "AccessibleComponent.h"
  6 +
  7 +class AccessibleFiller : public AccessibleComponent {
  8 + public:
  9 + AccessibleFiller(AccessibleComponent*, std::string);
  10 +};
  11 +
  12 +#endif
  13 +
... ...
include/AccessibileWindow.h 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +#ifndef ACCESSIBLE_WINDOW_H
  2 +#define ACCESSIBLE_WINDOW_H
  3 +
  4 +#include "atk-defs.h"
  5 +#include "AccessibleComponent.h"
  6 +
  7 +class AccessibleWindow : public AccessibleComponent {
  8 + public:
  9 + AccessibleWindow(AccessibleComponent*);
  10 +
  11 + //void set_active(bool);
  12 + //void set_showing(bool);
  13 +};
  14 +
  15 +#endif
  16 +
... ...
include/AccessibilityController.h 0 → 100644
... ... @@ -0,0 +1,62 @@
  1 +#ifndef ATK_CONTROLLER_H
  2 +#define ATK_CONTROLLER_H
  3 +
  4 +#include <glibmm.h>
  5 +#include <glibmm/main.h>
  6 +
  7 +#include "atk-defs.h"
  8 +#include "AccessibleComponent.h"
  9 +#include "AccessibleRoot.h"
  10 +#include "AccessibileWindow.h"
  11 +#include "AccessibleLabel.h"
  12 +#include "AccessibileFiller.h"
  13 +
  14 +typedef struct {
  15 + guint id;
  16 + AtkKeySnoopFunc snooper;
  17 + gpointer datum;
  18 +} key_listener_struct;
  19 +
  20 +
  21 +class AccessibilityController {
  22 + public:
  23 + static AccessibilityController* get_instance();
  24 + ~AccessibilityController() {};
  25 +
  26 + void init();
  27 + void handleSignal (int signum);
  28 + void manage_timings(bool);
  29 + void quit() { _mainloop->quit(); }
  30 +
  31 + AtkObject* get_root_obj();
  32 +
  33 + static GSList* _key_listeners;
  34 + static GSList* get_key_snoopers();
  35 + static guint add_key_listener(AtkKeySnoopFunc snooper, gpointer datum);
  36 +
  37 + AccessibleWindow* create_window();
  38 + AccessibleStatusbar* create_statusbar();
  39 + AccessibleLabel* create_label(std::string);
  40 + AccessibleFiller* create_filler(std::string);
  41 +
  42 + private:
  43 + AccessibilityController();
  44 + static AccessibilityController* _instance;
  45 +
  46 + Glib::Thread* _thread;
  47 + Glib::Mutex _mutex;
  48 +
  49 + AccessibleRoot _access_root;
  50 +
  51 + void setup_atk_classes();
  52 + void setup_atk(int *argc, char ***argv);
  53 +
  54 + void init_mainloop();
  55 + void startEventLoop();
  56 + Glib::RefPtr <Glib::MainContext> ctx;
  57 + Glib::RefPtr <Glib::MainLoop> _mainloop;
  58 + bool _restartSignal;
  59 + //mutable Glib::Threads::Mutex m_Mutex;
  60 +};
  61 +
  62 +#endif
... ...
include/AccessibleComponent.h 0 → 100644
... ... @@ -0,0 +1,49 @@
  1 +#ifndef ATK_COMPONENT_H
  2 +#define ATK_COMPONENT_H
  3 +
  4 +#include <vector>
  5 +#include "atk-defs.h"
  6 +
  7 +class AccessibleRoot;
  8 +class AccessibleLabel;
  9 +class AccessibleFiller;
  10 +class AccessibleStatusbar;
  11 +class AccessibleWindow;
  12 +
  13 +class AccessibleComponent {
  14 + public:
  15 + ~AccessibleComponent();
  16 +
  17 + AtkObject* atk_obj();
  18 + void manage_timings(bool);
  19 +
  20 + void init(){};
  21 + void update();
  22 + void update(AccessibleComponent*);
  23 + void focus();
  24 + void unfocus();
  25 + void focus(bool active);
  26 + void set_visible(bool);
  27 + void set_accessible_name(std::string);
  28 + void set_accessible_description(std::string);
  29 +
  30 + // factories
  31 + AccessibleWindow* create_window();
  32 + AccessibleStatusbar* create_statusbar();
  33 + AccessibleLabel* create_label(std::string);
  34 + AccessibleFiller* create_filler(std::string);
  35 +
  36 +
  37 + protected:
  38 + AccessibleComponent();
  39 + AccessibleComponent(AccessibleComponent*);
  40 +
  41 + bool _manage_timings; // to manage DBus update timings
  42 + AtkObject* _atk_obj;
  43 + AccessibleComponent* _parent;
  44 + std::vector<AccessibleComponent*> _children;
  45 +
  46 + void add_child_relation(AccessibleComponent*);
  47 +};
  48 +
  49 +#endif
... ...
include/AccessibleLabel.h 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +#ifndef ACCESSIBLE_LABEL_H
  2 +#define ACCESSIBLE_LABEL_H
  3 +
  4 +#include "atk-defs.h"
  5 +#include "AccessibleComponent.h"
  6 +
  7 +class AccessibleLabel : public AccessibleComponent {
  8 + public:
  9 + AccessibleLabel(AccessibleComponent*, std::string);
  10 +};
  11 +
  12 +#endif
... ...
include/AccessibleRoot.h 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +#ifndef ACCESSIBLE_ROOT_H
  2 +#define ACCESSIBLE_ROOT_H
  3 +
  4 +
  5 +#include "atk-defs.h"
  6 +#include "AccessibleComponent.h"
  7 +#include "AccessibleLabel.h"
  8 +#include "AccessibleStatusbar.h"
  9 +
  10 +class AccessibleRoot : public AccessibleComponent {
  11 + public:
  12 + AccessibleRoot();
  13 +};
  14 +
  15 +#endif
... ...
include/AccessibleStatusbar.h 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +#ifndef ACCESSIBLE_STATUSBAR_H
  2 +#define ACCESSIBLE_STATUSBAR_H
  3 +
  4 +#include "atk-defs.h"
  5 +#include "AccessibleComponent.h"
  6 +
  7 +class AccessibleStatusbar : public AccessibleComponent {
  8 + public:
  9 + AccessibleStatusbar(AccessibleComponent*);
  10 +};
  11 +
  12 +#endif
... ...
include/atk-defs.h 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +
  2 +#ifndef ATK_DEFS
  3 +#define ATK_DEFS
  4 +
  5 +extern "C"{
  6 +
  7 +#include "my-atk.h"
  8 +
  9 +#define ACCESSIBLE_NODE ((const xmlChar *) "accessible")
  10 +#define ACC_ACTION_NODE ((const xmlChar *) "accessible_action")
  11 +#define ACC_COMPONENT_NODE ((const xmlChar *) "accessible_component")
  12 +#define ACTION_NODE ((const xmlChar *) "action")
  13 +#define INTERFACE_NODE ((const xmlChar *) "interface")
  14 +#define RELATION_NODE ((const xmlChar *) "relation")
  15 +#define STATE_NODE ((const xmlChar *) "state")
  16 +#define COMPONENT_NODE ((const xmlChar *) "component")
  17 +
  18 +#define NAME_ATTR ((const xmlChar *) "name")
  19 +#define DESC_ATTR ((const xmlChar *) "description")
  20 +#define ROLE_ATTR ((const xmlChar *) "role")
  21 +#define TYPE_ATTR ((const xmlChar *) "type")
  22 +#define RELATION_TYPE_ATTR ((const xmlChar *) "relation_type")
  23 +#define RELATION_TARGET_NAME_ATTR ((const xmlChar *) "target_name")
  24 +#define STATE_TYPE_ATTR ((const xmlChar *) "state_enum")
  25 +#define ACTION_NAME_ATTR ((const xmlChar *) "action_name")
  26 +#define ACTION_DES_ATTR ((const xmlChar *) "action_description")
  27 +#define ACTION_KEY_BIND_ATTR ((const xmlChar *) "key_binding")
  28 +#define COMP_X_ATTR ((const xmlChar *) "x")
  29 +#define COMP_Y_ATTR ((const xmlChar *) "y")
  30 +#define COMP_WIDTH_ATTR ((const xmlChar *) "width")
  31 +#define COMP_HEIGHT_ATTR ((const xmlChar *) "height")
  32 +#define COMP_LAYER_ATTR ((const xmlChar *) "layer")
  33 +#define COMP_ZORDER_ATTR ((const xmlChar *) "zorder")
  34 +#define COMP_ALPHA_ATTR ((const xmlChar *) "alpha")
  35 +
  36 +}
  37 +#endif
... ...
include/my-atk-action.h 0 → 100644
... ... @@ -0,0 +1,63 @@
  1 +/*
  2 + * AT-SPI - Assistive Technology Service Provider Interface
  3 + * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
  4 + *
  5 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  6 + *
  7 + * This library is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Library General Public
  9 + * License as published by the Free Software Foundation; either
  10 + * version 2 of the License, or (at your option) any later version.
  11 + *
  12 + * This library is distributed in the hope that it will be useful,
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15 + * Library General Public License for more details.
  16 + *
  17 + * You should have received a copy of the GNU Library General Public
  18 + * License along with this library; if not, write to the
  19 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20 + * Boston, MA 02111-1307, USA.
  21 + */
  22 +
  23 +#ifndef MY_ATK_ACTION_H
  24 +#define MY_ATK_ACTION_H
  25 +
  26 +//#include <glib-2.0/glib.h>
  27 +//#include <glib-2.0/glib-object.h>
  28 +#include <atk/atk.h>
  29 +
  30 +#include "my-atk-object.h"
  31 +
  32 +#define MY_TYPE_ATK_ACTION (my_atk_action_get_type ())
  33 +#define MY_ATK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_ACTION, MyAtkAction))
  34 +#define MY_ATK_ACTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_ACTION, MyAtkActionClass))
  35 +#define MY_IS_ATK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_ACTION))
  36 +#define MY_IS_ATK_ACTION_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_ACTION))
  37 +#define MY_ATK_ACTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_ACTION, MyAtkActionClass))
  38 +
  39 +typedef struct _MyAtkAction MyAtkAction;
  40 +typedef struct _MyAtkActionPrivate MyAtkActionPrivate;
  41 +typedef struct _MyAtkActionClass MyAtkActionClass;
  42 +
  43 +typedef void (* MyAtkActionFunc) (MyAtkAction *action);
  44 +
  45 +struct _MyAtkAction {
  46 + MyAtkObject parent;
  47 + MyAtkActionPrivate *priv;
  48 + gint last_performed_action;//this field is changed when action is performed
  49 +
  50 +};
  51 +
  52 +struct _MyAtkActionClass {
  53 + MyAtkObjectClass parent;
  54 +};
  55 +
  56 +GType my_atk_action_get_type (void);
  57 +
  58 +guint my_atk_action_add_action (MyAtkAction *action,
  59 + const gchar *action_name,
  60 + const gchar *action_description,
  61 + const gchar *action_keybinding);
  62 +
  63 +#endif /*MY_ATK_ACTION_H*/
... ...
include/my-atk-component.h 0 → 100644
... ... @@ -0,0 +1,64 @@
  1 +/*
  2 + * AT-SPI - Assistive Technology Service Provider Interface
  3 + * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
  4 + *
  5 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  6 + *
  7 + * This library is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Library General Public
  9 + * License as published by the Free Software Foundation; either
  10 + * version 2 of the License, or (at your option) any later version.
  11 + *
  12 + * This library is distributed in the hope that it will be useful,
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15 + * Library General Public License for more details.
  16 + *
  17 + * You should have received a copy of the GNU Library General Public
  18 + * License along with this library; if not, write to the
  19 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20 + * Boston, MA 02111-1307, USA.
  21 + */
  22 +
  23 +
  24 +#ifndef MY_ATK_COMPONENT_H
  25 +#define MY_ATK_COMPONENT_H
  26 +
  27 +#include <atk/atk.h>
  28 +
  29 +#define MY_TYPE_ATK_COMPONENT (my_atk_component_get_type ())
  30 +#define MY_ATK_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_COMPONENT, MyAtkComponent))
  31 +#define MY_ATK_COMPONENT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_COMPONENT, MyAtkComponentClass))
  32 +#define MY_IS_ATK_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_COMPONENT))
  33 +#define MY_IS_ATK_COMPONENT_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_COMPONENT))
  34 +#define MY_ATK_COMPONENT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_COMPONENT, MyAtkComponentClass))
  35 +
  36 +typedef struct _MyAtkComponent MyAtkComponent;
  37 +typedef struct _MyAtkComponentClass MyAtkComponentClass;
  38 +
  39 +typedef void (* MyAtkComponentFunc) (MyAtkComponent *component);
  40 +
  41 +struct _MyAtkComponent {
  42 + MyAtkObject parent;
  43 + AtkRectangle extent;
  44 + gboolean extent_may_change;
  45 + gboolean is_manage_descendants;
  46 + AtkLayer layer;
  47 + gint zorder;
  48 + gdouble alpha;
  49 +};
  50 +
  51 +struct _MyAtkComponentClass {
  52 + MyAtkObjectClass parent;
  53 +};
  54 +
  55 +GType my_atk_component_get_type ();
  56 +
  57 +void my_atk_component_set_layer (AtkComponent *component, AtkLayer layer);
  58 +void my_atk_component_set_mdi_zorder (AtkComponent *component, gint mdi_zorder);
  59 +void my_atk_component_set_alpha (AtkComponent *component, gdouble alpha);
  60 +
  61 +gboolean my_atk_component_set_name (AtkComponent* object,
  62 + char *new_name);
  63 +
  64 +#endif /*MY_ATK_COMPONENT_H*/
... ...
include/my-atk-object.h 0 → 100644
... ... @@ -0,0 +1,63 @@
  1 +/*
  2 + * AT-SPI - Assistive Technology Service Provider Interface
  3 + * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
  4 + *
  5 + * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  6 + *
  7 + * This library is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Library General Public
  9 + * License as published by the Free Software Foundation; either
  10 + * version 2 of the License, or (at your option) any later version.
  11 + *
  12 + * This library is distributed in the hope that it will be useful,
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15 + * Library General Public License for more details.
  16 + *
  17 + * You should have received a copy of the GNU Library General Public
  18 + * License along with this library; if not, write to the
  19 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20 + * Boston, MA 02111-1307, USA.
  21 + */
  22 +
  23 +
  24 +#ifndef MY_ATK_OBJECT_H
  25 +#define MY_ATK_OBJECT_H
  26 +
  27 +#include <atk/atk.h>
  28 +
  29 +#define MY_TYPE_ATK_OBJECT (my_atk_object_get_type ())
  30 +#define MY_ATK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MY_TYPE_ATK_OBJECT, MyAtkObject))
  31 +#define MY_ATK_OBJECT_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), MY_TYPE_ATK_OBJECT, MyAtkObjectClass))
  32 +#define MY_IS_ATK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_ATK_OBJECT))
  33 +#define MY_IS_ATK_OBJECT_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), MY_TYPE_ATK_OBJECT))
  34 +#define MY_ATK_OBJECT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), MY_TYPE_ATK_OBJECT, MyAtkObjectClass))
  35 +
  36 +typedef struct _MyAtkObject MyAtkObject;