diff options
| author | YAMAMOTO Mitsuharu | 2006-06-28 08:31:32 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2006-06-28 08:31:32 +0000 |
| commit | 92289429a92d99d05569df6898332d07943c12ce (patch) | |
| tree | 4ffffbf24bd20b7fd49a0fcf9c8a62dff797a3ea /src | |
| parent | bc0e84127000d1743cd22eda6602c75e3994c035 (diff) | |
| download | emacs-92289429a92d99d05569df6898332d07943c12ce.tar.gz emacs-92289429a92d99d05569df6898332d07943c12ce.zip | |
(Qeql): Add extern.
(x_set_mouse_pixel_position) [MAC_OSX]: Use CGWarpMouseCursorPosition.
(fm_style_face_attributes_alist) [USE_ATSUI]: New variable.
(syms_of_macterm) [USE_ATSUI]: Initialize and staticpro it.
Change keys of Vmac_atsu_font_table from strings to numbers.
(fm_style_to_face_attributes) [USE_ATSUI]: New function.
(init_font_name_table) [USE_ATSUI]: Use it.
(saved_ts_script_language_on_focus) [USE_MAC_TSM]: New variable.
(syms_of_macterm) [USE_MAC_TSM]: Initialize and staticpro it.
[USE_MAC_TSM] (mac_tsm_resume): Restore script and language codes
only when saved_ts_script_language_on_focus coincides with
Vmac_ts_script_language_on_focus.
[USE_MAC_TSM] (mac_tsm_suspend): Save value of
Vmac_ts_script_language_on_focus to saved_ts_script_language_on_focus.
(XTread_socket) [USE_MAC_TSM]: Add Mac OS Classic support.
[USE_MAC_TSM] (mac_handle_text_input_event, init_tsm): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/macterm.c | 93 |
1 files changed, 78 insertions, 15 deletions
diff --git a/src/macterm.c b/src/macterm.c index e1fc7dbff66..0b6c0fca31c 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -196,6 +196,8 @@ static int input_signal_count; | |||
| 196 | 196 | ||
| 197 | extern Lisp_Object Vsystem_name; | 197 | extern Lisp_Object Vsystem_name; |
| 198 | 198 | ||
| 199 | extern Lisp_Object Qeql; | ||
| 200 | |||
| 199 | /* A mask of extra modifier bits to put into every keyboard char. */ | 201 | /* A mask of extra modifier bits to put into every keyboard char. */ |
| 200 | 202 | ||
| 201 | extern EMACS_INT extra_keyboard_modifiers; | 203 | extern EMACS_INT extra_keyboard_modifiers; |
| @@ -6031,13 +6033,28 @@ x_set_mouse_pixel_position (f, pix_x, pix_y) | |||
| 6031 | struct frame *f; | 6033 | struct frame *f; |
| 6032 | int pix_x, pix_y; | 6034 | int pix_x, pix_y; |
| 6033 | { | 6035 | { |
| 6034 | #if 0 /* MAC_TODO: CursorDeviceMoveTo is non-Carbon */ | 6036 | #ifdef MAC_OSX |
| 6037 | Point p; | ||
| 6038 | CGPoint point; | ||
| 6039 | |||
| 6040 | BLOCK_INPUT; | ||
| 6041 | SetPortWindowPort (FRAME_MAC_WINDOW (f)); | ||
| 6042 | p.h = pix_x; | ||
| 6043 | p.v = pix_y; | ||
| 6044 | LocalToGlobal (&p); | ||
| 6045 | point.x = p.h; | ||
| 6046 | point.y = p.v; | ||
| 6047 | CGWarpMouseCursorPosition (point); | ||
| 6048 | UNBLOCK_INPUT; | ||
| 6049 | #else | ||
| 6050 | #if 0 /* MAC_TODO: LMSetMouseLocation and CursorDeviceMoveTo are non-Carbon */ | ||
| 6035 | BLOCK_INPUT; | 6051 | BLOCK_INPUT; |
| 6036 | 6052 | ||
| 6037 | XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), | 6053 | XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), |
| 6038 | 0, 0, 0, 0, pix_x, pix_y); | 6054 | 0, 0, 0, 0, pix_x, pix_y); |
| 6039 | UNBLOCK_INPUT; | 6055 | UNBLOCK_INPUT; |
| 6040 | #endif | 6056 | #endif |
| 6057 | #endif | ||
| 6041 | } | 6058 | } |
| 6042 | 6059 | ||
| 6043 | /* focus shifting, raising and lowering. */ | 6060 | /* focus shifting, raising and lowering. */ |
| @@ -6897,6 +6914,8 @@ static Lisp_Object fm_font_family_alist; | |||
| 6897 | #if USE_ATSUI | 6914 | #if USE_ATSUI |
| 6898 | /* Hash table linking font family names to ATSU font IDs. */ | 6915 | /* Hash table linking font family names to ATSU font IDs. */ |
| 6899 | static Lisp_Object atsu_font_id_hash; | 6916 | static Lisp_Object atsu_font_id_hash; |
| 6917 | /* Alist linking Font Manager style to face attributes. */ | ||
| 6918 | static Lisp_Object fm_style_face_attributes_alist; | ||
| 6900 | static Lisp_Object Vmac_atsu_font_table; | 6919 | static Lisp_Object Vmac_atsu_font_table; |
| 6901 | extern Lisp_Object QCfamily, QCweight, QCslant, Qnormal, Qbold, Qitalic; | 6920 | extern Lisp_Object QCfamily, QCweight, QCslant, Qnormal, Qbold, Qitalic; |
| 6902 | #endif | 6921 | #endif |
| @@ -7132,6 +7151,29 @@ add_mac_font_name (name, size, style, charset) | |||
| 7132 | } | 7151 | } |
| 7133 | } | 7152 | } |
| 7134 | 7153 | ||
| 7154 | #if USE_ATSUI | ||
| 7155 | static Lisp_Object | ||
| 7156 | fm_style_to_face_attributes (fm_style) | ||
| 7157 | FMFontStyle fm_style; | ||
| 7158 | { | ||
| 7159 | Lisp_Object tem; | ||
| 7160 | |||
| 7161 | fm_style &= (bold | italic); | ||
| 7162 | tem = assq_no_quit (make_number (fm_style), | ||
| 7163 | fm_style_face_attributes_alist); | ||
| 7164 | if (!NILP (tem)) | ||
| 7165 | return XCDR (tem); | ||
| 7166 | |||
| 7167 | tem = list4 (QCweight, fm_style & bold ? Qbold : Qnormal, | ||
| 7168 | QCslant, fm_style & italic ? Qitalic : Qnormal); | ||
| 7169 | fm_style_face_attributes_alist = | ||
| 7170 | Fcons (Fcons (make_number (fm_style), tem), | ||
| 7171 | fm_style_face_attributes_alist); | ||
| 7172 | |||
| 7173 | return tem; | ||
| 7174 | } | ||
| 7175 | #endif | ||
| 7176 | |||
| 7135 | /* Sets up the table font_name_table to contain the list of all fonts | 7177 | /* Sets up the table font_name_table to contain the list of all fonts |
| 7136 | in the system the first time the table is used so that the Resource | 7178 | in the system the first time the table is used so that the Resource |
| 7137 | Manager need not be accessed every time this information is | 7179 | Manager need not be accessed every time this information is |
| @@ -7200,14 +7242,12 @@ init_font_name_table () | |||
| 7200 | decode_mac_font_name (name, name_len + 1, Qnil); | 7242 | decode_mac_font_name (name, name_len + 1, Qnil); |
| 7201 | family = make_unibyte_string (name, name_len); | 7243 | family = make_unibyte_string (name, name_len); |
| 7202 | FMGetFontFamilyInstanceFromFont (font_ids[i], &ff, &style); | 7244 | FMGetFontFamilyInstanceFromFont (font_ids[i], &ff, &style); |
| 7203 | Fputhash (make_unibyte_string ((char *)(font_ids + i), | 7245 | Fputhash ((font_ids[i] > MOST_POSITIVE_FIXNUM |
| 7204 | sizeof (ATSUFontID)), | 7246 | ? make_float (font_ids[i]) |
| 7247 | : make_number (font_ids[i])), | ||
| 7205 | Fcons (QCfamily, | 7248 | Fcons (QCfamily, |
| 7206 | list5 (family, | 7249 | Fcons (family, |
| 7207 | QCweight, | 7250 | fm_style_to_face_attributes (style))), |
| 7208 | style & bold ? Qbold : Qnormal, | ||
| 7209 | QCslant, | ||
| 7210 | style & italic ? Qitalic : Qnormal)), | ||
| 7211 | Vmac_atsu_font_table); | 7251 | Vmac_atsu_font_table); |
| 7212 | if (*name != '.' | 7252 | if (*name != '.' |
| 7213 | && hash_lookup (h, family, &hash_code) < 0) | 7253 | && hash_lookup (h, family, &hash_code) < 0) |
| @@ -8513,6 +8553,7 @@ static Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event; | |||
| 8513 | static Lisp_Object Vmac_ts_active_input_overlay; | 8553 | static Lisp_Object Vmac_ts_active_input_overlay; |
| 8514 | extern Lisp_Object Qbefore_string; | 8554 | extern Lisp_Object Qbefore_string; |
| 8515 | static Lisp_Object Vmac_ts_script_language_on_focus; | 8555 | static Lisp_Object Vmac_ts_script_language_on_focus; |
| 8556 | static Lisp_Object saved_ts_script_language_on_focus; | ||
| 8516 | static ScriptLanguageRecord saved_ts_language; | 8557 | static ScriptLanguageRecord saved_ts_language; |
| 8517 | static Component saved_ts_component; | 8558 | static Component saved_ts_component; |
| 8518 | #endif | 8559 | #endif |
| @@ -8875,11 +8916,17 @@ mac_tsm_resume () | |||
| 8875 | 8916 | ||
| 8876 | if (err == noErr) | 8917 | if (err == noErr) |
| 8877 | { | 8918 | { |
| 8878 | if (EQ (Vmac_ts_script_language_on_focus, Qt)) | 8919 | if (EQ (Vmac_ts_script_language_on_focus, Qt) |
| 8920 | && EQ (saved_ts_script_language_on_focus, Qt)) | ||
| 8879 | slptr = &saved_ts_language; | 8921 | slptr = &saved_ts_language; |
| 8880 | else if (CONSP (Vmac_ts_script_language_on_focus) | 8922 | else if (CONSP (Vmac_ts_script_language_on_focus) |
| 8881 | && INTEGERP (XCAR (Vmac_ts_script_language_on_focus)) | 8923 | && INTEGERP (XCAR (Vmac_ts_script_language_on_focus)) |
| 8882 | && INTEGERP (XCDR (Vmac_ts_script_language_on_focus))) | 8924 | && INTEGERP (XCDR (Vmac_ts_script_language_on_focus)) |
| 8925 | && CONSP (saved_ts_script_language_on_focus) | ||
| 8926 | && EQ (XCAR (saved_ts_script_language_on_focus), | ||
| 8927 | XCAR (Vmac_ts_script_language_on_focus)) | ||
| 8928 | && EQ (XCDR (saved_ts_script_language_on_focus), | ||
| 8929 | XCDR (Vmac_ts_script_language_on_focus))) | ||
| 8883 | { | 8930 | { |
| 8884 | slrec.fScript = XINT (XCAR (Vmac_ts_script_language_on_focus)); | 8931 | slrec.fScript = XINT (XCAR (Vmac_ts_script_language_on_focus)); |
| 8885 | slrec.fLanguage = XINT (XCDR (Vmac_ts_script_language_on_focus)); | 8932 | slrec.fLanguage = XINT (XCDR (Vmac_ts_script_language_on_focus)); |
| @@ -8912,6 +8959,8 @@ mac_tsm_suspend () | |||
| 8912 | OSStatus err; | 8959 | OSStatus err; |
| 8913 | ScriptLanguageRecord slrec, *slptr = NULL; | 8960 | ScriptLanguageRecord slrec, *slptr = NULL; |
| 8914 | 8961 | ||
| 8962 | saved_ts_script_language_on_focus = Vmac_ts_script_language_on_focus; | ||
| 8963 | |||
| 8915 | if (EQ (Vmac_ts_script_language_on_focus, Qt)) | 8964 | if (EQ (Vmac_ts_script_language_on_focus, Qt)) |
| 8916 | { | 8965 | { |
| 8917 | err = GetTextServiceLanguage (&saved_ts_language); | 8966 | err = GetTextServiceLanguage (&saved_ts_language); |
| @@ -9560,7 +9609,11 @@ mac_handle_text_input_event (next_handler, event, data) | |||
| 9560 | typeLongInteger, | 9609 | typeLongInteger, |
| 9561 | typeIntlWritingCode, | 9610 | typeIntlWritingCode, |
| 9562 | typeLongInteger, | 9611 | typeLongInteger, |
| 9612 | #ifdef MAC_OSX | ||
| 9563 | typeUnicodeText, | 9613 | typeUnicodeText, |
| 9614 | #else | ||
| 9615 | typeChar, | ||
| 9616 | #endif | ||
| 9564 | typeTextRangeArray, | 9617 | typeTextRangeArray, |
| 9565 | typeTextRangeArray, | 9618 | typeTextRangeArray, |
| 9566 | typeOffsetArray, | 9619 | typeOffsetArray, |
| @@ -10646,7 +10699,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10646 | #endif | 10699 | #endif |
| 10647 | mapped_modifiers &= modifiers; | 10700 | mapped_modifiers &= modifiers; |
| 10648 | 10701 | ||
| 10649 | #if USE_CARBON_EVENTS && defined (MAC_OSX) | 10702 | #if USE_CARBON_EVENTS && (defined (MAC_OSX) || USE_MAC_TSM) |
| 10650 | /* When using Carbon Events, we need to pass raw keyboard | 10703 | /* When using Carbon Events, we need to pass raw keyboard |
| 10651 | events to the TSM ourselves. If TSM handles it, it | 10704 | events to the TSM ourselves. If TSM handles it, it |
| 10652 | will pass back noErr, otherwise it will pass back | 10705 | will pass back noErr, otherwise it will pass back |
| @@ -11302,7 +11355,11 @@ init_menu_bar () | |||
| 11302 | static void | 11355 | static void |
| 11303 | init_tsm () | 11356 | init_tsm () |
| 11304 | { | 11357 | { |
| 11358 | #ifdef MAC_OSX | ||
| 11305 | static InterfaceTypeList types = {kUnicodeDocument}; | 11359 | static InterfaceTypeList types = {kUnicodeDocument}; |
| 11360 | #else | ||
| 11361 | static InterfaceTypeList types = {kTextService}; | ||
| 11362 | #endif | ||
| 11306 | 11363 | ||
| 11307 | NewTSMDocument (sizeof (types) / sizeof (types[0]), types, | 11364 | NewTSMDocument (sizeof (types) / sizeof (types[0]), types, |
| 11308 | &tsm_document_id, 0); | 11365 | &tsm_document_id, 0); |
| @@ -11490,6 +11547,14 @@ syms_of_macterm () | |||
| 11490 | #if USE_ATSUI | 11547 | #if USE_ATSUI |
| 11491 | staticpro (&atsu_font_id_hash); | 11548 | staticpro (&atsu_font_id_hash); |
| 11492 | atsu_font_id_hash = Qnil; | 11549 | atsu_font_id_hash = Qnil; |
| 11550 | |||
| 11551 | staticpro (&fm_style_face_attributes_alist); | ||
| 11552 | fm_style_face_attributes_alist = Qnil; | ||
| 11553 | #endif | ||
| 11554 | |||
| 11555 | #if USE_MAC_TSM | ||
| 11556 | staticpro (&saved_ts_script_language_on_focus); | ||
| 11557 | saved_ts_script_language_on_focus = Qnil; | ||
| 11493 | #endif | 11558 | #endif |
| 11494 | 11559 | ||
| 11495 | /* We don't yet support this, but defining this here avoids whining | 11560 | /* We don't yet support this, but defining this here avoids whining |
| @@ -11602,11 +11667,9 @@ CODING_SYSTEM is a coding system corresponding to TEXT-ENCODING. */); | |||
| 11602 | 11667 | ||
| 11603 | #if USE_ATSUI | 11668 | #if USE_ATSUI |
| 11604 | DEFVAR_LISP ("mac-atsu-font-table", &Vmac_atsu_font_table, | 11669 | DEFVAR_LISP ("mac-atsu-font-table", &Vmac_atsu_font_table, |
| 11605 | doc: /* Hash table of ATSU font IDs vs plist of attributes and values. | 11670 | doc: /* Hash table of ATSU font IDs vs plist of attributes and values. */); |
| 11606 | Each font ID is represented as a four-byte string in native byte | ||
| 11607 | order. */); | ||
| 11608 | Vmac_atsu_font_table = | 11671 | Vmac_atsu_font_table = |
| 11609 | make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), | 11672 | make_hash_table (Qeql, make_number (DEFAULT_HASH_SIZE), |
| 11610 | make_float (DEFAULT_REHASH_SIZE), | 11673 | make_float (DEFAULT_REHASH_SIZE), |
| 11611 | make_float (DEFAULT_REHASH_THRESHOLD), | 11674 | make_float (DEFAULT_REHASH_THRESHOLD), |
| 11612 | Qnil, Qnil, Qnil); | 11675 | Qnil, Qnil, Qnil); |