428
|
1 /* Generic scrollbar implementation.
|
|
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
|
|
3 Copyright (C) 1995 Free Software Foundation, Inc.
|
|
4 Copyright (C) 1995 Sun Microsystems, Inc.
|
|
5 Copyright (C) 1995 Darrell Kindred <dkindred+@cmu.edu>.
|
|
6
|
|
7 This file is part of XEmacs.
|
|
8
|
|
9 XEmacs is free software; you can redistribute it and/or modify it
|
|
10 under the terms of the GNU General Public License as published by the
|
|
11 Free Software Foundation; either version 2, or (at your option) any
|
|
12 later version.
|
|
13
|
|
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
17 for more details.
|
|
18
|
|
19 You should have received a copy of the GNU General Public License
|
|
20 along with XEmacs; see the file COPYING. If not, write to
|
|
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
22 Boston, MA 02111-1307, USA. */
|
|
23
|
|
24 /* Synched up with: Not in FSF. */
|
|
25
|
|
26 /* This file has been Mule-ized. */
|
|
27
|
|
28 #include <config.h>
|
|
29 #include "lisp.h"
|
|
30
|
|
31 #include "buffer.h"
|
|
32 #include "commands.h"
|
|
33 #include "scrollbar.h"
|
872
|
34 #include "device-impl.h"
|
|
35 #include "frame-impl.h"
|
428
|
36 #include "glyphs.h"
|
|
37 #include "gutter.h"
|
|
38 #include "window.h"
|
|
39
|
|
40 Lisp_Object Qinit_scrollbar_from_resources;
|
|
41
|
|
42 Lisp_Object Qscrollbar_line_up;
|
|
43 Lisp_Object Qscrollbar_line_down;
|
|
44 Lisp_Object Qscrollbar_page_up;
|
|
45 Lisp_Object Qscrollbar_page_down;
|
|
46 Lisp_Object Qscrollbar_to_top;
|
|
47 Lisp_Object Qscrollbar_to_bottom;
|
|
48 Lisp_Object Qscrollbar_vertical_drag;
|
|
49
|
|
50 Lisp_Object Qscrollbar_char_left;
|
|
51 Lisp_Object Qscrollbar_char_right;
|
|
52 Lisp_Object Qscrollbar_page_left;
|
|
53 Lisp_Object Qscrollbar_page_right;
|
|
54 Lisp_Object Qscrollbar_to_left;
|
|
55 Lisp_Object Qscrollbar_to_right;
|
|
56 Lisp_Object Qscrollbar_horizontal_drag;
|
|
57
|
|
58 #define DEFAULT_SCROLLBAR_WIDTH 15
|
|
59 #define DEFAULT_SCROLLBAR_HEIGHT 15
|
|
60
|
|
61 /* Width and height of the scrollbar. */
|
|
62 Lisp_Object Vscrollbar_width;
|
|
63 Lisp_Object Vscrollbar_height;
|
|
64
|
|
65 /* Scrollbar visibility specifiers */
|
|
66 Lisp_Object Vhorizontal_scrollbar_visible_p;
|
|
67 Lisp_Object Vvertical_scrollbar_visible_p;
|
|
68
|
|
69 /* Scrollbar location specifiers */
|
|
70 Lisp_Object Vscrollbar_on_left_p;
|
|
71 Lisp_Object Vscrollbar_on_top_p;
|
|
72
|
|
73 Lisp_Object Vscrollbar_pointer_glyph;
|
|
74
|
|
75 EXFUN (Fcenter_to_window_line, 2);
|
|
76
|
|
77 static void update_scrollbar_instance (struct window *w, int vertical,
|
|
78 struct scrollbar_instance *instance);
|
|
79
|
934
|
80 #ifdef USE_KKCC
|
|
81 static const struct lrecord_description scrollbar_instance_description [] = {
|
|
82 { XD_LISP_OBJECT, offsetof (struct scrollbar_instance, mirror) },
|
|
83 { XD_LISP_OBJECT, offsetof (struct scrollbar_instance, next) },
|
|
84 { XD_END }
|
|
85 };
|
|
86 #endif /* USE_KKCC */
|
|
87
|
428
|
88
|
617
|
89 static Lisp_Object
|
|
90 mark_scrollbar_instance (Lisp_Object obj)
|
|
91 {
|
|
92 struct scrollbar_instance *data = XSCROLLBAR_INSTANCE (obj);
|
|
93 mark_object (wrap_window_mirror (data->mirror));
|
|
94 if (data->next)
|
|
95 return wrap_scrollbar_instance (data->next);
|
|
96 else
|
|
97 return Qnil;
|
|
98 }
|
|
99
|
934
|
100 #ifdef USE_KKCC
|
|
101 DEFINE_LRECORD_IMPLEMENTATION ("scrollbar-instance", scrollbar_instance,
|
|
102 0, /*dumpable-flag*/
|
|
103 mark_scrollbar_instance,
|
|
104 internal_object_printer, 0, 0, 0,
|
|
105 scrollbar_instance_description,
|
|
106 struct scrollbar_instance);
|
|
107 #else /* not USE_KKCC */
|
617
|
108 DEFINE_LRECORD_IMPLEMENTATION ("scrollbar-instance", scrollbar_instance,
|
|
109 mark_scrollbar_instance,
|
|
110 internal_object_printer, 0, 0, 0, 0,
|
|
111 struct scrollbar_instance);
|
934
|
112 #endif /* not USE_KKCC */
|
617
|
113
|
428
|
114 static void
|
|
115 free_scrollbar_instance (struct scrollbar_instance *instance,
|
|
116 struct frame *frame)
|
|
117 {
|
|
118 if (!instance)
|
|
119 return;
|
|
120 else
|
|
121 {
|
|
122 struct device *d = XDEVICE (frame->device);
|
|
123
|
|
124 MAYBE_DEVMETH (d, free_scrollbar_instance, (instance));
|
617
|
125 /* not worth calling free_managed_lcrecord() -- scrollbar instances
|
|
126 are not created that frequently and it's dangerous. */
|
428
|
127 }
|
|
128 }
|
|
129
|
|
130 static void
|
|
131 free_window_mirror_scrollbars (struct window_mirror *mir)
|
|
132 {
|
|
133 free_scrollbar_instance (mir->scrollbar_vertical_instance, mir->frame);
|
|
134 mir->scrollbar_vertical_instance = 0;
|
|
135
|
|
136 free_scrollbar_instance (mir->scrollbar_horizontal_instance, mir->frame);
|
|
137 mir->scrollbar_horizontal_instance = 0;
|
|
138 }
|
|
139
|
|
140 static struct window_mirror *
|
|
141 free_scrollbars_loop (Lisp_Object window, struct window_mirror *mir)
|
|
142 {
|
|
143 struct window_mirror *retval = NULL;
|
|
144
|
|
145 while (mir)
|
|
146 {
|
|
147 assert (!NILP (window));
|
|
148
|
|
149 if (mir->vchild)
|
|
150 {
|
|
151 retval = free_scrollbars_loop (XWINDOW (window)->vchild,
|
|
152 mir->vchild);
|
|
153 }
|
|
154 else if (mir->hchild)
|
|
155 {
|
|
156 retval = free_scrollbars_loop (XWINDOW (window)->hchild,
|
|
157 mir->hchild);
|
|
158 }
|
|
159
|
|
160 if (retval != NULL)
|
|
161 return retval;
|
|
162
|
|
163 if (mir->scrollbar_vertical_instance ||
|
|
164 mir->scrollbar_horizontal_instance)
|
|
165 free_window_mirror_scrollbars (mir);
|
|
166
|
|
167 mir = mir->next;
|
|
168 window = XWINDOW (window)->next;
|
|
169 }
|
|
170
|
|
171 return NULL;
|
|
172 }
|
|
173
|
|
174 /* Destroy all scrollbars associated with FRAME. Only called from
|
|
175 delete_frame_internal. */
|
|
176 void
|
|
177 free_frame_scrollbars (struct frame *f)
|
|
178 {
|
|
179 if (!HAS_FRAMEMETH_P (f, create_scrollbar_instance))
|
|
180 return;
|
|
181
|
|
182 if (f->mirror_dirty)
|
|
183 update_frame_window_mirror (f);
|
|
184
|
617
|
185 free_scrollbars_loop (f->root_window, XWINDOW_MIRROR (f->root_mirror));
|
428
|
186
|
|
187 while (FRAME_SB_VCACHE (f))
|
|
188 {
|
|
189 struct scrollbar_instance *tofree = FRAME_SB_VCACHE (f);
|
|
190 FRAME_SB_VCACHE (f) = FRAME_SB_VCACHE (f)->next;
|
|
191 tofree->next = NULL;
|
|
192 free_scrollbar_instance (tofree, f);
|
|
193 }
|
|
194
|
|
195 while (FRAME_SB_HCACHE (f))
|
|
196 {
|
|
197 struct scrollbar_instance *tofree = FRAME_SB_HCACHE (f);
|
|
198 FRAME_SB_HCACHE (f) = FRAME_SB_HCACHE (f)->next;
|
|
199 tofree->next = NULL;
|
|
200 free_scrollbar_instance (tofree, f);
|
|
201 }
|
|
202 }
|
|
203
|
|
204
|
|
205 static struct scrollbar_instance *
|
|
206 create_scrollbar_instance (struct frame *f, int vertical)
|
|
207 {
|
|
208 struct device *d = XDEVICE (f->device);
|
|
209 struct scrollbar_instance *instance =
|
617
|
210 alloc_lcrecord_type (struct scrollbar_instance,
|
|
211 &lrecord_scrollbar_instance);
|
428
|
212
|
617
|
213 zero_lcrecord (instance);
|
428
|
214 MAYBE_DEVMETH (d, create_scrollbar_instance, (f, vertical, instance));
|
|
215
|
|
216 return instance;
|
|
217 }
|
|
218
|
|
219
|
|
220 #define GET_SCROLLBAR_INSTANCE_INTERNAL(cache) \
|
|
221 do { \
|
|
222 if (FRAME_SB_##cache (f)) \
|
|
223 { \
|
|
224 struct scrollbar_instance *retval = FRAME_SB_##cache (f); \
|
|
225 FRAME_SB_##cache (f) = FRAME_SB_##cache (f)->next; \
|
|
226 retval->next = NULL; \
|
|
227 return retval; \
|
|
228 } \
|
|
229 } while (0)
|
|
230
|
|
231 static struct scrollbar_instance *
|
|
232 get_scrollbar_instance (struct frame *f, int vertical)
|
|
233 {
|
|
234 /* Check if there are any available scrollbars already in existence. */
|
|
235 if (vertical)
|
|
236 GET_SCROLLBAR_INSTANCE_INTERNAL (VCACHE);
|
|
237 else
|
|
238 GET_SCROLLBAR_INSTANCE_INTERNAL (HCACHE);
|
|
239
|
|
240 return create_scrollbar_instance (f, vertical);
|
|
241 }
|
|
242 #undef GET_SCROLLBAR_INSTANCE_INTERNAL
|
|
243
|
|
244 #define RELEASE_SCROLLBAR_INSTANCE_INTERNAL(cache) \
|
|
245 do { \
|
|
246 if (!FRAME_SB_##cache (f)) \
|
|
247 { \
|
|
248 instance->next = NULL; \
|
|
249 FRAME_SB_##cache (f) = instance; \
|
|
250 } \
|
|
251 else \
|
|
252 { \
|
|
253 instance->next = FRAME_SB_##cache (f); \
|
|
254 FRAME_SB_##cache (f) = instance; \
|
|
255 } \
|
|
256 } while (0)
|
|
257
|
|
258 static void
|
|
259 release_scrollbar_instance (struct frame *f, int vertical,
|
|
260 struct scrollbar_instance *instance)
|
|
261 {
|
|
262 /* #### should we do "instance->mir = 0;" for safety? */
|
|
263 if (vertical)
|
|
264 RELEASE_SCROLLBAR_INSTANCE_INTERNAL (VCACHE);
|
|
265 else
|
|
266 RELEASE_SCROLLBAR_INSTANCE_INTERNAL (HCACHE);
|
|
267 }
|
|
268 #undef RELEASE_SCROLLBAR_INSTANCE_INTERNAL
|
|
269
|
|
270 #ifdef MEMORY_USAGE_STATS
|
|
271
|
|
272 int
|
|
273 compute_scrollbar_instance_usage (struct device *d,
|
|
274 struct scrollbar_instance *inst,
|
|
275 struct overhead_stats *ovstats)
|
|
276 {
|
|
277 int total = 0;
|
|
278
|
|
279 total += DEVMETH (d, compute_scrollbar_instance_usage, (d, inst, ovstats));
|
|
280
|
|
281 while (inst)
|
|
282 {
|
|
283 total += malloced_storage_size (inst, sizeof (*inst), ovstats);
|
|
284 inst = inst->next;
|
|
285 }
|
|
286
|
|
287 return total;
|
|
288 }
|
|
289
|
|
290 #endif /* MEMORY_USAGE_STATS */
|
|
291
|
|
292 void
|
|
293 update_window_scrollbars (struct window *w, struct window_mirror *mirror,
|
|
294 int active, int horiz_only)
|
|
295 {
|
|
296 struct frame *f = XFRAME (w->frame);
|
|
297 struct device *d = XDEVICE (f->device);
|
|
298
|
|
299 if (!HAS_DEVMETH_P (d, create_scrollbar_instance))
|
|
300 return;
|
|
301
|
|
302 in_display++;
|
|
303
|
|
304 /* It is possible for this to get called from the mirror update
|
|
305 routines. In that case the structure is in an indeterminate
|
|
306 state but we know exactly what struct we are working with. So we
|
|
307 pass it in in that case. We also take advantage of it at some
|
|
308 other points where we know what the mirror struct is. */
|
|
309 if (!mirror)
|
|
310 mirror = find_window_mirror (w);
|
|
311
|
|
312 if (!mirror->scrollbar_vertical_instance && active)
|
|
313 mirror->scrollbar_vertical_instance = get_scrollbar_instance (f, 1);
|
|
314
|
|
315 if (!mirror->scrollbar_horizontal_instance && active)
|
|
316 mirror->scrollbar_horizontal_instance = get_scrollbar_instance (f, 0);
|
|
317
|
|
318 if (!horiz_only && mirror->scrollbar_vertical_instance)
|
|
319 {
|
|
320 int size = (active ? window_scrollbar_width (w) : 0);
|
|
321 struct scrollbar_instance *instance;
|
|
322
|
|
323 instance = mirror->scrollbar_vertical_instance;
|
|
324 instance->scrollbar_is_active = active;
|
|
325 instance->mirror = mirror;
|
|
326
|
|
327 if (active && size)
|
|
328 update_scrollbar_instance (w, 1, instance);
|
|
329 MAYBE_DEVMETH (d, update_scrollbar_instance_status,
|
|
330 (w, active, size, instance));
|
|
331
|
|
332 if (!active)
|
|
333 {
|
|
334 release_scrollbar_instance (f, 1, instance);
|
|
335 mirror->scrollbar_vertical_instance = NULL;
|
|
336 }
|
|
337 }
|
|
338
|
|
339 if (mirror->scrollbar_horizontal_instance)
|
|
340 {
|
|
341 int size = (active ? window_scrollbar_height (w) : 0);
|
|
342 struct scrollbar_instance *instance;
|
|
343
|
|
344 instance = mirror->scrollbar_horizontal_instance;
|
|
345 instance->scrollbar_is_active = active;
|
|
346 instance->mirror = mirror;
|
|
347
|
|
348 if (active && size)
|
|
349 update_scrollbar_instance (w, 0, instance);
|
|
350 MAYBE_DEVMETH (d, update_scrollbar_instance_status,
|
|
351 (w, active, size, instance));
|
|
352
|
|
353 if (!active)
|
|
354 {
|
|
355 release_scrollbar_instance (f, 0, instance);
|
|
356 mirror->scrollbar_horizontal_instance = NULL;
|
|
357 }
|
|
358 }
|
|
359
|
|
360 in_display--;
|
|
361 }
|
|
362
|
|
363 void
|
|
364 release_window_mirror_scrollbars (struct window_mirror *mir)
|
|
365 {
|
|
366 struct device *d = XDEVICE (mir->frame->device);
|
|
367
|
|
368 if (!HAS_DEVMETH_P (d, create_scrollbar_instance))
|
|
369 return;
|
|
370
|
|
371 if (mir->scrollbar_vertical_instance)
|
|
372 {
|
|
373 release_scrollbar_instance (mir->frame, 1,
|
|
374 mir->scrollbar_vertical_instance);
|
|
375 MAYBE_DEVMETH (d, release_scrollbar_instance,
|
|
376 (mir->scrollbar_vertical_instance));
|
|
377 }
|
|
378 mir->scrollbar_vertical_instance = 0;
|
|
379
|
|
380 if (mir->scrollbar_horizontal_instance)
|
|
381 {
|
|
382 release_scrollbar_instance (mir->frame, 0,
|
|
383 mir->scrollbar_horizontal_instance);
|
|
384 MAYBE_DEVMETH (d, release_scrollbar_instance,
|
|
385 (mir->scrollbar_horizontal_instance));
|
|
386 }
|
|
387 mir->scrollbar_horizontal_instance = 0;
|
|
388 }
|
|
389
|
|
390 /*
|
|
391 * If w->sb_point is on the top line then return w->sb_point else
|
|
392 * return w->start. If flag, then return beginning point of line
|
|
393 * which w->sb_point lies on.
|
|
394 */
|
665
|
395 static Charbpos
|
428
|
396 scrollbar_point (struct window *w, int flag)
|
|
397 {
|
665
|
398 Charbpos start_pos, end_pos, sb_pos;
|
428
|
399 Lisp_Object buf;
|
|
400 struct buffer *b;
|
|
401
|
|
402 if (NILP (w->buffer)) /* non-leaf window */
|
|
403 return 0;
|
|
404
|
|
405 start_pos = marker_position (w->start[CURRENT_DISP]);
|
|
406 sb_pos = marker_position (w->sb_point);
|
|
407
|
|
408 if (!flag && sb_pos < start_pos)
|
|
409 return start_pos;
|
|
410
|
|
411 buf = get_buffer (w->buffer, 0);
|
|
412 if (!NILP (buf))
|
|
413 b = XBUFFER (buf);
|
|
414 else
|
|
415 return start_pos;
|
|
416
|
|
417 if (flag)
|
|
418 end_pos = find_next_newline_no_quit (b, sb_pos, -1);
|
|
419 else
|
|
420 end_pos = find_next_newline_no_quit (b, start_pos, 1);
|
|
421
|
|
422 if (flag)
|
|
423 return end_pos;
|
|
424 else if (sb_pos > end_pos)
|
|
425 return start_pos;
|
|
426 else
|
|
427 return sb_pos;
|
|
428 }
|
|
429
|
|
430 /*
|
|
431 * Update a window's horizontal or vertical scrollbar.
|
|
432 */
|
|
433 static void
|
|
434 update_scrollbar_instance (struct window *w, int vertical,
|
|
435 struct scrollbar_instance *instance)
|
|
436 {
|
|
437 struct frame *f = XFRAME (w->frame);
|
|
438 struct device *d = XDEVICE (f->device);
|
|
439 struct buffer *b = XBUFFER (w->buffer);
|
665
|
440 Charbpos start_pos, end_pos, sb_pos;
|
428
|
441 int scrollbar_width = window_scrollbar_width (w);
|
|
442 int scrollbar_height = window_scrollbar_height (w);
|
|
443
|
|
444 int new_line_increment = -1, new_page_increment = -1;
|
|
445 int new_minimum = -1, new_maximum = -1;
|
|
446 int new_slider_size = -1, new_slider_position = -1;
|
|
447 int new_width = -1, new_height = -1, new_x = -1, new_y = -1;
|
444
|
448 struct window *new_window = 0; /* #### currently unused */
|
428
|
449
|
|
450 end_pos = BUF_Z (b) - w->window_end_pos[CURRENT_DISP];
|
|
451 sb_pos = scrollbar_point (w, 0);
|
|
452 start_pos = sb_pos;
|
|
453
|
|
454 /* The end position must be strictly greater than the start
|
|
455 position, at least for the Motify scrollbar. It shouldn't hurt
|
|
456 anything for other scrollbar implementations. */
|
|
457 if (end_pos <= start_pos)
|
|
458 end_pos = start_pos + 1;
|
|
459
|
|
460 if (vertical)
|
|
461 {
|
|
462 new_height = WINDOW_TEXT_HEIGHT (w);
|
|
463 new_width = scrollbar_width;
|
|
464 }
|
|
465 else
|
|
466 {
|
|
467 new_height = scrollbar_height;
|
|
468 new_width = WINDOW_TEXT_WIDTH (w);
|
|
469 }
|
|
470
|
|
471 /* If the height and width are not greater than 0, then later on the
|
|
472 Motif widgets will bitch and moan. */
|
|
473 if (new_height <= 0)
|
|
474 new_height = 1;
|
|
475 if (new_width <= 0)
|
|
476 new_width = 1;
|
|
477
|
|
478 assert (instance->mirror && XWINDOW (real_window(instance->mirror, 0)) == w);
|
|
479
|
|
480 /* Only character-based scrollbars are implemented at the moment.
|
|
481 Line-based will be implemented in the future. */
|
|
482
|
|
483 instance->scrollbar_is_active = 1;
|
|
484 new_line_increment = 1;
|
|
485 new_page_increment = 1;
|
|
486
|
|
487 /* We used to check for inhibit_scrollbar_slider_size_change here,
|
|
488 but that seems bogus. */
|
|
489 {
|
|
490 int x_offset, y_offset;
|
|
491
|
|
492 /* Scrollbars are always the farthest from the text area, barring
|
|
493 gutters. */
|
|
494 if (vertical)
|
|
495 {
|
|
496 if (!NILP (w->scrollbar_on_left_p))
|
|
497 {
|
|
498 x_offset = WINDOW_LEFT (w);
|
|
499 }
|
442
|
500 else
|
428
|
501 {
|
|
502 x_offset = WINDOW_RIGHT (w) - scrollbar_width;
|
|
503 if (window_needs_vertical_divider (w))
|
|
504 x_offset -= window_divider_width (w);
|
|
505 }
|
|
506 y_offset = WINDOW_TEXT_TOP (w) + f->scrollbar_y_offset;
|
|
507 }
|
|
508 else
|
|
509 {
|
|
510 x_offset = WINDOW_TEXT_LEFT (w);
|
|
511 y_offset = f->scrollbar_y_offset;
|
|
512
|
|
513 if (!NILP (w->scrollbar_on_top_p))
|
|
514 {
|
|
515 y_offset += WINDOW_TOP (w);
|
|
516 }
|
|
517 else
|
|
518 {
|
|
519 y_offset += WINDOW_TEXT_BOTTOM (w);
|
|
520 }
|
|
521 }
|
|
522
|
|
523 new_x = x_offset;
|
|
524 new_y = y_offset;
|
|
525 }
|
|
526
|
|
527 /* A disabled scrollbar has its slider sized to the entire height of
|
|
528 the scrollbar. Currently the minibuffer scrollbar is
|
|
529 disabled. */
|
|
530 if (!MINI_WINDOW_P (w) && vertical)
|
|
531 {
|
|
532 if (!DEVMETH_OR_GIVEN (d, inhibit_scrollbar_slider_size_change, (), 0))
|
|
533 {
|
|
534 new_minimum = BUF_BEGV (b);
|
|
535 new_maximum = max (BUF_ZV (b), new_minimum + 1);
|
|
536 new_slider_size = min ((end_pos - start_pos),
|
|
537 (new_maximum - new_minimum));
|
|
538 new_slider_position = sb_pos;
|
|
539 new_window = w;
|
|
540 }
|
|
541 }
|
|
542 else if (!MINI_WINDOW_P (w))
|
|
543 {
|
|
544 /* The minus one is to account for the truncation glyph. */
|
|
545 int wcw = window_char_width (w, 0) - 1;
|
|
546 int max_width, max_slide;
|
|
547
|
|
548 if (w->max_line_len < wcw)
|
|
549 {
|
|
550 max_width = 1;
|
|
551 max_slide = 1;
|
|
552 wcw = 1;
|
|
553 }
|
|
554 else
|
|
555 {
|
|
556 max_width = w->max_line_len + 2;
|
|
557 max_slide = max_width - wcw;
|
|
558 }
|
|
559
|
|
560 new_minimum = 0;
|
|
561 new_maximum = max_width;
|
|
562 new_slider_size = wcw;
|
|
563 new_slider_position = min (w->hscroll, max_slide);
|
|
564 }
|
|
565 else /* MINI_WINDOW_P (w) */
|
|
566 {
|
|
567 new_minimum = 1;
|
|
568 new_maximum = 2;
|
|
569 new_slider_size = 1;
|
|
570 new_slider_position = 1;
|
|
571 instance->scrollbar_is_active = 0;
|
|
572 }
|
|
573
|
|
574 DEVMETH (d, update_scrollbar_instance_values, (w, instance,
|
|
575 new_line_increment,
|
|
576 new_page_increment,
|
|
577 new_minimum,
|
|
578 new_maximum,
|
|
579 new_slider_size,
|
|
580 new_slider_position,
|
|
581 new_width, new_height,
|
|
582 new_x, new_y));
|
|
583 }
|
|
584
|
|
585 void
|
|
586 init_frame_scrollbars (struct frame *f)
|
|
587 {
|
|
588 struct device *d = XDEVICE (f->device);
|
|
589
|
|
590 if (HAS_DEVMETH_P (d, create_scrollbar_instance))
|
|
591 {
|
|
592 int depth = unlock_ghost_specifiers_protected ();
|
793
|
593 Lisp_Object frame = wrap_frame (f);
|
|
594
|
428
|
595 call_critical_lisp_code (XDEVICE (FRAME_DEVICE (f)),
|
|
596 Qinit_scrollbar_from_resources,
|
|
597 frame);
|
771
|
598 unbind_to (depth);
|
428
|
599 }
|
|
600 }
|
|
601
|
|
602 void
|
|
603 init_device_scrollbars (struct device *d)
|
|
604 {
|
|
605 if (HAS_DEVMETH_P (d, create_scrollbar_instance))
|
|
606 {
|
|
607 int depth = unlock_ghost_specifiers_protected ();
|
793
|
608 Lisp_Object device = wrap_device (d);
|
|
609
|
428
|
610 call_critical_lisp_code (d,
|
|
611 Qinit_scrollbar_from_resources,
|
|
612 device);
|
771
|
613 unbind_to (depth);
|
428
|
614 }
|
|
615 }
|
|
616
|
|
617 void
|
|
618 init_global_scrollbars (struct device *d)
|
|
619 {
|
|
620 if (HAS_DEVMETH_P (d, create_scrollbar_instance))
|
|
621 {
|
|
622 int depth = unlock_ghost_specifiers_protected ();
|
|
623 call_critical_lisp_code (d,
|
|
624 Qinit_scrollbar_from_resources,
|
|
625 Qglobal);
|
771
|
626 unbind_to (depth);
|
428
|
627 }
|
|
628 }
|
|
629
|
|
630 static void
|
|
631 vertical_scrollbar_changed_in_window (Lisp_Object specifier,
|
|
632 struct window *w,
|
|
633 Lisp_Object oldval)
|
|
634 {
|
|
635 /* Hold on your cerebella guys. If we always show the dividers,
|
|
636 changing scrollbar affects only how the text and scrollbar are
|
|
637 laid out in the window. If we do not want the dividers to show up
|
|
638 always, then we mark more drastic change, because changing
|
|
639 divider appearance changes lotta things. Although we actually need
|
|
640 to do this only if the scrollbar has appeared or disappeared
|
|
641 completely at either window edge, we do this always, as users
|
|
642 usually do not reposition scrollbars 200 times a second or so. Do
|
|
643 you? */
|
|
644 if (NILP (w->vertical_divider_always_visible_p))
|
|
645 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (XFRAME (WINDOW_FRAME (w)));
|
|
646 else
|
|
647 MARK_WINDOWS_CHANGED (w);
|
|
648 }
|
|
649
|
|
650 /* This function is called as a result of a change to the
|
|
651 `scrollbar-pointer' glyph. */
|
|
652 static void
|
|
653 scrollbar_pointer_changed_in_window (Lisp_Object specifier, struct window *w,
|
|
654 Lisp_Object oldval)
|
|
655 {
|
|
656 struct frame *f = XFRAME (WINDOW_FRAME (w));
|
|
657
|
|
658 if (f->init_finished)
|
|
659 MAYBE_FRAMEMETH (f, scrollbar_pointer_changed_in_window, (w));
|
|
660 }
|
|
661
|
|
662 /* ####
|
|
663
|
|
664 All of the following stuff is functions that handle scrollbar
|
|
665 actions. All of it should be moved into Lisp. This may require
|
|
666 adding some badly-needed primitives. */
|
|
667
|
|
668 /********** vertical scrollbar stuff **********/
|
|
669
|
|
670 /*
|
|
671 * If the original point is still visible, put the cursor back there.
|
|
672 * Otherwise, when scrolling down stick it at the beginning of the
|
|
673 * first visible line and when scrolling up stick it at the beginning
|
|
674 * of the last visible line.
|
|
675 */
|
|
676
|
|
677 /* #### This function should be moved into Lisp */
|
|
678 static void
|
|
679 scrollbar_reset_cursor (Lisp_Object win, Lisp_Object orig_pt)
|
|
680 {
|
|
681 /* When this function is called we know that start is already
|
|
682 accurate. We know this because either set-window-start or
|
|
683 recenter was called immediately prior to it being called. */
|
|
684 Lisp_Object buf;
|
665
|
685 Charbpos start_pos = XINT (Fwindow_start (win));
|
|
686 Charbpos ptint = XINT (orig_pt);
|
428
|
687 struct window *w = XWINDOW (win);
|
|
688 int selected = ((w == XWINDOW (Fselected_window (XFRAME (w->frame)->device)))
|
|
689 ? 1
|
|
690 : 0);
|
|
691
|
|
692 buf = Fwindow_buffer (win);
|
|
693 if (NILP (buf))
|
|
694 return; /* the window was deleted out from under us */
|
|
695
|
|
696 if (ptint < XINT (Fwindow_start (win)))
|
|
697 {
|
|
698 if (selected)
|
|
699 Fgoto_char (make_int (start_pos), buf);
|
|
700 else
|
|
701 Fset_window_point (win, make_int (start_pos));
|
|
702 }
|
|
703 else if (!point_would_be_visible (XWINDOW (win), start_pos, ptint))
|
|
704 {
|
|
705 Fmove_to_window_line (make_int (-1), win);
|
|
706
|
|
707 if (selected)
|
|
708 Fbeginning_of_line (Qnil, buf);
|
|
709 else
|
|
710 {
|
|
711 /* #### Taken from forward-line. */
|
665
|
712 Charbpos pos;
|
428
|
713
|
|
714 pos = find_next_newline (XBUFFER (buf),
|
|
715 marker_position (w->pointm[CURRENT_DISP]),
|
|
716 -1);
|
|
717 Fset_window_point (win, make_int (pos));
|
|
718 }
|
|
719 }
|
|
720 else
|
|
721 {
|
|
722 if (selected)
|
|
723 Fgoto_char (orig_pt, buf);
|
|
724 else
|
|
725 Fset_window_point (win, orig_pt);
|
|
726 }
|
|
727 }
|
|
728
|
|
729 DEFUN ("scrollbar-line-up", Fscrollbar_line_up, 1, 1, 0, /*
|
|
730 Function called when the line-up arrow on the scrollbar is clicked.
|
|
731 This is the little arrow at the top of the scrollbar. One argument, the
|
|
732 scrollbar's window. You can advise this function to change the scrollbar
|
|
733 behavior.
|
|
734 */
|
|
735 (window))
|
|
736 {
|
|
737 CHECK_LIVE_WINDOW (window);
|
|
738 window_scroll (window, make_int (1), -1, ERROR_ME_NOT);
|
|
739 zmacs_region_stays = 1;
|
|
740 return Qnil;
|
|
741 }
|
|
742
|
|
743 DEFUN ("scrollbar-line-down", Fscrollbar_line_down, 1, 1, 0, /*
|
|
744 Function called when the line-down arrow on the scrollbar is clicked.
|
|
745 This is the little arrow at the bottom of the scrollbar. One argument, the
|
|
746 scrollbar's window. You can advise this function to change the scrollbar
|
|
747 behavior.
|
|
748 */
|
|
749 (window))
|
|
750 {
|
|
751 CHECK_LIVE_WINDOW (window);
|
|
752 window_scroll (window, make_int (1), 1, ERROR_ME_NOT);
|
|
753 zmacs_region_stays = 1;
|
|
754 return Qnil;
|
|
755 }
|
|
756
|
|
757 DEFUN ("scrollbar-page-up", Fscrollbar_page_up, 1, 1, 0, /*
|
|
758 Function called when the user gives the "page-up" scrollbar action.
|
|
759 \(The way this is done can vary from scrollbar to scrollbar.) One argument,
|
|
760 a cons containing the scrollbar's window and a value (#### document me!
|
|
761 This value is nil for Motif/Lucid scrollbars and a number for Athena
|
|
762 scrollbars). You can advise this function to change the scrollbar
|
|
763 behavior.
|
|
764 */
|
|
765 (object))
|
|
766 {
|
|
767 Lisp_Object window = Fcar (object);
|
|
768
|
|
769 CHECK_LIVE_WINDOW (window);
|
|
770 /* Motif and Athena scrollbars behave differently, but in accordance
|
|
771 with their standard behaviors. It is not possible to hide the
|
|
772 differences down in lwlib because knowledge of XEmacs buffer and
|
|
773 cursor motion routines is necessary. */
|
442
|
774
|
|
775 if (NILP (XCDR (object)))
|
|
776 window_scroll (window, Qnil, -1, ERROR_ME_NOT);
|
|
777 else
|
|
778 {
|
665
|
779 Charbpos charbpos;
|
442
|
780 Lisp_Object value = Fcdr (object);
|
428
|
781
|
442
|
782 CHECK_INT (value);
|
|
783 Fmove_to_window_line (Qzero, window);
|
|
784 /* can't use Fvertical_motion() because it moves the buffer point
|
|
785 rather than the window's point.
|
428
|
786
|
442
|
787 #### It does? Why does it take a window argument then? */
|
665
|
788 charbpos = vmotion (XWINDOW (window), XINT (Fwindow_point (window)),
|
442
|
789 XINT (value), 0);
|
665
|
790 Fset_window_point (window, make_int (charbpos));
|
442
|
791 Fcenter_to_window_line (Qzero, window);
|
|
792 }
|
|
793
|
428
|
794 zmacs_region_stays = 1;
|
|
795 return Qnil;
|
|
796 }
|
|
797
|
|
798 DEFUN ("scrollbar-page-down", Fscrollbar_page_down, 1, 1, 0, /*
|
|
799 Function called when the user gives the "page-down" scrollbar action.
|
|
800 \(The way this is done can vary from scrollbar to scrollbar.) One argument,
|
|
801 a cons containing the scrollbar's window and a value (#### document me!
|
|
802 This value is nil for Motif/Lucid scrollbars and a number for Athena
|
|
803 scrollbars). You can advise this function to change the scrollbar
|
|
804 behavior.
|
|
805 */
|
|
806 (object))
|
|
807 {
|
|
808 Lisp_Object window = Fcar (object);
|
|
809
|
|
810 CHECK_LIVE_WINDOW (window);
|
|
811 /* Motif and Athena scrollbars behave differently, but in accordance
|
|
812 with their standard behaviors. It is not possible to hide the
|
|
813 differences down in lwlib because knowledge of XEmacs buffer and
|
|
814 cursor motion routines is necessary. */
|
442
|
815
|
|
816 if (NILP (XCDR (object)))
|
|
817 window_scroll (window, Qnil, 1, ERROR_ME_NOT);
|
|
818 else
|
|
819 {
|
|
820 Lisp_Object value = Fcdr (object);
|
|
821 CHECK_INT (value);
|
|
822 Fmove_to_window_line (value, window);
|
|
823 Fcenter_to_window_line (Qzero, window);
|
|
824 }
|
|
825
|
428
|
826 zmacs_region_stays = 1;
|
|
827 return Qnil;
|
|
828 }
|
|
829
|
|
830 DEFUN ("scrollbar-to-top", Fscrollbar_to_top, 1, 1, 0, /*
|
|
831 Function called when the user invokes the "to-top" scrollbar action.
|
|
832 The way this is done can vary from scrollbar to scrollbar, but
|
|
833 C-button1 on the up-arrow is very common. One argument, the
|
|
834 scrollbar's window. You can advise this function to change the
|
|
835 scrollbar behavior.
|
|
836 */
|
|
837 (window))
|
|
838 {
|
|
839 Lisp_Object orig_pt = Fwindow_point (window);
|
|
840 Fset_window_point (window, Fpoint_min (Fwindow_buffer (window)));
|
|
841 Fcenter_to_window_line (Qzero, window);
|
|
842 scrollbar_reset_cursor (window, orig_pt);
|
|
843 zmacs_region_stays = 1;
|
|
844 return Qnil;
|
|
845 }
|
|
846
|
|
847 DEFUN ("scrollbar-to-bottom", Fscrollbar_to_bottom, 1, 1, 0, /*
|
|
848 Function called when the user invokes the "to-bottom" scrollbar action.
|
|
849 The way this is done can vary from scrollbar to scrollbar, but
|
|
850 C-button1 on the down-arrow is very common. One argument, the
|
|
851 scrollbar's window. You can advise this function to change the
|
|
852 scrollbar behavior.
|
|
853 */
|
|
854 (window))
|
|
855 {
|
|
856 Lisp_Object orig_pt = Fwindow_point (window);
|
|
857 Fset_window_point (window, Fpoint_max (Fwindow_buffer (window)));
|
|
858 Fcenter_to_window_line (make_int (-3), window);
|
|
859 scrollbar_reset_cursor (window, orig_pt);
|
|
860 zmacs_region_stays = 1;
|
|
861 return Qnil;
|
|
862 }
|
|
863
|
|
864 DEFUN ("scrollbar-vertical-drag", Fscrollbar_vertical_drag, 1, 1, 0, /*
|
|
865 Function called when the user drags the vertical scrollbar slider.
|
|
866 One argument, a cons containing the scrollbar's window and a value
|
|
867 between point-min and point-max. You can advise this function to
|
|
868 change the scrollbar behavior.
|
|
869 */
|
|
870 (object))
|
|
871 {
|
665
|
872 Charbpos start_pos;
|
428
|
873 Lisp_Object orig_pt;
|
|
874 Lisp_Object window = Fcar (object);
|
|
875 Lisp_Object value = Fcdr (object);
|
|
876
|
|
877 orig_pt = Fwindow_point (window);
|
|
878 Fset_marker (XWINDOW (window)->sb_point, value, Fwindow_buffer (window));
|
|
879 start_pos = scrollbar_point (XWINDOW (window), 1);
|
|
880 Fset_window_start (window, make_int (start_pos), Qnil);
|
|
881 scrollbar_reset_cursor (window, orig_pt);
|
|
882 Fsit_for(Qzero, Qnil);
|
|
883 zmacs_region_stays = 1;
|
|
884 return Qnil;
|
|
885 }
|
|
886
|
|
887 DEFUN ("scrollbar-set-hscroll", Fscrollbar_set_hscroll, 2, 2, 0, /*
|
|
888 Set WINDOW's hscroll position to VALUE.
|
|
889 This ensures that VALUE is in the proper range for the horizontal scrollbar.
|
|
890 */
|
|
891 (window, value))
|
|
892 {
|
|
893 struct window *w;
|
|
894 int hscroll, wcw, max_len;
|
|
895
|
|
896 CHECK_LIVE_WINDOW (window);
|
|
897 if (!EQ (value, Qmax))
|
|
898 CHECK_INT (value);
|
|
899
|
|
900 w = XWINDOW (window);
|
|
901 wcw = window_char_width (w, 0) - 1;
|
440
|
902 /* #### We should be able to scroll further right as long as there is
|
428
|
903 a visible truncation glyph. This calculation for max is bogus. */
|
|
904 max_len = w->max_line_len + 2;
|
|
905
|
|
906 if (EQ (value, Qmax) || (XINT (value) > (max_len - wcw)))
|
|
907 hscroll = max_len - wcw;
|
|
908 else
|
|
909 hscroll = XINT (value);
|
|
910
|
|
911 /* Can't allow this out of set-window-hscroll's acceptable range. */
|
|
912 /* #### What hell on the earth this code limits scroll size to the
|
|
913 machine-dependent SHORT size? -- kkm */
|
|
914 if (hscroll < 0)
|
|
915 hscroll = 0;
|
|
916 else if (hscroll >= (1 << (SHORTBITS - 1)) - 1)
|
|
917 hscroll = (1 << (SHORTBITS - 1)) - 1;
|
|
918
|
|
919 if (hscroll != w->hscroll)
|
|
920 Fset_window_hscroll (window, make_int (hscroll));
|
|
921
|
|
922 return Qnil;
|
|
923 }
|
|
924
|
|
925
|
|
926 /************************************************************************/
|
|
927 /* initialization */
|
|
928 /************************************************************************/
|
|
929
|
|
930 void
|
|
931 syms_of_scrollbar (void)
|
|
932 {
|
617
|
933 INIT_LRECORD_IMPLEMENTATION (scrollbar_instance);
|
|
934
|
563
|
935 DEFSYMBOL (Qscrollbar_line_up);
|
|
936 DEFSYMBOL (Qscrollbar_line_down);
|
|
937 DEFSYMBOL (Qscrollbar_page_up);
|
|
938 DEFSYMBOL (Qscrollbar_page_down);
|
|
939 DEFSYMBOL (Qscrollbar_to_top);
|
|
940 DEFSYMBOL (Qscrollbar_to_bottom);
|
|
941 DEFSYMBOL (Qscrollbar_vertical_drag);
|
428
|
942
|
563
|
943 DEFSYMBOL (Qscrollbar_char_left);
|
|
944 DEFSYMBOL (Qscrollbar_char_right);
|
|
945 DEFSYMBOL (Qscrollbar_page_left);
|
|
946 DEFSYMBOL (Qscrollbar_page_right);
|
|
947 DEFSYMBOL (Qscrollbar_to_left);
|
|
948 DEFSYMBOL (Qscrollbar_to_right);
|
|
949 DEFSYMBOL (Qscrollbar_horizontal_drag);
|
428
|
950
|
563
|
951 DEFSYMBOL (Qinit_scrollbar_from_resources);
|
428
|
952
|
|
953 /* #### All these functions should be moved into Lisp.
|
|
954 See comment above. */
|
|
955 DEFSUBR (Fscrollbar_line_up);
|
|
956 DEFSUBR (Fscrollbar_line_down);
|
|
957 DEFSUBR (Fscrollbar_page_up);
|
|
958 DEFSUBR (Fscrollbar_page_down);
|
|
959 DEFSUBR (Fscrollbar_to_top);
|
|
960 DEFSUBR (Fscrollbar_to_bottom);
|
|
961 DEFSUBR (Fscrollbar_vertical_drag);
|
|
962
|
|
963 DEFSUBR (Fscrollbar_set_hscroll);
|
|
964 }
|
|
965
|
|
966 void
|
|
967 vars_of_scrollbar (void)
|
|
968 {
|
|
969 DEFVAR_LISP ("scrollbar-pointer-glyph", &Vscrollbar_pointer_glyph /*
|
|
970 *The shape of the mouse-pointer when over a scrollbar.
|
|
971 This is a glyph; use `set-glyph-image' to change it.
|
|
972 If unspecified in a particular domain, the window-system-provided
|
|
973 default pointer is used.
|
|
974 */ );
|
|
975
|
|
976 Fprovide (intern ("scrollbar"));
|
|
977 }
|
|
978
|
|
979 void
|
|
980 specifier_vars_of_scrollbar (void)
|
|
981 {
|
|
982 DEFVAR_SPECIFIER ("scrollbar-width", &Vscrollbar_width /*
|
|
983 *Width of vertical scrollbars.
|
|
984 This is a specifier; use `set-specifier' to change it.
|
|
985 */ );
|
|
986 Vscrollbar_width = make_magic_specifier (Qnatnum);
|
|
987 set_specifier_fallback
|
|
988 (Vscrollbar_width,
|
|
989 list1 (Fcons (Qnil, make_int (DEFAULT_SCROLLBAR_WIDTH))));
|
|
990 set_specifier_caching (Vscrollbar_width,
|
438
|
991 offsetof (struct window, scrollbar_width),
|
428
|
992 vertical_scrollbar_changed_in_window,
|
438
|
993 offsetof (struct frame, scrollbar_width),
|
444
|
994 frame_size_slipped, 0);
|
428
|
995
|
|
996 DEFVAR_SPECIFIER ("scrollbar-height", &Vscrollbar_height /*
|
|
997 *Height of horizontal scrollbars.
|
|
998 This is a specifier; use `set-specifier' to change it.
|
|
999 */ );
|
|
1000 Vscrollbar_height = make_magic_specifier (Qnatnum);
|
|
1001 set_specifier_fallback
|
|
1002 (Vscrollbar_height,
|
|
1003 list1 (Fcons (Qnil, make_int (DEFAULT_SCROLLBAR_HEIGHT))));
|
|
1004 set_specifier_caching (Vscrollbar_height,
|
438
|
1005 offsetof (struct window, scrollbar_height),
|
428
|
1006 some_window_value_changed,
|
438
|
1007 offsetof (struct frame, scrollbar_height),
|
444
|
1008 frame_size_slipped, 0);
|
428
|
1009
|
|
1010 DEFVAR_SPECIFIER ("horizontal-scrollbar-visible-p", &Vhorizontal_scrollbar_visible_p /*
|
|
1011 *Whether the horizontal scrollbar is visible.
|
|
1012 This is a specifier; use `set-specifier' to change it.
|
|
1013 */ );
|
|
1014 Vhorizontal_scrollbar_visible_p = Fmake_specifier (Qboolean);
|
|
1015 set_specifier_fallback (Vhorizontal_scrollbar_visible_p,
|
|
1016 list1 (Fcons (Qnil, Qt)));
|
|
1017 set_specifier_caching (Vhorizontal_scrollbar_visible_p,
|
438
|
1018 offsetof (struct window,
|
|
1019 horizontal_scrollbar_visible_p),
|
428
|
1020 some_window_value_changed,
|
438
|
1021 offsetof (struct frame,
|
|
1022 horizontal_scrollbar_visible_p),
|
444
|
1023 frame_size_slipped, 0);
|
428
|
1024
|
|
1025 DEFVAR_SPECIFIER ("vertical-scrollbar-visible-p", &Vvertical_scrollbar_visible_p /*
|
|
1026 *Whether the vertical scrollbar is visible.
|
|
1027 This is a specifier; use `set-specifier' to change it.
|
|
1028 */ );
|
|
1029 Vvertical_scrollbar_visible_p = Fmake_specifier (Qboolean);
|
|
1030 set_specifier_fallback (Vvertical_scrollbar_visible_p,
|
|
1031 list1 (Fcons (Qnil, Qt)));
|
|
1032 set_specifier_caching (Vvertical_scrollbar_visible_p,
|
438
|
1033 offsetof (struct window,
|
|
1034 vertical_scrollbar_visible_p),
|
428
|
1035 vertical_scrollbar_changed_in_window,
|
438
|
1036 offsetof (struct frame,
|
|
1037 vertical_scrollbar_visible_p),
|
444
|
1038 frame_size_slipped, 0);
|
428
|
1039
|
|
1040 DEFVAR_SPECIFIER ("scrollbar-on-left-p", &Vscrollbar_on_left_p /*
|
|
1041 *Whether the vertical scrollbar is on the left side of window or frame.
|
|
1042 This is a specifier; use `set-specifier' to change it.
|
|
1043 */ );
|
|
1044 Vscrollbar_on_left_p = Fmake_specifier (Qboolean);
|
442
|
1045
|
428
|
1046 {
|
|
1047 /* Kludge. Under X, we want athena scrollbars on the left,
|
|
1048 while all other scrollbars go on the right by default. */
|
|
1049 Lisp_Object fallback = list1 (Fcons (Qnil, Qnil));
|
|
1050 #if defined (HAVE_X_WINDOWS) \
|
|
1051 && !defined (LWLIB_SCROLLBARS_MOTIF) \
|
|
1052 && !defined (LWLIB_SCROLLBARS_LUCID) \
|
|
1053 && !defined (LWLIB_SCROLLBARS_ATHENA3D)
|
|
1054
|
|
1055 fallback = Fcons (Fcons (list1 (Qx), Qt), fallback);
|
|
1056 #endif
|
|
1057 set_specifier_fallback (Vscrollbar_on_left_p, fallback);
|
|
1058 }
|
|
1059
|
|
1060 set_specifier_caching (Vscrollbar_on_left_p,
|
438
|
1061 offsetof (struct window, scrollbar_on_left_p),
|
428
|
1062 vertical_scrollbar_changed_in_window,
|
438
|
1063 offsetof (struct frame, scrollbar_on_left_p),
|
444
|
1064 frame_size_slipped, 0);
|
428
|
1065
|
|
1066 DEFVAR_SPECIFIER ("scrollbar-on-top-p", &Vscrollbar_on_top_p /*
|
|
1067 *Whether the horizontal scrollbar is on the top side of window or frame.
|
|
1068 This is a specifier; use `set-specifier' to change it.
|
|
1069 */ );
|
|
1070 Vscrollbar_on_top_p = Fmake_specifier (Qboolean);
|
|
1071 set_specifier_fallback (Vscrollbar_on_top_p,
|
|
1072 list1 (Fcons (Qnil, Qnil)));
|
|
1073 set_specifier_caching (Vscrollbar_on_top_p,
|
438
|
1074 offsetof (struct window, scrollbar_on_top_p),
|
428
|
1075 some_window_value_changed,
|
438
|
1076 offsetof (struct frame, scrollbar_on_top_p),
|
444
|
1077 frame_size_slipped, 0);
|
428
|
1078 }
|
|
1079
|
|
1080 void
|
|
1081 complex_vars_of_scrollbar (void)
|
|
1082 {
|
|
1083 Vscrollbar_pointer_glyph = Fmake_glyph_internal (Qpointer);
|
|
1084
|
|
1085 set_specifier_caching (XGLYPH (Vscrollbar_pointer_glyph)->image,
|
438
|
1086 offsetof (struct window, scrollbar_pointer),
|
428
|
1087 scrollbar_pointer_changed_in_window,
|
444
|
1088 0, 0, 0);
|
428
|
1089 }
|