[sawfish] Doc readability improvements in keymap.jl.



commit c53ccbfd46f45f9c86036a055f5bc4c47e19a3aa
Author: Teika kazura <teika lavabit com>
Date:   Tue Feb 1 14:09:03 2011 +0900

    Doc readability improvements in keymap.jl.
    
    Anonymous functions are given names, and moved to appropirate modules.

 lisp/sawfish/wm/keymaps.jl       |   62 +++++++++++--------------------------
 lisp/sawfish/wm/state/iconify.jl |   18 +++++++++--
 lisp/sawfish/wm/windows.jl       |   12 ++++++-
 3 files changed, 44 insertions(+), 48 deletions(-)
---
diff --git a/lisp/sawfish/wm/keymaps.jl b/lisp/sawfish/wm/keymaps.jl
index 0f82623..959e557 100644
--- a/lisp/sawfish/wm/keymaps.jl
+++ b/lisp/sawfish/wm/keymaps.jl
@@ -87,7 +87,7 @@
 				      "W-Left" 'previous-workspace
 				      "W-Right" 'next-workspace
 				      "W-Tab" 'cycle-windows)
-    "Keymap containing bindings active anywhere."
+    "Keymap active anywhere."
     :group bindings
     :type keymap
     :before-set (lambda () (ungrab-keymap global-keymap))
@@ -102,7 +102,7 @@
 				      "Button1-Click1" 'raise-and-pass-through-click
 				      "W-ISO_Left_Tab" 'tab-raise-left-window
 				      "H-ISO_Left_Tab" 'tab-raise-right-window)
-    "Keymap containing bindings active when a client window is focused."
+    "Keymap active when a client window is focused."
     :group bindings
     :type keymap
     :before-set (lambda () (ungrab-keymap window-keymap))
@@ -110,7 +110,7 @@
 
   (defcustom root-window-keymap (bind-keys (make-keymap)
 					   "Button2-Click1" 'popup-root-menu)
-    "Keymap containing bindings active when the pointer is in the root window
+    "Keymap active when the pointer is in the root window
 (or when no window is focused)."
     :group bindings
     :type keymap)
@@ -121,8 +121,7 @@
 				     "Button1-Off2" 'toggle-window-shaded
 				     "Button1-Move" 'move-window-interactively
 				     "Button2-Off" 'tab-add-to-group)
-    "Keymap containing bindings active when the pointer is in the title of
-a window. (Only mouse-bindings are evaluated in this map.)"
+    "Keymap of window title bar. Mouse-bindings only."
     :group bindings
     :type keymap)
 
@@ -132,8 +131,7 @@ a window. (Only mouse-bindings are evaluated in this map.)"
 				      "C-Button1-Off" 'tab-add-to-group
 				      "C-Button1-Click" 'tab-release-window
 				      "C-Button1-Move" 'move-window-interactively)
-    "Keymap containing bindings active when the pointer is in the tabbar of
-a window. (Only mouse-bindings are evaluated in this map.)"
+    "Keymap of window tabbar. Mouse-bindings only."
     :group bindings
     :type keymap)
 
@@ -141,8 +139,7 @@ a window. (Only mouse-bindings are evaluated in this map.)"
 				      "Button3-Off" 'raise-lower-window
 				      "Button2-Move" 'move-window-interactively
 				      "Button1-Move" 'resize-window-interactively)
-    "Keymap containing bindings active when the pointer is in the border of
-a window. (Only mouse-bindings are evaluated in this map.)"
+    "Keymap of window border. Mouse-bindings only."
     :group bindings
     :type keymap)
 
@@ -150,16 +147,14 @@ a window. (Only mouse-bindings are evaluated in this map.)"
 					    "Button3-Click1" 'popup-window-ops-menu
 					    "S-Button1-Off" 'delete-group
 					    "Button1-Off" 'delete-window)
-    "Keymap containing bindings active when the pointer is in the close button
-of a window. (Only mouse-bindings are evaluated in this map.)"
+    "Keymap of \"close\" button. Mouse-bindings only."
     :group bindings
     :type keymap)
 
   (defcustom iconify-button-keymap (bind-keys (make-keymap)
 					      "Button3-Click1" 'popup-window-ops-menu
 					      "Button1-Off" 'iconify-window)
-    "Keymap containing bindings active when the pointer is in the iconify
-button of a window. (Only mouse-bindings are evaluated in this map.)"
+    "Keymap of \"iconify\" button. Mouse-bindings only."
     :group bindings
     :type keymap)
 
@@ -167,57 +162,40 @@ button of a window. (Only mouse-bindings are evaluated in this map.)"
 					       "Button3-Off" 'maximize-window-horizontally-toggle
 					       "Button2-Off" 'maximize-window-vertically-toggle
 					       "Button1-Off" 'maximize-window-toggle)
-    "Keymap containing bindings active when the pointer is in the maximize
-button of a window. (Only mouse-bindings are evaluated in this map.)"
+    "Keymap of \"maximize\" button. Mouse-bindings only."
     :group bindings
     :type keymap)
 
   (defcustom menu-button-keymap (bind-keys (make-keymap)
 					   "Button3-Off" 'delete-window
 					   "Button1-Click1" 'popup-window-ops-menu)
-    "Keymap containing bindings active when the pointer is in the menu button
-of a window. (Only mouse-bindings are evaluated in this map.)"
+    "Keymap of \"menu\" button. Mouse-bindings only."
     :group bindings
     :type keymap)
 
   (defcustom shade-button-keymap (bind-keys (make-keymap)
 					    "Button1-Off" 'toggle-window-shaded)
-    "Keymap containing bindings active when the pointer is in the shade button
-of a window. (Only mouse-bindings are evaluated in this map.)"
+    "Keymap of \"shade\" button. Mouse-bindings only."
     :group bindings
     :type keymap)
 
   (defcustom sticky-button-keymap (bind-keys (make-keymap)
 					     "Button1-Off" 'toggle-window-sticky
-					     "Button2-Off" '(call-command
-							     (lambda ()
-							       (if (window-get (current-event-window) 'sticky-viewport)
-								   (window-put (current-event-window) 'sticky-viewport nil)
-								 (window-put (current-event-window) 'sticky-viewport t)))))
-    "Keymap containing bindings active when the pointer is in the sticky button
-of a window. (Only mouse-bindings are evaluated in this map.)"
+					     "Button2-Off" 'toggle-window-sticky-viewport)
+    "Keymap of \"sticky\" button. Mouse-bindings only."
     :group bindings
     :type keymap)
 
   (defcustom lock-button-keymap (bind-keys (make-keymap)
-					   "Button1-Off" '(call-command
-							   (lambda ()
-							     (if (window-get (current-event-window) 'fixed-position)
-								 (window-put (current-event-window) 'fixed-position nil)
-							       (window-put (current-event-window) 'fixed-position t))
-							     (call-window-hook 'window-state-change-hook (current-event-window) (list '(fixed-position))))))
-
-
-    "Keymap containing bindings active when the pointer is in the lock button
-of a window. (Only mouse-bindings are evaluated in this map.)"
+					   "Button1-Off" 'toggle-fixed-postion)
+    "Keymap of \"lock\" button. Mouse-bindings only."
     :group bindings
     :type keymap)
 
 
   (defcustom rename-button-keymap (bind-keys (make-keymap)
 					     "Button1-Off" 'rename-window)
-    "Keymap containing bindings active when the pointer is in the rename button
-of a window. (Only mouse-bindings are evaluated in this map.)"
+    "Keymap of \"rename\" button. Mouse-bindings only."
     :group bindings
     :type keymap)
 
@@ -227,8 +205,7 @@ of a window. (Only mouse-bindings are evaluated in this map.)"
 						  "Button3-Off" 'move-window-center
 						  "Button4-Off" 'double-window-size
 						  "Button5-Off" 'halve-window-size)
-    "Keymap containing bindings active when the pointer is in the move/resize button
-of a window. (Only mouse-bindings are evaluated in this map.)"
+    "Keymap of \"move/resize\" button. Mouse-bindings only."
     :group bindings
     :type keymap)
 
@@ -237,13 +214,12 @@ of a window. (Only mouse-bindings are evaluated in this map.)"
 						  "Button2-Off" 'lower-window
 						  "Button4-Off" 'raise-window-depth
 						  "Button5-Off" 'lower-window-depth)
-    "Keymap containing bindings active when the pointer is in the raise/lower button
-of a window. (Only mouse-bindings are evaluated in this map.)"
+    "Keymap of \"raise/lower\" button. Mouse-bindings only."
     :group bindings
     :type keymap)
 
   (defvar pointer-motion-threshold 2
-    "Distance in pixels pointer must move before generating motion events.")
+    "Distance pointer must move before generating motion events, in pixels.")
 
   (defcustom wm-modifier-value (wm-modifier)
     "Modifier key(s) used for default shortcuts."
diff --git a/lisp/sawfish/wm/state/iconify.jl b/lisp/sawfish/wm/state/iconify.jl
index 32a3fb3..554d77e 100644
--- a/lisp/sawfish/wm/state/iconify.jl
+++ b/lisp/sawfish/wm/state/iconify.jl
@@ -34,6 +34,7 @@
 	    window-sticky-p/viewport
 	    make-window-sticky/viewport
 	    make-window-unsticky/viewport
+	    toggle-window-sticky/viewport
 	    window-sticky-p
 	    make-window-sticky
 	    make-window-unsticky
@@ -198,12 +199,20 @@
       (unless no-hooks
 	(emit-sticky-hook w))))
 
+   (define (toggle-window-sticky/viewport w #!key no-hooks)
+     "Toggle the stickiness of the window, i.e. make it appear in
+all viewports."
+     (if (window-get w 'sticky-viewport)
+	 (window-put w 'sticky-viewport nil)
+       (window-put w 'sticky-viewport t)))
+
   ;; combined code
 
   (define (window-sticky-p w)
     (or (window-sticky-p/workspace w) (window-sticky-p/viewport w)))
 
   (define (make-window-sticky w)
+    "Make the window appear in all workspaces and viewports."
     (unless (window-sticky-p w)
       (make-window-sticky/workspace w #:no-hooks t)
       (make-window-sticky/viewport w #:no-hooks t)
@@ -216,8 +225,8 @@
       (emit-sticky-hook w)))
 
   (define (toggle-window-sticky w)
-    "Toggle the `stickiness' of the window--whether or not it is a member of
-all workspaces."
+    "Toggle the `stickiness' of the window, i.e. make it appear in
+all workspaces and viewports."
     (if (window-sticky-p w)
 	(make-window-unsticky w)
       (make-window-sticky w)))
@@ -225,7 +234,10 @@ all workspaces."
   (define-command 'make-window-sticky make-window-sticky #:spec "%W")
   (define-command 'make-window-unsticky make-window-unsticky #:spec "%W")
   (define-command 'toggle-window-sticky toggle-window-sticky #:spec "%W")
-
+  (define-command 'toggle-window-sticky-viewport
+    toggle-window-sticky/viewport #:spec "%W")
+    
+  
 ;;; hooks
 
   (define (ws-client-msg-handler w prop data)
diff --git a/lisp/sawfish/wm/windows.jl b/lisp/sawfish/wm/windows.jl
index 3df426a..0a1d959 100644
--- a/lisp/sawfish/wm/windows.jl
+++ b/lisp/sawfish/wm/windows.jl
@@ -59,7 +59,8 @@
 	     avoided-windows
 	     call-after-property-changed
 	     call-after-state-changed
-	     rename-window))
+	     rename-window
+	     toggle-fixed-postion))
 
     (open rep
 	  rep.system
@@ -572,7 +573,14 @@ STATES has been changed. STATES may also be a single symbol."
   (define-command 'rename-window rename-window
     #:spec "%W\nsEnter new window name:")
 
-  ;;; gaollable functions
+  (define (toggle-fixed-postion w)
+    "Toggle the window property `fixed-position'."
+     (if (window-get w 'fixed-position)
+	 (window-put w 'fixed-position nil)
+       (window-put w 'fixed-position t))
+     (call-window-hook 'window-state-change-hook w (list '(fixed-position))))
+  (define-command 'toggle-fixed-postion toggle-fixed-postion #:spec "%W")
+;;; gaollable functions
 
   (gaol-add window-really-wants-input-p window-class window-avoided-p
 	    call-after-property-changed call-after-state-changed



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