[sawfish] Tab.



commit 0a679eb06a7d5376f5eed3b3943d5e68776e151e
Author: Teika kazura <teika lavabit com>
Date:   Tue Jan 18 12:43:40 2011 +0900

    Tab.
    
    * Replaced defvar-setq with plain setq, and defvar to define.
    * Simplified a hook function.
    * News and source comments.

 lisp/sawfish/wm/tabs/tab.jl      |   41 ++++++++++----------
 lisp/sawfish/wm/tabs/tabgroup.jl |   76 +++++++++++++++++---------------------
 lisp/sawfish/wm/util/compat.jl   |    6 ++-
 man/news.texi                    |   21 ++++++----
 4 files changed, 72 insertions(+), 72 deletions(-)
---
diff --git a/lisp/sawfish/wm/tabs/tab.jl b/lisp/sawfish/wm/tabs/tab.jl
index 7b77e30..902ec4f 100644
--- a/lisp/sawfish/wm/tabs/tab.jl
+++ b/lisp/sawfish/wm/tabs/tab.jl
@@ -1,4 +1,4 @@
-;; tab.jl - emulate fluxbox tab system
+;; tab.jl - frame handling of tab
 ;;
 ;; Copyright (C) Yann Hodique <Yann Hodique lifl fr>
 ;;
@@ -20,8 +20,7 @@
 
 (define-structure sawfish.wm.tabs.tab
 
-    (export tab-add-to-group 
-            set-tab-adjustments)
+    (export set-tab-adjustments)
 
     (open rep
 	  rep.system
@@ -37,25 +36,25 @@
   (define-structure-alias tab sawfish.wm.tabs.tab)
 
   ;; TODO:
-  ;; - change other tab sizes when window resizes itself, should fixed
   ;; - make calculations work with tiny windows, should fixed
   ;; - hide some frame parts on leftmost and rightmost tabs, should fixed
   ;; - add a drag-n-drop way to group windows by tabs
 
+  (define tabbar-left-dec-width)
+  (define tabbar-right-dec-width)
+  (define tabbar-left-margin)
+  (define tabbar-right-margin)
+  (define tabbar-left-margin-transient)
+  (define tabbar-right-margin-transient)
+
   (define (set-tab-adjustments #!key theme-left-dec-width theme-right-dec-width theme-left-margin
                                theme-right-margin theme-left-margin-transient theme-right-margin-transient)
-    (if theme-left-dec-width
-        (defvar-setq tabbar-left-dec-width theme-left-dec-width))
-    (if theme-right-dec-width
-        (defvar-setq tabbar-right-dec-width theme-right-dec-width))
-    (if theme-left-margin
-        (defvar-setq tabbar-left-margin theme-left-margin))
-    (if theme-right-margin
-        (defvar-setq tabbar-right-margin theme-right-margin))
-    (if theme-left-margin-transient
-        (defvar-setq tabbar-left-margin-transient theme-left-margin-transient))
-    (if theme-right-margin-transient
-        (defvar-setq tabbar-right-margin-transient theme-right-margin-transient)))
+    (setq tabbar-left-dec-width theme-left-dec-width)
+    (setq tabbar-right-dec-width theme-right-dec-width)
+    (setq tabbar-left-margin theme-left-margin)
+    (setq tabbar-right-margin theme-right-margin)
+    (setq tabbar-left-margin-transient theme-left-margin-transient)
+    (setq tabbar-right-margin-transient theme-right-margin-transient))
 
   (gaol-add set-tab-adjustments)
 
@@ -167,14 +166,18 @@
   (define-frame-class 'tabbar-vertical-bottom-edge
     `((bottom-edge . ,tab-bottom-edge)) t)
   
-  (define (mygroup win)
+  ;; This function is for interactive use. Use tab-group-window for lisp.
+  (define (tab-add-to-group win)
+    "Add a window to a tabgroup. Apply this command on a window, then
+on another. The first window will be added to the tabgroup containig
+the second."
     (if (marked-windows)
         (progn
           (apply-on-marked-windows (lambda (w) (tab-group-window w win)))
           (unmark-all-windows))
       (mark-window win)))
 
-  (define-command 'tab-add-to-group mygroup #:spec "%W"))
+  (define-command 'tab-add-to-group tab-add-to-group #:spec "%W"))
 
 ;;(require 'x-cycle)
 ;;(define-cycle-command-pair
@@ -188,5 +191,3 @@
 ;;                   )
 ;;    )
 ;;  #:spec "%W")
-
-;;(require 'sawfish.wm.util.window-order)
diff --git a/lisp/sawfish/wm/tabs/tabgroup.jl b/lisp/sawfish/wm/tabs/tabgroup.jl
index 61fa85f..c762db8 100644
--- a/lisp/sawfish/wm/tabs/tabgroup.jl
+++ b/lisp/sawfish/wm/tabs/tabgroup.jl
@@ -1,4 +1,4 @@
-;; tabgroup.jl - emulate fluxbox tab system
+;; tabgroup.jl - tab main
 ;;
 ;; Copyright (C) Yann Hodique <Yann Hodique lifl fr>
 ;;
@@ -18,9 +18,6 @@
 ;; along with sawfish; see the file COPYING.  If not, write to
 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
-;; TODO
-;; Tabgroup to tabgroup
-
 (define-structure sawfish.wm.tabs.tabgroup
 
     (export tab-release-window
@@ -49,9 +46,9 @@
 
   (define-structure-alias tabgroup sawfish.wm.tabs.tabgroup)
 
-  (defvar tab-groups nil)
-  (defvar tab-refresh-lock t)
-  (defvar tab-move-lock t)
+  (define tab-groups nil)
+  (define tab-refresh-lock t)
+  (define tab-move-lock t)
 
   (define-record-type :tab-group
     (tab-build-group p d wl)
@@ -61,7 +58,7 @@
     (wl tab-group-window-list))
 
   (define (tab-move-resize-frame-window-to win x y w h)
-    "move and resize according to *frame* dimensions"
+    "Move and resize according to *frame* dimensions."
     (let* ((dim1 (window-dimensions win))
            (dim2 (window-frame-dimensions win))
            (dw (- (car dim2) (car dim1)))
@@ -69,7 +66,7 @@
       (move-resize-window-to win x y (- w dw) (- h dh))))
 
   (define (tab-make-new-group win)
-    "Return a new group containing only win"
+    "Return a new group containing only WIN."
     (let* ((pos (window-position win))
            (dim (window-frame-dimensions win))
            (group (tab-build-group pos dim (list win))))
@@ -77,7 +74,7 @@
       group))
 
   (define (tab-find-window win)
-    "Return a group containing win"
+    "Return the group containing win."
     (let loop ((gr tab-groups))
       (cond
        ((null gr)
@@ -89,7 +86,7 @@
 	(loop (cdr gr))))))
 
   (define (tab-window-group-index win)
-    "Return the index of the group containing win"
+    "Return the index of the group containing win."
     (let loop ((index 0))
       (cond
        ((eq index (length tab-groups))
@@ -106,7 +103,7 @@
       (+ 1 (tab-rank elem (cdr list)))))
   
   (define (tab-delete-window-from-group win index)
-    "Remove a window from a group at given index"
+    "Remove WIN from the group at given index."
     (let* ((old (nth index tab-groups))
            (l (remove win (tab-group-window-list old))))
       (if (null l)
@@ -121,11 +118,11 @@
         (tab-refresh-group (car l) 'frame))))
 
   (define (tab-delete-window-from-tab-groups w)
-    "Find window's group and remove it"
+    "Find window's group and remove it."
     (tab-delete-window-from-group w (tab-window-group-index w)))
 
   (define (tab-put-window-in-group win index)
-    "Put window in group at given index"
+    "Put window in group at given index."
     (let* ((group (nth index tab-groups))
            (dim (tab-group-dimensions group))
            (pos (tab-group-position group)))
@@ -138,8 +135,10 @@
       (rebuild-frame win)))
 
   (define (tab-refresh-group win prop)
-    "Refresh the entire group containing win according to prop
-  prop can be one of the symbols : frame, reframe, reframe-style, move, resize, type, depth, shade, unshade, iconify, uniconify, fixed-position"
+    "Refresh the entire group containing WIN according to PROP.
+PROP can be one of the symbols : frame, reframe, reframe-style, move,
+resize, type, depth, shade, unshade, iconify, uniconify,
+fixed-position."
     (when tab-refresh-lock
       (setq tab-refresh-lock nil)
       (unwind-protect
@@ -211,11 +210,10 @@
   
   ;; Entry points
   (define (tab-group-window w win)
-    "Put active window in pointer-selected group"
+    "Add window W to tabgroup containing WIN."
     ;; unshade windows if add/remove
     (unshade-window w)
     (unshade-window win)
-    (interactive)
     (let* ((index (tab-window-group-index win))
            (index2 (tab-window-group-index w))
            ;; adopt window settings for the new tab
@@ -248,25 +246,25 @@
         (tab-refresh-group win 'frame))))
 
   (define (tab-release-window w)
-    "Release active window from its group"
+    "Release the window from its group."
     (tab-delete-window-from-tab-groups w)
     (tab-make-new-group w))
   
   (define-command 'tab-release-window tab-release-window #:spec "%f")
   
   (define (tab-group-offset win n)
-    "Return the window at position (pos+n) in window's group"
+    "Return the window at position (pos+n) in window's group."
     (let* ((gr (tab-group-window-list (tab-find-window win)))
            (size (length gr))
            (r (tab-rank win gr)))
       (nth (modulo (+ r n) size) gr)))
   
   (define (tab-same-group-p w1 w2)
-    "Predicate : true <=> w1 and w2 are grouped together"
+    "Predicate : true <=> w1 and w2 are grouped together."
     (member w1 (tab-group-window-list (tab-find-window w2))))
 
   (define (tab-raise-left-window)
-    "Raise left window in current group"
+    "Raise left window in current tab group."
     (let ((win (tab-group-offset (input-focus) -1)))
       (raise-window win)
       (set-input-focus win)))
@@ -274,7 +272,7 @@
   (define-command 'tab-raise-left-window tab-raise-left-window)
 
   (define (tab-raise-right-window)
-    "Raise right window in current group"
+    "Raise right window in current tab group."
     (let ((win (tab-group-offset (input-focus) 1)))
       (raise-window win)
       (set-input-focus win)))
@@ -296,25 +294,19 @@
   (unless batch-mode
     (add-hook 'window-state-change-hook
               (lambda (win args)
-                (if (= '(sticky) args)
-                  (tab-group-sticky win))))
-    (add-hook 'window-state-change-hook
-              (lambda (win args)
-                (if (= '(fixed-position) args)
-                    (tab-refresh-group win 'fixed-position))))
-    (add-hook 'window-state-change-hook
-              (lambda (win args)
-                (if (= '(frame-style) args)
-                    (adjustment-title win)
-		  (tab-refresh-group win 'reframe-style))))
-    (add-hook 'window-state-change-hook
-              (lambda (win args)
-                (if (= '(type) args)
-                    (tab-refresh-group win 'type))))
-    (add-hook 'window-state-change-hook
-              (lambda (win args)
-                (if (= '(stacking) args)
-                    (tab-refresh-group win 'depth))))
+		(setq args (car args))
+		(cond ((eq 'sticky args)
+		       (tab-group-sticky win))
+		      ((eq 'fixed-position args)
+		       (tab-refresh-group win 'fixed-position))
+		      ((eq 'frame-style args)
+		       (adjustment-title win)
+		       (tab-refresh-group win 'reframe-style))
+		      ((eq 'type args)
+		       (tab-refresh-group win 'type))
+		      ((eq 'stacking args)
+		       (tab-refresh-group win 'depth)))))
+  
     (add-hook 'before-move-hook (lambda (win) (adjustment-title win)))
     (add-hook 'after-move-hook (lambda (win) (tab-refresh-group win 'move)))
     (add-hook 'after-resize-hook (lambda (win) (tab-refresh-group win 'resize)))
diff --git a/lisp/sawfish/wm/util/compat.jl b/lisp/sawfish/wm/util/compat.jl
index 48581ca..9da33c4 100644
--- a/lisp/sawfish/wm/util/compat.jl
+++ b/lisp/sawfish/wm/util/compat.jl
@@ -129,7 +129,11 @@
           infinite-desktop.stop-at-workspace-borders
 	  edge-flip-enabled edge-flip-type edge-flip-only-when-moving
 	  infinite-desktop-p infinite-desktop.move-distance
-	  infinite-desktop.move-cursor-distance ))
+	  infinite-desktop.move-cursor-distance
+	  tab-left-dec-width tab-right-dec-width
+	  tab-left-margin tab-right-margin
+	  tab-left-margin-transient tab-right-margin-transient
+	  ))
 
 ;;; obsolete custom setters
 
diff --git a/man/news.texi b/man/news.texi
index 2130aff..5d25f86 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -200,19 +200,22 @@ It returns the list of all commands. (@pxref{Operations on Commands}).
 @item Misc Changes
 @itemize @minus
 
- item Tabs-NG [fuchur]
+ item Tabs and themes [fuchur]
 
-Sawfish's tabbed window system is revised. Most changes are internal, but a few user-visible
-ones have been done, too. When a lot of windows are open, it should now be more responsive.
+A new, tab-capable, highly configurable theme ``DarkTab'' is added. It
+allows the tab-bar to appear in top, left, right, and bottom. Use a
+new window rule @code{title-position} for it. ``DarkTab'' is now the
+default theme.
 
-You no longer need to change the tab-adjustments via SawfishConfig, when changing or customizing tab-enabled themes
-(this is now done internally).
+Many improvements in tab system are done. For example, stickiness change
+on a window applies to all other windows in the same tab group, though
+maybe not yet complete. (Please tell us things you noticed.)
 
-Also there are now vertical and horizontal tabbar-prototypes available (see @code{DarkTab} theme), with a keymap both.
-The window-matcher @code{title-position} ensures that the position of the title will be restored, when using the @code{DarkTab} theme.
+When you use a tab capable theme (Elberg-Tabbed or Get-S-Tabbed), you
+had to manually adjust positions by pixel, but it's not necessary any
+more.
 
- item The themes @code{Elberg-Tabbed} and @code{Get-S-Tabbed} have been updated to work
-with Tabs-NG. The theme @code{DarkTab} made by fuchur is now the default theme.
+When a lot of windows are open, they should now be more responsive.
 
 @item Behavior modification at focus-in [Harald van Dijk]
 



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