# magnifier.h

Go to the documentation of this file.

    00001 /*
    00002  * AT-SPI - Assistive Technology Service Provider Interface
    00003  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
    00004  *
    00005  * Copyright 2001 Sun Microsystems Inc.
    00006  *
    00007  * This library is free software; you can redistribute it and/or
    00008  * modify it under the terms of the GNU Library General Public
    00009  * License as published by the Free Software Foundation; either
    00010  * version 2 of the License, or (at your option) any later version.
    00011  *
    00012  * This library is distributed in the hope that it will be useful,
    00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015  * Library General Public License for more details.
    00016  *
    00017  * You should have received a copy of the GNU Library General Public
    00018  * License along with this library; if not, write to the
    00019  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00020  * Boston, MA 02111-1307, USA.
    00021  */
    00022
    00023 #ifndef MAGNIFIER_H_
    00024 #define MAGNIFIER_H_
    00025
    00026 #ifdef __cplusplus
    00027 extern "C" {
    00028 #endif /* __cplusplus */
    00029
    00030 #include "GNOME_Magnifier.h"
    00031
    00032 #include <glib.h>
    00033
    00034 #include <gdk/gdk.h>
    00035
    00036 #include <bonobo/bonobo-object.h>
    00037 #include <bonobo/bonobo-property-bag.h>
    00038
    00039 #include <login-helper/login-helper.h>
    00040
    00041 #include <dbus/dbus-glib.h>
    00042
    00043 #define MAGNIFIER_TYPE         (magnifier_get_type ())
    00044 #define MAGNIFIER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), MAGNIFIER_TYPE, Magnifier))
    00045 #define MAGNIFIER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), MAGNIFIER_TYPE, MagnifierClass))
    00046 #define IS_MAGNIFIER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), MAGNIFIER_TYPE))
    00047 #define IS_MAGNIFIER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), MAGNIFIER_TYPE))
    00048 #define MAGNIFIER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MAGNIFIER_TYPE, MagnifierClass))
    00049
    00050 #define MAGNIFIER_OAFIID "OAFIID:GNOME_Magnifier_Magnifier:0.9"
    00051
    00052 typedef struct _MagnifierPrivate MagnifierPrivate;
    00053
    00054 typedef struct {
    00055         gint32 x1;
    00056         gint32 y1;
    00057         gint32 x2;
    00058         gint32 y2;
    00059 } RectBounds;
    00060
    00061 typedef struct {
    00062         gint32 x;
    00063         gint32 y;
    00064 } Point;
    00065
    00066 typedef struct {
    00067         BonoboObject       parent;
    00068         BonoboPropertyBag *property_bag;
    00069         GdkDisplay        *source_display;
    00070         GdkDisplay        *target_display;
    00071         gchar             *source_display_name;
    00072         gchar             *target_display_name;
    00073         int                source_screen_num;
    00074         int                target_screen_num;
    00075         GList             *zoom_regions;
    00076         GList             *zoom_regions_dbus;
    00077         gboolean           source_initialized;
    00078         gint               crosswire_size;
    00079         gint               crosswire_length;
    00080         guint32            crosswire_color;
    00081         gboolean           crosswire_clip;
    00082         gchar             *cursor_set;
    00083         gint               cursor_size_x;
    00084         gint               cursor_size_y;
    00085         guint32            cursor_color;
    00086         float              cursor_scale_factor;
    00087         GNOME_Magnifier_RectBounds source_bounds;
    00088         GNOME_Magnifier_RectBounds target_bounds;
    00089         GNOME_Magnifier_Point      cursor_hotspot;
    00090         MagnifierPrivate  *priv;
    00091 } Magnifier;
    00092
    00093 typedef struct {
    00094         BonoboObjectClass                   parent_class;
    00095         POA_GNOME_Magnifier_Magnifier__epv  epv;
    00096         DBusGConnection                    *connection;
    00097 } MagnifierClass;
    00098
    00099 /*
    00100  * When running the magnifier in timing test mode (--timing-pan-rate and/or
    00101  * --timing-iterations), then the following output is displayed:
    00102  *
    00103  * Pan Rate           = 200
    00104  * Frames Processed   = 1225
    00105  * Width/Height/Depth = 640/1024/8
    00106  * Zoom Factor (x/y)  = 3.000000/3.000000
    00107  * Update Duration    = (avg. 0.010232) (max. 0.002685) (tot. 1.084589) seconds
    00108  *   Update Pixels    = (avg. 3046) pixels/frame
    00109  *   Update Rate      = (avg. 97.732909) (max. 372.439485) updates/second
    00110  *   Net Update Rate  = (avg. 0.297724) (max. 0.457741) Mpex/second
    00111  * Pan Latency        = (avg. 0.008229) (max. 0.562326) seconds
    00112  * Tot Frame Duration = (avg. 0.008363) (max. 0.562485) (tot. 10.235981)seconds
    00113  * Frame Rate         = (avg. 119.578189) (max. 4854.369141) frames/second
    00114  * Scroll Delta (x)   = (avg. 0.000000) (tot. 0) lines
    00115  * Scroll Delta (y)   = (avg. 5.019608) (tot. 6144) lines
    00116  * Scroll Rate (x)    = (avg. 0.000000) lines/second
    00117  * Scroll Rate (y)    = (avg. 600.235657) lines/second
    00118  * Net Render Rate    = (avg. 8.685322) (max. 3181.359360) Mpex/second
    00119  *
    00120  * Pan Rate             - Displays the pan rate specified on the command line.
    00121  *                        Only displayed if --timing-pan-rate is used.
    00122  * Frames Processed     - Number of frames displayed
    00123  * Width/Height/Depth   - The width/height/depth of magnifier display.
    00124  * Zoom Factor (x/y)    - The zoom factor used.
    00125  * Update Duration      - Average and total time spent updating new sections of
    00126  *                        the screen.
    00127  *   Update Pixels      - Number of pixels updated
    00128  *   Update Rate        - Number of updates possible per second.
    00129  *   Net Update Rate    - Number of Megapixels updated per second.
    00130  * Pan Latency          - Time spent from the beginning of the setROI request
    00131  *                        until GTK+ has finished processing the update (in
    00132  *                        GDK's gdk_window_update_idle idle handler.
    00133  * Total Frame Duration - Average and total time processing frames.
    00134  * Frame Rate           - Number of frames per second.
    00135  * Scroll Delta         - Average and total number of lines scrolled.
    00136  * Scroll Rate          - Number of lines scrolled per second.  Note that this
    00137  *                        value will be equal to the --timing-pan-rate value
    00138  *                        times the y zoom factor.
    00139  * Net Render Rate      - Number of Megapixels processed per second.
    00140  *
    00141  * When running with the --timing-output argument, similar information is
    00142  * displayed for each frame plus timing information for the frame.  Update
    00143  * information is not displayed for frames where updates do not occur.  Pan
    00144  * Rate, Frames Processed, and Width/Height/Depth is not displayed for each
    00145  * frame, only when displaying summary information.
    00146  */
    00147
    00148 typedef struct timing {
    00149         GTimer  *process;
    00150         GTimer  *frame;
    00151         GTimer  *scale;
    00152         GTimer  *idle;
    00153         gdouble scale_val;
    00154         gdouble idle_val;
    00155         gdouble frame_val;
    00156         int     dx;
    00157         int     dy;
    00158         gdouble scale_total;
    00159         gdouble idle_total;
    00160         gdouble frame_total;
    00161         int     dx_total;
    00162         int     dy_total;
    00163         long    update_pixels_total;
    00164         long    num_scale_samples;
    00165         long    num_idle_samples;
    00166         long    num_frame_samples;
    00167         long    num_line_samples;
    00168         gdouble last_frame_val;
    00169         int     last_dy;
    00170 } TimingStruct;
    00171
    00172 TimingStruct mag_timing;
    00173
    00174 GdkDrawable *magnifier_get_cursor    (Magnifier *magnifier);
    00175 GType        magnifier_get_type      (void);
    00176 GdkWindow   *magnifier_get_root      (Magnifier *magnifier);
    00177 Magnifier   *magnifier_new           (gboolean override_redirect);
    00178 void         magnifier_notify_damage (Magnifier *magnifier,
    00179                                       GdkRectangle *rect);
    00180 void         magnifier_set_cursor_from_pixbuf (Magnifier *magnifier,
    00181                                                GdkPixbuf *pointer_pixbuf);
    00182 void         magnifier_set_cursor_pixmap_by_name (Magnifier *magnifier,
    00183                                                   const gchar *cursor_name,
    00184                                                   gboolean source_fallback);
    00185 void         magnifier_transform_cursor (Magnifier *magnifier);
    00186 void         magnifier_zoom_regions_update_pointer (Magnifier *magnifier);
    00187 gboolean     magnifier_full_screen_capable (Magnifier *magnifier);
    00188
    00189 /* D-BUS methods */
    00190 gboolean        impl_dbus_magnifier_full_screen_capable (Magnifier *magnifier);
    00191 gboolean        impl_dbus_magnifier_hide_cursor (Magnifier *magnifier);
    00192 gboolean        impl_dbus_magnifier_show_cursor (Magnifier *magnifier);
    00193 gboolean        impl_dbus_magnifier_support_colorblind_filters (Magnifier *magnifier);
    00194 gchar*          impl_dbus_magnifier_create_zoom_region (Magnifier *magnifier, const double zx, const double zy,
    00195                         const gint32 **roi, const gint32 **viewport);
    00196 gchar**         impl_dbus_magnifier_get_zoom_regions (Magnifier *magnifier);
    00197 gboolean        impl_dbus_magnifier_add_zoom_region (Magnifier *magnifier, gchar *zoom_region_path);
    00198 gboolean        impl_dbus_magnifier_clear_all_zoom_regions (Magnifier *magnifier);
    00199 gboolean        impl_dbus_magnifier_dispose (Magnifier *magnifier);
    00200 gboolean        impl_dbus_magnifier_set_source_display (Magnifier *magnifier, gchar *source_display);
    00201 gchar*          impl_dbus_magnifier_get_source_display (Magnifier *magnifier);
    00202 gboolean        impl_dbus_magnifier_set_target_display (Magnifier *magnifier, gchar *target_display);
    00203 gchar*          impl_dbus_magnifier_get_target_display (Magnifier *magnifier);
    00204 gboolean        impl_dbus_magnifier_set_source_size (Magnifier *magnifier, gint32 **bounds);
    00205 GArray*         impl_dbus_magnifier_get_source_size (Magnifier *magnifier);
    00206 gboolean        impl_dbus_magnifier_set_target_size (Magnifier *magnifier, gint32 **bounds);
    00207 GArray*         impl_dbus_magnifier_get_target_size (Magnifier *magnifier);
    00208 gboolean        impl_dbus_magnifier_set_cursor_set (Magnifier *magnifier, gchar *cursor_set);
    00209 gchar*          impl_dbus_magnifier_get_cursor_set (Magnifier *magnifier);
    00210 gboolean        impl_dbus_magnifier_set_cursor_size (Magnifier *magnifier, gint x, gint y);
    00211 GArray*         impl_dbus_magnifier_get_cursor_size (Magnifier *magnifier);
    00212 gboolean        impl_dbus_magnifier_set_cursor_zoom (Magnifier *magnifier, double factor);
    00213 double          impl_dbus_magnifier_get_cursor_zoom (Magnifier *magnifier);
    00214 gboolean        impl_dbus_magnifier_set_cursor_color (Magnifier *magnifier, guint32 color);
    00215 guint32         impl_dbus_magnifier_get_cursor_color (Magnifier *magnifier);
    00216 gboolean        impl_dbus_magnifier_set_cursor_hotspot (Magnifier *magnifier, gint32 x, gint32 y);
    00217 GArray*         impl_dbus_magnifier_get_cursor_hotspot (Magnifier *magnifier);
    00218 gint32          impl_dbus_magnifier_get_cursor_default_size (Magnifier *magnifier);
    00219 gboolean        impl_dbus_magnifier_set_crosswire_size (Magnifier *magnifier, gint size);
    00220 gint            impl_dbus_magnifier_get_crosswire_size (Magnifier *magnifier);
    00221 gboolean        impl_dbus_magnifier_set_crosswire_length (Magnifier *magnifier, gint length);
    00222 gint            impl_dbus_magnifier_get_crosswire_length (Magnifier *magnifier);
    00223 gboolean        impl_dbus_magnifier_set_crosswire_clip (Magnifier *magnifier, gboolean clip);
    00224 gboolean        impl_dbus_magnifier_get_crosswire_clip (Magnifier *magnifier);
    00225 gboolean        impl_dbus_magnifier_set_crosswire_color (Magnifier *magnifier, guint32 color);
    00226 guint32         impl_dbus_magnifier_get_crosswire_color (Magnifier *magnifier);
    00227
    00228 #ifdef __cplusplus
    00229 }
    00230 #endif /* __cplusplus */
    00231
    00232 #endif /* MAGNIFIER_H_ */