aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Blandy1993-01-14 15:15:15 +0000
committerJim Blandy1993-01-14 15:15:15 +0000
commitec3f896ca772786663555e45b6630a9e446cae1a (patch)
tree1b2a6fb33b5384dea8561f4ab74b2ea0ac1b635d
parent371fbaebeff2ec56370a4643dcabccceca9a4f0e (diff)
downloademacs-ec3f896ca772786663555e45b6630a9e446cae1a.tar.gz
emacs-ec3f896ca772786663555e45b6630a9e446cae1a.zip
* termhooks.h (mouse_position_hook): Doc fix.
(set_vertical_scrollbar_hook): This doesn't return anything any more, and doesn't take a struct scrollbar * argument any more. (condemn_scrollbars_hook, redeem_scrollbar_hook, judge_scrollbars_hook): Doc fixes. * term.c (mouse_position_hook): Doc fix. (set_vertical_scrollbar_hook): This doesn't return anything any more. Doc fixes. * keyboard.c (kbd_buffer_get_event): Receive the scrollbar's window from *mouse_position_hook and pass it to make_lispy_movement, instead of working with a pointer to a struct scrollbar. (make_lispy_event): We don't need a window_from_scrollbar function anymore; we are given the window directly in *EVENT. Unify the code which generates text-area mouse clicks and scrollbar clicks; use the same code to distinguish clicks from drags on the scrollbar as in the text area. Distinguish clicks from drags by storing a copy of the lispy position list returned as part of the event. (button_down_location): Make this a lisp vector, rather than an array of random structures. (struct mouse_position): Remove this; it's been replaced by a lisp list. (make_lispy_movement): Accept the scrollbar's window as a parameter, rather than the scrollbar itself. If FRAME is zero, assume that the other arguments are garbage. (syms_of_keyboard): No need to staticpro each window of button_down_location now; just initialize and staticpro it. * window.c (window_from_scrollbar): Function deleted; no longer needed. * xdisp.c (redisplay_window): Just pass the window to set_vertical_scrollbar hook; don't pass the scrollbar object too. * xterm.c (XTmouse_position): Don't return a pointer to the scrollbar for scrollbar motion; instead, return the scrollbar's window. * termhooks.h (struct input_event): Replace the frame member with a Lisp_Object member by the name of frame_or_window. Doc fixes. Remove the scrollbar member; instead, use frame_or_window to hold the window whose scrollbar was clicked. * keyboard.c (kbd_buffer_store_event, kbd_buffer_get_event, make_lispy_event): Adjust references to frame member of struct input_event to use frame_or_window now. * xterm.c (construct_mouse_click, XTread_socket): Same.
-rw-r--r--src/termhooks.h154
1 files changed, 102 insertions, 52 deletions
diff --git a/src/termhooks.h b/src/termhooks.h
index 63be5709999..9b2c0146ce0 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -1,6 +1,6 @@
1/* Hooks by which low level terminal operations 1/* Hooks by which low level terminal operations
2 can be made to call other routines. 2 can be made to call other routines.
3 Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc. 3 Copyright (C) 1985, 1986, 1992, 1993 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -18,6 +18,14 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs; see the file COPYING. If not, write to 18along with GNU Emacs; see the file COPYING. If not, write to
19the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 19the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20 20
21
22/* Miscellanea. */
23
24/* If nonzero, send all terminal output characters to this stream also. */
25extern FILE *termscript;
26
27
28/* Text display hooks. */
21 29
22extern int (*cursor_to_hook) (); 30extern int (*cursor_to_hook) ();
23extern int (*raw_cursor_to_hook) (); 31extern int (*raw_cursor_to_hook) ();
@@ -43,7 +51,9 @@ extern int (*update_begin_hook) ();
43extern int (*update_end_hook) (); 51extern int (*update_end_hook) ();
44extern int (*set_terminal_window_hook) (); 52extern int (*set_terminal_window_hook) ();
45 53
46extern int (*read_socket_hook) (); 54
55
56/* Multi-frame and mouse support hooks. */
47 57
48enum scrollbar_part { 58enum scrollbar_part {
49 scrollbar_above_handle, 59 scrollbar_above_handle,
@@ -52,11 +62,25 @@ enum scrollbar_part {
52}; 62};
53 63
54/* Return the current position of the mouse. 64/* Return the current position of the mouse.
55 Set `bar' to point to the scrollbar if the mouse movement started 65
56 in a scrollbar, or zero if it started elsewhere in the frame. 66 Set *f to the frame the mouse is in, or zero if the mouse is in no
57 This should clear mouse_moved until the next motion event arrives. */ 67 Emacs frame. If it is set to zero, all the other arguments are
68 garbage.
69
70 If the motion started in a scrollbar, set *bar_window to the
71 scrollbar's window, *part to the part the mouse is currently over,
72 *x to the position of the mouse along the scrollbar, and *y to the
73 overall length of the scrollbar.
74
75 Otherwise, set *bar_window to Qnil, and *x and *y to the column and
76 row of the character cell the mouse is over.
77
78 Set *time to the time the mouse was at the returned position.
79
80 This should clear mouse_moved until the next motion
81 event arrives. */
58extern void (*mouse_position_hook) ( /* FRAME_PTR *f, 82extern void (*mouse_position_hook) ( /* FRAME_PTR *f,
59 struct scrollbar **bar, 83 Lisp_Object *bar_window,
60 enum scrollbar_part *part, 84 enum scrollbar_part *part,
61 Lisp_Object *x, 85 Lisp_Object *x,
62 Lisp_Object *y, 86 Lisp_Object *y,
@@ -72,15 +96,38 @@ extern int mouse_moved;
72 X, this means that Emacs lies about where the focus is. */ 96 X, this means that Emacs lies about where the focus is. */
73extern void (*frame_rehighlight_hook) ( /* void */ ); 97extern void (*frame_rehighlight_hook) ( /* void */ );
74 98
75/* Set vertical scollbar BAR to have its upper left corner at (TOP, 99
76 LEFT), and be LENGTH rows high. Set its handle to indicate that we 100
77 are displaying PORTION characters out of a total of WHOLE 101/* Scrollbar hooks. */
78 characters, starting at POSITION. Return BAR. If BAR is zero, 102
79 create a new scrollbar and return a pointer to it. */ 103/* The representation of scrollbars is determined by the code which
80extern struct scrollbar *(*set_vertical_scrollbar_hook) 104 implements them, except for one thing: they must be represented by
81 ( /* struct scrollbar *BAR, 105 lisp objects. This allows us to place references to them in
82 struct window *window, 106 Lisp_Windows without worrying about those references becoming
83 int portion, int whole, int position */ ); 107 dangling references when the scrollbar is destroyed.
108
109 The window-system-independent portion of Emacs just refers to
110 scrollbars via their windows, and never looks inside the scrollbar
111 representation; it always uses hook functions to do all the
112 scrollbar manipulation it needs.
113
114 The `vertical_scrollbar' field of a Lisp_Window refers to that
115 window's scrollbar, or is nil if the window doesn't have a
116 scrollbar.
117
118 The `scrollbars' and `condemned_scrollbars' fields of a Lisp_Frame
119 are free for use by the scrollbar implementation in any way it sees
120 fit. They are marked by the garbage collector. */
121
122
123/* Set the vertical scrollbar for WINDOW to have its upper left corner
124 at (TOP, LEFT), and be LENGTH rows high. Set its handle to
125 indicate that we are displaying PORTION characters out of a total
126 of WHOLE characters, starting at POSITION. If WINDOW doesn't yet
127 have a scrollbar, create one for it. */
128extern void (*set_vertical_scrollbar_hook)
129 ( /* struct window *window,
130 int portion, int whole, int position */ );
84 131
85 132
86/* The following three hooks are used when we're doing a thorough 133/* The following three hooks are used when we're doing a thorough
@@ -93,20 +140,39 @@ extern struct scrollbar *(*set_vertical_scrollbar_hook)
93 140
94/* Arrange for all scrollbars on FRAME to be removed at the next call 141/* Arrange for all scrollbars on FRAME to be removed at the next call
95 to `*judge_scrollbars_hook'. A scrollbar may be spared if 142 to `*judge_scrollbars_hook'. A scrollbar may be spared if
96 `*redeem_scrollbar_hook' is applied to it before the judgement. */ 143 `*redeem_scrollbar_hook' is applied to its window before the judgement.
97extern void (*condemn_scrollbars_hook)( /* FRAME_PTR *FRAME */ ); 144
145 This should be applied to each frame each time its window tree is
146 redisplayed, even if it is not displaying scrollbars at the moment;
147 if the HAS_SCROLLBARS flag has just been turned off, only calling
148 this and the judge_scrollbars_hook will get rid of them.
98 149
99/* Unmark BAR for deletion in this judgement cycle. */ 150 If non-zero, this hook should be safe to apply to any frame,
100extern void (*redeem_scrollbar_hook)( /* struct scrollbar *BAR */ ); 151 whether or not it can support scrollbars, and whether or not it is
152 currently displaying them. */
153extern void (*condemn_scrollbars_hook)( /* FRAME_PTR *frame */ );
154
155/* Unmark WINDOW's scrollbar for deletion in this judgement cycle.
156 Note that it's okay to redeem a scrollbar that is not condemned. */
157extern void (*redeem_scrollbar_hook)( /* struct window *window */ );
101 158
102/* Remove all scrollbars on FRAME that haven't been saved since the 159/* Remove all scrollbars on FRAME that haven't been saved since the
103 last call to `*condemn_scrollbars_hook'. */ 160 last call to `*condemn_scrollbars_hook'.
104extern void (*judge_scrollbars_hook)( /* FRAME_PTR *FRAME */ );
105 161
162 This should be applied to each frame after each time its window
163 tree is redisplayed, even if it is not displaying scrollbars at the
164 moment; if the HAS_SCROLLBARS flag has just been turned off, only
165 calling this and condemn_scrollbars_hook will get rid of them.
106 166
167 If non-zero, this hook should be safe to apply to any frame,
168 whether or not it can support scrollbars, and whether or not it is
169 currently displaying them. */
170extern void (*judge_scrollbars_hook)( /* FRAME_PTR *FRAME */ );
107 171
108/* If nonzero, send all terminal output characters to this stream also. */ 172
109extern FILE *termscript; 173/* Input queue declarations and hooks. */
174
175extern int (*read_socket_hook) ();
110 176
111/* Expedient hack: only provide the below definitions to files that 177/* Expedient hack: only provide the below definitions to files that
112 are prepared to handle lispy things. XINT is defined iff lisp.h 178 are prepared to handle lispy things. XINT is defined iff lisp.h
@@ -125,8 +191,8 @@ struct input_event {
125 no_event, /* nothing happened. This should never 191 no_event, /* nothing happened. This should never
126 actually appear in the event queue. */ 192 actually appear in the event queue. */
127 ascii_keystroke, /* The ASCII code is in .code. 193 ascii_keystroke, /* The ASCII code is in .code.
128 .frame is the frame in which the key 194 .frame_or_window is the frame in
129 was typed. 195 which the key was typed.
130 Note that this includes meta-keys, and 196 Note that this includes meta-keys, and
131 the modifiers field of the event 197 the modifiers field of the event
132 is unused. 198 is unused.
@@ -140,8 +206,8 @@ struct input_event {
140 should feel free to add missing keys. 206 should feel free to add missing keys.
141 .modifiers holds the state of the 207 .modifiers holds the state of the
142 modifier keys. 208 modifier keys.
143 .frame is the frame in which the key 209 .frame_or_window is the frame in
144 was typed. 210 which the key was typed.
145 .timestamp gives a timestamp (in 211 .timestamp gives a timestamp (in
146 milliseconds) for the keystroke. */ 212 milliseconds) for the keystroke. */
147 mouse_click, /* The button number is in .code; it must 213 mouse_click, /* The button number is in .code; it must
@@ -151,48 +217,32 @@ struct input_event {
151 modifier keys. 217 modifier keys.
152 .x and .y give the mouse position, 218 .x and .y give the mouse position,
153 in characters, within the window. 219 in characters, within the window.
154 .frame gives the frame the mouse 220 .frame_or_window gives the frame
155 click occurred in. 221 the mouse click occurred in.
156 .timestamp gives a timestamp (in 222 .timestamp gives a timestamp (in
157 milliseconds) for the click. */ 223 milliseconds) for the click. */
158
159 scrollbar_click, /* .code gives the number of the mouse button 224 scrollbar_click, /* .code gives the number of the mouse button
160 that was clicked. 225 that was clicked.
161 .modifiers holds the state of the modifier 226 .modifiers holds the state of the modifier
162 keys. 227 keys.
163 .part is a lisp symbol indicating which 228 .part is a lisp symbol indicating which
164 part of the scrollbar got clicked. 229 part of the scrollbar got clicked.
165 .scrollbar is a pointer to the scrollbar
166 clicked on. Since redisplay may delete
167 scrollbars at any time, you may not assume
168 that this scrollbar still exists when you
169 dequeue this event. You have to traverse
170 the window tree to make it's in a valid
171 window.
172 .x gives the distance from the start of the 230 .x gives the distance from the start of the
173 scroll bar of the click; .y gives the total 231 scroll bar of the click; .y gives the total
174 length of the scroll bar. 232 length of the scroll bar.
175 .frame gives the frame the click should 233 .frame_or_window gives the window
176 apply to. 234 whose scrollbar was clicked in.
177 .timestamp gives a timestamp (in 235 .timestamp gives a timestamp (in
178 milliseconds) for the click. */ 236 milliseconds) for the click. */
179 } kind; 237 } kind;
180 238
181 Lisp_Object code; 239 Lisp_Object code;
182 enum scrollbar_part part; 240 enum scrollbar_part part;
183 struct scrollbar *scrollbar; 241
184 242 /* This field is copied into a vector while the event is in the queue,
185/* This is obviously wrong, but I'm not sure what else I should do. 243 so that garbage collections won't kill it. */
186 Obviously, this should be a FRAME_PTR. But that would require that 244 Lisp_Object frame_or_window;
187 every file which #includes this one should also #include "frame.h", 245
188 which would mean that files like cm.c and other innocents would be
189 dragged into the set of frame.h users. Maybe the definition of this
190 structure should be elsewhere? In its own file? */
191#ifdef MULTI_FRAME
192 struct frame *frame;
193#else
194 int frame;
195#endif
196 int modifiers; /* See enum below for interpretation. */ 246 int modifiers; /* See enum below for interpretation. */
197 247
198 Lisp_Object x, y; 248 Lisp_Object x, y;