aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann1999-07-21 21:43:52 +0000
committerGerd Moellmann1999-07-21 21:43:52 +0000
commit3b83d6312c4482c0f9106463886d9cd299403d66 (patch)
tree04faf496676a9a4f3ab65047b8821c218b19a75c /src
parent8720a429d9432c585fe1c9db3b52a6d34da8aa36 (diff)
downloademacs-3b83d6312c4482c0f9106463886d9cd299403d66.tar.gz
emacs-3b83d6312c4482c0f9106463886d9cd299403d66.zip
(FRAME_TOOLBAR_LINES): New.
(FRAME_TOP_MARGIN): New. (struct frame): Add toolbar-related members. (FRAME_WINDOW_WIDTH_ARG): Add bitmap area widths. (CHECK_FRAME): Give this macro a C-statement form! (CHECK_LIVE_FRAME): Ditto. (FRAME_FACE_CACHE): New. (struct frame): Add member face_cache. (FRAME_FLAGS_AREA_COLS): New. (FRAME_FLAGS_AREA_WIDTH): New. (struct frame): New member menu_bar_window. (struct frame): Add trunc_area_pixel_width, and _cols. (struct frame): Cursor-related stuff removed. (FRAME_SCROLL_BAR_WIDTH): Removed. (FRAME_WINDOW_WIDTH_ARG): Don't add scroll bar width. (FRAME_CURSOR_X): Removed. (FRAME_CURSOR_Y): Ditto. (struct frame): Remove old glyphs, add new.
Diffstat (limited to 'src')
-rw-r--r--src/frame.h239
1 files changed, 178 insertions, 61 deletions
diff --git a/src/frame.h b/src/frame.h
index 219ba288508..8ff3091491a 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -21,22 +21,33 @@ Boston, MA 02111-1307, USA. */
21 21
22/* Miscellanea. */ 22/* Miscellanea. */
23 23
24/* Nonzero means don't assume anything about current 24/* Nonzero means don't assume anything about current contents of
25 contents of actual terminal frame */ 25 actual terminal frame */
26
26extern int frame_garbaged; 27extern int frame_garbaged;
27 28
28/* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by 29/* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by
29 print. */ 30 print. */
31
30extern int message_buf_print; 32extern int message_buf_print;
31 33
32 34
33/* The structure representing a frame. */ 35/* The structure representing a frame. */
34 36
35enum output_method 37enum output_method
36{ output_termcap, output_x_window, output_msdos_raw, output_w32 }; 38{
39 output_termcap,
40 output_x_window,
41 output_msdos_raw,
42 output_w32
43};
37 44
38enum vertical_scroll_bar_type 45enum vertical_scroll_bar_type
39{ vertical_scroll_bar_none, vertical_scroll_bar_left, vertical_scroll_bar_right }; 46{
47 vertical_scroll_bar_none,
48 vertical_scroll_bar_left,
49 vertical_scroll_bar_right
50};
40 51
41struct frame 52struct frame
42{ 53{
@@ -127,18 +138,46 @@ struct frame
127 /* List of buffers viewed in this frame, for other-buffer. */ 138 /* List of buffers viewed in this frame, for other-buffer. */
128 Lisp_Object buffer_list; 139 Lisp_Object buffer_list;
129 140
141 /* A dummy window used to display menu bars under X when no X
142 toolkit support is available. */
143 Lisp_Object menu_bar_window;
144
145 /* A window used to display the toolbar of a frame. */
146 Lisp_Object toolbar_window;
147
148 /* Desired and current toolbar items. */
149 Lisp_Object desired_toolbar_items, current_toolbar_items;
150
151 /* Desired and current contents displayed in toolbar_window. */
152 Lisp_Object desired_toolbar_string, current_toolbar_string;
153
130 /* beyond here, there should be no more Lisp_Object components. */ 154 /* beyond here, there should be no more Lisp_Object components. */
131 155
156 /* Cache of realized faces. */
157 struct face_cache *face_cache;
132 158
133 /* A buffer to hold the frame's name. We can't use the Lisp string's 159 /* A buffer to hold the frame's name. We can't use the Lisp
134 pointer (`name', above) because it might get relocated. */ 160 string's pointer (`name', above) because it might get relocated. */
135 char *namebuf; 161 char *namebuf;
136 162
137 /* glyphs as they appear on the frame */ 163 /* Glyph pool and matrix. */
138 struct frame_glyphs *current_glyphs; 164 struct glyph_pool *current_pool;
165 struct glyph_pool *desired_pool;
166 struct glyph_matrix *desired_matrix;
167 struct glyph_matrix *current_matrix;
168
169 /* 1 means that glyphs on this frame have been initialized so it can
170 be used for output. */
171 unsigned glyphs_initialized_p : 1;
139 172
140 /* glyphs we'd like to appear on the frame */ 173 /* Margin at the top of the frame. Used to display the toolbar. */
141 struct frame_glyphs *desired_glyphs; 174 int toolbar_lines;
175
176 int n_desired_toolbar_items;
177 int n_current_toolbar_items;
178
179 /* A buffer for decode_mode_line. */
180 char *decode_mode_spec_buffer;
142 181
143 /* See do_line_insertion_deletion_costs for info on these arrays. */ 182 /* See do_line_insertion_deletion_costs for info on these arrays. */
144 /* Cost of inserting 1 line on this frame */ 183 /* Cost of inserting 1 line on this frame */
@@ -150,29 +189,11 @@ struct frame
150 /* Cost of deleting n lines on this frame */ 189 /* Cost of deleting n lines on this frame */
151 int *delete_n_lines_cost; 190 int *delete_n_lines_cost;
152 191
153 /* glyphs for the mode line */
154 struct frame_glyphs *temp_glyphs;
155
156 /* Intended cursor position of this frame.
157 Measured in characters, counting from upper left corner
158 within the frame. */
159 int cursor_x;
160 int cursor_y;
161
162 /* Actual cursor position of this frame, and the character under it.
163 (Not used for terminal frames.) */
164 int phys_cursor_x;
165 int phys_cursor_y;
166 /* This is handy for undrawing the cursor, because current_glyphs is
167 not always accurate when in do_scrolling. */
168 GLYPH phys_cursor_glyph;
169 /* Nonzero means the cursor is displayed. */
170 int phys_cursor_on;
171
172 /* Size of this frame, in units of characters. */ 192 /* Size of this frame, in units of characters. */
173 EMACS_INT height; 193 EMACS_INT height;
174 EMACS_INT width; 194 EMACS_INT width;
175 EMACS_INT window_width; 195 EMACS_INT window_width;
196 EMACS_INT window_height;
176 197
177 /* New height and width for pending size change. 0 if no change pending. */ 198 /* New height and width for pending size change. 0 if no change pending. */
178 int new_height, new_width; 199 int new_height, new_width;
@@ -186,7 +207,13 @@ struct frame
186 it is defined in xterm.h. 207 it is defined in xterm.h.
187 struct w32_output is used for W32 window frames; 208 struct w32_output is used for W32 window frames;
188 it is defined in w32term.h. */ 209 it is defined in w32term.h. */
189 union output_data { struct x_output *x; struct w32_output *w32; int nothing; } output_data; 210 union output_data
211 {
212 struct x_output *x;
213 struct w32_output *w32;
214 int nothing;
215 }
216 output_data;
190 217
191#ifdef MULTI_KBOARD 218#ifdef MULTI_KBOARD
192 /* A pointer to the kboard structure associated with this frame. 219 /* A pointer to the kboard structure associated with this frame.
@@ -298,6 +325,9 @@ struct frame
298 int scroll_bar_pixel_width; 325 int scroll_bar_pixel_width;
299 int scroll_bar_cols; 326 int scroll_bar_cols;
300 327
328 /* Width of area for drawing truncation marks and overlay arrow. */
329 int trunc_area_pixel_width, trunc_area_cols;
330
301 /* The baud rate that was used to calculate costs for this frame. */ 331 /* The baud rate that was used to calculate costs for this frame. */
302 int cost_calculation_baud_rate; 332 int cost_calculation_baud_rate;
303 333
@@ -333,6 +363,7 @@ typedef struct frame *FRAME_PTR;
333 363
334/* FRAME_WINDOW_P tests whether the frame is a window, and is 364/* FRAME_WINDOW_P tests whether the frame is a window, and is
335 defined to be the predicate for the window system being used. */ 365 defined to be the predicate for the window system being used. */
366
336#ifdef HAVE_X_WINDOWS 367#ifdef HAVE_X_WINDOWS
337#define FRAME_WINDOW_P(f) FRAME_X_P (f) 368#define FRAME_WINDOW_P(f) FRAME_X_P (f)
338#endif 369#endif
@@ -353,19 +384,6 @@ typedef struct frame *FRAME_PTR;
353/* Nonzero if frame F contains a minibuffer window. 384/* Nonzero if frame F contains a minibuffer window.
354 (If this is 0, F must use some other minibuffer window.) */ 385 (If this is 0, F must use some other minibuffer window.) */
355#define FRAME_HAS_MINIBUF_P(f) ((f)->has_minibuffer) 386#define FRAME_HAS_MINIBUF_P(f) ((f)->has_minibuffer)
356
357/* This points to the structure which describes the contents
358 currently displayed on frame F. See dispextern.h. */
359#define FRAME_CURRENT_GLYPHS(f) (f)->current_glyphs
360
361/* This points to the structure which describes the contents
362 intended to be displayed on frame F. See dispextern.h. */
363#define FRAME_DESIRED_GLYPHS(f) (f)->desired_glyphs
364
365#define FRAME_TEMP_GLYPHS(f) (f)->temp_glyphs
366#define SET_GLYPHS_FRAME(glyphs,frame) ((glyphs)->frame = (frame))
367
368/* Height of frame F, measured in character lines. */
369#define FRAME_HEIGHT(f) (f)->height 387#define FRAME_HEIGHT(f) (f)->height
370 388
371/* Width of frame F, measured in character columns, 389/* Width of frame F, measured in character columns,
@@ -378,6 +396,15 @@ typedef struct frame *FRAME_PTR;
378 These lines are counted in FRAME_HEIGHT. */ 396 These lines are counted in FRAME_HEIGHT. */
379#define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines 397#define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines
380 398
399/* Number of lines of frame F used for the toolbar. */
400
401#define FRAME_TOOLBAR_LINES(f) (f)->toolbar_lines
402
403/* Lines above the top-most window in frame F. */
404
405#define FRAME_TOP_MARGIN(F) \
406 (FRAME_MENU_BAR_LINES (F) + FRAME_TOOLBAR_LINES (F))
407
381/* Nonzero if this frame should display a menu bar 408/* Nonzero if this frame should display a menu bar
382 in a way that does not use any text lines. */ 409 in a way that does not use any text lines. */
383#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) 410#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
@@ -385,12 +412,6 @@ typedef struct frame *FRAME_PTR;
385#else 412#else
386#define FRAME_EXTERNAL_MENU_BAR(f) 0 413#define FRAME_EXTERNAL_MENU_BAR(f) 0
387#endif 414#endif
388
389/* Current cursor position for frame F. */
390#define FRAME_CURSOR_X(f) (f)->cursor_x
391#define FRAME_CURSOR_Y(f) (f)->cursor_y
392
393/* Nonzero if frame F is currently visible. */
394#define FRAME_VISIBLE_P(f) ((f)->visible != 0) 415#define FRAME_VISIBLE_P(f) ((f)->visible != 0)
395 416
396/* Nonzero if frame F is currently visible but hidden. */ 417/* Nonzero if frame F is currently visible but hidden. */
@@ -487,8 +508,10 @@ typedef struct frame *FRAME_PTR;
487 508
488/* Given a value WIDTH for frame F's nominal width, 509/* Given a value WIDTH for frame F's nominal width,
489 return the value that FRAME_WINDOW_WIDTH should have. */ 510 return the value that FRAME_WINDOW_WIDTH should have. */
490#define FRAME_WINDOW_WIDTH_ARG(f, width) \ 511#define FRAME_WINDOW_WIDTH_ARG(f, width) \
491 ((width) + FRAME_SCROLL_BAR_WIDTH (f)) 512 ((width) \
513 + FRAME_SCROLL_BAR_WIDTH (f) \
514 + 2 * FRAME_FLAGS_AREA_COLS (f))
492 515
493/* Maximum + 1 legitimate value for FRAME_CURSOR_X. */ 516/* Maximum + 1 legitimate value for FRAME_CURSOR_X. */
494#define FRAME_CURSOR_X_LIMIT(f) \ 517#define FRAME_CURSOR_X_LIMIT(f) \
@@ -502,9 +525,14 @@ typedef struct frame *FRAME_PTR;
502#define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate) 525#define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate)
503#define FRAME_FONTSET_DATA(f) ((f)->fontset_data) 526#define FRAME_FONTSET_DATA(f) ((f)->fontset_data)
504 527
528/* Return a pointer to the face cache of frame F. */
529
530#define FRAME_FACE_CACHE(F) (F)->face_cache
531
505/* Return the size of message_buf of the frame F. We multiply the 532/* Return the size of message_buf of the frame F. We multiply the
506 width of the frame by 4 because multi-byte form may require at most 533 width of the frame by 4 because multi-byte form may require at most
507 4-byte for a character. */ 534 4-byte for a character. */
535
508#define FRAME_MESSAGE_BUF_SIZE(f) (((int) (f)->width) * 4) 536#define FRAME_MESSAGE_BUF_SIZE(f) (((int) (f)->width) * 4)
509 537
510/* Emacs's redisplay code could become confused if a frame's 538/* Emacs's redisplay code could become confused if a frame's
@@ -530,24 +558,26 @@ typedef struct frame *FRAME_PTR;
530 Also, if a frame used to be invisible, but has just become visible, 558 Also, if a frame used to be invisible, but has just become visible,
531 it must be marked as garbaged, since redisplay hasn't been keeping 559 it must be marked as garbaged, since redisplay hasn't been keeping
532 up its contents. */ 560 up its contents. */
561
533#define FRAME_SAMPLE_VISIBILITY(f) \ 562#define FRAME_SAMPLE_VISIBILITY(f) \
534 (((f)->async_visible && (f)->visible != (f)->async_visible) ? \ 563 (((f)->async_visible && (f)->visible != (f)->async_visible) ? \
535 SET_FRAME_GARBAGED (f) : 0, \ 564 SET_FRAME_GARBAGED (f) : 0, \
536 (f)->visible = (f)->async_visible, \ 565 (f)->visible = (f)->async_visible, \
537 (f)->iconified = (f)->async_iconified) 566 (f)->iconified = (f)->async_iconified)
538 567
539#define CHECK_FRAME(x, i) \ 568#define CHECK_FRAME(x, i) \
540 { \ 569 if (! FRAMEP (x)) \
541 if (! FRAMEP (x)) \ 570 x = wrong_type_argument (Qframep, (x)); \
542 x = wrong_type_argument (Qframep, (x)); \ 571 else \
543 } 572 (void) 0
544 573
545#define CHECK_LIVE_FRAME(x, i) \ 574#define CHECK_LIVE_FRAME(x, i) \
546 { \ 575 if (! FRAMEP (x) \
547 if (! FRAMEP (x) \ 576 || ! FRAME_LIVE_P (XFRAME (x))) \
548 || ! FRAME_LIVE_P (XFRAME (x))) \ 577 x = wrong_type_argument (Qframe_live_p, (x)); \
549 x = wrong_type_argument (Qframe_live_p, (x)); \ 578 else \
550 } 579 (void) 0
580
551 581
552/* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a 582/* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a
553 `for' loop which iterates over the elements of Vframe_list. The 583 `for' loop which iterates over the elements of Vframe_list. The
@@ -559,6 +589,7 @@ typedef struct frame *FRAME_PTR;
559 This macro is a holdover from a time when multiple frames weren't always 589 This macro is a holdover from a time when multiple frames weren't always
560 supported. An alternate definition of the macro would expand to 590 supported. An alternate definition of the macro would expand to
561 something which executes the statement once. */ 591 something which executes the statement once. */
592
562#define FOR_EACH_FRAME(list_var, frame_var) \ 593#define FOR_EACH_FRAME(list_var, frame_var) \
563 for ((list_var) = Vframe_list; \ 594 for ((list_var) = Vframe_list; \
564 (CONSP (list_var) \ 595 (CONSP (list_var) \
@@ -593,6 +624,7 @@ extern Lisp_Object Vterminal_frame;
593 use for text. If the window touches the right edge of the frame, 624 use for text. If the window touches the right edge of the frame,
594 we have extra space allocated for it. Otherwise, the scroll bar 625 we have extra space allocated for it. Otherwise, the scroll bar
595 takes over the window's rightmost columns. */ 626 takes over the window's rightmost columns. */
627
596#define WINDOW_VERTICAL_SCROLL_BAR_COLUMN(w) \ 628#define WINDOW_VERTICAL_SCROLL_BAR_COLUMN(w) \
597 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (XFRAME (WINDOW_FRAME (w))) ? \ 629 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (XFRAME (WINDOW_FRAME (w))) ? \
598 (((XINT ((w)->left) + XINT ((w)->width)) \ 630 (((XINT ((w)->left) + XINT ((w)->width)) \
@@ -604,4 +636,89 @@ extern Lisp_Object Vterminal_frame;
604 636
605/* Return the height in lines of the vertical scroll bar in w. If the 637/* Return the height in lines of the vertical scroll bar in w. If the
606 window has a mode line, don't make the scroll bar extend that far. */ 638 window has a mode line, don't make the scroll bar extend that far. */
639
607#define WINDOW_VERTICAL_SCROLL_BAR_HEIGHT(w) (window_internal_height (w)) 640#define WINDOW_VERTICAL_SCROLL_BAR_HEIGHT(w) (window_internal_height (w))
641
642
643
644/***********************************************************************
645 Display-related Macros
646 ***********************************************************************/
647
648/* Canonical y-unit on frame F. This value currently equals the line
649 height of the frame. Terminal specific header files are expected
650 to define the macro FRAME_LINE_HEIGHT. */
651
652#define CANON_Y_UNIT(F) \
653 (FRAME_WINDOW_P (F) ? FRAME_LINE_HEIGHT (F) : 1)
654
655/* Canonical x-unit on frame F. This is currently equal to the width
656 of the default font of F. Terminal specific headers are expected
657 to define the macro FRAME_DEFAULT_FONT_WIDTH. */
658
659#define CANON_X_UNIT(F) \
660 (FRAME_WINDOW_P (F) ? FRAME_DEFAULT_FONT_WIDTH (F) : 1)
661
662/* Pixel width of areas used to display truncation marks, continuation
663 marks, overlay arrows. This is 0 for terminal frames. Other
664 terminal headers must define FRAME_X_TRUNC_WIDTH. */
665
666#ifdef HAVE_WINDOW_SYSTEM
667#define FRAME_FLAGS_AREA_COLS(F) \
668 (FRAME_WINDOW_P ((F)) ? FRAME_X_FLAGS_AREA_COLS ((F)) : 0)
669#define FRAME_FLAGS_AREA_WIDTH(F) \
670 (FRAME_FLAGS_AREA_COLS ((F)) * CANON_X_UNIT ((F)))
671#else
672#define FRAME_FLAGS_AREA_WIDTH(F) 0
673#define FRAME_FLAGS_AREA_COLS(F) 0
674#endif
675
676
677
678
679/***********************************************************************
680 Conversion between canonical units and pixels
681 ***********************************************************************/
682
683/* Canonical x-values are fractions of CANON_X_UNIT, canonical y-unit
684 are fractions of CANON_Y_UNIT of a frame. Both are represented as
685 Lisp numbers, i.e. integers or floats. */
686
687/* Convert canonical value X to pixels. F is the frame whose
688 canonical char width is to be used. X must be a Lisp integer or
689 float. Value is a C integer. */
690
691#define PIXEL_X_FROM_CANON_X(F, X) \
692 (INTEGERP (X) \
693 ? XINT (X) * CANON_X_UNIT (F) \
694 : (int) (XFLOAT (X)->data * CANON_X_UNIT (F)))
695
696/* Convert canonical value Y to pixels. F is the frame whose
697 canonical character height is to be used. X must be a Lisp integer
698 or float. Value is a C integer. */
699
700#define PIXEL_Y_FROM_CANON_Y(F, Y) \
701 (INTEGERP (Y) \
702 ? XINT (Y) * CANON_Y_UNIT (F) \
703 : (int) (XFLOAT (Y)->data * CANON_Y_UNIT (F)))
704
705/* Convert pixel-value X to canonical units. F is the frame whose
706 canonical character width is to be used. X is a C integer. Result
707 is a Lisp float if X is not a multiple of the canon width,
708 otherwise it's a Lisp integer. */
709
710#define CANON_X_FROM_PIXEL_X(F, X) \
711 ((X) % CANON_X_UNIT (F) != 0 \
712 ? make_float ((double) (X) / CANON_X_UNIT (F)) \
713 : make_number ((X) / CANON_X_UNIT (F)))
714
715/* Convert pixel-value Y to canonical units. F is the frame whose
716 canonical character height is to be used. Y is a C integer.
717 Result is a Lisp float if Y is not a multiple of the canon width,
718 otherwise it's a Lisp integer. */
719
720#define CANON_Y_FROM_PIXEL_Y(F, Y) \
721 ((Y) % CANON_Y_UNIT (F) \
722 ? make_float ((double) (Y) / CANON_Y_UNIT (F)) \
723 : make_number ((Y) / CANON_Y_UNIT (F)))
724