changeset 71021:a86a3503e350

(x_draw_stretch_glyph_string): Fix problems with invisible cursor and erasing cursor on partially visible stretch glyph on left. (x_draw_hollow_cursor): Compute x via get_phys_cursor_geometry.
author Kim F. Storm <storm@cua.dk>
date Sat, 27 May 2006 22:37:39 +0000
parents 3cc856b86408
children e21047351343
files src/macterm.c src/w32term.c src/xterm.c
diffstat 3 files changed, 80 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/src/macterm.c	Sat May 27 22:37:05 2006 +0000
+++ b/src/macterm.c	Sat May 27 22:37:39 2006 +0000
@@ -3529,19 +3529,28 @@
     {
       /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
 	 as wide as the stretch glyph.  */
-      int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width);
+      int width, background_width = s->background_width;
+      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+      if (x < left_x)
+	{
+	  background_width -= left_x - x;
+	  x = left_x;
+	}
+      width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
 
       /* Draw cursor.  */
-      x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height);
+      x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
 
       /* Clear rest using the GC of the original non-cursor face.  */
-      if (width < s->background_width)
+      if (width < background_width)
 	{
-	  int x = s->x + width, y = s->y;
-	  int w = s->background_width - width, h = s->height;
+	  int y = s->y;
+	  int w = background_width - width, h = s->height;
 	  Rect r;
 	  GC gc;
 
+	  x += width;
 	  if (s->row->mouse_face_p
 	      && cursor_in_mouse_face_p (s->w))
 	    {
@@ -3568,8 +3577,18 @@
 	}
     }
   else if (!s->background_filled_p)
-    x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width,
-				 s->height);
+    {
+      int background_width = s->background_width;
+      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+      if (x < left_x)
+	{
+	  background_width -= left_x - x;
+	  x = left_x;
+	}
+      if (background_width > 0)
+	x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
+    }
 
   s->background_filled_p = 1;
 }
@@ -5396,8 +5415,7 @@
     return;
 
   /* Compute frame-relative coordinates for phys cursor.  */
-  x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
-  y = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
+  get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h);
   wd = w->phys_cursor_width;
 
   /* The foreground of cursor_gc is typically the same as the normal
--- a/src/w32term.c	Sat May 27 22:37:05 2006 +0000
+++ b/src/w32term.c	Sat May 27 22:37:39 2006 +0000
@@ -2389,20 +2389,29 @@
     {
       /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
 	 as wide as the stretch glyph.  */
-      int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width);
+      int width, background_width = s->background_width;
+      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+      if (x < left_x)
+	{
+	  background_width -= left_x - x;
+	  x = left_x;
+	}
+      width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
 
       /* Draw cursor.  */
-      x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height);
+      x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
 
       /* Clear rest using the GC of the original non-cursor face.  */
-      if (width < s->background_width)
+      if (width < background_width)
 	{
 	  XGCValues *gc = s->face->gc;
-	  int x = s->x + width, y = s->y;
-	  int w = s->background_width - width, h = s->height;
+	  int y = s->y;
+	  int w = background_width - width, h = s->height;
 	  RECT r;
           HDC hdc = s->hdc;
 
+	  x += width;
 	  if (s->row->mouse_face_p
 	      && cursor_in_mouse_face_p (s->w))
 	    {
@@ -2431,8 +2440,17 @@
         }
     }
   else if (!s->background_filled_p)
-    x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width,
-				 s->height);
+    {
+      int background_width = s->background_width;
+      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+      if (x < left_x)
+	{
+	  background_width -= left_x - x;
+	  x = left_x;
+	}
+      if (background_width > 0)
+	x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
 
   s->background_filled_p = 1;
 }
@@ -4942,8 +4960,7 @@
     return;
 
   /* Compute frame-relative coordinates for phys cursor.  */
-  rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
-  rect.top = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
+  get_phys_cursor_geometry (w, row, cursor_glyph, &rect.left, &rect.top, &h);
   rect.bottom = rect.top + h;
   rect.right = rect.left + w->phys_cursor_width;
 
--- a/src/xterm.c	Sat May 27 22:37:05 2006 +0000
+++ b/src/xterm.c	Sat May 27 22:37:39 2006 +0000
@@ -2531,19 +2531,28 @@
     {
       /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
 	 as wide as the stretch glyph.  */
-      int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width);
+      int width, background_width = s->background_width;
+      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+      if (x < left_x)
+	{
+	  background_width -= left_x - x;
+	  x = left_x;
+	}
+      width = min (FRAME_COLUMN_WIDTH (s->f), background_width);
 
       /* Draw cursor.  */
-      x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height);
+      x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height);
 
       /* Clear rest using the GC of the original non-cursor face.  */
-      if (width < s->background_width)
+      if (width < background_width)
 	{
-	  int x = s->x + width, y = s->y;
-	  int w = s->background_width - width, h = s->height;
+	  int y = s->y;
+	  int w = background_width - width, h = s->height;
 	  XRectangle r;
 	  GC gc;
 
+	  x += width;
 	  if (s->row->mouse_face_p
 	      && cursor_in_mouse_face_p (s->w))
 	    {
@@ -2574,8 +2583,18 @@
 	}
     }
   else if (!s->background_filled_p)
-    x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width,
-				 s->height);
+    {
+      int background_width = s->background_width;
+      int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA);
+
+      if (x < left_x)
+	{
+	  background_width -= left_x - x;
+	  x = left_x;
+	}
+      if (background_width > 0)
+	x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
+    }
 
   s->background_filled_p = 1;
 }
@@ -7155,8 +7174,7 @@
     return;
 
   /* Compute frame-relative coordinates for phys cursor.  */
-  x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
-  y = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
+  get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h);
   wd = w->phys_cursor_width;
 
   /* The foreground of cursor_gc is typically the same as the normal