From fd4522df8ec50690ba09bba946ba0889f3f1f51a Mon Sep 17 00:00:00 2001 From: frese Date: Wed, 7 May 2003 16:37:51 +0000 Subject: [PATCH] implemented focus-policy click (click-to-focus) --- src/manager.scm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/manager.scm b/src/manager.scm index 57079a4..5d6d68e 100644 --- a/src/manager.scm +++ b/src/manager.scm @@ -315,6 +315,11 @@ (client (make-client window client-window in-channel #f #f))) (define-cursor dpy client-window (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) (create-client-handler wm client) client)) @@ -420,9 +425,16 @@ (not (window-contains-focus? dpy (client:window client)))) (wm-select-client wm client (crossing-event-time xevent)))) -;; ((eq? (event-type button-press) type) -;; (if (memq 'click (get-option-value (wm:options wm) 'focus-policy)) -;; (wm-select-client wm client (button-event-time xevent)))) + ((eq? (event-type button-press) type) + (if (memq 'click (get-option-value (wm:options wm) 'focus-policy)) + (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) (exit 'destroy)))))