xwem-patches
[Top] [All Lists]

Summary for xwem--main--2.1--patch-33

From: Zajcev Evgeny <lg@xxxxxxxx>
Subject: Summary for xwem--main--2.1--patch-33
Date: Mon, 7 Mar 2005 02:15:00 +0300 (MSK)
Location: lg@xxxxxxxxxxxxxx http://arch.xwem.org/2005/

Revision: xwem--main--2.1--patch-33
Archive: lg@xxxxxxxxxxxxxx
Creator: Zajcev Evgeny <lg@xxxxxxxx>
Date: Mon Mar  7 02:14:54 MSK 2005
Standard-date: 2005-03-06 23:14:54 GMT
Modified-files: extra/xwem-keytt.el extra/xwem-mogu.el
    lisp/xwem-minibuffer.el lisp/xwem-netwm.el
    utils/xwem-osd.el
New-patches: lg@xxxxxxxxxxxxxx/xwem--main--2.1--patch-33
Summary: Some minor fixes, advances in xwem-mogu
Keywords: keytt, modeline, fullscreen, mogu, osd

* utils/xwem-osd.el: [fix] Merged from steve

* lisp/xwem-netwm.el (xwem-fullscreen-apply-state): [change] Use real
  raise/lower, omiting stack ranking.

* extra/xwem-keytt.el (firefox): +/-/= and \\ commented out, because of
  problems.

* extra/xwem-mogu.el: Already usable.  No default bindings.

* added files

    {arch}/xwem/xwem--main/xwem--main--2.1/lg@xxxxxxxxxxxxxx/patch-log/patch-33

* modified files

--- orig/extra/xwem-keytt.el
+++ mod/extra/xwem-keytt.el
@@ -176,11 +176,11 @@
 (define-key xwem-keytt-firefox-keymap (kbd "C-g") (kbd "<self-insert> <esc>")) 
; cancel search
 (define-key xwem-keytt-firefox-keymap (kbd "C-x [") (kbd "<self-insert> 
M-<left>")) ; back
 (define-key xwem-keytt-firefox-keymap (kbd "C-x ]") (kbd "<self-insert> 
M-<right>")) ; forward
-(define-key xwem-keytt-firefox-keymap (kbd "+") (kbd "<self-insert> C-+")) ; 
zoom in
-(define-key xwem-keytt-firefox-keymap (kbd "-") (kbd "<self-insert> C--")) ; 
zoom out
-(define-key xwem-keytt-firefox-keymap (kbd "=") (kbd "<self-insert> C-0")) ; 
normal size
+;(define-key xwem-keytt-firefox-keymap (kbd "+") (kbd "<self-insert> C-+")) ; 
zoom in
+;(define-key xwem-keytt-firefox-keymap (kbd "-") (kbd "<self-insert> C--")) ; 
zoom out
+;(define-key xwem-keytt-firefox-keymap (kbd "=") (kbd "<self-insert> C-0")) ; 
normal size
 (define-key xwem-keytt-firefox-keymap (kbd "M-\\") (kbd "<self-insert> C-i")) 
; page info
-(define-key xwem-keytt-firefox-keymap (kbd "\\") (kbd "<self-insert> C-u")) ; 
page source
+;(define-key xwem-keytt-firefox-keymap (kbd "\\") (kbd "<self-insert> C-u")) ; 
page source
 (define-key xwem-keytt-firefox-keymap (kbd "C-x r m") (kbd "<self-insert> 
C-d")) ; Add bookmark
 
 


--- orig/extra/xwem-mogu.el
+++ mod/extra/xwem-mogu.el
@@ -84,16 +84,21 @@
   :type 'boolean
   :group 'xwem-mogu)
 
-(defcustom xwem-mogu-numbers 16
+(defcustom xwem-mogu-numbers 8
   "Maximum number of <number>s."
   :type 'number
   :group 'xwem-mogu)
 
-(defcustom xwem-mogu-characters 9
+(defcustom xwem-mogu-characters 6
   "Maximum number of <character>s."
   :type 'number
   :group 'xwem-mogu)
 
+(defcustom xwem-mogu-grid-width 1
+  "*Width of grid lines."
+  :type 'number
+  :group 'xwem-mogu)
+
 (defcustom xwem-mogu-grid-color "gray78"
   "Color for grid."
   :type 'color
@@ -109,13 +114,21 @@
   :type 'color
   :group 'xwem-mogu)
 
+(defcustom xwem-mogu-stack-rank
+  '(((eval t) . (30 . 30)))
+  "Stack ranks specification for xwem mogu."
+  :type '(cons (sexp :tag "Client MATCH-SPEC")
+               (cons (number :tag "Active")
+                     (number :tag "Inactive")))
+  :group 'xwem-mogu)
+
 (define-xwem-face xwem-mogu-face
   `(((grid) (:foreground ,xwem-mogu-grid-color))
     ((node) (:foreground ,xwem-mogu-node-color))
     ((mouse-node) (:foreground ,xwem-mogu-mouse-node-color)))
   "Face for use by xwem-mogu."
   :group 'xwem-mogu
-  :gorup 'xwem-faces)
+  :group 'xwem-faces)
 
 
 
@@ -137,40 +150,130 @@
   ;; TODO: write me
   )
 
+(defun xwem-mogu-query-mouse-node ()
+  "Return node that is most close to pointer location."
+  (let* ((qp (XQueryPointer (xwem-dpy) xwem-mogu-xwin))
+         (x (nth 5 qp))
+         (y (nth 6 qp))
+         (wid-step (+ (/ (X-Geom-width (xwem-rootgeom)) xwem-mogu-numbers)
+                      xwem-mogu-grid-width))
+         (hei-step (+ (/ (X-Geom-height (xwem-rootgeom)) xwem-mogu-characters)
+                      xwem-mogu-grid-width))
+         (rx (/ x wid-step))
+         (ry (/ y hei-step))
+         (wr (% x wid-step))
+         (hr (% y hei-step)))
+    (when (> wr (- wid-step wr))
+      (incf rx))
+    (when (> hr (- hei-step hr))
+      (incf ry))
+    ;(cons rx (int-to-char (+ ry (char-to-int ?a))))
+    (cons rx ry)))
+
 (defun xwem-mogu-create-grid ()
   "Create xwem-mogu grid."
   ;; TODO: write me
-  )
+  (unless xwem-mogu-xwin
+    (let* ((wid (X-Geom-width (xwem-rootgeom)))
+           (wid-step (/ wid xwem-mogu-numbers))
+           (hei (X-Geom-height (xwem-rootgeom)))
+           (hei-step (/ hei xwem-mogu-characters)))
+      (setq xwem-mogu-xwin
+            (XCreateWindow (xwem-dpy) (xwem-rootwin) 0 0
+                           wid hei 0
+                           nil nil nil
+                           (make-X-Attr :override-redirect t
+                                        :background-pixel
+                                        (XAllocColor (xwem-dpy) 
(XDefaultColormap (xwem-dpy))
+                                                     (xwem-make-color 
xwem-mogu-grid-color)))))
+      ;; XXX Setup stack rank
+      (xwem-misc-set-xwin-always-on-top xwem-mogu-xwin 100)
+
+      ;; Create mask pixmap
+      (setf (xwem-mogu-xmask xwem-mogu-xwin)
+            (XCreatePixmap (xwem-dpy) (make-X-Pixmap :dpy (xwem-dpy)
+                                                     :id (X-Dpy-get-id 
(xwem-dpy)))
+                           xwem-mogu-xwin 1 wid hei))
+
+      (XFillRectangle (xwem-dpy) (xwem-mogu-xmask xwem-mogu-xwin)
+                      xwem-misc-mask-fgc 0 0 wid hei)
+
+      (loop for xo from 0 to wid by (+ wid-step xwem-mogu-grid-width)
+        do (loop for yo from 0 to hei by (+ hei-step xwem-mogu-grid-width)
+             do (XFillRectangle (xwem-dpy) (xwem-mogu-xmask xwem-mogu-xwin)
+                                xwem-misc-mask-bgc
+                                (+ xo xwem-mogu-grid-width) (+ yo 
xwem-mogu-grid-width)
+                                wid-step hei-step)))
+
+      (X-XShapeMask (xwem-dpy) xwem-mogu-xwin
+                    X-XShape-Bounding X-XShapeSet 0 0
+                    (xwem-mogu-xmask xwem-mogu-xwin))
+
+      ;; Initialise mouse-node
+      (setf (xwem-mogu-mouse-node xwem-mogu-xwin)
+            (xwem-mogu-query-mouse-node))
+
+      ;; Show mouse grid
+      (XMapWindow (xwem-dpy) xwem-mogu-xwin)
+
+      xwem-mogu-xwin)))
 
 
 ;;; Commands:
 
-(defun xwem-mogu-goto (id)
+(defun xwem-mogu-goto (id-x id-y)
   "Move to node with ID."
-  )
+  (let* ((qp (XQueryPointer (xwem-dpy) xwem-mogu-xwin))
+         (x (nth 5 qp))
+         (y (nth 6 qp))
+         (wid-step (+ (/ (X-Geom-width (xwem-rootgeom)) xwem-mogu-numbers)
+                      xwem-mogu-grid-width))
+         (hei-step (+ (/ (X-Geom-height (xwem-rootgeom)) xwem-mogu-characters)
+                      xwem-mogu-grid-width))
+         wr hr)
+
+    (if (not xwem-mogu-keep-pointer-offset)
+        (setq wr 0 hr 0)
+
+      (setq wr (% x wid-step)
+            hr (% y hei-step))
+      (when (> wr (- wid-step wr))
+        (setq wr (- wr wid-step)))
+      (when (> hr (- hei-step hr))
+        (setq hr (- hr hei-step))))
+
+    ;; Save new mouse-node
+    (setf (xwem-mogu-mouse-node xwem-mogu-xwin)
+          (cons id-x id-y))
+
+    (XWarpPointer (xwem-dpy) (xwem-rootwin) xwem-mogu-xwin
+                  0 0 0 0
+                  (+ (* wid-step id-x) wr)
+                  (+ (* hei-step id-y) hr))))
 
 (defun xwem-mogu-move (direction arg)
   "Move in DIRECTION ARG times.
 DIRECTION is one of 'left, 'right, 'up or 'down.
 ARG is number."
-  (ecase direction
-    (left
-     (if (< arg 0)
-         (xwem-mogu-move 'right (- arg))
-       ))
-    (right
-     (if (< arg 0)
-         (xwem-mogu-move 'left (- arg))
-       ))
-    (up
-     (if (< arg 0)
-         (xwem-mogu-move 'down (- arg))
-       ))
-    (down
-     (if (< arg 0)
-         (xwem-mogu-move 'up (- arg))
-       ))
-  ))
+  (let ((m-n (xwem-mogu-mouse-node xwem-mogu-xwin)))
+    (ecase direction
+      (left
+       (if (< arg 0)
+           (xwem-mogu-move 'right (- arg))
+         (xwem-mogu-goto (decf (car m-n) arg) (cdr m-n))))
+      (right
+       (if (< arg 0)
+           (xwem-mogu-move 'left (- arg))
+         (xwem-mogu-goto (incf (car m-n) arg) (cdr m-n))))
+      (up
+       (if (< arg 0)
+           (xwem-mogu-move 'down (- arg))
+         (xwem-mogu-goto (car m-n) (decf (cdr m-n) arg))))
+      (down
+       (if (< arg 0)
+           (xwem-mogu-move 'up (- arg))
+         (xwem-mogu-goto (car m-n) (incf (cdr m-n) arg))))
+      )))
 
 (define-xwem-command xwem-mogu-right (arg)
   "Move forward ARG nodes."
@@ -192,6 +295,28 @@
   (xwem-interactive "p")
   (xwem-mogu-move 'down arg))
 
+(define-xwem-command xwem-mogu-hline-beginning ()
+  "Goto beginning of hline."
+  (xwem-interactive)
+  (xwem-mogu-goto 0 (cdr (xwem-mogu-mouse-node xwem-mogu-xwin))))
+
+(define-xwem-command xwem-mogu-hline-end ()
+  "Goto end of hline."
+  (xwem-interactive)
+  (xwem-mogu-goto xwem-mogu-numbers
+                  (cdr (xwem-mogu-mouse-node xwem-mogu-xwin))))
+
+(define-xwem-command xwem-mogu-vline-beginning ()
+  "Goto beginning of vline."
+  (xwem-interactive)
+  (xwem-mogu-goto (car (xwem-mogu-mouse-node xwem-mogu-xwin)) 0))
+
+(define-xwem-command xwem-mogu-vline-end ()
+  "Goto end of vline."
+  (xwem-interactive)
+  (xwem-mogu-goto (car (xwem-mogu-mouse-node xwem-mogu-xwin))
+                  xwem-mogu-characters))
+
 
 (provide 'xwem-mogu)
 


--- orig/lisp/xwem-minibuffer.el
+++ mod/lisp/xwem-minibuffer.el
@@ -725,8 +725,9 @@
 
 (define-xwem-deffered xwem-modeline-redraw (&optional cl)
   "Redraw xwem modeline."
-  (if (and (xwem-cl-alive-p cl) (xwem-cl-selected-p cl))
-      (xwem-modeline-redraw)
+  (if (xwem-cl-alive-p cl)
+      (when (xwem-cl-selected-p cl)
+        (xwem-modeline-redraw))
 
     (let* ((str (xwem-modeline-regenerate))
            (mw (frame-width (xwem-minib-frame xwem-minibuffer))))


--- orig/lisp/xwem-netwm.el
+++ mod/lisp/xwem-netwm.el
@@ -502,10 +502,10 @@
   (when (xwem-cl-p cl)
     (cond ((eq (xwem-cl-state cl) 'active)
            (XMapWindow (xwem-dpy) (xwem-cl-xwin cl))
-           (xwem-misc-raise-xwin (xwem-cl-xwin cl)))
+           (XRaiseWindow (xwem-dpy) (xwem-cl-xwin cl)))
         
           ((memq (xwem-cl-state cl) '(inactive iconified))
-           (xwem-misc-lower-xwin (xwem-cl-xwin cl))
+           (XLowerWindow (xwem-dpy) (xwem-cl-xwin cl))
            (XUnmapWindow (xwem-dpy) (xwem-cl-xwin cl))))))
          
 (defun xwem-activate-fullscreen (cl &optional type)


--- orig/utils/xwem-osd.el
+++ mod/utils/xwem-osd.el
@@ -87,14 +87,25 @@
 
 (require 'xwem-diagram)
 
+(defgroup xwem-osd nil
+  "Group to customize OSD."
+  :prefix "xwem-osd-"
+  :group 'xwem-misc)
+
 (defcustom xwem-osd-default-font "fixed"
-  "Default font for text drawed in osd.")
+  "Default font for text drawed in osd."
+  :type 'string
+  :group 'xwem-osd)
 
 (defcustom xwem-osd-default-color "black"
-  "Default color used to draw.")
-
-(defcustom xwem-osd-always-ontop t
-  "*Non-nil mean that OSD's winow will be always on top.")
+  "Default color used to draw."
+  :type 'color
+  :group 'xwem-osd)
+
+(defcustom xwem-osd-default-stack-rank 100
+  "Default rank."
+  :type 'number
+  :group 'xwem-osd)
 
 ;;; Internal variables
 
@@ -132,7 +143,6 @@
   `(xwem-osd-xdpy (xwem-osd-instance-osd osin)))
 
 (defstruct xwem-osd
-  always-ontop                          ; non-nil if OSD must be always on top
   state                                        ; 'destroyed, 'hided or 'shown
   x y width height
 
@@ -184,21 +194,6 @@
              (xwem-dispatch-command-xevent xev)))))
       )))
 
-(defun xwem-osd-root-event-handler (xdpy xwin xev)
-  "Root window event handler for OSD."
-  (X-Event-CASE xev
-    (:X-ConfigureNotify
-     (let ((osd (xwem-osd-get-osd (X-Event-xconfigure-above-sibling xev))))
-       (when (and (xwem-osd-p osd) (xwem-osd-always-ontop osd))
-        ;; OSD's window is above sibling for some other window, so it
-        ;; is (osd's window) obscured and we need to pop it back.
-         ;; 
-         ;; NOTE: what if two OSD with always-ontop property obscures
-         ;;       each other?
-        (xwem-osd-show osd)
-        )))
-    ))
-
 ;;; Instances operations
 (defun xwem-osd-instance-destroy (osin)
   "Destroy osd instance OSIN."
@@ -287,12 +282,16 @@
 ;;; OSD functions
 ;;;###autoload
 (defun xwem-osd-create (xdpy x y width height &optional x-parent properties)
-  "On X display XDPY create new xwem osd context with +X+Y/WIDTHxHEIGHT 
geometry on X-PARENT."
-  (let ((osd (make-xwem-osd :always-ontop xwem-osd-always-ontop
-                            :xdpy xdpy
+  "On X display XDPY create new xwem osd context with +X+Y/WIDTHxHEIGHT 
geometry on X-PARENT.
+PROPERTIES is a plist for osd.  Supported properties are:
+ 
+ 'keymap     - Keymap for OSD.
+ 'stack-rank - Rank of OSD in windows stack."
+  (let ((osd (make-xwem-osd :xdpy xdpy
                             :x x :y y :width width :height height
                             :plist properties))
-        (keymap (plist-get properties 'keymap)))
+        (keymap (plist-get properties 'keymap))
+        (stack-rank (plist-get properties 'stack-rank)))
     (setf (xwem-osd-xwin osd)
          (XCreateWindow xdpy (or x-parent (XDefaultRootWindow xdpy))
                         x y width height 0 nil nil nil
@@ -304,6 +303,10 @@
                                                                           
XM-ButtonPress
                                                                          
XM-ButtonRelease)
                                                               0)))))
+    ;; Apply STACK-RANK
+    (when stack-rank
+      (xwem-misc-set-xwin-always-on-top (xwem-osd-xwin osd) stack-rank))
+
     ;; Create gc
     (setf (xwem-osd-gc osd)
          (XCreateGC xdpy (xwem-osd-xwin osd)
@@ -315,9 +318,6 @@
     (X-Win-put-prop (xwem-osd-xwin osd) 'osd-ctx osd)
     (X-Win-EventHandler-add-new (xwem-osd-xwin osd) 'xwem-osd-event-handler)
 
-    (when xwem-osd-always-ontop
-      (X-Win-EventHandler-add-new (XDefaultRootWindow xdpy) 
'xwem-osd-root-event-handler))
-
     (xwem-osd-create-mask osd)
     osd))
 
@@ -326,8 +326,7 @@
   "Create docked osd instance.
 XDPY - Display.
 X, Y, WIDTH, HEIGHT - OSD Geometry."
-  (let* ((xwem-osd-always-ontop nil)    ; for sure
-         (osd (xwem-osd-create xdpy 0 0 width height nil properties)))
+  (let ((osd (xwem-osd-create xdpy 0 0 width height nil properties)))
     (xwem-osd-clear osd)
     (xwem-XTrayInit xdpy (xwem-osd-xwin osd))
     osd))
@@ -367,8 +366,7 @@
                                :foreground 1.0
                                :background 0.0
                                :font (X-Font-get xdpy xwem-osd-default-font))))
-    (xwem-osd-clear-mask osd)
-    ))
+    (xwem-osd-clear-mask osd)))
 
 (defun xwem-osd-set-height (osd new-height)
   "Set OSD's window height to NEW-HEIGHT."
@@ -448,10 +446,6 @@
   (X-Win-EventHandler-rem (xwem-osd-xwin osd) 'xwem-osd-event-handler)
   (X-Win-rem-prop (xwem-osd-xwin osd) 'osd-ctx)
   
-  ;; NOTE: Can't delete 'xwem-osd-root-event-handler because some other
-  ;;       OSD can be with always-ontop property.
-;  (X-Win-EventHandler-rem (XDefaultRootWindow (xwem-osd-xdpy osd)) 
'xwem-osd-root-event-handler)
-
   (unless already-destroyed
     (XDestroyWindow (xwem-osd-xdpy osd) (xwem-osd-xwin osd)))
   (XFreePixmap (xwem-osd-xdpy osd) (xwem-osd-xmask osd))




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