gnome-mag
magnifier.h
Go to the documentation of this file.
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001 Sun Microsystems Inc.
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 MAGNIFIER_H_
24 #define MAGNIFIER_H_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
29 
30 #include "GNOME_Magnifier.h"
31 
32 #include <glib.h>
33 
34 #include <gdk/gdk.h>
35 
36 #include <bonobo/bonobo-object.h>
37 #include <bonobo/bonobo-property-bag.h>
38 
39 #include <login-helper/login-helper.h>
40 
41 #include <dbus/dbus-glib.h>
42 
43 #define MAGNIFIER_TYPE (magnifier_get_type ())
44 #define MAGNIFIER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MAGNIFIER_TYPE, Magnifier))
45 #define MAGNIFIER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MAGNIFIER_TYPE, MagnifierClass))
46 #define IS_MAGNIFIER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MAGNIFIER_TYPE))
47 #define IS_MAGNIFIER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MAGNIFIER_TYPE))
48 #define MAGNIFIER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MAGNIFIER_TYPE, MagnifierClass))
49 
50 #define MAGNIFIER_OAFIID "OAFIID:GNOME_Magnifier_Magnifier:0.9"
51 
53 
54 typedef struct {
55  gint32 x1;
56  gint32 y1;
57  gint32 x2;
58  gint32 y2;
59 } RectBounds;
60 
61 typedef struct {
62  gint32 x;
63  gint32 y;
64 } Point;
65 
66 typedef struct {
67  BonoboObject parent;
68  BonoboPropertyBag *property_bag;
69  GdkDisplay *source_display;
70  GdkDisplay *target_display;
75  GList *zoom_regions;
80  guint32 crosswire_color;
81  gboolean crosswire_clip;
82  gchar *cursor_set;
85  guint32 cursor_color;
91 } Magnifier;
92 
93 typedef struct {
94  BonoboObjectClass parent_class;
96  DBusGConnection *connection;
98 
99 /*
100  * When running the magnifier in timing test mode (--timing-pan-rate and/or
101  * --timing-iterations), then the following output is displayed:
102  *
103  * Pan Rate = 200
104  * Frames Processed = 1225
105  * Width/Height/Depth = 640/1024/8
106  * Zoom Factor (x/y) = 3.000000/3.000000
107  * Update Duration = (avg. 0.010232) (max. 0.002685) (tot. 1.084589) seconds
108  * Update Pixels = (avg. 3046) pixels/frame
109  * Update Rate = (avg. 97.732909) (max. 372.439485) updates/second
110  * Net Update Rate = (avg. 0.297724) (max. 0.457741) Mpex/second
111  * Pan Latency = (avg. 0.008229) (max. 0.562326) seconds
112  * Tot Frame Duration = (avg. 0.008363) (max. 0.562485) (tot. 10.235981)seconds
113  * Frame Rate = (avg. 119.578189) (max. 4854.369141) frames/second
114  * Scroll Delta (x) = (avg. 0.000000) (tot. 0) lines
115  * Scroll Delta (y) = (avg. 5.019608) (tot. 6144) lines
116  * Scroll Rate (x) = (avg. 0.000000) lines/second
117  * Scroll Rate (y) = (avg. 600.235657) lines/second
118  * Net Render Rate = (avg. 8.685322) (max. 3181.359360) Mpex/second
119  *
120  * Pan Rate - Displays the pan rate specified on the command line.
121  * Only displayed if --timing-pan-rate is used.
122  * Frames Processed - Number of frames displayed
123  * Width/Height/Depth - The width/height/depth of magnifier display.
124  * Zoom Factor (x/y) - The zoom factor used.
125  * Update Duration - Average and total time spent updating new sections of
126  * the screen.
127  * Update Pixels - Number of pixels updated
128  * Update Rate - Number of updates possible per second.
129  * Net Update Rate - Number of Megapixels updated per second.
130  * Pan Latency - Time spent from the beginning of the setROI request
131  * until GTK+ has finished processing the update (in
132  * GDK's gdk_window_update_idle idle handler.
133  * Total Frame Duration - Average and total time processing frames.
134  * Frame Rate - Number of frames per second.
135  * Scroll Delta - Average and total number of lines scrolled.
136  * Scroll Rate - Number of lines scrolled per second. Note that this
137  * value will be equal to the --timing-pan-rate value
138  * times the y zoom factor.
139  * Net Render Rate - Number of Megapixels processed per second.
140  *
141  * When running with the --timing-output argument, similar information is
142  * displayed for each frame plus timing information for the frame. Update
143  * information is not displayed for frames where updates do not occur. Pan
144  * Rate, Frames Processed, and Width/Height/Depth is not displayed for each
145  * frame, only when displaying summary information.
146  */
147 
148 typedef struct timing {
149  GTimer *process;
150  GTimer *frame;
151  GTimer *scale;
152  GTimer *idle;
153  gdouble scale_val;
154  gdouble idle_val;
155  gdouble frame_val;
156  int dx;
157  int dy;
158  gdouble scale_total;
159  gdouble idle_total;
160  gdouble frame_total;
161  int dx_total;
162  int dy_total;
168  gdouble last_frame_val;
169  int last_dy;
170 } TimingStruct;
171 
173 
174 GdkDrawable *magnifier_get_cursor (Magnifier *magnifier);
175 GType magnifier_get_type (void);
176 GdkWindow *magnifier_get_root (Magnifier *magnifier);
177 Magnifier *magnifier_new (gboolean override_redirect);
178 void magnifier_notify_damage (Magnifier *magnifier,
179  GdkRectangle *rect);
181  GdkPixbuf *pointer_pixbuf);
183  const gchar *cursor_name,
184  gboolean source_fallback);
185 void magnifier_transform_cursor (Magnifier *magnifier);
187 gboolean magnifier_full_screen_capable (Magnifier *magnifier);
188 
189 /* D-BUS methods */
191 gboolean impl_dbus_magnifier_hide_cursor (Magnifier *magnifier);
192 gboolean impl_dbus_magnifier_show_cursor (Magnifier *magnifier);
194 gchar* impl_dbus_magnifier_create_zoom_region (Magnifier *magnifier, const double zx, const double zy,
195  const gint32 **roi, const gint32 **viewport);
197 gboolean impl_dbus_magnifier_add_zoom_region (Magnifier *magnifier, gchar *zoom_region_path);
199 gboolean impl_dbus_magnifier_dispose (Magnifier *magnifier);
200 gboolean impl_dbus_magnifier_set_source_display (Magnifier *magnifier, gchar *source_display);
202 gboolean impl_dbus_magnifier_set_target_display (Magnifier *magnifier, gchar *target_display);
204 gboolean impl_dbus_magnifier_set_source_size (Magnifier *magnifier, gint32 **bounds);
206 gboolean impl_dbus_magnifier_set_target_size (Magnifier *magnifier, gint32 **bounds);
208 gboolean impl_dbus_magnifier_set_cursor_set (Magnifier *magnifier, gchar *cursor_set);
210 gboolean impl_dbus_magnifier_set_cursor_size (Magnifier *magnifier, gint x, gint y);
212 gboolean impl_dbus_magnifier_set_cursor_zoom (Magnifier *magnifier, double factor);
214 gboolean impl_dbus_magnifier_set_cursor_color (Magnifier *magnifier, guint32 color);
216 gboolean impl_dbus_magnifier_set_cursor_hotspot (Magnifier *magnifier, gint32 x, gint32 y);
219 gboolean impl_dbus_magnifier_set_crosswire_size (Magnifier *magnifier, gint size);
221 gboolean impl_dbus_magnifier_set_crosswire_length (Magnifier *magnifier, gint length);
223 gboolean impl_dbus_magnifier_set_crosswire_clip (Magnifier *magnifier, gboolean clip);
225 gboolean impl_dbus_magnifier_set_crosswire_color (Magnifier *magnifier, guint32 color);
227 
228 #ifdef __cplusplus
229 }
230 #endif /* __cplusplus */
231 
232 #endif /* MAGNIFIER_H_ */