+ enum gutter_pos pos;
+ GUTTER_POS_LOOP (pos)
+ {
+ if (f->current_display_lines[pos])
+ mark_redisplay_structs (f->current_display_lines[pos]);
+ /* #### Do we really need to mark the desired lines? */
+ if (f->desired_display_lines[pos])
+ mark_redisplay_structs (f->desired_display_lines[pos]);
+ }
+}
+
+/* This is called by extent_changed_for_redisplay, so that redisplay
+ knows exactly what extents have changed. */
+void
+gutter_extent_signal_changed_region_maybe (Lisp_Object obj,
+ Bufpos start, Bufpos end)
+{
+ /* #### Start and end are currently ignored but could be used by a
+ more optimal gutter redisplay. We currently loop over all frames
+ here, this could be optimized. */
+ Lisp_Object frmcons, devcons, concons;
+
+ FRAME_LOOP_NO_BREAK (frmcons, devcons, concons)
+ {
+ struct frame *f = XFRAME (XCAR (frmcons));
+ enum gutter_pos pos;
+ Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f);
+ struct window* w = XWINDOW (window);
+
+ GUTTER_POS_LOOP (pos)
+ {
+ if (EQ (WINDOW_GUTTER (w, pos), obj))
+ {
+ w->gutter_extent_modiff[pos]++;
+ }
+ }
+ }
+}
+
+/* We have to change the gutter geometry separately to the gutter
+ update since it needs to occur outside of redisplay proper. */
+static void
+update_gutter_geometry (struct frame *f, enum gutter_pos pos)
+{
+ /* If the gutter geometry has changed then re-layout the
+ frame. If we are in display there is almost no point in doing
+ anything else since the frame size changes will be delayed
+ until we are out of redisplay proper. */
+ if (FRAME_GUTTER_BOUNDS (f, pos) != f->current_gutter_bounds[pos])
+ {
+ int width, height;
+ pixel_to_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f),
+ &width, &height);
+ change_frame_size (f, height, width, 0);
+ }
+
+ /* Mark sizes as up-to-date. */
+ f->current_gutter_bounds[pos] = FRAME_GUTTER_BOUNDS (f, pos);
+}
+
+void
+update_frame_gutter_geometry (struct frame *f)
+{
+ if (f->gutter_changed || f->windows_structure_changed)
+ {
+ enum gutter_pos pos;
+
+ /* If the gutter geometry has changed then re-layout the
+ frame. If we are in display there is almost no point in doing
+ anything else since the frame size changes will be delayed
+ until we are out of redisplay proper. */
+ GUTTER_POS_LOOP (pos)
+ {
+ update_gutter_geometry (f, pos);
+ }
+ }