emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/dispnew.c


From: Gerd Moellmann
Subject: [Emacs-diffs] Changes to emacs/src/dispnew.c
Date: Fri, 12 Apr 2002 05:36:56 -0400

Index: emacs/src/dispnew.c
diff -c emacs/src/dispnew.c:1.304 emacs/src/dispnew.c:1.305
*** emacs/src/dispnew.c:1.304   Sat Mar 30 06:55:21 2002
--- emacs/src/dispnew.c Fri Apr 12 05:36:56 2002
***************
*** 5754,5759 ****
--- 5754,5810 ----
  }
  
  
+ /* Value is the string under window-relative coordinates X/Y in either
+    marginal area, or nil if none.  *CHARPOS is set to the position in
+    the string returned.  */
+ 
+ Lisp_Object
+ marginal_area_string (w, x, y, area, charpos)
+      struct window *w;
+      int x, y;
+      int *charpos;
+      int area;
+ {
+   struct glyph_row *row = w->current_matrix->rows;
+   struct glyph *glyph, *end;
+   int x0, i, wy = y;
+   Lisp_Object string = Qnil;
+ 
+   if (area == 6)
+     area = LEFT_MARGIN_AREA;
+   else if (area == 7)
+     area = RIGHT_MARGIN_AREA;
+   else
+     abort ();
+ 
+   for (i = 0; row->enabled_p && i < w->current_matrix->nrows; ++i, ++row)
+     if (wy >= row->y && wy < MATRIX_ROW_BOTTOM_Y (row))
+       break;
+ 
+   if (row->enabled_p)
+     {
+       /* Find the glyph under X.  If we find one with a string object,
+        it's the one we were looking for.  */
+       glyph = row->glyphs[area];
+       end = glyph + row->used[area];
+       if (area == RIGHT_MARGIN_AREA)
+       x0 = (window_box_width (w, TEXT_AREA)
+             + window_box_width (w, LEFT_MARGIN_AREA));
+       else
+       x0 = 0;
+       for (; glyph < end; x0 += glyph->pixel_width, ++glyph)
+       if (x >= x0 && x < x0 + glyph->pixel_width)
+         {
+           string = glyph->object;
+           *charpos = glyph->charpos;
+           break;
+         }
+     }
+ 
+   return string;
+ }
+ 
+ 
  /***********************************************************************
                         Changing Frame Sizes
   ***********************************************************************/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]