comparison src/macterm.c @ 70496:8b2250961fcc

(XLoadQueryFont) [USE_ATSUI]: Set FMFontFamily value to font->mac_fontnum. [USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection): New function. (x_new_focus_frame) [USE_MAC_FONT_PANEL]: Use it. (QCfamily, QCweight, QCslant, Qnormal, Qbold, Qitalic): Add extern. (QWindow) [MAC_OSX]: Likewise. (Qfont) [USE_MAC_FONT_PANEL]: Likewise. (Vmac_atsu_font_table) [USE_ATSUI]: New variable. (syms_of_macterm) [USE_ATSUI]: Defvar it. (Qtoolbar_switch_mode) [MAC_OSX]: New variable. (Qpanel_closed, Qselection) [USE_MAC_FONT_PANEL]: Likewise. (syms_of_macterm): Intern and staticpro them. (init_font_name_table) [USE_ATSUI]: Set data to Vmac_atsu_font_table. [TARGET_API_MAC_CARBON] (mac_store_event_ref_as_apple_event): New function. [USE_CARBON_EVENTS] (mac_handle_command_event): Use it. [MAC_OSX] (mac_store_services_event): Likewise. [USE_CARBON_EVENTS] (mac_handle_window_event) [MAC_OSX]: Handle kEventWindowToolbarSwitchMode event. (install_window_handler) [USE_CARBON_EVENTS && MAC_OSX]: Register it. [MAC_OSX] (mac_store_services_event): Change return type to OSStatus. [USE_MAC_FONT_PANEL] (mac_handle_font_event): New function. (install_window_handler) [USE_MAC_FONT_PANEL]: Install it. (XTread_socket): Select window on mouse click if x_focus_frame is NULL.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Sun, 07 May 2006 08:07:13 +0000
parents a5899b40fd69
children fc3c18e2c3b9 1321f6cfb389
comparison
equal deleted inserted replaced
70495:7904c95deb65 70496:8b2250961fcc
4095 4095
4096 if (dpyinfo->x_focus_frame && dpyinfo->x_focus_frame->auto_raise) 4096 if (dpyinfo->x_focus_frame && dpyinfo->x_focus_frame->auto_raise)
4097 pending_autoraise_frame = dpyinfo->x_focus_frame; 4097 pending_autoraise_frame = dpyinfo->x_focus_frame;
4098 else 4098 else
4099 pending_autoraise_frame = 0; 4099 pending_autoraise_frame = 0;
4100
4101 #if USE_MAC_FONT_PANEL
4102 if (frame)
4103 mac_set_font_info_for_selection (frame);
4104 #endif
4100 } 4105 }
4101 4106
4102 x_frame_rehighlight (dpyinfo); 4107 x_frame_rehighlight (dpyinfo);
4103 } 4108 }
4104 4109
6865 for Mac OS Classic is created. */ 6870 for Mac OS Classic is created. */
6866 static Lisp_Object fm_font_family_alist; 6871 static Lisp_Object fm_font_family_alist;
6867 #if USE_ATSUI 6872 #if USE_ATSUI
6868 /* Hash table linking font family names to ATSU font IDs. */ 6873 /* Hash table linking font family names to ATSU font IDs. */
6869 static Lisp_Object atsu_font_id_hash; 6874 static Lisp_Object atsu_font_id_hash;
6875 static Lisp_Object Vmac_atsu_font_table;
6876 extern Lisp_Object QCfamily, QCweight, QCslant, Qnormal, Qbold, Qitalic;
6870 #endif 6877 #endif
6871 6878
6872 /* Alist linking character set strings to Mac text encoding and Emacs 6879 /* Alist linking character set strings to Mac text encoding and Emacs
6873 coding system. */ 6880 coding system. */
6874 static Lisp_Object Vmac_charset_info_alist; 6881 static Lisp_Object Vmac_charset_info_alist;
7160 kFontMacintoshPlatform, kFontNoScript, 7167 kFontMacintoshPlatform, kFontNoScript,
7161 kFontNoLanguage, name_len, name, 7168 kFontNoLanguage, name_len, name,
7162 NULL, NULL); 7169 NULL, NULL);
7163 if (err == noErr) 7170 if (err == noErr)
7164 { 7171 {
7172 FMFontFamily ff;
7173 FMFontStyle style = normal;
7174
7165 decode_mac_font_name (name, name_len + 1, Qnil); 7175 decode_mac_font_name (name, name_len + 1, Qnil);
7166 family = make_unibyte_string (name, name_len); 7176 family = make_unibyte_string (name, name_len);
7177 FMGetFontFamilyInstanceFromFont (font_ids[i], &ff, &style);
7178 Fputhash (make_unibyte_string ((char *)(font_ids + i),
7179 sizeof (ATSUFontID)),
7180 Fcons (QCfamily,
7181 list5 (family,
7182 QCweight,
7183 style & bold ? Qbold : Qnormal,
7184 QCslant,
7185 style & italic ? Qitalic : Qnormal)),
7186 Vmac_atsu_font_table);
7167 if (*name != '.' 7187 if (*name != '.'
7168 && hash_lookup (h, family, &hash_code) < 0) 7188 && hash_lookup (h, family, &hash_code) < 0)
7169 { 7189 {
7170 add_mac_font_name (name, 0, normal, "iso10646-1"); 7190 add_mac_font_name (name, 0, normal, "iso10646-1");
7171 hash_put (h, family, long_to_cons (font_ids[i]), 7191 hash_put (h, family, long_to_cons (font_ids[i]),
7707 ATSUFontFeatureType types[] = {kAllTypographicFeaturesType, 7727 ATSUFontFeatureType types[] = {kAllTypographicFeaturesType,
7708 kDiacriticsType}; 7728 kDiacriticsType};
7709 ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector, 7729 ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector,
7710 kDecomposeDiacriticsSelector}; 7730 kDecomposeDiacriticsSelector};
7711 Lisp_Object font_id_cons; 7731 Lisp_Object font_id_cons;
7732 FMFontStyle style;
7712 7733
7713 font_id_cons = Fgethash (make_unibyte_string (family, strlen (family)), 7734 font_id_cons = Fgethash (make_unibyte_string (family, strlen (family)),
7714 atsu_font_id_hash, Qnil); 7735 atsu_font_id_hash, Qnil);
7715 if (NILP (font_id_cons)) 7736 if (NILP (font_id_cons))
7716 return NULL; 7737 return NULL;
7725 types, selectors); 7746 types, selectors);
7726 if (err != noErr) 7747 if (err != noErr)
7727 return NULL; 7748 return NULL;
7728 err = ATSUSetAttributes (mac_style, sizeof (tags) / sizeof (tags[0]), 7749 err = ATSUSetAttributes (mac_style, sizeof (tags) / sizeof (tags[0]),
7729 tags, sizes, values); 7750 tags, sizes, values);
7730 fontnum = -1; 7751 if (err != noErr)
7752 return NULL;
7753 err = FMGetFontFamilyInstanceFromFont (font_id, &fontnum, &style);
7754 if (err != noErr)
7755 fontnum = -1;
7731 scriptcode = kTextEncodingMacUnicode; 7756 scriptcode = kTextEncodingMacUnicode;
7732 } 7757 }
7733 else 7758 else
7734 #endif 7759 #endif
7735 { 7760 {
7785 bzero (font->bounds.rows, sizeof (XCharStruct *) * 0x100); 7810 bzero (font->bounds.rows, sizeof (XCharStruct *) * 0x100);
7786 font->bounds.rows[0] = xmalloc (sizeof (XCharStruct) * 0x100); 7811 font->bounds.rows[0] = xmalloc (sizeof (XCharStruct) * 0x100);
7787 pcm_init (font->bounds.rows[0], 0x100); 7812 pcm_init (font->bounds.rows[0], 0x100);
7788 7813
7789 #if USE_CG_TEXT_DRAWING 7814 #if USE_CG_TEXT_DRAWING
7790 { 7815 if (fontnum != -1)
7791 FMFontFamily font_family; 7816 {
7792 FMFontStyle style; 7817 FMFontStyle style;
7793 ATSFontRef ats_font; 7818 ATSFontRef ats_font;
7794 7819
7795 err = FMGetFontFamilyInstanceFromFont (font_id, &font_family, &style); 7820 err = FMGetFontFromFontFamilyInstance (fontnum, fontface,
7796 if (err == noErr)
7797 err = FMGetFontFromFontFamilyInstance (font_family, fontface,
7798 &font_id, &style); 7821 &font_id, &style);
7799 /* Use CG text drawing if italic/bold is not synthesized. */ 7822 /* Use CG text drawing if italic/bold is not synthesized. */
7800 if (err == noErr && style == fontface) 7823 if (err == noErr && style == fontface)
7801 { 7824 {
7802 ats_font = FMGetATSFontRefFromFont (font_id); 7825 ats_font = FMGetATSFontRefFromFont (font_id);
7803 font->cg_font = CGFontCreateWithPlatformFont (&ats_font); 7826 font->cg_font = CGFontCreateWithPlatformFont (&ats_font);
7804 } 7827 }
7805 } 7828 }
7806 7829
7807 if (font->cg_font) 7830 if (font->cg_font)
7808 { 7831 {
7809 font->cg_glyphs = xmalloc (sizeof (CGGlyph) * 0x100); 7832 font->cg_glyphs = xmalloc (sizeof (CGGlyph) * 0x100);
7810 bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100); 7833 bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100);
8289 else 8312 else
8290 fontp->font_encoder = ccl; 8313 fontp->font_encoder = ccl;
8291 } 8314 }
8292 } 8315 }
8293 8316
8317 #if USE_MAC_FONT_PANEL
8318 OSStatus
8319 mac_set_font_info_for_selection (f)
8320 struct frame *f;
8321 {
8322 OSStatus err;
8323
8324 if (f == NULL)
8325 err = SetFontInfoForSelection (kFontSelectionATSUIType, 0, NULL, NULL);
8326 else
8327 {
8328 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
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 {
8334 FontSelectionQDStyle qd_style;
8335
8336 qd_style.version = kFontSelectionQDStyleVersionZero;
8337 qd_style.instance.fontFamily = ascii_font->mac_fontnum;
8338 qd_style.instance.fontStyle = ascii_font->mac_fontface;
8339 qd_style.size = ascii_font->mac_fontsize;
8340 qd_style.hasColor = false;
8341
8342 err = SetFontInfoForSelection (kFontSelectionQDType,
8343 1, &qd_style, target);
8344 }
8345 else
8346 err = SetFontInfoForSelection (kFontSelectionATSUIType,
8347 1, &ascii_font->mac_style, target);
8348 }
8349
8350 return err;
8351 }
8352 #endif
8294 8353
8295 8354
8296 /* The Mac Event loop code */ 8355 /* The Mac Event loop code */
8297 8356
8298 #if !TARGET_API_MAC_CARBON 8357 #if !TARGET_API_MAC_CARBON
8376 Point saved_menu_event_location; 8435 Point saved_menu_event_location;
8377 8436
8378 /* Apple Events */ 8437 /* Apple Events */
8379 #if USE_CARBON_EVENTS 8438 #if USE_CARBON_EVENTS
8380 static Lisp_Object Qhicommand; 8439 static Lisp_Object Qhicommand;
8440 #ifdef MAC_OSX
8441 extern Lisp_Object Qwindow;
8442 static Lisp_Object Qtoolbar_switch_mode;
8443 #endif
8444 #if USE_MAC_FONT_PANEL
8445 extern Lisp_Object Qfont;
8446 static Lisp_Object Qpanel_closed, Qselection;
8447 #endif
8381 #endif 8448 #endif
8382 extern int mac_ready_for_apple_events; 8449 extern int mac_ready_for_apple_events;
8383 extern Lisp_Object Qundefined; 8450 extern Lisp_Object Qundefined;
8384 extern void init_apple_event_handler P_ ((void)); 8451 extern void init_apple_event_handler P_ ((void));
8385 extern void mac_find_apple_event_spec P_ ((AEEventClass, AEEventID, 8452 extern void mac_find_apple_event_spec P_ ((AEEventClass, AEEventID,
8964 buf.arg = mac_aedesc_to_lisp (desc); 9031 buf.arg = mac_aedesc_to_lisp (desc);
8965 kbd_buffer_store_event (&buf); 9032 kbd_buffer_store_event (&buf);
8966 } 9033 }
8967 9034
8968 #if TARGET_API_MAC_CARBON 9035 #if TARGET_API_MAC_CARBON
9036 static OSStatus
9037 mac_store_event_ref_as_apple_event (class, id, class_key, id_key,
9038 event, num_params, names, types)
9039 AEEventClass class;
9040 AEEventID id;
9041 Lisp_Object class_key, id_key;
9042 EventRef event;
9043 UInt32 num_params;
9044 EventParamName *names;
9045 EventParamType *types;
9046 {
9047 OSStatus err = eventNotHandledErr;
9048 Lisp_Object binding;
9049
9050 mac_find_apple_event_spec (class, id, &class_key, &id_key, &binding);
9051 if (!NILP (binding) && !EQ (binding, Qundefined))
9052 {
9053 if (INTEGERP (binding))
9054 err = XINT (binding);
9055 else
9056 {
9057 AppleEvent apple_event;
9058 err = create_apple_event_from_event_ref (event, num_params,
9059 names, types,
9060 &apple_event);
9061 if (err == noErr)
9062 {
9063 mac_store_apple_event (class_key, id_key, &apple_event);
9064 AEDisposeDesc (&apple_event);
9065 }
9066 }
9067 }
9068
9069 return err;
9070 }
9071
8969 void 9072 void
8970 mac_store_drag_event (window, mouse_pos, modifiers, desc) 9073 mac_store_drag_event (window, mouse_pos, modifiers, desc)
8971 WindowRef window; 9074 WindowRef window;
8972 Point mouse_pos; 9075 Point mouse_pos;
8973 SInt16 modifiers; 9076 SInt16 modifiers;
8995 EventRef event; 9098 EventRef event;
8996 void *data; 9099 void *data;
8997 { 9100 {
8998 OSStatus result, err; 9101 OSStatus result, err;
8999 HICommand command; 9102 HICommand command;
9000 Lisp_Object class_key, id_key, binding; 9103 static EventParamName names[] = {kEventParamDirectObject,
9104 kEventParamKeyModifiers};
9105 static EventParamType types[] = {typeHICommand,
9106 typeUInt32};
9107 int num_params = sizeof (names) / sizeof (names[0]);
9001 9108
9002 result = CallNextEventHandler (next_handler, event); 9109 result = CallNextEventHandler (next_handler, event);
9003 if (result != eventNotHandledErr) 9110 if (result != eventNotHandledErr)
9004 return result; 9111 return result;
9005 9112
9009 if (err != noErr || command.commandID == 0) 9116 if (err != noErr || command.commandID == 0)
9010 return eventNotHandledErr; 9117 return eventNotHandledErr;
9011 9118
9012 /* A HICommand event is mapped to an Apple event whose event class 9119 /* A HICommand event is mapped to an Apple event whose event class
9013 symbol is `hicommand' and event ID is its command ID. */ 9120 symbol is `hicommand' and event ID is its command ID. */
9014 class_key = Qhicommand; 9121 err = mac_store_event_ref_as_apple_event (0, command.commandID,
9015 mac_find_apple_event_spec (0, command.commandID, 9122 Qhicommand, Qnil,
9016 &class_key, &id_key, &binding); 9123 event, num_params, names, types);
9017 if (!NILP (binding) && !EQ (binding, Qundefined)) 9124 return err == noErr ? noErr : eventNotHandledErr;
9018 {
9019 if (INTEGERP (binding))
9020 return XINT (binding);
9021 else
9022 {
9023 AppleEvent apple_event;
9024 static EventParamName names[] = {kEventParamDirectObject,
9025 kEventParamKeyModifiers};
9026 static EventParamType types[] = {typeHICommand,
9027 typeUInt32};
9028 err = create_apple_event_from_event_ref (event, 2, names, types,
9029 &apple_event);
9030 if (err == noErr)
9031 {
9032 mac_store_apple_event (class_key, id_key, &apple_event);
9033 AEDisposeDesc (&apple_event);
9034 return noErr;
9035 }
9036 }
9037 }
9038
9039 return eventNotHandledErr;
9040 } 9125 }
9041 9126
9042 static OSErr 9127 static OSErr
9043 init_command_handler () 9128 init_command_handler ()
9044 { 9129 {
9137 9222
9138 mac_handle_visibility_change (mac_window_to_frame (wp)); 9223 mac_handle_visibility_change (mac_window_to_frame (wp));
9139 return noErr; 9224 return noErr;
9140 9225
9141 break; 9226 break;
9227
9228 #ifdef MAC_OSX
9229 case kEventWindowToolbarSwitchMode:
9230 result = CallNextEventHandler (next_handler, event);
9231 {
9232 static EventParamName names[] = {kEventParamDirectObject,
9233 kEventParamWindowMouseLocation,
9234 kEventParamKeyModifiers,
9235 kEventParamMouseButton,
9236 kEventParamClickCount,
9237 kEventParamMouseChord};
9238 static EventParamType types[] = {typeWindowRef,
9239 typeQDPoint,
9240 typeUInt32,
9241 typeMouseButton,
9242 typeUInt32,
9243 typeUInt32};
9244 int num_params = sizeof (names) / sizeof (names[0]);
9245
9246 err = mac_store_event_ref_as_apple_event (0, 0,
9247 Qwindow,
9248 Qtoolbar_switch_mode,
9249 event, num_params,
9250 names, types);
9251 }
9252 return err == noErr ? noErr : result;
9253 #endif
9142 } 9254 }
9143 9255
9144 return eventNotHandledErr; 9256 return eventNotHandledErr;
9145 } 9257 }
9146 9258
9211 } 9323 }
9212 9324
9213 return eventNotHandledErr; 9325 return eventNotHandledErr;
9214 } 9326 }
9215 9327
9328 #if USE_MAC_FONT_PANEL
9329 static pascal OSStatus
9330 mac_handle_font_event (next_handler, event, data)
9331 EventHandlerCallRef next_handler;
9332 EventRef event;
9333 void *data;
9334 {
9335 OSStatus result, err;
9336 Lisp_Object id_key;
9337 int num_params;
9338 EventParamName *names;
9339 EventParamType *types;
9340 static EventParamName names_sel[] = {kEventParamATSUFontID,
9341 kEventParamATSUFontSize,
9342 kEventParamFMFontFamily,
9343 kEventParamFMFontSize,
9344 kEventParamFontColor};
9345 static EventParamType types_sel[] = {typeATSUFontID,
9346 typeATSUSize,
9347 typeFMFontFamily,
9348 typeFMFontSize,
9349 typeFontColor};
9350
9351 result = CallNextEventHandler (next_handler, event);
9352 if (result != eventNotHandledErr)
9353 return result;
9354
9355 switch (GetEventKind (event))
9356 {
9357 case kEventFontPanelClosed:
9358 id_key = Qpanel_closed;
9359 num_params = 0;
9360 names = NULL;
9361 types = NULL;
9362 break;
9363
9364 case kEventFontSelection:
9365 id_key = Qselection;
9366 num_params = sizeof (names_sel) / sizeof (names_sel[0]);
9367 names = names_sel;
9368 types = types_sel;
9369 break;
9370 }
9371
9372 err = mac_store_event_ref_as_apple_event (0, 0, Qfont, id_key,
9373 event, num_params,
9374 names, types);
9375
9376 return err == noErr ? noErr : eventNotHandledErr;
9377 }
9378 #endif
9379
9216 #ifdef MAC_OSX 9380 #ifdef MAC_OSX
9217 OSErr 9381 OSStatus
9218 mac_store_services_event (event) 9382 mac_store_services_event (event)
9219 EventRef event; 9383 EventRef event;
9220 { 9384 {
9221 OSErr err; 9385 OSStatus err;
9222 AppleEvent apple_event;
9223 Lisp_Object id_key; 9386 Lisp_Object id_key;
9387 int num_params;
9388 EventParamName *names;
9389 EventParamType *types;
9390 static EventParamName names_pfm[] = {kEventParamServiceMessageName,
9391 kEventParamServiceUserData};
9392 static EventParamType types_pfm[] = {typeCFStringRef,
9393 typeCFStringRef};
9224 9394
9225 switch (GetEventKind (event)) 9395 switch (GetEventKind (event))
9226 { 9396 {
9227 case kEventServicePaste: 9397 case kEventServicePaste:
9228 id_key = Qpaste; 9398 id_key = Qpaste;
9229 err = create_apple_event_from_event_ref (event, 0, NULL, NULL, 9399 num_params = 0;
9230 &apple_event); 9400 names = NULL;
9401 types = NULL;
9231 break; 9402 break;
9232 9403
9233 case kEventServicePerform: 9404 case kEventServicePerform:
9234 { 9405 id_key = Qperform;
9235 static EventParamName names[] = {kEventParamServiceMessageName, 9406 num_params = sizeof (names_pfm) / sizeof (names_pfm[0]);
9236 kEventParamServiceUserData}; 9407 names = names_pfm;
9237 static EventParamType types[] = {typeCFStringRef, 9408 types = types_pfm;
9238 typeCFStringRef};
9239
9240 id_key = Qperform;
9241 err = create_apple_event_from_event_ref (event, 2, names, types,
9242 &apple_event);
9243 }
9244 break; 9409 break;
9245 9410
9246 default: 9411 default:
9247 abort (); 9412 abort ();
9248 } 9413 }
9249 9414
9250 if (err == noErr) 9415 err = mac_store_event_ref_as_apple_event (0, 0, Qservices, id_key,
9251 { 9416 event, num_params,
9252 mac_store_apple_event (Qservices, id_key, &apple_event); 9417 names, types);
9253 AEDisposeDesc (&apple_event);
9254 }
9255 9418
9256 return err; 9419 return err;
9257 } 9420 }
9258 #endif /* MAC_OSX */ 9421 #endif /* MAC_OSX */
9259 #endif /* USE_CARBON_EVENTS */ 9422 #endif /* USE_CARBON_EVENTS */
9269 {{kEventClassWindow, kEventWindowUpdate}, 9432 {{kEventClassWindow, kEventWindowUpdate},
9270 {kEventClassWindow, kEventWindowBoundsChanging}, 9433 {kEventClassWindow, kEventWindowBoundsChanging},
9271 {kEventClassWindow, kEventWindowShown}, 9434 {kEventClassWindow, kEventWindowShown},
9272 {kEventClassWindow, kEventWindowHidden}, 9435 {kEventClassWindow, kEventWindowHidden},
9273 {kEventClassWindow, kEventWindowExpanded}, 9436 {kEventClassWindow, kEventWindowExpanded},
9274 {kEventClassWindow, kEventWindowCollapsed}}; 9437 {kEventClassWindow, kEventWindowCollapsed},
9438 #ifdef MAC_OSX
9439 {kEventClassWindow, kEventWindowToolbarSwitchMode},
9440 #endif
9441 };
9275 EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; 9442 EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}};
9276 static EventHandlerUPP handle_window_eventUPP = NULL; 9443 static EventHandlerUPP handle_window_eventUPP = NULL;
9277 static EventHandlerUPP handle_mouse_eventUPP = NULL; 9444 static EventHandlerUPP handle_mouse_eventUPP = NULL;
9445 #if USE_MAC_FONT_PANEL
9446 EventTypeSpec specs_font[] = {{kEventClassFont, kEventFontPanelClosed},
9447 {kEventClassFont, kEventFontSelection}};
9448 static EventHandlerUPP handle_font_eventUPP = NULL;
9449 #endif
9278 9450
9279 if (handle_window_eventUPP == NULL) 9451 if (handle_window_eventUPP == NULL)
9280 handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event); 9452 handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event);
9281 if (handle_mouse_eventUPP == NULL) 9453 if (handle_mouse_eventUPP == NULL)
9282 handle_mouse_eventUPP = NewEventHandlerUPP (mac_handle_mouse_event); 9454 handle_mouse_eventUPP = NewEventHandlerUPP (mac_handle_mouse_event);
9455 #if USE_MAC_FONT_PANEL
9456 if (handle_font_eventUPP == NULL)
9457 handle_font_eventUPP = NewEventHandlerUPP (mac_handle_font_event);
9458 #endif
9283 err = InstallWindowEventHandler (window, handle_window_eventUPP, 9459 err = InstallWindowEventHandler (window, handle_window_eventUPP,
9284 GetEventTypeCount (specs_window), 9460 GetEventTypeCount (specs_window),
9285 specs_window, NULL, NULL); 9461 specs_window, NULL, NULL);
9286 if (err == noErr) 9462 if (err == noErr)
9287 err = InstallWindowEventHandler (window, handle_mouse_eventUPP, 9463 err = InstallWindowEventHandler (window, handle_mouse_eventUPP,
9288 GetEventTypeCount (specs_mouse), 9464 GetEventTypeCount (specs_mouse),
9289 specs_mouse, NULL, NULL); 9465 specs_mouse, NULL, NULL);
9466 #if USE_MAC_FONT_PANEL
9467 if (err == noErr)
9468 err = InstallWindowEventHandler (window, handle_font_eventUPP,
9469 GetEventTypeCount (specs_font),
9470 specs_font, NULL, NULL);
9471 #endif
9290 #endif 9472 #endif
9291 if (err == noErr) 9473 if (err == noErr)
9292 err = install_drag_handler (window); 9474 err = install_drag_handler (window);
9293 9475
9294 return err; 9476 return err;
9746 inev.kind = MENU_BAR_ACTIVATE_EVENT; 9928 inev.kind = MENU_BAR_ACTIVATE_EVENT;
9747 XSETFRAME (inev.frame_or_window, f); 9929 XSETFRAME (inev.frame_or_window, f);
9748 break; 9930 break;
9749 9931
9750 case inContent: 9932 case inContent:
9751 if (window_ptr != FRAME_MAC_WINDOW (mac_focus_frame (dpyinfo))) 9933 if (dpyinfo->x_focus_frame == NULL
9934 || window_ptr != FRAME_MAC_WINDOW (dpyinfo->x_focus_frame))
9752 SelectWindow (window_ptr); 9935 SelectWindow (window_ptr);
9753 else 9936 else
9754 { 9937 {
9755 ControlPartCode control_part_code; 9938 ControlPartCode control_part_code;
9756 ControlHandle ch; 9939 ControlHandle ch;
10842 Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); 11025 Fput (Qsuper, Qmodifier_value, make_number (super_modifier));
10843 11026
10844 #if USE_CARBON_EVENTS 11027 #if USE_CARBON_EVENTS
10845 Qhicommand = intern ("hicommand"); staticpro (&Qhicommand); 11028 Qhicommand = intern ("hicommand"); staticpro (&Qhicommand);
10846 #ifdef MAC_OSX 11029 #ifdef MAC_OSX
11030 Qtoolbar_switch_mode = intern ("toolbar-switch-mode");
11031 staticpro (&Qtoolbar_switch_mode);
11032 #if USE_MAC_FONT_PANEL
11033 Qpanel_closed = intern ("panel-closed"); staticpro (&Qpanel_closed);
11034 Qselection = intern ("selection"); staticpro (&Qselection);
11035 #endif
11036
10847 Qservices = intern ("services"); staticpro (&Qservices); 11037 Qservices = intern ("services"); staticpro (&Qservices);
10848 Qpaste = intern ("paste"); staticpro (&Qpaste); 11038 Qpaste = intern ("paste"); staticpro (&Qpaste);
10849 Qperform = intern ("perform"); staticpro (&Qperform); 11039 Qperform = intern ("perform"); staticpro (&Qperform);
10850 #endif 11040 #endif
10851 #endif 11041 #endif
10882 11072
10883 NOTE: Not supported on Mac yet. */); 11073 NOTE: Not supported on Mac yet. */);
10884 x_use_underline_position_properties = 0; 11074 x_use_underline_position_properties = 0;
10885 11075
10886 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, 11076 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
10887 doc: /* If not nil, Emacs uses toolkit scroll bars. */); 11077 doc: /* If not nil, Emacs uses toolkit scroll bars. */);
10888 #ifdef USE_TOOLKIT_SCROLL_BARS 11078 #ifdef USE_TOOLKIT_SCROLL_BARS
10889 Vx_toolkit_scroll_bars = Qt; 11079 Vx_toolkit_scroll_bars = Qt;
10890 #else 11080 #else
10891 Vx_toolkit_scroll_bars = Qnil; 11081 Vx_toolkit_scroll_bars = Qnil;
10892 #endif 11082 #endif
10936 mouse-3 and the command-key will register for mouse-2. */); 11126 mouse-3 and the command-key will register for mouse-2. */);
10937 Vmac_emulate_three_button_mouse = Qnil; 11127 Vmac_emulate_three_button_mouse = Qnil;
10938 11128
10939 #if USE_CARBON_EVENTS 11129 #if USE_CARBON_EVENTS
10940 DEFVAR_BOOL ("mac-wheel-button-is-mouse-2", &mac_wheel_button_is_mouse_2, 11130 DEFVAR_BOOL ("mac-wheel-button-is-mouse-2", &mac_wheel_button_is_mouse_2,
10941 doc: /* *Non-nil if the wheel button is mouse-2 and the right click mouse-3. 11131 doc: /* *Non-nil if the wheel button is mouse-2 and the right click mouse-3.
10942 Otherwise, the right click will be treated as mouse-2 and the wheel 11132 Otherwise, the right click will be treated as mouse-2 and the wheel
10943 button will be mouse-3. */); 11133 button will be mouse-3. */);
10944 mac_wheel_button_is_mouse_2 = 1; 11134 mac_wheel_button_is_mouse_2 = 1;
10945 11135
10946 DEFVAR_BOOL ("mac-pass-command-to-system", &mac_pass_command_to_system, 11136 DEFVAR_BOOL ("mac-pass-command-to-system", &mac_pass_command_to_system,
10947 doc: /* *Non-nil if command key presses are passed on to the Mac Toolbox. */); 11137 doc: /* *Non-nil if command key presses are passed on to the Mac Toolbox. */);
10948 mac_pass_command_to_system = 1; 11138 mac_pass_command_to_system = 1;
10949 11139
10950 DEFVAR_BOOL ("mac-pass-control-to-system", &mac_pass_control_to_system, 11140 DEFVAR_BOOL ("mac-pass-control-to-system", &mac_pass_control_to_system,
10951 doc: /* *Non-nil if control key presses are passed on to the Mac Toolbox. */); 11141 doc: /* *Non-nil if control key presses are passed on to the Mac Toolbox. */);
10952 mac_pass_control_to_system = 1; 11142 mac_pass_control_to_system = 1;
10953 11143
10954 #endif 11144 #endif
10955 11145
10956 DEFVAR_BOOL ("mac-allow-anti-aliasing", &mac_use_core_graphics, 11146 DEFVAR_BOOL ("mac-allow-anti-aliasing", &mac_use_core_graphics,
10957 doc: /* *If non-nil, allow anti-aliasing. 11147 doc: /* *If non-nil, allow anti-aliasing.
10958 The text will be rendered using Core Graphics text rendering which 11148 The text will be rendered using Core Graphics text rendering which
10959 may anti-alias the text. */); 11149 may anti-alias the text. */);
10960 #if USE_CG_DRAWING 11150 #if USE_CG_DRAWING
10961 mac_use_core_graphics = 1; 11151 mac_use_core_graphics = 1;
10962 #else 11152 #else
10965 11155
10966 /* Register an entry for `mac-roman' so that it can be used when 11156 /* Register an entry for `mac-roman' so that it can be used when
10967 creating the terminal frame on Mac OS 9 before loading 11157 creating the terminal frame on Mac OS 9 before loading
10968 term/mac-win.elc. */ 11158 term/mac-win.elc. */
10969 DEFVAR_LISP ("mac-charset-info-alist", &Vmac_charset_info_alist, 11159 DEFVAR_LISP ("mac-charset-info-alist", &Vmac_charset_info_alist,
10970 doc: /* Alist of Emacs character sets vs text encodings and coding systems. 11160 doc: /* Alist of Emacs character sets vs text encodings and coding systems.
10971 Each entry should be of the form: 11161 Each entry should be of the form:
10972 11162
10973 (CHARSET-NAME TEXT-ENCODING CODING-SYSTEM) 11163 (CHARSET-NAME TEXT-ENCODING CODING-SYSTEM)
10974 11164
10975 where CHARSET-NAME is a string used in font names to identify the 11165 where CHARSET-NAME is a string used in font names to identify the
10976 charset, TEXT-ENCODING is a TextEncodingBase value in Mac, and 11166 charset, TEXT-ENCODING is a TextEncodingBase value in Mac, and
10977 CODING_SYSTEM is a coding system corresponding to TEXT-ENCODING. */); 11167 CODING_SYSTEM is a coding system corresponding to TEXT-ENCODING. */);
10978 Vmac_charset_info_alist = 11168 Vmac_charset_info_alist =
10979 Fcons (list3 (build_string ("mac-roman"), 11169 Fcons (list3 (build_string ("mac-roman"),
10980 make_number (smRoman), Qnil), Qnil); 11170 make_number (smRoman), Qnil), Qnil);
11171
11172 #if USE_ATSUI
11173 DEFVAR_LISP ("mac-atsu-font-table", &Vmac_atsu_font_table,
11174 doc: /* Hash table of ATSU font IDs vs plist of attributes and values.
11175 Each font ID is represented as a four-byte string in native byte
11176 order. */);
11177 Vmac_atsu_font_table =
11178 make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE),
11179 make_float (DEFAULT_REHASH_SIZE),
11180 make_float (DEFAULT_REHASH_THRESHOLD),
11181 Qnil, Qnil, Qnil);
11182 #endif
10981 } 11183 }
10982 11184
10983 /* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b 11185 /* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b
10984 (do not change this comment) */ 11186 (do not change this comment) */