Commit 46a5c487 authored by Jim Blandy's avatar Jim Blandy
Browse files

* frame.h (struct frame): New fields `can_have_scrollbars' and

	accessors, for both the MULTI_FRAME and non-MULTI_FRAME.
	* window.h (struct window): New field `vertical_scrollbar'.
	* xterm.h (struct x_display): vertical_scrollbars,
	judge_timestamp, vertical_scrollbar_extra: New fields.
	(struct scrollbar): New struct.
	PIXEL_TO_CHAR_HEIGHT): New accessors and macros.
	* frame.c (make_frame): Initialize the `can_have_scrollbars' and
	`has_vertical_scrollbars' fields of the frame.
	* term.c (term_init): Note that TERMCAP terminals don't support
	(mouse_position_hook): Document new args.
	(set_vertical_scrollbar_hook, condemn_scrollbars_hook,
	redeem_scrollbar_hook, judge_scrollbars_hook): New hooks.
	* termhooks.h: Declare and document them.
	(enum scrollbar_part): New type.
	(struct input_event): Describe the new form of the scrollbar_click
	event type.  Change `part' from a Lisp_Object to an enum
	scrollbar_part.  Add a new field `scrollbar'.
	* keyboard.c (kbd_buffer_get_event): Pass appropriate new
	parameters to *mouse_position_hook, and make_lispy_movement.
	* xfns.c (x_set_vertical_scrollbar): New function.
	(x_figure_window_size): Use new macros to calculate frame size.
	(Fx_create_frame): Note that X Windows frames do support scroll
	bars.  Default to "yes".
	* xterm.c: #include <X11/cursorfont.h> and "window.h".
	(x_vertical_scrollbar_cursor): New variable.
	(x_term_init): Initialize it.
	(last_mouse_bar, last_mouse_bar_frame, last_mouse_part,
	last_mouse_scroll_range_start, last_mouse_scroll_range_end): New
	(XTmouse_position): Use them to return scrollbar movement events.
	Take new arguments, for that purpose.
	(x_window_to_scrollbar, x_scrollbar_create,
	x_scrollbar_set_handle, x_scrollbar_remove, x_scrollbar_move,
	XTset_scrollbar, XTcondemn_scrollbars, XTredeem_scrollbar,
	XTjudge_scrollbars, x_scrollbar_expose,
	x_scrollbar_background_expose, x_scrollbar_handle_click,
	x_scrollbar_handle_motion): New functions to implement scrollbars.
	(x_term_init): Set the termhooks.h hooks to point to them.
	(x_set_window_size): Use new macros to calculate frame size.  Set
	vertical_scrollbar_extra field.
	(x_make_frame_visible): Use the frame accessor
	FRAME_HAS_VERTICAL_SCROLLBARS to decide if we need to map the
	frame's subwindows as well.
	(XTread_socket): Use new size-calculation macros from xterm.h when
	processing ConfigureNotify events.
	(x_wm_set_size_hint): Use PIXEL_TO_CHAR_WIDTH and
	* ymakefile (xdisp.o): This now depends on termhooks.h.
	(xterm.o): This now depends on window.h.

	Change the meaning of focus redirection to make switching windows
	work properly.  Fredirect_frame_focus has the details.
	* frame.h (focus_frame): Doc fix.
	[not MULTI_FRAME] (FRAME_FOCUS_FRAME): Make this Qnil, which
	indicates no focus redirection, instead of zero, which is
	* frame.c (make_frame): Initialize f->focus_frame to Qnil, rather
	than making it point to frame itself.
	(Fselect_frame): If changing the selected frame from FOO to BAR,
	make all redirections to FOO shift to BAR as well.  Doc fix.
	(Fredirect_frame_focus): Doc fix.  Accept nil as a valid
	redirection, not just as a default for FRAME.
	(Fframe_focus): Doc fix.
	* keyboard.c (kbd_buffer_store_event, kbd_buffer_get_event): Deal
	with focus redirections being nil.
	* xterm.c (XTframe_rehighlight): Doc fix.  Deal with focus
	redirections being nil.

	It's a pain to remember that you can't assign to FRAME->visible.
	Let's change all references to the `visible' member of struct
	frame to use the accessor macros, and then write a setter for the
	`visible' field that does the right thing.
	* frame.h (FRAME_VISIBLE_P): Make this not an l-value.
	(FRAME_SET_VISIBLE): New macro.
	* frame.c (make_terminal_frame, Fdelete_frame): Use FRAME_SET_VISIBLE.
	(Fframe_visible_p, Fvisible_frame_list): Use FRAME_VISIBLE_P and
	* dispnew.c (Fredraw_display): Use the FRAME_VISIBLE_P and
	FRAME_GARBAGED_P accessors.
	* xdisp.c (redisplay): Use the FRAME_VISIBLE_P accessor.
	* xfns.c (x_set_foreground_color, x_set_background_color,
	x_set_cursor_color, x_set_border_pixel, x_set_icon_type): Use the
	FRAME_VISIBLE_P accessor.
	(Fx_create_frame): Use FRAME_SET_VISIBILITY.
	* xterm.c (clear_cursor, x_display_bar_cursor,
	x_display_box_cursor): Use FRAME_SET_VISIBILITY.
parent a42e9724
......@@ -77,9 +77,16 @@ struct frame
Lisp_Object name;
/* The frame which should recieve keystrokes that occur in this
frame. This is usually the frame itself, but if the frame is
minibufferless, this points to the minibuffer frame when it is
active. */
frame, or nil if they should go to the frame itself. This is
usually nil, but if the frame is minibufferless, we can use this
to redirect keystrokes to a surrogate minibuffer frame when
Note that a value of nil is different than having the field point
to the frame itself. Whenever the Fselect_frame function is used
to shift from one frame to the other, any redirections to the
original frame are shifted to the newly selected frame; if
focus_frame is nil, Fselect_frame will leave it alone. */
Lisp_Object focus_frame;
/* This frame's root window. Every frame has one.
......@@ -118,6 +125,7 @@ struct frame
/* visible is nonzero if the frame is currently displayed; we check
it to see if we should bother updating the frame's contents.
iconified is nonzero if the frame is currently iconified.
......@@ -155,6 +163,14 @@ struct frame
show no modeline for that window. */
char wants_modeline;
/* Non-zero if the hardware device this frame is displaying on can
support scrollbars. */
char can_have_scrollbars;
/* If can_have_scrollbars is non-zero, this is non-zero if we should
actually display them on this frame. */
char has_vertical_scrollbars;
/* Non-0 means raise this frame to the top of the heap when selected. */
char auto_raise;
......@@ -203,7 +219,9 @@ typedef struct frame *FRAME_PTR;
#define FRAME_NEW_WIDTH(f) (f)->new_width
#define FRAME_CURSOR_X(f) (f)->cursor_x
#define FRAME_CURSOR_Y(f) (f)->cursor_y
#define FRAME_VISIBLE_P(f) (f)->visible
#define FRAME_VISIBLE_P(f) ((f)->visible != 0)
#define FRAME_SET_VISIBLE(f,p) \
((f)->async_visible = (p), FRAME_SAMPLE_VISIBILITY (f))
#define SET_FRAME_GARBAGED(f) (frame_garbaged = 1, f->garbaged = 1)
#define FRAME_GARBAGED_P(f) (f)->garbaged
#define FRAME_NO_SPLIT_P(f) (f)->no_split
......@@ -220,6 +238,8 @@ typedef struct frame *FRAME_PTR;
#define FRAME_MESSAGE_BUF(f) (f)->message_buf
#define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos
#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)
/* Emacs's redisplay code could become confused if a frame's
visibility changes at arbitrary times. For example, if a frame is
......@@ -237,7 +257,9 @@ typedef struct frame *FRAME_PTR;
the async_visible and async_iconified flags; the redisplay code
calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay,
which sets visible and iconified from their asynchronous
counterparts. */
Synchronous code must use the FRAME_SET_VISIBLE macro. */
((f)->visible = (f)->async_visible, \
(f)->iconified = (f)->async_iconified)
......@@ -327,6 +349,7 @@ extern int message_buf_print;
#define FRAME_NEW_WIDTH(f) (the_only_frame.new_width)
#define FRAME_CURSOR_X(f) (the_only_frame.cursor_x)
#define FRAME_CURSOR_Y(f) (the_only_frame.cursor_y)
#define FRAME_SET_VISIBLE(f,p) (p)
#define FRAME_VISIBLE_P(f) 1
#define SET_FRAME_GARBAGED(f) (frame_garbaged = 1)
#define FRAME_GARBAGED_P(f) (frame_garbaged)
......@@ -343,7 +366,10 @@ extern int message_buf_print;
#define FRAME_DELETEN_COST(frame) (the_only_frame.delete_n_lines_cost)
#define FRAME_MESSAGE_BUF(f) (the_only_frame.message_buf)
#define FRAME_SCROLL_BOTTOM_VPOS(f) (the_only_frame.scroll_bottom_vpos)
#define FRAME_FOCUS_FRAME(f) (0)
#define FRAME_FOCUS_FRAME(f) (Qnil)
#define FRAME_CAN_HAVE_SCROLLBARS(f) (the_only_frame.can_have_scrollbars)
/* See comments in definition above. */
......@@ -365,3 +391,32 @@ extern int message_buf_print;
for (frame_var = (FRAME_PTR) 1; frame_var; frame_var = (FRAME_PTR) 0)
#endif /* not MULTI_FRAME */
/* Device- and MULTI_FRAME-independent scrollbar stuff. */
/* 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,
we have extra space allocated for it. Otherwise, the scrollbar
takes over the window's rightmost columns. */
(((XINT ((w)->left) + XINT ((w)->width)) \
? XINT ((w)->left) + XINT ((w)->width) - VERTICAL_SCROLLBAR_WIDTH \
/* Return the height in lines of the vertical scrollbar in w. If the
window has a mode line, don't make the scrollbar extend that far. */
#define WINDOW_VERTICAL_SCROLLBAR_HEIGHT(w) (window_internal_height (w))
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