Mercurial > emacs
comparison src/macterm.c @ 90384:c156f6a9e7b5
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-56
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 204-225)
- Update from CVS
- Sync from erc--emacs--0
- Merge from gnus--rel--5.10
- Improve tq.el.
- Update from CVS: src/puresize.h (PURESIZE_RATIO): Reduce to 10/6.
* gnus--rel--5.10 (patch 81-85)
- Update from CVS
- Merge from emacs--devo--0
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 17 Apr 2006 08:41:12 +0000 |
parents | 65ca8fb66a0d 321089786c7b |
children | 72dea2ff0142 |
comparison
equal
deleted
inserted
replaced
90383:ab20fb198dda | 90384:c156f6a9e7b5 |
---|---|
75 #include "dispextern.h" | 75 #include "dispextern.h" |
76 #include "fontset.h" | 76 #include "fontset.h" |
77 #include "termhooks.h" | 77 #include "termhooks.h" |
78 #include "termopts.h" | 78 #include "termopts.h" |
79 #include "termchar.h" | 79 #include "termchar.h" |
80 #include "gnu.h" | |
81 #include "disptab.h" | 80 #include "disptab.h" |
82 #include "buffer.h" | 81 #include "buffer.h" |
83 #include "window.h" | 82 #include "window.h" |
84 #include "keyboard.h" | 83 #include "keyboard.h" |
85 #include "intervals.h" | 84 #include "intervals.h" |
215 | 214 |
216 #define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP) | 215 #define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP) |
217 | 216 |
218 struct mac_display_info *mac_display_info_for_display (Display *); | 217 struct mac_display_info *mac_display_info_for_display (Display *); |
219 static void x_update_window_end P_ ((struct window *, int, int)); | 218 static void x_update_window_end P_ ((struct window *, int, int)); |
220 static int x_io_error_quitter P_ ((Display *)); | |
221 int x_catch_errors P_ ((Display *)); | 219 int x_catch_errors P_ ((Display *)); |
222 void x_uncatch_errors P_ ((Display *, int)); | 220 void x_uncatch_errors P_ ((Display *, int)); |
223 void x_lower_frame P_ ((struct frame *)); | 221 void x_lower_frame P_ ((struct frame *)); |
224 void x_scroll_bar_clear P_ ((struct frame *)); | 222 void x_scroll_bar_clear P_ ((struct frame *)); |
225 int x_had_errors_p P_ ((Display *)); | 223 int x_had_errors_p P_ ((Display *)); |
1697 } | 1695 } |
1698 } | 1696 } |
1699 #endif | 1697 #endif |
1700 } | 1698 } |
1701 | 1699 |
1702 /* x_sync is a no-op on Mac. */ | |
1703 void | |
1704 x_sync (f) | |
1705 void *f; | |
1706 { | |
1707 } | |
1708 | |
1709 | |
1710 /* Flush display of frame F, or of all frames if F is null. */ | 1700 /* Flush display of frame F, or of all frames if F is null. */ |
1711 | 1701 |
1712 static void | 1702 static void |
1713 x_flush (f) | 1703 x_flush (f) |
1714 struct frame *f; | 1704 struct frame *f; |
2080 mac_define_fringe_bitmap (which, bits, h, wd) | 2070 mac_define_fringe_bitmap (which, bits, h, wd) |
2081 int which; | 2071 int which; |
2082 unsigned short *bits; | 2072 unsigned short *bits; |
2083 int h, wd; | 2073 int h, wd; |
2084 { | 2074 { |
2085 unsigned short *mask_bits; | |
2086 int i; | 2075 int i; |
2087 CGDataProviderRef provider; | 2076 CGDataProviderRef provider; |
2088 | 2077 |
2089 if (which >= max_fringe_bmp) | 2078 if (which >= max_fringe_bmp) |
2090 { | 2079 { |
2366 double, int, unsigned long)); | 2355 double, int, unsigned long)); |
2367 static void x_setup_relief_colors P_ ((struct glyph_string *)); | 2356 static void x_setup_relief_colors P_ ((struct glyph_string *)); |
2368 static void x_draw_image_glyph_string P_ ((struct glyph_string *)); | 2357 static void x_draw_image_glyph_string P_ ((struct glyph_string *)); |
2369 static void x_draw_image_relief P_ ((struct glyph_string *)); | 2358 static void x_draw_image_relief P_ ((struct glyph_string *)); |
2370 static void x_draw_image_foreground P_ ((struct glyph_string *)); | 2359 static void x_draw_image_foreground P_ ((struct glyph_string *)); |
2371 static void x_draw_image_foreground_1 P_ ((struct glyph_string *, Pixmap)); | |
2372 static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int, | 2360 static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int, |
2373 int, int, int)); | 2361 int, int, int)); |
2374 static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int, | 2362 static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int, |
2375 int, int, int, int, int, int, | 2363 int, int, int, int, int, int, |
2376 Rect *)); | 2364 Rect *)); |
2567 | 2555 |
2568 static void | 2556 static void |
2569 mac_compute_glyph_string_overhangs (s) | 2557 mac_compute_glyph_string_overhangs (s) |
2570 struct glyph_string *s; | 2558 struct glyph_string *s; |
2571 { | 2559 { |
2572 if (s->cmp == NULL | 2560 if (!(s->cmp == NULL |
2573 && s->first_glyph->type == CHAR_GLYPH) | 2561 && s->first_glyph->type == CHAR_GLYPH)) |
2574 if (!s->two_byte_p | 2562 return; |
2563 | |
2564 if (!s->two_byte_p | |
2575 #if USE_ATSUI | 2565 #if USE_ATSUI |
2576 || s->font->mac_style | 2566 || s->font->mac_style |
2577 #endif | 2567 #endif |
2578 ) | 2568 ) |
2579 { | 2569 { |
2580 XCharStruct cs; | 2570 XCharStruct cs; |
2581 | 2571 |
2582 mac_text_extents_16 (s->font, s->char2b, s->nchars, &cs); | 2572 mac_text_extents_16 (s->font, s->char2b, s->nchars, &cs); |
2583 s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0; | 2573 s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0; |
2584 s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0; | 2574 s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0; |
2585 } | 2575 } |
2586 else | 2576 else |
2587 { | 2577 { |
2588 Rect r; | 2578 Rect r; |
2589 MacFontStruct *font = s->font; | 2579 MacFontStruct *font = s->font; |
2590 | 2580 |
2591 TextFont (font->mac_fontnum); | 2581 TextFont (font->mac_fontnum); |
2592 TextSize (font->mac_fontsize); | 2582 TextSize (font->mac_fontsize); |
2593 TextFace (font->mac_fontface); | 2583 TextFace (font->mac_fontface); |
2594 | 2584 |
2595 QDTextBounds (s->nchars * 2, (char *)s->char2b, &r); | 2585 QDTextBounds (s->nchars * 2, (char *)s->char2b, &r); |
2596 | 2586 |
2597 s->right_overhang = r.right > s->width ? r.right - s->width : 0; | 2587 s->right_overhang = r.right > s->width ? r.right - s->width : 0; |
2598 s->left_overhang = r.left < 0 ? -r.left : 0; | 2588 s->left_overhang = r.left < 0 ? -r.left : 0; |
2599 } | 2589 } |
2600 } | 2590 } |
2601 | 2591 |
2602 | 2592 |
2603 /* Fill rectangle X, Y, W, H with background color of glyph string S. */ | 2593 /* Fill rectangle X, Y, W, H with background color of glyph string S. */ |
2604 | 2594 |
3430 { | 3420 { |
3431 int x, y; | 3421 int x, y; |
3432 int box_line_hwidth = abs (s->face->box_line_width); | 3422 int box_line_hwidth = abs (s->face->box_line_width); |
3433 int box_line_vwidth = max (s->face->box_line_width, 0); | 3423 int box_line_vwidth = max (s->face->box_line_width, 0); |
3434 int height; | 3424 int height; |
3435 Pixmap pixmap = 0; | |
3436 | 3425 |
3437 height = s->height - 2 * box_line_vwidth; | 3426 height = s->height - 2 * box_line_vwidth; |
3438 | 3427 |
3439 | 3428 |
3440 /* Fill background with face under the image. Do it only if row is | 3429 /* Fill background with face under the image. Do it only if row is |
4176 } | 4165 } |
4177 } | 4166 } |
4178 | 4167 |
4179 | 4168 |
4180 | 4169 |
4181 /* Keyboard processing - modifier keys, vendor-specific keysyms, etc. */ | |
4182 | |
4183 #if 0 /* MAC_TODO */ | |
4184 /* Initialize mode_switch_bit and modifier_meaning. */ | |
4185 static void | |
4186 x_find_modifier_meanings (dpyinfo) | |
4187 struct x_display_info *dpyinfo; | |
4188 { | |
4189 int min_code, max_code; | |
4190 KeySym *syms; | |
4191 int syms_per_code; | |
4192 XModifierKeymap *mods; | |
4193 | |
4194 dpyinfo->meta_mod_mask = 0; | |
4195 dpyinfo->shift_lock_mask = 0; | |
4196 dpyinfo->alt_mod_mask = 0; | |
4197 dpyinfo->super_mod_mask = 0; | |
4198 dpyinfo->hyper_mod_mask = 0; | |
4199 | |
4200 #ifdef HAVE_X11R4 | |
4201 XDisplayKeycodes (dpyinfo->display, &min_code, &max_code); | |
4202 #else | |
4203 min_code = dpyinfo->display->min_keycode; | |
4204 max_code = dpyinfo->display->max_keycode; | |
4205 #endif | |
4206 | |
4207 syms = XGetKeyboardMapping (dpyinfo->display, | |
4208 min_code, max_code - min_code + 1, | |
4209 &syms_per_code); | |
4210 mods = XGetModifierMapping (dpyinfo->display); | |
4211 | |
4212 /* Scan the modifier table to see which modifier bits the Meta and | |
4213 Alt keysyms are on. */ | |
4214 { | |
4215 int row, col; /* The row and column in the modifier table. */ | |
4216 | |
4217 for (row = 3; row < 8; row++) | |
4218 for (col = 0; col < mods->max_keypermod; col++) | |
4219 { | |
4220 KeyCode code | |
4221 = mods->modifiermap[(row * mods->max_keypermod) + col]; | |
4222 | |
4223 /* Zeroes are used for filler. Skip them. */ | |
4224 if (code == 0) | |
4225 continue; | |
4226 | |
4227 /* Are any of this keycode's keysyms a meta key? */ | |
4228 { | |
4229 int code_col; | |
4230 | |
4231 for (code_col = 0; code_col < syms_per_code; code_col++) | |
4232 { | |
4233 int sym = syms[((code - min_code) * syms_per_code) + code_col]; | |
4234 | |
4235 switch (sym) | |
4236 { | |
4237 case XK_Meta_L: | |
4238 case XK_Meta_R: | |
4239 dpyinfo->meta_mod_mask |= (1 << row); | |
4240 break; | |
4241 | |
4242 case XK_Alt_L: | |
4243 case XK_Alt_R: | |
4244 dpyinfo->alt_mod_mask |= (1 << row); | |
4245 break; | |
4246 | |
4247 case XK_Hyper_L: | |
4248 case XK_Hyper_R: | |
4249 dpyinfo->hyper_mod_mask |= (1 << row); | |
4250 break; | |
4251 | |
4252 case XK_Super_L: | |
4253 case XK_Super_R: | |
4254 dpyinfo->super_mod_mask |= (1 << row); | |
4255 break; | |
4256 | |
4257 case XK_Shift_Lock: | |
4258 /* Ignore this if it's not on the lock modifier. */ | |
4259 if ((1 << row) == LockMask) | |
4260 dpyinfo->shift_lock_mask = LockMask; | |
4261 break; | |
4262 } | |
4263 } | |
4264 } | |
4265 } | |
4266 } | |
4267 | |
4268 /* If we couldn't find any meta keys, accept any alt keys as meta keys. */ | |
4269 if (! dpyinfo->meta_mod_mask) | |
4270 { | |
4271 dpyinfo->meta_mod_mask = dpyinfo->alt_mod_mask; | |
4272 dpyinfo->alt_mod_mask = 0; | |
4273 } | |
4274 | |
4275 /* If some keys are both alt and meta, | |
4276 make them just meta, not alt. */ | |
4277 if (dpyinfo->alt_mod_mask & dpyinfo->meta_mod_mask) | |
4278 { | |
4279 dpyinfo->alt_mod_mask &= ~dpyinfo->meta_mod_mask; | |
4280 } | |
4281 | |
4282 XFree ((char *) syms); | |
4283 XFreeModifiermap (mods); | |
4284 } | |
4285 | |
4286 #endif /* MAC_TODO */ | |
4287 | |
4288 /* Convert between the modifier bits X uses and the modifier bits | |
4289 Emacs uses. */ | |
4290 | |
4291 static unsigned int | |
4292 x_mac_to_emacs_modifiers (dpyinfo, state) | |
4293 struct x_display_info *dpyinfo; | |
4294 unsigned short state; | |
4295 { | |
4296 return (((state & shiftKey) ? shift_modifier : 0) | |
4297 | ((state & controlKey) ? ctrl_modifier : 0) | |
4298 | ((state & cmdKey) ? meta_modifier : 0) | |
4299 | ((state & optionKey) ? alt_modifier : 0)); | |
4300 } | |
4301 | |
4302 #if 0 /* MAC_TODO */ | |
4303 static unsigned short | |
4304 x_emacs_to_x_modifiers (dpyinfo, state) | |
4305 struct x_display_info *dpyinfo; | |
4306 unsigned int state; | |
4307 { | |
4308 return ( ((state & alt_modifier) ? dpyinfo->alt_mod_mask : 0) | |
4309 | ((state & super_modifier) ? dpyinfo->super_mod_mask : 0) | |
4310 | ((state & hyper_modifier) ? dpyinfo->hyper_mod_mask : 0) | |
4311 | ((state & shift_modifier) ? ShiftMask : 0) | |
4312 | ((state & ctrl_modifier) ? ControlMask : 0) | |
4313 | ((state & meta_modifier) ? dpyinfo->meta_mod_mask : 0)); | |
4314 } | |
4315 #endif /* MAC_TODO */ | |
4316 | |
4317 /* Convert a keysym to its name. */ | 4170 /* Convert a keysym to its name. */ |
4318 | 4171 |
4319 char * | 4172 char * |
4320 x_get_keysym_name (keysym) | 4173 x_get_keysym_name (keysym) |
4321 int keysym; | 4174 int keysym; |
5102 UNBLOCK_INPUT; | 4955 UNBLOCK_INPUT; |
5103 } | 4956 } |
5104 | 4957 |
5105 #ifdef USE_TOOLKIT_SCROLL_BARS | 4958 #ifdef USE_TOOLKIT_SCROLL_BARS |
5106 if (NILP (bar->track_top)) | 4959 if (NILP (bar->track_top)) |
5107 if (sb_width >= disp_height) | 4960 { |
5108 { | 4961 if (sb_width >= disp_height) |
5109 XSETINT (bar->track_top, 0); | 4962 { |
5110 XSETINT (bar->track_height, 0); | 4963 XSETINT (bar->track_top, 0); |
5111 } | 4964 XSETINT (bar->track_height, 0); |
5112 else | 4965 } |
5113 { | 4966 else |
5114 ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); | 4967 { |
5115 Rect r0, r1; | 4968 ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); |
5116 | 4969 Rect r0, r1; |
5117 BLOCK_INPUT; | 4970 |
5118 | 4971 BLOCK_INPUT; |
5119 SetControl32BitMinimum (ch, 0); | 4972 |
5120 SetControl32BitMaximum (ch, 1); | 4973 SetControl32BitMinimum (ch, 0); |
5121 SetControlViewSize (ch, 1); | 4974 SetControl32BitMaximum (ch, 1); |
5122 | 4975 SetControlViewSize (ch, 1); |
5123 /* Move the scroll bar thumb to the top. */ | 4976 |
5124 SetControl32BitValue (ch, 0); | 4977 /* Move the scroll bar thumb to the top. */ |
5125 get_control_part_bounds (ch, kControlIndicatorPart, &r0); | 4978 SetControl32BitValue (ch, 0); |
5126 | 4979 get_control_part_bounds (ch, kControlIndicatorPart, &r0); |
5127 /* Move the scroll bar thumb to the bottom. */ | 4980 |
5128 SetControl32BitValue (ch, 1); | 4981 /* Move the scroll bar thumb to the bottom. */ |
5129 get_control_part_bounds (ch, kControlIndicatorPart, &r1); | 4982 SetControl32BitValue (ch, 1); |
5130 | 4983 get_control_part_bounds (ch, kControlIndicatorPart, &r1); |
5131 UnionRect (&r0, &r1, &r0); | 4984 |
5132 XSETINT (bar->track_top, r0.top); | 4985 UnionRect (&r0, &r1, &r0); |
5133 XSETINT (bar->track_height, r0.bottom - r0.top); | 4986 XSETINT (bar->track_top, r0.top); |
5134 | 4987 XSETINT (bar->track_height, r0.bottom - r0.top); |
5135 /* Don't show the scroll bar if its height is not enough to | 4988 |
5136 display the scroll bar thumb. */ | 4989 /* Don't show the scroll bar if its height is not enough to |
5137 if (r0.bottom - r0.top > 0) | 4990 display the scroll bar thumb. */ |
5138 ShowControl (ch); | 4991 if (r0.bottom - r0.top > 0) |
5139 | 4992 ShowControl (ch); |
5140 UNBLOCK_INPUT; | 4993 |
5141 } | 4994 UNBLOCK_INPUT; |
4995 } | |
4996 } | |
5142 | 4997 |
5143 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); | 4998 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); |
5144 #else /* not USE_TOOLKIT_SCROLL_BARS */ | 4999 #else /* not USE_TOOLKIT_SCROLL_BARS */ |
5145 /* Set the scroll bar's current state, unless we're currently being | 5000 /* Set the scroll bar's current state, unless we're currently being |
5146 dragged. */ | 5001 dragged. */ |
6222 WindowPtr wp = FRAME_MAC_WINDOW (f); | 6077 WindowPtr wp = FRAME_MAC_WINDOW (f); |
6223 int visible = 0, iconified = 0; | 6078 int visible = 0, iconified = 0; |
6224 struct input_event buf; | 6079 struct input_event buf; |
6225 | 6080 |
6226 if (IsWindowVisible (wp)) | 6081 if (IsWindowVisible (wp)) |
6227 if (IsWindowCollapsed (wp)) | 6082 { |
6228 iconified = 1; | 6083 if (IsWindowCollapsed (wp)) |
6229 else | 6084 iconified = 1; |
6230 visible = 1; | 6085 else |
6086 visible = 1; | |
6087 } | |
6231 | 6088 |
6232 if (!f->async_visible && visible) | 6089 if (!f->async_visible && visible) |
6233 { | 6090 { |
6234 if (f->iconified) | 6091 if (f->iconified) |
6235 { | 6092 { |
6271 | 6128 |
6272 void | 6129 void |
6273 x_make_frame_visible (f) | 6130 x_make_frame_visible (f) |
6274 struct frame *f; | 6131 struct frame *f; |
6275 { | 6132 { |
6276 Lisp_Object type; | |
6277 int original_top, original_left; | |
6278 | |
6279 BLOCK_INPUT; | 6133 BLOCK_INPUT; |
6280 | 6134 |
6281 if (! FRAME_VISIBLE_P (f)) | 6135 if (! FRAME_VISIBLE_P (f)) |
6282 { | 6136 { |
6283 /* We test FRAME_GARBAGED_P here to make sure we don't | 6137 /* We test FRAME_GARBAGED_P here to make sure we don't |
6284 call x_set_offset a second time | 6138 call x_set_offset a second time |
6285 if we get to x_make_frame_visible a second time | 6139 if we get to x_make_frame_visible a second time |
6286 before the window gets really visible. */ | 6140 before the window gets really visible. */ |
6287 if (! FRAME_ICONIFIED_P (f) | 6141 if (! FRAME_ICONIFIED_P (f) |
6288 && ! f->output_data.mac->asked_for_visible) | 6142 && ! f->output_data.mac->asked_for_visible) |
6143 { | |
6289 #if TARGET_API_MAC_CARBON | 6144 #if TARGET_API_MAC_CARBON |
6290 if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition))) | 6145 if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition))) |
6291 { | 6146 { |
6292 struct frame *sf = SELECTED_FRAME (); | 6147 struct frame *sf = SELECTED_FRAME (); |
6293 if (!FRAME_MAC_P (sf)) | 6148 if (!FRAME_MAC_P (sf)) |
6294 RepositionWindow (FRAME_MAC_WINDOW (f), NULL, | 6149 RepositionWindow (FRAME_MAC_WINDOW (f), NULL, |
6295 kWindowCenterOnMainScreen); | 6150 kWindowCenterOnMainScreen); |
6296 else | 6151 else |
6297 RepositionWindow (FRAME_MAC_WINDOW (f), | 6152 RepositionWindow (FRAME_MAC_WINDOW (f), |
6298 FRAME_MAC_WINDOW (sf), | 6153 FRAME_MAC_WINDOW (sf), |
6299 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 | 6154 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 |
6300 kWindowCascadeStartAtParentWindowScreen | 6155 kWindowCascadeStartAtParentWindowScreen |
6301 #else | 6156 #else |
6302 kWindowCascadeOnParentWindowScreen | 6157 kWindowCascadeOnParentWindowScreen |
6303 #endif | 6158 #endif |
6304 ); | 6159 ); |
6305 x_real_positions (f, &f->left_pos, &f->top_pos); | 6160 x_real_positions (f, &f->left_pos, &f->top_pos); |
6306 } | 6161 } |
6307 else | 6162 else |
6308 #endif | 6163 #endif |
6309 x_set_offset (f, f->left_pos, f->top_pos, 0); | 6164 x_set_offset (f, f->left_pos, f->top_pos, 0); |
6165 } | |
6310 | 6166 |
6311 f->output_data.mac->asked_for_visible = 1; | 6167 f->output_data.mac->asked_for_visible = 1; |
6312 | 6168 |
6313 CollapseWindow (FRAME_MAC_WINDOW (f), false); | 6169 CollapseWindow (FRAME_MAC_WINDOW (f), false); |
6314 ShowWindow (FRAME_MAC_WINDOW (f)); | 6170 ShowWindow (FRAME_MAC_WINDOW (f)); |
6747 /* ...a** -> ...a* */ | 6603 /* ...a** -> ...a* */ |
6748 continue; | 6604 continue; |
6749 else | 6605 else |
6750 { | 6606 { |
6751 if (last_char == '?') | 6607 if (last_char == '?') |
6752 if (anychar_head > pat->buf && *(anychar_head - 1) == '*') | 6608 { |
6753 /* ...*??* -> ...*?? */ | 6609 if (anychar_head > pat->buf && *(anychar_head - 1) == '*') |
6754 continue; | 6610 /* ...*??* -> ...*?? */ |
6755 else | 6611 continue; |
6756 /* ...a??* -> ...a*?? */ | 6612 else |
6757 { | 6613 /* ...a??* -> ...a*?? */ |
6758 *anychar_head++ = '*'; | 6614 { |
6759 c = '?'; | 6615 *anychar_head++ = '*'; |
6760 } | 6616 c = '?'; |
6617 } | |
6618 } | |
6761 nblocks++; | 6619 nblocks++; |
6762 } | 6620 } |
6763 else if (c == '?') | 6621 else if (c == '?') |
6764 { | 6622 { |
6765 if (last_char != '?') | 6623 if (last_char != '?') |
7586 for (i = 0; i < font_name_count; i++) | 7444 for (i = 0; i < font_name_count; i++) |
7587 { | 7445 { |
7588 if (xlfdpat_match (pat, font_name_table[i])) | 7446 if (xlfdpat_match (pat, font_name_table[i])) |
7589 { | 7447 { |
7590 font_list = Fcons (build_string (font_name_table[i]), font_list); | 7448 font_list = Fcons (build_string (font_name_table[i]), font_list); |
7591 if (exact || maxnames > 0 && ++n_fonts >= maxnames) | 7449 if (exact || (maxnames > 0 && ++n_fonts >= maxnames)) |
7592 break; | 7450 break; |
7593 } | 7451 } |
7594 else if (scl_val[XLFD_SCL_PIXEL_SIZE] > 0 | 7452 else if (scl_val[XLFD_SCL_PIXEL_SIZE] > 0 |
7595 && (ptr = strstr (font_name_table[i], "-0-0-0-0-m-0-"))) | 7453 && (ptr = strstr (font_name_table[i], "-0-0-0-0-m-0-"))) |
7596 { | 7454 { |
7609 | 7467 |
7610 if (xlfdpat_match (pat, scaled)) | 7468 if (xlfdpat_match (pat, scaled)) |
7611 { | 7469 { |
7612 font_list = Fcons (build_string (scaled), font_list); | 7470 font_list = Fcons (build_string (scaled), font_list); |
7613 xfree (scaled); | 7471 xfree (scaled); |
7614 if (exact || maxnames > 0 && ++n_fonts >= maxnames) | 7472 if (exact || (maxnames > 0 && ++n_fonts >= maxnames)) |
7615 break; | 7473 break; |
7616 } | 7474 } |
7617 else | 7475 else |
7618 xfree (scaled); | 7476 xfree (scaled); |
7619 } | 7477 } |
8258 else | 8116 else |
8259 return NULL; | 8117 return NULL; |
8260 | 8118 |
8261 /* Load the font and add it to the table. */ | 8119 /* Load the font and add it to the table. */ |
8262 { | 8120 { |
8263 char *full_name; | |
8264 struct MacFontStruct *font; | 8121 struct MacFontStruct *font; |
8265 struct font_info *fontp; | 8122 struct font_info *fontp; |
8266 unsigned long value; | |
8267 int i; | 8123 int i; |
8268 | 8124 |
8269 fontname = (char *) SDATA (XCAR (font_names)); | 8125 fontname = (char *) SDATA (XCAR (font_names)); |
8270 | 8126 |
8271 BLOCK_INPUT; | 8127 BLOCK_INPUT; |
8775 return result; | 8631 return result; |
8776 } | 8632 } |
8777 | 8633 |
8778 #endif | 8634 #endif |
8779 | 8635 |
8636 #ifdef MAC_OS8 | |
8780 static void | 8637 static void |
8781 do_get_menus (void) | 8638 do_get_menus (void) |
8782 { | 8639 { |
8783 Handle menubar_handle; | 8640 Handle menubar_handle; |
8784 MenuHandle menu_handle; | 8641 MenuHandle menu_handle; |
8836 { | 8693 { |
8837 StopAlert (RAM_TOO_LARGE_ALERT_ID, NULL); | 8694 StopAlert (RAM_TOO_LARGE_ALERT_ID, NULL); |
8838 exit (1); | 8695 exit (1); |
8839 } | 8696 } |
8840 } | 8697 } |
8698 #endif /* MAC_OS8 */ | |
8841 | 8699 |
8842 static void | 8700 static void |
8843 do_window_update (WindowPtr win) | 8701 do_window_update (WindowPtr win) |
8844 { | 8702 { |
8845 struct frame *f = mac_window_to_frame (win); | 8703 struct frame *f = mac_window_to_frame (win); |
9017 wide (DEFAULT_NUM_COLS) and as tall as will fit on the screen. */ | 8875 wide (DEFAULT_NUM_COLS) and as tall as will fit on the screen. */ |
9018 | 8876 |
9019 static void | 8877 static void |
9020 do_zoom_window (WindowPtr w, int zoom_in_or_out) | 8878 do_zoom_window (WindowPtr w, int zoom_in_or_out) |
9021 { | 8879 { |
9022 GrafPtr save_port; | |
9023 Rect zoom_rect, port_rect; | 8880 Rect zoom_rect, port_rect; |
9024 Point top_left; | 8881 int columns, rows, width, height; |
9025 int w_title_height, columns, rows, width, height; | |
9026 struct frame *f = mac_window_to_frame (w); | 8882 struct frame *f = mac_window_to_frame (w); |
9027 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | 8883 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); |
9028 | |
9029 #if TARGET_API_MAC_CARBON | 8884 #if TARGET_API_MAC_CARBON |
9030 { | 8885 Point standard_size; |
9031 Point standard_size; | 8886 |
9032 | 8887 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); |
9033 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); | 8888 standard_size.v = dpyinfo->height; |
9034 standard_size.v = dpyinfo->height; | 8889 |
9035 | 8890 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)) |
9036 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)) | 8891 zoom_in_or_out = inZoomIn; |
9037 zoom_in_or_out = inZoomIn; | 8892 else |
9038 else | 8893 { |
9039 { | 8894 /* Adjust the standard size according to character boundaries. */ |
9040 /* Adjust the standard size according to character boundaries. */ | 8895 |
9041 | 8896 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left); |
9042 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left); | 8897 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top); |
9043 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top); | 8898 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns); |
9044 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns); | 8899 standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); |
9045 standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); | 8900 GetWindowBounds (w, kWindowContentRgn, &port_rect); |
9046 GetWindowBounds (w, kWindowContentRgn, &port_rect); | 8901 if (IsWindowInStandardState (w, &standard_size, &zoom_rect) |
9047 if (IsWindowInStandardState (w, &standard_size, &zoom_rect) | 8902 && port_rect.left == zoom_rect.left |
9048 && port_rect.left == zoom_rect.left | 8903 && port_rect.top == zoom_rect.top) |
9049 && port_rect.top == zoom_rect.top) | 8904 zoom_in_or_out = inZoomIn; |
9050 zoom_in_or_out = inZoomIn; | 8905 else |
9051 else | 8906 zoom_in_or_out = inZoomOut; |
9052 zoom_in_or_out = inZoomOut; | 8907 } |
9053 } | 8908 |
9054 | 8909 ZoomWindowIdeal (w, zoom_in_or_out, &standard_size); |
9055 ZoomWindowIdeal (w, zoom_in_or_out, &standard_size); | |
9056 } | |
9057 #else /* not TARGET_API_MAC_CARBON */ | 8910 #else /* not TARGET_API_MAC_CARBON */ |
8911 GrafPtr save_port; | |
8912 Point top_left; | |
8913 int w_title_height; | |
8914 | |
9058 GetPort (&save_port); | 8915 GetPort (&save_port); |
9059 | 8916 |
9060 SetPortWindowPort (w); | 8917 SetPortWindowPort (w); |
9061 | 8918 |
9062 /* Clear window to avoid flicker. */ | 8919 /* Clear window to avoid flicker. */ |
9187 symbol is `hicommand' and event ID is its command ID. */ | 9044 symbol is `hicommand' and event ID is its command ID. */ |
9188 class_key = Qhicommand; | 9045 class_key = Qhicommand; |
9189 mac_find_apple_event_spec (0, command.commandID, | 9046 mac_find_apple_event_spec (0, command.commandID, |
9190 &class_key, &id_key, &binding); | 9047 &class_key, &id_key, &binding); |
9191 if (!NILP (binding) && !EQ (binding, Qundefined)) | 9048 if (!NILP (binding) && !EQ (binding, Qundefined)) |
9192 if (INTEGERP (binding)) | 9049 { |
9193 return XINT (binding); | 9050 if (INTEGERP (binding)) |
9194 else | 9051 return XINT (binding); |
9195 { | 9052 else |
9196 AppleEvent apple_event; | 9053 { |
9197 UInt32 modifiers; | 9054 AppleEvent apple_event; |
9198 static EventParamName names[] = {kEventParamDirectObject, | 9055 static EventParamName names[] = {kEventParamDirectObject, |
9199 kEventParamKeyModifiers}; | 9056 kEventParamKeyModifiers}; |
9200 static EventParamType types[] = {typeHICommand, | 9057 static EventParamType types[] = {typeHICommand, |
9201 typeUInt32}; | 9058 typeUInt32}; |
9202 err = create_apple_event_from_event_ref (event, 2, names, types, | 9059 err = create_apple_event_from_event_ref (event, 2, names, types, |
9203 &apple_event); | 9060 &apple_event); |
9204 if (err == noErr) | 9061 if (err == noErr) |
9205 { | 9062 { |
9206 err = mac_store_apple_event (class_key, id_key, &apple_event); | 9063 err = mac_store_apple_event (class_key, id_key, &apple_event); |
9207 AEDisposeDesc (&apple_event); | 9064 AEDisposeDesc (&apple_event); |
9208 } | 9065 } |
9209 if (err == noErr) | 9066 if (err == noErr) |
9210 return noErr; | 9067 return noErr; |
9211 } | 9068 } |
9069 } | |
9212 | 9070 |
9213 return eventNotHandledErr; | 9071 return eventNotHandledErr; |
9214 } | 9072 } |
9215 | 9073 |
9216 static OSErr | 9074 static OSErr |
9217 init_command_handler () | 9075 init_command_handler () |
9218 { | 9076 { |
9219 OSErr err = noErr; | |
9220 EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}}; | 9077 EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}}; |
9221 static EventHandlerUPP handle_command_eventUPP = NULL; | 9078 static EventHandlerUPP handle_command_eventUPP = NULL; |
9222 | 9079 |
9223 if (handle_command_eventUPP == NULL) | 9080 if (handle_command_eventUPP == NULL) |
9224 handle_command_eventUPP = NewEventHandlerUPP (mac_handle_command_event); | 9081 handle_command_eventUPP = NewEventHandlerUPP (mac_handle_command_event); |
10090 inev.modifiers = mac_to_emacs_modifiers (er.modifiers); | 9947 inev.modifiers = mac_to_emacs_modifiers (er.modifiers); |
10091 #endif | 9948 #endif |
10092 XSETINT (inev.x, mouse_loc.h); | 9949 XSETINT (inev.x, mouse_loc.h); |
10093 XSETINT (inev.y, mouse_loc.v); | 9950 XSETINT (inev.y, mouse_loc.v); |
10094 | 9951 |
10095 if (dpyinfo->grabbed && tracked_scroll_bar | 9952 if ((dpyinfo->grabbed && tracked_scroll_bar) |
10096 || ch != 0 | 9953 || (ch != 0 |
10097 #ifndef USE_TOOLKIT_SCROLL_BARS | 9954 #ifndef USE_TOOLKIT_SCROLL_BARS |
10098 /* control_part_code becomes kControlNoPart if | 9955 /* control_part_code becomes kControlNoPart if |
10099 a progress indicator is clicked. */ | 9956 a progress indicator is clicked. */ |
10100 && control_part_code != kControlNoPart | 9957 && control_part_code != kControlNoPart |
10101 #else /* USE_TOOLKIT_SCROLL_BARS */ | 9958 #else /* USE_TOOLKIT_SCROLL_BARS */ |
10102 #ifdef MAC_OSX | 9959 #ifdef MAC_OSX |
10103 && control_kind.kind == kControlKindScrollBar | 9960 && control_kind.kind == kControlKindScrollBar |
10104 #endif /* MAC_OSX */ | 9961 #endif /* MAC_OSX */ |
10105 #endif /* USE_TOOLKIT_SCROLL_BARS */ | 9962 #endif /* USE_TOOLKIT_SCROLL_BARS */ |
10106 ) | 9963 )) |
10107 { | 9964 { |
10108 struct scroll_bar *bar; | 9965 struct scroll_bar *bar; |
10109 | 9966 |
10110 if (dpyinfo->grabbed && tracked_scroll_bar) | 9967 if (dpyinfo->grabbed && tracked_scroll_bar) |
10111 { | 9968 { |
10901 mac_check_bundle() | 10758 mac_check_bundle() |
10902 { | 10759 { |
10903 extern int inhibit_window_system; | 10760 extern int inhibit_window_system; |
10904 extern int noninteractive; | 10761 extern int noninteractive; |
10905 CFBundleRef appsBundle; | 10762 CFBundleRef appsBundle; |
10906 pid_t child; | |
10907 | 10763 |
10908 /* No need to test if already -nw*/ | 10764 /* No need to test if already -nw*/ |
10909 if (inhibit_window_system || noninteractive) | 10765 if (inhibit_window_system || noninteractive) |
10910 return; | 10766 return; |
10911 | 10767 |