diff options
| author | Miles Bader | 2006-05-10 20:42:41 +0000 |
|---|---|---|
| committer | Miles Bader | 2006-05-10 20:42:41 +0000 |
| commit | 3bcf2b084a0dd1ff0399480d57b87e01cfe061dc (patch) | |
| tree | 355c68cda5a5c9c73824840df3cdae6320017283 /src/macterm.c | |
| parent | 0ea38cf9dca8f2b148d78f638eed17e8896984af (diff) | |
| parent | d105bfecce2288cd99f591382586a22a4ce1b6f2 (diff) | |
| download | emacs-3bcf2b084a0dd1ff0399480d57b87e01cfe061dc.tar.gz emacs-3bcf2b084a0dd1ff0399480d57b87e01cfe061dc.zip | |
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-60
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 259-273)
- Update from CVS
- lisp/replace.el (occur-engine): Bind `inhibit-field-text-motion' to t
- Merge from gnus--rel--5.10
- Rename "field-at-point" to "field-at-pos"
- (comint-insert-input): Remove redundant calls to setq and goto-char
* gnus--rel--5.10 (patch 99-100)
- Merge from emacs--devo--0
- Update from CVS
Diffstat (limited to 'src/macterm.c')
| -rw-r--r-- | src/macterm.c | 684 |
1 files changed, 372 insertions, 312 deletions
diff --git a/src/macterm.c b/src/macterm.c index 8ddd8febd69..e3b8b3b5881 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -4099,6 +4099,11 @@ x_new_focus_frame (dpyinfo, frame) | |||
| 4099 | pending_autoraise_frame = dpyinfo->x_focus_frame; | 4099 | pending_autoraise_frame = dpyinfo->x_focus_frame; |
| 4100 | else | 4100 | else |
| 4101 | pending_autoraise_frame = 0; | 4101 | pending_autoraise_frame = 0; |
| 4102 | |||
| 4103 | #if USE_MAC_FONT_PANEL | ||
| 4104 | if (frame) | ||
| 4105 | mac_set_font_info_for_selection (frame, DEFAULT_FACE_ID, 0); | ||
| 4106 | #endif | ||
| 4102 | } | 4107 | } |
| 4103 | 4108 | ||
| 4104 | x_frame_rehighlight (dpyinfo); | 4109 | x_frame_rehighlight (dpyinfo); |
| @@ -4456,35 +4461,11 @@ scroll_bar_timer_callback (timer, data) | |||
| 4456 | EventLoopTimerRef timer; | 4461 | EventLoopTimerRef timer; |
| 4457 | void *data; | 4462 | void *data; |
| 4458 | { | 4463 | { |
| 4459 | EventRef event = NULL; | 4464 | OSStatus err; |
| 4460 | OSErr err; | ||
| 4461 | |||
| 4462 | err = CreateEvent (NULL, kEventClassMouse, kEventMouseMoved, 0, | ||
| 4463 | kEventAttributeNone, &event); | ||
| 4464 | if (err == noErr) | ||
| 4465 | { | ||
| 4466 | Point mouse_pos; | ||
| 4467 | |||
| 4468 | GetMouse (&mouse_pos); | ||
| 4469 | LocalToGlobal (&mouse_pos); | ||
| 4470 | err = SetEventParameter (event, kEventParamMouseLocation, typeQDPoint, | ||
| 4471 | sizeof (Point), &mouse_pos); | ||
| 4472 | } | ||
| 4473 | if (err == noErr) | ||
| 4474 | { | ||
| 4475 | UInt32 modifiers = GetCurrentKeyModifiers (); | ||
| 4476 | 4465 | ||
| 4477 | err = SetEventParameter (event, kEventParamKeyModifiers, typeUInt32, | 4466 | err = mac_post_mouse_moved_event (); |
| 4478 | sizeof (UInt32), &modifiers); | ||
| 4479 | } | ||
| 4480 | if (err == noErr) | ||
| 4481 | err = PostEventToQueue (GetCurrentEventQueue (), event, | ||
| 4482 | kEventPriorityStandard); | ||
| 4483 | if (err == noErr) | 4467 | if (err == noErr) |
| 4484 | scroll_bar_timer_event_posted_p = 1; | 4468 | scroll_bar_timer_event_posted_p = 1; |
| 4485 | |||
| 4486 | if (event) | ||
| 4487 | ReleaseEvent (event); | ||
| 4488 | } | 4469 | } |
| 4489 | 4470 | ||
| 4490 | static OSStatus | 4471 | static OSStatus |
| @@ -6386,7 +6367,12 @@ x_free_frame_resources (f) | |||
| 6386 | f->output_data.mac = NULL; | 6367 | f->output_data.mac = NULL; |
| 6387 | 6368 | ||
| 6388 | if (f == dpyinfo->x_focus_frame) | 6369 | if (f == dpyinfo->x_focus_frame) |
| 6389 | dpyinfo->x_focus_frame = 0; | 6370 | { |
| 6371 | dpyinfo->x_focus_frame = 0; | ||
| 6372 | #if USE_MAC_FONT_PANEL | ||
| 6373 | mac_set_font_info_for_selection (NULL, DEFAULT_FACE_ID, 0); | ||
| 6374 | #endif | ||
| 6375 | } | ||
| 6390 | if (f == dpyinfo->x_focus_event_frame) | 6376 | if (f == dpyinfo->x_focus_event_frame) |
| 6391 | dpyinfo->x_focus_event_frame = 0; | 6377 | dpyinfo->x_focus_event_frame = 0; |
| 6392 | if (f == dpyinfo->x_highlight_frame) | 6378 | if (f == dpyinfo->x_highlight_frame) |
| @@ -6742,10 +6728,6 @@ xlfdpat_create (pattern) | |||
| 6742 | } | 6728 | } |
| 6743 | 6729 | ||
| 6744 | return pat; | 6730 | return pat; |
| 6745 | |||
| 6746 | error: | ||
| 6747 | xlfdpat_destroy (pat); | ||
| 6748 | return NULL; | ||
| 6749 | } | 6731 | } |
| 6750 | 6732 | ||
| 6751 | static INLINE int | 6733 | static INLINE int |
| @@ -6914,6 +6896,8 @@ static Lisp_Object fm_font_family_alist; | |||
| 6914 | #if USE_ATSUI | 6896 | #if USE_ATSUI |
| 6915 | /* Hash table linking font family names to ATSU font IDs. */ | 6897 | /* Hash table linking font family names to ATSU font IDs. */ |
| 6916 | static Lisp_Object atsu_font_id_hash; | 6898 | static Lisp_Object atsu_font_id_hash; |
| 6899 | static Lisp_Object Vmac_atsu_font_table; | ||
| 6900 | extern Lisp_Object QCfamily, QCweight, QCslant, Qnormal, Qbold, Qitalic; | ||
| 6917 | #endif | 6901 | #endif |
| 6918 | 6902 | ||
| 6919 | /* Alist linking character set strings to Mac text encoding and Emacs | 6903 | /* Alist linking character set strings to Mac text encoding and Emacs |
| @@ -7209,8 +7193,21 @@ init_font_name_table () | |||
| 7209 | NULL, NULL); | 7193 | NULL, NULL); |
| 7210 | if (err == noErr) | 7194 | if (err == noErr) |
| 7211 | { | 7195 | { |
| 7196 | FMFontFamily ff; | ||
| 7197 | FMFontStyle style = normal; | ||
| 7198 | |||
| 7212 | decode_mac_font_name (name, name_len + 1, Qnil); | 7199 | decode_mac_font_name (name, name_len + 1, Qnil); |
| 7213 | family = make_unibyte_string (name, name_len); | 7200 | family = make_unibyte_string (name, name_len); |
| 7201 | FMGetFontFamilyInstanceFromFont (font_ids[i], &ff, &style); | ||
| 7202 | Fputhash (make_unibyte_string ((char *)(font_ids + i), | ||
| 7203 | sizeof (ATSUFontID)), | ||
| 7204 | Fcons (QCfamily, | ||
| 7205 | list5 (family, | ||
| 7206 | QCweight, | ||
| 7207 | style & bold ? Qbold : Qnormal, | ||
| 7208 | QCslant, | ||
| 7209 | style & italic ? Qitalic : Qnormal)), | ||
| 7210 | Vmac_atsu_font_table); | ||
| 7214 | if (*name != '.' | 7211 | if (*name != '.' |
| 7215 | && hash_lookup (h, family, &hash_code) < 0) | 7212 | && hash_lookup (h, family, &hash_code) < 0) |
| 7216 | { | 7213 | { |
| @@ -7756,6 +7753,7 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7756 | ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector, | 7753 | ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector, |
| 7757 | kDecomposeDiacriticsSelector}; | 7754 | kDecomposeDiacriticsSelector}; |
| 7758 | Lisp_Object font_id_cons; | 7755 | Lisp_Object font_id_cons; |
| 7756 | FMFontStyle style; | ||
| 7759 | 7757 | ||
| 7760 | font_id_cons = Fgethash (make_unibyte_string (family, strlen (family)), | 7758 | font_id_cons = Fgethash (make_unibyte_string (family, strlen (family)), |
| 7761 | atsu_font_id_hash, Qnil); | 7759 | atsu_font_id_hash, Qnil); |
| @@ -7774,7 +7772,11 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7774 | return NULL; | 7772 | return NULL; |
| 7775 | err = ATSUSetAttributes (mac_style, sizeof (tags) / sizeof (tags[0]), | 7773 | err = ATSUSetAttributes (mac_style, sizeof (tags) / sizeof (tags[0]), |
| 7776 | tags, sizes, values); | 7774 | tags, sizes, values); |
| 7777 | fontnum = -1; | 7775 | if (err != noErr) |
| 7776 | return NULL; | ||
| 7777 | err = FMGetFontFamilyInstanceFromFont (font_id, &fontnum, &style); | ||
| 7778 | if (err != noErr) | ||
| 7779 | fontnum = -1; | ||
| 7778 | scriptcode = kTextEncodingMacUnicode; | 7780 | scriptcode = kTextEncodingMacUnicode; |
| 7779 | } | 7781 | } |
| 7780 | else | 7782 | else |
| @@ -7834,22 +7836,20 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7834 | pcm_init (font->bounds.rows[0], 0x100); | 7836 | pcm_init (font->bounds.rows[0], 0x100); |
| 7835 | 7837 | ||
| 7836 | #if USE_CG_TEXT_DRAWING | 7838 | #if USE_CG_TEXT_DRAWING |
| 7837 | { | 7839 | if (fontnum != -1) |
| 7838 | FMFontFamily font_family; | 7840 | { |
| 7839 | FMFontStyle style; | 7841 | FMFontStyle style; |
| 7840 | ATSFontRef ats_font; | 7842 | ATSFontRef ats_font; |
| 7841 | 7843 | ||
| 7842 | err = FMGetFontFamilyInstanceFromFont (font_id, &font_family, &style); | 7844 | err = FMGetFontFromFontFamilyInstance (fontnum, fontface, |
| 7843 | if (err == noErr) | ||
| 7844 | err = FMGetFontFromFontFamilyInstance (font_family, fontface, | ||
| 7845 | &font_id, &style); | 7845 | &font_id, &style); |
| 7846 | /* Use CG text drawing if italic/bold is not synthesized. */ | 7846 | /* Use CG text drawing if italic/bold is not synthesized. */ |
| 7847 | if (err == noErr && style == fontface) | 7847 | if (err == noErr && style == fontface) |
| 7848 | { | 7848 | { |
| 7849 | ats_font = FMGetATSFontRefFromFont (font_id); | 7849 | ats_font = FMGetATSFontRefFromFont (font_id); |
| 7850 | font->cg_font = CGFontCreateWithPlatformFont (&ats_font); | 7850 | font->cg_font = CGFontCreateWithPlatformFont (&ats_font); |
| 7851 | } | 7851 | } |
| 7852 | } | 7852 | } |
| 7853 | 7853 | ||
| 7854 | if (font->cg_font) | 7854 | if (font->cg_font) |
| 7855 | { | 7855 | { |
| @@ -8340,6 +8340,55 @@ x_find_ccl_program (fontp) | |||
| 8340 | } | 8340 | } |
| 8341 | } | 8341 | } |
| 8342 | 8342 | ||
| 8343 | #if USE_MAC_FONT_PANEL | ||
| 8344 | OSStatus | ||
| 8345 | mac_set_font_info_for_selection (f, face_id, c) | ||
| 8346 | struct frame *f; | ||
| 8347 | int face_id, c; | ||
| 8348 | { | ||
| 8349 | OSStatus err; | ||
| 8350 | EventTargetRef target = NULL; | ||
| 8351 | XFontStruct *font = NULL; | ||
| 8352 | |||
| 8353 | if (f) | ||
| 8354 | { | ||
| 8355 | target = GetWindowEventTarget (FRAME_MAC_WINDOW (f)); | ||
| 8356 | |||
| 8357 | if (FRAME_FACE_CACHE (f) && CHAR_VALID_P (c, 0)) | ||
| 8358 | { | ||
| 8359 | struct face *face; | ||
| 8360 | |||
| 8361 | face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c); | ||
| 8362 | face = FACE_FROM_ID (f, face_id); | ||
| 8363 | font = face->font; | ||
| 8364 | } | ||
| 8365 | } | ||
| 8366 | |||
| 8367 | if (font == NULL) | ||
| 8368 | err = SetFontInfoForSelection (kFontSelectionATSUIType, 0, NULL, target); | ||
| 8369 | else | ||
| 8370 | { | ||
| 8371 | if (font->mac_fontnum != -1) | ||
| 8372 | { | ||
| 8373 | FontSelectionQDStyle qd_style; | ||
| 8374 | |||
| 8375 | qd_style.version = kFontSelectionQDStyleVersionZero; | ||
| 8376 | qd_style.instance.fontFamily = font->mac_fontnum; | ||
| 8377 | qd_style.instance.fontStyle = font->mac_fontface; | ||
| 8378 | qd_style.size = font->mac_fontsize; | ||
| 8379 | qd_style.hasColor = false; | ||
| 8380 | |||
| 8381 | err = SetFontInfoForSelection (kFontSelectionQDType, | ||
| 8382 | 1, &qd_style, target); | ||
| 8383 | } | ||
| 8384 | else | ||
| 8385 | err = SetFontInfoForSelection (kFontSelectionATSUIType, | ||
| 8386 | 1, &font->mac_style, target); | ||
| 8387 | } | ||
| 8388 | |||
| 8389 | return err; | ||
| 8390 | } | ||
| 8391 | #endif | ||
| 8343 | 8392 | ||
| 8344 | 8393 | ||
| 8345 | /* The Mac Event loop code */ | 8394 | /* The Mac Event loop code */ |
| @@ -8427,6 +8476,14 @@ Point saved_menu_event_location; | |||
| 8427 | /* Apple Events */ | 8476 | /* Apple Events */ |
| 8428 | #if USE_CARBON_EVENTS | 8477 | #if USE_CARBON_EVENTS |
| 8429 | static Lisp_Object Qhicommand; | 8478 | static Lisp_Object Qhicommand; |
| 8479 | #ifdef MAC_OSX | ||
| 8480 | extern Lisp_Object Qwindow; | ||
| 8481 | static Lisp_Object Qtoolbar_switch_mode; | ||
| 8482 | #endif | ||
| 8483 | #if USE_MAC_FONT_PANEL | ||
| 8484 | extern Lisp_Object Qfont; | ||
| 8485 | static Lisp_Object Qpanel_closed, Qselection; | ||
| 8486 | #endif | ||
| 8430 | #endif | 8487 | #endif |
| 8431 | extern int mac_ready_for_apple_events; | 8488 | extern int mac_ready_for_apple_events; |
| 8432 | extern Lisp_Object Qundefined; | 8489 | extern Lisp_Object Qundefined; |
| @@ -8436,18 +8493,14 @@ extern void mac_find_apple_event_spec P_ ((AEEventClass, AEEventID, | |||
| 8436 | Lisp_Object *)); | 8493 | Lisp_Object *)); |
| 8437 | extern OSErr init_coercion_handler P_ ((void)); | 8494 | extern OSErr init_coercion_handler P_ ((void)); |
| 8438 | 8495 | ||
| 8439 | #if TARGET_API_MAC_CARBON | ||
| 8440 | /* Drag and Drop */ | 8496 | /* Drag and Drop */ |
| 8441 | static pascal OSErr mac_do_track_drag (DragTrackingMessage, WindowPtr, void*, DragReference); | 8497 | OSErr install_drag_handler P_ ((WindowRef)); |
| 8442 | static pascal OSErr mac_do_receive_drag (WindowPtr, void*, DragReference); | 8498 | void remove_drag_handler P_ ((WindowRef)); |
| 8443 | static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL; | ||
| 8444 | static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL; | ||
| 8445 | #endif | ||
| 8446 | 8499 | ||
| 8447 | #if USE_CARBON_EVENTS | 8500 | #if USE_CARBON_EVENTS |
| 8448 | #ifdef MAC_OSX | 8501 | #ifdef MAC_OSX |
| 8449 | extern void init_service_handler (); | 8502 | extern void init_service_handler (); |
| 8450 | static Lisp_Object Qservices, Qpaste, Qperform; | 8503 | static Lisp_Object Qservice, Qpaste, Qperform; |
| 8451 | #endif | 8504 | #endif |
| 8452 | /* Window Event Handler */ | 8505 | /* Window Event Handler */ |
| 8453 | static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, | 8506 | static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, |
| @@ -8998,47 +9051,84 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out) | |||
| 8998 | x_real_positions (f, &f->left_pos, &f->top_pos); | 9051 | x_real_positions (f, &f->left_pos, &f->top_pos); |
| 8999 | } | 9052 | } |
| 9000 | 9053 | ||
| 9001 | OSErr | 9054 | void |
| 9002 | mac_store_apple_event (class, id, desc) | 9055 | mac_store_apple_event (class, id, desc) |
| 9003 | Lisp_Object class, id; | 9056 | Lisp_Object class, id; |
| 9004 | const AEDesc *desc; | 9057 | const AEDesc *desc; |
| 9005 | { | 9058 | { |
| 9006 | OSErr err; | ||
| 9007 | struct input_event buf; | 9059 | struct input_event buf; |
| 9008 | AEDesc *desc_copy; | ||
| 9009 | 9060 | ||
| 9010 | desc_copy = xmalloc (sizeof (AEDesc)); | 9061 | EVENT_INIT (buf); |
| 9011 | err = AEDuplicateDesc (desc, desc_copy); | 9062 | |
| 9012 | if (err == noErr) | 9063 | buf.kind = MAC_APPLE_EVENT; |
| 9013 | { | 9064 | buf.x = class; |
| 9014 | EVENT_INIT (buf); | 9065 | buf.y = id; |
| 9066 | XSETFRAME (buf.frame_or_window, | ||
| 9067 | mac_focus_frame (&one_mac_display_info)); | ||
| 9068 | /* Now that Lisp object allocations are protected by BLOCK_INPUT, it | ||
| 9069 | is safe to use them during read_socket_hook. */ | ||
| 9070 | buf.arg = mac_aedesc_to_lisp (desc); | ||
| 9071 | kbd_buffer_store_event (&buf); | ||
| 9072 | } | ||
| 9015 | 9073 | ||
| 9016 | buf.kind = MAC_APPLE_EVENT; | 9074 | #if TARGET_API_MAC_CARBON |
| 9017 | buf.x = class; | 9075 | static OSStatus |
| 9018 | buf.y = id; | 9076 | mac_store_event_ref_as_apple_event (class, id, class_key, id_key, |
| 9019 | buf.code = (int)desc_copy; | 9077 | event, num_params, names, types) |
| 9020 | XSETFRAME (buf.frame_or_window, | 9078 | AEEventClass class; |
| 9021 | mac_focus_frame (&one_mac_display_info)); | 9079 | AEEventID id; |
| 9022 | buf.arg = Qnil; | 9080 | Lisp_Object class_key, id_key; |
| 9023 | kbd_buffer_store_event (&buf); | 9081 | EventRef event; |
| 9082 | UInt32 num_params; | ||
| 9083 | EventParamName *names; | ||
| 9084 | EventParamType *types; | ||
| 9085 | { | ||
| 9086 | OSStatus err = eventNotHandledErr; | ||
| 9087 | Lisp_Object binding; | ||
| 9088 | |||
| 9089 | mac_find_apple_event_spec (class, id, &class_key, &id_key, &binding); | ||
| 9090 | if (!NILP (binding) && !EQ (binding, Qundefined)) | ||
| 9091 | { | ||
| 9092 | if (INTEGERP (binding)) | ||
| 9093 | err = XINT (binding); | ||
| 9094 | else | ||
| 9095 | { | ||
| 9096 | AppleEvent apple_event; | ||
| 9097 | err = create_apple_event_from_event_ref (event, num_params, | ||
| 9098 | names, types, | ||
| 9099 | &apple_event); | ||
| 9100 | if (err == noErr) | ||
| 9101 | { | ||
| 9102 | mac_store_apple_event (class_key, id_key, &apple_event); | ||
| 9103 | AEDisposeDesc (&apple_event); | ||
| 9104 | } | ||
| 9105 | } | ||
| 9024 | } | 9106 | } |
| 9025 | 9107 | ||
| 9026 | return err; | 9108 | return err; |
| 9027 | } | 9109 | } |
| 9028 | 9110 | ||
| 9029 | Lisp_Object | 9111 | void |
| 9030 | mac_make_lispy_event_code (code) | 9112 | mac_store_drag_event (window, mouse_pos, modifiers, desc) |
| 9031 | int code; | 9113 | WindowRef window; |
| 9114 | Point mouse_pos; | ||
| 9115 | SInt16 modifiers; | ||
| 9116 | const AEDesc *desc; | ||
| 9032 | { | 9117 | { |
| 9033 | AEDesc *desc = (AEDesc *)code; | 9118 | struct input_event buf; |
| 9034 | Lisp_Object obj; | ||
| 9035 | 9119 | ||
| 9036 | obj = mac_aedesc_to_lisp (desc); | 9120 | EVENT_INIT (buf); |
| 9037 | AEDisposeDesc (desc); | ||
| 9038 | xfree (desc); | ||
| 9039 | 9121 | ||
| 9040 | return obj; | 9122 | buf.kind = DRAG_N_DROP_EVENT; |
| 9123 | buf.modifiers = mac_to_emacs_modifiers (modifiers); | ||
| 9124 | buf.timestamp = TickCount () * (1000 / 60); | ||
| 9125 | XSETINT (buf.x, mouse_pos.h); | ||
| 9126 | XSETINT (buf.y, mouse_pos.v); | ||
| 9127 | XSETFRAME (buf.frame_or_window, mac_window_to_frame (window)); | ||
| 9128 | buf.arg = mac_aedesc_to_lisp (desc); | ||
| 9129 | kbd_buffer_store_event (&buf); | ||
| 9041 | } | 9130 | } |
| 9131 | #endif | ||
| 9042 | 9132 | ||
| 9043 | #if USE_CARBON_EVENTS | 9133 | #if USE_CARBON_EVENTS |
| 9044 | static pascal OSStatus | 9134 | static pascal OSStatus |
| @@ -9049,7 +9139,11 @@ mac_handle_command_event (next_handler, event, data) | |||
| 9049 | { | 9139 | { |
| 9050 | OSStatus result, err; | 9140 | OSStatus result, err; |
| 9051 | HICommand command; | 9141 | HICommand command; |
| 9052 | Lisp_Object class_key, id_key, binding; | 9142 | static EventParamName names[] = {kEventParamDirectObject, |
| 9143 | kEventParamKeyModifiers}; | ||
| 9144 | static EventParamType types[] = {typeHICommand, | ||
| 9145 | typeUInt32}; | ||
| 9146 | int num_params = sizeof (names) / sizeof (names[0]); | ||
| 9053 | 9147 | ||
| 9054 | result = CallNextEventHandler (next_handler, event); | 9148 | result = CallNextEventHandler (next_handler, event); |
| 9055 | if (result != eventNotHandledErr) | 9149 | if (result != eventNotHandledErr) |
| @@ -9063,33 +9157,10 @@ mac_handle_command_event (next_handler, event, data) | |||
| 9063 | 9157 | ||
| 9064 | /* A HICommand event is mapped to an Apple event whose event class | 9158 | /* A HICommand event is mapped to an Apple event whose event class |
| 9065 | symbol is `hicommand' and event ID is its command ID. */ | 9159 | symbol is `hicommand' and event ID is its command ID. */ |
| 9066 | class_key = Qhicommand; | 9160 | err = mac_store_event_ref_as_apple_event (0, command.commandID, |
| 9067 | mac_find_apple_event_spec (0, command.commandID, | 9161 | Qhicommand, Qnil, |
| 9068 | &class_key, &id_key, &binding); | 9162 | event, num_params, names, types); |
| 9069 | if (!NILP (binding) && !EQ (binding, Qundefined)) | 9163 | return err == noErr ? noErr : eventNotHandledErr; |
| 9070 | { | ||
| 9071 | if (INTEGERP (binding)) | ||
| 9072 | return XINT (binding); | ||
| 9073 | else | ||
| 9074 | { | ||
| 9075 | AppleEvent apple_event; | ||
| 9076 | static EventParamName names[] = {kEventParamDirectObject, | ||
| 9077 | kEventParamKeyModifiers}; | ||
| 9078 | static EventParamType types[] = {typeHICommand, | ||
| 9079 | typeUInt32}; | ||
| 9080 | err = create_apple_event_from_event_ref (event, 2, names, types, | ||
| 9081 | &apple_event); | ||
| 9082 | if (err == noErr) | ||
| 9083 | { | ||
| 9084 | err = mac_store_apple_event (class_key, id_key, &apple_event); | ||
| 9085 | AEDisposeDesc (&apple_event); | ||
| 9086 | } | ||
| 9087 | if (err == noErr) | ||
| 9088 | return noErr; | ||
| 9089 | } | ||
| 9090 | } | ||
| 9091 | |||
| 9092 | return eventNotHandledErr; | ||
| 9093 | } | 9164 | } |
| 9094 | 9165 | ||
| 9095 | static OSErr | 9166 | static OSErr |
| @@ -9192,6 +9263,33 @@ mac_handle_window_event (next_handler, event, data) | |||
| 9192 | return noErr; | 9263 | return noErr; |
| 9193 | 9264 | ||
| 9194 | break; | 9265 | break; |
| 9266 | |||
| 9267 | #ifdef MAC_OSX | ||
| 9268 | case kEventWindowToolbarSwitchMode: | ||
| 9269 | result = CallNextEventHandler (next_handler, event); | ||
| 9270 | { | ||
| 9271 | static EventParamName names[] = {kEventParamDirectObject, | ||
| 9272 | kEventParamWindowMouseLocation, | ||
| 9273 | kEventParamKeyModifiers, | ||
| 9274 | kEventParamMouseButton, | ||
| 9275 | kEventParamClickCount, | ||
| 9276 | kEventParamMouseChord}; | ||
| 9277 | static EventParamType types[] = {typeWindowRef, | ||
| 9278 | typeQDPoint, | ||
| 9279 | typeUInt32, | ||
| 9280 | typeMouseButton, | ||
| 9281 | typeUInt32, | ||
| 9282 | typeUInt32}; | ||
| 9283 | int num_params = sizeof (names) / sizeof (names[0]); | ||
| 9284 | |||
| 9285 | err = mac_store_event_ref_as_apple_event (0, 0, | ||
| 9286 | Qwindow, | ||
| 9287 | Qtoolbar_switch_mode, | ||
| 9288 | event, num_params, | ||
| 9289 | names, types); | ||
| 9290 | } | ||
| 9291 | return err == noErr ? noErr : result; | ||
| 9292 | #endif | ||
| 9195 | } | 9293 | } |
| 9196 | 9294 | ||
| 9197 | return eventNotHandledErr; | 9295 | return eventNotHandledErr; |
| @@ -9266,45 +9364,96 @@ mac_handle_mouse_event (next_handler, event, data) | |||
| 9266 | return eventNotHandledErr; | 9364 | return eventNotHandledErr; |
| 9267 | } | 9365 | } |
| 9268 | 9366 | ||
| 9367 | #if USE_MAC_FONT_PANEL | ||
| 9368 | static pascal OSStatus | ||
| 9369 | mac_handle_font_event (next_handler, event, data) | ||
| 9370 | EventHandlerCallRef next_handler; | ||
| 9371 | EventRef event; | ||
| 9372 | void *data; | ||
| 9373 | { | ||
| 9374 | OSStatus result, err; | ||
| 9375 | Lisp_Object id_key; | ||
| 9376 | int num_params; | ||
| 9377 | EventParamName *names; | ||
| 9378 | EventParamType *types; | ||
| 9379 | static EventParamName names_sel[] = {kEventParamATSUFontID, | ||
| 9380 | kEventParamATSUFontSize, | ||
| 9381 | kEventParamFMFontFamily, | ||
| 9382 | kEventParamFMFontSize, | ||
| 9383 | kEventParamFontColor}; | ||
| 9384 | static EventParamType types_sel[] = {typeATSUFontID, | ||
| 9385 | typeATSUSize, | ||
| 9386 | typeFMFontFamily, | ||
| 9387 | typeFMFontSize, | ||
| 9388 | typeFontColor}; | ||
| 9389 | |||
| 9390 | result = CallNextEventHandler (next_handler, event); | ||
| 9391 | if (result != eventNotHandledErr) | ||
| 9392 | return result; | ||
| 9393 | |||
| 9394 | switch (GetEventKind (event)) | ||
| 9395 | { | ||
| 9396 | case kEventFontPanelClosed: | ||
| 9397 | id_key = Qpanel_closed; | ||
| 9398 | num_params = 0; | ||
| 9399 | names = NULL; | ||
| 9400 | types = NULL; | ||
| 9401 | break; | ||
| 9402 | |||
| 9403 | case kEventFontSelection: | ||
| 9404 | id_key = Qselection; | ||
| 9405 | num_params = sizeof (names_sel) / sizeof (names_sel[0]); | ||
| 9406 | names = names_sel; | ||
| 9407 | types = types_sel; | ||
| 9408 | break; | ||
| 9409 | } | ||
| 9410 | |||
| 9411 | err = mac_store_event_ref_as_apple_event (0, 0, Qfont, id_key, | ||
| 9412 | event, num_params, | ||
| 9413 | names, types); | ||
| 9414 | |||
| 9415 | return err == noErr ? noErr : eventNotHandledErr; | ||
| 9416 | } | ||
| 9417 | #endif | ||
| 9418 | |||
| 9269 | #ifdef MAC_OSX | 9419 | #ifdef MAC_OSX |
| 9270 | OSErr | 9420 | OSStatus |
| 9271 | mac_store_services_event (event) | 9421 | mac_store_service_event (event) |
| 9272 | EventRef event; | 9422 | EventRef event; |
| 9273 | { | 9423 | { |
| 9274 | OSErr err; | 9424 | OSStatus err; |
| 9275 | AppleEvent apple_event; | ||
| 9276 | Lisp_Object id_key; | 9425 | Lisp_Object id_key; |
| 9426 | int num_params; | ||
| 9427 | EventParamName *names; | ||
| 9428 | EventParamType *types; | ||
| 9429 | static EventParamName names_pfm[] = {kEventParamServiceMessageName, | ||
| 9430 | kEventParamServiceUserData}; | ||
| 9431 | static EventParamType types_pfm[] = {typeCFStringRef, | ||
| 9432 | typeCFStringRef}; | ||
| 9277 | 9433 | ||
| 9278 | switch (GetEventKind (event)) | 9434 | switch (GetEventKind (event)) |
| 9279 | { | 9435 | { |
| 9280 | case kEventServicePaste: | 9436 | case kEventServicePaste: |
| 9281 | id_key = Qpaste; | 9437 | id_key = Qpaste; |
| 9282 | err = create_apple_event_from_event_ref (event, 0, NULL, NULL, | 9438 | num_params = 0; |
| 9283 | &apple_event); | 9439 | names = NULL; |
| 9440 | types = NULL; | ||
| 9284 | break; | 9441 | break; |
| 9285 | 9442 | ||
| 9286 | case kEventServicePerform: | 9443 | case kEventServicePerform: |
| 9287 | { | 9444 | id_key = Qperform; |
| 9288 | static EventParamName names[] = {kEventParamServiceMessageName, | 9445 | num_params = sizeof (names_pfm) / sizeof (names_pfm[0]); |
| 9289 | kEventParamServiceUserData}; | 9446 | names = names_pfm; |
| 9290 | static EventParamType types[] = {typeCFStringRef, | 9447 | types = types_pfm; |
| 9291 | typeCFStringRef}; | ||
| 9292 | |||
| 9293 | id_key = Qperform; | ||
| 9294 | err = create_apple_event_from_event_ref (event, 2, names, types, | ||
| 9295 | &apple_event); | ||
| 9296 | } | ||
| 9297 | break; | 9448 | break; |
| 9298 | 9449 | ||
| 9299 | default: | 9450 | default: |
| 9300 | abort (); | 9451 | abort (); |
| 9301 | } | 9452 | } |
| 9302 | 9453 | ||
| 9303 | if (err == noErr) | 9454 | err = mac_store_event_ref_as_apple_event (0, 0, Qservice, id_key, |
| 9304 | { | 9455 | event, num_params, |
| 9305 | err = mac_store_apple_event (Qservices, id_key, &apple_event); | 9456 | names, types); |
| 9306 | AEDisposeDesc (&apple_event); | ||
| 9307 | } | ||
| 9308 | 9457 | ||
| 9309 | return err; | 9458 | return err; |
| 9310 | } | 9459 | } |
| @@ -9324,15 +9473,28 @@ install_window_handler (window) | |||
| 9324 | {kEventClassWindow, kEventWindowShown}, | 9473 | {kEventClassWindow, kEventWindowShown}, |
| 9325 | {kEventClassWindow, kEventWindowHidden}, | 9474 | {kEventClassWindow, kEventWindowHidden}, |
| 9326 | {kEventClassWindow, kEventWindowExpanded}, | 9475 | {kEventClassWindow, kEventWindowExpanded}, |
| 9327 | {kEventClassWindow, kEventWindowCollapsed}}; | 9476 | {kEventClassWindow, kEventWindowCollapsed}, |
| 9477 | #ifdef MAC_OSX | ||
| 9478 | {kEventClassWindow, kEventWindowToolbarSwitchMode}, | ||
| 9479 | #endif | ||
| 9480 | }; | ||
| 9328 | EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; | 9481 | EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; |
| 9329 | static EventHandlerUPP handle_window_eventUPP = NULL; | 9482 | static EventHandlerUPP handle_window_eventUPP = NULL; |
| 9330 | static EventHandlerUPP handle_mouse_eventUPP = NULL; | 9483 | static EventHandlerUPP handle_mouse_eventUPP = NULL; |
| 9484 | #if USE_MAC_FONT_PANEL | ||
| 9485 | EventTypeSpec specs_font[] = {{kEventClassFont, kEventFontPanelClosed}, | ||
| 9486 | {kEventClassFont, kEventFontSelection}}; | ||
| 9487 | static EventHandlerUPP handle_font_eventUPP = NULL; | ||
| 9488 | #endif | ||
| 9331 | 9489 | ||
| 9332 | if (handle_window_eventUPP == NULL) | 9490 | if (handle_window_eventUPP == NULL) |
| 9333 | handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event); | 9491 | handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event); |
| 9334 | if (handle_mouse_eventUPP == NULL) | 9492 | if (handle_mouse_eventUPP == NULL) |
| 9335 | handle_mouse_eventUPP = NewEventHandlerUPP (mac_handle_mouse_event); | 9493 | handle_mouse_eventUPP = NewEventHandlerUPP (mac_handle_mouse_event); |
| 9494 | #if USE_MAC_FONT_PANEL | ||
| 9495 | if (handle_font_eventUPP == NULL) | ||
| 9496 | handle_font_eventUPP = NewEventHandlerUPP (mac_handle_font_event); | ||
| 9497 | #endif | ||
| 9336 | err = InstallWindowEventHandler (window, handle_window_eventUPP, | 9498 | err = InstallWindowEventHandler (window, handle_window_eventUPP, |
| 9337 | GetEventTypeCount (specs_window), | 9499 | GetEventTypeCount (specs_window), |
| 9338 | specs_window, NULL, NULL); | 9500 | specs_window, NULL, NULL); |
| @@ -9340,18 +9502,16 @@ install_window_handler (window) | |||
| 9340 | err = InstallWindowEventHandler (window, handle_mouse_eventUPP, | 9502 | err = InstallWindowEventHandler (window, handle_mouse_eventUPP, |
| 9341 | GetEventTypeCount (specs_mouse), | 9503 | GetEventTypeCount (specs_mouse), |
| 9342 | specs_mouse, NULL, NULL); | 9504 | specs_mouse, NULL, NULL); |
| 9343 | #endif | 9505 | #if USE_MAC_FONT_PANEL |
| 9344 | #if TARGET_API_MAC_CARBON | ||
| 9345 | if (mac_do_track_dragUPP == NULL) | ||
| 9346 | mac_do_track_dragUPP = NewDragTrackingHandlerUPP (mac_do_track_drag); | ||
| 9347 | if (mac_do_receive_dragUPP == NULL) | ||
| 9348 | mac_do_receive_dragUPP = NewDragReceiveHandlerUPP (mac_do_receive_drag); | ||
| 9349 | |||
| 9350 | if (err == noErr) | 9506 | if (err == noErr) |
| 9351 | err = InstallTrackingHandler (mac_do_track_dragUPP, window, NULL); | 9507 | err = InstallWindowEventHandler (window, handle_font_eventUPP, |
| 9352 | if (err == noErr) | 9508 | GetEventTypeCount (specs_font), |
| 9353 | err = InstallReceiveHandler (mac_do_receive_dragUPP, window, NULL); | 9509 | specs_font, NULL, NULL); |
| 9510 | #endif | ||
| 9354 | #endif | 9511 | #endif |
| 9512 | if (err == noErr) | ||
| 9513 | err = install_drag_handler (window); | ||
| 9514 | |||
| 9355 | return err; | 9515 | return err; |
| 9356 | } | 9516 | } |
| 9357 | 9517 | ||
| @@ -9359,167 +9519,9 @@ void | |||
| 9359 | remove_window_handler (window) | 9519 | remove_window_handler (window) |
| 9360 | WindowPtr window; | 9520 | WindowPtr window; |
| 9361 | { | 9521 | { |
| 9362 | #if TARGET_API_MAC_CARBON | 9522 | remove_drag_handler (window); |
| 9363 | if (mac_do_track_dragUPP) | ||
| 9364 | RemoveTrackingHandler (mac_do_track_dragUPP, window); | ||
| 9365 | if (mac_do_receive_dragUPP) | ||
| 9366 | RemoveReceiveHandler (mac_do_receive_dragUPP, window); | ||
| 9367 | #endif | ||
| 9368 | } | 9523 | } |
| 9369 | 9524 | ||
| 9370 | #if TARGET_API_MAC_CARBON | ||
| 9371 | static pascal OSErr | ||
| 9372 | mac_do_track_drag (DragTrackingMessage message, WindowPtr window, | ||
| 9373 | void *handlerRefCon, DragReference theDrag) | ||
| 9374 | { | ||
| 9375 | static int can_accept; | ||
| 9376 | short items; | ||
| 9377 | short index; | ||
| 9378 | ItemReference theItem; | ||
| 9379 | FlavorFlags theFlags; | ||
| 9380 | OSErr result; | ||
| 9381 | |||
| 9382 | if (GetFrontWindowOfClass (kMovableModalWindowClass, false)) | ||
| 9383 | return dragNotAcceptedErr; | ||
| 9384 | |||
| 9385 | switch (message) | ||
| 9386 | { | ||
| 9387 | case kDragTrackingEnterHandler: | ||
| 9388 | CountDragItems (theDrag, &items); | ||
| 9389 | can_accept = 0; | ||
| 9390 | for (index = 1; index <= items; index++) | ||
| 9391 | { | ||
| 9392 | GetDragItemReferenceNumber (theDrag, index, &theItem); | ||
| 9393 | result = GetFlavorFlags (theDrag, theItem, flavorTypeHFS, &theFlags); | ||
| 9394 | if (result == noErr) | ||
| 9395 | { | ||
| 9396 | can_accept = 1; | ||
| 9397 | break; | ||
| 9398 | } | ||
| 9399 | } | ||
| 9400 | break; | ||
| 9401 | |||
| 9402 | case kDragTrackingEnterWindow: | ||
| 9403 | if (can_accept) | ||
| 9404 | { | ||
| 9405 | RgnHandle hilite_rgn = NewRgn (); | ||
| 9406 | Rect r; | ||
| 9407 | struct frame *f = mac_window_to_frame (window); | ||
| 9408 | |||
| 9409 | GetWindowPortBounds (window, &r); | ||
| 9410 | OffsetRect (&r, -r.left, -r.top); | ||
| 9411 | RectRgn (hilite_rgn, &r); | ||
| 9412 | ShowDragHilite (theDrag, hilite_rgn, true); | ||
| 9413 | DisposeRgn (hilite_rgn); | ||
| 9414 | SetThemeCursor (kThemeCopyArrowCursor); | ||
| 9415 | } | ||
| 9416 | break; | ||
| 9417 | |||
| 9418 | case kDragTrackingInWindow: | ||
| 9419 | break; | ||
| 9420 | |||
| 9421 | case kDragTrackingLeaveWindow: | ||
| 9422 | if (can_accept) | ||
| 9423 | { | ||
| 9424 | struct frame *f = mac_window_to_frame (window); | ||
| 9425 | |||
| 9426 | HideDragHilite (theDrag); | ||
| 9427 | SetThemeCursor (kThemeArrowCursor); | ||
| 9428 | } | ||
| 9429 | break; | ||
| 9430 | |||
| 9431 | case kDragTrackingLeaveHandler: | ||
| 9432 | break; | ||
| 9433 | } | ||
| 9434 | |||
| 9435 | return noErr; | ||
| 9436 | } | ||
| 9437 | |||
| 9438 | static pascal OSErr | ||
| 9439 | mac_do_receive_drag (WindowPtr window, void *handlerRefCon, | ||
| 9440 | DragReference theDrag) | ||
| 9441 | { | ||
| 9442 | short items; | ||
| 9443 | short index; | ||
| 9444 | FlavorFlags theFlags; | ||
| 9445 | Point mouse; | ||
| 9446 | OSErr result; | ||
| 9447 | ItemReference theItem; | ||
| 9448 | HFSFlavor data; | ||
| 9449 | Size size = sizeof (HFSFlavor); | ||
| 9450 | Lisp_Object file_list; | ||
| 9451 | |||
| 9452 | if (GetFrontWindowOfClass (kMovableModalWindowClass, false)) | ||
| 9453 | return dragNotAcceptedErr; | ||
| 9454 | |||
| 9455 | file_list = Qnil; | ||
| 9456 | GetDragMouse (theDrag, &mouse, 0L); | ||
| 9457 | CountDragItems (theDrag, &items); | ||
| 9458 | for (index = 1; index <= items; index++) | ||
| 9459 | { | ||
| 9460 | /* Only handle file references. */ | ||
| 9461 | GetDragItemReferenceNumber (theDrag, index, &theItem); | ||
| 9462 | result = GetFlavorFlags (theDrag, theItem, flavorTypeHFS, &theFlags); | ||
| 9463 | if (result == noErr) | ||
| 9464 | { | ||
| 9465 | OSErr err; | ||
| 9466 | AEDesc desc; | ||
| 9467 | |||
| 9468 | err = GetFlavorData (theDrag, theItem, flavorTypeHFS, | ||
| 9469 | &data, &size, 0L); | ||
| 9470 | if (err == noErr) | ||
| 9471 | err = AECoercePtr (typeFSS, &data.fileSpec, sizeof (FSSpec), | ||
| 9472 | TYPE_FILE_NAME, &desc); | ||
| 9473 | if (err == noErr) | ||
| 9474 | { | ||
| 9475 | Lisp_Object file; | ||
| 9476 | |||
| 9477 | /* x-dnd functions expect undecoded filenames. */ | ||
| 9478 | file = make_uninit_string (AEGetDescDataSize (&desc)); | ||
| 9479 | err = AEGetDescData (&desc, SDATA (file), SBYTES (file)); | ||
| 9480 | if (err == noErr) | ||
| 9481 | file_list = Fcons (file, file_list); | ||
| 9482 | AEDisposeDesc (&desc); | ||
| 9483 | } | ||
| 9484 | } | ||
| 9485 | } | ||
| 9486 | /* If there are items in the list, construct an event and post it to | ||
| 9487 | the queue like an interrupt using kbd_buffer_store_event. */ | ||
| 9488 | if (!NILP (file_list)) | ||
| 9489 | { | ||
| 9490 | struct input_event event; | ||
| 9491 | Lisp_Object frame; | ||
| 9492 | struct frame *f = mac_window_to_frame (window); | ||
| 9493 | SInt16 modifiers; | ||
| 9494 | |||
| 9495 | GlobalToLocal (&mouse); | ||
| 9496 | GetDragModifiers (theDrag, NULL, NULL, &modifiers); | ||
| 9497 | |||
| 9498 | event.kind = DRAG_N_DROP_EVENT; | ||
| 9499 | event.code = 0; | ||
| 9500 | event.modifiers = mac_to_emacs_modifiers (modifiers); | ||
| 9501 | event.timestamp = TickCount () * (1000 / 60); | ||
| 9502 | XSETINT (event.x, mouse.h); | ||
| 9503 | XSETINT (event.y, mouse.v); | ||
| 9504 | XSETFRAME (frame, f); | ||
| 9505 | event.frame_or_window = frame; | ||
| 9506 | event.arg = file_list; | ||
| 9507 | /* Post to the interrupt queue */ | ||
| 9508 | kbd_buffer_store_event (&event); | ||
| 9509 | /* MAC_TODO: Mimic behavior of windows by switching contexts to Emacs */ | ||
| 9510 | { | ||
| 9511 | ProcessSerialNumber psn; | ||
| 9512 | GetCurrentProcess (&psn); | ||
| 9513 | SetFrontProcess (&psn); | ||
| 9514 | } | ||
| 9515 | |||
| 9516 | return noErr; | ||
| 9517 | } | ||
| 9518 | else | ||
| 9519 | return dragNotAcceptedErr; | ||
| 9520 | } | ||
| 9521 | #endif | ||
| 9522 | |||
| 9523 | 9525 | ||
| 9524 | #if __profile__ | 9526 | #if __profile__ |
| 9525 | void | 9527 | void |
| @@ -9805,6 +9807,41 @@ mac_wait_next_event (er, sleep_time, dequeue) | |||
| 9805 | } | 9807 | } |
| 9806 | #endif /* not USE_CARBON_EVENTS */ | 9808 | #endif /* not USE_CARBON_EVENTS */ |
| 9807 | 9809 | ||
| 9810 | #if TARGET_API_MAC_CARBON | ||
| 9811 | OSStatus | ||
| 9812 | mac_post_mouse_moved_event () | ||
| 9813 | { | ||
| 9814 | EventRef event = NULL; | ||
| 9815 | OSStatus err; | ||
| 9816 | |||
| 9817 | err = CreateEvent (NULL, kEventClassMouse, kEventMouseMoved, 0, | ||
| 9818 | kEventAttributeNone, &event); | ||
| 9819 | if (err == noErr) | ||
| 9820 | { | ||
| 9821 | Point mouse_pos; | ||
| 9822 | |||
| 9823 | GetMouse (&mouse_pos); | ||
| 9824 | LocalToGlobal (&mouse_pos); | ||
| 9825 | err = SetEventParameter (event, kEventParamMouseLocation, typeQDPoint, | ||
| 9826 | sizeof (Point), &mouse_pos); | ||
| 9827 | } | ||
| 9828 | if (err == noErr) | ||
| 9829 | { | ||
| 9830 | UInt32 modifiers = GetCurrentKeyModifiers (); | ||
| 9831 | |||
| 9832 | err = SetEventParameter (event, kEventParamKeyModifiers, typeUInt32, | ||
| 9833 | sizeof (UInt32), &modifiers); | ||
| 9834 | } | ||
| 9835 | if (err == noErr) | ||
| 9836 | err = PostEventToQueue (GetCurrentEventQueue (), event, | ||
| 9837 | kEventPriorityStandard); | ||
| 9838 | if (event) | ||
| 9839 | ReleaseEvent (event); | ||
| 9840 | |||
| 9841 | return err; | ||
| 9842 | } | ||
| 9843 | #endif | ||
| 9844 | |||
| 9808 | /* Emacs calls this whenever it wants to read an input event from the | 9845 | /* Emacs calls this whenever it wants to read an input event from the |
| 9809 | user. */ | 9846 | user. */ |
| 9810 | int | 9847 | int |
| @@ -9932,7 +9969,13 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9932 | break; | 9969 | break; |
| 9933 | 9970 | ||
| 9934 | case inContent: | 9971 | case inContent: |
| 9935 | if (window_ptr != FRAME_MAC_WINDOW (mac_focus_frame (dpyinfo))) | 9972 | if ( |
| 9973 | #if TARGET_API_MAC_CARBON | ||
| 9974 | FrontNonFloatingWindow () | ||
| 9975 | #else | ||
| 9976 | FrontWindow () | ||
| 9977 | #endif | ||
| 9978 | != window_ptr) | ||
| 9936 | SelectWindow (window_ptr); | 9979 | SelectWindow (window_ptr); |
| 9937 | else | 9980 | else |
| 9938 | { | 9981 | { |
| @@ -10079,20 +10122,18 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10079 | } | 10122 | } |
| 10080 | break; | 10123 | break; |
| 10081 | 10124 | ||
| 10082 | #if TARGET_API_MAC_CARBON | ||
| 10083 | case inProxyIcon: | ||
| 10084 | if (TrackWindowProxyDrag (window_ptr, er.where) | ||
| 10085 | != errUserWantsToDragWindow) | ||
| 10086 | break; | ||
| 10087 | /* fall through */ | ||
| 10088 | #endif | ||
| 10089 | case inDrag: | 10125 | case inDrag: |
| 10090 | #if TARGET_API_MAC_CARBON | 10126 | #if TARGET_API_MAC_CARBON |
| 10127 | case inProxyIcon: | ||
| 10091 | if (IsWindowPathSelectClick (window_ptr, &er)) | 10128 | if (IsWindowPathSelectClick (window_ptr, &er)) |
| 10092 | { | 10129 | { |
| 10093 | WindowPathSelect (window_ptr, NULL, NULL); | 10130 | WindowPathSelect (window_ptr, NULL, NULL); |
| 10094 | break; | 10131 | break; |
| 10095 | } | 10132 | } |
| 10133 | if (part_code == inProxyIcon | ||
| 10134 | && (TrackWindowProxyDrag (window_ptr, er.where) | ||
| 10135 | != errUserWantsToDragWindow)) | ||
| 10136 | break; | ||
| 10096 | DragWindow (window_ptr, er.where, NULL); | 10137 | DragWindow (window_ptr, er.where, NULL); |
| 10097 | #else /* not TARGET_API_MAC_CARBON */ | 10138 | #else /* not TARGET_API_MAC_CARBON */ |
| 10098 | DragWindow (window_ptr, er.where, &qd.screenBits.bounds); | 10139 | DragWindow (window_ptr, er.where, &qd.screenBits.bounds); |
| @@ -11030,7 +11071,14 @@ syms_of_macterm () | |||
| 11030 | #if USE_CARBON_EVENTS | 11071 | #if USE_CARBON_EVENTS |
| 11031 | Qhicommand = intern ("hicommand"); staticpro (&Qhicommand); | 11072 | Qhicommand = intern ("hicommand"); staticpro (&Qhicommand); |
| 11032 | #ifdef MAC_OSX | 11073 | #ifdef MAC_OSX |
| 11033 | Qservices = intern ("services"); staticpro (&Qservices); | 11074 | Qtoolbar_switch_mode = intern ("toolbar-switch-mode"); |
| 11075 | staticpro (&Qtoolbar_switch_mode); | ||
| 11076 | #if USE_MAC_FONT_PANEL | ||
| 11077 | Qpanel_closed = intern ("panel-closed"); staticpro (&Qpanel_closed); | ||
| 11078 | Qselection = intern ("selection"); staticpro (&Qselection); | ||
| 11079 | #endif | ||
| 11080 | |||
| 11081 | Qservice = intern ("service"); staticpro (&Qservice); | ||
| 11034 | Qpaste = intern ("paste"); staticpro (&Qpaste); | 11082 | Qpaste = intern ("paste"); staticpro (&Qpaste); |
| 11035 | Qperform = intern ("perform"); staticpro (&Qperform); | 11083 | Qperform = intern ("perform"); staticpro (&Qperform); |
| 11036 | #endif | 11084 | #endif |
| @@ -11070,7 +11118,7 @@ NOTE: Not supported on Mac yet. */); | |||
| 11070 | x_use_underline_position_properties = 0; | 11118 | x_use_underline_position_properties = 0; |
| 11071 | 11119 | ||
| 11072 | DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, | 11120 | DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, |
| 11073 | doc: /* If not nil, Emacs uses toolkit scroll bars. */); | 11121 | doc: /* If not nil, Emacs uses toolkit scroll bars. */); |
| 11074 | #ifdef USE_TOOLKIT_SCROLL_BARS | 11122 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 11075 | Vx_toolkit_scroll_bars = Qt; | 11123 | Vx_toolkit_scroll_bars = Qt; |
| 11076 | #else | 11124 | #else |
| @@ -11124,23 +11172,23 @@ mouse-3 and the command-key will register for mouse-2. */); | |||
| 11124 | 11172 | ||
| 11125 | #if USE_CARBON_EVENTS | 11173 | #if USE_CARBON_EVENTS |
| 11126 | DEFVAR_BOOL ("mac-wheel-button-is-mouse-2", &mac_wheel_button_is_mouse_2, | 11174 | DEFVAR_BOOL ("mac-wheel-button-is-mouse-2", &mac_wheel_button_is_mouse_2, |
| 11127 | doc: /* *Non-nil if the wheel button is mouse-2 and the right click mouse-3. | 11175 | doc: /* *Non-nil if the wheel button is mouse-2 and the right click mouse-3. |
| 11128 | Otherwise, the right click will be treated as mouse-2 and the wheel | 11176 | Otherwise, the right click will be treated as mouse-2 and the wheel |
| 11129 | button will be mouse-3. */); | 11177 | button will be mouse-3. */); |
| 11130 | mac_wheel_button_is_mouse_2 = 1; | 11178 | mac_wheel_button_is_mouse_2 = 1; |
| 11131 | 11179 | ||
| 11132 | DEFVAR_BOOL ("mac-pass-command-to-system", &mac_pass_command_to_system, | 11180 | DEFVAR_BOOL ("mac-pass-command-to-system", &mac_pass_command_to_system, |
| 11133 | doc: /* *Non-nil if command key presses are passed on to the Mac Toolbox. */); | 11181 | doc: /* *Non-nil if command key presses are passed on to the Mac Toolbox. */); |
| 11134 | mac_pass_command_to_system = 1; | 11182 | mac_pass_command_to_system = 1; |
| 11135 | 11183 | ||
| 11136 | DEFVAR_BOOL ("mac-pass-control-to-system", &mac_pass_control_to_system, | 11184 | DEFVAR_BOOL ("mac-pass-control-to-system", &mac_pass_control_to_system, |
| 11137 | doc: /* *Non-nil if control key presses are passed on to the Mac Toolbox. */); | 11185 | doc: /* *Non-nil if control key presses are passed on to the Mac Toolbox. */); |
| 11138 | mac_pass_control_to_system = 1; | 11186 | mac_pass_control_to_system = 1; |
| 11139 | 11187 | ||
| 11140 | #endif | 11188 | #endif |
| 11141 | 11189 | ||
| 11142 | DEFVAR_BOOL ("mac-allow-anti-aliasing", &mac_use_core_graphics, | 11190 | DEFVAR_BOOL ("mac-allow-anti-aliasing", &mac_use_core_graphics, |
| 11143 | doc: /* *If non-nil, allow anti-aliasing. | 11191 | doc: /* *If non-nil, allow anti-aliasing. |
| 11144 | The text will be rendered using Core Graphics text rendering which | 11192 | The text will be rendered using Core Graphics text rendering which |
| 11145 | may anti-alias the text. */); | 11193 | may anti-alias the text. */); |
| 11146 | #if USE_CG_DRAWING | 11194 | #if USE_CG_DRAWING |
| @@ -11153,7 +11201,7 @@ may anti-alias the text. */); | |||
| 11153 | creating the terminal frame on Mac OS 9 before loading | 11201 | creating the terminal frame on Mac OS 9 before loading |
| 11154 | term/mac-win.elc. */ | 11202 | term/mac-win.elc. */ |
| 11155 | DEFVAR_LISP ("mac-charset-info-alist", &Vmac_charset_info_alist, | 11203 | DEFVAR_LISP ("mac-charset-info-alist", &Vmac_charset_info_alist, |
| 11156 | doc: /* Alist of Emacs character sets vs text encodings and coding systems. | 11204 | doc: /* Alist of Emacs character sets vs text encodings and coding systems. |
| 11157 | Each entry should be of the form: | 11205 | Each entry should be of the form: |
| 11158 | 11206 | ||
| 11159 | (CHARSET-NAME TEXT-ENCODING CODING-SYSTEM) | 11207 | (CHARSET-NAME TEXT-ENCODING CODING-SYSTEM) |
| @@ -11164,6 +11212,18 @@ CODING_SYSTEM is a coding system corresponding to TEXT-ENCODING. */); | |||
| 11164 | Vmac_charset_info_alist = | 11212 | Vmac_charset_info_alist = |
| 11165 | Fcons (list3 (build_string ("mac-roman"), | 11213 | Fcons (list3 (build_string ("mac-roman"), |
| 11166 | make_number (smRoman), Qnil), Qnil); | 11214 | make_number (smRoman), Qnil), Qnil); |
| 11215 | |||
| 11216 | #if USE_ATSUI | ||
| 11217 | DEFVAR_LISP ("mac-atsu-font-table", &Vmac_atsu_font_table, | ||
| 11218 | doc: /* Hash table of ATSU font IDs vs plist of attributes and values. | ||
| 11219 | Each font ID is represented as a four-byte string in native byte | ||
| 11220 | order. */); | ||
| 11221 | Vmac_atsu_font_table = | ||
| 11222 | make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), | ||
| 11223 | make_float (DEFAULT_REHASH_SIZE), | ||
| 11224 | make_float (DEFAULT_REHASH_THRESHOLD), | ||
| 11225 | Qnil, Qnil, Qnil); | ||
| 11226 | #endif | ||
| 11167 | } | 11227 | } |
| 11168 | 11228 | ||
| 11169 | /* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b | 11229 | /* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b |