Location: lg@xxxxxxxxxxxxxx http://arch.xwem.org/2005/
Revision: xwem--main--2.1--patch-10
Archive: lg@xxxxxxxxxxxxxx
Creator: Zajcev Evgeny <lg@xxxxxxxx>
Date: Mon Jan 31 03:09:12 MSK 2005
Standard-date: 2005-01-31 00:09:12 GMT
Modified-files: dockapp/xwem-weather.el lisp/xwem-clgen.el
lisp/xwem-keyboard.el lisp/xwem-keymacro.el
lisp/xwem-misc.el
New-patches: lg@xxxxxxxxxxxxxx/xwem--main--2.1--patch-10
Summary: tiny fixes, little cleanup
Keywords: weather, keyboard, misc
* dockapp/xwem-weather.el (xwem-weather-display-temp): [fix]
`xwem-osd-show' removed. `xwem-osd-show' implied by
`xwem-osd-create-dock'.
* lisp/xwem-clgen.el (parenting): [addon] parenting stuff moved here from
xwem-misc.
* lisp/xwem-misc.el (parenting): [rem] moved to xwem-clgen.
* lisp/xwem-keymacro.el (xwem-executing-kbd-macro): [removed]
* lisp/xwem-keymacro.el (xwem-keymacro-executing-p): [new] Return non-nil
if executing keyboard macro.
* added files
{arch}/xwem/xwem--main/xwem--main--2.1/lg@xxxxxxxxxxxxxx/patch-log/patch-10
* modified files
--- orig/dockapp/xwem-weather.el
+++ mod/dockapp/xwem-weather.el
@@ -316,9 +316,7 @@
;; Do it so, `xwem-weather-osd-text-height' and
;; `xwem-weather-osd-text-height' will use mask's gc.
(xwem-osd-create-mask xwem-weather-osd)
-
- (xwem-weather-display-text text)
- (xwem-osd-show xwem-weather-osd))))
+ (xwem-weather-display-text text))))
;;;###autoload
(defun xwem-weather-init (&optional dockid dockgroup dockalign)
--- orig/lisp/xwem-clgen.el
+++ mod/lisp/xwem-clgen.el
@@ -307,8 +307,16 @@
(xwem-clgen-refit cl)
(xwem-cl-apply-xgeom cl))
-;;; NOTE: make sure XReparentWindow adviced by xwem-misc to save last
-;; xparent.
+(defun xwem-clgen-has-xparent (cl xparent)
+ "Return non-nil if generic client CL has XPARENT last-parent."
+ (let ((clxp (xwem-cl-get-sys-prop cl 'last-xparent)))
+ (and (X-Win-p clxp)
+ (X-Win-equal clxp xparent))))
+
+(defun xwem-clgen-xreparent (cl xparwin x y)
+ (XReparentWindow (xwem-dpy) (xwem-cl-xwin cl) xparwin x y)
+ (xwem-cl-put-sys-prop cl 'last-xparent xparwin))
+
(define-xwem-deffered xwem-clgen-apply-state (cl)
"Apply CL's state to life for generic client CL."
(when (and (xwem-cl-p cl)
@@ -316,30 +324,26 @@
(cond ((eq (xwem-cl-state cl) 'active)
(xwem-clgen-refit cl)
(when (and (xwem-cl-frame cl)
- (not (X-Win-equal
- (xwem-misc-xwin-last-xparent (xwem-cl-xwin cl))
- (xwem-frame-xwin (xwem-cl-frame cl)))))
- (XReparentWindow (xwem-dpy) (xwem-cl-xwin cl)
- (xwem-frame-xwin (xwem-cl-frame cl))
- (X-Geom-x (xwem-cl-xgeom cl))
- (X-Geom-y (xwem-cl-xgeom cl))))
+ (not (xwem-clgen-has-xparent
+ cl (xwem-frame-xwin (xwem-cl-frame cl)))))
+ (xwem-clgen-xreparent cl (xwem-frame-xwin (xwem-cl-frame cl))
+ (X-Geom-x (xwem-cl-xgeom cl))
+ (X-Geom-y (xwem-cl-xgeom cl))))
(xwem-cl-apply-xgeom-1 cl)
(XLowerWindow (xwem-dpy) (xwem-cl-xwin cl))
(XMapWindow (xwem-dpy) (xwem-cl-xwin cl)))
((eq (xwem-cl-state cl) 'inactive)
- (unless (X-Win-equal (xwem-misc-xwin-last-xparent (xwem-cl-xwin cl))
- (xwem-cl-xparent cl))
- (XReparentWindow (xwem-dpy) (xwem-cl-xwin cl)
- (xwem-cl-xparent cl) 0 0)
+ (unless (xwem-clgen-has-xparent
+ cl (xwem-cl-xparent cl))
+ (xwem-clgen-xreparent cl (xwem-cl-xparent cl) 0 0)
(XLowerWindow (xwem-dpy) (xwem-cl-xwin cl))
(XUnmapWindow (xwem-dpy) (xwem-cl-xwin cl))))
((eq (xwem-cl-state cl) 'iconified)
- (unless (X-Win-equal (xwem-misc-xwin-last-xparent (xwem-cl-xwin cl))
- (xwem-cl-xparent cl))
- (XReparentWindow (xwem-dpy) (xwem-cl-xwin cl)
- (xwem-cl-xparent cl) 0 0)
+ (unless (xwem-clgen-has-xparent
+ cl (xwem-cl-xparent cl))
+ (xwem-clgen-xreparent cl (xwem-cl-xparent cl) 0 0)
(XLowerWindow (xwem-dpy) (xwem-cl-xwin cl))
(XUnmapWindow (xwem-dpy) (xwem-cl-xwin cl)))))
))
--- orig/lisp/xwem-keyboard.el
+++ mod/lisp/xwem-keyboard.el
@@ -854,28 +854,12 @@
;;;###xwem-autoload
(defun xwem-kbd-wait-key-release (keycode)
"Wait for key with KEYCODE for release."
- (unless xwem-executing-kbd-macro
-
+ (unless (xwem-keymacro-executing-p)
;; Now wait key release event
(XNextEvent (xwem-dpy) nil
(lambda (xev)
(and (= (X-Event-type xev) X-KeyRelease)
- (= (X-Event-xkey-keycode xev) keycode))))
- ))
-; ;; Increase events queue protecs so no events will be
-; ;; processed inside `XIfEvent'.
-; (incf (X-Dpy-evq-protects (xwem-dpy)))
-
-; ;; Wait for a keyrelease
-; (unwind-protect
-; (XIfEvent (xwem-dpy)
-; (lambda (xev)
-; (and (= (X-Event-type xev) X-KeyRelease)
-; (= (X-Event-xkey-keycode xev) keycode))))
-
-; ;; Allow later events processing
-; (decf (X-Dpy-evq-protects (xwem-dpy)))))
-
+ (= (X-Event-xkey-keycode xev) keycode))))))
;;;###xwem-autoload
(defun xwem-kbd-force-mods-release (&optional mods)
@@ -1345,13 +1329,13 @@
(defun xwem-kbd-apply-grabbing ()
"Start/stop grabbing according to `xwem-kbd-now-grabbing'."
(if xwem-kbd-now-grabbing
- (unless xwem-executing-kbd-macro
+ (unless (xwem-keymacro-executing-p)
(XGrabKeyboard (xwem-dpy) (or (xwem-cl-xwin (xwem-dummy-client))
(xwem-rootwin))
nil)
(xwem-mouse-grab xwem-kbd-now-grabbing)
(XAllowEvents (xwem-dpy) X-SyncBoth))
- (unless xwem-executing-kbd-macro
+ (unless (xwem-keymacro-executing-p)
(XUngrabKeyboard (xwem-dpy))
(xwem-mouse-ungrab))))
--- orig/lisp/xwem-keymacro.el
+++ mod/lisp/xwem-keymacro.el
@@ -105,10 +105,6 @@
;;; Macros recording/playing internal variables
;;;###xwem-autoload
-(defvar xwem-executing-kbd-macro nil
- "Non-nil when executing keyboard macro.")
-
-;;;###xwem-autoload
(defvar xwem-keymacro-macros-stack nil
"List of defined keyboard macroses.")
@@ -209,27 +205,21 @@
(or cutlen 1))))
(key-sequence-list-description (vconcat evs))))
-(defun xwem-keymacro-start-executing-keys (&rest args)
- "Start executing keyboard macro."
- (setq xwem-executing-kbd-macro t))
-
-(defun xwem-keymacro-stop-executing-keys (&rest args)
- "Stop executing keyboard macro."
- (setq xwem-executing-kbd-macro nil))
+;;;###xwem-autoload
+(defun xwem-keymacro-executing-p ()
+ "Return non-nil if executing keyboard macro."
+ (and (boundp 'xwem-keymacro-keys)
+ (boundp 'xwem-keymacro-keys-index)))
;;;###xwem-autoload
(defun xwem-keymacro-execute-keys (keys)
"Execute keyboard macro KEYS."
- (xwem-keymacro-start-executing-keys)
-
(let ((xwem-keymacro-keys keys)
(xwem-keymacro-keys-index 0))
- (xwem-unwind-protect
- (while (< xwem-keymacro-keys-index (length xwem-keymacro-keys))
- (xwem-dispatch-command-event
- (aref xwem-keymacro-keys xwem-keymacro-keys-index))
- (incf xwem-keymacro-keys-index))
- (xwem-keymacro-stop-executing-keys))))
+ (while (< xwem-keymacro-keys-index (length xwem-keymacro-keys))
+ (xwem-dispatch-command-event
+ (aref xwem-keymacro-keys xwem-keymacro-keys-index))
+ (incf xwem-keymacro-keys-index))))
; (enqueue-eval-event 'xwem-keymacro-start-executing-keys t)
; (mapc 'xwem-unread-command-event keys)
; (enqueue-eval-event 'xwem-keymacro-stop-executing-keys t)
@@ -373,19 +363,19 @@
edit."
(xwem-interactive "_P")
- (or xwem-executing-kbd-macro
+ (or (xwem-keymacro-executing-p)
xwem-keymacro-saving
(error 'xwem-error "Not defining or executing keyboard macro"))
(let ((xwem-this-command-keys [])
(xwem-prefix-arg nil))
- (unless xwem-executing-kbd-macro
+ (unless (xwem-keymacro-executing-p)
(X-XRecordDisableContext (xwem-dpy) xwem-keymacro-rcontext))
(xwem-recursive-edit)
- (unless xwem-executing-kbd-macro
+ (unless (xwem-keymacro-executing-p)
(X-XRecordEnableContext xwem-keymacro-dpy xwem-keymacro-rcontext))
))
@@ -395,7 +385,7 @@
(xwem-interactive "*")
;; XXX
- (when xwem-executing-kbd-macro
+ (when (xwem-keymacro-executing-p)
(xwem-kbd-force-mods-release))
(xwem-exit-recursive-edit))
--- orig/lisp/xwem-misc.el
+++ mod/lisp/xwem-misc.el
@@ -712,12 +712,6 @@
(pushnew 'xwem-misc-xerr-hook (X-Dpy-error-hooks (xwem-dpy)))
(xwem-cursors-init)
- ;; Advice XReparentWindow to save last xparent
- (defadvice XReparentWindow (after save-last-parent-window
- (xdpy win parwin &rest args) activate)
- "Save last parent on every `XReparentWindow'."
- (X-Win-put-prop win 'last-xparent parwin))
-
(xwem-message 'init "Initializing masking ...")
;; Depth 1 pixmap, gcs
(setq xwem-misc-mask-pixmap
@@ -1588,15 +1582,6 @@
(let ((print-level 3)) ; XXX Restrict huge output
(apply 'X-Dpy-log (xwem-dpy) routine fmt fmt-args)))
-;;;###xwem-autoload
-(defun xwem-misc-xwin-last-xparent (xwin)
- "Return last xparent for XWIN."
- (let ((rxp (X-Win-get-prop xwin 'last-xparent)))
- (unless (X-Win-p rxp)
- (setq rxp (nth 3 (XQueryTree (X-Win-dpy xwin) xwin)))
- (X-Win-put-prop xwin 'last-xparent rxp))
- rxp))
-
(provide 'xwem-misc)
|