diff options
| author | Michael Albinus | 2017-03-14 15:52:32 +0100 |
|---|---|---|
| committer | Michael Albinus | 2017-03-14 15:52:32 +0100 |
| commit | 5a64d78854998c2ed6d9b8de1b593d8462b8fa39 (patch) | |
| tree | 3dd71c54b0958a95b92837b587d353a44c42f70e /src | |
| parent | a568d0a7d4b62d0b92ecd6450bef1b9a5ac8ae9a (diff) | |
| parent | 726c6c97ca8f14ad6db67b8d526aca93e88432de (diff) | |
| download | emacs-5a64d78854998c2ed6d9b8de1b593d8462b8fa39.tar.gz emacs-5a64d78854998c2ed6d9b8de1b593d8462b8fa39.zip | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsimage.m | 14 | ||||
| -rw-r--r-- | src/nsmenu.m | 5 | ||||
| -rw-r--r-- | src/nsterm.m | 109 |
3 files changed, 41 insertions, 87 deletions
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 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 179 | return nil; | 179 | return nil; |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | /* The next two lines cause the DPI of the image to be ignored. | ||
| 183 | This seems to be the behavior users expect. */ | ||
| 184 | #ifdef NS_IMPL_COCOA | ||
| 185 | #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | ||
| 186 | [image setScalesWhenResized: YES]; | ||
| 187 | #endif | ||
| 188 | #endif | ||
| 189 | [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; | 182 | [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; |
| 190 | 183 | ||
| 191 | [image setName: [NSString stringWithUTF8String: SSDATA (file)]]; | 184 | [image setName: [NSString stringWithUTF8String: SSDATA (file)]]; |
| @@ -355,13 +348,6 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 355 | if ([bmr numberOfPlanes] >= 3) | 348 | if ([bmr numberOfPlanes] >= 3) |
| 356 | [bmr getBitmapDataPlanes: pixmapData]; | 349 | [bmr getBitmapDataPlanes: pixmapData]; |
| 357 | 350 | ||
| 358 | /* The next two lines cause the DPI of the image to be ignored. | ||
| 359 | This seems to be the behavior users expect. */ | ||
| 360 | #ifdef NS_IMPL_COCOA | ||
| 361 | #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | ||
| 362 | [self setScalesWhenResized: YES]; | ||
| 363 | #endif | ||
| 364 | #endif | ||
| 365 | [self setSize: NSMakeSize([bmr pixelsWide], [bmr pixelsHigh])]; | 351 | [self setSize: NSMakeSize([bmr pixelsWide], [bmr pixelsHigh])]; |
| 366 | 352 | ||
| 367 | break; | 353 | 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 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) | |||
| 1519 | area.size.width = ICONSIZE; | 1519 | area.size.width = ICONSIZE; |
| 1520 | area.size.height= ICONSIZE; | 1520 | area.size.height= ICONSIZE; |
| 1521 | img = [[NSImage imageNamed: @"NSApplicationIcon"] copy]; | 1521 | img = [[NSImage imageNamed: @"NSApplicationIcon"] copy]; |
| 1522 | #ifdef NS_IMPL_COCOA | ||
| 1523 | #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | ||
| 1524 | [img setScalesWhenResized: YES]; | ||
| 1525 | #endif | ||
| 1526 | #endif | ||
| 1527 | [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)]; | 1522 | [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)]; |
| 1528 | imgView = [[NSImageView alloc] initWithFrame: area]; | 1523 | imgView = [[NSImageView alloc] initWithFrame: area]; |
| 1529 | [imgView setImage: img]; | 1524 | [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 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 4108 | struct input_event event; | 4108 | struct input_event event; |
| 4109 | char c; | 4109 | char c; |
| 4110 | 4110 | ||
| 4111 | NSDate *timeout_date = nil; | ||
| 4112 | NSEvent *ns_event; | ||
| 4113 | |||
| 4114 | NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_select"); | 4111 | NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_select"); |
| 4115 | 4112 | ||
| 4116 | #ifdef HAVE_NATIVE_FS | 4113 | #ifdef HAVE_NATIVE_FS |
| @@ -4168,69 +4165,70 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 4168 | /* Inform fd_handler that select should be called */ | 4165 | /* Inform fd_handler that select should be called */ |
| 4169 | c = 'g'; | 4166 | c = 'g'; |
| 4170 | emacs_write_sig (selfds[1], &c, 1); | 4167 | emacs_write_sig (selfds[1], &c, 1); |
| 4171 | |||
| 4172 | /* We rely on fd_handler timing out to cause | ||
| 4173 | nextEventMatchingMask below to return, so set it's timeout to | ||
| 4174 | an unreasonably long time. */ | ||
| 4175 | timeout_date = [NSDate distantFuture]; | ||
| 4176 | } | 4168 | } |
| 4177 | else if (nr == 0 && timeout) | 4169 | else if (nr == 0 && timeout) |
| 4178 | { | 4170 | { |
| 4179 | /* No file descriptor, just a timeout, no need to wake | 4171 | /* No file descriptor, just a timeout, no need to wake fd_handler */ |
| 4180 | fd_handler. Set nextEventMatchingMask timeout. */ | ||
| 4181 | double time = timespectod (*timeout); | 4172 | double time = timespectod (*timeout); |
| 4182 | timeout_date = [NSDate dateWithTimeIntervalSinceNow: time]; | 4173 | timed_entry = [[NSTimer scheduledTimerWithTimeInterval: time |
| 4174 | target: NSApp | ||
| 4175 | selector: | ||
| 4176 | @selector (timeout_handler:) | ||
| 4177 | userInfo: 0 | ||
| 4178 | repeats: NO] | ||
| 4179 | retain]; | ||
| 4180 | } | ||
| 4181 | else /* No timeout and no file descriptors, can this happen? */ | ||
| 4182 | { | ||
| 4183 | /* Send appdefined so we exit from the loop */ | ||
| 4184 | ns_send_appdefined (-1); | ||
| 4183 | } | 4185 | } |
| 4184 | 4186 | ||
| 4185 | /* Listen for a new NSEvent. */ | 4187 | block_input (); |
| 4186 | ns_event = [NSApp nextEventMatchingMask: NSEventMaskAny | 4188 | ns_init_events (&event); |
| 4187 | untilDate: timeout_date | 4189 | |
| 4188 | inMode: NSDefaultRunLoopMode | 4190 | [NSApp run]; |
| 4189 | dequeue: NO]; | ||
| 4190 | 4191 | ||
| 4192 | ns_finish_events (); | ||
| 4191 | if (nr > 0 && readfds) | 4193 | if (nr > 0 && readfds) |
| 4192 | { | 4194 | { |
| 4193 | c = 's'; | 4195 | c = 's'; |
| 4194 | emacs_write_sig (selfds[1], &c, 1); | 4196 | emacs_write_sig (selfds[1], &c, 1); |
| 4195 | } | 4197 | } |
| 4198 | unblock_input (); | ||
| 4196 | 4199 | ||
| 4197 | if (ns_event != nil) | 4200 | t = last_appdefined_event_data; |
| 4201 | |||
| 4202 | if (t != NO_APPDEFINED_DATA) | ||
| 4198 | { | 4203 | { |
| 4199 | if ([ns_event type] == NSEventTypeApplicationDefined) | 4204 | last_appdefined_event_data = NO_APPDEFINED_DATA; |
| 4200 | { | ||
| 4201 | if ([ns_event data1] < 0) | ||
| 4202 | { | ||
| 4203 | /* The NX_APPDEFINED event we received was a timeout. */ | ||
| 4204 | result = 0; | ||
| 4205 | } | ||
| 4206 | else | ||
| 4207 | { | ||
| 4208 | /* Received back from select () in fd_handler; copy the results */ | ||
| 4209 | pthread_mutex_lock (&select_mutex); | ||
| 4210 | if (readfds) *readfds = select_readfds; | ||
| 4211 | if (writefds) *writefds = select_writefds; | ||
| 4212 | pthread_mutex_unlock (&select_mutex); | ||
| 4213 | result = [ns_event data1]; | ||
| 4214 | } | ||
| 4215 | 4205 | ||
| 4216 | /* Remove the NX_APPDEFINED event from the queue as it's no | 4206 | if (t == -2) |
| 4217 | longer needed. */ | 4207 | { |
| 4218 | [NSApp nextEventMatchingMask: NSEventMaskAny | 4208 | /* The NX_APPDEFINED event we received was a timeout. */ |
| 4219 | untilDate: nil | 4209 | result = 0; |
| 4220 | inMode: NSDefaultRunLoopMode | ||
| 4221 | dequeue: YES]; | ||
| 4222 | } | 4210 | } |
| 4223 | else | 4211 | else if (t == -1) |
| 4224 | { | 4212 | { |
| 4225 | /* A real NSEvent came in. */ | 4213 | /* The NX_APPDEFINED event we received was the result of |
| 4214 | at least one real input event arriving. */ | ||
| 4226 | errno = EINTR; | 4215 | errno = EINTR; |
| 4227 | result = -1; | 4216 | result = -1; |
| 4228 | } | 4217 | } |
| 4218 | else | ||
| 4219 | { | ||
| 4220 | /* Received back from select () in fd_handler; copy the results */ | ||
| 4221 | pthread_mutex_lock (&select_mutex); | ||
| 4222 | if (readfds) *readfds = select_readfds; | ||
| 4223 | if (writefds) *writefds = select_writefds; | ||
| 4224 | pthread_mutex_unlock (&select_mutex); | ||
| 4225 | result = t; | ||
| 4226 | } | ||
| 4229 | } | 4227 | } |
| 4230 | else | 4228 | else |
| 4231 | { | 4229 | { |
| 4232 | /* Reading from the NSEvent queue timed out. */ | 4230 | errno = EINTR; |
| 4233 | result = 0; | 4231 | result = -1; |
| 4234 | } | 4232 | } |
| 4235 | 4233 | ||
| 4236 | return result; | 4234 | return result; |
| @@ -5936,31 +5934,6 @@ not_in_argv (NSString *arg) | |||
| 5936 | } | 5934 | } |
| 5937 | 5935 | ||
| 5938 | 5936 | ||
| 5939 | #ifdef NS_IMPL_COCOA | ||
| 5940 | /* Needed to pick up Ctrl-tab and possibly other events that Mac OS X | ||
| 5941 | decided not to send key-down for. | ||
| 5942 | See http://osdir.com/ml/editors.vim.mac/2007-10/msg00141.html | ||
| 5943 | This only applies on Tiger and earlier. | ||
| 5944 | If it matches one of these, send it on to keyDown. */ | ||
| 5945 | -(void)keyUp: (NSEvent *)theEvent | ||
| 5946 | { | ||
| 5947 | int flags = [theEvent modifierFlags]; | ||
| 5948 | int code = [theEvent keyCode]; | ||
| 5949 | |||
| 5950 | NSTRACE ("[EmacsView keyUp:]"); | ||
| 5951 | |||
| 5952 | if (floor (NSAppKitVersionNumber) <= 824 /*NSAppKitVersionNumber10_4*/ && | ||
| 5953 | code == 0x30 && (flags & NSEventModifierFlagControl) && !(flags & NSEventModifierFlagCommand)) | ||
| 5954 | { | ||
| 5955 | if (NS_KEYLOG) | ||
| 5956 | fprintf (stderr, "keyUp: passed test"); | ||
| 5957 | ns_fake_keydown = YES; | ||
| 5958 | [self keyDown: theEvent]; | ||
| 5959 | } | ||
| 5960 | } | ||
| 5961 | #endif | ||
| 5962 | |||
| 5963 | |||
| 5964 | /* <NSTextInput> implementation (called through super interpretKeyEvents:]). */ | 5937 | /* <NSTextInput> implementation (called through super interpretKeyEvents:]). */ |
| 5965 | 5938 | ||
| 5966 | 5939 | ||