comparison 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
comparison
equal deleted inserted replaced
90600:84dd84b43e1b 90601:a1a25ac6c88a
2873 else 2873 else
2874 y = s->y + s->height - h; 2874 y = s->y + s->height - h;
2875 } 2875 }
2876 else 2876 else
2877 #endif 2877 #endif
2878 if (x_underline_at_descent_line) 2878 {
2879 y = s->y + s->height - h; 2879 y = s->y + s->height - h;
2880 else 2880 if (!x_underline_at_descent_line)
2881 { 2881 {
2882 /* Get the underline position. This is the recommended 2882 /* Get the underline position. This is the recommended
2883 vertical offset in pixels from the baseline to the top of 2883 vertical offset in pixels from the baseline to the top of
2884 the underline. This is a signed value according to the 2884 the underline. This is a signed value according to the
2885 specs, and its default is 2885 specs, and its default is
2886 2886
2887 ROUND ((maximum descent) / 2), with 2887 ROUND ((maximum descent) / 2), with
2888 ROUND(x) = floor (x + 0.5) */ 2888 ROUND(x) = floor (x + 0.5) */
2889 2889
2890 if (x_use_underline_position_properties 2890 if (x_use_underline_position_properties
2891 && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem)) 2891 && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem))
2892 y = s->ybase + (long) tem; 2892 y = s->ybase + (long) tem;
2893 else if (s->face->font) 2893 else if (s->face->font)
2894 y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2; 2894 y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2;
2895 } 2895 }
2896 }
2896 2897
2897 if (s->face->underline_defaulted_p) 2898 if (s->face->underline_defaulted_p)
2898 XFillRectangle (s->display, s->window, s->gc, 2899 XFillRectangle (s->display, s->window, s->gc,
2899 s->x, y, s->background_width, h); 2900 s->x, y, s->background_width, h);
2900 else 2901 else
4333 ev->data.l[3] = (long) portion; 4334 ev->data.l[3] = (long) portion;
4334 ev->data.l[4] = (long) whole; 4335 ev->data.l[4] = (long) whole;
4335 4336
4336 /* Make Xt timeouts work while the scroll bar is active. */ 4337 /* Make Xt timeouts work while the scroll bar is active. */
4337 toolkit_scroll_bar_interaction = 1; 4338 toolkit_scroll_bar_interaction = 1;
4339 #ifdef USE_X_TOOLKIT
4340 x_activate_timeout_atimer ();
4341 #endif
4338 4342
4339 /* Setting the event mask to zero means that the message will 4343 /* Setting the event mask to zero means that the message will
4340 be sent to the client that created the window, and if that 4344 be sent to the client that created the window, and if that
4341 window no longer exists, no event will be sent. */ 4345 window no longer exists, no event will be sent. */
4342 XSendEvent (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), False, 0, &event); 4346 XSendEvent (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), False, 0, &event);
6799 6803
6800 if (f) 6804 if (f)
6801 { 6805 {
6802 6806
6803 /* Generate SELECT_WINDOW_EVENTs when needed. */ 6807 /* Generate SELECT_WINDOW_EVENTs when needed. */
6804 if (mouse_autoselect_window) 6808 if (!NILP (Vmouse_autoselect_window))
6805 { 6809 {
6806 Lisp_Object window; 6810 Lisp_Object window;
6807 6811
6808 window = window_from_coordinates (f, 6812 window = window_from_coordinates (f,
6809 event.xmotion.x, event.xmotion.y, 6813 event.xmotion.x, event.xmotion.y,
7716 struct x_error_message_stack *prev; 7720 struct x_error_message_stack *prev;
7717 }; 7721 };
7718 static struct x_error_message_stack *x_error_message; 7722 static struct x_error_message_stack *x_error_message;
7719 7723
7720 /* An X error handler which stores the error message in 7724 /* An X error handler which stores the error message in
7721 x_error_message_string. This is called from x_error_handler if 7725 *x_error_message. This is called from x_error_handler if
7722 x_catch_errors is in effect. */ 7726 x_catch_errors is in effect. */
7723 7727
7724 static void 7728 static void
7725 x_error_catcher (display, error) 7729 x_error_catcher (display, error)
7726 Display *display; 7730 Display *display;
7735 for all displays, but DPY should be the display you are actually 7739 for all displays, but DPY should be the display you are actually
7736 operating on. 7740 operating on.
7737 7741
7738 After calling this function, X protocol errors no longer cause 7742 After calling this function, X protocol errors no longer cause
7739 Emacs to exit; instead, they are recorded in the string 7743 Emacs to exit; instead, they are recorded in the string
7740 stored in x_error_message_string. 7744 stored in *x_error_message.
7741 7745
7742 Calling x_check_errors signals an Emacs error if an X error has 7746 Calling x_check_errors signals an Emacs error if an X error has
7743 occurred since the last call to x_catch_errors or x_check_errors. 7747 occurred since the last call to x_catch_errors or x_check_errors.
7744 7748
7745 Calling x_uncatch_errors resumes the normal error handling. */ 7749 Calling x_uncatch_errors resumes the normal error handling. */
7995 error ("%s", error_msg); 7999 error ("%s", error_msg);
7996 } 8000 }
7997 8001
7998 /* We specifically use it before defining it, so that gcc doesn't inline it, 8002 /* We specifically use it before defining it, so that gcc doesn't inline it,
7999 otherwise gdb doesn't know how to properly put a breakpoint on it. */ 8003 otherwise gdb doesn't know how to properly put a breakpoint on it. */
8000 static void x_error_quitter P_ ((Display *, XErrorEvent *)) NO_RETURN; 8004 static void x_error_quitter P_ ((Display *, XErrorEvent *));
8001 8005
8002 /* This is the first-level handler for X protocol errors. 8006 /* This is the first-level handler for X protocol errors.
8003 It calls x_error_quitter or x_error_catcher. */ 8007 It calls x_error_quitter or x_error_catcher. */
8004 8008
8005 static int 8009 static int
8039 x_error_quitter (display, error) 8043 x_error_quitter (display, error)
8040 Display *display; 8044 Display *display;
8041 XErrorEvent *error; 8045 XErrorEvent *error;
8042 { 8046 {
8043 char buf[256], buf1[356]; 8047 char buf[256], buf1[356];
8048
8049 /* Ignore BadName errors. They can happen because of fonts
8050 or colors that are not defined. */
8051
8052 if (error->error_code == BadName)
8053 return;
8044 8054
8045 /* Note that there is no real way portable across R3/R4 to get the 8055 /* Note that there is no real way portable across R3/R4 to get the
8046 original error handler. */ 8056 original error handler. */
8047 8057
8048 XGetErrorText (display, error->error_code, buf, sizeof (buf)); 8058 XGetErrorText (display, error->error_code, buf, sizeof (buf));
10587 {"-iconname", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL}, 10597 {"-iconname", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL},
10588 {"-in", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL}, 10598 {"-in", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL},
10589 {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL}, 10599 {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL},
10590 {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL} 10600 {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL}
10591 }; 10601 };
10602
10603 /* Whether atimer for Xt timeouts is activated or not. */
10604
10605 static int x_timeout_atimer_activated_flag;
10606
10592 #endif /* USE_X_TOOLKIT */ 10607 #endif /* USE_X_TOOLKIT */
10593 10608
10594 static int x_initialized; 10609 static int x_initialized;
10595 10610
10596 #ifdef HAVE_X_SM 10611 #ifdef HAVE_X_SM
11268 11283
11269 static void 11284 static void
11270 x_process_timeouts (timer) 11285 x_process_timeouts (timer)
11271 struct atimer *timer; 11286 struct atimer *timer;
11272 { 11287 {
11288 BLOCK_INPUT;
11289 x_timeout_atimer_activated_flag = 0;
11273 if (toolkit_scroll_bar_interaction || popup_activated ()) 11290 if (toolkit_scroll_bar_interaction || popup_activated ())
11274 { 11291 {
11275 BLOCK_INPUT;
11276 while (XtAppPending (Xt_app_con) & XtIMTimer) 11292 while (XtAppPending (Xt_app_con) & XtIMTimer)
11277 XtAppProcessEvent (Xt_app_con, XtIMTimer); 11293 XtAppProcessEvent (Xt_app_con, XtIMTimer);
11278 UNBLOCK_INPUT; 11294 /* Reactivate the atimer for next time. */
11279 } 11295 x_activate_timeout_atimer ();
11296 }
11297 UNBLOCK_INPUT;
11298 }
11299
11300 /* Install an asynchronous timer that processes Xt timeout events
11301 every 0.1s as long as either `toolkit_scroll_bar_interaction' or
11302 `popup_activated_flag' (in xmenu.c) is set. Make sure to call this
11303 function whenever these variables are set. This is necessary
11304 because some widget sets use timeouts internally, for example the
11305 LessTif menu bar, or the Xaw3d scroll bar. When Xt timeouts aren't
11306 processed, these widgets don't behave normally. */
11307
11308 void
11309 x_activate_timeout_atimer ()
11310 {
11311 BLOCK_INPUT;
11312 if (!x_timeout_atimer_activated_flag)
11313 {
11314 EMACS_TIME interval;
11315
11316 EMACS_SET_SECS_USECS (interval, 0, 100000);
11317 start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0);
11318 x_timeout_atimer_activated_flag = 1;
11319 }
11320 UNBLOCK_INPUT;
11280 } 11321 }
11281 11322
11282 #endif /* USE_X_TOOLKIT */ 11323 #endif /* USE_X_TOOLKIT */
11283 11324
11284 11325
11380 cvt_string_to_pixel_args, 11421 cvt_string_to_pixel_args,
11381 XtNumber (cvt_string_to_pixel_args), 11422 XtNumber (cvt_string_to_pixel_args),
11382 XtCacheByDisplay, cvt_pixel_dtor); 11423 XtCacheByDisplay, cvt_pixel_dtor);
11383 11424
11384 XtAppSetFallbackResources (Xt_app_con, Xt_default_resources); 11425 XtAppSetFallbackResources (Xt_app_con, Xt_default_resources);
11385
11386 /* Install an asynchronous timer that processes Xt timeout events
11387 every 0.1s. This is necessary because some widget sets use
11388 timeouts internally, for example the LessTif menu bar, or the
11389 Xaw3d scroll bar. When Xt timouts aren't processed, these
11390 widgets don't behave normally. */
11391 {
11392 EMACS_TIME interval;
11393 EMACS_SET_SECS_USECS (interval, 0, 100000);
11394 start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0);
11395 }
11396 #endif 11426 #endif
11397 11427
11398 #ifdef USE_TOOLKIT_SCROLL_BARS 11428 #ifdef USE_TOOLKIT_SCROLL_BARS
11399 #ifndef USE_GTK 11429 #ifndef USE_GTK
11400 xaw3d_arrow_scroll = False; 11430 xaw3d_arrow_scroll = False;