WM Spec stacking compliance fix



According to

http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#STACKINGORDER

<quote>
Stacking order

To obtain good interoperability between different Desktop Environments,
the following layered stacking order is recommended, from the bottom: 

      * windows of type _NET_WM_TYPE_DESKTOP
        
      * windows having state _NET_WM_STATE_BELOW
        
      * windows not belonging in any other layer
        
      * windows of type _NET_WM_TYPE_DOCK (unless they have state
        _NET_WM_TYPE_BELOW) and windows having state _NET_WM_STATE_ABOVE
        
      * focused windows having state _NET_WM_STATE_FULLSCREEN
</quote>

Sawfish respect most of these _NET_WM types, but fullscreen and dock
aren't treated according to this specification. Sawfish does recognize
"dock", but does not keep it on top of all other windows. Using
matched-windows or changing the dock-window-depth to "2" works most of
the time. 

But if you want to run an app fullscreen, the dock will stay above this
app. This is of course undesired. The code below fixes this by
temporarily raises the window depth by 4.

This results in an overall stacking depth logic of sawfish:

desktop: -4
state_below: -2
regular window: 0
dock window: +2 (the below state will force it back to 0)
fullscreen: +4

Here is the patch against sawfish cvs HEAD.
-- 
Fruhwirth Clemens - http://clemens.endorphin.org 
for robots: sp4mtrap endorphin org
Index: lisp/sawfish/wm/windows.jl
===================================================================
RCS file: /cvs/gnome/sawfish/lisp/sawfish/wm/windows.jl,v
retrieving revision 1.32
diff -u -r1.32 windows.jl
--- lisp/sawfish/wm/windows.jl	27 Mar 2003 06:30:30 -0000	1.32
+++ lisp/sawfish/wm/windows.jl	9 Aug 2005 12:20:52 -0000
@@ -99,7 +99,7 @@
   (defvar desktop-window-depth -4
     "The stacking depth of desktop windows.")
 
-  (defvar dock-window-depth 0
+  (defvar dock-window-depth 2
     "The stacking depth of dock windows.")
 
 
Index: lisp/sawfish/wm/state/maximize.jl
===================================================================
RCS file: /cvs/gnome/sawfish/lisp/sawfish/wm/state/maximize.jl,v
retrieving revision 1.67
diff -u -r1.67 maximize.jl
--- lisp/sawfish/wm/state/maximize.jl	23 Sep 2002 07:33:17 -0000	1.67
+++ lisp/sawfish/wm/state/maximize.jl	9 Aug 2005 12:20:53 -0000
@@ -63,7 +63,8 @@
 	  sawfish.wm.util.display-window
 	  sawfish.wm.util.stacking
 	  sawfish.wm.frames
-	  sawfish.wm.misc)
+	  sawfish.wm.misc
+	  sawfish.wm.stacking)
 
   (define-structure-alias maximize sawfish.wm.state.maximize)
 
@@ -93,6 +94,9 @@
   ;; called when a window is un-maximized, args (W #!optional DIRECTION)
   (defvar window-unmaximized-hook nil)
 
+  ;; value to add to window-depth when window becomes fullscreen
+  (defvar window-fullscreen-depth-offset 4)
+
 
 ;;; handling maximized state
 
@@ -500,9 +504,12 @@
 		   (head-dims (current-head-dimensions w)))
 	       (save-unmaximized-geometry w)
 	       (window-put w 'unmaximized-type (window-type w))
+	       (window-put w 'unmaximized-depth (window-depth w))
 	       (push-window-type w 'unframed 'sawfish.wm.state.maximize)
 	       (move-resize-window-to w (car head-offset) (cdr head-offset)
 				      (car head-dims) (cdr head-dims))
+	       (set-window-depth w (+ window-fullscreen-depth-offset 
+				    (window-depth w)))
 	       (raise-window* w)
 	       (window-put w 'maximized-fullscreen t)
 	       (window-put w 'maximized-vertically t)
@@ -513,7 +520,8 @@
 				 w (list '(maximized))))))
 
 	  ((and (not state) (window-maximized-fullscreen-p w))
-	   (unmaximize-window w 'fullscreen))))
+	   (set-window-depth w (window-get w 'unmaximized-depth))
+	   (unmaximize-window w 'fullscreen))))	
 
   (define (maximize-window-fullscreen-toggle w)
     (maximize-window-fullscreen w (not (window-maximized-fullscreen-p w))))

Attachment: signature.asc
Description: This is a digitally signed message part



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