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;
|
2286
|
440 #if 0
|
444
|
441 struct window *new_window = 0; /* #### currently unused */
|
2286
|
442 #endif
|
428
|
443
|
|
444 end_pos = BUF_Z (b) - w->window_end_pos[CURRENT_DISP];
|
|
445 sb_pos = scrollbar_point (w, 0);
|
|
446 start_pos = sb_pos;
|
|
447
|
|
448 /* The end position must be strictly greater than the start
|
|
449 position, at least for the Motify scrollbar. It shouldn't hurt
|
|
450 anything for other scrollbar implementations. */
|
|
451 if (end_pos <= start_pos)
|
|
452 end_pos = start_pos + 1;
|
|
453
|
|
454 if (vertical)
|
|
455 {
|
|
456 new_height = WINDOW_TEXT_HEIGHT (w);
|
|
457 new_width = scrollbar_width;
|
|
458 }
|
|
459 else
|
|
460 {
|
|
461 new_height = scrollbar_height;
|
|
462 new_width = WINDOW_TEXT_WIDTH (w);
|
|
463 }
|
|
464
|
|
465 /* If the height and width are not greater than 0, then later on the
|
|
466 Motif widgets will bitch and moan. */
|
|
467 if (new_height <= 0)
|
|
468 new_height = 1;
|
|
469 if (new_width <= 0)
|
|
470 new_width = 1;
|
|
471
|
|
472 assert (instance->mirror && XWINDOW (real_window(instance->mirror, 0)) == w);
|
|
473
|
|
474 /* Only character-based scrollbars are implemented at the moment.
|
|
475 Line-based will be implemented in the future. */
|
|
476
|
|
477 instance->scrollbar_is_active = 1;
|
|
478 new_line_increment = 1;
|
|
479 new_page_increment = 1;
|
|
480
|
|
481 /* We used to check for inhibit_scrollbar_slider_size_change here,
|
|
482 but that seems bogus. */
|
|
483 {
|
|
484 int x_offset, y_offset;
|
|
485
|
|
486 /* Scrollbars are always the farthest from the text area, barring
|
|
487 gutters. */
|
|
488 if (vertical)
|
|
489 {
|
|
490 if (!NILP (w->scrollbar_on_left_p))
|
|
491 {
|
|
492 x_offset = WINDOW_LEFT (w);
|
|
493 }
|
442
|
494 else
|
428
|
495 {
|
|
496 x_offset = WINDOW_RIGHT (w) - scrollbar_width;
|
|
497 if (window_needs_vertical_divider (w))
|
|
498 x_offset -= window_divider_width (w);
|
|
499 }
|
|
500 y_offset = WINDOW_TEXT_TOP (w) + f->scrollbar_y_offset;
|
|
501 }
|
|
502 else
|
|
503 {
|
|
504 x_offset = WINDOW_TEXT_LEFT (w);
|
|
505 y_offset = f->scrollbar_y_offset;
|
|
506
|
|
507 if (!NILP (w->scrollbar_on_top_p))
|
|
508 {
|
|
509 y_offset += WINDOW_TOP (w);
|
|
510 }
|
|
511 else
|
|
512 {
|
|
513 y_offset += WINDOW_TEXT_BOTTOM (w);
|
|
514 }
|
|
515 }
|
|
516
|
|
517 new_x = x_offset;
|
|
518 new_y = y_offset;
|
|
519 }
|
|
520
|
|
521 /* A disabled scrollbar has its slider sized to the entire height of
|
|
522 the scrollbar. Currently the minibuffer scrollbar is
|
|
523 disabled. */
|
|
524 if (!MINI_WINDOW_P (w) && vertical)
|
|
525 {
|
|
526 if (!DEVMETH_OR_GIVEN (d, inhibit_scrollbar_slider_size_change, (), 0))
|
|
527 {
|
|
528 new_minimum = BUF_BEGV (b);
|
|
529 new_maximum = max (BUF_ZV (b), new_minimum + 1);
|
|
530 new_slider_size = min ((end_pos - start_pos),
|
|
531 (new_maximum - new_minimum));
|
|
532 new_slider_position = sb_pos;
|
2286
|
533 #if 0
|
428
|
534 new_window = w;
|
2286
|
535 #endif
|
428
|
536 }
|
|
537 }
|
|
538 else if (!MINI_WINDOW_P (w))
|
|
539 {
|
|
540 /* The minus one is to account for the truncation glyph. */
|
|
541 int wcw = window_char_width (w, 0) - 1;
|
|
542 int max_width, max_slide;
|
|
543
|
|
544 if (w->max_line_len < wcw)
|
|
545 {
|
|
546 max_width = 1;
|
|
547 max_slide = 1;
|
|
548 wcw = 1;
|
|
549 }
|
|
550 else
|
|
551 {
|
|
552 max_width = w->max_line_len + 2;
|
|
553 max_slide = max_width - wcw;
|
|
554 }
|
|
555
|
|
556 new_minimum = 0;
|
|
557 new_maximum = max_width;
|
|
558 new_slider_size = wcw;
|
|
559 new_slider_position = min (w->hscroll, max_slide);
|
|
560 }
|
|
561 else /* MINI_WINDOW_P (w) */
|
|
562 {
|
|
563 new_minimum = 1;
|
|
564 new_maximum = 2;
|
|
565 new_slider_size = 1;
|
|
566 new_slider_position = 1;
|
|
567 instance->scrollbar_is_active = 0;
|
|
568 }
|
|
569
|
|
570 DEVMETH (d, update_scrollbar_instance_values, (w, instance,
|
|
571 new_line_increment,
|
|
572 new_page_increment,
|
|
573 new_minimum,
|
|
574 new_maximum,
|
|
575 new_slider_size,
|
|
576 new_slider_position,
|
|
577 new_width, new_height,
|
|
578 new_x, new_y));
|
|
579 }
|
|
580
|
|
581 void
|
|
582 init_frame_scrollbars (struct frame *f)
|
|
583 {
|
|
584 struct device *d = XDEVICE (f->device);
|
|
585
|
|
586 if (HAS_DEVMETH_P (d, create_scrollbar_instance))
|
|
587 {
|
|
588 int depth = unlock_ghost_specifiers_protected ();
|
793
|
589 Lisp_Object frame = wrap_frame (f);
|
|
590
|
428
|
591 call_critical_lisp_code (XDEVICE (FRAME_DEVICE (f)),
|
|
592 Qinit_scrollbar_from_resources,
|
|
593 frame);
|
771
|
594 unbind_to (depth);
|
428
|
595 }
|
|
596 }
|
|
597
|
|
598 void
|
|
599 init_device_scrollbars (struct device *d)
|
|
600 {
|
|
601 if (HAS_DEVMETH_P (d, create_scrollbar_instance))
|
|
602 {
|
|
603 int depth = unlock_ghost_specifiers_protected ();
|
793
|
604 Lisp_Object device = wrap_device (d);
|
|
605
|
428
|
606 call_critical_lisp_code (d,
|
|
607 Qinit_scrollbar_from_resources,
|
|
608 device);
|
771
|
609 unbind_to (depth);
|
428
|
610 }
|
|
611 }
|
|
612
|
|
613 void
|
|
614 init_global_scrollbars (struct device *d)
|
|
615 {
|
|
616 if (HAS_DEVMETH_P (d, create_scrollbar_instance))
|
|
617 {
|
|
618 int depth = unlock_ghost_specifiers_protected ();
|
|
619 call_critical_lisp_code (d,
|
|
620 Qinit_scrollbar_from_resources,
|
|
621 Qglobal);
|
771
|
622 unbind_to (depth);
|
428
|
623 }
|
|
624 }
|
|
625
|
|
626 static void
|
2286
|
627 vertical_scrollbar_changed_in_window (Lisp_Object UNUSED (specifier),
|
428
|
628 struct window *w,
|
2286
|
629 Lisp_Object UNUSED (oldval))
|
428
|
630 {
|
|
631 /* Hold on your cerebella guys. If we always show the dividers,
|
|
632 changing scrollbar affects only how the text and scrollbar are
|
|
633 laid out in the window. If we do not want the dividers to show up
|
|
634 always, then we mark more drastic change, because changing
|
|
635 divider appearance changes lotta things. Although we actually need
|
|
636 to do this only if the scrollbar has appeared or disappeared
|
|
637 completely at either window edge, we do this always, as users
|
|
638 usually do not reposition scrollbars 200 times a second or so. Do
|
|
639 you? */
|
|
640 if (NILP (w->vertical_divider_always_visible_p))
|
|
641 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (XFRAME (WINDOW_FRAME (w)));
|
|
642 else
|
|
643 MARK_WINDOWS_CHANGED (w);
|
|
644 }
|
|
645
|
|
646 /* This function is called as a result of a change to the
|
|
647 `scrollbar-pointer' glyph. */
|
|
648 static void
|
2286
|
649 scrollbar_pointer_changed_in_window (Lisp_Object UNUSED (specifier),
|
|
650 struct window *w,
|
|
651 Lisp_Object UNUSED (oldval))
|
428
|
652 {
|
|
653 struct frame *f = XFRAME (WINDOW_FRAME (w));
|
|
654
|
|
655 if (f->init_finished)
|
|
656 MAYBE_FRAMEMETH (f, scrollbar_pointer_changed_in_window, (w));
|
|
657 }
|
|
658
|
|
659 /* ####
|
|
660
|
|
661 All of the following stuff is functions that handle scrollbar
|
|
662 actions. All of it should be moved into Lisp. This may require
|
|
663 adding some badly-needed primitives. */
|
|
664
|
|
665 /********** vertical scrollbar stuff **********/
|
|
666
|
|
667 /*
|
|
668 * If the original point is still visible, put the cursor back there.
|
|
669 * Otherwise, when scrolling down stick it at the beginning of the
|
|
670 * first visible line and when scrolling up stick it at the beginning
|
|
671 * of the last visible line.
|
|
672 */
|
|
673
|
|
674 /* #### This function should be moved into Lisp */
|
|
675 static void
|
|
676 scrollbar_reset_cursor (Lisp_Object win, Lisp_Object orig_pt)
|
|
677 {
|
|
678 /* When this function is called we know that start is already
|
|
679 accurate. We know this because either set-window-start or
|
|
680 recenter was called immediately prior to it being called. */
|
|
681 Lisp_Object buf;
|
665
|
682 Charbpos start_pos = XINT (Fwindow_start (win));
|
|
683 Charbpos ptint = XINT (orig_pt);
|
428
|
684 struct window *w = XWINDOW (win);
|
|
685 int selected = ((w == XWINDOW (Fselected_window (XFRAME (w->frame)->device)))
|
|
686 ? 1
|
|
687 : 0);
|
|
688
|
|
689 buf = Fwindow_buffer (win);
|
|
690 if (NILP (buf))
|
|
691 return; /* the window was deleted out from under us */
|
|
692
|
|
693 if (ptint < XINT (Fwindow_start (win)))
|
|
694 {
|
|
695 if (selected)
|
|
696 Fgoto_char (make_int (start_pos), buf);
|
|
697 else
|
|
698 Fset_window_point (win, make_int (start_pos));
|
|
699 }
|
1708
|
700 else if (!point_would_be_visible (XWINDOW (win), start_pos, ptint, 0))
|
428
|
701 {
|
|
702 Fmove_to_window_line (make_int (-1), win);
|
|
703
|
|
704 if (selected)
|
|
705 Fbeginning_of_line (Qnil, buf);
|
|
706 else
|
|
707 {
|
|
708 /* #### Taken from forward-line. */
|
665
|
709 Charbpos pos;
|
428
|
710
|
|
711 pos = find_next_newline (XBUFFER (buf),
|
|
712 marker_position (w->pointm[CURRENT_DISP]),
|
|
713 -1);
|
|
714 Fset_window_point (win, make_int (pos));
|
|
715 }
|
|
716 }
|
|
717 else
|
|
718 {
|
|
719 if (selected)
|
|
720 Fgoto_char (orig_pt, buf);
|
|
721 else
|
|
722 Fset_window_point (win, orig_pt);
|
|
723 }
|
|
724 }
|
|
725
|
|
726 DEFUN ("scrollbar-line-up", Fscrollbar_line_up, 1, 1, 0, /*
|
|
727 Function called when the line-up arrow on the scrollbar is clicked.
|
|
728 This is the little arrow at the top of the scrollbar. One argument, the
|
|
729 scrollbar's window. You can advise this function to change the scrollbar
|
|
730 behavior.
|
|
731 */
|
|
732 (window))
|
|
733 {
|
|
734 CHECK_LIVE_WINDOW (window);
|
|
735 window_scroll (window, make_int (1), -1, ERROR_ME_NOT);
|
|
736 zmacs_region_stays = 1;
|
|
737 return Qnil;
|
|
738 }
|
|
739
|
|
740 DEFUN ("scrollbar-line-down", Fscrollbar_line_down, 1, 1, 0, /*
|
|
741 Function called when the line-down arrow on the scrollbar is clicked.
|
|
742 This is the little arrow at the bottom of the scrollbar. One argument, the
|
|
743 scrollbar's window. You can advise this function to change the scrollbar
|
|
744 behavior.
|
|
745 */
|
|
746 (window))
|
|
747 {
|
|
748 CHECK_LIVE_WINDOW (window);
|
|
749 window_scroll (window, make_int (1), 1, ERROR_ME_NOT);
|
|
750 zmacs_region_stays = 1;
|
|
751 return Qnil;
|
|
752 }
|
|
753
|
|
754 DEFUN ("scrollbar-page-up", Fscrollbar_page_up, 1, 1, 0, /*
|
|
755 Function called when the user gives the "page-up" scrollbar action.
|
|
756 \(The way this is done can vary from scrollbar to scrollbar.) One argument,
|
|
757 a cons containing the scrollbar's window and a value (#### document me!
|
|
758 This value is nil for Motif/Lucid scrollbars and a number for Athena
|
|
759 scrollbars). You can advise this function to change the scrollbar
|
|
760 behavior.
|
|
761 */
|
|
762 (object))
|
|
763 {
|
|
764 Lisp_Object window = Fcar (object);
|
|
765
|
|
766 CHECK_LIVE_WINDOW (window);
|
|
767 /* Motif and Athena scrollbars behave differently, but in accordance
|
|
768 with their standard behaviors. It is not possible to hide the
|
|
769 differences down in lwlib because knowledge of XEmacs buffer and
|
|
770 cursor motion routines is necessary. */
|
442
|
771
|
|
772 if (NILP (XCDR (object)))
|
|
773 window_scroll (window, Qnil, -1, ERROR_ME_NOT);
|
|
774 else
|
|
775 {
|
665
|
776 Charbpos charbpos;
|
442
|
777 Lisp_Object value = Fcdr (object);
|
428
|
778
|
442
|
779 CHECK_INT (value);
|
|
780 Fmove_to_window_line (Qzero, window);
|
|
781 /* can't use Fvertical_motion() because it moves the buffer point
|
|
782 rather than the window's point.
|
428
|
783
|
442
|
784 #### It does? Why does it take a window argument then? */
|
665
|
785 charbpos = vmotion (XWINDOW (window), XINT (Fwindow_point (window)),
|
442
|
786 XINT (value), 0);
|
665
|
787 Fset_window_point (window, make_int (charbpos));
|
442
|
788 Fcenter_to_window_line (Qzero, window);
|
|
789 }
|
|
790
|
428
|
791 zmacs_region_stays = 1;
|
|
792 return Qnil;
|
|
793 }
|
|
794
|
|
795 DEFUN ("scrollbar-page-down", Fscrollbar_page_down, 1, 1, 0, /*
|
|
796 Function called when the user gives the "page-down" scrollbar action.
|
|
797 \(The way this is done can vary from scrollbar to scrollbar.) One argument,
|
|
798 a cons containing the scrollbar's window and a value (#### document me!
|
|
799 This value is nil for Motif/Lucid scrollbars and a number for Athena
|
|
800 scrollbars). You can advise this function to change the scrollbar
|
|
801 behavior.
|
|
802 */
|
|
803 (object))
|
|
804 {
|
|
805 Lisp_Object window = Fcar (object);
|
|
806
|
|
807 CHECK_LIVE_WINDOW (window);
|
|
808 /* Motif and Athena scrollbars behave differently, but in accordance
|
|
809 with their standard behaviors. It is not possible to hide the
|
|
810 differences down in lwlib because knowledge of XEmacs buffer and
|
|
811 cursor motion routines is necessary. */
|
442
|
812
|
|
813 if (NILP (XCDR (object)))
|
|
814 window_scroll (window, Qnil, 1, ERROR_ME_NOT);
|
|
815 else
|
|
816 {
|
|
817 Lisp_Object value = Fcdr (object);
|
|
818 CHECK_INT (value);
|
|
819 Fmove_to_window_line (value, window);
|
|
820 Fcenter_to_window_line (Qzero, window);
|
|
821 }
|
|
822
|
428
|
823 zmacs_region_stays = 1;
|
|
824 return Qnil;
|
|
825 }
|
|
826
|
|
827 DEFUN ("scrollbar-to-top", Fscrollbar_to_top, 1, 1, 0, /*
|
|
828 Function called when the user invokes the "to-top" scrollbar action.
|
|
829 The way this is done can vary from scrollbar to scrollbar, but
|
|
830 C-button1 on the up-arrow is very common. One argument, the
|
|
831 scrollbar's window. You can advise this function to change the
|
|
832 scrollbar behavior.
|
|
833 */
|
|
834 (window))
|
|
835 {
|
|
836 Lisp_Object orig_pt = Fwindow_point (window);
|
|
837 Fset_window_point (window, Fpoint_min (Fwindow_buffer (window)));
|
|
838 Fcenter_to_window_line (Qzero, window);
|
|
839 scrollbar_reset_cursor (window, orig_pt);
|
|
840 zmacs_region_stays = 1;
|
|
841 return Qnil;
|
|
842 }
|
|
843
|
|
844 DEFUN ("scrollbar-to-bottom", Fscrollbar_to_bottom, 1, 1, 0, /*
|
|
845 Function called when the user invokes the "to-bottom" scrollbar action.
|
|
846 The way this is done can vary from scrollbar to scrollbar, but
|
|
847 C-button1 on the down-arrow is very common. One argument, the
|
|
848 scrollbar's window. You can advise this function to change the
|
|
849 scrollbar behavior.
|
|
850 */
|
|
851 (window))
|
|
852 {
|
|
853 Lisp_Object orig_pt = Fwindow_point (window);
|
|
854 Fset_window_point (window, Fpoint_max (Fwindow_buffer (window)));
|
|
855 Fcenter_to_window_line (make_int (-3), window);
|
|
856 scrollbar_reset_cursor (window, orig_pt);
|
|
857 zmacs_region_stays = 1;
|
|
858 return Qnil;
|
|
859 }
|
|
860
|
|
861 DEFUN ("scrollbar-vertical-drag", Fscrollbar_vertical_drag, 1, 1, 0, /*
|
|
862 Function called when the user drags the vertical scrollbar slider.
|
|
863 One argument, a cons containing the scrollbar's window and a value
|
|
864 between point-min and point-max. You can advise this function to
|
|
865 change the scrollbar behavior.
|
|
866 */
|
|
867 (object))
|
|
868 {
|
665
|
869 Charbpos start_pos;
|
428
|
870 Lisp_Object orig_pt;
|
|
871 Lisp_Object window = Fcar (object);
|
|
872 Lisp_Object value = Fcdr (object);
|
|
873
|
|
874 orig_pt = Fwindow_point (window);
|
|
875 Fset_marker (XWINDOW (window)->sb_point, value, Fwindow_buffer (window));
|
|
876 start_pos = scrollbar_point (XWINDOW (window), 1);
|
|
877 Fset_window_start (window, make_int (start_pos), Qnil);
|
|
878 scrollbar_reset_cursor (window, orig_pt);
|
|
879 Fsit_for(Qzero, Qnil);
|
|
880 zmacs_region_stays = 1;
|
|
881 return Qnil;
|
|
882 }
|
|
883
|
|
884 DEFUN ("scrollbar-set-hscroll", Fscrollbar_set_hscroll, 2, 2, 0, /*
|
|
885 Set WINDOW's hscroll position to VALUE.
|
|
886 This ensures that VALUE is in the proper range for the horizontal scrollbar.
|
|
887 */
|
|
888 (window, value))
|
|
889 {
|
|
890 struct window *w;
|
|
891 int hscroll, wcw, max_len;
|
|
892
|
|
893 CHECK_LIVE_WINDOW (window);
|
|
894 if (!EQ (value, Qmax))
|
|
895 CHECK_INT (value);
|
|
896
|
|
897 w = XWINDOW (window);
|
|
898 wcw = window_char_width (w, 0) - 1;
|
440
|
899 /* #### We should be able to scroll further right as long as there is
|
428
|
900 a visible truncation glyph. This calculation for max is bogus. */
|
|
901 max_len = w->max_line_len + 2;
|
|
902
|
|
903 if (EQ (value, Qmax) || (XINT (value) > (max_len - wcw)))
|
|
904 hscroll = max_len - wcw;
|
|
905 else
|
|
906 hscroll = XINT (value);
|
|
907
|
|
908 /* Can't allow this out of set-window-hscroll's acceptable range. */
|
|
909 /* #### What hell on the earth this code limits scroll size to the
|
|
910 machine-dependent SHORT size? -- kkm */
|
|
911 if (hscroll < 0)
|
|
912 hscroll = 0;
|
|
913 else if (hscroll >= (1 << (SHORTBITS - 1)) - 1)
|
|
914 hscroll = (1 << (SHORTBITS - 1)) - 1;
|
|
915
|
|
916 if (hscroll != w->hscroll)
|
|
917 Fset_window_hscroll (window, make_int (hscroll));
|
|
918
|
|
919 return Qnil;
|
|
920 }
|
|
921
|
|
922
|
|
923 /************************************************************************/
|
|
924 /* initialization */
|
|
925 /************************************************************************/
|
|
926
|
|
927 void
|
|
928 syms_of_scrollbar (void)
|
|
929 {
|
617
|
930 INIT_LRECORD_IMPLEMENTATION (scrollbar_instance);
|
|
931
|
563
|
932 DEFSYMBOL (Qscrollbar_line_up);
|
|
933 DEFSYMBOL (Qscrollbar_line_down);
|
|
934 DEFSYMBOL (Qscrollbar_page_up);
|
|
935 DEFSYMBOL (Qscrollbar_page_down);
|
|
936 DEFSYMBOL (Qscrollbar_to_top);
|
|
937 DEFSYMBOL (Qscrollbar_to_bottom);
|
|
938 DEFSYMBOL (Qscrollbar_vertical_drag);
|
428
|
939
|
563
|
940 DEFSYMBOL (Qscrollbar_char_left);
|
|
941 DEFSYMBOL (Qscrollbar_char_right);
|
|
942 DEFSYMBOL (Qscrollbar_page_left);
|
|
943 DEFSYMBOL (Qscrollbar_page_right);
|
|
944 DEFSYMBOL (Qscrollbar_to_left);
|
|
945 DEFSYMBOL (Qscrollbar_to_right);
|
|
946 DEFSYMBOL (Qscrollbar_horizontal_drag);
|
428
|
947
|
563
|
948 DEFSYMBOL (Qinit_scrollbar_from_resources);
|
428
|
949
|
|
950 /* #### All these functions should be moved into Lisp.
|
|
951 See comment above. */
|
|
952 DEFSUBR (Fscrollbar_line_up);
|
|
953 DEFSUBR (Fscrollbar_line_down);
|
|
954 DEFSUBR (Fscrollbar_page_up);
|
|
955 DEFSUBR (Fscrollbar_page_down);
|
|
956 DEFSUBR (Fscrollbar_to_top);
|
|
957 DEFSUBR (Fscrollbar_to_bottom);
|
|
958 DEFSUBR (Fscrollbar_vertical_drag);
|
|
959
|
|
960 DEFSUBR (Fscrollbar_set_hscroll);
|
|
961 }
|
|
962
|
|
963 void
|
|
964 vars_of_scrollbar (void)
|
|
965 {
|
|
966 DEFVAR_LISP ("scrollbar-pointer-glyph", &Vscrollbar_pointer_glyph /*
|
|
967 *The shape of the mouse-pointer when over a scrollbar.
|
|
968 This is a glyph; use `set-glyph-image' to change it.
|
|
969 If unspecified in a particular domain, the window-system-provided
|
|
970 default pointer is used.
|
|
971 */ );
|
|
972
|
|
973 Fprovide (intern ("scrollbar"));
|
|
974 }
|
|
975
|
|
976 void
|
|
977 specifier_vars_of_scrollbar (void)
|
|
978 {
|
|
979 DEFVAR_SPECIFIER ("scrollbar-width", &Vscrollbar_width /*
|
|
980 *Width of vertical scrollbars.
|
|
981 This is a specifier; use `set-specifier' to change it.
|
|
982 */ );
|
|
983 Vscrollbar_width = make_magic_specifier (Qnatnum);
|
|
984 set_specifier_fallback
|
|
985 (Vscrollbar_width,
|
1295
|
986 #ifdef HAVE_TTY
|
1287
|
987 list2 (Fcons (list1 (Qtty), make_int (0)),
|
1295
|
988 Fcons (Qnil, make_int (DEFAULT_SCROLLBAR_WIDTH)))
|
|
989 #else
|
|
990 list1 (Fcons (Qnil, make_int (DEFAULT_SCROLLBAR_WIDTH)))
|
|
991 #endif
|
|
992 );
|
428
|
993 set_specifier_caching (Vscrollbar_width,
|
438
|
994 offsetof (struct window, scrollbar_width),
|
428
|
995 vertical_scrollbar_changed_in_window,
|
438
|
996 offsetof (struct frame, scrollbar_width),
|
444
|
997 frame_size_slipped, 0);
|
428
|
998
|
|
999 DEFVAR_SPECIFIER ("scrollbar-height", &Vscrollbar_height /*
|
|
1000 *Height of horizontal scrollbars.
|
|
1001 This is a specifier; use `set-specifier' to change it.
|
|
1002 */ );
|
|
1003 Vscrollbar_height = make_magic_specifier (Qnatnum);
|
|
1004 set_specifier_fallback
|
|
1005 (Vscrollbar_height,
|
1295
|
1006 #ifdef HAVE_TTY
|
1287
|
1007 list2 (Fcons (list1 (Qtty), make_int (0)),
|
1295
|
1008 Fcons (Qnil, make_int (DEFAULT_SCROLLBAR_HEIGHT)))
|
|
1009 #else
|
|
1010 list1 (Fcons (Qnil, make_int (DEFAULT_SCROLLBAR_HEIGHT)))
|
|
1011 #endif
|
|
1012 );
|
428
|
1013 set_specifier_caching (Vscrollbar_height,
|
438
|
1014 offsetof (struct window, scrollbar_height),
|
428
|
1015 some_window_value_changed,
|
438
|
1016 offsetof (struct frame, scrollbar_height),
|
444
|
1017 frame_size_slipped, 0);
|
428
|
1018
|
|
1019 DEFVAR_SPECIFIER ("horizontal-scrollbar-visible-p", &Vhorizontal_scrollbar_visible_p /*
|
|
1020 *Whether the horizontal scrollbar is visible.
|
|
1021 This is a specifier; use `set-specifier' to change it.
|
|
1022 */ );
|
|
1023 Vhorizontal_scrollbar_visible_p = Fmake_specifier (Qboolean);
|
|
1024 set_specifier_fallback (Vhorizontal_scrollbar_visible_p,
|
|
1025 list1 (Fcons (Qnil, Qt)));
|
|
1026 set_specifier_caching (Vhorizontal_scrollbar_visible_p,
|
438
|
1027 offsetof (struct window,
|
|
1028 horizontal_scrollbar_visible_p),
|
428
|
1029 some_window_value_changed,
|
438
|
1030 offsetof (struct frame,
|
|
1031 horizontal_scrollbar_visible_p),
|
444
|
1032 frame_size_slipped, 0);
|
428
|
1033
|
|
1034 DEFVAR_SPECIFIER ("vertical-scrollbar-visible-p", &Vvertical_scrollbar_visible_p /*
|
|
1035 *Whether the vertical scrollbar is visible.
|
|
1036 This is a specifier; use `set-specifier' to change it.
|
|
1037 */ );
|
|
1038 Vvertical_scrollbar_visible_p = Fmake_specifier (Qboolean);
|
|
1039 set_specifier_fallback (Vvertical_scrollbar_visible_p,
|
|
1040 list1 (Fcons (Qnil, Qt)));
|
|
1041 set_specifier_caching (Vvertical_scrollbar_visible_p,
|
438
|
1042 offsetof (struct window,
|
|
1043 vertical_scrollbar_visible_p),
|
428
|
1044 vertical_scrollbar_changed_in_window,
|
438
|
1045 offsetof (struct frame,
|
|
1046 vertical_scrollbar_visible_p),
|
444
|
1047 frame_size_slipped, 0);
|
428
|
1048
|
|
1049 DEFVAR_SPECIFIER ("scrollbar-on-left-p", &Vscrollbar_on_left_p /*
|
|
1050 *Whether the vertical scrollbar is on the left side of window or frame.
|
|
1051 This is a specifier; use `set-specifier' to change it.
|
|
1052 */ );
|
|
1053 Vscrollbar_on_left_p = Fmake_specifier (Qboolean);
|
442
|
1054
|
428
|
1055 {
|
|
1056 /* Kludge. Under X, we want athena scrollbars on the left,
|
|
1057 while all other scrollbars go on the right by default. */
|
|
1058 Lisp_Object fallback = list1 (Fcons (Qnil, Qnil));
|
|
1059 #if defined (HAVE_X_WINDOWS) \
|
|
1060 && !defined (LWLIB_SCROLLBARS_MOTIF) \
|
|
1061 && !defined (LWLIB_SCROLLBARS_LUCID) \
|
|
1062 && !defined (LWLIB_SCROLLBARS_ATHENA3D)
|
|
1063
|
|
1064 fallback = Fcons (Fcons (list1 (Qx), Qt), fallback);
|
|
1065 #endif
|
|
1066 set_specifier_fallback (Vscrollbar_on_left_p, fallback);
|
|
1067 }
|
|
1068
|
|
1069 set_specifier_caching (Vscrollbar_on_left_p,
|
438
|
1070 offsetof (struct window, scrollbar_on_left_p),
|
428
|
1071 vertical_scrollbar_changed_in_window,
|
438
|
1072 offsetof (struct frame, scrollbar_on_left_p),
|
444
|
1073 frame_size_slipped, 0);
|
428
|
1074
|
|
1075 DEFVAR_SPECIFIER ("scrollbar-on-top-p", &Vscrollbar_on_top_p /*
|
|
1076 *Whether the horizontal scrollbar is on the top side of window or frame.
|
|
1077 This is a specifier; use `set-specifier' to change it.
|
|
1078 */ );
|
|
1079 Vscrollbar_on_top_p = Fmake_specifier (Qboolean);
|
|
1080 set_specifier_fallback (Vscrollbar_on_top_p,
|
|
1081 list1 (Fcons (Qnil, Qnil)));
|
|
1082 set_specifier_caching (Vscrollbar_on_top_p,
|
438
|
1083 offsetof (struct window, scrollbar_on_top_p),
|
428
|
1084 some_window_value_changed,
|
438
|
1085 offsetof (struct frame, scrollbar_on_top_p),
|
444
|
1086 frame_size_slipped, 0);
|
428
|
1087 }
|
|
1088
|
|
1089 void
|
|
1090 complex_vars_of_scrollbar (void)
|
|
1091 {
|
|
1092 Vscrollbar_pointer_glyph = Fmake_glyph_internal (Qpointer);
|
|
1093
|
|
1094 set_specifier_caching (XGLYPH (Vscrollbar_pointer_glyph)->image,
|
438
|
1095 offsetof (struct window, scrollbar_pointer),
|
428
|
1096 scrollbar_pointer_changed_in_window,
|
444
|
1097 0, 0, 0);
|
428
|
1098 }
|