Magnification utility enhancements.
authorbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Tue, 12 Feb 2002 14:11:46 +0000 (14:11 +0000)
committerbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Tue, 12 Feb 2002 14:11:46 +0000 (14:11 +0000)
git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@236 e2bd861d-eb25-0410-b326-f6ed22b6b98c

18 files changed:
ChangeLog
docs/reference/cspi/tmpl/spi_accessible.sgml
docs/reference/cspi/tmpl/spi_action.sgml
docs/reference/cspi/tmpl/spi_component.sgml
docs/reference/cspi/tmpl/spi_editabletext.sgml
docs/reference/cspi/tmpl/spi_hyperlink.sgml
docs/reference/cspi/tmpl/spi_hypertext.sgml
docs/reference/cspi/tmpl/spi_image.sgml
docs/reference/cspi/tmpl/spi_registry.sgml
docs/reference/cspi/tmpl/spi_selection.sgml
docs/reference/cspi/tmpl/spi_table.sgml
docs/reference/cspi/tmpl/spi_text.sgml
test/demo.csh
util/mag_client.h
util/mag_control.c
util/mag_image.c
util/mag_image.h
util/magnifier.c

index 49a39f6..d44a24f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,36 @@
+2002-02-12 Bill Haneman <bill.haneman@sun.com>
+
+       Magnification Utility Enhancements:
+       
+       * util/magnifier.c:
+       Added implementation of createZoomRegion, clearAllZoomRegions,
+       resizeZoomRegion.  Added new commandline argument
+       "--no-initial-region".  Note that clearAllZoomRegions doesn't
+       unmap the old '0' region as it should (yet), and the other
+       methods only work when creating/resizing a single region,
+       which is "region 0".  
+       (Code for multiple region support will be added later.)
+
+       * util/mag_image.c:
+       Now we raise the magnifier window each time it's refreshed;
+       this will help keep it on top.
+       
+       * util/mag_client.h:
+       Added simple wrappers for above, used by mag_control.
+       For general use, it's recommended to use the bonobo magnifier
+       control API directly instead of using these wrappers.
+
+       * util/mag_image.h:
+       Moved ZoomRegionData from magnifier.c to this file.
+       
+       * util/mag_control.c: 
+       Added some code to exercise new IDL implementations.
+       
 2002-02-06 Marc Mulcahy <marc.mulcahy@sun.com>
 
        * libspi/text.c: Provide implementation for getAttributes.
 
-       2002-02-04  Bill Haneman <bill.haneman@sun.com>
+2002-02-04  Bill Haneman <bill.haneman@sun.com>
        
        * configure.in:
        Incremented revision.
index 449ffe5..f177805 100644 (file)
@@ -76,9 +76,8 @@ Accessible Objects
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @childIndex: 
+@Returns: 
 
 
 <!-- ##### FUNCTION Accessible_getIndexInParent ##### -->
index e9b2142..4674885 100644 (file)
@@ -49,9 +49,8 @@ AccessibleAction Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @i: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleAction_getKeyBinding ##### -->
@@ -60,9 +59,8 @@ AccessibleAction Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @i: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleAction_getName ##### -->
@@ -71,9 +69,8 @@ AccessibleAction Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @i: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleAction_getDescription ##### -->
@@ -82,8 +79,7 @@ AccessibleAction Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @i: 
+@Returns: 
 
 
index bba2e1d..b6a1372 100644 (file)
@@ -62,11 +62,10 @@ AccessibleComponent Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @x: 
 @y: 
 @ctype: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleComponent_getAccessibleAtPoint ##### -->
@@ -75,11 +74,10 @@ AccessibleComponent Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @x: 
 @y: 
 @ctype: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleComponent_getExtents ##### -->
@@ -88,7 +86,6 @@ AccessibleComponent Interface
 </para>
 
 @obj: 
-<!-- # Unused Parameters # -->
 @x: 
 @y: 
 @width: 
@@ -102,7 +99,6 @@ AccessibleComponent Interface
 </para>
 
 @obj: 
-<!-- # Unused Parameters # -->
 @x: 
 @y: 
 @ctype: 
@@ -114,7 +110,6 @@ AccessibleComponent Interface
 </para>
 
 @obj: 
-<!-- # Unused Parameters # -->
 @width: 
 @height: 
 
index 8fa6fdd..730d515 100644 (file)
@@ -40,10 +40,9 @@ AccessibleEditableText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @startPos: 
 @endPos: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleEditableText_deleteText ##### -->
@@ -52,10 +51,9 @@ AccessibleEditableText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @startPos: 
 @endPos: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleEditableText_insertText ##### -->
@@ -64,11 +62,10 @@ AccessibleEditableText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @position: 
 @text: 
 @length: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleEditableText_cutText ##### -->
@@ -77,10 +74,9 @@ AccessibleEditableText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @startPos: 
 @endPos: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleEditableText_pasteText ##### -->
@@ -89,9 +85,8 @@ AccessibleEditableText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @position: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleEditableText_setTextContents ##### -->
@@ -111,9 +106,8 @@ AccessibleEditableText Interface
 
 @obj: 
 @attributes: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @startOffset: 
 @endOffset: 
+@Returns: 
 
 
index 2f923b0..8d03b55 100644 (file)
@@ -45,7 +45,6 @@ AccessibleHyperlink Interface
 </para>
 
 @obj: 
-<!-- # Unused Parameters # -->
 @startIndex: 
 @endIndex: 
 
@@ -56,9 +55,8 @@ AccessibleHyperlink Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @i: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleHyperlink_getURI ##### -->
@@ -67,9 +65,8 @@ AccessibleHyperlink Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @i: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleHyperlink_isValid ##### -->
index 30d313a..5a7f2c0 100644 (file)
@@ -49,9 +49,8 @@ AccessibleHypertext Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @linkIndex: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleHypertext_getLinkIndex ##### -->
@@ -60,8 +59,7 @@ AccessibleHypertext Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @characterOffset: 
+@Returns: 
 
 
index f666d78..32f036e 100644 (file)
@@ -49,7 +49,6 @@ AccessibleImage Interface
 </para>
 
 @obj: 
-<!-- # Unused Parameters # -->
 @width: 
 @height: 
 
@@ -60,7 +59,6 @@ AccessibleImage Interface
 </para>
 
 @obj: 
-<!-- # Unused Parameters # -->
 @x: 
 @y: 
 @ctype: 
@@ -72,7 +70,6 @@ AccessibleImage Interface
 </para>
 
 @obj: 
-<!-- # Unused Parameters # -->
 @x: 
 @y: 
 @width: 
index fb55349..09ab7cd 100644 (file)
@@ -195,11 +195,10 @@ Registry queries
 
 </para>
 
-@Returns: 
-<!-- # Unused Parameters # -->
 @keyval: 
 @keystring: 
 @synth_type: 
+@Returns: 
 
 
 <!-- ##### FUNCTION SPI_generateMouseEvent ##### -->
@@ -207,10 +206,9 @@ Registry queries
 
 </para>
 
-@Returns: 
-<!-- # Unused Parameters # -->
 @x: 
 @y: 
 @name: 
+@Returns: 
 
 
index 2668a50..d46f4ae 100644 (file)
@@ -49,9 +49,8 @@ AccessibleSelection Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @selectedChildIndex: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleSelection_selectChild ##### -->
@@ -60,9 +59,8 @@ AccessibleSelection Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @childIndex: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleSelection_isChildSelected ##### -->
@@ -71,9 +69,8 @@ AccessibleSelection Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @childIndex: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleSelection_deselectSelectedChild ##### -->
@@ -82,9 +79,8 @@ AccessibleSelection Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @selectedChildIndex: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleSelection_clearSelection ##### -->
index 38d142a..331c16a 100644 (file)
@@ -40,10 +40,9 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @row: 
 @column: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_getCaption ##### -->
@@ -61,9 +60,8 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @index: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_getColumnDescription ##### -->
@@ -72,9 +70,8 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @column: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_getColumnExtentAt ##### -->
@@ -83,10 +80,9 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @row: 
 @column: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_getColumnHeader ##### -->
@@ -95,9 +91,8 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @column: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_getIndexAt ##### -->
@@ -106,10 +101,9 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @row: 
 @column: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_getNColumns ##### -->
@@ -154,9 +148,8 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @index: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_getRowDescription ##### -->
@@ -165,9 +158,8 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @row: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_getRowExtentAt ##### -->
@@ -176,10 +168,9 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @row: 
 @column: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_getRowHeader ##### -->
@@ -188,9 +179,8 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @row: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_getSelectedRows ##### -->
@@ -199,9 +189,8 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @selectedRows: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_getSelectedColumns ##### -->
@@ -210,9 +199,8 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @selectedColumns: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_getSummary ##### -->
@@ -230,9 +218,8 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @column: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_isRowSelected ##### -->
@@ -241,9 +228,8 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @row: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleTable_isSelected ##### -->
@@ -252,9 +238,8 @@ AccessibleTable Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @row: 
 @column: 
+@Returns: 
 
 
index b3bc9dd..c4e6c77 100644 (file)
@@ -55,10 +55,9 @@ AccessibleText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @startOffset: 
 @endOffset: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleText_getAttributes ##### -->
@@ -67,11 +66,10 @@ AccessibleText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @offset: 
 @startOffset: 
 @endOffset: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleText_getCaretOffset ##### -->
@@ -98,7 +96,6 @@ AccessibleText Interface
 </para>
 
 @obj: 
-<!-- # Unused Parameters # -->
 @offset: 
 @x: 
 @y: 
@@ -122,11 +119,10 @@ AccessibleText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @x: 
 @y: 
 @type: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleText_getSelection ##### -->
@@ -135,7 +131,6 @@ AccessibleText Interface
 </para>
 
 @obj: 
-<!-- # Unused Parameters # -->
 @selectionNum: 
 @startOffset: 
 @endOffset: 
@@ -147,10 +142,9 @@ AccessibleText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @startOffset: 
 @endOffset: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleText_getTextBeforeOffset ##### -->
@@ -159,12 +153,11 @@ AccessibleText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @offset: 
 @type: 
 @startOffset: 
 @endOffset: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleText_getTextAfterOffset ##### -->
@@ -173,12 +166,11 @@ AccessibleText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @offset: 
 @type: 
 @startOffset: 
 @endOffset: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleText_getTextAtOffset ##### -->
@@ -187,12 +179,11 @@ AccessibleText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @offset: 
 @type: 
 @startOffset: 
 @endOffset: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleText_removeSelection ##### -->
@@ -201,9 +192,8 @@ AccessibleText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @selectionNum: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleText_setCaretOffset ##### -->
@@ -212,9 +202,8 @@ AccessibleText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @newOffset: 
+@Returns: 
 
 
 <!-- ##### FUNCTION AccessibleText_setSelection ##### -->
@@ -223,10 +212,9 @@ AccessibleText Interface
 </para>
 
 @obj: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @selectionNum: 
 @startOffset: 
 @endOffset: 
+@Returns: 
 
 
index 7bdc2ee..bc14b3c 100755 (executable)
@@ -15,16 +15,18 @@ pkill festival
 pkill sleep
 pkill magnifier
 pkill simple-at
+pkill keysynth-demo
 unsetenv GTK_MODULES
 setenv MAGNIFIER 1
 setenv FESTIVAL 1
+setenv GTK_RC_FILES /opt/gnome-2.0/share/themes/Default/gtk-2.0/gtkrc
 # start the text-to-speech service
 festival_server &
 
 # start the simple AT client, which uses the
 #  MAGNIFIER and FESTIVAL environment variables
 simple-at &
-
+sleep 2; keysynth-demo &
 # now set GTK_MODULES for use by GTK+ applications
 # this will cause the gail accessibility support, 
 # the ferret test tool, and the atk-bridge to be
index b4c8008..9b89878 100644 (file)
 extern "C" {
 #endif /* __cplusplus */
 
-Accessibility_Magnifier get_magnifier(void);
+Accessibility_Magnifier get_magnifier (void);
 void magnifier_set_roi (int zoom_region, int x1, int y1, int x2, int y2);
 void magnifier_set_magnification (int zoom_region, float mag_factor_x, float mag_factor_y);
+void magnifier_resize_region (int zoom_region, int x1, int y1, int x2, int y2);
+int  magnifier_create_region (float zx, float zy, int x1, int y1, int x2, int y2);
+void magnifier_clear_all_regions (void);
 
 #ifdef __cplusplus
 }
index f223944..a2883f0 100644 (file)
@@ -20,12 +20,28 @@ int main(int argc, char ** argv){
          get_magnifier ();
   }
 
-  else {
-         printf ("setting mag factor to %f\n", (float) atof (argv[1]));
-         magnifier_set_magnification (0, (float) atof (argv[1]),
-                                      (float) atof (argv[1]));
-  }
-  sleep (4);
+  else
+    {
+      switch (*argv[1])
+        {
+       case 'z':       
+         printf ("setting mag factor to %f\n", (float) atof (argv[1]+1));
+         magnifier_set_magnification (0, (float) atof (argv[1]+1),
+                                      (float) atof (argv[1]+1));
+         break;
+       case 's':
+         printf ("resizing region 0 to 100x100 at (600, 0)\n");
+         magnifier_resize_region (0, 600, 0, 700, 100);
+         break;
+       case 'd':
+         printf ("destroying/clearing all regions.\n");
+         magnifier_clear_all_regions ();
+         break;
+       case 'c':
+         printf ("creating 3x region at 100,100; 300x200\n");
+         magnifier_create_region (3.0, 3.0, 100, 100, 400, 300);
+        }
+    }
   return 0;
 }
 
@@ -81,6 +97,49 @@ magnifier_set_roi(int zoom_region, int x, int y, int w, int h)
 }
 
 void
+magnifier_resize_region (int zoom_region, int x1, int y1, int x2, int y2)
+{
+  Accessibility_Magnifier magnifier = get_magnifier();
+
+  if (magnifier)
+       Accessibility_Magnifier_resizeZoomRegion (magnifier,
+                                                (const CORBA_short) zoom_region,
+                                                (const CORBA_long) x1,
+                                                (const CORBA_long) y1,
+                                                (const CORBA_long) x2,
+                                                (const CORBA_long) y2,
+                                                &ev);
+}
+
+void
+magnifier_clear_all_regions ()
+{
+  Accessibility_Magnifier magnifier = get_magnifier();
+
+  if (magnifier)
+       Accessibility_Magnifier_clearAllZoomRegions (magnifier,
+                                                   &ev);
+}
+
+int
+magnifier_create_region (float zx, float zy, int x1, int y1, int x2, int y2)
+{
+  Accessibility_Magnifier magnifier = get_magnifier();
+  int retval = -1;
+  
+  if (magnifier)
+       retval = Accessibility_Magnifier_createZoomRegion (magnifier,
+                                                         (const CORBA_float) zx,
+                                                         (const CORBA_float) zy,
+                                                         (const CORBA_long) x1,
+                                                         (const CORBA_long) y1,
+                                                         (const CORBA_long) x2,
+                                                         (const CORBA_long) y2,
+                                                         &ev);
+  return retval;
+}
+
+void
 magnifier_set_magnification (int zoom_region, float mag_factor_x, float mag_factor_y)
 {
   Accessibility_Magnifier magnifier = get_magnifier();
index cc7aa7a..aa2c3a7 100644 (file)
@@ -121,7 +121,8 @@ int display_image(gpointer data)
                        0,0,0,0,DisplayWidth (mag_data->target_display,screen_num),
                        DisplayHeight(mag_data->target_display,screen_num),
                        GDK_RGB_DITHER_NORMAL,0,0);
-  /* TODO: raise this window to top on refresh */
+
+  gdk_window_raise (drawing_area->window);
   return TRUE;
 }
 
index 6ca08b7..109001c 100644 (file)
@@ -29,6 +29,16 @@ struct xlib_colormap_struct {
        Colormap colormap;
 };
 
+typedef struct {
+       GdkRectangle extents;
+       GdkRectangle roi;
+       float zoom_x;
+       float zoom_y;
+       int contrast;
+       gboolean is_managed;
+       gboolean is_dirty;
+} ZoomRegionData;
+
 point      center_position;
 point      curpos; /* Position of the magnified cursor */
 GdkPixbuf*  image;
@@ -54,6 +64,7 @@ typedef struct _MagnifierData {
        GtkWidget *output_window;
        void *source_display;
        void *target_display;
+       GList *zoom_regions;
 } MagnifierData;
 
 #define        FACTOR          1
index cb12459..bb04cc3 100644 (file)
 struct sockaddr_un mag_server = { AF_UNIX ,  "/tmp/magnifier_socket" };
 
 typedef struct {
-       GdkRectangle extents;
-       GdkRectangle roi;
-       float zoom_x;
-       float zoom_y;
-       int contrast;
-       gboolean is_managed;
-       gboolean is_dirty;
-} ZoomRegionData;
-
-typedef struct {
        gchar *target_display;
        gchar *source_display;
        int   vertical_split;
@@ -36,7 +26,7 @@ typedef struct {
        int   min_refresh_time;
        int   no_bonobo;
        int   fast_cmap_convert;
-       GList *zoom_regions;
+       int   no_initial_region;
 } MagnifierOptions;
 
 static MagnifierOptions global_options = { ":0.0",
@@ -50,6 +40,7 @@ static MagnifierOptions global_options = { ":0.0",
                                           2.0,
                                           200,
                                           0,
+                                          0,
                                           0
                                          };
 
@@ -65,6 +56,7 @@ struct poptOption magnifier_options [] = {
 /*     {"invert image", 'i', POPT_ARG_NONE, &global_options.invert_image, 'i', "invert the image colormap", NULL}, */
        {"fast-colormap-conversion", 'c', POPT_ARG_NONE, &global_options.fast_cmap_convert, 'c', "use faster colormap conversion algorithm (fails for 6 bit color)", NULL}, 
        {"no-bonobo", '\0', POPT_ARG_NONE, &global_options.no_bonobo, '\0', "don't use bonobo for controls, use sockets", NULL},
+       {"no-initial-region", '\0', POPT_ARG_NONE, &global_options.no_initial_region, '\0', "don't create an initial zoom region", NULL},
        {NULL, 0, 0, NULL, 0, 0}
 };
 
@@ -119,6 +111,24 @@ static gboolean get_commands(GIOChannel* client,
 
 }
 
+static void
+magnifier_pack_regions (Magnifier *magnifier)
+{
+  /* 
+   * this call prevents resizing, which is a bother, but required to 
+   * work around dtwm incompatibilities.  Perhaps a better workaround will
+   * be found, or we can make this a runtime option.
+   */ 
+  gtk_widget_set_size_request (magnifier->mag_data->output_window, 
+                              magnifier->mag_data->mag_width, 
+                              magnifier->mag_data->mag_height);
+
+  gdk_window_move(magnifier->mag_data->output_window->window,
+                 magnifier->mag_data->mag_x,
+                 magnifier->mag_data->mag_y);
+
+}
+
 int main (int argc, char** argv){
   GIOChannel *mag_channel;
   char *dpyname;
@@ -146,12 +156,20 @@ int main (int argc, char** argv){
          global_options.mouse_follow;
   magnifier->mag_data->color_inverted =
          global_options.invert_image;
-  magnifier->mag_data->factor_x =
-    (int) global_options.zoom_factor; 
-  magnifier->mag_data->factor_y =
-    (int) global_options.zoom_factor;
-  
-  /* TODO: enable fractional magnifications ? */
+  if (!global_options.no_initial_region) 
+    {
+      magnifier->mag_data->zoom_regions =
+             g_list_prepend (magnifier->mag_data->zoom_regions,
+                             g_new0 (ZoomRegionData, 1));
+      magnifier->mag_data->factor_x = (int) global_options.zoom_factor; 
+      magnifier->mag_data->factor_y = (int) global_options.zoom_factor;
+    }
+  else {
+      g_print ("starting magnifier with no initial zoom region\n");
+      magnifier->mag_data->mag_width = 0; 
+      magnifier->mag_data->mag_height = 0;
+  }
+      /* TODO: enable fractional magnifications option? */
   if (global_options.target_display) {
     snprintf (env_string, (size_t) (ENV_STRING_MAX_SIZE-1), "DISPLAY=%s", global_options.target_display);
     putenv (env_string);
@@ -234,30 +252,41 @@ int main (int argc, char** argv){
                                DisplayWidth (magnifier->mag_data->target_display,screen_num),
                                DisplayHeight(magnifier->mag_data->target_display,screen_num));
   if (global_options.vertical_split)
-         magnifier->mag_data->mag_width = DisplayWidth (magnifier->mag_data->target_display,screen_num)/2;
-  else
-         magnifier->mag_data->mag_width = DisplayWidth (magnifier->mag_data->target_display, screen_num);
-  if (global_options.horizontal_split)
-         magnifier->mag_data->mag_height = DisplayHeight (magnifier->mag_data->target_display,screen_num)/2;
-  else magnifier->mag_data->mag_height = DisplayHeight (magnifier->mag_data->target_display, screen_num);
+    {
+      magnifier->mag_data->mag_width =
+             DisplayWidth (magnifier->mag_data->target_display,screen_num)/2;
+      magnifier->mag_data->mag_height =
+             DisplayHeight (magnifier->mag_data->target_display, screen_num);
+    }
+  else if (global_options.horizontal_split)
+    {
+      magnifier->mag_data->mag_width =
+           DisplayWidth (magnifier->mag_data->target_display, screen_num);
+      magnifier->mag_data->mag_height =
+           DisplayHeight (magnifier->mag_data->target_display,screen_num)/2;
+    }
+  else if (global_options.fullscreen)
+    {
+      magnifier->mag_data->mag_width =
+           DisplayWidth (magnifier->mag_data->target_display, screen_num);
+      magnifier->mag_data->mag_height =
+           DisplayHeight (magnifier->mag_data->target_display,screen_num);
+    }
+  magnifier->mag_data->mag_x =
+         DisplayWidth (magnifier->mag_data->target_display, screen_num)
+         - magnifier->mag_data->mag_width;
+  magnifier->mag_data->mag_y =
+         DisplayHeight (magnifier->mag_data->target_display, screen_num)
+         - magnifier->mag_data->mag_height;
+
+  magnifier->mag_data->output_window = window;
   gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
-  
-  /* 
-   * this call prevents resizing, which is a bother, but required to 
-   * work around dtwm incompatibilities.  Perhaps a better workaround will
-   * be found, or we can make this a runtime option.
-   */ 
-  gtk_widget_set_size_request (window, 
-                              magnifier->mag_data->mag_width, 
-                              magnifier->mag_data->mag_height);
   gtk_widget_show_all (window);
-  
-  gdk_window_move(window->window,
-                 gdk_screen_width() - magnifier->mag_data->mag_width,
-                 gdk_screen_height() - magnifier->mag_data->mag_height);
 
-  magnifier->mag_data->output_window = window;
-  if (global_options.fullscreen) gdk_window_stick (window->window);
+  magnifier_pack_regions (magnifier);
+  
+  /* if (global_options.fullscreen) */
+  gdk_window_stick (window->window);
   gdk_window_set_functions(window->window, 0);
   gdk_window_raise(window->window);
   
@@ -387,6 +416,10 @@ impl_magnifier_set_mag_factor (PortableServer_Servant servant,
 static void
 impl_magnifier_mark_dirty (PortableServer_Servant servant,
                           const CORBA_short zoom_region,
+                          const CORBA_long x1,
+                          const CORBA_long y1,
+                          const CORBA_long x2,
+                          const CORBA_long y2,
                           CORBA_Environment *ev)
 {
   Magnifier *magnifier = MAGNIFIER (bonobo_object_from_servant (servant));
@@ -413,7 +446,23 @@ impl_magnifier_create_zoom_region (PortableServer_Servant servant,
                                   CORBA_Environment *ev)
 {
   Magnifier *magnifier = MAGNIFIER (bonobo_object_from_servant (servant));
-  return -1;
+  if (magnifier->mag_data->zoom_regions == NULL)
+    {
+      magnifier->mag_data->zoom_regions =
+             g_list_prepend (magnifier->mag_data->zoom_regions,
+                             g_new0 (ZoomRegionData, 1));
+      magnifier->mag_data->factor_x = (int) zx; 
+      magnifier->mag_data->factor_y = (int) zy;
+      magnifier->mag_data->mag_x = x1;
+      magnifier->mag_data->mag_y = y1;
+      magnifier->mag_data->mag_width = (x2 - x1);
+      magnifier->mag_data->mag_height = (y2 - y1);
+      magnifier_pack_regions (magnifier);
+    }
+  else
+    {
+      return -1;
+    }
 }
 
 static CORBA_boolean
@@ -440,25 +489,42 @@ impl_magnifier_get_zoom_region_params (PortableServer_Servant servant,
 }
 
 static void
-impl_magnifier_resize_zoom_region (PortableServer_Servant _servant,
+impl_magnifier_resize_zoom_region (PortableServer_Servant servant,
                                   const CORBA_short zoom_region,
                                   const CORBA_long x1, const CORBA_long y1,
                                   const CORBA_long x2, const CORBA_long y2,
                                   CORBA_Environment * ev)
 {
+  Magnifier *magnifier = MAGNIFIER (bonobo_object_from_servant (servant));
+  if (zoom_region == 0)
+    {
+      magnifier->mag_data->mag_x = x1;
+      magnifier->mag_data->mag_y = y1;
+      magnifier->mag_data->mag_width = (x2 - x1);
+      magnifier->mag_data->mag_height = (y2 - y1);
+      magnifier_pack_regions (magnifier);
+    }
 }
 
 static void
-impl_magnifier_destroy_zoom_region (PortableServer_Servant _servant,
+impl_magnifier_destroy_zoom_region (PortableServer_Servant servant,
                                    const CORBA_short zoom_region,
                                    CORBA_Environment * ev)
 {
+  Magnifier *magnifier = MAGNIFIER (bonobo_object_from_servant (servant));
+  if (zoom_region == 0)
+    {
+      g_list_free (magnifier->mag_data->zoom_regions);
+    }
 }
 
 static void
-impl_magnifier_clear_all_zoom_regions (PortableServer_Servant _servant,
+impl_magnifier_clear_all_zoom_regions (PortableServer_Servant servant,
                                       CORBA_Environment * ev)
 {
+  Magnifier *magnifier = MAGNIFIER (bonobo_object_from_servant (servant));
+  g_list_free (magnifier->mag_data->zoom_regions);
+  magnifier->mag_data->zoom_regions = NULL;
 }
 
 static void
@@ -500,6 +566,7 @@ magnifier_init (Magnifier *magnifier)
   magnifier->mag_data->fast_rgb_convert = FALSE;
   magnifier->mag_data->center.x = 0;
   magnifier->mag_data->center.y = 0;
+  magnifier->mag_data->zoom_regions = NULL;
 }
 
 GType