aboutsummaryrefslogtreecommitdiffstats
path: root/src/macterm.c
diff options
context:
space:
mode:
authorMiles Bader2006-04-17 08:41:12 +0000
committerMiles Bader2006-04-17 08:41:12 +0000
commitcfc2051d0ed5a268528a647ab0911a2f5cc451de (patch)
treecb622fe0b6c1ba8b97314fb80ba2fd8fad60a5a2 /src/macterm.c
parentca49cf1703cc20d50653c32ca2f438c8819b78bd (diff)
parente4a89ccf738861d7b9c4f611185aa0f204c9c208 (diff)
downloademacs-cfc2051d0ed5a268528a647ab0911a2f5cc451de.tar.gz
emacs-cfc2051d0ed5a268528a647ab0911a2f5cc451de.zip
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
Diffstat (limited to 'src/macterm.c')
-rw-r--r--src/macterm.c440
1 files changed, 148 insertions, 292 deletions
diff --git a/src/macterm.c b/src/macterm.c
index 472fe3d28c8..5c3787c2a51 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -77,7 +77,6 @@ Boston, MA 02110-1301, USA. */
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"
@@ -217,7 +216,6 @@ QDGlobals qd; /* QuickDraw global information structure. */
217 216
218struct mac_display_info *mac_display_info_for_display (Display *); 217struct mac_display_info *mac_display_info_for_display (Display *);
219static void x_update_window_end P_ ((struct window *, int, int)); 218static void x_update_window_end P_ ((struct window *, int, int));
220static int x_io_error_quitter P_ ((Display *));
221int x_catch_errors P_ ((Display *)); 219int x_catch_errors P_ ((Display *));
222void x_uncatch_errors P_ ((Display *, int)); 220void x_uncatch_errors P_ ((Display *, int));
223void x_lower_frame P_ ((struct frame *)); 221void x_lower_frame P_ ((struct frame *));
@@ -1699,14 +1697,6 @@ XSetWindowBackground (display, w, color)
1699#endif 1697#endif
1700} 1698}
1701 1699
1702/* x_sync is a no-op on Mac. */
1703void
1704x_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
1712static void 1702static void
@@ -2082,7 +2072,6 @@ mac_define_fringe_bitmap (which, bits, h, wd)
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
@@ -2368,7 +2357,6 @@ static void x_setup_relief_colors P_ ((struct glyph_string *));
2368static void x_draw_image_glyph_string P_ ((struct glyph_string *)); 2357static void x_draw_image_glyph_string P_ ((struct glyph_string *));
2369static void x_draw_image_relief P_ ((struct glyph_string *)); 2358static void x_draw_image_relief P_ ((struct glyph_string *));
2370static void x_draw_image_foreground P_ ((struct glyph_string *)); 2359static void x_draw_image_foreground P_ ((struct glyph_string *));
2371static void x_draw_image_foreground_1 P_ ((struct glyph_string *, Pixmap));
2372static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int, 2360static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int,
2373 int, int, int)); 2361 int, int, int));
2374static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int, 2362static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int,
@@ -2569,34 +2557,36 @@ static void
2569mac_compute_glyph_string_overhangs (s) 2557mac_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
@@ -3432,7 +3422,6 @@ x_draw_image_glyph_string (s)
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
@@ -4178,142 +4167,6 @@ x_frame_rehighlight (dpyinfo)
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. */
4185static void
4186x_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
4291static unsigned int
4292x_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 */
4303static unsigned short
4304x_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
4319char * 4172char *
@@ -5104,41 +4957,43 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
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);
4969 Rect r0, r1;
5116 4970
5117 BLOCK_INPUT; 4971 BLOCK_INPUT;
5118 4972
5119 SetControl32BitMinimum (ch, 0); 4973 SetControl32BitMinimum (ch, 0);
5120 SetControl32BitMaximum (ch, 1); 4974 SetControl32BitMaximum (ch, 1);
5121 SetControlViewSize (ch, 1); 4975 SetControlViewSize (ch, 1);
5122 4976
5123 /* Move the scroll bar thumb to the top. */ 4977 /* Move the scroll bar thumb to the top. */
5124 SetControl32BitValue (ch, 0); 4978 SetControl32BitValue (ch, 0);
5125 get_control_part_bounds (ch, kControlIndicatorPart, &r0); 4979 get_control_part_bounds (ch, kControlIndicatorPart, &r0);
5126 4980
5127 /* Move the scroll bar thumb to the bottom. */ 4981 /* Move the scroll bar thumb to the bottom. */
5128 SetControl32BitValue (ch, 1); 4982 SetControl32BitValue (ch, 1);
5129 get_control_part_bounds (ch, kControlIndicatorPart, &r1); 4983 get_control_part_bounds (ch, kControlIndicatorPart, &r1);
5130 4984
5131 UnionRect (&r0, &r1, &r0); 4985 UnionRect (&r0, &r1, &r0);
5132 XSETINT (bar->track_top, r0.top); 4986 XSETINT (bar->track_top, r0.top);
5133 XSETINT (bar->track_height, r0.bottom - r0.top); 4987 XSETINT (bar->track_height, r0.bottom - r0.top);
5134 4988
5135 /* Don't show the scroll bar if its height is not enough to 4989 /* Don't show the scroll bar if its height is not enough to
5136 display the scroll bar thumb. */ 4990 display the scroll bar thumb. */
5137 if (r0.bottom - r0.top > 0) 4991 if (r0.bottom - r0.top > 0)
5138 ShowControl (ch); 4992 ShowControl (ch);
5139 4993
5140 UNBLOCK_INPUT; 4994 UNBLOCK_INPUT;
5141 } 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 */
@@ -6224,10 +6079,12 @@ mac_handle_visibility_change (f)
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 {
@@ -6273,9 +6130,6 @@ void
6273x_make_frame_visible (f) 6130x_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))
@@ -6286,27 +6140,29 @@ x_make_frame_visible (f)
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
@@ -6749,15 +6605,17 @@ xlfdpat_create (pattern)
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 == '?')
@@ -7588,7 +7446,7 @@ mac_do_list_fonts (pattern, maxnames)
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
@@ -7611,7 +7469,7 @@ mac_do_list_fonts (pattern, maxnames)
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
@@ -8260,10 +8118,8 @@ x_load_font (f, fontname, size)
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));
@@ -8777,6 +8633,7 @@ static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec)
8777 8633
8778#endif 8634#endif
8779 8635
8636#ifdef MAC_OS8
8780static void 8637static void
8781do_get_menus (void) 8638do_get_menus (void)
8782{ 8639{
@@ -8838,6 +8695,7 @@ do_check_ram_size (void)
8838 exit (1); 8695 exit (1);
8839 } 8696 }
8840} 8697}
8698#endif /* MAC_OS8 */
8841 8699
8842static void 8700static void
8843do_window_update (WindowPtr win) 8701do_window_update (WindowPtr win)
@@ -9019,42 +8877,41 @@ do_grow_window (WindowPtr w, EventRecord *e)
9019static void 8877static void
9020do_zoom_window (WindowPtr w, int zoom_in_or_out) 8878do_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;
9032 8886
9033 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); 8887 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
9034 standard_size.v = dpyinfo->height; 8888 standard_size.v = dpyinfo->height;
9035 8889
9036 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)) 8890 if (IsWindowInStandardState (w, &standard_size, &zoom_rect))
9037 zoom_in_or_out = inZoomIn; 8891 zoom_in_or_out = inZoomIn;
9038 else 8892 else
9039 { 8893 {
9040 /* Adjust the standard size according to character boundaries. */ 8894 /* Adjust the standard size according to character boundaries. */
9041
9042 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
9043 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
9044 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
9045 standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
9046 GetWindowBounds (w, kWindowContentRgn, &port_rect);
9047 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
9048 && port_rect.left == zoom_rect.left
9049 && port_rect.top == zoom_rect.top)
9050 zoom_in_or_out = inZoomIn;
9051 else
9052 zoom_in_or_out = inZoomOut;
9053 }
9054 8895
9055 ZoomWindowIdeal (w, zoom_in_or_out, &standard_size); 8896 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
9056 } 8897 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);
8899 standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
8900 GetWindowBounds (w, kWindowContentRgn, &port_rect);
8901 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
8902 && port_rect.left == zoom_rect.left
8903 && port_rect.top == zoom_rect.top)
8904 zoom_in_or_out = inZoomIn;
8905 else
8906 zoom_in_or_out = inZoomOut;
8907 }
8908
8909 ZoomWindowIdeal (w, zoom_in_or_out, &standard_size);
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);
@@ -9189,26 +9046,27 @@ mac_handle_command_event (next_handler, event, data)
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}
@@ -9216,7 +9074,6 @@ mac_handle_command_event (next_handler, event, data)
9216static OSErr 9074static OSErr
9217init_command_handler () 9075init_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
@@ -10092,18 +9949,18 @@ XTread_socket (sd, expected, hold_quit)
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
@@ -10903,7 +10760,6 @@ mac_check_bundle()
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)