frame.h 39.9 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
{
85
  struct vectorlike_header header;
Jim Blandy's avatar
Jim Blandy committed
86

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

90 91
  /* 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
92 93
  Lisp_Object name;

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

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

102
  /* The frame which should receive keystrokes that occur in this
103 104 105 106 107 108 109 110 111 112
     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
113
  Lisp_Object focus_frame;
Jim Blandy's avatar
Jim Blandy committed
114

Jim Blandy's avatar
Jim Blandy committed
115 116 117
  /* 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
118 119
  Lisp_Object root_window;

Jim Blandy's avatar
Jim Blandy committed
120 121 122 123
  /* 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
124 125
  Lisp_Object selected_window;

Jim Blandy's avatar
Jim Blandy committed
126 127 128
  /* 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
129 130 131
     can actually appear to exist.  */
  Lisp_Object minibuffer_window;

Jim Blandy's avatar
Jim Blandy committed
132 133 134
  /* 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
135 136
  Lisp_Object param_alist;

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

Richard M. Stallman's avatar
Richard M. Stallman committed
147 148 149 150 151
  /* 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.  */
152 153
  Lisp_Object menu_bar_items;

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

157 158 159 160 161 162 163 164
  /* 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;

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

168 169 170
  /* 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
171

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

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

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

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

186 187
  /* 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
188

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

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

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

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

Gerd Moellmann's avatar
Gerd Moellmann committed
201 202 203 204 205 206 207 208 209
  /* 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;
210

211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
  /* 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;

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

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

243
  int n_tool_bar_rows;
244
  int n_tool_bar_items;
245

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

  /* 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;

259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
  /* 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;

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

280 281 282 283 284 285 286 287 288
  /* 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;
289

290 291 292 293 294 295 296 297 298 299 300
  /* 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
301
  /* Width of space glyph of default font, in pixels.  */
302 303
  int space_width;

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

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

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

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

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

335 336 337 338 339 340 341 342 343 344 345
  /* 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 */
346
  enum fullscreen_type want_fullscreen;
347

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

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

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

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

364 365 366 367
     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.

368 369 370 371 372 373 374
     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
375

376 377 378 379 380 381 382 383 384 385
     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
386
     These two are mutually exclusive.  They might both be zero, if the
387
     frame has been made invisible without an icon.  */
388
  unsigned char visible : 2;
389 390 391
  unsigned char iconified : 1;

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

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

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

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

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

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

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

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

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

Jim Blandy's avatar
Jim Blandy committed
422 423 424 425
  /* 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.  */
426
  unsigned char explicit_name : 1;
Jim Blandy's avatar
Jim Blandy committed
427

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

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

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

438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
  /* 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
456
  /* Storage for messages to this frame. */
Jim Blandy's avatar
Jim Blandy committed
457 458 459 460 461
  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;
462

463 464 465 466 467 468 469 470 471 472 473
  /* 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;
474 475 476

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

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

484 485 486 487
  /* 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;
488 489 490

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

492 493 494
  /* 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
495 496
};

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

499 500 501
/* 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
502 503
typedef struct frame *FRAME_PTR;

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

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

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

/* 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
521

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

535 536
/* Return a pointer to the structure holding information about the
   region of text, if any, that is currently shown in mouse-face on
537 538 539 540 541 542 543 544 545 546 547
   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
548

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

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

/* 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
558
#define FRAME_HAS_MINIBUF_P(f) ((f)->has_minibuffer)
Richard M. Stallman's avatar
Richard M. Stallman committed
559

560 561 562 563 564 565 566 567 568 569 570 571
/* 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
572
   not including scroll bars if any.  */
573
#define FRAME_COLS(f) (f)->text_cols
Richard M. Stallman's avatar
Richard M. Stallman committed
574 575 576 577

/* 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.
578
   These lines are counted in FRAME_LINES.  */
579
#define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines
Richard M. Stallman's avatar
Richard M. Stallman committed
580

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

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

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

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

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

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

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

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

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

620 621
#define FRAME_SET_VISIBLE(f,p) \
  ((f)->async_visible = (p), FRAME_SAMPLE_VISIBILITY (f))
Jim Blandy's avatar
Jim Blandy committed
622 623
#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
624 625

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

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

/* 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.  */
634
#define FRAME_WINDOW_SIZES_CHANGED(f) (f)->window_sizes_changed
Richard M. Stallman's avatar
Richard M. Stallman committed
635 636

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

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

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

645 646
#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
647 648 649 650 651
#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
652 653 654 655

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

/* This frame slot says whether scroll bars are currently enabled for frame F,
   and which side they are on.  */
660 661 662 663 664 665 666
#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
667 668 669 670

/* 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.  */
671
#define FRAME_CONFIG_SCROLL_BAR_WIDTH(f) ((f)->config_scroll_bar_width)
Richard M. Stallman's avatar
Richard M. Stallman committed
672 673 674 675

/* 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.  */
676
#define FRAME_CONFIG_SCROLL_BAR_COLS(f) ((f)->config_scroll_bar_cols)
Richard M. Stallman's avatar
Richard M. Stallman committed
677 678

/* Width of a scroll bar in frame F, measured in columns (characters),
679 680 681
   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.  */

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

687 688 689 690 691 692 693
/* 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)

694 695 696 697
/* 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.  */

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

703 704 705 706 707 708 709 710 711 712 713 714
/* 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)		\
715
      : 0)
Richard M. Stallman's avatar
Richard M. Stallman committed
716

717 718 719 720 721 722 723
/* 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
724 725
/* Total width of frame F, in columns (characters),
   including the width used by scroll bars if any.  */
726 727

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

/* Set the width of frame F to VAL.
   VAL is the width of a full-frame window,
731 732 733 734 735
   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
736 737

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

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

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

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

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

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

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

758 759 760 761 762
#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
763 764 765 766
/* Return a pointer to the face cache of frame F.  */

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

767 768 769
/* 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.  */
770

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

773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788
/* 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
789 790
   counterparts.

791 792 793 794
   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
795 796 797 798
   up its contents.

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

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

806 807 808 809 810
#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
811

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

Karl Heuer's avatar
Karl Heuer committed
819 820 821
   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
822

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


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

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

838
extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
Jan D's avatar
Jan D committed
839 840
extern struct frame *make_initial_frame (void);
extern struct frame *make_frame (int);
841
#ifdef HAVE_WINDOW_SYSTEM
Jan D's avatar
Jan D committed
842 843 844 845
extern struct frame *make_minibuffer_frame (void);
extern struct frame *make_frame_without_minibuffer (Lisp_Object,
                                                    struct kboard *,
                                                    Lisp_Object);
846
#endif /* HAVE_WINDOW_SYSTEM */
Jan D's avatar
Jan D committed
847 848 849
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
850

Jim Blandy's avatar
Jim Blandy committed
851
extern Lisp_Object Vframe_list;
Jim Blandy's avatar
Jim Blandy committed
852

Gerd Moellmann's avatar
Gerd Moellmann committed
853 854 855 856 857
/* The currently selected frame.  */

extern Lisp_Object selected_frame;

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

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

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

871
/* Canonical y-unit on frame F.
872 873 874 875
   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
876

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

880
#define FRAME_COLUMN_WIDTH(F) ((F)->column_width)
Gerd Moellmann's avatar
Gerd Moellmann committed
881

882 883 884 885
/* 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
886 887

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

#ifdef HAVE_WINDOW_SYSTEM
891

892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913
/* 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)
914

915 916
#else /* not HAVE_WINDOW_SYSTEM */

Kim F. Storm's avatar
Kim F. Storm committed
917
#define FRAME_FRINGE_COLS(F)	0
918
#define FRAME_TOTAL_FRINGE_WIDTH(F)	0
Kim F. Storm's avatar
Kim F. Storm committed
919
#define FRAME_LEFT_FRINGE_WIDTH(F)  0
920
#define FRAME_RIGHT_FRINGE_WIDTH(F) 0
921
#define FRAME_INTERNAL_BORDER_WIDTH(F) 0
922 923

#endif /* not HAVE_WINDOW_SYSTEM */
924

Gerd Moellmann's avatar
Gerd Moellmann committed
925 926 927 928 929 930 931


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

932 933 934
/* 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
935 936 937 938

/* 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.  */
939

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

Gerd Moellmann's avatar
Gerd Moellmann committed
945 946 947
/* 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.  */
948