diff options
| author | Kim F. Storm | 2003-05-24 21:58:07 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2003-05-24 21:58:07 +0000 |
| commit | b45afe99ed29a2bcb8b525878f81630233c1097d (patch) | |
| tree | 325e608d4798189797264d57fe1812de16887953 /src | |
| parent | 5af5757be47b6b88c907f2abd132861e9af4cc9f (diff) | |
| download | emacs-b45afe99ed29a2bcb8b525878f81630233c1097d.tar.gz emacs-b45afe99ed29a2bcb8b525878f81630233c1097d.zip | |
(struct frame): Rename members height to text_lines,
width to text_cols, window_height to total_lines, window_width to
total_cols, new_height to new_text_lines, new_width to
new_text_cols. All uses changed.
(struct frame): New members which consolidate common members of
x_output, w32_output, and mac_output structures: left_pos,
top_pos, pixel_height, pixel_width, x_pixels_diff, y_pixels_diff,
win_gravity, size_hint_flags, border_width, internal_border_width,
line_height, fringe_cols, left_fringe_width, right_fringe_width,
want_fullscreen. All uses changed.
(struct frame): New member column_width contaning the canonical
column width, analogue to line_height. All uses changed.
(struct frame): Rename members scroll_bar_pixel_width to
config_scroll_bar_width, and scroll_bar_cols to
config_scroll_bar_cols. All uses changed.
(struct frame): New member scroll_bar_actual_width which
consolidates and renames the vertical_scroll_bar_extra member of
x_output, w32_output, and mac_output structures. All uses changed.
(FRAME_PIXEL_HEIGHT): Renamed from PIXEL_HEIGHT and moved
from x/w32/macterm.h files. All uses changed. Also change code
which referred to f->output_data...->pixel_height.
(FRAME_PIXEL_WIDTH): Renamed from PIXEL_WIDTH and moved
from x/w32/macterm.h files. All uses changed. Also change code
which referred to f->output_data...->pixel_width.
(FRAME_LINES): Renamed from FRAME_HEIGHT. All uses changed.
Also change code which referred to f->height.
(FRAME_COLS): Renamed from FRAME_WIDTH. All uses changed.
Also change code which referred to f->width.
(FRAME_NEW_HEIGHT, FRAME_NEW_WIDTH): Remove macros; change uses
to update new_text_lines and new_text_cols members directly.
(FRAME_CONFIG_SCROLL_BAR_WIDTH): Renamed from
FRAME_SCROLL_BAR_PIXEL_WIDTH. All uses changed.
(FRAME_CONFIG_SCROLL_BAR_COLS): Renamed from
FRAME_SCROLL_BAR_COLS. All uses changed.
(FRAME_LEFT_SCROLL_BAR_COLS, FRAME_RIGHT_SCROLL_BAR_COLS):
Renamed from FRAME_LEFT_SCROLL_BAR_WIDTH and
FRAME_RIGHT_SCROLL_BAR_WIDTH, resp. All uses changed.
(FRAME_SCROLL_BAR_AREA_WIDTH, FRAME_LEFT_SCROLL_BAR_AREA_WIDTH)
(FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH): New macros.
(FRAME_TOTAL_COLS): Renamed from FRAME_WINDOW_WIDTH.
(SET_FRAME_COLS): Renamed from SET_FRAME_WIDTH.
(FRAME_TOTAL_COLS_ARG): Renamed from FRAME_WINDOW_WIDTH_ARG.
(WINDOW_VERTICAL_SCROLL_BAR_COLUMN): Remove unused macro.
(WINDOW_VERTICAL_SCROLL_BAR_HEIGHT): Remove unused macro.
(FRAME_LINE_HEIGHT): Renamed from CANON_Y_UNIT. Unconditionally
return line_height member (it now has proper value also for
non-window frames).
(FRAME_COLUMN_WIDTH): Renamed from CANON_X_UNIT. Unconditionally
return new column_width member (rather than the default font width).
(FRAME_FRINGE_COLS, FRAME_LEFT_FRINGE_WIDTH)
(FRAME_RIGHT_FRINGE_WIDTH): Renamed from FRAME_X_... and moved
from x/w32/macterm.h files. Unconditionally return corresponding
member of frame structure (they now have proper values also for
non-window frames).
(FRAME_TOTAL_FRINGE_WIDTH): Renamed from FRAME_FRINGE_WIDTH.
Calculate return value from left and right widths.
(FRAME_INTERNAL_BORDER_WIDTH): Unconditionally return
internal_border_width member (has proper value for non-window frame).
(FRAME_PIXEL_X_FROM_CANON_X): Renamed from PIXEL_X_FROM_CANON_X.
(FRAME_PIXEL_Y_FROM_CANON_Y): Renamed from PIXEL_Y_FROM_CANON_Y.
(FRAME_CANON_X_FROM_PIXEL_X): Renamed from CANON_X_FROM_PIXEL_X.
(FRAME_CANON_Y_FROM_PIXEL_Y): Renamed from CANON_Y_FROM_PIXEL_Y.
(FRAME_LINE_TO_PIXEL_Y): Renamed from CHAR_TO_PIXEL_ROW,
consolidated from xterm.h, macterm.h, and w32term.h.
(FRAME_COL_TO_PIXEL_X): Renamed from CHAR_TO_PIXEL_COL,
consolidated from xterm.h, macterm.h, and w32term.h.
(FRAME_TEXT_COLS_TO_PIXEL_WIDTH): Renamed from
CHAR_TO_PIXEL_WIDTH consolidated from x/mac/w32term.h.
(FRAME_TEXT_LINES_TO_PIXEL_HEIGHT): Renamed from
CHAR_TO_PIXEL_HEIGHT consolidated from x/mac/w32term.h.
(FRAME_PIXEL_Y_TO_LINE): Renamed from PIXEL_TO_CHAR_ROW
consolidated from x/mac/w32term.h.
(FRAME_PIXEL_X_TO_COL): Renamed from PIXEL_TO_CHAR_COL
consolidated from x/mac/w32term.h.
(FRAME_PIXEL_WIDTH_TO_TEXT_COLS): Renamed from
PIXEL_TO_CHAR_WIDTH consolidated from x/mac/w32term.h.
(FRAME_PIXEL_HEIGHT_TO_TEXT_LINES): Renamed from
PIXEL_TO_CHAR_HEIGHT consolidated from x/mac/w32term.h.
Diffstat (limited to 'src')
| -rw-r--r-- | src/frame.h | 329 |
1 files changed, 229 insertions, 100 deletions
diff --git a/src/frame.h b/src/frame.h index 864024c88bd..6ecfcf970b5 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -81,8 +81,6 @@ struct x_output | |||
| 81 | PIX_TYPE foreground_pixel; | 81 | PIX_TYPE foreground_pixel; |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | #define FRAME_INTERNAL_BORDER_WIDTH(f) 0 | ||
| 85 | |||
| 86 | #endif /* ! HAVE_X_WINDOWS */ | 84 | #endif /* ! HAVE_X_WINDOWS */ |
| 87 | 85 | ||
| 88 | 86 | ||
| @@ -238,14 +236,47 @@ struct frame | |||
| 238 | /* Cost of deleting n lines on this frame */ | 236 | /* Cost of deleting n lines on this frame */ |
| 239 | int *delete_n_lines_cost; | 237 | int *delete_n_lines_cost; |
| 240 | 238 | ||
| 241 | /* Size of this frame, in units of characters. */ | 239 | /* Size of this frame, excluding fringes, scroll bars etc., |
| 242 | EMACS_INT height; | 240 | in units of canonical characters. */ |
| 243 | EMACS_INT width; | 241 | EMACS_INT text_lines, text_cols; |
| 244 | EMACS_INT window_width; | 242 | |
| 245 | EMACS_INT window_height; | 243 | /* Total size of this frame (i.e. its native window), in units of |
| 244 | canonical characters. */ | ||
| 245 | EMACS_INT total_lines, total_cols; | ||
| 246 | |||
| 247 | /* New text height and width for pending size change. | ||
| 248 | 0 if no change pending. */ | ||
| 249 | int new_text_lines, new_text_cols; | ||
| 250 | |||
| 251 | /* Pixel position of the frame window (x and y offsets in root window). */ | ||
| 252 | int left_pos, top_pos; | ||
| 253 | |||
| 254 | /* Size of the frame window in pixels. */ | ||
| 255 | int pixel_height, pixel_width; | ||
| 256 | |||
| 257 | /* These many pixels are the difference between the outer window (i.e. the | ||
| 258 | left and top of the window manager decoration) and FRAME_X_WINDOW. */ | ||
| 259 | int x_pixels_diff, y_pixels_diff; | ||
| 260 | |||
| 261 | /* This is the gravity value for the specified window position. */ | ||
| 262 | int win_gravity; | ||
| 263 | |||
| 264 | /* The geometry flags for this window. */ | ||
| 265 | int size_hint_flags; | ||
| 246 | 266 | ||
| 247 | /* New height and width for pending size change. 0 if no change pending. */ | 267 | /* Border width of the frame window as known by the (X) window system. */ |
| 248 | int new_height, new_width; | 268 | int border_width; |
| 269 | |||
| 270 | /* Width of the internal border. This is a line of background color | ||
| 271 | just inside the window's border. When the frame is selected, | ||
| 272 | a highlighting is displayed inside the internal border. */ | ||
| 273 | int internal_border_width; | ||
| 274 | |||
| 275 | /* Canonical X unit. Width of default font, in pixels. */ | ||
| 276 | int column_width; | ||
| 277 | |||
| 278 | /* Canonical Y unit. Height of a line, in pixels. */ | ||
| 279 | int line_height; | ||
| 249 | 280 | ||
| 250 | /* The output method says how the contents of this frame | 281 | /* The output method says how the contents of this frame |
| 251 | are displayed. It could be using termcap, or using an X window. */ | 282 | are displayed. It could be using termcap, or using an X window. */ |
| @@ -265,6 +296,16 @@ struct frame | |||
| 265 | } | 296 | } |
| 266 | output_data; | 297 | output_data; |
| 267 | 298 | ||
| 299 | /* Total width of fringes reserved for drawing truncation bitmaps, | ||
| 300 | continuation bitmaps and alike. The width is in canonical char | ||
| 301 | units of the frame. This must currently be the case because window | ||
| 302 | sizes aren't pixel values. If it weren't the case, we wouldn't be | ||
| 303 | able to split windows horizontally nicely. */ | ||
| 304 | int fringe_cols; | ||
| 305 | |||
| 306 | /* The extra width (in pixels) currently allotted for fringes. */ | ||
| 307 | int left_fringe_width, right_fringe_width; | ||
| 308 | |||
| 268 | #ifdef MULTI_KBOARD | 309 | #ifdef MULTI_KBOARD |
| 269 | /* A pointer to the kboard structure associated with this frame. | 310 | /* A pointer to the kboard structure associated with this frame. |
| 270 | For termcap frames, this points to initial_kboard. For X frames, | 311 | For termcap frames, this points to initial_kboard. For X frames, |
| @@ -272,6 +313,9 @@ struct frame | |||
| 272 | struct kboard *kboard; | 313 | struct kboard *kboard; |
| 273 | #endif | 314 | #endif |
| 274 | 315 | ||
| 316 | /* See FULLSCREEN_ enum below */ | ||
| 317 | int want_fullscreen; | ||
| 318 | |||
| 275 | /* Number of lines of menu bar. */ | 319 | /* Number of lines of menu bar. */ |
| 276 | int menu_bar_lines; | 320 | int menu_bar_lines; |
| 277 | 321 | ||
| @@ -377,12 +421,17 @@ struct frame | |||
| 377 | for lines beyond a certain vpos. This is the vpos. */ | 421 | for lines beyond a certain vpos. This is the vpos. */ |
| 378 | int scroll_bottom_vpos; | 422 | int scroll_bottom_vpos; |
| 379 | 423 | ||
| 380 | /* Width of the scroll bar, in pixels and in characters. | 424 | /* Configured width of the scroll bar, in pixels and in characters. |
| 381 | scroll_bar_cols tracks scroll_bar_pixel_width if the latter is positive; | 425 | config_scroll_bar_cols tracks config_scroll_bar_width if the |
| 382 | a zero value in scroll_bar_pixel_width means to compute the actual width | 426 | latter is positive; a zero value in config_scroll_bar_width means |
| 383 | on the fly, using scroll_bar_cols and the current font width. */ | 427 | to compute the actual width on the fly, using config_scroll_bar_cols |
| 384 | int scroll_bar_pixel_width; | 428 | and the current font width. */ |
| 385 | int scroll_bar_cols; | 429 | int config_scroll_bar_width; |
| 430 | int config_scroll_bar_cols; | ||
| 431 | |||
| 432 | /* The size of the extra width currently allotted for vertical | ||
| 433 | scroll bars in this frame, in pixels. */ | ||
| 434 | int scroll_bar_actual_width; | ||
| 386 | 435 | ||
| 387 | /* The baud rate that was used to calculate costs for this frame. */ | 436 | /* The baud rate that was used to calculate costs for this frame. */ |
| 388 | int cost_calculation_baud_rate; | 437 | int cost_calculation_baud_rate; |
| @@ -451,16 +500,26 @@ typedef struct frame *FRAME_PTR; | |||
| 451 | /* Nonzero if frame F contains a minibuffer window. | 500 | /* Nonzero if frame F contains a minibuffer window. |
| 452 | (If this is 0, F must use some other minibuffer window.) */ | 501 | (If this is 0, F must use some other minibuffer window.) */ |
| 453 | #define FRAME_HAS_MINIBUF_P(f) ((f)->has_minibuffer) | 502 | #define FRAME_HAS_MINIBUF_P(f) ((f)->has_minibuffer) |
| 454 | #define FRAME_HEIGHT(f) (f)->height | ||
| 455 | 503 | ||
| 456 | /* Width of frame F, measured in character columns, | 504 | /* Pixel height of frame F, including non-toolkit menu bar and |
| 505 | non-toolkit tool bar lines. */ | ||
| 506 | #define FRAME_PIXEL_HEIGHT(f) ((f)->pixel_height) | ||
| 507 | |||
| 508 | /* Pixel width of frame F. */ | ||
| 509 | #define FRAME_PIXEL_WIDTH(f) ((f)->pixel_width) | ||
| 510 | |||
| 511 | /* Height of frame F, measured in canonical lines, including | ||
| 512 | non-toolkit menu bar and non-toolkit tool bar lines. */ | ||
| 513 | #define FRAME_LINES(f) (f)->text_lines | ||
| 514 | |||
| 515 | /* Width of frame F, measured in canonical character columns, | ||
| 457 | not including scroll bars if any. */ | 516 | not including scroll bars if any. */ |
| 458 | #define FRAME_WIDTH(f) (f)->width | 517 | #define FRAME_COLS(f) (f)->text_cols |
| 459 | 518 | ||
| 460 | /* Number of lines of frame F used for menu bar. | 519 | /* Number of lines of frame F used for menu bar. |
| 461 | This is relevant on terminal frames and on | 520 | This is relevant on terminal frames and on |
| 462 | X Windows when not using the X toolkit. | 521 | X Windows when not using the X toolkit. |
| 463 | These lines are counted in FRAME_HEIGHT. */ | 522 | These lines are counted in FRAME_LINES. */ |
| 464 | #define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines | 523 | #define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines |
| 465 | 524 | ||
| 466 | /* Nonzero if this frame should display a tool bar | 525 | /* Nonzero if this frame should display a tool bar |
| @@ -512,9 +571,6 @@ typedef struct frame *FRAME_PTR; | |||
| 512 | but not yet really put into effect. This can be true temporarily | 571 | but not yet really put into effect. This can be true temporarily |
| 513 | when an X event comes in at a bad time. */ | 572 | when an X event comes in at a bad time. */ |
| 514 | #define FRAME_WINDOW_SIZES_CHANGED(f) (f)->window_sizes_changed | 573 | #define FRAME_WINDOW_SIZES_CHANGED(f) (f)->window_sizes_changed |
| 515 | /* When a size change is pending, these are the requested new sizes. */ | ||
| 516 | #define FRAME_NEW_HEIGHT(f) (f)->new_height | ||
| 517 | #define FRAME_NEW_WIDTH(f) (f)->new_width | ||
| 518 | 574 | ||
| 519 | /* The minibuffer window of frame F, if it has one; otherwise nil. */ | 575 | /* The minibuffer window of frame F, if it has one; otherwise nil. */ |
| 520 | #define FRAME_MINIBUF_WINDOW(f) (f)->minibuffer_window | 576 | #define FRAME_MINIBUF_WINDOW(f) (f)->minibuffer_window |
| @@ -551,60 +607,87 @@ typedef struct frame *FRAME_PTR; | |||
| 551 | /* Width that a scroll bar in frame F should have, if there is one. | 607 | /* Width that a scroll bar in frame F should have, if there is one. |
| 552 | Measured in pixels. | 608 | Measured in pixels. |
| 553 | If scroll bars are turned off, this is still nonzero. */ | 609 | If scroll bars are turned off, this is still nonzero. */ |
| 554 | #define FRAME_SCROLL_BAR_PIXEL_WIDTH(f) ((f)->scroll_bar_pixel_width) | 610 | #define FRAME_CONFIG_SCROLL_BAR_WIDTH(f) ((f)->config_scroll_bar_width) |
| 555 | 611 | ||
| 556 | /* Width that a scroll bar in frame F should have, if there is one. | 612 | /* Width that a scroll bar in frame F should have, if there is one. |
| 557 | Measured in columns (characters). | 613 | Measured in columns (characters). |
| 558 | If scroll bars are turned off, this is still nonzero. */ | 614 | If scroll bars are turned off, this is still nonzero. */ |
| 559 | #define FRAME_SCROLL_BAR_COLS(f) ((f)->scroll_bar_cols) | 615 | #define FRAME_CONFIG_SCROLL_BAR_COLS(f) ((f)->config_scroll_bar_cols) |
| 560 | 616 | ||
| 561 | /* Width of a scroll bar in frame F, measured in columns (characters), | 617 | /* Width of a scroll bar in frame F, measured in columns (characters), |
| 562 | but only if scroll bars are on the left. If scroll bars are on | 618 | but only if scroll bars are on the left. If scroll bars are on |
| 563 | the right in this frame, or there are no scroll bars, value is 0. */ | 619 | the right in this frame, or there are no scroll bars, value is 0. */ |
| 564 | 620 | ||
| 565 | #define FRAME_LEFT_SCROLL_BAR_WIDTH(f) \ | 621 | #define FRAME_LEFT_SCROLL_BAR_COLS(f) \ |
| 566 | (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \ | 622 | (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \ |
| 567 | ? FRAME_SCROLL_BAR_COLS (f) \ | 623 | ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \ |
| 568 | : 0) | 624 | : 0) |
| 569 | 625 | ||
| 626 | /* Width of a left scroll bar in frame F, measured in pixels */ | ||
| 627 | |||
| 628 | #define FRAME_LEFT_SCROLL_BAR_AREA_WIDTH(f) \ | ||
| 629 | (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \ | ||
| 630 | ? (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)) \ | ||
| 631 | : 0) | ||
| 632 | |||
| 570 | /* Width of a scroll bar in frame F, measured in columns (characters), | 633 | /* Width of a scroll bar in frame F, measured in columns (characters), |
| 571 | but only if scroll bars are on the right. If scroll bars are on | 634 | but only if scroll bars are on the right. If scroll bars are on |
| 572 | the left in this frame, or there are no scroll bars, value is 0. */ | 635 | the left in this frame, or there are no scroll bars, value is 0. */ |
| 573 | 636 | ||
| 574 | #define FRAME_RIGHT_SCROLL_BAR_WIDTH(f) \ | 637 | #define FRAME_RIGHT_SCROLL_BAR_COLS(f) \ |
| 575 | (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \ | 638 | (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \ |
| 576 | ? FRAME_SCROLL_BAR_COLS (f) \ | 639 | ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \ |
| 577 | : 0) | 640 | : 0) |
| 578 | 641 | ||
| 579 | /* Width of a scroll bar in frame F, measured in columns (characters). */ | 642 | /* Width of a right scroll bar area in frame F, measured in pixels */ |
| 580 | #define FRAME_SCROLL_BAR_WIDTH(f) \ | 643 | |
| 581 | (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \ | 644 | #define FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH(f) \ |
| 582 | ? FRAME_SCROLL_BAR_COLS (f) \ | 645 | (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \ |
| 646 | ? (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)) \ | ||
| 647 | : 0) | ||
| 648 | |||
| 649 | /* Actual width of a scroll bar in frame F, measured in columns. */ | ||
| 650 | |||
| 651 | #define FRAME_SCROLL_BAR_COLS(f) \ | ||
| 652 | (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \ | ||
| 653 | ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \ | ||
| 583 | : 0) | 654 | : 0) |
| 584 | 655 | ||
| 656 | /* Actual width of a scroll bar area in frame F, measured in pixels. */ | ||
| 657 | |||
| 658 | #define FRAME_SCROLL_BAR_AREA_WIDTH(f) \ | ||
| 659 | (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \ | ||
| 660 | ? (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)) \ | ||
| 661 | : 0) | ||
| 662 | |||
| 585 | /* Total width of frame F, in columns (characters), | 663 | /* Total width of frame F, in columns (characters), |
| 586 | including the width used by scroll bars if any. */ | 664 | including the width used by scroll bars if any. */ |
| 587 | #define FRAME_WINDOW_WIDTH(f) ((f)->window_width) | 665 | |
| 666 | #define FRAME_TOTAL_COLS(f) ((f)->total_cols) | ||
| 588 | 667 | ||
| 589 | /* Set the width of frame F to VAL. | 668 | /* Set the width of frame F to VAL. |
| 590 | VAL is the width of a full-frame window, | 669 | VAL is the width of a full-frame window, |
| 591 | not including scroll bars. */ | 670 | not including scroll bars and fringes. */ |
| 592 | #define SET_FRAME_WIDTH(f, val) \ | 671 | |
| 593 | ((f)->width = (val), \ | 672 | #define SET_FRAME_COLS(f, val) \ |
| 594 | (f)->window_width = FRAME_WINDOW_WIDTH_ARG (f, (f)->width)) | 673 | (FRAME_COLS (f) = (val), \ |
| 674 | (f)->total_cols = FRAME_TOTAL_COLS_ARG (f, FRAME_COLS (f))) | ||
| 595 | 675 | ||
| 596 | /* Given a value WIDTH for frame F's nominal width, | 676 | /* Given a value WIDTH for frame F's nominal width, |
| 597 | return the value that FRAME_WINDOW_WIDTH should have. */ | 677 | return the value that FRAME_TOTAL_COLS should have. */ |
| 598 | #define FRAME_WINDOW_WIDTH_ARG(f, width) \ | 678 | |
| 679 | #define FRAME_TOTAL_COLS_ARG(f, width) \ | ||
| 599 | ((width) \ | 680 | ((width) \ |
| 600 | + FRAME_SCROLL_BAR_WIDTH (f) \ | 681 | + FRAME_SCROLL_BAR_COLS (f) \ |
| 601 | + FRAME_FRINGE_COLS (f)) | 682 | + FRAME_FRINGE_COLS (f)) |
| 602 | 683 | ||
| 603 | /* Maximum + 1 legitimate value for FRAME_CURSOR_X. */ | 684 | /* Maximum + 1 legitimate value for FRAME_CURSOR_X. */ |
| 685 | |||
| 604 | #define FRAME_CURSOR_X_LIMIT(f) \ | 686 | #define FRAME_CURSOR_X_LIMIT(f) \ |
| 605 | (FRAME_WIDTH (f) + FRAME_LEFT_SCROLL_BAR_WIDTH (f)) | 687 | (FRAME_COLS (f) + FRAME_LEFT_SCROLL_BAR_COLS (f)) |
| 606 | 688 | ||
| 607 | /* Nonzero if frame F has scroll bars. */ | 689 | /* Nonzero if frame F has scroll bars. */ |
| 690 | |||
| 608 | #define FRAME_SCROLL_BARS(f) ((f)->scroll_bars) | 691 | #define FRAME_SCROLL_BARS(f) ((f)->scroll_bars) |
| 609 | 692 | ||
| 610 | #define FRAME_CONDEMNED_SCROLL_BARS(f) ((f)->condemned_scroll_bars) | 693 | #define FRAME_CONDEMNED_SCROLL_BARS(f) ((f)->condemned_scroll_bars) |
| @@ -624,7 +707,7 @@ typedef struct frame *FRAME_PTR; | |||
| 624 | width of the frame by 4 because multi-byte form may require at most | 707 | width of the frame by 4 because multi-byte form may require at most |
| 625 | 4-byte for a character. */ | 708 | 4-byte for a character. */ |
| 626 | 709 | ||
| 627 | #define FRAME_MESSAGE_BUF_SIZE(f) (((int) (f)->width) * 4) | 710 | #define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4) |
| 628 | 711 | ||
| 629 | /* Emacs's redisplay code could become confused if a frame's | 712 | /* Emacs's redisplay code could become confused if a frame's |
| 630 | visibility changes at arbitrary times. For example, if a frame is | 713 | visibility changes at arbitrary times. For example, if a frame is |
| @@ -711,28 +794,6 @@ extern Lisp_Object Vmouse_highlight; | |||
| 711 | enum text_cursor_kinds get_specified_cursor_type P_ ((Lisp_Object, int *)); | 794 | enum text_cursor_kinds get_specified_cursor_type P_ ((Lisp_Object, int *)); |
| 712 | enum text_cursor_kinds get_window_cursor_type P_ ((struct window *, int *, int *)); | 795 | enum text_cursor_kinds get_window_cursor_type P_ ((struct window *, int *, int *)); |
| 713 | 796 | ||
| 714 | /* Device-independent scroll bar stuff. */ | ||
| 715 | |||
| 716 | /* Return the starting column (zero-based) of the vertical scroll bar | ||
| 717 | for window W. The column before this one is the last column we can | ||
| 718 | use for text. If the window touches the right edge of the frame, | ||
| 719 | we have extra space allocated for it. Otherwise, the scroll bar | ||
| 720 | takes over the window's rightmost columns. */ | ||
| 721 | |||
| 722 | #define WINDOW_VERTICAL_SCROLL_BAR_COLUMN(w) \ | ||
| 723 | (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (XFRAME (WINDOW_FRAME (w))) ? \ | ||
| 724 | (((XINT ((w)->left) + XINT ((w)->width)) \ | ||
| 725 | < FRAME_WIDTH (XFRAME (WINDOW_FRAME (w)))) \ | ||
| 726 | ? (XINT ((w)->left) + XINT ((w)->width) \ | ||
| 727 | - FRAME_SCROLL_BAR_COLS (XFRAME (WINDOW_FRAME (w)))) \ | ||
| 728 | : FRAME_WIDTH (XFRAME (WINDOW_FRAME (w)))) \ | ||
| 729 | : XINT ((w)->left)) | ||
| 730 | |||
| 731 | /* Return the height in lines of the vertical scroll bar in w. If the | ||
| 732 | window has a mode line, don't make the scroll bar extend that far. */ | ||
| 733 | |||
| 734 | #define WINDOW_VERTICAL_SCROLL_BAR_HEIGHT(w) (window_internal_height (w)) | ||
| 735 | |||
| 736 | /* The currently selected frame. */ | 797 | /* The currently selected frame. */ |
| 737 | 798 | ||
| 738 | extern Lisp_Object selected_frame; | 799 | extern Lisp_Object selected_frame; |
| @@ -751,40 +812,53 @@ extern Lisp_Object selected_frame; | |||
| 751 | Display-related Macros | 812 | Display-related Macros |
| 752 | ***********************************************************************/ | 813 | ***********************************************************************/ |
| 753 | 814 | ||
| 754 | /* Canonical y-unit on frame F. This value currently equals the line | 815 | /* Canonical y-unit on frame F. |
| 755 | height of the frame. Terminal specific header files are expected | 816 | This value currently equals the line height of the frame (which is |
| 756 | to define the macro FRAME_LINE_HEIGHT. */ | 817 | the height of the default font of F). */ |
| 818 | |||
| 819 | #define FRAME_LINE_HEIGHT(F) ((F)->line_height) | ||
| 757 | 820 | ||
| 758 | #define CANON_Y_UNIT(F) \ | 821 | /* Canonical x-unit on frame F. |
| 759 | (FRAME_WINDOW_P (F) ? FRAME_LINE_HEIGHT (F) : 1) | 822 | This value currently equals the width of the default font of F. */ |
| 760 | 823 | ||
| 761 | /* Canonical x-unit on frame F. This is currently equal to the width | 824 | #define FRAME_COLUMN_WIDTH(F) ((F)->column_width) |
| 762 | of the default font of F. Terminal specific headers are expected | ||
| 763 | to define the macro FRAME_DEFAULT_FONT_WIDTH. */ | ||
| 764 | 825 | ||
| 765 | #define CANON_X_UNIT(F) \ | ||
| 766 | (FRAME_WINDOW_P (F) ? FRAME_DEFAULT_FONT_WIDTH (F) : 1) | ||
| 767 | 826 | ||
| 768 | /* Pixel width of areas used to display truncation marks, continuation | 827 | /* Pixel width of areas used to display truncation marks, continuation |
| 769 | marks, overlay arrows. This is 0 for terminal frames. */ | 828 | marks, overlay arrows. This is 0 for terminal frames. */ |
| 770 | 829 | ||
| 771 | #ifdef HAVE_WINDOW_SYSTEM | 830 | #ifdef HAVE_WINDOW_SYSTEM |
| 772 | 831 | ||
| 773 | #define FRAME_FRINGE_COLS(F) \ | 832 | /* Total width of fringes reserved for drawing truncation bitmaps, |
| 774 | (FRAME_WINDOW_P (F) ? FRAME_X_FRINGE_COLS (F) : 0) | 833 | continuation bitmaps and alike. The width is in canonical char |
| 775 | #define FRAME_FRINGE_WIDTH(F) \ | 834 | units of the frame. This must currently be the case because window |
| 776 | (FRAME_WINDOW_P (F) ? FRAME_X_FRINGE_WIDTH (F) : 0) | 835 | sizes aren't pixel values. If it weren't the case, we wouldn't be |
| 777 | #define FRAME_LEFT_FRINGE_WIDTH(F) \ | 836 | able to split windows horizontally nicely. */ |
| 778 | (FRAME_WINDOW_P (F) ? FRAME_X_LEFT_FRINGE_WIDTH (F) : 0) | 837 | |
| 779 | #define FRAME_RIGHT_FRINGE_WIDTH(F) \ | 838 | #define FRAME_FRINGE_COLS(F) ((F)->fringe_cols) |
| 780 | (FRAME_WINDOW_P (F) ? FRAME_X_RIGHT_FRINGE_WIDTH (F) : 0) | 839 | |
| 840 | /* Pixel-width of the left and right fringe. */ | ||
| 841 | |||
| 842 | #define FRAME_LEFT_FRINGE_WIDTH(F) ((F)->left_fringe_width) | ||
| 843 | #define FRAME_RIGHT_FRINGE_WIDTH(F) ((F)->right_fringe_width) | ||
| 844 | |||
| 845 | /* Total width of fringes in pixels. */ | ||
| 846 | |||
| 847 | #define FRAME_TOTAL_FRINGE_WIDTH(F) \ | ||
| 848 | (FRAME_LEFT_FRINGE_WIDTH (F) + FRAME_RIGHT_FRINGE_WIDTH (F)) | ||
| 849 | |||
| 850 | |||
| 851 | /* Pixel-width of internal border lines */ | ||
| 852 | |||
| 853 | #define FRAME_INTERNAL_BORDER_WIDTH(F) ((F)->internal_border_width) | ||
| 781 | 854 | ||
| 782 | #else /* not HAVE_WINDOW_SYSTEM */ | 855 | #else /* not HAVE_WINDOW_SYSTEM */ |
| 783 | 856 | ||
| 784 | #define FRAME_FRINGE_WIDTH(F) 0 | ||
| 785 | #define FRAME_FRINGE_COLS(F) 0 | 857 | #define FRAME_FRINGE_COLS(F) 0 |
| 858 | #define FRAME_TOTAL_FRINGE_WIDTH(F) 0 | ||
| 786 | #define FRAME_LEFT_FRINGE_WIDTH(F) 0 | 859 | #define FRAME_LEFT_FRINGE_WIDTH(F) 0 |
| 787 | #define FRAME_RIGHT_FRINGE_WIDTH(F) 0 | 860 | #define FRAME_RIGHT_FRINGE_WIDTH(F) 0 |
| 861 | #define FRAME_INTERNAL_BORDER_WIDTH(F) 0 | ||
| 788 | 862 | ||
| 789 | #endif /* not HAVE_WINDOW_SYSTEM */ | 863 | #endif /* not HAVE_WINDOW_SYSTEM */ |
| 790 | 864 | ||
| @@ -795,47 +869,102 @@ extern Lisp_Object selected_frame; | |||
| 795 | Conversion between canonical units and pixels | 869 | Conversion between canonical units and pixels |
| 796 | ***********************************************************************/ | 870 | ***********************************************************************/ |
| 797 | 871 | ||
| 798 | /* Canonical x-values are fractions of CANON_X_UNIT, canonical y-unit | 872 | /* Canonical x-values are fractions of FRAME_COLUMN_WIDTH, canonical |
| 799 | are fractions of CANON_Y_UNIT of a frame. Both are represented as | 873 | y-unit are fractions of FRAME_LINE_HEIGHT of a frame. Both are |
| 800 | Lisp numbers, i.e. integers or floats. */ | 874 | represented as Lisp numbers, i.e. integers or floats. */ |
| 801 | 875 | ||
| 802 | /* Convert canonical value X to pixels. F is the frame whose | 876 | /* Convert canonical value X to pixels. F is the frame whose |
| 803 | canonical char width is to be used. X must be a Lisp integer or | 877 | canonical char width is to be used. X must be a Lisp integer or |
| 804 | float. Value is a C integer. */ | 878 | float. Value is a C integer. */ |
| 805 | 879 | ||
| 806 | #define PIXEL_X_FROM_CANON_X(F, X) \ | 880 | #define FRAME_PIXEL_X_FROM_CANON_X(F, X) \ |
| 807 | (INTEGERP (X) \ | 881 | (INTEGERP (X) \ |
| 808 | ? XINT (X) * CANON_X_UNIT (F) \ | 882 | ? XINT (X) * FRAME_COLUMN_WIDTH (F) \ |
| 809 | : (int) (XFLOAT_DATA (X) * CANON_X_UNIT (F))) | 883 | : (int) (XFLOAT_DATA (X) * FRAME_COLUMN_WIDTH (F))) |
| 810 | 884 | ||
| 811 | /* Convert canonical value Y to pixels. F is the frame whose | 885 | /* Convert canonical value Y to pixels. F is the frame whose |
| 812 | canonical character height is to be used. X must be a Lisp integer | 886 | canonical character height is to be used. X must be a Lisp integer |
| 813 | or float. Value is a C integer. */ | 887 | or float. Value is a C integer. */ |
| 814 | 888 | ||
| 815 | #define PIXEL_Y_FROM_CANON_Y(F, Y) \ | 889 | #define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y) \ |
| 816 | (INTEGERP (Y) \ | 890 | (INTEGERP (Y) \ |
| 817 | ? XINT (Y) * CANON_Y_UNIT (F) \ | 891 | ? XINT (Y) * FRAME_LINE_HEIGHT (F) \ |
| 818 | : (int) (XFLOAT_DATA (Y) * CANON_Y_UNIT (F))) | 892 | : (int) (XFLOAT_DATA (Y) * FRAME_LINE_HEIGHT (F))) |
| 819 | 893 | ||
| 820 | /* Convert pixel-value X to canonical units. F is the frame whose | 894 | /* Convert pixel-value X to canonical units. F is the frame whose |
| 821 | canonical character width is to be used. X is a C integer. Result | 895 | canonical character width is to be used. X is a C integer. Result |
| 822 | is a Lisp float if X is not a multiple of the canon width, | 896 | is a Lisp float if X is not a multiple of the canon width, |
| 823 | otherwise it's a Lisp integer. */ | 897 | otherwise it's a Lisp integer. */ |
| 824 | 898 | ||
| 825 | #define CANON_X_FROM_PIXEL_X(F, X) \ | 899 | #define FRAME_CANON_X_FROM_PIXEL_X(F, X) \ |
| 826 | ((X) % CANON_X_UNIT (F) != 0 \ | 900 | ((X) % FRAME_COLUMN_WIDTH (F) != 0 \ |
| 827 | ? make_float ((double) (X) / CANON_X_UNIT (F)) \ | 901 | ? make_float ((double) (X) / FRAME_COLUMN_WIDTH (F)) \ |
| 828 | : make_number ((X) / CANON_X_UNIT (F))) | 902 | : make_number ((X) / FRAME_COLUMN_WIDTH (F))) |
| 829 | 903 | ||
| 830 | /* Convert pixel-value Y to canonical units. F is the frame whose | 904 | /* Convert pixel-value Y to canonical units. F is the frame whose |
| 831 | canonical character height is to be used. Y is a C integer. | 905 | canonical character height is to be used. Y is a C integer. |
| 832 | Result is a Lisp float if Y is not a multiple of the canon width, | 906 | Result is a Lisp float if Y is not a multiple of the canon width, |
| 833 | otherwise it's a Lisp integer. */ | 907 | otherwise it's a Lisp integer. */ |
| 834 | 908 | ||
| 835 | #define CANON_Y_FROM_PIXEL_Y(F, Y) \ | 909 | #define FRAME_CANON_Y_FROM_PIXEL_Y(F, Y) \ |
| 836 | ((Y) % CANON_Y_UNIT (F) \ | 910 | ((Y) % FRAME_LINE_HEIGHT (F) \ |
| 837 | ? make_float ((double) (Y) / CANON_Y_UNIT (F)) \ | 911 | ? make_float ((double) (Y) / FRAME_LINE_HEIGHT (F)) \ |
| 838 | : make_number ((Y) / CANON_Y_UNIT (F))) | 912 | : make_number ((Y) / FRAME_LINE_HEIGHT (F))) |
| 913 | |||
| 914 | |||
| 915 | |||
| 916 | /* Manipulating pixel sizes and character sizes. | ||
| 917 | Knowledge of which factors affect the overall size of the window should | ||
| 918 | be hidden in these macros, if that's possible. | ||
| 919 | |||
| 920 | Return the upper/left pixel position of the character cell on frame F | ||
| 921 | at ROW/COL. */ | ||
| 922 | |||
| 923 | #define FRAME_LINE_TO_PIXEL_Y(f, row) \ | ||
| 924 | (FRAME_INTERNAL_BORDER_WIDTH (f) \ | ||
| 925 | + (row) * FRAME_LINE_HEIGHT (f)) | ||
| 926 | |||
| 927 | #define FRAME_COL_TO_PIXEL_X(f, col) \ | ||
| 928 | (FRAME_INTERNAL_BORDER_WIDTH (f) \ | ||
| 929 | + (col) * FRAME_COLUMN_WIDTH (f)) | ||
| 930 | |||
| 931 | /* Return the pixel width/height of frame F if it has | ||
| 932 | COLS columns/LINES rows. */ | ||
| 933 | |||
| 934 | #define FRAME_TEXT_COLS_TO_PIXEL_WIDTH(f, cols) \ | ||
| 935 | (FRAME_COL_TO_PIXEL_X (f, cols) \ | ||
| 936 | + (f)->scroll_bar_actual_width \ | ||
| 937 | + FRAME_TOTAL_FRINGE_WIDTH (f) \ | ||
| 938 | + FRAME_INTERNAL_BORDER_WIDTH (f)) | ||
| 939 | |||
| 940 | #define FRAME_TEXT_LINES_TO_PIXEL_HEIGHT(f, lines) \ | ||
| 941 | (FRAME_LINE_TO_PIXEL_Y (f, lines) \ | ||
| 942 | + FRAME_INTERNAL_BORDER_WIDTH (f)) | ||
| 943 | |||
| 944 | |||
| 945 | /* Return the row/column (zero-based) of the character cell containing | ||
| 946 | the pixel on FRAME at Y/X. */ | ||
| 947 | |||
| 948 | #define FRAME_PIXEL_Y_TO_LINE(f, y) \ | ||
| 949 | (((y) - FRAME_INTERNAL_BORDER_WIDTH (f)) \ | ||
| 950 | / FRAME_LINE_HEIGHT (f)) | ||
| 951 | |||
| 952 | #define FRAME_PIXEL_X_TO_COL(f, x) \ | ||
| 953 | (((x) - FRAME_INTERNAL_BORDER_WIDTH (f)) \ | ||
| 954 | / FRAME_COLUMN_WIDTH (f)) | ||
| 955 | |||
| 956 | /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on | ||
| 957 | frame F? */ | ||
| 958 | |||
| 959 | #define FRAME_PIXEL_WIDTH_TO_TEXT_COLS(f, width) \ | ||
| 960 | (FRAME_PIXEL_X_TO_COL (f, ((width) \ | ||
| 961 | - FRAME_INTERNAL_BORDER_WIDTH (f) \ | ||
| 962 | - FRAME_TOTAL_FRINGE_WIDTH (f) \ | ||
| 963 | - (f)->scroll_bar_actual_width))) | ||
| 964 | |||
| 965 | #define FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(f, height) \ | ||
| 966 | (FRAME_PIXEL_Y_TO_LINE (f, ((height) \ | ||
| 967 | - FRAME_INTERNAL_BORDER_WIDTH (f)))) | ||
| 839 | 968 | ||
| 840 | 969 | ||
| 841 | /*********************************************************************** | 970 | /*********************************************************************** |