I want to prevent the "first" click on a frame in an inactive X window from having any effect, other than to make the frame active. Specifically, I don't want it to reposition point.
The problem is that I can't seem to detect that he frame was inactive when I get the mouse click. So the following code always shows "y"
:
;; detect if frame is active when clicking
(defun my/mouse-drag-region (event)
(interactive "e")
(mouse-minibuffer-check event)
(let* ((window (caadr event))
(frame (window-frame window)))
(if (eql frame (selected-frame))
(print "y")
(print "n"))))
(global-set-key [down-mouse-1] 'my/mouse-drag-region)
How do I detect that the frame was previously inactive?
Or, has someone already achieved what I am trying to do elsewhere?
Note: I am asking for something different than this other question, which is about inactive windows, not inactive frames.
mouse-set-point
and create your own function to do whatever you want. Do theC-h k
mouse click thing and see the two (2) functions that are listed there.