3 static void _check_position (AtkObject *obj);
5 static void _check_position (AtkObject *obj)
7 AtkObject *parent, *ret_object;
9 gint x, y, width, height;
10 gint x1, y1, width1, height1;
12 x = y = width = height = 0;
13 x1 = y1 = width1 = height1 = 0;
15 if (!ATK_IS_COMPONENT (obj))
18 atk_component_get_extents (ATK_COMPONENT(obj), &x, &y, &width, &height, ATK_XY_SCREEN);
19 atk_component_get_position (ATK_COMPONENT(obj), &x1, &y1, ATK_XY_SCREEN );
20 atk_component_get_size (ATK_COMPONENT(obj), &width1, &height1);
21 if ((x1 != x) || (y1 != y))
23 g_print ("atk_component_get_extents and atk_get_position give different"
24 " values: %d,%d %d,%d\n", x, y, x1, y1);
26 if ((width1 != width) || (height1 != height))
28 g_print ("atk_component_get_extents and atk_get_size give different"
29 " values: %d,%d %d,%d\n", width, height, width1, height1);
32 atk_component_get_position (ATK_COMPONENT(obj), &x1, &y1, ATK_XY_SCREEN);
33 g_print ("Object Type: %s\n", g_type_name (G_OBJECT_TYPE (obj)));
34 g_print ("Object at %d, %d on screen\n", x1, y1);
35 g_print ("Object at %d, %d, size: %d, %d\n", x, y, width, height);
37 parent = atk_object_get_parent (obj);
39 if (ATK_IS_COMPONENT (parent))
41 gint px, py, pwidth, pheight;
43 atk_component_get_extents (ATK_COMPONENT(parent),
44 &px, &py, &pwidth, &pheight, ATK_XY_SCREEN);
45 g_print ("Parent Type: %s\n", g_type_name (G_OBJECT_TYPE (parent)));
46 g_print ("Parent at %d, %d, size: %d, %d\n", px, py, pwidth, pheight);
47 ret_object = atk_component_ref_accessible_at_point (ATK_COMPONENT (parent),
52 g_print ("1:atk_component_ref_accessible_at_point returns NULL\n");
54 else if (ret_object != obj)
56 g_print ("1:atk_component_ref_accessible_at_point returns wrong value for %d %d\n",
58 atk_component_get_extents (ATK_COMPONENT(ret_object),
59 &px, &py, &pwidth, &pheight, ATK_XY_SCREEN);
60 g_print ("ret_object at %d, %d, size: %d, %d\n", px, py, pwidth, pheight);
63 g_object_unref (G_OBJECT (ret_object));
64 ret_object = atk_component_ref_accessible_at_point (ATK_COMPONENT (parent),
65 x+width-1, y+height-1, ATK_XY_SCREEN);
68 g_print ("2:atk_component_ref_accessible_at_point returns NULL\n");
70 else if (ret_object != obj)
72 g_print ("2:atk_component_ref_accessible_at_point returns wrong value for %d %d\n",
73 x+width-1, y+height-1);
76 g_object_unref (G_OBJECT (ret_object));
77 ret_object = atk_component_ref_accessible_at_point (ATK_COMPONENT (parent),
78 x-1, y-1, ATK_XY_SCREEN);
79 if ((ret_object) && (ret_object == obj))
81 g_print ("3:atk_component_ref_accessible_at_point returns wrong value for %d %d\n",
85 g_object_unref (G_OBJECT (ret_object));
86 ret_object = atk_component_ref_accessible_at_point (ATK_COMPONENT (parent),
87 x+width, y+height, ATK_XY_SCREEN);
88 if ((ret_object) && (ret_object == obj))
90 g_print ("4:atk_component_ref_accessible_at_point returns wrong value for %d %d\n",
94 g_object_unref (G_OBJECT (ret_object));
96 if (!atk_component_contains (ATK_COMPONENT(obj), x, y, ATK_XY_SCREEN))
97 g_print ("Component does not contain position, %d %d\n", x, y);
98 if (atk_component_contains (ATK_COMPONENT(obj), x-1, y-1, ATK_XY_SCREEN))
99 g_print ("Component does contain position, %d %d\n", x-1, y-1);
100 if (!atk_component_contains (ATK_COMPONENT(obj), x+width-1, y+height-1, ATK_XY_SCREEN))
101 g_print ("Component does not contain position, %d %d\n",
102 x+width-1, y+height-1);
103 if (atk_component_contains (ATK_COMPONENT(obj), x+width, y+height, ATK_XY_SCREEN))
104 g_print ("Component does contain position, %d %d\n", x+width, y+height);
108 _create_event_watcher (void)
110 atk_add_focus_tracker (_check_position);
114 gtk_module_init(gint argc, char* argv[])
116 g_print("testcomponent Module loaded\n");
118 _create_event_watcher();