? autom4te.cache
? diff
? gnome-mag-0.11.2.tar.gz
? strut-patch.diff
? cursors/Makefile
? cursors/Makefile.in
? cursors/1_32/Makefile
? cursors/1_32/Makefile.in
? test/control-client
? test/mag-test
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-mag/ChangeLog,v
retrieving revision 1.117
diff -u -r1.117 ChangeLog
--- ChangeLog	27 May 2004 09:43:20 -0000	1.117
+++ ChangeLog	11 Jun 2004 13:02:31 -0000
@@ -1,7 +1,47 @@
+2004-06-11  Bill Haneman <billh@gnome.org>
+
+	* configure.in: Revved to 0.11.3.
+
+	* magnifier/magnifier-main.c:
+	Added is_override_redirect flag to MagnifierOptions.
+	Initialized to '0'.  Added --override-redirect 
+	commandline option.
+
+	* magnifier/magnifier.h:
+	(magnifier_new): Take a gboolean indicating whether the instance
+	should be override-redirect or not.
+
+	* magnifier/magnifier.c:
+	Removed #define MAG_WINDOW_OVERRIDE_REDIRECT and related
+	compile-time bracketing, replaced with override-redirect
+	runtime flag.
+	Added enum for WM_STRUT types.
+	(magnifier_reset_struts_at_idle): New, called in idle handler
+	after a window is created, to ensure that struts are set when
+	appropriate.
+	(magnifier_check_set_struts): Sets the _NET_WM_STRUT and 
+	_NET_WM_STRUT_PARTIAL properties on the magnifier window.
+	Has no effect if the window is override-redirect.
+	(magnifier_set_property): Call magnifier_check_set_struts when the
+	source or target display, or target bounds, are changed.
+	(impl_magnifier_add_zoom_region): Reset the struts when a zoom
+	region is added.
+	(magnifier_init_window): Register an idle handler to set the
+	window struts.
+	(magnifier_new): Take a boolean indicating whether the
+	instance is override redirect or not.  Attach to the
+	size_allocate signal.
+	(magnifier_size_allocate): New, reset struts when size changes.
+	Fixes for bug #124690.
+
+	* test/control-client.c:
+	Added test "control-client T" for resizing the target bounds.
+	
 2004-05-27  Mohammad DAMT  <mdamt@bisnisweb.com>
  
-        * po/id.po: Added Indonesian translation done by Ahmad Riza H Nst <rizahnst@eriagempita.co.id>
-        * configure.in: Added id to ALL_LINGUAS
+	* po/id.po: Added Indonesian translation done by 
+	Ahmad Riza H Nst <rizahnst@eriagempita.co.id>
+	* configure.in: Added id to ALL_LINGUAS
  
 2004-05-14  Bill Haneman <billh@gnome.org>
 
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnome-mag/configure.in,v
retrieving revision 1.65
diff -u -r1.65 configure.in
--- configure.in	27 May 2004 09:43:20 -0000	1.65
+++ configure.in	11 Jun 2004 13:02:31 -0000
@@ -12,7 +12,7 @@
 
 dnl increment any time the source you release changes; set to
 dnl 0 if you increment CURRENT
-GNOME_MAG_REVISION=2
+GNOME_MAG_REVISION=3
 GNOME_MAG_MICRO_VERSION=$GNOME_MAG_REVISION
 
 dnl increment if any interfaces have been added; set to 0
Index: magnifier/magnifier-main.c
===================================================================
RCS file: /cvs/gnome/gnome-mag/magnifier/magnifier-main.c,v
retrieving revision 1.29
diff -u -r1.29 magnifier-main.c
--- magnifier/magnifier-main.c	8 Apr 2004 20:57:19 -0000	1.29
+++ magnifier/magnifier-main.c	11 Jun 2004 13:02:31 -0000
@@ -65,6 +65,7 @@
 	int   border_width;
 	unsigned long  border_color;
 	int   test_pattern;
+        int   is_override_redirect;
 } MagnifierOptions;
 
 static MagnifierOptions global_options = { ":0.0",
@@ -93,6 +94,7 @@
 					   1,
 					   0,
 					   0,
+					   0,
 					   0
                                          };
 
@@ -122,6 +124,7 @@
 	{"border-size", 'b', POPT_ARG_INT, &global_options.border_width, '\0', "width of border", NULL},
 	{"border-color", 'c', POPT_ARG_LONG, &global_options.border_color, '\0', "border color specified as (A)RGB 23-bit value, Alpha-MSB", NULL},
 	{"use-test-pattern", '\0', POPT_ARG_NONE, &global_options.test_pattern, '\0', "use test pattern as source", NULL},
+	{"override-redirect", '\0', POPT_ARG_NONE, &global_options.is_override_redirect, '\0', "make the magnifier window totally unmanaged by the window manager", NULL},
 	POPT_AUTOHELP
 	{NULL, 0, 0, NULL, 0, 0}
 };
@@ -382,7 +385,7 @@
   /* FIXME */
   gtk_init (&argc, &argv);
 
-  magnifier = magnifier_new ();
+  magnifier = magnifier_new (global_options.is_override_redirect);
   fprintf (stderr, "New magnifier created.\n");
   
   properties = GNOME_Magnifier_Magnifier_getProperties (
Index: magnifier/magnifier-private.h
===================================================================
RCS file: /cvs/gnome/gnome-mag/magnifier/magnifier-private.h,v
retrieving revision 1.5
diff -u -r1.5 magnifier-private.h
--- magnifier/magnifier-private.h	8 Apr 2004 19:30:41 -0000	1.5
+++ magnifier/magnifier-private.h	11 Jun 2004 13:02:31 -0000
@@ -40,7 +40,7 @@
         int cursor_default_size_y;
 	gboolean crosswire;
 	GdkBitmap *cursor_mask;
-	int cursor_x;
+ 	int cursor_x;
 	int cursor_y;
 	int cursor_hotspot_x;
 	int cursor_hotspot_y;
Index: magnifier/magnifier.c
===================================================================
RCS file: /cvs/gnome/gnome-mag/magnifier/magnifier.c,v
retrieving revision 1.43
diff -u -r1.43 magnifier.c
--- magnifier/magnifier.c	14 May 2004 11:20:18 -0000	1.43
+++ magnifier/magnifier.c	11 Jun 2004 13:02:31 -0000
@@ -39,12 +39,24 @@
 #include "zoom-region-private.h"
 #include "GNOME_Magnifier.h"
 
-
-#define MAG_WINDOW_OVERRIDE_REDIRECT
-
 static GObjectClass *parent_class = NULL;
 
 enum {
+	STRUT_LEFT = 0,
+	STRUT_RIGHT = 1,
+	STRUT_TOP = 2,
+	STRUT_BOTTOM = 3,
+	STRUT_LEFT_START = 4,
+	STRUT_LEFT_END = 5,
+	STRUT_RIGHT_START = 6,
+	STRUT_RIGHT_END = 7,
+	STRUT_TOP_START = 8,
+	STRUT_TOP_END = 9,
+	STRUT_BOTTOM_START = 10,
+	STRUT_BOTTOM_END = 11
+};
+
+enum {
 	MAGNIFIER_SOURCE_DISPLAY_PROP,
 	MAGNIFIER_TARGET_DISPLAY_PROP,
 	MAGNIFIER_SOURCE_SIZE_PROP,
@@ -63,9 +75,13 @@
 static int _x_error = 0;
 static int fixes_event_base = 0, fixes_error_base;
 static Display *cursor_client_connection;
+static Magnifier *_this_magnifier = NULL;
 
 static void magnifier_transform_cursor (Magnifier *magnifier);
 static void magnifier_init_cursor_set (Magnifier *magnifier, gchar *cursor_set);
+static gboolean magnifier_check_set_struts (Magnifier *magnifier);
+static gboolean magnifier_reset_struts_at_idle (gpointer data);
+static gboolean _is_override_redirect = FALSE;
 
 gboolean
 magnifier_error_check (void)
@@ -376,6 +392,12 @@
 }
 
 static void
+magnifier_size_allocate (GtkWidget *widget)
+{
+	magnifier_check_set_struts (_this_magnifier);
+}
+
+static void
 magnifier_realize (GtkWidget *widget)
 {
 	XWMHints wm_hints;
@@ -781,6 +803,107 @@
 	magnifier_transform_cursor (magnifier);
 }
 
+static gboolean 
+magnifier_reset_struts_at_idle (gpointer data)
+{
+	if (data)
+	{
+		Magnifier *magnifier = MAGNIFIER (data);
+		if (magnifier->priv && GTK_WIDGET_REALIZED (magnifier->priv->w) && 
+		    magnifier_check_set_struts (magnifier))
+		{
+			return FALSE;
+		}
+	}
+	return TRUE;
+}
+
+static gboolean
+magnifier_check_set_struts (Magnifier *magnifier)
+{
+	/* TODO: don't do this if we're using Composite */
+	if (magnifier &&
+	    magnifier->priv && magnifier->priv->w && GTK_WIDGET_REALIZED (magnifier->priv->w) &&
+	    magnifier->priv->w->window) 
+	{
+		Atom atom_strut = gdk_x11_get_xatom_by_name ("_NET_WM_STRUT");
+		Atom atom_strut_partial = gdk_x11_get_xatom_by_name ("_NET_WM_STRUT_PARTIAL");
+		guint32 struts[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+		GtkWidget *widget = magnifier->priv->w;
+		gint width = gdk_screen_get_width (
+			gdk_display_get_screen (magnifier->target_display,
+						magnifier->target_screen_num));
+		gint height = gdk_screen_get_height (
+			gdk_display_get_screen (magnifier->target_display,
+						magnifier->target_screen_num));
+
+		gint right_margin, left_margin, top_margin, bottom_margin;
+		gint wx, wy, ww, wh;
+
+		gtk_window_get_position (GTK_WINDOW (magnifier->priv->w), &wx, &wy);
+		gtk_window_get_size (GTK_WINDOW (magnifier->priv->w), &ww, &wh);
+
+		left_margin = wx;
+		right_margin = (width - ww) - wx;
+		top_margin = wy;
+		bottom_margin = (height - wh) - wy;
+
+		/* set the WM_STRUT properties on the appropriate side */
+		if (bottom_margin > top_margin && 
+		    bottom_margin > left_margin &&
+		    bottom_margin > right_margin)
+		{
+			struts[STRUT_TOP] = wh + wy;
+			struts[STRUT_TOP_START] = wx;
+			struts[STRUT_TOP_END] = wx + ww;
+		} 
+		else if (top_margin > bottom_margin && 
+			 top_margin > left_margin &&
+			 top_margin > right_margin)
+		{
+			struts[STRUT_BOTTOM] = height - wy;
+			struts[STRUT_BOTTOM_START] = wx;
+			struts[STRUT_BOTTOM_END] = wx + ww;
+		}
+		else if (right_margin > left_margin &&
+			 right_margin > top_margin &&
+			 right_margin > bottom_margin)
+		{
+			struts[STRUT_LEFT] = wx;
+			struts[STRUT_LEFT_START] = wy;
+			struts[STRUT_LEFT_END] = wh + wy;
+		}
+		else 
+		{
+			struts[STRUT_RIGHT] = width - wx;
+			struts[STRUT_RIGHT_START] = wy;
+			struts[STRUT_RIGHT_END] = wy + wh;
+		}
+		
+		gdk_error_trap_push ();
+		XChangeProperty (GDK_WINDOW_XDISPLAY (widget->window), 
+				 GDK_WINDOW_XWINDOW (widget->window), 
+				 atom_strut,
+				 XA_CARDINAL, 32, PropModeReplace,
+				 (guchar *) &struts, 4);
+		XChangeProperty (GDK_WINDOW_XDISPLAY (widget->window), 
+				 GDK_WINDOW_XWINDOW (widget->window), 
+				 atom_strut_partial,
+				 XA_CARDINAL, 32, PropModeReplace,
+				 (guchar *) &struts, 12); 
+		gdk_error_trap_pop ();
+
+#ifdef DEBUG_STRUTS
+		g_message ("struts TOP %d (%d - %d)", struts[STRUT_TOP], struts[STRUT_TOP_START], struts[STRUT_TOP_END]);
+		g_message ("struts BOTTOM %d (%d - %d)", struts[STRUT_BOTTOM], struts[STRUT_BOTTOM_START], struts[STRUT_BOTTOM_END]);
+		g_message ("struts LEFT %d (%d - %d)", struts[STRUT_LEFT], struts[STRUT_LEFT_START], struts[STRUT_LEFT_END]);
+		g_message ("struts RIGHT %d (%d - %d)", struts[STRUT_RIGHT], struts[STRUT_RIGHT_START], struts[STRUT_RIGHT_END]);
+#endif
+		return TRUE;
+	}
+	return FALSE;
+}
+
 static void
 magnifier_get_property (BonoboPropertyBag *bag,
 			BonoboArg *arg,
@@ -872,6 +995,7 @@
 					magnifier->source_screen_num));
 		magnifier_warp_cursor_to_screen (magnifier);
 		magnifier_get_display_rect_bounds (magnifier, &magnifier->source_bounds, FALSE);
+		magnifier_check_set_struts (magnifier);
 		break;
 	case MAGNIFIER_TARGET_DISPLAY_PROP:
 		full_display_string = BONOBO_ARG_GET_STRING (arg);
@@ -889,6 +1013,7 @@
 		magnifier_get_display_rect_bounds (magnifier, &magnifier->target_bounds, TRUE);
 		magnifier_get_display_rect_bounds (magnifier, &magnifier->source_bounds, FALSE);
 		magnifier_reparent_zoom_regions (magnifier);
+		magnifier_check_set_struts (magnifier);
 		break;
 	case MAGNIFIER_SOURCE_SIZE_PROP:
 	        magnifier->source_bounds = BONOBO_ARG_GET_GENERAL (arg,
@@ -908,7 +1033,7 @@
 		gtk_window_resize (GTK_WINDOW (magnifier->priv->w),
 				   magnifier->target_bounds.x2 - magnifier->target_bounds.x1,
 				   magnifier->target_bounds.y2 - magnifier->target_bounds.y1);
-		
+		magnifier_check_set_struts (magnifier);
 		break;
 	case MAGNIFIER_CURSOR_SET_PROP:
 		magnifier_init_cursor_set (magnifier, g_strdup (BONOBO_ARG_GET_STRING (arg)));
@@ -1087,6 +1212,7 @@
 
 	/* FIXME: this needs proper lifecycle management */
 	magnifier->zoom_regions = g_list_append (magnifier->zoom_regions, region);
+	magnifier_check_set_struts (magnifier);
 
 	return CORBA_TRUE;
 }
@@ -1325,21 +1451,21 @@
 static void
 magnifier_init_window (Magnifier *magnifier)
 {
+	GtkWindowType mag_win_type = GTK_WINDOW_TOPLEVEL;
+	if (_is_override_redirect) mag_win_type = GTK_WINDOW_POPUP;
+
 	magnifier->priv->w =
 		g_object_connect (gtk_widget_new (gtk_window_get_type (),
 						  "user_data", NULL,
 						  "can_focus", FALSE,
-#ifdef MAG_WINDOW_OVERRIDE_REDIRECT
-						  "type", GTK_WINDOW_POPUP,
-#else
-						  "type", GTK_WINDOW_TOPLEVEL,
-#endif
+						  "type", mag_win_type,  
 						  "title", "magnifier",
 						  "allow_grow", TRUE,
 						  "allow_shrink", TRUE,
 						  "border_width", 0,
 						  NULL),
 				  "signal::realize", magnifier_realize, NULL,
+				  "signal::size_allocate", magnifier_size_allocate, NULL,
 				  "signal::destroy", magnifier_exit, NULL,
 				  NULL);
 	magnifier->priv->canvas = gtk_fixed_new ();
@@ -1397,19 +1523,26 @@
 }
 
 Magnifier *
-magnifier_new (void)
+magnifier_new (gboolean override_redirect)
 {
 	Magnifier *mag;
 	int ret;
 
+	_is_override_redirect = override_redirect;
+
 	mag = g_object_new (magnifier_get_type(), NULL);
+
+	_this_magnifier = mag; /* FIXME what about multiple instances? */
+	
 	ret = bonobo_activation_active_server_register (
 		MAGNIFIER_OAFIID, BONOBO_OBJREF (mag));
 	if (ret != Bonobo_ACTIVATION_REG_SUCCESS)
 	    g_error ("Error registering magnifier server.\n");
 	else
 	    g_message ("The magnifier server was successfully registred.\n");
-	
+
+	g_idle_add (magnifier_reset_struts_at_idle, mag);
+
 	return mag;
 }
 
Index: magnifier/magnifier.h
===================================================================
RCS file: /cvs/gnome/gnome-mag/magnifier/magnifier.h,v
retrieving revision 1.11
diff -u -r1.11 magnifier.h
--- magnifier/magnifier.h	8 Apr 2004 19:30:41 -0000	1.11
+++ magnifier/magnifier.h	11 Jun 2004 13:02:31 -0000
@@ -74,7 +74,7 @@
 GdkDrawable *magnifier_get_cursor    (Magnifier *magnifier);
 GType        magnifier_get_type      (void);
 GdkWindow   *magnifier_get_root      (Magnifier *magnifier);
-Magnifier   *magnifier_new           (void);
+Magnifier   *magnifier_new           (gboolean override_redirect);
 gboolean     magnifier_error_check   (void);
 void         magnifier_notify_damage (Magnifier *magnifier, XRectangle *rect);
 
Index: test/control-client.c
===================================================================
RCS file: /cvs/gnome/gnome-mag/test/control-client.c,v
retrieving revision 1.5
diff -u -r1.5 control-client.c
--- test/control-client.c	14 May 2004 11:20:18 -0000	1.5
+++ test/control-client.c	11 Jun 2004 13:02:31 -0000
@@ -128,6 +128,9 @@
 	GNOME_Magnifier_ZoomRegion zoom_region;
 	Bonobo_PropertyBag properties;
 	CORBA_Environment ev;
+	CORBA_any *rect_any;
+	GNOME_Magnifier_RectBounds *rectangle;
+
 	CORBA_exception_init (&ev);
 	
 	if (!bonobo_init (&argc, argv))
@@ -189,6 +192,19 @@
 		properties = GNOME_Magnifier_Magnifier_getProperties (magnifier, &ev);
 		bonobo_pbclient_set_long (properties, "cursor-size", 200, NULL);
 		bonobo_pbclient_set_ulong (properties, "cursor-color", 0xFFF, NULL);
+		bonobo_object_release_unref (properties, NULL);
+		break;
+        case 'T':
+		rect_any = CORBA_any__alloc ();
+		rectangle = GNOME_Magnifier_RectBounds__alloc ();
+		rectangle->x1 = 800;
+		rectangle->x2 = 1024;
+		rectangle->y1 = 0;
+		rectangle->y2 = 800;
+		rect_any->_type = TC_GNOME_Magnifier_RectBounds;
+		rect_any->_value = ORBit_copy_value (rectangle, TC_GNOME_Magnifier_RectBounds);
+		properties = GNOME_Magnifier_Magnifier_getProperties (magnifier, &ev);
+		Bonobo_PropertyBag_setValue (properties, "target-display-bounds", rect_any, NULL);
 		bonobo_object_release_unref (properties, NULL);
 		break;
         }
