[sawfish] various sawfish.wm.tabs.* changes, check news.texi
- From: Christopher Bratusek <chrisb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sawfish] various sawfish.wm.tabs.* changes, check news.texi
- Date: Sat, 20 Mar 2010 09:06:02 +0000 (UTC)
commit 75450726cd98fc530a7026eb8b109c2920b2dd66
Author: Christopher Roy Bratusek <zanghar freenet de>
Date: Sat Mar 20 10:05:17 2010 +0100
various sawfish.wm.tabs.* changes, check news.texi
ChangeLog | 6 ++
lisp/sawfish/wm/tabs/tab.jl | 170 +++++++++++++++++++++++++++-----------
lisp/sawfish/wm/tabs/tabgroup.jl | 158 ++++++++++++++++++++++++-----------
man/news.texi | 48 ++++++++---
4 files changed, 271 insertions(+), 111 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4ca9a70..7561798 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-20 Christopher Bratusek <zanghar freenet de>
+ * lisp/sawfish/wm/tabs/tab.jl
+ * lisp/sawfish/wm/tabs/tabgroup.jl: several additions, check man/news.texi [Fuchur]
+
+ * man/news.texi: updated
+
2010-03-20 Teika Kazura <teika lavabit com>
* lisp/sawfish/wm/windows.jl
* man/news.texi
diff --git a/lisp/sawfish/wm/tabs/tab.jl b/lisp/sawfish/wm/tabs/tab.jl
index 5188c6d..cf833f1 100644
--- a/lisp/sawfish/wm/tabs/tab.jl
+++ b/lisp/sawfish/wm/tabs/tab.jl
@@ -20,25 +20,26 @@
(define-structure sawfish.wm.tabs.tab
- (export raise-tabs-on-hover-setter)
-
- (open rep
- rep.system
- sawfish.wm.misc
- sawfish.wm.custom
- sawfish.wm.commands
- sawfish.wm.frames
- sawfish.wm.tabs.tabgroup
- sawfish.wm.util.marks
- sawfish.wm.windows
- sawfish.wm.stacking)
-
- (define-structure-alias tab sawfish.wm.tabs.tab)
+ (export tab-add-to-group
+ raise-tabs-on-hover-setter)
+
+ (open rep
+ rep.system
+ sawfish.wm.misc
+ sawfish.wm.custom
+ sawfish.wm.commands
+ sawfish.wm.frames
+ sawfish.wm.tabs.tabgroup
+ sawfish.wm.util.marks
+ sawfish.wm.windows
+ sawfish.wm.stacking)
+
+ (define-structure-alias tab sawfish.wm.tabs.tab)
;; TODO:
- ;; - change other tab sizes when window resizes itself
- ;; - make calculations work with tiny windows
- ;; - hide some frame parts on leftmost and rightmost tabs
+ ;; - 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
;;###autoload (defgroup tabs "Tabs")
@@ -47,21 +48,35 @@
(defcustom tab-left-dec-width 11 "Width of tab's left-edge decoration"
:group tabs
- :type number)
+ :type number
+ :after-set reframe-all-windows)
(defcustom tab-right-dec-width 11 "Width of tab's right-edge decoration"
:group tabs
- :type number)
+ :type number
+ :after-set reframe-all-windows)
+
+ (defcustom tab-left-margin 66 "Width of tab area's left-edge decoration"
+ :group tabs
+ :type number
+ :after-set reframe-all-windows)
- (defcustom tab-left-margin 16 "Width of tab area's left-edge decoration"
+ (defcustom tab-right-margin 68 "Width of tab area's right-edge decoration"
:group tabs
- :type number)
+ :type number
+ :after-set reframe-all-windows)
- (defcustom tab-right-margin 16 "Width of tab area's right-edge decoration"
+ (defcustom tab-left-margin-transient 44 "Width of tab area's left-edge-transient decoration"
:group tabs
- :type number)
+ :type number
+ :after-set reframe-all-windows)
- (defcustom tab-raise-on-hover nil
+ (defcustom tab-right-margin-transient 24 "Width of tab area's right-edge-transient decoration"
+ :group tabs
+ :type number
+ :after-set reframe-all-windows)
+
+ (defcustom tab-raise-on-hover nil
"Raise Tabs on Hover"
:group tabs
:type boolean
@@ -74,65 +89,127 @@
(define (tab-pos group tabnum win)
"find the left and right pixel offsets of a tab"
- (let* ((tabarea-width (+
- ;; get width of a window in this group
- ;;(car (window-dimensions
- ;; (car (tab-group-window-list group))))
- (car (window-dimensions win))
- (- tab-left-margin)
- (- tab-right-margin)))
+ (let* ((dim-x (car (window-dimensions win)))
+ (dim-y (cdr (window-dimensions win)))
+ (margin-l
+ (if (or (eq (window-get win 'type) 'transient)
+ (eq (window-get win 'type) 'shaped-transient))
+ tab-left-margin-transient
+ tab-left-margin))
+ (margin-r
+ (if (or (eq (window-get win 'type) 'transient)
+ (eq (window-get win 'type) 'shaped-transient))
+ tab-right-margin-transient
+ tab-right-margin))
+ (tabarea-width (- dim-x margin-l margin-r))
+ (tabarea-height (- dim-y margin-l margin-r))
(numtabs (length (tab-group-window-list group)))
(left (quotient (* tabnum tabarea-width) numtabs))
+ (bottom (quotient (* tabnum tabarea-height) numtabs))
;; the right edge is not always "left + (window-width / numtabs)"
;; that would be inaccurate due to rounding errors
(right (quotient (* (+ tabnum 1) tabarea-width) numtabs))
- (width (- right left)))
- (list left right width)))
+ (top (quotient (* (+ tabnum 1) tabarea-height) numtabs))
+ (width (- right left))
+ (height (- top bottom)))
+ (list dim-x dim-y margin-l margin-r left right width bottom top height)))
(define (tab-title-text-width win)
- "width of the title text area is the tabwidth minus decorations"
- (let* ((tabwidth (nth 2 (get-tab-pos win))))
- (+ tabwidth
- (- tab-left-dec-width)
- (- tab-right-dec-width))))
+ "Width of the title text area is the tabwidth minus decorations"
+ (let* ((tabwidth (nth 6 (get-tab-pos win))))
+ (+ tabwidth
+ (- tab-left-dec-width)
+ (- tab-right-dec-width))))
+
+ (define (tab-title-text-height win)
+ "Height of the title text area is the tabheight minus decorations by a left or right titlebar themes"
+ (let* ((tabheight (nth 9 (get-tab-pos win))))
+ (when (> tabheight 0)
+ (+ tabheight
+ (- tab-left-dec-width)
+ (- tab-right-dec-width)))))
(define (tab-left-edge win)
"Compute left edge of tab"
- (let* ((left (nth 0 (get-tab-pos win))))
- (+ left tab-left-margin)))
+ (let* ((left (nth 4 (get-tab-pos win)))
+ (margin-l (nth 2 (get-tab-pos win))))
+ (+ left margin-l)))
+
+ (define (tab-bottom-edge win)
+ "Compute bottom edge of tab by a left or right titlebar themes"
+ (let* ((bottom (nth 7 (get-tab-pos win)))
+ (margin-l (nth 2 (get-tab-pos win))))
+ (+ bottom margin-l)))
(define (tab-right-dec-pos win)
"Compute position of tab's right-edge decoration"
- (let* ((right (nth 1 (get-tab-pos win))))
- (+ right tab-left-margin (- tab-right-dec-width))))
-
+ (let* ((right (nth 5 (get-tab-pos win)))
+ (margin-l (nth 2 (get-tab-pos win)))
+ (dim-x (nth 0 (get-tab-pos win))))
+ (when (> dim-x margin-l) ;; don't display outside from frame
+ (+ right margin-l (- tab-right-dec-width)))))
+
+ (define (tab-top-dec-pos win)
+ "Compute position of tab's top-edge decoration by a left or right titlebar themes"
+ (let* ((top (nth 8 (get-tab-pos win)))
+ (margin-l (nth 2 (get-tab-pos win)))
+ (dim-y (nth 1 (get-tab-pos win))))
+ (when (> dim-y margin-l) ;; don't display outside from frame
+ ;; use double size for icon support
+ (+ top margin-l (- (* tab-right-dec-width 2))))))
+
(define (tab-title-left-edge win)
"Compute left edge of tab"
(+ (tab-left-edge win) tab-left-dec-width))
+ (define (tab-title-bottom-edge win)
+ "Compute bottom edge of tab by a left or right titlebar themes"
+ (+ (tab-bottom-edge win) tab-left-dec-width))
+
;; new class : tab
(define-frame-class 'tab
`((cursor . left_ptr)
- (x-justify . center)
+ (x-justify . 12)
(y-justify . center)
(left-edge . ,tab-title-left-edge)
(width . ,tab-title-text-width)))
+
(set-frame-part-value 'tab 'keymap 'title-keymap)
+ ;; side tab arena
+ (define-frame-class 'tab-s
+ `((cursor . left_ptr)
+ (x-justify . 12)
+ (y-justify . center)
+ (bottom-edge . ,tab-title-bottom-edge)
+ (height . ,tab-title-text-height)))
+
+ (set-frame-part-value 'tab-s 'keymap 'title-keymap)
+
(define-frame-class 'tab-l
`((cursor . left_ptr)
(left-edge . ,tab-left-edge)) t)
+ ;; side tab arena bottom end
+ (define-frame-class 'tab-ls
+ `((cursor . left_ptr)
+ (bottom-edge . ,tab-bottom-edge)) t)
+
(define-frame-class 'tab-r
`((cursor . left_ptr)
- (left-edge . ,tab-right-dec-pos)) t)
+ (left-edge . ,tab-right-dec-pos)) t)
+ ;; side tab arena top end
+ (define-frame-class 'tab-rs
+ `((cursor . left_ptr)
+ (bottom-edge . ,tab-top-dec-pos)) t)
+
(define (mygroup win)
(if (marked-windows)
(progn
(apply-on-marked-windows (lambda (w) (tab-group-window w win)))
(unmark-all-windows))
- (mark-window win)))
+ (mark-window win)))
(define-command 'tab-add-to-group mygroup #:spec "%W")
@@ -158,4 +235,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 d6c48d6..aab0dae 100644
--- a/lisp/sawfish/wm/tabs/tabgroup.jl
+++ b/lisp/sawfish/wm/tabs/tabgroup.jl
@@ -18,26 +18,33 @@
;; 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
- tab-raise-left-window
+ (export tab-release-window
+ tab-raise-left-window
tab-raise-right-window
tab-find-window
tab-rank
tab-group-window-list
tab-group-window)
- (open rep
- rep.system
- rep.data.records
- sawfish.wm.misc
- sawfish.wm.custom
- sawfish.wm.commands
- sawfish.wm.windows
- sawfish.wm.state.iconify
- sawfish.wm.state.shading
- sawfish.wm.stacking)
+ (open rep
+ rep.system
+ rep.data.records
+ sawfish.wm.misc
+ sawfish.wm.custom
+ sawfish.wm.commands
+ sawfish.wm.windows
+ sawfish.wm.frames
+ sawfish.wm.state.iconify
+ sawfish.wm.state.shading
+ sawfish.wm.commands.move-resize
+ sawfish.wm.stacking
+ sawfish.wm.util.groups
+ sawfish.wm.workspace)
(define-structure-alias tabgroup sawfish.wm.tabs.tabgroup)
@@ -46,6 +53,7 @@
(defvar tab-refresh-lock t)
(defvar tab-move-lock t)
+
(define-record-type :tab-group
(tab-build-group p d wl)
tab-group?
@@ -97,7 +105,7 @@
(if (eq elem (car list))
0
(+ 1 (tab-rank elem (cdr list)))))
-
+
(define (tab-delete-window-from-group win index)
"Remove a window from a group at given index"
(let* ((old (nth index tab-groups))
@@ -105,8 +113,10 @@
(if (null l)
(setq tab-groups (delete old tab-groups))
(rplaca (nthcdr index tab-groups)
- (tab-build-group (tab-group-position old)
- (tab-group-dimensions old) l))
+ (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 'fixed-position nil)
(tab-refresh-group (car l) 'frame))))
(define (tab-delete-window-from-tab-groups w)
@@ -121,15 +131,13 @@
(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))
+ (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)))
(define (tab-refresh-group win prop)
"Refresh the entire group containing win according to prop
- prop can be one of the symbols : frame, move, resize, shade, unshade"
+ 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
@@ -139,19 +147,48 @@
((eq prop 'frame)
(mapcar (lambda (w)
(rebuild-frame w)) wins))
+ ((eq prop 'reframe)
+ (mapcar (lambda (w)
+ (reframe-window w)) wins))
+ ((eq prop 'reframe-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))
+ (rebuild-frame w)) wins)))
((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))
+ (tab-move-resize-frame-window-to w (car pos) (cdr pos) (car dim) (cdr dim))
(rebuild-frame w)) wins)
(rplaca (nthcdr index tab-groups)
(tab-build-group pos dim wins))))
- ((eq prop 'stick)
+ ((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)))
+ ((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)))
+ ((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)))
+ ((eq prop 'iconify)
+ (mapcar (lambda (w)
+ (iconify-window w)
+ (rebuild-frame w)) wins))
+ ((eq prop 'uniconify)
(mapcar (lambda (w)
- (toggle-window-sticky w)) wins))
+ (uniconify-window w)
+ (rebuild-frame w)) wins))
((eq prop 'shade)
(mapcar (lambda (w)
(shade-window w)
@@ -161,27 +198,45 @@
(unshade-window w)
(rebuild-frame w)) wins))))
(setq tab-refresh-lock t))))
-
+
;; Entry points
(define (tab-group-window w win)
"Put active window in pointer-selected group"
+ ;; 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)))
+ (index2 (tab-window-group-index w))
+ ;; 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-fixed-position (window-get win 'fixed-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)))
+ (window-put w 'type group-frame-type)
+ (window-put w 'sticky group-frame-sticky)
+ (window-put w 'depth group-frame-depth)
+ (window-put w 'fixed-position group-frame-fixed-position)
+ (window-put w 'frame-style group-frame-style)
;; 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 w 'move)))
+ (tab-refresh-group win 'move)))
(define (tab-release-window w)
"Release active 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"
(let* ((gr (tab-group-window-list (tab-find-window win)))
@@ -219,23 +274,26 @@
(unless batch-mode
(add-hook 'window-state-change-hook
(lambda (win args)
- (if (= 'sticky args)
- (tab-refresh-group win 'stick))))
- (add-hook 'after-move-hook
- (lambda (win) (tab-refresh-group win 'move)))
- (add-hook 'while-moving-hook
- (lambda (win) (tab-refresh-group win 'move)))
- (add-hook 'after-resize-hook
- (lambda (win) (tab-refresh-group win 'resize)))
- (add-hook 'while-resizing-hook
- (lambda (win) (tab-refresh-group win 'resize)))
- (add-hook 'window-maximized-hook
- (lambda (win) (tab-refresh-group win 'resize)))
- (add-hook 'window-unmaximized-hook
- (lambda (win) (tab-refresh-group win 'resize)))
- (add-hook 'shade-window-hook
- (lambda (win) (tab-refresh-group win 'shade)))
- (add-hook 'unshade-window-hook
- (lambda (win) (tab-refresh-group win 'unshade)))
- (add-hook 'destroy-notify-hook
- tab-delete-window-from-tab-groups)))
+ (if (= '(fixed-position) args)
+ (tab-refresh-group win 'fixed-position))))
+ (add-hook 'window-state-change-hook
+ (lambda (win args)
+ (if (= '(frame-style) args)
+ (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))))
+ (add-hook 'after-move-hook (lambda (win) (tab-refresh-group win 'move)))
+ (add-hook 'while-moving-hook (lambda (win) (tab-refresh-group win 'move)))
+ (add-hook 'window-resized-hook (lambda (win) (tab-refresh-group win 'resize)))
+ (add-hook 'shade-window-hook (lambda (win) (tab-refresh-group win 'shade)))
+ (add-hook 'unshade-window-hook (lambda (win) (tab-refresh-group win 'unshade)))
+ (add-hook 'iconify-window-hook (lambda (win) (tab-refresh-group win 'iconify)))
+ (add-hook 'uniconify-window-hook (lambda (win) (tab-refresh-group win 'uniconify)))
+ (add-hook 'destroy-notify-hook tab-delete-window-from-tab-groups)
+ (add-hook 'after-framing-hook (lambda (win) (tab-refresh-group win 'reframe)))))
diff --git a/man/news.texi b/man/news.texi
index 2ab9cb9..ab313dc 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -29,8 +29,42 @@ was possible for some lisp files, but now it's guaranteed for all
files. Of course, you can define new modules, too.
@end itemize
+ item Bugfixes
+ itemize @minus
+ item In tabbed-windows the left/right end is no longer outside the
+window, if that is too small [Fuchur]
+
+ item Unsupported option @code{ignore-window-input-hint} is deleted @*
+It has been invalid for long. [Teika kazura]
+
+ item Honor the user option @code{maximize-raises} in @code{maximize-window-fullscreen} and
+ code{maximize-window-fullxinerama}, too, not just in maximize-window
+[Nolan Leake]
+
+ item More robustness in applications menu [Teika Kazura]
+
+It broke for 'R', and whitespace handling didn't follow the specification.
+Phony constants are removed, too.
+ end itemize
+
@item New Features
@itemize @minus
+
+ item Tabbed-Windowing-System [Fuchur]
+ itemize +
+ item Support for transient tab-frames
+
+ item new frame classes:
+ itemize x
+ item tab-s (side tab)
+ item tab-ls (side tab, left/bottom end)
+ item tab-rs (side tab, right/top end)
+ end itemize
+
+ item tabgroups now support a set of new properties and actions:
+type, set-frame-style, fixed-position, iconify. In addition, new
+tabs gain those properties from their parent window.
+ end itemize
@item New command @code{display-window-position} [Teika kazura]
User chooses a window by cursor and click, and it prints its position
@@ -48,20 +82,6 @@ but only the latter was returned previously by the function
@code{window-class}. Now with the new optional argument, the instance
is returned too. (@pxref{Window Attributes})
@end itemize
- item Bugfixes
- itemize @minus
- item Unsupported option @code{ignore-window-input-hint} is deleted @*
-It has been invalid for long. [Teika kazura]
-
- item Honor the user option @code{maximize-raises} in @code{maximize-window-fullscreen} and
- code{maximize-window-fullxinerama}, too, not just in maximize-window
-[Nolan Leake]
-
- item More robustness in applications menu [Teika Kazura]
-
-It broke for 'R', and whitespace handling didn't follow the specification.
-Phony constants are removed, too.
- end itemize
@item Other Changes
@itemize @minus
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]