aboutsummaryrefslogtreecommitdiffstats
path: root/src/macterm.c
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2006-04-12 08:09:24 +0000
committerYAMAMOTO Mitsuharu2006-04-12 08:09:24 +0000
commitf93e4d4f49b84c2eedb93d46cd6d0f8325b85d1c (patch)
treef4dd14396043501d9522b84f5bb1cfb275aaad3c /src/macterm.c
parent961bf5901f777fb95d356e62cdfed3e24d330521 (diff)
downloademacs-f93e4d4f49b84c2eedb93d46cd6d0f8325b85d1c.tar.gz
emacs-f93e4d4f49b84c2eedb93d46cd6d0f8325b85d1c.zip
Don't include gnu.h.
(x_io_error_quitter, x_draw_image_foreground_1): Remove prototypes. (x_sync): Move to macfns.c. [USE_CG_DRAWING] (mac_define_fringe_bitmap): Remove unused variable `mask_bits'. (mac_compute_glyph_string_overhangs): Avoid ambiguous `else'. (x_draw_image_glyph_string): Remove unused variable `pixmap'. (x_mac_to_emacs_modifiers): Remove function. (XTset_vertical_scroll_bar, mac_handle_visibility_change) (x_make_frame_visible, xlfdpat_create, mac_handle_command_event): Add explicit braces to avoid ambiguous `else'. (x_make_frame_visible): Remove unused variables `type', `original_top', and `original_left'. (mac_do_list_fonts, XTread_socket): Add parentheses around && within ||. (x_load_font): Remove unused variables `full_name', and `value'. (do_get_menus, do_init_managers, do_check_ram_size) [!MAC_OS8]: Remove functions. (do_zoom_window): Reorganize variables with respect to conditionals. (init_command_handler): Remove unused variable `err'. [MAC_OSX] (mac_check_bundle): Remove unused variable `child'.
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 6287d1a4f93..cc8e659515b 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"
@@ -215,7 +214,6 @@ QDGlobals qd; /* QuickDraw global information structure. */
215 214
216struct mac_display_info *mac_display_info_for_display (Display *); 215struct mac_display_info *mac_display_info_for_display (Display *);
217static void x_update_window_end P_ ((struct window *, int, int)); 216static void x_update_window_end P_ ((struct window *, int, int));
218static int x_io_error_quitter P_ ((Display *));
219int x_catch_errors P_ ((Display *)); 217int x_catch_errors P_ ((Display *));
220void x_uncatch_errors P_ ((Display *, int)); 218void x_uncatch_errors P_ ((Display *, int));
221void x_lower_frame P_ ((struct frame *)); 219void x_lower_frame P_ ((struct frame *));
@@ -1697,14 +1695,6 @@ XSetWindowBackground (display, w, color)
1697#endif 1695#endif
1698} 1696}
1699 1697
1700/* x_sync is a no-op on Mac. */
1701void
1702x_sync (f)
1703 void *f;
1704{
1705}
1706
1707
1708/* Flush display of frame F, or of all frames if F is null. */ 1698/* Flush display of frame F, or of all frames if F is null. */
1709 1699
1710static void 1700static void
@@ -2080,7 +2070,6 @@ mac_define_fringe_bitmap (which, bits, h, wd)
2080 unsigned short *bits; 2070 unsigned short *bits;
2081 int h, wd; 2071 int h, wd;
2082{ 2072{
2083 unsigned short *mask_bits;
2084 int i; 2073 int i;
2085 CGDataProviderRef provider; 2074 CGDataProviderRef provider;
2086 2075
@@ -2366,7 +2355,6 @@ static void x_setup_relief_colors P_ ((struct glyph_string *));
2366static void x_draw_image_glyph_string P_ ((struct glyph_string *)); 2355static void x_draw_image_glyph_string P_ ((struct glyph_string *));
2367static void x_draw_image_relief P_ ((struct glyph_string *)); 2356static void x_draw_image_relief P_ ((struct glyph_string *));
2368static void x_draw_image_foreground P_ ((struct glyph_string *)); 2357static void x_draw_image_foreground P_ ((struct glyph_string *));
2369static void x_draw_image_foreground_1 P_ ((struct glyph_string *, Pixmap));
2370static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int, 2358static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int,
2371 int, int, int)); 2359 int, int, int));
2372static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int, 2360static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int,
@@ -2567,34 +2555,36 @@ static void
2567mac_compute_glyph_string_overhangs (s) 2555mac_compute_glyph_string_overhangs (s)
2568 struct glyph_string *s; 2556 struct glyph_string *s;
2569{ 2557{
2570 if (s->cmp == NULL 2558 if (!(s->cmp == NULL
2571 && s->first_glyph->type == CHAR_GLYPH) 2559 && s->first_glyph->type == CHAR_GLYPH))
2572 if (!s->two_byte_p 2560 return;
2561
2562 if (!s->two_byte_p
2573#if USE_ATSUI 2563#if USE_ATSUI
2574 || s->font->mac_style 2564 || s->font->mac_style
2575#endif 2565#endif
2576 ) 2566 )
2577 { 2567 {
2578 XCharStruct cs; 2568 XCharStruct cs;
2579 2569
2580 mac_text_extents_16 (s->font, s->char2b, s->nchars, &cs); 2570 mac_text_extents_16 (s->font, s->char2b, s->nchars, &cs);
2581 s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0; 2571 s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0;
2582 s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0; 2572 s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0;
2583 } 2573 }
2584 else 2574 else
2585 { 2575 {
2586 Rect r; 2576 Rect r;
2587 MacFontStruct *font = s->font; 2577 MacFontStruct *font = s->font;
2588 2578
2589 TextFont (font->mac_fontnum); 2579 TextFont (font->mac_fontnum);
2590 TextSize (font->mac_fontsize); 2580 TextSize (font->mac_fontsize);
2591 TextFace (font->mac_fontface); 2581 TextFace (font->mac_fontface);
2592 2582
2593 QDTextBounds (s->nchars * 2, (char *)s->char2b, &r); 2583 QDTextBounds (s->nchars * 2, (char *)s->char2b, &r);
2594 2584
2595 s->right_overhang = r.right > s->width ? r.right - s->width : 0; 2585 s->right_overhang = r.right > s->width ? r.right - s->width : 0;
2596 s->left_overhang = r.left < 0 ? -r.left : 0; 2586 s->left_overhang = r.left < 0 ? -r.left : 0;
2597 } 2587 }
2598} 2588}
2599 2589
2600 2590
@@ -3430,7 +3420,6 @@ x_draw_image_glyph_string (s)
3430 int box_line_hwidth = abs (s->face->box_line_width); 3420 int box_line_hwidth = abs (s->face->box_line_width);
3431 int box_line_vwidth = max (s->face->box_line_width, 0); 3421 int box_line_vwidth = max (s->face->box_line_width, 0);
3432 int height; 3422 int height;
3433 Pixmap pixmap = 0;
3434 3423
3435 height = s->height - 2 * box_line_vwidth; 3424 height = s->height - 2 * box_line_vwidth;
3436 3425
@@ -4176,142 +4165,6 @@ x_frame_rehighlight (dpyinfo)
4176 4165
4177 4166
4178 4167
4179/* Keyboard processing - modifier keys, vendor-specific keysyms, etc. */
4180
4181#if 0 /* MAC_TODO */
4182/* Initialize mode_switch_bit and modifier_meaning. */
4183static void
4184x_find_modifier_meanings (dpyinfo)
4185 struct x_display_info *dpyinfo;
4186{
4187 int min_code, max_code;
4188 KeySym *syms;
4189 int syms_per_code;
4190 XModifierKeymap *mods;
4191
4192 dpyinfo->meta_mod_mask = 0;
4193 dpyinfo->shift_lock_mask = 0;
4194 dpyinfo->alt_mod_mask = 0;
4195 dpyinfo->super_mod_mask = 0;
4196 dpyinfo->hyper_mod_mask = 0;
4197
4198#ifdef HAVE_X11R4
4199 XDisplayKeycodes (dpyinfo->display, &min_code, &max_code);
4200#else
4201 min_code = dpyinfo->display->min_keycode;
4202 max_code = dpyinfo->display->max_keycode;
4203#endif
4204
4205 syms = XGetKeyboardMapping (dpyinfo->display,
4206 min_code, max_code - min_code + 1,
4207 &syms_per_code);
4208 mods = XGetModifierMapping (dpyinfo->display);
4209
4210 /* Scan the modifier table to see which modifier bits the Meta and
4211 Alt keysyms are on. */
4212 {
4213 int row, col; /* The row and column in the modifier table. */
4214
4215 for (row = 3; row < 8; row++)
4216 for (col = 0; col < mods->max_keypermod; col++)
4217 {
4218 KeyCode code
4219 = mods->modifiermap[(row * mods->max_keypermod) + col];
4220
4221 /* Zeroes are used for filler. Skip them. */
4222 if (code == 0)
4223 continue;
4224
4225 /* Are any of this keycode's keysyms a meta key? */
4226 {
4227 int code_col;
4228
4229 for (code_col = 0; code_col < syms_per_code; code_col++)
4230 {
4231 int sym = syms[((code - min_code) * syms_per_code) + code_col];
4232
4233 switch (sym)
4234 {
4235 case XK_Meta_L:
4236 case XK_Meta_R:
4237 dpyinfo->meta_mod_mask |= (1 << row);
4238 break;
4239
4240 case XK_Alt_L:
4241 case XK_Alt_R:
4242 dpyinfo->alt_mod_mask |= (1 << row);
4243 break;
4244
4245 case XK_Hyper_L:
4246 case XK_Hyper_R:
4247 dpyinfo->hyper_mod_mask |= (1 << row);
4248 break;
4249
4250 case XK_Super_L:
4251 case XK_Super_R:
4252 dpyinfo->super_mod_mask |= (1 << row);
4253 break;
4254
4255 case XK_Shift_Lock:
4256 /* Ignore this if it's not on the lock modifier. */
4257 if ((1 << row) == LockMask)
4258 dpyinfo->shift_lock_mask = LockMask;
4259 break;
4260 }
4261 }
4262 }
4263 }
4264 }
4265
4266 /* If we couldn't find any meta keys, accept any alt keys as meta keys. */
4267 if (! dpyinfo->meta_mod_mask)
4268 {
4269 dpyinfo->meta_mod_mask = dpyinfo->alt_mod_mask;
4270 dpyinfo->alt_mod_mask = 0;
4271 }
4272
4273 /* If some keys are both alt and meta,
4274 make them just meta, not alt. */
4275 if (dpyinfo->alt_mod_mask & dpyinfo->meta_mod_mask)
4276 {
4277 dpyinfo->alt_mod_mask &= ~dpyinfo->meta_mod_mask;
4278 }
4279
4280 XFree ((char *) syms);
4281 XFreeModifiermap (mods);
4282}
4283
4284#endif /* MAC_TODO */
4285
4286/* Convert between the modifier bits X uses and the modifier bits
4287 Emacs uses. */
4288
4289static unsigned int
4290x_mac_to_emacs_modifiers (dpyinfo, state)
4291 struct x_display_info *dpyinfo;
4292 unsigned short state;
4293{
4294 return (((state & shiftKey) ? shift_modifier : 0)
4295 | ((state & controlKey) ? ctrl_modifier : 0)
4296 | ((state & cmdKey) ? meta_modifier : 0)
4297 | ((state & optionKey) ? alt_modifier : 0));
4298}
4299
4300#if 0 /* MAC_TODO */
4301static unsigned short
4302x_emacs_to_x_modifiers (dpyinfo, state)
4303 struct x_display_info *dpyinfo;
4304 unsigned int state;
4305{
4306 return ( ((state & alt_modifier) ? dpyinfo->alt_mod_mask : 0)
4307 | ((state & super_modifier) ? dpyinfo->super_mod_mask : 0)
4308 | ((state & hyper_modifier) ? dpyinfo->hyper_mod_mask : 0)
4309 | ((state & shift_modifier) ? ShiftMask : 0)
4310 | ((state & ctrl_modifier) ? ControlMask : 0)
4311 | ((state & meta_modifier) ? dpyinfo->meta_mod_mask : 0));
4312}
4313#endif /* MAC_TODO */
4314
4315/* Convert a keysym to its name. */ 4168/* Convert a keysym to its name. */
4316 4169
4317char * 4170char *
@@ -5102,41 +4955,43 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
5102 4955
5103#ifdef USE_TOOLKIT_SCROLL_BARS 4956#ifdef USE_TOOLKIT_SCROLL_BARS
5104 if (NILP (bar->track_top)) 4957 if (NILP (bar->track_top))
5105 if (sb_width >= disp_height) 4958 {
5106 { 4959 if (sb_width >= disp_height)
5107 XSETINT (bar->track_top, 0); 4960 {
5108 XSETINT (bar->track_height, 0); 4961 XSETINT (bar->track_top, 0);
5109 } 4962 XSETINT (bar->track_height, 0);
5110 else 4963 }
5111 { 4964 else
5112 ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); 4965 {
5113 Rect r0, r1; 4966 ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
4967 Rect r0, r1;
5114 4968
5115 BLOCK_INPUT; 4969 BLOCK_INPUT;
5116 4970
5117 SetControl32BitMinimum (ch, 0); 4971 SetControl32BitMinimum (ch, 0);
5118 SetControl32BitMaximum (ch, 1); 4972 SetControl32BitMaximum (ch, 1);
5119 SetControlViewSize (ch, 1); 4973 SetControlViewSize (ch, 1);
5120 4974
5121 /* Move the scroll bar thumb to the top. */ 4975 /* Move the scroll bar thumb to the top. */
5122 SetControl32BitValue (ch, 0); 4976 SetControl32BitValue (ch, 0);
5123 get_control_part_bounds (ch, kControlIndicatorPart, &r0); 4977 get_control_part_bounds (ch, kControlIndicatorPart, &r0);
5124 4978
5125 /* Move the scroll bar thumb to the bottom. */ 4979 /* Move the scroll bar thumb to the bottom. */
5126 SetControl32BitValue (ch, 1); 4980 SetControl32BitValue (ch, 1);
5127 get_control_part_bounds (ch, kControlIndicatorPart, &r1); 4981 get_control_part_bounds (ch, kControlIndicatorPart, &r1);
5128 4982
5129 UnionRect (&r0, &r1, &r0); 4983 UnionRect (&r0, &r1, &r0);
5130 XSETINT (bar->track_top, r0.top); 4984 XSETINT (bar->track_top, r0.top);
5131 XSETINT (bar->track_height, r0.bottom - r0.top); 4985 XSETINT (bar->track_height, r0.bottom - r0.top);
5132 4986
5133 /* Don't show the scroll bar if its height is not enough to 4987 /* Don't show the scroll bar if its height is not enough to
5134 display the scroll bar thumb. */ 4988 display the scroll bar thumb. */
5135 if (r0.bottom - r0.top > 0) 4989 if (r0.bottom - r0.top > 0)
5136 ShowControl (ch); 4990 ShowControl (ch);
5137 4991
5138 UNBLOCK_INPUT; 4992 UNBLOCK_INPUT;
5139 } 4993 }
4994 }
5140 4995
5141 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); 4996 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
5142#else /* not USE_TOOLKIT_SCROLL_BARS */ 4997#else /* not USE_TOOLKIT_SCROLL_BARS */
@@ -6205,10 +6060,12 @@ mac_handle_visibility_change (f)
6205 struct input_event buf; 6060 struct input_event buf;
6206 6061
6207 if (IsWindowVisible (wp)) 6062 if (IsWindowVisible (wp))
6208 if (IsWindowCollapsed (wp)) 6063 {
6209 iconified = 1; 6064 if (IsWindowCollapsed (wp))
6210 else 6065 iconified = 1;
6211 visible = 1; 6066 else
6067 visible = 1;
6068 }
6212 6069
6213 if (!f->async_visible && visible) 6070 if (!f->async_visible && visible)
6214 { 6071 {
@@ -6254,9 +6111,6 @@ void
6254x_make_frame_visible (f) 6111x_make_frame_visible (f)
6255 struct frame *f; 6112 struct frame *f;
6256{ 6113{
6257 Lisp_Object type;
6258 int original_top, original_left;
6259
6260 BLOCK_INPUT; 6114 BLOCK_INPUT;
6261 6115
6262 if (! FRAME_VISIBLE_P (f)) 6116 if (! FRAME_VISIBLE_P (f))
@@ -6267,27 +6121,29 @@ x_make_frame_visible (f)
6267 before the window gets really visible. */ 6121 before the window gets really visible. */
6268 if (! FRAME_ICONIFIED_P (f) 6122 if (! FRAME_ICONIFIED_P (f)
6269 && ! f->output_data.mac->asked_for_visible) 6123 && ! f->output_data.mac->asked_for_visible)
6124 {
6270#if TARGET_API_MAC_CARBON 6125#if TARGET_API_MAC_CARBON
6271 if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition))) 6126 if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition)))
6272 { 6127 {
6273 struct frame *sf = SELECTED_FRAME (); 6128 struct frame *sf = SELECTED_FRAME ();
6274 if (!FRAME_MAC_P (sf)) 6129 if (!FRAME_MAC_P (sf))
6275 RepositionWindow (FRAME_MAC_WINDOW (f), NULL, 6130 RepositionWindow (FRAME_MAC_WINDOW (f), NULL,
6276 kWindowCenterOnMainScreen); 6131 kWindowCenterOnMainScreen);
6277 else 6132 else
6278 RepositionWindow (FRAME_MAC_WINDOW (f), 6133 RepositionWindow (FRAME_MAC_WINDOW (f),
6279 FRAME_MAC_WINDOW (sf), 6134 FRAME_MAC_WINDOW (sf),
6280#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 6135#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
6281 kWindowCascadeStartAtParentWindowScreen 6136 kWindowCascadeStartAtParentWindowScreen
6282#else 6137#else
6283 kWindowCascadeOnParentWindowScreen 6138 kWindowCascadeOnParentWindowScreen
6284#endif 6139#endif
6285 ); 6140 );
6286 x_real_positions (f, &f->left_pos, &f->top_pos); 6141 x_real_positions (f, &f->left_pos, &f->top_pos);
6287 } 6142 }
6288 else 6143 else
6289#endif 6144#endif
6290 x_set_offset (f, f->left_pos, f->top_pos, 0); 6145 x_set_offset (f, f->left_pos, f->top_pos, 0);
6146 }
6291 6147
6292 f->output_data.mac->asked_for_visible = 1; 6148 f->output_data.mac->asked_for_visible = 1;
6293 6149
@@ -6730,15 +6586,17 @@ xlfdpat_create (pattern)
6730 else 6586 else
6731 { 6587 {
6732 if (last_char == '?') 6588 if (last_char == '?')
6733 if (anychar_head > pat->buf && *(anychar_head - 1) == '*') 6589 {
6734 /* ...*??* -> ...*?? */ 6590 if (anychar_head > pat->buf && *(anychar_head - 1) == '*')
6735 continue; 6591 /* ...*??* -> ...*?? */
6736 else 6592 continue;
6737 /* ...a??* -> ...a*?? */ 6593 else
6738 { 6594 /* ...a??* -> ...a*?? */
6739 *anychar_head++ = '*'; 6595 {
6740 c = '?'; 6596 *anychar_head++ = '*';
6741 } 6597 c = '?';
6598 }
6599 }
6742 nblocks++; 6600 nblocks++;
6743 } 6601 }
6744 else if (c == '?') 6602 else if (c == '?')
@@ -7569,7 +7427,7 @@ mac_do_list_fonts (pattern, maxnames)
7569 if (xlfdpat_match (pat, font_name_table[i])) 7427 if (xlfdpat_match (pat, font_name_table[i]))
7570 { 7428 {
7571 font_list = Fcons (build_string (font_name_table[i]), font_list); 7429 font_list = Fcons (build_string (font_name_table[i]), font_list);
7572 if (exact || maxnames > 0 && ++n_fonts >= maxnames) 7430 if (exact || (maxnames > 0 && ++n_fonts >= maxnames))
7573 break; 7431 break;
7574 } 7432 }
7575 else if (scl_val[XLFD_SCL_PIXEL_SIZE] > 0 7433 else if (scl_val[XLFD_SCL_PIXEL_SIZE] > 0
@@ -7592,7 +7450,7 @@ mac_do_list_fonts (pattern, maxnames)
7592 { 7450 {
7593 font_list = Fcons (build_string (scaled), font_list); 7451 font_list = Fcons (build_string (scaled), font_list);
7594 xfree (scaled); 7452 xfree (scaled);
7595 if (exact || maxnames > 0 && ++n_fonts >= maxnames) 7453 if (exact || (maxnames > 0 && ++n_fonts >= maxnames))
7596 break; 7454 break;
7597 } 7455 }
7598 else 7456 else
@@ -8241,10 +8099,8 @@ x_load_font (f, fontname, size)
8241 8099
8242 /* Load the font and add it to the table. */ 8100 /* Load the font and add it to the table. */
8243 { 8101 {
8244 char *full_name;
8245 struct MacFontStruct *font; 8102 struct MacFontStruct *font;
8246 struct font_info *fontp; 8103 struct font_info *fontp;
8247 unsigned long value;
8248 int i; 8104 int i;
8249 8105
8250 fontname = (char *) SDATA (XCAR (font_names)); 8106 fontname = (char *) SDATA (XCAR (font_names));
@@ -8756,6 +8612,7 @@ static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec)
8756 8612
8757#endif 8613#endif
8758 8614
8615#ifdef MAC_OS8
8759static void 8616static void
8760do_get_menus (void) 8617do_get_menus (void)
8761{ 8618{
@@ -8817,6 +8674,7 @@ do_check_ram_size (void)
8817 exit (1); 8674 exit (1);
8818 } 8675 }
8819} 8676}
8677#endif /* MAC_OS8 */
8820 8678
8821static void 8679static void
8822do_window_update (WindowPtr win) 8680do_window_update (WindowPtr win)
@@ -8998,42 +8856,41 @@ do_grow_window (WindowPtr w, EventRecord *e)
8998static void 8856static void
8999do_zoom_window (WindowPtr w, int zoom_in_or_out) 8857do_zoom_window (WindowPtr w, int zoom_in_or_out)
9000{ 8858{
9001 GrafPtr save_port;
9002 Rect zoom_rect, port_rect; 8859 Rect zoom_rect, port_rect;
9003 Point top_left; 8860 int columns, rows, width, height;
9004 int w_title_height, columns, rows, width, height;
9005 struct frame *f = mac_window_to_frame (w); 8861 struct frame *f = mac_window_to_frame (w);
9006 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); 8862 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
9007
9008#if TARGET_API_MAC_CARBON 8863#if TARGET_API_MAC_CARBON
9009 { 8864 Point standard_size;
9010 Point standard_size;
9011 8865
9012 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); 8866 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
9013 standard_size.v = dpyinfo->height; 8867 standard_size.v = dpyinfo->height;
9014 8868
9015 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)) 8869 if (IsWindowInStandardState (w, &standard_size, &zoom_rect))
9016 zoom_in_or_out = inZoomIn; 8870 zoom_in_or_out = inZoomIn;
9017 else 8871 else
9018 { 8872 {
9019 /* Adjust the standard size according to character boundaries. */ 8873 /* Adjust the standard size according to character boundaries. */
9020
9021 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
9022 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
9023 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
9024 standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
9025 GetWindowBounds (w, kWindowContentRgn, &port_rect);
9026 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
9027 && port_rect.left == zoom_rect.left
9028 && port_rect.top == zoom_rect.top)
9029 zoom_in_or_out = inZoomIn;
9030 else
9031 zoom_in_or_out = inZoomOut;
9032 }
9033 8874
9034 ZoomWindowIdeal (w, zoom_in_or_out, &standard_size); 8875 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
9035 } 8876 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
8877 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
8878 standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
8879 GetWindowBounds (w, kWindowContentRgn, &port_rect);
8880 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
8881 && port_rect.left == zoom_rect.left
8882 && port_rect.top == zoom_rect.top)
8883 zoom_in_or_out = inZoomIn;
8884 else
8885 zoom_in_or_out = inZoomOut;
8886 }
8887
8888 ZoomWindowIdeal (w, zoom_in_or_out, &standard_size);
9036#else /* not TARGET_API_MAC_CARBON */ 8889#else /* not TARGET_API_MAC_CARBON */
8890 GrafPtr save_port;
8891 Point top_left;
8892 int w_title_height;
8893
9037 GetPort (&save_port); 8894 GetPort (&save_port);
9038 8895
9039 SetPortWindowPort (w); 8896 SetPortWindowPort (w);
@@ -9168,26 +9025,27 @@ mac_handle_command_event (next_handler, event, data)
9168 mac_find_apple_event_spec (0, command.commandID, 9025 mac_find_apple_event_spec (0, command.commandID,
9169 &class_key, &id_key, &binding); 9026 &class_key, &id_key, &binding);
9170 if (!NILP (binding) && !EQ (binding, Qundefined)) 9027 if (!NILP (binding) && !EQ (binding, Qundefined))
9171 if (INTEGERP (binding)) 9028 {
9172 return XINT (binding); 9029 if (INTEGERP (binding))
9173 else 9030 return XINT (binding);
9174 { 9031 else
9175 AppleEvent apple_event; 9032 {
9176 UInt32 modifiers; 9033 AppleEvent apple_event;
9177 static EventParamName names[] = {kEventParamDirectObject, 9034 static EventParamName names[] = {kEventParamDirectObject,
9178 kEventParamKeyModifiers}; 9035 kEventParamKeyModifiers};
9179 static EventParamType types[] = {typeHICommand, 9036 static EventParamType types[] = {typeHICommand,
9180 typeUInt32}; 9037 typeUInt32};
9181 err = create_apple_event_from_event_ref (event, 2, names, types, 9038 err = create_apple_event_from_event_ref (event, 2, names, types,
9182 &apple_event); 9039 &apple_event);
9183 if (err == noErr) 9040 if (err == noErr)
9184 { 9041 {
9185 err = mac_store_apple_event (class_key, id_key, &apple_event); 9042 err = mac_store_apple_event (class_key, id_key, &apple_event);
9186 AEDisposeDesc (&apple_event); 9043 AEDisposeDesc (&apple_event);
9187 } 9044 }
9188 if (err == noErr) 9045 if (err == noErr)
9189 return noErr; 9046 return noErr;
9190 } 9047 }
9048 }
9191 9049
9192 return eventNotHandledErr; 9050 return eventNotHandledErr;
9193} 9051}
@@ -9195,7 +9053,6 @@ mac_handle_command_event (next_handler, event, data)
9195static OSErr 9053static OSErr
9196init_command_handler () 9054init_command_handler ()
9197{ 9055{
9198 OSErr err = noErr;
9199 EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}}; 9056 EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}};
9200 static EventHandlerUPP handle_command_eventUPP = NULL; 9057 static EventHandlerUPP handle_command_eventUPP = NULL;
9201 9058
@@ -10071,18 +9928,18 @@ XTread_socket (sd, expected, hold_quit)
10071 XSETINT (inev.x, mouse_loc.h); 9928 XSETINT (inev.x, mouse_loc.h);
10072 XSETINT (inev.y, mouse_loc.v); 9929 XSETINT (inev.y, mouse_loc.v);
10073 9930
10074 if (dpyinfo->grabbed && tracked_scroll_bar 9931 if ((dpyinfo->grabbed && tracked_scroll_bar)
10075 || ch != 0 9932 || (ch != 0
10076#ifndef USE_TOOLKIT_SCROLL_BARS 9933#ifndef USE_TOOLKIT_SCROLL_BARS
10077 /* control_part_code becomes kControlNoPart if 9934 /* control_part_code becomes kControlNoPart if
10078 a progress indicator is clicked. */ 9935 a progress indicator is clicked. */
10079 && control_part_code != kControlNoPart 9936 && control_part_code != kControlNoPart
10080#else /* USE_TOOLKIT_SCROLL_BARS */ 9937#else /* USE_TOOLKIT_SCROLL_BARS */
10081#ifdef MAC_OSX 9938#ifdef MAC_OSX
10082 && control_kind.kind == kControlKindScrollBar 9939 && control_kind.kind == kControlKindScrollBar
10083#endif /* MAC_OSX */ 9940#endif /* MAC_OSX */
10084#endif /* USE_TOOLKIT_SCROLL_BARS */ 9941#endif /* USE_TOOLKIT_SCROLL_BARS */
10085 ) 9942 ))
10086 { 9943 {
10087 struct scroll_bar *bar; 9944 struct scroll_bar *bar;
10088 9945
@@ -10882,7 +10739,6 @@ mac_check_bundle()
10882 extern int inhibit_window_system; 10739 extern int inhibit_window_system;
10883 extern int noninteractive; 10740 extern int noninteractive;
10884 CFBundleRef appsBundle; 10741 CFBundleRef appsBundle;
10885 pid_t child;
10886 10742
10887 /* No need to test if already -nw*/ 10743 /* No need to test if already -nw*/
10888 if (inhibit_window_system || noninteractive) 10744 if (inhibit_window_system || noninteractive)