emacs-diffs
[Top][All Lists]
Advanced

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

master c829e63b0a: Fix double unfocus during NS cursor display


From: Po Lu
Subject: master c829e63b0a: Fix double unfocus during NS cursor display
Date: Fri, 15 Jul 2022 10:02:58 -0400 (EDT)

branch: master
commit c829e63b0aeb6e6e3af4ca3a69cc90689b423de4
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix double unfocus during NS cursor display
    
    * src/nsterm.m (ns_draw_window_cursor): Unfocus around calls to
    draw_phys_cursor_glyph, then focus again later.  (bug#56559)
---
 src/nsterm.m | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 2ba167f189..2372ea8ae0 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3103,16 +3103,25 @@ ns_draw_window_cursor (struct window *w, struct 
glyph_row *glyph_row,
     case NO_CURSOR:
       break;
     case FILLED_BOX_CURSOR:
+      /* The call to draw_phys_cursor_glyph can end up undoing the
+        ns_focus, so unfocus here and regain focus later.  */
+      [ctx restoreGraphicsState];
+      ns_unfocus (f);
       draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR);
+      ns_focus (f, &r, 1);
       break;
     case HOLLOW_BOX_CURSOR:
+      [ctx restoreGraphicsState];
+      ns_unfocus (f);
       draw_phys_cursor_glyph (w, glyph_row, DRAW_NORMAL_TEXT);
+      ns_focus (f, &r, 1);
 
       /* This works like it does in PostScript, not X Windows.  */
       [NSBezierPath strokeRect: NSInsetRect (r, 0.5, 0.5)];
       break;
     case HBAR_CURSOR:
       NSRectFill (r);
+      [ctx restoreGraphicsState];
       break;
     case BAR_CURSOR:
       s = r;
@@ -3123,10 +3132,10 @@ ns_draw_window_cursor (struct window *w, struct 
glyph_row *glyph_row,
         s.origin.x += cursor_glyph->pixel_width - s.size.width;
 
       NSRectFill (s);
+      [ctx restoreGraphicsState];
       break;
     }
 
-  [ctx restoreGraphicsState];
   ns_unfocus (f);
 }
 



reply via email to

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