Browse all patches |
Author[]
Harald van Dijk and Timo Korvola
Synopsis[]
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
.
Patch[]
diff --git a/lisp/sawfish/wm/windows.jl b/lisp/sawfish/wm/windows.jl index ca92acb..c9de526 100644 --- a/lisp/sawfish/wm/windows.jl +++ b/lisp/sawfish/wm/windows.jl @@ -201,7 +201,7 @@ supported by client window W." (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 @@ returned in the list." (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) diff --git a/themes/Crux/theme.jl b/themes/Crux/theme.jl index 59c6f95..50d1688 100644 --- a/themes/Crux/theme.jl +++ b/themes/Crux/theme.jl @@ -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) diff --git a/themes/microGUI/theme.jl b/themes/microGUI/theme.jl index 805471f..6d2ebff 100644 --- a/themes/microGUI/theme.jl +++ b/themes/microGUI/theme.jl @@ -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))))
Community's reasons for inclusion or rejection[]
Patch submitters, please vote also! Yes, obviosuly your vote will be positive, but it's the place to give your explanation why this patch is good for all Sawfish users, and why it is correct - good reasons for inclusion.
When voting anonymously please write your name, so that it can be associated with your posts on the mailing list. If you are logged in you can sign yourself by typing four tilda characters: ~~~~.
vote: yes. I'm using this patch and it fixed my titlebar updating problem - Gabor Z.Papp
vote: yes. Cleaned it up a bit and also fixed a completely unrelated typo while I was at it. I am still a bit unsure about this kluge but perhaps it is necessary at least as a temporary measure because the introduction of _NET_WM_NAME affects a lot of themes. - Tkorvola 21:55, 2 February 2008 (UTC)
vote: yes. I've been using this patch since about a week and it fixes the updating problem when switching tabs in Mozilla-based browsers. I didn't see any new problems coming from it, either. -- Peter
vote: yes. wow, lots of positive votes. Patch applied to 1.3.3, thanks a lot for trying it! Janek Kozicki 19:16, 18 February 2008 (UTC)