diff options
Diffstat (limited to 'src/nsterm.m')
| -rw-r--r-- | src/nsterm.m | 87 |
1 files changed, 39 insertions, 48 deletions
diff --git a/src/nsterm.m b/src/nsterm.m index cc44c58a938..3c746f2926c 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -597,7 +597,6 @@ ns_init_locale (void) | |||
| 597 | setenv ("LANG", lang, 1); | 597 | setenv ("LANG", lang, 1); |
| 598 | } | 598 | } |
| 599 | 599 | ||
| 600 | |||
| 601 | void | 600 | void |
| 602 | ns_release_object (void *obj) | 601 | ns_release_object (void *obj) |
| 603 | /* -------------------------------------------------------------------------- | 602 | /* -------------------------------------------------------------------------- |
| @@ -5901,53 +5900,6 @@ ns_term_init (Lisp_Object display_name) | |||
| 5901 | ns_antialias_threshold = NILP (tmp) ? 10.0 : extract_float (tmp); | 5900 | ns_antialias_threshold = NILP (tmp) ? 10.0 : extract_float (tmp); |
| 5902 | } | 5901 | } |
| 5903 | 5902 | ||
| 5904 | NSTRACE_MSG ("Colors"); | ||
| 5905 | |||
| 5906 | { | ||
| 5907 | NSColorList *cl = [NSColorList colorListNamed: @"Emacs"]; | ||
| 5908 | |||
| 5909 | /* There are 752 colors defined in rgb.txt. */ | ||
| 5910 | if ( cl == nil || [[cl allKeys] count] < 752) | ||
| 5911 | { | ||
| 5912 | Lisp_Object color_file, color_map, color, name; | ||
| 5913 | unsigned long c; | ||
| 5914 | |||
| 5915 | color_file = Fexpand_file_name (build_string ("rgb.txt"), | ||
| 5916 | Fsymbol_value (intern ("data-directory"))); | ||
| 5917 | |||
| 5918 | color_map = Fx_load_color_file (color_file); | ||
| 5919 | if (NILP (color_map)) | ||
| 5920 | fatal ("Could not read %s.\n", SDATA (color_file)); | ||
| 5921 | |||
| 5922 | cl = [[NSColorList alloc] initWithName: @"Emacs"]; | ||
| 5923 | for ( ; CONSP (color_map); color_map = XCDR (color_map)) | ||
| 5924 | { | ||
| 5925 | color = XCAR (color_map); | ||
| 5926 | name = XCAR (color); | ||
| 5927 | c = XFIXNUM (XCDR (color)); | ||
| 5928 | c |= 0xFF000000; | ||
| 5929 | [cl setColor: | ||
| 5930 | [NSColor colorWithUnsignedLong:c] | ||
| 5931 | forKey: [NSString stringWithLispString: name]]; | ||
| 5932 | } | ||
| 5933 | |||
| 5934 | /* FIXME: Report any errors writing the color file below. */ | ||
| 5935 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 | ||
| 5936 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 101100 | ||
| 5937 | if ([cl respondsToSelector:@selector(writeToURL:error:)]) | ||
| 5938 | #endif | ||
| 5939 | [cl writeToURL:nil error:nil]; | ||
| 5940 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 101100 | ||
| 5941 | else | ||
| 5942 | #endif | ||
| 5943 | #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 */ | ||
| 5944 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 101100 \ | ||
| 5945 | || defined (NS_IMPL_GNUSTEP) | ||
| 5946 | [cl writeToFile: nil]; | ||
| 5947 | #endif | ||
| 5948 | } | ||
| 5949 | } | ||
| 5950 | |||
| 5951 | NSTRACE_MSG ("Versions"); | 5903 | NSTRACE_MSG ("Versions"); |
| 5952 | 5904 | ||
| 5953 | delete_keyboard_wait_descriptor (0); | 5905 | delete_keyboard_wait_descriptor (0); |
| @@ -6382,6 +6334,20 @@ ns_term_shutdown (int sig) | |||
| 6382 | #endif | 6334 | #endif |
| 6383 | 6335 | ||
| 6384 | #ifdef NS_IMPL_COCOA | 6336 | #ifdef NS_IMPL_COCOA |
| 6337 | /* Sleep event notification. */ | ||
| 6338 | [[[NSWorkspace sharedWorkspace] notificationCenter] | ||
| 6339 | addObserver: self | ||
| 6340 | selector:@selector(systemWillSleep:) | ||
| 6341 | name: NSWorkspaceWillSleepNotification | ||
| 6342 | object: nil]; | ||
| 6343 | [[[NSWorkspace sharedWorkspace] notificationCenter] | ||
| 6344 | addObserver: self | ||
| 6345 | selector: @selector(systemDidWake:) | ||
| 6346 | name: NSWorkspaceDidWakeNotification | ||
| 6347 | object: nil]; | ||
| 6348 | #endif | ||
| 6349 | |||
| 6350 | #ifdef NS_IMPL_COCOA | ||
| 6385 | /* Some functions/methods in CoreFoundation/Foundation increase the | 6351 | /* Some functions/methods in CoreFoundation/Foundation increase the |
| 6386 | maximum number of open files for the process in their first call. | 6352 | maximum number of open files for the process in their first call. |
| 6387 | We make dummy calls to them and then reduce the resource limit | 6353 | We make dummy calls to them and then reduce the resource limit |
| @@ -6419,6 +6385,31 @@ ns_term_shutdown (int sig) | |||
| 6419 | #endif | 6385 | #endif |
| 6420 | } | 6386 | } |
| 6421 | 6387 | ||
| 6388 | /* Sleep event notification. */ | ||
| 6389 | |||
| 6390 | - (void) systemWillSleep:(NSNotification *)notification | ||
| 6391 | { | ||
| 6392 | #ifdef NS_IMPL_COCOA | ||
| 6393 | NSTRACE ("[EmacsApp systemWillSleep:]"); | ||
| 6394 | struct input_event ie; | ||
| 6395 | EVENT_INIT (ie); | ||
| 6396 | ie.kind = SLEEP_EVENT; | ||
| 6397 | ie.arg = list1 (Qpre_sleep); | ||
| 6398 | kbd_buffer_store_event (&ie); | ||
| 6399 | #endif | ||
| 6400 | } | ||
| 6401 | |||
| 6402 | - (void) systemDidWake:(NSNotification *)notification | ||
| 6403 | { | ||
| 6404 | #ifdef NS_IMPL_COCOA | ||
| 6405 | NSTRACE ("[EmacsApp systemDidWake:]"); | ||
| 6406 | struct input_event ie; | ||
| 6407 | EVENT_INIT (ie); | ||
| 6408 | ie.kind = SLEEP_EVENT; | ||
| 6409 | ie.arg = list1 (Qpost_wake); | ||
| 6410 | kbd_buffer_store_event (&ie); | ||
| 6411 | #endif | ||
| 6412 | } | ||
| 6422 | 6413 | ||
| 6423 | /* Termination sequences: | 6414 | /* Termination sequences: |
| 6424 | C-x C-c: | 6415 | C-x C-c: |