- changed the action for the kill-button, to manually kill zombie

clients.
- added tracking of the last two focused clients, to refocus the
  last one if a client has been killed.
This commit is contained in:
frese 2003-10-23 14:41:37 +00:00
parent 328ddca7b0
commit 43866aff9e
2 changed files with 30 additions and 6 deletions

View File

@ -99,6 +99,7 @@
wm-clients wm-current-client
wm-manage-window wm-unmanage-window wm-select-client
wm-configure-window wm-iconify-window wm-maximize-window
wm-deinit-client
ignore-next-enter-notify!

View File

@ -19,10 +19,21 @@
wm)))
(define-record-type switch-wm-data :switch-wm-data
(make-switch-wm-data titlebars empty-titlebar)
(make-switch-wm-data titlebars empty-titlebar last-focused)
switch-wm-data?
(titlebars data:titlebars set-data:titlebars!)
(empty-titlebar data:empty-titlebar))
(empty-titlebar data:empty-titlebar)
(last-focused data:last-focused set-data:last-focused!))
;; only for switch-wm's, but maybe we will need that for all...
(define (last-focused-client wm data)
(let ((c (cdr (data:last-focused data))))
(and (memq c (wm-clients wm)) c)))
(define (add-last-focused-client! wm data client)
(let ((p (data:last-focused data)))
(set-cdr! p (car p))
(set-car! p client)))
(define (init-switch-wm wm channel)
(let* ((dpy (wm:dpy wm))
@ -30,7 +41,7 @@
(options (wm:options wm))
(gc (create-gc dpy window '()))
(empty-titlebar (create-empty-titlebar wm))
(data (make-switch-wm-data '() empty-titlebar)))
(data (make-switch-wm-data '() empty-titlebar (cons #f #f))))
(update-titlebars wm data)
(grab-shortcut dpy window
@ -131,7 +142,8 @@
(if (window-viewable? dpy window)
'active
'normal))))
(set-titlebar-state! titlebar state)))))
(set-titlebar-state! titlebar state)))
(if focused? (add-last-focused-client! wm data client))))
((update-client-name)
(let ((client (second msg))
@ -223,7 +235,16 @@
(wm-select-client wm client (fourth msg)))
;; from titlebar-buttons
((kill)
(delete-window dpy (client:window client) (second msg)))
(let ((time (second msg)))
;; sometimes zombie-client-windows still hang
;; around. this is just a hack to let the user close
;; those manually:
(if (or (not (window-exists? dpy (client:window client)))
(not (eq? (window-parent dpy (client:window client))
(client:client-window client))))
(spawn (lambda ()
(wm-deinit-client wm client)))
(delete-window dpy (client:window client) time))))
(else (warn "unhandled client message " wm client msg))))
(loop))))
@ -276,7 +297,9 @@
(if (null? (wm-clients wm))
(set-input-focus dpy (wm:window wm) (revert-to parent)
current-time)
(wm-select-client wm (car (wm-clients wm)) current-time)))))
(let ((next-client (or (last-focused-client wm data)
(car (wm-clients wm)))))
(wm-select-client wm next-client current-time))))))
;; ***