aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2007-01-12 09:00:24 +0000
committerYAMAMOTO Mitsuharu2007-01-12 09:00:24 +0000
commitc857519ff4b1c72e69271ac1d3285adbd155eaa6 (patch)
treef85a91103f50dab77a3c7fac314d66c20bc924ea
parent28eabd14f72716b1def66114f18023891b534906 (diff)
downloademacs-c857519ff4b1c72e69271ac1d3285adbd155eaa6.tar.gz
emacs-c857519ff4b1c72e69271ac1d3285adbd155eaa6.zip
(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.
-rw-r--r--src/macterm.c94
1 files changed, 35 insertions, 59 deletions
diff --git a/src/macterm.c b/src/macterm.c
index 50943463e15..b09a83d7b2b 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -6572,6 +6572,9 @@ x_free_frame_resources (f)
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
@@ -9052,6 +9055,38 @@ mac_get_emulated_btn ( UInt32 modifiers )
9052 return result; 9055 return result;
9053} 9056}
9054 9057
9058#if TARGET_API_MAC_CARBON
9059/***** Code to handle C-g testing *****/
9060extern int quit_char;
9061extern int make_ctrl_char P_ ((int));
9062
9063int
9064mac_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. */
@@ -11607,35 +11642,6 @@ x_delete_display (dpyinfo)
11607 11642
11608#ifdef MAC_OSX 11643#ifdef MAC_OSX
11609void 11644void
11610mac_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
11638void
11639MakeMeTheFrontProcess () 11645MakeMeTheFrontProcess ()
11640{ 11646{
11641 ProcessSerialNumber psn; 11647 ProcessSerialNumber psn;
@@ -11645,36 +11651,6 @@ MakeMeTheFrontProcess ()
11645 if (err == noErr) 11651 if (err == noErr)
11646 (void) SetFrontProcess (&psn); 11652 (void) SetFrontProcess (&psn);
11647} 11653}
11648
11649/***** Code to handle C-g testing *****/
11650extern int quit_char;
11651extern int make_ctrl_char P_ ((int));
11652
11653int
11654mac_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}
11678#endif /* MAC_OSX */ 11654#endif /* MAC_OSX */
11679 11655
11680static void 11656static void