diff options
author | Alexander Gramiak <agrambot@gmail.com> | 2019-04-13 20:51:36 -0600 |
---|---|---|
committer | Alexander Gramiak <agrambot@gmail.com> | 2019-04-13 20:57:13 -0600 |
commit | 12c18dba9ac7ed13e4b0ccdca1d7eeaed7b7d113 (patch) | |
tree | d59b7c7e8650b3ead0efc170027c5ebc06f46e1d | |
parent | 51ba147a0976351c48ee6b5dbec41aedf273354b (diff) | |
download | emacs-12c18dba9ac7ed13e4b0ccdca1d7eeaed7b7d113.tar.gz |
Add terminal hook query_colors
* src/termhooks.c (query_colors): New terminal hook.
* src/w32term.c:
* src/xterm.c: Implement and set the new terminal hook.
* src/image.c (image_to_xcolors): Use the hook.
-rw-r--r-- | src/image.c | 6 | ||||
-rw-r--r-- | src/termhooks.h | 6 | ||||
-rw-r--r-- | src/w32term.c | 3 | ||||
-rw-r--r-- | src/xterm.c | 1 |
4 files changed, 10 insertions, 6 deletions
diff --git a/src/image.c b/src/image.c index 0528d46ad08..a7792e970cd 100644 --- a/src/image.c +++ b/src/image.c @@ -4926,11 +4926,7 @@ image_to_xcolors (struct frame *f, struct image *img, bool rgb_p) p->pixel = GET_PIXEL (ximg, x, y); if (rgb_p) { -# ifdef HAVE_NTGUI - w32_query_colors (f, row, img->width); -# else - x_query_colors (f, row, img->width); -# endif + FRAME_TERMINAL (f)->query_colors (f, row, img->width); } #else diff --git a/src/termhooks.h b/src/termhooks.h index 91333b37371..ab1a701bef3 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -504,6 +504,12 @@ struct terminal void (*query_frame_background_color) (struct frame *f, XColor *bgcolor); +#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) + /* On frame F, translate pixel colors to RGB values for the NCOLORS + colors in COLORS. Use cached information, if available. */ + + void (*query_colors) (struct frame *f, XColor *colors, int ncolors); +#endif /* Return the current position of the mouse. Set *f to the frame the mouse is in, or zero if the mouse is in no diff --git a/src/w32term.c b/src/w32term.c index c8f7b9933a7..9c3791f6d15 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1593,7 +1593,7 @@ w32_alloc_lighter_color (struct frame *f, COLORREF *color, /* On frame F, translate pixel colors to RGB values for the NCOLORS colors in COLORS. On W32, we no longer try to map colors to a palette. */ -void +static void w32_query_colors (struct frame *f, XColor *colors, int ncolors) { int i; @@ -7169,6 +7169,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo) terminal->frame_up_to_date_hook = w32_frame_up_to_date; terminal->defined_color_hook = w32_defined_color; terminal->query_frame_background_color = w32_query_frame_background_color; + terminal->query_colors = w32_query_colors; terminal->mouse_position_hook = w32_mouse_position; terminal->get_focus_frame = w32_get_focus_frame; terminal->focus_frame_hook = w32_focus_frame; diff --git a/src/xterm.c b/src/xterm.c index 2175835d6ab..3a440a34c5f 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -13306,6 +13306,7 @@ x_create_terminal (struct x_display_info *dpyinfo) terminal->buffer_flipping_unblocked_hook = XTbuffer_flipping_unblocked_hook; terminal->defined_color_hook = x_defined_color; terminal->query_frame_background_color = x_query_frame_background_color; + terminal->query_colors = x_query_colors; terminal->mouse_position_hook = XTmouse_position; terminal->get_focus_frame = x_get_focus_frame; terminal->focus_frame_hook = x_focus_frame; |