xwem-patches
[Top] [All Lists]

Summary for xwem--main--2.1--patch-23

From: Zajcev Evgeny <lg@xxxxxxxx>
Subject: Summary for xwem--main--2.1--patch-23
Date: Thu, 17 Feb 2005 02:02:11 +0300 (MSK)
Location: lg@xxxxxxxxxxxxxx http://arch.xwem.org/2005/

Revision: xwem--main--2.1--patch-23
Archive: lg@xxxxxxxxxxxxxx
Creator: Zajcev Evgeny <lg@xxxxxxxx>
Date: Thu Feb 17 02:02:01 MSK 2005
Standard-date: 2005-02-16 23:02:01 GMT
New-files: extra/.arch-ids/xwem-keytt.el.id
    extra/.arch-ids/xwem-vline.el.id extra/xwem-keytt.el
    extra/xwem-vline.el
Modified-files: dockapp/xwem-time.el lisp/xwem-clients.el
    lisp/xwem-focus.el lisp/xwem-frame.el
    lisp/xwem-keyboard.el lisp/xwem-main.el
    lisp/xwem-modes.el utils/xwem-diagram.el
    xwem-agent/xwem-agent.c
New-patches: dev@xxxxxxxxxxxxxxxx/xwem--dev--2.1--patch-17
    lg@xxxxxxxxxxxxxx/xwem--main--2.1--patch-23
Summary: Merge from ckent, xwem-vline initial import
Keywords: xwem-keytt, xwem-vline, minor-modes

* dockapp/xwem-time.el (xwem-time-format-distance): [new] Custom variable
  to specify distance between time/load/main items.

* lisp/xwem-clients.el (xwem-cl-XProperty-manage-spec-export): [fix]
  Check client for aliveness before exporting.

* lisp/xwem-clients.el (xwem-cl-XProperty-plist-export): [fix] Check
  client for aliveness before exporting.

* lisp/xwem-clients.el (xwem-cl-presetup): [addon] Grab keymaps of global
  minor modes.

* lisp/xwem-focus.el (xwem-add-minor-mode): [fix] due to minor modes
  fixes.

* lisp/xwem-frame.el (xwem-frame-export-frame-configuration): [comment]
  Profiling results added.

* lisp/xwem-frame.el (xwem-frame-frame-command-post-hook): [change]
  Always export frames configuration.  Since profiling shows that
  exporting does not strikes performance at all.

* lisp/xwem-keyboard.el (xwem-keyboard-use-synth-events): Client local
  now.

* lisp/xwem-keyboard.el (xwem-lookup-map): [fix] due to minor modes
  fixes.

* lisp/xwem-keyboard.el (xwem-minor-mode-key-binding): [fix] due to minor
  modes fixes.

* lisp/xwem-main.el (xwem-commands-gc-cons-threshold): [change] 40000000
  is too large for default value.  Now 5000000.

* lisp/xwem-modes.el (xwem-add-minor-mode): [fix] KEYMAP is a symbol now
  that holds a keymap, to make keymaps possible be client local.

* lisp/xwem-modes.el (xwem-turn-on-minor-mode): [fix] due to minor modes
  fixes.

* lisp/xwem-modes.el (xwem-turn-off-minor-mode): [fix] due to minor modes
  fixes.

* utils/xwem-diagram.el (xwem-diag-draw-percentage): [BUG fix] incorrect
  rendering fixed.

* xwem-agent/xwem-agent.c (restart_emacs): [BUG fix] waiting is performed
  in SIGCHLD handler.

* xwem-agent/xwem-agent.c (state): [new] Variable represents current
  xwem-agent state - waiting, running or killing.

* xwem-agent/xwem-agent.c (main): [addon] kill key added on C-Sh-f9 to
  kill emacs with SIGKILL.

* extra/xwem-keytt.el (new): Initial import of keyboard translation minor
  mode.  Use H-M-x xwem-keytt-minor-mode RET to toggle it for selected
  client.  NOTE: only 'gv' application is supported currently.

* extra/xwem-vline.el (new): Initial import of vertical line minor mode.
  Use H-M-x xwem-vline-minor-mode RET to toggle it for selected client.


* added files

    extra/.arch-ids/xwem-keytt.el.id
    extra/.arch-ids/xwem-vline.el.id
    extra/xwem-keytt.el
    extra/xwem-vline.el
    {arch}/xwem/xwem--dev/xwem--dev--2.1/dev@xxxxxxxxxxxxxxxx/patch-log/patch-17
    {arch}/xwem/xwem--main/xwem--main--2.1/lg@xxxxxxxxxxxxxx/patch-log/patch-23

* modified files

--- orig/dockapp/xwem-time.el
+++ mod/dockapp/xwem-time.el
@@ -60,7 +60,7 @@
   :group 'xwem)
 
 (defcustom xwem-time-format '(time load mail)
-  "Format to display time/load/mail.
+  "*Format to display time/load/mail.
 List of keywords, where each keyword is either:
 
   time - Display time
@@ -76,6 +76,11 @@
   :initialize 'custom-initialize-default
   :group 'xwem-time)
 
+(defcustom xwem-time-format-distance 3
+  "*Distance in pixels between time/load/mail items."
+  :type 'number
+  :group 'xwem-time)
+
 ;; Time
 (defcustom xwem-time-time-color "#CA1E1C"
   "Foreground color to display time."
@@ -892,10 +897,12 @@
          (off 0))
      (while (and fmt (not (eq (car fmt) ,tag)))
        (incf off (xwem-time-format-tag-width (car fmt)))
+       (incf off xwem-time-format-distance)
        (setq fmt (cdr fmt)))
      off))
 (defmacro xwem-time-format-width ()
-  `(apply '+ (mapcar 'xwem-time-format-tag-width xwem-time-format)))
+  `(+ (apply '+ (mapcar 'xwem-time-format-tag-width xwem-time-format))
+      (* (1- (length xwem-time-format)) xwem-time-format-distance)))
 (defmacro xwem-time-format-height ()
   'xwem-time-dockapp-height)
 


--- orig/lisp/xwem-clients.el
+++ mod/lisp/xwem-clients.el
@@ -464,15 +464,16 @@
   `(xwem-cl-XProperty-get ,cl "XWEM_CLIENT_MANAGE_SPEC"))
 (define-xwem-deffered xwem-cl-XProperty-manage-spec-export (cl)
   "Export CL's manage spec into XWEM_CLIENT_PLIST X property."
-  (xwem-cl-XProperty-set cl "XWEM_CLIENT_MANAGE_SPEC"
-                         (xwem-cl-manage-spec cl)))
+  (when (xwem-cl-alive-p cl)
+    (xwem-cl-XProperty-set cl "XWEM_CLIENT_MANAGE_SPEC"
+                           (xwem-cl-manage-spec cl))))
 (defmacro xwem-cl-XProperty-plist (cl)
   `(xwem-cl-XProperty-get ,cl "XWEM_CLIENT_PLIST"))
 (define-xwem-deffered xwem-cl-XProperty-plist-export (cl)
   "Export CL's plist into XWEM_CLIENT_PLIST X property."
-  (xwem-cl-XProperty-set
-   cl "XWEM_CLIENT_PLIST"
-   (xwem-client-properties cl)))
+  (when (xwem-cl-alive-p cl)
+    (xwem-cl-XProperty-set cl "XWEM_CLIENT_PLIST"
+                           (xwem-client-properties cl))))
 
 
 ;;; Functions
@@ -1100,8 +1101,7 @@
 
   ;; If CL was current client, uset current client
   (when (xwem-cl-selected-p cl)
-    (xwem-select-client nil))
-  )
+    (xwem-select-client nil)))
 
 ;;; Creating new client
 (defun xwem-cl-presetup (cl)
@@ -1139,10 +1139,17 @@
 
     (XChangeSaveSet (xwem-dpy) (xwem-cl-xwin cl) X-SetModeInsert)
 
-    (XChangeSaveSet (xwem-dpy) (xwem-cl-xwin cl) X-SetModeInsert)
-
     ;; Install keyboard grabs, (ARGUSED)
-    (xwem-kbd-install-grab xwem-global-map xwin)))
+    (xwem-kbd-install-grab xwem-global-map xwin)
+
+    ;; Install keyboard grabs for global minor modes
+    (mapc (lambda (mm-entry)
+            (when (and (not (xwem-client-local-variable-p (car mm-entry)))
+                       (not (xwem-client-local-variable-p (cdr mm-entry)))
+                       (symbol-value (car mm-entry)))
+              (xwem-kbd-install-grab (symbol-value (cdr mm-entry)) xwin)))
+          xwem-minor-mode-map-alist)
+    ))
 
 ;;;###xwem-autoload
 (defun xwem-make-client (xwin &optional props)
@@ -1157,7 +1164,6 @@
                                        xwem-frame-ev-mask
                                      0)))))
     (when (xwem-misc-xwin-valid-p xwin) ; just to check that XWIN still alive
-
       (xwem-debug 'xwem-cl "New Client making name=%s, class=%S"
                   '(XGetWMName (xwem-dpy) xwin) '(XGetWMClass (xwem-dpy) xwin))
 


--- orig/lisp/xwem-focus.el
+++ mod/lisp/xwem-focus.el
@@ -278,9 +278,8 @@
          (xwem-turn-off-focus-click-mode cl))))
 
 ;; Register minor mode
-(xwem-add-minor-mode 'xwem-focus-click-minor-mode
-                     'xwem-focus-click-minor-mode
-                     xwem-focus-click-to-focus-map)
+(xwem-add-minor-mode 'xwem-focus-click-minor-mode "Click "
+                     'xwem-focus-click-to-focus-map)
 
 
 (provide 'xwem-focus)


--- orig/lisp/xwem-frame.el
+++ mod/lisp/xwem-frame.el
@@ -336,7 +336,13 @@
   `(xwem-XProperty-set (xwem-frame-xwin ,frame) ,prop-atom-string ,prop-val))
 
 (define-xwem-deffered xwem-frame-export-frame-configuration ()
-  "Export frame configuration to root window."
+  "Export frame configuration to root window.
+
+Profiling results on 9 frames with 32 windows:
+Function Name                          Call Count  Elapsed Time  Average Time
+=====================================  ==========  ============  ============
+xwem-frame-export-frame-configuration  50          0.016508      0.00033016
+"
   (xwem-XProperty-set (xwem-rootwin) "XWEM_FRAME_CONFIGURATION"
                       (with-temp-buffer
                         (xwem-frame-config-dump1 (xwem-frame-configuration)
@@ -345,12 +351,8 @@
 
 (defun xwem-frame-frame-command-post-hook ()
   "Function to use in `xwem-post-command-hook'.
-It exports frame configuration if executed frame command.
-However it will not guarantie full sync of frames configuration.
-Also it makes sense only if `xwem-frame-configuration-exporting' is
-non-nil."
-  (when (and xwem-frame-configuration-exporting
-             (get xwem-last-command 'xwem-frame-command))
+It exports frame configuration after each xwem command."
+  (when xwem-frame-configuration-exporting
     (xwem-frame-export-frame-configuration)))
 
 (defun xwem-frame-import-frame-configuration ()


--- orig/lisp/xwem-keyboard.el
+++ mod/lisp/xwem-keyboard.el
@@ -167,9 +167,11 @@
 However if having `xwem-keyboard-use-synth-events' to non-nil, make
 sure you've configured clients to accept synthetic X events (f.i. set
 `x-allow-sendevents' to non-nil to make XEmacs accept synthetic
-events)."
+events).
+This is client local variable.  Each client have its own value for it."
   :type 'boolean
   :group 'xwem-keyboard)
+(xwem-make-variable-client-local 'xwem-keyboard-use-synth-events)
 
 ;;; Internal variables
 
@@ -1079,15 +1081,15 @@
            (and bind lkmap))
 
           ;; Try minor modes keymaps and global keymap
-          (t (let ((mlist xwem-minor-mode-map-alist))
-               ;; Scan minor modes for binding
-               (while (and mlist
-                           (null (xwem-client-local-variable-value client (car 
(car mlist))))
-                           (null (setq bind (lookup-key (xwem-kbd-fixup-keymap 
(cdr (car mlist)))
-                                                        keys accept-default))))
-                 (setq mlist (cdr mlist)))
-               ;; If no biding, use global map
-               (or (and bind (cdr (car mlist)))
+          (t (let* ((mm-bind (xwem-minor-mode-key-binding client keys 
accept-default))
+                    (mm-km-sym (and mm-bind
+                                    (cdr (assq (car mm-bind) 
xwem-minor-mode-map-alist))))
+                    (mm-km (and mm-km-sym
+                                (if (xwem-client-local-variable-p mm-km-sym)
+                                    (xwem-client-local-variable-value client 
mm-km-sym)
+                                  (symbol-value mm-km-sym)))))
+               ;; If no minor mode keymap, use global map
+               (or mm-km
                    (and (lookup-key (xwem-kbd-fixup-keymap xwem-global-map)
                                     keys accept-default)
                         xwem-global-map)))))))
@@ -1112,9 +1114,17 @@
         (bind nil))
     ;; Scan minor modes for binding
     (while (and mlist (not bind))
-      (when (xwem-client-local-variable-value cl (car (car mlist)))
-        (setq bind (lookup-key (xwem-kbd-fixup-keymap (cdr (car mlist)))
-                               keys accept-default)))
+      (let ((mode-sym (car (car mlist)))
+            (km-sym (cdr (car mlist)))
+            kmap)
+        (when (if (xwem-client-local-variable-p mode-sym)
+                  (xwem-client-local-variable-value cl mode-sym)
+                (symbol-value mode-sym))
+          (setq kmap (if (xwem-client-local-variable-p km-sym)
+                         (xwem-client-local-variable-value cl km-sym)
+                       (symbol-value km-sym)))
+          (when (keymapp kmap)
+            (setq bind (lookup-key kmap keys accept-default)))))
       (unless bind
         (setq mlist (cdr mlist))))
     (when bind


--- orig/lisp/xwem-main.el
+++ mod/lisp/xwem-main.el
@@ -121,7 +121,7 @@
   :group 'xwem)
 
 ;;;###xwem-autoload
-(defcustom xwem-commands-gc-cons-threshold 40000000
+(defcustom xwem-commands-gc-cons-threshold 5000000
   "*Value of `gc-cons-threshold' to use when executing xwem commands.
 Make sense only if `xwem-commands-inhibit-gc' is non-nil."
   :type 'number


--- orig/lisp/xwem-modes.el
+++ mod/lisp/xwem-modes.el
@@ -45,26 +45,29 @@
   "Alist of keymaps for use of minor modes.
 Each element looks like (VAR . KEYMAP).")
 
-;;;###xwem-autoload
+;;;###xwem-autoload(autoload 'xwem-add-minor-mode "xwem-modes")
 (defun xwem-add-minor-mode (toggle name &optional keymap)
   "Add a minor mode to `xwem-minor-mode-alist'.
-
 For TOGGLE, NAME, KEYMAP, usage take a look at `add-minor-mode'."
   (setq xwem-minor-mode-alist
         (put-alist toggle (list name) xwem-minor-mode-alist))
-  (when (keymapp keymap)
+
+  (when keymap
     (setq xwem-minor-mode-map-alist
           (put-alist toggle keymap xwem-minor-mode-map-alist))))
 
 ;;;###xwem-autoload
 (defun xwem-turn-on-minor-mode (cl mm-toggle)
   "On CL, turn on minor mode MM-TOGGLE."
-  (unless (or (and (xwem-client-local-variable-p mm-toggle)
-                   (xwem-client-local-variable-value cl mm-toggle))
-              (symbol-value mm-toggle))
-    (let ((kmap (assq mm-toggle xwem-minor-mode-map-alist)))
-      (when (keymapp (cdr kmap))
-        (xwem-kbd-install-grab (cdr kmap) (xwem-cl-xwin cl))))
+  (unless (if (xwem-client-local-variable-p mm-toggle)
+              (xwem-client-local-variable-value cl mm-toggle)
+            (symbol-value mm-toggle))
+    (let* ((km-sym (cdr (assq mm-toggle xwem-minor-mode-map-alist)))
+           (kmap (if (xwem-client-local-variable-p km-sym)
+                     (xwem-client-local-variable-value cl km-sym)
+                   (symbol-value km-sym))))
+      (when (keymapp kmap)
+        (xwem-kbd-install-grab kmap (xwem-cl-xwin cl))))
 
     (if (xwem-client-local-variable-p mm-toggle)
         (xwem-client-local-variable-set cl mm-toggle t)
@@ -73,12 +76,15 @@
 ;;;###xwem-autoload
 (defun xwem-turn-off-minor-mode (cl mm-toggle)
   "On CL, turn off minor mode MM-TOGGLE."
-  (when (or (and (xwem-client-local-variable-p mm-toggle)
-                 (xwem-client-local-variable-value cl mm-toggle))
-            (symbol-value mm-toggle))
-    (let ((kmap (assq mm-toggle xwem-minor-mode-map-alist)))
-      (when (keymapp (cdr kmap))
-        (xwem-kbd-uninstall-grab (cdr kmap) (xwem-cl-xwin cl))))
+  (when (if (xwem-client-local-variable-p mm-toggle)
+            (xwem-client-local-variable-value cl mm-toggle)
+          (symbol-value mm-toggle))
+    (let* ((km-sym (cdr (assq mm-toggle xwem-minor-mode-map-alist)))
+           (kmap (if (xwem-client-local-variable-p km-sym)
+                     (xwem-client-local-variable-value cl km-sym)
+                   (symbol-value km-sym))))
+      (when (keymapp kmap)
+        (xwem-kbd-uninstall-grab kmap (xwem-cl-xwin cl))))
     (if (xwem-client-local-variable-p mm-toggle)
         (xwem-client-local-variable-set cl mm-toggle nil)
       (set-variable mm-toggle nil))))


--- orig/utils/xwem-diagram.el
+++ mod/utils/xwem-diagram.el
@@ -442,20 +442,11 @@
         
       ;; Draw little sectors
       (setq angle-begin start-angle)
-      (mapc (lambda (ssec)
-              (setq curang (* 360.0 (/ (aref ssec 0) 100.0))
-                    angle-begin (- angle-begin curang))
-              (funcall draw-sector ssec angle-begin curang))
-            (nreverse spec))
-
-      ;; Draw other sectors, XXX not used
-      (setq angle-begin 0)
-      (mapc (lambda (el)
-              (setq curang (* 360.0 (/ (aref el 0) 100.0)))
-              (funcall draw-sector el angle-begin curang)
-              (setq angle-begin (+ angle-begin curang)))
-            spec))))
-
+      (mapc (lambda (sss)
+              (setq curang (* 360.0 (/ (aref sss 0) 100.0)))
+              (setq angle-begin (- angle-begin curang))
+              (funcall draw-sector sss angle-begin curang))
+            (nreverse spec)))))
 
 (defun xwem-diag-plot-coordinates (d gc x y w h x-step y-step &rest params)
   "Draw coordinates system."


--- orig/xwem-agent/xwem-agent.c
+++ mod/xwem-agent/xwem-agent.c
@@ -48,6 +48,8 @@
  *
  *   C-Sh-F6  - Kill (S)XEmacs with SIGABORT signal, this will cause
  *              (S)XEmacs to dump core for futher investigation.
+ *   C-Sh-F9  - Kill (S)XEmacs with SIGKILL signal, this will cause
+ *              (S)XEmacs to always exit.
  *   C-Sh-F11 - Kill (S)XEmacs with SIGTERM signal, this will cause
  *              (S)XEmacs to terminate normally.
  *   C-Sh-ESC - Exit xwem-agent.
@@ -112,6 +114,12 @@
 
 char *outfile = NULL;
 
+enum {
+        STATE_WAITINNG,
+        STATE_RUNNING,
+        STATE_KILLING
+};
+static int state = STATE_WAITINNG;      /* xwem-agent current state */
 
 /*
  * Evil hackery do display verbose logs
@@ -178,6 +186,7 @@
                 exit(EX_UNAVAILABLE);
                 /* NOT REACHED */
         }
+        state = STATE_RUNNING;
         xverbose("  + Starting %s pid=%d ..", emacs, epid);
 
         return epid;
@@ -192,12 +201,9 @@
         if (epid > 0) {
                 xverbose("  + Killing (S)XEmacs pid=%d sig=%d ..", epid, sig);
 
+                state = STATE_KILLING;
                 kill(epid, sig);
-                wait(NULL);
-        }
-
-        /* Start it again */
-        if (epid < 0) 
+        } else
                 start_emacs();
 }
 
@@ -217,8 +223,10 @@
         XSetInputFocus(xdpy, PointerRoot, RevertToPointerRoot, CurrentTime);
         xverbose("  + InputFocus set to PointerRoot ..");
 
-        if (autodetect && epid < 0)
+        if ((state == STATE_KILLING) || autodetect)
                 start_emacs();
+        else
+                state = STATE_WAITINNG;
 }
 
 void
@@ -248,7 +256,7 @@
         const char *prog = argv[0];
         int o_flag = 0;
         int ch;
-        KeyCode exit_kc, abort_kc, term_kc;
+        KeyCode exit_kc, abort_kc, term_kc, kill_kc;
 
         while ((ch = getopt(argc, argv, "onv:f:")) != -1) {
                 switch (ch) {
@@ -300,7 +308,6 @@
 
         xverbose("+ X Initialisation ..");
 
-
         XSetInputFocus(xdpy, RootWindow(xdpy, DefaultScreen(xdpy)),
                        RevertToPointerRoot, CurrentTime);
         xverbose("  + InputFocus set to root window ..");
@@ -318,9 +325,15 @@
         XGrabKey(xdpy, term_kc, ShiftMask|ControlMask,
                  RootWindow(xdpy, DefaultScreen(xdpy)), True,
                  GrabModeAsync, GrabModeAsync);
-        xverbose("  + Magic keys at C-Sh-ESC(exit), C-Sh-F6(SIGABORT) and 
C-Sh-F11(SIGTERM) ..");
-
+        kill_kc = XKeysymToKeycode(xdpy, XK_F9);
+        XGrabKey(xdpy, kill_kc, ShiftMask|ControlMask,
+                 RootWindow(xdpy, DefaultScreen(xdpy)), True,
+                 GrabModeAsync, GrabModeAsync);
         XFlush(xdpy);
+        xverbose("  + Magic keys at C-Sh-ESC(exit), C-Sh-F6(SIGABORT),"
+                 " C-Sh-F9(SIGKILL) and C-Sh-F11(SIGTERM) ..");
+
+        state = STATE_WAITINNG;
 
         if (o_flag == 0)
                 /* Start (S)XEmacs */
@@ -342,6 +355,8 @@
                                 restart_emacs(SIGABRT);
                         else if (xev.xkey.keycode == term_kc)
                                 restart_emacs(SIGTERM);
+                        else if (xev.xkey.keycode == kill_kc)
+                                restart_emacs(SIGKILL);
                         else
                                 xverbose("  - Unrecognized keycode 0x%X ..",
                                          xev.xkey.keycode);




<Prev in Thread] Current Thread [Next in Thread>
  • Summary for xwem--main--2.1--patch-23, Zajcev Evgeny <=