summaryrefslogtreecommitdiff
path: root/src/xterm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c78
1 files changed, 53 insertions, 25 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 466037c75a2..95b2a87fd4b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2701,9 +2701,8 @@ x_draw_glyph_string (s)
if (!XGetFontProperty (s->font, XA_UNDERLINE_THICKNESS, &h))
h = 1;
- if (x_underline_at_descent_line)
- y = s->y + s->height - h;
- else
+ 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
@@ -4105,6 +4104,9 @@ x_send_scroll_bar_event (window, part, portion, whole)
/* 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
@@ -6597,7 +6599,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
{
/* Generate SELECT_WINDOW_EVENTs when needed. */
- if (mouse_autoselect_window)
+ if (!NILP (Vmouse_autoselect_window))
{
Lisp_Object window;
@@ -7517,7 +7519,7 @@ struct x_error_message_stack {
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
@@ -7536,7 +7538,7 @@ x_error_catcher (display, error)
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.
@@ -7819,7 +7821,7 @@ x_connection_closed (dpy, error_message)
/* 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. */
@@ -7864,6 +7866,12 @@ x_error_quitter (display, error)
{
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. */
@@ -8372,7 +8380,7 @@ x_check_expected_move (f, expected_left, expected_top)
int expected_left;
int expected_top;
{
- int count = 0, current_left = 0, current_top = 0;
+ int current_left = 0, current_top = 0;
/* x_real_positions returns the left and top offsets of the outermost
window manager window around the frame. */
@@ -10169,6 +10177,11 @@ static XrmOptionDescRec emacs_options[] = {
{"-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;
@@ -10882,13 +10895,39 @@ static void
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 */
@@ -10957,15 +10996,15 @@ x_delete_terminal (struct terminal *terminal)
x_destroy_all_bitmaps (dpyinfo);
XSetCloseDownMode (dpyinfo->display, DestroyAll);
-#ifdef USE_X_TOOLKIT
- XtCloseDisplay (dpyinfo->display);
-#else
#ifdef USE_GTK
xg_display_close (dpyinfo->display);
#else
+#ifdef USE_X_TOOLKIT
+ XtCloseDisplay (dpyinfo->display);
+#else
XCloseDisplay (dpyinfo->display);
#endif
-#endif
+#endif /* ! USE_GTK */
x_delete_display (dpyinfo);
UNBLOCK_INPUT;
@@ -11052,17 +11091,6 @@ x_initialize ()
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