comparison src/macterm.c @ 70563:fc3c18e2c3b9

(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.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Wed, 10 May 2006 08:24:49 +0000
parents 8b2250961fcc
children d0bad3102124 b6689e223e2f 146cd8369025
comparison
equal deleted inserted replaced
70562:e2bd086e6902 70563:fc3c18e2c3b9
4098 else 4098 else
4099 pending_autoraise_frame = 0; 4099 pending_autoraise_frame = 0;
4100 4100
4101 #if USE_MAC_FONT_PANEL 4101 #if USE_MAC_FONT_PANEL
4102 if (frame) 4102 if (frame)
4103 mac_set_font_info_for_selection (frame); 4103 mac_set_font_info_for_selection (frame, DEFAULT_FACE_ID, 0);
4104 #endif 4104 #endif
4105 } 4105 }
4106 4106
4107 x_frame_rehighlight (dpyinfo); 4107 x_frame_rehighlight (dpyinfo);
4108 } 4108 }
6346 6346
6347 xfree (f->output_data.mac); 6347 xfree (f->output_data.mac);
6348 f->output_data.mac = NULL; 6348 f->output_data.mac = NULL;
6349 6349
6350 if (f == dpyinfo->x_focus_frame) 6350 if (f == dpyinfo->x_focus_frame)
6351 dpyinfo->x_focus_frame = 0; 6351 {
6352 dpyinfo->x_focus_frame = 0;
6353 #if USE_MAC_FONT_PANEL
6354 mac_set_font_info_for_selection (NULL, DEFAULT_FACE_ID, 0);
6355 #endif
6356 }
6352 if (f == dpyinfo->x_focus_event_frame) 6357 if (f == dpyinfo->x_focus_event_frame)
6353 dpyinfo->x_focus_event_frame = 0; 6358 dpyinfo->x_focus_event_frame = 0;
6354 if (f == dpyinfo->x_highlight_frame) 6359 if (f == dpyinfo->x_highlight_frame)
6355 dpyinfo->x_highlight_frame = 0; 6360 dpyinfo->x_highlight_frame = 0;
6356 6361
8314 } 8319 }
8315 } 8320 }
8316 8321
8317 #if USE_MAC_FONT_PANEL 8322 #if USE_MAC_FONT_PANEL
8318 OSStatus 8323 OSStatus
8319 mac_set_font_info_for_selection (f) 8324 mac_set_font_info_for_selection (f, face_id, c)
8320 struct frame *f; 8325 struct frame *f;
8326 int face_id, c;
8321 { 8327 {
8322 OSStatus err; 8328 OSStatus err;
8323 8329 EventTargetRef target = NULL;
8324 if (f == NULL) 8330 XFontStruct *font = NULL;
8325 err = SetFontInfoForSelection (kFontSelectionATSUIType, 0, NULL, NULL); 8331
8332 if (f)
8333 {
8334 target = GetWindowEventTarget (FRAME_MAC_WINDOW (f));
8335
8336 if (FRAME_FACE_CACHE (f) && CHAR_VALID_P (c, 0))
8337 {
8338 struct face *face;
8339
8340 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c);
8341 face = FACE_FROM_ID (f, face_id);
8342 font = face->font;
8343 }
8344 }
8345
8346 if (font == NULL)
8347 err = SetFontInfoForSelection (kFontSelectionATSUIType, 0, NULL, target);
8326 else 8348 else
8327 { 8349 {
8328 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); 8350 if (font->mac_fontnum != -1)
8329 XFontStruct *ascii_font = default_face->ascii_face->font;
8330 EventTargetRef target = GetWindowEventTarget (FRAME_MAC_WINDOW (f));
8331
8332 if (ascii_font->mac_fontnum != -1)
8333 { 8351 {
8334 FontSelectionQDStyle qd_style; 8352 FontSelectionQDStyle qd_style;
8335 8353
8336 qd_style.version = kFontSelectionQDStyleVersionZero; 8354 qd_style.version = kFontSelectionQDStyleVersionZero;
8337 qd_style.instance.fontFamily = ascii_font->mac_fontnum; 8355 qd_style.instance.fontFamily = font->mac_fontnum;
8338 qd_style.instance.fontStyle = ascii_font->mac_fontface; 8356 qd_style.instance.fontStyle = font->mac_fontface;
8339 qd_style.size = ascii_font->mac_fontsize; 8357 qd_style.size = font->mac_fontsize;
8340 qd_style.hasColor = false; 8358 qd_style.hasColor = false;
8341 8359
8342 err = SetFontInfoForSelection (kFontSelectionQDType, 8360 err = SetFontInfoForSelection (kFontSelectionQDType,
8343 1, &qd_style, target); 8361 1, &qd_style, target);
8344 } 8362 }
8345 else 8363 else
8346 err = SetFontInfoForSelection (kFontSelectionATSUIType, 8364 err = SetFontInfoForSelection (kFontSelectionATSUIType,
8347 1, &ascii_font->mac_style, target); 8365 1, &font->mac_style, target);
8348 } 8366 }
8349 8367
8350 return err; 8368 return err;
8351 } 8369 }
8352 #endif 8370 #endif
8459 void remove_drag_handler P_ ((WindowRef)); 8477 void remove_drag_handler P_ ((WindowRef));
8460 8478
8461 #if USE_CARBON_EVENTS 8479 #if USE_CARBON_EVENTS
8462 #ifdef MAC_OSX 8480 #ifdef MAC_OSX
8463 extern void init_service_handler (); 8481 extern void init_service_handler ();
8464 static Lisp_Object Qservices, Qpaste, Qperform; 8482 static Lisp_Object Qservice, Qpaste, Qperform;
8465 #endif 8483 #endif
8466 /* Window Event Handler */ 8484 /* Window Event Handler */
8467 static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, 8485 static pascal OSStatus mac_handle_window_event (EventHandlerCallRef,
8468 EventRef, void *); 8486 EventRef, void *);
8469 #endif 8487 #endif
9377 } 9395 }
9378 #endif 9396 #endif
9379 9397
9380 #ifdef MAC_OSX 9398 #ifdef MAC_OSX
9381 OSStatus 9399 OSStatus
9382 mac_store_services_event (event) 9400 mac_store_service_event (event)
9383 EventRef event; 9401 EventRef event;
9384 { 9402 {
9385 OSStatus err; 9403 OSStatus err;
9386 Lisp_Object id_key; 9404 Lisp_Object id_key;
9387 int num_params; 9405 int num_params;
9410 9428
9411 default: 9429 default:
9412 abort (); 9430 abort ();
9413 } 9431 }
9414 9432
9415 err = mac_store_event_ref_as_apple_event (0, 0, Qservices, id_key, 9433 err = mac_store_event_ref_as_apple_event (0, 0, Qservice, id_key,
9416 event, num_params, 9434 event, num_params,
9417 names, types); 9435 names, types);
9418 9436
9419 return err; 9437 return err;
9420 } 9438 }
9928 inev.kind = MENU_BAR_ACTIVATE_EVENT; 9946 inev.kind = MENU_BAR_ACTIVATE_EVENT;
9929 XSETFRAME (inev.frame_or_window, f); 9947 XSETFRAME (inev.frame_or_window, f);
9930 break; 9948 break;
9931 9949
9932 case inContent: 9950 case inContent:
9933 if (dpyinfo->x_focus_frame == NULL 9951 if (
9934 || window_ptr != FRAME_MAC_WINDOW (dpyinfo->x_focus_frame)) 9952 #if TARGET_API_MAC_CARBON
9953 FrontNonFloatingWindow ()
9954 #else
9955 FrontWindow ()
9956 #endif
9957 != window_ptr)
9935 SelectWindow (window_ptr); 9958 SelectWindow (window_ptr);
9936 else 9959 else
9937 { 9960 {
9938 ControlPartCode control_part_code; 9961 ControlPartCode control_part_code;
9939 ControlHandle ch; 9962 ControlHandle ch;
11032 #if USE_MAC_FONT_PANEL 11055 #if USE_MAC_FONT_PANEL
11033 Qpanel_closed = intern ("panel-closed"); staticpro (&Qpanel_closed); 11056 Qpanel_closed = intern ("panel-closed"); staticpro (&Qpanel_closed);
11034 Qselection = intern ("selection"); staticpro (&Qselection); 11057 Qselection = intern ("selection"); staticpro (&Qselection);
11035 #endif 11058 #endif
11036 11059
11037 Qservices = intern ("services"); staticpro (&Qservices); 11060 Qservice = intern ("service"); staticpro (&Qservice);
11038 Qpaste = intern ("paste"); staticpro (&Qpaste); 11061 Qpaste = intern ("paste"); staticpro (&Qpaste);
11039 Qperform = intern ("perform"); staticpro (&Qperform); 11062 Qperform = intern ("perform"); staticpro (&Qperform);
11040 #endif 11063 #endif
11041 #endif 11064 #endif
11042 11065