Add ns-click-through option to control activation click handling

* src/nsterm.m (acceptsFirstMouse):
Use ns_click_through variable instead of always returning YES.
(syms_of_nsterm): Define ns-click-through variable.

* lisp/cus-start.el: Add customization definition for ns-click-through.

* etc/NEWS: Document the new option.
This commit is contained in:
Daniel Colascione 2025-03-04 08:14:43 -08:00
parent a382bfdfa4
commit 3a8ce5ac9c
3 changed files with 35 additions and 1 deletions

View file

@ -29,6 +29,19 @@ applies, and please also update docstrings as needed.
The traditional unexec dumper, deprecated since Emacs 27, has been
removed.
* MacOS/NS Changes in Emacs 31.1
---
** New user option 'ns-click-through' controls whether activation clicks
are passed through to Emacs commands.
When nil, clicking on an inactive Emacs frame will only activate it.
When t (the default), the click will both activate the frame and be interpreted
as a command.
+++
** On Cocoa builds, stipples now render with color. (Bug#73384)
** Changed GCC default options on 32-bit x86 systems.
When using GCC 4 or later to build Emacs on 32-bit x86 systems,
'configure' now defaults to using the GCC options '-mfpmath=sse' (if the

View file

@ -582,6 +582,12 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
(ns-use-fullscreen-animation ns boolean "25.1")
(ns-use-srgb-colorspace ns boolean "24.4")
(ns-scroll-event-delta-factor ns float "29.1")
(ns-click-through
ns (choice (const :tag "Never (nil)" :value nil)
(const :tag "Always (t)" :value t))
"31.1")
;; process.c
(delete-exited-processes processes-basics boolean)
(process-error-pause-time processes-basics integer "29.1")

View file

@ -6891,7 +6891,7 @@ - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
{
NSTRACE_MSG ("First mouse event: type=%ld, clickCount=%ld",
[theEvent type], [theEvent clickCount]);
return YES;
return ns_click_through;
}
- (void)resetCursorRects
{
@ -11300,6 +11300,21 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
doc: /* SKIP: real doc in xterm.c. */);
x_underline_at_descent_line = 0;
// TODO: add an "auto" mode that passes clicks through to "utility" UI
// elements, selectis windows, and so on, but doesn't pass them
// through for commands in general --- consistent with
// other applications.
DEFVAR_BOOL ("ns-click-through",
ns_click_through,
doc: /* Whether to pass activation clicks through to Emacs.
When nil, if Emacs is not focused, the click that focuses Emacs will not
be interpreted as a common. If t, it will be. For example, when nil,
if Emacs is inactive, two clicks are needed to move point: the first to
activate Emacs and the second to activate the mouse-1 binding. When t,
only a single click is needed. */);
ns_click_through = YES;
DEFSYM (Qx_underline_at_descent_line, "x-underline-at-descent-line");
DEFVAR_LISP ("ns-scroll-event-delta-factor", Vns_scroll_event_delta_factor,