Mercurial > emacs
diff src/xterm.c @ 90601:a1a25ac6c88a
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 427-436)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 134-136)
- Merge from emacs--devo--0
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-110
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 14 Sep 2006 09:24:00 +0000 |
parents | 6823a91487f2 f295b430aa3a |
children | 8dd8c8286063 |
line wrap: on
line diff
--- a/src/xterm.c Wed Sep 06 07:30:39 2006 +0000 +++ b/src/xterm.c Thu Sep 14 09:24:00 2006 +0000 @@ -2875,24 +2875,25 @@ } else #endif - if (x_underline_at_descent_line) - y = s->y + s->height - h; - else - { - /* Get the underline position. This is the recommended - vertical offset in pixels from the baseline to the top of - the underline. This is a signed value according to the - specs, and its default is - - ROUND ((maximum descent) / 2), with - ROUND(x) = floor (x + 0.5) */ - - if (x_use_underline_position_properties - && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem)) - y = s->ybase + (long) tem; - else if (s->face->font) - y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2; - } + { + y = s->y + s->height - h; + if (!x_underline_at_descent_line) + { + /* Get the underline position. This is the recommended + vertical offset in pixels from the baseline to the top of + the underline. This is a signed value according to the + specs, and its default is + + ROUND ((maximum descent) / 2), with + ROUND(x) = floor (x + 0.5) */ + + if (x_use_underline_position_properties + && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem)) + y = s->ybase + (long) tem; + else if (s->face->font) + y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2; + } + } if (s->face->underline_defaulted_p) XFillRectangle (s->display, s->window, s->gc, @@ -4335,6 +4336,9 @@ /* Make Xt timeouts work while the scroll bar is active. */ toolkit_scroll_bar_interaction = 1; +#ifdef USE_X_TOOLKIT + x_activate_timeout_atimer (); +#endif /* Setting the event mask to zero means that the message will be sent to the client that created the window, and if that @@ -6801,7 +6805,7 @@ { /* Generate SELECT_WINDOW_EVENTs when needed. */ - if (mouse_autoselect_window) + if (!NILP (Vmouse_autoselect_window)) { Lisp_Object window; @@ -7718,7 +7722,7 @@ static struct x_error_message_stack *x_error_message; /* An X error handler which stores the error message in - x_error_message_string. This is called from x_error_handler if + *x_error_message. This is called from x_error_handler if x_catch_errors is in effect. */ static void @@ -7737,7 +7741,7 @@ After calling this function, X protocol errors no longer cause Emacs to exit; instead, they are recorded in the string - stored in x_error_message_string. + stored in *x_error_message. Calling x_check_errors signals an Emacs error if an X error has occurred since the last call to x_catch_errors or x_check_errors. @@ -7997,7 +8001,7 @@ /* We specifically use it before defining it, so that gcc doesn't inline it, otherwise gdb doesn't know how to properly put a breakpoint on it. */ -static void x_error_quitter P_ ((Display *, XErrorEvent *)) NO_RETURN; +static void x_error_quitter P_ ((Display *, XErrorEvent *)); /* This is the first-level handler for X protocol errors. It calls x_error_quitter or x_error_catcher. */ @@ -8042,6 +8046,12 @@ { char buf[256], buf1[356]; + /* Ignore BadName errors. They can happen because of fonts + or colors that are not defined. */ + + if (error->error_code == BadName) + return; + /* Note that there is no real way portable across R3/R4 to get the original error handler. */ @@ -10589,6 +10599,11 @@ {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL}, {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL} }; + +/* Whether atimer for Xt timeouts is activated or not. */ + +static int x_timeout_atimer_activated_flag; + #endif /* USE_X_TOOLKIT */ static int x_initialized; @@ -11270,13 +11285,39 @@ x_process_timeouts (timer) struct atimer *timer; { + BLOCK_INPUT; + x_timeout_atimer_activated_flag = 0; if (toolkit_scroll_bar_interaction || popup_activated ()) { - BLOCK_INPUT; while (XtAppPending (Xt_app_con) & XtIMTimer) XtAppProcessEvent (Xt_app_con, XtIMTimer); - UNBLOCK_INPUT; - } + /* Reactivate the atimer for next time. */ + x_activate_timeout_atimer (); + } + UNBLOCK_INPUT; +} + +/* Install an asynchronous timer that processes Xt timeout events + every 0.1s as long as either `toolkit_scroll_bar_interaction' or + `popup_activated_flag' (in xmenu.c) is set. Make sure to call this + function whenever these variables are set. This is necessary + because some widget sets use timeouts internally, for example the + LessTif menu bar, or the Xaw3d scroll bar. When Xt timeouts aren't + processed, these widgets don't behave normally. */ + +void +x_activate_timeout_atimer () +{ + BLOCK_INPUT; + if (!x_timeout_atimer_activated_flag) + { + EMACS_TIME interval; + + EMACS_SET_SECS_USECS (interval, 0, 100000); + start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0); + x_timeout_atimer_activated_flag = 1; + } + UNBLOCK_INPUT; } #endif /* USE_X_TOOLKIT */ @@ -11382,17 +11423,6 @@ XtCacheByDisplay, cvt_pixel_dtor); XtAppSetFallbackResources (Xt_app_con, Xt_default_resources); - - /* Install an asynchronous timer that processes Xt timeout events - every 0.1s. This is necessary because some widget sets use - timeouts internally, for example the LessTif menu bar, or the - Xaw3d scroll bar. When Xt timouts aren't processed, these - widgets don't behave normally. */ - { - EMACS_TIME interval; - EMACS_SET_SECS_USECS (interval, 0, 100000); - start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0); - } #endif #ifdef USE_TOOLKIT_SCROLL_BARS