aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2005-02-13 07:19:08 +0000
committerMiles Bader2005-02-13 07:19:08 +0000
commitdd75f82d04b1c7fb91fd3024021a3d7977154857 (patch)
tree456488f67c9de7fec805140f39993e1e3bebac8f /src
parent3807ffd05dc6b10cef9066b4d3b49b24788313a9 (diff)
parent9b981cb6861358a05a241509d73f2b8ea25c64ce (diff)
downloademacs-dd75f82d04b1c7fb91fd3024021a3d7977154857.tar.gz
emacs-dd75f82d04b1c7fb91fd3024021a3d7977154857.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog92
-rw-r--r--src/eval.c25
-rw-r--r--src/keyboard.c4
-rw-r--r--src/undo.c60
-rw-r--r--src/xdisp.c12
-rw-r--r--src/xfns.c61
-rw-r--r--src/xselect.c151
7 files changed, 296 insertions, 109 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b15fba5254c..d2afed264eb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,7 +1,70 @@
12005-02-12 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * keyboard.c: If HAVE_FCNTL_H include fcntl.h.
4
52005-02-12 Kim F. Storm <storm@cua.dk>
6
7 * xdisp.c (expose_window): Don't fix overlaps for mode lines.
8
92005-02-10 Kim F. Storm <storm@cua.dk>
10
11 * xdisp.c (try_window_id): Set first_unchanged_at_end_row to NULL
12 if it moves outside window or it doesn't display text.
13
142005-02-09 Kim F. Storm <storm@cua.dk>
15
16 * undo.c (Fprimitive_undo): Check that undo function does not
17 switch buffer.
18
192005-02-08 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
20
21 * xselect.c (selection_data_to_lisp_data): For the special case
22 type == XA_ATOM, data contains array of int, not array of Atom.
23 (x_property_data_to_lisp, selection_data_to_lisp_data): Comment
24 update: data must be array of int for format == 32.
25
262005-02-08 Stefan Monnier <monnier@iro.umontreal.ca>
27
28 * undo.c (Fprimitive_undo): Check veracity of delta,start,end.
29
302005-02-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
31
32 * xfns.c (Fx_change_window_property): Use long array when format is 32.
33 (Fx_window_property): If format is 32 and long is bigger than 32 bits,
34 convert long array returned from XGetWindowProperty to an int array.
35 (x_set_tool_bar_lines): Check that width and height is greater than
36 zero before clearing area.
37
38 * xselect.c (x_reply_selection_request): Pass long array to
39 XChangeProperty so that 64 bit longs are handeled correctly.
40 (x_get_window_property): If format is 32 and long is bigger than 32
41 bits convert data from XGetWindowProperty from long array to int array.
42 (lisp_data_to_selection_data): When the input is a vector and the
43 format is 32, allocate a long array even if long is bigger than 32 bits.
44 (x_fill_property_data): Use char, short and long as the man page
45 for XChangeProperty specifies. This way the data returned is OK for
46 both 32 and 64 bit machines.
47 (x_handle_dnd_message): Calculate size correctly even for 64 bit
48 machines.
49 (Fx_send_client_event): Undo change from 2005-02-05,
50 x_fill_property_data now handles that case.
51
52 * xfns.c (Fx_backspace_delete_keys_p): Add comment about the
53 reason for the approach in the code.
54
552005-02-07 Kim F. Storm <storm@cua.dk>
56
57 * undo.c (Fprimitive_undo): Record max one dummmy apply element.
58
592005-02-06 Richard M. Stallman <rms@gnu.org>
60
61 * eval.c (Frun_hook_with_args)
62 (Frun_hook_with_args_until_success)
63 (Frun_hook_with_args_until_failure): Doc fixes.
64
12005-02-05 Andreas Schwab <schwab@suse.de> 652005-02-05 Andreas Schwab <schwab@suse.de>
2 66
3 * sysdep.c (sys_subshell): Properly terminate execlp argument 67 * sysdep.c (sys_subshell): Properly terminate execlp argument list.
4 list.
5 68
62005-02-05 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 692005-02-05 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
7 70
@@ -41,8 +104,7 @@
41 104
42 * macfns.c (x_create_tip_frame): Likewise. 105 * macfns.c (x_create_tip_frame): Likewise.
43 106
44 * macterm.c (mac_draw_string_common, x_make_frame_visible): 107 * macterm.c (mac_draw_string_common, x_make_frame_visible): Likewise.
45 Likewise.
46 108
472005-02-03 Richard M. Stallman <rms@gnu.org> 1092005-02-03 Richard M. Stallman <rms@gnu.org>
48 110
@@ -9915,7 +9977,7 @@
9915 * search.c (Fmatch_data): Doc fix. Explicitly state that 9977 * search.c (Fmatch_data): Doc fix. Explicitly state that
9916 match-data is undefined if last search failed. 9978 match-data is undefined if last search failed.
9917 9979
9918 * keymap.c (Fcommand_remapping): Renamed from Fremap_command. 9980 * keymap.c (Fcommand_remapping): Rename from Fremap_command.
9919 All uses changed. 9981 All uses changed.
9920 9982
99212003-02-12 Juanma Barranquero <lektu@terra.es> 99832003-02-12 Juanma Barranquero <lektu@terra.es>
@@ -10622,7 +10684,7 @@
10622 selected frame. 10684 selected frame.
10623 10685
10624 * keymap.c (apropos_predicate, apropos_accumulate): Make them static. 10686 * keymap.c (apropos_predicate, apropos_accumulate): Make them static.
10625 (syms_of_keymap): staticpro them. 10687 (syms_of_keymap): Staticpro them.
10626 (Fapropos_internal): Initialize them and clear them out. 10688 (Fapropos_internal): Initialize them and clear them out.
10627 Don't GCPRO them. 10689 Don't GCPRO them.
10628 10690
@@ -12724,9 +12786,9 @@
12724 * fns.c (concat): Likewise. 12786 * fns.c (concat): Likewise.
12725 * lread.c (read_vector): Likewise. 12787 * lread.c (read_vector): Likewise.
12726 12788
12727 * lisp.h (SMBP): Deleted. All uses changed to STRING_MULTIBYTE. 12789 * lisp.h (SMBP): Delete. All uses changed to STRING_MULTIBYTE.
12728 (STRING_SET_UNIBYTE): New macro. 12790 (STRING_SET_UNIBYTE): New macro.
12729 (SET_STRING_BYTES): Deleted. Callers (all of which supplied a 12791 (SET_STRING_BYTES): Delete. Callers (all of which supplied a
12730 length of -1) changed to use STRING_SET_UNIBYTE. 12792 length of -1) changed to use STRING_SET_UNIBYTE.
12731 * abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, 12793 * abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c,
12732 casefiddle.c, category.c, ccl.c, charset.c, charset.h, coding.c, 12794 casefiddle.c, category.c, ccl.c, charset.c, charset.h, coding.c,
@@ -12769,7 +12831,7 @@
127692002-07-11 Richard M. Stallman <rms@gnu.org> 128312002-07-11 Richard M. Stallman <rms@gnu.org>
12770 12832
12771 * alloc.c (Vmemory_full): New variable. 12833 * alloc.c (Vmemory_full): New variable.
12772 (Vmemory_signal_data): Renamed from memory_signal_data. 12834 (Vmemory_signal_data): Rename from memory_signal_data.
12773 Uses changed. 12835 Uses changed.
12774 (syms_of_alloc): Defvar them. 12836 (syms_of_alloc): Defvar them.
12775 (memory_full, buffer_memory_full): Set Vmemory_full. 12837 (memory_full, buffer_memory_full): Set Vmemory_full.
@@ -12787,7 +12849,7 @@
12787 (reseat_at_next_visible_line_start, next_element_from_buffer): 12849 (reseat_at_next_visible_line_start, next_element_from_buffer):
12788 Use `double', not `float', when calling indented_beyond_p. 12850 Use `double', not `float', when calling indented_beyond_p.
12789 12851
12790 * s/hpux11.h (BROKEN_SA_RESTART): Defined. 12852 * s/hpux11.h (BROKEN_SA_RESTART): Define.
12791 12853
12792 * sysdep.c (sys_signal): Test BROKEN_SA_RESTART. 12854 * sysdep.c (sys_signal): Test BROKEN_SA_RESTART.
12793 12855
@@ -13545,7 +13607,7 @@
13545 13607
135462002-05-11 Kim F. Storm <storm@cua.dk> 136082002-05-11 Kim F. Storm <storm@cua.dk>
13547 13609
13548 * keymap.c (current_minor_maps): Fixed resizing of cmm_maps; 13610 * keymap.c (current_minor_maps): Fix resizing of cmm_maps;
13549 only update cmm_size if realloc actually succeeds. 13611 only update cmm_size if realloc actually succeeds.
13550 Testing with initial size of 2 elements revealed that using 13612 Testing with initial size of 2 elements revealed that using
13551 realloc on GNU/Linux would cause a random trap in xmalloc 13613 realloc on GNU/Linux would cause a random trap in xmalloc
@@ -14784,7 +14846,7 @@
14784 14846
147852002-02-24 Kim F. Storm <storm@cua.dk> 148472002-02-24 Kim F. Storm <storm@cua.dk>
14786 14848
14787 * keymap.c (Flookup_key): Fixed problem in 2001-12-28 patch: 14849 * keymap.c (Flookup_key): Fix problem in 2001-12-28 patch:
14788 The validation of the event type was too strict as it didn't 14850 The validation of the event type was too strict as it didn't
14789 allow string events; buffer names are used in bindings for 14851 allow string events; buffer names are used in bindings for
14790 menu-bar-select-buffer (see `menu-bar-update-buffers'). 14852 menu-bar-select-buffer (see `menu-bar-update-buffers').
@@ -14797,7 +14859,7 @@
14797 prefix in the keymaps, i.e. [remap COMMAND]. 14859 prefix in the keymaps, i.e. [remap COMMAND].
14798 14860
14799 * keymap.c (Qremap, remap_command_vector): New variables. 14861 * keymap.c (Qremap, remap_command_vector): New variables.
14800 (is_command_symbol): Removed function. 14862 (is_command_symbol): Remove function.
14801 (Fdefine_key): No longer accept a symbol for KEY. 14863 (Fdefine_key): No longer accept a symbol for KEY.
14802 Added validation of [remap COMMAND] argument for KEY. 14864 Added validation of [remap COMMAND] argument for KEY.
14803 The DEF is no longer required to be a symbol when remapping a command. 14865 The DEF is no longer required to be a symbol when remapping a command.
@@ -15155,7 +15217,7 @@
15155 Doc updated. Callers changed. Pass arg to where_is_internal. 15217 Doc updated. Callers changed. Pass arg to where_is_internal.
15156 15218
15157 * keymap.h (Fkey_binding, Fwhere_is_internal): Update prototype. 15219 * keymap.h (Fkey_binding, Fwhere_is_internal): Update prototype.
15158 (is_command_symbol): Added prototype. 15220 (is_command_symbol): Add prototype.
15159 15221
15160 * keyboard.c (Vthis_original_command): New variable. 15222 * keyboard.c (Vthis_original_command): New variable.
15161 (syms_of_keyboard): DEFVAR_LISP it. 15223 (syms_of_keyboard): DEFVAR_LISP it.
@@ -15572,7 +15634,7 @@
15572 15634
155732002-01-03 Kim F. Storm <storm@cua.dk> 156352002-01-03 Kim F. Storm <storm@cua.dk>
15574 15636
15575 * keyboard.c (read_key_sequence): Fixed cast of submaps arg to bcopy. 15637 * keyboard.c (read_key_sequence): Fix cast of submaps arg to bcopy.
15576 15638
155772002-01-02 Richard M. Stallman <rms@gnu.org> 156392002-01-02 Richard M. Stallman <rms@gnu.org>
15578 15640
diff --git a/src/eval.c b/src/eval.c
index 9c27caa29ca..83e16360473 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2323,7 +2323,7 @@ called to run the hook. If the value is a function, it is called with
2323the given arguments and its return value is returned. If it is a list 2323the given arguments and its return value is returned. If it is a list
2324of functions, those functions are called, in order, 2324of functions, those functions are called, in order,
2325with the given arguments ARGS. 2325with the given arguments ARGS.
2326It is best not to depend on the value return by `run-hook-with-args', 2326It is best not to depend on the value returned by `run-hook-with-args',
2327as that may change. 2327as that may change.
2328 2328
2329Do not use `make-local-variable' to make a hook variable buffer-local. 2329Do not use `make-local-variable' to make a hook variable buffer-local.
@@ -2339,11 +2339,14 @@ usage: (run-hook-with-args HOOK &rest ARGS) */)
2339DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, 2339DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success,
2340 Srun_hook_with_args_until_success, 1, MANY, 0, 2340 Srun_hook_with_args_until_success, 1, MANY, 0,
2341 doc: /* Run HOOK with the specified arguments ARGS. 2341 doc: /* Run HOOK with the specified arguments ARGS.
2342HOOK should be a symbol, a hook variable. Its value should 2342HOOK should be a symbol, a hook variable. If HOOK has a non-nil
2343be a list of functions. We call those functions, one by one, 2343value, that value may be a function or a list of functions to be
2344passing arguments ARGS to each of them, until one of them 2344called to run the hook. If the value is a function, it is called with
2345the given arguments and its return value is returned.
2346If it is a list of functions, those functions are called, in order,
2347with the given arguments ARGS, until one of them
2345returns a non-nil value. Then we return that value. 2348returns a non-nil value. Then we return that value.
2346If all the functions return nil, we return nil. 2349However, if they all return nil, we return nil.
2347 2350
2348Do not use `make-local-variable' to make a hook variable buffer-local. 2351Do not use `make-local-variable' to make a hook variable buffer-local.
2349Instead, use `add-hook' and specify t for the LOCAL argument. 2352Instead, use `add-hook' and specify t for the LOCAL argument.
@@ -2358,11 +2361,13 @@ usage: (run-hook-with-args-until-success HOOK &rest ARGS) */)
2358DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, 2361DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure,
2359 Srun_hook_with_args_until_failure, 1, MANY, 0, 2362 Srun_hook_with_args_until_failure, 1, MANY, 0,
2360 doc: /* Run HOOK with the specified arguments ARGS. 2363 doc: /* Run HOOK with the specified arguments ARGS.
2361HOOK should be a symbol, a hook variable. Its value should 2364HOOK should be a symbol, a hook variable. If HOOK has a non-nil
2362be a list of functions. We call those functions, one by one, 2365value, that value may be a function or a list of functions to be
2363passing arguments ARGS to each of them, until one of them 2366called to run the hook. If the value is a function, it is called with
2364returns nil. Then we return nil. 2367the given arguments and its return value is returned.
2365If all the functions return non-nil, we return non-nil. 2368If it is a list of functions, those functions are called, in order,
2369with the given arguments ARGS, until one of them returns nil.
2370Then we return nil. However, if they all return non-nil, we return non-nil.
2366 2371
2367Do not use `make-local-variable' to make a hook variable buffer-local. 2372Do not use `make-local-variable' to make a hook variable buffer-local.
2368Instead, use `add-hook' and specify t for the LOCAL argument. 2373Instead, use `add-hook' and specify t for the LOCAL argument.
diff --git a/src/keyboard.c b/src/keyboard.c
index 8abc38b1072..e10b111d12d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -65,6 +65,10 @@ Boston, MA 02111-1307, USA. */
65#include <unistd.h> 65#include <unistd.h>
66#endif 66#endif
67 67
68#ifdef HAVE_FCNTL_H
69#include <fcntl.h>
70#endif
71
68/* This is to get the definitions of the XK_ symbols. */ 72/* This is to get the definitions of the XK_ symbols. */
69#ifdef HAVE_X_WINDOWS 73#ifdef HAVE_X_WINDOWS
70#include "xterm.h" 74#include "xterm.h"
diff --git a/src/undo.c b/src/undo.c
index eaf312be676..b4e16bfd0e5 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -1,5 +1,6 @@
1/* undo handling for GNU Emacs. 1/* undo handling for GNU Emacs.
2 Copyright (C) 1990, 1993, 1994, 2000 Free Software Foundation, Inc. 2 Copyright (C) 1990, 1993, 1994, 2000, 2002, 2004, 2005
3 Free Software Foundation, Inc.
3 4
4This file is part of GNU Emacs. 5This file is part of GNU Emacs.
5 6
@@ -454,6 +455,8 @@ Return what remains of the list. */)
454 Lisp_Object next; 455 Lisp_Object next;
455 int count = SPECPDL_INDEX (); 456 int count = SPECPDL_INDEX ();
456 register int arg; 457 register int arg;
458 Lisp_Object oldlist;
459 int did_apply = 0;
457 460
458#if 0 /* This is a good feature, but would make undo-start 461#if 0 /* This is a good feature, but would make undo-start
459 unable to do what is expected. */ 462 unable to do what is expected. */
@@ -470,6 +473,8 @@ Return what remains of the list. */)
470 arg = XINT (n); 473 arg = XINT (n);
471 next = Qnil; 474 next = Qnil;
472 GCPRO2 (next, list); 475 GCPRO2 (next, list);
476 /* I don't think we need to gcpro oldlist, as we use it only
477 to check for EQ. ++kfs */
473 478
474 /* In a writable buffer, enable undoing read-only text that is so 479 /* In a writable buffer, enable undoing read-only text that is so
475 because of text properties. */ 480 because of text properties. */
@@ -479,6 +484,8 @@ Return what remains of the list. */)
479 /* Don't let `intangible' properties interfere with undo. */ 484 /* Don't let `intangible' properties interfere with undo. */
480 specbind (Qinhibit_point_motion_hooks, Qt); 485 specbind (Qinhibit_point_motion_hooks, Qt);
481 486
487 oldlist = current_buffer->undo_list;
488
482 while (arg > 0) 489 while (arg > 0)
483 { 490 {
484 while (CONSP (list)) 491 while (CONSP (list))
@@ -549,24 +556,38 @@ Return what remains of the list. */)
549 } 556 }
550 else if (EQ (car, Qapply)) 557 else if (EQ (car, Qapply))
551 { 558 {
552 Lisp_Object oldlist = current_buffer->undo_list; 559 /* Element (apply FUN . ARGS) means call FUN to undo. */
553 /* Element (apply FUNNAME . ARGS) means call FUNNAME to undo. */ 560 struct buffer *save_buffer = current_buffer;
561
554 car = Fcar (cdr); 562 car = Fcar (cdr);
563 cdr = Fcdr (cdr);
555 if (INTEGERP (car)) 564 if (INTEGERP (car))
556 { 565 {
557 /* Long format: (apply DELTA START END FUNNAME . ARGS). */ 566 /* Long format: (apply DELTA START END FUN . ARGS). */
558 cdr = Fcdr (Fcdr (Fcdr (cdr))); 567 Lisp_Object delta = car;
559 car = Fcar (cdr); 568 Lisp_Object start = Fcar (cdr);
569 Lisp_Object end = Fcar (Fcdr (cdr));
570 Lisp_Object start_mark = Fcopy_marker (start, Qnil);
571 Lisp_Object end_mark = Fcopy_marker (end, Qt);
572
573 cdr = Fcdr (Fcdr (cdr));
574 apply1 (Fcar (cdr), Fcdr (cdr));
575
576 /* Check that the function did what the entry said it
577 would do. */
578 if (!EQ (start, Fmarker_position (start_mark))
579 || (XINT (delta) + XINT (end)
580 != marker_position (end_mark)))
581 error ("Changes to be undone by function different than announced");
582 Fset_marker (start_mark, Qnil, Qnil);
583 Fset_marker (end_mark, Qnil, Qnil);
560 } 584 }
561 cdr = Fcdr (cdr); 585 else
562 apply1 (car, cdr); 586 apply1 (car, cdr);
563 587
564 /* Make sure this produces at least one undo entry, 588 if (save_buffer != current_buffer)
565 so the test in `undo' for continuing an undo series 589 error ("Undo function switched buffer");
566 will work right. */ 590 did_apply = 1;
567 if (EQ (oldlist, current_buffer->undo_list))
568 current_buffer->undo_list
569 = Fcons (list3 (Qapply, Qcdr, Qnil), current_buffer->undo_list);
570 } 591 }
571 else if (STRINGP (car) && INTEGERP (cdr)) 592 else if (STRINGP (car) && INTEGERP (cdr))
572 { 593 {
@@ -611,6 +632,15 @@ Return what remains of the list. */)
611 arg--; 632 arg--;
612 } 633 }
613 634
635
636 /* Make sure an apply entry produces at least one undo entry,
637 so the test in `undo' for continuing an undo series
638 will work right. */
639 if (did_apply
640 && EQ (oldlist, current_buffer->undo_list))
641 current_buffer->undo_list
642 = Fcons (list3 (Qapply, Qcdr, Qnil), current_buffer->undo_list);
643
614 UNGCPRO; 644 UNGCPRO;
615 return unbind_to (count, list); 645 return unbind_to (count, list);
616} 646}
diff --git a/src/xdisp.c b/src/xdisp.c
index 6ee9efafc62..a90483aae1e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13927,7 +13927,12 @@ try_window_id (w)
13927 bottom_vpos, dy); 13927 bottom_vpos, dy);
13928 13928
13929 if (first_unchanged_at_end_row) 13929 if (first_unchanged_at_end_row)
13930 first_unchanged_at_end_row += dvpos; 13930 {
13931 first_unchanged_at_end_row += dvpos;
13932 if (first_unchanged_at_end_row->y >= it.last_visible_y
13933 || !MATRIX_ROW_DISPLAYS_TEXT_P (first_unchanged_at_end_row))
13934 first_unchanged_at_end_row = NULL;
13935 }
13931 13936
13932 /* If scrolling up, there may be some lines to display at the end of 13937 /* If scrolling up, there may be some lines to display at the end of
13933 the window. */ 13938 the window. */
@@ -13984,7 +13989,6 @@ try_window_id (w)
13984 13989
13985 /* Update window_end_pos and window_end_vpos. */ 13990 /* Update window_end_pos and window_end_vpos. */
13986 if (first_unchanged_at_end_row 13991 if (first_unchanged_at_end_row
13987 && first_unchanged_at_end_row->y < it.last_visible_y
13988 && !last_text_row_at_end) 13992 && !last_text_row_at_end)
13989 { 13993 {
13990 /* Window end line if one of the preserved rows from the current 13994 /* Window end line if one of the preserved rows from the current
@@ -22235,7 +22239,9 @@ expose_window (w, fr)
22235 || (r.y >= y0 && r.y < y1) 22239 || (r.y >= y0 && r.y < y1)
22236 || (r.y + r.height > y0 && r.y + r.height < y1)) 22240 || (r.y + r.height > y0 && r.y + r.height < y1))
22237 { 22241 {
22238 if (row->overlapping_p) 22242 /* A header line may be overlapping, but there is no need
22243 to fix overlapping areas for them. KFS 2005-02-12 */
22244 if (row->overlapping_p && !row->mode_line_p)
22239 { 22245 {
22240 if (first_overlapping_row == NULL) 22246 if (first_overlapping_row == NULL)
22241 first_overlapping_row = row; 22247 first_overlapping_row = row;
diff --git a/src/xfns.c b/src/xfns.c
index 2732a1be051..d1edf554feb 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1399,10 +1399,14 @@ x_set_tool_bar_lines (f, value, oldval)
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);
@@ -4051,8 +4055,13 @@ Value is VALUE. */)
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 }
@@ -4187,6 +4196,30 @@ no value of TYPE. */)
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
@@ -5387,6 +5420,22 @@ usual X keysyms. */)
5387 return Qnil; 5420 return Qnil;
5388 } 5421 }
5389 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. */
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)
diff --git a/src/xselect.c b/src/xselect.c
index daae84b276c..bf37cde4d0b 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -173,12 +173,6 @@ static Lisp_Object Vselection_converter_alist;
173/* If the selection owner takes too long to reply to a selection request, 173/* If the selection owner takes too long to reply to a selection request,
174 we give up on it. This is in milliseconds (0 = no timeout.) */ 174 we give up on it. This is in milliseconds (0 = no timeout.) */
175static EMACS_INT x_selection_timeout; 175static EMACS_INT x_selection_timeout;
176
177/* Utility functions */
178
179static void lisp_data_to_selection_data ();
180static Lisp_Object selection_data_to_lisp_data ();
181static Lisp_Object x_get_window_property_as_lisp_data ();
182 176
183 177
184 178
@@ -769,9 +763,17 @@ x_reply_selection_request (event, format, data, size, type)
769 763
770 TRACE1 ("Set %s to number of bytes to send", 764 TRACE1 ("Set %s to number of bytes to send",
771 XGetAtomName (display, reply.property)); 765 XGetAtomName (display, reply.property));
772 XChangeProperty (display, window, reply.property, dpyinfo->Xatom_INCR, 766 {
773 32, PropModeReplace, 767 /* XChangeProperty expects an array of long even if long is more than
774 (unsigned char *) &bytes_remaining, 1); 768 32 bits. */
769 long value[1];
770
771 value[0] = bytes_remaining;
772 XChangeProperty (display, window, reply.property, dpyinfo->Xatom_INCR,
773 32, PropModeReplace,
774 (unsigned char *) value, 1);
775 }
776
775 XSelectInput (display, window, PropertyChangeMask); 777 XSelectInput (display, window, PropertyChangeMask);
776 778
777 /* Tell 'em the INCR data is there... */ 779 /* Tell 'em the INCR data is there... */
@@ -796,9 +798,9 @@ x_reply_selection_request (event, format, data, size, type)
796 TRACE0 ("Got ACK"); 798 TRACE0 ("Got ACK");
797 while (bytes_remaining) 799 while (bytes_remaining)
798 { 800 {
799 int i = ((bytes_remaining < max_bytes) 801 int i = ((bytes_remaining < max_bytes)
800 ? bytes_remaining 802 ? bytes_remaining
801 : max_bytes); 803 : max_bytes);
802 804
803 BLOCK_INPUT; 805 BLOCK_INPUT;
804 806
@@ -1523,9 +1525,38 @@ x_get_window_property (display, window, property, data_ret, bytes_ret,
1523 reading it. Deal with that, I guess.... */ 1525 reading it. Deal with that, I guess.... */
1524 if (result != Success) 1526 if (result != Success)
1525 break; 1527 break;
1526 *actual_size_ret *= *actual_format_ret / 8; 1528
1527 bcopy (tmp_data, (*data_ret) + offset, *actual_size_ret); 1529 /* The man page for XGetWindowProperty says:
1528 offset += *actual_size_ret; 1530 "If the returned format is 32, the returned data is represented
1531 as a long array and should be cast to that type to obtain the
1532 elements."
1533 This applies even if long is more than 32 bits, the X library
1534 converts from 32 bit elements received from the X server to long
1535 and passes the long array to us. Thus, for that case bcopy can not
1536 be used. We convert to a 32 bit type here, because so much code
1537 assume on that.
1538
1539 The bytes and offsets passed to XGetWindowProperty refers to the
1540 property and those are indeed in 32 bit quantities if format is 32. */
1541
1542 if (*actual_format_ret == 32 && *actual_format_ret < BITS_PER_LONG)
1543 {
1544 unsigned long i;
1545 int *idata = (int *) ((*data_ret) + offset);
1546 long *ldata = (long *) tmp_data;
1547
1548 for (i = 0; i < *actual_size_ret; ++i)
1549 {
1550 idata[i]= (int) ldata[i];
1551 offset += 4;
1552 }
1553 }
1554 else
1555 {
1556 *actual_size_ret *= *actual_format_ret / 8;
1557 bcopy (tmp_data, (*data_ret) + offset, *actual_size_ret);
1558 offset += *actual_size_ret;
1559 }
1529 1560
1530 /* This was allocated by Xlib, so use XFree. */ 1561 /* This was allocated by Xlib, so use XFree. */
1531 XFree ((char *) tmp_data); 1562 XFree ((char *) tmp_data);
@@ -1738,7 +1769,11 @@ x_get_window_property_as_lisp_data (display, window, property, target_type,
1738 1769
1739 When converting an object to C, it may be of the form (SYMBOL . <data>) 1770 When converting an object to C, it may be of the form (SYMBOL . <data>)
1740 where SYMBOL is what we should claim that the type is. Format and 1771 where SYMBOL is what we should claim that the type is. Format and
1741 representation are as above. */ 1772 representation are as above.
1773
1774 Important: When format is 32, data should contain an array of int,
1775 not an array of long as the X library returns. This makes a difference
1776 when sizeof(long) != sizeof(int). */
1742 1777
1743 1778
1744 1779
@@ -1780,15 +1815,21 @@ selection_data_to_lisp_data (display, data, size, type, format)
1780 else if (type == XA_ATOM) 1815 else if (type == XA_ATOM)
1781 { 1816 {
1782 int i; 1817 int i;
1783 if (size == sizeof (Atom)) 1818 /* On a 64 bit machine sizeof(Atom) == sizeof(long) == 8.
1784 return x_atom_to_symbol (display, *((Atom *) data)); 1819 But the callers of these function has made sure the data for
1820 format == 32 is an array of int. Thus, use int instead
1821 of Atom. */
1822 int *idata = (int *) data;
1823
1824 if (size == sizeof (int))
1825 return x_atom_to_symbol (display, (Atom) idata[0]);
1785 else 1826 else
1786 { 1827 {
1787 Lisp_Object v = Fmake_vector (make_number (size / sizeof (Atom)), 1828 Lisp_Object v = Fmake_vector (make_number (size / sizeof (int)),
1788 make_number (0)); 1829 make_number (0));
1789 for (i = 0; i < size / sizeof (Atom); i++) 1830 for (i = 0; i < size / sizeof (int); i++)
1790 Faset (v, make_number (i), 1831 Faset (v, make_number (i),
1791 x_atom_to_symbol (display, ((Atom *) data) [i])); 1832 x_atom_to_symbol (display, (Atom) idata[i]));
1792 return v; 1833 return v;
1793 } 1834 }
1794 } 1835 }
@@ -1970,6 +2011,7 @@ lisp_data_to_selection_data (display, obj,
1970 else 2011 else
1971 /* This vector is an INTEGER set, or something like it */ 2012 /* This vector is an INTEGER set, or something like it */
1972 { 2013 {
2014 int data_size = 2;
1973 *size_ret = XVECTOR (obj)->size; 2015 *size_ret = XVECTOR (obj)->size;
1974 if (NILP (type)) type = QINTEGER; 2016 if (NILP (type)) type = QINTEGER;
1975 *format_ret = 16; 2017 *format_ret = 16;
@@ -1982,7 +2024,11 @@ lisp_data_to_selection_data (display, obj,
1982 ("elements of selection vector must be integers or conses of integers"), 2024 ("elements of selection vector must be integers or conses of integers"),
1983 Fcons (obj, Qnil))); 2025 Fcons (obj, Qnil)));
1984 2026
1985 *data_ret = (unsigned char *) xmalloc (*size_ret * (*format_ret/8)); 2027 /* Use sizeof(long) even if it is more than 32 bits. See comment
2028 in x_get_window_property and x_fill_property_data. */
2029
2030 if (*format_ret == 32) data_size = sizeof(long);
2031 *data_ret = (unsigned char *) xmalloc (*size_ret * data_size);
1986 for (i = 0; i < *size_ret; i++) 2032 for (i = 0; i < *size_ret; i++)
1987 if (*format_ret == 32) 2033 if (*format_ret == 32)
1988 (*((unsigned long **) data_ret)) [i] 2034 (*((unsigned long **) data_ret)) [i]
@@ -2469,8 +2515,10 @@ x_check_property_data (data)
2469 DATA is a Lisp list of values to be converted. 2515 DATA is a Lisp list of values to be converted.
2470 RET is the C array that contains the converted values. It is assumed 2516 RET is the C array that contains the converted values. It is assumed
2471 it is big enough to hold all values. 2517 it is big enough to hold all values.
2472 FORMAT is 8, 16 or 32 and gives the size in bits for each C value to 2518 FORMAT is 8, 16 or 32 and denotes char/short/long for each C value to
2473 be stored in RET. */ 2519 be stored in RET. Note that long is used for 32 even if long is more
2520 than 32 bits (see man pages for XChangeProperty, XGetWindowProperty and
2521 XClientMessageEvent). */
2474 2522
2475void 2523void
2476x_fill_property_data (dpy, data, ret, format) 2524x_fill_property_data (dpy, data, ret, format)
@@ -2479,10 +2527,10 @@ x_fill_property_data (dpy, data, ret, format)
2479 void *ret; 2527 void *ret;
2480 int format; 2528 int format;
2481{ 2529{
2482 CARD32 val; 2530 long val;
2483 CARD32 *d32 = (CARD32 *) ret; 2531 long *d32 = (long *) ret;
2484 CARD16 *d16 = (CARD16 *) ret; 2532 short *d16 = (short *) ret;
2485 CARD8 *d08 = (CARD8 *) ret; 2533 char *d08 = (char *) ret;
2486 Lisp_Object iter; 2534 Lisp_Object iter;
2487 2535
2488 for (iter = data; CONSP (iter); iter = XCDR (iter)) 2536 for (iter = data; CONSP (iter); iter = XCDR (iter))
@@ -2490,24 +2538,24 @@ x_fill_property_data (dpy, data, ret, format)
2490 Lisp_Object o = XCAR (iter); 2538 Lisp_Object o = XCAR (iter);
2491 2539
2492 if (INTEGERP (o)) 2540 if (INTEGERP (o))
2493 val = (CARD32) XFASTINT (o); 2541 val = (long) XFASTINT (o);
2494 else if (FLOATP (o)) 2542 else if (FLOATP (o))
2495 val = (CARD32) XFLOAT_DATA (o); 2543 val = (long) XFLOAT_DATA (o);
2496 else if (CONSP (o)) 2544 else if (CONSP (o))
2497 val = (CARD32) cons_to_long (o); 2545 val = (long) cons_to_long (o);
2498 else if (STRINGP (o)) 2546 else if (STRINGP (o))
2499 { 2547 {
2500 BLOCK_INPUT; 2548 BLOCK_INPUT;
2501 val = XInternAtom (dpy, (char *) SDATA (o), False); 2549 val = (long) XInternAtom (dpy, (char *) SDATA (o), False);
2502 UNBLOCK_INPUT; 2550 UNBLOCK_INPUT;
2503 } 2551 }
2504 else 2552 else
2505 error ("Wrong type, must be string, number or cons"); 2553 error ("Wrong type, must be string, number or cons");
2506 2554
2507 if (format == 8) 2555 if (format == 8)
2508 *d08++ = (CARD8) val; 2556 *d08++ = (char) val;
2509 else if (format == 16) 2557 else if (format == 16)
2510 *d16++ = (CARD16) val; 2558 *d16++ = (short) val;
2511 else 2559 else
2512 *d32++ = val; 2560 *d32++ = val;
2513 } 2561 }
@@ -2522,6 +2570,10 @@ x_fill_property_data (dpy, data, ret, format)
2522 be stored in RET. 2570 be stored in RET.
2523 SIZE is the number of elements in DATA. 2571 SIZE is the number of elements in DATA.
2524 2572
2573 Important: When format is 32, data should contain an array of int,
2574 not an array of long as the X library returns. This makes a difference
2575 when sizeof(long) != sizeof(int).
2576
2525 Also see comment for selection_data_to_lisp_data above. */ 2577 Also see comment for selection_data_to_lisp_data above. */
2526 2578
2527Lisp_Object 2579Lisp_Object
@@ -2633,7 +2685,8 @@ x_handle_dnd_message (f, event, dpyinfo, bufp)
2633{ 2685{
2634 Lisp_Object vec; 2686 Lisp_Object vec;
2635 Lisp_Object frame; 2687 Lisp_Object frame;
2636 unsigned long size = (8*sizeof (event->data))/event->format; 2688 /* format 32 => size 5, format 16 => size 10, format 8 => size 20 */
2689 unsigned long size = 160/event->format;
2637 int x, y; 2690 int x, y;
2638 unsigned char *data = (unsigned char *) event->data.b; 2691 unsigned char *data = (unsigned char *) event->data.b;
2639 int idata[5]; 2692 int idata[5];
@@ -2712,8 +2765,6 @@ are ignored. */)
2712 struct frame *f = check_x_frame (from); 2765 struct frame *f = check_x_frame (from);
2713 int count; 2766 int count;
2714 int to_root; 2767 int to_root;
2715 int idata[5];
2716 void *data;
2717 2768
2718 CHECK_STRING (message_type); 2769 CHECK_STRING (message_type);
2719 CHECK_NUMBER (format); 2770 CHECK_NUMBER (format);
@@ -2774,30 +2825,10 @@ are ignored. */)
2774 event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest; 2825 event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest;
2775 2826
2776 2827
2777 if (event.xclient.format == 32 && event.xclient.format < BITS_PER_LONG) 2828 memset (event.xclient.data.b, 0, sizeof (event.xclient.data.b));
2778 { 2829 x_fill_property_data (dpyinfo->display, values, event.xclient.data.b,
2779 /* x_fill_property_data expects data to hold 32 bit values when 2830 event.xclient.format);
2780 format == 32, but on a 64 bit machine long is 64 bits.
2781 event.xclient.l is an array of long, so we must compensate. */
2782
2783 memset (idata, 0, sizeof (idata));
2784 data = idata;
2785 }
2786 else
2787 {
2788 memset (event.xclient.data.b, 0, sizeof (event.xclient.data.b));
2789 data = event.xclient.data.b;
2790 }
2791
2792 x_fill_property_data (dpyinfo->display, values, data, event.xclient.format);
2793 2831
2794 if (data == idata)
2795 {
2796 int i;
2797 for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */
2798 event.xclient.data.l[i] = (long) idata[i];
2799 }
2800
2801 /* If event mask is 0 the event is sent to the client that created 2832 /* If event mask is 0 the event is sent to the client that created
2802 the destination window. But if we are sending to the root window, 2833 the destination window. But if we are sending to the root window,
2803 there is no such client. Then we set the event mask to 0xffff. The 2834 there is no such client. Then we set the event mask to 0xffff. The