home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.freefriends.org
/
ftp.freefriends.org.tar
/
ftp.freefriends.org
/
arnold
/
Source
/
gwm-dist.tar.gz
/
gwm-dist.tar
/
home-gwm
/
jerq-menus.gwm
< prev
next >
Wrap
Text File
|
1993-07-07
|
8KB
|
278 lines
; JERQ MENUS
; ==========
;;File: jerq-menus.gwm -- default root/window/icon menus
;;Author: colas@mirsa.inria.fr (Colas NAHABOO) -- Bull Research FRANCE
;;Revision: 1.4 -- July 20 1989
;;State: Exp
;;GWM Version: 1.4
; create menus with lists of xterms and xloads
; ============================================
(defname-in-screen-to () xterm-pop xload-pop)
(defaults-to
xterm-list ()
xterm-rsh-list ()
xterm-telnet-list ())
(de host-part (item)
(if (eq (type item) 'list)
(# 0 item)
item))
(de extra-part (item)
(if (eq (type item) 'list)
(+ " -l " (# 1 item))
""))
(for screen (list-of-screens)
(with (fsm pop-fsm menu ())
(if (not (boundp 'root-pop))
(: root-pop
(menu-make
(item-make "New" (jerq-menus.new-xterm))
(item-make "Reshape" (jerq-menus.pick do-resize))
(item-make "Tromp" (jerq-menus.pick do-iconify))
(item-make "Move" (jerq-menus.pick do-move))
(item-make "Top" (jerq-menus.pick raise-window))
(item-make "Bottom" (jerq-menus.pick lower-window))
(item-make "Current" (jerq-menus.pick do-current))
(item-make "Push" (jerq-menus.pick do-push))
(item-make "Delete" (jerq-menus.pick do-kill-window)))))
(: window-pop root-pop) ; We ARE the Phone Company!
(if (not (boundp 'alt-root-pop)) (progn
(: alt-root-items (list
'(item-make "Refresh" (refresh))
'(item-make "Restart" (restart))
'(item-make "Reload" (load ".gwmrc"))
'(item-make "Tromp All" (tromp-all))
'(item-make "Untromp All" (untromp-all))
'(item-make "Window Info" (jerq-menus.pick window-info))
'(item-make
"Wool infos" (progn
(hashinfo)(gcinfo)
(wlcfinfo)(meminfo)))
'(item-make "Exec cut"
(execute-string (+ "(? " cut-buffer ")")))
'(item-make "End" (end))))
(if want-kill-session
(insert-at '(item-make "Kill session"
(progn
(! "kill" "-9" (getenv "session_pid"))
(for w (list-of-windows)
(move-window w 4000 4000))
(end)))
alt-root-items
(length alt-root-items)))
(: alt-root-pop (eval (+ '(menu-make) alt-root-items)))))
(if (not (boundp 'icon-pop)) (: icon-pop window-pop))
(: xterm-pop (eval (+
'(menu-make
(item-make "." (! "/bin/sh" "-c" (+ "exec xterm -display " x-screen-name " -ut -n `hostname`"))))
(mapfor host xterm-list
(list 'item-make (no-domains host) (list 'rxterm host)))
(mapfor host xterm-rsh-list
(list 'item-make (no-domains (host-part host)) (list 'rsh host)))
(mapfor host xterm-telnet-list
(list 'item-make (no-domains (host-part host)) (list 'telnet host))))))))
(df rxterm (host)
(! "/bin/sh" "-c" (+ "DISPLAY=" x-screen-name
" rxterm " host "</dev/null")))
(df rsh (item)
(! "/bin/sh" "-c" (+ "DISPLAY=" x-screen-name
" exec xterm -ut -n " (no-domains (host-part item))
" -e rsh " (host-part item) (extra-part item))))
(df telnet (host)
(! "/bin/sh" "-c" (+ "DISPLAY=" x-screen-name
" exec xterm -ut -n " (no-domains host)
" -e telnet " host)))
(de pop-root-menu ()
(set-colormap-focus ()) ; bugged on dpx???
(pop-menu root-pop 2))
(: target (cursor-make "target"))
(: sweep (cursor-make "sweep"))
(: push (cursor-make "push"))
(: freeze-server 0)
; debugging - I only want an active pointer grab here anyway, not
; a server grab.
(de do-move nil
(with (cursor sweep)
(warp-pointer 0 0 window)
(move-window)
(unpop-menu jerq-menus.target)
(raise-window)
(warp-pointer
(/ window-width 2)
(/ window-height 2)
window)))
(de do-push nil
(with (cursor push)
(move-window)
(unpop-menu jerq-menus.target)
(raise-window)))
(de do-resize nil
(with (cursor blit-arrow)
(resize-window)
(unpop-menu jerq-menus.target)
(raise-window)))
(de do-current nil
; (unpop-menu jerq-menus.target)
(current))
(de do-kill-window nil
(if (not (delete-window))
(kill-window)))
(de do-iconify nil
(iconify-window)
(if (= window-status 'window)
(progn (raise-window))))
(de tromp-all nil
(for window (list-of-windows)
(if (and (= window-status 'window)
(not (# 'no-tromp-all window-property)))
(iconify-window))))
(de untromp-all nil
(for window (list-of-windows)
(if (and (= window-status 'icon)
(not window-starts-iconic))
(iconify-window))))
(: jerq-menus.fsm1
(fsm-make
(state-make
; (on (buttonpress 1 any) (jerq-menus.abort))
; (on (buttonpress 2 any) (jerq-menus.abort))
(on (buttonpress 3 any) (jerq-menus.prime))
(on (buttonrelease any any) (unpop-menu))
(on (user-event 'kludge) (jerq-menus.hit)))
))
(: jerq-menus.fsm2
(fsm-make
(: start (state-make
(on (buttonpress 1 any) (jerq-menus.abort))
(on (buttonpress 2 any) (jerq-menus.abort))
(on (buttonpress 3 any) (jerq-menus.start) finish)))
(: finish (state-make
(on (buttonrelease 3 any) (jerq-menus.end) start)))
))
(: jerq-menus.target (with (fsm jerq-menus.fsm1 cursor target)
(menu-make (with (fsm nil) (bar-make ())))))
(: jerq-menus.sweep (with (fsm jerq-menus.fsm2 cursor sweep)
(menu-make (with (fsm nil) (bar-make ())))))
(move-window (menu-wob jerq-menus.target) -10 -10)
(move-window (menu-wob jerq-menus.sweep) -10 -10)
(df jerq-menus.pick (act)
(: jerq-menus.action (list act))
(primitive-pop-menu jerq-menus.target 'here))
(de jerq-menus.reshape nil
(primitive-pop-menu jerq-menus.sweep 'here))
(de jerq-menus.abort nil
(unpop-menu))
(df jerq-menus.prime nil
(: jerq-menus.wob (wob-at-coords (current-event-x) (current-event-y)))
(send-user-event 'kludge (menu-wob jerq-menus.target)))
(de jerq-menus.hit nil
(unpop-menu) ; Want to remove, but xterm can't take it...
(with (_w jerq-menus.wob)
(if (and _w (not (= _w root-window)))
(with (window _w) (eval jerq-menus.action)))))
(de jerq-menus.start nil
(: jerq-menus.x (current-event-x))
(: jerq-menus.y (current-event-y))
)
(de jerq-menus.end nil
(unpop-menu)
(move-window 4000 4000)
(resize-window (- (current-event-x) jerq-menus.x)
(- (current-event-y) jerq-menus.y))
(move-window jerq-menus.x jerq-menus.y)
)
(de jtest nil
(jerq-menus.pick jerq-menus.reshape))
(de jerq-menus.new-xterm nil
(if (boundp 'primitive-pop-menu)
(primitive-pop-menu xterm-pop)
(pop-menu xterm-pop)))
;; icon-group-pop: give the user a menu with which to select which member of
;; the icon group to de-iconify. If there's no icon-group, or it has only
;; one member, then we just de-iconify.
;; Note: icon-groups MUST be loaded!
(defun icon-group-pop (w)
(with (window w items () icon-pop ())
(if window-group
(progn
(for window window-group
(if (or (= 'icon window-status) (not window-is-mapped))
(: items (+ items (list
(list
'item-make
(if (= "icon" window-icon-name)
(window-name)
(window-icon-name))
(list 'deiconify-this-window window)))))))
(if (> (length items) 1)
(progn
(: icon-pop (menu-make-from-list (+ (list
(list
'item-make
"all"
(list 'deiconify-all window))) items)))
(menu-default-action icon-pop
(list 'deiconify-all window))
(pop-menu icon-pop))
; Else only one icon in group (rest are mapped)
(deiconify-all window)))
; Else no window group
(do-iconify))
))
(defun deiconify-this-window (w)
(with (window w)
(map-window)
(currtop nil)))
(defun deiconify-all (w)
(with (window w)
(for window (+ (sublist 1 (length window-group) window-group)
(list (# 0 window-group)))
(if (or (= 'icon window-status) (not window-is-mapped))
(progn
(map-window)
(currtop nil))))
(with (window (# 0 window-group))
(unmap-window window-icon))))