aboutsummaryrefslogtreecommitdiffstats
path: root/src/frame.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/frame.h')
-rw-r--r--src/frame.h177
1 files changed, 89 insertions, 88 deletions
diff --git a/src/frame.h b/src/frame.h
index 5ebfc2f7ec3..32a6954024e 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1,5 +1,5 @@
1/* Define frame-object for GNU Emacs. 1/* Define frame-object for GNU Emacs.
2 Copyright (C) 1993-1994, 1999-2012 Free Software Foundation, Inc. 2 Copyright (C) 1993-1994, 1999-2013 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -18,7 +18,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19/* Don't multiply include: dispextern.h includes macterm.h which 19/* Don't multiply include: dispextern.h includes macterm.h which
20 includes frame.h some emacs source includes both dispextern.h and 20 includes frame.h some emacs source includes both dispextern.h and
21 frame.h */ 21 frame.h. */
22 22
23#ifndef EMACS_FRAME_H 23#ifndef EMACS_FRAME_H
24#define EMACS_FRAME_H 24#define EMACS_FRAME_H
@@ -33,7 +33,7 @@ INLINE_HEADER_BEGIN
33 33
34/* Miscellanea. */ 34/* Miscellanea. */
35 35
36/* Nonzero means there is at least one garbaged frame. */ 36/* Nonzero means there is at least one garbaged frame. */
37extern bool frame_garbaged; 37extern bool frame_garbaged;
38 38
39 39
@@ -46,7 +46,6 @@ enum output_method
46 output_x_window, 46 output_x_window,
47 output_msdos_raw, 47 output_msdos_raw,
48 output_w32, 48 output_w32,
49 output_mac,
50 output_ns 49 output_ns
51}; 50};
52 51
@@ -171,9 +170,11 @@ struct frame
171 most recently buried buffer is first. For last-buffer. */ 170 most recently buried buffer is first. For last-buffer. */
172 Lisp_Object buried_buffer_list; 171 Lisp_Object buried_buffer_list;
173 172
173#if defined (HAVE_X_WINDOWS) && ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
174 /* A dummy window used to display menu bars under X when no X 174 /* A dummy window used to display menu bars under X when no X
175 toolkit support is available. */ 175 toolkit support is available. */
176 Lisp_Object menu_bar_window; 176 Lisp_Object menu_bar_window;
177#endif
177 178
178 /* A window used to display the tool-bar of a frame. */ 179 /* A window used to display the tool-bar of a frame. */
179 Lisp_Object tool_bar_window; 180 Lisp_Object tool_bar_window;
@@ -201,7 +202,7 @@ struct frame
201 string's pointer (`name', above) because it might get relocated. */ 202 string's pointer (`name', above) because it might get relocated. */
202 char *namebuf; 203 char *namebuf;
203 204
204 /* Glyph pool and matrix. */ 205 /* Glyph pool and matrix. */
205 struct glyph_pool *current_pool; 206 struct glyph_pool *current_pool;
206 struct glyph_pool *desired_pool; 207 struct glyph_pool *desired_pool;
207 struct glyph_matrix *desired_matrix; 208 struct glyph_matrix *desired_matrix;
@@ -277,9 +278,6 @@ struct frame
277 /* Size of the frame window in pixels. */ 278 /* Size of the frame window in pixels. */
278 int pixel_height, pixel_width; 279 int pixel_height, pixel_width;
279 280
280 /* Dots per inch of the screen the frame is on. */
281 double resx, resy;
282
283 /* These many pixels are the difference between the outer window (i.e. the 281 /* These many pixels are the difference between the outer window (i.e. the
284 left and top of the window manager decoration) and FRAME_X_WINDOW. */ 282 left and top of the window manager decoration) and FRAME_X_WINDOW. */
285 int x_pixels_diff, y_pixels_diff; 283 int x_pixels_diff, y_pixels_diff;
@@ -301,9 +299,6 @@ struct frame
301 /* Canonical X unit. Width of default font, in pixels. */ 299 /* Canonical X unit. Width of default font, in pixels. */
302 int column_width; 300 int column_width;
303 301
304 /* Width of space glyph of default font, in pixels. */
305 int space_width;
306
307 /* Canonical Y unit. Height of a line, in pixels. */ 302 /* Canonical Y unit. Height of a line, in pixels. */
308 int line_height; 303 int line_height;
309 304
@@ -357,46 +352,30 @@ struct frame
357 unsigned int external_menu_bar : 1; 352 unsigned int external_menu_bar : 1;
358#endif 353#endif
359 354
360 /* visible is nonzero if the frame is currently displayed; we check 355 /* Next two bitfields are mutually exclusive. They might both be
356 zero if the frame has been made invisible without an icon. */
357
358 /* Nonzero if the frame is currently displayed; we check
361 it to see if we should bother updating the frame's contents. 359 it to see if we should bother updating the frame's contents.
362 DON'T SET IT DIRECTLY; instead, use FRAME_SET_VISIBLE.
363 360
364 Note that, since invisible frames aren't updated, whenever a 361 Note that, since invisible frames aren't updated, whenever a
365 frame becomes visible again, it must be marked as garbaged. The 362 frame becomes visible again, it must be marked as garbaged.
366 FRAME_SAMPLE_VISIBILITY macro takes care of this.
367 363
368 On ttys and on Windows NT/9X, to avoid wasting effort updating 364 On ttys and on Windows NT/9X, to avoid wasting effort updating
369 visible frames that are actually completely obscured by other 365 visible frames that are actually completely obscured by other
370 windows on the display, we bend the meaning of visible slightly: 366 windows on the display, we bend the meaning of visible slightly:
371 if greater than 1, then the frame is obscured - we still consider 367 if equal to 2, then the frame is obscured - we still consider
372 it to be "visible" as seen from lisp, but we don't bother 368 it to be "visible" as seen from lisp, but we don't bother
373 updating it. We must take care to garbage the frame when it 369 updating it. We must take care to garbage the frame when it
374 ceases to be obscured though. 370 ceases to be obscured though. See SET_FRAME_VISIBLE below. */
375
376 iconified is nonzero if the frame is currently iconified.
377
378 Asynchronous input handlers should NOT change these directly;
379 instead, they should change async_visible or async_iconified, and
380 let the FRAME_SAMPLE_VISIBILITY macro set visible and iconified
381 at the next redisplay.
382
383 These should probably be considered read-only by everyone except
384 FRAME_SAMPLE_VISIBILITY.
385
386 These two are mutually exclusive. They might both be zero, if the
387 frame has been made invisible without an icon. */
388 unsigned visible : 2; 371 unsigned visible : 2;
389 unsigned iconified : 1;
390
391 /* Let's not use bitfields for volatile variables. */
392 372
393 /* Asynchronous input handlers change these, and 373 /* Nonzero if the frame is currently iconified. Do not
394 FRAME_SAMPLE_VISIBILITY copies them into visible and iconified. 374 set this directly, use SET_FRAME_ICONIFIED instead. */
395 See FRAME_SAMPLE_VISIBILITY, below. */ 375 unsigned iconified : 1;
396 volatile char async_visible, async_iconified;
397 376
398 /* Nonzero if this frame should be redrawn. */ 377 /* Nonzero if this frame should be redrawn. */
399 volatile char garbaged; 378 unsigned garbaged : 1;
400 379
401 /* True if frame actually has a minibuffer window on it. 380 /* True if frame actually has a minibuffer window on it.
402 0 if using a minibuffer window that isn't on this frame. */ 381 0 if using a minibuffer window that isn't on this frame. */
@@ -448,9 +427,6 @@ struct frame
448 /* Width of bar cursor (if we are using that) for blink-off state. */ 427 /* Width of bar cursor (if we are using that) for blink-off state. */
449 int blink_off_cursor_width; 428 int blink_off_cursor_width;
450 429
451 /* Storage for messages to this frame. */
452 char *message_buf;
453
454 /* Nonnegative if current redisplay should not do scroll computation 430 /* Nonnegative if current redisplay should not do scroll computation
455 for lines beyond a certain vpos. This is the vpos. */ 431 for lines beyond a certain vpos. This is the vpos. */
456 int scroll_bottom_vpos; 432 int scroll_bottom_vpos;
@@ -541,11 +517,13 @@ fset_menu_bar_vector (struct frame *f, Lisp_Object val)
541{ 517{
542 f->menu_bar_vector = val; 518 f->menu_bar_vector = val;
543} 519}
520#if defined (HAVE_X_WINDOWS) && ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
544FRAME_INLINE void 521FRAME_INLINE void
545fset_menu_bar_window (struct frame *f, Lisp_Object val) 522fset_menu_bar_window (struct frame *f, Lisp_Object val)
546{ 523{
547 f->menu_bar_window = val; 524 f->menu_bar_window = val;
548} 525}
526#endif
549FRAME_INLINE void 527FRAME_INLINE void
550fset_name (struct frame *f, Lisp_Object val) 528fset_name (struct frame *f, Lisp_Object val)
551{ 529{
@@ -592,6 +570,26 @@ fset_tool_bar_window (struct frame *f, Lisp_Object val)
592 f->tool_bar_window = val; 570 f->tool_bar_window = val;
593} 571}
594 572
573#define NUMVAL(X) ((INTEGERP (X) || FLOATP (X)) ? XFLOATINT (X) : -1)
574
575FRAME_INLINE double
576default_pixels_per_inch_x (void)
577{
578 Lisp_Object v = (CONSP (Vdisplay_pixels_per_inch)
579 ? XCAR (Vdisplay_pixels_per_inch)
580 : Vdisplay_pixels_per_inch);
581 return NUMVAL (v) > 0 ? NUMVAL (v) : 72.0;
582}
583
584FRAME_INLINE double
585default_pixels_per_inch_y (void)
586{
587 Lisp_Object v = (CONSP (Vdisplay_pixels_per_inch)
588 ? XCDR (Vdisplay_pixels_per_inch)
589 : Vdisplay_pixels_per_inch);
590 return NUMVAL (v) > 0 ? NUMVAL (v) : 72.0;
591}
592
595#define FRAME_KBOARD(f) ((f)->terminal->kboard) 593#define FRAME_KBOARD(f) ((f)->terminal->kboard)
596 594
597/* Return a pointer to the image cache of frame F. */ 595/* Return a pointer to the image cache of frame F. */
@@ -625,6 +623,37 @@ typedef struct frame *FRAME_PTR;
625#else 623#else
626#define FRAME_NS_P(f) ((f)->output_method == output_ns) 624#define FRAME_NS_P(f) ((f)->output_method == output_ns)
627#endif 625#endif
626
627/* Dots per inch of the screen the frame F is on. */
628
629#ifdef HAVE_X_WINDOWS
630#define FRAME_RES_X(f) \
631 (eassert (FRAME_X_P (f)), FRAME_X_DISPLAY_INFO (f)->resx)
632#define FRAME_RES_Y(f) \
633 (eassert (FRAME_X_P (f)), FRAME_X_DISPLAY_INFO (f)->resy)
634#endif
635
636#ifdef HAVE_NTGUI
637#define FRAME_RES_X(f) \
638 (eassert (FRAME_W32_P (f)), FRAME_W32_DISPLAY_INFO (f)->resx)
639#define FRAME_RES_Y(f) \
640 (eassert (FRAME_W32_P (f)), FRAME_W32_DISPLAY_INFO (f)->resy)
641#endif
642
643#ifdef HAVE_NS
644#define FRAME_RES_X(f) \
645 (eassert (FRAME_NS_P (f)), FRAME_NS_DISPLAY_INFO (f)->resx)
646#define FRAME_RES_Y(f) \
647 (eassert (FRAME_NS_P (f)), FRAME_NS_DISPLAY_INFO (f)->resy)
648#endif
649
650/* Defaults when no window system available. */
651
652#ifndef FRAME_RES_X
653#define FRAME_RES_X(f) default_pixels_per_inch_x ()
654#define FRAME_RES_Y(f) default_pixels_per_inch_y ()
655#endif
656
628/* FRAME_WINDOW_P tests whether the frame is a window, and is 657/* FRAME_WINDOW_P tests whether the frame is a window, and is
629 defined to be the predicate for the window system being used. */ 658 defined to be the predicate for the window system being used. */
630 659
@@ -718,7 +747,7 @@ typedef struct frame *FRAME_PTR;
718#else 747#else
719#define FRAME_EXTERNAL_MENU_BAR(f) 0 748#define FRAME_EXTERNAL_MENU_BAR(f) 0
720#endif 749#endif
721#define FRAME_VISIBLE_P(f) ((f)->visible != 0) 750#define FRAME_VISIBLE_P(f) (f)->visible
722 751
723/* Nonzero if frame F is currently visible but hidden. */ 752/* Nonzero if frame F is currently visible but hidden. */
724#define FRAME_OBSCURED_P(f) ((f)->visible > 1) 753#define FRAME_OBSCURED_P(f) ((f)->visible > 1)
@@ -726,9 +755,10 @@ typedef struct frame *FRAME_PTR;
726/* Nonzero if frame F is currently iconified. */ 755/* Nonzero if frame F is currently iconified. */
727#define FRAME_ICONIFIED_P(f) (f)->iconified 756#define FRAME_ICONIFIED_P(f) (f)->iconified
728 757
729#define FRAME_SET_VISIBLE(f,p) \ 758/* Mark frame F as currently garbaged. */
730 ((f)->async_visible = (p), FRAME_SAMPLE_VISIBILITY (f))
731#define SET_FRAME_GARBAGED(f) (frame_garbaged = 1, f->garbaged = 1) 759#define SET_FRAME_GARBAGED(f) (frame_garbaged = 1, f->garbaged = 1)
760
761/* Nonzero if frame F is currently garbaged. */
732#define FRAME_GARBAGED_P(f) (f)->garbaged 762#define FRAME_GARBAGED_P(f) (f)->garbaged
733 763
734/* Nonzero means do not allow splitting this frame's window. */ 764/* Nonzero means do not allow splitting this frame's window. */
@@ -755,7 +785,6 @@ typedef struct frame *FRAME_PTR;
755#define FRAME_DELETE_COST(f) (f)->delete_line_cost 785#define FRAME_DELETE_COST(f) (f)->delete_line_cost
756#define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost 786#define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost
757#define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost 787#define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost
758#define FRAME_MESSAGE_BUF(f) (f)->message_buf
759#define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos 788#define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos
760#define FRAME_FOCUS_FRAME(f) f->focus_frame 789#define FRAME_FOCUS_FRAME(f) f->focus_frame
761 790
@@ -874,39 +903,6 @@ typedef struct frame *FRAME_PTR;
874 903
875#define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4) 904#define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4)
876 905
877/* Emacs's redisplay code could become confused if a frame's
878 visibility changes at arbitrary times. For example, if a frame is
879 visible while the desired glyphs are being built, but becomes
880 invisible before they are updated, then some rows of the
881 desired_glyphs will be left marked as enabled after redisplay is
882 complete, which should never happen. The next time the frame
883 becomes visible, redisplay will probably barf.
884
885 Currently, there are no similar situations involving iconified, but
886 the principle is the same.
887
888 So instead of having asynchronous input handlers directly set and
889 clear the frame's visibility and iconification flags, they just set
890 the async_visible and async_iconified flags; the redisplay code
891 calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay,
892 which sets visible and iconified from their asynchronous
893 counterparts.
894
895 Synchronous code must use the FRAME_SET_VISIBLE macro.
896
897 Also, if a frame used to be invisible, but has just become visible,
898 it must be marked as garbaged, since redisplay hasn't been keeping
899 up its contents.
900
901 Note that a tty frame is visible if and only if it is the topmost
902 frame. */
903
904#define FRAME_SAMPLE_VISIBILITY(f) \
905 (((f)->async_visible && (f)->visible != (f)->async_visible) ? \
906 SET_FRAME_GARBAGED (f) : 0, \
907 (f)->visible = (f)->async_visible, \
908 (f)->iconified = (f)->async_iconified)
909
910#define CHECK_FRAME(x) \ 906#define CHECK_FRAME(x) \
911 CHECK_TYPE (FRAMEP (x), Qframep, x) 907 CHECK_TYPE (FRAMEP (x), Qframep, x)
912 908
@@ -940,12 +936,24 @@ typedef struct frame *FRAME_PTR;
940 block_input (); \ 936 block_input (); \
941 if (hlinfo->mouse_face_mouse_frame) \ 937 if (hlinfo->mouse_face_mouse_frame) \
942 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \ 938 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
943 hlinfo->mouse_face_mouse_x, \ 939 hlinfo->mouse_face_mouse_x, \
944 hlinfo->mouse_face_mouse_y); \ 940 hlinfo->mouse_face_mouse_y); \
945 unblock_input (); \ 941 unblock_input (); \
946 } \ 942 } \
947 } while (0) 943 } while (0)
948 944
945/* Set visibility of frame F, marking F as garbaged if needed. */
946
947#define SET_FRAME_VISIBLE(f, v) \
948 (((f)->visible == 0 || ((f)->visible == 2)) \
949 && ((v) == 1) ? SET_FRAME_GARBAGED (f) : 0, \
950 (f)->visible = (eassert (0 <= (v) && (v) <= 2), (v)))
951
952/* Set iconify of frame F. */
953
954#define SET_FRAME_ICONIFIED(f, i) \
955 (f)->iconified = (eassert (0 <= (i) && (i) <= 1), (i))
956
949extern Lisp_Object Qframep, Qframe_live_p; 957extern Lisp_Object Qframep, Qframe_live_p;
950extern Lisp_Object Qtty, Qtty_type; 958extern Lisp_Object Qtty, Qtty_type;
951extern Lisp_Object Qtty_color_mode; 959extern Lisp_Object Qtty_color_mode;
@@ -1000,11 +1008,6 @@ extern Lisp_Object selected_frame;
1000 1008
1001#define FRAME_COLUMN_WIDTH(F) ((F)->column_width) 1009#define FRAME_COLUMN_WIDTH(F) ((F)->column_width)
1002 1010
1003/* Space glyph width of the default font of frame F. */
1004
1005#define FRAME_SPACE_WIDTH(F) ((F)->space_width)
1006
1007
1008/* Pixel width of areas used to display truncation marks, continuation 1011/* Pixel width of areas used to display truncation marks, continuation
1009 marks, overlay arrows. This is 0 for terminal frames. */ 1012 marks, overlay arrows. This is 0 for terminal frames. */
1010 1013
@@ -1186,7 +1189,7 @@ extern Lisp_Object Qalpha;
1186extern Lisp_Object Qleft_fringe, Qright_fringe; 1189extern Lisp_Object Qleft_fringe, Qright_fringe;
1187extern Lisp_Object Qheight, Qwidth; 1190extern Lisp_Object Qheight, Qwidth;
1188extern Lisp_Object Qminibuffer, Qmodeline; 1191extern Lisp_Object Qminibuffer, Qmodeline;
1189extern Lisp_Object Qx, Qw32, Qmac, Qpc, Qns; 1192extern Lisp_Object Qx, Qw32, Qpc, Qns;
1190extern Lisp_Object Qvisible; 1193extern Lisp_Object Qvisible;
1191extern Lisp_Object Qdisplay_type; 1194extern Lisp_Object Qdisplay_type;
1192 1195
@@ -1263,8 +1266,6 @@ extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
1263extern void x_make_frame_visible (struct frame *f); 1266extern void x_make_frame_visible (struct frame *f);
1264extern void x_make_frame_invisible (struct frame *f); 1267extern void x_make_frame_invisible (struct frame *f);
1265extern void x_iconify_frame (struct frame *f); 1268extern void x_iconify_frame (struct frame *f);
1266extern int x_char_width (struct frame *f);
1267extern int x_char_height (struct frame *f);
1268extern int x_pixel_width (struct frame *f); 1269extern int x_pixel_width (struct frame *f);
1269extern int x_pixel_height (struct frame *f); 1270extern int x_pixel_height (struct frame *f);
1270extern void x_set_frame_alpha (struct frame *f); 1271extern void x_set_frame_alpha (struct frame *f);