]> git.eshelyaron.com Git - emacs.git/commitdiff
Add ns-click-through option to control activation click handling
authorDaniel Colascione <dancol@dancol.org>
Tue, 4 Mar 2025 16:14:43 +0000 (08:14 -0800)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Mar 2025 07:03:10 +0000 (08:03 +0100)
* 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.

(cherry picked from commit 3a8ce5ac9c4652eb87bf0bce835d82083061a28b)

lisp/cus-start.el
src/nsterm.m

index 133f44c9fad8038b5d6bb03edd7ba5bb76d983ef..16e4f7e65b3ed86dc9cc5ef873b0ede9a204dbee 100644 (file)
@@ -577,6 +577,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")
index e7108c817c805c642720a52d4893cc51455c79ca..fcd9377646f5d6cfb9a25caef519183172055470 100644 (file)
@@ -6891,7 +6891,7 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action)
 {
   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 @@ This variable is ignored on macOS < 10.7 and GNUstep.  Default is t.  */);
      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,