aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian Robert2008-08-05 03:05:14 +0000
committerAdrian Robert2008-08-05 03:05:14 +0000
commit4e6225928e54d42a7899dc20a5f56da51e056332 (patch)
tree27cc44228ee044d447283489a52a3fc352dfb79a /src
parentcd1c5ce121ba476ca1472cd6f84a15a34c5b2d65 (diff)
downloademacs-4e6225928e54d42a7899dc20a5f56da51e056332.tar.gz
emacs-4e6225928e54d42a7899dc20a5f56da51e056332.zip
Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog19
-rw-r--r--src/lisp.h2
-rw-r--r--src/nsmenu.m4
-rw-r--r--src/nsterm.h2
-rw-r--r--src/nsterm.m32
5 files changed, 51 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4b157961e80..ed88f0c45d2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,20 @@
12008-08-04 Adrian Robert <Adrian.B.Robert@gmail.com>
2
3 Dock menu customization, based on a patch by Ken Raeburn, plus some
4 other fixes.
5 * nsmenu.m (dockMenu): New variable.
6 (EmacsDialog -clicked:): Fix mistake in change of 2008-07-17.
7
8 * nsterm.h (dockMenu): Declare.
9
10 * nsterm.m (KEY_NS_NEW_FRAME): New definition.
11 (ns_term_init): Initialize dockMenu.
12 (EmacsApp -newFrame:, -applicationDockMenu:): New methods.
13 (EmacsView -windowShouldClose:): Don't behave specially if <= 1 frame
14 left.
15
16 * lisp.h (LSB_TAG): Use on DARWIN_OS, not NS_IMPL_COCOA.
17
12008-08-04 Chong Yidong <cyd@stupidchicken.com> 182008-08-04 Chong Yidong <cyd@stupidchicken.com>
2 19
3 * nsterm.h: Test directly for NS_HAVE_INTEGER before defining it. 20 * nsterm.h: Test directly for NS_HAVE_INTEGER before defining it.
@@ -30,7 +47,7 @@
30 when popup done. 47 when popup done.
31 (ns_popup_dialog): Set popup_activated_flag. 48 (ns_popup_dialog): Set popup_activated_flag.
32 49
33 * nsterm.m (EmacsView -converstationIdentifier): Use NSInteger 50 * nsterm.m (EmacsView -conversationIdentifier): Use NSInteger
34 version for GNUstep (handled by conditional typedef in nsterm.m). 51 version for GNUstep (handled by conditional typedef in nsterm.m).
35 (ns_get_color): Remove special-casing for "darkblue", "dark blue" (now 52 (ns_get_color): Remove special-casing for "darkblue", "dark blue" (now
36 in rgb.txt). 53 in rgb.txt).
diff --git a/src/lisp.h b/src/lisp.h
index 0e9c8b7c799..d013a04553e 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -157,7 +157,7 @@ extern void die P_((const char *, const char *, int)) NO_RETURN;
157#endif 157#endif
158 158
159/* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8. */ 159/* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8. */
160#if defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ || defined(NS_IMPL_COCOA) 160#if defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ || defined DARWIN_OS
161/* We also need to be able to specify mult-of-8 alignment on static vars. */ 161/* We also need to be able to specify mult-of-8 alignment on static vars. */
162# if defined DECL_ALIGN 162# if defined DECL_ALIGN
163/* We currently do not support USE_LSB_TAG with a union Lisp_Object. */ 163/* We currently do not support USE_LSB_TAG with a union Lisp_Object. */
diff --git a/src/nsmenu.m b/src/nsmenu.m
index b4e8dbc9143..825568f6557 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -63,7 +63,7 @@ extern Lisp_Object Voverriding_local_map, Voverriding_local_map_menu_flag,
63 Qoverriding_local_map, Qoverriding_terminal_local_map; 63 Qoverriding_local_map, Qoverriding_terminal_local_map;
64 64
65extern long context_menu_value; 65extern long context_menu_value;
66EmacsMenu *mainMenu, *svcsMenu; 66EmacsMenu *mainMenu, *svcsMenu, *dockMenu;
67 67
68/* Nonzero means a menu is currently active. */ 68/* Nonzero means a menu is currently active. */
69static int popup_activated_flag; 69static int popup_activated_flag;
@@ -1747,7 +1747,7 @@ void process_dialog (id window, Lisp_Object list)
1747 return self; 1747 return self;
1748 1748
1749 seltag = [[sellist objectAtIndex: 0] tag]; 1749 seltag = [[sellist objectAtIndex: 0] tag];
1750 if (seltag == XHASH (Qundefined)) // FIXME: BIG UGLY HACK!! 1750 if (seltag != XHASH (Qundefined)) // FIXME: BIG UGLY HACK!!
1751 [NSApp stopModalWithCode: seltag]; 1751 [NSApp stopModalWithCode: seltag];
1752 return self; 1752 return self;
1753} 1753}
diff --git a/src/nsterm.h b/src/nsterm.h
index f0b15b7cdc9..c479b333fd1 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -355,7 +355,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
355@end 355@end
356 356
357extern NSArray *ns_send_types, *ns_return_types; 357extern NSArray *ns_send_types, *ns_return_types;
358extern EmacsMenu *mainMenu, *svcsMenu; 358extern EmacsMenu *mainMenu, *svcsMenu, *dockMenu;
359 359
360/* Apple removed the declaration, but kept the implementation */ 360/* Apple removed the declaration, but kept the implementation */
361#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 361#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4
diff --git a/src/nsterm.m b/src/nsterm.m
index fd3757be557..3fb9905e4b7 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -78,6 +78,7 @@ int term_trace_num = 0;
78#define KEY_NS_INSERT_WORKING_TEXT ((1<<28)|(0<<16)|9) 78#define KEY_NS_INSERT_WORKING_TEXT ((1<<28)|(0<<16)|9)
79#define KEY_NS_DELETE_WORKING_TEXT ((1<<28)|(0<<16)|10) 79#define KEY_NS_DELETE_WORKING_TEXT ((1<<28)|(0<<16)|10)
80#define KEY_NS_SPI_SERVICE_CALL ((1<<28)|(0<<16)|11) 80#define KEY_NS_SPI_SERVICE_CALL ((1<<28)|(0<<16)|11)
81#define KEY_NS_NEW_FRAME ((1<<28)|(0<<16)|12)
81 82
82/* Convert a symbol indexed with an NSxxx value to a value as defined 83/* Convert a symbol indexed with an NSxxx value to a value as defined
83 in keyboard.c (lispy_function_key). I hope this is a correct way 84 in keyboard.c (lispy_function_key). I hope this is a correct way
@@ -3880,6 +3881,7 @@ ns_term_init (Lisp_Object display_name)
3880 appMenu = [[EmacsMenu alloc] initWithTitle: @"Emacs"]; 3881 appMenu = [[EmacsMenu alloc] initWithTitle: @"Emacs"];
3881 [appMenu setAutoenablesItems: NO]; 3882 [appMenu setAutoenablesItems: NO];
3882 mainMenu = [[EmacsMenu alloc] initWithTitle: @""]; 3883 mainMenu = [[EmacsMenu alloc] initWithTitle: @""];
3884 dockMenu = [[EmacsMenu alloc] initWithTitle: @""];
3883 3885
3884 [appMenu insertItemWithTitle: @"About Emacs" 3886 [appMenu insertItemWithTitle: @"About Emacs"
3885 action: @selector (orderFrontStandardAboutPanel:) 3887 action: @selector (orderFrontStandardAboutPanel:)
@@ -3918,6 +3920,10 @@ ns_term_init (Lisp_Object display_name)
3918 keyEquivalent: @"" 3920 keyEquivalent: @""
3919 atIndex: 0]; 3921 atIndex: 0];
3920 [mainMenu setSubmenu: appMenu forItem: item]; 3922 [mainMenu setSubmenu: appMenu forItem: item];
3923 [dockMenu insertItemWithTitle: @"New Frame"
3924 action: @selector (newFrame:)
3925 keyEquivalent: @""
3926 atIndex: 0];
3921 3927
3922 [NSApp setMainMenu: mainMenu]; 3928 [NSApp setMainMenu: mainMenu];
3923 [NSApp setAppleMenu: appMenu]; 3929 [NSApp setAppleMenu: appMenu];
@@ -4026,6 +4032,20 @@ ns_term_shutdown (int sig)
4026} 4032}
4027 4033
4028 4034
4035- (void)newFrame: (id)sender
4036{
4037 struct frame *emacsframe = SELECTED_FRAME ();
4038 NSEvent *theEvent = [NSApp currentEvent];
4039
4040 if (!emacs_event)
4041 return;
4042 emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
4043 emacs_event->code = KEY_NS_NEW_FRAME;
4044 emacs_event->modifiers = 0;
4045 EV_TRAILER (theEvent);
4046}
4047
4048
4029/* Open a file (used by below, after going into queue read by ns_read_socket) */ 4049/* Open a file (used by below, after going into queue read by ns_read_socket) */
4030- (BOOL) openFile: (NSString *)fileName 4050- (BOOL) openFile: (NSString *)fileName
4031{ 4051{
@@ -4137,6 +4157,14 @@ fprintf (stderr, "res = %d\n", EQ (res, Qt)); /* FIXME */
4137 4157
4138} 4158}
4139 4159
4160
4161/* Handle dock menu requests. */
4162- (NSMenu *)applicationDockMenu: (NSApplication *) sender
4163{
4164 return dockMenu;
4165}
4166
4167
4140/* TODO: these may help w/IO switching btwn terminal and NSApp */ 4168/* TODO: these may help w/IO switching btwn terminal and NSApp */
4141- (void)applicationDidBecomeActive: (NSNotification *)notification 4169- (void)applicationDidBecomeActive: (NSNotification *)notification
4142{ 4170{
@@ -4834,8 +4862,6 @@ if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request");
4834 4862
4835 NSTRACE (windowShouldClose); 4863 NSTRACE (windowShouldClose);
4836 windowClosing = YES; 4864 windowClosing = YES;
4837 if (ns_window_num <= 1)
4838 return NO;
4839 if (!emacs_event) 4865 if (!emacs_event)
4840 return NO; 4866 return NO;
4841 emacs_event->kind = DELETE_WINDOW_EVENT; 4867 emacs_event->kind = DELETE_WINDOW_EVENT;
@@ -4943,7 +4969,7 @@ if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request");
4943 4969
4944 ns_send_appdefined (-1); 4970 ns_send_appdefined (-1);
4945 4971
4946 /* The following line causes a crash on GNUstep. Adrian Roberts 4972 /* The following line causes a crash on GNUstep. Adrian Robert
4947 says he doesn't remember why he added this line, but removing it 4973 says he doesn't remember why he added this line, but removing it
4948 doesn't seem to cause problems on OSX, either. */ 4974 doesn't seem to cause problems on OSX, either. */
4949#if 0 4975#if 0