Commit 20a6c8d7 authored by Jim Blandy's avatar Jim Blandy

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.
	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.
	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
	(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
	* ymakefile: Note dependency change.
parent 17857782
/* Define frame-object for GNU Emacs.
Copyright (C) 1988, 1992 Free Software Foundation, Inc.
Copyright (C) 1988, 1992, 1993 Free Software Foundation, Inc.
This file is part of GNU Emacs.
......@@ -17,7 +17,18 @@ You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Miscellanea. */
/* Nonzero means don't assume anything about current
contents of actual terminal frame */
extern int frame_garbaged;
/* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by
print. */
extern int message_buf_print;
/* The structure representing a frame.
We declare this even if MULTI_FRAME is not defined, because when
......@@ -111,6 +122,16 @@ struct frame
or modified with modify-frame-parameters. */
Lisp_Object param_alist;
/* List of scrollbars on this frame.
Actually, we don't specify exactly what is stored here at all; the
scrollbar implementation code can use it to store anything it likes.
This field is marked by the garbage collector. It is here
instead of in the `display' structure so that the garbage
collector doesn't need to look inside the window-system-dependent
structure. */
Lisp_Object scrollbars;
Lisp_Object condemned_scrollbars;
/* The output method says how the contents of this frame
are displayed. It could be using termcap, or using an X window. */
enum output_method output_method;
......@@ -127,6 +148,10 @@ struct frame
it to see if we should bother updating the frame's contents.
Note that, since invisible frames aren't updated, whenever a
frame becomes visible again, it must be marked as garbaged. The
FRAME_SAMPLE_VISIBILITY macro takes care of this.
iconified is nonzero if the frame is currently iconified.
Asynchronous input handlers should NOT change these directly;
......@@ -240,6 +265,8 @@ typedef struct frame *FRAME_PTR;
#define FRAME_FOCUS_FRAME(f) (f)->focus_frame
#define FRAME_CAN_HAVE_SCROLLBARS(f) ((f)->can_have_scrollbars)
#define FRAME_HAS_VERTICAL_SCROLLBARS(f) ((f)->has_vertical_scrollbars)
#define FRAME_SCROLLBARS(f) ((f)->scrollbars)
#define FRAME_CONDEMNED_SCROLLBARS(f) ((f)->condemned_scrollbars)
/* Emacs's redisplay code could become confused if a frame's
visibility changes at arbitrary times. For example, if a frame is
......@@ -259,9 +286,14 @@ typedef struct frame *FRAME_PTR;
which sets visible and iconified from their asynchronous
Synchronous code must use the FRAME_SET_VISIBLE macro. */
Synchronous code must use the FRAME_SET_VISIBLE macro.
Also, if a frame used to be invisible, but has just become visible,
it must be marked as garbaged, since redisplay hasn't been keeping
up its contents. */
((f)->visible = (f)->async_visible, \
(((f)->async_visible && ! (f)->visible) ? SET_FRAME_GARBAGED (f) : 0, \
(f)->visible = (f)->async_visible, \
(f)->iconified = (f)->async_iconified)
#define CHECK_FRAME(x, i) \
......@@ -303,10 +335,6 @@ extern struct frame *make_frame ();
extern struct frame *make_minibuffer_frame ();
extern struct frame *make_frame_without_minibuffer ();
/* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by
print. */
extern int message_buf_print;
extern Lisp_Object Vframe_list;
extern Lisp_Object Vdefault_frame_alist;
......@@ -327,10 +355,6 @@ extern struct frame the_only_frame;
extern int selected_frame;
extern int last_nonminibuf_frame;
/* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by
print. */
extern int message_buf_print;
#define XFRAME(f) selected_frame
#define WINDOW_FRAME(w) selected_frame
......@@ -370,6 +394,8 @@ extern int message_buf_print;
#define FRAME_CAN_HAVE_SCROLLBARS(f) (the_only_frame.can_have_scrollbars)
#define FRAME_SCROLLBARS(f) (the_only_frame.scrollbars)
#define FRAME_CONDEMNED_SCROLLBARS(f) (the_only_frame.condemned_scrollbars)
/* See comments in definition above. */
......@@ -398,14 +424,6 @@ extern int message_buf_print;
/* The number of columns a vertical scrollbar occupies. */
/* Turn a window's scrollbar member into a `struct scrollbar *';
return NULL if the window doesn't have a scrollbar. */
(XTYPE ((w)->vertical_scrollbar) == Lisp_Int \
? (struct scrollbar *) XPNTR ((w)->vertical_scrollbar) \
: (struct scrollbar *) 0)
/* Return the starting column (zero-based) of the vertical scrollbar
for window W. The column before this one is the last column we can
use for text. If the window touches the right edge of the frame,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment