Re: [Sawfish] Patch to save memory and speed up StyleTab

[ Thread Index | Date Index | More Archives ]


On Thu, 10 Apr 2014 01:58:24 +0200
wrote fuchur <flohtransporter@xxxxxxxxx>:

>On Wed, 9 Apr 2014 17:04:11 +0200
>wrote Christopher Roy Bratusek <nano@xxxxxxxxxxxxx>:
>>on a side-note: Tiling + Tabbing does not work well together. Not that
>>it actually should be a huge issue (how many will do both at the same
>>time?), but just wanted to inform you all.
>Yes that correct. Here i have a xinerama setup with two monitors and
>today i play first time with tiling and i have only "chaos" on my
>Windows over docks (panel, gkrellm).
>Windows half over xinerama head (from left to right and top to bottom).
>Windows disappear, and i don't get them back.
>Windows from tray appears on the desktop (goldendict).
>Different placement window mode not overwrite (interactively, under
>pointer ...)
>Errors in my ~/.xsession-errors by keypress:
>Lisp backtrace:
>#2   ws-inc-max ...
>#1   change-max-windows ...
>#0   call-command ...
>Sawfish error:
>Bad argument: #<closure ws-inc-max @ sawfish.wm.tile.tall>, t, 1
>Lisp backtrace:
>#2   eval ...
>#1   user-eval ...
>#0   call-command ...
>Sawfish error:
>Unbound variable: increase-cols
>No docs. That is that what i found (News) and i put this in my ~.sawfish/rc:
>(require 'sawfish.wm.tile.tile)
>(tall-tiling 0 #:width 1.75 #:top 0 #:bottom 0 #:gap 3 #:max 3 #:right nil #:resize t)
>(col-tiling 0 #:top 0 #:bottom 0 #:gap 3 #:cols 3 #:resize t)
>(bind-keys global-keymap
>"M-KP_Subtract" 'increase-max-windows
>"M-KP_Add" 'decrease-max-windows
>"Super-KP_Subtract" 'increase-cols
>"Super-KP_Add" 'decrease-cols
>"C-KP_Subtract" 'tall-rotate-right
>"C-KP_Add" 'tall-rotate-left
>"C-F11" 'next-tiling)
>For me, tab support is not the biggest problem for tiling.

Two patches to add tabsupport in the part from tiling which working
here. Also rename "tab-group-window-index" to "tab-group-windows"


GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
diff -urNad lisp.orgi/sawfish/wm/tabs/tab.jl lisp/sawfish/wm/tabs/tab.jl
--- lisp.orgi/sawfish/wm/tabs/tab.jl
+++ lisp/sawfish/wm/tabs/tab.jl
@@ -202,10 +202,10 @@
     (when (net-wm-window-type-normal-p win)
       (if marked-window
-            (setq marked-window (tab-group-window-index (car marked-window)))
+            (setq marked-window (tab-group-windows (car marked-window)))
             (tab-window-add-to-tabgroup win))
         (default-cursor (get-cursor marked-cursor-shape))
-        (setq marked-window (tab-group-window-index win))
+        (setq marked-window (tab-group-windows win))
         (mapcar (lambda (w) 
                   (window-put w 'marked t)
                   (emit-marked-hook w)) marked-window))))
diff -urNad lisp.orgi/sawfish/wm/tabs/tabgroup.jl lisp/sawfish/wm/tabs/tabgroup.jl
--- lisp.orgi/sawfish/wm/tabs/tabgroup.jl
+++ lisp/sawfish/wm/tabs/tabgroup.jl
@@ -31,8 +31,10 @@
-            tab-group-window-index
-            tab-group-window)
+            tab-group-windows
+            tab-group-windows-stacking-order
+            tab-group-window
+            tab-move-resize-lock)
     (open rep
@@ -57,6 +59,7 @@
   (define oldgroup nil)
   (define tab-groups nil)
   (define tab-refresh-lock t)
+  (define tab-move-resize-lock nil)
   (define release-window t)
   (define last-unmap-id nil)
   (define in-tab-group-name nil)
@@ -132,12 +135,22 @@
         (loop (+ index 1))))))
-  (define (tab-group-window-index win)
+  (define (tab-group-windows win)
     "Return the windows of the group containing WIN."
     (let* ((index (tab-window-group-index win))
            (wins (tab-group-window-list (nth index tab-groups))))
+  (define (tab-group-windows-stacking-order win)
+    "Return the windows of the group containing WIN sort by stacking order.."
+    (let* ((tabs (tab-group-windows win))
+           (all-wins (stacking-order))
+           order)
+      (mapcar (lambda (w)
+                (if (member w tabs)
+                    (setq order (append order (list w))))) all-wins)
+      order))
   (define (tab-rank elem list)
     "Returns the nth position from elem (tab) in a list (tabbar)"
     (if (eq elem (car list))
@@ -163,10 +176,10 @@
         (remove-from-tab-group w))
     (setq release-window t)
     (when (window-tabbed-p w)
-      (let ((wins (list (remove w (tab-group-window-index w)))))
+      (let ((wins (list (remove w (tab-group-windows w)))))
         (if (not (window-get w 'shaded))
             (mapcar (lambda (w)
-                      (unshade-window w)) (tab-group-window-index w)))
+                      (unshade-window w)) (tab-group-windows w)))
         (tab-delete-window-from-group w (tab-window-group-index w))
         (window-put w 'fixed-position nil)
         (tab-refresh-group oldgroup 'frame)
@@ -280,10 +293,10 @@
                               (if viewport-sticky
                                   (make-window-sticky/viewport w)
                                 (make-window-unsticky/viewport w)))) unfocus))))
-            (when (cdr (tab-group-window-index win))
+            (when (cdr (tab-group-windows win))
               (if not-shaded (unshade-window win))
               (mapcar (lambda (w)
-                        (shade-window w)) (remove win (tab-group-window-index win)))))
+                        (shade-window w)) (remove win (tab-group-windows win)))))
         (setq tab-refresh-lock t))))
   ;; Entry points
@@ -371,7 +384,7 @@
           (setq tab-refresh-lock t)
           (tab-refresh-group w 'frame)
           (set-input-focus w)
-          (call-hook 'tab-group-windows-hook (list (tab-group-window-index w)))
+          (call-hook 'tab-group-windows-hook (list (tab-group-windows w)))
           (if (not (window-tabbed-p win)) (window-put win 'tabbed t))
           (window-put w 'tabbed t)))))
@@ -413,7 +426,7 @@
   (define (move-tab w pos)
     "Move tab W to pos"
     (when (window-tabbed-p w)
-      (let* ((wins (tab-group-window-index w))
+      (let* ((wins (tab-group-windows w))
             (rank (tab-rank w wins))
             (list-end (nthcdr rank wins))
             (list-start wins)
@@ -470,7 +483,7 @@
   (define (move-tab-edge w pos)
     "Move tab W to pos"
     (when (window-tabbed-p w)
-      (let ((tabs (remove w (tab-group-window-index w))))
+      (let ((tabs (remove w (tab-group-windows w))))
         (if (eq pos 'end)
             (setq all-wins (append tabs (cons w nil))))
         (if (eq pos 'beg)
@@ -504,8 +517,9 @@
     "Releas WIN from the tabgroup and iconify the rest from the group."
     (let* ((default-window-animator 'none)
            (index (tab-window-group-index win))
-           (wins (tab-group-window-index win))
-           (tabs (remove win (tab-group-window-index win))))
+           (wins (tab-group-windows win))
+           (tabs (remove win (tab-group-windows win))))
+      (setq tab-move-resize-lock 't)
       (tab-delete-window-from-group win index)
       (reframe-window win)
       (setq tab-refresh-lock nil)
@@ -539,13 +553,14 @@
                     (window-put w 'never-iconify-opaque nil)
                     (window-put w 'never-iconify t))
                   (window-put w 'tabbed t)) wins)
-        (call-hook 'tab-group-windows-hook (list (tab-group-window-index win)))
+        (call-hook 'tab-group-windows-hook (list (tab-group-windows win)))
         (raise-window win)
         (setq all-wins nil))
       (setq tab-refresh-lock t)
       (when (window-tabbed-p win)
         (tab-refresh-group win 'move)
-        (tab-refresh-group win 'frame))))
+        (tab-refresh-group win 'frame))
+      (setq tab-move-resize-lock nil)))
   (define (unmap-id win)
     (setq last-unmap-id (window-id win)))
@@ -608,4 +623,4 @@
     (add-hook 'window-unmaximized-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'maximized))))
     (add-hook 'destroy-notify-hook tab-delete-window-from-tab-groups))
-  (gaol-add set-tab-theme-name tab-refresh-group tab-group-window-index))
+  (gaol-add set-tab-theme-name tab-refresh-group tab-group-windows))
diff -urNad lisp.orgi/sawfish/wm/tile/tiler.jl lisp/sawfish/wm/tile/tiler.jl
--- lisp.orgi/sawfish/wm/tile/tiler.jl
+++ lisp/sawfish/wm/tile/tiler.jl
@@ -77,10 +77,11 @@
   (define (tileable-window-p w)
     (and w
-	 (tiling-auto-p (tiling (window-workspace w)) w)
+         (tiling-auto-p (tiling (window-workspace w)) w)
          (not (window-never-tile-p w))
-	 (not (window-ignored-p w))
-	 (not (dock-window-p w))
+         (not (window-ignored-p w))
+         (not (dock-window-p w))
+         (not (tab-background-p w))
          (eq (window-type w) 'default)))
   (define (tileable-windows #!optional ignore)
diff -urNad lisp.orgi/sawfish/wm/tile/utils.jl lisp/sawfish/wm/tile/utils.jl
--- lisp.orgi/sawfish/wm/tile/utils.jl
+++ lisp/sawfish/wm/tile/utils.jl
@@ -19,6 +19,7 @@
+            tab-background-p
     (open rep
@@ -36,18 +37,26 @@
   (define (window-never-tile-p w) (window-get w 'never-tile))
+  (define (tab-background-p w)
+    "Returns t if a tabbed window is a background tab"
+    (require 'sawfish.wm.tabs.tabgroup)
+    (if tab-move-resize-lock 't
+      (if (window-tabbed-p w)
+          (if (member w (nthcdr 1 (tab-group-windows-stacking-order w))) 't))))
   (define (tileable-workspace-windows #!optional ignore)
     (remove-if (lambda (w)
-		 (or (equal w ignore)
-		     (dock-window-p w)
-		     (window-iconified-p w)
-		     ;; window-matcher
-		     (window-never-tile-p w)
-		     ;; for pager and stuff
-		     (not (window-visible-p w))
-		     ;; no dialogs
-		     (not (eq (window-type w) 'default))
-		     (window-ignored-p w)))
+                 (or (equal w ignore)
+                     (dock-window-p w)
+                     (window-iconified-p w)
+                     ;; window-matcher
+                     (window-never-tile-p w)
+                     ;; for pager and stuff
+                     (not (window-visible-p w))
+                     ;; no dialogs
+                     (not (eq (window-type w) 'default))
+                     (tab-background-p w)
+                     (window-ignored-p w)))
                (window-order current-workspace)))
   (define (window-x w) (car (window-position w)))
@@ -67,6 +76,9 @@
   (define (push-window w x y width height)
     (resize-frame-to w (inexact->exact width) (inexact->exact height))
     (move-window-to w (inexact->exact x) (inexact->exact y))
+    (require 'sawfish.wm.tabs.tabgroup)
+    (when (window-tabbed-p w)
+      (tab-refresh-group (nth 0 (tab-group-windows-stacking-order w)) 'move))
     (window-order-push w))
   (define (focus-window w) (window-order-push w))
diff -urNad lisp.orgi/sawfish/wm/workspace.jl lisp/sawfish/wm/workspace.jl
--- lisp.orgi/sawfish/wm/workspace.jl
+++ lisp/sawfish/wm/workspace.jl
@@ -706,7 +706,7 @@
                               w current-workspace)
                            (car (window-workspaces w))))
-             (wins (tab-group-window-index w)))
+             (wins (tab-group-windows w)))
          (when orig-space
            (mapcar (lambda (w)
                      (copy-window-to-workspace w orig-space space)) wins)

--- themes/StyleTab/theme.jl.orgi
+++ themes/StyleTab/theme.jl
@@ -467,7 +467,7 @@
 (define (rotate-tab src dest)
   (let ((w (current-event-window))
-        (wins (tab-group-window-index (current-event-window)))
+        (wins (tab-group-windows (current-event-window)))
         pos-x pos-y fdim framew framehigh dim-x dim-y current-title type)
     (if (not (window-get w 'title-position))
         (case styletab-c:titlebar-place
@@ -610,7 +610,7 @@
 (define (f-type dest)
   (let ((w (current-event-window))
-        (wins (tab-group-window-index (current-event-window)))
+        (wins (tab-group-windows (current-event-window)))
         pos-x pos-y dim-x dim-y cur new current-title)
     (if (not (window-get w 'title-position))
         (case styletab-c:titlebar-place

Attachment: signature.asc
Description: PGP signature

Mail converted by MHonArc 2.6.19+