[sawfish] Final tabs-ng code: - improved tab-refresh-group - added support for maximized/unmaxmized, focus-mod



commit 7e0ea1a1e418a36300484714273de816c234dd73
Author: Christopher Roy Bratusek <zanghar freenet de>
Date:   Tue Feb 22 20:40:34 2011 +0100

    Final tabs-ng code:
    - improved tab-refresh-group
    - added support for maximized/unmaxmized, focus-mode, gravity, sticky-viewport and never-maximized
    - small fix in beofre-move-resize

 ChangeLog                        |    4 +
 lisp/sawfish/wm/tabs/tabgroup.jl |  122 +++++++++++++++++++++++---------------
 2 files changed, 79 insertions(+), 47 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9efed86..6757490 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,10 @@
 	maybe-raise-tab. Instead make, what was tab-raise-on-hover the
 	predefined behaviour.
 
+	* lisp/sawfish/wm/tabs/tabgroup.jl: improved tab-refresh-group, added
+	support for maximized/unmaxmized, focus-mode, gravity, sticky-viewport
+	and never-maximize. Small fix for before-move-resize [fuchur]
+
 	* KEYBINDINGS: small update
 
 2011-02-21  Christopher Roy Bratusek <zanghar freenet de>
diff --git a/lisp/sawfish/wm/tabs/tabgroup.jl b/lisp/sawfish/wm/tabs/tabgroup.jl
index 23a1fab..02f7bc4 100644
--- a/lisp/sawfish/wm/tabs/tabgroup.jl
+++ b/lisp/sawfish/wm/tabs/tabgroup.jl
@@ -152,8 +152,8 @@
 
   (define (tab-refresh-group win prop)
     "Refresh the entire group containing WIN according to PROP.
-PROP can be one of the symbols: raise, frame, reframe, style, move,
-resize, title-position, type, depth, shade, unshade, iconify, uniconify,
+PROP can be one of the symbols: raise, frame, reframe, reframe-all, style, move,
+resize, title-position, type, depth, shade, unshade, iconify, uniconify, maximized,
 sticky, unsticky, fixed-position."
     (when tab-refresh-lock
       (setq tab-refresh-lock nil)
@@ -177,64 +177,70 @@ sticky, unsticky, fixed-position."
               (rebuild-frame focus))
              ((eq prop 'reframe)
               (mapcar (lambda (w)
+                        (reframe-window w)) unfocus))
+             ((eq prop 'reframe-all)
+              (mapcar (lambda (w)
                         (reframe-window w)) unfocus)
               (reframe-window focus))
+             ((or (eq prop 'move) (eq prop 'resize))
+              (let ((dim (window-frame-dimensions win))
+                    (pos (window-position win)))
+                (mapcar (lambda (w)
+                          (tab-move-resize-frame-window-to w (car pos) (cdr pos) (car dim) (cdr dim))) unfocus)))
              ((eq prop 'style)
               (let ((group-frame-style (window-get win 'frame-style))
                     (dim (window-frame-dimensions win))
                     (pos (window-position win)))
                 (mapcar (lambda (w)
                           (set-frame-style w group-frame-style)
-                          (tab-move-resize-frame-window-to w (car pos) (cdr pos) (car dim) (cdr dim))) unfocus)
-                (set-frame-style focus group-frame-style)
-                (tab-move-resize-frame-window-to focus (car pos) (cdr pos) (car dim) (cdr dim))))
-             ((or (eq prop 'move) (eq prop 'resize))
-              (let ((dim (window-frame-dimensions win))
-                    (pos (window-position win)))
-                (mapcar (lambda (w)
-                          (tab-move-resize-frame-window-to w (car pos) (cdr pos) (car dim) (cdr dim))) unfocus)
-                (tab-move-resize-frame-window-to focus (car pos) (cdr pos) (car dim) (cdr dim))
-                (rplaca (nthcdr index tab-groups)
-                        (tab-build-group pos dim wins))))
+                          (tab-move-resize-frame-window-to w (car pos) (cdr pos) (car dim) (cdr dim))) unfocus)))
              ((eq prop 'fixed-position)
               (let ((group-frame-fixed-position (window-get win 'fixed-position)))
                 (mapcar (lambda (w)
-                          (window-put w 'fixed-position group-frame-fixed-position)) unfocus)
-                (window-put focus 'fixed-position group-frame-fixed-position)))
+                          (window-put w 'fixed-position group-frame-fixed-position)) unfocus)))
              ((eq prop 'type)
               (let ((group-frame-type (window-get win 'type)))
                 (mapcar (lambda (w)
-                          (window-put w 'type group-frame-type)) unfocus)
-                (window-put focus 'type group-frame-type)))
+                          (window-put w 'type group-frame-type)) unfocus)))
              ((eq prop 'depth)
               (let ((group-frame-depth (window-get win 'depth)))
                 (mapcar (lambda (w)
                           (window-put w 'depth group-frame-depth)) unfocus)
-                 (window-put focus 'depth group-frame-depth)))
+                (raise-window win)
+                (set-input-focus win)))
              ((eq prop 'iconify)
               (mapcar (lambda (w)
-                        (iconify-window w)) unfocus)
-              (iconify-window focus))
+                        (iconify-window w)) unfocus))
              ((eq prop 'uniconify)
               (mapcar (lambda (w)
-                        (uniconify-window w)) unfocus)
-              (uniconify-window focus))
+                        (uniconify-window w)) unfocus))
+             ((eq prop 'maximized)
+              (let ((dim (window-frame-dimensions win))
+                    (pos (window-position win))
+                    (group-frame-maximized-vertically (window-get win 'maximized-vertically))
+                    (group-frame-maximized-horizontally (window-get win 'maximized-horizontally))
+                    (group-frame-maximized-fullscreen (window-get win 'maximized-fullscreen))
+                    (group-frame-unmaximized-type (window-get win 'unmaximized-type))
+                    (group-frame-unmaximized-geometry (window-get win 'unmaximized-geometry)))
+                (mapcar (lambda (w)
+                          (window-put w 'maximized-vertically group-frame-maximized-vertically)
+                          (window-put w 'maximized-horizontally group-frame-maximized-horizontally)
+                          (window-put w 'maximized-fullscreen group-frame-maximized-fullscreen)
+                          (window-put w 'unmaximized-type group-frame-unmaximized-type)
+                          (window-put w 'unmaximized-geometry group-frame-unmaximized-geometry)
+                          (tab-move-resize-frame-window-to w (car pos) (cdr pos) (car dim) (cdr dim))) unfocus)))
              ((eq prop 'sticky)
               (mapcar (lambda (w)
-                        (make-window-sticky w)) unfocus)
-              (make-window-sticky focus))
+                        (make-window-sticky w)) unfocus))
              ((eq prop 'unsticky)
               (mapcar (lambda (w)
-                        (make-window-unsticky w)) unfocus)
-              (make-window-unsticky focus))
+                        (make-window-unsticky w)) unfocus))
              ((eq prop 'shade)
               (mapcar (lambda (w)
-                        (shade-window w)) unfocus) 
-              (shade-window focus))
+                        (shade-window w)) unfocus)) 
              ((eq prop 'unshade)
               (mapcar (lambda (w)
-                        (unshade-window w)) unfocus) 
-              (unshade-window focus))))
+                        (unshade-window w)) unfocus))))
         (setq tab-refresh-lock t))))
 
   ;; Entry points
@@ -250,11 +256,20 @@ sticky, unsticky, fixed-position."
              ;; adopt window settings for the new tab
              (group-frame-style (window-get win 'frame-style))
              (group-frame-type (window-get win 'type))
+             (group-frame-focus-mode (window-get win 'focus-mode))
+             (group-frame-gravity (window-get win 'gravity))
              (group-frame-sticky (window-get win 'sticky))
+             (group-frame-sticky-viewport (window-get win 'sticky-viewport))
              (group-frame-never-iconify (window-get win 'never-iconify))
              (group-frame-fixed-position (window-get win 'fixed-position))
              (group-frame-title-position (window-get win 'title-position))
-             (group-frame-depth (window-get win 'depth)))
+             (group-frame-depth (window-get win 'depth))
+             (group-frame-never-maximize (window-get win 'never-maximize))
+             (group-frame-maximized-vertically (window-get win 'maximized-vertically))
+             (group-frame-maximized-horizontally (window-get win 'maximized-horizontally))
+             (group-frame-maximized-fullscreen (window-get win 'maximized-fullscreen))
+             (group-frame-unmaximized-type (window-get win 'unmaximized-type))
+             (group-frame-unmaximized-geometry (window-get win 'unmaximized-geometry)))
         (when (not (eq index index2))
           ;; tabgroup to tabgroup
           (when (window-tabbed-p w)
@@ -264,11 +279,20 @@ sticky, unsticky, fixed-position."
           (if (window-get win 'shaded) (unshade-window win))
           (window-put w 'frame-style group-frame-style)
           (window-put w 'type group-frame-type)
+          (window-put w 'focus-mode group-frame-focus-mode)
+          (window-put w 'gravity group-frame-gravity)
           (window-put w 'title-position group-frame-title-position)
           (window-put w 'sticky group-frame-sticky)
+          (window-put w 'sticky-viewport group-frame-sticky-viewport)
           (window-put w 'never-iconify group-frame-never-iconify)
           (window-put w 'depth group-frame-depth)
           (window-put w 'fixed-position group-frame-fixed-position)
+          (window-put w 'never-maximize group-frame-never-maximize)
+          (window-put w 'maximized-vertically group-frame-maximized-vertically)
+          (window-put w 'maximized-horizontally group-frame-maximized-horizontally)
+          (window-put w 'maximized-fullscreen group-frame-maximized-fullscreen)
+          (window-put w 'unmaximized-type group-frame-unmaximized-type)
+          (window-put w 'unmaximized-geometry group-frame-unmaximized-geometry)
           ;; reframe w here, tab-refresh-group expectet
           ;; the same frame for w and win
           (reframe-window w)
@@ -334,21 +358,23 @@ sticky, unsticky, fixed-position."
 
   (define (before-move-resize win)
     "Releas win from the tabgroup and iconify the rest from the group."
-    (let* ((index (tab-window-group-index win))
-           (wins (tab-group-window-list (nth index tab-groups)))
-           (tabs (remove win (tab-group-window-list (nth index tab-groups))))
-	   (default-window-animator 'none))
-      (tab-delete-window-from-group win index)
-      (rebuild-frame win)
-      (setq tab-refresh-lock nil)
-      (mapcar (lambda (w)
-                (when (window-get w 'never-iconify)
-                  (window-put w 'never-iconify nil)
-                  (window-put w 'never-iconify-opaque t))
-		(iconify-window w)) tabs)
-      (setq all-wins wins)
-      (setq current-win win))
-    (setq tab-refresh-lock t))
+    (when (not (window-get win 'fixed-position))
+      (when (eq all-wins nil)
+        (let* ((index (tab-window-group-index win))
+               (wins (tab-group-window-list (nth index tab-groups)))
+               (tabs (remove win (tab-group-window-list (nth index tab-groups))))
+               (default-window-animator 'none))
+          (tab-delete-window-from-group win index)
+          (rebuild-frame win)
+          (setq tab-refresh-lock nil)
+          (mapcar (lambda (w)
+                    (when (window-get w 'never-iconify)
+                      (window-put w 'never-iconify nil)
+                      (window-put w 'never-iconify-opaque t))
+                    (iconify-window w)) tabs)
+          (setq all-wins wins)
+          (setq current-win win))
+        (setq tab-refresh-lock t))))
 
   (define (after-move-resize win)
     "Add all tabs to the tabgroup from win. (Releas and iconify by before-move-resize)"
@@ -394,7 +420,7 @@ sticky, unsticky, fixed-position."
                          (tab-refresh-group win 'frame))
                         ((eq 'frame-style args)
                          (tab-refresh-group win 'style)
-                         (tab-refresh-group win 'reframe)
+                         (tab-refresh-group win 'reframe-all)
                          (tab-refresh-group win 'move))
                         ((eq 'type args)
                          (tab-refresh-group win 'type)
@@ -414,6 +440,8 @@ sticky, unsticky, fixed-position."
     (add-hook 'unshade-window-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'unshade))))
     (add-hook 'iconify-window-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'iconify))))
     (add-hook 'uniconify-window-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'uniconify))))
+    (add-hook 'window-maximized-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'maximized))))
+    (add-hook 'window-unmaximized-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'maximized))))
     (add-hook 'add-to-workspace-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'frame))))
     (add-hook 'destroy-notify-hook tab-delete-window-from-tab-groups))
 



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