all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 69525@debbugs.gnu.org, alan@idiocy.org
Subject: bug#69525: 30.0.50; MacOS: New warnings on stderr
Date: Tue, 30 Jul 2024 08:00:35 +0200	[thread overview]
Message-ID: <m2ikwnctbw.fsf@pro2.fritz.box> (raw)
In-Reply-To: <86a5i32vea.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 27 Jul 2024 09:37:01 +0300")

[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann@gmail.com>
>> Cc: 69525@debbugs.gnu.org,  Eli Zaretskii <eliz@gnu.org>
>> Date: Sat, 27 Jul 2024 05:56:30 +0200
>> 
>> Alan Third <alan@idiocy.org> writes:
>> 
>> > I would agree that Apple's documentation is abysmal. AFAICT most new
>> > features are exclusively documented in WWDC talks, so if you're not
>> > immersed in the Apple eco-system it can be very hard to keep track of
>> > what's changed. I assume that's some sort of marketing ploy.
>> 
>> Yeah, could be. Although I wonder what advantage they expect from making
>> such stuff effectively a secret :-/.
>
> Companies that develop proprietary software for macOS can probably
> fund courses for their employees, or buy auxiliary documentation that
> is not available for free, or ask Apple questions and get answers,
> something that could be available only for those who have contracts
> with Apple.

Yeah, maybe :-/.

Meanwhile, I think I pulled this off anyway by studying and mimicking
what others did. At least it works for me on macOS 14.5 just like the
old code did, at least for entering accented characters, which is the
only thing I know how to use.

I'll push that to master, if nobody objects.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: NSTextInputClient --]
[-- Type: text/x-patch, Size: 2683 bytes --]

From 65d5ace8e85111ecbd5035541ab24fdcfc065c7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gerd=20M=C3=B6llmann?= <gerd@gnu.org>
Date: Tue, 30 Jul 2024 07:47:44 +0200
Subject: [PATCH] NS: Let EmacsView implement NSTextInputClient

* src/nsterm.h (@interface EmacsView): Implement NSTextInputClient protocol.
* src/nsterm.m: Implement required NSTextInputClient methods, forwarding
to existing NSTextInput methods.
---
 src/nsterm.h |  4 ++--
 src/nsterm.m | 37 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/src/nsterm.h b/src/nsterm.h
index 5d4810cba4a..f3dcb07a0f1 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -463,9 +463,9 @@ #define NSTRACE_UNSILENCE()
 @class EmacsLayer;
 
 #ifdef NS_IMPL_COCOA
-@interface EmacsView : NSView <NSTextInput, NSWindowDelegate>
+@interface EmacsView : NSView <NSTextInput, NSTextInputClient, NSWindowDelegate>
 #else
-@interface EmacsView : NSView <NSTextInput>
+@interface EmacsView : NSView <NSTextInput, NSTextInputClient>
 #endif
 {
 #ifdef NS_IMPL_COCOA
diff --git a/src/nsterm.m b/src/nsterm.m
index cd6ffabddde..c659ef40c73 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7049,9 +7049,44 @@ In that case we use UCKeyTranslate (ns_get_shifted_character)
   [nsEvArray removeObject: theEvent];
 }
 
+/***********************************************************************
+			   NSTextInputClient
+ ***********************************************************************/
 
-/* <NSTextInput> implementation (called through [super interpretKeyEvents:]).  */
+- (void) insertText: (id) string
+   replacementRange: (NSRange) replacementRange
+{
+  if ([string isKindOfClass:[NSAttributedString class]])
+    string = [string string];
+  [self unmarkText];
+  [self insertText:string];
+}
+
+- (void) setMarkedText: (id) string
+	 selectedRange: (NSRange) selectedRange
+      replacementRange: (NSRange) replacementRange
+{
+  [self setMarkedText: string selectedRange: selectedRange];
+}
+
+- (nullable NSAttributedString *)
+  attributedSubstringForProposedRange: (NSRange) range
+			  actualRange: (nullable NSRangePointer) actualRange
+{
+  return nil;
+}
 
+- (NSRect) firstRectForCharacterRange: (NSRange) range
+			  actualRange: (nullable NSRangePointer) actualRange
+{
+  return NSZeroRect;
+}
+
+/***********************************************************************
+			      NSTextInput
+ ***********************************************************************/
+
+/* <NSTextInput> implementation (called through [super interpretKeyEvents:]).  */
 
 /* <NSTextInput>: called when done composing;
    NOTE: also called when we delete over working text, followed
-- 
2.45.2


  reply	other threads:[~2024-07-30  6:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-03 16:18 bug#69525: 30.0.50; MacOS: New warnings on stderr Gerd Möllmann
2024-03-03 16:26 ` Eli Zaretskii
2024-03-03 17:33   ` Gerd Möllmann
2024-03-03 17:36     ` Gerd Möllmann
2024-03-03 18:06       ` Alan Third
2024-03-03 19:29         ` Gerd Möllmann
2024-03-04  9:12           ` Gerd Möllmann
2024-03-04 13:48         ` Gerd Möllmann
2024-03-04 14:43           ` Gerd Möllmann
2024-03-04 21:40           ` Alan Third
2024-03-05  4:38             ` Gerd Möllmann
2024-03-05 12:59               ` Alan Third
2024-03-05 14:31                 ` Gerd Möllmann
2024-03-05  5:31         ` Gerd Möllmann
2024-07-26 10:33           ` Gerd Möllmann
2024-07-26 10:55             ` Eli Zaretskii
2024-07-26 11:02               ` Gerd Möllmann
2024-07-26 19:09             ` Alan Third
2024-07-26 19:24               ` Gerd Möllmann
2024-07-26 19:36                 ` Alan Third
2024-07-27  3:56                   ` Gerd Möllmann
2024-07-27  6:37                     ` Eli Zaretskii
2024-07-30  6:00                       ` Gerd Möllmann [this message]
2024-07-31  3:22                         ` Gerd Möllmann
2024-07-31 13:51                           ` Eli Zaretskii
2024-07-26  9:56 ` Gerd Möllmann
2024-07-26 18:38   ` Alan Third
2024-07-26 19:02     ` Gerd Möllmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ikwnctbw.fsf@pro2.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=69525@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.