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