(sentence-end-double-space, sentence-end-without-period): Move to paragraphs.
[emacs.git] / mac / inc / macterm.h
blob7145e57fa71d88e717cd4191e17d56eddf99f13b
1 /* Display module for Mac OS.
2 Copyright (C) 2000 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* Contributed by Andrew Choi (akochoi@users.sourceforge.net). */
23 #include "macgui.h"
24 #include "frame.h"
26 /* The class of this X application. */
27 #define EMACS_CLASS "Emacs"
29 #define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b))
31 #define RED_FROM_ULONG(color) ((color) >> 16)
32 #define GREEN_FROM_ULONG(color) (((color) >> 8) & 0xff)
33 #define BLUE_FROM_ULONG(color) ((color) & 0xff)
35 #define BLACK_PIX_DEFAULT(f) RGB_TO_ULONG(0,0,0)
36 #define WHITE_PIX_DEFAULT(f) RGB_TO_ULONG(255,255,255)
38 #define FONT_WIDTH(f) ((f)->max_bounds.width)
39 #define FONT_HEIGHT(f) ((f)->ascent + (f)->descent)
40 #define FONT_BASE(f) ((f)->ascent)
41 #define FONT_DESCENT(f) ((f)->descent)
43 #define FONT_MAX_WIDTH(f) FONT_WIDTH(f) /* fix later */
45 enum text_cursor_kinds {
46 NO_CURSOR = -1,
47 FILLED_BOX_CURSOR,
48 HOLLOW_BOX_CURSOR,
49 BAR_CURSOR
52 /* Structure recording bitmaps and reference count.
53 If REFCOUNT is 0 then this record is free to be reused. */
55 struct mac_bitmap_record
57 char *bitmap_data;
58 int refcount;
59 int height, width;
63 /* For each display (currently only one on mac), we have a structure that
64 records information about it. */
66 struct mac_display_info
68 /* Chain of all mac_display_info structures. */
69 struct mac_display_info *next;
71 /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
72 The same cons cell also appears in x_display_name_list. */
73 Lisp_Object name_list_element;
75 /* Number of frames that are on this display. */
76 int reference_count;
78 /* Dots per inch of the screen. */
79 double resx, resy;
81 /* Number of planes on this screen. */
82 int n_planes;
84 /* Number of bits per pixel on this screen. */
85 int n_cbits;
87 /* Dimensions of this screen. */
88 int height, width;
89 #if 0
90 int height_in,width_in;
91 #endif
93 /* Mask of things that cause the mouse to be grabbed. */
94 int grabbed;
96 #if 0
97 /* Emacs bitmap-id of the default icon bitmap for this frame.
98 Or -1 if none has been allocated yet. */
99 int icon_bitmap_id;
101 #endif
102 /* The root window of this screen. */
103 Window root_window;
105 /* The cursor to use for vertical scroll bars. */
106 Cursor vertical_scroll_bar_cursor;
108 #if 0
109 /* color palette information. */
110 int has_palette;
111 struct w32_palette_entry * color_list;
112 unsigned num_colors;
113 HPALETTE palette;
115 /* deferred action flags checked when starting frame update. */
116 int regen_palette;
118 /* Keystroke that has been faked by Emacs and will be ignored when
119 received; value is reset after key is received. */
120 int faked_key;
122 #endif
124 /* A table of all the fonts we have already loaded. */
125 struct font_info *font_table;
127 /* The current capacity of font_table. */
128 int font_table_size;
130 /* The number of fonts actually stored in the font table.
131 font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <=
132 n_fonts <= font_table_size. and font_table[i].name != 0. */
133 int n_fonts;
135 /* Minimum width over all characters in all fonts in font_table. */
136 int smallest_char_width;
138 /* Minimum font height over all fonts in font_table. */
139 int smallest_font_height;
141 /* Reusable Graphics Context for drawing a cursor in a non-default face. */
142 XGCValues *scratch_cursor_gc;
144 /* These variables describe the range of text currently shown in its
145 mouse-face, together with the window they apply to. As long as
146 the mouse stays within this range, we need not redraw anything on
147 its account. Rows and columns are glyph matrix positions in
148 MOUSE_FACE_WINDOW. */
149 int mouse_face_beg_row, mouse_face_beg_col;
150 int mouse_face_beg_x, mouse_face_beg_y;
151 int mouse_face_end_row, mouse_face_end_col;
152 int mouse_face_end_x, mouse_face_end_y;
153 int mouse_face_past_end;
155 Lisp_Object mouse_face_window;
157 int mouse_face_face_id;
159 /* 1 if a mouse motion event came and we didn't handle it right away because
160 gc was in progress. */
161 int mouse_face_deferred_gc;
163 /* FRAME and X, Y position of mouse when last checked for
164 highlighting. X and Y can be negative or out of range for the frame. */
165 struct frame *mouse_face_mouse_frame;
167 int mouse_face_mouse_x, mouse_face_mouse_y;
169 /* Nonzero means defer mouse-motion highlighting. */
170 int mouse_face_defer;
172 int mouse_face_image_state;
174 char *mac_id_name;
176 /* Pointer to bitmap records. */
177 struct mac_bitmap_record *bitmaps;
179 /* Allocated size of bitmaps field. */
180 int bitmaps_size;
182 /* Last used bitmap index. */
183 int bitmaps_last;
185 /* The frame (if any) which has the window that has keyboard focus.
186 Zero if none. This is examined by Ffocus_frame in w32fns.c. Note
187 that a mere EnterNotify event can set this; if you need to know the
188 last frame specified in a FocusIn or FocusOut event, use
189 w32_focus_event_frame. */
190 struct frame *x_focus_frame;
192 /* The last frame mentioned in a FocusIn or FocusOut event. This is
193 separate from w32_focus_frame, because whether or not LeaveNotify
194 events cause us to lose focus depends on whether or not we have
195 received a FocusIn event for it. */
196 struct frame *x_focus_event_frame;
198 /* The frame which currently has the visual highlight, and should get
199 keyboard input (other sorts of input have the frame encoded in the
200 event). It points to the focus frame's selected window's
201 frame. It differs from w32_focus_frame when we're using a global
202 minibuffer. */
203 struct frame *x_highlight_frame;
205 /* Cache of images. */
206 struct image_cache *image_cache;
209 #define x_display_info mac_display_info
211 /* This is a chain of structures for all the displays currently in use. */
212 extern struct mac_display_info one_mac_display_info;
214 /* This is a chain of structures for all the X displays currently in use. */
215 extern struct x_display_info *x_display_list;
217 /* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE),
218 one for each element of x_display_list and in the same order.
219 NAME is the name of the frame.
220 FONT-LIST-CACHE records previous values returned by x-list-fonts. */
221 extern Lisp_Object x_display_name_list;
223 /* A flag to control how to display unibyte 8-bit character. */
224 extern int unibyte_display_via_language_environment;
226 extern struct x_display_info *x_display_info_for_display P_ ((Display *));
227 extern struct x_display_info *x_display_info_for_name P_ ((Lisp_Object));
229 extern struct mac_display_info *mac_term_init ();
231 /* The collection of data describing a window on the Mac. Functions
232 defined in macterm.c */
233 struct mac_output {
234 WindowPtr mWP; /* pointer to QuickDraw window */
235 FRAME_PTR mFP; /* points back to the frame struct */
237 #if 0
238 int mNumCols; /* number of characters per column */
239 int mNumRows; /* number of characters per row */
240 int mLineHeight; /* height of one line of text in pixels */
241 int mCharWidth; /* width of one character in pixels */
242 int mHomeX; /* X pixel coordinate of lower left corner of character at (0, 0) */
243 int mHomeY; /* Y pixel coordinate of lower left corner of character at (0, 0) */
244 int mHighlight; /* current highlight state (0 = off). */
245 int mTermWinSize; /* num of lines from top of window affected by ins_del_lines; set by set_terminal_window. */
246 #endif
248 #if 0
249 /* stuffs used by xfaces.c */
250 struct face **param_faces;
251 int n_param_faces;
252 struct face **computed_faces;
253 int n_computed_faces;
254 int size_computed_faces;
255 #endif
257 unsigned long background_pixel;
258 unsigned long foreground_pixel;
260 /* Position of the Mac window (x and y offsets in global coordinates). */
261 int left_pos;
262 int top_pos;
264 /* Border width of the W32 window as known by the window system. */
265 int border_width;
267 /* Size of the W32 window in pixels. */
268 int pixel_height, pixel_width;
270 /* Height of a line, in pixels. */
271 int line_height;
273 /* Here are the Graphics Contexts for the default font. */
274 GC normal_gc; /* Normal video */
275 GC reverse_gc; /* Reverse video */
276 GC cursor_gc; /* cursor drawing */
278 /* Width of the internal border. This is a line of background color
279 just inside the window's border. When the frame is selected,
280 a highlighting is displayed inside the internal border. */
281 int internal_border_width;
283 /* The window used for this frame.
284 May be zero while the frame object is being created
285 and the window has not yet been created. */
286 Window window_desc;
288 /* The window that is the parent of this window.
289 Usually this is a window that was made by the window manager,
290 but it can be the root window, and it can be explicitly specified
291 (see the explicit_parent field, below). */
292 Window parent_desc;
294 /* Default ASCII font of this frame. */
295 XFontStruct *font;
297 /* The baseline offset of the default ASCII font. */
298 int baseline_offset;
300 /* If a fontset is specified for this frame instead of font, this
301 value contains an ID of the fontset, else -1. */
302 int fontset;
304 /* Pixel values used for various purposes.
305 border_pixel may be -1 meaning use a gray tile. */
306 unsigned long cursor_pixel;
307 unsigned long border_pixel;
308 unsigned long mouse_pixel;
309 unsigned long cursor_foreground_pixel;
311 /* Foreground color for scroll bars. A value of -1 means use the
312 default (black for non-toolkit scroll bars). */
313 unsigned long scroll_bar_foreground_pixel;
315 /* Background color for scroll bars. A value of -1 means use the
316 default (background color of the frame for non-toolkit scroll
317 bars). */
318 unsigned long scroll_bar_background_pixel;
320 /* Descriptor for the cursor in use for this window. */
321 Cursor text_cursor;
322 Cursor nontext_cursor;
323 Cursor modeline_cursor;
324 Cursor cross_cursor;
325 Cursor hourglass_cursor;
326 #if 0
327 /* Window whose cursor is hourglass_cursor. This window is temporarily
328 mapped to display a hourglass-cursor. */
329 Window hourglass_window;
331 /* Non-zero means hourglass cursor is currently displayed. */
332 unsigned hourglass_p : 1;
334 /* Flag to set when the window needs to be completely repainted. */
335 int needs_exposure;
337 #endif
339 /* What kind of text cursor is drawn in this window right now?
340 (If there is no cursor (phys_cursor_x < 0), then this means nothing.) */
341 enum text_cursor_kinds current_cursor;
343 /* What kind of text cursor should we draw in the future?
344 This should always be filled_box_cursor or bar_cursor. */
345 enum text_cursor_kinds desired_cursor;
347 /* Width of bar cursor (if we are using that). */
348 int cursor_width;
350 #if 0
351 DWORD dwStyle;
352 #endif
354 /* The size of the extra width currently allotted for vertical
355 scroll bars, in pixels. */
356 int vertical_scroll_bar_extra;
358 /* The extra width currently allotted for the areas in which
359 truncation marks, continuation marks, and overlay arrows are
360 displayed. */
361 int flags_areas_extra;
363 /* This is the gravity value for the specified window position. */
364 int win_gravity;
366 /* The geometry flags for this window. */
367 int size_hint_flags;
369 /* This is the Emacs structure for the display this frame is on. */
370 /* struct w32_display_info *display_info; */
372 /* Nonzero means our parent is another application's window
373 and was explicitly specified. */
374 char explicit_parent;
376 /* Nonzero means tried already to make this frame visible. */
377 char asked_for_visible;
379 /* Nonzero means menubar is currently active. */
380 char menubar_active;
382 /* Always contains NULL on the Mac OS because the menu bar is shared. */
383 int menubar_widget;
385 #if 0
386 /* Nonzero means menubar is about to become active, but should be
387 brought up to date first. */
388 volatile char pending_menu_activation;
390 #endif
391 /* Relief GCs, colors etc. */
392 struct relief
394 XGCValues *gc;
395 unsigned long pixel;
396 int allocated_p;
398 black_relief, white_relief;
400 /* The background for which the above relief GCs were set up.
401 They are changed only when a different background is involved. */
402 unsigned long relief_background;
405 typedef struct mac_output mac_output;
407 /* Return the Mac window used for displaying data in frame F. */
408 #define FRAME_MAC_WINDOW(f) ((f)->output_data.mac->mWP)
410 #define FRAME_FOREGROUND_PIXEL(f) ((f)->output_data.mac->foreground_pixel)
411 #define FRAME_BACKGROUND_PIXEL(f) ((f)->output_data.mac->background_pixel)
413 #define FRAME_FONT(f) ((f)->output_data.mac->font)
414 #define FRAME_FONTSET(f) ((f)->output_data.mac->fontset)
416 #define FRAME_INTERNAL_BORDER_WIDTH(f) ((f)->output_data.mac->internal_border_width)
417 #define FRAME_LINE_HEIGHT(f) ((f)->output_data.mac->line_height)
418 /* Width of the default font of frame F. Must be defined by each
419 terminal specific header. */
420 #define FRAME_DEFAULT_FONT_WIDTH(F) FONT_WIDTH (FRAME_FONT (F))
421 #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.mac->baseline_offset)
423 /* This gives the w32_display_info structure for the display F is on. */
424 #define FRAME_MAC_DISPLAY_INFO(f) (&one_mac_display_info)
425 #define FRAME_X_DISPLAY_INFO(f) (&one_mac_display_info)
427 /* This is the `Display *' which frame F is on. */
428 #define FRAME_MAC_DISPLAY(f) (0)
430 /* This is the 'font_info *' which frame F has. */
431 #define FRAME_MAC_FONT_TABLE(f) (FRAME_MAC_DISPLAY_INFO (f)->font_table)
433 /* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}. */
434 #define PIXEL_WIDTH(f) ((f)->output_data.mac->pixel_width)
435 #define PIXEL_HEIGHT(f) ((f)->output_data.mac->pixel_height)
437 #define FRAME_DESIRED_CURSOR(f) ((f)->output_data.mac->desired_cursor)
439 /* Value is the smallest width of any character in any font on frame F. */
441 #define FRAME_SMALLEST_CHAR_WIDTH(F) \
442 FRAME_MAC_DISPLAY_INFO(F)->smallest_char_width
444 /* Value is the smallest height of any font on frame F. */
446 #define FRAME_SMALLEST_FONT_HEIGHT(F) \
447 FRAME_MAC_DISPLAY_INFO(F)->smallest_font_height
449 /* Return a pointer to the image cache of frame F. */
451 #define FRAME_X_IMAGE_CACHE(F) FRAME_MAC_DISPLAY_INFO ((F))->image_cache
454 /* Pixel width of the bitmaps drawn to indicate truncation,
455 continuation etc. */
457 #define FRAME_FLAGS_BITMAP_WIDTH(f) 8
458 #define FRAME_FLAGS_BITMAP_HEIGHT(f) 8
460 /* Total width of areas reserved for drawing truncation bitmaps,
461 continuation bitmaps and alike. The width is in canonical char
462 units of the frame. This must currently be the case because window
463 sizes aren't pixel values. If it weren't the case, we wouldn't be
464 able to split windows horizontally nicely. */
466 #define FRAME_X_FLAGS_AREA_COLS(F) \
467 ((2 * FRAME_FLAGS_BITMAP_WIDTH ((F)) + CANON_X_UNIT ((F)) - 1) \
468 / CANON_X_UNIT ((F)))
470 /* Total width of flags areas in pixels. */
472 #define FRAME_X_FLAGS_AREA_WIDTH(F) \
473 (FRAME_X_FLAGS_AREA_COLS ((F)) * CANON_X_UNIT ((F)))
475 /* Pixel-width of the left flags area. */
477 #define FRAME_X_LEFT_FLAGS_AREA_WIDTH(F) \
478 (FRAME_X_FLAGS_AREA_WIDTH (F) / 2)
480 /* Pixel-width of the right flags area. Note that we are doing
481 integer arithmetic here, so don't loose a pixel if the total
482 width is an odd number. */
484 #define FRAME_X_RIGHT_FLAGS_AREA_WIDTH(F) \
485 (FRAME_X_FLAGS_AREA_WIDTH (F) - FRAME_X_FLAGS_AREA_WIDTH (F) / 2)
489 /* Mac-specific scroll bar stuff. */
491 /* We represent scroll bars as lisp vectors. This allows us to place
492 references to them in windows without worrying about whether we'll
493 end up with windows referring to dead scroll bars; the garbage
494 collector will free it when its time comes.
496 We use struct scroll_bar as a template for accessing fields of the
497 vector. */
499 struct scroll_bar {
501 /* These fields are shared by all vectors. */
502 EMACS_INT size_from_Lisp_Vector_struct;
503 struct Lisp_Vector *next_from_Lisp_Vector_struct;
505 /* The window we're a scroll bar for. */
506 Lisp_Object window;
508 /* The next and previous in the chain of scroll bars in this frame. */
509 Lisp_Object next, prev;
511 /* The Mac control handle of this scroll bar. Since this is a full
512 32-bit quantity, we store it split into two 32-bit values. */
513 Lisp_Object control_handle_low, control_handle_high;
515 /* The position and size of the scroll bar in pixels, relative to the
516 frame. */
517 Lisp_Object top, left, width, height;
519 /* The starting and ending positions of the handle, relative to the
520 handle area (i.e. zero is the top position, not
521 SCROLL_BAR_TOP_BORDER). If they're equal, that means the handle
522 hasn't been drawn yet.
524 These are not actually the locations where the beginning and end
525 are drawn; in order to keep handles from becoming invisible when
526 editing large files, we establish a minimum height by always
527 drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below
528 where they would be normally; the bottom and top are in a
529 different co-ordinate system. */
530 Lisp_Object start, end;
532 /* If the scroll bar handle is currently being dragged by the user,
533 this is the number of pixels from the top of the handle to the
534 place where the user grabbed it. If the handle isn't currently
535 being dragged, this is Qnil. */
536 Lisp_Object dragging;
539 /* The number of elements a vector holding a struct scroll_bar needs. */
540 #define SCROLL_BAR_VEC_SIZE \
541 ((sizeof (struct scroll_bar) \
542 - sizeof (EMACS_INT) - sizeof (struct Lisp_Vector *)) \
543 / sizeof (Lisp_Object))
545 /* Turning a lisp vector value into a pointer to a struct scroll_bar. */
546 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
549 /* Building a 32-bit C integer from two 16-bit lisp integers. */
550 #define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low))
552 /* Setting two lisp integers to the low and high words of a 32-bit C int. */
553 #define SCROLL_BAR_UNPACK(low, high, int32) \
554 (XSETINT ((low), (int32) & 0xffff), \
555 XSETINT ((high), ((int32) >> 16) & 0xffff))
558 /* Extract the Mac control handle of the scroll bar from a struct scroll_bar. */
559 #define SCROLL_BAR_CONTROL_HANDLE(ptr) \
560 ((ControlHandle) SCROLL_BAR_PACK ((ptr)->control_handle_low, (ptr)->control_handle_high))
562 /* Store a Mac control handle in a struct scroll_bar. */
563 #define SET_SCROLL_BAR_CONTROL_HANDLE(ptr, id) \
564 (SCROLL_BAR_UNPACK ((ptr)->control_handle_low, (ptr)->control_handle_high, (int) id))
566 /* Return the inside width of a vertical scroll bar, given the outside
567 width. */
568 #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f,width) \
569 ((width) \
570 - VERTICAL_SCROLL_BAR_LEFT_BORDER \
571 - VERTICAL_SCROLL_BAR_RIGHT_BORDER \
572 - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2)
574 /* Return the length of the rectangle within which the top of the
575 handle must stay. This isn't equivalent to the inside height,
576 because the scroll bar handle has a minimum height.
578 This is the real range of motion for the scroll bar, so when we're
579 scaling buffer positions to scroll bar positions, we use this, not
580 VERTICAL_SCROLL_BAR_INSIDE_HEIGHT. */
581 #define VERTICAL_SCROLL_BAR_TOP_RANGE(f,height) \
582 (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, height) - VERTICAL_SCROLL_BAR_MIN_HANDLE - UP_AND_DOWN_ARROWS)
584 /* Return the inside height of vertical scroll bar, given the outside
585 height. See VERTICAL_SCROLL_BAR_TOP_RANGE too. */
586 #define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(f,height) \
587 ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER)
590 /* Border widths for scroll bars.
592 Scroll bar windows don't have any borders; their border width is
593 set to zero, and we redraw borders ourselves. This makes the code
594 a bit cleaner, since we don't have to convert between outside width
595 (used when relating to the rest of the screen) and inside width
596 (used when sizing and drawing the scroll bar window itself).
598 The handle moves up and down/back and forth in a rectangle inset
599 from the edges of the scroll bar. These are widths by which we
600 inset the handle boundaries from the scroll bar edges. */
601 #define VERTICAL_SCROLL_BAR_LEFT_BORDER (0)
602 #define VERTICAL_SCROLL_BAR_RIGHT_BORDER (0)
603 #define VERTICAL_SCROLL_BAR_TOP_BORDER (0)
604 #define VERTICAL_SCROLL_BAR_BOTTOM_BORDER (0)
606 /* Minimum lengths for scroll bar handles, in pixels. */
607 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (16)
609 /* Combined length of up and down arrow boxes in scroll bars, in pixels. */
610 #define UP_AND_DOWN_ARROWS (32)
612 /* Trimming off a few pixels from each side prevents
613 text from glomming up against the scroll bar */
614 #define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
617 /* Manipulating pixel sizes and character sizes.
618 Knowledge of which factors affect the overall size of the window should
619 be hidden in these macros, if that's possible.
621 Return the upper/left pixel position of the character cell on frame F
622 at ROW/COL. */
623 #define CHAR_TO_PIXEL_ROW(f, row) \
624 ((f)->output_data.mac->internal_border_width \
625 + (row) * (f)->output_data.mac->line_height)
626 #define CHAR_TO_PIXEL_COL(f, col) \
627 ((f)->output_data.mac->internal_border_width \
628 + (col) * FONT_WIDTH ((f)->output_data.mac->font))
630 /* Return the pixel width/height of frame F if it has
631 WIDTH columns/HEIGHT rows. */
632 #define CHAR_TO_PIXEL_WIDTH(f, width) \
633 (CHAR_TO_PIXEL_COL (f, width) \
634 + (f)->output_data.mac->vertical_scroll_bar_extra \
635 + (f)->output_data.mac->flags_areas_extra \
636 + (f)->output_data.mac->internal_border_width)
637 #define CHAR_TO_PIXEL_HEIGHT(f, height) \
638 (CHAR_TO_PIXEL_ROW (f, height) \
639 + (f)->output_data.mac->internal_border_width)
642 /* Return the row/column (zero-based) of the character cell containing
643 the pixel on FRAME at ROW/COL. */
644 #define PIXEL_TO_CHAR_ROW(f, row) \
645 (((row) - (f)->output_data.mac->internal_border_width) \
646 / (f)->output_data.mac->line_height)
647 #define PIXEL_TO_CHAR_COL(f, col) \
648 (((col) - (f)->output_data.mac->internal_border_width) \
649 / FONT_WIDTH ((f)->output_data.mac->font))
651 /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on
652 frame F? */
653 #define PIXEL_TO_CHAR_WIDTH(f, width) \
654 (PIXEL_TO_CHAR_COL (f, ((width) \
655 - (f)->output_data.mac->internal_border_width \
656 - (f)->output_data.mac->flags_areas_extra \
657 - (f)->output_data.mac->vertical_scroll_bar_extra)))
658 #define PIXEL_TO_CHAR_HEIGHT(f, height) \
659 (PIXEL_TO_CHAR_ROW (f, ((height) \
660 - (f)->output_data.mac->internal_border_width)))
662 struct frame * check_x_frame (Lisp_Object);
664 /* Dummy entry for defining tty_display in frame.c. */
665 struct x_output
667 char _dummy;