Hi, On Wed, 16 Feb 2011 20:26:52 +0100 wrote Christopher Roy Bratusek <nano tuxfamily org>: >> Patch for tabgroup. Changelog: >> Makes sure we call only the hooks from tabgroup.jl if a window is >> "tabbed". >> Rename reframe-style to style in tab-refresh-group. >> Replace "reframe-window" with "rebuild-frame" in tab-refresh-group for >> type. >> Make tab-group-window work with "no-click" mode work. >> Makes sure that a window is in a tabgroup you can also add to a other. Patch for tabgroup. Changelog: Make opaque move and resize mode works with tabs. Add "(define (before-move-resize win)" and "(define (after-move-resize win)" for befor/after move/resize hooks. Improve tab-refresh-group and tab-group-window. Move reframe/frame stuff from tab-delete-window-from-group to tab-delete-window-from-tab-groups" Remove "tab-move-resize-frame-window-to" and "rebuild-frame" from tab-put-window-in-group. I have it testet it also with no-click and i got no errors but need more testing (other custom settings). -- 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-21 19:41:18.000000000 +0100 +++ sawfish-git-9999/lisp/sawfish/wm/tabs/tabgroup.jl 2011-02-21 19:51:34.000000000 +0100 @@ -31,7 +31,7 @@ tab-group-window-list tab-group-window-index tab-group-window - maybe-raise-tab) + maybe-raise-tab) (open rep rep.system @@ -57,17 +57,19 @@ :group focus :type boolean) - (define (maybe-raise-tab w) - "Raise a window, when it's a tab and automatic raising of is disabled" - (when (and (not tab-raise-on-hover) - (window-tabbed-p w)) - (tab-refresh-group w 'raise))) - - (define-command 'maybe-raise-tab maybe-raise-tab #:spec "%W") + (define (maybe-raise-tab w) + "Raise a window, when it's a tab and automatic raising of is disabled" + (when (and (not tab-raise-on-hover) + (window-tabbed-p w)) + (tab-refresh-group w 'raise))) + + (define-command 'maybe-raise-tab maybe-raise-tab #:spec "%W") + (define current-win nil) + (define all-wins nil) + (define oldgroup nil) (define tab-groups nil) (define tab-refresh-lock t) - (define tab-move-lock t) (define (window-tabbed-p w) (window-get w 'tabbed)) @@ -142,17 +144,17 @@ (rplaca (nthcdr index tab-groups) (tab-build-group (tab-group-position old) (tab-group-dimensions old) l)) (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)))) + (setq oldgroup (car l))))) (define (tab-delete-window-from-tab-groups w) "Find window's group and remove it." (when (window-tabbed-p w) - (tab-delete-window-from-group w (tab-window-group-index w)))) + (tab-delete-window-from-group w (tab-window-group-index w)) + (window-put w 'fixed-position nil) + (tab-refresh-group oldgroup 'frame) + (rebuild-frame w 'frame))) (define (tab-put-window-in-group win index) "Put window in group at given index." @@ -162,9 +164,7 @@ (rplaca (nthcdr index tab-groups) (tab-build-group (tab-group-position group) (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)) - (rebuild-frame win))) + (append (tab-group-window-list group) (list win)))))) (define (tab-refresh-group win prop) "Refresh the entire group containing WIN according to PROP. @@ -176,7 +176,8 @@ (unwind-protect (let* ((index (tab-window-group-index win)) (wins (tab-group-window-list (nth index tab-groups))) - (focus (tab-group-offset win 0))) + (focus (tab-group-offset win 0)) + (unfocus (remove focus wins))) (adjust-title win) (cond ((eq prop 'raise) @@ -184,68 +185,72 @@ ((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))) + (window-put w 'title-position group-title-position)) unfocus) + (window-put focus 'title-position group-title-position))) ((eq prop 'frame) (mapcar (lambda (w) - (rebuild-frame w)) wins)) + (rebuild-frame w)) unfocus) + (rebuild-frame focus)) ((eq prop 'reframe) (mapcar (lambda (w) - (reframe-window w)) wins)) + (reframe-window w)) unfocus) + (reframe-window focus)) ((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)) - (reframe-window w)) wins))) + (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)) - (rebuild-frame w)) wins) + (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)))) ((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) - (rebuild-frame w)) wins))) + (window-put w 'fixed-position group-frame-fixed-position)) unfocus) + (window-put focus 'fixed-position group-frame-fixed-position))) ((eq prop 'type) (let ((group-frame-type (window-get win 'type))) (mapcar (lambda (w) - (window-put w 'type group-frame-type) - (rebuild-frame w)) wins))) + (window-put w 'type group-frame-type)) unfocus) + (window-put focus 'type group-frame-type))) ((eq prop 'depth) (let ((group-frame-depth (window-get win 'depth))) (mapcar (lambda (w) - (window-put w 'depth group-frame-depth) - (rebuild-frame w)) wins))) + (window-put w 'depth group-frame-depth)) unfocus) + (window-put focus 'depth group-frame-depth))) ((eq prop 'iconify) (mapcar (lambda (w) - (iconify-window w) - (rebuild-frame w)) wins)) + (iconify-window w)) unfocus) + (iconify-window focus)) ((eq prop 'uniconify) (mapcar (lambda (w) - (uniconify-window w) - (rebuild-frame w)) wins)) + (uniconify-window w)) unfocus) + (uniconify-window focus)) ((eq prop 'sticky) (mapcar (lambda (w) - (make-window-sticky w) - (rebuild-frame w)) wins)) + (make-window-sticky w)) unfocus) + (make-window-sticky focus)) ((eq prop 'unsticky) (mapcar (lambda (w) - (make-window-unsticky w) - (rebuild-frame w)) wins)) + (make-window-unsticky w)) unfocus) + (make-window-unsticky focus)) ((eq prop 'shade) (mapcar (lambda (w) - (shade-window w) - (rebuild-frame w)) wins)) + (shade-window w)) unfocus) + (shade-window focus)) ((eq prop 'unshade) (mapcar (lambda (w) - (unshade-window w) - (rebuild-frame w)) wins)))) + (unshade-window w)) unfocus) + (unshade-window focus)))) (setq tab-refresh-lock t)))) ;; Entry points @@ -254,39 +259,42 @@ ;; don't add a window as tab, if it already ;; exists on another workspace (when (not (cdr (window-get win 'workspaces))) - ;; from tabgroup to tabgroup - (when (window-tabbed-p w) - (tab-delete-window-from-tab-groups w)) - ;; sort windows/tabs (depth) - (tab-refresh-group win 'raise) - (raise-window w) - (set-input-focus w) (let* ((index (tab-window-group-index win)) (index2 (tab-window-group-index w)) + (pos (window-position win)) + (dim (window-dimensions win)) ;; adopt window settings for the new tab (group-frame-style (window-get win 'frame-style)) (group-frame-type (window-get win 'type)) (group-frame-sticky (window-get win 'sticky)) + (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))) (when (not (eq index index2)) + ;; tabgroup to tabgroup + (when (window-tabbed-p w) + (tab-delete-window-from-tab-groups w)) + (setq tab-refresh-lock nil) (if (window-get w 'shaded) (unshade-window w)) (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 'title-position group-frame-title-position) (window-put w 'sticky group-frame-sticky) + (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) ;; reframe w here, tab-refresh-group expectet ;; the same frame for w and win (reframe-window w) - (tab-refresh-group win 'move) (tab-put-window-in-group w index) (tab-delete-window-from-group w index2) - (tab-refresh-group win 'frame) - (tab-refresh-group w 'move) + (resize-window-to w (car dim) (cdr dim)) + (move-window-to w (car pos) (cdr pos)) + (setq tab-refresh-lock t) + (tab-refresh-group w 'frame) + (set-input-focus w) (if (not (window-tabbed-p win)) (window-put win 'tabbed t)) (window-put w 'tabbed t))))) @@ -340,35 +348,82 @@ (tab-refresh-group win 'sticky) (tab-refresh-group win 'unsticky))) + (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))))) + (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)" + (setq tab-refresh-lock nil) + (let* ((wins all-wins) + (pos (window-position win)) + (dim (window-dimensions win)) + index index-old) + (when (and (cdr wins) + (eq win current-win)) + (setq index (tab-window-group-index (car wins))) + (mapcar (lambda (w) + (when (not (eq index (tab-window-group-index w))) + (setq index-old (tab-window-group-index w)) + (tab-put-window-in-group w index) + (tab-delete-window-from-group w index-old)) + (move-window-to w (car pos) (cdr pos)) + (resize-window-to w (car dim) (cdr dim)) + (uniconify-window w) + (when (window-get w 'never-iconify-opaque) + (window-put w 'never-iconify-opaque nil) + (window-put w 'never-iconify t)) + (window-put w 'tabbed t)) wins) + (raise-window win) + (setq all-wins nil) + (setq current-win nil)) + (setq tab-refresh-lock t) + (when (window-tabbed-p win) + (tab-refresh-group win 'move) + (tab-refresh-group win 'frame)))) + (unless batch-mode (add-hook 'window-state-change-hook (lambda (win args) (when (window-tabbed-p win) (setq args (car args)) (cond ((eq 'sticky args) - (tab-group-sticky win)) + (tab-group-sticky win) + (tab-refresh-group win 'frame)) ((eq 'fixed-position args) - (tab-refresh-group win 'fixed-position)) + (tab-refresh-group win '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 'move)) ((eq 'type args) - (tab-refresh-group win 'type)) + (tab-refresh-group win 'type) + (tab-refresh-group win 'reframe)) ((eq 'stacking args) - (tab-refresh-group win 'depth)))))) + (tab-refresh-group win 'depth) + (tab-refresh-group win 'frame)))))) - (add-hook 'focus-in-hook - (lambda (win) - (if tab-raise-on-hover - (tab-group-raise win)))) - (add-hook 'after-move-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'move)))) - (add-hook 'after-resize-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'resize)))) - ;; only update tabs by move if opaque move mode (opaque = slow) - ;; + (add-hook 'focus-in-hook (lambda (win) (if tab-raise-on-hover (tab-group-raise win)))) (when (eq move-outline-mode 'opaque) - (add-hook 'while-moving-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'move)))) - ) - (add-hook 'window-resized-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'resize)))) + (add-hook 'before-move-hook (lambda (win) (if (window-tabbed-p win) (before-move-resize win))))) + (add-hook 'after-move-hook (lambda (win) (after-move-resize win))) + (when (eq resize-outline-mode 'opaque) + (add-hook 'before-resize-hook (lambda (win) (if (window-tabbed-p win) (before-move-resize win))))) + (add-hook 'after-resize-hook (lambda (win) (after-move-resize win))) (add-hook 'shade-window-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'shade)))) (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))))
Attachment:
signature.asc
Description: PGP signature