annotate src/scrollbar.c @ 371:cc15677e0335 r21-2b1

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