sawfish r4221 - in trunk: lisp/sawfish/wm themes/Crux themes/microGUI



Author: jkozicki
Date: Mon Feb 18 19:16:44 2008
New Revision: 4221
URL: http://svn.gnome.org/viewvc/sawfish?rev=4221&view=rev

Log:
patch by Harald van Dijk and Timo Korvola, "Titlebar updates"

When using a theme which updates itself as window titles change, such as the
default theme Crux, the updates happen at the wrong time, and the title bar
ends up messed up. When the netwm patch is applied, you can easily see this by
normal browsing in Mozilla Firefox, or editing a document in editors that
update the title to include "*" or "modified" when you start typing. This
happens because the themes look for updates to the WM_NAME property, but
sawfish now reads the _NET_WM_NAME property as well, so themes should check for
updates to that too. This patch updates the default themes, and to prevent
custom themes (not distributed with sawfish itself) from breaking, treats
(call-after-property-changed 'WM_NAME ...) as a special case that should also
check for _NEW_WM_NAME.



Modified:
   trunk/lisp/sawfish/wm/windows.jl
   trunk/themes/Crux/theme.jl
   trunk/themes/microGUI/theme.jl

Modified: trunk/lisp/sawfish/wm/windows.jl
==============================================================================
--- trunk/lisp/sawfish/wm/windows.jl	(original)
+++ trunk/lisp/sawfish/wm/windows.jl	Mon Feb 18 19:16:44 2008
@@ -201,7 +201,7 @@
 	     (nreverse out))))))
 
   (define (window-supports-wm-protocol-p w atom)
-    "Return true if winow W includes ATOM in its `WM_PROTOCOLS' property."
+    "Return true if window W includes ATOM in its `WM_PROTOCOLS' property."
     (let* ((prop (get-x-property w 'WM_PROTOCOLS))
 	   (data (and prop (eq (car prop) 'ATOM) (nth 2 prop))))
       (when data
@@ -437,10 +437,24 @@
   (define (call-after-property-changed prop fun)
     "Arrange for function FUN to be called with arguments (WINDOW PROPERTY
 STATE) when the X11 property named PROP (a symbol) changes. PROP may also
-be a list of property names to monitor."
-    (setq prop-changes (cons (cons (if (listp prop)
-				       prop
-				     (list prop)) fun) prop-changes)))
+be a list of property names to monitor.
+
+Kluge: if PROP is `WM_NAME', it is replaced with `(WM_NAME _NET_WM_NAME)'.
+This is done to cope with themes that want to update title bars on name
+changes but only watch `WM_NAME'.  A warning is printed on stderr when
+this substitution occurs.  Those themes should really be fixed."
+    (setq prop-changes
+          (cons
+           (cons (cond ((listp prop) prop)
+                       ((eq prop 'WM_NAME)
+                        (format standard-error
+"(call-after-property-changed 'WM_NAME ...) should probably be
+(call-after-property-changed '(WM_NAME _NET_WM_NAME) ...);
+use '(WM_NAME) if you really want only WM_NAME\n")
+                        '(WM_NAME _NET_WM_NAME))
+                       (t (list prop)))
+                 fun)
+           prop-changes)))
   
   (add-hook 'property-notify-hook
 	    (lambda (w prop state)

Modified: trunk/themes/Crux/theme.jl
==============================================================================
--- trunk/themes/Crux/theme.jl	(original)
+++ trunk/themes/Crux/theme.jl	Mon Feb 18 19:16:44 2008
@@ -457,4 +457,4 @@
 (add-frame-style 'Crux get-frame)
 
 ;; recalibrate frames when the window-name changes
-(call-after-property-changed 'WM_NAME rebuild-frame)
+(call-after-property-changed '(WM_NAME _NET_WM_NAME) rebuild-frame)

Modified: trunk/themes/microGUI/theme.jl
==============================================================================
--- trunk/themes/microGUI/theme.jl	(original)
+++ trunk/themes/microGUI/theme.jl	Mon Feb 18 19:16:44 2008
@@ -351,5 +351,5 @@
 		       ((shaped-transient) shaped-transient-frame))))
 
   (call-after-property-changed
-   'WM_NAME (lambda ()
-	      (rebuild-frames-with-style 'microGUI))))
+   '(WM_NAME _NET_WM_NAME) (lambda ()
+                             (rebuild-frames-with-style 'microGUI))))



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