Commit a9b4df69 authored by Adrian Robert's avatar Adrian Robert
Browse files

* nsterm.m: (x_set_frame_alpha): Add prototype. (ns_fake_keydown,...

* nsterm.m: (x_set_frame_alpha): Add prototype.  (ns_fake_keydown, EmacsView-keyUp:): New variable and function to handle Ctrl-tab.  (ns_get_color): Use unsigned long long for scanned hex string value.  (ns_term_shutdown): Abort on non SIGTERM signals.
parent cbe0b5bf
2009-01-21 Adrian Robert <Adrian.B.Robert@gmail.com> 2009-01-21 Adrian Robert <Adrian.B.Robert@gmail.com>
   
* nsmenu.m (NSMENUPROFILE): Change #if style. * nsmenu.m (NSMENUPROFILE): Change #if style.
* nsterm.m: (x_set_frame_alpha): Add prototype.
(ns_fake_keydown, EmacsView-keyUp:): New variable and function to
handle Ctrl-tab. (Bug#1841)
(ns_get_color): Use unsigned long long for scanned hex string value.
(ns_term_shutdown): Abort on non SIGTERM signals.
   
2009-01-19 Chong Yidong <cyd@stupidchicken.com> 2009-01-19 Chong Yidong <cyd@stupidchicken.com>
   
......
...@@ -212,6 +212,7 @@ the Function modifer (laptops). May be any of the modifier lisp symbols. */ ...@@ -212,6 +212,7 @@ the Function modifer (laptops). May be any of the modifier lisp symbols. */
static NSRect uRect; static NSRect uRect;
static BOOL gsaved = NO; static BOOL gsaved = NO;
BOOL ns_in_resize = NO; BOOL ns_in_resize = NO;
static BOOL ns_fake_keydown = NO;
int ns_tmp_flags; /* FIXME */ int ns_tmp_flags; /* FIXME */
struct nsfont_info *ns_tmp_font; /* FIXME */ struct nsfont_info *ns_tmp_font; /* FIXME */
/*static int debug_lock = 0; */ /*static int debug_lock = 0; */
...@@ -302,6 +303,7 @@ the Function modifer (laptops). May be any of the modifier lisp symbols. */ ...@@ -302,6 +303,7 @@ the Function modifer (laptops). May be any of the modifier lisp symbols. */
/* TODO: get rid of need for these forward declarations */ /* TODO: get rid of need for these forward declarations */
static void ns_condemn_scroll_bars (struct frame *f); static void ns_condemn_scroll_bars (struct frame *f);
static void ns_judge_scroll_bars (struct frame *f); static void ns_judge_scroll_bars (struct frame *f);
void x_set_frame_alpha (struct frame *f);
/* unused variables needed for compatibility reasons */ /* unused variables needed for compatibility reasons */
int x_use_underline_position_properties, x_underline_at_descent_line; int x_use_underline_position_properties, x_underline_at_descent_line;
...@@ -1419,7 +1421,7 @@ Free a pool and temporary objects it refers to (callable from C) ...@@ -1419,7 +1421,7 @@ Free a pool and temporary objects it refers to (callable from C)
/* Direct colors (hex values) */ /* Direct colors (hex values) */
if (hex) if (hex)
{ {
unsigned long color = 0; unsigned long long color = 0;
if (sscanf (hex, "%x", &color)) if (sscanf (hex, "%x", &color))
{ {
float f1, f2, f3, f4; float f1, f2, f3, f4;
...@@ -3986,8 +3988,15 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes. ...@@ -3986,8 +3988,15 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes.
if (STRINGP (Vauto_save_list_file_name)) if (STRINGP (Vauto_save_list_file_name))
unlink (SDATA (Vauto_save_list_file_name)); unlink (SDATA (Vauto_save_list_file_name));
ns_shutdown_properly = YES; if (sig == 0 || sig == SIGTERM)
[NSApp terminate: NSApp]; {
ns_shutdown_properly = YES;
[NSApp terminate: NSApp];
}
else // force a stack trace to happen
{
abort();
}
} }
...@@ -4374,6 +4383,7 @@ - (void)resetCursorRects ...@@ -4374,6 +4383,7 @@ - (void)resetCursorRects
} }
/*****************************************************************************/ /*****************************************************************************/
/* Keyboard handling. */ /* Keyboard handling. */
#define NS_KEYLOG 0 #define NS_KEYLOG 0
...@@ -4390,7 +4400,9 @@ - (void)keyDown: (NSEvent *)theEvent ...@@ -4390,7 +4400,9 @@ - (void)keyDown: (NSEvent *)theEvent
NSTRACE (keyDown); NSTRACE (keyDown);
/* Rhapsody and OS X give up and down events for the arrow keys */ /* Rhapsody and OS X give up and down events for the arrow keys */
if ([theEvent type] != NSKeyDown) if (ns_fake_keydown == YES)
ns_fake_keydown = NO;
else if ([theEvent type] != NSKeyDown)
return; return;
if (!emacs_event) if (!emacs_event)
...@@ -4485,10 +4497,12 @@ NSView most recently updated (I guess), which is not the correct one. ...@@ -4485,10 +4497,12 @@ NSView most recently updated (I guess), which is not the correct one.
} }
if (flags & NSControlKeyMask) if (flags & NSControlKeyMask)
emacs_event->modifiers |= parse_solitary_modifier (ns_control_modifier); emacs_event->modifiers |=
parse_solitary_modifier (ns_control_modifier);
if (flags & NS_FUNCTION_KEY_MASK && !fnKeysym) if (flags & NS_FUNCTION_KEY_MASK && !fnKeysym)
emacs_event->modifiers |= parse_solitary_modifier (ns_function_modifier); emacs_event->modifiers |=
parse_solitary_modifier (ns_function_modifier);
if (flags & NSAlternateKeyMask) /* default = meta */ if (flags & NSAlternateKeyMask) /* default = meta */
{ {
...@@ -4501,10 +4515,13 @@ NSView most recently updated (I guess), which is not the correct one. ...@@ -4501,10 +4515,13 @@ NSView most recently updated (I guess), which is not the correct one.
emacs_event->modifiers = 0; emacs_event->modifiers = 0;
} }
else else
emacs_event->modifiers |= parse_solitary_modifier (ns_alternate_modifier); emacs_event->modifiers |=
parse_solitary_modifier (ns_alternate_modifier);
} }
/*fprintf (stderr,"code =%x\tfnKey =%x\tflags = %x\tmods = %x\n",code,fnKeysym,flags,emacs_event->modifiers); */ if (NS_KEYLOG)
fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n",
code, fnKeysym, flags, emacs_event->modifiers);
/* if it was a function key or had modifiers, pass it directly to emacs */ /* if it was a function key or had modifiers, pass it directly to emacs */
if (fnKeysym || (emacs_event->modifiers if (fnKeysym || (emacs_event->modifiers
...@@ -4534,7 +4551,7 @@ NSView most recently updated (I guess), which is not the correct one. ...@@ -4534,7 +4551,7 @@ NSView most recently updated (I guess), which is not the correct one.
firstTime = NO; firstTime = NO;
if (NS_KEYLOG && !processingCompose) if (NS_KEYLOG && !processingCompose)
fprintf (stderr, "Begin compose sequence.\n"); fprintf (stderr, "keyDown: Begin compose sequence.\n");
processingCompose = YES; processingCompose = YES;
[nsEvArray addObject: theEvent]; [nsEvArray addObject: theEvent];
...@@ -4543,6 +4560,26 @@ NSView most recently updated (I guess), which is not the correct one. ...@@ -4543,6 +4560,26 @@ NSView most recently updated (I guess), which is not the correct one.
} }
#ifdef NS_IMPL_COCOA
/* Needed to pick up Ctrl-tab and possibly other events that OS X has
decided not to send key-down for.
See http://osdir.com/ml/editors.vim.mac/2007-10/msg00141.html
If it matches one of these, send it on to keyDown. */
-(void)keyUp: (NSEvent *)theEvent
{
int flags = [theEvent modifierFlags];
int code = [theEvent keyCode];
if (code == 0x30 && (flags & NSControlKeyMask) && !(flags & NSCommandKeyMask))
{
if (NS_KEYLOG)
fprintf (stderr, "keyUp: passed test");
ns_fake_keydown = YES;
[self keyDown: theEvent];
}
}
#endif
/* <NSTextInput> implementation (called through super interpretKeyEvents:]). */ /* <NSTextInput> implementation (called through super interpretKeyEvents:]). */
...@@ -4553,7 +4590,8 @@ - (void)insertText: (id)aString ...@@ -4553,7 +4590,8 @@ - (void)insertText: (id)aString
int len = [(NSString *)aString length]; int len = [(NSString *)aString length];
int i; int i;
if (NS_KEYLOG) NSLog (@"insertText '%@'\tlen = %d", aString, len); if (NS_KEYLOG)
NSLog (@"insertText '%@'\tlen = %d", aString, len);
processingCompose = NO; processingCompose = NO;
if (!emacs_event) if (!emacs_event)
...@@ -4654,13 +4692,15 @@ - (NSRange)markedRange ...@@ -4654,13 +4692,15 @@ - (NSRange)markedRange
{ {
NSRange rng = workingText != nil NSRange rng = workingText != nil
? NSMakeRange (0, [workingText length]) : NSMakeRange (NSNotFound, 0); ? NSMakeRange (0, [workingText length]) : NSMakeRange (NSNotFound, 0);
if (NS_KEYLOG) NSLog (@"markedRange request"); if (NS_KEYLOG)
NSLog (@"markedRange request");
return rng; return rng;
} }
- (void)unmarkText - (void)unmarkText
{ {
if (NS_KEYLOG) NSLog (@"unmark (accept) text"); if (NS_KEYLOG)
NSLog (@"unmark (accept) text");
[self deleteWorkingText]; [self deleteWorkingText];
processingCompose = NO; processingCompose = NO;
} }
...@@ -4671,7 +4711,8 @@ - (NSRect)firstRectForCharacterRange: (NSRange)theRange ...@@ -4671,7 +4711,8 @@ - (NSRect)firstRectForCharacterRange: (NSRange)theRange
NSRect rect; NSRect rect;
NSPoint pt; NSPoint pt;
struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)); struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
if (NS_KEYLOG) NSLog (@"firstRectForCharRange request"); if (NS_KEYLOG)
NSLog (@"firstRectForCharRange request");
rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe); rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
rect.size.height = FRAME_LINE_HEIGHT (emacsframe); rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
...@@ -4694,8 +4735,8 @@ - (NSInteger)conversationIdentifier ...@@ -4694,8 +4735,8 @@ - (NSInteger)conversationIdentifier
- (void)doCommandBySelector: (SEL)aSelector - (void)doCommandBySelector: (SEL)aSelector
{ {
if (NS_KEYLOG) NSLog (@"Do command by selector: %@", if (NS_KEYLOG)
NSStringFromSelector (aSelector)); NSLog (@"doCommandBySelector: %@", NSStringFromSelector (aSelector));
if (aSelector == @selector (deleteBackward:)) if (aSelector == @selector (deleteBackward:))
{ {
...@@ -4719,13 +4760,15 @@ - (NSArray *)validAttributesForMarkedText ...@@ -4719,13 +4760,15 @@ - (NSArray *)validAttributesForMarkedText
- (NSRange)selectedRange - (NSRange)selectedRange
{ {
if (NS_KEYLOG) NSLog (@"selectedRange request"); if (NS_KEYLOG)
NSLog (@"selectedRange request");
return NSMakeRange (NSNotFound, 0); return NSMakeRange (NSNotFound, 0);
} }
- (unsigned int)characterIndexForPoint: (NSPoint)thePoint - (unsigned int)characterIndexForPoint: (NSPoint)thePoint
{ {
if (NS_KEYLOG) NSLog (@"characterIndexForPoint request"); if (NS_KEYLOG)
NSLog (@"characterIndexForPoint request");
return 0; return 0;
} }
...@@ -4733,7 +4776,8 @@ - (NSAttributedString *)attributedSubstringFromRange: (NSRange)theRange ...@@ -4733,7 +4776,8 @@ - (NSAttributedString *)attributedSubstringFromRange: (NSRange)theRange
{ {
static NSAttributedString *str = nil; static NSAttributedString *str = nil;
if (str == nil) str = [NSAttributedString new]; if (str == nil) str = [NSAttributedString new];
if (NS_KEYLOG) NSLog (@"attributedSubstringFromRange request"); if (NS_KEYLOG)
NSLog (@"attributedSubstringFromRange request");
return str; return str;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment