frame.h 40.1 KB
Newer Older
Jim Blandy's avatar
Jim Blandy committed
1
/* Define frame-object for GNU Emacs.
2
   Copyright (C) 1993-1994, 1999-2011 Free Software Foundation, Inc.
Jim Blandy's avatar
Jim Blandy committed
3 4 5

This file is part of GNU Emacs.

6
GNU Emacs is free software: you can redistribute it and/or modify
Jim Blandy's avatar
Jim Blandy committed
7
it under the terms of the GNU General Public License as published by
8 9
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Jim Blandy's avatar
Jim Blandy committed
10 11 12 13 14 15 16

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
17
along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
Jim Blandy's avatar
Jim Blandy committed
18

19 20 21 22
/* Don't multiply include: dispextern.h includes macterm.h which
   includes frame.h some emacs source includes both dispextern.h and
   frame.h */

23 24
#ifndef EMACS_FRAME_H
#define EMACS_FRAME_H
Gerd Moellmann's avatar
Gerd Moellmann committed
25

26 27
#include "dispextern.h"

28 29 30

/* Miscellanea.  */

31
/* Nonzero means there is at least one garbaged frame. */
32 33 34
extern int frame_garbaged;


Karl Heuer's avatar
Karl Heuer committed
35
/* The structure representing a frame.  */
Jim Blandy's avatar
Jim Blandy committed
36 37

enum output_method
Gerd Moellmann's avatar
Gerd Moellmann committed
38
{
39
  output_initial,
Gerd Moellmann's avatar
Gerd Moellmann committed
40 41 42
  output_termcap,
  output_x_window,
  output_msdos_raw,
43
  output_w32,
44 45
  output_mac,
  output_ns
Gerd Moellmann's avatar
Gerd Moellmann committed
46
};
Jim Blandy's avatar
Jim Blandy committed
47

48
enum vertical_scroll_bar_type
Gerd Moellmann's avatar
Gerd Moellmann committed
49 50 51 52 53
{
  vertical_scroll_bar_none,
  vertical_scroll_bar_left,
  vertical_scroll_bar_right
};
54

55 56 57 58 59 60 61 62 63 64
enum text_cursor_kinds
{
  DEFAULT_CURSOR = -2,
  NO_CURSOR = -1,
  FILLED_BOX_CURSOR,
  HOLLOW_BOX_CURSOR,
  BAR_CURSOR,
  HBAR_CURSOR
};

65 66
enum fullscreen_type
{
67 68 69 70 71 72
  FULLSCREEN_NONE,
  FULLSCREEN_WIDTH     = 0x001,
  FULLSCREEN_HEIGHT    = 0x002,
  FULLSCREEN_BOTH      = 0x003,
  FULLSCREEN_MAXIMIZED = 0x013,
  FULLSCREEN_WAIT      = 0x100
73 74 75
};


76 77
#define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel)
#define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel)
78

79
struct terminal;
80

81 82
struct font_driver_list;

Jim Blandy's avatar
Jim Blandy committed
83
struct frame
Jim Blandy's avatar
Jim Blandy committed
84
{
Stefan Monnier's avatar
Stefan Monnier committed
85
  EMACS_UINT size;
Jim Blandy's avatar
Jim Blandy committed
86 87
  struct Lisp_Vector *next;

88 89
  /* All Lisp_Object components must come first.
     That ensures they are all aligned normally.  */
Jim Blandy's avatar
Jim Blandy committed
90

91 92
  /* Name of this frame: a Lisp string.  It is used for looking up resources,
     as well as for the title in some cases.  */
Jim Blandy's avatar
Jim Blandy committed
93 94
  Lisp_Object name;

95 96 97 98
  /* The name to use for the icon, the last time
     it was refreshed.  nil means not explicitly specified.  */
  Lisp_Object icon_name;

99 100 101 102
  /* This is the frame title specified explicitly, if any.
     Usually it is nil.  */
  Lisp_Object title;

103
  /* The frame which should receive keystrokes that occur in this
104 105 106 107 108 109 110 111 112 113
     frame, or nil if they should go to the frame itself.  This is
     usually nil, but if the frame is minibufferless, we can use this
     to redirect keystrokes to a surrogate minibuffer frame when
     needed.

     Note that a value of nil is different than having the field point
     to the frame itself.  Whenever the Fselect_frame function is used
     to shift from one frame to the other, any redirections to the
     original frame are shifted to the newly selected frame; if
     focus_frame is nil, Fselect_frame will leave it alone.  */
Jim Blandy's avatar
Jim Blandy committed
114
  Lisp_Object focus_frame;
Jim Blandy's avatar
Jim Blandy committed
115

Jim Blandy's avatar
Jim Blandy committed
116 117 118
  /* This frame's root window.  Every frame has one.
     If the frame has only a minibuffer window, this is it.
     Otherwise, if the frame has a minibuffer window, this is its sibling.  */
Jim Blandy's avatar
Jim Blandy committed
119 120
  Lisp_Object root_window;

Jim Blandy's avatar
Jim Blandy committed
121 122 123 124
  /* This frame's selected window.
     Each frame has its own window hierarchy
     and one of the windows in it is selected within the frame.
     The selected window of the selected frame is Emacs's selected window.  */
Jim Blandy's avatar
Jim Blandy committed
125 126
  Lisp_Object selected_window;

Jim Blandy's avatar
Jim Blandy committed
127 128 129
  /* This frame's minibuffer window.
     Most frames have their own minibuffer windows,
     but only the selected frame's minibuffer window
Jim Blandy's avatar
Jim Blandy committed
130 131 132
     can actually appear to exist.  */
  Lisp_Object minibuffer_window;

Jim Blandy's avatar
Jim Blandy committed
133 134 135
  /* Parameter alist of this frame.
     These are the parameters specified when creating the frame
     or modified with modify-frame-parameters.  */
Jim Blandy's avatar
Jim Blandy committed
136 137
  Lisp_Object param_alist;

138
  /* List of scroll bars on this frame.
139
     Actually, we don't specify exactly what is stored here at all; the
140
     scroll bar implementation code can use it to store anything it likes.
141
     This field is marked by the garbage collector.  It is here
142
     instead of in the `device' structure so that the garbage
143 144
     collector doesn't need to look inside the window-system-dependent
     structure.  */
145 146
  Lisp_Object scroll_bars;
  Lisp_Object condemned_scroll_bars;
147

Richard M. Stallman's avatar
Richard M. Stallman committed
148 149 150 151 152
  /* Vector describing the items to display in the menu bar.
     Each item has four elements in this vector.
     They are KEY, STRING, SUBMAP, and HPOS.
     (HPOS is not used in when the X toolkit is in use.)
     There are four additional elements of nil at the end, to terminate.  */
153 154
  Lisp_Object menu_bar_items;

155 156 157
  /* Alist of elements (FACE-NAME . FACE-VECTOR-DATA).  */
  Lisp_Object face_alist;

158 159 160 161 162 163 164 165
  /* A vector that records the entire structure of this frame's menu bar.
     For the format of the data, see extensive comments in xmenu.c.
     Only the X toolkit version uses this.  */
  Lisp_Object menu_bar_vector;

  /* Predicate for selecting buffers for other-buffer.  */
  Lisp_Object buffer_predicate;

166 167 168
  /* List of buffers viewed in this frame, for other-buffer.  */
  Lisp_Object buffer_list;

169 170 171
  /* List of buffers that were viewed, then buried in this frame.  The
     most recently buried buffer is first.  For last-buffer.  */
  Lisp_Object buried_buffer_list;
Juanma Barranquero's avatar
Juanma Barranquero committed
172

Gerd Moellmann's avatar
Gerd Moellmann committed
173 174 175 176
  /* A dummy window used to display menu bars under X when no X
     toolkit support is available.  */
  Lisp_Object menu_bar_window;

177 178
  /* A window used to display the tool-bar of a frame.  */
  Lisp_Object tool_bar_window;
Gerd Moellmann's avatar
Gerd Moellmann committed
179

180
  /* Desired and current tool-bar items.  */
181
  Lisp_Object tool_bar_items;
Gerd Moellmann's avatar
Gerd Moellmann committed
182

183 184 185 186
  /* Where tool bar is, can be left, right, top or bottom.  The native
     tool bar only supports top.  */
  Lisp_Object tool_bar_position;

187 188
  /* Desired and current contents displayed in tool_bar_window.  */
  Lisp_Object desired_tool_bar_string, current_tool_bar_string;
Gerd Moellmann's avatar
Gerd Moellmann committed
189

Juanma Barranquero's avatar
Juanma Barranquero committed
190
  /* Beyond here, there should be no more Lisp_Object components.  */
191

Gerd Moellmann's avatar
Gerd Moellmann committed
192 193
  /* Cache of realized faces.  */
  struct face_cache *face_cache;
194

195 196 197
  /* Number of elements in `menu_bar_vector' that have meaningful data.  */
  EMACS_INT menu_bar_items_used;

Gerd Moellmann's avatar
Gerd Moellmann committed
198 199
  /* A buffer to hold the frame's name.  We can't use the Lisp
     string's pointer (`name', above) because it might get relocated.  */
200 201
  char *namebuf;

Gerd Moellmann's avatar
Gerd Moellmann committed
202 203 204 205 206 207 208 209 210
  /* Glyph pool and matrix. */
  struct glyph_pool *current_pool;
  struct glyph_pool *desired_pool;
  struct glyph_matrix *desired_matrix;
  struct glyph_matrix *current_matrix;

  /* 1 means that glyphs on this frame have been initialized so it can
     be used for output.  */
  unsigned glyphs_initialized_p : 1;
211

212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
  /* Set to non-zero in change_frame_size when size of frame changed
     Clear the frame in clear_garbaged_frames if set.  */
  unsigned resized_p : 1;

  /* Set to non-zero in when we want for force a flush_display in
     update_frame, usually after resizing the frame.  */
  unsigned force_flush_display_p : 1;

  /* Set to non-zero if the default face for the frame has been
     realized.  Reset to zero whenever the default face changes.
     Used to see the difference between a font change and face change.  */
  unsigned default_face_done_p : 1;

  /* Set to non-zero if this frame has already been hscrolled during
     current redisplay.  */
  unsigned already_hscrolled_p : 1;

  /* Set to non-zero when current redisplay has updated frame.  */
  unsigned updated_p : 1;

  /* Set to non-zero to minimize tool-bar height even when
     auto-resize-tool-bar is set to grow-only.  */
  unsigned minimize_tool_bar_window_p : 1;

236
#if defined (USE_GTK) || defined (HAVE_NS)
Jan Djärv's avatar
Jan Djärv committed
237 238 239 240
  /* Nonzero means using a tool bar that comes from the toolkit.  */
  int external_tool_bar;
#endif

241 242
  /* Margin at the top of the frame.  Used to display the tool-bar.  */
  int tool_bar_lines;
Gerd Moellmann's avatar
Gerd Moellmann committed
243

244
  int n_tool_bar_rows;
245
  int n_tool_bar_items;
246

Gerd Moellmann's avatar
Gerd Moellmann committed
247 248
  /* A buffer for decode_mode_line. */
  char *decode_mode_spec_buffer;
249 250 251 252 253 254 255 256 257 258 259

  /* See do_line_insertion_deletion_costs for info on these arrays. */
  /* Cost of inserting 1 line on this frame */
  int *insert_line_cost;
  /* Cost of deleting 1 line on this frame */
  int *delete_line_cost;
  /* Cost of inserting n lines on this frame */
  int *insert_n_lines_cost;
  /* Cost of deleting n lines on this frame */
  int *delete_n_lines_cost;

260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
  /* Size of this frame, excluding fringes, scroll bars etc.,
     in units of canonical characters.  */
  EMACS_INT text_lines, text_cols;

  /* Total size of this frame (i.e. its native window), in units of
     canonical characters.  */
  EMACS_INT total_lines, total_cols;

  /* New text height and width for pending size change.
     0 if no change pending.  */
  int new_text_lines, new_text_cols;

  /* Pixel position of the frame window (x and y offsets in root window).  */
  int left_pos, top_pos;

  /* Size of the frame window in pixels.  */
  int pixel_height, pixel_width;

278 279 280
  /* Dots per inch of the screen the frame is on.  */
  double resx, resy;

281 282 283 284 285 286 287 288 289
  /* These many pixels are the difference between the outer window (i.e. the
     left and top of the window manager decoration) and FRAME_X_WINDOW. */
  int x_pixels_diff, y_pixels_diff;

  /* This is the gravity value for the specified window position.  */
  int win_gravity;

  /* The geometry flags for this window.  */
  int size_hint_flags;
290

291 292 293 294 295 296 297 298 299 300 301
  /* Border width of the frame window as known by the (X) window system.  */
  int border_width;

  /* Width of the internal border.  This is a line of background color
     just inside the window's border.  When the frame is selected,
     a highlighting is displayed inside the internal border.  */
  int internal_border_width;

  /* Canonical X unit.  Width of default font, in pixels.  */
  int column_width;

Juanma Barranquero's avatar
Juanma Barranquero committed
302
  /* Width of space glyph of default font, in pixels.  */
303 304
  int space_width;

305 306
  /* Canonical Y unit.  Height of a line, in pixels.  */
  int line_height;
307

308 309
  /* The output method says how the contents of this frame are
     displayed.  It could be using termcap, or using an X window.
310
     This must be the same as the terminal->type. */
Jim Blandy's avatar
Jim Blandy committed
311 312
  enum output_method output_method;

313
  /* The terminal device that this frame uses.  If this is NULL, then
314
     the frame has been deleted. */
315
  struct terminal *terminal;
Juanma Barranquero's avatar
Juanma Barranquero committed
316

317
  /* Device-dependent, frame-local auxiliary data used for displaying
318 319
     the contents.  When the frame is deleted, this data is deleted as
     well. */
Gerd Moellmann's avatar
Gerd Moellmann committed
320 321
  union output_data
  {
322 323 324
    struct tty_output *tty;     /* termchar.h */
    struct x_output *x;         /* xterm.h */
    struct w32_output *w32;     /* w32term.h */
325
    struct ns_output *ns;       /* nsterm.h */
326
    EMACS_INT nothing;
Gerd Moellmann's avatar
Gerd Moellmann committed
327 328
  }
  output_data;
Jim Blandy's avatar
Jim Blandy committed
329

330 331
  /* List of font-drivers available on the frame. */
  struct font_driver_list *font_driver_list;
332 333 334
  /* List of data specific to font-driver and frame, but common to
     faces.  */
  struct font_data_list *font_data_list;
335

336 337 338 339 340 341 342 343 344 345 346
  /* Total width of fringes reserved for drawing truncation bitmaps,
     continuation bitmaps and alike.  The width is in canonical char
     units of the frame.  This must currently be the case because window
     sizes aren't pixel values.  If it weren't the case, we wouldn't be
     able to split windows horizontally nicely.  */
  int fringe_cols;

  /* The extra width (in pixels) currently allotted for fringes.  */
  int left_fringe_width, right_fringe_width;

  /* See FULLSCREEN_ enum below */
347
  enum fullscreen_type want_fullscreen;
348

349 350 351
  /* Number of lines of menu bar.  */
  int menu_bar_lines;

352
#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
353
    || defined (HAVE_NS) || defined (USE_GTK)
354
  /* Nonzero means using a menu bar that comes from the X toolkit.  */
355
  unsigned int external_menu_bar : 1;
356 357
#endif

Jim Blandy's avatar
Jim Blandy committed
358
  /* Nonzero if last attempt at redisplay on this frame was preempted.  */
359
  unsigned char display_preempted : 1;
Jim Blandy's avatar
Jim Blandy committed
360

361 362
  /* visible is nonzero if the frame is currently displayed; we check
     it to see if we should bother updating the frame's contents.
363
     DON'T SET IT DIRECTLY; instead, use FRAME_SET_VISIBLE.
Jim Blandy's avatar
Jim Blandy committed
364

365 366 367 368
     Note that, since invisible frames aren't updated, whenever a
     frame becomes visible again, it must be marked as garbaged.  The
     FRAME_SAMPLE_VISIBILITY macro takes care of this.

369 370 371 372 373 374 375
     On ttys and on Windows NT/9X, to avoid wasting effort updating
     visible frames that are actually completely obscured by other
     windows on the display, we bend the meaning of visible slightly:
     if greater than 1, then the frame is obscured - we still consider
     it to be "visible" as seen from lisp, but we don't bother
     updating it.  We must take care to garbage the frame when it
     ceaces to be obscured though.
Geoff Voelker's avatar
Geoff Voelker committed
376

377 378 379 380 381 382 383 384 385 386
     iconified is nonzero if the frame is currently iconified.

     Asynchronous input handlers should NOT change these directly;
     instead, they should change async_visible or async_iconified, and
     let the FRAME_SAMPLE_VISIBILITY macro set visible and iconified
     at the next redisplay.

     These should probably be considered read-only by everyone except
     FRAME_SAMPLE_VISIBILITY.

Karl Heuer's avatar
Karl Heuer committed
387
     These two are mutually exclusive.  They might both be zero, if the
388
     frame has been made invisible without an icon.  */
389
  unsigned char visible : 2;
390 391 392
  unsigned char iconified : 1;

  /* Let's not use bitfields for volatile variables.  */
393 394 395 396

  /* Asynchronous input handlers change these, and
     FRAME_SAMPLE_VISIBILITY copies them into visible and iconified.
     See FRAME_SAMPLE_VISIBILITY, below.  */
397
  volatile char async_visible, async_iconified;
Jim Blandy's avatar
Jim Blandy committed
398

Jim Blandy's avatar
Jim Blandy committed
399
  /* Nonzero if this frame should be redrawn.  */
400
  volatile char garbaged;
Jim Blandy's avatar
Jim Blandy committed
401

Jim Blandy's avatar
Jim Blandy committed
402 403
  /* True if frame actually has a minibuffer window on it.
     0 if using a minibuffer window that isn't on this frame.  */
404
  unsigned char has_minibuffer : 1;
405

Jim Blandy's avatar
Jim Blandy committed
406
  /* 0 means, if this frame has just one window,
Jim Blandy's avatar
Jim Blandy committed
407
     show no modeline for that window.  */
408
  unsigned char wants_modeline : 1;
Jim Blandy's avatar
Jim Blandy committed
409

410
  /* Non-zero if the hardware device this frame is displaying on can
411 412
     support scroll bars.  */
  char can_have_scroll_bars;
413

Jim Blandy's avatar
Jim Blandy committed
414
  /* Non-0 means raise this frame to the top of the heap when selected.  */
415
  unsigned char auto_raise : 1;
Jim Blandy's avatar
Jim Blandy committed
416

Jim Blandy's avatar
Jim Blandy committed
417
  /* Non-0 means lower this frame to the bottom of the stack when left.  */
418
  unsigned char auto_lower : 1;
Jim Blandy's avatar
Jim Blandy committed
419

Jim Blandy's avatar
Jim Blandy committed
420
  /* True if frame's root window can't be split.  */
421
  unsigned char no_split : 1;
Jim Blandy's avatar
Jim Blandy committed
422

Jim Blandy's avatar
Jim Blandy committed
423 424 425 426
  /* If this is set, then Emacs won't change the frame name to indicate
     the current buffer, etcetera.  If the user explicitly sets the frame
     name, this gets set.  If the user sets the name to Qnil, this is
     cleared.  */
427
  unsigned char explicit_name : 1;
Jim Blandy's avatar
Jim Blandy committed
428

429
  /* Nonzero if size of some window on this frame has changed.  */
430
  unsigned char window_sizes_changed : 1;
431

432 433
  /* Nonzero if the mouse has moved on this display device
     since the last time we checked.  */
434
  unsigned char mouse_moved :1;
435

436 437 438
  /* Nonzero means that the pointer is invisible. */
  unsigned char pointer_invisible :1;

439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456
  /* If can_have_scroll_bars is non-zero, this is non-zero if we should
     actually display them on this frame.  */
  enum vertical_scroll_bar_type vertical_scroll_bar_type;

  /* What kind of text cursor should we draw in the future?
     This should always be filled_box_cursor or bar_cursor.  */
  enum text_cursor_kinds desired_cursor;

  /* Width of bar cursor (if we are using that).  */
  int cursor_width;

  /* What kind of text cursor should we draw when the cursor blinks off?
     This can be filled_box_cursor or bar_cursor or no_cursor.  */
  enum text_cursor_kinds blink_off_cursor;

  /* Width of bar cursor (if we are using that) for blink-off state.  */
  int blink_off_cursor_width;

Jim Blandy's avatar
Jim Blandy committed
457
  /* Storage for messages to this frame. */
Jim Blandy's avatar
Jim Blandy committed
458 459 460 461 462
  char *message_buf;

  /* Nonnegative if current redisplay should not do scroll computation
     for lines beyond a certain vpos.  This is the vpos.  */
  int scroll_bottom_vpos;
463

464 465 466 467 468 469 470 471 472 473 474
  /* Configured width of the scroll bar, in pixels and in characters.
     config_scroll_bar_cols tracks config_scroll_bar_width if the
     latter is positive; a zero value in config_scroll_bar_width means
     to compute the actual width on the fly, using config_scroll_bar_cols
     and the current font width.  */
  int config_scroll_bar_width;
  int config_scroll_bar_cols;

  /* The size of the extra width currently allotted for vertical
     scroll bars in this frame, in pixels.  */
  int scroll_bar_actual_width;
475 476 477

  /* The baud rate that was used to calculate costs for this frame.  */
  int cost_calculation_baud_rate;
478

479 480
  /* frame opacity
     alpha[0]: alpha transparency of the active frame
481 482
     alpha[1]: alpha transparency of inactive frames
     Negative values mean not to change alpha.  */
483 484
  double alpha[2];

485 486 487 488
  /* Exponent for gamma correction of colors.  1/(VIEWING_GAMMA *
     SCREEN_GAMMA) where viewing_gamma is 0.4545 and SCREEN_GAMMA is a
     frame parameter.  0 means don't do gamma correction.  */
  double gamma;
489 490 491

  /* Additional space to put between text lines on this frame.  */
  int extra_line_spacing;
492

493 494 495
  /* All display backends seem to need these two pixel values. */
  unsigned long background_pixel;
  unsigned long foreground_pixel;
Jim Blandy's avatar
Jim Blandy committed
496 497
};

498
#define FRAME_KBOARD(f) ((f)->terminal->kboard)
499

500 501 502
/* Return a pointer to the image cache of frame F.  */
#define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache)

Jim Blandy's avatar
Jim Blandy committed
503 504
typedef struct frame *FRAME_PTR;

505
#define XFRAME(p) (eassert (FRAMEP(p)),(struct frame *) XPNTR (p))
506
#define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
Jim Blandy's avatar
Jim Blandy committed
507

Richard M. Stallman's avatar
Richard M. Stallman committed
508
/* Given a window, return its frame as a Lisp_Object.  */
Jim Blandy's avatar
Jim Blandy committed
509 510
#define WINDOW_FRAME(w) (w)->frame

Richard M. Stallman's avatar
Richard M. Stallman committed
511
/* Test a frame for particular kinds of display methods.  */
512
#define FRAME_INITIAL_P(f) ((f)->output_method == output_initial)
Richard M. Stallman's avatar
Richard M. Stallman committed
513
#define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap)
514
#define FRAME_X_P(f) ((f)->output_method == output_x_window)
515
#define FRAME_W32_P(f) ((f)->output_method == output_w32)
516
#define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw)
517
#define FRAME_MAC_P(f) ((f)->output_method == output_mac)
518
#define FRAME_NS_P(f) ((f)->output_method == output_ns)
519 520 521

/* FRAME_WINDOW_P tests whether the frame is a window, and is
   defined to be the predicate for the window system being used.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
522

523 524 525 526
#ifdef HAVE_X_WINDOWS
#define FRAME_WINDOW_P(f) FRAME_X_P (f)
#endif
#ifdef HAVE_NTGUI
527
#define FRAME_WINDOW_P(f) FRAME_W32_P (f)
528
#endif
529 530 531
#ifdef HAVE_NS
#define FRAME_WINDOW_P(f) FRAME_NS_P(f)
#endif
532 533 534
#ifndef FRAME_WINDOW_P
#define FRAME_WINDOW_P(f) (0)
#endif
535

536 537
/* Return a pointer to the structure holding information about the
   region of text, if any, that is currently shown in mouse-face on
538 539 540 541 542 543 544 545 546 547 548
   frame F.  We need to define two versions because a TTY-only build
   does not have FRAME_X_DISPLAY_INFO.  */
#ifdef HAVE_WINDOW_SYSTEM
# define MOUSE_HL_INFO(F)					\
   (FRAME_WINDOW_P(F)						\
    ? &(FRAME_X_DISPLAY_INFO(F)->mouse_highlight)		\
    : &(((F)->output_data.tty->display_info)->mouse_highlight))
#else
# define MOUSE_HL_INFO(F)					\
    (&(((F)->output_data.tty->display_info)->mouse_highlight))
#endif
549

Richard M. Stallman's avatar
Richard M. Stallman committed
550
/* Nonzero if frame F is still alive (not deleted).  */
551
#define FRAME_LIVE_P(f) ((f)->terminal != 0)
Richard M. Stallman's avatar
Richard M. Stallman committed
552 553

/* Nonzero if frame F is a minibuffer-only frame.  */
Jim Blandy's avatar
Jim Blandy committed
554 555
#define FRAME_MINIBUF_ONLY_P(f) \
  EQ (FRAME_ROOT_WINDOW (f), FRAME_MINIBUF_WINDOW (f))
Richard M. Stallman's avatar
Richard M. Stallman committed
556 557 558

/* Nonzero if frame F contains a minibuffer window.
   (If this is 0, F must use some other minibuffer window.)  */
Jim Blandy's avatar
Jim Blandy committed
559
#define FRAME_HAS_MINIBUF_P(f) ((f)->has_minibuffer)
Richard M. Stallman's avatar
Richard M. Stallman committed
560

561 562 563 564 565 566 567 568 569 570 571 572
/* Pixel height of frame F, including non-toolkit menu bar and
   non-toolkit tool bar lines.  */
#define FRAME_PIXEL_HEIGHT(f) ((f)->pixel_height)

/* Pixel width of frame F.  */
#define FRAME_PIXEL_WIDTH(f) ((f)->pixel_width)

/* Height of frame F, measured in canonical lines, including
   non-toolkit menu bar and non-toolkit tool bar lines.  */
#define FRAME_LINES(f) (f)->text_lines

/* Width of frame F, measured in canonical character columns,
Richard M. Stallman's avatar
Richard M. Stallman committed
573
   not including scroll bars if any.  */
574
#define FRAME_COLS(f) (f)->text_cols
Richard M. Stallman's avatar
Richard M. Stallman committed
575 576 577 578

/* Number of lines of frame F used for menu bar.
   This is relevant on terminal frames and on
   X Windows when not using the X toolkit.
579
   These lines are counted in FRAME_LINES.  */
580
#define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines
Richard M. Stallman's avatar
Richard M. Stallman committed
581

Jan Djärv's avatar
Jan Djärv committed
582 583
/* Nonzero if this frame should display a tool bar
   in a way that does not use any text lines.  */
584
#if defined (USE_GTK) || defined (HAVE_NS)
Jan Djärv's avatar
Jan Djärv committed
585 586 587 588 589
#define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar
#else
#define FRAME_EXTERNAL_TOOL_BAR(f) 0
#endif

590
/* Number of lines of frame F used for the tool-bar.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
591

592
#define FRAME_TOOL_BAR_LINES(f) (f)->tool_bar_lines
Gerd Moellmann's avatar
Gerd Moellmann committed
593

Jan Djärv's avatar
Jan Djärv committed
594

Gerd Moellmann's avatar
Gerd Moellmann committed
595 596 597
/* Lines above the top-most window in frame F.  */

#define FRAME_TOP_MARGIN(F) \
598
     (FRAME_MENU_BAR_LINES (F) + FRAME_TOOL_BAR_LINES (F))
Gerd Moellmann's avatar
Gerd Moellmann committed
599

600 601 602 603 604
/* Pixel height of the top margin above.  */

#define FRAME_TOP_MARGIN_HEIGHT(f) \
  (FRAME_TOP_MARGIN (f) * FRAME_LINE_HEIGHT (f))

Richard M. Stallman's avatar
Richard M. Stallman committed
605 606
/* Nonzero if this frame should display a menu bar
   in a way that does not use any text lines.  */
607
#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
608
     || defined (HAVE_NS) || defined (USE_GTK)
609
#define FRAME_EXTERNAL_MENU_BAR(f) (f)->external_menu_bar
610 611 612
#else
#define FRAME_EXTERNAL_MENU_BAR(f) 0
#endif
613
#define FRAME_VISIBLE_P(f) ((f)->visible != 0)
Richard M. Stallman's avatar
Richard M. Stallman committed
614 615

/* Nonzero if frame F is currently visible but hidden.  */
Geoff Voelker's avatar
Geoff Voelker committed
616
#define FRAME_OBSCURED_P(f) ((f)->visible > 1)
Richard M. Stallman's avatar
Richard M. Stallman committed
617 618 619 620

/* Nonzero if frame F is currently iconified.  */
#define FRAME_ICONIFIED_P(f) (f)->iconified

621 622
#define FRAME_SET_VISIBLE(f,p) \
  ((f)->async_visible = (p), FRAME_SAMPLE_VISIBILITY (f))
Jim Blandy's avatar
Jim Blandy committed
623 624
#define SET_FRAME_GARBAGED(f) (frame_garbaged = 1, f->garbaged = 1)
#define FRAME_GARBAGED_P(f) (f)->garbaged
Richard M. Stallman's avatar
Richard M. Stallman committed
625 626

/* Nonzero means do not allow splitting this frame's window.  */
Jim Blandy's avatar
Jim Blandy committed
627
#define FRAME_NO_SPLIT_P(f) (f)->no_split
Richard M. Stallman's avatar
Richard M. Stallman committed
628 629

/* Not really implemented.  */
Jim Blandy's avatar
Jim Blandy committed
630
#define FRAME_WANTS_MODELINE_P(f) (f)->wants_modeline
Richard M. Stallman's avatar
Richard M. Stallman committed
631 632 633 634

/* Nonzero if a size change has been requested for frame F
   but not yet really put into effect.  This can be true temporarily
   when an X event comes in at a bad time.  */
635
#define FRAME_WINDOW_SIZES_CHANGED(f) (f)->window_sizes_changed
Richard M. Stallman's avatar
Richard M. Stallman committed
636 637

/* The minibuffer window of frame F, if it has one; otherwise nil.  */
Jim Blandy's avatar
Jim Blandy committed
638
#define FRAME_MINIBUF_WINDOW(f) (f)->minibuffer_window
Richard M. Stallman's avatar
Richard M. Stallman committed
639 640

/* The root window of the window tree of frame F.  */
Jim Blandy's avatar
Jim Blandy committed
641
#define FRAME_ROOT_WINDOW(f) (f)->root_window
Richard M. Stallman's avatar
Richard M. Stallman committed
642 643

/* The currently selected window of the window tree of frame F.  */
Jim Blandy's avatar
Jim Blandy committed
644
#define FRAME_SELECTED_WINDOW(f) (f)->selected_window
Richard M. Stallman's avatar
Richard M. Stallman committed
645

646 647
#define FRAME_INSERT_COST(f) (f)->insert_line_cost
#define FRAME_DELETE_COST(f) (f)->delete_line_cost
Jim Blandy's avatar
Jim Blandy committed
648 649 650 651 652
#define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost
#define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost
#define FRAME_MESSAGE_BUF(f) (f)->message_buf
#define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos
#define FRAME_FOCUS_FRAME(f) (f)->focus_frame
Richard M. Stallman's avatar
Richard M. Stallman committed
653 654 655 656

/* Nonzero if frame F supports scroll bars.
   If this is zero, then it is impossible to enable scroll bars
   on frame F.  */
657
#define FRAME_CAN_HAVE_SCROLL_BARS(f) ((f)->can_have_scroll_bars)
Richard M. Stallman's avatar
Richard M. Stallman committed
658 659 660

/* This frame slot says whether scroll bars are currently enabled for frame F,
   and which side they are on.  */
661 662 663 664 665 666 667
#define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type)
#define FRAME_HAS_VERTICAL_SCROLL_BARS(f) \
     ((f)->vertical_scroll_bar_type != vertical_scroll_bar_none)
#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) \
     ((f)->vertical_scroll_bar_type == vertical_scroll_bar_left)
#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \
     ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right)
Richard M. Stallman's avatar
Richard M. Stallman committed
668 669 670 671

/* Width that a scroll bar in frame F should have, if there is one.
   Measured in pixels.
   If scroll bars are turned off, this is still nonzero.  */
672
#define FRAME_CONFIG_SCROLL_BAR_WIDTH(f) ((f)->config_scroll_bar_width)
Richard M. Stallman's avatar
Richard M. Stallman committed
673 674 675 676

/* Width that a scroll bar in frame F should have, if there is one.
   Measured in columns (characters).
   If scroll bars are turned off, this is still nonzero.  */
677
#define FRAME_CONFIG_SCROLL_BAR_COLS(f) ((f)->config_scroll_bar_cols)
Richard M. Stallman's avatar
Richard M. Stallman committed
678 679

/* Width of a scroll bar in frame F, measured in columns (characters),
680 681 682
   but only if scroll bars are on the left.  If scroll bars are on
   the right in this frame, or there are no scroll bars, value is 0.  */

683
#define FRAME_LEFT_SCROLL_BAR_COLS(f)			\
684
     (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)	\
685
      ? FRAME_CONFIG_SCROLL_BAR_COLS (f)		\
686 687
      : 0)

688 689 690 691 692 693 694
/* Width of a left scroll bar in frame F, measured in pixels */

#define FRAME_LEFT_SCROLL_BAR_AREA_WIDTH(f)					\
  (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)				\
   ? (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))	\
   : 0)

695 696 697 698
/* Width of a scroll bar in frame F, measured in columns (characters),
   but only if scroll bars are on the right.  If scroll bars are on
   the left in this frame, or there are no scroll bars, value is 0.  */

699
#define FRAME_RIGHT_SCROLL_BAR_COLS(f)			\
700
     (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)	\
701
      ? FRAME_CONFIG_SCROLL_BAR_COLS (f)		\
702
      : 0)
Richard M. Stallman's avatar
Richard M. Stallman committed
703

704 705 706 707 708 709 710 711 712 713 714 715
/* Width of a right scroll bar area in frame F, measured in pixels */

#define FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH(f)					\
  (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)				\
   ? (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))	\
   : 0)

/* Actual width of a scroll bar in frame F, measured in columns.  */

#define FRAME_SCROLL_BAR_COLS(f)			\
     (FRAME_HAS_VERTICAL_SCROLL_BARS (f)		\
      ? FRAME_CONFIG_SCROLL_BAR_COLS (f)		\
716
      : 0)
Richard M. Stallman's avatar
Richard M. Stallman committed
717

718 719 720 721 722 723 724
/* Actual width of a scroll bar area in frame F, measured in pixels.  */

#define FRAME_SCROLL_BAR_AREA_WIDTH(f)					\
  (FRAME_HAS_VERTICAL_SCROLL_BARS (f)					\
   ? (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))	\
   : 0)

Richard M. Stallman's avatar
Richard M. Stallman committed
725 726
/* Total width of frame F, in columns (characters),
   including the width used by scroll bars if any.  */
727 728

#define FRAME_TOTAL_COLS(f) ((f)->total_cols)
Richard M. Stallman's avatar
Richard M. Stallman committed
729 730 731

/* Set the width of frame F to VAL.
   VAL is the width of a full-frame window,
732 733 734 735 736
   not including scroll bars and fringes.  */

#define SET_FRAME_COLS(f, val)						\
     (FRAME_COLS (f) = (val),						\
      (f)->total_cols = FRAME_TOTAL_COLS_ARG (f, FRAME_COLS (f)))
Richard M. Stallman's avatar
Richard M. Stallman committed
737 738

/* Given a value WIDTH for frame F's nominal width,
739 740 741
   return the value that FRAME_TOTAL_COLS should have.  */

#define FRAME_TOTAL_COLS_ARG(f, width)		\
Gerd Moellmann's avatar
Gerd Moellmann committed
742
     ((width)					\
743
      + FRAME_SCROLL_BAR_COLS (f)		\
Kim F. Storm's avatar
Kim F. Storm committed
744
      + FRAME_FRINGE_COLS (f))
Richard M. Stallman's avatar
Richard M. Stallman committed
745

746
/* Maximum + 1 legitimate value for FRAME_CURSOR_X.  */
747

748
#define FRAME_CURSOR_X_LIMIT(f) \
749
     (FRAME_COLS (f) + FRAME_LEFT_SCROLL_BAR_COLS (f))
Richard M. Stallman's avatar
Richard M. Stallman committed
750 751

/* Nonzero if frame F has scroll bars.  */
752

753
#define FRAME_SCROLL_BARS(f) ((f)->scroll_bars)
Richard M. Stallman's avatar
Richard M. Stallman committed
754

755
#define FRAME_CONDEMNED_SCROLL_BARS(f) ((f)->condemned_scroll_bars)
756
#define FRAME_MENU_BAR_ITEMS(f) ((f)->menu_bar_items)
757
#define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate)
758

759 760 761 762 763
#define FRAME_DESIRED_CURSOR(f) ((f)->desired_cursor)
#define FRAME_BLINK_OFF_CURSOR(f) ((f)->blink_off_cursor)
#define FRAME_CURSOR_WIDTH(f) ((f)->cursor_width)
#define FRAME_BLINK_OFF_CURSOR_WIDTH(f) ((f)->blink_off_cursor_width)

Gerd Moellmann's avatar
Gerd Moellmann committed
764 765 766 767
/* Return a pointer to the face cache of frame F.  */

#define FRAME_FACE_CACHE(F)	(F)->face_cache

768 769 770
/* Return the size of message_buf of the frame F.  We multiply the
   width of the frame by 4 because multi-byte form may require at most
   4-byte for a character.  */
771

772
#define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4)
Jim Blandy's avatar
Jim Blandy committed
773

774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789
/* Emacs's redisplay code could become confused if a frame's
   visibility changes at arbitrary times.  For example, if a frame is
   visible while the desired glyphs are being built, but becomes
   invisible before they are updated, then some rows of the
   desired_glyphs will be left marked as enabled after redisplay is
   complete, which should never happen.  The next time the frame
   becomes visible, redisplay will probably barf.

   Currently, there are no similar situations involving iconified, but
   the principle is the same.

   So instead of having asynchronous input handlers directly set and
   clear the frame's visibility and iconification flags, they just set
   the async_visible and async_iconified flags; the redisplay code
   calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay,
   which sets visible and iconified from their asynchronous
790 791
   counterparts.

792 793 794 795
   Synchronous code must use the FRAME_SET_VISIBLE macro.

   Also, if a frame used to be invisible, but has just become visible,
   it must be marked as garbaged, since redisplay hasn't been keeping
796 797 798 799
   up its contents.

   Note that a tty frame is visible if and only if it is the topmost
   frame. */
800

801
#define FRAME_SAMPLE_VISIBILITY(f) \
Geoff Voelker's avatar
Geoff Voelker committed
802 803
  (((f)->async_visible && (f)->visible != (f)->async_visible) ? \
   SET_FRAME_GARBAGED (f) : 0, \
804
   (f)->visible = (f)->async_visible, \
805 806
   (f)->iconified = (f)->async_iconified)

807 808 809 810 811
#define CHECK_FRAME(x) \
  CHECK_TYPE (FRAMEP (x), Qframep, x)

#define CHECK_LIVE_FRAME(x) \
  CHECK_TYPE (FRAMEP (x) && FRAME_LIVE_P (XFRAME (x)), Qframe_live_p, x)
Jim Blandy's avatar
Jim Blandy committed
812

Jim Blandy's avatar
Jim Blandy committed
813 814
/* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a
   `for' loop which iterates over the elements of Vframe_list.  The
815
   loop will set FRAME_VAR, a Lisp_Object, to each frame in
Jim Blandy's avatar
Jim Blandy committed
816
   Vframe_list in succession and execute the statement.  LIST_VAR
817
   should be a Lisp_Object too; it is used to iterate through the
818
   Vframe_list.
Jim Blandy's avatar
Jim Blandy committed
819

Karl Heuer's avatar
Karl Heuer committed
820 821 822
   This macro is a holdover from a time when multiple frames weren't always
   supported.  An alternate definition of the macro would expand to
   something which executes the statement once.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
823

Jim Blandy's avatar
Jim Blandy committed
824 825
#define FOR_EACH_FRAME(list_var, frame_var)			\
  for ((list_var) = Vframe_list;				\
Jim Blandy's avatar
Jim Blandy committed
826
       (CONSP (list_var)					\
827 828
	&& (frame_var = XCAR (list_var), 1));		\
       list_var = XCDR (list_var))
Jim Blandy's avatar
Jim Blandy committed
829 830


831
extern Lisp_Object Qframep, Qframe_live_p;
832
extern Lisp_Object Qtty, Qtty_type;
833
extern Lisp_Object Qtty_color_mode;
834
extern Lisp_Object Qterminal, Qterminal_live_p;
835
extern Lisp_Object Qnoelisp;
Jim Blandy's avatar
Jim Blandy committed
836

Jim Blandy's avatar
Jim Blandy committed
837
extern struct frame *last_nonminibuf_frame;
Jim Blandy's avatar
Jim Blandy committed
838

839
extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
Jan D's avatar
Jan D committed
840 841 842
extern struct frame *make_initial_frame (void);
extern struct frame *make_terminal_frame (struct terminal *);
extern struct frame *make_frame (int);
843
#ifdef HAVE_WINDOW_SYSTEM
Jan D's avatar
Jan D committed
844 845 846 847
extern struct frame *make_minibuffer_frame (void);
extern struct frame *make_frame_without_minibuffer (Lisp_Object,
                                                    struct kboard *,
                                                    Lisp_Object);
848
#endif /* HAVE_WINDOW_SYSTEM */
Jan D's avatar
Jan D committed
849 850 851 852
extern int other_visible_frames (struct frame *);
extern void frame_make_pointer_invisible (void);
extern void frame_make_pointer_visible (void);
extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object);
Jim Blandy's avatar
Jim Blandy committed
853

Jim Blandy's avatar
Jim Blandy committed
854
extern Lisp_Object Vframe_list;
Jim Blandy's avatar
Jim Blandy committed
855

Gerd Moellmann's avatar
Gerd Moellmann committed
856 857 858 859 860
/* The currently selected frame.  */

extern Lisp_Object selected_frame;

/* Value is a pointer to the selected frame.  If the selected frame
861
   isn't live, abort.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
862 863 864 865 866

#define SELECTED_FRAME()				\
     ((FRAMEP (selected_frame)				\
       && FRAME_LIVE_P (XFRAME (selected_frame)))	\
      ? XFRAME (selected_frame)				\
867
      : (abort (), (struct frame *) 0))
Gerd Moellmann's avatar
Gerd Moellmann committed
868 869 870 871 872 873


/***********************************************************************
			Display-related Macros
 ***********************************************************************/

874
/* Canonical y-unit on frame F.
875 876 877 878
   This value currently equals the line height of the frame (which is
   the height of the default font of F).  */

#define FRAME_LINE_HEIGHT(F) ((F)->line_height)
Gerd Moellmann's avatar
Gerd Moellmann committed
879

880
/* Canonical x-unit on frame F.
881
   This value currently equals the average width of the default font of F.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
882

883
#define FRAME_COLUMN_WIDTH(F) ((F)->column_width)
Gerd Moellmann's avatar
Gerd Moellmann committed
884

885 886 887 888
/* Space glyph width of the default font of frame F.  */

#define FRAME_SPACE_WIDTH(F) ((F)->space_width)

Gerd Moellmann's avatar
Gerd Moellmann committed
889 890

/* Pixel width of areas used to display truncation marks, continuation
891
   marks, overlay arrows.  This is 0 for terminal frames.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
892 893

#ifdef HAVE_WINDOW_SYSTEM
894

895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916
/* Total width of fringes reserved for drawing truncation bitmaps,
   continuation bitmaps and alike.  The width is in canonical char
   units of the frame.  This must currently be the case because window
   sizes aren't pixel values.  If it weren't the case, we wouldn't be
   able to split windows horizontally nicely.  */

#define FRAME_FRINGE_COLS(F) ((F)->fringe_cols)

/* Pixel-width of the left and right fringe.  */

#define FRAME_LEFT_FRINGE_WIDTH(F) ((F)->left_fringe_width)
#define FRAME_RIGHT_FRINGE_WIDTH(F) ((F)->right_fringe_width)

/* Total width of fringes in pixels.  */

#define FRAME_TOTAL_FRINGE_WIDTH(F) \
  (FRAME_LEFT_FRINGE_WIDTH (F) + FRAME_RIGHT_FRINGE_WIDTH (F))


/* Pixel-width of internal border lines */

#define FRAME_INTERNAL_BORDER_WIDTH(F) ((F)->internal_border_width)
917

918 919
#else /* not HAVE_WINDOW_SYSTEM */

Kim F. Storm's avatar
Kim F. Storm committed
920
#define FRAME_FRINGE_COLS(F)	0
921
#define FRAME_TOTAL_FRINGE_WIDTH(F)	0
Kim F. Storm's avatar
Kim F. Storm committed
922
#define FRAME_LEFT_FRINGE_WIDTH(F)  0
923
#define FRAME_RIGHT_FRINGE_WIDTH(F) 0
924
#define FRAME_INTERNAL_BORDER_WIDTH(F) 0
925 926

#endif /* not HAVE_WINDOW_SYSTEM */
927

Gerd Moellmann's avatar
Gerd Moellmann committed
928 929 930 931 932 933 934



/***********************************************************************
	    Conversion between canonical units and pixels
 ***********************************************************************/

935 936 937
/* Canonical x-values are fractions of FRAME_COLUMN_WIDTH, canonical
   y-unit are fractions of FRAME_LINE_HEIGHT of a frame.  Both are
   represented as Lisp numbers, i.e. integers or floats.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
938 939 940 941

/* Convert canonical value X to pixels.  F is the frame whose
   canonical char width is to be used.  X must be a Lisp integer or
   float.  Value is a C integer.  */
942

943
#define FRAME_PIXEL_X_FROM_CANON_X(F, X)		\
Gerd Moellmann's avatar
Gerd Moellmann committed
944
     (INTEGERP (X)					\
945 946
      ? XINT (X) * FRAME_COLUMN_WIDTH (F)		\
      : (int) (XFLOAT_DATA (X) * FRAME_COLUMN_WIDTH (F)))
947

Gerd Moellmann's avatar
Gerd Moellmann committed
948 949 950
/* Convert canonical value Y to pixels.  F is the frame whose
   canonical character height is to be used.  X must be a Lisp integer
   or float.  Value is a C integer.  */
951