comparison src/macterm.c @ 75200:659905f1c3a4

(x_free_frame_resources) [USE_CG_DRAWING]: Call mac_prepare_for_quickdraw. (quit_char, make_ctrl_char) [TARGET_API_MAC_CARBON]: Move externs outside #ifdef MAC_OSX. (mac_quit_char_key_p) [TARGET_API_MAC_CARBON]: Move function outside #ifdef MAC_OSX. (mac_check_bundle) [MAC_OSX]: Remove unused function.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Fri, 12 Jan 2007 09:00:24 +0000
parents a567ccd9c91c
children 3d45362f1d38
comparison
equal deleted inserted replaced
75199:6f528fee9d6d 75200:659905f1c3a4
6570 BLOCK_INPUT; 6570 BLOCK_INPUT;
6571 6571
6572 if (wp != tip_window) 6572 if (wp != tip_window)
6573 remove_window_handler (wp); 6573 remove_window_handler (wp);
6574 6574
6575 #if USE_CG_DRAWING
6576 mac_prepare_for_quickdraw (f);
6577 #endif
6575 DisposeWindow (wp); 6578 DisposeWindow (wp);
6576 if (wp == tip_window) 6579 if (wp == tip_window)
6577 /* Neither WaitNextEvent nor ReceiveNextEvent receives `window 6580 /* Neither WaitNextEvent nor ReceiveNextEvent receives `window
6578 closed' event. So we reset tip_window here. */ 6581 closed' event. So we reset tip_window here. */
6579 tip_window = NULL; 6582 tip_window = NULL;
9050 result = cmdIs3 ? 1 : 2; 9053 result = cmdIs3 ? 1 : 2;
9051 } 9054 }
9052 return result; 9055 return result;
9053 } 9056 }
9054 9057
9058 #if TARGET_API_MAC_CARBON
9059 /***** Code to handle C-g testing *****/
9060 extern int quit_char;
9061 extern int make_ctrl_char P_ ((int));
9062
9063 int
9064 mac_quit_char_key_p (modifiers, key_code)
9065 UInt32 modifiers, key_code;
9066 {
9067 UInt32 char_code;
9068 unsigned long some_state = 0;
9069 Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
9070 int c, emacs_modifiers;
9071
9072 /* Mask off modifier keys that are mapped to some Emacs modifiers. */
9073 key_code |= (modifiers & ~(mac_mapped_modifiers (modifiers)));
9074 char_code = KeyTranslate (kchr_ptr, key_code, &some_state);
9075 if (char_code & ~0xff)
9076 return 0;
9077
9078 emacs_modifiers = mac_to_emacs_modifiers (modifiers);
9079 if (emacs_modifiers & ctrl_modifier)
9080 c = make_ctrl_char (char_code);
9081
9082 c |= (emacs_modifiers
9083 & (meta_modifier | alt_modifier
9084 | hyper_modifier | super_modifier));
9085
9086 return c == quit_char;
9087 }
9088 #endif
9089
9055 #if USE_CARBON_EVENTS 9090 #if USE_CARBON_EVENTS
9056 /* Obtains the event modifiers from the event ref and then calls 9091 /* Obtains the event modifiers from the event ref and then calls
9057 mac_to_emacs_modifiers. */ 9092 mac_to_emacs_modifiers. */
9058 static int 9093 static int
9059 mac_event_to_emacs_modifiers (EventRef eventRef) 9094 mac_event_to_emacs_modifiers (EventRef eventRef)
11605 } 11640 }
11606 11641
11607 11642
11608 #ifdef MAC_OSX 11643 #ifdef MAC_OSX
11609 void 11644 void
11610 mac_check_bundle()
11611 {
11612 extern int inhibit_window_system;
11613 extern int noninteractive;
11614 CFBundleRef appsBundle;
11615
11616 /* No need to test if already -nw*/
11617 if (inhibit_window_system || noninteractive)
11618 return;
11619
11620 appsBundle = CFBundleGetMainBundle();
11621 if (appsBundle != NULL)
11622 {
11623 CFStringRef cfBI = CFSTR("CFBundleIdentifier");
11624 CFTypeRef res = CFBundleGetValueForInfoDictionaryKey(appsBundle, cfBI);
11625 /* We found the bundle identifier, now we know we are valid. */
11626 if (res != NULL)
11627 {
11628 CFRelease(res);
11629 return;
11630 }
11631 }
11632 /* MAC_TODO: Have this start the bundled executable */
11633
11634 /* For now, prevent the fatal error by bringing it up in the terminal */
11635 inhibit_window_system = 1;
11636 }
11637
11638 void
11639 MakeMeTheFrontProcess () 11645 MakeMeTheFrontProcess ()
11640 { 11646 {
11641 ProcessSerialNumber psn; 11647 ProcessSerialNumber psn;
11642 OSErr err; 11648 OSErr err;
11643 11649
11644 err = GetCurrentProcess (&psn); 11650 err = GetCurrentProcess (&psn);
11645 if (err == noErr) 11651 if (err == noErr)
11646 (void) SetFrontProcess (&psn); 11652 (void) SetFrontProcess (&psn);
11647 }
11648
11649 /***** Code to handle C-g testing *****/
11650 extern int quit_char;
11651 extern int make_ctrl_char P_ ((int));
11652
11653 int
11654 mac_quit_char_key_p (modifiers, key_code)
11655 UInt32 modifiers, key_code;
11656 {
11657 UInt32 char_code;
11658 unsigned long some_state = 0;
11659 Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
11660 int c, emacs_modifiers;
11661
11662 /* Mask off modifier keys that are mapped to some Emacs modifiers. */
11663 key_code |= (modifiers & ~(mac_mapped_modifiers (modifiers)));
11664 char_code = KeyTranslate (kchr_ptr, key_code, &some_state);
11665 if (char_code & ~0xff)
11666 return 0;
11667
11668 emacs_modifiers = mac_to_emacs_modifiers (modifiers);
11669 if (emacs_modifiers & ctrl_modifier)
11670 c = make_ctrl_char (char_code);
11671
11672 c |= (emacs_modifiers
11673 & (meta_modifier | alt_modifier
11674 | hyper_modifier | super_modifier));
11675
11676 return c == quit_char;
11677 } 11653 }
11678 #endif /* MAC_OSX */ 11654 #endif /* MAC_OSX */
11679 11655
11680 static void 11656 static void
11681 init_menu_bar () 11657 init_menu_bar ()