[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: stupid desktop question



On Wed, Dec 15, 2004 at 03:45:26PM -0800, David Mosberger wrote:
> Anybody else noticed this and/or know where the problem is?  Is it
> just operator error?

I hadn't noticed it till you pointed it out, but then it annoyed me :)

The problem is that _NET_WORKAREA isn't being found correctly.

So, digging deeper, we are getting _NET_WORKAREA via
gdk_property_get()

Looking @
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Properties-and-Atoms.html#gdk-property-get
gdk_property_get takes an 'gulong' argument length that the
documentation says

 length : the length of the data to delete. (in bytes, but the actual
 retrieved length will be the next integer multiple multiple of four
 greater than this!)

huh?  Anyway gdk_property_get calculates length as ((length + 3) / 4).
However, Nautilus passes a length value to gtk_property_get of
LONG_MAX which gets wrapped around by the calcuation.
gdk_property_get then passes this onto XGetWindowProperty which thus
returns 0 bytes of data.  Of course the function doesn't fail, but it
doesn't return anything useful, either.

I think a real fix might be re-writing these interfaces to be sane;
but the attached makes the icon sit in the right place for me (if
no-one can suggest a better fix I'll file this as a bug).

-i
--- nautilus-2.8.2/src/file-manager/fm-desktop-icon-view.c	2004-06-10 00:14:55.000000000 +1000
+++ nautilus-2.8.2-fixed/src/file-manager/fm-desktop-icon-view.c	2004-12-16 16:40:24.890554128 +1100
@@ -141,10 +141,10 @@
 	screen_height = gdk_screen_get_height (screen);
 
 	for (i = 0; i < n_items; i += 4) {
-		int x      = workareas [i];
-		int y      = workareas [i + 1];
-		int width  = workareas [i + 2];
-		int height = workareas [i + 3];
+		int x      = (int) workareas [i];
+		int y      = (int) workareas [i + 1];
+		int width  = (int) workareas [i + 2];
+		int height = (int) workareas [i + 3];
 
 		if ((x + width) > screen_width || (y + height) > screen_height)
 			continue;
@@ -178,7 +178,7 @@
 	if (!gdk_property_get (window,
 			       gdk_atom_intern ("_NET_WORKAREA", FALSE),
 			       gdk_x11_xatom_to_atom (XA_CARDINAL),
-			       0, G_MAXLONG, FALSE,
+			       0, 1024, FALSE,
 			       &type_returned,
 			       &format_returned,
 			       &length_returned,

Attachment: signature.asc
Description: Digital signature


Reply to: