aboutsummaryrefslogtreecommitdiffstats
path: root/src/macterm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/macterm.c')
-rw-r--r--src/macterm.c93
1 files changed, 78 insertions, 15 deletions
diff --git a/src/macterm.c b/src/macterm.c
index 7e354642759..a6fc6b1a497 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -198,6 +198,8 @@ static int input_signal_count;
198 198
199extern Lisp_Object Vsystem_name; 199extern Lisp_Object Vsystem_name;
200 200
201extern Lisp_Object Qeql;
202
201/* A mask of extra modifier bits to put into every keyboard char. */ 203/* A mask of extra modifier bits to put into every keyboard char. */
202 204
203extern EMACS_INT extra_keyboard_modifiers; 205extern EMACS_INT extra_keyboard_modifiers;
@@ -6050,13 +6052,28 @@ x_set_mouse_pixel_position (f, pix_x, pix_y)
6050 struct frame *f; 6052 struct frame *f;
6051 int pix_x, pix_y; 6053 int pix_x, pix_y;
6052{ 6054{
6053#if 0 /* MAC_TODO: CursorDeviceMoveTo is non-Carbon */ 6055#ifdef MAC_OSX
6056 Point p;
6057 CGPoint point;
6058
6059 BLOCK_INPUT;
6060 SetPortWindowPort (FRAME_MAC_WINDOW (f));
6061 p.h = pix_x;
6062 p.v = pix_y;
6063 LocalToGlobal (&p);
6064 point.x = p.h;
6065 point.y = p.v;
6066 CGWarpMouseCursorPosition (point);
6067 UNBLOCK_INPUT;
6068#else
6069#if 0 /* MAC_TODO: LMSetMouseLocation and CursorDeviceMoveTo are non-Carbon */
6054 BLOCK_INPUT; 6070 BLOCK_INPUT;
6055 6071
6056 XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), 6072 XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f),
6057 0, 0, 0, 0, pix_x, pix_y); 6073 0, 0, 0, 0, pix_x, pix_y);
6058 UNBLOCK_INPUT; 6074 UNBLOCK_INPUT;
6059#endif 6075#endif
6076#endif
6060} 6077}
6061 6078
6062/* focus shifting, raising and lowering. */ 6079/* focus shifting, raising and lowering. */
@@ -6916,6 +6933,8 @@ static Lisp_Object fm_font_family_alist;
6916#if USE_ATSUI 6933#if USE_ATSUI
6917/* Hash table linking font family names to ATSU font IDs. */ 6934/* Hash table linking font family names to ATSU font IDs. */
6918static Lisp_Object atsu_font_id_hash; 6935static Lisp_Object atsu_font_id_hash;
6936/* Alist linking Font Manager style to face attributes. */
6937static Lisp_Object fm_style_face_attributes_alist;
6919static Lisp_Object Vmac_atsu_font_table; 6938static Lisp_Object Vmac_atsu_font_table;
6920extern Lisp_Object QCfamily, QCweight, QCslant, Qnormal, Qbold, Qitalic; 6939extern Lisp_Object QCfamily, QCweight, QCslant, Qnormal, Qbold, Qitalic;
6921#endif 6940#endif
@@ -7151,6 +7170,29 @@ add_mac_font_name (name, size, style, charset)
7151 } 7170 }
7152} 7171}
7153 7172
7173#if USE_ATSUI
7174static Lisp_Object
7175fm_style_to_face_attributes (fm_style)
7176 FMFontStyle fm_style;
7177{
7178 Lisp_Object tem;
7179
7180 fm_style &= (bold | italic);
7181 tem = assq_no_quit (make_number (fm_style),
7182 fm_style_face_attributes_alist);
7183 if (!NILP (tem))
7184 return XCDR (tem);
7185
7186 tem = list4 (QCweight, fm_style & bold ? Qbold : Qnormal,
7187 QCslant, fm_style & italic ? Qitalic : Qnormal);
7188 fm_style_face_attributes_alist =
7189 Fcons (Fcons (make_number (fm_style), tem),
7190 fm_style_face_attributes_alist);
7191
7192 return tem;
7193}
7194#endif
7195
7154/* Sets up the table font_name_table to contain the list of all fonts 7196/* Sets up the table font_name_table to contain the list of all fonts
7155 in the system the first time the table is used so that the Resource 7197 in the system the first time the table is used so that the Resource
7156 Manager need not be accessed every time this information is 7198 Manager need not be accessed every time this information is
@@ -7219,14 +7261,12 @@ init_font_name_table ()
7219 decode_mac_font_name (name, name_len + 1, Qnil); 7261 decode_mac_font_name (name, name_len + 1, Qnil);
7220 family = make_unibyte_string (name, name_len); 7262 family = make_unibyte_string (name, name_len);
7221 FMGetFontFamilyInstanceFromFont (font_ids[i], &ff, &style); 7263 FMGetFontFamilyInstanceFromFont (font_ids[i], &ff, &style);
7222 Fputhash (make_unibyte_string ((char *)(font_ids + i), 7264 Fputhash ((font_ids[i] > MOST_POSITIVE_FIXNUM
7223 sizeof (ATSUFontID)), 7265 ? make_float (font_ids[i])
7266 : make_number (font_ids[i])),
7224 Fcons (QCfamily, 7267 Fcons (QCfamily,
7225 list5 (family, 7268 Fcons (family,
7226 QCweight, 7269 fm_style_to_face_attributes (style))),
7227 style & bold ? Qbold : Qnormal,
7228 QCslant,
7229 style & italic ? Qitalic : Qnormal)),
7230 Vmac_atsu_font_table); 7270 Vmac_atsu_font_table);
7231 if (*name != '.' 7271 if (*name != '.'
7232 && hash_lookup (h, family, &hash_code) < 0) 7272 && hash_lookup (h, family, &hash_code) < 0)
@@ -8534,6 +8574,7 @@ static Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event;
8534static Lisp_Object Vmac_ts_active_input_overlay; 8574static Lisp_Object Vmac_ts_active_input_overlay;
8535extern Lisp_Object Qbefore_string; 8575extern Lisp_Object Qbefore_string;
8536static Lisp_Object Vmac_ts_script_language_on_focus; 8576static Lisp_Object Vmac_ts_script_language_on_focus;
8577static Lisp_Object saved_ts_script_language_on_focus;
8537static ScriptLanguageRecord saved_ts_language; 8578static ScriptLanguageRecord saved_ts_language;
8538static Component saved_ts_component; 8579static Component saved_ts_component;
8539#endif 8580#endif
@@ -8896,11 +8937,17 @@ mac_tsm_resume ()
8896 8937
8897 if (err == noErr) 8938 if (err == noErr)
8898 { 8939 {
8899 if (EQ (Vmac_ts_script_language_on_focus, Qt)) 8940 if (EQ (Vmac_ts_script_language_on_focus, Qt)
8941 && EQ (saved_ts_script_language_on_focus, Qt))
8900 slptr = &saved_ts_language; 8942 slptr = &saved_ts_language;
8901 else if (CONSP (Vmac_ts_script_language_on_focus) 8943 else if (CONSP (Vmac_ts_script_language_on_focus)
8902 && INTEGERP (XCAR (Vmac_ts_script_language_on_focus)) 8944 && INTEGERP (XCAR (Vmac_ts_script_language_on_focus))
8903 && INTEGERP (XCDR (Vmac_ts_script_language_on_focus))) 8945 && INTEGERP (XCDR (Vmac_ts_script_language_on_focus))
8946 && CONSP (saved_ts_script_language_on_focus)
8947 && EQ (XCAR (saved_ts_script_language_on_focus),
8948 XCAR (Vmac_ts_script_language_on_focus))
8949 && EQ (XCDR (saved_ts_script_language_on_focus),
8950 XCDR (Vmac_ts_script_language_on_focus)))
8904 { 8951 {
8905 slrec.fScript = XINT (XCAR (Vmac_ts_script_language_on_focus)); 8952 slrec.fScript = XINT (XCAR (Vmac_ts_script_language_on_focus));
8906 slrec.fLanguage = XINT (XCDR (Vmac_ts_script_language_on_focus)); 8953 slrec.fLanguage = XINT (XCDR (Vmac_ts_script_language_on_focus));
@@ -8933,6 +8980,8 @@ mac_tsm_suspend ()
8933 OSStatus err; 8980 OSStatus err;
8934 ScriptLanguageRecord slrec, *slptr = NULL; 8981 ScriptLanguageRecord slrec, *slptr = NULL;
8935 8982
8983 saved_ts_script_language_on_focus = Vmac_ts_script_language_on_focus;
8984
8936 if (EQ (Vmac_ts_script_language_on_focus, Qt)) 8985 if (EQ (Vmac_ts_script_language_on_focus, Qt))
8937 { 8986 {
8938 err = GetTextServiceLanguage (&saved_ts_language); 8987 err = GetTextServiceLanguage (&saved_ts_language);
@@ -9581,7 +9630,11 @@ mac_handle_text_input_event (next_handler, event, data)
9581 typeLongInteger, 9630 typeLongInteger,
9582 typeIntlWritingCode, 9631 typeIntlWritingCode,
9583 typeLongInteger, 9632 typeLongInteger,
9633#ifdef MAC_OSX
9584 typeUnicodeText, 9634 typeUnicodeText,
9635#else
9636 typeChar,
9637#endif
9585 typeTextRangeArray, 9638 typeTextRangeArray,
9586 typeTextRangeArray, 9639 typeTextRangeArray,
9587 typeOffsetArray, 9640 typeOffsetArray,
@@ -10643,7 +10696,7 @@ XTread_socket (sd, expected, hold_quit)
10643#endif 10696#endif
10644 mapped_modifiers &= modifiers; 10697 mapped_modifiers &= modifiers;
10645 10698
10646#if USE_CARBON_EVENTS && defined (MAC_OSX) 10699#if USE_CARBON_EVENTS && (defined (MAC_OSX) || USE_MAC_TSM)
10647 /* When using Carbon Events, we need to pass raw keyboard 10700 /* When using Carbon Events, we need to pass raw keyboard
10648 events to the TSM ourselves. If TSM handles it, it 10701 events to the TSM ourselves. If TSM handles it, it
10649 will pass back noErr, otherwise it will pass back 10702 will pass back noErr, otherwise it will pass back
@@ -11299,7 +11352,11 @@ init_menu_bar ()
11299static void 11352static void
11300init_tsm () 11353init_tsm ()
11301{ 11354{
11355#ifdef MAC_OSX
11302 static InterfaceTypeList types = {kUnicodeDocument}; 11356 static InterfaceTypeList types = {kUnicodeDocument};
11357#else
11358 static InterfaceTypeList types = {kTextService};
11359#endif
11303 11360
11304 NewTSMDocument (sizeof (types) / sizeof (types[0]), types, 11361 NewTSMDocument (sizeof (types) / sizeof (types[0]), types,
11305 &tsm_document_id, 0); 11362 &tsm_document_id, 0);
@@ -11487,6 +11544,14 @@ syms_of_macterm ()
11487#if USE_ATSUI 11544#if USE_ATSUI
11488 staticpro (&atsu_font_id_hash); 11545 staticpro (&atsu_font_id_hash);
11489 atsu_font_id_hash = Qnil; 11546 atsu_font_id_hash = Qnil;
11547
11548 staticpro (&fm_style_face_attributes_alist);
11549 fm_style_face_attributes_alist = Qnil;
11550#endif
11551
11552#if USE_MAC_TSM
11553 staticpro (&saved_ts_script_language_on_focus);
11554 saved_ts_script_language_on_focus = Qnil;
11490#endif 11555#endif
11491 11556
11492 /* We don't yet support this, but defining this here avoids whining 11557 /* We don't yet support this, but defining this here avoids whining
@@ -11599,11 +11664,9 @@ CODING_SYSTEM is a coding system corresponding to TEXT-ENCODING. */);
11599 11664
11600#if USE_ATSUI 11665#if USE_ATSUI
11601 DEFVAR_LISP ("mac-atsu-font-table", &Vmac_atsu_font_table, 11666 DEFVAR_LISP ("mac-atsu-font-table", &Vmac_atsu_font_table,
11602 doc: /* Hash table of ATSU font IDs vs plist of attributes and values. 11667 doc: /* Hash table of ATSU font IDs vs plist of attributes and values. */);
11603Each font ID is represented as a four-byte string in native byte
11604order. */);
11605 Vmac_atsu_font_table = 11668 Vmac_atsu_font_table =
11606 make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), 11669 make_hash_table (Qeql, make_number (DEFAULT_HASH_SIZE),
11607 make_float (DEFAULT_REHASH_SIZE), 11670 make_float (DEFAULT_REHASH_SIZE),
11608 make_float (DEFAULT_REHASH_THRESHOLD), 11671 make_float (DEFAULT_REHASH_THRESHOLD),
11609 Qnil, Qnil, Qnil); 11672 Qnil, Qnil, Qnil);