Re: Why does Sawfish dislike KDE dockable applications?



> People have tried to figure out the rest of it from the source:
> <URL:https://listman.redhat.com/archives/xdg-list/2002-March/msg00014.html>.

I tried to fix this based on the explanation there, code below.  It does
not quite work yet.  I ran into a couple of problems:
- How do I tell Sawfish not to reparent a window?  I am using
  (window-put w 'ignored t) but I sometimes still get reparenting
  fights.
- How do I add features to _NET_SUPPORTED?  wm-spec seems to overwrite
  it.  Currently I use after-initialization-hook to postpone my
  changes after loading wm-spec but I suppose that the
  initial windows of the session will not see the features then.

-- 
	Timo Korvola		<URL:http://www.iki.fi/tkorvola>

;;; Support for the KDE system tray protocol.  See
;;; https://listman.redhat.com/archives/xdg-list/2002-March/msg00014.html

(define (kde-system-tray-remove w)
  (let* ((tray-prop (get-x-property 'root '_KDE_NET_SYSTEM_TRAY_WINDOWS))
	 (winid (window-id w))
	 (tray-list (remove winid (vector->list (caddr tray-prop)))))
    (set-x-property 'root '_KDE_NET_SYSTEM_TRAY_WINDOWS
		    (list->vector tray-list) 'WINDOW 32)))

(define (kde-system-tray-handler w)
  (when (get-x-property w '_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR)
    (window-put w 'ignored t)
    (window-put w 'unmap-window-hook kde-system-tray-remove)
    (let* ((tray-prop (or (get-x-property 'root '_KDE_NET_SYSTEM_TRAY_WINDOWS)
			 '(WINDOW 32 [])))
	   (tray-list (vector->list (caddr tray-prop)))
	   (winid (window-id w)))
      (when (and winid
		 (not (member winid tray-list)))
	(set-x-property 'root '_KDE_NET_SYSTEM_TRAY_WINDOWS
			(list->vector (append tray-list (list winid)))
			'WINDOW 32)))))

(add-hook 'before-add-window-hook kde-system-tray-handler)

(define (kde-init-system-tray)
  (let* ((supp-prop (or (get-x-property 'root '_NET_SUPPORTED)
			'(ATOM 32 [])))
	 (supp-list (vector->list (caddr supp-prop)))
	 (changed nil))
    (mapc (lambda (s)
	    (when (not (memq s supp-list))
	      (setq supp-list (cons s supp-list))
	      (setq changed t)))
	  '(_KDE_NET_SYSTEM_TRAY_WINDOW_FOR
	    _KDE_NET_SYSTEM_TRAY_WINDOWS))
    (when changed
      (set-x-property 'root '_NET_SUPPORTED
		      (list->vector supp-list)
		      'ATOM 32))))

; Needs to be done after loading the wm-spec module.
(add-hook 'after-initialization-hook kde-init-system-tray)



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