diff --git a/src/manager.scm b/src/manager.scm index f5790cc..56066f3 100644 --- a/src/manager.scm +++ b/src/manager.scm @@ -424,7 +424,12 @@ (window-exists? dpy (client:window client)) (not (eq? client (wm-current-client wm))) (not (window-contains-focus? dpy (client:window client)))) - (wm-select-client wm client (crossing-event-time xevent)))) + (if (ignore-next-enter-notify?) + (begin + (accept-next-enter-notify!) + (if (not (wm-current-client wm)) + (wm-select-client wm client (crossing-event-time xevent)))) + (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)) @@ -503,6 +508,19 @@ (get-transient-for (wm:dpy wm) (client:window c))))) (wm:clients wm))) +;; ignoring the next enter-notify +(define (ignore-next-enter-notify!) + (set! *ignore-next-enter-notify* #t)) + +(define (ignore-next-enter-notify?) + *ignore-next-enter-notify*) + +(define *ignore-next-enter-notify* #f) + +(define (accept-next-enter-notify!) + (set! *ignore-next-enter-notify* #f)) + + ;; *** client names ************************************************** (define *client-names* '()) ;; (window oname name) diff --git a/src/packages.scm b/src/packages.scm index 5b85cc8..c92830d 100644 --- a/src/packages.scm +++ b/src/packages.scm @@ -97,10 +97,11 @@ (manager-type :syntax) manager-types manager-type-name create-wm destroy-wm wm-clients wm-current-client - wm-manage-window wm-unmanage-window wm-select-client wm-configure-window wm-iconify-window wm-maximize-window + ignore-next-enter-notify! + client? client:window client:client-window client:data set-client:data! client-name find-window-by-name get-all-window-names diff --git a/src/root-manager.scm b/src/root-manager.scm index b317404..b0886aa 100644 --- a/src/root-manager.scm +++ b/src/root-manager.scm @@ -119,8 +119,10 @@ (let ((i (car msg)) (cs (wm-clients wm))) (if (< i (length cs)) - (wm-select-client wm (list-ref cs i) - (second msg))))) + (begin + (ignore-next-enter-notify!) + (wm-select-client wm (list-ref cs i) + (second msg)))))) (loop))))) wm))