[Sawfish] Some patches

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


Hi,

I have some patches for tab support and tabthemes.

check-win-group-fix.patch:
Improve (add-hook 'destroy-notify-hook check-win). Always rebuild list
from marked windows (also if you select a complete tabgroup) if you
close a marked window.

03-net-wm-window-type-normal-p-1.patch:
Add frame-style-tabs-support-p in tabgroup.jl.
frame-style-tabs-support-p returns 't if a frame-style has tabsupport.
Allowed only add a window or tabgroup add as tab to the "parent"
window if the frame-style from parent window has tabsupport.
improve net-wm-window-type-normal-p 
(get-x-property w '_NET_WM_WINDOW_TYPE) in net-wm-window-type-normal-p
not by all windows it returns something and i got errors
in .xsession-errors but it is fix now.

02-tabthemes-1.patch:
Update Elberg-tabbed and gradient-tabbed. Both themes now work with the
last updates/fixes in tab.jl tabgroup.jl. Also update both themes and
StyleTab to support frame-style-tabs-support-p.

04-keymaps-tab-title-fix.patch:
improve the default keybindings for title-keymap and tabbar-keymap for
tabsupport.

-- 
Regards,
Fuchur

GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
diff -urNad themes.orgi/Elberg-tabbed/theme.jl themes/Elberg-tabbed/theme.jl
--- themes.orgi/Elberg-tabbed/theme.jl
+++ themes/Elberg-tabbed/theme.jl
@@ -15,6 +15,8 @@
 ;;        ((w-width (car (window-dimensions w))))
 ;;      (max 0 (min (- w-width 100) (text-width (window-name w)))))))
 
+(define theme-name 'Elberg-tabbed)
+
 ;; 6x19 - upper left corner
 (define upper-left-images (list (make-image "i-ul.png")
                                 (make-image "a-ul.png")))
@@ -160,9 +162,7 @@
 
 (define text-colors (list "grey50" "white"))
 
-
 ;; frame layout
-
 (define frame
   `(((background . ,upper-left-images)
      (left-edge . -6)
@@ -292,7 +292,7 @@
 
 (define shaped-frame 
   `(((background . ,upper-left-shaped-images)
-     (left-edge . -6)
+     (left-edge . 6)
      (top-edge . -19)
      (height . 19)
      (class . top-left-corner))
@@ -335,7 +335,7 @@
     
     ;; top-right corner
     ((background . ,upper-right-shaped-images)
-     (right-edge . -6)
+     (right-edge . 6)
      (top-edge . -19)
      (height . 19)
      (class . top-right-corner))
@@ -379,7 +379,6 @@
      (top-edge . -19)
      (class . tabbar-horizontal-right-edge))))
 
-
 (define transient-frame 
   `(((background . ,t-upper-left-images)
      (left-edge . -4)
@@ -477,18 +476,19 @@
                            Elberg-left-m #:theme-right-margin Elberg-rigth-m #:theme-left-margin-transient Elberg-left-m-t 
                            #:theme-right-margin-transient Elberg-right-m-t))))
 
-(create-frames)
-  
-(add-frame-style 'Elberg-tabbed
-                 (lambda (w type)
-                   (case type
-                         ((default) frame)
-                         ((transient) transient-frame)
-                         ((shaped) shaped-frame)
-                         ((shaped-transient) shaped-transient-frame))))
+(define (frame-style-name w)
+  (when (eq (window-get w 'current-frame-style) theme-name)
+    (set-tab-theme-name #:frame-style-supported-tabs theme-name)))
 
-(define (create-frames-only w)
-    (when (eq (window-get w 'current-frame-style) 'Elberg-tabbed)
-      (create-frames)))
+(define (get-frame w type)
+  (create-frames)
+  (case type
+        ((default) frame)
+        ((transient) transient-frame)
+        ((shaped) shaped-frame)
+        ((shaped-transient) shaped-transient-frame)))
 
-(call-after-state-changed '(title-position) create-frames-only)
+(create-frames)
+
+(add-frame-style theme-name get-frame)
+(call-after-state-changed '(tab-theme-name) frame-style-name)
diff -urNad themes.orgi/StyleTab/theme.jl themes/StyleTab/theme.jl
--- themes.orgi/StyleTab/theme.jl
+++ themes/StyleTab/theme.jl
@@ -2626,6 +2626,10 @@
   (reload-frame-style theme-name)
   (reframe-with-style))
 
+(define (frame-style-name w)
+  (when (eq (window-get w 'current-frame-style) theme-name)
+    (set-tab-theme-name #:frame-style-supported-tabs theme-name)))
+
 (define (get-frame w type)
   (let ((current-title 
          (if (not (window-get w 'title-position))
@@ -2655,6 +2659,7 @@
 
 (add-frame-style theme-name get-frame)
 
+(call-after-state-changed '(tab-theme-name) frame-style-name)
 (call-after-state-changed '(marked) reframe-marked)
 (call-after-state-changed '(maximized sticky fixed-position stacking) reframe-one)
 (add-hook 'remove-from-workspace-hook reframe-one)
diff -urNad themes.orgi/gradient-tabbed/theme.jl themes/gradient-tabbed/theme.jl
--- themes.orgi/gradient-tabbed/theme.jl
+++ themes/gradient-tabbed/theme.jl
@@ -4,6 +4,8 @@
 
 ;; Copyright (C) 2009-2011 Sergey Kozhemyakin <serg.kozhemyakin@xxxxxxxxx>
 
+(define theme-name 'gradient-tabbed)
+
 (require 'gradient)
 
 ;; customize variables
@@ -117,8 +119,7 @@
        gradient-tabbed:inactive-menu-color))
     (when (> (cdr (image-dimensions img)) 4)
       (bevel-image img 1 (not (eq state 'clicked))))
-    (set-image-border img 1 1 1 1)
-    ))
+    (set-image-border img 1 1 1 1)))
 
 (define render-close-button
   (lambda (img state)
@@ -129,8 +130,7 @@
        gradient-tabbed:inactive-close-color))
     (when (> (cdr (image-dimensions img)) 4)
       (bevel-image img 1 (not (eq state 'clicked))))
-    (set-image-border img 1 1 1 1)
-    ))
+    (set-image-border img 1 1 1 1)))
 
 (define menu-button
   (list
@@ -155,8 +155,7 @@
        gradient-tabbed:normal-from-color))
     (when (> (cdr (image-dimensions img)) 4)
       (bevel-image img 1 (not (eq state 'clicked))))
-    (set-image-border img 1 1 1 1)
-    ))
+    (set-image-border img 1 1 1 1)))
 
 (define render-resizebar-handle
   (lambda (img state)
@@ -167,8 +166,7 @@
        gradient-tabbed:inactive-handle-color))
     (when (> (cdr (image-dimensions img)) 4)
       (bevel-image img 1 (not (eq state 'clicked))))
-    (set-image-border img 1 1 1 1)
-    ))
+    (set-image-border img 1 1 1 1)))
 
 (define menu
   `((renderer . ,render-menu-button)
@@ -253,8 +251,7 @@
     (class . bottom-left-corner)))
 
 (define left-border
-  `(
-    (background . ,border-color)
+  `((background . ,border-color)
     (left-edge . -1)
     (width . 1)
     (top-edge . -21)
@@ -262,8 +259,7 @@
     (class . left-border)))
 
 (define right-border
-  `(
-    (background . ,border-color)
+  `((background . ,border-color)
     (right-edge . -1)
     (width . 1)
     (top-edge . -21)
@@ -271,8 +267,7 @@
     (class . right-border)))
 
 (define left-transient-border
-  `(
-    (background . ,border-color)
+  `((background . ,border-color)
     (left-edge . -1)
     (width . 1)
     (top-edge . -21)
@@ -280,8 +275,7 @@
     (class . left-border)))
 
 (define right-transient-border
-  `(
-    (background . ,border-color)
+  `((background . ,border-color)
     (right-edge . -1)
     (width . 1)
     (top-edge . -21)
@@ -289,8 +283,7 @@
     (class . right-border)))
 
 (define bottom-border
-  `(
-    (background . ,border-color)
+  `((background . ,border-color)
     (left-edge . -1)
     (right-edge . -1)
     (bottom-edge . -1)
@@ -298,8 +291,7 @@
     (class . bottom-border)))
 
 (define top-border
-  `(
-    (background . ,border-color)
+  `((background . ,border-color)
     (left-edge . -1)
     (right-edge . -1)
     (top-edge . -22)
@@ -309,8 +301,7 @@
 ;; frames definitions
 
 (define frame
-  `(
-    ,menu
+  `(,menu
     ,close
     ,tab
     ,resizebar
@@ -318,33 +309,26 @@
     ,resizebar-right
     ,left-border
     ,right-border
-    ,top-border
-    ))
+    ,top-border))
 
 (define shaped-frame
-  `(
-    ,menu
+  `(,menu
     ,close
     ,tab
     ,left-transient-border
     ,right-transient-border
     ,bottom-border
-    ,top-border
-    ))
+    ,top-border))
 
 (define transient-frame
-  `(
-    ,transient-titlebar
+  `(,tab
     ,left-transient-border
     ,right-transient-border
     ,bottom-border
-    ,top-border
-    ))
+    ,top-border))
 
 (define shaped-transient-frame
-  `(
-    ,transient-titlebar
-    ))
+  `(,tab))
 
 ;; build frames
 
@@ -364,18 +348,19 @@
                            #:theme-left-margin-transient gradient-tabbed-left-m-t
                            #:theme-right-margin-transient gradient-tabbed-right-m-t))))
 
-(create-frames)
+(define (frame-style-name w)
+  (when (eq (window-get w 'current-frame-style) theme-name)
+    (set-tab-theme-name #:frame-style-supported-tabs theme-name)))
 
-(add-frame-style 'gradient-tabbed
-                 (lambda (w type)
-                   (case type
-                     ((default) frame)
-                     ((transient) transient-frame)
-                     ((shaped) shaped-frame)
-                     ((shaped-transient) shaped-transient-frame))))
+(define (get-frame w type)
+  (create-frames)
+  (case type
+        ((default) frame)
+        ((transient) transient-frame)
+        ((shaped) shaped-frame)
+        ((shaped-transient) shaped-transient-frame)))
 
-(define (create-frames-only w)
-  (when (eq (window-get w 'current-frame-style) 'gradient-tabbed)
-    (create-frames)))
+(create-frames)
 
-(call-after-state-changed '(title-position) create-frames-only)
\ Kein Zeilenumbruch am Dateiende.
+(add-frame-style theme-name get-frame)
+(call-after-state-changed '(tab-theme-name) frame-style-name)
diff -urNad sawfish/lisp/sawfish/wm/tabs.orig/tabgroup.jl sawfish/lisp/sawfish/wm/tabs/tabgroup.jl
--- sawfish/lisp/sawfish/wm/tabs.orig/tabgroup.jl
+++ sawfish/lisp/sawfish/wm/tabs/tabgroup.jl
@@ -22,6 +22,7 @@
 (define-structure sawfish.wm.tabs.tabgroup
 
     (export window-tabbed-p
+            frame-style-tabs-support-p
             net-wm-window-type-normal-p
             tab-refresh-group
             tab-release-window
@@ -59,12 +60,22 @@
   (define release-window t)
   (define last-unmap-id nil)
   (define in-tab-group-name nil)
+  (define tab-theme-name)
+
+  (define (set-tab-theme-name #!key frame-style-supported-tabs)
+    (setq tab-theme-name frame-style-supported-tabs))
 
   (define (window-tabbed-p w)
     (window-get w 'tabbed))
 
+  (define (frame-style-tabs-support-p w)
+    (setq tab-theme-name nil)
+    (call-window-hook 'window-state-change-hook w (list '(tab-theme-name)))
+    (eq (window-get w 'current-frame-style) tab-theme-name))
+  
   (define (net-wm-window-type-normal-p w)
-    (equal (aref (nth 2 (get-x-property w '_NET_WM_WINDOW_TYPE)) 0) '_NET_WM_WINDOW_TYPE_NORMAL))
+    (if (get-x-property w '_NET_WM_WINDOW_TYPE)
+        (equal (aref (nth 2 (get-x-property w '_NET_WM_WINDOW_TYPE)) 0) '_NET_WM_WINDOW_TYPE_NORMAL)))
 
   (define-record-type :tab-group
     (tab-build-group p d wl)
@@ -265,7 +276,8 @@
     ;; is not a "normal" window (e.g. dock panel ...)
     (when (and (not (cdr (window-get win 'workspaces)))
                (net-wm-window-type-normal-p w)
-               (net-wm-window-type-normal-p win))
+               (net-wm-window-type-normal-p win)
+               (frame-style-tabs-support-p win))
       (let* ((index (tab-window-group-index win))
              (index2 (tab-window-group-index w))
              (pos (window-position win))
@@ -499,4 +511,4 @@
     (add-hook 'add-to-workspace-hook (lambda (win) (if (window-tabbed-p win) (tab-refresh-group win 'frame))))
     (add-hook 'destroy-notify-hook tab-delete-window-from-tab-groups))
 
-  (gaol-add tab-refresh-group tab-group-window-index))
+  (gaol-add set-tab-theme-name tab-refresh-group tab-group-window-index))
--- sawfish.orgi/lisp/sawfish/wm/keymaps.jl
+++ sawfish/lisp/sawfish/wm/keymaps.jl
@@ -118,22 +118,24 @@
 
   (defcustom title-keymap (bind-keys (make-keymap)
 				     "Button3-Off" 'raise-lower-window
+				     "Button3-Move" 'move-window-interactively
+				     "Button3-Click" 'tab-release-window
 				     "Button2-Move" 'resize-window-interactively
-				     "Button1-Off2" 'toggle-window-shaded
-				     "Button1-Move" 'move-window-interactively
 				     "Button2-Off" 'tab-add-to-group
-                                     "C-Button2-Off" 'tabgroup-add-to-group)
+				     "C-Button2-Off" 'tabgroup-add-to-group
+				     "Button1-Off2" 'toggle-window-shaded
+				     "Button1-Move" 'move-window-interactively)
     "Keymap of window title bar. Mouse-bindings only."
     :group bindings
     :type keymap)
 
   (defcustom tabbar-keymap (bind-keys (make-keymap)
-				      "Button1-Off2" 'toggle-window-shaded
-				      "Button1-Move" 'move-window-interactively
-				      "Button2-Off" 'tab-add-to-group
-                                      "C-Button2-Off" 'tabgroup-add-to-group
+				      "Button3-Move" 'move-window-interactively
 				      "Button3-Click" 'tab-release-window
-				      "Button3-Move" 'move-window-interactively)
+				      "Button2-Off" 'tab-add-to-group
+				      "C-Button2-Off" 'tabgroup-add-to-group
+				      "Button1-Off2" 'toggle-window-shaded
+				      "Button1-Move" 'move-window-interactively)
     "Keymap of window tabbar. Mouse-bindings only."
     :group bindings
     :type keymap)
--- sawfish/lisp/sawfish/wm/tabs/tab.jl.orgi
+++ sawfish/lisp/sawfish/wm/tabs/tab.jl
@@ -213,11 +213,15 @@
   (define-command 'tabgroup-add-to-group tabgroup-add-to-group #:spec "%W")
 
   (define (check-win)
-    (if (and (car marked-window)
-             (not (window-id (car marked-window))))
-        (progn
-          (default-cursor select-cursor)
-          (setq marked-window nil))))
+    (if (car marked-window)
+        (let ((m-list marked-window))
+          (setq marked-window nil)
+          (mapcar (lambda (w)
+                    (if (window-id w)
+                        (setq marked-window (append marked-window (cons w nil))))) m-list)
+          (when (not (car marked-window))
+            (default-cursor select-cursor)
+            (setq marked-window nil)))))
 
   (add-hook 'destroy-notify-hook check-win))
 

Attachment: signature.asc
Description: PGP signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/