aboutsummaryrefslogtreecommitdiffstats
path: root/src/macterm.c
diff options
context:
space:
mode:
authorMiles Bader2006-06-17 20:57:37 +0000
committerMiles Bader2006-06-17 20:57:37 +0000
commit10c1758c0b2d29b3e1fb8e3ffe5c5dc262f25217 (patch)
tree78d2db4ab91026e7d5373086d022a2bce083200b /src/macterm.c
parent2090e2a3897bd0e36fd0e8ba13d861668a0a887f (diff)
parentf362b76002bfd0f43af76a7772a808c042302f07 (diff)
downloademacs-10c1758c0b2d29b3e1fb8e3ffe5c5dc262f25217.tar.gz
emacs-10c1758c0b2d29b3e1fb8e3ffe5c5dc262f25217.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 300-313) - Update from CVS - Update from CVS: lispref/display.texi (Forcing Redisplay): Fix typo. - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 105-106) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-74
Diffstat (limited to 'src/macterm.c')
-rw-r--r--src/macterm.c141
1 files changed, 104 insertions, 37 deletions
diff --git a/src/macterm.c b/src/macterm.c
index dc449498a4a..7e354642759 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -8533,6 +8533,9 @@ static Lisp_Object Qtext_input;
8533static Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event; 8533static Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event;
8534static Lisp_Object Vmac_ts_active_input_overlay; 8534static Lisp_Object Vmac_ts_active_input_overlay;
8535extern Lisp_Object Qbefore_string; 8535extern Lisp_Object Qbefore_string;
8536static Lisp_Object Vmac_ts_script_language_on_focus;
8537static ScriptLanguageRecord saved_ts_language;
8538static Component saved_ts_component;
8536#endif 8539#endif
8537#endif 8540#endif
8538extern int mac_ready_for_apple_events; 8541extern int mac_ready_for_apple_events;
@@ -8882,22 +8885,84 @@ is_emacs_window (WindowPtr win)
8882 return 0; 8885 return 0;
8883} 8886}
8884 8887
8885static void
8886do_app_resume ()
8887{
8888#if USE_MAC_TSM 8888#if USE_MAC_TSM
8889 ActivateTSMDocument (tsm_document_id); 8889static OSStatus
8890mac_tsm_resume ()
8891{
8892 OSStatus err;
8893 ScriptLanguageRecord slrec, *slptr = NULL;
8894
8895 err = ActivateTSMDocument (tsm_document_id);
8896
8897 if (err == noErr)
8898 {
8899 if (EQ (Vmac_ts_script_language_on_focus, Qt))
8900 slptr = &saved_ts_language;
8901 else if (CONSP (Vmac_ts_script_language_on_focus)
8902 && INTEGERP (XCAR (Vmac_ts_script_language_on_focus))
8903 && INTEGERP (XCDR (Vmac_ts_script_language_on_focus)))
8904 {
8905 slrec.fScript = XINT (XCAR (Vmac_ts_script_language_on_focus));
8906 slrec.fLanguage = XINT (XCDR (Vmac_ts_script_language_on_focus));
8907 slptr = &slrec;
8908 }
8909 }
8910
8911 if (slptr)
8912 {
8913#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
8914 err = SetDefaultInputMethodOfClass (saved_ts_component, slptr,
8915 kKeyboardInputMethodClass);
8916#else
8917 err = SetDefaultInputMethod (saved_ts_component, slptr);
8890#endif 8918#endif
8919 if (err == noErr)
8920 err = SetTextServiceLanguage (slptr);
8921
8922 /* Seems to be needed on Mac OS X 10.2. */
8923 if (err == noErr)
8924 KeyScript (slptr->fScript | smKeyForceKeyScriptMask);
8925 }
8926
8927 return err;
8891} 8928}
8892 8929
8893static void 8930static OSStatus
8894do_app_suspend () 8931mac_tsm_suspend ()
8895{ 8932{
8896#if USE_MAC_TSM 8933 OSStatus err;
8897 DeactivateTSMDocument (tsm_document_id); 8934 ScriptLanguageRecord slrec, *slptr = NULL;
8935
8936 if (EQ (Vmac_ts_script_language_on_focus, Qt))
8937 {
8938 err = GetTextServiceLanguage (&saved_ts_language);
8939 if (err == noErr)
8940 slptr = &saved_ts_language;
8941 }
8942 else if (CONSP (Vmac_ts_script_language_on_focus)
8943 && INTEGERP (XCAR (Vmac_ts_script_language_on_focus))
8944 && INTEGERP (XCDR (Vmac_ts_script_language_on_focus)))
8945 {
8946 slrec.fScript = XINT (XCAR (Vmac_ts_script_language_on_focus));
8947 slrec.fLanguage = XINT (XCDR (Vmac_ts_script_language_on_focus));
8948 slptr = &slrec;
8949 }
8950
8951 if (slptr)
8952 {
8953#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
8954 GetDefaultInputMethodOfClass (&saved_ts_component, slptr,
8955 kKeyboardInputMethodClass);
8956#else
8957 GetDefaultInputMethod (&saved_ts_component, slptr);
8898#endif 8958#endif
8899} 8959 }
8900 8960
8961 err = DeactivateTSMDocument (tsm_document_id);
8962
8963 return err;
8964}
8965#endif
8901 8966
8902static void 8967static void
8903do_apple_menu (SInt16 menu_item) 8968do_apple_menu (SInt16 menu_item)
@@ -9351,12 +9416,12 @@ mac_handle_window_event (next_handler, event, data)
9351#if USE_MAC_TSM 9416#if USE_MAC_TSM
9352 case kEventWindowFocusAcquired: 9417 case kEventWindowFocusAcquired:
9353 result = CallNextEventHandler (next_handler, event); 9418 result = CallNextEventHandler (next_handler, event);
9354 err = ActivateTSMDocument (tsm_document_id); 9419 err = mac_tsm_resume ();
9355 return err == noErr ? noErr : result; 9420 return err == noErr ? noErr : result;
9356 9421
9357 case kEventWindowFocusRelinquish: 9422 case kEventWindowFocusRelinquish:
9358 result = CallNextEventHandler (next_handler, event); 9423 result = CallNextEventHandler (next_handler, event);
9359 err = DeactivateTSMDocument (tsm_document_id); 9424 err = mac_tsm_suspend ();
9360 return err == noErr ? noErr : result; 9425 return err == noErr ? noErr : result;
9361#endif 9426#endif
9362 } 9427 }
@@ -10391,10 +10456,12 @@ XTread_socket (sd, expected, hold_quit)
10391 switch ((er.message >> 24) & 0x000000FF) 10456 switch ((er.message >> 24) & 0x000000FF)
10392 { 10457 {
10393 case suspendResumeMessage: 10458 case suspendResumeMessage:
10394 if ((er.message & resumeFlag) == 1) 10459#if USE_MAC_TSM
10395 do_app_resume (); 10460 if (er.message & resumeFlag)
10461 mac_tsm_resume ();
10396 else 10462 else
10397 do_app_suspend (); 10463 mac_tsm_suspend ();
10464#endif
10398 break; 10465 break;
10399 10466
10400 case mouseMovedMessage: 10467 case mouseMovedMessage:
@@ -10957,7 +11024,6 @@ void
10957mac_initialize_display_info () 11024mac_initialize_display_info ()
10958{ 11025{
10959 struct mac_display_info *dpyinfo = &one_mac_display_info; 11026 struct mac_display_info *dpyinfo = &one_mac_display_info;
10960 GDHandle main_device_handle;
10961 11027
10962 bzero (dpyinfo, sizeof (*dpyinfo)); 11028 bzero (dpyinfo, sizeof (*dpyinfo));
10963 11029
@@ -10973,37 +11039,29 @@ mac_initialize_display_info ()
10973 strcpy (dpyinfo->mac_id_name, "Mac Display"); 11039 strcpy (dpyinfo->mac_id_name, "Mac Display");
10974#endif 11040#endif
10975 11041
10976 main_device_handle = LMGetMainDevice();
10977
10978 dpyinfo->reference_count = 0; 11042 dpyinfo->reference_count = 0;
10979 dpyinfo->resx = 72.0; 11043 dpyinfo->resx = 72.0;
10980 dpyinfo->resy = 72.0; 11044 dpyinfo->resy = 72.0;
10981 dpyinfo->color_p = TestDeviceAttribute (main_device_handle, gdDevType);
10982#ifdef MAC_OSX 11045#ifdef MAC_OSX
10983 /* HasDepth returns true if it is possible to have a 32 bit display, 11046 /* HasDepth returns true if it is possible to have a 32 bit display,
10984 but this may not be what is actually used. Mac OSX can do better. 11047 but this may not be what is actually used. Mac OSX can do better. */
10985 CGMainDisplayID is only available on OSX 10.2 and higher, but the 11048 dpyinfo->color_p = 1;
10986 header for CGGetActiveDisplayList says that the first display returned 11049 dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay);
10987 is the active one, so we use that. */ 11050 dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay);
11051 dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay);
11052#else
10988 { 11053 {
10989 CGDirectDisplayID disp_id[1]; 11054 GDHandle main_device_handle = LMGetMainDevice();
10990 CGDisplayCount disp_count;
10991 CGDisplayErr error_code;
10992
10993 error_code = CGGetActiveDisplayList (1, disp_id, &disp_count);
10994 if (error_code != 0)
10995 error ("No display found, CGGetActiveDisplayList error %d", error_code);
10996 11055
10997 dpyinfo->n_planes = CGDisplayBitsPerPixel (disp_id[0]); 11056 dpyinfo->color_p = TestDeviceAttribute (main_device_handle, gdDevType);
11057 for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1)
11058 if (HasDepth (main_device_handle, dpyinfo->n_planes,
11059 gdDevType, dpyinfo->color_p))
11060 break;
11061 dpyinfo->height = (**main_device_handle).gdRect.bottom;
11062 dpyinfo->width = (**main_device_handle).gdRect.right;
10998 } 11063 }
10999#else
11000 for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1)
11001 if (HasDepth (main_device_handle, dpyinfo->n_planes,
11002 gdDevType, dpyinfo->color_p))
11003 break;
11004#endif 11064#endif
11005 dpyinfo->height = (**main_device_handle).gdRect.bottom;
11006 dpyinfo->width = (**main_device_handle).gdRect.right;
11007 dpyinfo->grabbed = 0; 11065 dpyinfo->grabbed = 0;
11008 dpyinfo->root_window = NULL; 11066 dpyinfo->root_window = NULL;
11009 dpyinfo->image_cache = make_image_cache (); 11067 dpyinfo->image_cache = make_image_cache ();
@@ -11554,6 +11612,15 @@ order. */);
11554 DEFVAR_LISP ("mac-ts-active-input-overlay", &Vmac_ts_active_input_overlay, 11612 DEFVAR_LISP ("mac-ts-active-input-overlay", &Vmac_ts_active_input_overlay,
11555 doc: /* Overlay used to display Mac TSM active input area. */); 11613 doc: /* Overlay used to display Mac TSM active input area. */);
11556 Vmac_ts_active_input_overlay = Qnil; 11614 Vmac_ts_active_input_overlay = Qnil;
11615
11616 DEFVAR_LISP ("mac-ts-script-language-on-focus", &Vmac_ts_script_language_on_focus,
11617 doc: /* *How to change Mac TSM script/language when a frame gets focus.
11618If the value is t, the input script and language are restored to those
11619used in the last focus frame. If the value is a pair of integers, the
11620input script and language codes, which are defined in the Script
11621Manager, are set to its car and cdr parts, respectively. Otherwise,
11622Emacs doesn't set them and thus follows the system default behavior. */);
11623 Vmac_ts_script_language_on_focus = Qnil;
11557#endif 11624#endif
11558} 11625}
11559 11626