Commit 307e7706577a0da4e6888dccfcb213315e14e215

Authored by perry.werneck@gmail.com
1 parent 1f8ed5de

Work in progress

src/gtk/main.c
... ... @@ -31,6 +31,7 @@
31 31  
32 32 #include "globals.h"
33 33 #include "v3270/v3270.h"
  34 +#include "v3270/accessible.h"
34 35 #include <lib3270/popup.h>
35 36 #include <stdlib.h>
36 37  
... ...
src/gtk/pw3270-GTK.cbp
... ... @@ -7,8 +7,8 @@
7 7 <Option compiler="gcc" />
8 8 <Build>
9 9 <Target title="Debug">
10   - <Option output=".bin\Debug\pw3270-GTK" prefix_auto="1" extension_auto="1" />
11   - <Option object_output=".obj\Debug\" />
  10 + <Option output=".bin/Debug/pw3270-GTK" prefix_auto="1" extension_auto="1" />
  11 + <Option object_output=".obj/Debug/" />
12 12 <Option type="1" />
13 13 <Option compiler="gcc" />
14 14 <Compiler>
... ... @@ -17,8 +17,8 @@
17 17 </Compiler>
18 18 </Target>
19 19 <Target title="Release">
20   - <Option output=".bin\Release\pw3270-GTK" prefix_auto="1" extension_auto="1" />
21   - <Option object_output=".obj\Release\" />
  20 + <Option output=".bin/Release/pw3270-GTK" prefix_auto="1" extension_auto="1" />
  21 + <Option object_output=".obj/Release/" />
22 22 <Option type="0" />
23 23 <Option compiler="gcc" />
24 24 <Compiler>
... ... @@ -32,7 +32,7 @@
32 32 <Compiler>
33 33 <Add option="-Wall" />
34 34 <Add option="`pkg-config lib3270 gtk+-2.0 lib3270 --cflags`" />
35   - <Add directory="..\include" />
  35 + <Add directory="../include" />
36 36 </Compiler>
37 37 <Linker>
38 38 <Add option="`pkg-config lib3270 gtk+-2.0 lib3270 --libs`" />
... ... @@ -44,12 +44,12 @@
44 44 <Unit filename="colors.c">
45 45 <Option compilerVar="CC" />
46 46 </Unit>
47   - <Unit filename="common\common.h" />
48   - <Unit filename="common\common.h.in" />
49   - <Unit filename="common\config.c">
  47 + <Unit filename="common/common.h" />
  48 + <Unit filename="common/common.h.in" />
  49 + <Unit filename="common/config.c">
50 50 <Option compilerVar="CC" />
51 51 </Unit>
52   - <Unit filename="common\sources.mak" />
  52 + <Unit filename="common/sources.mak" />
53 53 <Unit filename="dialog.c">
54 54 <Option compilerVar="CC" />
55 55 </Unit>
... ... @@ -66,74 +66,78 @@
66 66 <Unit filename="print.c">
67 67 <Option compilerVar="CC" />
68 68 </Unit>
69   - <Unit filename="uiparser\accelerator.c">
  69 + <Unit filename="uiparser/accelerator.c">
70 70 <Option compilerVar="CC" />
71 71 </Unit>
72   - <Unit filename="uiparser\action.c">
  72 + <Unit filename="uiparser/action.c">
73 73 <Option compilerVar="CC" />
74 74 </Unit>
75   - <Unit filename="uiparser\menu.c">
  75 + <Unit filename="uiparser/menu.c">
76 76 <Option compilerVar="CC" />
77 77 </Unit>
78   - <Unit filename="uiparser\menubar.c">
  78 + <Unit filename="uiparser/menubar.c">
79 79 <Option compilerVar="CC" />
80 80 </Unit>
81   - <Unit filename="uiparser\menuitem.c">
  81 + <Unit filename="uiparser/menuitem.c">
82 82 <Option compilerVar="CC" />
83 83 </Unit>
84   - <Unit filename="uiparser\parsefile.c">
  84 + <Unit filename="uiparser/parsefile.c">
85 85 <Option compilerVar="CC" />
86 86 </Unit>
87   - <Unit filename="uiparser\parser.c">
  87 + <Unit filename="uiparser/parser.c">
88 88 <Option compilerVar="CC" />
89 89 </Unit>
90   - <Unit filename="uiparser\parser.h" />
91   - <Unit filename="uiparser\popup.c">
  90 + <Unit filename="uiparser/parser.h" />
  91 + <Unit filename="uiparser/popup.c">
92 92 <Option compilerVar="CC" />
93 93 </Unit>
94   - <Unit filename="uiparser\private.h" />
95   - <Unit filename="uiparser\script.c">
  94 + <Unit filename="uiparser/private.h" />
  95 + <Unit filename="uiparser/script.c">
96 96 <Option compilerVar="CC" />
97 97 </Unit>
98   - <Unit filename="uiparser\separator.c">
  98 + <Unit filename="uiparser/separator.c">
99 99 <Option compilerVar="CC" />
100 100 </Unit>
101   - <Unit filename="uiparser\sources.mak" />
102   - <Unit filename="uiparser\toolbar.c">
  101 + <Unit filename="uiparser/sources.mak" />
  102 + <Unit filename="uiparser/toolbar.c">
103 103 <Option compilerVar="CC" />
104 104 </Unit>
105   - <Unit filename="uiparser\toolitem.c">
  105 + <Unit filename="uiparser/toolitem.c">
106 106 <Option compilerVar="CC" />
107 107 </Unit>
108   - <Unit filename="v3270\clipboard.c">
  108 + <Unit filename="v3270/accessible.c">
109 109 <Option compilerVar="CC" />
110 110 </Unit>
111   - <Unit filename="v3270\draw.c">
  111 + <Unit filename="v3270/accessible.h" />
  112 + <Unit filename="v3270/clipboard.c">
112 113 <Option compilerVar="CC" />
113 114 </Unit>
114   - <Unit filename="v3270\genmarshal" />
115   - <Unit filename="v3270\iocallback.c">
  115 + <Unit filename="v3270/draw.c">
116 116 <Option compilerVar="CC" />
117 117 </Unit>
118   - <Unit filename="v3270\keyboard.c">
  118 + <Unit filename="v3270/genmarshal" />
  119 + <Unit filename="v3270/iocallback.c">
119 120 <Option compilerVar="CC" />
120 121 </Unit>
121   - <Unit filename="v3270\locked.xbm" />
122   - <Unit filename="v3270\marshal.c">
  122 + <Unit filename="v3270/keyboard.c">
123 123 <Option compilerVar="CC" />
124 124 </Unit>
125   - <Unit filename="v3270\marshal.h" />
126   - <Unit filename="v3270\mouse.c">
  125 + <Unit filename="v3270/locked.xbm" />
  126 + <Unit filename="v3270/marshal.c">
127 127 <Option compilerVar="CC" />
128 128 </Unit>
129   - <Unit filename="v3270\oia.c">
  129 + <Unit filename="v3270/marshal.h" />
  130 + <Unit filename="v3270/mouse.c">
130 131 <Option compilerVar="CC" />
131 132 </Unit>
132   - <Unit filename="v3270\private.h" />
133   - <Unit filename="v3270\sources.mak" />
134   - <Unit filename="v3270\unlocked.xbm" />
135   - <Unit filename="v3270\v3270.h" />
136   - <Unit filename="v3270\widget.c">
  133 + <Unit filename="v3270/oia.c">
  134 + <Option compilerVar="CC" />
  135 + </Unit>
  136 + <Unit filename="v3270/private.h" />
  137 + <Unit filename="v3270/sources.mak" />
  138 + <Unit filename="v3270/unlocked.xbm" />
  139 + <Unit filename="v3270/v3270.h" />
  140 + <Unit filename="v3270/widget.c">
137 141 <Option compilerVar="CC" />
138 142 </Unit>
139 143 <Unit filename="valgrind.suppression" />
... ...
src/gtk/v3270/accessible.c
... ... @@ -40,14 +40,17 @@
40 40  
41 41 /*--[ Prototipes ]-----------------------------------------------------------------------------------*/
42 42  
  43 +static void atk_component_interface_init (AtkComponentIface *iface);
43 44 static void atk_editable_text_interface_init (AtkEditableTextIface *iface);
  45 +
44 46 static void v3270_accessible_class_init (v3270AccessibleClass *klass);
45 47 static void v3270_accessible_init (v3270Accessible *widget);
46 48  
47 49 /*--[ Widget definition ]----------------------------------------------------------------------------*/
48 50  
49   -G_DEFINE_TYPE_WITH_CODE (v3270Accessible, v3270_accessible, GTK_TYPE_V3270_ACCESSIBLE,
50   - G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init) )
  51 +G_DEFINE_TYPE_WITH_CODE (v3270Accessible, v3270_accessible, GTK_TYPE_ACCESSIBLE,
  52 + G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init)
  53 + G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init) )
51 54  
52 55 // G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
53 56 // G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init)
... ... @@ -74,6 +77,20 @@ static void v3270_accessible_class_init(v3270AccessibleClass *klass)
74 77 */
75 78 }
76 79  
  80 +static void
  81 +atk_component_interface_init(AtkComponentIface *iface)
  82 +{
  83 +/*
  84 + iface->get_extents = gtk_widget_accessible_get_extents;
  85 + iface->get_size = gtk_widget_accessible_get_size;
  86 + iface->get_layer = gtk_widget_accessible_get_layer;
  87 + iface->grab_focus = gtk_widget_accessible_grab_focus;
  88 + iface->set_extents = gtk_widget_accessible_set_extents;
  89 + iface->set_position = gtk_widget_accessible_set_position;
  90 + iface->set_size = gtk_widget_accessible_set_size;
  91 +*/
  92 +}
  93 +
77 94 static void v3270_accessible_init(v3270Accessible *widget)
78 95 {
79 96 trace("*********************************** %s",__FUNCTION__);
... ...
src/gtk/v3270/widget.c
... ... @@ -57,10 +57,11 @@
57 57  
58 58 // http://git.gnome.org/browse/gtk+/tree/gtk/gtkdrawingarea.c?h=gtk-3-0
59 59  
60   -static void v3270_realize ( GtkWidget * widget);
  60 +static void v3270_realize ( GtkWidget * widget) ;
61 61 static void v3270_size_allocate ( GtkWidget * widget,
62   - GtkAllocation * allocation);
63   -static void v3270_send_configure ( v3270 * terminal);
  62 + GtkAllocation * allocation );
  63 +static void v3270_send_configure ( v3270 * terminal );
  64 +static AtkObject * v3270_get_accessible ( GtkWidget * widget );
64 65  
65 66 // Signals
66 67 static void v3270_activate (GtkWidget *widget);
... ... @@ -231,6 +232,9 @@ static void v3270_class_init(v3270Class *klass)
231 232 widget_class->motion_notify_event = v3270_motion_notify_event;
232 233 widget_class->popup_menu = v3270_popup_menu;
233 234  
  235 + /* Accessibility support */
  236 + widget_class->get_accessible = v3270_get_accessible;
  237 +
234 238 klass->activate = v3270_activate;
235 239 klass->toggle_changed = v3270_toggle_changed;
236 240 klass->message_changed = v3270_update_message;
... ... @@ -433,15 +437,6 @@ static void v3270_class_init(v3270Class *klass)
433 437 pw3270_VOID__VOID_BOOL,
434 438 G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
435 439  
436   -#ifdef DEBUG
437   - trace("%s: Acessibility check starts",__FUNCTION__);
438   - v3270_accessible_get_type();
439   - trace("%s: Acessibility check ends",__FUNCTION__);
440   -#endif // DEBUG
441   -
442   -#if GTK_CHECK_VERSION(3,0,0)
443   - gtk_widget_class_set_accessible_type(widget_class, GTK_TYPE_V3270_ACCESSIBLE);
444   -#endif
445 440 }
446 441  
447 442 void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int height)
... ... @@ -1102,4 +1097,18 @@ const GtkWidgetClass * v3270_get_parent_class(void)
1102 1097 return GTK_WIDGET_CLASS(v3270_parent_class);
1103 1098 }
1104 1099  
  1100 +static AtkObject * v3270_get_accessible(GtkWidget * widget)
  1101 +{
  1102 + v3270 * terminal = GTK_V3270(widget);
  1103 +
  1104 +// trace("%s acc=%p",__FUNCTION__,terminal->accessible);
  1105 +
  1106 + if(!terminal->accessible)
  1107 + {
  1108 + terminal->accessible = g_object_new(GTK_TYPE_V3270_ACCESSIBLE,NULL);
  1109 + atk_object_initialize(ATK_OBJECT(terminal->accessible), widget);
  1110 + }
  1111 +
  1112 + return ATK_OBJECT(terminal->accessible);
  1113 +}
1105 1114  
... ...