annotate src/scrollbar.c @ 1318:b531bf8658e9

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