aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1992-12-24 06:07:02 +0000
committerJim Blandy1992-12-24 06:07:02 +0000
commit46a5c4874d68d66681a783226a3a5bd139136d21 (patch)
treead9a67526bd14ab0a0f4b6b77e8d1faad1d16834 /src
parenta42e972438ae75e95e6cb4ff25db244b4d8fb4fa (diff)
downloademacs-46a5c4874d68d66681a783226a3a5bd139136d21.tar.gz
emacs-46a5c4874d68d66681a783226a3a5bd139136d21.zip
* frame.h (struct frame): New fields `can_have_scrollbars' and
`has_vertical_scrollbars'. (FRAME_CAN_HAVE_SCROLLBARS, FRAME_HAS_VERTICAL_SCROLLBARS): New accessors, for both the MULTI_FRAME and non-MULTI_FRAME. (VERTICAL_SCROLLBAR_WIDTH, WINDOW_VERTICAL_SCROLLBAR, WINDOW_VERTICAL_SCROLLBAR_COLUMN, WINDOW_VERTICAL_SCROLLBAR_HEIGHT): New macros. * 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. (VERTICAL_SCROLLBAR_PIXEL_WIDTH, VERTICAL_SCROLLBAR_PIXEL_HEIGHT, VERTICAL_SCROLLBAR_LEFT_BORDER, VERTICAL_SCROLLBAR_RIGHT_BORDER, VERTICAL_SCROLLBAR_TOP_BORDER, VERTICAL_SCROLLBAR_BOTTOM_BORDER, CHAR_TO_PIXEL_WIDTH, CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_WIDTH, 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 scrollbars. (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 variables. (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 PIXEL_TO_CHAR_HEIGHT macros. * 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 selected_frame. * 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 FRAME_ICONIFIED_P. * 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.
Diffstat (limited to 'src')
-rw-r--r--src/frame.h67
1 files changed, 61 insertions, 6 deletions
diff --git a/src/frame.h b/src/frame.h
index d15526951e1..6f63e4e2ec4 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -77,9 +77,16 @@ struct frame
77 Lisp_Object name; 77 Lisp_Object name;
78 78
79 /* The frame which should recieve keystrokes that occur in this 79 /* The frame which should recieve keystrokes that occur in this
80 frame. This is usually the frame itself, but if the frame is 80 frame, or nil if they should go to the frame itself. This is
81 minibufferless, this points to the minibuffer frame when it is 81 usually nil, but if the frame is minibufferless, we can use this
82 active. */ 82 to redirect keystrokes to a surrogate minibuffer frame when
83 needed.
84
85 Note that a value of nil is different than having the field point
86 to the frame itself. Whenever the Fselect_frame function is used
87 to shift from one frame to the other, any redirections to the
88 original frame are shifted to the newly selected frame; if
89 focus_frame is nil, Fselect_frame will leave it alone. */
83 Lisp_Object focus_frame; 90 Lisp_Object focus_frame;
84 91
85 /* This frame's root window. Every frame has one. 92 /* This frame's root window. Every frame has one.
@@ -118,6 +125,7 @@ struct frame
118 125
119 /* visible is nonzero if the frame is currently displayed; we check 126 /* visible is nonzero if the frame is currently displayed; we check
120 it to see if we should bother updating the frame's contents. 127 it to see if we should bother updating the frame's contents.
128 DON'T SET IT DIRECTLY; instead, use FRAME_SET_VISIBLE.
121 129
122 iconified is nonzero if the frame is currently iconified. 130 iconified is nonzero if the frame is currently iconified.
123 131
@@ -155,6 +163,14 @@ struct frame
155 show no modeline for that window. */ 163 show no modeline for that window. */
156 char wants_modeline; 164 char wants_modeline;
157 165
166 /* Non-zero if the hardware device this frame is displaying on can
167 support scrollbars. */
168 char can_have_scrollbars;
169
170 /* If can_have_scrollbars is non-zero, this is non-zero if we should
171 actually display them on this frame. */
172 char has_vertical_scrollbars;
173
158 /* Non-0 means raise this frame to the top of the heap when selected. */ 174 /* Non-0 means raise this frame to the top of the heap when selected. */
159 char auto_raise; 175 char auto_raise;
160 176
@@ -203,7 +219,9 @@ typedef struct frame *FRAME_PTR;
203#define FRAME_NEW_WIDTH(f) (f)->new_width 219#define FRAME_NEW_WIDTH(f) (f)->new_width
204#define FRAME_CURSOR_X(f) (f)->cursor_x 220#define FRAME_CURSOR_X(f) (f)->cursor_x
205#define FRAME_CURSOR_Y(f) (f)->cursor_y 221#define FRAME_CURSOR_Y(f) (f)->cursor_y
206#define FRAME_VISIBLE_P(f) (f)->visible 222#define FRAME_VISIBLE_P(f) ((f)->visible != 0)
223#define FRAME_SET_VISIBLE(f,p) \
224 ((f)->async_visible = (p), FRAME_SAMPLE_VISIBILITY (f))
207#define SET_FRAME_GARBAGED(f) (frame_garbaged = 1, f->garbaged = 1) 225#define SET_FRAME_GARBAGED(f) (frame_garbaged = 1, f->garbaged = 1)
208#define FRAME_GARBAGED_P(f) (f)->garbaged 226#define FRAME_GARBAGED_P(f) (f)->garbaged
209#define FRAME_NO_SPLIT_P(f) (f)->no_split 227#define FRAME_NO_SPLIT_P(f) (f)->no_split
@@ -220,6 +238,8 @@ typedef struct frame *FRAME_PTR;
220#define FRAME_MESSAGE_BUF(f) (f)->message_buf 238#define FRAME_MESSAGE_BUF(f) (f)->message_buf
221#define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos 239#define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos
222#define FRAME_FOCUS_FRAME(f) (f)->focus_frame 240#define FRAME_FOCUS_FRAME(f) (f)->focus_frame
241#define FRAME_CAN_HAVE_SCROLLBARS(f) ((f)->can_have_scrollbars)
242#define FRAME_HAS_VERTICAL_SCROLLBARS(f) ((f)->has_vertical_scrollbars)
223 243
224/* Emacs's redisplay code could become confused if a frame's 244/* Emacs's redisplay code could become confused if a frame's
225 visibility changes at arbitrary times. For example, if a frame is 245 visibility changes at arbitrary times. For example, if a frame is
@@ -237,7 +257,9 @@ typedef struct frame *FRAME_PTR;
237 the async_visible and async_iconified flags; the redisplay code 257 the async_visible and async_iconified flags; the redisplay code
238 calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay, 258 calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay,
239 which sets visible and iconified from their asynchronous 259 which sets visible and iconified from their asynchronous
240 counterparts. */ 260 counterparts.
261
262 Synchronous code must use the FRAME_SET_VISIBLE macro. */
241#define FRAME_SAMPLE_VISIBILITY(f) \ 263#define FRAME_SAMPLE_VISIBILITY(f) \
242 ((f)->visible = (f)->async_visible, \ 264 ((f)->visible = (f)->async_visible, \
243 (f)->iconified = (f)->async_iconified) 265 (f)->iconified = (f)->async_iconified)
@@ -327,6 +349,7 @@ extern int message_buf_print;
327#define FRAME_NEW_WIDTH(f) (the_only_frame.new_width) 349#define FRAME_NEW_WIDTH(f) (the_only_frame.new_width)
328#define FRAME_CURSOR_X(f) (the_only_frame.cursor_x) 350#define FRAME_CURSOR_X(f) (the_only_frame.cursor_x)
329#define FRAME_CURSOR_Y(f) (the_only_frame.cursor_y) 351#define FRAME_CURSOR_Y(f) (the_only_frame.cursor_y)
352#define FRAME_SET_VISIBLE(f,p) (p)
330#define FRAME_VISIBLE_P(f) 1 353#define FRAME_VISIBLE_P(f) 1
331#define SET_FRAME_GARBAGED(f) (frame_garbaged = 1) 354#define SET_FRAME_GARBAGED(f) (frame_garbaged = 1)
332#define FRAME_GARBAGED_P(f) (frame_garbaged) 355#define FRAME_GARBAGED_P(f) (frame_garbaged)
@@ -343,7 +366,10 @@ extern int message_buf_print;
343#define FRAME_DELETEN_COST(frame) (the_only_frame.delete_n_lines_cost) 366#define FRAME_DELETEN_COST(frame) (the_only_frame.delete_n_lines_cost)
344#define FRAME_MESSAGE_BUF(f) (the_only_frame.message_buf) 367#define FRAME_MESSAGE_BUF(f) (the_only_frame.message_buf)
345#define FRAME_SCROLL_BOTTOM_VPOS(f) (the_only_frame.scroll_bottom_vpos) 368#define FRAME_SCROLL_BOTTOM_VPOS(f) (the_only_frame.scroll_bottom_vpos)
346#define FRAME_FOCUS_FRAME(f) (0) 369#define FRAME_FOCUS_FRAME(f) (Qnil)
370#define FRAME_CAN_HAVE_SCROLLBARS(f) (the_only_frame.can_have_scrollbars)
371#define FRAME_HAS_VERTICAL_SCROLLBARS(f) \
372 (the_only_frame.has_vertical_scrollbars)
347 373
348/* See comments in definition above. */ 374/* See comments in definition above. */
349#define FRAME_SAMPLE_VISIBILITY(f) (0) 375#define FRAME_SAMPLE_VISIBILITY(f) (0)
@@ -365,3 +391,32 @@ extern int message_buf_print;
365 for (frame_var = (FRAME_PTR) 1; frame_var; frame_var = (FRAME_PTR) 0) 391 for (frame_var = (FRAME_PTR) 1; frame_var; frame_var = (FRAME_PTR) 0)
366 392
367#endif /* not MULTI_FRAME */ 393#endif /* not MULTI_FRAME */
394
395
396/* Device- and MULTI_FRAME-independent scrollbar stuff. */
397
398/* The number of columns a vertical scrollbar occupies. */
399#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
409/* 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
411 use for text. If the window touches the right edge of the frame,
412 we have extra space allocated for it. Otherwise, the scrollbar
413 takes over the window's rightmost columns. */
414#define WINDOW_VERTICAL_SCROLLBAR_COLUMN(w) \
415 (((XINT ((w)->left) + XINT ((w)->width)) \
416 < FRAME_WIDTH (XFRAME (WINDOW_FRAME (w)))) \
417 ? XINT ((w)->left) + XINT ((w)->width) - VERTICAL_SCROLLBAR_WIDTH \
418 : FRAME_WIDTH (XFRAME (WINDOW_FRAME (w))))
419
420/* Return the height in lines of the vertical scrollbar in w. If the
421 window has a mode line, don't make the scrollbar extend that far. */
422#define WINDOW_VERTICAL_SCROLLBAR_HEIGHT(w) (window_internal_height (w))