From 2c4e9985922b106389abf659d63d8dd721f2a9bc Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 14 May 2022 21:35:05 +0800 Subject: [PATCH] Minor fixes for popup dialogs on macOS * nsmenu.m (pop_down_menu): Restore old hack for macOS. ([EmacsDialogPanel initWithTitle:isQuestion:]): Set command title correctly. --- src/nsmenu.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/nsmenu.m b/src/nsmenu.m index 1ebaca4e872..2219d6cf998 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1540,6 +1540,12 @@ pop_down_menu (void *arg) { popup_activated_flag = 0; [panel close]; + /* For some reason this is required on macOS, or the selected + frame gets the keyboard focus but doesn't become + highlighted. */ +#ifdef NS_IMPL_COCOA + [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; +#endif discard_menu_items (); } } @@ -1847,10 +1853,11 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) if (title_string) [title setStringValue: [NSString stringWithUTF8String: title_string]]; - else if (is_question) - [title setStringValue: @"Question"]; + + if (is_question) + [command setStringValue: @"Question"]; else - [title setStringValue: @"Information"]; + [command setStringValue: @"Information"]; return self; } -- 2.39.2