aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-05-29 18:12:12 -0700
committerPaul Eggert2011-05-29 18:12:12 -0700
commit90856fe0b82ba19d1c3d73a4ba48007380201e66 (patch)
tree1b41ea9c212d3e7c1da29d03acc155a177db6c7c /src
parent55d4c1b248e84d347ae73278faff623741f52691 (diff)
parentca3cf0a561302e2a94eb0ab24063e29580a97fe1 (diff)
downloademacs-90856fe0b82ba19d1c3d73a4ba48007380201e66.tar.gz
emacs-90856fe0b82ba19d1c3d73a4ba48007380201e66.zip
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog28
-rw-r--r--src/coding.c4
-rw-r--r--src/emacs.c9
-rw-r--r--src/font.c61
-rw-r--r--src/font.h72
-rw-r--r--src/frame.c9
-rw-r--r--src/image.c94
-rw-r--r--src/xselect.c91
-rw-r--r--src/xterm.h2
9 files changed, 201 insertions, 169 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f31e68e9b7b..bada9f108f7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,4 @@
12011-05-28 Paul Eggert <eggert@cs.ucla.edu> 12011-05-30 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Use 'inline', not 'INLINE'. 3 Use 'inline', not 'INLINE'.
4 * alloc.c, fontset.c (INLINE): Remove. 4 * alloc.c, fontset.c (INLINE): Remove.
@@ -8,6 +8,32 @@
8 * gmalloc.c (register_heapinfo): Use inline unconditionally. 8 * gmalloc.c (register_heapinfo): Use inline unconditionally.
9 * lisp.h (LISP_MAKE_RVALUE): Use inline, not __inline__. 9 * lisp.h (LISP_MAKE_RVALUE): Use inline, not __inline__.
10 10
112011-05-29 Chong Yidong <cyd@stupidchicken.com>
12
13 * image.c: Various fixes to ImageMagick code comments.
14 (Fimagemagick_types): Doc fix.
15
162011-05-29 Paul Eggert <eggert@cs.ucla.edu>
17
18 Minor fixes prompted by GCC 4.6.0 warnings.
19
20 * xselect.c (converted_selections, conversion_fail_tag): Now static.
21
22 * emacs.c [HAVE_X_WINDOWS]: Include "xterm.h".
23 (x_clipboard_manager_save_all): Move extern decl to ...
24 * xterm.h: ... here, so that it can be checked for consistency.
25
262011-05-29 Chong Yidong <cyd@stupidchicken.com>
27
28 * xselect.c (x_clipboard_manager_save_frame)
29 (x_clipboard_manager_save_all): New functions.
30 (Fx_clipboard_manager_save): Lisp function deleted.
31
32 * emacs.c (Fkill_emacs): Call x_clipboard_manager_save_all.
33 * frame.c (delete_frame): Call x_clipboard_manager_save_frame.
34
35 * xterm.h: Update prototype.
36
112011-05-28 William Xu <william.xwl@gmail.com> 372011-05-28 William Xu <william.xwl@gmail.com>
12 38
13 * nsterm.m (ns_term_shutdown): Synchronize user defaults before 39 * nsterm.m (ns_term_shutdown): Synchronize user defaults before
diff --git a/src/coding.c b/src/coding.c
index e257790bbef..6ccaf354c74 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -55,8 +55,8 @@ CODING SYSTEM
55 character sequence of emacs-utf-8 to a byte sequence of a specific 55 character sequence of emacs-utf-8 to a byte sequence of a specific
56 coding system. 56 coding system.
57 57
58 In Emacs Lisp, a coding system is represented by a Lisp symbol. In 58 In Emacs Lisp, a coding system is represented by a Lisp symbol. On
59 C level, a coding system is represented by a vector of attributes 59 the C level, a coding system is represented by a vector of attributes
60 stored in the hash table Vcharset_hash_table. The conversion from 60 stored in the hash table Vcharset_hash_table. The conversion from
61 coding system symbol to attributes vector is done by looking up 61 coding system symbol to attributes vector is done by looking up
62 Vcharset_hash_table by the symbol. 62 Vcharset_hash_table by the symbol.
diff --git a/src/emacs.c b/src/emacs.c
index 8c4490b0a52..cf74963a816 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -65,6 +65,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
65#include "nsterm.h" 65#include "nsterm.h"
66#endif 66#endif
67 67
68#ifdef HAVE_X_WINDOWS
69#include "xterm.h"
70#endif
71
68#ifdef HAVE_SETLOCALE 72#ifdef HAVE_SETLOCALE
69#include <locale.h> 73#include <locale.h>
70#endif 74#endif
@@ -1985,6 +1989,11 @@ all of which are called before Emacs is actually killed. */)
1985 1989
1986 UNGCPRO; 1990 UNGCPRO;
1987 1991
1992#ifdef HAVE_X_WINDOWS
1993 /* Transfer any clipboards we own to the clipboard manager. */
1994 x_clipboard_manager_save_all ();
1995#endif
1996
1988 shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil); 1997 shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil);
1989 1998
1990 /* If we have an auto-save list file, 1999 /* If we have an auto-save list file,
diff --git a/src/font.c b/src/font.c
index edbdc958539..398198324a4 100644
--- a/src/font.c
+++ b/src/font.c
@@ -136,7 +136,7 @@ Lisp_Object Qja, Qko;
136 136
137static Lisp_Object QCuser_spec; 137static Lisp_Object QCuser_spec;
138 138
139/* Alist of font registry symbol and the corresponding charsets 139/* Alist of font registry symbols and the corresponding charset
140 information. The information is retrieved from 140 information. The information is retrieved from
141 Vfont_encoding_alist on demand. 141 Vfont_encoding_alist on demand.
142 142
@@ -226,9 +226,9 @@ static int num_font_drivers;
226 226
227 227
228/* Return a Lispy value of a font property value at STR and LEN bytes. 228/* Return a Lispy value of a font property value at STR and LEN bytes.
229 If STR is "*", it returns nil. 229 If STR is "*", return nil.
230 If FORCE_SYMBOL is zero and all characters in STR are digits, it 230 If FORCE_SYMBOL is zero and all characters in STR are digits,
231 returns an integer. Otherwise, it returns a symbol interned from 231 return an integer. Otherwise, return a symbol interned from
232 STR. */ 232 STR. */
233 233
234Lisp_Object 234Lisp_Object
@@ -251,7 +251,7 @@ font_intern_prop (const char *str, int len, int force_symbol)
251 } 251 }
252 252
253 /* The following code is copied from the function intern (in 253 /* The following code is copied from the function intern (in
254 lread.c), and modified to suite our purpose. */ 254 lread.c), and modified to suit our purpose. */
255 obarray = Vobarray; 255 obarray = Vobarray;
256 if (!VECTORP (obarray) || ASIZE (obarray) == 0) 256 if (!VECTORP (obarray) || ASIZE (obarray) == 0)
257 obarray = check_obarray (obarray); 257 obarray = check_obarray (obarray);
@@ -305,7 +305,7 @@ font_pixel_size (FRAME_PTR f, Lisp_Object spec)
305 font vector. If VAL is not valid (i.e. not registered in 305 font vector. If VAL is not valid (i.e. not registered in
306 font_style_table), return -1 if NOERROR is zero, and return a 306 font_style_table), return -1 if NOERROR is zero, and return a
307 proper index if NOERROR is nonzero. In that case, register VAL in 307 proper index if NOERROR is nonzero. In that case, register VAL in
308 font_style_table if VAL is a symbol, and return a closest index if 308 font_style_table if VAL is a symbol, and return the closest index if
309 VAL is an integer. */ 309 VAL is an integer. */
310 310
311int 311int
@@ -473,7 +473,7 @@ font_registry_charsets (Lisp_Object registry, struct charset **encoding, struct
473} 473}
474 474
475 475
476/* Font property value validaters. See the comment of 476/* Font property value validators. See the comment of
477 font_property_table for the meaning of the arguments. */ 477 font_property_table for the meaning of the arguments. */
478 478
479static Lisp_Object font_prop_validate (int, Lisp_Object, Lisp_Object); 479static Lisp_Object font_prop_validate (int, Lisp_Object, Lisp_Object);
@@ -591,7 +591,7 @@ font_prop_validate_otf (Lisp_Object prop, Lisp_Object val)
591 return val; 591 return val;
592} 592}
593 593
594/* Structure of known font property keys and validater of the 594/* Structure of known font property keys and validator of the
595 values. */ 595 values. */
596static const struct 596static const struct
597{ 597{
@@ -742,7 +742,7 @@ enum xlfd_field_mask
742}; 742};
743 743
744 744
745/* Parse P pointing the pixel/point size field of the form 745/* Parse P pointing to the pixel/point size field of the form
746 `[A B C D]' which specifies a transformation matrix: 746 `[A B C D]' which specifies a transformation matrix:
747 747
748 A B 0 748 A B 0
@@ -775,7 +775,7 @@ parse_matrix (const char *p)
775} 775}
776 776
777/* Expand a wildcard field in FIELD (the first N fields are filled) to 777/* Expand a wildcard field in FIELD (the first N fields are filled) to
778 multiple fields to fill in all 14 XLFD fields while restring a 778 multiple fields to fill in all 14 XLFD fields while restricting a
779 field position by its contents. */ 779 field position by its contents. */
780 780
781static int 781static int
@@ -2054,14 +2054,14 @@ font_rescale_ratio (Lisp_Object font_entity)
2054 font-spec. The score value is 32 bit (`unsigned'), and the smaller 2054 font-spec. The score value is 32 bit (`unsigned'), and the smaller
2055 the value is, the closer the font is to the font-spec. 2055 the value is, the closer the font is to the font-spec.
2056 2056
2057 The lowest 2 bits of the score is used for driver type. The font 2057 The lowest 2 bits of the score are used for driver type. The font
2058 available by the most preferred font driver is 0. 2058 available by the most preferred font driver is 0.
2059 2059
2060 Each 7-bit in the higher 28 bits are used for numeric properties 2060 The 4 7-bit fields in the higher 28 bits are used for numeric properties
2061 WEIGHT, SLANT, WIDTH, and SIZE. */ 2061 WEIGHT, SLANT, WIDTH, and SIZE. */
2062 2062
2063/* How many bits to shift to store the difference value of each font 2063/* How many bits to shift to store the difference value of each font
2064 property in a score. Note that flots for FONT_TYPE_INDEX and 2064 property in a score. Note that floats for FONT_TYPE_INDEX and
2065 FONT_REGISTRY_INDEX are not used. */ 2065 FONT_REGISTRY_INDEX are not used. */
2066static int sort_shift_bits[FONT_SIZE_INDEX + 1]; 2066static int sort_shift_bits[FONT_SIZE_INDEX + 1];
2067 2067
@@ -2598,7 +2598,7 @@ font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver)
2598static Lisp_Object scratch_font_spec, scratch_font_prefer; 2598static Lisp_Object scratch_font_spec, scratch_font_prefer;
2599 2599
2600/* Check each font-entity in VEC, and return a list of font-entities 2600/* Check each font-entity in VEC, and return a list of font-entities
2601 that satisfy this condition: 2601 that satisfy these conditions:
2602 (1) matches with SPEC and SIZE if SPEC is not nil, and 2602 (1) matches with SPEC and SIZE if SPEC is not nil, and
2603 (2) doesn't match with any regexps in Vface_ignored_fonts (if non-nil). 2603 (2) doesn't match with any regexps in Vface_ignored_fonts (if non-nil).
2604*/ 2604*/
@@ -3018,8 +3018,8 @@ font_clear_prop (Lisp_Object *attrs, enum font_property_index prop)
3018 attrs[LFACE_FONT_INDEX] = font; 3018 attrs[LFACE_FONT_INDEX] = font;
3019} 3019}
3020 3020
3021/* Selecte a font from ENTITIES (list of font-entity vectors) that 3021/* Select a font from ENTITIES (list of font-entity vectors) that
3022 supports C and matches best with ATTRS and PIXEL_SIZE. */ 3022 supports C and is the best match for ATTRS and PIXEL_SIZE. */
3023 3023
3024static Lisp_Object 3024static Lisp_Object
3025font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs, int pixel_size, int c) 3025font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs, int pixel_size, int c)
@@ -3062,8 +3062,8 @@ font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs,
3062 return font_sort_entities (entities, prefer, frame, c); 3062 return font_sort_entities (entities, prefer, frame, c);
3063} 3063}
3064 3064
3065/* Return a font-entity satisfying SPEC and best matching with face's 3065/* Return a font-entity that satisfies SPEC and is the best match for
3066 font related attributes in ATTRS. C, if not negative, is a 3066 face's font related attributes in ATTRS. C, if not negative, is a
3067 character that the entity must support. */ 3067 character that the entity must support. */
3068 3068
3069Lisp_Object 3069Lisp_Object
@@ -3254,8 +3254,8 @@ font_open_for_lface (FRAME_PTR f, Lisp_Object entity, Lisp_Object *attrs, Lisp_O
3254} 3254}
3255 3255
3256 3256
3257/* Find a font satisfying SPEC and best matching with face's 3257/* Find a font that satisfies SPEC and is the best match for
3258 attributes in ATTRS on FRAME, and return the opened 3258 face's attributes in ATTRS on FRAME, and return the opened
3259 font-object. */ 3259 font-object. */
3260 3260
3261Lisp_Object 3261Lisp_Object
@@ -3267,8 +3267,7 @@ font_load_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
3267 if (NILP (entity)) 3267 if (NILP (entity))
3268 { 3268 {
3269 /* No font is listed for SPEC, but each font-backend may have 3269 /* No font is listed for SPEC, but each font-backend may have
3270 the different criteria about "font matching". So, try 3270 different criteria about "font matching". So, try it. */
3271 it. */
3272 entity = font_matching_entity (f, attrs, spec); 3271 entity = font_matching_entity (f, attrs, spec);
3273 if (NILP (entity)) 3272 if (NILP (entity))
3274 return Qnil; 3273 return Qnil;
@@ -3307,7 +3306,7 @@ font_done_for_face (FRAME_PTR f, struct face *face)
3307} 3306}
3308 3307
3309 3308
3310/* Open a font matching with font-spec SPEC on frame F. If no proper 3309/* Open a font that is a match for font-spec SPEC on frame F. If no proper
3311 font is found, return Qnil. */ 3310 font is found, return Qnil. */
3312 3311
3313Lisp_Object 3312Lisp_Object
@@ -3331,7 +3330,7 @@ font_open_by_spec (FRAME_PTR f, Lisp_Object spec)
3331} 3330}
3332 3331
3333 3332
3334/* Open a font matching with NAME on frame F. If no proper font is 3333/* Open a font that matches NAME on frame F. If no proper font is
3335 found, return Qnil. */ 3334 found, return Qnil. */
3336 3335
3337Lisp_Object 3336Lisp_Object
@@ -3355,7 +3354,7 @@ font_open_by_name (FRAME_PTR f, const char *name)
3355/* Register font-driver DRIVER. This function is used in two ways. 3354/* Register font-driver DRIVER. This function is used in two ways.
3356 3355
3357 The first is with frame F non-NULL. In this case, make DRIVER 3356 The first is with frame F non-NULL. In this case, make DRIVER
3358 available (but not yet activated) on F. All frame creaters 3357 available (but not yet activated) on F. All frame creators
3359 (e.g. Fx_create_frame) must call this function at least once with 3358 (e.g. Fx_create_frame) must call this function at least once with
3360 an available font-driver. 3359 an available font-driver.
3361 3360
@@ -3682,7 +3681,7 @@ font_at (int c, EMACS_INT pos, struct face *face, struct window *w,
3682#ifdef HAVE_WINDOW_SYSTEM 3681#ifdef HAVE_WINDOW_SYSTEM
3683 3682
3684/* Check how many characters after POS (at most to *LIMIT) can be 3683/* Check how many characters after POS (at most to *LIMIT) can be
3685 displayed by the same font on the window W. FACE, if non-NULL, is 3684 displayed by the same font in the window W. FACE, if non-NULL, is
3686 the face selected for the character at POS. If STRING is not nil, 3685 the face selected for the character at POS. If STRING is not nil,
3687 it is the string to check instead of the current buffer. In that 3686 it is the string to check instead of the current buffer. In that
3688 case, FACE must be not NULL. 3687 case, FACE must be not NULL.
@@ -3826,7 +3825,7 @@ GSUB and GPOS may contain `nil' element. In such a case, the font
3826must not have any of the remaining elements. 3825must not have any of the remaining elements.
3827 3826
3828For instance, if the VALUE is `(thai nil nil (mark))', the font must 3827For instance, if the VALUE is `(thai nil nil (mark))', the font must
3829be an OpenType font, and whose GPOS table of `thai' script's default 3828be an OpenType font whose GPOS table of `thai' script's default
3830language system must contain `mark' feature. 3829language system must contain `mark' feature.
3831 3830
3832usage: (font-spec ARGS...) */) 3831usage: (font-spec ARGS...) */)
@@ -4189,7 +4188,7 @@ DEFUN ("font-xlfd-name", Ffont_xlfd_name, Sfont_xlfd_name, 1, 2, 0,
4189FONT is a font-spec, font-entity, or font-object. 4188FONT is a font-spec, font-entity, or font-object.
4190If the name is too long for XLFD (maximum 255 chars), return nil. 4189If the name is too long for XLFD (maximum 255 chars), return nil.
4191If the 2nd optional arg FOLD-WILDCARDS is non-nil, 4190If the 2nd optional arg FOLD-WILDCARDS is non-nil,
4192the consecutive wildcards are folded to one. */) 4191the consecutive wildcards are folded into one. */)
4193 (Lisp_Object font, Lisp_Object fold_wildcards) 4192 (Lisp_Object font, Lisp_Object fold_wildcards)
4194{ 4193{
4195 char name[256]; 4194 char name[256];
@@ -4436,7 +4435,7 @@ the value is 0.
4436If GSTRING-OUT is too short to hold produced glyphs, no glyphs are 4435If GSTRING-OUT is too short to hold produced glyphs, no glyphs are
4437produced in GSTRING-OUT, and the value is nil. 4436produced in GSTRING-OUT, and the value is nil.
4438 4437
4439See the documentation of `font-make-gstring' for the format of 4438See the documentation of `composition-get-gstring' for the format of
4440glyph-string. */) 4439glyph-string. */)
4441 (Lisp_Object otf_features, Lisp_Object gstring_in, Lisp_Object from, Lisp_Object to, Lisp_Object gstring_out, Lisp_Object index) 4440 (Lisp_Object otf_features, Lisp_Object gstring_in, Lisp_Object from, Lisp_Object to, Lisp_Object gstring_out, Lisp_Object index)
4442{ 4441{
@@ -4571,10 +4570,10 @@ The value is a vector:
4571 [ NAME FILENAME PIXEL-SIZE SIZE ASCENT DESCENT SPACE-WIDTH AVERAGE-WIDTH 4570 [ NAME FILENAME PIXEL-SIZE SIZE ASCENT DESCENT SPACE-WIDTH AVERAGE-WIDTH
4572 CAPABILITY ] 4571 CAPABILITY ]
4573 4572
4574NAME is a string of the font name (or nil if the font backend doesn't 4573NAME is the font name, a string (or nil if the font backend doesn't
4575provide a name). 4574provide a name).
4576 4575
4577FILENAME is a string of the font file (or nil if the font backend 4576FILENAME is the font file name, a string (or nil if the font backend
4578doesn't provide a file name). 4577doesn't provide a file name).
4579 4578
4580PIXEL-SIZE is a pixel size by which the font is opened. 4579PIXEL-SIZE is a pixel size by which the font is opened.
diff --git a/src/font.h b/src/font.h
index 4b3ceed1dd3..0ca9e8baec4 100644
--- a/src/font.h
+++ b/src/font.h
@@ -36,22 +36,22 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
36 36
37 FONT-ENTITY 37 FONT-ENTITY
38 38
39 Pseudo vector (length FONT_ENTITY_MAX) of fully instanciated 39 Pseudo vector (length FONT_ENTITY_MAX) of fully instantiated
40 font properties that a font-driver returns upon a request of 40 font properties that a font-driver returns upon a request of
41 FONT-SPEC. 41 FONT-SPEC.
42 42
43 Note: Only the method `list' and `match' of a font-driver can 43 Note: Only the method `list' and `match' of a font-driver can
44 create this object, and should never be modified by Lisp. 44 create this object, and it should never be modified by Lisp.
45 45
46 FONT-OBJECT 46 FONT-OBJECT
47 47
48 Pseudo vector (length FONT_OBJECT_MAX) of a opend font. 48 Pseudo vector (length FONT_OBJECT_MAX) of an opened font.
49 49
50 Lisp object encapsulating "struct font". This corresponds to 50 Lisp object encapsulating "struct font". This corresponds to
51 an opened font. 51 an opened font.
52 52
53 Note: Only the method `open' of a font-driver can create this 53 Note: Only the method `open' of a font-driver can create this
54 object, and should never be modified by Lisp. */ 54 object, and it should never be modified by Lisp. */
55 55
56extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; 56extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
57 57
@@ -68,7 +68,7 @@ struct glyph_string;
68enum font_property_index 68enum font_property_index
69 { 69 {
70 /* FONT-TYPE is a symbol indicating a font backend; currently `x', 70 /* FONT-TYPE is a symbol indicating a font backend; currently `x',
71 `xft', `ftx' are available on X, `uniscribe' and `gdi' on 71 `xft', and `ftx' are available on X, `uniscribe' and `gdi' on
72 Windows, and `ns' under Cocoa / GNUstep. */ 72 Windows, and `ns' under Cocoa / GNUstep. */
73 FONT_TYPE_INDEX, 73 FONT_TYPE_INDEX,
74 74
@@ -86,26 +86,26 @@ enum font_property_index
86 FONT_REGISTRY_INDEX, 86 FONT_REGISTRY_INDEX,
87 87
88 /* FONT-WEIGHT is a numeric value of weight (e.g. medium, bold) of 88 /* FONT-WEIGHT is a numeric value of weight (e.g. medium, bold) of
89 the font. The lowest 8-bit is an index determining the 89 the font. The lowest 8 bits is an index determining the
90 symbolic name, and the higher bits is the actual numeric value 90 symbolic name, and the higher bits is the actual numeric value
91 defined in `font-weight-table'. */ 91 defined in `font-weight-table'. */
92 FONT_WEIGHT_INDEX, 92 FONT_WEIGHT_INDEX,
93 93
94 /* FONT-SLANT is a numeric value of slant (e.g. r, i, o) of the 94 /* FONT-SLANT is a numeric value of slant (e.g. r, i, o) of the
95 font. The lowest 8-bit is an index determining the symbolic 95 font. The lowest 8 bits is an index determining the symbolic
96 name, and the higher bits is the actual numeric value defined 96 name, and the higher bits is the actual numeric value defined
97 in `font-slant-table'. */ 97 in `font-slant-table'. */
98 FONT_SLANT_INDEX, 98 FONT_SLANT_INDEX,
99 99
100 /* FONT-WIDTH is a numeric value of setwidth (e.g. normal) of the 100 /* FONT-WIDTH is a numeric value of setwidth (e.g. normal) of the
101 font. The lowest 8-bit is an index determining the symbolic 101 font. The lowest 8 bits is an index determining the symbolic
102 name, and the higher bits is the actual numeric value defined 102 name, and the higher bits is the actual numeric value defined
103 `font-width-table'. */ 103 `font-width-table'. */
104 FONT_WIDTH_INDEX, 104 FONT_WIDTH_INDEX,
105 105
106 /* FONT-SIZE is a size of the font. If integer, it is a pixel 106 /* FONT-SIZE is a size of the font. If integer, it is a pixel
107 size. For a font-spec, the value can be float specifying a 107 size. For a font-spec, the value can be a float specifying
108 point size. The value zero means that the font is 108 the point size. The value zero means that the font is
109 scalable. */ 109 scalable. */
110 FONT_SIZE_INDEX, 110 FONT_SIZE_INDEX,
111 111
@@ -129,18 +129,18 @@ enum font_property_index
129 129
130 /* FONT-STYLE is a 24-bit integer containing indices for 130 /* FONT-STYLE is a 24-bit integer containing indices for
131 style-related properties WEIGHT, SLANT, and WIDTH. The lowest 131 style-related properties WEIGHT, SLANT, and WIDTH. The lowest
132 8-bit is an indice to the weight table AREF (font_style_table, 132 8 bits is an index to the weight table AREF (font_style_table,
133 0), the next 8-bit is an indice to the slant table AREF 133 0), the next 8 bits is an index to the slant table AREF
134 (font_style_table, 1), the highest 8-bit is an indice to the 134 (font_style_table, 1), the highest 8 bits is an index to the
135 slant table AREF (font_style_table, 2). The indice 0 indicates 135 slant table AREF (font_style_table, 2). The index 0 indicates
136 that the corresponding style is not specified. This way, we 136 that the corresponding style is not specified. This way, we
137 can represent at most 255 different names for each style, which 137 can represent at most 255 different names for each style, which
138 is surely sufficient. */ 138 is surely sufficient. */
139 FONT_STYLE_INDEX, 139 FONT_STYLE_INDEX,
140 140
141 /* FONT-METRICS is a 27-bit integer containing metrics-related 141 /* FONT-METRICS is a 27-bit integer containing metrics-related
142 properties DPI, AVGWIDTH, SPACING. The lowest 12-bit is for 142 properties DPI, AVGWIDTH, SPACING. The lowest 12 bits is for
143 DPI, the next 12-bit is for AVGWIDTH, the highest 3-bit is for 143 DPI, the next 12 bits is for AVGWIDTH, the highest 3 bits is for
144 SPACING. In each bit field, the highest bit indicates that the 144 SPACING. In each bit field, the highest bit indicates that the
145 corresponding value is set or not. This way, we can represent 145 corresponding value is set or not. This way, we can represent
146 DPI by 11-bit (0 to 2047), AVGWIDTH by 11-bit (0 to 2047), 146 DPI by 11-bit (0 to 2047), AVGWIDTH by 11-bit (0 to 2047),
@@ -176,7 +176,7 @@ enum font_property_index
176 FONT_NAME_INDEX = FONT_ENTITY_MAX, 176 FONT_NAME_INDEX = FONT_ENTITY_MAX,
177 177
178 /* Full name of the font (string). It is the name extracted from 178 /* Full name of the font (string). It is the name extracted from
179 the opend font, and may be different from the above. It may be 179 the opened font, and may be different from the above. It may be
180 nil if the opened font doesn't give a name. */ 180 nil if the opened font doesn't give a name. */
181 FONT_FULLNAME_INDEX, 181 FONT_FULLNAME_INDEX,
182 182
@@ -300,7 +300,7 @@ struct font
300 int space_width; 300 int space_width;
301 301
302 /* Average width of glyphs in the font. If the font itself doesn't 302 /* Average width of glyphs in the font. If the font itself doesn't
303 have that information but has glyphs of ASCII character, the 303 have that information but has glyphs of ASCII characters, the
304 value is the average with of those glyphs. Otherwise, the value 304 value is the average with of those glyphs. Otherwise, the value
305 is 0. */ 305 is 0. */
306 int average_width; 306 int average_width;
@@ -321,7 +321,7 @@ struct font
321 int underline_position; 321 int underline_position;
322 322
323 /* 1 if `vertical-centering-font-regexp' matches this font name. 323 /* 1 if `vertical-centering-font-regexp' matches this font name.
324 In this case, we render characters at vartical center positions 324 In this case, we render characters at vertical center positions
325 of lines. */ 325 of lines. */
326 int vertical_centering; 326 int vertical_centering;
327 327
@@ -335,27 +335,27 @@ struct font
335 unsigned char encoding_type; 335 unsigned char encoding_type;
336 336
337 /* The baseline position of a font is normally `ascent' value of the 337 /* The baseline position of a font is normally `ascent' value of the
338 font. However, there exists many fonts which don't set `ascent' 338 font. However, there exist many fonts which don't set `ascent' to
339 an appropriate value to be used as baseline position. This is 339 an appropriate value to be used as baseline position. This is
340 typical in such ASCII fonts which are designed to be used with 340 typical in such ASCII fonts which are designed to be used with
341 Chinese, Japanese, Korean characters. When we use mixture of 341 Chinese, Japanese, Korean characters. When we use mixture of
342 such fonts and normal fonts (having correct `ascent' value), a 342 such fonts and normal fonts (having correct `ascent' value), a
343 display line gets very ugly. Since we have no way to fix it 343 display line gets very ugly. Since we have no way to fix it
344 automatically, it is users responsibility to supply well designed 344 automatically, it is user's responsibility to supply well designed
345 fonts or correct `ascent' value of fonts. But, the latter 345 fonts or correct `ascent' value of fonts. But, the latter
346 requires heavy work (modifying all bitmap data in BDF files). 346 requires heavy work (modifying all bitmap data in BDF files).
347 So, Emacs accepts a private font property 347 So, Emacs accepts a private font property
348 `_MULE_BASELINE_OFFSET'. If a font has this property, we 348 `_MULE_BASELINE_OFFSET'. If a font has this property, we
349 calculate the baseline position by subtracting the value from 349 calculate the baseline position by subtracting the value from
350 `ascent'. In other words, the value indicates how many bits 350 `ascent'. In other words, the value indicates how many pixels
351 higher we should draw a character of the font than normal ASCII 351 higher than normal ASCII text we should draw a character of the
352 text for a better looking. 352 font for better appearance.
353 353
354 We also have to consider the fact that the concept of `baseline' 354 We also have to consider the fact that the concept of `baseline'
355 differs among scripts to which each character belongs. For 355 differs among scripts to which each character belongs. For
356 instance, baseline should be at the bottom most position of all 356 instance, baseline should be at the bottom-most position of all
357 glyphs for Chinese, Japanese, and Korean. But, many of existing 357 glyphs for Chinese, Japanese, and Korean. But, many of existing
358 fonts for those characters doesn't have correct `ascent' values 358 fonts for those characters don't have correct `ascent' values
359 because they are designed to be used with ASCII fonts. To 359 because they are designed to be used with ASCII fonts. To
360 display characters of different language on the same line, the 360 display characters of different language on the same line, the
361 best way will be to arrange them in the middle of the line. So, 361 best way will be to arrange them in the middle of the line. So,
@@ -365,20 +365,20 @@ struct font
365 of a line. */ 365 of a line. */
366 int baseline_offset; 366 int baseline_offset;
367 367
368 /* Non zero means a character should be composed at a position 368 /* Non-zero means a character should be composed at a position
369 relative to the height (or depth) of previous glyphs in the 369 relative to the height (or depth) of previous glyphs in the
370 following cases: 370 following cases:
371 (1) The bottom of the character is higher than this value. In 371 (1) The bottom of the character is higher than this value. In
372 this case, the character is drawn above the previous glyphs. 372 this case, the character is drawn above the previous glyphs.
373 (2) The top of the character is lower than 0 (i.e. baseline 373 (2) The top of the character is lower than 0 (i.e. baseline
374 height). In this case, the character is drawn beneath the 374 height). In this case, the character is drawn below the
375 previous glyphs. 375 previous glyphs.
376 376
377 This value is taken from a private font property 377 This value is taken from a private font property
378 `_MULE_RELATIVE_COMPOSE' which is introduced by Emacs. */ 378 `_MULE_RELATIVE_COMPOSE' which is introduced by Emacs. */
379 int relative_compose; 379 int relative_compose;
380 380
381 /* Non zero means an ascent value to be used for a character 381 /* Non-zero means an ascent value to be used for a character
382 registered in char-table `use-default-ascent'. */ 382 registered in char-table `use-default-ascent'. */
383 int default_ascent; 383 int default_ascent;
384 384
@@ -398,8 +398,8 @@ struct font
398 determine it. */ 398 determine it. */
399 int repertory_charset; 399 int repertory_charset;
400 400
401 /* There will be more to this structure, but they are private to a 401 /* There are more members in this structure, but they are private
402 font-driver. */ 402 to the font-driver. */
403}; 403};
404 404
405enum font_spacing 405enum font_spacing
@@ -484,8 +484,8 @@ struct font_bitmap
484#define POINT_TO_PIXEL(POINT, DPI) ((POINT) * (DPI) / PT_PER_INCH + 0.5) 484#define POINT_TO_PIXEL(POINT, DPI) ((POINT) * (DPI) / PT_PER_INCH + 0.5)
485 485
486/* Return a point size corresponding to POINT size (integer) 486/* Return a point size corresponding to POINT size (integer)
487 on resolution DPI. Note that though point size is a double, we expect 487 on resolution DPI. Note that though point size is a double, we expect
488 it to be rounded to an int, so we add 0.5 here. If the desired value 488 it to be rounded to an int, so we add 0.5 here. If the desired value
489 is tenths of points (as in xfld specs), then the pixel size should 489 is tenths of points (as in xfld specs), then the pixel size should
490 be multiplied BEFORE the conversion to avoid magnifying the error. */ 490 be multiplied BEFORE the conversion to avoid magnifying the error. */
491#define PIXEL_TO_POINT(PIXEL, DPI) ((PIXEL) * PT_PER_INCH / (DPI) + 0.5) 491#define PIXEL_TO_POINT(PIXEL, DPI) ((PIXEL) * PT_PER_INCH / (DPI) + 0.5)
@@ -582,7 +582,7 @@ struct font_driver
582 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ 582 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */
583 unsigned (*encode_char) (struct font *font, int c); 583 unsigned (*encode_char) (struct font *font, int c);
584 584
585 /* Computate the total metrics of the NGLYPHS glyphs specified by 585 /* Compute the total metrics of the NGLYPHS glyphs specified by
586 the font FONT and the sequence of glyph codes CODE, and store the 586 the font FONT and the sequence of glyph codes CODE, and store the
587 result in METRICS. */ 587 result in METRICS. */
588 int (*text_extents) (struct font *font, 588 int (*text_extents) (struct font *font,
@@ -635,7 +635,7 @@ struct font_driver
635 635
636 FEATURES specifies which OTF features to apply in this format: 636 FEATURES specifies which OTF features to apply in this format:
637 (SCRIPT LANGSYS GSUB-FEATURE GPOS-FEATURE) 637 (SCRIPT LANGSYS GSUB-FEATURE GPOS-FEATURE)
638 See the documentation of `font-drive-otf' for the detail. 638 See the documentation of `font-drive-otf' for the details.
639 639
640 This method applies the specified features to the codes in the 640 This method applies the specified features to the codes in the
641 elements of GSTRING-IN (between FROMth and TOth). The output 641 elements of GSTRING-IN (between FROMth and TOth). The output
@@ -710,7 +710,7 @@ struct font_driver
710 710
711struct font_driver_list 711struct font_driver_list
712{ 712{
713 /* 1 iff this driver is currently used. It is igonred in the global 713 /* 1 iff this driver is currently used. It is ignored in the global
714 font driver list.*/ 714 font driver list.*/
715 int on; 715 int on;
716 /* Pointer to the font driver. */ 716 /* Pointer to the font driver. */
diff --git a/src/frame.c b/src/frame.c
index ce92a83b86c..74e222f85fc 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1347,7 +1347,14 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1347 = Fcons (list3 (Qrun_hook_with_args, Qdelete_frame_functions, frame), 1347 = Fcons (list3 (Qrun_hook_with_args, Qdelete_frame_functions, frame),
1348 pending_funcalls); 1348 pending_funcalls);
1349 else 1349 else
1350 safe_call2 (Qrun_hook_with_args, Qdelete_frame_functions, frame); 1350 {
1351#ifdef HAVE_X_WINDOWS
1352 /* Also, save clipboard to the the clipboard manager. */
1353 x_clipboard_manager_save_frame (frame);
1354#endif
1355
1356 safe_call2 (Qrun_hook_with_args, Qdelete_frame_functions, frame);
1357 }
1351 1358
1352 /* The hook may sometimes (indirectly) cause the frame to be deleted. */ 1359 /* The hook may sometimes (indirectly) cause the frame to be deleted. */
1353 if (! FRAME_LIVE_P (f)) 1360 if (! FRAME_LIVE_P (f))
diff --git a/src/image.c b/src/image.c
index d3702a180c6..0f269f46492 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7352,6 +7352,10 @@ gif_load (struct frame *f, struct image *img)
7352 7352
7353Lisp_Object Qimagemagick; 7353Lisp_Object Qimagemagick;
7354 7354
7355static int imagemagick_image_p (Lisp_Object);
7356static int imagemagick_load (struct frame *, struct image *);
7357static void imagemagick_clear_image (struct frame *, struct image *);
7358
7355/* Indices of image specification fields in imagemagick_format. */ 7359/* Indices of image specification fields in imagemagick_format. */
7356 7360
7357enum imagemagick_keyword_index 7361enum imagemagick_keyword_index
@@ -7394,6 +7398,18 @@ static struct image_keyword imagemagick_format[IMAGEMAGICK_LAST] =
7394 {":crop", IMAGE_DONT_CHECK_VALUE_TYPE, 0} 7398 {":crop", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
7395 }; 7399 };
7396 7400
7401/* Structure describing the image type for any image handled via
7402 ImageMagick. */
7403
7404static struct image_type imagemagick_type =
7405 {
7406 &Qimagemagick,
7407 imagemagick_image_p,
7408 imagemagick_load,
7409 imagemagick_clear_image,
7410 NULL
7411 };
7412
7397/* Free X resources of imagemagick image IMG which is used on frame F. */ 7413/* Free X resources of imagemagick image IMG which is used on frame F. */
7398 7414
7399static void 7415static void
@@ -7425,34 +7441,27 @@ imagemagick_image_p (Lisp_Object object)
7425#define DrawRectangle DrawRectangleGif 7441#define DrawRectangle DrawRectangleGif
7426#include <wand/MagickWand.h> 7442#include <wand/MagickWand.h>
7427 7443
7428/* imagemagick_load_image is a helper function for imagemagick_load, 7444/* Helper function for imagemagick_load, which does the actual loading
7429 which does the actual loading given contents and size, apart from 7445 given contents and size, apart from frame and image structures,
7430 frame and image structures, passed from imagemagick_load. 7446 passed from imagemagick_load. Uses librimagemagick to do most of
7447 the image processing.
7431 7448
7432 Uses librimagemagick to do most of the image processing. 7449 F is a pointer to the Emacs frame; IMG to the image structure to
7450 prepare; CONTENTS is the string containing the IMAGEMAGICK data to
7451 be parsed; SIZE is the number of bytes of data; and FILENAME is
7452 either the file name or the image data.
7433 7453
7434 Return non-zero if successful. 7454 Return non-zero if successful. */
7435*/
7436 7455
7437static int 7456static int
7438imagemagick_load_image (/* Pointer to emacs frame structure. */ 7457imagemagick_load_image (struct frame *f, struct image *img,
7439 struct frame *f, 7458 unsigned char *contents, unsigned int size,
7440 /* Pointer to emacs image structure. */ 7459 unsigned char *filename)
7441 struct image *img,
7442 /* String containing the IMAGEMAGICK data to
7443 be parsed. */
7444 unsigned char *contents,
7445 /* Size of data in bytes. */
7446 unsigned int size,
7447 /* Filename, either pass filename or
7448 contents/size. */
7449 unsigned char *filename)
7450{ 7460{
7451 unsigned long width; 7461 unsigned long width;
7452 unsigned long height; 7462 unsigned long height;
7453 7463
7454 MagickBooleanType 7464 MagickBooleanType status;
7455 status;
7456 7465
7457 XImagePtr ximg; 7466 XImagePtr ximg;
7458 Lisp_Object specified_bg; 7467 Lisp_Object specified_bg;
@@ -7514,8 +7523,8 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7514 7523
7515 DestroyMagickWand (ping_wand); 7524 DestroyMagickWand (ping_wand);
7516 7525
7517 /* Now, after pinging, we know how many images are inside the 7526 /* Now we know how many images are inside the file. If it's not a
7518 file. If it's not a bundle, the number is one. */ 7527 bundle, the number is one. */
7519 7528
7520 if (filename != NULL) 7529 if (filename != NULL)
7521 { 7530 {
@@ -7628,8 +7637,8 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7628 } 7637 }
7629 } 7638 }
7630 7639
7631 /* Finaly we are done manipulating the image, figure out resulting 7640 /* Finally we are done manipulating the image. Figure out the
7632 width, height, and then transfer ownerwship to Emacs. */ 7641 resulting width/height and transfer ownerwship to Emacs. */
7633 height = MagickGetImageHeight (image_wand); 7642 height = MagickGetImageHeight (image_wand);
7634 width = MagickGetImageWidth (image_wand); 7643 width = MagickGetImageWidth (image_wand);
7635 7644
@@ -7784,8 +7793,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7784 the prototype thus needs to be compatible with that structure. */ 7793 the prototype thus needs to be compatible with that structure. */
7785 7794
7786static int 7795static int
7787imagemagick_load (struct frame *f, 7796imagemagick_load (struct frame *f, struct image *img)
7788 struct image *img)
7789{ 7797{
7790 int success_p = 0; 7798 int success_p = 0;
7791 Lisp_Object file_name; 7799 Lisp_Object file_name;
@@ -7823,36 +7831,18 @@ imagemagick_load (struct frame *f,
7823 return success_p; 7831 return success_p;
7824} 7832}
7825 7833
7826/* Structure describing the image type `imagemagick'. Its the same
7827 type of structure defined for all image formats, handled by Emacs
7828 image functions. See struct image_type in dispextern.h. */
7829
7830static struct image_type imagemagick_type =
7831 {
7832 /* An identifier showing that this is an image structure for the
7833 IMAGEMAGICK format. */
7834 &Qimagemagick,
7835 /* Handle to a function that can be used to identify a IMAGEMAGICK
7836 file. */
7837 imagemagick_image_p,
7838 /* Handle to function used to load a IMAGEMAGICK file. */
7839 imagemagick_load,
7840 /* Handle to function to free resources for IMAGEMAGICK. */
7841 imagemagick_clear_image,
7842 /* An internal field to link to the next image type in a list of
7843 image types, will be filled in when registering the format. */
7844 NULL
7845 };
7846
7847
7848DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0, 0, 0, 7834DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0, 0, 0,
7849 doc: /* Return the image types supported by ImageMagick. 7835 doc: /* Return a list of image types supported by ImageMagick.
7850Note that ImageMagick recognizes many file-types that Emacs does not recognize 7836Each entry in this list is a symbol named after an ImageMagick format
7851as images, such as .c. */) 7837tag. See the ImageMagick manual for a list of ImageMagick formats and
7838their descriptions (http://www.imagemagick.org/script/formats.php).
7839
7840Note that ImageMagick recognizes many file-types that Emacs does not
7841recognize as images, such as C. See `imagemagick-types-inhibit'. */)
7852 (void) 7842 (void)
7853{ 7843{
7854 Lisp_Object typelist = Qnil; 7844 Lisp_Object typelist = Qnil;
7855 unsigned long numf; 7845 unsigned long numf = 0;
7856 ExceptionInfo ex; 7846 ExceptionInfo ex;
7857 char **imtypes = GetMagickList ("*", &numf, &ex); 7847 char **imtypes = GetMagickList ("*", &numf, &ex);
7858 int i; 7848 int i;
diff --git a/src/xselect.c b/src/xselect.c
index 8741cb89967..73ef4abc0a4 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -489,10 +489,10 @@ struct selection_data
489 489
490/* Linked list of the above (in support of MULTIPLE targets). */ 490/* Linked list of the above (in support of MULTIPLE targets). */
491 491
492struct selection_data *converted_selections; 492static struct selection_data *converted_selections;
493 493
494/* "Data" to send a requestor for a failed MULTIPLE subtarget. */ 494/* "Data" to send a requestor for a failed MULTIPLE subtarget. */
495Atom conversion_fail_tag; 495static Atom conversion_fail_tag;
496 496
497/* Used as an unwind-protect clause so that, if a selection-converter signals 497/* Used as an unwind-protect clause so that, if a selection-converter signals
498 an error, we tell the requester that we were unable to do what they wanted 498 an error, we tell the requester that we were unable to do what they wanted
@@ -2107,6 +2107,7 @@ frame's display, or the first available X display. */)
2107 return (owner ? Qt : Qnil); 2107 return (owner ? Qt : Qnil);
2108} 2108}
2109 2109
2110
2110/* Send the clipboard manager a SAVE_TARGETS request with a 2111/* Send the clipboard manager a SAVE_TARGETS request with a
2111 UTF8_STRING property, as described by 2112 UTF8_STRING property, as described by
2112 http://www.freedesktop.org/wiki/ClipboardManager */ 2113 http://www.freedesktop.org/wiki/ClipboardManager */
@@ -2126,54 +2127,53 @@ x_clipboard_manager_save (struct x_display_info *dpyinfo,
2126 Qnil, frame); 2127 Qnil, frame);
2127} 2128}
2128 2129
2129DEFUN ("x-clipboard-manager-save", Fx_clipboard_manager_save, 2130/* Called from delete_frame: save any clipboard owned by FRAME to the
2130 Sx_clipboard_manager_save, 0, 1, 0, 2131 clipboard manager. Do nothing if FRAME does not own the clipboard,
2131 doc: /* Save the clipboard contents to the clipboard manager. 2132 or if no clipboard manager is present. */
2132This function is intended to run from `delete-frame-functions' and 2133
2133`kill-emacs-hook', to transfer clipboard data owned by Emacs to a 2134void
2134clipboard manager prior to deleting a frame or killing Emacs. 2135x_clipboard_manager_save_frame (Lisp_Object frame)
2135
2136FRAME specifies a frame owning a clipboard; do nothing if FRAME does
2137not own the clipboard, or if no clipboard manager is present. If
2138FRAME is nil, save all clipboard contents owned by Emacs. */)
2139 (Lisp_Object frame)
2140{ 2136{
2141 if (FRAMEP (frame)) 2137 struct frame *f;
2138
2139 if (FRAMEP (frame)
2140 && (f = XFRAME (frame), FRAME_X_P (f))
2141 && FRAME_LIVE_P (f))
2142 { 2142 {
2143 struct frame *f = XFRAME (frame); 2143 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
2144 if (FRAME_LIVE_P (f) && FRAME_X_P (f)) 2144 Lisp_Object local_selection
2145 { 2145 = LOCAL_SELECTION (QCLIPBOARD, dpyinfo);
2146 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 2146
2147 Lisp_Object local_selection 2147 if (!NILP (local_selection)
2148 = LOCAL_SELECTION (QCLIPBOARD, dpyinfo); 2148 && EQ (frame, XCAR (XCDR (XCDR (XCDR (local_selection)))))
2149 2149 && XGetSelectionOwner (dpyinfo->display,
2150 if (!NILP (local_selection) 2150 dpyinfo->Xatom_CLIPBOARD_MANAGER))
2151 && EQ (frame, XCAR (XCDR (XCDR (XCDR (local_selection))))) 2151 x_clipboard_manager_save (dpyinfo, frame);
2152 && XGetSelectionOwner (dpyinfo->display,
2153 dpyinfo->Xatom_CLIPBOARD_MANAGER))
2154 x_clipboard_manager_save (dpyinfo, frame);
2155 }
2156 } 2152 }
2157 else if (NILP (frame)) 2153}
2154
2155/* Called from Fkill_emacs: save any clipboard owned by FRAME to the
2156 clipboard manager. Do nothing if FRAME does not own the clipboard,
2157 or if no clipboard manager is present. */
2158
2159void
2160x_clipboard_manager_save_all (void)
2161{
2162 /* Loop through all X displays, saving owned clipboards. */
2163 struct x_display_info *dpyinfo;
2164 Lisp_Object local_selection, local_frame;
2165 for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
2158 { 2166 {
2159 /* Loop through all X displays, saving owned clipboards. */ 2167 local_selection = LOCAL_SELECTION (QCLIPBOARD, dpyinfo);
2160 struct x_display_info *dpyinfo; 2168 if (NILP (local_selection)
2161 Lisp_Object local_selection, local_frame; 2169 || !XGetSelectionOwner (dpyinfo->display,
2162 for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next) 2170 dpyinfo->Xatom_CLIPBOARD_MANAGER))
2163 { 2171 continue;
2164 local_selection = LOCAL_SELECTION (QCLIPBOARD, dpyinfo);
2165 if (NILP (local_selection)
2166 || !XGetSelectionOwner (dpyinfo->display,
2167 dpyinfo->Xatom_CLIPBOARD_MANAGER))
2168 continue;
2169
2170 local_frame = XCAR (XCDR (XCDR (XCDR (local_selection))));
2171 if (FRAME_LIVE_P (XFRAME (local_frame)))
2172 x_clipboard_manager_save (dpyinfo, local_frame);
2173 }
2174 }
2175 2172
2176 return Qnil; 2173 local_frame = XCAR (XCDR (XCDR (XCDR (local_selection))));
2174 if (FRAME_LIVE_P (XFRAME (local_frame)))
2175 x_clipboard_manager_save (dpyinfo, local_frame);
2176 }
2177} 2177}
2178 2178
2179 2179
@@ -2586,7 +2586,6 @@ syms_of_xselect (void)
2586 defsubr (&Sx_disown_selection_internal); 2586 defsubr (&Sx_disown_selection_internal);
2587 defsubr (&Sx_selection_owner_p); 2587 defsubr (&Sx_selection_owner_p);
2588 defsubr (&Sx_selection_exists_p); 2588 defsubr (&Sx_selection_exists_p);
2589 defsubr (&Sx_clipboard_manager_save);
2590 2589
2591 defsubr (&Sx_get_atom_name); 2590 defsubr (&Sx_get_atom_name);
2592 defsubr (&Sx_send_client_message); 2591 defsubr (&Sx_send_client_message);
diff --git a/src/xterm.h b/src/xterm.h
index c44978d5386..2938de9b339 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1024,6 +1024,8 @@ extern Lisp_Object x_property_data_to_lisp (struct frame *,
1024 Atom, 1024 Atom,
1025 int, 1025 int,
1026 unsigned long); 1026 unsigned long);
1027extern void x_clipboard_manager_save_frame (Lisp_Object);
1028extern void x_clipboard_manager_save_all (void);
1027 1029
1028/* Defined in xfns.c */ 1030/* Defined in xfns.c */
1029 1031