comparison src/frame.h @ 1776:20c6f4aa5843

Make scrollbar structures into lisp objects, so that they can be GC'd; this allows windows and scrollbars can refer to each other without worrying about dangling pointers. * xterm.h (struct x_display): vertical_scrollbars and judge_timestamp members deleted. (struct scrollbar): Redesigned to be a template for a Lisp_Vector. (SCROLLBAR_VEC_SIZE, XSCROLLBAR, SCROLLBAR_PACK, SCROLLBAR_UNPACK, SCROLLBAR_X_WINDOW, SET_SCROLLBAR_X_WINDOW, VERTICAL_SCROLLBAR_INSIDE_WIDTH, VERTICAL_SCROLLBAR_TOP_RANGE, VERTICAL_SCROLLBAR_INSIDE_HEIGHT, VERTICAL_SCROLLBAR_MIN_HANDLE): New macros, to help deal with the lispy structures, and deal with the graphics. * frame.h (WINDOW_VERTICAL_SCROLLBAR): Macro deleted. (struct frame): New fields `scrollbars' and `condemned_scrollbars', for use by the scrollbar implementation. [MULTI_FRAME and not MULTI_FRAME] (FRAME_SCROLLBARS, FRAME_CONDEMNED_SCROLLBARS): Accessors for the new field. * window.h (struct window): Doc fix for vertical_scrollbar field. * frame.c (make_frame): Initialize the `scrollbars' and `condemned_scrollbars' fields of the new frame. * alloc.c (mark_object): Mark the `scrollbars' and `condemned_scrollbars' slots of frames. * xterm.c (x_window_to_scrollbar): Scrollbars are chained on frames' scrollbar field, not their x.display->vertical_scrollbars field. (x_scrollbar_create, x_scrollbar_set_handle, x_scrollbar_move, x_scrollbar_remove, XTset_vertical_scrollbar, XTcondemn_scrollbars, XTredeem_scrollbar, XTjudge_scrollbars, x_scrollbar_expose, x_scrollbar_handle_click, x_scrollbar_handle_motion): Substantially rewritten to correct typos and brainos, and to accomodate the lispy structures. * frame.h (FRAME_SAMPLE_VISIBILITY): Make sure frame is marked as garbaged whenever it goes from invisible to visible. * dispextern.h (frame_garbaged): Move extern declaration from here... * frame.h (frame_garbaged): ... to here. The FRAME_SAMPLE_VISIBILITY macro uses it now, and this seems to be just as modular. Make a new page, just for this and message_buf_print. (struct frame): Doc fix for the `visible' field. * process.c: #include "frame.h" instead of "dispextern.h"; the only thing we care about from it is the frame_garbaged declaration. * ymakefile: Note dependency change.
author Jim Blandy <jimb@redhat.com>
date Thu, 14 Jan 1993 15:09:51 +0000
parents 26054080a152
children 04fb1d3d6992
comparison
equal deleted inserted replaced
1775:f9ac4c0d8b72 1776:20c6f4aa5843
1 /* Define frame-object for GNU Emacs. 1 /* Define frame-object for GNU Emacs.
2 Copyright (C) 1988, 1992 Free Software Foundation, Inc. 2 Copyright (C) 1988, 1992, 1993 Free Software Foundation, Inc.
3 3
4 This file is part of GNU Emacs. 4 This file is part of GNU Emacs.
5 5
6 GNU Emacs is free software; you can redistribute it and/or modify 6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to 17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19 19
20 20
21 /* Miscellanea. */
22
23 /* Nonzero means don't assume anything about current
24 contents of actual terminal frame */
25 extern int frame_garbaged;
26
27 /* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by
28 print. */
29 extern int message_buf_print;
30
31
21 /* The structure representing a frame. 32 /* The structure representing a frame.
22 33
23 We declare this even if MULTI_FRAME is not defined, because when 34 We declare this even if MULTI_FRAME is not defined, because when
24 we lack multi-frame support, we use one instance of this structure 35 we lack multi-frame support, we use one instance of this structure
25 to represent the one frame we support. This is cleaner than 36 to represent the one frame we support. This is cleaner than
109 /* Parameter alist of this frame. 120 /* Parameter alist of this frame.
110 These are the parameters specified when creating the frame 121 These are the parameters specified when creating the frame
111 or modified with modify-frame-parameters. */ 122 or modified with modify-frame-parameters. */
112 Lisp_Object param_alist; 123 Lisp_Object param_alist;
113 124
125 /* List of scrollbars on this frame.
126 Actually, we don't specify exactly what is stored here at all; the
127 scrollbar implementation code can use it to store anything it likes.
128 This field is marked by the garbage collector. It is here
129 instead of in the `display' structure so that the garbage
130 collector doesn't need to look inside the window-system-dependent
131 structure. */
132 Lisp_Object scrollbars;
133 Lisp_Object condemned_scrollbars;
134
114 /* The output method says how the contents of this frame 135 /* The output method says how the contents of this frame
115 are displayed. It could be using termcap, or using an X window. */ 136 are displayed. It could be using termcap, or using an X window. */
116 enum output_method output_method; 137 enum output_method output_method;
117 138
118 /* A structure of auxiliary data used for displaying the contents. 139 /* A structure of auxiliary data used for displaying the contents.
124 char display_preempted; 145 char display_preempted;
125 146
126 /* visible is nonzero if the frame is currently displayed; we check 147 /* visible is nonzero if the frame is currently displayed; we check
127 it to see if we should bother updating the frame's contents. 148 it to see if we should bother updating the frame's contents.
128 DON'T SET IT DIRECTLY; instead, use FRAME_SET_VISIBLE. 149 DON'T SET IT DIRECTLY; instead, use FRAME_SET_VISIBLE.
150
151 Note that, since invisible frames aren't updated, whenever a
152 frame becomes visible again, it must be marked as garbaged. The
153 FRAME_SAMPLE_VISIBILITY macro takes care of this.
129 154
130 iconified is nonzero if the frame is currently iconified. 155 iconified is nonzero if the frame is currently iconified.
131 156
132 Asynchronous input handlers should NOT change these directly; 157 Asynchronous input handlers should NOT change these directly;
133 instead, they should change async_visible or async_iconified, and 158 instead, they should change async_visible or async_iconified, and
238 #define FRAME_MESSAGE_BUF(f) (f)->message_buf 263 #define FRAME_MESSAGE_BUF(f) (f)->message_buf
239 #define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos 264 #define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos
240 #define FRAME_FOCUS_FRAME(f) (f)->focus_frame 265 #define FRAME_FOCUS_FRAME(f) (f)->focus_frame
241 #define FRAME_CAN_HAVE_SCROLLBARS(f) ((f)->can_have_scrollbars) 266 #define FRAME_CAN_HAVE_SCROLLBARS(f) ((f)->can_have_scrollbars)
242 #define FRAME_HAS_VERTICAL_SCROLLBARS(f) ((f)->has_vertical_scrollbars) 267 #define FRAME_HAS_VERTICAL_SCROLLBARS(f) ((f)->has_vertical_scrollbars)
268 #define FRAME_SCROLLBARS(f) ((f)->scrollbars)
269 #define FRAME_CONDEMNED_SCROLLBARS(f) ((f)->condemned_scrollbars)
243 270
244 /* Emacs's redisplay code could become confused if a frame's 271 /* Emacs's redisplay code could become confused if a frame's
245 visibility changes at arbitrary times. For example, if a frame is 272 visibility changes at arbitrary times. For example, if a frame is
246 visible while the desired glyphs are being built, but becomes 273 visible while the desired glyphs are being built, but becomes
247 invisible before they are updated, then some rows of the 274 invisible before they are updated, then some rows of the
257 the async_visible and async_iconified flags; the redisplay code 284 the async_visible and async_iconified flags; the redisplay code
258 calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay, 285 calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay,
259 which sets visible and iconified from their asynchronous 286 which sets visible and iconified from their asynchronous
260 counterparts. 287 counterparts.
261 288
262 Synchronous code must use the FRAME_SET_VISIBLE macro. */ 289 Synchronous code must use the FRAME_SET_VISIBLE macro.
290
291 Also, if a frame used to be invisible, but has just become visible,
292 it must be marked as garbaged, since redisplay hasn't been keeping
293 up its contents. */
263 #define FRAME_SAMPLE_VISIBILITY(f) \ 294 #define FRAME_SAMPLE_VISIBILITY(f) \
264 ((f)->visible = (f)->async_visible, \ 295 (((f)->async_visible && ! (f)->visible) ? SET_FRAME_GARBAGED (f) : 0, \
296 (f)->visible = (f)->async_visible, \
265 (f)->iconified = (f)->async_iconified) 297 (f)->iconified = (f)->async_iconified)
266 298
267 #define CHECK_FRAME(x, i) \ 299 #define CHECK_FRAME(x, i) \
268 { \ 300 { \
269 if (! FRAMEP (x)) \ 301 if (! FRAMEP (x)) \
301 extern struct frame *make_terminal_frame (); 333 extern struct frame *make_terminal_frame ();
302 extern struct frame *make_frame (); 334 extern struct frame *make_frame ();
303 extern struct frame *make_minibuffer_frame (); 335 extern struct frame *make_minibuffer_frame ();
304 extern struct frame *make_frame_without_minibuffer (); 336 extern struct frame *make_frame_without_minibuffer ();
305 337
306 /* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by
307 print. */
308 extern int message_buf_print;
309
310 extern Lisp_Object Vframe_list; 338 extern Lisp_Object Vframe_list;
311 extern Lisp_Object Vdefault_frame_alist; 339 extern Lisp_Object Vdefault_frame_alist;
312 340
313 extern Lisp_Object Vterminal_frame; 341 extern Lisp_Object Vterminal_frame;
314 342
324 element explicitly. */ 352 element explicitly. */
325 extern struct frame the_only_frame; 353 extern struct frame the_only_frame;
326 354
327 extern int selected_frame; 355 extern int selected_frame;
328 extern int last_nonminibuf_frame; 356 extern int last_nonminibuf_frame;
329
330 /* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by
331 print. */
332 extern int message_buf_print;
333 357
334 #define XFRAME(f) selected_frame 358 #define XFRAME(f) selected_frame
335 #define WINDOW_FRAME(w) selected_frame 359 #define WINDOW_FRAME(w) selected_frame
336 360
337 #define FRAMEP(f) (XTYPE(f) == Lisp_Frame) 361 #define FRAMEP(f) (XTYPE(f) == Lisp_Frame)
368 #define FRAME_SCROLL_BOTTOM_VPOS(f) (the_only_frame.scroll_bottom_vpos) 392 #define FRAME_SCROLL_BOTTOM_VPOS(f) (the_only_frame.scroll_bottom_vpos)
369 #define FRAME_FOCUS_FRAME(f) (Qnil) 393 #define FRAME_FOCUS_FRAME(f) (Qnil)
370 #define FRAME_CAN_HAVE_SCROLLBARS(f) (the_only_frame.can_have_scrollbars) 394 #define FRAME_CAN_HAVE_SCROLLBARS(f) (the_only_frame.can_have_scrollbars)
371 #define FRAME_HAS_VERTICAL_SCROLLBARS(f) \ 395 #define FRAME_HAS_VERTICAL_SCROLLBARS(f) \
372 (the_only_frame.has_vertical_scrollbars) 396 (the_only_frame.has_vertical_scrollbars)
397 #define FRAME_SCROLLBARS(f) (the_only_frame.scrollbars)
398 #define FRAME_CONDEMNED_SCROLLBARS(f) (the_only_frame.condemned_scrollbars)
373 399
374 /* See comments in definition above. */ 400 /* See comments in definition above. */
375 #define FRAME_SAMPLE_VISIBILITY(f) (0) 401 #define FRAME_SAMPLE_VISIBILITY(f) (0)
376 402
377 #define CHECK_FRAME(x, i) do; while (0) 403 #define CHECK_FRAME(x, i) do; while (0)
395 421
396 /* Device- and MULTI_FRAME-independent scrollbar stuff. */ 422 /* Device- and MULTI_FRAME-independent scrollbar stuff. */
397 423
398 /* The number of columns a vertical scrollbar occupies. */ 424 /* The number of columns a vertical scrollbar occupies. */
399 #define VERTICAL_SCROLLBAR_WIDTH (2) 425 #define VERTICAL_SCROLLBAR_WIDTH (2)
400
401 /* Turn a window's scrollbar member into a `struct scrollbar *';
402 return NULL if the window doesn't have a scrollbar. */
403 #define WINDOW_VERTICAL_SCROLLBAR(w) \
404 (XTYPE ((w)->vertical_scrollbar) == Lisp_Int \
405 ? (struct scrollbar *) XPNTR ((w)->vertical_scrollbar) \
406 : (struct scrollbar *) 0)
407
408 426
409 /* Return the starting column (zero-based) of the vertical scrollbar 427 /* Return the starting column (zero-based) of the vertical scrollbar
410 for window W. The column before this one is the last column we can 428 for window W. The column before this one is the last column we can
411 use for text. If the window touches the right edge of the frame, 429 use for text. If the window touches the right edge of the frame,
412 we have extra space allocated for it. Otherwise, the scrollbar 430 we have extra space allocated for it. Otherwise, the scrollbar