aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuuki Harano2018-01-13 20:27:11 +0900
committerJeff Walsh2020-11-22 14:46:55 +1100
commit045e25278bdec3e08c3c069a537e4ae7a66de262 (patch)
tree379aaf3da93a0e865f5df4278809d187df47c50a /src
parent1b621c8e3c1aa1dd71d39f080703292cde270446 (diff)
downloademacs-045e25278bdec3e08c3c069a537e4ae7a66de262.tar.gz
emacs-045e25278bdec3e08c3c069a537e4ae7a66de262.zip
Add support for cursor_foreground_colors
* ../src/pgtkterm.c (x_set_cursor_gc): * ../src/pgtkfns.c (x_set_cursor_color, Fx_create_frame) (syms_of_pgtkfns): * src/pgtkterm.h (struct pgtk_output): cursor_foreground_color 対応。 あんまり意味なかった感じ。
Diffstat (limited to 'src')
-rw-r--r--src/pgtkfns.c60
-rw-r--r--src/pgtkterm.c4
-rw-r--r--src/pgtkterm.h5
3 files changed, 49 insertions, 20 deletions
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index 67391fac86f..b08b81a885c 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -197,25 +197,49 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
197static void 197static void
198x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 198x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
199{ 199{
200 unsigned long fore_pixel, pixel;
201 struct pgtk_output *x = f->output_data.pgtk;
200 Emacs_Color col; 202 Emacs_Color col;
201 203
202 block_input (); 204 if (!NILP (Vx_cursor_fore_pixel))
203 if (pgtk_lisp_to_color (arg, &col))
204 { 205 {
205 store_frame_param (f, Qcursor_color, oldval); 206 if (pgtk_lisp_to_color(Vx_cursor_fore_pixel, &col))
206 unblock_input (); 207 signal_error ("Undefined color", Vx_cursor_fore_pixel);
207 error ("Unknown color"); 208 fore_pixel = col.pixel;
208 } 209 }
210 else
211 fore_pixel = FRAME_BACKGROUND_PIXEL (f);
209 212
210 FRAME_CURSOR_COLOR (f) = col.pixel; 213 if (pgtk_lisp_to_color(arg, &col))
214 signal_error ("Undefined color", arg);
215 pixel = col.pixel;
211 216
212 if (FRAME_VISIBLE_P (f)) 217 /* Make sure that the cursor color differs from the background color. */
218 if (pixel == FRAME_BACKGROUND_PIXEL (f))
219 {
220 pixel = x->mouse_color;
221 if (pixel == fore_pixel)
222 {
223 fore_pixel = FRAME_BACKGROUND_PIXEL (f);
224 }
225 }
226
227 x->cursor_foreground_color = fore_pixel;
228 x->cursor_color = pixel;
229
230 if (FRAME_X_WINDOW (f) != 0)
213 { 231 {
214 x_update_cursor (f, 0); 232 x->cursor_xgcv.background = x->cursor_color;
215 x_update_cursor (f, 1); 233 x->cursor_xgcv.foreground = fore_pixel;
234
235 if (FRAME_VISIBLE_P (f))
236 {
237 x_update_cursor (f, false);
238 x_update_cursor (f, true);
239 }
216 } 240 }
241
217 update_face_from_frame_parameter (f, Qcursor_color, arg); 242 update_face_from_frame_parameter (f, Qcursor_color, arg);
218 unblock_input ();
219} 243}
220 244
221 245
@@ -1029,11 +1053,11 @@ This function is an internal primitive--use `make-frame' instead. */)
1029 FRAME_FOREGROUND_PIXEL (f) = -1; 1053 FRAME_FOREGROUND_PIXEL (f) = -1;
1030 FRAME_BACKGROUND_PIXEL (f) = -1; 1054 FRAME_BACKGROUND_PIXEL (f) = -1;
1031 FRAME_X_OUTPUT(f)->cursor_color = -1; 1055 FRAME_X_OUTPUT(f)->cursor_color = -1;
1056 FRAME_X_OUTPUT(f)->cursor_foreground_color = -1;
1032#if 0 1057#if 0
1033 FRAME_X_OUTPUT(f)->cursor_foreground_pixel = -1;
1034 FRAME_X_OUTPUT(f)->border_pixel = -1; 1058 FRAME_X_OUTPUT(f)->border_pixel = -1;
1035 FRAME_X_OUTPUT(f)->mouse_pixel = -1;
1036#endif 1059#endif
1060 FRAME_X_OUTPUT(f)->mouse_color = -1;
1037 1061
1038 black = build_string ("black"); 1062 black = build_string ("black");
1039 FRAME_FOREGROUND_PIXEL (f) 1063 FRAME_FOREGROUND_PIXEL (f)
@@ -1042,14 +1066,14 @@ This function is an internal primitive--use `make-frame' instead. */)
1042 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 1066 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
1043 FRAME_X_OUTPUT(f)->cursor_color 1067 FRAME_X_OUTPUT(f)->cursor_color
1044 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 1068 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
1045#if 0 1069 FRAME_X_OUTPUT(f)->cursor_foreground_color
1046 FRAME_X_OUTPUT(f)->cursor_foreground_pixel
1047 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 1070 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
1071#if 0
1048 FRAME_X_OUTPUT(f)->border_pixel 1072 FRAME_X_OUTPUT(f)->border_pixel
1049 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 1073 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
1050 FRAME_X_OUTPUT(f)->mouse_pixel
1051 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
1052#endif 1074#endif
1075 FRAME_X_OUTPUT(f)->mouse_color
1076 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
1053 } 1077 }
1054 1078
1055 /* Specify the parent under which to make this X window. */ 1079 /* Specify the parent under which to make this X window. */
@@ -2615,6 +2639,10 @@ syms_of_pgtkfns (void)
2615 DEFSYM (Qicon_title_format, "icon-title-format"); 2639 DEFSYM (Qicon_title_format, "icon-title-format");
2616 DEFSYM (Qdark, "dark"); 2640 DEFSYM (Qdark, "dark");
2617 2641
2642 DEFVAR_LISP ("x-cursor-fore-pixel", Vx_cursor_fore_pixel,
2643 doc: /* A string indicating the foreground color of the cursor box. */);
2644 Vx_cursor_fore_pixel = Qnil;
2645
2618 DEFVAR_LISP ("pgtk-icon-type-alist", Vpgtk_icon_type_alist, 2646 DEFVAR_LISP ("pgtk-icon-type-alist", Vpgtk_icon_type_alist,
2619 doc: /* Alist of elements (REGEXP . IMAGE) for images of icons associated to frames. 2647 doc: /* Alist of elements (REGEXP . IMAGE) for images of icons associated to frames.
2620If the title of a frame matches REGEXP, then IMAGE.tiff is 2648If the title of a frame matches REGEXP, then IMAGE.tiff is
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index a1c42eb2748..4f2c4542372 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -765,10 +765,8 @@ x_set_cursor_gc (struct glyph_string *s)
765 if (xgcv.foreground == xgcv.background) 765 if (xgcv.foreground == xgcv.background)
766 xgcv.foreground = s->face->foreground; 766 xgcv.foreground = s->face->foreground;
767 PGTK_TRACE("x_set_cursor_gc: 4. %08lx, %08lx.", xgcv.background, xgcv.foreground); 767 PGTK_TRACE("x_set_cursor_gc: 4. %08lx, %08lx.", xgcv.background, xgcv.foreground);
768#if 0
769 if (xgcv.foreground == xgcv.background) 768 if (xgcv.foreground == xgcv.background)
770 xgcv.foreground = FRAME_X_OUTPUT(s->f)->cursor_foreground_pixel; 769 xgcv.foreground = FRAME_X_OUTPUT(s->f)->cursor_foreground_color;
771#endif
772 if (xgcv.foreground == xgcv.background) 770 if (xgcv.foreground == xgcv.background)
773 xgcv.foreground = s->face->foreground; 771 xgcv.foreground = s->face->foreground;
774 PGTK_TRACE("x_set_cursor_gc: 5. %08lx, %08lx.", xgcv.background, xgcv.foreground); 772 PGTK_TRACE("x_set_cursor_gc: 5. %08lx, %08lx.", xgcv.background, xgcv.foreground);
diff --git a/src/pgtkterm.h b/src/pgtkterm.h
index c01d846748e..6cd6da4ccb3 100644
--- a/src/pgtkterm.h
+++ b/src/pgtkterm.h
@@ -226,7 +226,6 @@ struct pgtk_output
226 void *view; 226 void *view;
227 void *miniimage; 227 void *miniimage;
228#endif 228#endif
229 unsigned long cursor_color;
230 unsigned long foreground_color; 229 unsigned long foreground_color;
231 unsigned long background_color; 230 unsigned long background_color;
232 void *toolbar; 231 void *toolbar;
@@ -269,6 +268,10 @@ struct pgtk_output
269 value contains an ID of the fontset, else -1. */ 268 value contains an ID of the fontset, else -1. */
270 int fontset; /* only used with font_backend */ 269 int fontset; /* only used with font_backend */
271 270
271 unsigned long mouse_color;
272 unsigned long cursor_color;
273 unsigned long cursor_foreground_color;
274
272 int icon_top; 275 int icon_top;
273 int icon_left; 276 int icon_left;
274 277