/* NeXT/Open/GNUstep and MacOSX Cocoa menu and toolbar module.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include "nsmenu_common.c"
#endif
-extern Lisp_Object Qundefined, Qmenu_enable, Qmenu_bar_update_hook;
-extern Lisp_Object QCtoggle, QCradio;
-
-Lisp_Object Qdebug_on_next_call;
-extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
-
extern long context_menu_value;
EmacsMenu *mainMenu, *svcsMenu, *dockMenu;
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
}
frame = f;
}
-#ifdef NS_IMPL_COCOA
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
-extern NSString *NSMenuDidBeginTrackingNotification;
-#endif
-#endif
-
#ifdef NS_IMPL_COCOA
-(void)trackingNotification:(NSNotification *)notification
{
/* 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
- (void)menuWillOpen:(NSMenu *)menu
{
++trackingMenu;
{
--trackingMenu;
}
-#endif /* OSX >= 10.5 */
#endif /* NS_IMPL_COCOA */
if (trackingMenu == 0)
return;
/*fprintf (stderr, "Updating menu '%s'\n", [[self title] UTF8String]); NSLog (@"%@\n", event); */
-#if (! defined (NS_IMPL_COCOA) \
- || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
+#ifdef NS_IMPL_GNUSTEP
/* Don't know how to do this for anything other than OSX >= 10.5
This is wrong, as it might run Lisp code in the event loop. */
ns_update_menubar (frame, true, self);
{
NSMenuItem *item = [self itemAtIndex: n];
NSString *title = [item title];
- if (([title length] == 0 /* OSX 10.5 */
- || [ns_app_name isEqualToString: title] /* from 10.6 on */
- || [@"Apple" isEqualToString: title]) /* older */
+ if ([ns_app_name isEqualToString: title]
&& ![item isSeparatorItem])
continue;
[self removeItemAtIndex: n];
========================================================================== */
Lisp_Object
-ns_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
+ns_menu_show (struct frame *f, int x, int y, int menuflags,
Lisp_Object title, const char **error)
{
EmacsMenu *pmenu;
Lisp_Object tem;
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
widget_value *wv, *first_wv = 0;
+ bool keymaps = (menuflags & MENU_KEYMAPS);
block_input ();
EmacsView *view = FRAME_NS_VIEW (f);
NSWindow *window = [view window];
EmacsToolbar *toolbar = [view toolbar];
+ int oldh;
if (view == nil || toolbar == nil) return;
block_input ();
+ oldh = FRAME_TOOLBAR_HEIGHT (f);
+
#ifdef NS_IMPL_COCOA
[toolbar clearActive];
#else
if (FRAME_TOOLBAR_HEIGHT (f) < 0) // happens if frame is fullscreen.
FRAME_TOOLBAR_HEIGHT (f) = 0;
+ if (oldh != FRAME_TOOLBAR_HEIGHT (f))
+ [view updateFrameSize:YES];
if (view->wait_for_tool_bar && FRAME_TOOLBAR_HEIGHT (f) > 0)
+ {
+ view->wait_for_tool_bar = NO;
[view setNeedsDisplay: YES];
+ }
unblock_input ();
}
Lisp_Object
-ns_popup_dialog (Lisp_Object position, Lisp_Object header, Lisp_Object contents)
+ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
{
id dialog;
Lisp_Object window, tem, title;
- struct frame *f;
NSPoint p;
BOOL isQ;
NSAutoreleasePool *pool;
isQ = NILP (header);
- if (EQ (position, Qt)
- || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar)
- || EQ (XCAR (position), Qtool_bar))))
- {
- window = selected_window;
- }
- else if (CONSP (position))
- {
- Lisp_Object tem;
- tem = Fcar (position);
- if (XTYPE (tem) == Lisp_Cons)
- window = Fcar (Fcdr (position));
- else
- {
- tem = Fcar (Fcdr (position)); /* EVENT_START (position) */
- window = Fcar (tem); /* POSN_WINDOW (tem) */
- }
- }
- else if (WINDOWP (position) || FRAMEP (position))
- {
- window = position;
- }
- else
- window = Qnil;
-
- if (FRAMEP (window))
- f = XFRAME (window);
- else if (WINDOWP (window))
- {
- CHECK_LIVE_WINDOW (window);
- f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
- }
- else
- CHECK_WINDOW (window);
-
check_window_system (f);
p.x = (int)f->left_pos + ((int)FRAME_COLUMN_WIDTH (f) * f->text_cols)/2;
defsubr (&Sns_reset_menu);
defsubr (&Smenu_or_popup_active_p);
- Qdebug_on_next_call = intern_c_string ("debug-on-next-call");
- staticpro (&Qdebug_on_next_call);
+ DEFSYM (Qdebug_on_next_call, "debug-on-next-call");
}