changeset 40816:46a04c76845c

(x_display_and_set_cursor): Do not move system caret if cursor_glyph is NULL.
author Jason Rumney <jasonr@gnu.org>
date Wed, 07 Nov 2001 21:11:00 +0000
parents 18a8015d9546
children 4ce7ef7fad3f
files src/w32term.c
diffstat 1 files changed, 24 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32term.c	Wed Nov 07 19:46:57 2001 +0000
+++ b/src/w32term.c	Wed Nov 07 21:11:00 2001 +0000
@@ -9604,31 +9604,33 @@
 	 and speech synthesizers can follow the cursor.  */
       if (active_cursor)
 	{
-	  HWND hwnd = FRAME_W32_WINDOW (f);
-
 	  struct glyph * cursor_glyph = get_phys_cursor_glyph (w);
-	  int caret_width = cursor_glyph->pixel_width;
-	  w32_system_caret_x
-	    = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
-	  w32_system_caret_y
-	    = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y)
-	       + glyph_row->ascent - w->phys_cursor_ascent);
-
-	  /* If the size of the active cursor changed, destroy the old
-	     system caret.  */
-	  if (w32_system_caret_hwnd
-	      && (w32_system_caret_height != w->phys_cursor_height
-		  || w32_system_caret_width != caret_width))
-	    PostMessage (hwnd, WM_EMACS_DESTROY_CARET, NULL, NULL);
-
-	  if (!w32_system_caret_hwnd)
+	  if (cursor_glyph)
 	    {
-	      w32_system_caret_height = w->phys_cursor_height;
-	      w32_system_caret_width = caret_width;
+	      HWND hwnd = FRAME_W32_WINDOW (f);
+	      int caret_width = cursor_glyph->pixel_width;
+	      w32_system_caret_x
+		= WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
+	      w32_system_caret_y
+		= (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y)
+		   + glyph_row->ascent - w->phys_cursor_ascent);
+
+	      /* If the size of the active cursor changed, destroy the old
+		 system caret.  */
+	      if (w32_system_caret_hwnd
+		  && (w32_system_caret_height != w->phys_cursor_height
+		      || w32_system_caret_width != caret_width))
+		PostMessage (hwnd, WM_EMACS_DESTROY_CARET, NULL, NULL);
+
+	      if (!w32_system_caret_hwnd)
+		{
+		  w32_system_caret_height = w->phys_cursor_height;
+		  w32_system_caret_width = caret_width;
+		}
+
+	      /* Move the system caret.  */
+	      PostMessage (hwnd, WM_EMACS_TRACK_CARET, NULL, NULL);
 	    }
-
-	  /* Move the system caret.  */
-	  PostMessage (hwnd, WM_EMACS_TRACK_CARET, NULL, NULL);
 	}
 
       switch (new_cursor_type)