Commit 4cb62a90 authored by YAMAMOTO Mitsuharu's avatar YAMAMOTO Mitsuharu
Browse files

(Qservice) [MAC_OSX]: Rename from Qservices. All uses changed.

[MAC_OSX] (mac_store_service_event): Rename from
mac_store_services_event.  All callers changed.
[USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection): Add args
FACE_ID and C.  All callers changed.
(x_free_frame_resources) [USE_MAC_FONT_PANEL]: Call
mac_set_font_info_for_selection when focus frame is destroyed.
(XTread_socket): Revert to FrontNonFloatingWindow/FrontWindow.
parent c2e93c82
...@@ -4100,7 +4100,7 @@ x_new_focus_frame (dpyinfo, frame) ...@@ -4100,7 +4100,7 @@ x_new_focus_frame (dpyinfo, frame)
#if USE_MAC_FONT_PANEL #if USE_MAC_FONT_PANEL
if (frame) if (frame)
mac_set_font_info_for_selection (frame); mac_set_font_info_for_selection (frame, DEFAULT_FACE_ID, 0);
#endif #endif
} }
...@@ -6348,7 +6348,12 @@ x_free_frame_resources (f) ...@@ -6348,7 +6348,12 @@ x_free_frame_resources (f)
f->output_data.mac = NULL; f->output_data.mac = NULL;
if (f == dpyinfo->x_focus_frame) 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) if (f == dpyinfo->x_focus_event_frame)
dpyinfo->x_focus_event_frame = 0; dpyinfo->x_focus_event_frame = 0;
if (f == dpyinfo->x_highlight_frame) if (f == dpyinfo->x_highlight_frame)
...@@ -8316,27 +8321,40 @@ x_find_ccl_program (fontp) ...@@ -8316,27 +8321,40 @@ x_find_ccl_program (fontp)
#if USE_MAC_FONT_PANEL #if USE_MAC_FONT_PANEL
OSStatus OSStatus
mac_set_font_info_for_selection (f) mac_set_font_info_for_selection (f, face_id, c)
struct frame *f; struct frame *f;
int face_id, c;
{ {
OSStatus err; OSStatus err;
EventTargetRef target = NULL;
XFontStruct *font = NULL;
if (f == NULL) if (f)
err = SetFontInfoForSelection (kFontSelectionATSUIType, 0, NULL, NULL);
else
{ {
struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); target = GetWindowEventTarget (FRAME_MAC_WINDOW (f));
XFontStruct *ascii_font = default_face->ascii_face->font;
EventTargetRef 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; FontSelectionQDStyle qd_style;
qd_style.version = kFontSelectionQDStyleVersionZero; qd_style.version = kFontSelectionQDStyleVersionZero;
qd_style.instance.fontFamily = ascii_font->mac_fontnum; qd_style.instance.fontFamily = font->mac_fontnum;
qd_style.instance.fontStyle = ascii_font->mac_fontface; qd_style.instance.fontStyle = font->mac_fontface;
qd_style.size = ascii_font->mac_fontsize; qd_style.size = font->mac_fontsize;
qd_style.hasColor = false; qd_style.hasColor = false;
err = SetFontInfoForSelection (kFontSelectionQDType, err = SetFontInfoForSelection (kFontSelectionQDType,
...@@ -8344,7 +8362,7 @@ mac_set_font_info_for_selection (f) ...@@ -8344,7 +8362,7 @@ mac_set_font_info_for_selection (f)
} }
else else
err = SetFontInfoForSelection (kFontSelectionATSUIType, err = SetFontInfoForSelection (kFontSelectionATSUIType,
1, &ascii_font->mac_style, target); 1, &font->mac_style, target);
} }
return err; return err;
...@@ -8461,7 +8479,7 @@ void remove_drag_handler P_ ((WindowRef)); ...@@ -8461,7 +8479,7 @@ void remove_drag_handler P_ ((WindowRef));
#if USE_CARBON_EVENTS #if USE_CARBON_EVENTS
#ifdef MAC_OSX #ifdef MAC_OSX
extern void init_service_handler (); extern void init_service_handler ();
static Lisp_Object Qservices, Qpaste, Qperform; static Lisp_Object Qservice, Qpaste, Qperform;
#endif #endif
/* Window Event Handler */ /* Window Event Handler */
static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, static pascal OSStatus mac_handle_window_event (EventHandlerCallRef,
...@@ -9379,7 +9397,7 @@ mac_handle_font_event (next_handler, event, data) ...@@ -9379,7 +9397,7 @@ mac_handle_font_event (next_handler, event, data)
#ifdef MAC_OSX #ifdef MAC_OSX
OSStatus OSStatus
mac_store_services_event (event) mac_store_service_event (event)
EventRef event; EventRef event;
{ {
OSStatus err; OSStatus err;
...@@ -9412,7 +9430,7 @@ mac_store_services_event (event) ...@@ -9412,7 +9430,7 @@ mac_store_services_event (event)
abort (); 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, event, num_params,
names, types); names, types);
...@@ -9930,8 +9948,13 @@ XTread_socket (sd, expected, hold_quit) ...@@ -9930,8 +9948,13 @@ XTread_socket (sd, expected, hold_quit)
break; break;
case inContent: case inContent:
if (dpyinfo->x_focus_frame == NULL if (
|| window_ptr != FRAME_MAC_WINDOW (dpyinfo->x_focus_frame)) #if TARGET_API_MAC_CARBON
FrontNonFloatingWindow ()
#else
FrontWindow ()
#endif
!= window_ptr)
SelectWindow (window_ptr); SelectWindow (window_ptr);
else else
{ {
...@@ -11034,7 +11057,7 @@ syms_of_macterm () ...@@ -11034,7 +11057,7 @@ syms_of_macterm ()
Qselection = intern ("selection"); staticpro (&Qselection); Qselection = intern ("selection"); staticpro (&Qselection);
#endif #endif
Qservices = intern ("services"); staticpro (&Qservices); Qservice = intern ("service"); staticpro (&Qservice);
Qpaste = intern ("paste"); staticpro (&Qpaste); Qpaste = intern ("paste"); staticpro (&Qpaste);
Qperform = intern ("perform"); staticpro (&Qperform); Qperform = intern ("perform"); staticpro (&Qperform);
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment