sawfish r4261 - in trunk: man src



Author: tkorvola
Date: Tue Aug  5 20:28:11 2008
New Revision: 4261
URL: http://svn.gnome.org/viewvc/sawfish?rev=4261&view=rev

Log:
Make window-plist return the plist itself, not a copy.

Returning a shallow copy still leaves ample opportunities for
shooting oneself in the foot. Actually, you can do that even
without window-plist by destructively modifying a list property
returned by window-get. So there is no point in pretending to
protect the user by returning a copy.

Modified:
   trunk/man/sawmill.texi
   trunk/src/windows.c

Modified: trunk/man/sawmill.texi
==============================================================================
--- trunk/man/sawmill.texi	(original)
+++ trunk/man/sawmill.texi	Tue Aug  5 20:28:11 2008
@@ -845,10 +845,8 @@
 Returns the property list of the window @var{window} which is of the form
 @code{(prop value prop value ...)}. 
 
-The returned list is ``copied once'', i.e., its structure is copied,
-but elements other than symbol, lists for example, are the original ones.
-Do NOT modify them to change the property value. Use @code{window-put}
-instead.
+Do not attempt to change properties by modifying the property list in place.
+Use window-put instead.
 @end defun
 
 @defun window-remprop window property

Modified: trunk/src/windows.c
==============================================================================
--- trunk/src/windows.c	(original)
+++ trunk/src/windows.c	Tue Aug  5 20:28:11 2008
@@ -733,10 +733,10 @@
 		if (ph->prop == prop && old != val)
 		    ph->callback (VWIN (win), prop, old, val);
 	    }
-	    rep_CAR(rep_CDR(plist)) = val;
+	    rep_CADR(plist) = val;
 	    return val;
 	}
-	plist = rep_CDR(rep_CDR(plist));
+	plist = rep_CDDR(plist);
     }
     plist = Fcons(prop, Fcons(val, VWIN(win)->plist));
     if (plist != rep_NULL)
@@ -784,13 +784,12 @@
 Returns the property list of the window window which is of the form
 (prop value prop value ...).
 
-The returned list is ``copied once'', i.e., its structure is copied,
-but elements other than atom, lists for example, are the original ones.
-Do NOT modify them to change the property value. Use window-put instead.
+Do not attempt to change properties by modifying the property list in place.
+Use window-put instead.
 ::end:: */
 {
     rep_DECLARE1(win, XWINDOWP);
-    return Fcopy_sequence (VWIN(win)->plist);
+    return VWIN(win)->plist;
 }
 
 DEFUN("window-name", Fwindow_name, Swindow_name, (repv win), rep_Subr1) /*



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