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