[g-a-devel] [PATCH] minor changes to gnome-mag code
- From: Carlos Eduardo Rodrigues Diógenes <cerdiogenes yahoo com br>
- To: gnome-accessibility-devel gnome org
- Subject: [g-a-devel] [PATCH] minor changes to gnome-mag code
- Date: Wed, 08 Mar 2006 15:46:29 -0300
Hi,
This patch removes the <sys/time.h> from magnifier-main.c, that is not
necessary.
In the test to see if the user pass the target_display argument, I
changed the putenv by a g_setenv, what in my understand is more portable
than putenv.
>From magnifier.c it's remove the duplicate prototype of
magnifier_init_window ().
In the impl_zoom_region_set_mag_factor () in zoom-region.c, where have
the TODO i put the following:
g_assert (IS_MAGNIFIER ((Magnifier *) zoom_region->priv->parent));
I don't know if is this that must be done, so comments are welcome.
I'm reading a lot the code to try to understand the program better. So,
I'm also trying to make the code more consistent, i.e., chaging the
identation in some places and the open bracket in if and for statements.
I'm also breaking lines that pass 80 columns when I think that it will
be more confortable to read and when it's possibly. All these changes
are been made with the GNOME Programming Guidelines and the GNU
Standards in mind, but more have to be done to leave the code more
consistent in my point of view.
Bill, if you think that this is OK, please commit. My CVS account was
created, but I don't have a password to access it.
Thanks,
--
Carlos Eduardo Rodrigues Diógenes
Index: magnifier/magnifier-main.c
===================================================================
RCS file: /cvs/gnome/gnome-mag/magnifier/magnifier-main.c,v
retrieving revision 1.36
diff -u -p -r1.36 magnifier-main.c
--- magnifier/magnifier-main.c 14 Feb 2006 14:05:04 -0000 1.36
+++ magnifier/magnifier-main.c 8 Mar 2006 18:11:42 -0000
@@ -23,7 +23,6 @@
#include <string.h>
#include <stdlib.h>
#include <popt.h>
-#include <sys/time.h>
#include <gdk/gdkwindow.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
@@ -163,12 +162,15 @@ magnifier_main_test_image (gpointer data
if (global_options.timing_iterations > 0) {
if (timing_counter > global_options.timing_iterations) {
CORBA_exception_init (&ev);
- properties = GNOME_Magnifier_ZoomRegion_getProperties (zoom_region, &ev);
+ properties = GNOME_Magnifier_ZoomRegion_getProperties (
+ zoom_region, &ev);
if (BONOBO_EX (&ev))
fprintf (stderr, "EXCEPTION\n");
- bonobo_pbclient_set_boolean (properties, "exit-magnifier",
- TRUE, &ev);
+ bonobo_pbclient_set_boolean (properties,
+ "exit-magnifier",
+ TRUE,
+ &ev);
}
}
@@ -199,7 +201,8 @@ magnifier_main_test_image (gpointer data
y_roi = global_options.timing_delta_y * (timing_y_pos + y_direction);
/* The counter is increased each time the y-direction changes */
- if (y_roi + (screen_height / global_options.zoom_factor) > screen_height) {
+ if (y_roi + (screen_height / global_options.zoom_factor) >
+ screen_height) {
timing_counter++;
y_direction = -1;
}
@@ -235,62 +238,62 @@ static int last_x = 0, last_y = 0;
static int
magnifier_main_pan_image (gpointer data)
{
- Magnifier *magnifier = (Magnifier *) data;
- GNOME_Magnifier_ZoomRegionList *zoom_regions;
- GNOME_Magnifier_ZoomRegion zoom_region;
- CORBA_Environment ev;
- GNOME_Magnifier_RectBounds roi;
- int mouse_x_return, mouse_y_return;
- int w, h;
- GdkModifierType mask_return;
-
- CORBA_exception_init (&ev);
-
- if (global_options.mouse_follow && IS_MAGNIFIER (magnifier))
- {
- gdk_window_get_pointer (
- magnifier_get_root (magnifier),
- &mouse_x_return,
- &mouse_y_return,
- &mask_return);
+ Magnifier *magnifier = (Magnifier *) data;
+ GNOME_Magnifier_ZoomRegionList *zoom_regions;
+ GNOME_Magnifier_ZoomRegion zoom_region;
+ CORBA_Environment ev;
+ GNOME_Magnifier_RectBounds roi;
+ int mouse_x_return, mouse_y_return;
+ int w, h;
+ GdkModifierType mask_return;
+
+ CORBA_exception_init (&ev);
+
+ if (global_options.mouse_follow && IS_MAGNIFIER (magnifier)) {
+ gdk_window_get_pointer (magnifier_get_root (magnifier),
+ &mouse_x_return,
+ &mouse_y_return,
+ &mask_return);
- if (last_x != mouse_x_return || last_y != mouse_y_return)
- {
- last_x = mouse_x_return;
- last_y = mouse_y_return;
- w = (magnifier->target_bounds.x2 - magnifier->target_bounds.x1);
- h = (magnifier->target_bounds.y2 - magnifier->target_bounds.y1);
- roi.x1 = mouse_x_return;
- roi.y1 = mouse_y_return;
- roi.x2 = roi.x1 + 1;
- roi.y2 = roi.y1 + 1;
+ if (last_x != mouse_x_return || last_y != mouse_y_return) {
+ last_x = mouse_x_return;
+ last_y = mouse_y_return;
+ w = (magnifier->target_bounds.x2 -
+ magnifier->target_bounds.x1);
+ h = (magnifier->target_bounds.y2 -
+ magnifier->target_bounds.y1);
+ roi.x1 = mouse_x_return;
+ roi.y1 = mouse_y_return;
+ roi.x2 = roi.x1 + 1;
+ roi.y2 = roi.y1 + 1;
- zoom_regions =
- GNOME_Magnifier_Magnifier_getZoomRegions (
- BONOBO_OBJREF (magnifier),
- &ev);
- if (zoom_regions && (zoom_regions->_length > 0))
- {
- int i;
- for (i = 0; i < zoom_regions->_length; ++i)
- {
- /* fprintf (stderr, "panning region %d\n", i);*/
- zoom_region =
- CORBA_Object_duplicate (
- ( (CORBA_Object *)
- (zoom_regions->_buffer))[i], &ev);
- if (zoom_region != CORBA_OBJECT_NIL) {
- GNOME_Magnifier_ZoomRegion_setROI (zoom_region,
- &roi,
- &ev);
- } else fprintf (stderr, "nil region!\n");
- }
- }
- }
- return TRUE;
- }
-
- return FALSE;
+ zoom_regions =
+ GNOME_Magnifier_Magnifier_getZoomRegions (
+ BONOBO_OBJREF (magnifier),
+ &ev);
+ if (zoom_regions && (zoom_regions->_length > 0)) {
+ int i;
+ for (i = 0; i < zoom_regions->_length; ++i) {
+ /* fprintf (stderr, "panning region
+ * %d\n", i);*/
+ zoom_region =
+ CORBA_Object_duplicate (
+ ((CORBA_Object *)
+ (zoom_regions->_buffer))[i],
+ &ev);
+ if (zoom_region != CORBA_OBJECT_NIL) {
+ GNOME_Magnifier_ZoomRegion_setROI (
+ zoom_region,
+ &roi,
+ &ev);
+ } else fprintf (stderr,
+ "nil region!\n");
+ }
+ }
+ }
+ return TRUE;
+ }
+ return FALSE;
}
static int
@@ -310,16 +313,17 @@ magnifier_main_refresh_all (gpointer dat
return FALSE;
regions = GNOME_Magnifier_Magnifier_getZoomRegions (
- BONOBO_OBJREF (magnifier),
- &ev);
+ BONOBO_OBJREF (magnifier), &ev);
#ifdef DEBUG_REFRESH
fprintf (stderr, "refreshing %d regions\n", regions->_length);
#endif
- properties = GNOME_Magnifier_Magnifier_getProperties (BONOBO_OBJREF (magnifier), &ev);
+ properties = GNOME_Magnifier_Magnifier_getProperties (
+ BONOBO_OBJREF (magnifier), &ev);
- dirty_bounds_any = Bonobo_PropertyBag_getValue (properties, "source-display-bounds", &ev);
+ dirty_bounds_any = Bonobo_PropertyBag_getValue (
+ properties, "source-display-bounds", &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Error getting source-display-bounds");
bonobo_main_quit ();
@@ -328,249 +332,282 @@ magnifier_main_refresh_all (gpointer dat
dirty_bounds = (GNOME_Magnifier_RectBounds *) dirty_bounds_any->_value;
- fprintf (stderr, "region to update: %d %d %d %d\n",
- dirty_bounds->x1, dirty_bounds->y1, dirty_bounds->x2, dirty_bounds->y2);
+ fprintf (stderr, "region to update: %d %d %d %d\n",
+ dirty_bounds->x1,
+ dirty_bounds->y1,
+ dirty_bounds->x2,
+ dirty_bounds->y2);
for (i = 0; i < regions->_length; ++i)
GNOME_Magnifier_ZoomRegion_markDirty (
regions->_buffer [i], dirty_bounds, &ev);
bonobo_object_release_unref (properties, NULL);
-
+
return TRUE;
}
int
main (int argc, char** argv)
{
- poptContext ctx;
- GNOME_Magnifier_RectBounds *roi = GNOME_Magnifier_RectBounds__alloc();
- GNOME_Magnifier_RectBounds *viewport = GNOME_Magnifier_RectBounds__alloc();
- CORBA_any *viewport_any;
- int x = 0, y = 0, fullwidth, fullheight;
- guint pan_handle = 0, refresh_handle = 0;
- CORBA_Environment ev;
- Bonobo_PropertyBag properties;
+ poptContext ctx;
+ GNOME_Magnifier_RectBounds *roi = GNOME_Magnifier_RectBounds__alloc();
+ GNOME_Magnifier_RectBounds *viewport =
+ GNOME_Magnifier_RectBounds__alloc();
+ CORBA_any *viewport_any;
+ int x = 0, y = 0, fullwidth, fullheight;
+ guint pan_handle = 0, refresh_handle = 0;
+ CORBA_Environment ev;
+ Bonobo_PropertyBag properties;
- Magnifier *magnifier;
-
- if (!bonobo_init (&argc, argv)) {
- g_error ("Could not initialize Bonobo");
- }
- CORBA_exception_init (&ev);
+ Magnifier *magnifier;
+
+ if (!bonobo_init (&argc, argv)) {
+ g_error ("Could not initialize Bonobo");
+ }
+ CORBA_exception_init (&ev);
- ctx = poptGetContext ("magnifier",
- argc,
- (const char **)argv,
- magnifier_options,
- 0);
-
- while (poptGetNextOpt (ctx) >= 0)
- /**/;
-
- poptFreeContext (ctx);
-
- /**
- * slight hack, we set $DISPLAY if --target-display is set.
- * this is because I don't think GTK+ works well with across multiple
- * servers yet.
- **/
- if (global_options.target_display) {
- gchar *string;
- string = g_strconcat ("DISPLAY=", global_options.target_display, NULL);
- putenv (string);
- }
-
- if (global_options.timing_pan_rate && global_options.timing_iterations == 0)
- {
- g_error ("Must specify timing_iterations when running pan test");
- }
-
- /* FIXME */
- gtk_init (&argc, &argv);
-
- if (global_options.ignore_damage)
- {
- g_setenv ("MAGNIFIER_IGNORE_DAMAGE", "1", TRUE);
- }
+ ctx = poptGetContext ("magnifier",
+ argc,
+ (const char **)argv,
+ magnifier_options,
+ 0);
+
+ while (poptGetNextOpt (ctx) >= 0)
+ /**/;
+
+ poptFreeContext (ctx);
+
+ /**
+ * slight hack, we set $DISPLAY if --target-display is set.
+ * this is because I don't think GTK+ works well with across multiple
+ * servers yet.
+ **/
+ if (global_options.target_display) {
+ g_setenv ("DISPLAY", global_options.target_display, TRUE);
+ }
+
+ if (global_options.timing_pan_rate &&
+ global_options.timing_iterations == 0)
+ {
+ g_error ("Must specify timing_iterations when running pan test");
+ }
+
+ gtk_init (&argc, &argv);
+
+ if (global_options.ignore_damage) {
+ g_setenv ("MAGNIFIER_IGNORE_DAMAGE", "1", TRUE);
+ }
- magnifier = magnifier_new (global_options.is_override_redirect);
+ magnifier = magnifier_new (global_options.is_override_redirect);
- properties = GNOME_Magnifier_Magnifier_getProperties (
- BONOBO_OBJREF (magnifier), &ev);
- if (ev._major != CORBA_NO_EXCEPTION) fprintf (stderr, "EXCEPTION\n");
-
- if (global_options.source_display)
- bonobo_pbclient_set_string (properties, "source-display-screen",
- global_options.source_display, NULL);
-
- if (global_options.target_display)
- bonobo_pbclient_set_string (properties, "target-display-screen",
- global_options.target_display, NULL);
-
- if (global_options.cursor_set)
- bonobo_pbclient_set_string (properties, "cursor-set",
- global_options.cursor_set, NULL);
-
- if (global_options.cursor_size)
- bonobo_pbclient_set_long (properties, "cursor-size",
- global_options.cursor_size, NULL);
-
- else if (global_options.cursor_scale_factor != 0.0F)
- bonobo_pbclient_set_float (properties, "cursor-scale-factor",
- global_options.cursor_scale_factor, NULL);
- else
- bonobo_pbclient_set_float (properties, "cursor-scale-factor",
- global_options.zoom_factor, NULL);
-
- if (global_options.cursor_color)
- bonobo_pbclient_set_ulong (properties, "cursor-color",
- global_options.cursor_color,
- NULL);
-
- fullwidth = screen_width = gdk_screen_get_width (
- gdk_display_get_screen (magnifier->target_display,
- magnifier->target_screen_num));
- fullheight = screen_height = gdk_screen_get_height (
- gdk_display_get_screen (magnifier->target_display,
- magnifier->target_screen_num));
-
- if (global_options.vertical_split) {
- screen_width /= 2;
- x = screen_width;
- }
- if (global_options.horizontal_split) {
- screen_height /= 2;
- }
+ properties = GNOME_Magnifier_Magnifier_getProperties (
+ BONOBO_OBJREF (magnifier), &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) fprintf (stderr, "EXCEPTION\n");
+
+ if (global_options.source_display)
+ bonobo_pbclient_set_string (properties,
+ "source-display-screen",
+ global_options.source_display,
+ NULL);
+
+ if (global_options.target_display)
+ bonobo_pbclient_set_string (properties,
+ "target-display-screen",
+ global_options.target_display,
+ NULL);
+
+ if (global_options.cursor_set)
+ bonobo_pbclient_set_string (properties,
+ "cursor-set",
+ global_options.cursor_set,
+ NULL);
+
+ if (global_options.cursor_size)
+ bonobo_pbclient_set_long (properties,
+ "cursor-size",
+ global_options.cursor_size,
+ NULL);
+
+ else if (global_options.cursor_scale_factor != 0.0F)
+ bonobo_pbclient_set_float (properties,
+ "cursor-scale-factor",
+ global_options.cursor_scale_factor,
+ NULL);
+ else
+ bonobo_pbclient_set_float (properties,
+ "cursor-scale-factor",
+ global_options.zoom_factor,
+ NULL);
+
+ if (global_options.cursor_color)
+ bonobo_pbclient_set_ulong (properties,
+ "cursor-color",
+ global_options.cursor_color,
+ NULL);
+
+ fullwidth = screen_width = gdk_screen_get_width (
+ gdk_display_get_screen (magnifier->target_display,
+ magnifier->target_screen_num));
+ fullheight = screen_height = gdk_screen_get_height (
+ gdk_display_get_screen (magnifier->target_display,
+ magnifier->target_screen_num));
+
+ if (global_options.vertical_split) {
+ screen_width /= 2;
+ x = screen_width;
+ }
+ if (global_options.horizontal_split) {
+ screen_height /= 2;
+ }
- fprintf (stderr, "initial viewport %d %d\n", (int) screen_width,
- (int) screen_height);
+ fprintf (stderr, "initial viewport %d %d\n", (int) screen_width,
+ (int) screen_height);
- init_rect_bounds (viewport, x, y, x + screen_width, y + screen_height);
- viewport_any = bonobo_arg_new_from (TC_GNOME_Magnifier_RectBounds, viewport);
+ init_rect_bounds (viewport, x, y, x + screen_width, y + screen_height);
+ viewport_any = bonobo_arg_new_from (TC_GNOME_Magnifier_RectBounds,
+ viewport);
- bonobo_pbclient_set_value (properties, "target-display-bounds",
- viewport_any,
- &ev);
- bonobo_arg_release (viewport_any);
-
- if (global_options.vertical_split || global_options.horizontal_split)
- {
- init_rect_bounds (viewport, 0, 0, fullwidth-x, fullheight-y);
- viewport_any = bonobo_arg_new_from (TC_GNOME_Magnifier_RectBounds, viewport);
- bonobo_pbclient_set_value (properties, "source-display-bounds",
- viewport_any,
- &ev);
-
- bonobo_arg_release (viewport_any);
- }
-
- bonobo_object_release_unref (properties, NULL);
- properties = NULL;
-
- if (global_options.vertical_split ||
- global_options.horizontal_split ||
- global_options.fullscreen)
- {
- int scroll_policy;
+ bonobo_pbclient_set_value (properties,
+ "target-display-bounds",
+ viewport_any,
+ &ev);
+ bonobo_arg_release (viewport_any);
+
+ if (global_options.vertical_split || global_options.horizontal_split) {
+ init_rect_bounds (viewport, 0, 0, fullwidth-x, fullheight-y);
+ viewport_any = bonobo_arg_new_from (
+ TC_GNOME_Magnifier_RectBounds, viewport);
+ bonobo_pbclient_set_value (properties,
+ "source-display-bounds",
+ viewport_any,
+ &ev);
+
+ bonobo_arg_release (viewport_any);
+ }
+
+ bonobo_object_release_unref (properties, NULL);
+ properties = NULL;
+
+ if (global_options.vertical_split ||
+ global_options.horizontal_split ||
+ global_options.fullscreen) {
+ int scroll_policy;
- init_rect_bounds (roi, 0, 0, 100, 100);
- init_rect_bounds (viewport, 0, 0, screen_width, screen_height);
- zoom_region =
- GNOME_Magnifier_Magnifier_createZoomRegion (
- BONOBO_OBJREF (magnifier),
- global_options.zoom_factor,
- global_options.zoom_factor,
- roi,
- viewport,
- &ev);
+ init_rect_bounds (roi, 0, 0, 100, 100);
+ init_rect_bounds (viewport, 0, 0, screen_width, screen_height);
+ zoom_region =
+ GNOME_Magnifier_Magnifier_createZoomRegion (
+ BONOBO_OBJREF (magnifier),
+ global_options.zoom_factor,
+ global_options.zoom_factor,
+ roi,
+ viewport,
+ &ev);
- properties = GNOME_Magnifier_ZoomRegion_getProperties (zoom_region, &ev);
- if (BONOBO_EX (&ev))
- fprintf (stderr, "EXCEPTION\n");
-
- scroll_policy = global_options.smooth_scroll ?
- GNOME_Magnifier_ZoomRegion_SCROLL_SMOOTHEST :
- GNOME_Magnifier_ZoomRegion_SCROLL_FASTEST;
-
- bonobo_pbclient_set_long (properties, "timing-iterations",
- global_options.timing_iterations, &ev);
- bonobo_pbclient_set_boolean (properties, "timing-output",
- global_options.timing_output, &ev);
- bonobo_pbclient_set_long (properties, "timing-pan-rate",
- global_options.timing_pan_rate, &ev);
- bonobo_pbclient_set_long (properties, "border-size",
- global_options.border_width, &ev);
- bonobo_pbclient_set_long (properties, "border-color",
- global_options.border_color, &ev);
- bonobo_pbclient_set_short (properties, "smooth-scroll-policy",
- (short) scroll_policy, &ev);
- bonobo_pbclient_set_boolean (properties, "use-test-pattern",
- global_options.test_pattern, &ev);
-
- if (strcmp (global_options.smoothing_type, "none"))
- bonobo_pbclient_set_string (properties, "smoothing-type",
- global_options.smoothing_type, &ev);
-
- if (global_options.invert_image)
- bonobo_pbclient_set_boolean (properties, "inverse-video",
- global_options.invert_image, NULL);
-
- GNOME_Magnifier_Magnifier_addZoomRegion (
- BONOBO_OBJREF (magnifier),
- zoom_region,
- &ev);
-
- bonobo_object_release_unref (properties, &ev);
- properties = NULL;
- }
-
- if (global_options.timing_pan_rate)
- {
- GNOME_Magnifier_ZoomRegionList *zoom_regions;
- GNOME_Magnifier_RectBounds roi;
- roi.x1 = 100;
- roi.x2 = 100 + (screen_width / global_options.zoom_factor);
- roi.y1 = 0;
- roi.y2 = screen_height / global_options.zoom_factor;
+ properties = GNOME_Magnifier_ZoomRegion_getProperties (
+ zoom_region, &ev);
+ if (BONOBO_EX (&ev))
+ fprintf (stderr, "EXCEPTION\n");
+
+ scroll_policy = global_options.smooth_scroll ?
+ GNOME_Magnifier_ZoomRegion_SCROLL_SMOOTHEST :
+ GNOME_Magnifier_ZoomRegion_SCROLL_FASTEST;
+
+ bonobo_pbclient_set_long (properties,
+ "timing-iterations",
+ global_options.timing_iterations,
+ &ev);
+ bonobo_pbclient_set_boolean (properties,
+ "timing-output",
+ global_options.timing_output,
+ &ev);
+ bonobo_pbclient_set_long (properties,
+ "timing-pan-rate",
+ global_options.timing_pan_rate,
+ &ev);
+ bonobo_pbclient_set_long (properties,
+ "border-size",
+ global_options.border_width,
+ &ev);
+ bonobo_pbclient_set_long (properties,
+ "border-color",
+ global_options.border_color,
+ &ev);
+ bonobo_pbclient_set_short (properties,
+ "smooth-scroll-policy",
+ (short) scroll_policy,
+ &ev);
+ bonobo_pbclient_set_boolean (properties,
+ "use-test-pattern",
+ global_options.test_pattern,
+ &ev);
+
+ if (strcmp (global_options.smoothing_type, "none"))
+ bonobo_pbclient_set_string (
+ properties,
+ "smoothing-type",
+ global_options.smoothing_type,
+ &ev);
+
+ if (global_options.invert_image)
+ bonobo_pbclient_set_boolean (
+ properties,
+ "inverse-video",
+ global_options.invert_image,
+ NULL);
+
+ GNOME_Magnifier_Magnifier_addZoomRegion (
+ BONOBO_OBJREF (magnifier),
+ zoom_region,
+ &ev);
+
+ bonobo_object_release_unref (properties, &ev);
+ properties = NULL;
+ }
+
+ if (global_options.timing_pan_rate) {
+ GNOME_Magnifier_ZoomRegionList *zoom_regions;
+ GNOME_Magnifier_RectBounds roi;
+ roi.x1 = 100;
+ roi.x2 = 100 + (screen_width / global_options.zoom_factor);
+ roi.y1 = 0;
+ roi.y2 = screen_height / global_options.zoom_factor;
- zoom_regions = GNOME_Magnifier_Magnifier_getZoomRegions (
- BONOBO_OBJREF (magnifier), &ev);
+ zoom_regions = GNOME_Magnifier_Magnifier_getZoomRegions (
+ BONOBO_OBJREF (magnifier), &ev);
- if (zoom_regions && (zoom_regions->_length > 0))
- {
- GNOME_Magnifier_ZoomRegion_setROI (
- zoom_regions->_buffer[0], &roi, &ev);
- }
- }
- else if (global_options.timing_iterations)
- {
- refresh_handle = g_timeout_add (global_options.refresh_time,
- magnifier_main_test_image,
- magnifier);
- }
- else
- {
- if (global_options.ignore_damage ||
- !magnifier_source_has_damage_extension (magnifier))
- {
- refresh_handle = g_timeout_add (
- global_options.refresh_time,
- magnifier_main_refresh_all, magnifier);
- }
+ if (zoom_regions && (zoom_regions->_length > 0)) {
+ GNOME_Magnifier_ZoomRegion_setROI (
+ zoom_regions->_buffer[0], &roi, &ev);
+ }
+ }
+ else if (global_options.timing_iterations) {
+ refresh_handle = g_timeout_add (global_options.refresh_time,
+ magnifier_main_test_image,
+ magnifier);
+ }
+ else {
+ if (global_options.ignore_damage ||
+ !magnifier_source_has_damage_extension (magnifier)) {
+ refresh_handle = g_timeout_add (
+ global_options.refresh_time,
+ magnifier_main_refresh_all, magnifier);
+ }
- pan_handle = g_timeout_add (
- global_options.mouse_poll_time,
- magnifier_main_pan_image, magnifier);
- }
-
- bonobo_main ();
+ pan_handle = g_timeout_add (global_options.mouse_poll_time,
+ magnifier_main_pan_image,
+ magnifier);
+ }
- if (refresh_handle)
- g_source_remove (refresh_handle);
+ bonobo_main ();
- if (pan_handle)
- g_source_remove (pan_handle);
+ if (refresh_handle)
+ g_source_remove (refresh_handle);
+
+ if (pan_handle)
+ g_source_remove (pan_handle);
- return 0;
+ return 0;
}
Index: magnifier/magnifier.c
===================================================================
RCS file: /cvs/gnome/gnome-mag/magnifier/magnifier.c,v
retrieving revision 1.65
diff -u -p -r1.65 magnifier.c
--- magnifier/magnifier.c 14 Feb 2006 14:05:04 -0000 1.65
+++ magnifier/magnifier.c 8 Mar 2006 18:11:43 -0000
@@ -143,7 +143,6 @@ static void magnifier_init_cursor_set (M
static void magnifier_init_window (Magnifier *magnifier, GdkScreen *screen);
static gboolean magnifier_check_set_struts (Magnifier *magnifier);
static gboolean magnifier_reset_struts_at_idle (gpointer data);
-static void magnifier_init_window (Magnifier *magnifier, GdkScreen *screen);
static void magnifier_adjust_source_size (Magnifier *magnifier);
static gboolean _is_override_redirect = FALSE;
@@ -1072,12 +1071,10 @@ magnifier_init_cursor_set (Magnifier *ma
static gboolean
magnifier_reset_struts_at_idle (gpointer data)
{
- if (data)
- {
+ if (data) {
Magnifier *magnifier = MAGNIFIER (data);
- if (magnifier->priv && GTK_WIDGET_REALIZED (magnifier->priv->w) &&
- magnifier_check_set_struts (magnifier))
- {
+ if (magnifier->priv && GTK_WIDGET_REALIZED (magnifier->priv->w)
+ && magnifier_check_set_struts (magnifier)) {
return FALSE;
}
}
@@ -1956,6 +1953,11 @@ magnifier_new (gboolean override_redirec
return mag;
}
+/* Macro that includes all the boilerplate code need to register a new
+ * BonoboObject-derived class. The programmer has to define two functions only:
+ * prefix_init and prefix_class_init. As a result of the macro expansion, a
+ * function named @prefix_get_type() is defined. More informations in the
+ * libbonobo API reference manual. */
BONOBO_TYPE_FUNC_FULL (Magnifier,
GNOME_Magnifier_Magnifier,
BONOBO_TYPE_OBJECT,
Index: magnifier/zoom-region.c
===================================================================
RCS file: /cvs/gnome/gnome-mag/magnifier/zoom-region.c,v
retrieving revision 1.59
diff -u -p -r1.59 zoom-region.c
--- magnifier/zoom-region.c 14 Feb 2006 14:05:04 -0000 1.59
+++ magnifier/zoom-region.c 8 Mar 2006 18:11:45 -0000
@@ -716,14 +716,18 @@ zoom_region_update_current (ZoomRegion *
#endif
if (zoom_region->priv)
{
- gboolean pixmap_valid = GDK_IS_DRAWABLE (zoom_region->priv->pixmap);
+ gboolean pixmap_valid = GDK_IS_DRAWABLE (
+ zoom_region->priv->pixmap);
if (!pixmap_valid)
- pixmap_valid = (zoom_region_create_pixmap (zoom_region) == ZOOM_REGION_ERROR_NONE);
+ pixmap_valid =
+ (zoom_region_create_pixmap (zoom_region) ==
+ ZOOM_REGION_ERROR_NONE);
if (pixmap_valid)
- zoom_region_update (zoom_region,
- zoom_region_source_rect_from_view_bounds (
- zoom_region,
- &zoom_region->priv->exposed_viewport));
+ zoom_region_update (
+ zoom_region,
+ zoom_region_source_rect_from_view_bounds (
+ zoom_region,
+ &zoom_region->priv->exposed_viewport));
}
}
@@ -1129,19 +1133,18 @@ zoom_region_create_pixmap (ZoomRegion *z
#ifdef ZOOM_REGION_DEBUG
g_assert (zoom_region->alive);
#endif
- if (zoom_region->priv->w && GDK_IS_DRAWABLE (zoom_region->priv->w->window))
- {
+ if (zoom_region->priv->w &&
+ GDK_IS_DRAWABLE (zoom_region->priv->w->window)) {
long width = (zoom_region->priv->source_area.x2 -
zoom_region->priv->source_area.x1) * zoom_region->xscale;
long height = (zoom_region->priv->source_area.y2 -
zoom_region->priv->source_area.y1) * zoom_region->yscale;
zoom_region->priv->pixmap =
- gdk_pixmap_new (
- zoom_region->priv->w->window,
- width,
- height,
- gdk_drawable_get_depth (
- zoom_region->priv->w->window));
+ gdk_pixmap_new (zoom_region->priv->w->window,
+ width,
+ height,
+ gdk_drawable_get_depth (
+ zoom_region->priv->w->window));
if (magnifier_error_check ()) {
zoom_region->priv->pixmap = NULL;
@@ -1157,22 +1160,26 @@ zoom_region_create_pixmap (ZoomRegion *z
zoom_region->priv->exposed_viewport.y2);
#endif
- DEBUG_RECT("viewport", zoom_region_source_rect_from_view_bounds
- (zoom_region, &zoom_region->priv->exposed_viewport));
- DEBUG_RECT("source", zoom_region_rect_from_bounds
- (zoom_region, &((Magnifier*)zoom_region->priv->parent)->source_bounds));
+ DEBUG_RECT("viewport",
+ zoom_region_source_rect_from_view_bounds (
+ zoom_region,
+ &zoom_region->priv->exposed_viewport));
+ DEBUG_RECT("source",
+ zoom_region_rect_from_bounds (
+ zoom_region,
+ &((Magnifier*)zoom_region->priv->parent)->source_bounds));
- zoom_region_update (zoom_region,
+ zoom_region_update (zoom_region,
/* zoom_region_source_rect_from_view_bounds (
zoom_region,
&zoom_region->priv->exposed_viewport));
*/
- zoom_region_rect_from_bounds
- (zoom_region,
- &((Magnifier *)zoom_region->priv->parent)->source_bounds));
+ zoom_region_rect_from_bounds (
+ zoom_region,
+ &((Magnifier *)zoom_region->priv->parent)->source_bounds));
return ZOOM_REGION_ERROR_NONE;
}
-
+
return ZOOM_REGION_ERROR_NO_TARGET_DRAWABLE;
}
@@ -1881,16 +1888,19 @@ zoom_region_process_updates (gpointer da
if (zoom_region->priv->q != NULL) {
GList *last = g_list_last (zoom_region->priv->q);
#ifdef ZOOM_REGION_DEBUG
- fprintf (stderr, "qlen=%d\n", g_list_length (zoom_region->priv->q));
+ fprintf (stderr, "qlen=%d\n",
+ g_list_length (zoom_region->priv->q));
#endif
if (last) {
- zoom_region->priv->q = g_list_remove_link (zoom_region->priv->q,
- last);
+ zoom_region->priv->q =
+ g_list_remove_link (zoom_region->priv->q,
+ last);
zoom_region_update (zoom_region,
* (GdkRectangle *) last->data);
g_list_free (last);
#ifdef DEBUG
- fputs (".\n", stderr); /* debug output, means we actually did something. */
+ fputs (".\n", stderr); /* debug output, means we
+ * actually did something. */
#endif
}
return TRUE;
@@ -2634,9 +2644,10 @@ impl_zoom_region_set_mag_factor (Portabl
double ys_old = zoom_region->yscale;
CORBA_boolean retval = CORBA_TRUE;
- /* TODO: assert that parent is magnifier object */
+ g_assert (IS_MAGNIFIER ((Magnifier *) zoom_region->priv->parent));
+
Bonobo_PropertyBag properties =
- GNOME_Magnifier_Magnifier_getProperties(
+ GNOME_Magnifier_Magnifier_getProperties (
BONOBO_OBJREF (
(Magnifier *) zoom_region->priv->parent), ev);
any = Bonobo_PropertyBag_getValue (
@@ -2656,27 +2667,29 @@ impl_zoom_region_set_mag_factor (Portabl
zoom_region->priv->scaled_pixbuf = gdk_pixbuf_new (
GDK_COLORSPACE_RGB, FALSE, 8,
(zoom_region->priv->source_area.x2 -
- zoom_region->priv->source_area.x1) * zoom_region->xscale + 1,
+ zoom_region->priv->source_area.x1) * zoom_region->xscale + 1,
(zoom_region->priv->source_area.y2 -
- zoom_region->priv->source_area.y1) * zoom_region->yscale + 1);
+ zoom_region->priv->source_area.y1) * zoom_region->yscale + 1);
if (zoom_region->priv->pixmap) {
g_object_unref (zoom_region->priv->pixmap);
zoom_region->priv->pixmap = NULL;
}
- if (zoom_region_create_pixmap (zoom_region) == ZOOM_REGION_ERROR_TOO_BIG) {
+ if (zoom_region_create_pixmap (zoom_region) ==
+ ZOOM_REGION_ERROR_TOO_BIG) {
zoom_region->xscale = xs_old;
zoom_region->yscale = ys_old;
zoom_region_create_pixmap (zoom_region);
g_object_unref (zoom_region->priv->scaled_pixbuf);
- /* only create a scaled image big enough for the target display, for now */
+ /* only create a scaled image big enough for the target
+ * display, for now */
zoom_region->priv->scaled_pixbuf = gdk_pixbuf_new (
GDK_COLORSPACE_RGB, FALSE, 8,
(zoom_region->priv->source_area.x2 -
- zoom_region->priv->source_area.x1) * zoom_region->xscale + 1,
+ zoom_region->priv->source_area.x1) * zoom_region->xscale + 1,
(zoom_region->priv->source_area.y2 -
- zoom_region->priv->source_area.y1) * zoom_region->yscale + 1);
+ zoom_region->priv->source_area.y1) * zoom_region->yscale + 1);
retval = CORBA_FALSE;
}
zoom_region_update_current (zoom_region);
@@ -3178,6 +3191,11 @@ zoom_region_finalize (GObject *region)
BONOBO_CALL_PARENT (G_OBJECT_CLASS, finalize, (region));
}
+/* Macro that includes all the boilerplate code need to register a new
+ * BonoboObject-derived class. The programmer has to define two functions only:
+ * prefix_init and prefix_class_init. As a result of the macro expansion, a
+ * function named @prefix_get_type() is defined. More informations in the
+ * libbonobo API reference manual. */
BONOBO_TYPE_FUNC_FULL (ZoomRegion,
GNOME_Magnifier_ZoomRegion,
BONOBO_TYPE_OBJECT,
Index: po/Makefile.in.in
===================================================================
RCS file: /cvs/gnome/gnome-mag/po/Makefile.in.in,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile.in.in
--- po/Makefile.in.in 2 Apr 2003 13:33:15 -0000 1.2
+++ po/Makefile.in.in 8 Mar 2006 18:11:45 -0000
@@ -11,6 +11,11 @@
#
# - Modified by jacob berkman <jacob ximian com> to install
# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
+#
+# - Modified by Rodney Dawes <dobey novell com> for use with intltool
+#
+# We have the following line for use by intltoolize:
+# INTLTOOL_MAKEFILE
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
PACKAGE = @PACKAGE@
@@ -27,15 +32,17 @@ VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = @datadir@
+datarootdir = @datarootdir@
libdir = @libdir@
localedir = $(libdir)/locale
gnulocaledir = $(datadir)/locale
gettextsrcdir = $(datadir)/glib-2.0/gettext/po
subdir = po
+install_sh = @install_sh@
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
-MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
CC = @CC@
GENCAT = @GENCAT@
@@ -44,8 +51,8 @@ MSGFMT = @MSGFMT@
XGETTEXT = @XGETTEXT@
INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
-MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
-GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
+MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
+GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
DEFS = @DEFS@
CFLAGS = @CFLAGS@
@@ -58,8 +65,9 @@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $
SOURCES =
POFILES = @POFILES@
GMOFILES = @GMOFILES@
-DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
-$(POFILES) $(GMOFILES) $(SOURCES)
+DISTFILES = ChangeLog Makefile.in.in POTFILES.in \
+$(POFILES) $(SOURCES)
+EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS
POTFILES = \
@@ -75,13 +83,13 @@ INSTOBJEXT = @INSTOBJEXT@
.po.pox:
$(MAKE) $(GETTEXT_PACKAGE).pot
- $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*pox
+ $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
.po.mo:
$(MSGFMT) -o $@ $<
.po.gmo:
- file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
+ file=`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
.po.cat:
@@ -94,7 +102,7 @@ all: all- USE_NLS@
all-yes: $(CATALOGS)
all-no:
-$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
+$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(GENPOT)
install: install-exec install-data
@@ -102,7 +110,7 @@ install-exec:
install-data: install-data- USE_NLS@
install-data-no: all
install-data-yes: all
- if test -r "$(MKINSTALLDIRS)"; then \
+ if test -n "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
@@ -116,7 +124,7 @@ install-data-yes: all
esac; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
- if test -r "$(MKINSTALLDIRS)"; then \
+ if test -n "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $$dir; \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
@@ -144,7 +152,7 @@ install-data-yes: all
fi; \
done
if test "$(PACKAGE)" = "glib"; then \
- if test -r "$(MKINSTALLDIRS)"; then \
+ if test -n "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
@@ -172,28 +180,33 @@ uninstall:
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
fi
-check: all
+check: all $(GETTEXT_PACKAGE).pot
dvi info tags TAGS ID:
mostlyclean:
- rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
+ rm -f core core.* *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
rm -fr *.o
rm -f .intltool-merge-cache
clean: mostlyclean
distclean: clean
- rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
+ rm -f Makefile Makefile.in POTFILES
+ rm -f *.mo *.msg *.cat *.cat.m $(GMOFILES)
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
- rm -f $(GMOFILES)
+ rm -f Makefile.in.in
distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
-dist distdir: update-po $(DISTFILES)
+dist distdir: $(DISTFILES)
dists="$(DISTFILES)"; \
+ extra_dists="$(EXTRA_DISTFILES)"; \
+ for file in $$extra_dists; do \
+ test -f $$file && dists="$$dists $$file"; \
+ done; \
for file in $$dists; do \
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|| cp -p $(srcdir)/$$file $(distdir); \
@@ -202,14 +215,14 @@ dist distdir: update-po $(DISTFILES)
update-po: Makefile
$(MAKE) $(GETTEXT_PACKAGE).pot
tmpdir=`pwd`; \
- cd $(srcdir); \
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
echo "$$lang:"; \
- if $$tmpdir/$(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist -o $$tmpdir/$$lang.new.po $$lang; then \
- if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+ result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
+ if $$result; then \
+ if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
@@ -230,17 +243,13 @@ update-po: Makefile
# and Intltool tags (enclosed in square brackets), and appending a full
# relative path to them
POTFILES: POTFILES.in
- ( if test 'x$(srcdir)' != 'x.'; then \
- posrcprefix='$(top_srcdir)/'; \
- else \
- posrcprefix="../"; \
- fi; \
+ ( posrcprefix='$(top_srcdir)/'; \
rm -f $ -t $@ \
- && (sed -e '/^#/d' \
- -e "s/^\[.*\] +//" \
- -e '/^[ ]*$$/d' \
- -e "s *@ $$posrcprefix& \\\\@" < $(srcdir)/$ in \
- | sed -e '$$s/\\$$//') > $ -t \
+ && (sed -e '/^#/d' \
+ -e 's/^[[].*] *//' \
+ -e '/^[ ]*$$/d' \
+ -e "s ^@ $$posrcprefix@" $(srcdir)/$ in \
+ | sed -e '$$!s/$$/ \\/') > $ -t \
&& chmod a-w $ -t \
&& mv $ -t $@ )
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]