aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1993-01-14 15:09:51 +0000
committerJim Blandy1993-01-14 15:09:51 +0000
commit20a6c8d708ed56e3cbaa0cba2f56d7ae446ae6a5 (patch)
treeb126728b5769fa607014e103bf0b9acb7098dbd8 /src
parent178577827e99f3a78604c3391177e33e57acd6f0 (diff)
downloademacs-20a6c8d708ed56e3cbaa0cba2f56d7ae446ae6a5.tar.gz
emacs-20a6c8d708ed56e3cbaa0cba2f56d7ae446ae6a5.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/frame.h56
1 files changed, 37 insertions, 19 deletions
diff --git a/src/frame.h b/src/frame.h
index 6f63e4e2ec4..5a3f45a080d 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) 1988, 1992 Free Software Foundation, Inc. 2 Copyright (C) 1988, 1992, 1993 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -17,7 +17,18 @@ You should have received a copy of the GNU General Public License
17along with GNU Emacs; see the file COPYING. If not, write to 17along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19 19
20
21/* Miscellanea. */
22
23/* Nonzero means don't assume anything about current
24 contents of actual terminal frame */
25extern int frame_garbaged;
26
27/* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by
28 print. */
29extern int message_buf_print;
20 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
@@ -111,6 +122,16 @@ struct 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;
@@ -127,6 +148,10 @@ struct frame
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.
129 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.
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;
@@ -240,6 +265,8 @@ typedef struct frame *FRAME_PTR;
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
@@ -259,9 +286,14 @@ typedef struct frame *FRAME_PTR;
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) \
@@ -303,10 +335,6 @@ extern struct frame *make_frame ();
303extern struct frame *make_minibuffer_frame (); 335extern struct frame *make_minibuffer_frame ();
304extern struct frame *make_frame_without_minibuffer (); 336extern struct frame *make_frame_without_minibuffer ();
305 337
306/* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by
307 print. */
308extern int message_buf_print;
309
310extern Lisp_Object Vframe_list; 338extern Lisp_Object Vframe_list;
311extern Lisp_Object Vdefault_frame_alist; 339extern Lisp_Object Vdefault_frame_alist;
312 340
@@ -327,10 +355,6 @@ extern struct frame the_only_frame;
327extern int selected_frame; 355extern int selected_frame;
328extern int last_nonminibuf_frame; 356extern int last_nonminibuf_frame;
329 357
330/* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by
331 print. */
332extern int message_buf_print;
333
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
@@ -370,6 +394,8 @@ extern int message_buf_print;
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)
@@ -398,14 +424,6 @@ extern int message_buf_print;
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 426
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
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,