[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/x_emacs 12c18db 7/7: Add terminal hook query_color
From: |
Alexander Gramiak |
Subject: |
[Emacs-diffs] scratch/x_emacs 12c18db 7/7: Add terminal hook query_colors |
Date: |
Sat, 13 Apr 2019 23:30:11 -0400 (EDT) |
branch: scratch/x_emacs
commit 12c18dba9ac7ed13e4b0ccdca1d7eeaed7b7d113
Author: Alexander Gramiak <address@hidden>
Commit: Alexander Gramiak <address@hidden>
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.
---
src/image.c | 6 +-----
src/termhooks.h | 6 ++++++
src/w32term.c | 3 ++-
src/xterm.c | 1 +
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/image.c b/src/image.c
index 0528d46..a7792e9 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 91333b3..ab1a701 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 c8f7b99..9c3791f 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 2175835..3a440a3 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;
- [Emacs-diffs] branch scratch/x_emacs created (now 12c18db), Alexander Gramiak, 2019/04/13
- [Emacs-diffs] scratch/x_emacs 480a22c 5/7: Add terminal hook defined_color_hook, Alexander Gramiak, 2019/04/13
- [Emacs-diffs] scratch/x_emacs e7c3d39 4/7: Rename non-X x_* identifiers 2, Alexander Gramiak, 2019/04/13
- [Emacs-diffs] scratch/x_emacs 51ba147 6/7: Add terminal hook query_frame_background_color, Alexander Gramiak, 2019/04/13
- [Emacs-diffs] scratch/x_emacs 09fd8e7 3/7: Rename non-X x_* identifiers, Alexander Gramiak, 2019/04/13
- [Emacs-diffs] scratch/x_emacs 12c18db 7/7: Add terminal hook query_colors,
Alexander Gramiak <=
- [Emacs-diffs] scratch/x_emacs 2ca8409 2/7: Add prefixes to some window system-dependent procedures, Alexander Gramiak, 2019/04/13
- [Emacs-diffs] scratch/x_emacs 7d9edee 1/7: Rename non-X x_* procedures in xdisp.c, Alexander Gramiak, 2019/04/13