Re: Themes for 3.0



Hi,

On Thu, 4 Nov 2010 21:13:37 +0100
wrote Christopher Roy Bratusek <zanghar freenet de>:

>Well after doing some testing I removed a small portion:
>
>diff --git a/lisp/sawfish/wm/tabs/tabgroup.jl b/lisp/sawfish/wm/tabs/tabgroup.jl
>index bdfc95a..cd55e5a 100644
>--- a/lisp/sawfish/wm/tabs/tabgroup.jl
>+++ b/lisp/sawfish/wm/tabs/tabgroup.jl
>@@ -287,7 +287,7 @@
>       (make-group-unsticky w)))
>
>   (unless batch-mode
>-    (add-hook 'focus-in-hook raise-tab-group)
>+    ;(add-hook 'focus-in-hook raise-tab-group)
>     (add-hook 'window-state-change-hook
>               (lambda (win args)
>                 (if (= '(sticky) args)
>
>The reason why I did is pretty simple: it always raises a newly focused window.
>That is a bad behavior, as it overrides the settings I made (enter-exit, but not raising
>a window, unless I hit it's border (using raise-tabs-on-hover)).
>
>Chris

I have work on tab support.
Changes in tabgroup.jl:
Add "tabbed" to window properties if a window is in a tabbgroup and
remove it if release from group.
Add window-tabbed-p t if window in tabbgroup.
Don't use sawfish default groups for tabbed windows.
Only raise a tabbed-window if it is in tabgroup and get focus, and put
the select ( last event window / focus ) at the heights position in
tabgroup. 
Fix focus (give focus to last event window).
Add support for title-position call from theme.jl
Fix overlapping bug
(http://article.gmane.org/gmane.comp.window-managers.sawfish/7896).

Changes in theme.jl:
Improve icon switch.


With default and my custom settings it works, no overlapping,
windows/tabs got correct focus and so on. Please test it also with
yours settings and report if is something wrong. Thanks.

-- 
Regards,
Fuchur

GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
diff -urNad sawfish-git-9999.orgi/lisp/sawfish/wm/tabs/tabgroup.jl sawfish-git-9999/lisp/sawfish/wm/tabs/tabgroup.jl
--- sawfish-git-9999.orgi/lisp/sawfish/wm/tabs/tabgroup.jl	2011-02-09 17:42:24.000000000 +0100
+++ sawfish-git-9999/lisp/sawfish/wm/tabs/tabgroup.jl	2011-02-09 17:43:34.000000000 +0100
@@ -20,7 +20,9 @@
 
 (define-structure sawfish.wm.tabs.tabgroup
 
-    (export adjustment-title
+    (export window-tabbed-p
+            adjustment-title
+            tab-refresh-group
             tab-release-window
             tab-raise-left-window
             tab-raise-right-window
@@ -51,6 +53,9 @@
   (define tab-refresh-lock t)
   (define tab-move-lock t)
 
+  (define (window-tabbed-p w)
+    (window-get w 'tabbed))
+
   (define-record-type :tab-group
     (tab-build-group p d wl)
     tab-group?
@@ -61,7 +66,6 @@
   (define (adjustment-title w)
     (call-window-hook 'window-state-change-hook w (list '(title-position))))
 
-
   (define (tab-move-resize-frame-window-to win x y w h)
     "Move and resize according to *frame* dimensions."
     (let* ((dim1 (window-dimensions win))
@@ -83,24 +87,24 @@
     (let loop ((gr tab-groups))
       (cond
        ((null gr)
-	(tab-make-new-group win)
-	)
+        (tab-make-new-group win)
+        )
        ((member win (tab-group-window-list (car gr)))
-	(car gr))
+        (car gr))
        (t
-	(loop (cdr gr))))))
+        (loop (cdr gr))))))
 
   (define (tab-window-group-index win)
     "Return the index of the group containing win."
     (let loop ((index 0))
       (cond
        ((eq index (length tab-groups))
-	(tab-make-new-group win)
-	index)
+        (tab-make-new-group win)
+        index)
        ((member win (tab-group-window-list (nth index tab-groups)))
-	index)
+        index)
        (t
-	(loop (+ index 1))))))
+        (loop (+ index 1))))))
 
   (define (tab-rank elem list)
     (if (eq elem (car list))
@@ -115,10 +119,12 @@
           (setq tab-groups (delete old tab-groups))
         (rplaca (nthcdr index tab-groups)
                 (tab-build-group (tab-group-position old) (tab-group-dimensions old) l))
-        ;; releas from sawfish "default" group adopt by tab-group-window
-        (add-window-to-new-group win)
+        (window-put win 'tabbed nil)
+        (tab-refresh-group win 'raise)
         (tab-refresh-group win 'frame)
         (window-put win 'fixed-position nil)
+        (if (not (cdr l))
+            (window-put (car l) 'tabbed nil))
         (tab-refresh-group (car l) 'frame))))
 
   (define (tab-delete-window-from-tab-groups w)
@@ -135,7 +141,6 @@
                                (tab-group-dimensions group)
                                (append (tab-group-window-list group) (list win))))
       (tab-move-resize-frame-window-to win (car pos) (cdr pos) (car dim) (cdr dim))
-      (raise-group win)
       (rebuild-frame win)))
 
   (define (tab-refresh-group win prop)
@@ -147,9 +152,16 @@
       (setq tab-refresh-lock nil)
       (unwind-protect
           (let* ((index (tab-window-group-index win))
-                 (wins (tab-group-window-list (nth index tab-groups))))
+                 (wins (tab-group-window-list (nth index tab-groups)))
+                 (focus (tab-group-offset win 0)))
             (adjustment-title win)
             (cond
+             ((eq prop 'raise)
+              (raise-windows focus wins))
+             ((eq prop 'title-position)
+              (let ((group-title-position (window-get win 'title-position)))
+                (mapcar (lambda (w)
+                          (window-put w 'title-position group-title-position)) wins)))
              ((eq prop 'frame)
               (mapcar (lambda (w)
                         (rebuild-frame w)) wins))
@@ -212,13 +224,10 @@
                         (unshade-window w)
                         (rebuild-frame w)) wins))))
         (setq tab-refresh-lock t))))
-  
+
   ;; Entry points
   (define (tab-group-window w win)
     "Add window W to tabgroup containing WIN."
-    ;; unshade windows if add/remove
-    (unshade-window w)
-    (unshade-window win)
     (let* ((index (tab-window-group-index win))
            (index2 (tab-window-group-index w))
            ;; adopt window settings for the new tab
@@ -227,11 +236,16 @@
            (group-frame-sticky (window-get win 'sticky))
            (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))
-           ;; adopt group for the new tab
-           ;; use sawfish's "default" groups
-           (group-id (window-actual-group-id win)))
+           (group-frame-depth (window-get win 'depth)))
       (when (not (eq index index2))
+        ;; unshade windows if add/remove
+        (if (window-get w 'shaded)
+            (unshade-window w))
+        (if (window-get win 'shaded)
+            (unshade-window win))
+        (if (not (window-tabbed-p win))
+            (window-put win 'tabbed t))
+        (window-put w 'tabbed t)
         (window-put w 'frame-style group-frame-style)
         (window-put w 'type group-frame-type)
         (window-put w 'title-position group-frame-title-position)
@@ -245,10 +259,10 @@
         ;; ugly hack, don't know why it's needed, but new groups are
         ;; listed with pos (0,0):
         (tab-refresh-group win 'move)
-        (add-window-to-group w group-id)
         (tab-put-window-in-group w index)
         (tab-delete-window-from-group w index2)
-        (tab-refresh-group win 'frame))))
+        (tab-refresh-group win 'frame)
+        (tab-refresh-group w 'raise))))
 
   (define (tab-release-window w)
     "Release the window from its group."
@@ -291,6 +305,10 @@
              (lambda (w) (eq w win))
              (tab-group-window-list (tab-find-window win)))) )
 
+  (define (tab-group-raise win)
+    (if (window-tabbed-p win)
+        (tab-refresh-group win 'raise)))
+
   (define (tab-group-sticky win)
     (if (window-get win 'sticky)
         (tab-refresh-group win 'sticky)
@@ -299,18 +317,19 @@
   (unless batch-mode
     (add-hook 'window-state-change-hook
               (lambda (win args)
-		(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)
-		       (tab-refresh-group win 'reframe-style))
-		      ((eq 'type args)
-		       (tab-refresh-group win 'type))
-		      ((eq '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)
+                       (tab-refresh-group win 'reframe-style))
+                      ((eq 'type args)
+                       (tab-refresh-group win 'type))
+                      ((eq 'stacking args)
+                       (tab-refresh-group win 'depth)))))
+    
+    (add-hook 'focus-in-hook (lambda (win) (tab-group-raise 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)))
     ;; only update tabs by move if opaque move mode (opaque = slow)
diff -urNad sawfish-git-9999.orgi/themes/StyleTab/theme.jl sawfish-git-9999/themes/StyleTab/theme.jl
--- sawfish-git-9999.orgi/themes/StyleTab/theme.jl	2011-02-09 17:42:25.000000000 +0100
+++ sawfish-git-9999/themes/StyleTab/theme.jl	2011-02-09 17:48:45.000000000 +0100
@@ -51,7 +51,7 @@
 (defgroup StyleTab:right-bottom-buttons-group "Right Titlebar Bottom Buttons"
   :group (appearance StyleTab:group StyleTab:buttons-group StyleTab:right-buttons-group))
 
-(defcustom styletab:style 'Dark "Frame and button style. (after you set this, you'll need to restart Sawfish)"
+(defcustom styletab:style 'Dark "Frame and button style. (after you set this, you'll need to restart Sawfish)"
   :group (appearance StyleTab:group StyleTab:settings-group)
   :options (Reduce Dark DarkColor Silver SilverColor Smoothly)
   :type symbol)
@@ -472,150 +472,152 @@
    tabbar-horizontal-left-edge-keymap "Button1-Off"
    '(call-command
      (lambda ()
-       (if (not (window-get (current-event-window) 'title-position))
+       (require 'sawfish.wm.tabs.tabgroup)
+       (setq w (current-event-window))
+       (if (not (window-get w 'title-position))
            (case styletab:titlebar-place
                  ((top) (setq current-title 'top))
                  ((bottom) (setq current-title 'bottom))
                  ((left) (setq current-title 'left))
                  ((right) (setq current-title 'right)))
-         (setq current-title (window-get (current-event-window) 'title-position)))
-       (unshade-window (current-event-window))
-       (setq pos-x (car (window-position (current-event-window))))
-       (setq pos-y (cdr (window-position (current-event-window))))
-       (setq dim (window-dimensions (current-event-window)))
-       (setq fdim (window-frame-dimensions (current-event-window)))
+         (setq current-title (window-get w 'title-position)))
+       (unshade-window w)
+       (setq pos-x (car (window-position w)))
+       (setq pos-y (cdr (window-position w)))
+       (setq dim (window-dimensions w))
+       (setq fdim (window-frame-dimensions w))
        (setq framew (/ (- (+ (car fdim) (cdr fdim)) (+ (car dim) (cdr dim) styletab:title-dimension)) 3))
        (if (eq current-title 'right)
            (setq framehigh 0)
-         (if (or (eq (window-get (current-event-window)
+         (if (or (eq (window-get w
                                  'type) 'default)
-                 (eq (window-get (current-event-window)
+                 (eq (window-get w
                                  'type) 'transient))
              (setq framehigh (+ (- styletab:title-dimension (* styletab:borders-dimension 2)) framew))
            (setq framehigh (+ styletab:title-dimension framew))))
-       (setq dim-x (- (car (window-dimensions (current-event-window)))
+       (setq dim-x (- (car (window-dimensions w))
                       framehigh))
-       (setq dim-y (+ (cdr (window-dimensions (current-event-window)))
+       (setq dim-y (+ (cdr (window-dimensions w))
                       framehigh))
        (if (<= pos-x 0) (setq pos-x 0))
-       (map-window-group 
-        (lambda (x)
-          (window-put x 'title-position 'left)) (current-event-window))
-       (call-window-hook 'window-state-change-hook (current-event-window) (list '(title-position)))
-       (map-window-group (lambda (x) (reframe-window x)) (current-event-window))
-       (move-window-to (current-event-window) pos-x pos-y)
-       (resize-window-to (current-event-window) dim-x dim-y))))
+       (window-put w 'title-position 'left)
+       (tab-refresh-group w 'title-position)
+       (call-window-hook 'window-state-change-hook w (list '(title-position)))
+       (tab-refresh-group w 'reframe)
+       (move-window-to w pos-x pos-y)
+       (resize-window-to w dim-x dim-y))))
   (bind-keys
    tabbar-horizontal-left-edge-keymap "Button2-Off"
    '(call-command
      (lambda ()
-       (if (not (window-get (current-event-window) 'title-position))
+       (require 'sawfish.wm.tabs.tabgroup)
+       (setq w (current-event-window))
+       (if (not (window-get w 'title-position))
            (case styletab:titlebar-place
                  ((top) (setq current-title 'top))
                  ((bottom) (setq current-title 'bottom))
                  ((left) (setq current-title 'left))
                  ((right) (setq current-title 'right)))
-         (setq current-title (window-get (current-event-window) 'title-position)))
-       (unshade-window (current-event-window))
-       (setq pos-x (car (window-position (current-event-window))))
-       (setq pos-y (cdr (window-position (current-event-window))))
-       (setq dim-x (car (window-dimensions (current-event-window))))
-       (setq dim-y (cdr (window-dimensions (current-event-window))))
-       (setq fdim (window-frame-dimensions (current-event-window)))
+         (setq current-title (window-get w 'title-position)))
+       (unshade-window w)
+       (setq pos-x (car (window-position w)))
+       (setq pos-y (cdr (window-position w)))
+       (setq dim-x (car (window-dimensions w)))
+       (setq dim-y (cdr (window-dimensions w)))
+       (setq fdim (window-frame-dimensions w))
        (setq framew (/ (- (+ (car fdim) (cdr fdim)) (+ dim-x dim-y styletab:title-dimension)) 3))
-
-       (setq type (window-get (current-event-window) 'type))
-
+       (setq type (window-get w 'type))
        (if (>= (+ pos-y dim-y styletab:title-dimension framew) (screen-height))
            (setq pos-y (- (screen-height) dim-y styletab:title-dimension framew)))
        (if (<= pos-y 0) (setq pos-y 0))
        (if (eq current-title 'top)
-           (map-window-group
-            (lambda (x)
-              (window-put x 'title-position 'bottom)) (current-event-window))
-         (map-window-group
-          (lambda (x)
-            (window-put x 'title-position 'top)) (current-event-window)))
-       (call-window-hook 'window-state-change-hook (current-event-window) (list '(title-position)))
-       (map-window-group (lambda (x) (reframe-window x)) (current-event-window))
-       (move-window-to (current-event-window) pos-x pos-y)
-       (resize-window-to (current-event-window) dim-x dim-y))))
+           (window-put w 'title-position 'bottom)      
+         (window-put w 'title-position 'top))
+       (if (eq current-title 'top)
+           (tab-refresh-group w 'title-position)
+         (tab-refresh-group w 'title-position))
+       (call-window-hook 'window-state-change-hook w (list '(title-position)))
+       (tab-refresh-group w 'reframe)
+       (move-window-to w pos-x pos-y)
+       (resize-window-to w dim-x dim-y))))
   (bind-keys
    tabbar-horizontal-left-edge-keymap "Button3-Off"
    '(call-command
      (lambda ()
-       (if (not (window-get (current-event-window) 'title-position))
+       (require 'sawfish.wm.tabs.tabgroup)
+       (setq w (current-event-window))
+       (if (not (window-get w 'title-position))
            (case styletab:titlebar-place
                  ((top) (setq current-title 'top))
                  ((bottom) (setq current-title 'bottom))
                  ((left) (setq current-title 'left))
                  ((right) (setq current-title 'right)))
-         (setq current-title (window-get (current-event-window) 'title-position)))
-       (unshade-window (current-event-window))
-       (setq pos-x (car (window-position (current-event-window))))
-       (setq pos-y (cdr (window-position (current-event-window))))
-       (setq dim (window-dimensions (current-event-window)))
-       (setq fdim (window-frame-dimensions (current-event-window)))
+         (setq current-title (window-get w 'title-position)))
+       (unshade-window w)
+       (setq pos-x (car (window-position w)))
+       (setq pos-y (cdr (window-position w)))
+       (setq dim (window-dimensions w))
+       (setq fdim (window-frame-dimensions w))
        (setq framew (/ (- (+ (car fdim) (cdr fdim)) (+ (car dim) (cdr dim) styletab:title-dimension)) 3))
        (if (eq current-title 'left)
            (setq framehigh 0)
-         (if (or (eq (window-get (current-event-window)
+         (if (or (eq (window-get w
                                  'type) 'default)
-                 (eq (window-get (current-event-window)
+                 (eq (window-get w
                                  'type) 'transient))
              (setq framehigh (+ (- styletab:title-dimension (* styletab:borders-dimension 2)) framew))
            (setq framehigh (+ styletab:title-dimension framew))))
-       (setq dim-x (- (car (window-dimensions (current-event-window)))
+       (setq dim-x (- (car (window-dimensions w))
                       framehigh))
-       (setq dim-y (+ (cdr (window-dimensions (current-event-window)))
+       (setq dim-y (+ (cdr (window-dimensions w))
                       framehigh))
        (if (>= (+ pos-x dim-x framehigh framew framew) (screen-width))
            (setq pos-x (- (screen-width) dim-x styletab:title-dimension framew)))
-       (map-window-group
-        (lambda (x)
-          (window-put x 'title-position 'right)) (current-event-window))
-       (call-window-hook 'window-state-change-hook (current-event-window) (list '(title-position)))
-       (map-window-group (lambda (x) (reframe-window x)) (current-event-window))
-       (move-window-to (current-event-window) pos-x pos-y)
-       (resize-window-to (current-event-window) dim-x dim-y)))))
+       (window-put w 'title-position 'right)
+       (tab-refresh-group w 'title-position)
+       (call-window-hook 'window-state-change-hook w (list '(title-position)))
+       (tab-refresh-group w 'reframe)
+       (move-window-to w pos-x pos-y)
+       (resize-window-to w dim-x dim-y)))))
 
 (def-frame-class tabbar-vertical-top-edge ()
   (bind-keys
    tabbar-vertical-top-edge-keymap "Button1-Off"
    '(call-command
      (lambda ()
-       (if (not (window-get (current-event-window) 'title-position))
+       (require 'sawfish.wm.tabs.tabgroup)
+       (setq w (current-event-window))
+       (if (not (window-get w 'title-position))
            (case styletab:titlebar-place
                  ((top) (setq current-title 'top))
                  ((bottom) (setq current-title 'bottom))
                  ((left) (setq current-title 'left))
                  ((right) (setq current-title 'right)))
-         (setq current-title (window-get (current-event-window) 'title-position)))
-       (unshade-window (current-event-window))
-       (setq pos-x (car (window-position (current-event-window))))
-       (setq pos-y (cdr (window-position (current-event-window))))
-       (setq dim-x (car (window-dimensions (current-event-window))))
-       (setq dim-y (cdr (window-dimensions (current-event-window))))
-       (setq dim (window-dimensions (current-event-window)))
-       (setq fdim (window-frame-dimensions (current-event-window)))
+         (setq current-title (window-get w 'title-position)))
+       (unshade-window w)
+       (setq pos-x (car (window-position w)))
+       (setq pos-y (cdr (window-position w)))
+       (setq dim-x (car (window-dimensions w)))
+       (setq dim-y (cdr (window-dimensions w)))
+       (setq dim (window-dimensions w))
+       (setq fdim (window-frame-dimensions w))
        (when (not (eq current-title 'left))
          (setq framew (/ (- (+ (car fdim) (cdr fdim)) (+ (car dim) (cdr dim) styletab:title-dimension)) 3))
          (if (eq current-title 'right)
              (setq framehigh 0)
            (setq framehigh (+ (- styletab:title-dimension (* styletab:borders-dimension 2)) framew)))
-         (setq dim-x (- (car (window-dimensions (current-event-window)))
+         (setq dim-x (- (car (window-dimensions w))
                         framehigh))
-         (setq dim-y (+ (cdr (window-dimensions (current-event-window)))
+         (setq dim-y (+ (cdr (window-dimensions w))
                         framehigh))
          (if (<= pos-x 0) (setq pos-x 0))
-         (map-window-group
-          (lambda (x)
-            (window-put x 'title-position 'left)) (current-event-window)))
+         (window-put w 'title-position 'left)
+         (tab-refresh-group w 'title-position))
        (when (eq current-title 'left)
          (setq framew (/ (- (+ (car fdim) (cdr fdim)) (+ dim-x dim-y styletab:title-dimension)) 3))
-         (if (or (eq (window-get (current-event-window)
+         (if (or (eq (window-get w
                                  'type) 'default)
-                 (eq (window-get (current-event-window)
+                 (eq (window-get w
                                  'type) 'transient))
              (setq framehigh (- styletab:title-dimension (* styletab:borders-dimension 2)))
            (setq framehigh styletab:title-dimension))
@@ -624,34 +626,35 @@
          (if (>= (+ pos-y dim-y styletab:title-dimension framew) (screen-height))
              (setq pos-y (- (screen-height) dim-y styletab:title-dimension framew)))
          (if (<= pos-y 0) (setq pos-y 0))
-         (map-window-group
-          (lambda (x)
-            (window-put x 'title-position 'bottom)) (current-event-window)))
-       (call-window-hook 'window-state-change-hook (current-event-window) (list '(title-position)))
-       (map-window-group (lambda (x) (reframe-window x)) (current-event-window))
-       (move-window-to (current-event-window) pos-x pos-y)
-       (resize-window-to (current-event-window) dim-x dim-y))))
+         (window-put w 'title-position 'bottom)
+         (tab-refresh-group w 'title-position))
+       (call-window-hook 'window-state-change-hook w (list '(title-position)))
+       (tab-refresh-group w 'reframe)
+       (move-window-to w pos-x pos-y)
+       (resize-window-to w dim-x dim-y))))
   (bind-keys
    tabbar-vertical-top-edge-keymap "Button2-Off"
    '(call-command
      (lambda ()
-       (if (not (window-get (current-event-window) 'title-position))
+       (require 'sawfish.wm.tabs.tabgroup)
+       (setq w (current-event-window))
+       (if (not (window-get w 'title-position))
            (case styletab:titlebar-place
                  ((top) (setq current-title 'top))
                  ((bottom) (setq current-title 'bottom))
                  ((left) (setq current-title 'left))
                  ((right) (setq current-title 'right)))
-         (setq current-title (window-get (current-event-window) 'title-position)))
-       (unshade-window (current-event-window))
-       (setq pos-x (car (window-position (current-event-window))))
-       (setq pos-y (cdr (window-position (current-event-window))))
-       (setq dim-x (car (window-dimensions (current-event-window))))
-       (setq dim-y (cdr (window-dimensions (current-event-window))))
-       (setq fdim (window-frame-dimensions (current-event-window)))
+         (setq current-title (window-get w 'title-position)))
+       (unshade-window w)
+       (setq pos-x (car (window-position w)))
+       (setq pos-y (cdr (window-position w)))
+       (setq dim-x (car (window-dimensions w)))
+       (setq dim-y (cdr (window-dimensions w)))
+       (setq fdim (window-frame-dimensions w))
        (setq framew (/ (- (+ (car fdim) (cdr fdim)) (+ dim-x dim-y styletab:title-dimension)) 3))
-       (if (or (eq (window-get (current-event-window)
+       (if (or (eq (window-get w
                                'type) 'default)
-               (eq (window-get (current-event-window)
+               (eq (window-get w
                                'type) 'transient))
            (setq framehigh (- styletab:title-dimension (* styletab:borders-dimension 2)))
          (setq framehigh styletab:title-dimension))
@@ -660,50 +663,50 @@
        (if (>= (+ pos-y dim-y styletab:title-dimension framew) (screen-height))
            (setq pos-y (- (screen-height) dim-y styletab:title-dimension framew)))
        (if (<= pos-y 0) (setq pos-y 0))
-       (map-window-group
-        (lambda (x)
-          (window-put x 'title-position 'top)) (current-event-window))
-       (call-window-hook 'window-state-change-hook (current-event-window) (list '(title-position)))
-       (map-window-group (lambda (x) (reframe-window x)) (current-event-window))
-       (move-window-to (current-event-window) pos-x pos-y)
-       (resize-window-to (current-event-window) dim-x dim-y))))
+       (window-put w 'title-position 'top)
+       (tab-refresh-group w 'title-position)
+       (call-window-hook 'window-state-change-hook w (list '(title-position)))
+       (tab-refresh-group w 'reframe)
+       (move-window-to w pos-x pos-y)
+       (resize-window-to w dim-x dim-y))))
   (bind-keys
    tabbar-vertical-top-edge-keymap "Button3-Off"
    '(call-command
      (lambda ()
-       (if (not (window-get (current-event-window) 'title-position))
+       (require 'sawfish.wm.tabs.tabgroup)
+       (setq w (current-event-window))
+       (if (not (window-get w 'title-position))
            (case styletab:titlebar-place
                  ((top) (setq current-title 'top))
                  ((bottom) (setq current-title 'bottom))
                  ((left) (setq current-title 'left))
                  ((right) (setq current-title 'right)))
-         (setq current-title (window-get (current-event-window) 'title-position)))
-       (unshade-window (current-event-window))
-       (setq pos-x (car (window-position (current-event-window))))
-       (setq pos-y (cdr (window-position (current-event-window))))
-       (setq dim-x (car (window-dimensions (current-event-window))))
-       (setq dim-y (cdr (window-dimensions (current-event-window))))
-       (setq dim (window-dimensions (current-event-window)))
-       (setq fdim (window-frame-dimensions (current-event-window)))
+         (setq current-title (window-get w 'title-position)))
+       (unshade-window w)
+       (setq pos-x (car (window-position w)))
+       (setq pos-y (cdr (window-position w)))
+       (setq dim-x (car (window-dimensions w)))
+       (setq dim-y (cdr (window-dimensions w)))
+       (setq dim (window-dimensions w))
+       (setq fdim (window-frame-dimensions w))
        (when (not (eq current-title 'right))
          (setq framew (/ (- (+ (car fdim) (cdr fdim)) (+ (car dim) (cdr dim) styletab:title-dimension)) 3))
          (if (eq current-title 'left)
              (setq framehigh 0)
            (setq framehigh (+ (- styletab:title-dimension (* styletab:borders-dimension 2)) framew)))
-         (setq dim-x (- (car (window-dimensions (current-event-window)))
+         (setq dim-x (- (car (window-dimensions w))
                         framehigh))
-         (setq dim-y (+ (cdr (window-dimensions (current-event-window)))
+         (setq dim-y (+ (cdr (window-dimensions w))
                         framehigh))
          (if (>= (+ pos-x dim-x) (screen-width))
              (setq pos-x (- (screen-width) dim-x styletab:title-dimension framew)))
-         (map-window-group
-          (lambda (x)
-            (window-put x 'title-position 'right)) (current-event-window)))
+         (window-put w 'title-position 'right)
+         (tab-refresh-group w 'title-position))
        (when (eq current-title 'right)
          (setq framew (/ (- (+ (car fdim) (cdr fdim)) (+ dim-x dim-y styletab:title-dimension)) 3))
-         (if (or (eq (window-get (current-event-window)
+         (if (or (eq (window-get w
                                  'type) 'default)
-                 (eq (window-get (current-event-window)
+                 (eq (window-get w
                                  'type) 'transient))
              (setq framehigh (- styletab:title-dimension (* styletab:borders-dimension 2)))
            (setq framehigh styletab:title-dimension))
@@ -712,13 +715,12 @@
          (if (>= (+ pos-y dim-y styletab:title-dimension framew) (screen-height))
              (setq pos-y (- (screen-height) dim-y styletab:title-dimension framew)))
          (if (<= pos-y 0) (setq pos-y 0))
-         (map-window-group
-          (lambda (x)
-            (window-put x 'title-position 'bottom)) (current-event-window)))
-       (call-window-hook 'window-state-change-hook (current-event-window) (list '(title-position)))
-       (map-window-group (lambda (x) (reframe-window x)) (current-event-window))
-       (move-window-to (current-event-window) pos-x pos-y)
-       (resize-window-to (current-event-window) dim-x dim-y)))))
+         (window-put w 'title-position 'bottom)
+         (tab-refresh-group w 'title-position))
+       (call-window-hook 'window-state-change-hook w (list '(title-position)))
+       (tab-refresh-group w 'reframe)
+       (move-window-to w pos-x pos-y)
+       (resize-window-to w dim-x dim-y)))))
 
 (defvar prev-button-keymap
   (bind-keys (make-keymap)
@@ -737,18 +739,19 @@
    frame-typ-button-keymap "Button1-Off"
    '(call-command
      (lambda ()
-       (if (not (window-get (current-event-window) 'title-position))
+       (setq w (current-event-window))
+       (if (not (window-get w 'title-position))
            (case styletab:titlebar-place
                  ((top) (setq current-title 'top))
                  ((bottom) (setq current-title 'bottom))
                  ((left) (setq current-title 'left))
                  ((right) (setq current-title 'right)))
-         (setq current-title (window-get (current-event-window) 'title-position)))
-       (setq pos-x (car (window-position (current-event-window))))
-       (setq pos-y (cdr (window-position (current-event-window))))
-       (setq dim-x (car (window-dimensions (current-event-window))))
-       (setq dim-y (cdr (window-dimensions (current-event-window))))
-       (setq type (window-get (current-event-window) 'type))
+         (setq current-title (window-get w 'title-position)))
+       (setq pos-x (car (window-position w)))
+       (setq pos-y (cdr (window-position w)))
+       (setq dim-x (car (window-dimensions w)))
+       (setq dim-y (cdr (window-dimensions w)))
+       (setq type (window-get w 'type))
        (if (eq type 'default)
            (setq typ 'transient)
          (setq typ 'default))
@@ -771,25 +774,26 @@
                       (eq current-title 'bottom)))
            (setq dim-x (+ dim-x styletab:borders-dimension))
            (setq dim-y (- dim-y styletab:borders-dimension))))
-       (set-window-type (current-event-window) typ)
-       (move-resize-window-to (current-event-window) pos-x pos-y dim-x dim-y))))
+       (set-window-type w typ)
+       (move-resize-window-to w pos-x pos-y dim-x dim-y))))
 
   (bind-keys
    frame-typ-button-keymap "Button2-Off"
    '(call-command
      (lambda ()
-       (if (eq (window-get (current-event-window) 'title-position) nil)
+       (setq w (current-event-window))
+       (if (eq (window-get w 'title-position) nil)
            (case styletab:titlebar-place
                  ((top) (setq current-title 'top))
                  ((bottom) (setq current-title 'bottom))
                  ((left) (setq current-title 'left))
                  ((right) (setq current-title 'right)))
-         (setq current-title (window-get (current-event-window) 'title-position)))
-       (setq pos-x (car (window-position (current-event-window))))
-       (setq pos-y (cdr (window-position (current-event-window))))
-       (setq dim-x (car (window-dimensions (current-event-window))))
-       (setq dim-y (cdr (window-dimensions (current-event-window))))
-       (setq type (window-get (current-event-window) 'type))
+         (setq current-title (window-get w 'title-position)))
+       (setq pos-x (car (window-position w)))
+       (setq pos-y (cdr (window-position w)))
+       (setq dim-x (car (window-dimensions w)))
+       (setq dim-y (cdr (window-dimensions w)))
+       (setq type (window-get w 'type))
        (when (or (eq type 'default)
                  (eq type 'transient))
          (setq typ 'shaped)
@@ -809,25 +813,26 @@
                  (eq current-title 'bottom))
              (setq dim-y (+ dim-y styletab:title-dimension))
            (setq dim-x (+ dim-x styletab:title-dimension))))
-       (set-window-type (current-event-window) 'unframed)
-       (move-resize-window-to (current-event-window) pos-x pos-y dim-x dim-y))))
+       (set-window-type w 'unframed)
+       (move-resize-window-to w pos-x pos-y dim-x dim-y))))
   
   (bind-keys
    frame-typ-button-keymap "Button3-Off"
    '(call-command
      (lambda ()
-       (if (not (window-get (current-event-window) 'title-position))
+       (setq w (current-event-window))
+       (if (not (window-get w 'title-position))
            (case styletab:titlebar-place
                  ((top) (setq current-title 'top))
                  ((bottom) (setq current-title 'bottom))
                  ((left) (setq current-title 'left))
                  ((right) (setq current-title 'right)))
-         (setq current-title (window-get (current-event-window) 'title-position)))
-       (setq pos-x (car (window-position (current-event-window))))
-       (setq pos-y (cdr (window-position (current-event-window))))
-       (setq dim-x (car (window-dimensions (current-event-window))))
-       (setq dim-y (cdr (window-dimensions (current-event-window))))
-       (setq type (window-get (current-event-window) 'type))
+         (setq current-title (window-get w 'title-position)))
+       (setq pos-x (car (window-position w)))
+       (setq pos-y (cdr (window-position w)))
+       (setq dim-x (car (window-dimensions w)))
+       (setq dim-y (cdr (window-dimensions w)))
+       (setq type (window-get w 'type))
        (if (or (eq type 'shaped)
                (eq type 'utility))
            (setq typ 'shaped-transient)
@@ -850,8 +855,8 @@
                       (eq current-title 'bottom)))
            (setq dim-x (- dim-x styletab:borders-dimension))
            (setq dim-y (+ dim-y styletab:borders-dimension))))
-       (set-window-type (current-event-window) typ)
-       (move-resize-window-to (current-event-window) pos-x pos-y dim-x dim-y)))))
+       (set-window-type w typ)
+       (move-resize-window-to w pos-x pos-y dim-x dim-y)))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; make images ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -2366,13 +2371,13 @@
 (add-frame-style theme-name
                  (lambda (w type)
                    (case type
-                         ((default)				normal-frame)
-                         ((shaped)				shaped-frame)
-                         ((transient)			transient-frame)
-                         ((shaped-transient)	shaped-transient-frame)
-                         ((utility)			    normal-frame)
-                         ((shaded-utility)	    normal-frame)
-                         ((unframed)			nil-frame))))
+                         ((default)             normal-frame)
+                         ((shaped)              shaped-frame)
+                         ((transient)           transient-frame)
+                         ((shaped-transient)    shaped-transient-frame)
+                         ((utility)             normal-frame)
+                         ((shaded-utility)      normal-frame)
+                         ((unframed)            nil-frame))))
 
 (define (current-title-w w)
   (if (not (window-get w 'title-position))

Attachment: signature.asc
Description: PGP signature



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