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"
|
872
|
30 #include "frame-impl.h"
|
|
31 #include "device-impl.h"
|
428
|
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));
|
1318
|
338 display_line_dynarr *ddla;
|
444
|
339 Lisp_Object ret = Qnil;
|
|
340
|
1318
|
341 /* Callers need to handle this. */
|
|
342 assert (!in_display);
|
444
|
343 /* degenerate case */
|
|
344 if (NILP (RAW_WINDOW_GUTTER (w, pos))
|
|
345 ||
|
|
346 !FRAME_VISIBLE_P (f)
|
|
347 ||
|
|
348 NILP (w->buffer))
|
|
349 return Qnil;
|
|
350
|
1318
|
351 if (!in_display)
|
|
352 {
|
|
353 int count;
|
|
354
|
|
355 /* We are calling directly into redisplay from the outside, so turn on
|
|
356 critical section protection. */
|
|
357 count = enter_redisplay_critical_section ();
|
444
|
358
|
1318
|
359 ddla = Dynarr_new (display_line);
|
|
360 /* generate some display lines */
|
|
361 generate_displayable_area (w, WINDOW_GUTTER (w, pos),
|
|
362 FRAME_LEFT_BORDER_END (f),
|
|
363 FRAME_TOP_BORDER_END (f),
|
|
364 FRAME_RIGHT_BORDER_START (f)
|
|
365 - FRAME_LEFT_BORDER_END (f),
|
|
366 FRAME_BOTTOM_BORDER_START (f)
|
|
367 - FRAME_TOP_BORDER_END (f),
|
|
368 ddla, 0, 0);
|
444
|
369
|
1318
|
370 /* Let GC happen again. */
|
|
371 exit_redisplay_critical_section (count);
|
444
|
372
|
1318
|
373 ret = make_int (calculate_gutter_size_from_display_lines (pos, ddla));
|
|
374 free_display_lines (ddla);
|
|
375 }
|
444
|
376
|
|
377 return ret;
|
|
378 }
|
|
379
|
428
|
380 static void
|
442
|
381 output_gutter (struct frame *f, enum gutter_pos pos, int force)
|
428
|
382 {
|
|
383 Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f);
|
|
384 struct device *d = XDEVICE (f->device);
|
|
385 struct window* w = XWINDOW (window);
|
|
386 int x, y, width, height, ypos;
|
440
|
387 int line, border_width;
|
|
388 face_index findex;
|
428
|
389 display_line_dynarr* ddla, *cdla;
|
442
|
390 struct display_line *dl = 0;
|
428
|
391 int cdla_len;
|
|
392
|
440
|
393 if (!WINDOW_LIVE_P (w))
|
|
394 return;
|
|
395
|
|
396 border_width = FRAME_GUTTER_BORDER_WIDTH (f, pos);
|
442
|
397 findex = get_builtin_face_cache_index (w, Vwidget_face);
|
440
|
398
|
442
|
399 if (!f->current_display_lines[pos])
|
|
400 f->current_display_lines[pos] = Dynarr_new (display_line);
|
|
401 if (!f->desired_display_lines[pos])
|
|
402 f->desired_display_lines[pos] = Dynarr_new (display_line);
|
428
|
403
|
442
|
404 ddla = f->desired_display_lines[pos];
|
|
405 cdla = f->current_display_lines[pos];
|
428
|
406 cdla_len = Dynarr_length (cdla);
|
|
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,
|
665
|
555 Charbpos start, Charbpos end)
|
442
|
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);
|
905
|
594 MARK_FRAME_LAYOUT_CHANGED (f);
|
442
|
595 }
|
|
596
|
|
597 /* Mark sizes as up-to-date. */
|
|
598 f->current_gutter_bounds[pos] = FRAME_GUTTER_BOUNDS (f, pos);
|
|
599 }
|
|
600
|
|
601 void
|
|
602 update_frame_gutter_geometry (struct frame *f)
|
|
603 {
|
905
|
604 if (f->gutter_changed
|
|
605 || f->frame_layout_changed
|
|
606 || f->windows_structure_changed)
|
442
|
607 {
|
|
608 enum gutter_pos pos;
|
|
609
|
|
610 /* If the gutter geometry has changed then re-layout the
|
|
611 frame. If we are in display there is almost no point in doing
|
|
612 anything else since the frame size changes will be delayed
|
|
613 until we are out of redisplay proper. */
|
|
614 GUTTER_POS_LOOP (pos)
|
|
615 {
|
|
616 update_gutter_geometry (f, pos);
|
|
617 }
|
|
618 }
|
|
619 }
|
|
620
|
428
|
621 void
|
|
622 update_frame_gutters (struct frame *f)
|
|
623 {
|
442
|
624 if (f->faces_changed || f->frame_changed ||
|
|
625 f->gutter_changed || f->glyphs_changed ||
|
|
626 f->size_changed || f->subwindows_changed ||
|
|
627 f->windows_changed || f->windows_structure_changed ||
|
905
|
628 f->extents_changed || f->frame_layout_changed)
|
428
|
629 {
|
|
630 enum gutter_pos pos;
|
442
|
631
|
428
|
632 /* We don't actually care about these when outputting the gutter
|
|
633 so locally disable them. */
|
|
634 int local_clip_changed = f->clip_changed;
|
|
635 int local_buffers_changed = f->buffers_changed;
|
|
636 f->clip_changed = 0;
|
|
637 f->buffers_changed = 0;
|
|
638
|
|
639 /* and output */
|
|
640 GUTTER_POS_LOOP (pos)
|
|
641 {
|
|
642 if (FRAME_GUTTER_VISIBLE (f, pos))
|
442
|
643 output_gutter (f, pos, 0);
|
|
644
|
428
|
645 else if (gutter_was_visible (f, pos))
|
442
|
646 clear_gutter (f, pos);
|
428
|
647 }
|
442
|
648
|
428
|
649 f->clip_changed = local_clip_changed;
|
|
650 f->buffers_changed = local_buffers_changed;
|
|
651 f->gutter_changed = 0;
|
|
652 }
|
|
653 }
|
|
654
|
|
655 void
|
|
656 reset_gutter_display_lines (struct frame* f)
|
|
657 {
|
442
|
658 enum gutter_pos pos;
|
|
659 GUTTER_POS_LOOP (pos)
|
|
660 {
|
|
661 if (f->current_display_lines[pos])
|
|
662 Dynarr_reset (f->current_display_lines[pos]);
|
|
663 }
|
428
|
664 }
|
|
665
|
|
666 static void
|
|
667 redraw_exposed_gutter (struct frame *f, enum gutter_pos pos, int x, int y,
|
|
668 int width, int height)
|
|
669 {
|
|
670 int g_x, g_y, g_width, g_height;
|
|
671
|
|
672 get_gutter_coords (f, pos, &g_x, &g_y, &g_width, &g_height);
|
|
673
|
|
674 if (((y + height) < g_y) || (y > (g_y + g_height)) || !height || !width || !g_height || !g_width)
|
|
675 return;
|
|
676 if (((x + width) < g_x) || (x > (g_x + g_width)))
|
|
677 return;
|
|
678
|
442
|
679 #ifdef DEBUG_WIDGETS
|
639
|
680 stderr_out ("redrawing gutter after expose %d+%d, %dx%d\n",
|
442
|
681 x, y, width, height);
|
|
682 #endif
|
428
|
683 /* #### optimize this - redrawing the whole gutter for every expose
|
|
684 is very expensive. We reset the current display lines because if
|
|
685 they're being exposed they are no longer current. */
|
|
686 reset_gutter_display_lines (f);
|
|
687
|
|
688 /* Even if none of the gutter is in the area, the blank region at
|
|
689 the very least must be because the first thing we did is verify
|
|
690 that some portion of the gutter is in the exposed region. */
|
442
|
691 output_gutter (f, pos, 1);
|
428
|
692 }
|
|
693
|
|
694 void
|
|
695 redraw_exposed_gutters (struct frame *f, int x, int y, int width,
|
|
696 int height)
|
|
697 {
|
|
698 enum gutter_pos pos;
|
442
|
699
|
1318
|
700 /* We are already inside the critical section -- our caller did that. */
|
428
|
701 GUTTER_POS_LOOP (pos)
|
|
702 {
|
|
703 if (FRAME_GUTTER_VISIBLE (f, pos))
|
|
704 redraw_exposed_gutter (f, pos, x, y, width, height);
|
|
705 }
|
|
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
|
1204
|
736 RETURN_NOT_REACHED (TOP_GUTTER);
|
428
|
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 */
|
1318
|
755 int depth = begin_hold_frame_size_changes ();
|
|
756
|
428
|
757 set_specifier_fallback (Vgutter[cur], list1 (Fcons (Qnil, Qnil)));
|
|
758 set_specifier_fallback (Vgutter[new], Vdefault_gutter);
|
|
759 set_specifier_fallback (Vgutter_size[cur], list1 (Fcons (Qnil, Qzero)));
|
|
760 set_specifier_fallback (Vgutter_size[new],
|
|
761 new == TOP_GUTTER || new == BOTTOM_GUTTER
|
|
762 ? Vdefault_gutter_height
|
|
763 : Vdefault_gutter_width);
|
|
764 set_specifier_fallback (Vgutter_border_width[cur],
|
|
765 list1 (Fcons (Qnil, Qzero)));
|
|
766 set_specifier_fallback (Vgutter_border_width[new],
|
|
767 Vdefault_gutter_border_width);
|
444
|
768 set_specifier_fallback (Vgutter_visible_p[cur], list1 (Fcons (Qnil, Qt)));
|
|
769 set_specifier_fallback (Vgutter_visible_p[new], Vdefault_gutter_visible_p);
|
1318
|
770 Vdefault_gutter_position = position;
|
442
|
771
|
1318
|
772 unbind_to (depth);
|
428
|
773 }
|
|
774
|
442
|
775 run_hook (Qdefault_gutter_position_changed_hook);
|
|
776
|
428
|
777 return position;
|
|
778 }
|
|
779
|
|
780 DEFUN ("default-gutter-position", Fdefault_gutter_position, 0, 0, 0, /*
|
|
781 Return the position that the `default-gutter' will be displayed at.
|
|
782 The `default-gutter' will only be displayed here if the corresponding
|
|
783 position-specific gutter specifier does not provide a value.
|
|
784 */
|
|
785 ())
|
|
786 {
|
|
787 return Vdefault_gutter_position;
|
|
788 }
|
|
789
|
|
790 DEFUN ("gutter-pixel-width", Fgutter_pixel_width, 0, 2, 0, /*
|
|
791 Return the pixel width of the gutter at POS in LOCALE.
|
|
792 POS defaults to the default gutter position. LOCALE defaults to
|
|
793 the current window.
|
|
794 */
|
|
795 (pos, locale))
|
|
796 {
|
|
797 int x, y, width, height;
|
|
798 enum gutter_pos p = TOP_GUTTER;
|
|
799 struct frame *f = decode_frame (FW_FRAME (locale));
|
|
800
|
|
801 if (NILP (pos))
|
|
802 pos = Vdefault_gutter_position;
|
|
803 p = decode_gutter_position (pos);
|
|
804
|
|
805 get_gutter_coords (f, p, &x, &y, &width, &height);
|
|
806 width -= (FRAME_GUTTER_BORDER_WIDTH (f, p) * 2);
|
|
807
|
|
808 return make_int (width);
|
|
809 }
|
|
810
|
|
811 DEFUN ("gutter-pixel-height", Fgutter_pixel_height, 0, 2, 0, /*
|
|
812 Return the pixel height of the gutter at POS in LOCALE.
|
|
813 POS defaults to the default gutter position. LOCALE defaults to
|
|
814 the current window.
|
|
815 */
|
|
816 (pos, locale))
|
|
817 {
|
|
818 int x, y, width, height;
|
|
819 enum gutter_pos p = TOP_GUTTER;
|
|
820 struct frame *f = decode_frame (FW_FRAME (locale));
|
|
821
|
|
822 if (NILP (pos))
|
|
823 pos = Vdefault_gutter_position;
|
|
824 p = decode_gutter_position (pos);
|
|
825
|
|
826 get_gutter_coords (f, p, &x, &y, &width, &height);
|
|
827 height -= (FRAME_GUTTER_BORDER_WIDTH (f, p) * 2);
|
|
828
|
|
829 return make_int (height);
|
|
830 }
|
|
831
|
|
832 DEFINE_SPECIFIER_TYPE (gutter);
|
|
833
|
|
834 static void
|
|
835 gutter_after_change (Lisp_Object specifier, Lisp_Object locale)
|
|
836 {
|
|
837 MARK_GUTTER_CHANGED;
|
|
838 }
|
|
839
|
|
840 static void
|
|
841 gutter_validate (Lisp_Object instantiator)
|
|
842 {
|
|
843 if (NILP (instantiator))
|
|
844 return;
|
|
845
|
442
|
846 /* Must be a string or a plist. */
|
|
847 if (!STRINGP (instantiator) && NILP (Fvalid_plist_p (instantiator)))
|
563
|
848 sferror ("Gutter spec must be string, plist or nil", instantiator);
|
442
|
849
|
428
|
850 if (!STRINGP (instantiator))
|
442
|
851 {
|
|
852 Lisp_Object rest;
|
|
853
|
|
854 for (rest = instantiator; !NILP (rest); rest = XCDR (XCDR (rest)))
|
|
855 {
|
|
856 if (!SYMBOLP (XCAR (rest))
|
|
857 || !STRINGP (XCAR (XCDR (rest))))
|
563
|
858 sferror ("Gutter plist spec must contain strings", instantiator);
|
442
|
859 }
|
|
860 }
|
428
|
861 }
|
|
862
|
|
863 DEFUN ("gutter-specifier-p", Fgutter_specifier_p, 1, 1, 0, /*
|
|
864 Return non-nil if OBJECT is a gutter specifier.
|
|
865
|
442
|
866 See `make-gutter-specifier' for a description of possible gutter
|
|
867 instantiators.
|
428
|
868 */
|
|
869 (object))
|
|
870 {
|
|
871 return GUTTER_SPECIFIERP (object) ? Qt : Qnil;
|
|
872 }
|
|
873
|
|
874
|
|
875 /*
|
|
876 Helper for invalidating the real specifier when default
|
|
877 specifier caching changes
|
|
878 */
|
|
879 static void
|
|
880 recompute_overlaying_specifier (Lisp_Object real_one[4])
|
|
881 {
|
|
882 enum gutter_pos pos = decode_gutter_position (Vdefault_gutter_position);
|
|
883 Fset_specifier_dirty_flag (real_one[pos]);
|
|
884 }
|
|
885
|
1318
|
886 static void gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
|
887 Lisp_Object oldval, enum gutter_pos pos);
|
|
888
|
|
889 static void
|
|
890 gutter_specs_changed_1 (Lisp_Object arg)
|
|
891 {
|
|
892 gutter_specs_changed (X1ST (arg), XWINDOW (X2ND (arg)),
|
|
893 X3RD (arg), (enum gutter_pos) XINT (X4TH (arg)));
|
|
894 free_list (arg);
|
|
895 }
|
|
896
|
428
|
897 static void
|
|
898 gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
1318
|
899 Lisp_Object oldval, enum gutter_pos pos)
|
428
|
900 {
|
1318
|
901 if (in_display)
|
|
902 register_post_redisplay_action (gutter_specs_changed_1,
|
|
903 list4 (specifier, wrap_window (w),
|
|
904 oldval, make_int (pos)));
|
|
905 else
|
|
906 {
|
|
907 w->real_gutter[pos] = construct_window_gutter_spec (w, pos);
|
|
908 w->real_gutter_size[pos] = w->gutter_size[pos];
|
442
|
909
|
1318
|
910 if (EQ (w->real_gutter_size[pos], Qautodetect)
|
|
911 && !NILP (w->gutter_visible_p[pos]))
|
|
912 {
|
|
913 w->real_gutter_size [pos] = calculate_gutter_size (w, pos);
|
|
914 }
|
|
915 MARK_GUTTER_CHANGED;
|
|
916 MARK_MODELINE_CHANGED;
|
|
917 MARK_WINDOWS_CHANGED (w);
|
428
|
918 }
|
|
919 }
|
|
920
|
442
|
921 /* We define all of these so we can access which actual gutter changed. */
|
|
922 static void
|
|
923 top_gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
|
924 Lisp_Object oldval)
|
|
925 {
|
|
926 gutter_specs_changed (specifier, w, oldval, TOP_GUTTER);
|
|
927 }
|
|
928
|
|
929 static void
|
|
930 bottom_gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
|
931 Lisp_Object oldval)
|
|
932 {
|
|
933 gutter_specs_changed (specifier, w, oldval, BOTTOM_GUTTER);
|
|
934 }
|
|
935
|
|
936 static void
|
|
937 left_gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
|
938 Lisp_Object oldval)
|
|
939 {
|
|
940 gutter_specs_changed (specifier, w, oldval, LEFT_GUTTER);
|
|
941 }
|
|
942
|
|
943 static void
|
|
944 right_gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
|
945 Lisp_Object oldval)
|
|
946 {
|
|
947 gutter_specs_changed (specifier, w, oldval, RIGHT_GUTTER);
|
|
948 }
|
|
949
|
428
|
950 static void
|
|
951 default_gutter_specs_changed (Lisp_Object specifier, struct window *w,
|
|
952 Lisp_Object oldval)
|
|
953 {
|
|
954 recompute_overlaying_specifier (Vgutter);
|
|
955 }
|
|
956
|
1318
|
957 static void gutter_geometry_changed_in_window (Lisp_Object specifier,
|
|
958 struct window *w,
|
|
959 Lisp_Object oldval);
|
|
960
|
|
961 static void
|
|
962 gutter_geometry_changed_in_window_1 (Lisp_Object arg)
|
|
963 {
|
|
964 gutter_geometry_changed_in_window (X1ST (arg), XWINDOW (X2ND (arg)),
|
|
965 X3RD (arg));
|
|
966 free_list (arg);
|
|
967 }
|
|
968
|
428
|
969 static void
|
|
970 gutter_geometry_changed_in_window (Lisp_Object specifier, struct window *w,
|
|
971 Lisp_Object oldval)
|
|
972 {
|
1318
|
973 if (in_display)
|
|
974 register_post_redisplay_action (gutter_geometry_changed_in_window_1,
|
|
975 list3 (specifier, wrap_window (w),
|
|
976 oldval));
|
|
977 else
|
428
|
978 {
|
1318
|
979 enum gutter_pos pos;
|
|
980 GUTTER_POS_LOOP (pos)
|
428
|
981 {
|
1318
|
982 w->real_gutter_size[pos] = w->gutter_size[pos];
|
|
983 if (EQ (w->real_gutter_size[pos], Qautodetect)
|
|
984 && !NILP (w->gutter_visible_p[pos]))
|
|
985 {
|
|
986 w->real_gutter_size [pos] = calculate_gutter_size (w, pos);
|
|
987 }
|
428
|
988 }
|
442
|
989
|
1318
|
990 MARK_GUTTER_CHANGED;
|
|
991 MARK_MODELINE_CHANGED;
|
|
992 MARK_WINDOWS_CHANGED (w);
|
|
993 }
|
428
|
994 }
|
|
995
|
|
996 static void
|
|
997 default_gutter_size_changed_in_window (Lisp_Object specifier, struct window *w,
|
|
998 Lisp_Object oldval)
|
|
999 {
|
|
1000 recompute_overlaying_specifier (Vgutter_size);
|
|
1001 }
|
|
1002
|
|
1003 static void
|
|
1004 default_gutter_border_width_changed_in_window (Lisp_Object specifier,
|
|
1005 struct window *w,
|
|
1006 Lisp_Object oldval)
|
|
1007 {
|
|
1008 recompute_overlaying_specifier (Vgutter_border_width);
|
|
1009 }
|
|
1010
|
|
1011 static void
|
|
1012 default_gutter_visible_p_changed_in_window (Lisp_Object specifier,
|
|
1013 struct window *w,
|
|
1014 Lisp_Object oldval)
|
|
1015 {
|
|
1016 recompute_overlaying_specifier (Vgutter_visible_p);
|
442
|
1017 /* Need to reconstruct the gutter specifier as it is affected by the
|
|
1018 visibility. */
|
|
1019 recompute_overlaying_specifier (Vgutter);
|
428
|
1020 }
|
|
1021
|
|
1022
|
|
1023 DECLARE_SPECIFIER_TYPE (gutter_size);
|
|
1024 #define GUTTER_SIZE_SPECIFIERP(x) SPECIFIER_TYPEP (x, gutter_size)
|
|
1025 DEFINE_SPECIFIER_TYPE (gutter_size);
|
|
1026
|
|
1027 static void
|
|
1028 gutter_size_validate (Lisp_Object instantiator)
|
|
1029 {
|
|
1030 if (NILP (instantiator))
|
|
1031 return;
|
|
1032
|
|
1033 if (!INTP (instantiator) && !EQ (instantiator, Qautodetect))
|
563
|
1034 invalid_argument ("Gutter size must be an integer or 'autodetect", instantiator);
|
428
|
1035 }
|
|
1036
|
|
1037 DEFUN ("gutter-size-specifier-p", Fgutter_size_specifier_p, 1, 1, 0, /*
|
|
1038 Return non-nil if OBJECT is a gutter-size specifier.
|
442
|
1039
|
|
1040 See `make-gutter-size-specifier' for a description of possible gutter-size
|
|
1041 instantiators.
|
428
|
1042 */
|
|
1043 (object))
|
|
1044 {
|
|
1045 return GUTTER_SIZE_SPECIFIERP (object) ? Qt : Qnil;
|
|
1046 }
|
|
1047
|
442
|
1048 DECLARE_SPECIFIER_TYPE (gutter_visible);
|
|
1049 #define GUTTER_VISIBLE_SPECIFIERP(x) SPECIFIER_TYPEP (x, gutter_visible)
|
|
1050 DEFINE_SPECIFIER_TYPE (gutter_visible);
|
|
1051
|
|
1052 static void
|
|
1053 gutter_visible_validate (Lisp_Object instantiator)
|
|
1054 {
|
|
1055 if (NILP (instantiator))
|
|
1056 return;
|
|
1057
|
|
1058 if (!NILP (instantiator) && !EQ (instantiator, Qt) && !CONSP (instantiator))
|
563
|
1059 invalid_argument ("Gutter visibility must be a boolean or list of symbols",
|
442
|
1060 instantiator);
|
|
1061
|
|
1062 if (CONSP (instantiator))
|
|
1063 {
|
|
1064 Lisp_Object rest;
|
|
1065
|
|
1066 EXTERNAL_LIST_LOOP (rest, instantiator)
|
|
1067 {
|
|
1068 if (!SYMBOLP (XCAR (rest)))
|
563
|
1069 invalid_argument ("Gutter visibility must be a boolean or list of symbols",
|
442
|
1070 instantiator);
|
|
1071 }
|
|
1072 }
|
|
1073 }
|
|
1074
|
|
1075 DEFUN ("gutter-visible-specifier-p", Fgutter_visible_specifier_p, 1, 1, 0, /*
|
|
1076 Return non-nil if OBJECT is a gutter-visible specifier.
|
|
1077
|
|
1078 See `make-gutter-visible-specifier' for a description of possible
|
|
1079 gutter-visible instantiators.
|
|
1080 */
|
|
1081 (object))
|
|
1082 {
|
|
1083 return GUTTER_VISIBLE_SPECIFIERP (object) ? Qt : Qnil;
|
|
1084 }
|
|
1085
|
428
|
1086 DEFUN ("redisplay-gutter-area", Fredisplay_gutter_area, 0, 0, 0, /*
|
|
1087 Ensure that all gutters are correctly showing their gutter specifier.
|
|
1088 */
|
|
1089 ())
|
|
1090 {
|
|
1091 Lisp_Object devcons, concons;
|
|
1092
|
1318
|
1093 /* Can't reentrantly enter redisplay */
|
|
1094 if (in_display)
|
|
1095 return Qnil;
|
|
1096
|
428
|
1097 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
1098 {
|
|
1099 struct device *d = XDEVICE (XCAR (devcons));
|
|
1100 Lisp_Object frmcons;
|
|
1101
|
|
1102 DEVICE_FRAME_LOOP (frmcons, d)
|
|
1103 {
|
|
1104 struct frame *f = XFRAME (XCAR (frmcons));
|
|
1105
|
442
|
1106 MAYBE_DEVMETH (d, frame_output_begin, (f));
|
|
1107
|
|
1108 /* Sequence is quite important here. We not only want to
|
|
1109 redisplay the gutter area but we also want to flush any
|
|
1110 frame size changes out so that the gutter redisplay happens
|
|
1111 in a kosha environment.
|
|
1112
|
|
1113 This is not only so that things look right but so that
|
|
1114 glyph redisplay optimization kicks in, by default display
|
|
1115 lines will be completely re-output if
|
|
1116 f->windows_structure_changed is 1, and this is true if
|
|
1117 frame size changes haven't been flushed out. Once frame
|
|
1118 size changes have been flushed out we then need to
|
|
1119 redisplay the frame in order to flush out pending window
|
|
1120 size changes. */
|
|
1121 update_frame_gutter_geometry (f);
|
428
|
1122
|
442
|
1123 if (f->windows_structure_changed)
|
|
1124 redisplay_frame (f, 1);
|
|
1125 else if (FRAME_REPAINT_P (f))
|
|
1126 {
|
853
|
1127 int depth;
|
|
1128
|
442
|
1129 /* We have to be "in display" when we output the gutter
|
|
1130 - make it so. */
|
853
|
1131 depth = enter_redisplay_critical_section ();
|
442
|
1132 update_frame_gutters (f);
|
853
|
1133 exit_redisplay_critical_section (depth);
|
442
|
1134 }
|
|
1135
|
|
1136 MAYBE_DEVMETH (d, frame_output_end, (f));
|
|
1137 }
|
|
1138
|
|
1139 d->gutter_changed = 0;
|
428
|
1140 }
|
|
1141
|
442
|
1142 /* This is so that further changes to the gutters will trigger redisplay. */
|
|
1143 gutter_changed_set = 0;
|
|
1144 gutter_changed = 0;
|
|
1145
|
428
|
1146 return Qnil;
|
|
1147 }
|
|
1148
|
|
1149 void
|
|
1150 init_frame_gutters (struct frame *f)
|
|
1151 {
|
|
1152 enum gutter_pos pos;
|
|
1153 struct window* w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
|
|
1154 /* We are here as far in frame creation so cached specifiers are
|
|
1155 already recomputed, and possibly modified by resource
|
|
1156 initialization. We need to recalculate autodetected gutters. */
|
|
1157 GUTTER_POS_LOOP (pos)
|
|
1158 {
|
442
|
1159 w->real_gutter[pos] = construct_window_gutter_spec (w, pos);
|
428
|
1160 w->real_gutter_size[pos] = w->gutter_size[pos];
|
|
1161 if (EQ (w->gutter_size[pos], Qautodetect)
|
|
1162 && !NILP (w->gutter_visible_p[pos]))
|
|
1163 {
|
|
1164 w->real_gutter_size [pos] = calculate_gutter_size (w, pos);
|
|
1165 MARK_GUTTER_CHANGED;
|
|
1166 MARK_WINDOWS_CHANGED (w);
|
|
1167 }
|
|
1168 }
|
442
|
1169
|
|
1170 /* Keep a record of the current sizes of things. */
|
|
1171 GUTTER_POS_LOOP (pos)
|
|
1172 {
|
|
1173 f->current_gutter_bounds[pos] = FRAME_GUTTER_BOUNDS (f, pos);
|
|
1174 }
|
428
|
1175 }
|
|
1176
|
|
1177 void
|
|
1178 syms_of_gutter (void)
|
|
1179 {
|
|
1180 DEFSUBR (Fgutter_specifier_p);
|
|
1181 DEFSUBR (Fgutter_size_specifier_p);
|
442
|
1182 DEFSUBR (Fgutter_visible_specifier_p);
|
428
|
1183 DEFSUBR (Fset_default_gutter_position);
|
|
1184 DEFSUBR (Fdefault_gutter_position);
|
|
1185 DEFSUBR (Fgutter_pixel_height);
|
|
1186 DEFSUBR (Fgutter_pixel_width);
|
|
1187 DEFSUBR (Fredisplay_gutter_area);
|
|
1188
|
563
|
1189 DEFSYMBOL (Qgutter_size);
|
|
1190 DEFSYMBOL (Qgutter_visible);
|
|
1191 DEFSYMBOL (Qdefault_gutter_position_changed_hook);
|
428
|
1192 }
|
|
1193
|
|
1194 void
|
|
1195 vars_of_gutter (void)
|
|
1196 {
|
|
1197 staticpro (&Vdefault_gutter_position);
|
|
1198 Vdefault_gutter_position = Qtop;
|
|
1199
|
|
1200 Fprovide (Qgutter);
|
|
1201 }
|
|
1202
|
|
1203 void
|
|
1204 specifier_type_create_gutter (void)
|
|
1205 {
|
|
1206 INITIALIZE_SPECIFIER_TYPE (gutter, "gutter", "gutter-specifier-p");
|
|
1207 SPECIFIER_HAS_METHOD (gutter, validate);
|
|
1208 SPECIFIER_HAS_METHOD (gutter, after_change);
|
|
1209
|
|
1210 INITIALIZE_SPECIFIER_TYPE (gutter_size, "gutter-size", "gutter-size-specifier-p");
|
442
|
1211 SPECIFIER_HAS_METHOD (gutter_size, validate);
|
428
|
1212
|
442
|
1213 INITIALIZE_SPECIFIER_TYPE (gutter_visible, "gutter-visible", "gutter-visible-specifier-p");
|
|
1214 SPECIFIER_HAS_METHOD (gutter_visible, validate);
|
428
|
1215 }
|
|
1216
|
|
1217 void
|
|
1218 reinit_specifier_type_create_gutter (void)
|
|
1219 {
|
|
1220 REINITIALIZE_SPECIFIER_TYPE (gutter);
|
|
1221 REINITIALIZE_SPECIFIER_TYPE (gutter_size);
|
442
|
1222 REINITIALIZE_SPECIFIER_TYPE (gutter_visible);
|
428
|
1223 }
|
|
1224
|
|
1225 void
|
|
1226 specifier_vars_of_gutter (void)
|
|
1227 {
|
|
1228 Lisp_Object fb;
|
|
1229
|
|
1230 DEFVAR_SPECIFIER ("default-gutter", &Vdefault_gutter /*
|
|
1231 Specifier for a fallback gutter.
|
|
1232 Use `set-specifier' to change this.
|
|
1233
|
|
1234 The position of this gutter is specified in the function
|
|
1235 `default-gutter-position'. If the corresponding position-specific
|
|
1236 gutter (e.g. `top-gutter' if `default-gutter-position' is 'top)
|
|
1237 does not specify a gutter in a particular domain (usually a window),
|
|
1238 then the value of `default-gutter' in that domain, if any, will be
|
|
1239 used instead.
|
|
1240
|
|
1241 Note that the gutter at any particular position will not be
|
|
1242 displayed unless its visibility flag is true and its thickness
|
|
1243 \(width or height, depending on orientation) is non-zero. The
|
|
1244 visibility is controlled by the specifiers `top-gutter-visible-p',
|
|
1245 `bottom-gutter-visible-p', `left-gutter-visible-p', and
|
|
1246 `right-gutter-visible-p', and the thickness is controlled by the
|
|
1247 specifiers `top-gutter-height', `bottom-gutter-height',
|
|
1248 `left-gutter-width', and `right-gutter-width'.
|
|
1249
|
|
1250 Note that one of the four visibility specifiers inherits from
|
|
1251 `default-gutter-visibility' and one of the four thickness
|
|
1252 specifiers inherits from either `default-gutter-width' or
|
|
1253 `default-gutter-height' (depending on orientation), just
|
|
1254 like for the gutter description specifiers (e.g. `top-gutter')
|
|
1255 mentioned above.
|
|
1256
|
|
1257 Therefore, if you are setting `default-gutter', you should control
|
|
1258 the visibility and thickness using `default-gutter-visible-p',
|
|
1259 `default-gutter-width', and `default-gutter-height', rather than
|
|
1260 using position-specific specifiers. That way, you will get sane
|
|
1261 behavior if the user changes the default gutter position.
|
|
1262
|
442
|
1263 The gutter value should be a string, a property list of strings or
|
|
1264 nil. You can attach extents and glyphs to the string and hence display
|
|
1265 glyphs and text in other fonts in the gutter area. If the gutter value
|
|
1266 is a property list then the strings will be concatenated together
|
|
1267 before being displayed. */ );
|
428
|
1268
|
|
1269 Vdefault_gutter = Fmake_specifier (Qgutter);
|
|
1270 /* #### It would be even nicer if the specifier caching
|
|
1271 automatically knew about specifier fallbacks, so we didn't
|
|
1272 have to do it ourselves. */
|
|
1273 set_specifier_caching (Vdefault_gutter,
|
438
|
1274 offsetof (struct window, default_gutter),
|
428
|
1275 default_gutter_specs_changed,
|
444
|
1276 0, 0, 1);
|
428
|
1277
|
|
1278 DEFVAR_SPECIFIER ("top-gutter",
|
|
1279 &Vgutter[TOP_GUTTER] /*
|
|
1280 Specifier for the gutter at the top of the frame.
|
|
1281 Use `set-specifier' to change this.
|
|
1282 See `default-gutter' for a description of a valid gutter instantiator.
|
|
1283 */ );
|
|
1284 Vgutter[TOP_GUTTER] = Fmake_specifier (Qgutter);
|
|
1285 set_specifier_caching (Vgutter[TOP_GUTTER],
|
438
|
1286 offsetof (struct window, gutter[TOP_GUTTER]),
|
442
|
1287 top_gutter_specs_changed,
|
444
|
1288 0, 0, 1);
|
428
|
1289
|
|
1290 DEFVAR_SPECIFIER ("bottom-gutter",
|
|
1291 &Vgutter[BOTTOM_GUTTER] /*
|
|
1292 Specifier for the gutter at the bottom of the frame.
|
|
1293 Use `set-specifier' to change this.
|
|
1294 See `default-gutter' for a description of a valid gutter instantiator.
|
|
1295
|
|
1296 Note that, unless the `default-gutter-position' is `bottom', by
|
|
1297 default the height of the bottom gutter (controlled by
|
|
1298 `bottom-gutter-height') is 0; thus, a bottom gutter will not be
|
|
1299 displayed even if you provide a value for `bottom-gutter'.
|
|
1300 */ );
|
|
1301 Vgutter[BOTTOM_GUTTER] = Fmake_specifier (Qgutter);
|
|
1302 set_specifier_caching (Vgutter[BOTTOM_GUTTER],
|
438
|
1303 offsetof (struct window, gutter[BOTTOM_GUTTER]),
|
442
|
1304 bottom_gutter_specs_changed,
|
444
|
1305 0, 0, 1);
|
428
|
1306
|
|
1307 DEFVAR_SPECIFIER ("left-gutter",
|
|
1308 &Vgutter[LEFT_GUTTER] /*
|
|
1309 Specifier for the gutter at the left edge of the frame.
|
|
1310 Use `set-specifier' to change this.
|
|
1311 See `default-gutter' for a description of a valid gutter instantiator.
|
|
1312
|
|
1313 Note that, unless the `default-gutter-position' is `left', by
|
|
1314 default the height of the left gutter (controlled by
|
|
1315 `left-gutter-width') is 0; thus, a left gutter will not be
|
|
1316 displayed even if you provide a value for `left-gutter'.
|
|
1317 */ );
|
|
1318 Vgutter[LEFT_GUTTER] = Fmake_specifier (Qgutter);
|
|
1319 set_specifier_caching (Vgutter[LEFT_GUTTER],
|
438
|
1320 offsetof (struct window, gutter[LEFT_GUTTER]),
|
442
|
1321 left_gutter_specs_changed,
|
444
|
1322 0, 0, 1);
|
428
|
1323
|
|
1324 DEFVAR_SPECIFIER ("right-gutter",
|
|
1325 &Vgutter[RIGHT_GUTTER] /*
|
|
1326 Specifier for the gutter at the right edge of the frame.
|
|
1327 Use `set-specifier' to change this.
|
|
1328 See `default-gutter' for a description of a valid gutter instantiator.
|
|
1329
|
|
1330 Note that, unless the `default-gutter-position' is `right', by
|
|
1331 default the height of the right gutter (controlled by
|
|
1332 `right-gutter-width') is 0; thus, a right gutter will not be
|
|
1333 displayed even if you provide a value for `right-gutter'.
|
|
1334 */ );
|
|
1335 Vgutter[RIGHT_GUTTER] = Fmake_specifier (Qgutter);
|
|
1336 set_specifier_caching (Vgutter[RIGHT_GUTTER],
|
438
|
1337 offsetof (struct window, gutter[RIGHT_GUTTER]),
|
442
|
1338 right_gutter_specs_changed,
|
444
|
1339 0, 0, 1);
|
428
|
1340
|
|
1341 /* initially, top inherits from default; this can be
|
|
1342 changed with `set-default-gutter-position'. */
|
|
1343 fb = list1 (Fcons (Qnil, Qnil));
|
|
1344 set_specifier_fallback (Vdefault_gutter, fb);
|
|
1345 set_specifier_fallback (Vgutter[TOP_GUTTER], Vdefault_gutter);
|
|
1346 set_specifier_fallback (Vgutter[BOTTOM_GUTTER], fb);
|
|
1347 set_specifier_fallback (Vgutter[LEFT_GUTTER], fb);
|
|
1348 set_specifier_fallback (Vgutter[RIGHT_GUTTER], fb);
|
|
1349
|
|
1350 DEFVAR_SPECIFIER ("default-gutter-height", &Vdefault_gutter_height /*
|
|
1351 *Height of the default gutter, if it's oriented horizontally.
|
|
1352 This is a specifier; use `set-specifier' to change it.
|
|
1353
|
|
1354 The position of the default gutter is specified by the function
|
|
1355 `set-default-gutter-position'. If the corresponding position-specific
|
|
1356 gutter thickness specifier (e.g. `top-gutter-height' if
|
|
1357 `default-gutter-position' is 'top) does not specify a thickness in a
|
|
1358 particular domain (a window or a frame), then the value of
|
|
1359 `default-gutter-height' or `default-gutter-width' (depending on the
|
|
1360 gutter orientation) in that domain, if any, will be used instead.
|
|
1361
|
|
1362 Note that `default-gutter-height' is only used when
|
|
1363 `default-gutter-position' is 'top or 'bottom, and `default-gutter-width'
|
|
1364 is only used when `default-gutter-position' is 'left or 'right.
|
|
1365
|
|
1366 Note that all of the position-specific gutter thickness specifiers
|
|
1367 have a fallback value of zero when they do not correspond to the
|
|
1368 default gutter. Therefore, you will have to set a non-zero thickness
|
|
1369 value if you want a position-specific gutter to be displayed.
|
|
1370
|
|
1371 If you set the height to 'autodetect the size of the gutter will be
|
|
1372 calculated to be large enough to hold the contents of the gutter. This
|
|
1373 is the default.
|
|
1374 */ );
|
|
1375 Vdefault_gutter_height = Fmake_specifier (Qgutter_size);
|
|
1376 set_specifier_caching (Vdefault_gutter_height,
|
438
|
1377 offsetof (struct window, default_gutter_height),
|
428
|
1378 default_gutter_size_changed_in_window,
|
444
|
1379 0, 0, 1);
|
428
|
1380
|
|
1381 DEFVAR_SPECIFIER ("default-gutter-width", &Vdefault_gutter_width /*
|
|
1382 *Width of the default gutter, if it's oriented vertically.
|
|
1383 This is a specifier; use `set-specifier' to change it.
|
|
1384
|
|
1385 See `default-gutter-height' for more information.
|
|
1386 */ );
|
444
|
1387 Vdefault_gutter_width = Fmake_specifier (Qgutter_size);
|
428
|
1388 set_specifier_caching (Vdefault_gutter_width,
|
438
|
1389 offsetof (struct window, default_gutter_width),
|
428
|
1390 default_gutter_size_changed_in_window,
|
444
|
1391 0, 0, 1);
|
428
|
1392
|
|
1393 DEFVAR_SPECIFIER ("top-gutter-height",
|
|
1394 &Vgutter_size[TOP_GUTTER] /*
|
|
1395 *Height of the top gutter.
|
|
1396 This is a specifier; use `set-specifier' to change it.
|
|
1397
|
|
1398 See `default-gutter-height' for more information.
|
|
1399 */ );
|
|
1400 Vgutter_size[TOP_GUTTER] = Fmake_specifier (Qgutter_size);
|
|
1401 set_specifier_caching (Vgutter_size[TOP_GUTTER],
|
438
|
1402 offsetof (struct window, gutter_size[TOP_GUTTER]),
|
444
|
1403 gutter_geometry_changed_in_window, 0, 0, 1);
|
428
|
1404
|
|
1405 DEFVAR_SPECIFIER ("bottom-gutter-height",
|
|
1406 &Vgutter_size[BOTTOM_GUTTER] /*
|
|
1407 *Height of the bottom gutter.
|
|
1408 This is a specifier; use `set-specifier' to change it.
|
|
1409
|
|
1410 See `default-gutter-height' for more information.
|
|
1411 */ );
|
|
1412 Vgutter_size[BOTTOM_GUTTER] = Fmake_specifier (Qgutter_size);
|
|
1413 set_specifier_caching (Vgutter_size[BOTTOM_GUTTER],
|
438
|
1414 offsetof (struct window, gutter_size[BOTTOM_GUTTER]),
|
444
|
1415 gutter_geometry_changed_in_window, 0, 0, 1);
|
428
|
1416
|
|
1417 DEFVAR_SPECIFIER ("left-gutter-width",
|
|
1418 &Vgutter_size[LEFT_GUTTER] /*
|
|
1419 *Width of left gutter.
|
|
1420 This is a specifier; use `set-specifier' to change it.
|
|
1421
|
|
1422 See `default-gutter-height' for more information.
|
|
1423 */ );
|
444
|
1424 Vgutter_size[LEFT_GUTTER] = Fmake_specifier (Qgutter_size);
|
428
|
1425 set_specifier_caching (Vgutter_size[LEFT_GUTTER],
|
438
|
1426 offsetof (struct window, gutter_size[LEFT_GUTTER]),
|
444
|
1427 gutter_geometry_changed_in_window, 0, 0, 1);
|
428
|
1428
|
|
1429 DEFVAR_SPECIFIER ("right-gutter-width",
|
|
1430 &Vgutter_size[RIGHT_GUTTER] /*
|
|
1431 *Width of right gutter.
|
|
1432 This is a specifier; use `set-specifier' to change it.
|
|
1433
|
|
1434 See `default-gutter-height' for more information.
|
|
1435 */ );
|
444
|
1436 Vgutter_size[RIGHT_GUTTER] = Fmake_specifier (Qgutter_size);
|
428
|
1437 set_specifier_caching (Vgutter_size[RIGHT_GUTTER],
|
438
|
1438 offsetof (struct window, gutter_size[RIGHT_GUTTER]),
|
444
|
1439 gutter_geometry_changed_in_window, 0, 0, 1);
|
428
|
1440
|
|
1441 fb = Qnil;
|
|
1442 #ifdef HAVE_TTY
|
|
1443 fb = Fcons (Fcons (list1 (Qtty), Qautodetect), fb);
|
|
1444 #endif
|
462
|
1445 #ifdef HAVE_GTK
|
|
1446 fb = Fcons (Fcons (list1 (Qgtk), Qautodetect), fb);
|
|
1447 #endif
|
428
|
1448 #ifdef HAVE_X_WINDOWS
|
|
1449 fb = Fcons (Fcons (list1 (Qx), Qautodetect), fb);
|
|
1450 #endif
|
|
1451 #ifdef HAVE_MS_WINDOWS
|
440
|
1452 fb = Fcons (Fcons (list1 (Qmsprinter), Qautodetect), fb);
|
428
|
1453 fb = Fcons (Fcons (list1 (Qmswindows), Qautodetect), fb);
|
|
1454 #endif
|
|
1455 if (!NILP (fb))
|
|
1456 set_specifier_fallback (Vdefault_gutter_height, fb);
|
|
1457
|
|
1458 fb = Qnil;
|
|
1459 #ifdef HAVE_TTY
|
444
|
1460 fb = Fcons (Fcons (list1 (Qtty), Qautodetect), fb);
|
428
|
1461 #endif
|
|
1462 #ifdef HAVE_X_WINDOWS
|
444
|
1463 fb = Fcons (Fcons (list1 (Qx), Qautodetect), fb);
|
428
|
1464 #endif
|
462
|
1465 #ifdef HAVE_GTK
|
|
1466 fb = Fcons (Fcons (list1 (Qgtk), Qautodetect), fb);
|
|
1467 #endif
|
428
|
1468 #ifdef HAVE_MS_WINDOWS
|
444
|
1469 fb = Fcons (Fcons (list1 (Qmsprinter), Qautodetect), fb);
|
|
1470 fb = Fcons (Fcons (list1 (Qmswindows), Qautodetect), fb);
|
428
|
1471 #endif
|
|
1472 if (!NILP (fb))
|
|
1473 set_specifier_fallback (Vdefault_gutter_width, fb);
|
|
1474
|
|
1475 set_specifier_fallback (Vgutter_size[TOP_GUTTER], Vdefault_gutter_height);
|
|
1476 fb = list1 (Fcons (Qnil, Qzero));
|
|
1477 set_specifier_fallback (Vgutter_size[BOTTOM_GUTTER], fb);
|
|
1478 set_specifier_fallback (Vgutter_size[LEFT_GUTTER], fb);
|
|
1479 set_specifier_fallback (Vgutter_size[RIGHT_GUTTER], fb);
|
|
1480
|
|
1481 DEFVAR_SPECIFIER ("default-gutter-border-width",
|
|
1482 &Vdefault_gutter_border_width /*
|
|
1483 *Width of the border around the default gutter.
|
|
1484 This is a specifier; use `set-specifier' to change it.
|
|
1485
|
|
1486 The position of the default gutter is specified by the function
|
|
1487 `set-default-gutter-position'. If the corresponding position-specific
|
|
1488 gutter border width specifier (e.g. `top-gutter-border-width' if
|
|
1489 `default-gutter-position' is 'top) does not specify a border width in a
|
|
1490 particular domain (a window or a frame), then the value of
|
|
1491 `default-gutter-border-width' in that domain, if any, will be used
|
|
1492 instead.
|
|
1493
|
|
1494 */ );
|
|
1495 Vdefault_gutter_border_width = Fmake_specifier (Qnatnum);
|
|
1496 set_specifier_caching (Vdefault_gutter_border_width,
|
438
|
1497 offsetof (struct window, default_gutter_border_width),
|
428
|
1498 default_gutter_border_width_changed_in_window,
|
444
|
1499 0, 0, 0);
|
428
|
1500
|
|
1501 DEFVAR_SPECIFIER ("top-gutter-border-width",
|
|
1502 &Vgutter_border_width[TOP_GUTTER] /*
|
|
1503 *Border width of the top gutter.
|
|
1504 This is a specifier; use `set-specifier' to change it.
|
|
1505
|
|
1506 See `default-gutter-height' for more information.
|
|
1507 */ );
|
|
1508 Vgutter_border_width[TOP_GUTTER] = Fmake_specifier (Qnatnum);
|
|
1509 set_specifier_caching (Vgutter_border_width[TOP_GUTTER],
|
438
|
1510 offsetof (struct window,
|
|
1511 gutter_border_width[TOP_GUTTER]),
|
444
|
1512 gutter_geometry_changed_in_window, 0, 0, 0);
|
428
|
1513
|
|
1514 DEFVAR_SPECIFIER ("bottom-gutter-border-width",
|
|
1515 &Vgutter_border_width[BOTTOM_GUTTER] /*
|
|
1516 *Border width of the bottom gutter.
|
|
1517 This is a specifier; use `set-specifier' to change it.
|
|
1518
|
|
1519 See `default-gutter-height' for more information.
|
|
1520 */ );
|
|
1521 Vgutter_border_width[BOTTOM_GUTTER] = Fmake_specifier (Qnatnum);
|
|
1522 set_specifier_caching (Vgutter_border_width[BOTTOM_GUTTER],
|
438
|
1523 offsetof (struct window,
|
|
1524 gutter_border_width[BOTTOM_GUTTER]),
|
444
|
1525 gutter_geometry_changed_in_window, 0, 0, 0);
|
428
|
1526
|
|
1527 DEFVAR_SPECIFIER ("left-gutter-border-width",
|
|
1528 &Vgutter_border_width[LEFT_GUTTER] /*
|
|
1529 *Border width of left gutter.
|
|
1530 This is a specifier; use `set-specifier' to change it.
|
|
1531
|
|
1532 See `default-gutter-height' for more information.
|
|
1533 */ );
|
|
1534 Vgutter_border_width[LEFT_GUTTER] = Fmake_specifier (Qnatnum);
|
|
1535 set_specifier_caching (Vgutter_border_width[LEFT_GUTTER],
|
438
|
1536 offsetof (struct window,
|
|
1537 gutter_border_width[LEFT_GUTTER]),
|
444
|
1538 gutter_geometry_changed_in_window, 0, 0, 0);
|
428
|
1539
|
|
1540 DEFVAR_SPECIFIER ("right-gutter-border-width",
|
|
1541 &Vgutter_border_width[RIGHT_GUTTER] /*
|
|
1542 *Border width of right gutter.
|
|
1543 This is a specifier; use `set-specifier' to change it.
|
|
1544
|
|
1545 See `default-gutter-height' for more information.
|
|
1546 */ );
|
|
1547 Vgutter_border_width[RIGHT_GUTTER] = Fmake_specifier (Qnatnum);
|
|
1548 set_specifier_caching (Vgutter_border_width[RIGHT_GUTTER],
|
438
|
1549 offsetof (struct window,
|
|
1550 gutter_border_width[RIGHT_GUTTER]),
|
444
|
1551 gutter_geometry_changed_in_window, 0, 0, 0);
|
428
|
1552
|
|
1553 fb = Qnil;
|
|
1554 #ifdef HAVE_TTY
|
|
1555 fb = Fcons (Fcons (list1 (Qtty), Qzero), fb);
|
|
1556 #endif
|
|
1557 #ifdef HAVE_X_WINDOWS
|
|
1558 fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_GUTTER_BORDER_WIDTH)), fb);
|
|
1559 #endif
|
|
1560 #ifdef HAVE_MS_WINDOWS
|
440
|
1561 fb = Fcons (Fcons (list1 (Qmsprinter), Qzero), fb);
|
428
|
1562 fb = Fcons (Fcons (list1 (Qmswindows), make_int (DEFAULT_GUTTER_BORDER_WIDTH)), fb);
|
|
1563 #endif
|
|
1564 if (!NILP (fb))
|
|
1565 set_specifier_fallback (Vdefault_gutter_border_width, fb);
|
|
1566
|
|
1567 set_specifier_fallback (Vgutter_border_width[TOP_GUTTER], Vdefault_gutter_border_width);
|
|
1568 fb = list1 (Fcons (Qnil, Qzero));
|
|
1569 set_specifier_fallback (Vgutter_border_width[BOTTOM_GUTTER], fb);
|
|
1570 set_specifier_fallback (Vgutter_border_width[LEFT_GUTTER], fb);
|
|
1571 set_specifier_fallback (Vgutter_border_width[RIGHT_GUTTER], fb);
|
|
1572
|
|
1573 DEFVAR_SPECIFIER ("default-gutter-visible-p", &Vdefault_gutter_visible_p /*
|
|
1574 *Whether the default gutter is visible.
|
|
1575 This is a specifier; use `set-specifier' to change it.
|
|
1576
|
|
1577 The position of the default gutter is specified by the function
|
|
1578 `set-default-gutter-position'. If the corresponding position-specific
|
|
1579 gutter visibility specifier (e.g. `top-gutter-visible-p' if
|
|
1580 `default-gutter-position' is 'top) does not specify a visible-p value
|
|
1581 in a particular domain (a window or a frame), then the value of
|
|
1582 `default-gutter-visible-p' in that domain, if any, will be used
|
|
1583 instead.
|
|
1584
|
|
1585 `default-gutter-visible-p' and all of the position-specific gutter
|
|
1586 visibility specifiers have a fallback value of true.
|
|
1587 */ );
|
442
|
1588 Vdefault_gutter_visible_p = Fmake_specifier (Qgutter_visible);
|
428
|
1589 set_specifier_caching (Vdefault_gutter_visible_p,
|
438
|
1590 offsetof (struct window,
|
|
1591 default_gutter_visible_p),
|
428
|
1592 default_gutter_visible_p_changed_in_window,
|
444
|
1593 0, 0, 0);
|
428
|
1594
|
|
1595 DEFVAR_SPECIFIER ("top-gutter-visible-p",
|
|
1596 &Vgutter_visible_p[TOP_GUTTER] /*
|
|
1597 *Whether the top gutter is visible.
|
|
1598 This is a specifier; use `set-specifier' to change it.
|
|
1599
|
|
1600 See `default-gutter-visible-p' for more information.
|
|
1601 */ );
|
442
|
1602 Vgutter_visible_p[TOP_GUTTER] = Fmake_specifier (Qgutter_visible);
|
428
|
1603 set_specifier_caching (Vgutter_visible_p[TOP_GUTTER],
|
438
|
1604 offsetof (struct window,
|
|
1605 gutter_visible_p[TOP_GUTTER]),
|
444
|
1606 top_gutter_specs_changed, 0, 0, 0);
|
428
|
1607
|
|
1608 DEFVAR_SPECIFIER ("bottom-gutter-visible-p",
|
|
1609 &Vgutter_visible_p[BOTTOM_GUTTER] /*
|
|
1610 *Whether the bottom gutter is visible.
|
|
1611 This is a specifier; use `set-specifier' to change it.
|
|
1612
|
|
1613 See `default-gutter-visible-p' for more information.
|
|
1614 */ );
|
442
|
1615 Vgutter_visible_p[BOTTOM_GUTTER] = Fmake_specifier (Qgutter_visible);
|
428
|
1616 set_specifier_caching (Vgutter_visible_p[BOTTOM_GUTTER],
|
438
|
1617 offsetof (struct window,
|
|
1618 gutter_visible_p[BOTTOM_GUTTER]),
|
444
|
1619 bottom_gutter_specs_changed, 0, 0, 0);
|
428
|
1620
|
|
1621 DEFVAR_SPECIFIER ("left-gutter-visible-p",
|
|
1622 &Vgutter_visible_p[LEFT_GUTTER] /*
|
|
1623 *Whether the left gutter is visible.
|
|
1624 This is a specifier; use `set-specifier' to change it.
|
|
1625
|
|
1626 See `default-gutter-visible-p' for more information.
|
|
1627 */ );
|
442
|
1628 Vgutter_visible_p[LEFT_GUTTER] = Fmake_specifier (Qgutter_visible);
|
428
|
1629 set_specifier_caching (Vgutter_visible_p[LEFT_GUTTER],
|
438
|
1630 offsetof (struct window,
|
|
1631 gutter_visible_p[LEFT_GUTTER]),
|
444
|
1632 left_gutter_specs_changed, 0, 0, 0);
|
428
|
1633
|
|
1634 DEFVAR_SPECIFIER ("right-gutter-visible-p",
|
|
1635 &Vgutter_visible_p[RIGHT_GUTTER] /*
|
|
1636 *Whether the right gutter is visible.
|
|
1637 This is a specifier; use `set-specifier' to change it.
|
|
1638
|
|
1639 See `default-gutter-visible-p' for more information.
|
|
1640 */ );
|
442
|
1641 Vgutter_visible_p[RIGHT_GUTTER] = Fmake_specifier (Qgutter_visible);
|
428
|
1642 set_specifier_caching (Vgutter_visible_p[RIGHT_GUTTER],
|
438
|
1643 offsetof (struct window,
|
|
1644 gutter_visible_p[RIGHT_GUTTER]),
|
444
|
1645 right_gutter_specs_changed, 0, 0, 0);
|
428
|
1646
|
|
1647 /* initially, top inherits from default; this can be
|
|
1648 changed with `set-default-gutter-position'. */
|
|
1649 fb = list1 (Fcons (Qnil, Qt));
|
|
1650 set_specifier_fallback (Vdefault_gutter_visible_p, fb);
|
|
1651 set_specifier_fallback (Vgutter_visible_p[TOP_GUTTER],
|
|
1652 Vdefault_gutter_visible_p);
|
|
1653 set_specifier_fallback (Vgutter_visible_p[BOTTOM_GUTTER], fb);
|
|
1654 set_specifier_fallback (Vgutter_visible_p[LEFT_GUTTER], fb);
|
|
1655 set_specifier_fallback (Vgutter_visible_p[RIGHT_GUTTER], fb);
|
|
1656 }
|