diff --git a/src/nsimage.m b/src/nsimage.m index 51367915e1b..cc8abf76094 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -179,13 +179,6 @@ @implementation EmacsImage return nil; } - /* The next two lines cause the DPI of the image to be ignored. - This seems to be the behavior users expect. */ -#ifdef NS_IMPL_COCOA -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 - [image setScalesWhenResized: YES]; -#endif -#endif [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; [image setName: [NSString stringWithUTF8String: SSDATA (file)]]; @@ -355,13 +348,6 @@ - (void) setPixmapData if ([bmr numberOfPlanes] >= 3) [bmr getBitmapDataPlanes: pixmapData]; - /* The next two lines cause the DPI of the image to be ignored. - This seems to be the behavior users expect. */ -#ifdef NS_IMPL_COCOA -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 - [self setScalesWhenResized: YES]; -#endif -#endif [self setSize: NSMakeSize([bmr pixelsWide], [bmr pixelsHigh])]; break; diff --git a/src/nsmenu.m b/src/nsmenu.m index 5c6442ad0e8..59ea3855ed1 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1519,11 +1519,6 @@ @implementation EmacsDialogPanel area.size.width = ICONSIZE; area.size.height= ICONSIZE; img = [[NSImage imageNamed: @"NSApplicationIcon"] copy]; -#ifdef NS_IMPL_COCOA -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 - [img setScalesWhenResized: YES]; -#endif -#endif [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)]; imgView = [[NSImageView alloc] initWithFrame: area]; [imgView setImage: img]; diff --git a/src/nsterm.m b/src/nsterm.m index f985786e198..b03ad526212 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4108,9 +4108,6 @@ in certain situations (rapid incoming events). struct input_event event; char c; - NSDate *timeout_date = nil; - NSEvent *ns_event; - NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_select"); #ifdef HAVE_NATIVE_FS @@ -4168,69 +4165,70 @@ in certain situations (rapid incoming events). /* Inform fd_handler that select should be called */ c = 'g'; emacs_write_sig (selfds[1], &c, 1); - - /* We rely on fd_handler timing out to cause - nextEventMatchingMask below to return, so set it's timeout to - an unreasonably long time. */ - timeout_date = [NSDate distantFuture]; } else if (nr == 0 && timeout) { - /* No file descriptor, just a timeout, no need to wake - fd_handler. Set nextEventMatchingMask timeout. */ + /* No file descriptor, just a timeout, no need to wake fd_handler */ double time = timespectod (*timeout); - timeout_date = [NSDate dateWithTimeIntervalSinceNow: time]; + timed_entry = [[NSTimer scheduledTimerWithTimeInterval: time + target: NSApp + selector: + @selector (timeout_handler:) + userInfo: 0 + repeats: NO] + retain]; + } + else /* No timeout and no file descriptors, can this happen? */ + { + /* Send appdefined so we exit from the loop */ + ns_send_appdefined (-1); } - /* Listen for a new NSEvent. */ - ns_event = [NSApp nextEventMatchingMask: NSEventMaskAny - untilDate: timeout_date - inMode: NSDefaultRunLoopMode - dequeue: NO]; + block_input (); + ns_init_events (&event); + [NSApp run]; + + ns_finish_events (); if (nr > 0 && readfds) { c = 's'; emacs_write_sig (selfds[1], &c, 1); } + unblock_input (); - if (ns_event != nil) + t = last_appdefined_event_data; + + if (t != NO_APPDEFINED_DATA) { - if ([ns_event type] == NSEventTypeApplicationDefined) - { - if ([ns_event data1] < 0) - { - /* The NX_APPDEFINED event we received was a timeout. */ - result = 0; - } - else - { - /* Received back from select () in fd_handler; copy the results */ - pthread_mutex_lock (&select_mutex); - if (readfds) *readfds = select_readfds; - if (writefds) *writefds = select_writefds; - pthread_mutex_unlock (&select_mutex); - result = [ns_event data1]; - } + last_appdefined_event_data = NO_APPDEFINED_DATA; - /* Remove the NX_APPDEFINED event from the queue as it's no - longer needed. */ - [NSApp nextEventMatchingMask: NSEventMaskAny - untilDate: nil - inMode: NSDefaultRunLoopMode - dequeue: YES]; + if (t == -2) + { + /* The NX_APPDEFINED event we received was a timeout. */ + result = 0; + } + else if (t == -1) + { + /* The NX_APPDEFINED event we received was the result of + at least one real input event arriving. */ + errno = EINTR; + result = -1; } else { - /* A real NSEvent came in. */ - errno = EINTR; - result = -1; + /* Received back from select () in fd_handler; copy the results */ + pthread_mutex_lock (&select_mutex); + if (readfds) *readfds = select_readfds; + if (writefds) *writefds = select_writefds; + pthread_mutex_unlock (&select_mutex); + result = t; } } else { - /* Reading from the NSEvent queue timed out. */ - result = 0; + errno = EINTR; + result = -1; } return result; @@ -5936,31 +5934,6 @@ flag set (this is probably a bug in the OS). } -#ifdef NS_IMPL_COCOA -/* Needed to pick up Ctrl-tab and possibly other events that Mac OS X - decided not to send key-down for. - See http://osdir.com/ml/editors.vim.mac/2007-10/msg00141.html - This only applies on Tiger and earlier. - If it matches one of these, send it on to keyDown. */ --(void)keyUp: (NSEvent *)theEvent -{ - int flags = [theEvent modifierFlags]; - int code = [theEvent keyCode]; - - NSTRACE ("[EmacsView keyUp:]"); - - if (floor (NSAppKitVersionNumber) <= 824 /*NSAppKitVersionNumber10_4*/ && - code == 0x30 && (flags & NSEventModifierFlagControl) && !(flags & NSEventModifierFlagCommand)) - { - if (NS_KEYLOG) - fprintf (stderr, "keyUp: passed test"); - ns_fake_keydown = YES; - [self keyDown: theEvent]; - } -} -#endif - - /* implementation (called through super interpretKeyEvents:]). */