#if USE_MAC_FONT_PANEL
if (frame)
- mac_set_font_info_for_selection (frame);
+ mac_set_font_info_for_selection (frame, DEFAULT_FACE_ID, 0);
#endif
}
f->output_data.mac = NULL;
if (f == dpyinfo->x_focus_frame)
- dpyinfo->x_focus_frame = 0;
+ {
+ dpyinfo->x_focus_frame = 0;
+#if USE_MAC_FONT_PANEL
+ mac_set_font_info_for_selection (NULL, DEFAULT_FACE_ID, 0);
+#endif
+ }
if (f == dpyinfo->x_focus_event_frame)
dpyinfo->x_focus_event_frame = 0;
if (f == dpyinfo->x_highlight_frame)
#if USE_MAC_FONT_PANEL
OSStatus
-mac_set_font_info_for_selection (f)
+mac_set_font_info_for_selection (f, face_id, c)
struct frame *f;
+ int face_id, c;
{
OSStatus err;
+ EventTargetRef target = NULL;
+ XFontStruct *font = NULL;
- if (f == NULL)
- err = SetFontInfoForSelection (kFontSelectionATSUIType, 0, NULL, NULL);
- else
+ if (f)
{
- struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
- XFontStruct *ascii_font = default_face->ascii_face->font;
- EventTargetRef target = GetWindowEventTarget (FRAME_MAC_WINDOW (f));
+ target = GetWindowEventTarget (FRAME_MAC_WINDOW (f));
- if (ascii_font->mac_fontnum != -1)
+ if (FRAME_FACE_CACHE (f) && CHAR_VALID_P (c, 0))
+ {
+ struct face *face;
+
+ face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c);
+ face = FACE_FROM_ID (f, face_id);
+ font = face->font;
+ }
+ }
+
+ if (font == NULL)
+ err = SetFontInfoForSelection (kFontSelectionATSUIType, 0, NULL, target);
+ else
+ {
+ if (font->mac_fontnum != -1)
{
FontSelectionQDStyle qd_style;
qd_style.version = kFontSelectionQDStyleVersionZero;
- qd_style.instance.fontFamily = ascii_font->mac_fontnum;
- qd_style.instance.fontStyle = ascii_font->mac_fontface;
- qd_style.size = ascii_font->mac_fontsize;
+ qd_style.instance.fontFamily = font->mac_fontnum;
+ qd_style.instance.fontStyle = font->mac_fontface;
+ qd_style.size = font->mac_fontsize;
qd_style.hasColor = false;
err = SetFontInfoForSelection (kFontSelectionQDType,
}
else
err = SetFontInfoForSelection (kFontSelectionATSUIType,
- 1, &ascii_font->mac_style, target);
+ 1, &font->mac_style, target);
}
return err;
#if USE_CARBON_EVENTS
#ifdef MAC_OSX
extern void init_service_handler ();
-static Lisp_Object Qservices, Qpaste, Qperform;
+static Lisp_Object Qservice, Qpaste, Qperform;
#endif
/* Window Event Handler */
static pascal OSStatus mac_handle_window_event (EventHandlerCallRef,
#ifdef MAC_OSX
OSStatus
-mac_store_services_event (event)
+mac_store_service_event (event)
EventRef event;
{
OSStatus err;
abort ();
}
- err = mac_store_event_ref_as_apple_event (0, 0, Qservices, id_key,
+ err = mac_store_event_ref_as_apple_event (0, 0, Qservice, id_key,
event, num_params,
names, types);
break;
case inContent:
- if (dpyinfo->x_focus_frame == NULL
- || window_ptr != FRAME_MAC_WINDOW (dpyinfo->x_focus_frame))
+ if (
+#if TARGET_API_MAC_CARBON
+ FrontNonFloatingWindow ()
+#else
+ FrontWindow ()
+#endif
+ != window_ptr)
SelectWindow (window_ptr);
else
{
Qselection = intern ("selection"); staticpro (&Qselection);
#endif
- Qservices = intern ("services"); staticpro (&Qservices);
+ Qservice = intern ("service"); staticpro (&Qservice);
Qpaste = intern ("paste"); staticpro (&Qpaste);
Qperform = intern ("perform"); staticpro (&Qperform);
#endif