aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2005-02-10 20:43:55 +0000
committerKaroly Lorentey2005-02-10 20:43:55 +0000
commitbdfec2134d38a605c95baab0e38ef321a6b1d59e (patch)
treef2c616c523590a8a8f294ea3c6258d72f5de86a1 /src
parentfc8bcb58bc6e96beed7ad20bae40d28d3d2ea058 (diff)
parentd25e21dddcd4df58a4029f106ad7eea82c5726dd (diff)
downloademacs-bdfec2134d38a605c95baab0e38ef321a6b1d59e.tar.gz
emacs-bdfec2134d38a605c95baab0e38ef321a6b1d59e.zip
Merged from miles@gnu.org--gnu-2005 (patch 12-13, 79-90)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-79 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-80 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-81 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-82 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-83 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-84 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-85 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-86 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-87 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-88 Update from CVS * 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/gnus--rel--5.10--patch-12 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-13 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-290
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog90
-rw-r--r--src/eval.c25
-rw-r--r--src/sysdep.c4
-rw-r--r--src/undo.c60
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xfns.c61
-rw-r--r--src/xselect.c143
7 files changed, 301 insertions, 84 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index eb8bab64362..c00c06cc358 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,68 @@
12005-02-09 Kim F. Storm <storm@cua.dk>
2
3 * undo.c (Fprimitive_undo): Check that undo function does not
4 switch buffer.
5
62005-02-08 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
7
8 * xselect.c (selection_data_to_lisp_data): For the special case
9 type == XA_ATOM, data contains array of int, not array of Atom.
10 (x_property_data_to_lisp, selection_data_to_lisp_data): Comment
11 update: data must be array of int for format == 32.
12
132005-02-08 Stefan Monnier <monnier@iro.umontreal.ca>
14
15 * undo.c (Fprimitive_undo): Check veracity of delta,start,end.
16
172005-02-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
18
19 * xfns.c (Fx_change_window_property): Use long array when format is 32.
20 (Fx_window_property): If format is 32 and long is bigger than 32 bits,
21 convert long array returned from XGetWindowProperty to an int array.
22 (x_set_tool_bar_lines): Check that width and height is greater than
23 zero before clearing area.
24
25 * xselect.c (x_reply_selection_request): Pass long array to
26 XChangeProperty so that 64 bit longs are handeled correctly.
27 (x_get_window_property): If format is 32 and long is bigger than 32
28 bits convert data from XGetWindowProperty from long array to int array.
29 (lisp_data_to_selection_data): When the input is a vector and the
30 format is 32, allocate a long array even if long is bigger than 32 bits.
31 (x_fill_property_data): Use char, short and long as the man page
32 for XChangeProperty specifies. This way the data returned is OK for
33 both 32 and 64 bit machines.
34 (x_handle_dnd_message): Calculate size correctly even for 64 bit
35 machines.
36 (Fx_send_client_event): Undo change from 2005-02-05,
37 x_fill_property_data now handles that case.
38
39 * xfns.c (Fx_backspace_delete_keys_p): Add comment about the
40 reason for the approach in the code.
41
422005-02-07 Kim F. Storm <storm@cua.dk>
43
44 * undo.c (Fprimitive_undo): Record max one dummmy apply element.
45
462005-02-06 Richard M. Stallman <rms@gnu.org>
47
48 * eval.c (Frun_hook_with_args)
49 (Frun_hook_with_args_until_success)
50 (Frun_hook_with_args_until_failure): Doc fixes.
51
522005-02-05 Andreas Schwab <schwab@suse.de>
53
54 * sysdep.c (sys_subshell): Properly terminate execlp argument list.
55
562005-02-05 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
57
58 * xselect.c (Fx_send_client_event, x_handle_dnd_message): Handle
59 the longs in a XClientMessageEvent correctly when long is 64 bits.
60
612005-02-05 Eli Zaretskii <eliz@gnu.org>
62
63 * xfaces.c (face_color_supported_p): Use HAVE_WINDOW_SYSTEM
64 instead of HAVE_X_WINDOWS, for non-X windowed sessions.
65
12005-02-03 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 662005-02-03 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2 67
3 * xmenu.c (menubar_selection_callback): Force out GTK buffered 68 * xmenu.c (menubar_selection_callback): Force out GTK buffered
@@ -26,8 +91,7 @@
26 91
27 * macfns.c (x_create_tip_frame): Likewise. 92 * macfns.c (x_create_tip_frame): Likewise.
28 93
29 * macterm.c (mac_draw_string_common, x_make_frame_visible): 94 * macterm.c (mac_draw_string_common, x_make_frame_visible): Likewise.
30 Likewise.
31 95
322005-02-03 Richard M. Stallman <rms@gnu.org> 962005-02-03 Richard M. Stallman <rms@gnu.org>
33 97
@@ -9905,7 +9969,7 @@
9905 * search.c (Fmatch_data): Doc fix. Explicitly state that 9969 * search.c (Fmatch_data): Doc fix. Explicitly state that
9906 match-data is undefined if last search failed. 9970 match-data is undefined if last search failed.
9907 9971
9908 * keymap.c (Fcommand_remapping): Renamed from Fremap_command. 9972 * keymap.c (Fcommand_remapping): Rename from Fremap_command.
9909 All uses changed. 9973 All uses changed.
9910 9974
99112003-02-12 Juanma Barranquero <lektu@terra.es> 99752003-02-12 Juanma Barranquero <lektu@terra.es>
@@ -10612,7 +10676,7 @@
10612 selected frame. 10676 selected frame.
10613 10677
10614 * keymap.c (apropos_predicate, apropos_accumulate): Make them static. 10678 * keymap.c (apropos_predicate, apropos_accumulate): Make them static.
10615 (syms_of_keymap): staticpro them. 10679 (syms_of_keymap): Staticpro them.
10616 (Fapropos_internal): Initialize them and clear them out. 10680 (Fapropos_internal): Initialize them and clear them out.
10617 Don't GCPRO them. 10681 Don't GCPRO them.
10618 10682
@@ -12714,9 +12778,9 @@
12714 * fns.c (concat): Likewise. 12778 * fns.c (concat): Likewise.
12715 * lread.c (read_vector): Likewise. 12779 * lread.c (read_vector): Likewise.
12716 12780
12717 * lisp.h (SMBP): Deleted. All uses changed to STRING_MULTIBYTE. 12781 * lisp.h (SMBP): Delete. All uses changed to STRING_MULTIBYTE.
12718 (STRING_SET_UNIBYTE): New macro. 12782 (STRING_SET_UNIBYTE): New macro.
12719 (SET_STRING_BYTES): Deleted. Callers (all of which supplied a 12783 (SET_STRING_BYTES): Delete. Callers (all of which supplied a
12720 length of -1) changed to use STRING_SET_UNIBYTE. 12784 length of -1) changed to use STRING_SET_UNIBYTE.
12721 * abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, 12785 * abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c,
12722 casefiddle.c, category.c, ccl.c, charset.c, charset.h, coding.c, 12786 casefiddle.c, category.c, ccl.c, charset.c, charset.h, coding.c,
@@ -12759,7 +12823,7 @@
127592002-07-11 Richard M. Stallman <rms@gnu.org> 128232002-07-11 Richard M. Stallman <rms@gnu.org>
12760 12824
12761 * alloc.c (Vmemory_full): New variable. 12825 * alloc.c (Vmemory_full): New variable.
12762 (Vmemory_signal_data): Renamed from memory_signal_data. 12826 (Vmemory_signal_data): Rename from memory_signal_data.
12763 Uses changed. 12827 Uses changed.
12764 (syms_of_alloc): Defvar them. 12828 (syms_of_alloc): Defvar them.
12765 (memory_full, buffer_memory_full): Set Vmemory_full. 12829 (memory_full, buffer_memory_full): Set Vmemory_full.
@@ -12777,7 +12841,7 @@
12777 (reseat_at_next_visible_line_start, next_element_from_buffer): 12841 (reseat_at_next_visible_line_start, next_element_from_buffer):
12778 Use `double', not `float', when calling indented_beyond_p. 12842 Use `double', not `float', when calling indented_beyond_p.
12779 12843
12780 * s/hpux11.h (BROKEN_SA_RESTART): Defined. 12844 * s/hpux11.h (BROKEN_SA_RESTART): Define.
12781 12845
12782 * sysdep.c (sys_signal): Test BROKEN_SA_RESTART. 12846 * sysdep.c (sys_signal): Test BROKEN_SA_RESTART.
12783 12847
@@ -13535,7 +13599,7 @@
13535 13599
135362002-05-11 Kim F. Storm <storm@cua.dk> 136002002-05-11 Kim F. Storm <storm@cua.dk>
13537 13601
13538 * keymap.c (current_minor_maps): Fixed resizing of cmm_maps; 13602 * keymap.c (current_minor_maps): Fix resizing of cmm_maps;
13539 only update cmm_size if realloc actually succeeds. 13603 only update cmm_size if realloc actually succeeds.
13540 Testing with initial size of 2 elements revealed that using 13604 Testing with initial size of 2 elements revealed that using
13541 realloc on GNU/Linux would cause a random trap in xmalloc 13605 realloc on GNU/Linux would cause a random trap in xmalloc
@@ -14774,7 +14838,7 @@
14774 14838
147752002-02-24 Kim F. Storm <storm@cua.dk> 148392002-02-24 Kim F. Storm <storm@cua.dk>
14776 14840
14777 * keymap.c (Flookup_key): Fixed problem in 2001-12-28 patch: 14841 * keymap.c (Flookup_key): Fix problem in 2001-12-28 patch:
14778 The validation of the event type was too strict as it didn't 14842 The validation of the event type was too strict as it didn't
14779 allow string events; buffer names are used in bindings for 14843 allow string events; buffer names are used in bindings for
14780 menu-bar-select-buffer (see `menu-bar-update-buffers'). 14844 menu-bar-select-buffer (see `menu-bar-update-buffers').
@@ -14787,7 +14851,7 @@
14787 prefix in the keymaps, i.e. [remap COMMAND]. 14851 prefix in the keymaps, i.e. [remap COMMAND].
14788 14852
14789 * keymap.c (Qremap, remap_command_vector): New variables. 14853 * keymap.c (Qremap, remap_command_vector): New variables.
14790 (is_command_symbol): Removed function. 14854 (is_command_symbol): Remove function.
14791 (Fdefine_key): No longer accept a symbol for KEY. 14855 (Fdefine_key): No longer accept a symbol for KEY.
14792 Added validation of [remap COMMAND] argument for KEY. 14856 Added validation of [remap COMMAND] argument for KEY.
14793 The DEF is no longer required to be a symbol when remapping a command. 14857 The DEF is no longer required to be a symbol when remapping a command.
@@ -15145,7 +15209,7 @@
15145 Doc updated. Callers changed. Pass arg to where_is_internal. 15209 Doc updated. Callers changed. Pass arg to where_is_internal.
15146 15210
15147 * keymap.h (Fkey_binding, Fwhere_is_internal): Update prototype. 15211 * keymap.h (Fkey_binding, Fwhere_is_internal): Update prototype.
15148 (is_command_symbol): Added prototype. 15212 (is_command_symbol): Add prototype.
15149 15213
15150 * keyboard.c (Vthis_original_command): New variable. 15214 * keyboard.c (Vthis_original_command): New variable.
15151 (syms_of_keyboard): DEFVAR_LISP it. 15215 (syms_of_keyboard): DEFVAR_LISP it.
@@ -15562,7 +15626,7 @@
15562 15626
155632002-01-03 Kim F. Storm <storm@cua.dk> 156272002-01-03 Kim F. Storm <storm@cua.dk>
15564 15628
15565 * keyboard.c (read_key_sequence): Fixed cast of submaps arg to bcopy. 15629 * keyboard.c (read_key_sequence): Fix cast of submaps arg to bcopy.
15566 15630
155672002-01-02 Richard M. Stallman <rms@gnu.org> 156312002-01-02 Richard M. Stallman <rms@gnu.org>
15568 15632
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/sysdep.c b/src/sysdep.c
index 55b333bfbc9..581a225c33b 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1,6 +1,6 @@
1/* Interfaces to system-dependent kernel and library entries. 1/* Interfaces to system-dependent kernel and library entries.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001,
3 2003, 2004 Free Software Foundation, Inc. 3 2003, 2004, 2005 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -866,7 +866,7 @@ sys_subshell ()
866 if (pid == -1) 866 if (pid == -1)
867 write (1, "Can't execute subshell", 22); 867 write (1, "Can't execute subshell", 22);
868#else /* not WINDOWSNT */ 868#else /* not WINDOWSNT */
869 execlp (sh, sh, 0); 869 execlp (sh, sh, (char *) 0);
870 write (1, "Can't execute subshell", 22); 870 write (1, "Can't execute subshell", 22);
871 _exit (1); 871 _exit (1);
872#endif /* not WINDOWSNT */ 872#endif /* not WINDOWSNT */
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/xfaces.c b/src/xfaces.c
index a0ac3867ef6..9b2d5731508 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1516,7 +1516,7 @@ face_color_supported_p (f, color_name, background_p)
1516 1516
1517 XSETFRAME (frame, f); 1517 XSETFRAME (frame, f);
1518 return 1518 return
1519#ifdef HAVE_X_WINDOWS 1519#ifdef HAVE_WINDOW_SYSTEM
1520 FRAME_WINDOW_P (f) 1520 FRAME_WINDOW_P (f)
1521 ? (!NILP (Fxw_display_color_p (frame)) 1521 ? (!NILP (Fxw_display_color_p (frame))
1522 || xstricmp (color_name, "black") == 0 1522 || xstricmp (color_name, "black") == 0
diff --git a/src/xfns.c b/src/xfns.c
index 48967575f0c..8c5039d0cf6 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1408,10 +1408,14 @@ x_set_tool_bar_lines (f, value, oldval)
1408 int width = FRAME_PIXEL_WIDTH (f); 1408 int width = FRAME_PIXEL_WIDTH (f);
1409 int y = nlines * FRAME_LINE_HEIGHT (f); 1409 int y = nlines * FRAME_LINE_HEIGHT (f);
1410 1410
1411 BLOCK_INPUT; 1411 /* height can be zero here. */
1412 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 1412 if (height > 0 && width > 0)
1413 0, y, width, height, False); 1413 {
1414 UNBLOCK_INPUT; 1414 BLOCK_INPUT;
1415 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
1416 0, y, width, height, False);
1417 UNBLOCK_INPUT;
1418 }
1415 1419
1416 if (WINDOWP (f->tool_bar_window)) 1420 if (WINDOWP (f->tool_bar_window))
1417 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); 1421 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
@@ -4086,8 +4090,13 @@ Value is VALUE. */)
4086 data = (unsigned char *) xmalloc (nelements); 4090 data = (unsigned char *) xmalloc (nelements);
4087 else if (element_format == 16) 4091 else if (element_format == 16)
4088 data = (unsigned char *) xmalloc (nelements*2); 4092 data = (unsigned char *) xmalloc (nelements*2);
4089 else 4093 else /* format == 32 */
4090 data = (unsigned char *) xmalloc (nelements*4); 4094 /* The man page for XChangeProperty:
4095 "If the specified format is 32, the property data must be a
4096 long array."
4097 This applies even if long is more than 64 bits. The X library
4098 converts to 32 bits before sending to the X server. */
4099 data = (unsigned char *) xmalloc (nelements * sizeof(long));
4091 4100
4092 x_fill_property_data (FRAME_X_DISPLAY (f), value, data, element_format); 4101 x_fill_property_data (FRAME_X_DISPLAY (f), value, data, element_format);
4093 } 4102 }
@@ -4222,6 +4231,30 @@ no value of TYPE. */)
4222 (unsigned char **) &tmp_data); 4231 (unsigned char **) &tmp_data);
4223 if (rc == Success && tmp_data) 4232 if (rc == Success && tmp_data)
4224 { 4233 {
4234 /* The man page for XGetWindowProperty says:
4235 "If the returned format is 32, the returned data is represented
4236 as a long array and should be cast to that type to obtain the
4237 elements."
4238 This applies even if long is more than 32 bits, the X library
4239 converts from 32 bit elements received from the X server to long
4240 and passes the long array to us. Thus, for that case bcopy can not
4241 be used. We convert to a 32 bit type here, because so much code
4242 assume on that.
4243
4244 The bytes and offsets passed to XGetWindowProperty refers to the
4245 property and those are indeed in 32 bit quantities if format is
4246 32. */
4247
4248 if (actual_format == 32 && actual_format < BITS_PER_LONG)
4249 {
4250 unsigned long i;
4251 int *idata = (int *) tmp_data;
4252 long *ldata = (long *) tmp_data;
4253
4254 for (i = 0; i < actual_size; ++i)
4255 idata[i]= (int) ldata[i];
4256 }
4257
4225 if (NILP (vector_ret_p)) 4258 if (NILP (vector_ret_p))
4226 prop_value = make_string (tmp_data, size); 4259 prop_value = make_string (tmp_data, size);
4227 else 4260 else
@@ -5438,6 +5471,22 @@ usual X keysyms. */)
5438 return Qnil; 5471 return Qnil;
5439 } 5472 }
5440 5473
5474 /* In this code we check that the keyboard has physical keys with names
5475 that start with BKSP (Backspace) and DELE (Delete), and that they
5476 generate keysym XK_BackSpace and XK_Delete respectively.
5477 This function is used to test if normal-erase-is-backspace should be
5478 turned on.
5479 An alternative approach would be to just check if XK_BackSpace and
5480 XK_Delete are mapped to any key. But if any of those are mapped to
5481 some non-intuitive key combination (Meta-Shift-Ctrl-whatever) and the
5482 user doesn't know about it, it is better to return false here.
5483 It is more obvious to the user what to do if she/he has two keys
5484 clearly marked with names/symbols and one key does something not
5485 expected (i.e. she/he then tries the other).
5486 The cases where Backspace/Delete is mapped to some other key combination
5487 are rare, and in those cases, normal-erase-is-backspace can be turned on
5488 manually. */
5489
5441 have_keys = Qnil; 5490 have_keys = Qnil;
5442 kb = XkbGetMap (dpy, XkbAllMapComponentsMask, XkbUseCoreKbd); 5491 kb = XkbGetMap (dpy, XkbAllMapComponentsMask, XkbUseCoreKbd);
5443 if (kb) 5492 if (kb)
diff --git a/src/xselect.c b/src/xselect.c
index f26014746ba..adea1f3c2d6 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
@@ -777,9 +771,17 @@ x_reply_selection_request (event, format, data, size, type)
777 771
778 TRACE1 ("Set %s to number of bytes to send", 772 TRACE1 ("Set %s to number of bytes to send",
779 XGetAtomName (display, reply.property)); 773 XGetAtomName (display, reply.property));
780 XChangeProperty (display, window, reply.property, dpyinfo->Xatom_INCR, 774 {
781 32, PropModeReplace, 775 /* XChangeProperty expects an array of long even if long is more than
782 (unsigned char *) &bytes_remaining, 1); 776 32 bits. */
777 long value[1];
778
779 value[0] = bytes_remaining;
780 XChangeProperty (display, window, reply.property, dpyinfo->Xatom_INCR,
781 32, PropModeReplace,
782 (unsigned char *) value, 1);
783 }
784
783 XSelectInput (display, window, PropertyChangeMask); 785 XSelectInput (display, window, PropertyChangeMask);
784 786
785 /* Tell 'em the INCR data is there... */ 787 /* Tell 'em the INCR data is there... */
@@ -804,9 +806,9 @@ x_reply_selection_request (event, format, data, size, type)
804 TRACE0 ("Got ACK"); 806 TRACE0 ("Got ACK");
805 while (bytes_remaining) 807 while (bytes_remaining)
806 { 808 {
807 int i = ((bytes_remaining < max_bytes) 809 int i = ((bytes_remaining < max_bytes)
808 ? bytes_remaining 810 ? bytes_remaining
809 : max_bytes); 811 : max_bytes);
810 812
811 BLOCK_INPUT; 813 BLOCK_INPUT;
812 814
@@ -1540,9 +1542,38 @@ x_get_window_property (display, window, property, data_ret, bytes_ret,
1540 reading it. Deal with that, I guess.... */ 1542 reading it. Deal with that, I guess.... */
1541 if (result != Success) 1543 if (result != Success)
1542 break; 1544 break;
1543 *actual_size_ret *= *actual_format_ret / 8; 1545
1544 bcopy (tmp_data, (*data_ret) + offset, *actual_size_ret); 1546 /* The man page for XGetWindowProperty says:
1545 offset += *actual_size_ret; 1547 "If the returned format is 32, the returned data is represented
1548 as a long array and should be cast to that type to obtain the
1549 elements."
1550 This applies even if long is more than 32 bits, the X library
1551 converts from 32 bit elements received from the X server to long
1552 and passes the long array to us. Thus, for that case bcopy can not
1553 be used. We convert to a 32 bit type here, because so much code
1554 assume on that.
1555
1556 The bytes and offsets passed to XGetWindowProperty refers to the
1557 property and those are indeed in 32 bit quantities if format is 32. */
1558
1559 if (*actual_format_ret == 32 && *actual_format_ret < BITS_PER_LONG)
1560 {
1561 unsigned long i;
1562 int *idata = (int *) ((*data_ret) + offset);
1563 long *ldata = (long *) tmp_data;
1564
1565 for (i = 0; i < *actual_size_ret; ++i)
1566 {
1567 idata[i]= (int) ldata[i];
1568 offset += 4;
1569 }
1570 }
1571 else
1572 {
1573 *actual_size_ret *= *actual_format_ret / 8;
1574 bcopy (tmp_data, (*data_ret) + offset, *actual_size_ret);
1575 offset += *actual_size_ret;
1576 }
1546 1577
1547 /* This was allocated by Xlib, so use XFree. */ 1578 /* This was allocated by Xlib, so use XFree. */
1548 XFree ((char *) tmp_data); 1579 XFree ((char *) tmp_data);
@@ -1755,7 +1786,11 @@ x_get_window_property_as_lisp_data (display, window, property, target_type,
1755 1786
1756 When converting an object to C, it may be of the form (SYMBOL . <data>) 1787 When converting an object to C, it may be of the form (SYMBOL . <data>)
1757 where SYMBOL is what we should claim that the type is. Format and 1788 where SYMBOL is what we should claim that the type is. Format and
1758 representation are as above. */ 1789 representation are as above.
1790
1791 Important: When format is 32, data should contain an array of int,
1792 not an array of long as the X library returns. This makes a difference
1793 when sizeof(long) != sizeof(int). */
1759 1794
1760 1795
1761 1796
@@ -1797,15 +1832,21 @@ selection_data_to_lisp_data (display, data, size, type, format)
1797 else if (type == XA_ATOM) 1832 else if (type == XA_ATOM)
1798 { 1833 {
1799 int i; 1834 int i;
1800 if (size == sizeof (Atom)) 1835 /* On a 64 bit machine sizeof(Atom) == sizeof(long) == 8.
1801 return x_atom_to_symbol (display, *((Atom *) data)); 1836 But the callers of these function has made sure the data for
1837 format == 32 is an array of int. Thus, use int instead
1838 of Atom. */
1839 int *idata = (int *) data;
1840
1841 if (size == sizeof (int))
1842 return x_atom_to_symbol (display, (Atom) idata[0]);
1802 else 1843 else
1803 { 1844 {
1804 Lisp_Object v = Fmake_vector (make_number (size / sizeof (Atom)), 1845 Lisp_Object v = Fmake_vector (make_number (size / sizeof (int)),
1805 make_number (0)); 1846 make_number (0));
1806 for (i = 0; i < size / sizeof (Atom); i++) 1847 for (i = 0; i < size / sizeof (int); i++)
1807 Faset (v, make_number (i), 1848 Faset (v, make_number (i),
1808 x_atom_to_symbol (display, ((Atom *) data) [i])); 1849 x_atom_to_symbol (display, (Atom) idata[i]));
1809 return v; 1850 return v;
1810 } 1851 }
1811 } 1852 }
@@ -1987,6 +2028,7 @@ lisp_data_to_selection_data (display, obj,
1987 else 2028 else
1988 /* This vector is an INTEGER set, or something like it */ 2029 /* This vector is an INTEGER set, or something like it */
1989 { 2030 {
2031 int data_size = 2;
1990 *size_ret = XVECTOR (obj)->size; 2032 *size_ret = XVECTOR (obj)->size;
1991 if (NILP (type)) type = QINTEGER; 2033 if (NILP (type)) type = QINTEGER;
1992 *format_ret = 16; 2034 *format_ret = 16;
@@ -1999,7 +2041,11 @@ lisp_data_to_selection_data (display, obj,
1999 ("elements of selection vector must be integers or conses of integers"), 2041 ("elements of selection vector must be integers or conses of integers"),
2000 Fcons (obj, Qnil))); 2042 Fcons (obj, Qnil)));
2001 2043
2002 *data_ret = (unsigned char *) xmalloc (*size_ret * (*format_ret/8)); 2044 /* Use sizeof(long) even if it is more than 32 bits. See comment
2045 in x_get_window_property and x_fill_property_data. */
2046
2047 if (*format_ret == 32) data_size = sizeof(long);
2048 *data_ret = (unsigned char *) xmalloc (*size_ret * data_size);
2003 for (i = 0; i < *size_ret; i++) 2049 for (i = 0; i < *size_ret; i++)
2004 if (*format_ret == 32) 2050 if (*format_ret == 32)
2005 (*((unsigned long **) data_ret)) [i] 2051 (*((unsigned long **) data_ret)) [i]
@@ -2501,8 +2547,10 @@ x_check_property_data (data)
2501 DATA is a Lisp list of values to be converted. 2547 DATA is a Lisp list of values to be converted.
2502 RET is the C array that contains the converted values. It is assumed 2548 RET is the C array that contains the converted values. It is assumed
2503 it is big enough to hold all values. 2549 it is big enough to hold all values.
2504 FORMAT is 8, 16 or 32 and gives the size in bits for each C value to 2550 FORMAT is 8, 16 or 32 and denotes char/short/long for each C value to
2505 be stored in RET. */ 2551 be stored in RET. Note that long is used for 32 even if long is more
2552 than 32 bits (see man pages for XChangeProperty, XGetWindowProperty and
2553 XClientMessageEvent). */
2506 2554
2507void 2555void
2508x_fill_property_data (dpy, data, ret, format) 2556x_fill_property_data (dpy, data, ret, format)
@@ -2511,10 +2559,10 @@ x_fill_property_data (dpy, data, ret, format)
2511 void *ret; 2559 void *ret;
2512 int format; 2560 int format;
2513{ 2561{
2514 CARD32 val; 2562 long val;
2515 CARD32 *d32 = (CARD32 *) ret; 2563 long *d32 = (long *) ret;
2516 CARD16 *d16 = (CARD16 *) ret; 2564 short *d16 = (short *) ret;
2517 CARD8 *d08 = (CARD8 *) ret; 2565 char *d08 = (char *) ret;
2518 Lisp_Object iter; 2566 Lisp_Object iter;
2519 2567
2520 for (iter = data; CONSP (iter); iter = XCDR (iter)) 2568 for (iter = data; CONSP (iter); iter = XCDR (iter))
@@ -2522,24 +2570,24 @@ x_fill_property_data (dpy, data, ret, format)
2522 Lisp_Object o = XCAR (iter); 2570 Lisp_Object o = XCAR (iter);
2523 2571
2524 if (INTEGERP (o)) 2572 if (INTEGERP (o))
2525 val = (CARD32) XFASTINT (o); 2573 val = (long) XFASTINT (o);
2526 else if (FLOATP (o)) 2574 else if (FLOATP (o))
2527 val = (CARD32) XFLOAT_DATA (o); 2575 val = (long) XFLOAT_DATA (o);
2528 else if (CONSP (o)) 2576 else if (CONSP (o))
2529 val = (CARD32) cons_to_long (o); 2577 val = (long) cons_to_long (o);
2530 else if (STRINGP (o)) 2578 else if (STRINGP (o))
2531 { 2579 {
2532 BLOCK_INPUT; 2580 BLOCK_INPUT;
2533 val = XInternAtom (dpy, (char *) SDATA (o), False); 2581 val = (long) XInternAtom (dpy, (char *) SDATA (o), False);
2534 UNBLOCK_INPUT; 2582 UNBLOCK_INPUT;
2535 } 2583 }
2536 else 2584 else
2537 error ("Wrong type, must be string, number or cons"); 2585 error ("Wrong type, must be string, number or cons");
2538 2586
2539 if (format == 8) 2587 if (format == 8)
2540 *d08++ = (CARD8) val; 2588 *d08++ = (char) val;
2541 else if (format == 16) 2589 else if (format == 16)
2542 *d16++ = (CARD16) val; 2590 *d16++ = (short) val;
2543 else 2591 else
2544 *d32++ = val; 2592 *d32++ = val;
2545 } 2593 }
@@ -2554,6 +2602,10 @@ x_fill_property_data (dpy, data, ret, format)
2554 be stored in RET. 2602 be stored in RET.
2555 SIZE is the number of elements in DATA. 2603 SIZE is the number of elements in DATA.
2556 2604
2605 Important: When format is 32, data should contain an array of int,
2606 not an array of long as the X library returns. This makes a difference
2607 when sizeof(long) != sizeof(int).
2608
2557 Also see comment for selection_data_to_lisp_data above. */ 2609 Also see comment for selection_data_to_lisp_data above. */
2558 2610
2559Lisp_Object 2611Lisp_Object
@@ -2568,7 +2620,7 @@ x_property_data_to_lisp (f, data, type, format, size)
2568 data, size*format/8, type, format); 2620 data, size*format/8, type, format);
2569} 2621}
2570 2622
2571/* Get the mouse position frame relative coordinates. */ 2623/* Get the mouse position in frame relative coordinates. */
2572 2624
2573static void 2625static void
2574mouse_position_for_drop (f, x, y) 2626mouse_position_for_drop (f, x, y)
@@ -2665,18 +2717,34 @@ x_handle_dnd_message (f, event, dpyinfo, bufp)
2665{ 2717{
2666 Lisp_Object vec; 2718 Lisp_Object vec;
2667 Lisp_Object frame; 2719 Lisp_Object frame;
2668 unsigned long size = (8*sizeof (event->data))/event->format; 2720 /* format 32 => size 5, format 16 => size 10, format 8 => size 20 */
2721 unsigned long size = 160/event->format;
2669 int x, y; 2722 int x, y;
2723 unsigned char *data = (unsigned char *) event->data.b;
2724 int idata[5];
2670 2725
2671 XSETFRAME (frame, f); 2726 XSETFRAME (frame, f);
2672 2727
2728 /* On a 64 bit machine, the event->data.l array members are 64 bits (long),
2729 but the x_property_data_to_lisp (or rather selection_data_to_lisp_data)
2730 function expects them to be of size int (i.e. 32). So to be able to
2731 use that function, put the data in the form it expects if format is 32. */
2732
2733 if (event->format == 32 && event->format < BITS_PER_LONG)
2734 {
2735 int i;
2736 for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */
2737 idata[i] = (int) event->data.l[i];
2738 data = (unsigned char *) idata;
2739 }
2740
2673 vec = Fmake_vector (make_number (4), Qnil); 2741 vec = Fmake_vector (make_number (4), Qnil);
2674 AREF (vec, 0) = SYMBOL_NAME (x_atom_to_symbol (FRAME_X_DISPLAY (f), 2742 AREF (vec, 0) = SYMBOL_NAME (x_atom_to_symbol (FRAME_X_DISPLAY (f),
2675 event->message_type)); 2743 event->message_type));
2676 AREF (vec, 1) = frame; 2744 AREF (vec, 1) = frame;
2677 AREF (vec, 2) = make_number (event->format); 2745 AREF (vec, 2) = make_number (event->format);
2678 AREF (vec, 3) = x_property_data_to_lisp (f, 2746 AREF (vec, 3) = x_property_data_to_lisp (f,
2679 event->data.b, 2747 data,
2680 event->message_type, 2748 event->message_type,
2681 event->format, 2749 event->format,
2682 size); 2750 size);
@@ -2788,6 +2856,7 @@ are ignored. */)
2788 when sending to the root window. */ 2856 when sending to the root window. */
2789 event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest; 2857 event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest;
2790 2858
2859
2791 memset (event.xclient.data.b, 0, sizeof (event.xclient.data.b)); 2860 memset (event.xclient.data.b, 0, sizeof (event.xclient.data.b));
2792 x_fill_property_data (dpyinfo->display, values, event.xclient.data.b, 2861 x_fill_property_data (dpyinfo->display, values, event.xclient.data.b,
2793 event.xclient.format); 2862 event.xclient.format);