428
|
1 /* Gutter implementation.
|
442
|
2 Copyright (C) 1999, 2000 Andy Piper.
|
428
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 /* Synched up with: Not in FSF. */
|
|
22
|
|
23 /* written by Andy Piper <andy@xemacs.org> with specifiers partially
|
|
24 ripped-off from toolbar.c */
|
|
25
|
|
26 #include <config.h>
|
|
27 #include "lisp.h"
|
|
28
|
|
29 #include "buffer.h"
|
|
30 #include "frame.h"
|
|
31 #include "device.h"
|
|
32 #include "faces.h"
|
|
33 #include "glyphs.h"
|
|
34 #include "redisplay.h"
|
|
35 #include "window.h"
|
|
36 #include "gutter.h"
|
|
37
|
|
38 Lisp_Object Vgutter[4];
|
|
39 Lisp_Object Vgutter_size[4];
|
|
40 Lisp_Object Vgutter_visible_p[4];
|
|
41 Lisp_Object Vgutter_border_width[4];
|
|
42
|
|
43 Lisp_Object Vdefault_gutter, Vdefault_gutter_visible_p;
|
|
44 Lisp_Object Vdefault_gutter_width, Vdefault_gutter_height;
|
|
45 Lisp_Object Vdefault_gutter_border_width;
|
|
46
|
|
47 Lisp_Object Vdefault_gutter_position;
|
|
48
|
|
49 Lisp_Object Qgutter_size;
|
442
|
50 Lisp_Object Qgutter_visible;
|
|
51 Lisp_Object Qdefault_gutter_position_changed_hook;
|
|
52
|
|
53 static void
|
|
54 update_gutter_geometry (struct frame *f, enum gutter_pos pos);
|
428
|
55
|
|
56 #define SET_GUTTER_WAS_VISIBLE_FLAG(frame, pos, flag) \
|
|
57 do { \
|
|
58 switch (pos) \
|
|
59 { \
|
|
60 case TOP_GUTTER: \
|
|
61 (frame)->top_gutter_was_visible = flag; \
|
|
62 break; \
|
|
63 case BOTTOM_GUTTER: \
|
|
64 (frame)->bottom_gutter_was_visible = flag; \
|
|
65 break; \
|
|
66 case LEFT_GUTTER: \
|
|
67 (frame)->left_gutter_was_visible = flag; \
|
|
68 break; \
|
|
69 case RIGHT_GUTTER: \
|
|
70 (frame)->right_gutter_was_visible = flag; \
|
|
71 break; \
|
|
72 default: \
|
|
73 abort (); \
|
|
74 } \
|
|
75 } while (0)
|
|
76
|
|
77 static int gutter_was_visible (struct frame* frame, enum gutter_pos pos)
|
|
78 {
|
|
79 switch (pos)
|
|
80 {
|
|
81 case TOP_GUTTER:
|
|
82 return frame->top_gutter_was_visible;
|
|
83 case BOTTOM_GUTTER:
|
|
84 return frame->bottom_gutter_was_visible;
|
|
85 case LEFT_GUTTER:
|
|
86 return frame->left_gutter_was_visible;
|
|
87 case RIGHT_GUTTER:
|
|
88 return frame->right_gutter_was_visible;
|
|
89 default:
|
|
90 abort ();
|
442
|
91 return 0; /* To keep the compiler happy */
|
428
|
92 }
|
|
93 }
|
|
94
|
442
|
95 #if 0
|
428
|
96 static Lisp_Object
|
|
97 frame_topmost_window (struct frame *f)
|
|
98 {
|
|
99 Lisp_Object w = FRAME_ROOT_WINDOW (f);
|
|
100
|
|
101 do {
|
|
102 while (!NILP (XWINDOW (w)->vchild))
|
|
103 {
|
|
104 w = XWINDOW (w)->vchild;
|
|
105 }
|
|
106 } while (!NILP (XWINDOW (w)->hchild) && !NILP (w = XWINDOW (w)->hchild));
|
|
107
|
|
108 return w;
|
|
109 }
|
442
|
110 #endif
|
428
|
111
|
|
112 static Lisp_Object
|
|
113 frame_bottommost_window (struct frame *f)
|
|
114 {
|
|
115 Lisp_Object w = FRAME_ROOT_WINDOW (f);
|
|
116
|
|
117 do {
|
|
118 while (!NILP (XWINDOW (w)->vchild))
|
|
119 {
|
|
120 w = XWINDOW (w)->vchild;
|
|
121 while (!NILP (XWINDOW (w)->next))
|
|
122 {
|
|
123 w = XWINDOW (w)->next;
|
|
124 }
|
|
125 }
|
|
126 } while (!NILP (XWINDOW (w)->hchild) && !NILP (w = XWINDOW (w)->hchild));
|
|
127
|
|
128 return w;
|
|
129 }
|
|
130
|
|
131 #if 0
|
|
132 static Lisp_Object
|
|
133 frame_leftmost_window (struct frame *f)
|
|
134 {
|
|
135 Lisp_Object w = FRAME_ROOT_WINDOW (f);
|
|
136
|
|
137 do {
|
|
138 while (!NILP (XWINDOW (w)->hchild))
|
|
139 {
|
|
140 w = XWINDOW (w)->hchild;
|
|
141 }
|
|
142 } while (!NILP (XWINDOW (w)->vchild) && !NILP (w = XWINDOW (w)->vchild));
|
|
143
|
|
144 return w;
|
|
145 }
|
|
146
|
|
147 static Lisp_Object
|
|
148 frame_rightmost_window (struct frame *f)
|
|
149 {
|
|
150 Lisp_Object w = FRAME_ROOT_WINDOW (f);
|
|
151
|
|
152 do {
|
|
153 while (!NILP (XWINDOW (w)->hchild))
|
|
154 {
|
|
155 w = XWINDOW (w)->hchild;
|
|
156 while (!NILP (XWINDOW (w)->next))
|
|
157 {
|
|
158 w = XWINDOW (w)->next;
|
|
159 }
|
|
160 }
|
|
161 } while (!NILP (XWINDOW (w)->vchild) && !NILP (w = XWINDOW (w)->vchild));
|
|
162 return w;
|
|
163 }
|
|
164 #endif
|
|
165
|
|
166 /* calculate the coordinates of a gutter for the current frame and
|
|
167 selected window. we have to be careful in calculating this as we
|
|
168 need to use *two* windows, the currently selected window will give
|
|
169 us the actual height, width and contents of the gutter, but if we
|
|
170 use this for calculating the gutter positions we run into trouble
|
|
171 if it is not the window nearest the gutter. Instead we predetermine
|
|
172 the nearest window and then use that.*/
|
|
173 static void
|
|
174 get_gutter_coords (struct frame *f, enum gutter_pos pos, int *x, int *y,
|
|
175 int *width, int *height)
|
|
176 {
|
|
177 struct window
|
|
178 * bot = XWINDOW (frame_bottommost_window (f));
|
|
179 /* The top and bottom gutters take precedence over the left and
|
|
180 right. */
|
|
181 switch (pos)
|
|
182 {
|
|
183 case TOP_GUTTER:
|
|
184 *x = FRAME_LEFT_BORDER_END (f);
|
|
185 *y = FRAME_TOP_BORDER_END (f);
|
442
|
186 *width = FRAME_RIGHT_BORDER_START (f)
|
428
|
187 - FRAME_LEFT_BORDER_END (f);
|
|
188 *height = FRAME_TOP_GUTTER_BOUNDS (f);
|
|
189 break;
|
|
190
|
|
191 case BOTTOM_GUTTER:
|
|
192 *x = FRAME_LEFT_BORDER_END (f);
|
442
|
193 *y = WINDOW_BOTTOM (bot);
|
|
194 *width = FRAME_RIGHT_BORDER_START (f)
|
428
|
195 - FRAME_LEFT_BORDER_END (f);
|
|
196 *height = FRAME_BOTTOM_GUTTER_BOUNDS (f);
|
|
197 break;
|
|
198
|
|
199 case LEFT_GUTTER:
|
|
200 *x = FRAME_LEFT_BORDER_END (f);
|
442
|
201 *y = FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f);
|
428
|
202 *width = FRAME_LEFT_GUTTER_BOUNDS (f);
|
|
203 *height = WINDOW_BOTTOM (bot)
|
442
|
204 - (FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f));
|
428
|
205 break;
|
442
|
206
|
428
|
207 case RIGHT_GUTTER:
|
|
208 *x = FRAME_RIGHT_BORDER_START (f)
|
|
209 - FRAME_RIGHT_GUTTER_BOUNDS (f);
|
442
|
210 *y = FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f);
|
428
|
211 *width = FRAME_RIGHT_GUTTER_BOUNDS (f);
|
|
212 *height = WINDOW_BOTTOM (bot)
|
442
|
213 - (FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f));
|
428
|
214 break;
|
|
215
|
|
216 default:
|
|
217 abort ();
|
|
218 }
|
|
219 }
|
|
220
|
446
|
221 /*
|
|
222 display_boxes_in_gutter_p
|
|
223
|
|
224 Determine whether the required display_glyph_area is completely
|
|
225 inside the gutter. -1 means the display_box is not in the gutter. 1
|
|
226 means the display_box and the display_glyph_area are in the
|
|
227 window. 0 means the display_box is in the gutter but the
|
|
228 display_glyph_area is not. */
|
|
229 int display_boxes_in_gutter_p (struct frame *f, struct display_box* db,
|
|
230 struct display_glyph_area* dga)
|
|
231 {
|
|
232 enum gutter_pos pos;
|
|
233 GUTTER_POS_LOOP (pos)
|
|
234 {
|
|
235 if (FRAME_GUTTER_VISIBLE (f, pos))
|
|
236 {
|
|
237 int x, y, width, height;
|
|
238 get_gutter_coords (f, pos, &x, &y, &width, &height);
|
|
239 if (db->xpos + dga->xoffset >= x
|
|
240 &&
|
|
241 db->ypos + dga->yoffset >= y
|
|
242 &&
|
|
243 db->xpos + dga->xoffset + dga->width <= x + width
|
|
244 &&
|
|
245 db->ypos + dga->yoffset + dga->height <= y + height)
|
|
246 return 1;
|
|
247 else if (db->xpos >= x && db->ypos >= y
|
|
248 && db->xpos + db->width <= x + width
|
|
249 && db->ypos + db->height <= y + height)
|
|
250 return 0;
|
|
251 }
|
|
252 }
|
|
253 return -1;
|
|
254 }
|
|
255
|
442
|
256 /* Convert the gutter specifier into something we can actually
|
|
257 display. */
|
|
258 static Lisp_Object construct_window_gutter_spec (struct window* w,
|
|
259 enum gutter_pos pos)
|
|
260 {
|
|
261 Lisp_Object rest, *args;
|
|
262 int nargs = 0;
|
|
263 Lisp_Object gutter = RAW_WINDOW_GUTTER (w, pos);
|
|
264
|
|
265 if (STRINGP (gutter) || NILP (gutter))
|
|
266 return gutter;
|
|
267
|
|
268 GET_LIST_LENGTH (gutter, nargs);
|
|
269 args = alloca_array (Lisp_Object, nargs >> 1);
|
|
270 nargs = 0;
|
|
271
|
|
272 for (rest = gutter; !NILP (rest); rest = XCDR (XCDR (rest)))
|
|
273 {
|
|
274 /* We only put things in the real gutter that are declared to be
|
|
275 visible. */
|
|
276 if (!CONSP (WINDOW_GUTTER_VISIBLE (w, pos))
|
|
277 ||
|
|
278 !NILP (Fmemq (XCAR (rest), WINDOW_GUTTER_VISIBLE (w, pos))))
|
|
279 {
|
|
280 args [nargs++] = XCAR (XCDR (rest));
|
|
281 }
|
|
282 }
|
|
283
|
|
284 return Fconcat (nargs, args);
|
|
285 }
|
|
286
|
444
|
287 /* Sizing gutters is a pain so we try and help the user by determining
|
|
288 what height will accommodate all lines. This is useless on left and
|
|
289 right gutters as we always have a maximal number of lines. */
|
|
290 static int
|
|
291 calculate_gutter_size_from_display_lines (enum gutter_pos pos,
|
|
292 display_line_dynarr* ddla)
|
|
293 {
|
|
294 int size = 0;
|
|
295 struct display_line *dl;
|
|
296
|
|
297 /* For top and bottom the calculation is easy. */
|
|
298 if (pos == TOP_GUTTER || pos == BOTTOM_GUTTER)
|
|
299 {
|
|
300 /* grab coordinates of last line */
|
|
301 if (Dynarr_length (ddla))
|
|
302 {
|
|
303 dl = Dynarr_atp (ddla, Dynarr_length (ddla) - 1);
|
|
304 size = (dl->ypos + dl->descent - dl->clip)
|
|
305 - (Dynarr_atp (ddla, 0)->ypos - Dynarr_atp (ddla, 0)->ascent);
|
|
306 }
|
|
307 }
|
|
308 /* For left and right we have to do some maths. */
|
|
309 else
|
|
310 {
|
|
311 int start_pos = 0, end_pos = 0, line;
|
|
312 for (line = 0; line < Dynarr_length (ddla); line++)
|
|
313 {
|
|
314 int block;
|
|
315 dl = Dynarr_atp (ddla, line);
|
|
316
|
|
317 for (block = 0; block < Dynarr_largest (dl->display_blocks); block++)
|
|
318 {
|
|
319 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
|
|
320
|
|
321 if (db->type == TEXT)
|
|
322 {
|
|
323 start_pos = min (db->start_pos, start_pos);
|
|
324 end_pos = max (db->end_pos, end_pos);
|
|
325 }
|
|
326 }
|
|
327 }
|
|
328 size = end_pos - start_pos;
|
|
329 }
|
|
330
|
|
331 return size;
|
|
332 }
|
|
333
|
|
334 static Lisp_Object
|
|
335 calculate_gutter_size (struct window *w, enum gutter_pos pos)
|
|
336 {
|
|
337 struct frame* f = XFRAME (WINDOW_FRAME (w));
|
|
338 int count;
|
|
339 display_line_dynarr* ddla;
|
|
340 Lisp_Object ret = Qnil;
|
|
341
|
|
342 /* degenerate case */
|
|
343 if (NILP (RAW_WINDOW_GUTTER (w, pos))
|
|
344 ||
|
|
345 !FRAME_VISIBLE_P (f)
|
|
346 ||
|
|
347 NILP (w->buffer))
|
|
348 return Qnil;
|
|
349
|
|
350 /* Redisplay code that we use relies on GC not happening. Make it
|
|
351 so. */
|
|
352 count = specpdl_depth ();
|
|
353 record_unwind_protect (restore_gc_inhibit,
|
|
354 make_int (gc_currently_forbidden));
|
|
355 gc_currently_forbidden = 1;
|
|
356
|
|
357 ddla = Dynarr_new (display_line);
|
|
358 /* generate some display lines */
|
|
359 generate_displayable_area (w, WINDOW_GUTTER (w, pos),
|
|
360 FRAME_LEFT_BORDER_END (f),
|
|
361 FRAME_TOP_BORDER_END (f),
|
|
362 FRAME_RIGHT_BORDER_START (f)
|
|
363 - FRAME_LEFT_BORDER_END (f),
|
|
364 FRAME_BOTTOM_BORDER_START (f)
|
|
365 - FRAME_TOP_BORDER_END (f),
|
|
366 ddla, 0, 0);
|
|
367
|
|
368 /* Let GC happen again. */
|
|
369 unbind_to (count, Qnil);
|
|
370
|
|
371 ret = make_int (calculate_gutter_size_from_display_lines (pos, ddla));
|
|
372 free_display_lines (ddla);
|
|
373
|
|
374 return ret;
|
|
375 }
|
|
376
|
428
|
377 static void
|
442
|
378 output_gutter (struct frame *f, enum gutter_pos pos, int force)
|
428
|
379 {
|
|
380 Lisp_Object frame;
|
|
381 Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f);
|
|
382 struct device *d = XDEVICE (f->device);
|
|
383 struct window* w = XWINDOW (window);
|
|
384 int x, y, width, height, ypos;
|
440
|
385 int line, border_width;
|
|
386 face_index findex;
|
428
|
387 display_line_dynarr* ddla, *cdla;
|
442
|
388 struct display_line *dl = 0;
|
428
|
389 int cdla_len;
|
|
390
|
440
|
391 if (!WINDOW_LIVE_P (w))
|
|
392 return;
|
|
393
|
|
394 border_width = FRAME_GUTTER_BORDER_WIDTH (f, pos);
|
442
|
395 findex = get_builtin_face_cache_index (w, Vwidget_face);
|
440
|
396
|
442
|
397 if (!f->current_display_lines[pos])
|
|
398 f->current_display_lines[pos] = Dynarr_new (display_line);
|
|
399 if (!f->desired_display_lines[pos])
|
|
400 f->desired_display_lines[pos] = Dynarr_new (display_line);
|
428
|
401
|
442
|
402 ddla = f->desired_display_lines[pos];
|
|
403 cdla = f->current_display_lines[pos];
|
428
|
404 cdla_len = Dynarr_length (cdla);
|
|
405
|
|
406 XSETFRAME (frame, f);
|
|
407
|
|
408 get_gutter_coords (f, pos, &x, &y, &width, &height);
|
|
409 /* generate some display lines */
|
|
410 generate_displayable_area (w, WINDOW_GUTTER (w, pos),
|
|
411 x + border_width, y + border_width,
|
442
|
412 width - 2 * border_width,
|
428
|
413 height - 2 * border_width, ddla, 0, findex);
|
442
|
414
|
|
415 /* We only output the gutter if we think something of significance
|
|
416 has changed. This is, for example, because redisplay can cause
|
|
417 new face cache elements to get added causing compare_runes to
|
|
418 fail because the findex for a particular face has changed. */
|
|
419 if (force || f->faces_changed || f->frame_changed ||
|
|
420 f->gutter_changed || f->glyphs_changed ||
|
|
421 f->size_changed || f->subwindows_changed ||
|
|
422 w->windows_changed || f->windows_structure_changed ||
|
|
423 cdla_len != Dynarr_length (ddla) ||
|
|
424 (f->extents_changed && w->gutter_extent_modiff[pos]))
|
428
|
425 {
|
442
|
426 #ifdef DEBUG_GUTTERS
|
639
|
427 stderr_out ("gutter redisplay [%s %dx%d@%d+%d] triggered by %s,\n",
|
|
428 pos == TOP_GUTTER ? "TOP" :
|
|
429 pos == BOTTOM_GUTTER ? "BOTTOM" :
|
|
430 pos == LEFT_GUTTER ? "LEFT" : "RIGHT",
|
446
|
431 width, height, x, y, force ? "force" :
|
442
|
432 f->faces_changed ? "f->faces_changed" :
|
|
433 f->frame_changed ? "f->frame_changed" :
|
|
434 f->gutter_changed ? "f->gutter_changed" :
|
|
435 f->glyphs_changed ? "f->glyphs_changed" :
|
|
436 f->size_changed ? "f->size_changed" :
|
|
437 f->subwindows_changed ? "f->subwindows_changed" :
|
|
438 w->windows_changed ? "w->windows_changed" :
|
|
439 f->windows_structure_changed ? "f->windows_structure_changed" :
|
|
440 cdla_len != Dynarr_length (ddla) ? "different display structures" :
|
|
441 f->extents_changed && w->gutter_extent_modiff[pos] ?
|
|
442 "f->extents_changed && w->gutter_extent_modiff[pos]" : "<null>");
|
|
443 #endif
|
|
444 /* Output each line. */
|
|
445 for (line = 0; line < Dynarr_length (ddla); line++)
|
|
446 {
|
|
447 output_display_line (w, cdla, ddla, line, -1, -1);
|
|
448 }
|
|
449
|
|
450 /* If the number of display lines has shrunk, adjust. */
|
|
451 if (cdla_len > Dynarr_length (ddla))
|
|
452 {
|
|
453 Dynarr_length (cdla) = Dynarr_length (ddla);
|
|
454 }
|
|
455
|
|
456 /* grab coordinates of last line and blank after it. */
|
|
457 if (Dynarr_length (ddla) > 0)
|
|
458 {
|
|
459 dl = Dynarr_atp (ddla, Dynarr_length (ddla) - 1);
|
|
460 ypos = dl->ypos + dl->descent - dl->clip;
|
|
461 }
|
|
462 else
|
|
463 ypos = y;
|
428
|
464
|
442
|
465 redisplay_clear_region (window, findex, x + border_width , ypos,
|
|
466 width - 2 * border_width, height - (ypos - y) - border_width);
|
|
467 /* If, for some reason, we have more to display than we have
|
|
468 room for, and we are allowed to resize the gutter, then make
|
|
469 sure this happens before the next time we try and
|
|
470 output. This can happen when face font sizes change. */
|
444
|
471 if (dl && EQ (w->gutter_size[pos], Qautodetect)
|
|
472 && (dl->clip > 0 ||
|
|
473 calculate_gutter_size_from_display_lines (pos, ddla) >
|
|
474 WINDOW_GUTTER_SIZE_INTERNAL (w, pos)))
|
442
|
475 {
|
|
476 /* #### Ideally we would just mark the specifier as dirty
|
|
477 and everything else would "just work". Unfortunately we have
|
|
478 two problems with this. One is that the specifier cache
|
|
479 won't be recalculated unless the specifier code thinks the
|
|
480 cached value has actually changed, even though we have
|
|
481 marked the specifier as dirty. Additionally, although doing
|
|
482 this results in a gutter size change, we never seem to get
|
|
483 back into redisplay so that the frame size can be updated. I
|
|
484 think this is because we are already in redisplay and later
|
|
485 on the frame will be marked as clean. Thus we also have to
|
|
486 force a pending recalculation of the frame size. */
|
|
487 w->gutter_size[pos] = Qnil;
|
|
488 Fset_specifier_dirty_flag (Vgutter_size[pos]);
|
|
489 update_gutter_geometry (f, pos);
|
|
490 }
|
|
491
|
|
492 /* bevel the gutter area if so desired */
|
|
493 if (border_width != 0)
|
|
494 {
|
|
495 MAYBE_DEVMETH (d, bevel_area,
|
|
496 (w, findex, x, y, width, height, border_width,
|
|
497 EDGE_ALL, EDGE_BEVEL_OUT));
|
|
498 }
|
|
499 }
|
|
500 else
|
428
|
501 {
|
442
|
502 /* Nothing of significance happened so sync the display line
|
|
503 structs. */
|
|
504 for (line = 0; line < Dynarr_length (ddla); line++)
|
|
505 {
|
|
506 sync_display_line_structs (w, line, 1, cdla, ddla);
|
|
507 }
|
428
|
508 }
|
|
509
|
442
|
510 w->gutter_extent_modiff [pos] = 0;
|
428
|
511 }
|
|
512
|
|
513 static void
|
|
514 clear_gutter (struct frame *f, enum gutter_pos pos)
|
|
515 {
|
|
516 int x, y, width, height;
|
|
517 Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f);
|
|
518 face_index findex = get_builtin_face_cache_index (XWINDOW (window),
|
442
|
519 Vwidget_face);
|
428
|
520 get_gutter_coords (f, pos, &x, &y, &width, &height);
|
|
521
|
|
522 SET_GUTTER_WAS_VISIBLE_FLAG (f, pos, 0);
|
|
523
|
|
524 redisplay_clear_region (window, findex, x, y, width, height);
|
|
525 }
|
|
526
|
617
|
527 /* [[#### I don't currently believe that redisplay needs to mark the
|
442
|
528 glyphs in its structures since these will always be referenced from
|
|
529 somewhere else. However, I'm not sure enough to stake my life on it
|
617
|
530 at this point, so we do the safe thing.]]
|
|
531
|
|
532 ALWAYS mark everything. --ben */
|
442
|
533
|
|
534 /* See the comment in image_instantiate_cache_result as to why marking
|
|
535 the glyph will also mark the image_instance. */
|
|
536 void
|
617
|
537 mark_gutters (struct frame *f)
|
442
|
538 {
|
|
539 enum gutter_pos pos;
|
|
540 GUTTER_POS_LOOP (pos)
|
|
541 {
|
|
542 if (f->current_display_lines[pos])
|
|
543 mark_redisplay_structs (f->current_display_lines[pos]);
|
617
|
544 /* [[#### Do we really need to mark the desired lines?]]
|
|
545 ALWAYS mark everything. --ben */
|
442
|
546 if (f->desired_display_lines[pos])
|
|
547 mark_redisplay_structs (f->desired_display_lines[pos]);
|
|
548 }
|
|
549 }
|
|
550
|
|
551 /* This is called by extent_changed_for_redisplay, so that redisplay
|
|
552 knows exactly what extents have changed. */
|
|
553 void
|
|
554 gutter_extent_signal_changed_region_maybe (Lisp_Object obj,
|
|
555 Bufpos start, Bufpos end)
|
|
556 {
|
|
557 /* #### Start and end are currently ignored but could be used by a
|
|
558 more optimal gutter redisplay. We currently loop over all frames
|
|
559 here, this could be optimized. */
|
|
560 Lisp_Object frmcons, devcons, concons;
|
|
561
|
|
562 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons)
|
|
563 {
|
|
564 struct frame *f = XFRAME (XCAR (frmcons));
|
|
565 enum gutter_pos pos;
|
|
566 Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f);
|
|
567 struct window* w = XWINDOW (window);
|
|
568
|
|
569 GUTTER_POS_LOOP (pos)
|
|
570 {
|
|
571 if (EQ (WINDOW_GUTTER (w, pos), obj))
|
|
572 {
|
|
573 w->gutter_extent_modiff[pos]++;
|
|
574 }
|
|
575 }
|
|
576 }
|
|
577 }
|
|
578
|
|
579 /* We have to change the gutter geometry separately to the gutter
|
|
580 update since it needs to occur outside of redisplay proper. */
|
|
581 static void
|
|
582 update_gutter_geometry (struct frame *f, enum gutter_pos pos)
|
|
583 {
|
|
584 /* If the gutter geometry has changed then re-layout the
|
|
585 frame. If we are in display there is almost no point in doing
|
|
586 anything else since the frame size changes will be delayed
|
|
587 until we are out of redisplay proper. */
|
|
588 if (FRAME_GUTTER_BOUNDS (f, pos) != f->current_gutter_bounds[pos])
|
|
589 {
|
|
590 int width, height;
|
|
591 pixel_to_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f),
|
|
592 &width, &height);
|
|
593 change_frame_size (f, height, width, 0);
|
|
594 }
|
|
595
|
|
596 /* Mark sizes as up-to-date. */
|
|
597 f->current_gutter_bounds[pos] = FRAME_GUTTER_BOUNDS (f, pos);
|
|
598 }
|
|
599
|
|
600 void
|
|
601 update_frame_gutter_geometry (struct frame *f)
|
|
602 {
|
|
603 if (f->gutter_changed || f->windows_structure_changed)
|
|
604 {
|
|
605 enum gutter_pos pos;
|
|
606
|
|
607 /* If the gutter geometry has changed then re-layout the
|
|
608 frame. If we are in display there is almost no point in doing
|
|
609 anything else since the frame size changes will be delayed
|
|
610 until we are out of redisplay proper. */
|
|
611 GUTTER_POS_LOOP (pos)
|
|
612 {
|
|
613 update_gutter_geometry (f, pos);
|
|
614 }
|
|
615 }
|
|
616 }
|
|
617
|
428
|
618 void
|
|
619 update_frame_gutters (struct frame *f)
|
|
620 {
|
442
|
621 if (f->faces_changed || f->frame_changed ||
|
|
622 f->gutter_changed || f->glyphs_changed ||
|
|
623 f->size_changed || f->subwindows_changed ||
|
|
624 f->windows_changed || f->windows_structure_changed ||
|
|
625 f->extents_changed)
|
428
|
626 {
|
|
627 enum gutter_pos pos;
|
442
|
628
|
428
|
629 /* We don't actually care about these when outputting the gutter
|
|
630 so locally disable them. */
|
|
631 int local_clip_changed = f->clip_changed;
|
|
632 int local_buffers_changed = f->buffers_changed;
|
|
633 f->clip_changed = 0;
|
|
634 f->buffers_changed = 0;
|
|
635
|
|
636 /* and output */
|
|
637 GUTTER_POS_LOOP (pos)
|
|
638 {
|
|
639 if (FRAME_GUTTER_VISIBLE (f, pos))
|
442
|
640 output_gutter (f, pos, 0);
|
|
641
|
428
|
642 else if (gutter_was_visible (f, pos))
|
442
|
643 clear_gutter (f, pos);
|
428
|
644 }
|
442
|
645
|
428
|
646 f->clip_changed = local_clip_changed;
|
|
647 f->buffers_changed = local_buffers_changed;
|
|
648 f->gutter_changed = 0;
|
|
649 }
|
|
650 }
|
|
651
|
|
652 void
|
|
653 reset_gutter_display_lines (struct frame* f)
|
|
654 {
|
442
|
655 enum gutter_pos pos;
|
|
656 GUTTER_POS_LOOP (pos)
|
|
657 {
|
|
658 if (f->current_display_lines[pos])
|
|
659 Dynarr_reset (f->current_display_lines[pos]);
|
|
660 }
|
428
|
661 }
|
|
662
|
|
663 static void
|
|
664 redraw_exposed_gutter (struct frame *f, enum gutter_pos pos, int x, int y,
|
|
665 int width, int height)
|
|
666 {
|
|
667 int g_x, g_y, g_width, g_height;
|
|
668
|
|
669 get_gutter_coords (f, pos, &g_x, &g_y, &g_width, &g_height);
|
|
670
|
|
671 if (((y + height) < g_y) || (y > (g_y + g_height)) || !height || !width || !g_height || !g_width)
|
|
672 return;
|
|
673 if (((x + width) < g_x) || (x > (g_x + g_width)))
|
|
674 return;
|
|
675
|
442
|
676 #ifdef DEBUG_WIDGETS
|
639
|
677 stderr_out ("redrawing gutter after expose %d+%d, %dx%d\n",
|
442
|
678 x, y, width, height);
|
|
679 #endif
|
428
|
680 /* #### optimize this - redrawing the whole gutter for every expose
|
|
681 is very expensive. We reset the current display lines because if
|
|
682 they're being exposed they are no longer current. */
|
|
683 reset_gutter_display_lines (f);
|
|
684
|
|
685 /* Even if none of the gutter is in the area, the blank region at
|
|
686 the very least must be because the first thing we did is verify
|
|
687 that some portion of the gutter is in the exposed region. */
|
442
|
688 output_gutter (f, pos, 1);
|
428
|
689 }
|
|
690
|
|
691 void
|
|
692 redraw_exposed_gutters (struct frame *f, int x, int y, int width,
|
|
693 int height)
|
|
694 {
|
|
695 enum gutter_pos pos;
|
442
|
696
|
|
697 /* We have to be "in display" when we output the gutter - make it
|
|
698 so. */
|
|
699 hold_frame_size_changes ();
|
428
|
700 GUTTER_POS_LOOP (pos)
|
|
701 {
|
|
702 if (FRAME_GUTTER_VISIBLE (f, pos))
|
|
703 redraw_exposed_gutter (f, pos, x, y, width, height);
|
|
704 }
|
442
|
705 unhold_one_frame_size_changes (f);
|
428
|
706 }
|
|
707
|
|
708 void
|
|
709 free_frame_gutters (struct frame *f)
|
|
710 {
|
442
|
711 enum gutter_pos pos;
|
|
712 GUTTER_POS_LOOP (pos)
|
428
|
713 {
|
442
|
714 if (f->current_display_lines[pos])
|
|
715 {
|
|
716 free_display_lines (f->current_display_lines[pos]);
|
|
717 f->current_display_lines[pos] = 0;
|
|
718 }
|
|
719 if (f->desired_display_lines[pos])
|
|
720 {
|
|
721 free_display_lines (f->desired_display_lines[pos]);
|
|
722 f->desired_display_lines[pos] = 0;
|
|
723 }
|
428
|
724 }
|
|
725 }
|
|
726
|
|
727 static enum gutter_pos
|
|
728 decode_gutter_position (Lisp_Object position)
|
|
729 {
|
|
730 if (EQ (position, Qtop)) return TOP_GUTTER;
|
|
731 if (EQ (position, Qbottom)) return BOTTOM_GUTTER;
|
|
732 if (EQ (position, Qleft)) return LEFT_GUTTER;
|
|
733 if (EQ (position, Qright)) return RIGHT_GUTTER;
|
563
|
734 invalid_constant ("Invalid gutter position", position);
|
428
|
735
|
|
736 return TOP_GUTTER; /* not reached */
|
|
737 }
|
|
738
|
|
739 DEFUN ("set-default-gutter-position", Fset_default_gutter_position, 1, 1, 0, /*
|
|
740 Set the position that the `default-gutter' will be displayed at.
|
|
741 Valid positions are 'top, 'bottom, 'left and 'right.
|
|
742 See `default-gutter-position'.
|
|
743 */
|
|
744 (position))
|
|
745 {
|
|
746 enum gutter_pos cur = decode_gutter_position (Vdefault_gutter_position);
|
|
747 enum gutter_pos new = decode_gutter_position (position);
|
|
748
|
|
749 if (cur != new)
|
|
750 {
|
|
751 /* The following calls will automatically cause the dirty
|
|
752 flags to be set; we delay frame size changes to avoid
|
|
753 lots of frame flickering. */
|
|
754 /* #### I think this should be GC protected. -sb */
|
|
755 hold_frame_size_changes ();
|
|
756 set_specifier_fallback (Vgutter[cur], list1 (Fcons (Qnil, Qnil)));
|
|
757 set_specifier_fallback (Vgutter[new], Vdefault_gutter);
|
|
758 set_specifier_fallback (Vgutter_size[cur], list1 (Fcons (Qnil, Qzero)));
|
|
759 set_specifier_fallback (Vgutter_size[new],
|
|
760 new == TOP_GUTTER || new == BOTTOM_GUTTER
|
|
761 ? Vdefault_gutter_height
|
|
762 : Vdefault_gutter_width);
|
|
763 set_specifier_fallback (Vgutter_border_width[cur],
|
|
764 list1 (Fcons (Qnil, Qzero)));
|
|
765 set_specifier_fallback (Vgutter_border_width[new],
|
|
766 Vdefault_gutter_border_width);
|
444
|
767 set_specifier_fallback (Vgutter_visible_p[cur], list1 (Fcons (Qnil, Qt)));
|
|
768 set_specifier_fallback (Vgutter_visible_p[new], Vdefault_gutter_visible_p);
|
442
|
769
|
428
|
770 Vdefault_gutter_position = position;
|
|
771 unhold_frame_size_changes ();
|
|
772 }
|
|
773
|
442
|
774 run_hook (Qdefault_gutter_position_changed_hook);
|
|
775
|
428
|
776 return position;
|
|
777 }
|
|
778
|
|
779 DEFUN ("default-gutter-position", Fdefault_gutter_position, 0, 0, 0, /*
|
|
780 Return the position that the `default-gutter' will be displayed at.
|
|
781 The `default-gutter' will only be displayed here if the corresponding
|
|
782 position-specific gutter specifier does not provide a value.
|
|
783 */
|
|
784 ())
|
|
785 {
|
|
786 return Vdefault_gutter_position;
|
|
787 }
|
|
788
|
|
789 DEFUN ("gutter-pixel-width", Fgutter_pixel_width, 0, 2, 0, /*
|
|
790 Return the pixel width of the gutter at POS in LOCALE.
|
|
791 POS defaults to the default gutter position. LOCALE defaults to
|
|
792 the current window.
|
|
793 */
|
|
794 (pos, locale))
|
|
795 {
|
|
796 int x, y, width, height;
|
|
797 enum gutter_pos p = TOP_GUTTER;
|
|
798 struct frame *f = decode_frame (FW_FRAME (locale));
|
|
799
|
|
800 if (NILP (pos))
|
|
801 pos = Vdefault_gutter_position;
|
|
802 p = decode_gutter_position (pos);
|
|
803
|
|
804 get_gutter_coords (f, p, &x, &y, &width, &height);
|
|
805 width -= (FRAME_GUTTER_BORDER_WIDTH (f, p) * 2);
|
|
806
|
|
807 return make_int (width);
|
|
808 }
|
|
809
|
|
810 DEFUN ("gutter-pixel-height", Fgutter_pixel_height, 0, 2, 0, /*
|
|
811 Return the pixel height of the gutter at POS in LOCALE.
|
|
812 POS defaults to the default gutter position. LOCALE defaults to
|
|
813 the current window.
|
|
814 */
|
|
815 (pos, locale))
|
|
816 {
|
|
817 int x, y, width, height;
|
|
818 enum gutter_pos p = TOP_GUTTER;
|
|
819 struct frame *f = decode_frame (FW_FRAME (locale));
|
|
820
|
|
821 if (NILP (pos))
|
|
822 pos = Vdefault_gutter_position;
|
|
823 p = decode_gutter_position (pos);
|
|
824
|
|
825 get_gutter_coords (f, p, &x, &y, &width, &height);
|
|
826 height -= (FRAME_GUTTER_BORDER_WIDTH (f, p) * 2);
|
|
827
|
|
828 return make_int (height);
|
|
829 }
|
|
830
|
|
831 DEFINE_SPECIFIER_TYPE (gutter);
|
|
832
|
|
833 static void
|
|
834 gutter_after_change (Lisp_Object specifier, Lisp_Object locale)
|
|
835 {
|
|
836 MARK_GUTTER_CHANGED;
|
|
837 }
|
|
838
|
|
839 static void
|
|
840 gutter_validate (Lisp_Object instantiator)
|
|
841 {
|
|
842 if (NILP (instantiator))
|
|
843 return;
|
|
844
|
442
|
845 /* Must be a string or a plist. */
|
|
846 if (!STRINGP (instantiator) && NILP (Fvalid_plist_p (instantiator)))
|
563
|
847 sferror ("Gutter spec must be string, plist or nil", instantiator);
|
442
|
848
|
428
|
849 if (!STRINGP (instantiator))
|
442
|
850 {
|
|
851 Lisp_Object rest;
|
|
852
|
|
853 for (rest = instantiator; !NILP (rest); rest = XCDR (XCDR (rest)))
|
|
854 {
|
|
855 if (!SYMBOLP (XCAR (rest))
|
|
856 || !STRINGP (XCAR (XCDR (rest))))
|
563
|
857 sferror ("Gutter plist spec must contain strings", instantiator);
|
442
|
858 }
|
|
859 }
|
428
|
860 }
|
|
861
|
|
862 DEFUN ("gutter-specifier-p", Fgutter_specifier_p, 1, 1, 0, /*
|
|
863 Return non-nil if OBJECT is a gutter specifier.
|
|
864
|
442
|
865 See `make-gutter-specifier' for a description of possible gutter
|
|
866 instantiators.
|
428
|
867 */
|
|
868 (object))
|
|
869 {
|
|
870 return GUTTER_SPECIFIERP (object) ? Qt : Qnil;
|
|
871 }
|
|
872
|
|
873
|
|
874 /*
|
|
875 Helper for invalidating the real specifier when default
|
|
876 specifier caching changes
|
|
877 */
|
|
878 static void
|
|
879 recompute_overlaying_specifier (Lisp_Object real_one[4])
|
|
880 {
|
|
881 enum gutter_pos pos = decode_gutter_position (Vdefault_gutter_position);
|
|
882 Fset_specifier_dirty_flag (real_one[pos]);
|
|
883 }
|
|
884
|
|
885 static void
|
|
886 gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
442
|
887 Lisp_Object oldval, enum gutter_pos pos)
|
428
|
888 {
|
442
|
889 w->real_gutter[pos] = construct_window_gutter_spec (w, pos);
|
|
890 w->real_gutter_size[pos] = w->gutter_size[pos];
|
|
891
|
|
892 if (EQ (w->real_gutter_size[pos], Qautodetect)
|
|
893 && !NILP (w->gutter_visible_p[pos]))
|
428
|
894 {
|
442
|
895 w->real_gutter_size [pos] = calculate_gutter_size (w, pos);
|
428
|
896 }
|
|
897 MARK_GUTTER_CHANGED;
|
442
|
898 MARK_MODELINE_CHANGED;
|
428
|
899 MARK_WINDOWS_CHANGED (w);
|
|
900 }
|
|
901
|
442
|
902 /* We define all of these so we can access which actual gutter changed. */
|
|
903 static void
|
|
904 top_gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
|
905 Lisp_Object oldval)
|
|
906 {
|
|
907 gutter_specs_changed (specifier, w, oldval, TOP_GUTTER);
|
|
908 }
|
|
909
|
|
910 static void
|
|
911 bottom_gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
|
912 Lisp_Object oldval)
|
|
913 {
|
|
914 gutter_specs_changed (specifier, w, oldval, BOTTOM_GUTTER);
|
|
915 }
|
|
916
|
|
917 static void
|
|
918 left_gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
|
919 Lisp_Object oldval)
|
|
920 {
|
|
921 gutter_specs_changed (specifier, w, oldval, LEFT_GUTTER);
|
|
922 }
|
|
923
|
|
924 static void
|
|
925 right_gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
|
926 Lisp_Object oldval)
|
|
927 {
|
|
928 gutter_specs_changed (specifier, w, oldval, RIGHT_GUTTER);
|
|
929 }
|
|
930
|
428
|
931 static void
|
|
932 default_gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
|
933 Lisp_Object oldval)
|
|
934 {
|
|
935 recompute_overlaying_specifier (Vgutter);
|
|
936 }
|
|
937
|
|
938 static void
|
|
939 gutter_geometry_changed_in_window (Lisp_Object specifier, struct window *w,
|
|
940 Lisp_Object oldval)
|
|
941 {
|
|
942 enum gutter_pos pos;
|
|
943 GUTTER_POS_LOOP (pos)
|
|
944 {
|
|
945 w->real_gutter_size[pos] = w->gutter_size[pos];
|
|
946 if (EQ (w->real_gutter_size[pos], Qautodetect)
|
|
947 && !NILP (w->gutter_visible_p[pos]))
|
|
948 {
|
|
949 w->real_gutter_size [pos] = calculate_gutter_size (w, pos);
|
|
950 }
|
|
951 }
|
442
|
952
|
428
|
953 MARK_GUTTER_CHANGED;
|
442
|
954 MARK_MODELINE_CHANGED;
|
428
|
955 MARK_WINDOWS_CHANGED (w);
|
|
956 }
|
|
957
|
|
958 static void
|
|
959 default_gutter_size_changed_in_window (Lisp_Object specifier, struct window *w,
|
|
960 Lisp_Object oldval)
|
|
961 {
|
|
962 recompute_overlaying_specifier (Vgutter_size);
|
|
963 }
|
|
964
|
|
965 static void
|
|
966 default_gutter_border_width_changed_in_window (Lisp_Object specifier,
|
|
967 struct window *w,
|
|
968 Lisp_Object oldval)
|
|
969 {
|
|
970 recompute_overlaying_specifier (Vgutter_border_width);
|
|
971 }
|
|
972
|
|
973 static void
|
|
974 default_gutter_visible_p_changed_in_window (Lisp_Object specifier,
|
|
975 struct window *w,
|
|
976 Lisp_Object oldval)
|
|
977 {
|
|
978 recompute_overlaying_specifier (Vgutter_visible_p);
|
442
|
979 /* Need to reconstruct the gutter specifier as it is affected by the
|
|
980 visibility. */
|
|
981 recompute_overlaying_specifier (Vgutter);
|
428
|
982 }
|
|
983
|
|
984
|
|
985 DECLARE_SPECIFIER_TYPE (gutter_size);
|
|
986 #define GUTTER_SIZE_SPECIFIERP(x) SPECIFIER_TYPEP (x, gutter_size)
|
|
987 DEFINE_SPECIFIER_TYPE (gutter_size);
|
|
988
|
|
989 static void
|
|
990 gutter_size_validate (Lisp_Object instantiator)
|
|
991 {
|
|
992 if (NILP (instantiator))
|
|
993 return;
|
|
994
|
|
995 if (!INTP (instantiator) && !EQ (instantiator, Qautodetect))
|
563
|
996 invalid_argument ("Gutter size must be an integer or 'autodetect", instantiator);
|
428
|
997 }
|
|
998
|
|
999 DEFUN ("gutter-size-specifier-p", Fgutter_size_specifier_p, 1, 1, 0, /*
|
|
1000 Return non-nil if OBJECT is a gutter-size specifier.
|
442
|
1001
|
|
1002 See `make-gutter-size-specifier' for a description of possible gutter-size
|
|
1003 instantiators.
|
428
|
1004 */
|
|
1005 (object))
|
|
1006 {
|
|
1007 return GUTTER_SIZE_SPECIFIERP (object) ? Qt : Qnil;
|
|
1008 }
|
|
1009
|
442
|
1010 DECLARE_SPECIFIER_TYPE (gutter_visible);
|
|
1011 #define GUTTER_VISIBLE_SPECIFIERP(x) SPECIFIER_TYPEP (x, gutter_visible)
|
|
1012 DEFINE_SPECIFIER_TYPE (gutter_visible);
|
|
1013
|
|
1014 static void
|
|
1015 gutter_visible_validate (Lisp_Object instantiator)
|
|
1016 {
|
|
1017 if (NILP (instantiator))
|
|
1018 return;
|
|
1019
|
|
1020 if (!NILP (instantiator) && !EQ (instantiator, Qt) && !CONSP (instantiator))
|
563
|
1021 invalid_argument ("Gutter visibility must be a boolean or list of symbols",
|
442
|
1022 instantiator);
|
|
1023
|
|
1024 if (CONSP (instantiator))
|
|
1025 {
|
|
1026 Lisp_Object rest;
|
|
1027
|
|
1028 EXTERNAL_LIST_LOOP (rest, instantiator)
|
|
1029 {
|
|
1030 if (!SYMBOLP (XCAR (rest)))
|
563
|
1031 invalid_argument ("Gutter visibility must be a boolean or list of symbols",
|
442
|
1032 instantiator);
|
|
1033 }
|
|
1034 }
|
|
1035 }
|
|
1036
|
|
1037 DEFUN ("gutter-visible-specifier-p", Fgutter_visible_specifier_p, 1, 1, 0, /*
|
|
1038 Return non-nil if OBJECT is a gutter-visible specifier.
|
|
1039
|
|
1040 See `make-gutter-visible-specifier' for a description of possible
|
|
1041 gutter-visible instantiators.
|
|
1042 */
|
|
1043 (object))
|
|
1044 {
|
|
1045 return GUTTER_VISIBLE_SPECIFIERP (object) ? Qt : Qnil;
|
|
1046 }
|
|
1047
|
428
|
1048 DEFUN ("redisplay-gutter-area", Fredisplay_gutter_area, 0, 0, 0, /*
|
|
1049 Ensure that all gutters are correctly showing their gutter specifier.
|
|
1050 */
|
|
1051 ())
|
|
1052 {
|
|
1053 Lisp_Object devcons, concons;
|
|
1054
|
|
1055 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
1056 {
|
|
1057 struct device *d = XDEVICE (XCAR (devcons));
|
|
1058 Lisp_Object frmcons;
|
|
1059
|
|
1060 DEVICE_FRAME_LOOP (frmcons, d)
|
|
1061 {
|
|
1062 struct frame *f = XFRAME (XCAR (frmcons));
|
|
1063
|
442
|
1064 MAYBE_DEVMETH (d, frame_output_begin, (f));
|
|
1065
|
|
1066 /* Sequence is quite important here. We not only want to
|
|
1067 redisplay the gutter area but we also want to flush any
|
|
1068 frame size changes out so that the gutter redisplay happens
|
|
1069 in a kosha environment.
|
|
1070
|
|
1071 This is not only so that things look right but so that
|
|
1072 glyph redisplay optimization kicks in, by default display
|
|
1073 lines will be completely re-output if
|
|
1074 f->windows_structure_changed is 1, and this is true if
|
|
1075 frame size changes haven't been flushed out. Once frame
|
|
1076 size changes have been flushed out we then need to
|
|
1077 redisplay the frame in order to flush out pending window
|
|
1078 size changes. */
|
|
1079 update_frame_gutter_geometry (f);
|
428
|
1080
|
442
|
1081 if (f->windows_structure_changed)
|
|
1082 redisplay_frame (f, 1);
|
|
1083 else if (FRAME_REPAINT_P (f))
|
|
1084 {
|
|
1085 /* We have to be "in display" when we output the gutter
|
|
1086 - make it so. */
|
|
1087 hold_frame_size_changes ();
|
|
1088 update_frame_gutters (f);
|
|
1089 unhold_one_frame_size_changes (f);
|
|
1090 }
|
|
1091
|
|
1092 MAYBE_DEVMETH (d, frame_output_end, (f));
|
|
1093 }
|
|
1094
|
|
1095 d->gutter_changed = 0;
|
428
|
1096 }
|
|
1097
|
442
|
1098 /* This is so that further changes to the gutters will trigger redisplay. */
|
|
1099 gutter_changed_set = 0;
|
|
1100 gutter_changed = 0;
|
|
1101
|
428
|
1102 return Qnil;
|
|
1103 }
|
|
1104
|
|
1105 void
|
|
1106 init_frame_gutters (struct frame *f)
|
|
1107 {
|
|
1108 enum gutter_pos pos;
|
|
1109 struct window* w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
|
|
1110 /* We are here as far in frame creation so cached specifiers are
|
|
1111 already recomputed, and possibly modified by resource
|
|
1112 initialization. We need to recalculate autodetected gutters. */
|
|
1113 GUTTER_POS_LOOP (pos)
|
|
1114 {
|
442
|
1115 w->real_gutter[pos] = construct_window_gutter_spec (w, pos);
|
428
|
1116 w->real_gutter_size[pos] = w->gutter_size[pos];
|
|
1117 if (EQ (w->gutter_size[pos], Qautodetect)
|
|
1118 && !NILP (w->gutter_visible_p[pos]))
|
|
1119 {
|
|
1120 w->real_gutter_size [pos] = calculate_gutter_size (w, pos);
|
|
1121 MARK_GUTTER_CHANGED;
|
|
1122 MARK_WINDOWS_CHANGED (w);
|
|
1123 }
|
|
1124 }
|
442
|
1125
|
|
1126 /* Keep a record of the current sizes of things. */
|
|
1127 GUTTER_POS_LOOP (pos)
|
|
1128 {
|
|
1129 f->current_gutter_bounds[pos] = FRAME_GUTTER_BOUNDS (f, pos);
|
|
1130 }
|
428
|
1131 }
|
|
1132
|
|
1133 void
|
|
1134 syms_of_gutter (void)
|
|
1135 {
|
|
1136 DEFSUBR (Fgutter_specifier_p);
|
|
1137 DEFSUBR (Fgutter_size_specifier_p);
|
442
|
1138 DEFSUBR (Fgutter_visible_specifier_p);
|
428
|
1139 DEFSUBR (Fset_default_gutter_position);
|
|
1140 DEFSUBR (Fdefault_gutter_position);
|
|
1141 DEFSUBR (Fgutter_pixel_height);
|
|
1142 DEFSUBR (Fgutter_pixel_width);
|
|
1143 DEFSUBR (Fredisplay_gutter_area);
|
|
1144
|
563
|
1145 DEFSYMBOL (Qgutter_size);
|
|
1146 DEFSYMBOL (Qgutter_visible);
|
|
1147 DEFSYMBOL (Qdefault_gutter_position_changed_hook);
|
428
|
1148 }
|
|
1149
|
|
1150 void
|
|
1151 vars_of_gutter (void)
|
|
1152 {
|
|
1153 staticpro (&Vdefault_gutter_position);
|
|
1154 Vdefault_gutter_position = Qtop;
|
|
1155
|
|
1156 Fprovide (Qgutter);
|
|
1157 }
|
|
1158
|
|
1159 void
|
|
1160 specifier_type_create_gutter (void)
|
|
1161 {
|
|
1162 INITIALIZE_SPECIFIER_TYPE (gutter, "gutter", "gutter-specifier-p");
|
|
1163 SPECIFIER_HAS_METHOD (gutter, validate);
|
|
1164 SPECIFIER_HAS_METHOD (gutter, after_change);
|
|
1165
|
|
1166 INITIALIZE_SPECIFIER_TYPE (gutter_size, "gutter-size", "gutter-size-specifier-p");
|
442
|
1167 SPECIFIER_HAS_METHOD (gutter_size, validate);
|
428
|
1168
|
442
|
1169 INITIALIZE_SPECIFIER_TYPE (gutter_visible, "gutter-visible", "gutter-visible-specifier-p");
|
|
1170 SPECIFIER_HAS_METHOD (gutter_visible, validate);
|
428
|
1171 }
|
|
1172
|
|
1173 void
|
|
1174 reinit_specifier_type_create_gutter (void)
|
|
1175 {
|
|
1176 REINITIALIZE_SPECIFIER_TYPE (gutter);
|
|
1177 REINITIALIZE_SPECIFIER_TYPE (gutter_size);
|
442
|
1178 REINITIALIZE_SPECIFIER_TYPE (gutter_visible);
|
428
|
1179 }
|
|
1180
|
|
1181 void
|
|
1182 specifier_vars_of_gutter (void)
|
|
1183 {
|
|
1184 Lisp_Object fb;
|
|
1185
|
|
1186 DEFVAR_SPECIFIER ("default-gutter", &Vdefault_gutter /*
|
|
1187 Specifier for a fallback gutter.
|
|
1188 Use `set-specifier' to change this.
|
|
1189
|
|
1190 The position of this gutter is specified in the function
|
|
1191 `default-gutter-position'. If the corresponding position-specific
|
|
1192 gutter (e.g. `top-gutter' if `default-gutter-position' is 'top)
|
|
1193 does not specify a gutter in a particular domain (usually a window),
|
|
1194 then the value of `default-gutter' in that domain, if any, will be
|
|
1195 used instead.
|
|
1196
|
|
1197 Note that the gutter at any particular position will not be
|
|
1198 displayed unless its visibility flag is true and its thickness
|
|
1199 \(width or height, depending on orientation) is non-zero. The
|
|
1200 visibility is controlled by the specifiers `top-gutter-visible-p',
|
|
1201 `bottom-gutter-visible-p', `left-gutter-visible-p', and
|
|
1202 `right-gutter-visible-p', and the thickness is controlled by the
|
|
1203 specifiers `top-gutter-height', `bottom-gutter-height',
|
|
1204 `left-gutter-width', and `right-gutter-width'.
|
|
1205
|
|
1206 Note that one of the four visibility specifiers inherits from
|
|
1207 `default-gutter-visibility' and one of the four thickness
|
|
1208 specifiers inherits from either `default-gutter-width' or
|
|
1209 `default-gutter-height' (depending on orientation), just
|
|
1210 like for the gutter description specifiers (e.g. `top-gutter')
|
|
1211 mentioned above.
|
|
1212
|
|
1213 Therefore, if you are setting `default-gutter', you should control
|
|
1214 the visibility and thickness using `default-gutter-visible-p',
|
|
1215 `default-gutter-width', and `default-gutter-height', rather than
|
|
1216 using position-specific specifiers. That way, you will get sane
|
|
1217 behavior if the user changes the default gutter position.
|
|
1218
|
442
|
1219 The gutter value should be a string, a property list of strings or
|
|
1220 nil. You can attach extents and glyphs to the string and hence display
|
|
1221 glyphs and text in other fonts in the gutter area. If the gutter value
|
|
1222 is a property list then the strings will be concatenated together
|
|
1223 before being displayed. */ );
|
428
|
1224
|
|
1225 Vdefault_gutter = Fmake_specifier (Qgutter);
|
|
1226 /* #### It would be even nicer if the specifier caching
|
|
1227 automatically knew about specifier fallbacks, so we didn't
|
|
1228 have to do it ourselves. */
|
|
1229 set_specifier_caching (Vdefault_gutter,
|
438
|
1230 offsetof (struct window, default_gutter),
|
428
|
1231 default_gutter_specs_changed,
|
444
|
1232 0, 0, 1);
|
428
|
1233
|
|
1234 DEFVAR_SPECIFIER ("top-gutter",
|
|
1235 &Vgutter[TOP_GUTTER] /*
|
|
1236 Specifier for the gutter at the top of the frame.
|
|
1237 Use `set-specifier' to change this.
|
|
1238 See `default-gutter' for a description of a valid gutter instantiator.
|
|
1239 */ );
|
|
1240 Vgutter[TOP_GUTTER] = Fmake_specifier (Qgutter);
|
|
1241 set_specifier_caching (Vgutter[TOP_GUTTER],
|
438
|
1242 offsetof (struct window, gutter[TOP_GUTTER]),
|
442
|
1243 top_gutter_specs_changed,
|
444
|
1244 0, 0, 1);
|
428
|
1245
|
|
1246 DEFVAR_SPECIFIER ("bottom-gutter",
|
|
1247 &Vgutter[BOTTOM_GUTTER] /*
|
|
1248 Specifier for the gutter at the bottom of the frame.
|
|
1249 Use `set-specifier' to change this.
|
|
1250 See `default-gutter' for a description of a valid gutter instantiator.
|
|
1251
|
|
1252 Note that, unless the `default-gutter-position' is `bottom', by
|
|
1253 default the height of the bottom gutter (controlled by
|
|
1254 `bottom-gutter-height') is 0; thus, a bottom gutter will not be
|
|
1255 displayed even if you provide a value for `bottom-gutter'.
|
|
1256 */ );
|
|
1257 Vgutter[BOTTOM_GUTTER] = Fmake_specifier (Qgutter);
|
|
1258 set_specifier_caching (Vgutter[BOTTOM_GUTTER],
|
438
|
1259 offsetof (struct window, gutter[BOTTOM_GUTTER]),
|
442
|
1260 bottom_gutter_specs_changed,
|
444
|
1261 0, 0, 1);
|
428
|
1262
|
|
1263 DEFVAR_SPECIFIER ("left-gutter",
|
|
1264 &Vgutter[LEFT_GUTTER] /*
|
|
1265 Specifier for the gutter at the left edge of the frame.
|
|
1266 Use `set-specifier' to change this.
|
|
1267 See `default-gutter' for a description of a valid gutter instantiator.
|
|
1268
|
|
1269 Note that, unless the `default-gutter-position' is `left', by
|
|
1270 default the height of the left gutter (controlled by
|
|
1271 `left-gutter-width') is 0; thus, a left gutter will not be
|
|
1272 displayed even if you provide a value for `left-gutter'.
|
|
1273 */ );
|
|
1274 Vgutter[LEFT_GUTTER] = Fmake_specifier (Qgutter);
|
|
1275 set_specifier_caching (Vgutter[LEFT_GUTTER],
|
438
|
1276 offsetof (struct window, gutter[LEFT_GUTTER]),
|
442
|
1277 left_gutter_specs_changed,
|
444
|
1278 0, 0, 1);
|
428
|
1279
|
|
1280 DEFVAR_SPECIFIER ("right-gutter",
|
|
1281 &Vgutter[RIGHT_GUTTER] /*
|
|
1282 Specifier for the gutter at the right edge of the frame.
|
|
1283 Use `set-specifier' to change this.
|
|
1284 See `default-gutter' for a description of a valid gutter instantiator.
|
|
1285
|
|
1286 Note that, unless the `default-gutter-position' is `right', by
|
|
1287 default the height of the right gutter (controlled by
|
|
1288 `right-gutter-width') is 0; thus, a right gutter will not be
|
|
1289 displayed even if you provide a value for `right-gutter'.
|
|
1290 */ );
|
|
1291 Vgutter[RIGHT_GUTTER] = Fmake_specifier (Qgutter);
|
|
1292 set_specifier_caching (Vgutter[RIGHT_GUTTER],
|
438
|
1293 offsetof (struct window, gutter[RIGHT_GUTTER]),
|
442
|
1294 right_gutter_specs_changed,
|
444
|
1295 0, 0, 1);
|
428
|
1296
|
|
1297 /* initially, top inherits from default; this can be
|
|
1298 changed with `set-default-gutter-position'. */
|
|
1299 fb = list1 (Fcons (Qnil, Qnil));
|
|
1300 set_specifier_fallback (Vdefault_gutter, fb);
|
|
1301 set_specifier_fallback (Vgutter[TOP_GUTTER], Vdefault_gutter);
|
|
1302 set_specifier_fallback (Vgutter[BOTTOM_GUTTER], fb);
|
|
1303 set_specifier_fallback (Vgutter[LEFT_GUTTER], fb);
|
|
1304 set_specifier_fallback (Vgutter[RIGHT_GUTTER], fb);
|
|
1305
|
|
1306 DEFVAR_SPECIFIER ("default-gutter-height", &Vdefault_gutter_height /*
|
|
1307 *Height of the default gutter, if it's oriented horizontally.
|
|
1308 This is a specifier; use `set-specifier' to change it.
|
|
1309
|
|
1310 The position of the default gutter is specified by the function
|
|
1311 `set-default-gutter-position'. If the corresponding position-specific
|
|
1312 gutter thickness specifier (e.g. `top-gutter-height' if
|
|
1313 `default-gutter-position' is 'top) does not specify a thickness in a
|
|
1314 particular domain (a window or a frame), then the value of
|
|
1315 `default-gutter-height' or `default-gutter-width' (depending on the
|
|
1316 gutter orientation) in that domain, if any, will be used instead.
|
|
1317
|
|
1318 Note that `default-gutter-height' is only used when
|
|
1319 `default-gutter-position' is 'top or 'bottom, and `default-gutter-width'
|
|
1320 is only used when `default-gutter-position' is 'left or 'right.
|
|
1321
|
|
1322 Note that all of the position-specific gutter thickness specifiers
|
|
1323 have a fallback value of zero when they do not correspond to the
|
|
1324 default gutter. Therefore, you will have to set a non-zero thickness
|
|
1325 value if you want a position-specific gutter to be displayed.
|
|
1326
|
|
1327 If you set the height to 'autodetect the size of the gutter will be
|
|
1328 calculated to be large enough to hold the contents of the gutter. This
|
|
1329 is the default.
|
|
1330 */ );
|
|
1331 Vdefault_gutter_height = Fmake_specifier (Qgutter_size);
|
|
1332 set_specifier_caching (Vdefault_gutter_height,
|
438
|
1333 offsetof (struct window, default_gutter_height),
|
428
|
1334 default_gutter_size_changed_in_window,
|
444
|
1335 0, 0, 1);
|
428
|
1336
|
|
1337 DEFVAR_SPECIFIER ("default-gutter-width", &Vdefault_gutter_width /*
|
|
1338 *Width of the default gutter, if it's oriented vertically.
|
|
1339 This is a specifier; use `set-specifier' to change it.
|
|
1340
|
|
1341 See `default-gutter-height' for more information.
|
|
1342 */ );
|
444
|
1343 Vdefault_gutter_width = Fmake_specifier (Qgutter_size);
|
428
|
1344 set_specifier_caching (Vdefault_gutter_width,
|
438
|
1345 offsetof (struct window, default_gutter_width),
|
428
|
1346 default_gutter_size_changed_in_window,
|
444
|
1347 0, 0, 1);
|
428
|
1348
|
|
1349 DEFVAR_SPECIFIER ("top-gutter-height",
|
|
1350 &Vgutter_size[TOP_GUTTER] /*
|
|
1351 *Height of the top gutter.
|
|
1352 This is a specifier; use `set-specifier' to change it.
|
|
1353
|
|
1354 See `default-gutter-height' for more information.
|
|
1355 */ );
|
|
1356 Vgutter_size[TOP_GUTTER] = Fmake_specifier (Qgutter_size);
|
|
1357 set_specifier_caching (Vgutter_size[TOP_GUTTER],
|
438
|
1358 offsetof (struct window, gutter_size[TOP_GUTTER]),
|
444
|
1359 gutter_geometry_changed_in_window, 0, 0, 1);
|
428
|
1360
|
|
1361 DEFVAR_SPECIFIER ("bottom-gutter-height",
|
|
1362 &Vgutter_size[BOTTOM_GUTTER] /*
|
|
1363 *Height of the bottom gutter.
|
|
1364 This is a specifier; use `set-specifier' to change it.
|
|
1365
|
|
1366 See `default-gutter-height' for more information.
|
|
1367 */ );
|
|
1368 Vgutter_size[BOTTOM_GUTTER] = Fmake_specifier (Qgutter_size);
|
|
1369 set_specifier_caching (Vgutter_size[BOTTOM_GUTTER],
|
438
|
1370 offsetof (struct window, gutter_size[BOTTOM_GUTTER]),
|
444
|
1371 gutter_geometry_changed_in_window, 0, 0, 1);
|
428
|
1372
|
|
1373 DEFVAR_SPECIFIER ("left-gutter-width",
|
|
1374 &Vgutter_size[LEFT_GUTTER] /*
|
|
1375 *Width of left gutter.
|
|
1376 This is a specifier; use `set-specifier' to change it.
|
|
1377
|
|
1378 See `default-gutter-height' for more information.
|
|
1379 */ );
|
444
|
1380 Vgutter_size[LEFT_GUTTER] = Fmake_specifier (Qgutter_size);
|
428
|
1381 set_specifier_caching (Vgutter_size[LEFT_GUTTER],
|
438
|
1382 offsetof (struct window, gutter_size[LEFT_GUTTER]),
|
444
|
1383 gutter_geometry_changed_in_window, 0, 0, 1);
|
428
|
1384
|
|
1385 DEFVAR_SPECIFIER ("right-gutter-width",
|
|
1386 &Vgutter_size[RIGHT_GUTTER] /*
|
|
1387 *Width of right gutter.
|
|
1388 This is a specifier; use `set-specifier' to change it.
|
|
1389
|
|
1390 See `default-gutter-height' for more information.
|
|
1391 */ );
|
444
|
1392 Vgutter_size[RIGHT_GUTTER] = Fmake_specifier (Qgutter_size);
|
428
|
1393 set_specifier_caching (Vgutter_size[RIGHT_GUTTER],
|
438
|
1394 offsetof (struct window, gutter_size[RIGHT_GUTTER]),
|
444
|
1395 gutter_geometry_changed_in_window, 0, 0, 1);
|
428
|
1396
|
|
1397 fb = Qnil;
|
|
1398 #ifdef HAVE_TTY
|
|
1399 fb = Fcons (Fcons (list1 (Qtty), Qautodetect), fb);
|
|
1400 #endif
|
462
|
1401 #ifdef HAVE_GTK
|
|
1402 fb = Fcons (Fcons (list1 (Qgtk), Qautodetect), fb);
|
|
1403 #endif
|
428
|
1404 #ifdef HAVE_X_WINDOWS
|
|
1405 fb = Fcons (Fcons (list1 (Qx), Qautodetect), fb);
|
|
1406 #endif
|
|
1407 #ifdef HAVE_MS_WINDOWS
|
440
|
1408 fb = Fcons (Fcons (list1 (Qmsprinter), Qautodetect), fb);
|
428
|
1409 fb = Fcons (Fcons (list1 (Qmswindows), Qautodetect), fb);
|
|
1410 #endif
|
|
1411 if (!NILP (fb))
|
|
1412 set_specifier_fallback (Vdefault_gutter_height, fb);
|
|
1413
|
|
1414 fb = Qnil;
|
|
1415 #ifdef HAVE_TTY
|
444
|
1416 fb = Fcons (Fcons (list1 (Qtty), Qautodetect), fb);
|
428
|
1417 #endif
|
|
1418 #ifdef HAVE_X_WINDOWS
|
444
|
1419 fb = Fcons (Fcons (list1 (Qx), Qautodetect), fb);
|
428
|
1420 #endif
|
462
|
1421 #ifdef HAVE_GTK
|
|
1422 fb = Fcons (Fcons (list1 (Qgtk), Qautodetect), fb);
|
|
1423 #endif
|
428
|
1424 #ifdef HAVE_MS_WINDOWS
|
444
|
1425 fb = Fcons (Fcons (list1 (Qmsprinter), Qautodetect), fb);
|
|
1426 fb = Fcons (Fcons (list1 (Qmswindows), Qautodetect), fb);
|
428
|
1427 #endif
|
|
1428 if (!NILP (fb))
|
|
1429 set_specifier_fallback (Vdefault_gutter_width, fb);
|
|
1430
|
|
1431 set_specifier_fallback (Vgutter_size[TOP_GUTTER], Vdefault_gutter_height);
|
|
1432 fb = list1 (Fcons (Qnil, Qzero));
|
|
1433 set_specifier_fallback (Vgutter_size[BOTTOM_GUTTER], fb);
|
|
1434 set_specifier_fallback (Vgutter_size[LEFT_GUTTER], fb);
|
|
1435 set_specifier_fallback (Vgutter_size[RIGHT_GUTTER], fb);
|
|
1436
|
|
1437 DEFVAR_SPECIFIER ("default-gutter-border-width",
|
|
1438 &Vdefault_gutter_border_width /*
|
|
1439 *Width of the border around the default gutter.
|
|
1440 This is a specifier; use `set-specifier' to change it.
|
|
1441
|
|
1442 The position of the default gutter is specified by the function
|
|
1443 `set-default-gutter-position'. If the corresponding position-specific
|
|
1444 gutter border width specifier (e.g. `top-gutter-border-width' if
|
|
1445 `default-gutter-position' is 'top) does not specify a border width in a
|
|
1446 particular domain (a window or a frame), then the value of
|
|
1447 `default-gutter-border-width' in that domain, if any, will be used
|
|
1448 instead.
|
|
1449
|
|
1450 */ );
|
|
1451 Vdefault_gutter_border_width = Fmake_specifier (Qnatnum);
|
|
1452 set_specifier_caching (Vdefault_gutter_border_width,
|
438
|
1453 offsetof (struct window, default_gutter_border_width),
|
428
|
1454 default_gutter_border_width_changed_in_window,
|
444
|
1455 0, 0, 0);
|
428
|
1456
|
|
1457 DEFVAR_SPECIFIER ("top-gutter-border-width",
|
|
1458 &Vgutter_border_width[TOP_GUTTER] /*
|
|
1459 *Border width of the top gutter.
|
|
1460 This is a specifier; use `set-specifier' to change it.
|
|
1461
|
|
1462 See `default-gutter-height' for more information.
|
|
1463 */ );
|
|
1464 Vgutter_border_width[TOP_GUTTER] = Fmake_specifier (Qnatnum);
|
|
1465 set_specifier_caching (Vgutter_border_width[TOP_GUTTER],
|
438
|
1466 offsetof (struct window,
|
|
1467 gutter_border_width[TOP_GUTTER]),
|
444
|
1468 gutter_geometry_changed_in_window, 0, 0, 0);
|
428
|
1469
|
|
1470 DEFVAR_SPECIFIER ("bottom-gutter-border-width",
|
|
1471 &Vgutter_border_width[BOTTOM_GUTTER] /*
|
|
1472 *Border width of the bottom gutter.
|
|
1473 This is a specifier; use `set-specifier' to change it.
|
|
1474
|
|
1475 See `default-gutter-height' for more information.
|
|
1476 */ );
|
|
1477 Vgutter_border_width[BOTTOM_GUTTER] = Fmake_specifier (Qnatnum);
|
|
1478 set_specifier_caching (Vgutter_border_width[BOTTOM_GUTTER],
|
438
|
1479 offsetof (struct window,
|
|
1480 gutter_border_width[BOTTOM_GUTTER]),
|
444
|
1481 gutter_geometry_changed_in_window, 0, 0, 0);
|
428
|
1482
|
|
1483 DEFVAR_SPECIFIER ("left-gutter-border-width",
|
|
1484 &Vgutter_border_width[LEFT_GUTTER] /*
|
|
1485 *Border width of left gutter.
|
|
1486 This is a specifier; use `set-specifier' to change it.
|
|
1487
|
|
1488 See `default-gutter-height' for more information.
|
|
1489 */ );
|
|
1490 Vgutter_border_width[LEFT_GUTTER] = Fmake_specifier (Qnatnum);
|
|
1491 set_specifier_caching (Vgutter_border_width[LEFT_GUTTER],
|
438
|
1492 offsetof (struct window,
|
|
1493 gutter_border_width[LEFT_GUTTER]),
|
444
|
1494 gutter_geometry_changed_in_window, 0, 0, 0);
|
428
|
1495
|
|
1496 DEFVAR_SPECIFIER ("right-gutter-border-width",
|
|
1497 &Vgutter_border_width[RIGHT_GUTTER] /*
|
|
1498 *Border width of right gutter.
|
|
1499 This is a specifier; use `set-specifier' to change it.
|
|
1500
|
|
1501 See `default-gutter-height' for more information.
|
|
1502 */ );
|
|
1503 Vgutter_border_width[RIGHT_GUTTER] = Fmake_specifier (Qnatnum);
|
|
1504 set_specifier_caching (Vgutter_border_width[RIGHT_GUTTER],
|
438
|
1505 offsetof (struct window,
|
|
1506 gutter_border_width[RIGHT_GUTTER]),
|
444
|
1507 gutter_geometry_changed_in_window, 0, 0, 0);
|
428
|
1508
|
|
1509 fb = Qnil;
|
|
1510 #ifdef HAVE_TTY
|
|
1511 fb = Fcons (Fcons (list1 (Qtty), Qzero), fb);
|
|
1512 #endif
|
|
1513 #ifdef HAVE_X_WINDOWS
|
|
1514 fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_GUTTER_BORDER_WIDTH)), fb);
|
|
1515 #endif
|
|
1516 #ifdef HAVE_MS_WINDOWS
|
440
|
1517 fb = Fcons (Fcons (list1 (Qmsprinter), Qzero), fb);
|
428
|
1518 fb = Fcons (Fcons (list1 (Qmswindows), make_int (DEFAULT_GUTTER_BORDER_WIDTH)), fb);
|
|
1519 #endif
|
|
1520 if (!NILP (fb))
|
|
1521 set_specifier_fallback (Vdefault_gutter_border_width, fb);
|
|
1522
|
|
1523 set_specifier_fallback (Vgutter_border_width[TOP_GUTTER], Vdefault_gutter_border_width);
|
|
1524 fb = list1 (Fcons (Qnil, Qzero));
|
|
1525 set_specifier_fallback (Vgutter_border_width[BOTTOM_GUTTER], fb);
|
|
1526 set_specifier_fallback (Vgutter_border_width[LEFT_GUTTER], fb);
|
|
1527 set_specifier_fallback (Vgutter_border_width[RIGHT_GUTTER], fb);
|
|
1528
|
|
1529 DEFVAR_SPECIFIER ("default-gutter-visible-p", &Vdefault_gutter_visible_p /*
|
|
1530 *Whether the default gutter is visible.
|
|
1531 This is a specifier; use `set-specifier' to change it.
|
|
1532
|
|
1533 The position of the default gutter is specified by the function
|
|
1534 `set-default-gutter-position'. If the corresponding position-specific
|
|
1535 gutter visibility specifier (e.g. `top-gutter-visible-p' if
|
|
1536 `default-gutter-position' is 'top) does not specify a visible-p value
|
|
1537 in a particular domain (a window or a frame), then the value of
|
|
1538 `default-gutter-visible-p' in that domain, if any, will be used
|
|
1539 instead.
|
|
1540
|
|
1541 `default-gutter-visible-p' and all of the position-specific gutter
|
|
1542 visibility specifiers have a fallback value of true.
|
|
1543 */ );
|
442
|
1544 Vdefault_gutter_visible_p = Fmake_specifier (Qgutter_visible);
|
428
|
1545 set_specifier_caching (Vdefault_gutter_visible_p,
|
438
|
1546 offsetof (struct window,
|
|
1547 default_gutter_visible_p),
|
428
|
1548 default_gutter_visible_p_changed_in_window,
|
444
|
1549 0, 0, 0);
|
428
|
1550
|
|
1551 DEFVAR_SPECIFIER ("top-gutter-visible-p",
|
|
1552 &Vgutter_visible_p[TOP_GUTTER] /*
|
|
1553 *Whether the top gutter is visible.
|
|
1554 This is a specifier; use `set-specifier' to change it.
|
|
1555
|
|
1556 See `default-gutter-visible-p' for more information.
|
|
1557 */ );
|
442
|
1558 Vgutter_visible_p[TOP_GUTTER] = Fmake_specifier (Qgutter_visible);
|
428
|
1559 set_specifier_caching (Vgutter_visible_p[TOP_GUTTER],
|
438
|
1560 offsetof (struct window,
|
|
1561 gutter_visible_p[TOP_GUTTER]),
|
444
|
1562 top_gutter_specs_changed, 0, 0, 0);
|
428
|
1563
|
|
1564 DEFVAR_SPECIFIER ("bottom-gutter-visible-p",
|
|
1565 &Vgutter_visible_p[BOTTOM_GUTTER] /*
|
|
1566 *Whether the bottom gutter is visible.
|
|
1567 This is a specifier; use `set-specifier' to change it.
|
|
1568
|
|
1569 See `default-gutter-visible-p' for more information.
|
|
1570 */ );
|
442
|
1571 Vgutter_visible_p[BOTTOM_GUTTER] = Fmake_specifier (Qgutter_visible);
|
428
|
1572 set_specifier_caching (Vgutter_visible_p[BOTTOM_GUTTER],
|
438
|
1573 offsetof (struct window,
|
|
1574 gutter_visible_p[BOTTOM_GUTTER]),
|
444
|
1575 bottom_gutter_specs_changed, 0, 0, 0);
|
428
|
1576
|
|
1577 DEFVAR_SPECIFIER ("left-gutter-visible-p",
|
|
1578 &Vgutter_visible_p[LEFT_GUTTER] /*
|
|
1579 *Whether the left gutter is visible.
|
|
1580 This is a specifier; use `set-specifier' to change it.
|
|
1581
|
|
1582 See `default-gutter-visible-p' for more information.
|
|
1583 */ );
|
442
|
1584 Vgutter_visible_p[LEFT_GUTTER] = Fmake_specifier (Qgutter_visible);
|
428
|
1585 set_specifier_caching (Vgutter_visible_p[LEFT_GUTTER],
|
438
|
1586 offsetof (struct window,
|
|
1587 gutter_visible_p[LEFT_GUTTER]),
|
444
|
1588 left_gutter_specs_changed, 0, 0, 0);
|
428
|
1589
|
|
1590 DEFVAR_SPECIFIER ("right-gutter-visible-p",
|
|
1591 &Vgutter_visible_p[RIGHT_GUTTER] /*
|
|
1592 *Whether the right gutter is visible.
|
|
1593 This is a specifier; use `set-specifier' to change it.
|
|
1594
|
|
1595 See `default-gutter-visible-p' for more information.
|
|
1596 */ );
|
442
|
1597 Vgutter_visible_p[RIGHT_GUTTER] = Fmake_specifier (Qgutter_visible);
|
428
|
1598 set_specifier_caching (Vgutter_visible_p[RIGHT_GUTTER],
|
438
|
1599 offsetof (struct window,
|
|
1600 gutter_visible_p[RIGHT_GUTTER]),
|
444
|
1601 right_gutter_specs_changed, 0, 0, 0);
|
428
|
1602
|
|
1603 /* initially, top inherits from default; this can be
|
|
1604 changed with `set-default-gutter-position'. */
|
|
1605 fb = list1 (Fcons (Qnil, Qt));
|
|
1606 set_specifier_fallback (Vdefault_gutter_visible_p, fb);
|
|
1607 set_specifier_fallback (Vgutter_visible_p[TOP_GUTTER],
|
|
1608 Vdefault_gutter_visible_p);
|
|
1609 set_specifier_fallback (Vgutter_visible_p[BOTTOM_GUTTER], fb);
|
|
1610 set_specifier_fallback (Vgutter_visible_p[LEFT_GUTTER], fb);
|
|
1611 set_specifier_fallback (Vgutter_visible_p[RIGHT_GUTTER], fb);
|
|
1612 }
|