diff options
| author | Po Lu | 2024-08-01 08:25:31 +0800 |
|---|---|---|
| committer | Po Lu | 2024-08-01 08:25:31 +0800 |
| commit | 96097d362322595e308157ff70f191ef2b49640d (patch) | |
| tree | 095ad24c7f807cc69350b5336172c493f2621e52 /src | |
| parent | d00eb0468b147f2bfcb58bc586801f0495f5973d (diff) | |
| parent | 1154d8aafe2f4702b8fc775835f830fd00cfbaaf (diff) | |
| download | emacs-96097d362322595e308157ff70f191ef2b49640d.tar.gz emacs-96097d362322595e308157ff70f191ef2b49640d.zip | |
Merge from savannah/emacs-30
1154d8aafe2 Better resolve bug#72188
ceb5a152227 MacOS: Let EmacsView implement NSTextInputClient
9f7c1ace9f8 NS: Set frame position when entering/exiting fullscreen (...
74fe889a93f Merge branch 'emacs-30' of git.savannah.gnu.org:/srv/git/...
abefd9514bc * lisp/tab-bar.el (tab-bar-move-tab-to-group): Fix for a ...
e09982f8f5a Merge branch 'emacs-30' of git.savannah.gnu.org:/srv/git/...
5cf64d8377a Fix sporadic crashes and `select' failures in dumped images
a475360af98 Correct display of Doc View documents after tab switching
b0d927e1dce Merge branch 'emacs-30' of git.savannah.gnu.org:/srv/git/...
469bc7c9686 Use 'kill-process' as a fallback when a pipe gets broken ...
158835668df ; * doc/lispref/modes.texi (Mode Line Data): Fix formatting.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsterm.h | 3 | ||||
| -rw-r--r-- | src/nsterm.m | 58 |
2 files changed, 59 insertions, 2 deletions
diff --git a/src/nsterm.h b/src/nsterm.h index 3a713f8e8c9..a07829a36ec 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -463,7 +463,7 @@ enum ns_return_frame_mode | |||
| 463 | @class EmacsLayer; | 463 | @class EmacsLayer; |
| 464 | 464 | ||
| 465 | #ifdef NS_IMPL_COCOA | 465 | #ifdef NS_IMPL_COCOA |
| 466 | @interface EmacsView : NSView <NSTextInput, NSWindowDelegate> | 466 | @interface EmacsView : NSView <NSTextInput, NSTextInputClient, NSWindowDelegate> |
| 467 | #else | 467 | #else |
| 468 | @interface EmacsView : NSView <NSTextInput> | 468 | @interface EmacsView : NSView <NSTextInput> |
| 469 | #endif | 469 | #endif |
| @@ -522,6 +522,7 @@ enum ns_return_frame_mode | |||
| 522 | - (void)copyRect:(NSRect)srcRect to:(NSPoint)dest; | 522 | - (void)copyRect:(NSRect)srcRect to:(NSPoint)dest; |
| 523 | 523 | ||
| 524 | /* Non-notification versions of NSView methods. Used for direct calls. */ | 524 | /* Non-notification versions of NSView methods. Used for direct calls. */ |
| 525 | - (void)adjustEmacsFrameRect; | ||
| 525 | - (void)windowWillEnterFullScreen; | 526 | - (void)windowWillEnterFullScreen; |
| 526 | - (void)windowDidEnterFullScreen; | 527 | - (void)windowDidEnterFullScreen; |
| 527 | - (void)windowWillExitFullScreen; | 528 | - (void)windowWillExitFullScreen; |
diff --git a/src/nsterm.m b/src/nsterm.m index d25f216edd4..b56c587bc69 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -7032,9 +7032,48 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action) | |||
| 7032 | [nsEvArray removeObject: theEvent]; | 7032 | [nsEvArray removeObject: theEvent]; |
| 7033 | } | 7033 | } |
| 7034 | 7034 | ||
| 7035 | /*********************************************************************** | ||
| 7036 | NSTextInputClient | ||
| 7037 | ***********************************************************************/ | ||
| 7035 | 7038 | ||
| 7036 | /* <NSTextInput> implementation (called through [super interpretKeyEvents:]). */ | 7039 | #ifdef NS_IMPL_COCOA |
| 7040 | |||
| 7041 | - (void) insertText: (id) string | ||
| 7042 | replacementRange: (NSRange) replacementRange | ||
| 7043 | { | ||
| 7044 | if ([string isKindOfClass:[NSAttributedString class]]) | ||
| 7045 | string = [string string]; | ||
| 7046 | [self unmarkText]; | ||
| 7047 | [self insertText:string]; | ||
| 7048 | } | ||
| 7049 | |||
| 7050 | - (void) setMarkedText: (id) string | ||
| 7051 | selectedRange: (NSRange) selectedRange | ||
| 7052 | replacementRange: (NSRange) replacementRange | ||
| 7053 | { | ||
| 7054 | [self setMarkedText: string selectedRange: selectedRange]; | ||
| 7055 | } | ||
| 7037 | 7056 | ||
| 7057 | - (nullable NSAttributedString *) | ||
| 7058 | attributedSubstringForProposedRange: (NSRange) range | ||
| 7059 | actualRange: (nullable NSRangePointer) actualRange | ||
| 7060 | { | ||
| 7061 | return nil; | ||
| 7062 | } | ||
| 7063 | |||
| 7064 | - (NSRect) firstRectForCharacterRange: (NSRange) range | ||
| 7065 | actualRange: (nullable NSRangePointer) actualRange | ||
| 7066 | { | ||
| 7067 | return NSZeroRect; | ||
| 7068 | } | ||
| 7069 | |||
| 7070 | #endif /* NS_IMPL_COCOA */ | ||
| 7071 | |||
| 7072 | /*********************************************************************** | ||
| 7073 | NSTextInput | ||
| 7074 | ***********************************************************************/ | ||
| 7075 | |||
| 7076 | /* <NSTextInput> implementation (called through [super interpretKeyEvents:]). */ | ||
| 7038 | 7077 | ||
| 7039 | /* <NSTextInput>: called when done composing; | 7078 | /* <NSTextInput>: called when done composing; |
| 7040 | NOTE: also called when we delete over working text, followed | 7079 | NOTE: also called when we delete over working text, followed |
| @@ -8318,6 +8357,15 @@ ns_in_echo_area (void) | |||
| 8318 | [self windowDidEnterFullScreen]; | 8357 | [self windowDidEnterFullScreen]; |
| 8319 | } | 8358 | } |
| 8320 | 8359 | ||
| 8360 | - (void)adjustEmacsFrameRect | ||
| 8361 | { | ||
| 8362 | struct frame *f = emacsframe; | ||
| 8363 | NSWindow *frame_window = [FRAME_NS_VIEW (f) window]; | ||
| 8364 | NSRect r = [frame_window frame]; | ||
| 8365 | f->left_pos = NSMinX (r) - NS_PARENT_WINDOW_LEFT_POS (f); | ||
| 8366 | f->top_pos = NS_PARENT_WINDOW_TOP_POS (f) - NSMaxY (r); | ||
| 8367 | } | ||
| 8368 | |||
| 8321 | - (void)windowDidEnterFullScreen /* provided for direct calls */ | 8369 | - (void)windowDidEnterFullScreen /* provided for direct calls */ |
| 8322 | { | 8370 | { |
| 8323 | NSTRACE ("[EmacsView windowDidEnterFullScreen]"); | 8371 | NSTRACE ("[EmacsView windowDidEnterFullScreen]"); |
| @@ -8347,6 +8395,10 @@ ns_in_echo_area (void) | |||
| 8347 | } | 8395 | } |
| 8348 | #endif | 8396 | #endif |
| 8349 | } | 8397 | } |
| 8398 | |||
| 8399 | /* Do what windowDidMove does which isn't called when entering/exiting | ||
| 8400 | fullscreen mode. */ | ||
| 8401 | [self adjustEmacsFrameRect]; | ||
| 8350 | } | 8402 | } |
| 8351 | 8403 | ||
| 8352 | - (void)windowWillExitFullScreen:(NSNotification *)notification | 8404 | - (void)windowWillExitFullScreen:(NSNotification *)notification |
| @@ -8389,6 +8441,10 @@ ns_in_echo_area (void) | |||
| 8389 | 8441 | ||
| 8390 | if (next_maximized != -1) | 8442 | if (next_maximized != -1) |
| 8391 | [[self window] performZoom:self]; | 8443 | [[self window] performZoom:self]; |
| 8444 | |||
| 8445 | /* Do what windowDidMove does which isn't called when entering/exiting | ||
| 8446 | fullscreen mode. */ | ||
| 8447 | [self adjustEmacsFrameRect]; | ||
| 8392 | } | 8448 | } |
| 8393 | 8449 | ||
| 8394 | - (BOOL)fsIsNative | 8450 | - (BOOL)fsIsNative |