Mercurial > hg > xemacs-beta
changeset 4815:6540302eedf5
Fix query_string_geometry lookup domain
author | Didier Verna <didier@lrde.epita.fr> |
---|---|
date | Sat, 09 Jan 2010 15:31:25 +0100 |
parents | ae2e0c1c8fae |
children | 576f09d387d5 |
files | src/ChangeLog src/glyphs.c src/redisplay.c src/redisplay.h |
diffstat | 4 files changed, 65 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Fri Jan 08 14:30:22 2010 +0000 +++ b/src/ChangeLog Sat Jan 09 15:31:25 2010 +0100 @@ -1,3 +1,20 @@ +2010-01-09 Didier Verna <didier@xemacs.org> + + Fix query_string_geometry lookup domain. + * redisplay.c (redisplay_window_text_width_ichar_string): Formerly + named redisplay_text_width_ichar_string. + * redisplay.c (redisplay_window_text_width_string): Formerly named + redisplay_text_width_string. Make static. + * redisplay.c (redisplay_text_width_string): Formerly named + redisplay_frame_text_width_string. Generalize to accept any + Lisp_Object domain argument (instead of only frames). + * redisplay.c (add_ichar_rune_1): Update funcalls for the above + renaming. + * redisplay.c (generate_fstring_runes): Ditto. + * redisplay.h: Ditto. + * glyphs.c (query_string_geometry): Use proper domain for cachel + updating and in generalized version of redisplay_text_width_string. + 2010-01-08 Aidan Kehoe <kehoea@parhasard.net> * mule-charset.c (Fmake_charset):
--- a/src/glyphs.c Fri Jan 08 14:30:22 2010 +0000 +++ b/src/glyphs.c Sat Jan 09 15:31:25 2010 +0100 @@ -2379,9 +2379,10 @@ { struct font_metric_info fm; unsigned char charsets[NUM_LEADING_BYTES]; - struct face_cachel frame_cachel; - struct face_cachel *cachel; - Lisp_Object frame = DOMAIN_FRAME (domain); + struct face_cachel cachel; + struct face_cachel *the_cachel; + Lisp_Object window = DOMAIN_WINDOW (domain); + Lisp_Object frame = DOMAIN_FRAME (domain); CHECK_STRING (string); @@ -2396,18 +2397,22 @@ /* Fallback to the default face if none was provided. */ if (!NILP (face)) { - reset_face_cachel (&frame_cachel); - update_face_cachel_data (&frame_cachel, frame, face); - cachel = &frame_cachel; + reset_face_cachel (&cachel); + update_face_cachel_data (&cachel, + /* #### NOTE: in fact, I'm not sure if it's + #### possible to *not* get a window + #### here, but you never know... + #### -- dvl */ + NILP (window) ? frame : window, + face); + the_cachel = &cachel; } else - { - cachel = WINDOW_FACE_CACHEL (DOMAIN_XWINDOW (domain), - DEFAULT_INDEX); - } - - ensure_face_cachel_complete (cachel, domain, charsets); - face_cachel_charset_font_metric_info (cachel, charsets, &fm); + the_cachel = WINDOW_FACE_CACHEL (DOMAIN_XWINDOW (domain), + DEFAULT_INDEX); + + ensure_face_cachel_complete (the_cachel, domain, charsets); + face_cachel_charset_font_metric_info (the_cachel, charsets, &fm); *height = fm.ascent + fm.descent; /* #### descent only gets set if we query the height as well. */ @@ -2417,16 +2422,9 @@ /* Compute width */ if (width) - { - if (!NILP (face)) - *width = redisplay_frame_text_width_string (XFRAME (frame), - face, - 0, string, 0, -1); - else - *width = redisplay_frame_text_width_string (XFRAME (frame), - Vdefault_face, - 0, string, 0, -1); - } + *width = redisplay_text_width_string (domain, + NILP (face) ? Vdefault_face : face, + 0, string, 0, -1); } Lisp_Object
--- a/src/redisplay.c Fri Jan 08 14:30:22 2010 +0000 +++ b/src/redisplay.c Sat Jan 09 15:31:25 2010 +0100 @@ -630,8 +630,8 @@ /***************************************************************************/ static int -redisplay_text_width_ichar_string (struct window *w, int findex, - Ichar *str, Charcount len) +redisplay_window_text_width_ichar_string (struct window *w, int findex, + Ichar *str, Charcount len) { unsigned char charsets[NUM_LEADING_BYTES]; Lisp_Object window; @@ -647,10 +647,10 @@ static Ichar_dynarr *rtw_ichar_dynarr; -int -redisplay_text_width_string (struct window *w, int findex, - Ibyte *nonreloc, Lisp_Object reloc, - Bytecount offset, Bytecount len) +static int +redisplay_window_text_width_string (struct window *w, int findex, + Ibyte *nonreloc, Lisp_Object reloc, + Bytecount offset, Bytecount len) { if (!rtw_ichar_dynarr) rtw_ichar_dynarr = Dynarr_new (Ichar); @@ -660,18 +660,19 @@ if (STRINGP (reloc)) nonreloc = XSTRING_DATA (reloc); convert_ibyte_string_into_ichar_dynarr (nonreloc, len, rtw_ichar_dynarr); - return redisplay_text_width_ichar_string + return redisplay_window_text_width_ichar_string (w, findex, Dynarr_atp (rtw_ichar_dynarr, 0), Dynarr_length (rtw_ichar_dynarr)); } int -redisplay_frame_text_width_string (struct frame *f, Lisp_Object face, - Ibyte *nonreloc, Lisp_Object reloc, - Bytecount offset, Bytecount len) -{ +redisplay_text_width_string (Lisp_Object domain, Lisp_Object face, + Ibyte *nonreloc, Lisp_Object reloc, + Bytecount offset, Bytecount len) +{ + Lisp_Object window = DOMAIN_WINDOW (domain); + Lisp_Object frame = DOMAIN_FRAME (domain); unsigned char charsets[NUM_LEADING_BYTES]; - Lisp_Object frame; struct face_cachel cachel; if (!rtw_ichar_dynarr) @@ -685,10 +686,13 @@ find_charsets_in_ibyte_string (charsets, nonreloc, len); reset_face_cachel (&cachel); cachel.face = face; - frame = wrap_frame (f); - ensure_face_cachel_complete (&cachel, frame, charsets); - return DEVMETH (XDEVICE (FRAME_DEVICE (f)), - text_width, (f, &cachel, Dynarr_atp (rtw_ichar_dynarr, 0), + ensure_face_cachel_complete (&cachel, + NILP (window) ? frame : window, + charsets); + return DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (frame))), + text_width, (XFRAME (frame), + &cachel, + Dynarr_atp (rtw_ichar_dynarr, 0), Dynarr_length (rtw_ichar_dynarr))); } @@ -1127,8 +1131,8 @@ Ichar ch = data->font_is_bogus ? '~' : data->ch; data->last_char_width = - redisplay_text_width_ichar_string (XWINDOW (data->window), - data->findex, &ch, 1); + redisplay_window_text_width_ichar_string + (XWINDOW (data->window), data->findex, &ch, 1); } else data->last_char_width = -1; @@ -1145,9 +1149,8 @@ width = data->last_char_width; if (width < 0) /* proportional fonts */ - width = redisplay_text_width_ichar_string (XWINDOW (data->window), - data->findex, - &data->ch, 1); + width = redisplay_window_text_width_ichar_string + (XWINDOW (data->window), data->findex, &data->ch, 1); } if (data->max_pixpos != -1 && (data->pixpos + width > data->max_pixpos)) @@ -4178,8 +4181,8 @@ SET_CURRENT_MODE_CHARS_PIXSIZE; dash_pixsize = - redisplay_text_width_string (w, findex, &ch, Qnil, 0, - 1); + redisplay_window_text_width_string + (w, findex, &ch, Qnil, 0, 1); if (dash_pixsize == 0) num_to_add = 0;
--- a/src/redisplay.h Fri Jan 08 14:30:22 2010 +0000 +++ b/src/redisplay.h Sat Jan 09 15:31:25 2010 +0100 @@ -719,14 +719,9 @@ /*************************************************************************/ EXFUN (Fredraw_frame, 2); -int redisplay_text_width_string (struct window *w, int findex, +int redisplay_text_width_string (Lisp_Object domain, Lisp_Object face, Ibyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount len); -int redisplay_frame_text_width_string (struct frame *f, - Lisp_Object face, - Ibyte *nonreloc, - Lisp_Object reloc, - Bytecount offset, Bytecount len); int redisplay_frame (struct frame *f, int preemption_check); void redisplay_no_pre_idle_hook (void); void redisplay (void);