X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/f90e3ebd13de8169ada56274f3abaa1ea8dc6d05..1269a680862a9bc6cd65e3d26ef05f68c7521632:/src/nsmenu.m diff --git a/src/nsmenu.m b/src/nsmenu.m index 2850f0ed97..19f161709d 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -504,9 +504,11 @@ void x_activate_menubar (struct frame *f) { #ifdef NS_IMPL_COCOA +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 ns_update_menubar (f, true, nil); ns_check_pending_open_menu (); #endif +#endif } @@ -563,7 +565,9 @@ extern NSString *NSMenuDidBeginTrackingNotification; /* Update menu in menuNeedsUpdate only while tracking menus. */ trackingMenu = ([notification name] == NSMenuDidBeginTrackingNotification ? 1 : 0); +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 if (! trackingMenu) ns_check_menu_open (nil); +#endif } #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 @@ -571,7 +575,7 @@ extern NSString *NSMenuDidBeginTrackingNotification; { ++trackingMenu; -#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_6 +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 // On 10.6 we get repeated calls, only the one for NSSystemDefined is "real". if ([[NSApp currentEvent] type] != NSSystemDefined) return; #endif @@ -726,7 +730,7 @@ extern NSString *NSMenuDidBeginTrackingNotification; - (void)fillWithWidgetValue: (void *)wvptr { - [self fillWithWidgetValue: wvptr frame:nil]; + [self fillWithWidgetValue: wvptr frame: (struct frame *)nil]; } - (void)fillWithWidgetValue: (void *)wvptr frame: (struct frame *)f @@ -829,6 +833,8 @@ ns_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, ptrdiff_t specpdl_count = SPECPDL_INDEX (); widget_value *wv, *first_wv = 0; + block_input (); + p.x = x; p.y = y; /* now parse stage 2 as in ns_update_menubar */ @@ -1031,6 +1037,7 @@ ns_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, popup_activated_flag = 0; [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; + unblock_input (); return tem; } @@ -1235,7 +1242,7 @@ update_frame_tool_bar (struct frame *f) { /* 1) come up w/identifier */ NSString *identifier - = [NSString stringWithFormat: @"%u", [img hash]]; + = [NSString stringWithFormat: @"%lu", (unsigned long)[img hash]]; [activeIdentifiers addObject: identifier]; /* 2) create / reuse item */ @@ -1445,7 +1452,7 @@ pop_down_menu (void *arg) Lisp_Object -ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) +ns_popup_dialog (Lisp_Object position, Lisp_Object header, Lisp_Object contents) { id dialog; Lisp_Object window, tem, title; @@ -1863,11 +1870,11 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) while (popup_activated_flag) { NSTimer *tmo = nil; - EMACS_TIME next_time = timer_check (); + struct timespec next_time = timer_check (); - if (EMACS_TIME_VALID_P (next_time)) + if (timespec_valid_p (next_time)) { - double time = EMACS_TIME_TO_DOUBLE (next_time); + double time = timespectod (next_time); tmo = [NSTimer timerWithTimeInterval: time target: self selector: @selector (timeout_handler:) @@ -1912,34 +1919,6 @@ DEFUN ("ns-reset-menu", Fns_reset_menu, Sns_reset_menu, 0, 0, 0, } -DEFUN ("x-popup-dialog", Fx_popup_dialog, Sx_popup_dialog, 2, 3, 0, - doc: /* Pop up a dialog box and return user's selection. -POSITION specifies which frame to use. -This is normally a mouse button event or a window or frame. -If POSITION is t, it means to use the frame the mouse is on. -The dialog box appears in the middle of the specified frame. - -CONTENTS specifies the alternatives to display in the dialog box. -It is a list of the form (DIALOG ITEM1 ITEM2...). -Each ITEM is a cons cell (STRING . VALUE). -The return value is VALUE from the chosen item. - -An ITEM may also be just a string--that makes a nonselectable item. -An ITEM may also be nil--that means to put all preceding items -on the left of the dialog box and all following items on the right. -\(By default, approximately half appear on each side.) - -If HEADER is non-nil, the frame title for the box is "Information", -otherwise it is "Question". - -If the user gets rid of the dialog box without making a valid choice, -for instance using the window manager, then this produces a quit and -`x-popup-dialog' does not return. */) - (Lisp_Object position, Lisp_Object contents, Lisp_Object header) -{ - return ns_popup_dialog (position, contents, header); -} - DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0, doc: /* Return t if a menu or popup dialog is active. */) (void) @@ -1961,7 +1940,6 @@ syms_of_nsmenu (void) update menus there. */ trackingMenu = 1; #endif - defsubr (&Sx_popup_dialog); defsubr (&Sns_reset_menu); defsubr (&Smenu_or_popup_active_p);