From 970bb804deb9b41de3053aeac57f3c091413e7b7 Mon Sep 17 00:00:00 2001 From: Zhi Date: Sun, 6 Jun 2021 23:39:43 +0800 Subject: [PATCH 1/2] fix: replace deprecated metods. Use NSInputContext to replace NSInputManager, which has been deprecated since 10.6. Sync from 0e30a96 in gtk3. --- gtk/gtkimcontextquartz.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gtk/gtkimcontextquartz.c b/gtk/gtkimcontextquartz.c index 8b204222f2..62ca2c4e56 100644 --- a/gtk/gtkimcontextquartz.c +++ b/gtk/gtkimcontextquartz.c @@ -239,8 +239,7 @@ discard_preedit (GtkIMContext *context) /* reset any partial input for this NSView */ [(GdkMacosBaseView *)nsview unmarkText]; - NSInputManager *currentInputManager = [NSInputManager currentInputManager]; - [currentInputManager markedTextAbandoned:nsview]; + [[NSTextInputContext currentInputContext] discardMarkedText]; if (qc->preedit_str && strlen (qc->preedit_str) > 0) { From 5776fcd95517cf7536147686a09d9753c527f46e Mon Sep 17 00:00:00 2001 From: Zhi Date: Tue, 15 Jun 2021 00:06:35 +0800 Subject: [PATCH 2/2] fix: make the new nsview as the first responder. Make the new view as the first responder(focused) so the new view can accept events from input method. Fixes #3968. --- gdk/macos/gdkmacosglcontext.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gdk/macos/gdkmacosglcontext.c b/gdk/macos/gdkmacosglcontext.c index b785beadc0..e4ef4abcb1 100644 --- a/gdk/macos/gdkmacosglcontext.c +++ b/gdk/macos/gdkmacosglcontext.c @@ -145,6 +145,7 @@ ensure_gl_view (GdkMacosGLContext *self) [nsview setPostsFrameChangedNotifications: YES]; [nsview setNeedsDisplay:YES]; [nswindow setContentView:nsview]; + [nswindow makeFirstResponder:nsview]; [nsview release]; if (self->dummy_view != NULL)