implemented focus-policy click (click-to-focus)

This commit is contained in:
frese 2003-05-07 16:37:51 +00:00
parent 6aeb922953
commit fd4522df8e
1 changed files with 15 additions and 3 deletions

View File

@ -315,6 +315,11 @@
(client (make-client window client-window in-channel #f #f))) (client (make-client window client-window in-channel #f #f)))
(define-cursor dpy client-window (define-cursor dpy client-window
(get-option-value (wm:options wm) 'client-cursor)) (get-option-value (wm:options wm) 'client-cursor))
(if (memq 'click (get-option-value (wm:options wm) 'focus-policy))
;; Note: won't work recursively (manager in manager)
(grab-button dpy (button button1) (state-set) client-window
#t (event-mask button-press button-release)
(grab-mode sync) (grab-mode async) none none))
(reparent-window dpy window client-window 0 0) (reparent-window dpy window client-window 0 0)
(create-client-handler wm client) (create-client-handler wm client)
client)) client))
@ -420,9 +425,16 @@
(not (window-contains-focus? dpy (client:window client)))) (not (window-contains-focus? dpy (client:window client))))
(wm-select-client wm client (crossing-event-time xevent)))) (wm-select-client wm client (crossing-event-time xevent))))
;; ((eq? (event-type button-press) type) ((eq? (event-type button-press) type)
;; (if (memq 'click (get-option-value (wm:options wm) 'focus-policy)) (if (memq 'click (get-option-value (wm:options wm) 'focus-policy))
;; (wm-select-client wm client (button-event-time xevent)))) (begin
(wm-select-client wm client (button-event-time xevent))
(if (not (eq? (button-event-subwindow xevent)
(client:client-window client)))
(allow-events dpy (event-mode replay-pointer)
(button-event-time xevent))
(allow-events dpy (event-mode async-pointer)
(button-event-time xevent))))))
((destroy-window-event? xevent) ((destroy-window-event? xevent)
(exit 'destroy))))) (exit 'destroy)))))