comparison src/xfns.c @ 90103:3ebd9bdb4fe5

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-13 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-83 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-89 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-90 Update from CVS: man/calc.texi: Add macro for LaTeX for info output. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-91 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-94 Update from CVS
author Miles Bader <miles@gnu.org>
date Sun, 13 Feb 2005 07:19:08 +0000
parents 72cf6261961e 7f8e4c715b72
children 7e3f621f1dd4
comparison
equal deleted inserted replaced
90102:9b4f359c4117 90103:3ebd9bdb4fe5
1397 { 1397 {
1398 int height = FRAME_INTERNAL_BORDER_WIDTH (f); 1398 int height = FRAME_INTERNAL_BORDER_WIDTH (f);
1399 int width = FRAME_PIXEL_WIDTH (f); 1399 int width = FRAME_PIXEL_WIDTH (f);
1400 int y = nlines * FRAME_LINE_HEIGHT (f); 1400 int y = nlines * FRAME_LINE_HEIGHT (f);
1401 1401
1402 BLOCK_INPUT; 1402 /* height can be zero here. */
1403 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 1403 if (height > 0 && width > 0)
1404 0, y, width, height, False); 1404 {
1405 UNBLOCK_INPUT; 1405 BLOCK_INPUT;
1406 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
1407 0, y, width, height, False);
1408 UNBLOCK_INPUT;
1409 }
1406 1410
1407 if (WINDOWP (f->tool_bar_window)) 1411 if (WINDOWP (f->tool_bar_window))
1408 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); 1412 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
1409 } 1413 }
1410 } 1414 }
4049 4053
4050 if (element_format == 8) 4054 if (element_format == 8)
4051 data = (unsigned char *) xmalloc (nelements); 4055 data = (unsigned char *) xmalloc (nelements);
4052 else if (element_format == 16) 4056 else if (element_format == 16)
4053 data = (unsigned char *) xmalloc (nelements*2); 4057 data = (unsigned char *) xmalloc (nelements*2);
4054 else 4058 else /* format == 32 */
4055 data = (unsigned char *) xmalloc (nelements*4); 4059 /* The man page for XChangeProperty:
4060 "If the specified format is 32, the property data must be a
4061 long array."
4062 This applies even if long is more than 64 bits. The X library
4063 converts to 32 bits before sending to the X server. */
4064 data = (unsigned char *) xmalloc (nelements * sizeof(long));
4056 4065
4057 x_fill_property_data (FRAME_X_DISPLAY (f), value, data, element_format); 4066 x_fill_property_data (FRAME_X_DISPLAY (f), value, data, element_format);
4058 } 4067 }
4059 else 4068 else
4060 { 4069 {
4185 &actual_type, &actual_format, 4194 &actual_type, &actual_format,
4186 &actual_size, &bytes_remaining, 4195 &actual_size, &bytes_remaining,
4187 (unsigned char **) &tmp_data); 4196 (unsigned char **) &tmp_data);
4188 if (rc == Success && tmp_data) 4197 if (rc == Success && tmp_data)
4189 { 4198 {
4199 /* The man page for XGetWindowProperty says:
4200 "If the returned format is 32, the returned data is represented
4201 as a long array and should be cast to that type to obtain the
4202 elements."
4203 This applies even if long is more than 32 bits, the X library
4204 converts from 32 bit elements received from the X server to long
4205 and passes the long array to us. Thus, for that case bcopy can not
4206 be used. We convert to a 32 bit type here, because so much code
4207 assume on that.
4208
4209 The bytes and offsets passed to XGetWindowProperty refers to the
4210 property and those are indeed in 32 bit quantities if format is
4211 32. */
4212
4213 if (actual_format == 32 && actual_format < BITS_PER_LONG)
4214 {
4215 unsigned long i;
4216 int *idata = (int *) tmp_data;
4217 long *ldata = (long *) tmp_data;
4218
4219 for (i = 0; i < actual_size; ++i)
4220 idata[i]= (int) ldata[i];
4221 }
4222
4190 if (NILP (vector_ret_p)) 4223 if (NILP (vector_ret_p))
4191 prop_value = make_string (tmp_data, size); 4224 prop_value = make_string (tmp_data, size);
4192 else 4225 else
4193 prop_value = x_property_data_to_lisp (f, 4226 prop_value = x_property_data_to_lisp (f,
4194 (unsigned char *) tmp_data, 4227 (unsigned char *) tmp_data,
5384 if (!XkbQueryExtension (dpy, &op, &event, &error, &major, &minor)) 5417 if (!XkbQueryExtension (dpy, &op, &event, &error, &major, &minor))
5385 { 5418 {
5386 UNBLOCK_INPUT; 5419 UNBLOCK_INPUT;
5387 return Qnil; 5420 return Qnil;
5388 } 5421 }
5422
5423 /* In this code we check that the keyboard has physical keys with names
5424 that start with BKSP (Backspace) and DELE (Delete), and that they
5425 generate keysym XK_BackSpace and XK_Delete respectively.
5426 This function is used to test if normal-erase-is-backspace should be
5427 turned on.
5428 An alternative approach would be to just check if XK_BackSpace and
5429 XK_Delete are mapped to any key. But if any of those are mapped to
5430 some non-intuitive key combination (Meta-Shift-Ctrl-whatever) and the
5431 user doesn't know about it, it is better to return false here.
5432 It is more obvious to the user what to do if she/he has two keys
5433 clearly marked with names/symbols and one key does something not
5434 expected (i.e. she/he then tries the other).
5435 The cases where Backspace/Delete is mapped to some other key combination
5436 are rare, and in those cases, normal-erase-is-backspace can be turned on
5437 manually. */
5389 5438
5390 have_keys = Qnil; 5439 have_keys = Qnil;
5391 kb = XkbGetMap (dpy, XkbAllMapComponentsMask, XkbUseCoreKbd); 5440 kb = XkbGetMap (dpy, XkbAllMapComponentsMask, XkbUseCoreKbd);
5392 if (kb) 5441 if (kb)
5393 { 5442 {