From: YAMAMOTO Mitsuharu Date: Sat, 10 Apr 2010 10:52:30 +0000 (+0900) Subject: Don't abort try_window with fonts change when showing tooltip (Bug#2423). X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~551 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6eff5c3dcd268cbc740ad9b89112203aad2a9756;p=emacs.git Don't abort try_window with fonts change when showing tooltip (Bug#2423). * dispextern.h (TRY_WINDOW_CHECK_MARGINS) (TRY_WINDOW_IGNORE_FONTS_CHANGE): New defines. * xdisp.c (try_window): Change arg from CHECK_MARGINS to FLAGS. Don't abort with fonts change if TRY_WINDOW_IGNORE_FONTS_CHANGE is set in FLAGS. Callers with non-zero CHECK_MARGINS changed to use TRY_WINDOW_CHECK_MARGINS. * xfns.c (Fx_show_tip): Call try_window with TRY_WINDOW_IGNORE_FONTS_CHANGE. --- diff --git a/src/ChangeLog b/src/ChangeLog index 43fdaaf3276..157ff6db673 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,15 @@ 2010-04-10 YAMAMOTO Mitsuharu - * xfns.c (Fx_show_tip): Undo last change. + * dispextern.h (TRY_WINDOW_CHECK_MARGINS) + (TRY_WINDOW_IGNORE_FONTS_CHANGE): New defines. + + * xdisp.c (try_window): Change arg from CHECK_MARGINS to FLAGS. + Don't abort with fonts change if TRY_WINDOW_IGNORE_FONTS_CHANGE is + set in FLAGS. Callers with non-zero CHECK_MARGINS changed to use + TRY_WINDOW_CHECK_MARGINS. + + * xfns.c (Fx_show_tip): Undo last change. Call try_window with + TRY_WINDOW_IGNORE_FONTS_CHANGE (Bug#2423). 2010-04-09 Jan Djärv diff --git a/src/dispextern.h b/src/dispextern.h index b8f68ec0e70..00da256c43e 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2974,6 +2974,10 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, XRectangle *)); #endif +/* Flags passed to try_window. */ +#define TRY_WINDOW_CHECK_MARGINS (1 << 0) +#define TRY_WINDOW_IGNORE_FONTS_CHANGE (1 << 1) + /* Defined in fringe.c */ int lookup_fringe_bitmap (Lisp_Object); diff --git a/src/xdisp.c b/src/xdisp.c index baede013485..902651dcc44 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -14203,7 +14203,7 @@ redisplay_window (window, just_this_one_p) = try_window_reusing_current_matrix (w))) { IF_DEBUG (debug_method_add (w, "1")); - if (try_window (window, startp, 1) < 0) + if (try_window (window, startp, TRY_WINDOW_CHECK_MARGINS) < 0) /* -1 means we need to scroll. 0 means we need new matrices, but fonts_changed_p is set in that case, so we will detect it below. */ @@ -14554,13 +14554,15 @@ redisplay_window (window, just_this_one_p) Value is 1 if successful. It is zero if fonts were loaded during redisplay which makes re-adjusting glyph matrices necessary, and -1 if point would appear in the scroll margins. - (We check that only if CHECK_MARGINS is nonzero. */ + (We check the former only if TRY_WINDOW_IGNORE_FONTS_CHANGE is + unset in FLAGS, and the latter only if TRY_WINDOW_CHECK_MARGINS is + set in FLAGS.) */ int -try_window (window, pos, check_margins) +try_window (window, pos, flags) Lisp_Object window; struct text_pos pos; - int check_margins; + int flags; { struct window *w = XWINDOW (window); struct it it; @@ -14582,12 +14584,12 @@ try_window (window, pos, check_margins) { if (display_line (&it)) last_text_row = it.glyph_row - 1; - if (fonts_changed_p) + if (fonts_changed_p && !(flags & TRY_WINDOW_IGNORE_FONTS_CHANGE)) return 0; } /* Don't let the cursor end in the scroll margins. */ - if (check_margins + if ((flags & TRY_WINDOW_CHECK_MARGINS) && !MINI_WINDOW_P (w)) { int this_scroll_margin; diff --git a/src/xfns.c b/src/xfns.c index 647526cc22b..52d6b7bd00f 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5228,7 +5228,7 @@ Text larger than the specified size is clipped. */) clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE); - try_window (FRAME_ROOT_WINDOW (f), pos, 0); + try_window (FRAME_ROOT_WINDOW (f), pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); /* Compute width and height of the tooltip. */ width = height = 0;