From: Po Lu Date: Fri, 7 Jan 2022 12:01:11 +0000 (+0800) Subject: Fix special-cased cursor foreground and background correctly on PGTK X-Git-Tag: emacs-29.0.90~3212 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d4e48c36420ec3a56c56f24cfa3888811b02e019;p=emacs.git Fix special-cased cursor foreground and background correctly on PGTK * src/pgtkfns.c (x_set_foreground_color): (x_set_background_color): Set cursor color as well if appropriate. (bug#53073) --- diff --git a/src/pgtkfns.c b/src/pgtkfns.c index e94c2dfb30f..c604e2f1002 100644 --- a/src/pgtkfns.c +++ b/src/pgtkfns.c @@ -186,18 +186,27 @@ pgtk_display_info_for_name (Lisp_Object name) static void x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { - unsigned long fg; + unsigned long fg, old_fg; + block_input (); + old_fg = FRAME_FOREGROUND_COLOR (f); fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); FRAME_FOREGROUND_PIXEL (f) = fg; FRAME_X_OUTPUT (f)->foreground_color = fg; if (FRAME_GTK_WIDGET (f)) { + if (FRAME_X_OUTPUT (f)->cursor_color == old_fg) + { + FRAME_X_OUTPUT (f)->cursor_color = fg; + FRAME_X_OUTPUT (f)->cursor_xgcv.background = fg; + } + update_face_from_frame_parameter (f, Qforeground_color, arg); if (FRAME_VISIBLE_P (f)) SET_FRAME_GARBAGED (f); } + unblock_input (); } @@ -206,6 +215,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { unsigned long bg; + block_input (); bg = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); FRAME_BACKGROUND_PIXEL (f) = bg; @@ -214,12 +224,14 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) pgtk_clear_frame (f); FRAME_X_OUTPUT (f)->background_color = bg; + FRAME_X_OUTPUT (f)->cursor_xgcv.foreground = bg; xg_set_background_color (f, bg); update_face_from_frame_parameter (f, Qbackground_color, arg); if (FRAME_VISIBLE_P (f)) SET_FRAME_GARBAGED (f); + unblock_input (); } static void