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