[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm aa92c7b 1/2: Avoid workspace switch loop with `mou
From: |
Chris Feng |
Subject: |
[elpa] externals/exwm aa92c7b 1/2: Avoid workspace switch loop with `mouse-autoselect-window' enabled |
Date: |
Sun, 16 Jun 2019 09:37:59 -0400 (EDT) |
branch: externals/exwm
commit aa92c7be8cb92ae74617b8d3d431431d2aa7edac
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>
Avoid workspace switch loop with `mouse-autoselect-window' enabled
* exwm-input.el (exwm-input--last-enter-notify-position): New variable
storing last mouse position.
(exwm-input--on-EnterNotify): Avoid switching workspace when mouse
position is not changed (the event is a result of a workspace switch).
---
exwm-input.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/exwm-input.el b/exwm-input.el
index eeea36e..22c8002 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -219,6 +219,8 @@ ARGS are additional arguments to CALLBACK."
(cdr exwm-input--timestamp-callback))
(setq exwm-input--timestamp-callback nil)))))
+(defvar exwm-input--last-enter-notify-position nil)
+
(defun exwm-input--on-EnterNotify (data _synthetic)
"Handle EnterNotify events."
(let ((evt (make-instance 'xcb:EnterNotify))
@@ -228,7 +230,9 @@ ARGS are additional arguments to CALLBACK."
(setq buffer (exwm--id->buffer event)
window (get-buffer-window buffer t))
(exwm--log "buffer=%s; window=%s" buffer window)
- (when (and buffer window (not (eq window (selected-window))))
+ (when (and buffer window (not (eq window (selected-window)))
+ (not (equal exwm-input--last-enter-notify-position
+ (vector root-x root-y))))
(setq frame (window-frame window)
frame-xid (frame-parameter frame 'exwm-id))
(unless (eq frame exwm-workspace--current)
@@ -260,7 +264,8 @@ ARGS are additional arguments to CALLBACK."
:destination frame-xid
:event-mask xcb:EventMask:NoEvent
:event (xcb:marshal fake-evt exwm--connection)))
- (xcb:flush exwm--connection)))))
+ (xcb:flush exwm--connection))
+ (setq exwm-input--last-enter-notify-position (vector root-x root-y)))))
(defun exwm-input--on-keysyms-update ()
(exwm--log)