aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/coding.c4
-rw-r--r--src/emacs.c2
-rw-r--r--src/intervals.c56
-rw-r--r--src/mac.c286
-rw-r--r--src/macfns.c12
-rw-r--r--src/syntax.c68
-rw-r--r--src/w32fns.c644
-rw-r--r--src/xdisp.c24
-rw-r--r--src/xsmfns.c58
-rw-r--r--src/xterm.c786
10 files changed, 970 insertions, 970 deletions
diff --git a/src/coding.c b/src/coding.c
index 69e3b7e3e3d..3fa383ad7be 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6313,7 +6313,7 @@ highest priority. */)
6313 the detecting source. Then code detectors can handle the tailing 6313 the detecting source. Then code detectors can handle the tailing
6314 byte sequence more accurately. 6314 byte sequence more accurately.
6315 6315
6316 Fix me: This is not an perfect solution. It is better that we 6316 Fix me: This is not a perfect solution. It is better that we
6317 add one more argument, say LAST_BLOCK, to all detect_coding_XXX. 6317 add one more argument, say LAST_BLOCK, to all detect_coding_XXX.
6318 */ 6318 */
6319 if (to == Z || (to == GPT && GAP_SIZE > 0)) 6319 if (to == Z || (to == GPT && GAP_SIZE > 0))
@@ -6538,7 +6538,7 @@ unencodable_char_position (safe_chars, pos, p, pend, n)
6538 { 6538 {
6539 int len; 6539 int len;
6540 int c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, len); 6540 int c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, len);
6541 6541
6542 if (c >= 128 6542 if (c >= 128
6543 && (CHAR_TABLE_P (safe_chars) 6543 && (CHAR_TABLE_P (safe_chars)
6544 ? NILP (CHAR_TABLE_REF (safe_chars, c)) 6544 ? NILP (CHAR_TABLE_REF (safe_chars, c))
diff --git a/src/emacs.c b/src/emacs.c
index ccf2f93f93c..83bec92263e 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -158,7 +158,7 @@ Lisp_Object Vprevious_system_messages_locale;
158Lisp_Object Vsystem_time_locale; 158Lisp_Object Vsystem_time_locale;
159Lisp_Object Vprevious_system_time_locale; 159Lisp_Object Vprevious_system_time_locale;
160 160
161/* If non-zero, emacs should not attempt to use an window-specific code, 161/* If non-zero, emacs should not attempt to use a window-specific code,
162 but instead should use the virtual terminal under which it was started. */ 162 but instead should use the virtual terminal under which it was started. */
163int inhibit_window_system; 163int inhibit_window_system;
164 164
diff --git a/src/intervals.c b/src/intervals.c
index 9ed2a651f55..3b8327b96d8 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -347,10 +347,10 @@ rotate_right (interval)
347 347
348/* Assuming that a right child exists, perform the following operation: 348/* Assuming that a right child exists, perform the following operation:
349 349
350 A B 350 A B
351 / \ / \ 351 / \ / \
352 B => A 352 B => A
353 / \ / \ 353 / \ / \
354 c c 354 c c
355*/ 355*/
356 356
@@ -524,7 +524,7 @@ split_interval_right (interval, offset)
524 new->total_length = new_length + new->right->total_length; 524 new->total_length = new_length + new->right->total_length;
525 balance_an_interval (new); 525 balance_an_interval (new);
526 } 526 }
527 527
528 balance_possible_root_interval (interval); 528 balance_possible_root_interval (interval);
529 529
530 return new; 530 return new;
@@ -569,7 +569,7 @@ split_interval_left (interval, offset)
569 new->total_length = new_length + new->left->total_length; 569 new->total_length = new_length + new->left->total_length;
570 balance_an_interval (new); 570 balance_an_interval (new);
571 } 571 }
572 572
573 balance_possible_root_interval (interval); 573 balance_possible_root_interval (interval);
574 574
575 return new; 575 return new;
@@ -754,39 +754,39 @@ update_interval (i, pos)
754 if (NULL_INTERVAL_P (i)) 754 if (NULL_INTERVAL_P (i))
755 return NULL_INTERVAL; 755 return NULL_INTERVAL;
756 756
757 while (1) 757 while (1)
758 { 758 {
759 if (pos < i->position) 759 if (pos < i->position)
760 { 760 {
761 /* Move left. */ 761 /* Move left. */
762 if (pos >= i->position - TOTAL_LENGTH (i->left)) 762 if (pos >= i->position - TOTAL_LENGTH (i->left))
763 { 763 {
764 i->left->position = i->position - TOTAL_LENGTH (i->left) 764 i->left->position = i->position - TOTAL_LENGTH (i->left)
765 + LEFT_TOTAL_LENGTH (i->left); 765 + LEFT_TOTAL_LENGTH (i->left);
766 i = i->left; /* Move to the left child */ 766 i = i->left; /* Move to the left child */
767 } 767 }
768 else if (NULL_PARENT (i)) 768 else if (NULL_PARENT (i))
769 error ("Point before start of properties"); 769 error ("Point before start of properties");
770 else 770 else
771 i = INTERVAL_PARENT (i); 771 i = INTERVAL_PARENT (i);
772 continue; 772 continue;
773 } 773 }
774 else if (pos >= INTERVAL_LAST_POS (i)) 774 else if (pos >= INTERVAL_LAST_POS (i))
775 { 775 {
776 /* Move right. */ 776 /* Move right. */
777 if (pos < INTERVAL_LAST_POS (i) + TOTAL_LENGTH (i->right)) 777 if (pos < INTERVAL_LAST_POS (i) + TOTAL_LENGTH (i->right))
778 { 778 {
779 i->right->position = INTERVAL_LAST_POS (i) + 779 i->right->position = INTERVAL_LAST_POS (i) +
780 LEFT_TOTAL_LENGTH (i->right); 780 LEFT_TOTAL_LENGTH (i->right);
781 i = i->right; /* Move to the right child */ 781 i = i->right; /* Move to the right child */
782 } 782 }
783 else if (NULL_PARENT (i)) 783 else if (NULL_PARENT (i))
784 error ("Point after end of properties"); 784 error ("Point after end of properties");
785 else 785 else
786 i = INTERVAL_PARENT (i); 786 i = INTERVAL_PARENT (i);
787 continue; 787 continue;
788 } 788 }
789 else 789 else
790 return i; 790 return i;
791 } 791 }
792} 792}
@@ -874,7 +874,7 @@ adjust_intervals_for_insertion (tree, position, length)
874 int eobp = 0; 874 int eobp = 0;
875 Lisp_Object parent; 875 Lisp_Object parent;
876 int offset; 876 int offset;
877 877
878 if (TOTAL_LENGTH (tree) == 0) /* Paranoia */ 878 if (TOTAL_LENGTH (tree) == 0) /* Paranoia */
879 abort (); 879 abort ();
880 880
@@ -989,7 +989,7 @@ adjust_intervals_for_insertion (tree, position, length)
989 temp->total_length += length; 989 temp->total_length += length;
990 temp = balance_possible_root_interval (temp); 990 temp = balance_possible_root_interval (temp);
991 } 991 }
992 992
993 /* If at least one interval has sticky properties, 993 /* If at least one interval has sticky properties,
994 we check the stickiness property by property. 994 we check the stickiness property by property.
995 995
@@ -1046,7 +1046,7 @@ adjust_intervals_for_insertion (tree, position, length)
1046 temp = balance_possible_root_interval (temp); 1046 temp = balance_possible_root_interval (temp);
1047 } 1047 }
1048 } 1048 }
1049 1049
1050 return tree; 1050 return tree;
1051} 1051}
1052 1052
@@ -1212,7 +1212,7 @@ merge_properties_sticky (pleft, pright)
1212 1212
1213 cat = textget (props, Qcategory); 1213 cat = textget (props, Qcategory);
1214 if (! NILP (front) 1214 if (! NILP (front)
1215 && 1215 &&
1216 /* If we have inherited a front-stick category property that is t, 1216 /* If we have inherited a front-stick category property that is t,
1217 we don't need to set up a detailed one. */ 1217 we don't need to set up a detailed one. */
1218 ! (! NILP (cat) && SYMBOLP (cat) 1218 ! (! NILP (cat) && SYMBOLP (cat)
@@ -1222,7 +1222,7 @@ merge_properties_sticky (pleft, pright)
1222} 1222}
1223 1223
1224 1224
1225/* Delete an node I from its interval tree by merging its subtrees 1225/* Delete a node I from its interval tree by merging its subtrees
1226 into one subtree which is then returned. Caller is responsible for 1226 into one subtree which is then returned. Caller is responsible for
1227 storing the resulting subtree into its parent. */ 1227 storing the resulting subtree into its parent. */
1228 1228
@@ -1351,7 +1351,7 @@ interval_deletion_adjustment (tree, from, amount)
1351 else 1351 else
1352 { 1352 {
1353 /* How much can we delete from this interval? */ 1353 /* How much can we delete from this interval? */
1354 int my_amount = ((tree->total_length 1354 int my_amount = ((tree->total_length
1355 - RIGHT_TOTAL_LENGTH (tree)) 1355 - RIGHT_TOTAL_LENGTH (tree))
1356 - relative_position); 1356 - relative_position);
1357 1357
@@ -1361,7 +1361,7 @@ interval_deletion_adjustment (tree, from, amount)
1361 tree->total_length -= amount; 1361 tree->total_length -= amount;
1362 if (LENGTH (tree) == 0) 1362 if (LENGTH (tree) == 0)
1363 delete_interval (tree); 1363 delete_interval (tree);
1364 1364
1365 return amount; 1365 return amount;
1366 } 1366 }
1367 1367
@@ -1780,7 +1780,7 @@ graft_intervals_into_buffer (source, position, length, buffer, inherit)
1780 The properties of under are the result of 1780 The properties of under are the result of
1781 adjust_intervals_for_insertion, so stickiness has 1781 adjust_intervals_for_insertion, so stickiness has
1782 already been taken care of. */ 1782 already been taken care of. */
1783 1783
1784 while (! NULL_INTERVAL_P (over)) 1784 while (! NULL_INTERVAL_P (over))
1785 { 1785 {
1786 if (LENGTH (over) < LENGTH (under)) 1786 if (LENGTH (over) < LENGTH (under))
@@ -1805,7 +1805,7 @@ graft_intervals_into_buffer (source, position, length, buffer, inherit)
1805 1805
1806/* Get the value of property PROP from PLIST, 1806/* Get the value of property PROP from PLIST,
1807 which is the plist of an interval. 1807 which is the plist of an interval.
1808 We check for direct properties, for categories with property PROP, 1808 We check for direct properties, for categories with property PROP,
1809 and for PROP appearing on the default-text-properties list. */ 1809 and for PROP appearing on the default-text-properties list. */
1810 1810
1811Lisp_Object 1811Lisp_Object
@@ -1887,7 +1887,7 @@ temp_set_point_both (buffer, charpos, bytepos)
1887 BUF_PT (buffer) = charpos; 1887 BUF_PT (buffer) = charpos;
1888} 1888}
1889 1889
1890/* Set point in BUFFER to CHARPOS. If the target position is 1890/* Set point in BUFFER to CHARPOS. If the target position is
1891 before an intangible character, move to an ok place. */ 1891 before an intangible character, move to an ok place. */
1892 1892
1893void 1893void
@@ -1907,7 +1907,7 @@ set_point (buffer, charpos)
1907 TEST_OFFS should be either 0 or -1, and ADJ should be either 1 or -1. 1907 TEST_OFFS should be either 0 or -1, and ADJ should be either 1 or -1.
1908 1908
1909 Note that `stickiness' is determined by overlay marker insertion types, 1909 Note that `stickiness' is determined by overlay marker insertion types,
1910 if the invisible property comes from an overlay. */ 1910 if the invisible property comes from an overlay. */
1911 1911
1912static int 1912static int
1913adjust_for_invis_intang (pos, test_offs, adj, test_intang) 1913adjust_for_invis_intang (pos, test_offs, adj, test_intang)
@@ -1945,7 +1945,7 @@ adjust_for_invis_intang (pos, test_offs, adj, test_intang)
1945} 1945}
1946 1946
1947/* Set point in BUFFER to CHARPOS, which corresponds to byte 1947/* Set point in BUFFER to CHARPOS, which corresponds to byte
1948 position BYTEPOS. If the target position is 1948 position BYTEPOS. If the target position is
1949 before an intangible character, move to an ok place. */ 1949 before an intangible character, move to an ok place. */
1950 1950
1951void 1951void
@@ -2218,7 +2218,7 @@ move_if_not_intangible (position)
2218 2218
2219 } 2219 }
2220 2220
2221 /* If the whole stretch between PT and POSITION isn't intangible, 2221 /* If the whole stretch between PT and POSITION isn't intangible,
2222 try moving to POSITION (which means we actually move farther 2222 try moving to POSITION (which means we actually move farther
2223 if POSITION is inside of intangible text). */ 2223 if POSITION is inside of intangible text). */
2224 2224
@@ -2265,7 +2265,7 @@ get_property_and_range (pos, prop, val, start, end, object)
2265 *start = i->position; 2265 *start = i->position;
2266 2266
2267 next = next_interval (i); 2267 next = next_interval (i);
2268 while (! NULL_INTERVAL_P (next) 2268 while (! NULL_INTERVAL_P (next)
2269 && EQ (*val, textget (next->plist, prop))) 2269 && EQ (*val, textget (next->plist, prop)))
2270 i = next, next = next_interval (next); 2270 i = next, next = next_interval (next);
2271 *end = i->position + LENGTH (i); 2271 *end = i->position + LENGTH (i);
diff --git a/src/mac.c b/src/mac.c
index a28f513a707..833ee5f3bdc 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -91,7 +91,7 @@ string_cat_and_replace (char *s1, const char *s2, int n, char a, char b)
91 int l2 = strlen (s2); 91 int l2 = strlen (s2);
92 char *p = s1 + l1; 92 char *p = s1 + l1;
93 int i; 93 int i;
94 94
95 strncat (s1, s2, n); 95 strncat (s1, s2, n);
96 for (i = 0; i < l2; i++) 96 for (i = 0; i < l2; i++)
97 { 97 {
@@ -104,27 +104,27 @@ string_cat_and_replace (char *s1, const char *s2, int n, char a, char b)
104 104
105/* Convert a Mac pathname to Posix form. A Mac full pathname is one 105/* Convert a Mac pathname to Posix form. A Mac full pathname is one
106 that does not begin with a ':' and contains at least one ':'. A Mac 106 that does not begin with a ':' and contains at least one ':'. A Mac
107 full pathname causes an '/' to be prepended to the Posix pathname. 107 full pathname causes a '/' to be prepended to the Posix pathname.
108 The algorithm for the rest of the pathname is as follows: 108 The algorithm for the rest of the pathname is as follows:
109 For each segment between two ':', 109 For each segment between two ':',
110 if it is non-null, copy as is and then add a '/' at the end, 110 if it is non-null, copy as is and then add a '/' at the end,
111 otherwise, insert a "../" into the Posix pathname. 111 otherwise, insert a "../" into the Posix pathname.
112 Returns 1 if successful; 0 if fails. */ 112 Returns 1 if successful; 0 if fails. */
113 113
114int 114int
115mac_to_posix_pathname (const char *mfn, char *ufn, int ufnbuflen) 115mac_to_posix_pathname (const char *mfn, char *ufn, int ufnbuflen)
116{ 116{
117 const char *p, *q, *pe; 117 const char *p, *q, *pe;
118 118
119 strcpy (ufn, ""); 119 strcpy (ufn, "");
120 120
121 if (*mfn == '\0') 121 if (*mfn == '\0')
122 return 1; 122 return 1;
123 123
124 p = strchr (mfn, ':'); 124 p = strchr (mfn, ':');
125 if (p != 0 && p != mfn) /* full pathname */ 125 if (p != 0 && p != mfn) /* full pathname */
126 strcat (ufn, "/"); 126 strcat (ufn, "/");
127 127
128 p = mfn; 128 p = mfn;
129 if (*p == ':') 129 if (*p == ':')
130 p++; 130 p++;
@@ -159,7 +159,7 @@ mac_to_posix_pathname (const char *mfn, char *ufn, int ufnbuflen)
159 p = pe; 159 p = pe;
160 } 160 }
161 } 161 }
162 162
163 return 1; 163 return 1;
164} 164}
165 165
@@ -169,20 +169,20 @@ extern char *get_temp_dir_name ();
169 169
170/* Convert a Posix pathname to Mac form. Approximately reverse of the 170/* Convert a Posix pathname to Mac form. Approximately reverse of the
171 above in algorithm. */ 171 above in algorithm. */
172 172
173int 173int
174posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen) 174posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen)
175{ 175{
176 const char *p, *q, *pe; 176 const char *p, *q, *pe;
177 char expanded_pathname[MAXPATHLEN+1]; 177 char expanded_pathname[MAXPATHLEN+1];
178 178
179 strcpy (mfn, ""); 179 strcpy (mfn, "");
180 180
181 if (*ufn == '\0') 181 if (*ufn == '\0')
182 return 1; 182 return 1;
183 183
184 p = ufn; 184 p = ufn;
185 185
186 /* Check for and handle volume names. Last comparison: strangely 186 /* Check for and handle volume names. Last comparison: strangely
187 somewhere "/.emacs" is passed. A temporary fix for now. */ 187 somewhere "/.emacs" is passed. A temporary fix for now. */
188 if (*p == '/' && strchr (p+1, '/') == NULL && strcmp (p, "/.emacs") != 0) 188 if (*p == '/' && strchr (p+1, '/') == NULL && strcmp (p, "/.emacs") != 0)
@@ -216,10 +216,10 @@ posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen)
216 strcat (expanded_pathname, p); 216 strcat (expanded_pathname, p);
217 p = expanded_pathname; 217 p = expanded_pathname;
218 /* now p points to the pathname with emacs dir prefix */ 218 /* now p points to the pathname with emacs dir prefix */
219 } 219 }
220 else if (*p != '/') /* relative pathname */ 220 else if (*p != '/') /* relative pathname */
221 strcat (mfn, ":"); 221 strcat (mfn, ":");
222 222
223 if (*p == '/') 223 if (*p == '/')
224 p++; 224 p++;
225 225
@@ -252,7 +252,7 @@ posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen)
252 p = pe; 252 p = pe;
253 } 253 }
254 } 254 }
255 255
256 return 1; 256 return 1;
257} 257}
258 258
@@ -311,7 +311,7 @@ stat_noalias (const char *path, struct stat *buf)
311 cipb.hFileInfo.ioDirID = 0; 311 cipb.hFileInfo.ioDirID = 0;
312 cipb.hFileInfo.ioFDirIndex = 0; 312 cipb.hFileInfo.ioFDirIndex = 0;
313 /* set to 0 to get information about specific dir or file */ 313 /* set to 0 to get information about specific dir or file */
314 314
315 errno = PBGetCatInfo (&cipb, false); 315 errno = PBGetCatInfo (&cipb, false);
316 if (errno == -43) /* -43: fnfErr defined in Errors.h */ 316 if (errno == -43) /* -43: fnfErr defined in Errors.h */
317 errno = ENOENT; 317 errno = ENOENT;
@@ -321,7 +321,7 @@ stat_noalias (const char *path, struct stat *buf)
321 if (cipb.hFileInfo.ioFlAttrib & 0x10) /* bit 4 = 1 for directories */ 321 if (cipb.hFileInfo.ioFlAttrib & 0x10) /* bit 4 = 1 for directories */
322 { 322 {
323 buf->st_mode = S_IFDIR | S_IREAD | S_IEXEC; 323 buf->st_mode = S_IFDIR | S_IREAD | S_IEXEC;
324 324
325 if (!(cipb.hFileInfo.ioFlAttrib & 0x1)) 325 if (!(cipb.hFileInfo.ioFlAttrib & 0x1))
326 buf->st_mode |= S_IWRITE; /* bit 1 = 1 for locked files/directories */ 326 buf->st_mode |= S_IWRITE; /* bit 1 = 1 for locked files/directories */
327 buf->st_ino = cipb.dirInfo.ioDrDirID; 327 buf->st_ino = cipb.dirInfo.ioDrDirID;
@@ -377,7 +377,7 @@ lstat (const char *path, struct stat *buf)
377 377
378 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) 378 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
379 return -1; 379 return -1;
380 380
381 return stat_noalias (true_pathname, buf); 381 return stat_noalias (true_pathname, buf);
382} 382}
383 383
@@ -386,16 +386,16 @@ int
386stat (const char *path, struct stat *sb) 386stat (const char *path, struct stat *sb)
387{ 387{
388 int result; 388 int result;
389 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; 389 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
390 int len; 390 int len;
391 391
392 if ((result = stat_noalias (path, sb)) >= 0 && 392 if ((result = stat_noalias (path, sb)) >= 0 &&
393 ! (sb->st_mode & S_IFLNK)) 393 ! (sb->st_mode & S_IFLNK))
394 return result; 394 return result;
395 395
396 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) 396 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
397 return -1; 397 return -1;
398 398
399 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); 399 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
400 if (len > -1) 400 if (len > -1)
401 { 401 {
@@ -437,10 +437,10 @@ mkdir (const char *dirname, int mode)
437 437
438 HFileParam hfpb; 438 HFileParam hfpb;
439 char true_pathname[MAXPATHLEN+1], mac_pathname[MAXPATHLEN+1]; 439 char true_pathname[MAXPATHLEN+1], mac_pathname[MAXPATHLEN+1];
440 440
441 if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1) 441 if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1)
442 return -1; 442 return -1;
443 443
444 if (posix_to_mac_pathname (true_pathname, mac_pathname, MAXPATHLEN+1) == 0) 444 if (posix_to_mac_pathname (true_pathname, mac_pathname, MAXPATHLEN+1) == 0)
445 return -1; 445 return -1;
446 446
@@ -448,7 +448,7 @@ mkdir (const char *dirname, int mode)
448 hfpb.ioNamePtr = mac_pathname; 448 hfpb.ioNamePtr = mac_pathname;
449 hfpb.ioVRefNum = 0; /* ignored unless name is invalid */ 449 hfpb.ioVRefNum = 0; /* ignored unless name is invalid */
450 hfpb.ioDirID = 0; /* parent is the root */ 450 hfpb.ioDirID = 0; /* parent is the root */
451 451
452 errno = PBDirCreate ((HParmBlkPtr) &hfpb, false); 452 errno = PBDirCreate ((HParmBlkPtr) &hfpb, false);
453 /* just return the Mac OSErr code for now */ 453 /* just return the Mac OSErr code for now */
454 return errno == noErr ? 0 : -1; 454 return errno == noErr ? 0 : -1;
@@ -460,7 +460,7 @@ sys_rmdir (const char *dirname)
460{ 460{
461 HFileParam hfpb; 461 HFileParam hfpb;
462 char mac_pathname[MAXPATHLEN+1]; 462 char mac_pathname[MAXPATHLEN+1];
463 463
464 if (posix_to_mac_pathname (dirname, mac_pathname, MAXPATHLEN+1) == 0) 464 if (posix_to_mac_pathname (dirname, mac_pathname, MAXPATHLEN+1) == 0)
465 return -1; 465 return -1;
466 466
@@ -468,7 +468,7 @@ sys_rmdir (const char *dirname)
468 hfpb.ioNamePtr = mac_pathname; 468 hfpb.ioNamePtr = mac_pathname;
469 hfpb.ioVRefNum = 0; /* ignored unless name is invalid */ 469 hfpb.ioVRefNum = 0; /* ignored unless name is invalid */
470 hfpb.ioDirID = 0; /* parent is the root */ 470 hfpb.ioDirID = 0; /* parent is the root */
471 471
472 errno = PBHDelete ((HParmBlkPtr) &hfpb, false); 472 errno = PBHDelete ((HParmBlkPtr) &hfpb, false);
473 return errno == noErr ? 0 : -1; 473 return errno == noErr ? 0 : -1;
474} 474}
@@ -487,14 +487,14 @@ execvp (const char *path, ...)
487int 487int
488utime (const char *path, const struct utimbuf *times) 488utime (const char *path, const struct utimbuf *times)
489{ 489{
490 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; 490 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
491 int len; 491 int len;
492 char mac_pathname[MAXPATHLEN+1]; 492 char mac_pathname[MAXPATHLEN+1];
493 CInfoPBRec cipb; 493 CInfoPBRec cipb;
494 494
495 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) 495 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
496 return -1; 496 return -1;
497 497
498 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); 498 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
499 if (len > -1) 499 if (len > -1)
500 fully_resolved_name[len] = '\0'; 500 fully_resolved_name[len] = '\0';
@@ -508,9 +508,9 @@ utime (const char *path, const struct utimbuf *times)
508 cipb.hFileInfo.ioNamePtr = mac_pathname; 508 cipb.hFileInfo.ioNamePtr = mac_pathname;
509 cipb.hFileInfo.ioVRefNum = 0; 509 cipb.hFileInfo.ioVRefNum = 0;
510 cipb.hFileInfo.ioDirID = 0; 510 cipb.hFileInfo.ioDirID = 0;
511 cipb.hFileInfo.ioFDirIndex = 0; 511 cipb.hFileInfo.ioFDirIndex = 0;
512 /* set to 0 to get information about specific dir or file */ 512 /* set to 0 to get information about specific dir or file */
513 513
514 errno = PBGetCatInfo (&cipb, false); 514 errno = PBGetCatInfo (&cipb, false);
515 if (errno != noErr) 515 if (errno != noErr)
516 return -1; 516 return -1;
@@ -549,14 +549,14 @@ utime (const char *path, const struct utimbuf *times)
549int 549int
550access (const char *path, int mode) 550access (const char *path, int mode)
551{ 551{
552 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; 552 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
553 int len; 553 int len;
554 char mac_pathname[MAXPATHLEN+1]; 554 char mac_pathname[MAXPATHLEN+1];
555 CInfoPBRec cipb; 555 CInfoPBRec cipb;
556 556
557 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) 557 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
558 return -1; 558 return -1;
559 559
560 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); 560 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
561 if (len > -1) 561 if (len > -1)
562 fully_resolved_name[len] = '\0'; 562 fully_resolved_name[len] = '\0';
@@ -572,7 +572,7 @@ access (const char *path, int mode)
572 cipb.hFileInfo.ioDirID = 0; 572 cipb.hFileInfo.ioDirID = 0;
573 cipb.hFileInfo.ioFDirIndex = 0; 573 cipb.hFileInfo.ioFDirIndex = 0;
574 /* set to 0 to get information about specific dir or file */ 574 /* set to 0 to get information about specific dir or file */
575 575
576 errno = PBGetCatInfo (&cipb, false); 576 errno = PBGetCatInfo (&cipb, false);
577 if (errno != noErr) 577 if (errno != noErr)
578 return -1; 578 return -1;
@@ -605,16 +605,16 @@ access (const char *path, int mode)
605int 605int
606sys_open (const char *path, int oflag) 606sys_open (const char *path, int oflag)
607{ 607{
608 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; 608 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
609 int len; 609 int len;
610 char mac_pathname[MAXPATHLEN+1]; 610 char mac_pathname[MAXPATHLEN+1];
611 611
612 if (strcmp (path, "/dev/null") == 0) 612 if (strcmp (path, "/dev/null") == 0)
613 return DEV_NULL_FD; /* some bogus fd to be ignored in write */ 613 return DEV_NULL_FD; /* some bogus fd to be ignored in write */
614 614
615 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) 615 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
616 return -1; 616 return -1;
617 617
618 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); 618 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
619 if (len > -1) 619 if (len > -1)
620 fully_resolved_name[len] = '\0'; 620 fully_resolved_name[len] = '\0';
@@ -642,10 +642,10 @@ sys_open (const char *path, int oflag)
642int 642int
643sys_creat (const char *path, mode_t mode) 643sys_creat (const char *path, mode_t mode)
644{ 644{
645 char true_pathname[MAXPATHLEN+1]; 645 char true_pathname[MAXPATHLEN+1];
646 int len; 646 int len;
647 char mac_pathname[MAXPATHLEN+1]; 647 char mac_pathname[MAXPATHLEN+1];
648 648
649 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) 649 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
650 return -1; 650 return -1;
651 651
@@ -668,13 +668,13 @@ sys_creat (const char *path, mode_t mode)
668int 668int
669sys_unlink (const char *path) 669sys_unlink (const char *path)
670{ 670{
671 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; 671 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
672 int len; 672 int len;
673 char mac_pathname[MAXPATHLEN+1]; 673 char mac_pathname[MAXPATHLEN+1];
674 674
675 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1) 675 if (find_true_pathname (path, true_pathname, MAXPATHLEN+1) == -1)
676 return -1; 676 return -1;
677 677
678 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); 678 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
679 if (len > -1) 679 if (len > -1)
680 fully_resolved_name[len] = '\0'; 680 fully_resolved_name[len] = '\0';
@@ -723,13 +723,13 @@ int
723sys_rename (const char * old_name, const char * new_name) 723sys_rename (const char * old_name, const char * new_name)
724{ 724{
725 char true_old_pathname[MAXPATHLEN+1], true_new_pathname[MAXPATHLEN+1]; 725 char true_old_pathname[MAXPATHLEN+1], true_new_pathname[MAXPATHLEN+1];
726 char fully_resolved_old_name[MAXPATHLEN+1]; 726 char fully_resolved_old_name[MAXPATHLEN+1];
727 int len; 727 int len;
728 char mac_old_name[MAXPATHLEN+1], mac_new_name[MAXPATHLEN+1]; 728 char mac_old_name[MAXPATHLEN+1], mac_new_name[MAXPATHLEN+1];
729 729
730 if (find_true_pathname (old_name, true_old_pathname, MAXPATHLEN+1) == -1) 730 if (find_true_pathname (old_name, true_old_pathname, MAXPATHLEN+1) == -1)
731 return -1; 731 return -1;
732 732
733 len = readlink (true_old_pathname, fully_resolved_old_name, MAXPATHLEN); 733 len = readlink (true_old_pathname, fully_resolved_old_name, MAXPATHLEN);
734 if (len > -1) 734 if (len > -1)
735 fully_resolved_old_name[len] = '\0'; 735 fully_resolved_old_name[len] = '\0';
@@ -738,7 +738,7 @@ sys_rename (const char * old_name, const char * new_name)
738 738
739 if (find_true_pathname (new_name, true_new_pathname, MAXPATHLEN+1) == -1) 739 if (find_true_pathname (new_name, true_new_pathname, MAXPATHLEN+1) == -1)
740 return -1; 740 return -1;
741 741
742 if (strcmp (fully_resolved_old_name, true_new_pathname) == 0) 742 if (strcmp (fully_resolved_old_name, true_new_pathname) == 0)
743 return 0; 743 return 0;
744 744
@@ -746,7 +746,7 @@ sys_rename (const char * old_name, const char * new_name)
746 mac_old_name, 746 mac_old_name,
747 MAXPATHLEN+1)) 747 MAXPATHLEN+1))
748 return -1; 748 return -1;
749 749
750 if (!posix_to_mac_pathname(true_new_pathname, mac_new_name, MAXPATHLEN+1)) 750 if (!posix_to_mac_pathname(true_new_pathname, mac_new_name, MAXPATHLEN+1))
751 return -1; 751 return -1;
752 752
@@ -754,7 +754,7 @@ sys_rename (const char * old_name, const char * new_name)
754 file in Unix. CW version fails in these situation. So we add a 754 file in Unix. CW version fails in these situation. So we add a
755 call to unlink here. */ 755 call to unlink here. */
756 (void) unlink (mac_new_name); 756 (void) unlink (mac_new_name);
757 757
758 return rename (mac_old_name, mac_new_name); 758 return rename (mac_old_name, mac_new_name);
759} 759}
760 760
@@ -764,13 +764,13 @@ extern FILE *fopen (const char *name, const char *mode);
764FILE * 764FILE *
765sys_fopen (const char *name, const char *mode) 765sys_fopen (const char *name, const char *mode)
766{ 766{
767 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; 767 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
768 int len; 768 int len;
769 char mac_pathname[MAXPATHLEN+1]; 769 char mac_pathname[MAXPATHLEN+1];
770 770
771 if (find_true_pathname (name, true_pathname, MAXPATHLEN+1) == -1) 771 if (find_true_pathname (name, true_pathname, MAXPATHLEN+1) == -1)
772 return 0; 772 return 0;
773 773
774 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); 774 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
775 if (len > -1) 775 if (len > -1)
776 fully_resolved_name[len] = '\0'; 776 fully_resolved_name[len] = '\0';
@@ -843,7 +843,7 @@ select (n, rfds, wfds, efds, timeout)
843 843
844 EMACS_GET_TIME (end_time); 844 EMACS_GET_TIME (end_time);
845 EMACS_ADD_TIME (end_time, end_time, *timeout); 845 EMACS_ADD_TIME (end_time, end_time, *timeout);
846 846
847 do 847 do
848 { 848 {
849 /* Also return true if an event other than a keyDown has 849 /* Also return true if an event other than a keyDown has
@@ -858,7 +858,7 @@ select (n, rfds, wfds, efds, timeout)
858 { 858 {
859 Point mouse_pos; 859 Point mouse_pos;
860 static Point old_mouse_pos = {-1, -1}; 860 static Point old_mouse_pos = {-1, -1};
861 861
862 GetMouse (&mouse_pos); 862 GetMouse (&mouse_pos);
863 if (!EqualPt (mouse_pos, old_mouse_pos)) 863 if (!EqualPt (mouse_pos, old_mouse_pos))
864 { 864 {
@@ -866,10 +866,10 @@ select (n, rfds, wfds, efds, timeout)
866 return 1; 866 return 1;
867 } 867 }
868 } 868 }
869 869
870 WaitNextEvent (0, &e, 1UL, NULL); /* Accept no event; wait 1 870 WaitNextEvent (0, &e, 1UL, NULL); /* Accept no event; wait 1
871 tic. by T.I. */ 871 tic. by T.I. */
872 872
873 EMACS_GET_TIME (now); 873 EMACS_GET_TIME (now);
874 EMACS_SUB_TIME (now, end_time, now); 874 EMACS_SUB_TIME (now, end_time, now);
875 } 875 }
@@ -887,18 +887,18 @@ pause ()
887{ 887{
888 EventRecord e; 888 EventRecord e;
889 unsigned long tick; 889 unsigned long tick;
890 890
891 if (!target_ticks) /* no alarm pending */ 891 if (!target_ticks) /* no alarm pending */
892 return -1; 892 return -1;
893 893
894 if ((tick = TickCount ()) < target_ticks) 894 if ((tick = TickCount ()) < target_ticks)
895 WaitNextEvent (0, &e, target_ticks - tick, NULL); /* Accept no event; 895 WaitNextEvent (0, &e, target_ticks - tick, NULL); /* Accept no event;
896 just wait. by T.I. */ 896 just wait. by T.I. */
897 897
898 target_ticks = 0; 898 target_ticks = 0;
899 if (alarm_signal_func) 899 if (alarm_signal_func)
900 (*alarm_signal_func)(SIGALRM); 900 (*alarm_signal_func)(SIGALRM);
901 901
902 return 0; 902 return 0;
903} 903}
904 904
@@ -907,9 +907,9 @@ int
907alarm (int seconds) 907alarm (int seconds)
908{ 908{
909 long remaining = target_ticks ? (TickCount () - target_ticks) / 60 : 0; 909 long remaining = target_ticks ? (TickCount () - target_ticks) / 60 : 0;
910 910
911 target_ticks = seconds ? TickCount () + 60 * seconds : 0; 911 target_ticks = seconds ? TickCount () + 60 * seconds : 0;
912 912
913 return (remaining < 0) ? 0 : (unsigned int) remaining; 913 return (remaining < 0) ? 0 : (unsigned int) remaining;
914} 914}
915 915
@@ -932,9 +932,9 @@ sys_signal (int signal_num, __signal_func_ptr signal_func)
932 else 932 else
933 { 933 {
934#ifdef __MRC__ 934#ifdef __MRC__
935 __sigfun old_signal_func; 935 __sigfun old_signal_func;
936#elif __MWERKS__ 936#elif __MWERKS__
937 __signal_func_ptr old_signal_func; 937 __signal_func_ptr old_signal_func;
938#else 938#else
939 You lose!!! 939 You lose!!!
940#endif 940#endif
@@ -979,7 +979,7 @@ gettimeofday (tp)
979 979
980 /* Get time since boot */ 980 /* Get time since boot */
981 Microseconds (&uw_microseconds); 981 Microseconds (&uw_microseconds);
982 982
983 /* Convert to time since midnight*/ 983 /* Convert to time since midnight*/
984 w_microseconds.hi = uw_microseconds.hi; 984 w_microseconds.hi = uw_microseconds.hi;
985 w_microseconds.lo = uw_microseconds.lo; 985 w_microseconds.lo = uw_microseconds.lo;
@@ -1019,7 +1019,7 @@ struct tm *
1019sys_gmtime (const time_t *timer) 1019sys_gmtime (const time_t *timer)
1020{ 1020{
1021 time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF; 1021 time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF;
1022 1022
1023 return gmtime (&unix_time); 1023 return gmtime (&unix_time);
1024} 1024}
1025 1025
@@ -1034,7 +1034,7 @@ sys_localtime (const time_t *timer)
1034#else 1034#else
1035 time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF; 1035 time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF;
1036#endif 1036#endif
1037 1037
1038 return localtime (&unix_time); 1038 return localtime (&unix_time);
1039} 1039}
1040 1040
@@ -1049,7 +1049,7 @@ sys_ctime (const time_t *timer)
1049#else 1049#else
1050 time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF; 1050 time_t unix_time = *timer + CW_OR_MPW_UNIX_EPOCH_DIFF;
1051#endif 1051#endif
1052 1052
1053 return ctime (&unix_time); 1053 return ctime (&unix_time);
1054} 1054}
1055 1055
@@ -1067,7 +1067,7 @@ sys_time (time_t *timer)
1067 1067
1068 if (timer) 1068 if (timer)
1069 *timer = mac_time; 1069 *timer = mac_time;
1070 1070
1071 return mac_time; 1071 return mac_time;
1072} 1072}
1073 1073
@@ -1130,23 +1130,23 @@ mktemp (char *template)
1130{ 1130{
1131 int len, k; 1131 int len, k;
1132 static seqnum = 0; 1132 static seqnum = 0;
1133 1133
1134 len = strlen (template); 1134 len = strlen (template);
1135 k = len - 1; 1135 k = len - 1;
1136 while (k >= 0 && template[k] == 'X') 1136 while (k >= 0 && template[k] == 'X')
1137 k--; 1137 k--;
1138 1138
1139 k++; /* make k index of first 'X' */ 1139 k++; /* make k index of first 'X' */
1140 1140
1141 if (k < len) 1141 if (k < len)
1142 { 1142 {
1143 /* Zero filled, number of digits equal to the number of X's. */ 1143 /* Zero filled, number of digits equal to the number of X's. */
1144 sprintf (&template[k], "%0*d", len-k, seqnum++); 1144 sprintf (&template[k], "%0*d", len-k, seqnum++);
1145 1145
1146 return template; 1146 return template;
1147 } 1147 }
1148 else 1148 else
1149 return 0; 1149 return 0;
1150} 1150}
1151 1151
1152 1152
@@ -1157,7 +1157,7 @@ mktemp (char *template)
1157static char my_passwd_name[PASSWD_FIELD_SIZE]; 1157static char my_passwd_name[PASSWD_FIELD_SIZE];
1158static char my_passwd_dir[MAXPATHLEN+1]; 1158static char my_passwd_dir[MAXPATHLEN+1];
1159 1159
1160static struct passwd my_passwd = 1160static struct passwd my_passwd =
1161{ 1161{
1162 my_passwd_name, 1162 my_passwd_name,
1163 my_passwd_dir, 1163 my_passwd_dir,
@@ -1201,7 +1201,7 @@ init_emacs_passwd_dir ()
1201 } 1201 }
1202 } 1202 }
1203 } 1203 }
1204 1204
1205 if (!found) 1205 if (!found)
1206 { 1206 {
1207 /* Setting to "/" probably won't work but set it to something 1207 /* Setting to "/" probably won't work but set it to something
@@ -1212,7 +1212,7 @@ init_emacs_passwd_dir ()
1212} 1212}
1213 1213
1214 1214
1215static struct passwd emacs_passwd = 1215static struct passwd emacs_passwd =
1216{ 1216{
1217 "emacs", 1217 "emacs",
1218 emacs_passwd_dir, 1218 emacs_passwd_dir,
@@ -1248,11 +1248,11 @@ struct passwd *
1248getpwuid (uid_t uid) 1248getpwuid (uid_t uid)
1249{ 1249{
1250 if (!my_passwd_inited) 1250 if (!my_passwd_inited)
1251 { 1251 {
1252 init_my_passwd (); 1252 init_my_passwd ();
1253 my_passwd_inited = 1; 1253 my_passwd_inited = 1;
1254 } 1254 }
1255 1255
1256 return &my_passwd; 1256 return &my_passwd;
1257} 1257}
1258 1258
@@ -1264,11 +1264,11 @@ getpwnam (const char *name)
1264 return &emacs_passwd; 1264 return &emacs_passwd;
1265 1265
1266 if (!my_passwd_inited) 1266 if (!my_passwd_inited)
1267 { 1267 {
1268 init_my_passwd (); 1268 init_my_passwd ();
1269 my_passwd_inited = 1; 1269 my_passwd_inited = 1;
1270 } 1270 }
1271 1271
1272 return &my_passwd; 1272 return &my_passwd;
1273} 1273}
1274 1274
@@ -1310,7 +1310,7 @@ int
1310sigblock (int mask) 1310sigblock (int mask)
1311{ 1311{
1312 return 0; 1312 return 0;
1313} 1313}
1314 1314
1315 1315
1316void 1316void
@@ -1392,7 +1392,7 @@ path_from_vol_dir_name (char *path, int man_path_len, short vol_ref_num,
1392 err = PBGetCatInfo (&cipb, false); 1392 err = PBGetCatInfo (&cipb, false);
1393 if (err != noErr) 1393 if (err != noErr)
1394 return 0; 1394 return 0;
1395 1395
1396 p2cstr (dir_name); 1396 p2cstr (dir_name);
1397 if (strlen (dir_name) + strlen (path) + 1 >= man_path_len) 1397 if (strlen (dir_name) + strlen (path) + 1 >= man_path_len)
1398 return 0; 1398 return 0;
@@ -1404,7 +1404,7 @@ path_from_vol_dir_name (char *path, int man_path_len, short vol_ref_num,
1404 } 1404 }
1405 while (cipb.dirInfo.ioDrDirID != fsRtDirID); 1405 while (cipb.dirInfo.ioDrDirID != fsRtDirID);
1406 /* stop when we see the volume's root directory */ 1406 /* stop when we see the volume's root directory */
1407 1407
1408 return 1; /* success */ 1408 return 1; /* success */
1409} 1409}
1410 1410
@@ -1468,7 +1468,7 @@ find_true_pathname (const char *path, char *buf, int bufsiz)
1468 return -1; 1468 return -1;
1469 1469
1470 buf[0] = '\0'; 1470 buf[0] = '\0';
1471 1471
1472 p = path; 1472 p = path;
1473 if (*p == '/') 1473 if (*p == '/')
1474 q = strchr (p + 1, '/'); 1474 q = strchr (p + 1, '/');
@@ -1492,10 +1492,10 @@ find_true_pathname (const char *path, char *buf, int bufsiz)
1492 p = q + 1; 1492 p = q + 1;
1493 q = strchr(p, '/'); 1493 q = strchr(p, '/');
1494 } 1494 }
1495 1495
1496 if (len + strlen (p) + 1 >= bufsiz) 1496 if (len + strlen (p) + 1 >= bufsiz)
1497 return -1; 1497 return -1;
1498 1498
1499 strcat (buf, p); 1499 strcat (buf, p);
1500 return len + strlen (p); 1500 return len + strlen (p);
1501} 1501}
@@ -1543,7 +1543,7 @@ int
1543dup2 (int oldd, int newd) 1543dup2 (int oldd, int newd)
1544{ 1544{
1545 int fd, ret; 1545 int fd, ret;
1546 1546
1547 close (newd); 1547 close (newd);
1548 1548
1549 fd = dup (oldd); 1549 fd = dup (oldd);
@@ -1654,7 +1654,7 @@ get_temp_dir_name ()
1654 CInfoPBRec cpb; 1654 CInfoPBRec cpb;
1655 char unix_dir_name[MAXPATHLEN+1]; 1655 char unix_dir_name[MAXPATHLEN+1];
1656 DIR *dir; 1656 DIR *dir;
1657 1657
1658 /* Cache directory name with pointer temp_dir_name. 1658 /* Cache directory name with pointer temp_dir_name.
1659 Look for it only the first time. */ 1659 Look for it only the first time. */
1660 if (!temp_dir_name) 1660 if (!temp_dir_name)
@@ -1663,18 +1663,18 @@ get_temp_dir_name ()
1663 &vol_ref_num, &dir_id); 1663 &vol_ref_num, &dir_id);
1664 if (err != noErr) 1664 if (err != noErr)
1665 return NULL; 1665 return NULL;
1666 1666
1667 if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p")) 1667 if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p"))
1668 return NULL; 1668 return NULL;
1669 1669
1670 if (strlen (full_path) + 6 <= MAXPATHLEN) 1670 if (strlen (full_path) + 6 <= MAXPATHLEN)
1671 strcat (full_path, "Emacs:"); 1671 strcat (full_path, "Emacs:");
1672 else 1672 else
1673 return NULL; 1673 return NULL;
1674 1674
1675 if (!mac_to_posix_pathname (full_path, unix_dir_name, MAXPATHLEN+1)) 1675 if (!mac_to_posix_pathname (full_path, unix_dir_name, MAXPATHLEN+1))
1676 return NULL; 1676 return NULL;
1677 1677
1678 dir = opendir (unix_dir_name); /* check whether temp directory exists */ 1678 dir = opendir (unix_dir_name); /* check whether temp directory exists */
1679 if (dir) 1679 if (dir)
1680 closedir (dir); 1680 closedir (dir);
@@ -1693,7 +1693,7 @@ get_temp_dir_name ()
1693/* Allocate and construct an array of pointers to strings from a list 1693/* Allocate and construct an array of pointers to strings from a list
1694 of strings stored in a 'STR#' resource. The returned pointer array 1694 of strings stored in a 'STR#' resource. The returned pointer array
1695 is stored in the style of argv and environ: if the 'STR#' resource 1695 is stored in the style of argv and environ: if the 'STR#' resource
1696 contains numString strings, an pointer array with numString+1 1696 contains numString strings, a pointer array with numString+1
1697 elements is returned in which the last entry contains a null 1697 elements is returned in which the last entry contains a null
1698 pointer. The pointer to the pointer array is passed by pointer in 1698 pointer. The pointer to the pointer array is passed by pointer in
1699 parameter t. The resource ID of the 'STR#' resource is passed in 1699 parameter t. The resource ID of the 'STR#' resource is passed in
@@ -1747,19 +1747,19 @@ get_path_to_system_folder ()
1747 CInfoPBRec cpb; 1747 CInfoPBRec cpb;
1748 static char system_folder_unix_name[MAXPATHLEN+1]; 1748 static char system_folder_unix_name[MAXPATHLEN+1];
1749 DIR *dir; 1749 DIR *dir;
1750 1750
1751 err = FindFolder (kOnSystemDisk, kSystemFolderType, kDontCreateFolder, 1751 err = FindFolder (kOnSystemDisk, kSystemFolderType, kDontCreateFolder,
1752 &vol_ref_num, &dir_id); 1752 &vol_ref_num, &dir_id);
1753 if (err != noErr) 1753 if (err != noErr)
1754 return NULL; 1754 return NULL;
1755 1755
1756 if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p")) 1756 if (!path_from_vol_dir_name (full_path, 255, vol_ref_num, dir_id, "\p"))
1757 return NULL; 1757 return NULL;
1758 1758
1759 if (!mac_to_posix_pathname (full_path, system_folder_unix_name, 1759 if (!mac_to_posix_pathname (full_path, system_folder_unix_name,
1760 MAXPATHLEN+1)) 1760 MAXPATHLEN+1))
1761 return NULL; 1761 return NULL;
1762 1762
1763 return system_folder_unix_name; 1763 return system_folder_unix_name;
1764} 1764}
1765 1765
@@ -1774,7 +1774,7 @@ void
1774init_environ () 1774init_environ ()
1775{ 1775{
1776 int i; 1776 int i;
1777 1777
1778 get_string_list (&environ, ENVIRON_STRING_LIST_ID); 1778 get_string_list (&environ, ENVIRON_STRING_LIST_ID);
1779 1779
1780 i = 0; 1780 i = 0;
@@ -1918,7 +1918,7 @@ mystrchr (char *s, char c)
1918 1918
1919char * 1919char *
1920mystrtok (char *s) 1920mystrtok (char *s)
1921{ 1921{
1922 while (*s) 1922 while (*s)
1923 s++; 1923 s++;
1924 1924
@@ -1974,7 +1974,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
1974 RgnHandle cursor_region_handle; 1974 RgnHandle cursor_region_handle;
1975 TargetID targ; 1975 TargetID targ;
1976 unsigned long ref_con, len; 1976 unsigned long ref_con, len;
1977 1977
1978 if (posix_to_mac_pathname (workdir, macworkdir, MAXPATHLEN+1) == 0) 1978 if (posix_to_mac_pathname (workdir, macworkdir, MAXPATHLEN+1) == 0)
1979 return -1; 1979 return -1;
1980 if (posix_to_mac_pathname (infn, macinfn, MAXPATHLEN+1) == 0) 1980 if (posix_to_mac_pathname (infn, macinfn, MAXPATHLEN+1) == 0)
@@ -1983,7 +1983,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
1983 return -1; 1983 return -1;
1984 if (posix_to_mac_pathname (errfn, macerrfn, MAXPATHLEN+1) == 0) 1984 if (posix_to_mac_pathname (errfn, macerrfn, MAXPATHLEN+1) == 0)
1985 return -1; 1985 return -1;
1986 1986
1987 paramlen = strlen (macworkdir) + strlen (macinfn) + strlen (macoutfn) 1987 paramlen = strlen (macworkdir) + strlen (macinfn) + strlen (macoutfn)
1988 + strlen (macerrfn) + 4; /* count nulls at end of strings */ 1988 + strlen (macerrfn) + 4; /* count nulls at end of strings */
1989 1989
@@ -2002,14 +2002,14 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2002 && argc == 3 && strcmp (argv[1], "-c") == 0) 2002 && argc == 3 && strcmp (argv[1], "-c") == 0)
2003 { 2003 {
2004 char *command, *t, tempmacpathname[MAXPATHLEN+1]; 2004 char *command, *t, tempmacpathname[MAXPATHLEN+1];
2005 2005
2006 /* The arguments for the command in argv[2] are separated by 2006 /* The arguments for the command in argv[2] are separated by
2007 spaces. Count them and put the count in newargc. */ 2007 spaces. Count them and put the count in newargc. */
2008 command = (char *) alloca (strlen (argv[2])+2); 2008 command = (char *) alloca (strlen (argv[2])+2);
2009 strcpy (command, argv[2]); 2009 strcpy (command, argv[2]);
2010 if (command[strlen (command) - 1] != ' ') 2010 if (command[strlen (command) - 1] != ' ')
2011 strcat (command, " "); 2011 strcat (command, " ");
2012 2012
2013 t = command; 2013 t = command;
2014 newargc = 0; 2014 newargc = 0;
2015 t = mystrchr (t, ' '); 2015 t = mystrchr (t, ' ');
@@ -2018,9 +2018,9 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2018 newargc++; 2018 newargc++;
2019 t = mystrchr (t+1, ' '); 2019 t = mystrchr (t+1, ' ');
2020 } 2020 }
2021 2021
2022 newargv = (char **) alloca (sizeof (char *) * newargc); 2022 newargv = (char **) alloca (sizeof (char *) * newargc);
2023 2023
2024 t = command; 2024 t = command;
2025 for (j = 0; j < newargc; j++) 2025 for (j = 0; j < newargc; j++)
2026 { 2026 {
@@ -2030,7 +2030,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2030 t = mystrtok (t); 2030 t = mystrtok (t);
2031 paramlen += strlen (newargv[j]) + 1; 2031 paramlen += strlen (newargv[j]) + 1;
2032 } 2032 }
2033 2033
2034 if (strncmp (newargv[0], "~emacs/", 7) == 0) 2034 if (strncmp (newargv[0], "~emacs/", 7) == 0)
2035 { 2035 {
2036 if (posix_to_mac_pathname (newargv[0], tempmacpathname, MAXPATHLEN+1) 2036 if (posix_to_mac_pathname (newargv[0], tempmacpathname, MAXPATHLEN+1)
@@ -2057,12 +2057,12 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2057 strcpy (macappname, tempmacpathname); 2057 strcpy (macappname, tempmacpathname);
2058 } 2058 }
2059 else 2059 else
2060 { 2060 {
2061 if (posix_to_mac_pathname (argv[0], macappname, MAXPATHLEN+1) == 0) 2061 if (posix_to_mac_pathname (argv[0], macappname, MAXPATHLEN+1) == 0)
2062 return -1; 2062 return -1;
2063 2063
2064 newargv = (char **) alloca (sizeof (char *) * argc); 2064 newargv = (char **) alloca (sizeof (char *) * argc);
2065 newargc = argc; 2065 newargc = argc;
2066 for (j = 1; j < argc; j++) 2066 for (j = 1; j < argc; j++)
2067 { 2067 {
2068 if (strncmp (argv[j], "~emacs/", 7) == 0) 2068 if (strncmp (argv[j], "~emacs/", 7) == 0)
@@ -2092,7 +2092,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2092 } 2092 }
2093 } 2093 }
2094 else 2094 else
2095 newargv[j] = argv[j]; 2095 newargv[j] = argv[j];
2096 paramlen += strlen (newargv[j]) + 1; 2096 paramlen += strlen (newargv[j]) + 1;
2097 } 2097 }
2098 } 2098 }
@@ -2113,24 +2113,24 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2113 /* null terminate strings sent so it's possible to use strcpy over there */ 2113 /* null terminate strings sent so it's possible to use strcpy over there */
2114 strcpy (p, macinfn); 2114 strcpy (p, macinfn);
2115 p += strlen (macinfn); 2115 p += strlen (macinfn);
2116 *p++ = '\0'; 2116 *p++ = '\0';
2117 strcpy (p, macoutfn); 2117 strcpy (p, macoutfn);
2118 p += strlen (macoutfn); 2118 p += strlen (macoutfn);
2119 *p++ = '\0'; 2119 *p++ = '\0';
2120 strcpy (p, macerrfn); 2120 strcpy (p, macerrfn);
2121 p += strlen (macerrfn); 2121 p += strlen (macerrfn);
2122 *p++ = '\0'; 2122 *p++ = '\0';
2123 for (j = 1; j < newargc; j++) 2123 for (j = 1; j < newargc; j++)
2124 { 2124 {
2125 strcpy (p, newargv[j]); 2125 strcpy (p, newargv[j]);
2126 p += strlen (newargv[j]); 2126 p += strlen (newargv[j]);
2127 *p++ = '\0'; 2127 *p++ = '\0';
2128 } 2128 }
2129 2129
2130 c2pstr (macappname); 2130 c2pstr (macappname);
2131 2131
2132 iErr = FSMakeFSSpec (0, 0, macappname, &spec); 2132 iErr = FSMakeFSSpec (0, 0, macappname, &spec);
2133 2133
2134 if (iErr != noErr) 2134 if (iErr != noErr)
2135 { 2135 {
2136 free (param); 2136 free (param);
@@ -2171,7 +2171,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2171 } 2171 }
2172 2172
2173 cursor_region_handle = NewRgn (); 2173 cursor_region_handle = NewRgn ();
2174 2174
2175 /* Wait for the subprocess to finish, when it will send us a ERPY 2175 /* Wait for the subprocess to finish, when it will send us a ERPY
2176 high level event. */ 2176 high level event. */
2177 while (1) 2177 while (1)
@@ -2179,7 +2179,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2179 cursor_region_handle) 2179 cursor_region_handle)
2180 && reply_event.message == kEmacsSubprocessReply) 2180 && reply_event.message == kEmacsSubprocessReply)
2181 break; 2181 break;
2182 2182
2183 /* The return code is sent through the refCon */ 2183 /* The return code is sent through the refCon */
2184 iErr = AcceptHighLevelEvent (&targ, &ref_con, NULL, &len); 2184 iErr = AcceptHighLevelEvent (&targ, &ref_con, NULL, &len);
2185 if (iErr != noErr) 2185 if (iErr != noErr)
@@ -2188,7 +2188,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2188 free (param); 2188 free (param);
2189 return -1; 2189 return -1;
2190 } 2190 }
2191 2191
2192 DisposeHandle ((Handle) cursor_region_handle); 2192 DisposeHandle ((Handle) cursor_region_handle);
2193 free (param); 2193 free (param);
2194 2194
@@ -2200,16 +2200,16 @@ run_mac_command (argv, workdir, infn, outfn, errfn)
2200DIR * 2200DIR *
2201opendir (const char *dirname) 2201opendir (const char *dirname)
2202{ 2202{
2203 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1]; 2203 char true_pathname[MAXPATHLEN+1], fully_resolved_name[MAXPATHLEN+1];
2204 char mac_pathname[MAXPATHLEN+1], vol_name[MAXPATHLEN+1]; 2204 char mac_pathname[MAXPATHLEN+1], vol_name[MAXPATHLEN+1];
2205 DIR *dirp; 2205 DIR *dirp;
2206 CInfoPBRec cipb; 2206 CInfoPBRec cipb;
2207 HVolumeParam vpb; 2207 HVolumeParam vpb;
2208 int len, vol_name_len; 2208 int len, vol_name_len;
2209 2209
2210 if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1) 2210 if (find_true_pathname (dirname, true_pathname, MAXPATHLEN+1) == -1)
2211 return 0; 2211 return 0;
2212 2212
2213 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN); 2213 len = readlink (true_pathname, fully_resolved_name, MAXPATHLEN);
2214 if (len > -1) 2214 if (len > -1)
2215 fully_resolved_name[len] = '\0'; 2215 fully_resolved_name[len] = '\0';
@@ -2237,7 +2237,7 @@ opendir (const char *dirname)
2237 len = strlen (mac_pathname); 2237 len = strlen (mac_pathname);
2238 if (mac_pathname[len - 1] != ':' && len < MAXPATHLEN) 2238 if (mac_pathname[len - 1] != ':' && len < MAXPATHLEN)
2239 strcat (mac_pathname, ":"); 2239 strcat (mac_pathname, ":");
2240 2240
2241 /* Extract volume name */ 2241 /* Extract volume name */
2242 vol_name_len = strchr (mac_pathname, ':') - mac_pathname; 2242 vol_name_len = strchr (mac_pathname, ':') - mac_pathname;
2243 strncpy (vol_name, mac_pathname, vol_name_len); 2243 strncpy (vol_name, mac_pathname, vol_name_len);
@@ -2251,7 +2251,7 @@ opendir (const char *dirname)
2251 cipb.hFileInfo.ioDirID = 0; 2251 cipb.hFileInfo.ioDirID = 0;
2252 cipb.hFileInfo.ioFDirIndex = 0; 2252 cipb.hFileInfo.ioFDirIndex = 0;
2253 /* set to 0 to get information about specific dir or file */ 2253 /* set to 0 to get information about specific dir or file */
2254 2254
2255 errno = PBGetCatInfo (&cipb, false); 2255 errno = PBGetCatInfo (&cipb, false);
2256 if (errno != noErr) 2256 if (errno != noErr)
2257 { 2257 {
@@ -2279,7 +2279,7 @@ opendir (const char *dirname)
2279 } 2279 }
2280 2280
2281 dirp->vol_ref_num = vpb.ioVRefNum; 2281 dirp->vol_ref_num = vpb.ioVRefNum;
2282 2282
2283 return dirp; 2283 return dirp;
2284} 2284}
2285 2285
@@ -2312,14 +2312,14 @@ readdir (DIR *dp)
2312 hpblock.volumeParam.ioNamePtr = s_name; 2312 hpblock.volumeParam.ioNamePtr = s_name;
2313 hpblock.volumeParam.ioVRefNum = 0; 2313 hpblock.volumeParam.ioVRefNum = 0;
2314 hpblock.volumeParam.ioVolIndex = dp->current_index; 2314 hpblock.volumeParam.ioVolIndex = dp->current_index;
2315 2315
2316 errno = PBHGetVInfo (&hpblock, false); 2316 errno = PBHGetVInfo (&hpblock, false);
2317 if (errno != noErr) 2317 if (errno != noErr)
2318 { 2318 {
2319 errno = ENOENT; 2319 errno = ENOENT;
2320 return 0; 2320 return 0;
2321 } 2321 }
2322 2322
2323 p2cstr (s_name); 2323 p2cstr (s_name);
2324 strcat (s_name, "/"); /* need "/" for stat to work correctly */ 2324 strcat (s_name, "/"); /* need "/" for stat to work correctly */
2325 2325
@@ -2327,7 +2327,7 @@ readdir (DIR *dp)
2327 2327
2328 s_dirent.d_ino = hpblock.volumeParam.ioVRefNum; 2328 s_dirent.d_ino = hpblock.volumeParam.ioVRefNum;
2329 s_dirent.d_name = s_name; 2329 s_dirent.d_name = s_name;
2330 2330
2331 return &s_dirent; 2331 return &s_dirent;
2332 } 2332 }
2333 else 2333 else
@@ -2343,25 +2343,25 @@ readdir (DIR *dp)
2343 cipb.hFileInfo.ioDirID = dp->dir_id; 2343 cipb.hFileInfo.ioDirID = dp->dir_id;
2344 /* directory ID found by opendir */ 2344 /* directory ID found by opendir */
2345 cipb.hFileInfo.ioFDirIndex = dp->current_index; 2345 cipb.hFileInfo.ioFDirIndex = dp->current_index;
2346 2346
2347 errno = PBGetCatInfo (&cipb, false); 2347 errno = PBGetCatInfo (&cipb, false);
2348 if (errno != noErr) 2348 if (errno != noErr)
2349 { 2349 {
2350 errno = ENOENT; 2350 errno = ENOENT;
2351 return 0; 2351 return 0;
2352 } 2352 }
2353 2353
2354 /* insist on an visibile entry */ 2354 /* insist on a visible entry */
2355 if (cipb.hFileInfo.ioFlAttrib & 0x10) /* directory? */ 2355 if (cipb.hFileInfo.ioFlAttrib & 0x10) /* directory? */
2356 done = !(cipb.dirInfo.ioDrUsrWds.frFlags & fInvisible); 2356 done = !(cipb.dirInfo.ioDrUsrWds.frFlags & fInvisible);
2357 else 2357 else
2358 done = !(cipb.hFileInfo.ioFlFndrInfo.fdFlags & fInvisible); 2358 done = !(cipb.hFileInfo.ioFlFndrInfo.fdFlags & fInvisible);
2359 2359
2360 dp->current_index++; 2360 dp->current_index++;
2361 } 2361 }
2362 2362
2363 p2cstr (s_name); 2363 p2cstr (s_name);
2364 2364
2365 p = s_name; 2365 p = s_name;
2366 while (*p) 2366 while (*p)
2367 { 2367 {
@@ -2373,7 +2373,7 @@ readdir (DIR *dp)
2373 s_dirent.d_ino = cipb.dirInfo.ioDrDirID; 2373 s_dirent.d_ino = cipb.dirInfo.ioDrDirID;
2374 /* value unimportant: non-zero for valid file */ 2374 /* value unimportant: non-zero for valid file */
2375 s_dirent.d_name = s_name; 2375 s_dirent.d_name = s_name;
2376 2376
2377 return &s_dirent; 2377 return &s_dirent;
2378 } 2378 }
2379} 2379}
@@ -2404,7 +2404,7 @@ initialize_applescript ()
2404{ 2404{
2405 AEDesc null_desc; 2405 AEDesc null_desc;
2406 OSAError osaerror; 2406 OSAError osaerror;
2407 2407
2408 /* if open fails, as_scripting_component is set to NULL. Its 2408 /* if open fails, as_scripting_component is set to NULL. Its
2409 subsequent use in OSA calls will fail with badComponentInstance 2409 subsequent use in OSA calls will fail with badComponentInstance
2410 error. */ 2410 error. */
@@ -2530,7 +2530,7 @@ component. */)
2530 long status; 2530 long status;
2531 2531
2532 CHECK_STRING (script); 2532 CHECK_STRING (script);
2533 2533
2534 status = do_applescript (SDATA (script), &result); 2534 status = do_applescript (SDATA (script), &result);
2535 if (status) 2535 if (status)
2536 { 2536 {
@@ -2567,7 +2567,7 @@ DEFUN ("mac-file-name-to-posix", Fmac_file_name_to_posix,
2567 char posix_filename[MAXPATHLEN+1]; 2567 char posix_filename[MAXPATHLEN+1];
2568 2568
2569 CHECK_STRING (mac_filename); 2569 CHECK_STRING (mac_filename);
2570 2570
2571 if (mac_to_posix_pathname (SDATA (mac_filename), posix_filename, 2571 if (mac_to_posix_pathname (SDATA (mac_filename), posix_filename,
2572 MAXPATHLEN)) 2572 MAXPATHLEN))
2573 return build_string (posix_filename); 2573 return build_string (posix_filename);
@@ -2585,7 +2585,7 @@ DEFUN ("posix-file-name-to-mac", Fposix_file_name_to_mac,
2585 char mac_filename[MAXPATHLEN+1]; 2585 char mac_filename[MAXPATHLEN+1];
2586 2586
2587 CHECK_STRING (posix_filename); 2587 CHECK_STRING (posix_filename);
2588 2588
2589 if (posix_to_mac_pathname (SDATA (posix_filename), mac_filename, 2589 if (posix_to_mac_pathname (SDATA (posix_filename), mac_filename,
2590 MAXPATHLEN)) 2590 MAXPATHLEN))
2591 return build_string (mac_filename); 2591 return build_string (mac_filename);
@@ -2622,7 +2622,7 @@ DEFUN ("mac-paste-function", Fmac_paste_function, Smac_paste_function, 0, 0, 0,
2622 if (GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data) != noErr 2622 if (GetScrapFlavorData (scrap, kScrapFlavorTypeText, &s, data) != noErr
2623 || s == 0) 2623 || s == 0)
2624 return Qnil; 2624 return Qnil;
2625 2625
2626 /* Emacs expects clipboard contents have Unix-style eol's */ 2626 /* Emacs expects clipboard contents have Unix-style eol's */
2627 for (i = 0; i < s; i++) 2627 for (i = 0; i < s; i++)
2628 if (data[i] == '\r') 2628 if (data[i] == '\r')
@@ -2650,7 +2650,7 @@ DEFUN ("mac-paste-function", Fmac_paste_function, Smac_paste_function, 0, 0, 0,
2650 value = make_string (*my_handle, rc); 2650 value = make_string (*my_handle, rc);
2651 2651
2652 HUnlock (my_handle); 2652 HUnlock (my_handle);
2653 2653
2654 DisposeHandle (my_handle); 2654 DisposeHandle (my_handle);
2655 2655
2656 return value; 2656 return value;
@@ -2671,12 +2671,12 @@ DEFUN ("mac-cut-function", Fmac_cut_function, Smac_cut_function, 1, 2, 0,
2671 /* fixme: ignore the push flag for now */ 2671 /* fixme: ignore the push flag for now */
2672 2672
2673 CHECK_STRING (value); 2673 CHECK_STRING (value);
2674 2674
2675 len = SCHARS (value); 2675 len = SCHARS (value);
2676 buf = (char *) alloca (len+1); 2676 buf = (char *) alloca (len+1);
2677 bcopy (SDATA (value), buf, len); 2677 bcopy (SDATA (value), buf, len);
2678 buf[len] = '\0'; 2678 buf[len] = '\0';
2679 2679
2680 /* convert to Mac-style eol's before sending to clipboard */ 2680 /* convert to Mac-style eol's before sending to clipboard */
2681 for (i = 0; i < len; i++) 2681 for (i = 0; i < len; i++)
2682 if (buf[i] == '\n') 2682 if (buf[i] == '\n')
@@ -2697,7 +2697,7 @@ DEFUN ("mac-cut-function", Fmac_cut_function, Smac_cut_function, 1, 2, 0,
2697 ZeroScrap (); 2697 ZeroScrap ();
2698 PutScrap (len, 'TEXT', buf); 2698 PutScrap (len, 'TEXT', buf);
2699#endif /* not TARGET_API_MAC_CARBON */ 2699#endif /* not TARGET_API_MAC_CARBON */
2700 2700
2701 return Qnil; 2701 return Qnil;
2702} 2702}
2703 2703
@@ -2911,7 +2911,7 @@ syms_of_mac ()
2911{ 2911{
2912 QCLIPBOARD = intern ("CLIPBOARD"); 2912 QCLIPBOARD = intern ("CLIPBOARD");
2913 staticpro (&QCLIPBOARD); 2913 staticpro (&QCLIPBOARD);
2914 2914
2915 defsubr (&Smac_paste_function); 2915 defsubr (&Smac_paste_function);
2916 defsubr (&Smac_cut_function); 2916 defsubr (&Smac_cut_function);
2917 defsubr (&Sx_selection_exists_p); 2917 defsubr (&Sx_selection_exists_p);
diff --git a/src/macfns.c b/src/macfns.c
index f1e42d17aec..44bbb3130e2 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -326,7 +326,7 @@ check_x_frame (frame)
326 return f; 326 return f;
327} 327}
328 328
329/* Let the user specify an display with a frame. 329/* Let the user specify a display with a frame.
330 nil stands for the selected frame--or, if that is not a mac frame, 330 nil stands for the selected frame--or, if that is not a mac frame,
331 the first display on the list. */ 331 the first display on the list. */
332 332
@@ -363,7 +363,7 @@ check_x_display_info (frame)
363 } 363 }
364} 364}
365 365
366/* Return the Emacs frame-object corresponding to an mac window. 366/* Return the Emacs frame-object corresponding to a mac window.
367 It could be the frame's main window or an icon window. */ 367 It could be the frame's main window or an icon window. */
368 368
369/* This function can be called during GC, so use GC_xxx type test macros. */ 369/* This function can be called during GC, so use GC_xxx type test macros. */
@@ -1969,7 +1969,7 @@ x_to_mac_color (colorname)
1969 if (value < 0.0 || value > 1.0) 1969 if (value < 0.0 || value > 1.0)
1970 break; 1970 break;
1971 val = (unsigned long)(0x100 * value); 1971 val = (unsigned long)(0x100 * value);
1972 /* We used 0x100 instead of 0xFF to give an continuous 1972 /* We used 0x100 instead of 0xFF to give a continuous
1973 range between 0.0 and 1.0 inclusive. The next statement 1973 range between 0.0 and 1.0 inclusive. The next statement
1974 fixes the 1.0 case. */ 1974 fixes the 1.0 case. */
1975 if (val == 0x100) 1975 if (val == 0x100)
@@ -2355,7 +2355,7 @@ x_set_cursor_color (f, arg, oldval)
2355 2355
2356/* Set the border-color of frame F to pixel value PIX. 2356/* Set the border-color of frame F to pixel value PIX.
2357 Note that this does not fully take effect if done before 2357 Note that this does not fully take effect if done before
2358 F has an window. */ 2358 F has a window. */
2359void 2359void
2360x_set_border_pixel (f, pix) 2360x_set_border_pixel (f, pix)
2361 struct frame *f; 2361 struct frame *f;
@@ -3011,7 +3011,7 @@ x_set_scroll_bar_width (f, arg, oldval)
3011 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0; 3011 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0;
3012} 3012}
3013 3013
3014/* Subroutines of creating an frame. */ 3014/* Subroutines of creating a frame. */
3015 3015
3016/* Make sure that Vx_resource_name is set to a reasonable value. 3016/* Make sure that Vx_resource_name is set to a reasonable value.
3017 Fix it up, or set it to `emacs' if it is too hopeless. */ 3017 Fix it up, or set it to `emacs' if it is too hopeless. */
@@ -9471,7 +9471,7 @@ x_create_tip_frame (dpyinfo, parms)
9471 f->height = 0; 9471 f->height = 0;
9472 SET_FRAME_WIDTH (f, 0); 9472 SET_FRAME_WIDTH (f, 0);
9473 change_frame_size (f, height, width, 1, 0, 0); 9473 change_frame_size (f, height, width, 1, 0, 0);
9474 9474
9475 /* Add `tooltip' frame parameter's default value. */ 9475 /* Add `tooltip' frame parameter's default value. */
9476 if (NILP (Fframe_parameter (frame, intern ("tooltip")))) 9476 if (NILP (Fframe_parameter (frame, intern ("tooltip"))))
9477 Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt), 9477 Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt),
diff --git a/src/syntax.c b/src/syntax.c
index 0f2cda592aa..f7b45cd6acc 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -199,7 +199,7 @@ update_syntax_table (charpos, count, init, object)
199 199
200 if (invalidate) 200 if (invalidate)
201 invalidate = !EQ (tmp_table, gl_state.old_prop); /* Need to invalidate? */ 201 invalidate = !EQ (tmp_table, gl_state.old_prop); /* Need to invalidate? */
202 202
203 if (invalidate) /* Did not get to adjacent interval. */ 203 if (invalidate) /* Did not get to adjacent interval. */
204 { /* with the same table => */ 204 { /* with the same table => */
205 /* invalidate the old range. */ 205 /* invalidate the old range. */
@@ -222,13 +222,13 @@ update_syntax_table (charpos, count, init, object)
222 if (EQ (Fsyntax_table_p (tmp_table), Qt)) 222 if (EQ (Fsyntax_table_p (tmp_table), Qt))
223 { 223 {
224 gl_state.use_global = 0; 224 gl_state.use_global = 0;
225 } 225 }
226 else if (CONSP (tmp_table)) 226 else if (CONSP (tmp_table))
227 { 227 {
228 gl_state.use_global = 1; 228 gl_state.use_global = 1;
229 gl_state.global_code = tmp_table; 229 gl_state.global_code = tmp_table;
230 } 230 }
231 else 231 else
232 { 232 {
233 gl_state.use_global = 0; 233 gl_state.use_global = 0;
234 gl_state.current_syntax_table = current_buffer->syntax_table; 234 gl_state.current_syntax_table = current_buffer->syntax_table;
@@ -251,7 +251,7 @@ update_syntax_table (charpos, count, init, object)
251 } 251 }
252 return; 252 return;
253 } 253 }
254 else if (cnt == INTERVALS_AT_ONCE) 254 else if (cnt == INTERVALS_AT_ONCE)
255 { 255 {
256 if (count > 0) 256 if (count > 0)
257 { 257 {
@@ -428,7 +428,7 @@ prev_char_comend_first (pos, pos_byte)
428 * int pos, pos_byte; 428 * int pos, pos_byte;
429 * { 429 * {
430 * int c, val; 430 * int c, val;
431 * 431 *
432 * DEC_BOTH (pos, pos_byte); 432 * DEC_BOTH (pos, pos_byte);
433 * UPDATE_SYNTAX_TABLE_BACKWARD (pos); 433 * UPDATE_SYNTAX_TABLE_BACKWARD (pos);
434 * c = FETCH_CHAR (pos_byte); 434 * c = FETCH_CHAR (pos_byte);
@@ -468,7 +468,7 @@ back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_p
468 int string_style = -1; /* Presumed outside of any string. */ 468 int string_style = -1; /* Presumed outside of any string. */
469 int string_lossage = 0; 469 int string_lossage = 0;
470 /* Not a real lossage: indicates that we have passed a matching comment 470 /* Not a real lossage: indicates that we have passed a matching comment
471 starter plus an non-matching comment-ender, meaning that any matching 471 starter plus a non-matching comment-ender, meaning that any matching
472 comment-starter we might see later could be a false positive (hidden 472 comment-starter we might see later could be a false positive (hidden
473 inside another comment). 473 inside another comment).
474 Test case: { a (* b } c (* d *) */ 474 Test case: { a (* b } c (* d *) */
@@ -584,7 +584,7 @@ back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_p
584 There's no way to grok this scanning backwards. */ 584 There's no way to grok this scanning backwards. */
585 string_lossage = 1; 585 string_lossage = 1;
586 break; 586 break;
587 587
588 case Scomment: 588 case Scomment:
589 /* We've already checked that it is the relevant comstyle. */ 589 /* We've already checked that it is the relevant comstyle. */
590 if (string_style != -1 || comment_lossage || string_lossage) 590 if (string_style != -1 || comment_lossage || string_lossage)
@@ -705,7 +705,7 @@ back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_p
705 from_byte = CHAR_TO_BYTE (from); 705 from_byte = CHAR_TO_BYTE (from);
706 UPDATE_SYNTAX_TABLE_FORWARD (from - 1); 706 UPDATE_SYNTAX_TABLE_FORWARD (from - 1);
707 } 707 }
708 708
709 done: 709 done:
710 *charpos_ptr = from; 710 *charpos_ptr = from;
711 *bytepos_ptr = from_byte; 711 *bytepos_ptr = from_byte;
@@ -732,7 +732,7 @@ check_syntax_table (obj)
732 if (!(CHAR_TABLE_P (obj) 732 if (!(CHAR_TABLE_P (obj)
733 && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table))) 733 && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table)))
734 wrong_type_argument (Qsyntax_table_p, obj); 734 wrong_type_argument (Qsyntax_table_p, obj);
735} 735}
736 736
737DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0, 737DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0,
738 doc: /* Return the current syntax table. 738 doc: /* Return the current syntax table.
@@ -961,7 +961,7 @@ text property. */)
961 val |= 1 << 22; 961 val |= 1 << 22;
962 break; 962 break;
963 } 963 }
964 964
965 if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match)) 965 if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match))
966 return XVECTOR (Vsyntax_code_object)->contents[val]; 966 return XVECTOR (Vsyntax_code_object)->contents[val];
967 else 967 else
@@ -971,7 +971,7 @@ text property. */)
971 971
972/* I really don't know why this is interactive 972/* I really don't know why this is interactive
973 help-form should at least be made useful whilst reading the second arg. */ 973 help-form should at least be made useful whilst reading the second arg. */
974DEFUN ("modify-syntax-entry", Fmodify_syntax_entry, Smodify_syntax_entry, 2, 3, 974DEFUN ("modify-syntax-entry", Fmodify_syntax_entry, Smodify_syntax_entry, 2, 3,
975 "cSet syntax for character: \nsSet syntax for %s to: ", 975 "cSet syntax for character: \nsSet syntax for %s to: ",
976 doc: /* Set syntax for character CHAR according to string NEWENTRY. 976 doc: /* Set syntax for character CHAR according to string NEWENTRY.
977The syntax is changed only for table SYNTAX_TABLE, which defaults to 977The syntax is changed only for table SYNTAX_TABLE, which defaults to
@@ -1293,7 +1293,7 @@ and the function returns nil. Field boundaries are not noticed if
1293 /* Avoid jumping out of an input field. */ 1293 /* Avoid jumping out of an input field. */
1294 val = XFASTINT (Fconstrain_to_field (make_number (val), make_number (PT), 1294 val = XFASTINT (Fconstrain_to_field (make_number (val), make_number (PT),
1295 Qt, Qnil, Qnil)); 1295 Qt, Qnil, Qnil));
1296 1296
1297 SET_PT (val); 1297 SET_PT (val);
1298 return val == orig_val ? Qt : Qnil; 1298 return val == orig_val ? Qt : Qnil;
1299} 1299}
@@ -1729,7 +1729,7 @@ forw_comment (from, from_byte, stop, nesting, style, prev_syntax,
1729 nesting++; 1729 nesting++;
1730 INC_BOTH (from, from_byte); 1730 INC_BOTH (from, from_byte);
1731 UPDATE_SYNTAX_TABLE_FORWARD (from); 1731 UPDATE_SYNTAX_TABLE_FORWARD (from);
1732 1732
1733 forw_incomment: 1733 forw_incomment:
1734 if (from < stop && SYNTAX_FLAGS_COMEND_FIRST (syntax) 1734 if (from < stop && SYNTAX_FLAGS_COMEND_FIRST (syntax)
1735 && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style 1735 && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style
@@ -1826,7 +1826,7 @@ between them, return t; otherwise return nil. */)
1826 && (c1 = FETCH_CHAR (from_byte), 1826 && (c1 = FETCH_CHAR (from_byte),
1827 SYNTAX_COMSTART_SECOND (c1))) 1827 SYNTAX_COMSTART_SECOND (c1)))
1828 { 1828 {
1829 /* We have encountered a comment start sequence and we 1829 /* We have encountered a comment start sequence and we
1830 are ignoring all text inside comments. We must record 1830 are ignoring all text inside comments. We must record
1831 the comment style this sequence begins so that later, 1831 the comment style this sequence begins so that later,
1832 only a comment end of the same style actually ends 1832 only a comment end of the same style actually ends
@@ -1907,7 +1907,7 @@ between them, return t; otherwise return nil. */)
1907 { 1907 {
1908 /* Skip until first preceding unquoted comment_fence. */ 1908 /* Skip until first preceding unquoted comment_fence. */
1909 int found = 0, ini = from, ini_byte = from_byte; 1909 int found = 0, ini = from, ini_byte = from_byte;
1910 1910
1911 while (1) 1911 while (1)
1912 { 1912 {
1913 DEC_BOTH (from, from_byte); 1913 DEC_BOTH (from, from_byte);
@@ -1916,9 +1916,9 @@ between them, return t; otherwise return nil. */)
1916 UPDATE_SYNTAX_TABLE_BACKWARD (from); 1916 UPDATE_SYNTAX_TABLE_BACKWARD (from);
1917 c = FETCH_CHAR (from_byte); 1917 c = FETCH_CHAR (from_byte);
1918 if (SYNTAX (c) == Scomment_fence 1918 if (SYNTAX (c) == Scomment_fence
1919 && !char_quoted (from, from_byte)) 1919 && !char_quoted (from, from_byte))
1920 { 1920 {
1921 found = 1; 1921 found = 1;
1922 break; 1922 break;
1923 } 1923 }
1924 } 1924 }
@@ -2036,7 +2036,7 @@ scan_lists (from, count, depth, sexpflag)
2036 && SYNTAX_COMSTART_SECOND (FETCH_CHAR (from_byte)) 2036 && SYNTAX_COMSTART_SECOND (FETCH_CHAR (from_byte))
2037 && parse_sexp_ignore_comments) 2037 && parse_sexp_ignore_comments)
2038 { 2038 {
2039 /* we have encountered a comment start sequence and we 2039 /* we have encountered a comment start sequence and we
2040 are ignoring all text inside comments. We must record 2040 are ignoring all text inside comments. We must record
2041 the comment style this sequence begins so that later, 2041 the comment style this sequence begins so that later,
2042 only a comment end of the same style actually ends 2042 only a comment end of the same style actually ends
@@ -2048,7 +2048,7 @@ scan_lists (from, count, depth, sexpflag)
2048 INC_BOTH (from, from_byte); 2048 INC_BOTH (from, from_byte);
2049 UPDATE_SYNTAX_TABLE_FORWARD (from); 2049 UPDATE_SYNTAX_TABLE_FORWARD (from);
2050 } 2050 }
2051 2051
2052 if (prefix) 2052 if (prefix)
2053 continue; 2053 continue;
2054 2054
@@ -2209,7 +2209,7 @@ scan_lists (from, count, depth, sexpflag)
2209 comstyle = SYNTAX_COMMENT_STYLE (c1); 2209 comstyle = SYNTAX_COMMENT_STYLE (c1);
2210 comnested = comnested || SYNTAX_COMMENT_NESTED (c1); 2210 comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
2211 } 2211 }
2212 2212
2213 /* Quoting turns anything except a comment-ender 2213 /* Quoting turns anything except a comment-ender
2214 into a word character. Note that this cannot be true 2214 into a word character. Note that this cannot be true
2215 if we decremented FROM in the if-statement above. */ 2215 if we decremented FROM in the if-statement above. */
@@ -2310,14 +2310,14 @@ scan_lists (from, count, depth, sexpflag)
2310 DEC_BOTH (from, from_byte); 2310 DEC_BOTH (from, from_byte);
2311 if (from == stop) goto lose; 2311 if (from == stop) goto lose;
2312 UPDATE_SYNTAX_TABLE_BACKWARD (from); 2312 UPDATE_SYNTAX_TABLE_BACKWARD (from);
2313 if (!char_quoted (from, from_byte) 2313 if (!char_quoted (from, from_byte)
2314 && (c = FETCH_CHAR (from_byte), 2314 && (c = FETCH_CHAR (from_byte),
2315 SYNTAX_WITH_MULTIBYTE_CHECK (c) == code)) 2315 SYNTAX_WITH_MULTIBYTE_CHECK (c) == code))
2316 break; 2316 break;
2317 } 2317 }
2318 if (code == Sstring_fence && !depth && sexpflag) goto done2; 2318 if (code == Sstring_fence && !depth && sexpflag) goto done2;
2319 break; 2319 break;
2320 2320
2321 case Sstring: 2321 case Sstring:
2322 stringterm = FETCH_CHAR (from_byte); 2322 stringterm = FETCH_CHAR (from_byte);
2323 while (1) 2323 while (1)
@@ -2425,7 +2425,7 @@ This includes chars with "quote" or "prefix" syntax (' or p). */)
2425 int pos_byte = PT_BYTE; 2425 int pos_byte = PT_BYTE;
2426 int c; 2426 int c;
2427 2427
2428 if (pos <= beg) 2428 if (pos <= beg)
2429 { 2429 {
2430 SET_PT_BOTH (opoint, opoint_byte); 2430 SET_PT_BOTH (opoint, opoint_byte);
2431 2431
@@ -2533,8 +2533,8 @@ do { prev_from = from; \
2533 oldstate = Fcdr (oldstate); 2533 oldstate = Fcdr (oldstate);
2534 tem = Fcar (oldstate); 2534 tem = Fcar (oldstate);
2535 /* Check whether we are inside string_fence-style string: */ 2535 /* Check whether we are inside string_fence-style string: */
2536 state.instring = (!NILP (tem) 2536 state.instring = (!NILP (tem)
2537 ? (INTEGERP (tem) ? XINT (tem) : ST_STRING_STYLE) 2537 ? (INTEGERP (tem) ? XINT (tem) : ST_STRING_STYLE)
2538 : -1); 2538 : -1);
2539 2539
2540 oldstate = Fcdr (oldstate); 2540 oldstate = Fcdr (oldstate);
@@ -2552,7 +2552,7 @@ do { prev_from = from; \
2552 oldstate = Fcdr (oldstate); 2552 oldstate = Fcdr (oldstate);
2553 oldstate = Fcdr (oldstate); 2553 oldstate = Fcdr (oldstate);
2554 tem = Fcar (oldstate); 2554 tem = Fcar (oldstate);
2555 state.comstyle = NILP (tem) ? 0 : (EQ (tem, Qsyntax_table) 2555 state.comstyle = NILP (tem) ? 0 : (EQ (tem, Qsyntax_table)
2556 ? ST_COMMENT_STYLE : 1); 2556 ? ST_COMMENT_STYLE : 1);
2557 2557
2558 oldstate = Fcdr (oldstate); 2558 oldstate = Fcdr (oldstate);
@@ -2735,14 +2735,14 @@ do { prev_from = from; \
2735 state.comstr_start = from - 1; 2735 state.comstr_start = from - 1;
2736 if (stopbefore) goto stop; /* this arg means stop at sexp start */ 2736 if (stopbefore) goto stop; /* this arg means stop at sexp start */
2737 curlevel->last = prev_from; 2737 curlevel->last = prev_from;
2738 state.instring = (code == Sstring 2738 state.instring = (code == Sstring
2739 ? (FETCH_CHAR (prev_from_byte)) 2739 ? (FETCH_CHAR (prev_from_byte))
2740 : ST_STRING_STYLE); 2740 : ST_STRING_STYLE);
2741 if (boundary_stop) goto done; 2741 if (boundary_stop) goto done;
2742 startinstring: 2742 startinstring:
2743 { 2743 {
2744 nofence = state.instring != ST_STRING_STYLE; 2744 nofence = state.instring != ST_STRING_STYLE;
2745 2745
2746 while (1) 2746 while (1)
2747 { 2747 {
2748 int c; 2748 int c;
@@ -2824,7 +2824,7 @@ Value is a list of ten elements describing final state of parsing:
2824 3. non-nil if inside a string. 2824 3. non-nil if inside a string.
2825 (it is the character that will terminate the string, 2825 (it is the character that will terminate the string,
2826 or t if the string should be terminated by a generic string delimiter.) 2826 or t if the string should be terminated by a generic string delimiter.)
2827 4. nil if outside a comment, t if inside a non-nestable comment, 2827 4. nil if outside a comment, t if inside a non-nestable comment,
2828 else an integer (the current comment nesting). 2828 else an integer (the current comment nesting).
2829 5. t if following a quote character. 2829 5. t if following a quote character.
2830 6. the minimum paren-depth encountered during this scan. 2830 6. the minimum paren-depth encountered during this scan.
@@ -2860,23 +2860,23 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
2860 scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)), 2860 scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)),
2861 XINT (to), 2861 XINT (to),
2862 target, !NILP (stopbefore), oldstate, 2862 target, !NILP (stopbefore), oldstate,
2863 (NILP (commentstop) 2863 (NILP (commentstop)
2864 ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1))); 2864 ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1)));
2865 2865
2866 SET_PT (state.location); 2866 SET_PT (state.location);
2867 2867
2868 return Fcons (make_number (state.depth), 2868 return Fcons (make_number (state.depth),
2869 Fcons (state.prevlevelstart < 0 ? Qnil : make_number (state.prevlevelstart), 2869 Fcons (state.prevlevelstart < 0 ? Qnil : make_number (state.prevlevelstart),
2870 Fcons (state.thislevelstart < 0 ? Qnil : make_number (state.thislevelstart), 2870 Fcons (state.thislevelstart < 0 ? Qnil : make_number (state.thislevelstart),
2871 Fcons (state.instring >= 0 2871 Fcons (state.instring >= 0
2872 ? (state.instring == ST_STRING_STYLE 2872 ? (state.instring == ST_STRING_STYLE
2873 ? Qt : make_number (state.instring)) : Qnil, 2873 ? Qt : make_number (state.instring)) : Qnil,
2874 Fcons (state.incomment < 0 ? Qt : 2874 Fcons (state.incomment < 0 ? Qt :
2875 (state.incomment == 0 ? Qnil : 2875 (state.incomment == 0 ? Qnil :
2876 make_number (state.incomment)), 2876 make_number (state.incomment)),
2877 Fcons (state.quoted ? Qt : Qnil, 2877 Fcons (state.quoted ? Qt : Qnil,
2878 Fcons (make_number (state.mindepth), 2878 Fcons (make_number (state.mindepth),
2879 Fcons ((state.comstyle 2879 Fcons ((state.comstyle
2880 ? (state.comstyle == ST_COMMENT_STYLE 2880 ? (state.comstyle == ST_COMMENT_STYLE
2881 ? Qsyntax_table : Qt) : 2881 ? Qsyntax_table : Qt) :
2882 Qnil), 2882 Qnil),
diff --git a/src/w32fns.c b/src/w32fns.c
index 2e0352ab68a..f4dd0421694 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -296,7 +296,7 @@ static HWND track_mouse_window;
296FARPROC track_mouse_event_fn; 296FARPROC track_mouse_event_fn;
297 297
298/* W95 mousewheel handler */ 298/* W95 mousewheel handler */
299unsigned int msh_mousewheel = 0; 299unsigned int msh_mousewheel = 0;
300 300
301/* Timers */ 301/* Timers */
302#define MOUSE_BUTTON_ID 1 302#define MOUSE_BUTTON_ID 1
@@ -346,7 +346,7 @@ check_w32 ()
346 346
347/* Nonzero if we can use mouse menus. 347/* Nonzero if we can use mouse menus.
348 You should not call this unless HAVE_MENUS is defined. */ 348 You should not call this unless HAVE_MENUS is defined. */
349 349
350int 350int
351have_menus_p () 351have_menus_p ()
352{ 352{
@@ -371,7 +371,7 @@ check_x_frame (frame)
371 return f; 371 return f;
372} 372}
373 373
374/* Let the user specify an display with a frame. 374/* Let the user specify a display with a frame.
375 nil stands for the selected frame--or, if that is not a w32 frame, 375 nil stands for the selected frame--or, if that is not a w32 frame,
376 the first display on the list. */ 376 the first display on the list. */
377 377
@@ -382,7 +382,7 @@ check_x_display_info (frame)
382 if (NILP (frame)) 382 if (NILP (frame))
383 { 383 {
384 struct frame *sf = XFRAME (selected_frame); 384 struct frame *sf = XFRAME (selected_frame);
385 385
386 if (FRAME_W32_P (sf) && FRAME_LIVE_P (sf)) 386 if (FRAME_W32_P (sf) && FRAME_LIVE_P (sf))
387 return FRAME_W32_DISPLAY_INFO (sf); 387 return FRAME_W32_DISPLAY_INFO (sf);
388 else 388 else
@@ -590,7 +590,7 @@ x_create_bitmap_from_file (f, file)
590 if (hinst == NULL) 590 if (hinst == NULL)
591 return -1; 591 return -1;
592 592
593 593
594 result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), 594 result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
595 filename, &width, &height, &bitmap, &xhot, &yhot); 595 filename, &width, &height, &bitmap, &xhot, &yhot);
596 if (result != BitmapSuccess) 596 if (result != BitmapSuccess)
@@ -863,7 +863,7 @@ x_set_frame_parameters (f, alist)
863 They are independent of other properties, but other properties (e.g., 863 They are independent of other properties, but other properties (e.g.,
864 cursor_color) are dependent upon them. */ 864 cursor_color) are dependent upon them. */
865 /* Process default font as well, since fringe widths depends on it. */ 865 /* Process default font as well, since fringe widths depends on it. */
866 for (p = 0; p < i; p++) 866 for (p = 0; p < i; p++)
867 { 867 {
868 Lisp_Object prop, val; 868 Lisp_Object prop, val;
869 869
@@ -882,7 +882,7 @@ x_set_frame_parameters (f, alist)
882 if (NILP (Fequal (val, old_value))) 882 if (NILP (Fequal (val, old_value)))
883 { 883 {
884 store_frame_param (f, prop, val); 884 store_frame_param (f, prop, val);
885 885
886 param_index = Fget (prop, Qx_frame_parameter); 886 param_index = Fget (prop, Qx_frame_parameter);
887 if (NATNUMP (param_index) 887 if (NATNUMP (param_index)
888 && (XFASTINT (param_index) 888 && (XFASTINT (param_index)
@@ -978,7 +978,7 @@ x_set_frame_parameters (f, alist)
978 position. Resize of the frame is taken care of in the code after 978 position. Resize of the frame is taken care of in the code after
979 this if-statement. */ 979 this if-statement. */
980 int new_left, new_top; 980 int new_left, new_top;
981 981
982 x_fullscreen_adjust (f, &width, &height, &new_top, &new_left); 982 x_fullscreen_adjust (f, &width, &height, &new_top, &new_left);
983 x_fullscreen_move (f, new_top, new_left); 983 x_fullscreen_move (f, new_top, new_left);
984 } 984 }
@@ -1245,13 +1245,13 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */)
1245} 1245}
1246 1246
1247/* The default colors for the w32 color map */ 1247/* The default colors for the w32 color map */
1248typedef struct colormap_t 1248typedef struct colormap_t
1249{ 1249{
1250 char *name; 1250 char *name;
1251 COLORREF colorref; 1251 COLORREF colorref;
1252} colormap_t; 1252} colormap_t;
1253 1253
1254colormap_t w32_color_map[] = 1254colormap_t w32_color_map[] =
1255{ 1255{
1256 {"snow" , PALETTERGB (255,250,250)}, 1256 {"snow" , PALETTERGB (255,250,250)},
1257 {"ghost white" , PALETTERGB (248,248,255)}, 1257 {"ghost white" , PALETTERGB (248,248,255)},
@@ -1502,36 +1502,36 @@ DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map,
1502 int i; 1502 int i;
1503 colormap_t *pc = w32_color_map; 1503 colormap_t *pc = w32_color_map;
1504 Lisp_Object cmap; 1504 Lisp_Object cmap;
1505 1505
1506 BLOCK_INPUT; 1506 BLOCK_INPUT;
1507 1507
1508 cmap = Qnil; 1508 cmap = Qnil;
1509 1509
1510 for (i = 0; i < sizeof (w32_color_map) / sizeof (w32_color_map[0]); 1510 for (i = 0; i < sizeof (w32_color_map) / sizeof (w32_color_map[0]);
1511 pc++, i++) 1511 pc++, i++)
1512 cmap = Fcons (Fcons (build_string (pc->name), 1512 cmap = Fcons (Fcons (build_string (pc->name),
1513 make_number (pc->colorref)), 1513 make_number (pc->colorref)),
1514 cmap); 1514 cmap);
1515 1515
1516 UNBLOCK_INPUT; 1516 UNBLOCK_INPUT;
1517 1517
1518 return (cmap); 1518 return (cmap);
1519} 1519}
1520 1520
1521Lisp_Object 1521Lisp_Object
1522w32_to_x_color (rgb) 1522w32_to_x_color (rgb)
1523 Lisp_Object rgb; 1523 Lisp_Object rgb;
1524{ 1524{
1525 Lisp_Object color; 1525 Lisp_Object color;
1526 1526
1527 CHECK_NUMBER (rgb); 1527 CHECK_NUMBER (rgb);
1528 1528
1529 BLOCK_INPUT; 1529 BLOCK_INPUT;
1530 1530
1531 color = Frassq (rgb, Vw32_color_map); 1531 color = Frassq (rgb, Vw32_color_map);
1532 1532
1533 UNBLOCK_INPUT; 1533 UNBLOCK_INPUT;
1534 1534
1535 if (!NILP (color)) 1535 if (!NILP (color))
1536 return (Fcar (color)); 1536 return (Fcar (color));
1537 else 1537 else
@@ -1570,7 +1570,7 @@ w32_color_map_lookup (colorname)
1570 return ret; 1570 return ret;
1571} 1571}
1572 1572
1573COLORREF 1573COLORREF
1574x_to_w32_color (colorname) 1574x_to_w32_color (colorname)
1575 char * colorname; 1575 char * colorname;
1576{ 1576{
@@ -1584,7 +1584,7 @@ x_to_w32_color (colorname)
1584 char *color; 1584 char *color;
1585 int size; 1585 int size;
1586 color = colorname + 1; 1586 color = colorname + 1;
1587 1587
1588 size = strlen(color); 1588 size = strlen(color);
1589 if (size == 3 || size == 6 || size == 9 || size == 12) 1589 if (size == 3 || size == 6 || size == 9 || size == 12)
1590 { 1590 {
@@ -1593,7 +1593,7 @@ x_to_w32_color (colorname)
1593 pos = 0; 1593 pos = 0;
1594 size /= 3; 1594 size /= 3;
1595 colorval = 0; 1595 colorval = 0;
1596 1596
1597 for (i = 0; i < 3; i++) 1597 for (i = 0; i < 3; i++)
1598 { 1598 {
1599 char *end; 1599 char *end;
@@ -1649,7 +1649,7 @@ x_to_w32_color (colorname)
1649 { 1649 {
1650 char *end; 1650 char *end;
1651 unsigned long value; 1651 unsigned long value;
1652 1652
1653 /* The check for 'x' in the following conditional takes into 1653 /* The check for 'x' in the following conditional takes into
1654 account the fact that strtol allows a "0x" in front of 1654 account the fact that strtol allows a "0x" in front of
1655 our numbers, and we don't. */ 1655 our numbers, and we don't. */
@@ -1712,7 +1712,7 @@ x_to_w32_color (colorname)
1712 if (value < 0.0 || value > 1.0) 1712 if (value < 0.0 || value > 1.0)
1713 break; 1713 break;
1714 val = (UINT)(0x100 * value); 1714 val = (UINT)(0x100 * value);
1715 /* We used 0x100 instead of 0xFF to give an continuous 1715 /* We used 0x100 instead of 0xFF to give a continuous
1716 range between 0.0 and 1.0 inclusive. The next statement 1716 range between 0.0 and 1.0 inclusive. The next statement
1717 fixes the 1.0 case. */ 1717 fixes the 1.0 case. */
1718 if (val == 0x100) 1718 if (val == 0x100)
@@ -1736,27 +1736,27 @@ x_to_w32_color (colorname)
1736 RGB. */ 1736 RGB. */
1737 1737
1738 /* If we fail to lookup the color name in w32_color_map, then check the 1738 /* If we fail to lookup the color name in w32_color_map, then check the
1739 colorname to see if it can be crudely approximated: If the X color 1739 colorname to see if it can be crudely approximated: If the X color
1740 ends in a number (e.g., "darkseagreen2"), strip the number and 1740 ends in a number (e.g., "darkseagreen2"), strip the number and
1741 return the result of looking up the base color name. */ 1741 return the result of looking up the base color name. */
1742 ret = w32_color_map_lookup (colorname); 1742 ret = w32_color_map_lookup (colorname);
1743 if (NILP (ret)) 1743 if (NILP (ret))
1744 { 1744 {
1745 int len = strlen (colorname); 1745 int len = strlen (colorname);
1746 1746
1747 if (isdigit (colorname[len - 1])) 1747 if (isdigit (colorname[len - 1]))
1748 { 1748 {
1749 char *ptr, *approx = alloca (len + 1); 1749 char *ptr, *approx = alloca (len + 1);
1750 1750
1751 strcpy (approx, colorname); 1751 strcpy (approx, colorname);
1752 ptr = &approx[len - 1]; 1752 ptr = &approx[len - 1];
1753 while (ptr > approx && isdigit (*ptr)) 1753 while (ptr > approx && isdigit (*ptr))
1754 *ptr-- = '\0'; 1754 *ptr-- = '\0';
1755 1755
1756 ret = w32_color_map_lookup (approx); 1756 ret = w32_color_map_lookup (approx);
1757 } 1757 }
1758 } 1758 }
1759 1759
1760 UNBLOCK_INPUT; 1760 UNBLOCK_INPUT;
1761 return ret; 1761 return ret;
1762} 1762}
@@ -1911,7 +1911,7 @@ w32_defined_color (f, color, color_def, alloc)
1911 1911
1912 tem = x_to_w32_color (color); 1912 tem = x_to_w32_color (color);
1913 1913
1914 if (!NILP (tem)) 1914 if (!NILP (tem))
1915 { 1915 {
1916 if (f) 1916 if (f)
1917 { 1917 {
@@ -1928,7 +1928,7 @@ w32_defined_color (f, color, color_def, alloc)
1928 one_w32_display_info.color_list; 1928 one_w32_display_info.color_list;
1929 struct w32_palette_entry ** prev = 1929 struct w32_palette_entry ** prev =
1930 &one_w32_display_info.color_list; 1930 &one_w32_display_info.color_list;
1931 1931
1932 /* check if color is already mapped */ 1932 /* check if color is already mapped */
1933 while (entry) 1933 while (entry)
1934 { 1934 {
@@ -1964,7 +1964,7 @@ w32_defined_color (f, color, color_def, alloc)
1964 1964
1965 return 1; 1965 return 1;
1966 } 1966 }
1967 else 1967 else
1968 { 1968 {
1969 return 0; 1969 return 0;
1970 } 1970 }
@@ -2166,7 +2166,7 @@ x_set_mouse_color (f, arg, oldval)
2166 else 2166 else
2167 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch); 2167 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch);
2168 x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s"); 2168 x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s");
2169 2169
2170 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); 2170 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
2171 if (!EQ (Qnil, Vx_mode_pointer_shape)) 2171 if (!EQ (Qnil, Vx_mode_pointer_shape))
2172 { 2172 {
@@ -2249,7 +2249,7 @@ x_set_mouse_color (f, arg, oldval)
2249 && f->output_data.w32->modeline_cursor != 0) 2249 && f->output_data.w32->modeline_cursor != 0)
2250 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor); 2250 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor);
2251 f->output_data.w32->modeline_cursor = mode_cursor; 2251 f->output_data.w32->modeline_cursor = mode_cursor;
2252 2252
2253 if (cross_cursor != f->output_data.w32->cross_cursor 2253 if (cross_cursor != f->output_data.w32->cross_cursor
2254 && f->output_data.w32->cross_cursor != 0) 2254 && f->output_data.w32->cross_cursor != 0)
2255 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor); 2255 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor);
@@ -2279,7 +2279,7 @@ x_set_cursor_color (f, arg, oldval)
2279 fore_pixel = FRAME_BACKGROUND_PIXEL (f); 2279 fore_pixel = FRAME_BACKGROUND_PIXEL (f);
2280 2280
2281 pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); 2281 pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
2282 2282
2283 /* Make sure that the cursor color differs from the background color. */ 2283 /* Make sure that the cursor color differs from the background color. */
2284 if (pixel == FRAME_BACKGROUND_PIXEL (f)) 2284 if (pixel == FRAME_BACKGROUND_PIXEL (f))
2285 { 2285 {
@@ -2312,7 +2312,7 @@ x_set_cursor_color (f, arg, oldval)
2312 2312
2313/* Set the border-color of frame F to pixel value PIX. 2313/* Set the border-color of frame F to pixel value PIX.
2314 Note that this does not fully take effect if done before 2314 Note that this does not fully take effect if done before
2315 F has an window. */ 2315 F has a window. */
2316void 2316void
2317x_set_border_pixel (f, pix) 2317x_set_border_pixel (f, pix)
2318 struct frame *f; 2318 struct frame *f;
@@ -2369,7 +2369,7 @@ x_set_icon_type (f, arg, oldval)
2369 if (NILP (arg) && NILP (oldval)) 2369 if (NILP (arg) && NILP (oldval))
2370 return; 2370 return;
2371 2371
2372 if (STRINGP (arg) && STRINGP (oldval) 2372 if (STRINGP (arg) && STRINGP (oldval)
2373 && EQ (Fstring_equal (oldval, arg), Qt)) 2373 && EQ (Fstring_equal (oldval, arg), Qt))
2374 return; 2374 return;
2375 2375
@@ -2474,7 +2474,7 @@ x_set_font (f, arg, oldval)
2474 ? x_new_fontset (f, SDATA (fontset_name)) 2474 ? x_new_fontset (f, SDATA (fontset_name))
2475 : x_new_font (f, SDATA (arg))); 2475 : x_new_font (f, SDATA (arg)));
2476 UNBLOCK_INPUT; 2476 UNBLOCK_INPUT;
2477 2477
2478 if (EQ (result, Qnil)) 2478 if (EQ (result, Qnil))
2479 error ("Font `%s' is not defined", SDATA (arg)); 2479 error ("Font `%s' is not defined", SDATA (arg));
2480 else if (EQ (result, Qt)) 2480 else if (EQ (result, Qt))
@@ -2741,7 +2741,7 @@ x_set_name (f, name, explicit)
2741 Lisp_Object name; 2741 Lisp_Object name;
2742 int explicit; 2742 int explicit;
2743{ 2743{
2744 /* Make sure that requests from lisp code override requests from 2744 /* Make sure that requests from lisp code override requests from
2745 Emacs redisplay code. */ 2745 Emacs redisplay code. */
2746 if (explicit) 2746 if (explicit)
2747 { 2747 {
@@ -2889,7 +2889,7 @@ x_set_vertical_scroll_bars (f, arg, oldval)
2889 /* Put scroll bars on the right by default, as is conventional 2889 /* Put scroll bars on the right by default, as is conventional
2890 on MS-Windows. */ 2890 on MS-Windows. */
2891 EQ (Qleft, arg) 2891 EQ (Qleft, arg)
2892 ? vertical_scroll_bar_left 2892 ? vertical_scroll_bar_left
2893 : vertical_scroll_bar_right; 2893 : vertical_scroll_bar_right;
2894 2894
2895 /* We set this parameter before creating the window for the 2895 /* We set this parameter before creating the window for the
@@ -2930,10 +2930,10 @@ x_set_scroll_bar_width (f, arg, oldval)
2930 } 2930 }
2931 change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0); 2931 change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0);
2932 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0; 2932 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0;
2933 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0; 2933 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0;
2934} 2934}
2935 2935
2936/* Subroutines of creating an frame. */ 2936/* Subroutines of creating a frame. */
2937 2937
2938/* Make sure that Vx_resource_name is set to a reasonable value. 2938/* Make sure that Vx_resource_name is set to a reasonable value.
2939 Fix it up, or set it to `emacs' if it is too hopeless. */ 2939 Fix it up, or set it to `emacs' if it is too hopeless. */
@@ -3160,7 +3160,7 @@ w32_get_arg (alist, param, attribute, class, type)
3160 if (!strcmp (SDATA (tem), "on") 3160 if (!strcmp (SDATA (tem), "on")
3161 || !strcmp (SDATA (tem), "true")) 3161 || !strcmp (SDATA (tem), "true"))
3162 return Qt; 3162 return Qt;
3163 else 3163 else
3164 return Qnil; 3164 return Qnil;
3165 3165
3166 case RES_TYPE_STRING: 3166 case RES_TYPE_STRING:
@@ -3425,7 +3425,7 @@ x_figure_window_size (f, parms)
3425 3425
3426extern LRESULT CALLBACK w32_wnd_proc (); 3426extern LRESULT CALLBACK w32_wnd_proc ();
3427 3427
3428BOOL 3428BOOL
3429w32_init_class (hinst) 3429w32_init_class (hinst)
3430 HINSTANCE hinst; 3430 HINSTANCE hinst;
3431{ 3431{
@@ -3445,7 +3445,7 @@ w32_init_class (hinst)
3445 return (RegisterClass (&wc)); 3445 return (RegisterClass (&wc));
3446} 3446}
3447 3447
3448HWND 3448HWND
3449w32_createscrollbar (f, bar) 3449w32_createscrollbar (f, bar)
3450 struct frame *f; 3450 struct frame *f;
3451 struct scroll_bar * bar; 3451 struct scroll_bar * bar;
@@ -3453,7 +3453,7 @@ w32_createscrollbar (f, bar)
3453 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE, 3453 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE,
3454 /* Position and size of scroll bar. */ 3454 /* Position and size of scroll bar. */
3455 XINT(bar->left) + VERTICAL_SCROLL_BAR_WIDTH_TRIM, 3455 XINT(bar->left) + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
3456 XINT(bar->top), 3456 XINT(bar->top),
3457 XINT(bar->width) - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, 3457 XINT(bar->width) - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
3458 XINT(bar->height), 3458 XINT(bar->height),
3459 FRAME_W32_WINDOW (f), 3459 FRAME_W32_WINDOW (f),
@@ -3462,7 +3462,7 @@ w32_createscrollbar (f, bar)
3462 NULL)); 3462 NULL));
3463} 3463}
3464 3464
3465void 3465void
3466w32_createwindow (f) 3466w32_createwindow (f)
3467 struct frame *f; 3467 struct frame *f;
3468{ 3468{
@@ -3472,17 +3472,17 @@ w32_createwindow (f)
3472 rect.left = rect.top = 0; 3472 rect.left = rect.top = 0;
3473 rect.right = PIXEL_WIDTH (f); 3473 rect.right = PIXEL_WIDTH (f);
3474 rect.bottom = PIXEL_HEIGHT (f); 3474 rect.bottom = PIXEL_HEIGHT (f);
3475 3475
3476 AdjustWindowRect (&rect, f->output_data.w32->dwStyle, 3476 AdjustWindowRect (&rect, f->output_data.w32->dwStyle,
3477 FRAME_EXTERNAL_MENU_BAR (f)); 3477 FRAME_EXTERNAL_MENU_BAR (f));
3478 3478
3479 /* Do first time app init */ 3479 /* Do first time app init */
3480 3480
3481 if (!hprevinst) 3481 if (!hprevinst)
3482 { 3482 {
3483 w32_init_class (hinst); 3483 w32_init_class (hinst);
3484 } 3484 }
3485 3485
3486 FRAME_W32_WINDOW (f) = hwnd 3486 FRAME_W32_WINDOW (f) = hwnd
3487 = CreateWindow (EMACS_CLASS, 3487 = CreateWindow (EMACS_CLASS,
3488 f->namebuf, 3488 f->namebuf,
@@ -3506,13 +3506,13 @@ w32_createwindow (f)
3506 3506
3507 /* Enable drag-n-drop. */ 3507 /* Enable drag-n-drop. */
3508 DragAcceptFiles (hwnd, TRUE); 3508 DragAcceptFiles (hwnd, TRUE);
3509 3509
3510 /* Do this to discard the default setting specified by our parent. */ 3510 /* Do this to discard the default setting specified by our parent. */
3511 ShowWindow (hwnd, SW_HIDE); 3511 ShowWindow (hwnd, SW_HIDE);
3512 } 3512 }
3513} 3513}
3514 3514
3515void 3515void
3516my_post_msg (wmsg, hwnd, msg, wParam, lParam) 3516my_post_msg (wmsg, hwnd, msg, wParam, lParam)
3517 W32Msg * wmsg; 3517 W32Msg * wmsg;
3518 HWND hwnd; 3518 HWND hwnd;
@@ -3609,7 +3609,7 @@ record_keyup (unsigned int wparam, unsigned int lparam)
3609} 3609}
3610 3610
3611/* Emacs can lose focus while a modifier key has been pressed. When 3611/* Emacs can lose focus while a modifier key has been pressed. When
3612 it regains focus, be conservative and clear all modifiers since 3612 it regains focus, be conservative and clear all modifiers since
3613 we cannot reconstruct the left and right modifier state. */ 3613 we cannot reconstruct the left and right modifier state. */
3614static void 3614static void
3615reset_modifiers () 3615reset_modifiers ()
@@ -3664,10 +3664,10 @@ sync_modifiers ()
3664 if (!modifiers_recorded) 3664 if (!modifiers_recorded)
3665 return; 3665 return;
3666 3666
3667 if (!(GetKeyState (VK_CONTROL) & 0x8000)) 3667 if (!(GetKeyState (VK_CONTROL) & 0x8000))
3668 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0; 3668 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0;
3669 3669
3670 if (!(GetKeyState (VK_MENU) & 0x8000)) 3670 if (!(GetKeyState (VK_MENU) & 0x8000))
3671 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0; 3671 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0;
3672} 3672}
3673 3673
@@ -3877,7 +3877,7 @@ w32_msg_pump (deferred_msg * msg_buf)
3877 HWND focus_window; 3877 HWND focus_window;
3878 3878
3879 msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL); 3879 msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL);
3880 3880
3881 while (GetMessage (&msg, NULL, 0, 0)) 3881 while (GetMessage (&msg, NULL, 0, 0))
3882 { 3882 {
3883 if (msg.hwnd == NULL) 3883 if (msg.hwnd == NULL)
@@ -4067,7 +4067,7 @@ cancel_all_deferred_msgs ()
4067 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0); 4067 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0);
4068} 4068}
4069 4069
4070DWORD 4070DWORD
4071w32_msg_worker (dw) 4071w32_msg_worker (dw)
4072 DWORD dw; 4072 DWORD dw;
4073{ 4073{
@@ -4075,9 +4075,9 @@ w32_msg_worker (dw)
4075 deferred_msg dummy_buf; 4075 deferred_msg dummy_buf;
4076 4076
4077 /* Ensure our message queue is created */ 4077 /* Ensure our message queue is created */
4078 4078
4079 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); 4079 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
4080 4080
4081 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) 4081 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
4082 abort (); 4082 abort ();
4083 4083
@@ -4156,7 +4156,7 @@ post_character_message (hwnd, msg, wParam, lParam, modifiers)
4156 4156
4157/* Main window procedure */ 4157/* Main window procedure */
4158 4158
4159LRESULT CALLBACK 4159LRESULT CALLBACK
4160w32_wnd_proc (hwnd, msg, wParam, lParam) 4160w32_wnd_proc (hwnd, msg, wParam, lParam)
4161 HWND hwnd; 4161 HWND hwnd;
4162 UINT msg; 4162 UINT msg;
@@ -4185,7 +4185,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4185 w32_clear_rect, because these functions must obtain a DC handle 4185 w32_clear_rect, because these functions must obtain a DC handle
4186 from the frame struct using get_frame_dc which is thread-aware. */ 4186 from the frame struct using get_frame_dc which is thread-aware. */
4187 4187
4188 switch (msg) 4188 switch (msg)
4189 { 4189 {
4190 case WM_ERASEBKGND: 4190 case WM_ERASEBKGND:
4191 f = x_window_to_frame (dpyinfo, hwnd); 4191 f = x_window_to_frame (dpyinfo, hwnd);
@@ -4254,7 +4254,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4254 leave_crit (); 4254 leave_crit ();
4255 4255
4256 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); 4256 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
4257 4257
4258 return 0; 4258 return 0;
4259 } 4259 }
4260 4260
@@ -4374,13 +4374,13 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4374 return 0; 4374 return 0;
4375 break; 4375 break;
4376 case VK_MENU: 4376 case VK_MENU:
4377 if (NILP (Vw32_pass_alt_to_system)) 4377 if (NILP (Vw32_pass_alt_to_system))
4378 /* Prevent DefWindowProc from activating the menu bar if an 4378 /* Prevent DefWindowProc from activating the menu bar if an
4379 Alt key is pressed and released by itself. */ 4379 Alt key is pressed and released by itself. */
4380 return 0; 4380 return 0;
4381 windows_translate = 1; 4381 windows_translate = 1;
4382 break; 4382 break;
4383 case VK_CAPITAL: 4383 case VK_CAPITAL:
4384 /* Decide whether to treat as modifier or function key. */ 4384 /* Decide whether to treat as modifier or function key. */
4385 if (NILP (Vw32_enable_caps_lock)) 4385 if (NILP (Vw32_enable_caps_lock))
4386 goto disable_lock_key; 4386 goto disable_lock_key;
@@ -4417,7 +4417,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4417 w32_get_key_modifiers (wParam, lParam)); 4417 w32_get_key_modifiers (wParam, lParam));
4418 windows_translate = 1; 4418 windows_translate = 1;
4419 break; 4419 break;
4420 case VK_CONTROL: 4420 case VK_CONTROL:
4421 case VK_SHIFT: 4421 case VK_SHIFT:
4422 case VK_PROCESSKEY: /* Generated by IME. */ 4422 case VK_PROCESSKEY: /* Generated by IME. */
4423 windows_translate = 1; 4423 windows_translate = 1;
@@ -4475,7 +4475,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4475 int add; 4475 int add;
4476 int isdead = 0; 4476 int isdead = 0;
4477 KEY_EVENT_RECORD key; 4477 KEY_EVENT_RECORD key;
4478 4478
4479 key.bKeyDown = TRUE; 4479 key.bKeyDown = TRUE;
4480 key.wRepeatCount = 1; 4480 key.wRepeatCount = 1;
4481 key.wVirtualKeyCode = wParam; 4481 key.wVirtualKeyCode = wParam;
@@ -4516,7 +4516,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4516 } 4516 }
4517 4517
4518 /* Fall through */ 4518 /* Fall through */
4519 4519
4520 case WM_SYSCHAR: 4520 case WM_SYSCHAR:
4521 case WM_CHAR: 4521 case WM_CHAR:
4522 post_character_message (hwnd, msg, wParam, lParam, 4522 post_character_message (hwnd, msg, wParam, lParam,
@@ -4652,7 +4652,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4652 { 4652 {
4653 if (up) ReleaseCapture (); 4653 if (up) ReleaseCapture ();
4654 else SetCapture (hwnd); 4654 else SetCapture (hwnd);
4655 button = (button == 0) ? LMOUSE : 4655 button = (button == 0) ? LMOUSE :
4656 ((button == 1) ? MMOUSE : RMOUSE); 4656 ((button == 1) ? MMOUSE : RMOUSE);
4657 if (up) 4657 if (up)
4658 button_state &= ~button; 4658 button_state &= ~button;
@@ -4660,7 +4660,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4660 button_state |= button; 4660 button_state |= button;
4661 } 4661 }
4662 } 4662 }
4663 4663
4664 wmsg.dwModifiers = w32_get_modifiers (); 4664 wmsg.dwModifiers = w32_get_modifiers ();
4665 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); 4665 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
4666 4666
@@ -4693,7 +4693,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4693 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); 4693 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
4694 return 0; 4694 return 0;
4695 } 4695 }
4696 4696
4697 /* Hang onto mouse move and scroll messages for a bit, to avoid 4697 /* Hang onto mouse move and scroll messages for a bit, to avoid
4698 sending such events to Emacs faster than it can process them. 4698 sending such events to Emacs faster than it can process them.
4699 If we get more events before the timer from the first message 4699 If we get more events before the timer from the first message
@@ -4711,7 +4711,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4711 saved_mouse_move_msg.msg.lParam = lParam; 4711 saved_mouse_move_msg.msg.lParam = lParam;
4712 saved_mouse_move_msg.msg.time = GetMessageTime (); 4712 saved_mouse_move_msg.msg.time = GetMessageTime ();
4713 saved_mouse_move_msg.dwModifiers = w32_get_modifiers (); 4713 saved_mouse_move_msg.dwModifiers = w32_get_modifiers ();
4714 4714
4715 return 0; 4715 return 0;
4716 4716
4717 case WM_MOUSEWHEEL: 4717 case WM_MOUSEWHEEL:
@@ -4759,7 +4759,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4759 } 4759 }
4760 } 4760 }
4761 return 0; 4761 return 0;
4762 4762
4763 case WM_NCACTIVATE: 4763 case WM_NCACTIVATE:
4764 /* Windows doesn't send us focus messages when putting up and 4764 /* Windows doesn't send us focus messages when putting up and
4765 taking down a system popup dialog as for Ctrl-Alt-Del on Windows 95. 4765 taking down a system popup dialog as for Ctrl-Alt-Del on Windows 95.
@@ -4963,7 +4963,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4963 if (menu_free_timer) 4963 if (menu_free_timer)
4964 { 4964 {
4965 KillTimer (hwnd, menu_free_timer); 4965 KillTimer (hwnd, menu_free_timer);
4966 menu_free_timer = 0; 4966 menu_free_timer = 0;
4967 } 4967 }
4968 } 4968 }
4969 case WM_MOVE: 4969 case WM_MOVE:
@@ -4988,7 +4988,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4988 4988
4989 wp.length = sizeof (WINDOWPLACEMENT); 4989 wp.length = sizeof (WINDOWPLACEMENT);
4990 GetWindowPlacement (hwnd, &wp); 4990 GetWindowPlacement (hwnd, &wp);
4991 4991
4992 if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0) 4992 if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0)
4993 { 4993 {
4994 RECT rect; 4994 RECT rect;
@@ -4999,21 +4999,21 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4999 DWORD internal_border; 4999 DWORD internal_border;
5000 DWORD scrollbar_extra; 5000 DWORD scrollbar_extra;
5001 RECT wr; 5001 RECT wr;
5002 5002
5003 wp.length = sizeof(wp); 5003 wp.length = sizeof(wp);
5004 GetWindowRect (hwnd, &wr); 5004 GetWindowRect (hwnd, &wr);
5005 5005
5006 enter_crit (); 5006 enter_crit ();
5007 5007
5008 font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX); 5008 font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX);
5009 line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX); 5009 line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX);
5010 internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX); 5010 internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX);
5011 scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX); 5011 scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX);
5012 5012
5013 leave_crit (); 5013 leave_crit ();
5014 5014
5015 memset (&rect, 0, sizeof (rect)); 5015 memset (&rect, 0, sizeof (rect));
5016 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE), 5016 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE),
5017 GetMenu (hwnd) != NULL); 5017 GetMenu (hwnd) != NULL);
5018 5018
5019 /* Force width and height of client area to be exact 5019 /* Force width and height of client area to be exact
@@ -5024,17 +5024,17 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
5024 hdiff = (lppos->cy - (rect.bottom - rect.top) 5024 hdiff = (lppos->cy - (rect.bottom - rect.top)
5025 - 2 * internal_border) 5025 - 2 * internal_border)
5026 % line_height; 5026 % line_height;
5027 5027
5028 if (wdiff || hdiff) 5028 if (wdiff || hdiff)
5029 { 5029 {
5030 /* For right/bottom sizing we can just fix the sizes. 5030 /* For right/bottom sizing we can just fix the sizes.
5031 However for top/left sizing we will need to fix the X 5031 However for top/left sizing we will need to fix the X
5032 and Y positions as well. */ 5032 and Y positions as well. */
5033 5033
5034 lppos->cx -= wdiff; 5034 lppos->cx -= wdiff;
5035 lppos->cy -= hdiff; 5035 lppos->cy -= hdiff;
5036 5036
5037 if (wp.showCmd != SW_SHOWMAXIMIZED 5037 if (wp.showCmd != SW_SHOWMAXIMIZED
5038 && (lppos->flags & SWP_NOMOVE) == 0) 5038 && (lppos->flags & SWP_NOMOVE) == 0)
5039 { 5039 {
5040 if (lppos->x != wr.left || lppos->y != wr.top) 5040 if (lppos->x != wr.left || lppos->y != wr.top)
@@ -5047,12 +5047,12 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
5047 lppos->flags |= SWP_NOMOVE; 5047 lppos->flags |= SWP_NOMOVE;
5048 } 5048 }
5049 } 5049 }
5050 5050
5051 return 0; 5051 return 0;
5052 } 5052 }
5053 } 5053 }
5054 } 5054 }
5055 5055
5056 goto dflt; 5056 goto dflt;
5057 5057
5058 case WM_GETMINMAXINFO: 5058 case WM_GETMINMAXINFO:
@@ -5130,7 +5130,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
5130 CreateCaret (hwnd, NULL, 0, 5130 CreateCaret (hwnd, NULL, 0,
5131 w32_system_caret_height); 5131 w32_system_caret_height);
5132 } 5132 }
5133 5133
5134 if (!SetCaretPos (w32_system_caret_x, w32_system_caret_y)) 5134 if (!SetCaretPos (w32_system_caret_x, w32_system_caret_y))
5135 return 0; 5135 return 0;
5136 /* Ensure visible caret gets turned on when requested. */ 5136 /* Ensure visible caret gets turned on when requested. */
@@ -5161,7 +5161,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
5161 flags |= TPM_LEFTBUTTON; 5161 flags |= TPM_LEFTBUTTON;
5162 else if (button_state & RMOUSE) 5162 else if (button_state & RMOUSE)
5163 flags |= TPM_RIGHTBUTTON; 5163 flags |= TPM_RIGHTBUTTON;
5164 5164
5165 /* Remember we did a SetCapture on the initial mouse down event, 5165 /* Remember we did a SetCapture on the initial mouse down event,
5166 so for safety, we make sure the capture is cancelled now. */ 5166 so for safety, we make sure the capture is cancelled now. */
5167 ReleaseCapture (); 5167 ReleaseCapture ();
@@ -5172,8 +5172,8 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
5172 f = x_window_to_frame (dpyinfo, hwnd); 5172 f = x_window_to_frame (dpyinfo, hwnd);
5173 if (f) 5173 if (f)
5174 f->output_data.w32->menubar_active = 1; 5174 f->output_data.w32->menubar_active = 1;
5175 5175
5176 if (TrackPopupMenu ((HMENU)wParam, flags, pos->x, pos->y, 5176 if (TrackPopupMenu ((HMENU)wParam, flags, pos->x, pos->y,
5177 0, hwnd, NULL)) 5177 0, hwnd, NULL))
5178 { 5178 {
5179 MSG amsg; 5179 MSG amsg;
@@ -5206,17 +5206,17 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
5206 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); 5206 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
5207 return 0; 5207 return 0;
5208 } 5208 }
5209 5209
5210 dflt: 5210 dflt:
5211 return DefWindowProc (hwnd, msg, wParam, lParam); 5211 return DefWindowProc (hwnd, msg, wParam, lParam);
5212 } 5212 }
5213 5213
5214 5214
5215 /* The most common default return code for handled messages is 0. */ 5215 /* The most common default return code for handled messages is 0. */
5216 return 0; 5216 return 0;
5217} 5217}
5218 5218
5219void 5219void
5220my_create_window (f) 5220my_create_window (f)
5221 struct frame * f; 5221 struct frame * f;
5222{ 5222{
@@ -5232,7 +5232,7 @@ my_create_window (f)
5232 indirectly via the Window thread, as we do not need to process Window 5232 indirectly via the Window thread, as we do not need to process Window
5233 messages for the tooltip. Creating tooltips indirectly also creates 5233 messages for the tooltip. Creating tooltips indirectly also creates
5234 deadlocks when tooltips are created for menu items. */ 5234 deadlocks when tooltips are created for menu items. */
5235void 5235void
5236my_create_tip_window (f) 5236my_create_tip_window (f)
5237 struct frame *f; 5237 struct frame *f;
5238{ 5238{
@@ -5289,7 +5289,7 @@ w32_window (f, window_prompting, minibuffer_only)
5289 for the window manager, so GC relocation won't bother it. 5289 for the window manager, so GC relocation won't bother it.
5290 5290
5291 Elsewhere we specify the window name for the window manager. */ 5291 Elsewhere we specify the window name for the window manager. */
5292 5292
5293 { 5293 {
5294 char *str = (char *) SDATA (Vx_resource_name); 5294 char *str = (char *) SDATA (Vx_resource_name);
5295 f->namebuf = (char *) xmalloc (strlen (str) + 1); 5295 f->namebuf = (char *) xmalloc (strlen (str) + 1);
@@ -5413,7 +5413,7 @@ unwind_create_frame (frame)
5413#ifdef GLYPH_DEBUG 5413#ifdef GLYPH_DEBUG
5414 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); 5414 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
5415#endif 5415#endif
5416 5416
5417 x_free_frame_resources (f); 5417 x_free_frame_resources (f);
5418 5418
5419 /* Check that reference counts are indeed correct. */ 5419 /* Check that reference counts are indeed correct. */
@@ -5422,7 +5422,7 @@ unwind_create_frame (frame)
5422 5422
5423 return Qt; 5423 return Qt;
5424 } 5424 }
5425 5425
5426 return Qnil; 5426 return Qnil;
5427} 5427}
5428 5428
@@ -5586,7 +5586,7 @@ This function is an internal primitive--use `make-frame' instead. */)
5586 if (! STRINGP (font)) 5586 if (! STRINGP (font))
5587 font = build_string ("Fixedsys"); 5587 font = build_string ("Fixedsys");
5588 5588
5589 x_default_parameter (f, parms, Qfont, font, 5589 x_default_parameter (f, parms, Qfont, font,
5590 "font", "Font", RES_TYPE_STRING); 5590 "font", "Font", RES_TYPE_STRING);
5591 } 5591 }
5592 5592
@@ -5639,7 +5639,7 @@ This function is an internal primitive--use `make-frame' instead. */)
5639 end up in init_iterator with a null face cache, which should not 5639 end up in init_iterator with a null face cache, which should not
5640 happen. */ 5640 happen. */
5641 init_frame_faces (f); 5641 init_frame_faces (f);
5642 5642
5643 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), 5643 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
5644 "menuBar", "MenuBar", RES_TYPE_NUMBER); 5644 "menuBar", "MenuBar", RES_TYPE_NUMBER);
5645 x_default_parameter (f, parms, Qtool_bar_lines, make_number (1), 5645 x_default_parameter (f, parms, Qtool_bar_lines, make_number (1),
@@ -5664,7 +5664,7 @@ This function is an internal primitive--use `make-frame' instead. */)
5664 if (FRAME_TOOL_BAR_LINES (f)) 5664 if (FRAME_TOOL_BAR_LINES (f))
5665 { 5665 {
5666 int margin, relief, bar_height; 5666 int margin, relief, bar_height;
5667 5667
5668 relief = (tool_bar_button_relief >= 0 5668 relief = (tool_bar_button_relief >= 0
5669 ? tool_bar_button_relief 5669 ? tool_bar_button_relief
5670 : DEFAULT_TOOL_BAR_BUTTON_RELIEF); 5670 : DEFAULT_TOOL_BAR_BUTTON_RELIEF);
@@ -5678,7 +5678,7 @@ This function is an internal primitive--use `make-frame' instead. */)
5678 margin = XFASTINT (XCDR (Vtool_bar_button_margin)); 5678 margin = XFASTINT (XCDR (Vtool_bar_button_margin));
5679 else 5679 else
5680 margin = 0; 5680 margin = 0;
5681 5681
5682 bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief; 5682 bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief;
5683 f->height += (bar_height + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); 5683 f->height += (bar_height + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f);
5684 } 5684 }
@@ -5776,11 +5776,11 @@ This function is an internal primitive--use `make-frame' instead. */)
5776 ; 5776 ;
5777 } 5777 }
5778 UNGCPRO; 5778 UNGCPRO;
5779 5779
5780 /* Make sure windows on this frame appear in calls to next-window 5780 /* Make sure windows on this frame appear in calls to next-window
5781 and similar functions. */ 5781 and similar functions. */
5782 Vwindow_list = Qnil; 5782 Vwindow_list = Qnil;
5783 5783
5784 return unbind_to (count, frame); 5784 return unbind_to (count, frame);
5785} 5785}
5786 5786
@@ -5917,11 +5917,11 @@ w32_load_system_font (f,fontname,size)
5917 5917
5918 font->hfont = CreateFontIndirect (&lf); 5918 font->hfont = CreateFontIndirect (&lf);
5919 5919
5920 if (font->hfont == NULL) 5920 if (font->hfont == NULL)
5921 { 5921 {
5922 ok = FALSE; 5922 ok = FALSE;
5923 } 5923 }
5924 else 5924 else
5925 { 5925 {
5926 HDC hdc; 5926 HDC hdc;
5927 HANDLE oldobj; 5927 HANDLE oldobj;
@@ -6090,12 +6090,12 @@ int size;
6090} 6090}
6091 6091
6092 6092
6093void 6093void
6094w32_unload_font (dpyinfo, font) 6094w32_unload_font (dpyinfo, font)
6095 struct w32_display_info *dpyinfo; 6095 struct w32_display_info *dpyinfo;
6096 XFontStruct * font; 6096 XFontStruct * font;
6097{ 6097{
6098 if (font) 6098 if (font)
6099 { 6099 {
6100 if (font->per_char) xfree (font->per_char); 6100 if (font->per_char) xfree (font->per_char);
6101 if (font->bdf) w32_free_bdf_font (font->bdf); 6101 if (font->bdf) w32_free_bdf_font (font->bdf);
@@ -6128,7 +6128,7 @@ w32_unload_font (dpyinfo, font)
6128 * ) 6128 * )
6129 */ 6129 */
6130 6130
6131static LONG 6131static LONG
6132x_to_w32_weight (lpw) 6132x_to_w32_weight (lpw)
6133 char * lpw; 6133 char * lpw;
6134{ 6134{
@@ -6149,7 +6149,7 @@ x_to_w32_weight (lpw)
6149} 6149}
6150 6150
6151 6151
6152static char * 6152static char *
6153w32_to_x_weight (fnweight) 6153w32_to_x_weight (fnweight)
6154 int fnweight; 6154 int fnweight;
6155{ 6155{
@@ -6336,7 +6336,7 @@ w32_to_x_charset (fncharset)
6336 sprintf (buf, "*-#%u", fncharset); 6336 sprintf (buf, "*-#%u", fncharset);
6337 return buf; 6337 return buf;
6338 } 6338 }
6339 6339
6340 { 6340 {
6341 Lisp_Object rest; 6341 Lisp_Object rest;
6342 char * best_match = NULL; 6342 char * best_match = NULL;
@@ -6390,7 +6390,7 @@ w32_to_x_charset (fncharset)
6390 int this_enc = atoi (x_charset + 8); 6390 int this_enc = atoi (x_charset + 8);
6391 if (this_enc > 0 && this_enc < best_enc) 6391 if (this_enc > 0 && this_enc < best_enc)
6392 best_match = x_charset; 6392 best_match = x_charset;
6393 } 6393 }
6394 } 6394 }
6395 } 6395 }
6396 6396
@@ -6497,7 +6497,7 @@ w32_to_all_x_charsets (fncharset)
6497 sprintf (buf, "*-#%u", fncharset); 6497 sprintf (buf, "*-#%u", fncharset);
6498 return Fcons (build_string (buf), Qnil); 6498 return Fcons (build_string (buf), Qnil);
6499 } 6499 }
6500 6500
6501 { 6501 {
6502 Lisp_Object rest; 6502 Lisp_Object rest;
6503 /* Look through w32-charset-info-alist for the character set. 6503 /* Look through w32-charset-info-alist for the character set.
@@ -6548,7 +6548,7 @@ w32_to_all_x_charsets (fncharset)
6548/* Get the Windows codepage corresponding to the specified font. The 6548/* Get the Windows codepage corresponding to the specified font. The
6549 charset info in the font name is used to look up 6549 charset info in the font name is used to look up
6550 w32-charset-to-codepage-alist. */ 6550 w32-charset-to-codepage-alist. */
6551int 6551int
6552w32_codepage_for_font (char *fontname) 6552w32_codepage_for_font (char *fontname)
6553{ 6553{
6554 Lisp_Object codepage, entry; 6554 Lisp_Object codepage, entry;
@@ -6599,7 +6599,7 @@ w32_codepage_for_font (char *fontname)
6599} 6599}
6600 6600
6601 6601
6602static BOOL 6602static BOOL
6603w32_to_x_font (lplogfont, lpxstr, len, specific_charset) 6603w32_to_x_font (lplogfont, lpxstr, len, specific_charset)
6604 LOGFONT * lplogfont; 6604 LOGFONT * lplogfont;
6605 char * lpxstr; 6605 char * lpxstr;
@@ -6682,7 +6682,7 @@ w32_to_x_font (lplogfont, lpxstr, len, specific_charset)
6682 ? 'p' : 'c', /* spacing */ 6682 ? 'p' : 'c', /* spacing */
6683 width_pixels, /* avg width */ 6683 width_pixels, /* avg width */
6684 specific_charset ? specific_charset 6684 specific_charset ? specific_charset
6685 : w32_to_x_charset (lplogfont->lfCharSet) 6685 : w32_to_x_charset (lplogfont->lfCharSet)
6686 /* charset registry and encoding */ 6686 /* charset registry and encoding */
6687 ); 6687 );
6688 6688
@@ -6690,7 +6690,7 @@ w32_to_x_font (lplogfont, lpxstr, len, specific_charset)
6690 return (TRUE); 6690 return (TRUE);
6691} 6691}
6692 6692
6693static BOOL 6693static BOOL
6694x_to_w32_font (lpxstr, lplogfont) 6694x_to_w32_font (lpxstr, lplogfont)
6695 char * lpxstr; 6695 char * lpxstr;
6696 LOGFONT * lplogfont; 6696 LOGFONT * lplogfont;
@@ -6725,7 +6725,7 @@ x_to_w32_font (lpxstr, lplogfont)
6725 * format: 6725 * format:
6726 * "<font name>[:height in pixels[:width in pixels[:weight]]]" 6726 * "<font name>[:height in pixels[:width in pixels[:weight]]]"
6727 */ 6727 */
6728 6728
6729 if (*lpxstr == '-') 6729 if (*lpxstr == '-')
6730 { 6730 {
6731 int fields, tem; 6731 int fields, tem;
@@ -6993,7 +6993,7 @@ xlfd_strip_height (char *fontname)
6993} 6993}
6994 6994
6995/* Assume parameter 1 is fully qualified, no wildcards. */ 6995/* Assume parameter 1 is fully qualified, no wildcards. */
6996static BOOL 6996static BOOL
6997w32_font_match (fontname, pattern) 6997w32_font_match (fontname, pattern)
6998 char * fontname; 6998 char * fontname;
6999 char * pattern; 6999 char * pattern;
@@ -7055,7 +7055,7 @@ w32_font_match (fontname, pattern)
7055 font from each family, the second pass lists all the fonts from 7055 font from each family, the second pass lists all the fonts from
7056 each family. */ 7056 each family. */
7057 7057
7058typedef struct enumfont_t 7058typedef struct enumfont_t
7059{ 7059{
7060 HDC hdc; 7060 HDC hdc;
7061 int numFonts; 7061 int numFonts;
@@ -7070,7 +7070,7 @@ static void
7070enum_font_maybe_add_to_list (enumfont_t *, LOGFONT *, char *, Lisp_Object); 7070enum_font_maybe_add_to_list (enumfont_t *, LOGFONT *, char *, Lisp_Object);
7071 7071
7072 7072
7073static int CALLBACK 7073static int CALLBACK
7074enum_font_cb2 (lplf, lptm, FontType, lpef) 7074enum_font_cb2 (lplf, lptm, FontType, lpef)
7075 ENUMLOGFONT * lplf; 7075 ENUMLOGFONT * lplf;
7076 NEWTEXTMETRIC * lptm; 7076 NEWTEXTMETRIC * lptm;
@@ -7226,7 +7226,7 @@ enum_font_maybe_add_to_list (lpef, logfont, match_charset, width)
7226} 7226}
7227 7227
7228 7228
7229static int CALLBACK 7229static int CALLBACK
7230enum_font_cb1 (lplf, lptm, FontType, lpef) 7230enum_font_cb1 (lplf, lptm, FontType, lpef)
7231 ENUMLOGFONT * lplf; 7231 ENUMLOGFONT * lplf;
7232 NEWTEXTMETRIC * lptm; 7232 NEWTEXTMETRIC * lptm;
@@ -7413,7 +7413,7 @@ w32_list_fonts (f, pattern, size, maxnames)
7413 7413
7414 newlist = second_best = Qnil; 7414 newlist = second_best = Qnil;
7415 7415
7416 /* Make a list of the fonts that have the right width. */ 7416 /* Make a list of the fonts that have the right width. */
7417 for (; CONSP (list); list = XCDR (list)) 7417 for (; CONSP (list); list = XCDR (list))
7418 { 7418 {
7419 int found_size; 7419 int found_size;
@@ -7475,7 +7475,7 @@ w32_list_fonts (f, pattern, size, maxnames)
7475 { 7475 {
7476 if (NILP (second_best)) 7476 if (NILP (second_best))
7477 second_best = tem; 7477 second_best = tem;
7478 7478
7479 else if (found_size < size) 7479 else if (found_size < size)
7480 { 7480 {
7481 if (XINT (XCDR (second_best)) > size 7481 if (XINT (XCDR (second_best)) > size
@@ -7761,9 +7761,9 @@ If omitted or nil, that stands for the selected frame's display. */)
7761 and because probably is more meaningful on Windows anyway */ 7761 and because probably is more meaningful on Windows anyway */
7762 if (cap < 0) 7762 if (cap < 0)
7763 cap = 1 << min(dpyinfo->n_planes * dpyinfo->n_cbits, 24); 7763 cap = 1 << min(dpyinfo->n_planes * dpyinfo->n_cbits, 24);
7764 7764
7765 ReleaseDC (dpyinfo->root_window, hdc); 7765 ReleaseDC (dpyinfo->root_window, hdc);
7766 7766
7767 return make_number (cap); 7767 return make_number (cap);
7768} 7768}
7769 7769
@@ -7835,11 +7835,11 @@ If omitted or nil, that stands for the selected frame's display. */)
7835 int cap; 7835 int cap;
7836 7836
7837 hdc = GetDC (dpyinfo->root_window); 7837 hdc = GetDC (dpyinfo->root_window);
7838 7838
7839 cap = GetDeviceCaps (hdc, VERTSIZE); 7839 cap = GetDeviceCaps (hdc, VERTSIZE);
7840 7840
7841 ReleaseDC (dpyinfo->root_window, hdc); 7841 ReleaseDC (dpyinfo->root_window, hdc);
7842 7842
7843 return make_number (cap); 7843 return make_number (cap);
7844} 7844}
7845 7845
@@ -7857,11 +7857,11 @@ If omitted or nil, that stands for the selected frame's display. */)
7857 int cap; 7857 int cap;
7858 7858
7859 hdc = GetDC (dpyinfo->root_window); 7859 hdc = GetDC (dpyinfo->root_window);
7860 7860
7861 cap = GetDeviceCaps (hdc, HORZSIZE); 7861 cap = GetDeviceCaps (hdc, HORZSIZE);
7862 7862
7863 ReleaseDC (dpyinfo->root_window, hdc); 7863 ReleaseDC (dpyinfo->root_window, hdc);
7864 7864
7865 return make_number (cap); 7865 return make_number (cap);
7866} 7866}
7867 7867
@@ -8226,7 +8226,7 @@ valid_image_p (object)
8226 Lisp_Object object; 8226 Lisp_Object object;
8227{ 8227{
8228 int valid_p = 0; 8228 int valid_p = 0;
8229 8229
8230 if (CONSP (object) && EQ (XCAR (object), Qimage)) 8230 if (CONSP (object) && EQ (XCAR (object), Qimage))
8231 { 8231 {
8232 Lisp_Object tem; 8232 Lisp_Object tem;
@@ -8361,7 +8361,7 @@ parse_image_spec (spec, keywords, nkeywords, type)
8361 was found more than once, it's an error. */ 8361 was found more than once, it's an error. */
8362 keywords[i].value = value; 8362 keywords[i].value = value;
8363 ++keywords[i].count; 8363 ++keywords[i].count;
8364 8364
8365 if (keywords[i].count > 1) 8365 if (keywords[i].count > 1)
8366 return 0; 8366 return 0;
8367 8367
@@ -8416,7 +8416,7 @@ parse_image_spec (spec, keywords, nkeywords, type)
8416 8416
8417 case IMAGE_FUNCTION_VALUE: 8417 case IMAGE_FUNCTION_VALUE:
8418 value = indirect_function (value); 8418 value = indirect_function (value);
8419 if (SUBRP (value) 8419 if (SUBRP (value)
8420 || COMPILEDP (value) 8420 || COMPILEDP (value)
8421 || (CONSP (value) && EQ (XCAR (value), Qlambda))) 8421 || (CONSP (value) && EQ (XCAR (value), Qlambda)))
8422 break; 8422 break;
@@ -8465,7 +8465,7 @@ image_spec_value (spec, key, found)
8465 int *found; 8465 int *found;
8466{ 8466{
8467 Lisp_Object tail; 8467 Lisp_Object tail;
8468 8468
8469 xassert (valid_image_p (spec)); 8469 xassert (valid_image_p (spec));
8470 8470
8471 for (tail = XCDR (spec); 8471 for (tail = XCDR (spec);
@@ -8479,12 +8479,12 @@ image_spec_value (spec, key, found)
8479 return XCAR (XCDR (tail)); 8479 return XCAR (XCDR (tail));
8480 } 8480 }
8481 } 8481 }
8482 8482
8483 if (found) 8483 if (found)
8484 *found = 0; 8484 *found = 0;
8485 return Qnil; 8485 return Qnil;
8486} 8486}
8487 8487
8488 8488
8489DEFUN ("image-size", Fimage_size, Simage_size, 1, 3, 0, 8489DEFUN ("image-size", Fimage_size, Simage_size, 1, 3, 0,
8490 doc: /* Return the size of image SPEC as pair (WIDTH . HEIGHT). 8490 doc: /* Return the size of image SPEC as pair (WIDTH . HEIGHT).
@@ -8505,7 +8505,7 @@ or omitted means use the selected frame. */)
8505 struct image *img = IMAGE_FROM_ID (f, id); 8505 struct image *img = IMAGE_FROM_ID (f, id);
8506 int width = img->width + 2 * img->hmargin; 8506 int width = img->width + 2 * img->hmargin;
8507 int height = img->height + 2 * img->vmargin; 8507 int height = img->height + 2 * img->vmargin;
8508 8508
8509 if (NILP (pixels)) 8509 if (NILP (pixels))
8510 size = Fcons (make_float ((double) width / CANON_X_UNIT (f)), 8510 size = Fcons (make_float ((double) width / CANON_X_UNIT (f)),
8511 make_float ((double) height / CANON_Y_UNIT (f))); 8511 make_float ((double) height / CANON_Y_UNIT (f)));
@@ -8561,7 +8561,7 @@ make_image (spec, hash)
8561 unsigned hash; 8561 unsigned hash;
8562{ 8562{
8563 struct image *img = (struct image *) xmalloc (sizeof *img); 8563 struct image *img = (struct image *) xmalloc (sizeof *img);
8564 8564
8565 xassert (valid_image_p (spec)); 8565 xassert (valid_image_p (spec));
8566 bzero (img, sizeof *img); 8566 bzero (img, sizeof *img);
8567 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); 8567 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
@@ -8622,7 +8622,7 @@ prepare_image_for_display (f, img)
8622 if (img->pixmap == 0 && !img->load_failed_p) 8622 if (img->pixmap == 0 && !img->load_failed_p)
8623 img->load_failed_p = img->type->load (f, img) == 0; 8623 img->load_failed_p = img->type->load (f, img) == 0;
8624} 8624}
8625 8625
8626 8626
8627/* Value is the number of pixels for the ascent of image IMG when 8627/* Value is the number of pixels for the ascent of image IMG when
8628 drawn in face FACE. */ 8628 drawn in face FACE. */
@@ -8673,7 +8673,7 @@ four_corners_best (ximg, width, height)
8673 for (i = best_count = 0; i < 4; ++i) 8673 for (i = best_count = 0; i < 4; ++i)
8674 { 8674 {
8675 int j, n; 8675 int j, n;
8676 8676
8677 for (j = n = 0; j < 4; ++j) 8677 for (j = n = 0; j < 4; ++j)
8678 if (corners[i] == corners[j]) 8678 if (corners[i] == corners[j])
8679 ++n; 8679 ++n;
@@ -8793,7 +8793,7 @@ x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p)
8793 img->mask = NULL; 8793 img->mask = NULL;
8794 img->background_transparent_valid = 0; 8794 img->background_transparent_valid = 0;
8795 } 8795 }
8796 8796
8797 if (colors_p && img->ncolors) 8797 if (colors_p && img->ncolors)
8798 { 8798 {
8799#if 0 /* TODO: color table support. */ 8799#if 0 /* TODO: color table support. */
@@ -8825,7 +8825,7 @@ x_clear_image (f, img)
8825#if 0 /* TODO: color table support */ 8825#if 0 /* TODO: color table support */
8826 8826
8827 int class = FRAME_W32_DISPLAY_INFO (f)->visual->class; 8827 int class = FRAME_W32_DISPLAY_INFO (f)->visual->class;
8828 8828
8829 /* If display has an immutable color map, freeing colors is not 8829 /* If display has an immutable color map, freeing colors is not
8830 necessary and some servers don't allow it. So don't do it. */ 8830 necessary and some servers don't allow it. So don't do it. */
8831 if (class != StaticColor 8831 if (class != StaticColor
@@ -8840,7 +8840,7 @@ x_clear_image (f, img)
8840 UNBLOCK_INPUT; 8840 UNBLOCK_INPUT;
8841 } 8841 }
8842#endif 8842#endif
8843 8843
8844 xfree (img->colors); 8844 xfree (img->colors);
8845 img->colors = NULL; 8845 img->colors = NULL;
8846 img->ncolors = 0; 8846 img->ncolors = 0;
@@ -8899,7 +8899,7 @@ make_image_cache ()
8899{ 8899{
8900 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c); 8900 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
8901 int size; 8901 int size;
8902 8902
8903 bzero (c, sizeof *c); 8903 bzero (c, sizeof *c);
8904 c->size = 50; 8904 c->size = 50;
8905 c->images = (struct image **) xmalloc (c->size * sizeof *c->images); 8905 c->images = (struct image **) xmalloc (c->size * sizeof *c->images);
@@ -8924,7 +8924,7 @@ free_image_cache (f)
8924 8924
8925 /* Cache should not be referenced by any frame when freed. */ 8925 /* Cache should not be referenced by any frame when freed. */
8926 xassert (c->refcount == 0); 8926 xassert (c->refcount == 0);
8927 8927
8928 for (i = 0; i < c->used; ++i) 8928 for (i = 0; i < c->used; ++i)
8929 free_image (f, c->images[i]); 8929 free_image (f, c->images[i]);
8930 xfree (c->images); 8930 xfree (c->images);
@@ -8957,11 +8957,11 @@ clear_image_cache (f, force_p)
8957 8957
8958 EMACS_GET_TIME (t); 8958 EMACS_GET_TIME (t);
8959 old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay); 8959 old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay);
8960 8960
8961 /* Block input so that we won't be interrupted by a SIGIO 8961 /* Block input so that we won't be interrupted by a SIGIO
8962 while being in an inconsistent state. */ 8962 while being in an inconsistent state. */
8963 BLOCK_INPUT; 8963 BLOCK_INPUT;
8964 8964
8965 for (i = nfreed = 0; i < c->used; ++i) 8965 for (i = nfreed = 0; i < c->used; ++i)
8966 { 8966 {
8967 struct image *img = c->images[i]; 8967 struct image *img = c->images[i];
@@ -8980,7 +8980,7 @@ clear_image_cache (f, force_p)
8980 if (nfreed) 8980 if (nfreed)
8981 { 8981 {
8982 Lisp_Object tail, frame; 8982 Lisp_Object tail, frame;
8983 8983
8984 FOR_EACH_FRAME (tail, frame) 8984 FOR_EACH_FRAME (tail, frame)
8985 { 8985 {
8986 struct frame *f = XFRAME (frame); 8986 struct frame *f = XFRAME (frame);
@@ -9008,7 +9008,7 @@ FRAME t means clear the image caches of all frames. */)
9008 if (EQ (frame, Qt)) 9008 if (EQ (frame, Qt))
9009 { 9009 {
9010 Lisp_Object tail; 9010 Lisp_Object tail;
9011 9011
9012 FOR_EACH_FRAME (tail, frame) 9012 FOR_EACH_FRAME (tail, frame)
9013 if (FRAME_W32_P (XFRAME (frame))) 9013 if (FRAME_W32_P (XFRAME (frame)))
9014 clear_image_cache (XFRAME (frame), 1); 9014 clear_image_cache (XFRAME (frame), 1);
@@ -9036,7 +9036,7 @@ postprocess_image (f, img)
9036 Lisp_Object mask; 9036 Lisp_Object mask;
9037 9037
9038 spec = img->spec; 9038 spec = img->spec;
9039 9039
9040 /* `:heuristic-mask t' 9040 /* `:heuristic-mask t'
9041 `:mask heuristic' 9041 `:mask heuristic'
9042 means build a mask heuristically. 9042 means build a mask heuristically.
@@ -9046,16 +9046,16 @@ postprocess_image (f, img)
9046 image. 9046 image.
9047 `:mask nil' 9047 `:mask nil'
9048 means remove a mask, if any. */ 9048 means remove a mask, if any. */
9049 9049
9050 mask = image_spec_value (spec, QCheuristic_mask, NULL); 9050 mask = image_spec_value (spec, QCheuristic_mask, NULL);
9051 if (!NILP (mask)) 9051 if (!NILP (mask))
9052 x_build_heuristic_mask (f, img, mask); 9052 x_build_heuristic_mask (f, img, mask);
9053 else 9053 else
9054 { 9054 {
9055 int found_p; 9055 int found_p;
9056 9056
9057 mask = image_spec_value (spec, QCmask, &found_p); 9057 mask = image_spec_value (spec, QCmask, &found_p);
9058 9058
9059 if (EQ (mask, Qheuristic)) 9059 if (EQ (mask, Qheuristic))
9060 x_build_heuristic_mask (f, img, Qt); 9060 x_build_heuristic_mask (f, img, Qt);
9061 else if (CONSP (mask) 9061 else if (CONSP (mask)
@@ -9072,8 +9072,8 @@ postprocess_image (f, img)
9072 img->mask = NULL; 9072 img->mask = NULL;
9073 } 9073 }
9074 } 9074 }
9075 9075
9076 9076
9077 /* Should we apply an image transformation algorithm? */ 9077 /* Should we apply an image transformation algorithm? */
9078 conversion = image_spec_value (spec, QCconversion, NULL); 9078 conversion = image_spec_value (spec, QCconversion, NULL);
9079 if (EQ (conversion, Qdisabled)) 9079 if (EQ (conversion, Qdisabled))
@@ -9116,7 +9116,7 @@ lookup_image (f, spec)
9116 specification. */ 9116 specification. */
9117 xassert (FRAME_WINDOW_P (f)); 9117 xassert (FRAME_WINDOW_P (f));
9118 xassert (valid_image_p (spec)); 9118 xassert (valid_image_p (spec));
9119 9119
9120 GCPRO1 (spec); 9120 GCPRO1 (spec);
9121 9121
9122 /* Look up SPEC in the hash table of the image cache. */ 9122 /* Look up SPEC in the hash table of the image cache. */
@@ -9175,7 +9175,7 @@ lookup_image (f, spec)
9175 if (XINT (XCDR (margin)) > 0) 9175 if (XINT (XCDR (margin)) > 0)
9176 img->vmargin = XFASTINT (XCDR (margin)); 9176 img->vmargin = XFASTINT (XCDR (margin));
9177 } 9177 }
9178 9178
9179 relief = image_spec_value (spec, QCrelief, NULL); 9179 relief = image_spec_value (spec, QCrelief, NULL);
9180 if (INTEGERP (relief)) 9180 if (INTEGERP (relief))
9181 { 9181 {
@@ -9209,9 +9209,9 @@ lookup_image (f, spec)
9209 /* We're using IMG, so set its timestamp to `now'. */ 9209 /* We're using IMG, so set its timestamp to `now'. */
9210 EMACS_GET_TIME (now); 9210 EMACS_GET_TIME (now);
9211 img->timestamp = EMACS_SECS (now); 9211 img->timestamp = EMACS_SECS (now);
9212 9212
9213 UNGCPRO; 9213 UNGCPRO;
9214 9214
9215 /* Value is the image id. */ 9215 /* Value is the image id. */
9216 return img->id; 9216 return img->id;
9217} 9217}
@@ -9436,7 +9436,7 @@ x_find_image_file (file)
9436 9436
9437 /* Try to find FILE in data-directory, then x-bitmap-file-path. */ 9437 /* Try to find FILE in data-directory, then x-bitmap-file-path. */
9438 fd = openp (search_path, file, Qnil, &file_found, Qnil); 9438 fd = openp (search_path, file, Qnil, &file_found, Qnil);
9439 9439
9440 if (fd == -1) 9440 if (fd == -1)
9441 file_found = Qnil; 9441 file_found = Qnil;
9442 else 9442 else
@@ -9478,7 +9478,7 @@ slurp_file (file, size)
9478 buf = NULL; 9478 buf = NULL;
9479 } 9479 }
9480 } 9480 }
9481 9481
9482 return buf; 9482 return buf;
9483} 9483}
9484 9484
@@ -9557,7 +9557,7 @@ enum xbm_token
9557 XBM_TK_NUMBER 9557 XBM_TK_NUMBER
9558}; 9558};
9559 9559
9560 9560
9561/* Return non-zero if OBJECT is a valid XBM-type image specification. 9561/* Return non-zero if OBJECT is a valid XBM-type image specification.
9562 A valid specification is a list starting with the symbol `image' 9562 A valid specification is a list starting with the symbol `image'
9563 The rest of the list is a property list which must contain an 9563 The rest of the list is a property list which must contain an
@@ -9592,7 +9592,7 @@ xbm_image_p (object)
9592 Lisp_Object object; 9592 Lisp_Object object;
9593{ 9593{
9594 struct image_keyword kw[XBM_LAST]; 9594 struct image_keyword kw[XBM_LAST];
9595 9595
9596 bcopy (xbm_format, kw, sizeof kw); 9596 bcopy (xbm_format, kw, sizeof kw);
9597 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm)) 9597 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
9598 return 0; 9598 return 0;
@@ -9624,13 +9624,13 @@ xbm_image_p (object)
9624 data = kw[XBM_DATA].value; 9624 data = kw[XBM_DATA].value;
9625 width = XFASTINT (kw[XBM_WIDTH].value); 9625 width = XFASTINT (kw[XBM_WIDTH].value);
9626 height = XFASTINT (kw[XBM_HEIGHT].value); 9626 height = XFASTINT (kw[XBM_HEIGHT].value);
9627 9627
9628 /* Check type of data, and width and height against contents of 9628 /* Check type of data, and width and height against contents of
9629 data. */ 9629 data. */
9630 if (VECTORP (data)) 9630 if (VECTORP (data))
9631 { 9631 {
9632 int i; 9632 int i;
9633 9633
9634 /* Number of elements of the vector must be >= height. */ 9634 /* Number of elements of the vector must be >= height. */
9635 if (XVECTOR (data)->size < height) 9635 if (XVECTOR (data)->size < height)
9636 return 0; 9636 return 0;
@@ -9700,7 +9700,7 @@ xbm_scan (s, end, sval, ival)
9700 else if (isdigit (c)) 9700 else if (isdigit (c))
9701 { 9701 {
9702 int value = 0, digit; 9702 int value = 0, digit;
9703 9703
9704 if (c == '0' && *s < end) 9704 if (c == '0' && *s < end)
9705 { 9705 {
9706 c = *(*s)++; 9706 c = *(*s)++;
@@ -9838,7 +9838,7 @@ xbm_read_bitmap_data (contents, end, width, height, data)
9838 if (LA1 != (TOKEN)) \ 9838 if (LA1 != (TOKEN)) \
9839 goto failure; \ 9839 goto failure; \
9840 else \ 9840 else \
9841 match () 9841 match ()
9842 9842
9843#define expect_ident(IDENT) \ 9843#define expect_ident(IDENT) \
9844 if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \ 9844 if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \
@@ -9881,7 +9881,7 @@ xbm_read_bitmap_data (contents, end, width, height, data)
9881 { 9881 {
9882 if (strcmp (buffer, "unsigned") == 0) 9882 if (strcmp (buffer, "unsigned") == 0)
9883 { 9883 {
9884 match (); 9884 match ();
9885 expect_ident ("char"); 9885 expect_ident ("char");
9886 } 9886 }
9887 else if (strcmp (buffer, "short") == 0) 9887 else if (strcmp (buffer, "short") == 0)
@@ -9896,7 +9896,7 @@ xbm_read_bitmap_data (contents, end, width, height, data)
9896 else 9896 else
9897 goto failure; 9897 goto failure;
9898 } 9898 }
9899 else 9899 else
9900 goto failure; 9900 goto failure;
9901 9901
9902 expect (XBM_TK_IDENT); 9902 expect (XBM_TK_IDENT);
@@ -9919,7 +9919,7 @@ xbm_read_bitmap_data (contents, end, width, height, data)
9919 *p++ = val; 9919 *p++ = val;
9920 if (!padding_p || ((i + 2) % bytes_per_line)) 9920 if (!padding_p || ((i + 2) % bytes_per_line))
9921 *p++ = value >> 8; 9921 *p++ = value >> 8;
9922 9922
9923 if (LA1 == ',' || LA1 == '}') 9923 if (LA1 == ',' || LA1 == '}')
9924 match (); 9924 match ();
9925 else 9925 else
@@ -9932,7 +9932,7 @@ xbm_read_bitmap_data (contents, end, width, height, data)
9932 { 9932 {
9933 int val = value; 9933 int val = value;
9934 expect (XBM_TK_NUMBER); 9934 expect (XBM_TK_NUMBER);
9935 9935
9936 *p++ = val; 9936 *p++ = val;
9937 9937
9938 if (LA1 == ',' || LA1 == '}') 9938 if (LA1 == ',' || LA1 == '}')
@@ -9973,14 +9973,14 @@ xbm_load_image (f, img, contents, end)
9973 int rc; 9973 int rc;
9974 unsigned char *data; 9974 unsigned char *data;
9975 int success_p = 0; 9975 int success_p = 0;
9976 9976
9977 rc = xbm_read_bitmap_data (contents, end, &img->width, &img->height, &data); 9977 rc = xbm_read_bitmap_data (contents, end, &img->width, &img->height, &data);
9978 if (rc) 9978 if (rc)
9979 { 9979 {
9980 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); 9980 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
9981 unsigned long background = FRAME_BACKGROUND_PIXEL (f); 9981 unsigned long background = FRAME_BACKGROUND_PIXEL (f);
9982 Lisp_Object value; 9982 Lisp_Object value;
9983 9983
9984 xassert (img->width > 0 && img->height > 0); 9984 xassert (img->width > 0 && img->height > 0);
9985 9985
9986 /* Get foreground and background colors, maybe allocate colors. */ 9986 /* Get foreground and background colors, maybe allocate colors. */
@@ -10028,7 +10028,7 @@ xbm_file_p (data)
10028 &w, &h, NULL)); 10028 &w, &h, NULL));
10029} 10029}
10030 10030
10031 10031
10032/* Fill image IMG which is used on frame F with pixmap data. Value is 10032/* Fill image IMG which is used on frame F with pixmap data. Value is
10033 non-zero if successful. */ 10033 non-zero if successful. */
10034 10034
@@ -10120,7 +10120,7 @@ xbm_load (f, img)
10120 int i; 10120 int i;
10121 char *p; 10121 char *p;
10122 int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR; 10122 int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
10123 10123
10124 p = bits = (char *) alloca (nbytes * img->height); 10124 p = bits = (char *) alloca (nbytes * img->height);
10125 for (i = 0; i < img->height; ++i, p += nbytes) 10125 for (i = 0; i < img->height; ++i, p += nbytes)
10126 { 10126 {
@@ -10155,14 +10155,14 @@ xbm_load (f, img)
10155 10155
10156 return success_p; 10156 return success_p;
10157} 10157}
10158 10158
10159 10159
10160 10160
10161/*********************************************************************** 10161/***********************************************************************
10162 XPM images 10162 XPM images
10163 ***********************************************************************/ 10163 ***********************************************************************/
10164 10164
10165#if HAVE_XPM 10165#if HAVE_XPM
10166 10166
10167static int xpm_image_p P_ ((Lisp_Object object)); 10167static int xpm_image_p P_ ((Lisp_Object object));
10168static int xpm_load P_ ((struct frame *f, struct image *img)); 10168static int xpm_load P_ ((struct frame *f, struct image *img));
@@ -10300,7 +10300,7 @@ xpm_load (f, img)
10300 Lisp_Object tail; 10300 Lisp_Object tail;
10301 XpmColorSymbol *xpm_syms; 10301 XpmColorSymbol *xpm_syms;
10302 int i, size; 10302 int i, size;
10303 10303
10304 attrs.valuemask |= XpmColorSymbols; 10304 attrs.valuemask |= XpmColorSymbols;
10305 10305
10306 /* Count number of symbols. */ 10306 /* Count number of symbols. */
@@ -10341,7 +10341,7 @@ xpm_load (f, img)
10341 UNBLOCK_INPUT; 10341 UNBLOCK_INPUT;
10342 return 0; 10342 return 0;
10343 } 10343 }
10344 10344
10345 rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f), 10345 rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f),
10346 SDATA (file), &img->pixmap, &img->mask, 10346 SDATA (file), &img->pixmap, &img->mask,
10347 &attrs); 10347 &attrs);
@@ -10381,19 +10381,19 @@ xpm_load (f, img)
10381 case XpmOpenFailed: 10381 case XpmOpenFailed:
10382 image_error ("Error opening XPM file (%s)", img->spec, Qnil); 10382 image_error ("Error opening XPM file (%s)", img->spec, Qnil);
10383 break; 10383 break;
10384 10384
10385 case XpmFileInvalid: 10385 case XpmFileInvalid:
10386 image_error ("Invalid XPM file (%s)", img->spec, Qnil); 10386 image_error ("Invalid XPM file (%s)", img->spec, Qnil);
10387 break; 10387 break;
10388 10388
10389 case XpmNoMemory: 10389 case XpmNoMemory:
10390 image_error ("Out of memory (%s)", img->spec, Qnil); 10390 image_error ("Out of memory (%s)", img->spec, Qnil);
10391 break; 10391 break;
10392 10392
10393 case XpmColorFailed: 10393 case XpmColorFailed:
10394 image_error ("Color allocation error (%s)", img->spec, Qnil); 10394 image_error ("Color allocation error (%s)", img->spec, Qnil);
10395 break; 10395 break;
10396 10396
10397 default: 10397 default:
10398 image_error ("Unknown error (%s)", img->spec, Qnil); 10398 image_error ("Unknown error (%s)", img->spec, Qnil);
10399 break; 10399 break;
@@ -10542,7 +10542,7 @@ lookup_pixel_color (f, pixel)
10542 int rc; 10542 int rc;
10543 10543
10544 BLOCK_INPUT; 10544 BLOCK_INPUT;
10545 10545
10546 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f)); 10546 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
10547 color.pixel = pixel; 10547 color.pixel = pixel;
10548 XQueryColor (NULL, cmap, &color); 10548 XQueryColor (NULL, cmap, &color);
@@ -10552,7 +10552,7 @@ lookup_pixel_color (f, pixel)
10552 if (rc) 10552 if (rc)
10553 { 10553 {
10554 ++ct_colors_allocated; 10554 ++ct_colors_allocated;
10555 10555
10556 p = (struct ct_color *) xmalloc (sizeof *p); 10556 p = (struct ct_color *) xmalloc (sizeof *p);
10557 p->r = color.red; 10557 p->r = color.red;
10558 p->g = color.green; 10558 p->g = color.green;
@@ -10589,7 +10589,7 @@ colors_in_color_table (n)
10589 colors = (unsigned long *) xmalloc (ct_colors_allocated 10589 colors = (unsigned long *) xmalloc (ct_colors_allocated
10590 * sizeof *colors); 10590 * sizeof *colors);
10591 *n = ct_colors_allocated; 10591 *n = ct_colors_allocated;
10592 10592
10593 for (i = j = 0; i < CT_SIZE; ++i) 10593 for (i = j = 0; i < CT_SIZE; ++i)
10594 for (p = ct_table[i]; p; p = p->next) 10594 for (p = ct_table[i]; p; p = p->next)
10595 colors[j++] = p->pixel; 10595 colors[j++] = p->pixel;
@@ -10665,7 +10665,7 @@ x_to_xcolors (f, img, rgb_p)
10665 for (y = 0; y < img->height; ++y) 10665 for (y = 0; y < img->height; ++y)
10666 { 10666 {
10667 XColor *row = p; 10667 XColor *row = p;
10668 10668
10669 for (x = 0; x < img->width; ++x, ++p) 10669 for (x = 0; x < img->width; ++x, ++p)
10670 p->pixel = XGetPixel (ximg, x, y); 10670 p->pixel = XGetPixel (ximg, x, y);
10671 10671
@@ -10755,7 +10755,7 @@ x_from_xcolors (f, img, colors)
10755 10755
10756 MATRIX is a nine-element array specifying the transformation 10756 MATRIX is a nine-element array specifying the transformation
10757 matrix. See emboss_matrix for an example. 10757 matrix. See emboss_matrix for an example.
10758 10758
10759 COLOR_ADJUST is a color adjustment added to each pixel of the 10759 COLOR_ADJUST is a color adjustment added to each pixel of the
10760 outgoing image. */ 10760 outgoing image. */
10761 10761
@@ -10783,7 +10783,7 @@ x_detect_edges (f, img, matrix, color_adjust)
10783 p = COLOR (new, img->width - 1, y); 10783 p = COLOR (new, img->width - 1, y);
10784 p->red = p->green = p->blue = 0xffff/2; 10784 p->red = p->green = p->blue = 0xffff/2;
10785 } 10785 }
10786 10786
10787 for (x = 1; x < img->width - 1; ++x) 10787 for (x = 1; x < img->width - 1; ++x)
10788 { 10788 {
10789 p = COLOR (new, x, 0); 10789 p = COLOR (new, x, 0);
@@ -10795,7 +10795,7 @@ x_detect_edges (f, img, matrix, color_adjust)
10795 for (y = 1; y < img->height - 1; ++y) 10795 for (y = 1; y < img->height - 1; ++y)
10796 { 10796 {
10797 p = COLOR (new, 1, y); 10797 p = COLOR (new, 1, y);
10798 10798
10799 for (x = 1; x < img->width - 1; ++x, ++p) 10799 for (x = 1; x < img->width - 1; ++x, ++p)
10800 { 10800 {
10801 int r, g, b, y1, x1; 10801 int r, g, b, y1, x1;
@@ -10869,7 +10869,7 @@ x_edge_detection (f, img, matrix, color_adjust)
10869{ 10869{
10870 int i = 0; 10870 int i = 0;
10871 int trans[9]; 10871 int trans[9];
10872 10872
10873 if (CONSP (matrix)) 10873 if (CONSP (matrix))
10874 { 10874 {
10875 for (i = 0; 10875 for (i = 0;
@@ -10992,7 +10992,7 @@ x_build_heuristic_mask (f, img, how)
10992 /* Determine the background color of ximg. If HOW is `(R G B)' 10992 /* Determine the background color of ximg. If HOW is `(R G B)'
10993 take that as color. Otherwise, use the image's background color. */ 10993 take that as color. Otherwise, use the image's background color. */
10994 use_img_background = 1; 10994 use_img_background = 1;
10995 10995
10996 if (CONSP (how)) 10996 if (CONSP (how))
10997 { 10997 {
10998 int rgb[3], i; 10998 int rgb[3], i;
@@ -11011,7 +11011,7 @@ x_build_heuristic_mask (f, img, how)
11011 use_img_background = 0; 11011 use_img_background = 0;
11012 } 11012 }
11013 } 11013 }
11014 11014
11015 if (use_img_background) 11015 if (use_img_background)
11016 bg = four_corners_best (ximg, img->width, img->height); 11016 bg = four_corners_best (ximg, img->width, img->height);
11017 11017
@@ -11103,11 +11103,11 @@ pbm_image_p (object)
11103 Lisp_Object object; 11103 Lisp_Object object;
11104{ 11104{
11105 struct image_keyword fmt[PBM_LAST]; 11105 struct image_keyword fmt[PBM_LAST];
11106 11106
11107 bcopy (pbm_format, fmt, sizeof fmt); 11107 bcopy (pbm_format, fmt, sizeof fmt);
11108 11108
11109 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm) 11109 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)
11110 || (fmt[PBM_ASCENT].count 11110 || (fmt[PBM_ASCENT].count
11111 && XFASTINT (fmt[PBM_ASCENT].value) > 100)) 11111 && XFASTINT (fmt[PBM_ASCENT].value) > 100))
11112 return 0; 11112 return 0;
11113 11113
@@ -11185,14 +11185,14 @@ pbm_read_file (file, size)
11185 buf = NULL; 11185 buf = NULL;
11186 } 11186 }
11187 } 11187 }
11188 11188
11189 return buf; 11189 return buf;
11190} 11190}
11191 11191
11192 11192
11193/* Load PBM image IMG for use on frame F. */ 11193/* Load PBM image IMG for use on frame F. */
11194 11194
11195static int 11195static int
11196pbm_load (f, img) 11196pbm_load (f, img)
11197 struct frame *f; 11197 struct frame *f;
11198 struct image *img; 11198 struct image *img;
@@ -11255,7 +11255,7 @@ pbm_load (f, img)
11255 case '1': 11255 case '1':
11256 raw_p = 0, type = PBM_MONO; 11256 raw_p = 0, type = PBM_MONO;
11257 break; 11257 break;
11258 11258
11259 case '2': 11259 case '2':
11260 raw_p = 0, type = PBM_GRAY; 11260 raw_p = 0, type = PBM_GRAY;
11261 break; 11261 break;
@@ -11267,11 +11267,11 @@ pbm_load (f, img)
11267 case '4': 11267 case '4':
11268 raw_p = 1, type = PBM_MONO; 11268 raw_p = 1, type = PBM_MONO;
11269 break; 11269 break;
11270 11270
11271 case '5': 11271 case '5':
11272 raw_p = 1, type = PBM_GRAY; 11272 raw_p = 1, type = PBM_GRAY;
11273 break; 11273 break;
11274 11274
11275 case '6': 11275 case '6':
11276 raw_p = 1, type = PBM_COLOR; 11276 raw_p = 1, type = PBM_COLOR;
11277 break; 11277 break;
@@ -11292,7 +11292,7 @@ pbm_load (f, img)
11292 if (raw_p && max_color_idx > 255) 11292 if (raw_p && max_color_idx > 255)
11293 max_color_idx = 255; 11293 max_color_idx = 255;
11294 } 11294 }
11295 11295
11296 if (width < 0 11296 if (width < 0
11297 || height < 0 11297 || height < 0
11298 || (type != PBM_MONO && max_color_idx < 0)) 11298 || (type != PBM_MONO && max_color_idx < 0))
@@ -11316,7 +11316,7 @@ pbm_load (f, img)
11316 /* Parse the image specification. */ 11316 /* Parse the image specification. */
11317 bcopy (pbm_format, fmt, sizeof fmt); 11317 bcopy (pbm_format, fmt, sizeof fmt);
11318 parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm); 11318 parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm);
11319 11319
11320 /* Get foreground and background colors, maybe allocate colors. */ 11320 /* Get foreground and background colors, maybe allocate colors. */
11321 if (fmt[PBM_FOREGROUND].count 11321 if (fmt[PBM_FOREGROUND].count
11322 && STRINGP (fmt[PBM_FOREGROUND].value)) 11322 && STRINGP (fmt[PBM_FOREGROUND].value))
@@ -11351,7 +11351,7 @@ pbm_load (f, img)
11351 for (x = 0; x < width; ++x) 11351 for (x = 0; x < width; ++x)
11352 { 11352 {
11353 int r, g, b; 11353 int r, g, b;
11354 11354
11355 if (type == PBM_GRAY) 11355 if (type == PBM_GRAY)
11356 r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end); 11356 r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end);
11357 else if (raw_p) 11357 else if (raw_p)
@@ -11366,7 +11366,7 @@ pbm_load (f, img)
11366 g = pbm_scan_number (&p, end); 11366 g = pbm_scan_number (&p, end);
11367 b = pbm_scan_number (&p, end); 11367 b = pbm_scan_number (&p, end);
11368 } 11368 }
11369 11369
11370 if (r < 0 || g < 0 || b < 0) 11370 if (r < 0 || g < 0 || b < 0)
11371 { 11371 {
11372 x_destroy_x_image (ximg); 11372 x_destroy_x_image (ximg);
@@ -11374,7 +11374,7 @@ pbm_load (f, img)
11374 img->spec, Qnil); 11374 img->spec, Qnil);
11375 goto error; 11375 goto error;
11376 } 11376 }
11377 11377
11378 /* RGB values are now in the range 0..max_color_idx. 11378 /* RGB values are now in the range 0..max_color_idx.
11379 Scale this to the range 0..0xff supported by W32. */ 11379 Scale this to the range 0..0xff supported by W32. */
11380 r = (int) ((double) r * 255 / max_color_idx); 11380 r = (int) ((double) r * 255 / max_color_idx);
@@ -11398,11 +11398,11 @@ pbm_load (f, img)
11398 /* Maybe fill in the background field while we have ximg handy. */ 11398 /* Maybe fill in the background field while we have ximg handy. */
11399 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 11399 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
11400 IMAGE_BACKGROUND (img, f, ximg); 11400 IMAGE_BACKGROUND (img, f, ximg);
11401 11401
11402 /* Put the image into a pixmap. */ 11402 /* Put the image into a pixmap. */
11403 x_put_x_image (f, ximg, img->pixmap, width, height); 11403 x_put_x_image (f, ximg, img->pixmap, width, height);
11404 x_destroy_x_image (ximg); 11404 x_destroy_x_image (ximg);
11405 11405
11406 img->width = width; 11406 img->width = width;
11407 img->height = height; 11407 img->height = height;
11408 11408
@@ -11483,9 +11483,9 @@ png_image_p (object)
11483{ 11483{
11484 struct image_keyword fmt[PNG_LAST]; 11484 struct image_keyword fmt[PNG_LAST];
11485 bcopy (png_format, fmt, sizeof fmt); 11485 bcopy (png_format, fmt, sizeof fmt);
11486 11486
11487 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng) 11487 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)
11488 || (fmt[PNG_ASCENT].count 11488 || (fmt[PNG_ASCENT].count
11489 && XFASTINT (fmt[PNG_ASCENT].value) > 100)) 11489 && XFASTINT (fmt[PNG_ASCENT].value) > 100))
11490 return 0; 11490 return 0;
11491 11491
@@ -11542,7 +11542,7 @@ png_read_from_memory (png_ptr, data, length)
11542 11542
11543 if (length > tbr->len - tbr->index) 11543 if (length > tbr->len - tbr->index)
11544 png_error (png_ptr, "Read error"); 11544 png_error (png_ptr, "Read error");
11545 11545
11546 bcopy (tbr->bytes + tbr->index, data, length); 11546 bcopy (tbr->bytes + tbr->index, data, length);
11547 tbr->index = tbr->index + length; 11547 tbr->index = tbr->index + length;
11548} 11548}
@@ -11685,14 +11685,14 @@ png_load (f, img)
11685 png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 11685 png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
11686 &interlace_type, NULL, NULL); 11686 &interlace_type, NULL, NULL);
11687 11687
11688 /* If image contains simply transparency data, we prefer to 11688 /* If image contains simply transparency data, we prefer to
11689 construct a clipping mask. */ 11689 construct a clipping mask. */
11690 if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) 11690 if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))
11691 transparent_p = 1; 11691 transparent_p = 1;
11692 else 11692 else
11693 transparent_p = 0; 11693 transparent_p = 0;
11694 11694
11695 /* This function is easier to write if we only have to handle 11695 /* This function is easier to write if we only have to handle
11696 one data format: RGB or RGBA with 8 bits per channel. Let's 11696 one data format: RGB or RGBA with 8 bits per channel. Let's
11697 transform other formats into that format. */ 11697 transform other formats into that format. */
11698 11698
@@ -11705,7 +11705,7 @@ png_load (f, img)
11705 png_set_expand (png_ptr); 11705 png_set_expand (png_ptr);
11706 11706
11707 /* Convert grayscale images to RGB. */ 11707 /* Convert grayscale images to RGB. */
11708 if (color_type == PNG_COLOR_TYPE_GRAY 11708 if (color_type == PNG_COLOR_TYPE_GRAY
11709 || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) 11709 || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
11710 png_set_gray_to_rgb (png_ptr); 11710 png_set_gray_to_rgb (png_ptr);
11711 11711
@@ -11756,14 +11756,14 @@ png_load (f, img)
11756 } 11756 }
11757 } 11757 }
11758 else if (png_get_bKGD (png_ptr, info_ptr, &image_background)) 11758 else if (png_get_bKGD (png_ptr, info_ptr, &image_background))
11759 /* Image contains a background color with which to 11759 /* Image contains a background color with which to
11760 combine the image. */ 11760 combine the image. */
11761 png_set_background (png_ptr, image_background, 11761 png_set_background (png_ptr, image_background,
11762 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); 11762 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
11763 else 11763 else
11764 { 11764 {
11765 /* Image does not contain a background color with which 11765 /* Image does not contain a background color with which
11766 to combine the image data via an alpha channel. Use 11766 to combine the image data via an alpha channel. Use
11767 the frame's background instead. */ 11767 the frame's background instead. */
11768 XColor color; 11768 XColor color;
11769 Colormap cmap; 11769 Colormap cmap;
@@ -11816,7 +11816,7 @@ png_load (f, img)
11816 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, 11816 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg,
11817 &img->pixmap)) 11817 &img->pixmap))
11818 goto error; 11818 goto error;
11819 11819
11820 /* Create an image and pixmap serving as mask if the PNG image 11820 /* Create an image and pixmap serving as mask if the PNG image
11821 contains an alpha channel. */ 11821 contains an alpha channel. */
11822 if (channels == 4 11822 if (channels == 4
@@ -11847,16 +11847,16 @@ png_load (f, img)
11847 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b)); 11847 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));
11848 11848
11849 /* An alpha channel, aka mask channel, associates variable 11849 /* An alpha channel, aka mask channel, associates variable
11850 transparency with an image. Where other image formats 11850 transparency with an image. Where other image formats
11851 support binary transparency---fully transparent or fully 11851 support binary transparency---fully transparent or fully
11852 opaque---PNG allows up to 254 levels of partial transparency. 11852 opaque---PNG allows up to 254 levels of partial transparency.
11853 The PNG library implements partial transparency by combining 11853 The PNG library implements partial transparency by combining
11854 the image with a specified background color. 11854 the image with a specified background color.
11855 11855
11856 I'm not sure how to handle this here nicely: because the 11856 I'm not sure how to handle this here nicely: because the
11857 background on which the image is displayed may change, for 11857 background on which the image is displayed may change, for
11858 real alpha channel support, it would be necessary to create 11858 real alpha channel support, it would be necessary to create
11859 a new image for each possible background. 11859 a new image for each possible background.
11860 11860
11861 What I'm doing now is that a mask is created if we have 11861 What I'm doing now is that a mask is created if we have
11862 boolean transparency information. Otherwise I'm using 11862 boolean transparency information. Otherwise I'm using
@@ -12002,11 +12002,11 @@ jpeg_image_p (object)
12002 Lisp_Object object; 12002 Lisp_Object object;
12003{ 12003{
12004 struct image_keyword fmt[JPEG_LAST]; 12004 struct image_keyword fmt[JPEG_LAST];
12005 12005
12006 bcopy (jpeg_format, fmt, sizeof fmt); 12006 bcopy (jpeg_format, fmt, sizeof fmt);
12007 12007
12008 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg) 12008 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)
12009 || (fmt[JPEG_ASCENT].count 12009 || (fmt[JPEG_ASCENT].count
12010 && XFASTINT (fmt[JPEG_ASCENT].value) > 100)) 12010 && XFASTINT (fmt[JPEG_ASCENT].value) > 100))
12011 return 0; 12011 return 0;
12012 12012
@@ -12075,7 +12075,7 @@ our_skip_input_data (cinfo, num_bytes)
12075 { 12075 {
12076 if (num_bytes > src->bytes_in_buffer) 12076 if (num_bytes > src->bytes_in_buffer)
12077 ERREXIT (cinfo, JERR_INPUT_EOF); 12077 ERREXIT (cinfo, JERR_INPUT_EOF);
12078 12078
12079 src->bytes_in_buffer -= num_bytes; 12079 src->bytes_in_buffer -= num_bytes;
12080 src->next_input_byte += num_bytes; 12080 src->next_input_byte += num_bytes;
12081 } 12081 }
@@ -12113,7 +12113,7 @@ jpeg_memory_src (cinfo, data, len)
12113 src = (struct jpeg_source_mgr *) cinfo->src; 12113 src = (struct jpeg_source_mgr *) cinfo->src;
12114 src->next_input_byte = data; 12114 src->next_input_byte = data;
12115 } 12115 }
12116 12116
12117 src = (struct jpeg_source_mgr *) cinfo->src; 12117 src = (struct jpeg_source_mgr *) cinfo->src;
12118 src->init_source = our_init_source; 12118 src->init_source = our_init_source;
12119 src->fill_input_buffer = our_fill_input_buffer; 12119 src->fill_input_buffer = our_fill_input_buffer;
@@ -12128,7 +12128,7 @@ jpeg_memory_src (cinfo, data, len)
12128/* Load image IMG for use on frame F. Patterned after example.c 12128/* Load image IMG for use on frame F. Patterned after example.c
12129 from the JPEG lib. */ 12129 from the JPEG lib. */
12130 12130
12131static int 12131static int
12132jpeg_load (f, img) 12132jpeg_load (f, img)
12133 struct frame *f; 12133 struct frame *f;
12134 struct image *img; 12134 struct image *img;
@@ -12161,7 +12161,7 @@ jpeg_load (f, img)
12161 UNGCPRO; 12161 UNGCPRO;
12162 return 0; 12162 return 0;
12163 } 12163 }
12164 12164
12165 fp = fopen (SDATA (file), "r"); 12165 fp = fopen (SDATA (file), "r");
12166 if (fp == NULL) 12166 if (fp == NULL)
12167 { 12167 {
@@ -12170,12 +12170,12 @@ jpeg_load (f, img)
12170 return 0; 12170 return 0;
12171 } 12171 }
12172 } 12172 }
12173 12173
12174 /* Customize libjpeg's error handling to call my_error_exit when an 12174 /* Customize libjpeg's error handling to call my_error_exit when an
12175 error is detected. This function will perform a longjmp. */ 12175 error is detected. This function will perform a longjmp. */
12176 cinfo.err = jpeg_std_error (&mgr.pub); 12176 cinfo.err = jpeg_std_error (&mgr.pub);
12177 mgr.pub.error_exit = my_error_exit; 12177 mgr.pub.error_exit = my_error_exit;
12178 12178
12179 if ((rc = setjmp (mgr.setjmp_buffer)) != 0) 12179 if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
12180 { 12180 {
12181 if (rc == 1) 12181 if (rc == 1)
@@ -12186,18 +12186,18 @@ jpeg_load (f, img)
12186 image_error ("Error reading JPEG image `%s': %s", img->spec, 12186 image_error ("Error reading JPEG image `%s': %s", img->spec,
12187 build_string (buffer)); 12187 build_string (buffer));
12188 } 12188 }
12189 12189
12190 /* Close the input file and destroy the JPEG object. */ 12190 /* Close the input file and destroy the JPEG object. */
12191 if (fp) 12191 if (fp)
12192 fclose (fp); 12192 fclose (fp);
12193 jpeg_destroy_decompress (&cinfo); 12193 jpeg_destroy_decompress (&cinfo);
12194 12194
12195 /* If we already have an XImage, free that. */ 12195 /* If we already have an XImage, free that. */
12196 x_destroy_x_image (ximg); 12196 x_destroy_x_image (ximg);
12197 12197
12198 /* Free pixmap and colors. */ 12198 /* Free pixmap and colors. */
12199 x_clear_image (f, img); 12199 x_clear_image (f, img);
12200 12200
12201 UNGCPRO; 12201 UNGCPRO;
12202 return 0; 12202 return 0;
12203 } 12203 }
@@ -12248,7 +12248,7 @@ jpeg_load (f, img)
12248 init_color_table (); 12248 init_color_table ();
12249 colors = (unsigned long *) alloca (cinfo.actual_number_of_colors 12249 colors = (unsigned long *) alloca (cinfo.actual_number_of_colors
12250 * sizeof *colors); 12250 * sizeof *colors);
12251 12251
12252 for (i = 0; i < cinfo.actual_number_of_colors; ++i) 12252 for (i = 0; i < cinfo.actual_number_of_colors; ++i)
12253 { 12253 {
12254 /* Multiply RGB values with 255 because X expects RGB values 12254 /* Multiply RGB values with 255 because X expects RGB values
@@ -12280,11 +12280,11 @@ jpeg_load (f, img)
12280 jpeg_destroy_decompress (&cinfo); 12280 jpeg_destroy_decompress (&cinfo);
12281 if (fp) 12281 if (fp)
12282 fclose (fp); 12282 fclose (fp);
12283 12283
12284 /* Maybe fill in the background field while we have ximg handy. */ 12284 /* Maybe fill in the background field while we have ximg handy. */
12285 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 12285 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
12286 IMAGE_BACKGROUND (img, f, ximg); 12286 IMAGE_BACKGROUND (img, f, ximg);
12287 12287
12288 /* Put the image into the pixmap. */ 12288 /* Put the image into the pixmap. */
12289 x_put_x_image (f, ximg, img->pixmap, width, height); 12289 x_put_x_image (f, ximg, img->pixmap, width, height);
12290 x_destroy_x_image (ximg); 12290 x_destroy_x_image (ximg);
@@ -12366,12 +12366,12 @@ tiff_image_p (object)
12366{ 12366{
12367 struct image_keyword fmt[TIFF_LAST]; 12367 struct image_keyword fmt[TIFF_LAST];
12368 bcopy (tiff_format, fmt, sizeof fmt); 12368 bcopy (tiff_format, fmt, sizeof fmt);
12369 12369
12370 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff) 12370 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)
12371 || (fmt[TIFF_ASCENT].count 12371 || (fmt[TIFF_ASCENT].count
12372 && XFASTINT (fmt[TIFF_ASCENT].value) > 100)) 12372 && XFASTINT (fmt[TIFF_ASCENT].value) > 100))
12373 return 0; 12373 return 0;
12374 12374
12375 /* Must specify either the :data or :file keyword. */ 12375 /* Must specify either the :data or :file keyword. */
12376 return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1; 12376 return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1;
12377} 12377}
@@ -12432,22 +12432,22 @@ tiff_seek_in_memory (data, off, whence)
12432 case SEEK_SET: /* Go from beginning of source. */ 12432 case SEEK_SET: /* Go from beginning of source. */
12433 idx = off; 12433 idx = off;
12434 break; 12434 break;
12435 12435
12436 case SEEK_END: /* Go from end of source. */ 12436 case SEEK_END: /* Go from end of source. */
12437 idx = src->len + off; 12437 idx = src->len + off;
12438 break; 12438 break;
12439 12439
12440 case SEEK_CUR: /* Go from current position. */ 12440 case SEEK_CUR: /* Go from current position. */
12441 idx = src->index + off; 12441 idx = src->index + off;
12442 break; 12442 break;
12443 12443
12444 default: /* Invalid `whence'. */ 12444 default: /* Invalid `whence'. */
12445 return -1; 12445 return -1;
12446 } 12446 }
12447 12447
12448 if (idx > src->len || idx < 0) 12448 if (idx > src->len || idx < 0)
12449 return -1; 12449 return -1;
12450 12450
12451 src->index = idx; 12451 src->index = idx;
12452 return src->index; 12452 return src->index;
12453} 12453}
@@ -12494,7 +12494,7 @@ tiff_error_handler (title, format, ap)
12494{ 12494{
12495 char buf[512]; 12495 char buf[512];
12496 int len; 12496 int len;
12497 12497
12498 len = sprintf (buf, "TIFF error: %s ", title); 12498 len = sprintf (buf, "TIFF error: %s ", title);
12499 vsprintf (buf + len, format, ap); 12499 vsprintf (buf + len, format, ap);
12500 add_to_log (buf, Qnil, Qnil); 12500 add_to_log (buf, Qnil, Qnil);
@@ -12508,7 +12508,7 @@ tiff_warning_handler (title, format, ap)
12508{ 12508{
12509 char buf[512]; 12509 char buf[512];
12510 int len; 12510 int len;
12511 12511
12512 len = sprintf (buf, "TIFF warning: %s ", title); 12512 len = sprintf (buf, "TIFF warning: %s ", title);
12513 vsprintf (buf + len, format, ap); 12513 vsprintf (buf + len, format, ap);
12514 add_to_log (buf, Qnil, Qnil); 12514 add_to_log (buf, Qnil, Qnil);
@@ -12551,7 +12551,7 @@ tiff_load (f, img)
12551 UNGCPRO; 12551 UNGCPRO;
12552 return 0; 12552 return 0;
12553 } 12553 }
12554 12554
12555 /* Try to open the image file. */ 12555 /* Try to open the image file. */
12556 tiff = TIFFOpen (SDATA (file), "r"); 12556 tiff = TIFFOpen (SDATA (file), "r");
12557 if (tiff == NULL) 12557 if (tiff == NULL)
@@ -12590,7 +12590,7 @@ tiff_load (f, img)
12590 TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width); 12590 TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width);
12591 TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height); 12591 TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height);
12592 buf = (uint32 *) xmalloc (width * height * sizeof *buf); 12592 buf = (uint32 *) xmalloc (width * height * sizeof *buf);
12593 12593
12594 rc = TIFFReadRGBAImage (tiff, width, height, buf, 0); 12594 rc = TIFFReadRGBAImage (tiff, width, height, buf, 0);
12595 TIFFClose (tiff); 12595 TIFFClose (tiff);
12596 if (!rc) 12596 if (!rc)
@@ -12616,14 +12616,14 @@ tiff_load (f, img)
12616 for (y = 0; y < height; ++y) 12616 for (y = 0; y < height; ++y)
12617 { 12617 {
12618 uint32 *row = buf + y * width; 12618 uint32 *row = buf + y * width;
12619 12619
12620 for (x = 0; x < width; ++x) 12620 for (x = 0; x < width; ++x)
12621 { 12621 {
12622 uint32 abgr = row[x]; 12622 uint32 abgr = row[x];
12623 int r = TIFFGetR (abgr) << 8; 12623 int r = TIFFGetR (abgr) << 8;
12624 int g = TIFFGetG (abgr) << 8; 12624 int g = TIFFGetG (abgr) << 8;
12625 int b = TIFFGetB (abgr) << 8; 12625 int b = TIFFGetB (abgr) << 8;
12626 XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b)); 12626 XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b));
12627 } 12627 }
12628 } 12628 }
12629 12629
@@ -12721,12 +12721,12 @@ gif_image_p (object)
12721{ 12721{
12722 struct image_keyword fmt[GIF_LAST]; 12722 struct image_keyword fmt[GIF_LAST];
12723 bcopy (gif_format, fmt, sizeof fmt); 12723 bcopy (gif_format, fmt, sizeof fmt);
12724 12724
12725 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif) 12725 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)
12726 || (fmt[GIF_ASCENT].count 12726 || (fmt[GIF_ASCENT].count
12727 && XFASTINT (fmt[GIF_ASCENT].value) > 100)) 12727 && XFASTINT (fmt[GIF_ASCENT].value) > 100))
12728 return 0; 12728 return 0;
12729 12729
12730 /* Must specify either the :data or :file keyword. */ 12730 /* Must specify either the :data or :file keyword. */
12731 return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1; 12731 return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1;
12732} 12732}
@@ -12799,7 +12799,7 @@ gif_load (f, img)
12799 UNGCPRO; 12799 UNGCPRO;
12800 return 0; 12800 return 0;
12801 } 12801 }
12802 12802
12803 /* Open the GIF file. */ 12803 /* Open the GIF file. */
12804 gif = DGifOpenFileName (SDATA (file)); 12804 gif = DGifOpenFileName (SDATA (file));
12805 if (gif == NULL) 12805 if (gif == NULL)
@@ -12857,14 +12857,14 @@ gif_load (f, img)
12857 UNGCPRO; 12857 UNGCPRO;
12858 return 0; 12858 return 0;
12859 } 12859 }
12860 12860
12861 /* Allocate colors. */ 12861 /* Allocate colors. */
12862 gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap; 12862 gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap;
12863 if (!gif_color_map) 12863 if (!gif_color_map)
12864 gif_color_map = gif->SColorMap; 12864 gif_color_map = gif->SColorMap;
12865 init_color_table (); 12865 init_color_table ();
12866 bzero (pixel_colors, sizeof pixel_colors); 12866 bzero (pixel_colors, sizeof pixel_colors);
12867 12867
12868 for (i = 0; i < gif_color_map->ColorCount; ++i) 12868 for (i = 0; i < gif_color_map->ColorCount; ++i)
12869 { 12869 {
12870 int r = gif_color_map->Colors[i].Red << 8; 12870 int r = gif_color_map->Colors[i].Red << 8;
@@ -12877,7 +12877,7 @@ gif_load (f, img)
12877 free_color_table (); 12877 free_color_table ();
12878 12878
12879 /* Clear the part of the screen image that are not covered by 12879 /* Clear the part of the screen image that are not covered by
12880 the image from the GIF file. Full animated GIF support 12880 the image from the GIF file. Full animated GIF support
12881 requires more than can be done here (see the gif89 spec, 12881 requires more than can be done here (see the gif89 spec,
12882 disposal methods). Let's simply assume that the part 12882 disposal methods). Let's simply assume that the part
12883 not covered by a sub-image is in the frame's background color. */ 12883 not covered by a sub-image is in the frame's background color. */
@@ -12924,14 +12924,14 @@ gif_load (f, img)
12924 while (row >= image_height) 12924 while (row >= image_height)
12925 row = interlace_start[++pass]; 12925 row = interlace_start[++pass];
12926 } 12926 }
12927 12927
12928 for (x = 0; x < image_width; x++) 12928 for (x = 0; x < image_width; x++)
12929 { 12929 {
12930 int i = raster[(y * image_width) + x]; 12930 int i = raster[(y * image_width) + x];
12931 XPutPixel (ximg, x + image_left, row + image_top, 12931 XPutPixel (ximg, x + image_left, row + image_top,
12932 pixel_colors[i]); 12932 pixel_colors[i]);
12933 } 12933 }
12934 12934
12935 row += interlace_increment[pass]; 12935 row += interlace_increment[pass];
12936 } 12936 }
12937 } 12937 }
@@ -12944,7 +12944,7 @@ gif_load (f, img)
12944 XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]); 12944 XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]);
12945 } 12945 }
12946 } 12946 }
12947 12947
12948 DGifCloseFile (gif); 12948 DGifCloseFile (gif);
12949 12949
12950 /* Maybe fill in the background field while we have ximg handy. */ 12950 /* Maybe fill in the background field while we have ximg handy. */
@@ -12954,7 +12954,7 @@ gif_load (f, img)
12954 /* Put the image into the pixmap, then free the X image and its buffer. */ 12954 /* Put the image into the pixmap, then free the X image and its buffer. */
12955 x_put_x_image (f, ximg, img->pixmap, width, height); 12955 x_put_x_image (f, ximg, img->pixmap, width, height);
12956 x_destroy_x_image (ximg); 12956 x_destroy_x_image (ximg);
12957 12957
12958 UNGCPRO; 12958 UNGCPRO;
12959 return 1; 12959 return 1;
12960} 12960}
@@ -13055,11 +13055,11 @@ gs_image_p (object)
13055 struct image_keyword fmt[GS_LAST]; 13055 struct image_keyword fmt[GS_LAST];
13056 Lisp_Object tem; 13056 Lisp_Object tem;
13057 int i; 13057 int i;
13058 13058
13059 bcopy (gs_format, fmt, sizeof fmt); 13059 bcopy (gs_format, fmt, sizeof fmt);
13060 13060
13061 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript) 13061 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript)
13062 || (fmt[GS_ASCENT].count 13062 || (fmt[GS_ASCENT].count
13063 && XFASTINT (fmt[GS_ASCENT].value) > 100)) 13063 && XFASTINT (fmt[GS_ASCENT].value) > 100))
13064 return 0; 13064 return 0;
13065 13065
@@ -13127,7 +13127,7 @@ gs_load (f, img)
13127 image_error ("Unable to create pixmap for `%s'", img->spec, Qnil); 13127 image_error ("Unable to create pixmap for `%s'", img->spec, Qnil);
13128 return 0; 13128 return 0;
13129 } 13129 }
13130 13130
13131 /* Call the loader to fill the pixmap. It returns a process object 13131 /* Call the loader to fill the pixmap. It returns a process object
13132 if successful. We do not record_unwind_protect here because 13132 if successful. We do not record_unwind_protect here because
13133 other places in redisplay like calling window scroll functions 13133 other places in redisplay like calling window scroll functions
@@ -13138,12 +13138,12 @@ gs_load (f, img)
13138 (unsigned long) FRAME_W32_WINDOW (f), 13138 (unsigned long) FRAME_W32_WINDOW (f),
13139 (unsigned long) img->pixmap); 13139 (unsigned long) img->pixmap);
13140 window_and_pixmap_id = build_string (buffer); 13140 window_and_pixmap_id = build_string (buffer);
13141 13141
13142 sprintf (buffer, "%lu %lu", 13142 sprintf (buffer, "%lu %lu",
13143 FRAME_FOREGROUND_PIXEL (f), 13143 FRAME_FOREGROUND_PIXEL (f),
13144 FRAME_BACKGROUND_PIXEL (f)); 13144 FRAME_BACKGROUND_PIXEL (f));
13145 pixel_colors = build_string (buffer); 13145 pixel_colors = build_string (buffer);
13146 13146
13147 XSETFRAME (frame, f); 13147 XSETFRAME (frame, f);
13148 loader = image_spec_value (img->spec, QCloader, NULL); 13148 loader = image_spec_value (img->spec, QCloader, NULL);
13149 if (NILP (loader)) 13149 if (NILP (loader))
@@ -13205,10 +13205,10 @@ x_kill_gs_process (pixmap, f)
13205 if (ximg) 13205 if (ximg)
13206 { 13206 {
13207 int x, y; 13207 int x, y;
13208 13208
13209 /* Initialize the color table. */ 13209 /* Initialize the color table. */
13210 init_color_table (); 13210 init_color_table ();
13211 13211
13212 /* For each pixel of the image, look its color up in the 13212 /* For each pixel of the image, look its color up in the
13213 color table. After having done so, the color table will 13213 color table. After having done so, the color table will
13214 contain an entry for each color used by the image. */ 13214 contain an entry for each color used by the image. */
@@ -13238,7 +13238,7 @@ x_kill_gs_process (pixmap, f)
13238 else 13238 else
13239 image_error ("Cannot get X image of `%s'; colors will not be freed", 13239 image_error ("Cannot get X image of `%s'; colors will not be freed",
13240 img->spec, Qnil); 13240 img->spec, Qnil);
13241 13241
13242 UNBLOCK_INPUT; 13242 UNBLOCK_INPUT;
13243 } 13243 }
13244 13244
@@ -13350,8 +13350,8 @@ value. */)
13350 rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), 13350 rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
13351 prop_atom, 0, bytes_remaining, 13351 prop_atom, 0, bytes_remaining,
13352 False, XA_STRING, 13352 False, XA_STRING,
13353 &actual_type, &actual_format, 13353 &actual_type, &actual_format,
13354 &actual_size, &bytes_remaining, 13354 &actual_size, &bytes_remaining,
13355 (unsigned char **) &tmp_data); 13355 (unsigned char **) &tmp_data);
13356 if (rc == Success) 13356 if (rc == Success)
13357 prop_value = make_string (tmp_data, size); 13357 prop_value = make_string (tmp_data, size);
@@ -13405,7 +13405,7 @@ start_hourglass ()
13405#if 0 /* TODO: cursor shape changes. */ 13405#if 0 /* TODO: cursor shape changes. */
13406 EMACS_TIME delay; 13406 EMACS_TIME delay;
13407 int secs, usecs = 0; 13407 int secs, usecs = 0;
13408 13408
13409 cancel_hourglass (); 13409 cancel_hourglass ();
13410 13410
13411 if (INTEGERP (Vhourglass_delay) 13411 if (INTEGERP (Vhourglass_delay)
@@ -13421,7 +13421,7 @@ start_hourglass ()
13421 } 13421 }
13422 else 13422 else
13423 secs = DEFAULT_HOURGLASS_DELAY; 13423 secs = DEFAULT_HOURGLASS_DELAY;
13424 13424
13425 EMACS_SET_SECS_USECS (delay, secs, usecs); 13425 EMACS_SET_SECS_USECS (delay, secs, usecs);
13426 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, 13426 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
13427 show_hourglass, NULL); 13427 show_hourglass, NULL);
@@ -13440,7 +13440,7 @@ cancel_hourglass ()
13440 cancel_atimer (hourglass_atimer); 13440 cancel_atimer (hourglass_atimer);
13441 hourglass_atimer = NULL; 13441 hourglass_atimer = NULL;
13442 } 13442 }
13443 13443
13444 if (hourglass_shown_p) 13444 if (hourglass_shown_p)
13445 hide_hourglass (); 13445 hide_hourglass ();
13446} 13446}
@@ -13467,23 +13467,23 @@ show_hourglass (timer)
13467 if (!hourglass_shown_p) 13467 if (!hourglass_shown_p)
13468 { 13468 {
13469 Lisp_Object rest, frame; 13469 Lisp_Object rest, frame;
13470 13470
13471 BLOCK_INPUT; 13471 BLOCK_INPUT;
13472 13472
13473 FOR_EACH_FRAME (rest, frame) 13473 FOR_EACH_FRAME (rest, frame)
13474 if (FRAME_W32_P (XFRAME (frame))) 13474 if (FRAME_W32_P (XFRAME (frame)))
13475 { 13475 {
13476 struct frame *f = XFRAME (frame); 13476 struct frame *f = XFRAME (frame);
13477 13477
13478 f->output_data.w32->hourglass_p = 1; 13478 f->output_data.w32->hourglass_p = 1;
13479 13479
13480 if (!f->output_data.w32->hourglass_window) 13480 if (!f->output_data.w32->hourglass_window)
13481 { 13481 {
13482 unsigned long mask = CWCursor; 13482 unsigned long mask = CWCursor;
13483 XSetWindowAttributes attrs; 13483 XSetWindowAttributes attrs;
13484 13484
13485 attrs.cursor = f->output_data.w32->hourglass_cursor; 13485 attrs.cursor = f->output_data.w32->hourglass_cursor;
13486 13486
13487 f->output_data.w32->hourglass_window 13487 f->output_data.w32->hourglass_window
13488 = XCreateWindow (FRAME_X_DISPLAY (f), 13488 = XCreateWindow (FRAME_X_DISPLAY (f),
13489 FRAME_OUTER_WINDOW (f), 13489 FRAME_OUTER_WINDOW (f),
@@ -13492,7 +13492,7 @@ show_hourglass (timer)
13492 CopyFromParent, 13492 CopyFromParent,
13493 mask, &attrs); 13493 mask, &attrs);
13494 } 13494 }
13495 13495
13496 XMapRaised (FRAME_X_DISPLAY (f), 13496 XMapRaised (FRAME_X_DISPLAY (f),
13497 f->output_data.w32->hourglass_window); 13497 f->output_data.w32->hourglass_window);
13498 XFlush (FRAME_X_DISPLAY (f)); 13498 XFlush (FRAME_X_DISPLAY (f));
@@ -13519,7 +13519,7 @@ hide_hourglass ()
13519 FOR_EACH_FRAME (rest, frame) 13519 FOR_EACH_FRAME (rest, frame)
13520 { 13520 {
13521 struct frame *f = XFRAME (frame); 13521 struct frame *f = XFRAME (frame);
13522 13522
13523 if (FRAME_W32_P (f) 13523 if (FRAME_W32_P (f)
13524 /* Watch out for newly created frames. */ 13524 /* Watch out for newly created frames. */
13525 && f->output_data.x->hourglass_window) 13525 && f->output_data.x->hourglass_window)
@@ -13549,7 +13549,7 @@ static Lisp_Object x_create_tip_frame P_ ((struct w32_display_info *,
13549 Lisp_Object, Lisp_Object)); 13549 Lisp_Object, Lisp_Object));
13550static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object, 13550static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object,
13551 Lisp_Object, int, int, int *, int *)); 13551 Lisp_Object, int, int, int *, int *));
13552 13552
13553/* The frame of a currently visible tooltip. */ 13553/* The frame of a currently visible tooltip. */
13554 13554
13555Lisp_Object tip_frame; 13555Lisp_Object tip_frame;
@@ -13582,7 +13582,7 @@ unwind_create_tip_frame (frame)
13582 tip_window = NULL; 13582 tip_window = NULL;
13583 tip_frame = Qnil; 13583 tip_frame = Qnil;
13584 } 13584 }
13585 13585
13586 return deleted; 13586 return deleted;
13587} 13587}
13588 13588
@@ -13648,7 +13648,7 @@ x_create_tip_frame (dpyinfo, parms, text)
13648 Ferase_buffer (); 13648 Ferase_buffer ();
13649 Finsert (1, &text); 13649 Finsert (1, &text);
13650 set_buffer_internal_1 (old_buffer); 13650 set_buffer_internal_1 (old_buffer);
13651 13651
13652 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; 13652 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
13653 record_unwind_protect (unwind_create_tip_frame, frame); 13653 record_unwind_protect (unwind_create_tip_frame, frame);
13654 13654
@@ -13706,7 +13706,7 @@ x_create_tip_frame (dpyinfo, parms, text)
13706 else 13706 else
13707 font = x_new_font (f, SDATA (font)); 13707 font = x_new_font (f, SDATA (font));
13708 } 13708 }
13709 13709
13710 /* Try out a font which we hope has bold and italic variations. */ 13710 /* Try out a font which we hope has bold and italic variations. */
13711 if (!STRINGP (font)) 13711 if (!STRINGP (font))
13712 font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1"); 13712 font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1");
@@ -13816,7 +13816,7 @@ x_create_tip_frame (dpyinfo, parms, text)
13816 if (NILP (Fframe_parameter (frame, intern ("tooltip")))) 13816 if (NILP (Fframe_parameter (frame, intern ("tooltip"))))
13817 Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt), 13817 Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt),
13818 Qnil)); 13818 Qnil));
13819 13819
13820 /* Set up faces after all frame parameters are known. This call 13820 /* Set up faces after all frame parameters are known. This call
13821 also merges in face attributes specified for new frames. 13821 also merges in face attributes specified for new frames.
13822 13822
@@ -13831,12 +13831,12 @@ x_create_tip_frame (dpyinfo, parms, text)
13831 /* Set tip_frame here, so that */ 13831 /* Set tip_frame here, so that */
13832 tip_frame = frame; 13832 tip_frame = frame;
13833 call1 (Qface_set_after_frame_default, frame); 13833 call1 (Qface_set_after_frame_default, frame);
13834 13834
13835 if (!EQ (bg, Fframe_parameter (frame, Qbackground_color))) 13835 if (!EQ (bg, Fframe_parameter (frame, Qbackground_color)))
13836 Fmodify_frame_parameters (frame, Fcons (Fcons (Qbackground_color, bg), 13836 Fmodify_frame_parameters (frame, Fcons (Fcons (Qbackground_color, bg),
13837 Qnil)); 13837 Qnil));
13838 } 13838 }
13839 13839
13840 f->no_split = 1; 13840 f->no_split = 1;
13841 13841
13842 UNGCPRO; 13842 UNGCPRO;
@@ -13876,11 +13876,11 @@ compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
13876 int *root_x, *root_y; 13876 int *root_x, *root_y;
13877{ 13877{
13878 Lisp_Object left, top; 13878 Lisp_Object left, top;
13879 13879
13880 /* User-specified position? */ 13880 /* User-specified position? */
13881 left = Fcdr (Fassq (Qleft, parms)); 13881 left = Fcdr (Fassq (Qleft, parms));
13882 top = Fcdr (Fassq (Qtop, parms)); 13882 top = Fcdr (Fassq (Qtop, parms));
13883 13883
13884 /* Move the tooltip window where the mouse pointer is. Resize and 13884 /* Move the tooltip window where the mouse pointer is. Resize and
13885 show it. */ 13885 show it. */
13886 if (!INTEGERP (left) || !INTEGERP (top)) 13886 if (!INTEGERP (left) || !INTEGERP (top))
@@ -13952,7 +13952,7 @@ Text larger than the specified size is clipped. */)
13952 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 13952 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
13953 int old_windows_or_buffers_changed = windows_or_buffers_changed; 13953 int old_windows_or_buffers_changed = windows_or_buffers_changed;
13954 int count = SPECPDL_INDEX (); 13954 int count = SPECPDL_INDEX ();
13955 13955
13956 specbind (Qinhibit_redisplay, Qt); 13956 specbind (Qinhibit_redisplay, Qt);
13957 13957
13958 GCPRO4 (string, parms, frame, timeout); 13958 GCPRO4 (string, parms, frame, timeout);
@@ -13968,7 +13968,7 @@ Text larger than the specified size is clipped. */)
13968 dx = make_number (5); 13968 dx = make_number (5);
13969 else 13969 else
13970 CHECK_NUMBER (dx); 13970 CHECK_NUMBER (dx);
13971 13971
13972 if (NILP (dy)) 13972 if (NILP (dy))
13973 dy = make_number (-10); 13973 dy = make_number (-10);
13974 else 13974 else
@@ -13988,7 +13988,7 @@ Text larger than the specified size is clipped. */)
13988 && !NILP (Fequal (last_parms, parms))) 13988 && !NILP (Fequal (last_parms, parms)))
13989 { 13989 {
13990 struct frame *f = XFRAME (tip_frame); 13990 struct frame *f = XFRAME (tip_frame);
13991 13991
13992 /* Only DX and DY have changed. */ 13992 /* Only DX and DY have changed. */
13993 if (!NILP (tip_timer)) 13993 if (!NILP (tip_timer))
13994 { 13994 {
@@ -14063,7 +14063,7 @@ Text larger than the specified size is clipped. */)
14063 w->width = make_number (80); 14063 w->width = make_number (80);
14064 w->height = make_number (40); 14064 w->height = make_number (40);
14065 } 14065 }
14066 14066
14067 f->window_width = XINT (w->width); 14067 f->window_width = XINT (w->width);
14068 adjust_glyphs (f); 14068 adjust_glyphs (f);
14069 w->pseudo_window_p = 1; 14069 w->pseudo_window_p = 1;
@@ -14104,7 +14104,7 @@ Text larger than the specified size is clipped. */)
14104 else 14104 else
14105#endif 14105#endif
14106 row_width = row->pixel_width; 14106 row_width = row->pixel_width;
14107 14107
14108 /* TODO: find why tips do not draw along baseline as instructed. */ 14108 /* TODO: find why tips do not draw along baseline as instructed. */
14109 height += row->height; 14109 height += row->height;
14110 width = max (width, row_width); 14110 width = max (width, row_width);
@@ -14176,16 +14176,16 @@ Value is t if tooltip was open, nil otherwise. */)
14176 /* Return quickly if nothing to do. */ 14176 /* Return quickly if nothing to do. */
14177 if (NILP (tip_timer) && NILP (tip_frame)) 14177 if (NILP (tip_timer) && NILP (tip_frame))
14178 return Qnil; 14178 return Qnil;
14179 14179
14180 frame = tip_frame; 14180 frame = tip_frame;
14181 timer = tip_timer; 14181 timer = tip_timer;
14182 GCPRO2 (frame, timer); 14182 GCPRO2 (frame, timer);
14183 tip_frame = tip_timer = deleted = Qnil; 14183 tip_frame = tip_timer = deleted = Qnil;
14184 14184
14185 count = SPECPDL_INDEX (); 14185 count = SPECPDL_INDEX ();
14186 specbind (Qinhibit_redisplay, Qt); 14186 specbind (Qinhibit_redisplay, Qt);
14187 specbind (Qinhibit_quit, Qt); 14187 specbind (Qinhibit_quit, Qt);
14188 14188
14189 if (!NILP (timer)) 14189 if (!NILP (timer))
14190 call1 (Qcancel_timer, timer); 14190 call1 (Qcancel_timer, timer);
14191 14191
@@ -14953,13 +14953,13 @@ When nil, Emacs will translate the alt key to the Alt modifier, and not Meta. *
14953 doc: /* If non-zero, the virtual key code for an alternative quit key. */); 14953 doc: /* If non-zero, the virtual key code for an alternative quit key. */);
14954 XSETINT (Vw32_quit_key, 0); 14954 XSETINT (Vw32_quit_key, 0);
14955 14955
14956 DEFVAR_LISP ("w32-pass-lwindow-to-system", 14956 DEFVAR_LISP ("w32-pass-lwindow-to-system",
14957 &Vw32_pass_lwindow_to_system, 14957 &Vw32_pass_lwindow_to_system,
14958 doc: /* Non-nil if the left \"Windows\" key is passed on to Windows. 14958 doc: /* Non-nil if the left \"Windows\" key is passed on to Windows.
14959When non-nil, the Start menu is opened by tapping the key. */); 14959When non-nil, the Start menu is opened by tapping the key. */);
14960 Vw32_pass_lwindow_to_system = Qt; 14960 Vw32_pass_lwindow_to_system = Qt;
14961 14961
14962 DEFVAR_LISP ("w32-pass-rwindow-to-system", 14962 DEFVAR_LISP ("w32-pass-rwindow-to-system",
14963 &Vw32_pass_rwindow_to_system, 14963 &Vw32_pass_rwindow_to_system,
14964 doc: /* Non-nil if the right \"Windows\" key is passed on to Windows. 14964 doc: /* Non-nil if the right \"Windows\" key is passed on to Windows.
14965When non-nil, the Start menu is opened by tapping the key. */); 14965When non-nil, the Start menu is opened by tapping the key. */);
@@ -14977,13 +14977,13 @@ acting on \"Windows\" key events when `w32-pass-lwindow-to-system' or
14977 means that this hack won't interfere with any real key code. */ 14977 means that this hack won't interfere with any real key code. */
14978 Vw32_phantom_key_code = 255; 14978 Vw32_phantom_key_code = 255;
14979 14979
14980 DEFVAR_LISP ("w32-enable-num-lock", 14980 DEFVAR_LISP ("w32-enable-num-lock",
14981 &Vw32_enable_num_lock, 14981 &Vw32_enable_num_lock,
14982 doc: /* Non-nil if Num Lock should act normally. 14982 doc: /* Non-nil if Num Lock should act normally.
14983Set to nil to see Num Lock as the key `kp-numlock'. */); 14983Set to nil to see Num Lock as the key `kp-numlock'. */);
14984 Vw32_enable_num_lock = Qt; 14984 Vw32_enable_num_lock = Qt;
14985 14985
14986 DEFVAR_LISP ("w32-enable-caps-lock", 14986 DEFVAR_LISP ("w32-enable-caps-lock",
14987 &Vw32_enable_caps_lock, 14987 &Vw32_enable_caps_lock,
14988 doc: /* Non-nil if Caps Lock should act normally. 14988 doc: /* Non-nil if Caps Lock should act normally.
14989Set to nil to see Caps Lock as the key `capslock'. */); 14989Set to nil to see Caps Lock as the key `capslock'. */);
@@ -15090,7 +15090,7 @@ or when you set the mouse color. */);
15090 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p, 15090 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p,
15091 doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */); 15091 doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */);
15092 display_hourglass_p = 1; 15092 display_hourglass_p = 1;
15093 15093
15094 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, 15094 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay,
15095 doc: /* *Seconds to wait before displaying an hourglass pointer. 15095 doc: /* *Seconds to wait before displaying an hourglass pointer.
15096Value must be an integer or float. */); 15096Value must be an integer or float. */);
@@ -15118,7 +15118,7 @@ or when you set the mouse color. */);
15118 doc: /* Maximum size for tooltips. 15118 doc: /* Maximum size for tooltips.
15119Value is a pair (COLUMNS . ROWS). Text larger than this is clipped. */); 15119Value is a pair (COLUMNS . ROWS). Text larger than this is clipped. */);
15120 Vx_max_tooltip_size = Fcons (make_number (80), make_number (40)); 15120 Vx_max_tooltip_size = Fcons (make_number (80), make_number (40));
15121 15121
15122 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, 15122 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
15123 doc: /* Non-nil if no window manager is in use. 15123 doc: /* Non-nil if no window manager is in use.
15124Emacs doesn't try to figure this out; this is always nil 15124Emacs doesn't try to figure this out; this is always nil
@@ -15349,16 +15349,16 @@ versions of Windows) characters. */);
15349 Qxpm = intern ("xpm"); 15349 Qxpm = intern ("xpm");
15350 staticpro (&Qxpm); 15350 staticpro (&Qxpm);
15351#endif 15351#endif
15352 15352
15353#if HAVE_JPEG 15353#if HAVE_JPEG
15354 Qjpeg = intern ("jpeg"); 15354 Qjpeg = intern ("jpeg");
15355 staticpro (&Qjpeg); 15355 staticpro (&Qjpeg);
15356#endif 15356#endif
15357 15357
15358#if HAVE_TIFF 15358#if HAVE_TIFF
15359 Qtiff = intern ("tiff"); 15359 Qtiff = intern ("tiff");
15360 staticpro (&Qtiff); 15360 staticpro (&Qtiff);
15361#endif 15361#endif
15362 15362
15363#if HAVE_GIF 15363#if HAVE_GIF
15364 Qgif = intern ("gif"); 15364 Qgif = intern ("gif");
@@ -15406,15 +15406,15 @@ init_xfns ()
15406#if 0 /* TODO : Image support for W32 */ 15406#if 0 /* TODO : Image support for W32 */
15407 define_image_type (&gs_type); 15407 define_image_type (&gs_type);
15408#endif 15408#endif
15409 15409
15410#if HAVE_XPM 15410#if HAVE_XPM
15411 define_image_type (&xpm_type); 15411 define_image_type (&xpm_type);
15412#endif 15412#endif
15413 15413
15414#if HAVE_JPEG 15414#if HAVE_JPEG
15415 define_image_type (&jpeg_type); 15415 define_image_type (&jpeg_type);
15416#endif 15416#endif
15417 15417
15418#if HAVE_TIFF 15418#if HAVE_TIFF
15419 define_image_type (&tiff_type); 15419 define_image_type (&tiff_type);
15420#endif 15420#endif
@@ -15422,7 +15422,7 @@ init_xfns ()
15422#if HAVE_GIF 15422#if HAVE_GIF
15423 define_image_type (&gif_type); 15423 define_image_type (&gif_type);
15424#endif 15424#endif
15425 15425
15426#if HAVE_PNG 15426#if HAVE_PNG
15427 define_image_type (&png_type); 15427 define_image_type (&png_type);
15428#endif 15428#endif
@@ -15430,7 +15430,7 @@ init_xfns ()
15430 15430
15431#undef abort 15431#undef abort
15432 15432
15433void 15433void
15434w32_abort() 15434w32_abort()
15435{ 15435{
15436 int button; 15436 int button;
diff --git a/src/xdisp.c b/src/xdisp.c
index 64e94a9d6d1..e3f2ecc134b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1531,7 +1531,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
1531 1531
1532 /* If face attributes have been changed since the last redisplay, 1532 /* If face attributes have been changed since the last redisplay,
1533 free realized faces now because they depend on face definitions 1533 free realized faces now because they depend on face definitions
1534 that might have changed. Don't free faces while there might be 1534 that might have changed. Don't free faces while there might be
1535 desired matrices pending which reference these faces. */ 1535 desired matrices pending which reference these faces. */
1536 if (face_change_count && !inhibit_free_realized_faces) 1536 if (face_change_count && !inhibit_free_realized_faces)
1537 { 1537 {
@@ -4215,7 +4215,7 @@ int
4215get_next_display_element (it) 4215get_next_display_element (it)
4216 struct it *it; 4216 struct it *it;
4217{ 4217{
4218 /* Non-zero means that we found an display element. Zero means that 4218 /* Non-zero means that we found a display element. Zero means that
4219 we hit the end of what we iterate over. Performance note: the 4219 we hit the end of what we iterate over. Performance note: the
4220 function pointer `method' used here turns out to be faster than 4220 function pointer `method' used here turns out to be faster than
4221 using a sequence of if-statements. */ 4221 using a sequence of if-statements. */
@@ -9033,7 +9033,7 @@ redisplay_internal (preserve_echo_area)
9033 redisplay_window_error); 9033 redisplay_window_error);
9034 9034
9035 /* Compare desired and current matrices, perform output. */ 9035 /* Compare desired and current matrices, perform output. */
9036 9036
9037 update: 9037 update:
9038 /* If fonts changed, display again. */ 9038 /* If fonts changed, display again. */
9039 if (fonts_changed_p) 9039 if (fonts_changed_p)
@@ -13751,7 +13751,7 @@ static Lisp_Object mode_line_string_face_prop;
13751 13751
13752 PROPS is a property list to add to any string we encounter. 13752 PROPS is a property list to add to any string we encounter.
13753 13753
13754 If RISKY is nonzero, remove (disregard) any properties in any string 13754 If RISKY is nonzero, remove (disregard) any properties in any string
13755 we encounter, and ignore :eval and :propertize. 13755 we encounter, and ignore :eval and :propertize.
13756 13756
13757 If the global variable `frame_title_ptr' is non-NULL, then the output 13757 If the global variable `frame_title_ptr' is non-NULL, then the output
@@ -14165,7 +14165,7 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
14165 If COPY_STRING is non-zero, make a copy of LISP_STRING before adding 14165 If COPY_STRING is non-zero, make a copy of LISP_STRING before adding
14166 properties to the string. 14166 properties to the string.
14167 14167
14168 PROPS are the properties to add to the string. 14168 PROPS are the properties to add to the string.
14169 The mode_line_string_face face property is always added to the string. 14169 The mode_line_string_face face property is always added to the string.
14170 */ 14170 */
14171 14171
@@ -14201,7 +14201,7 @@ static int store_mode_line_string (string, lisp_string, copy_string, field_width
14201 Fadd_text_properties (make_number (0), make_number (len), 14201 Fadd_text_properties (make_number (0), make_number (len),
14202 props, lisp_string); 14202 props, lisp_string);
14203 } 14203 }
14204 else 14204 else
14205 { 14205 {
14206 len = XFASTINT (Flength (lisp_string)); 14206 len = XFASTINT (Flength (lisp_string));
14207 if (precision > 0 && len > precision) 14207 if (precision > 0 && len > precision)
@@ -14232,7 +14232,7 @@ static int store_mode_line_string (string, lisp_string, copy_string, field_width
14232 if (len > 0) 14232 if (len > 0)
14233 { 14233 {
14234 mode_line_string_list = Fcons (lisp_string, mode_line_string_list); 14234 mode_line_string_list = Fcons (lisp_string, mode_line_string_list);
14235 n += len; 14235 n += len;
14236 } 14236 }
14237 14237
14238 if (field_width > len) 14238 if (field_width > len)
@@ -14243,7 +14243,7 @@ static int store_mode_line_string (string, lisp_string, copy_string, field_width
14243 Fadd_text_properties (make_number (0), make_number (field_width), 14243 Fadd_text_properties (make_number (0), make_number (field_width),
14244 props, lisp_string); 14244 props, lisp_string);
14245 mode_line_string_list = Fcons (lisp_string, mode_line_string_list); 14245 mode_line_string_list = Fcons (lisp_string, mode_line_string_list);
14246 n += field_width; 14246 n += field_width;
14247 } 14247 }
14248 14248
14249 return n; 14249 return n;
@@ -14305,7 +14305,7 @@ If third optional arg NO-PROPS is non-nil, string is not propertized. */)
14305 /* We need a dummy last element in mode_line_string_list to 14305 /* We need a dummy last element in mode_line_string_list to
14306 indicate we are building the propertized mode-line string. 14306 indicate we are building the propertized mode-line string.
14307 Using mode_line_string_face_prop here GC protects it. */ 14307 Using mode_line_string_face_prop here GC protects it. */
14308 mode_line_string_list = 14308 mode_line_string_list =
14309 Fcons (mode_line_string_face_prop, Qnil); 14309 Fcons (mode_line_string_face_prop, Qnil);
14310 frame_title_ptr = NULL; 14310 frame_title_ptr = NULL;
14311 } 14311 }
@@ -15214,7 +15214,7 @@ get_specified_cursor_type (arg, width)
15214 int *width; 15214 int *width;
15215{ 15215{
15216 enum text_cursor_kinds type; 15216 enum text_cursor_kinds type;
15217 15217
15218 if (NILP (arg)) 15218 if (NILP (arg))
15219 return NO_CURSOR; 15219 return NO_CURSOR;
15220 15220
@@ -15369,8 +15369,8 @@ get_window_cursor_type (w, width)
15369 *width = FRAME_BLINK_OFF_CURSOR_WIDTH (f); 15369 *width = FRAME_BLINK_OFF_CURSOR_WIDTH (f);
15370 return FRAME_BLINK_OFF_CURSOR (f); 15370 return FRAME_BLINK_OFF_CURSOR (f);
15371 } 15371 }
15372 15372
15373 /* Finally perform built-in cursor blinking: 15373 /* Finally perform built-in cursor blinking:
15374 filled box <-> hollow box 15374 filled box <-> hollow box
15375 wide [h]bar <-> narrow [h]bar 15375 wide [h]bar <-> narrow [h]bar
15376 narrow [h]bar <-> no cursor 15376 narrow [h]bar <-> no cursor
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 6db774e7a9f..c2640e87ffb 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -98,7 +98,7 @@ Lisp_Object Vx_session_previous_id;
98 open to a session manager, just return 0. 98 open to a session manager, just return 0.
99 Otherwise returns the number of events stored in buffer BUFP, 99 Otherwise returns the number of events stored in buffer BUFP,
100 which can hold up to *NUMCHARS characters. At most one event is 100 which can hold up to *NUMCHARS characters. At most one event is
101 stored, an SAVE_SESSION_EVENT. */ 101 stored, a SAVE_SESSION_EVENT. */
102int 102int
103x_session_check_input (bufp, numchars) 103x_session_check_input (bufp, numchars)
104 struct input_event *bufp; 104 struct input_event *bufp;
@@ -106,15 +106,15 @@ x_session_check_input (bufp, numchars)
106{ 106{
107 SELECT_TYPE read_fds; 107 SELECT_TYPE read_fds;
108 EMACS_TIME tmout; 108 EMACS_TIME tmout;
109 109
110 if (ice_fd == -1) return 0; 110 if (ice_fd == -1) return 0;
111 111
112 FD_ZERO (&read_fds); 112 FD_ZERO (&read_fds);
113 FD_SET (ice_fd, &read_fds); 113 FD_SET (ice_fd, &read_fds);
114 114
115 tmout.tv_sec = 0; 115 tmout.tv_sec = 0;
116 tmout.tv_usec = 0; 116 tmout.tv_usec = 0;
117 117
118 /* Reset this so wo can check kind after callbacks have been called by 118 /* Reset this so wo can check kind after callbacks have been called by
119 IceProcessMessages. The smc_interact_CB sets the kind to 119 IceProcessMessages. The smc_interact_CB sets the kind to
120 SAVE_SESSION_EVENT, but we don't know beforehand if that callback 120 SAVE_SESSION_EVENT, but we don't know beforehand if that callback
@@ -127,13 +127,13 @@ x_session_check_input (bufp, numchars)
127 ice_fd = -1; 127 ice_fd = -1;
128 return 0; 128 return 0;
129 } 129 }
130 130
131 131
132 if (FD_ISSET (ice_fd, &read_fds)) 132 if (FD_ISSET (ice_fd, &read_fds))
133 IceProcessMessages (SmcGetIceConnection (smc_conn), 133 IceProcessMessages (SmcGetIceConnection (smc_conn),
134 (IceReplyWaitInfo *)0, (Bool *)0); 134 (IceReplyWaitInfo *)0, (Bool *)0);
135 135
136 136
137 /* Check if smc_interact_CB was called and we shall generate a 137 /* Check if smc_interact_CB was called and we shall generate a
138 SAVE_SESSION_EVENT. */ 138 SAVE_SESSION_EVENT. */
139 if (*numchars > 0 && emacs_event.kind != NO_EVENT) 139 if (*numchars > 0 && emacs_event.kind != NO_EVENT)
@@ -189,14 +189,14 @@ smc_save_yourself_CB (smcConn,
189 Bool fast; 189 Bool fast;
190{ 190{
191#define NR_PROPS 5 191#define NR_PROPS 5
192 192
193 SmProp *props[NR_PROPS]; 193 SmProp *props[NR_PROPS];
194 SmProp prop_ptr[NR_PROPS]; 194 SmProp prop_ptr[NR_PROPS];
195 195
196 SmPropValue values[20]; 196 SmPropValue values[20];
197 int val_idx = 0; 197 int val_idx = 0;
198 int props_idx = 0; 198 int props_idx = 0;
199 199
200 char cwd[MAXPATHLEN+1]; 200 char cwd[MAXPATHLEN+1];
201 char *smid_opt; 201 char *smid_opt;
202 202
@@ -219,7 +219,7 @@ smc_save_yourself_CB (smcConn,
219 props[props_idx]->vals[0].length = strlen (SDATA (Vinvocation_name)); 219 props[props_idx]->vals[0].length = strlen (SDATA (Vinvocation_name));
220 props[props_idx]->vals[0].value = SDATA (Vinvocation_name); 220 props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
221 ++props_idx; 221 ++props_idx;
222 222
223 /* How to restart Emacs (i.e.: /path/to/emacs --smid=xxxx). */ 223 /* How to restart Emacs (i.e.: /path/to/emacs --smid=xxxx). */
224 props[props_idx] = &prop_ptr[props_idx]; 224 props[props_idx] = &prop_ptr[props_idx];
225 props[props_idx]->name = SmRestartCommand; 225 props[props_idx]->name = SmRestartCommand;
@@ -232,7 +232,7 @@ smc_save_yourself_CB (smcConn,
232 smid_opt = xmalloc (strlen (SMID_OPT) + strlen (client_id) + 1); 232 smid_opt = xmalloc (strlen (SMID_OPT) + strlen (client_id) + 1);
233 strcpy (smid_opt, SMID_OPT); 233 strcpy (smid_opt, SMID_OPT);
234 strcat (smid_opt, client_id); 234 strcat (smid_opt, client_id);
235 235
236 props[props_idx]->vals[1].length = strlen (smid_opt); 236 props[props_idx]->vals[1].length = strlen (smid_opt);
237 props[props_idx]->vals[1].value = smid_opt; 237 props[props_idx]->vals[1].value = smid_opt;
238 val_idx += 2; 238 val_idx += 2;
@@ -264,8 +264,8 @@ smc_save_yourself_CB (smcConn,
264 props[props_idx]->vals[0].value = cwd; 264 props[props_idx]->vals[0].value = cwd;
265 ++props_idx; 265 ++props_idx;
266 } 266 }
267 267
268 268
269 SmcSetProperties (smcConn, props_idx, props); 269 SmcSetProperties (smcConn, props_idx, props);
270 270
271 xfree (smid_opt); 271 xfree (smid_opt);
@@ -375,7 +375,7 @@ ice_conn_watch_CB (iceConn, clientData, opening, watchData)
375 ice_fd = -1; 375 ice_fd = -1;
376 return; 376 return;
377 } 377 }
378 378
379 ice_fd = IceConnectionNumber (iceConn); 379 ice_fd = IceConnectionNumber (iceConn);
380#ifndef F_SETOWN_BUG 380#ifndef F_SETOWN_BUG
381#ifdef F_SETOWN 381#ifdef F_SETOWN
@@ -403,7 +403,7 @@ x_session_initialize ()
403 char* previous_id = NULL; 403 char* previous_id = NULL;
404 SmcCallbacks callbacks; 404 SmcCallbacks callbacks;
405 int name_len = 0; 405 int name_len = 0;
406 406
407 /* Check if we where started by the session manager. If so, we will 407 /* Check if we where started by the session manager. If so, we will
408 have a previous id. */ 408 have a previous id. */
409 if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id)) 409 if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id))
@@ -422,7 +422,7 @@ x_session_initialize ()
422 if (! EQ (Vinvocation_directory, Qnil)) 422 if (! EQ (Vinvocation_directory, Qnil))
423 strcpy (emacs_program, SDATA (Vinvocation_directory)); 423 strcpy (emacs_program, SDATA (Vinvocation_directory));
424 strcat (emacs_program, SDATA (Vinvocation_name)); 424 strcat (emacs_program, SDATA (Vinvocation_name));
425 425
426 /* The SM protocol says all callbacks are mandatory, so set up all 426 /* The SM protocol says all callbacks are mandatory, so set up all
427 here and in the mask passed to SmcOpenConnection */ 427 here and in the mask passed to SmcOpenConnection */
428 callbacks.save_yourself.callback = smc_save_yourself_CB; 428 callbacks.save_yourself.callback = smc_save_yourself_CB;
@@ -464,7 +464,7 @@ x_session_initialize ()
464DEFUN ("handle-save-session", Fhandle_save_session, 464DEFUN ("handle-save-session", Fhandle_save_session,
465 Shandle_save_session, 1, 1, "e", 465 Shandle_save_session, 1, 1, "e",
466 doc: /* Handle the save_yourself event from a session manager. 466 doc: /* Handle the save_yourself event from a session manager.
467A session manager can tell Emacs that the window system is shutting down 467A session manager can tell Emacs that the window system is shutting down
468by sending Emacs a save_yourself message. Emacs executes this function when 468by sending Emacs a save_yourself message. Emacs executes this function when
469such an event occurs. This function then executes `emacs-session-save'. 469such an event occurs. This function then executes `emacs-session-save'.
470After that, this function informs the session manager that it can continue 470After that, this function informs the session manager that it can continue
@@ -510,27 +510,27 @@ See also `x-session-previous-id', `emacs-save-session-functions',
510 510
511 DEFVAR_LISP ("x-session-previous-id", &Vx_session_previous_id, 511 DEFVAR_LISP ("x-session-previous-id", &Vx_session_previous_id,
512 doc: /* The previous session id Emacs got from session manager. 512 doc: /* The previous session id Emacs got from session manager.
513If Emacs is running on a window system that has a session manager, the 513If Emacs is running on a window system that has a session manager, the
514session manager gives Emacs a session id. It is feasible for Emacs lisp 514session manager gives Emacs a session id. It is feasible for Emacs lisp
515code to use the session id to save configuration in, for example, a file 515code to use the session id to save configuration in, for example, a file
516with a file name based on the session id. If Emacs is running when the 516with a file name based on the session id. If Emacs is running when the
517window system is shut down, the session manager remembers that Emacs was 517window system is shut down, the session manager remembers that Emacs was
518running and saves the session id Emacs had. 518running and saves the session id Emacs had.
519 519
520When the window system is started again, the session manager restarts 520When the window system is started again, the session manager restarts
521Emacs and hands Emacs the session id it had the last time it was 521Emacs and hands Emacs the session id it had the last time it was
522running. This is now the previous session id and the value of this 522running. This is now the previous session id and the value of this
523variable. If configuration was saved in a file as stated above, the 523variable. If configuration was saved in a file as stated above, the
524previous session id shall be used to reconstruct the file name. 524previous session id shall be used to reconstruct the file name.
525 525
526The session id Emacs has while it is running is in the variable 526The session id Emacs has while it is running is in the variable
527`x-session-id'. The value of this variable and `x-session-id' may be the 527`x-session-id'. The value of this variable and `x-session-id' may be the
528same, depending on how the session manager works. 528same, depending on how the session manager works.
529 529
530See also `emacs-save-session-functions', `emacs-session-save' and 530See also `emacs-save-session-functions', `emacs-session-save' and
531`emacs-session-restore'." */); 531`emacs-session-restore'." */);
532 Vx_session_previous_id = Qnil; 532 Vx_session_previous_id = Qnil;
533 533
534 defsubr (&Shandle_save_session); 534 defsubr (&Shandle_save_session);
535} 535}
536 536
diff --git a/src/xterm.c b/src/xterm.c
index eded4c8d9fa..36325e3973d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -238,7 +238,7 @@ Lisp_Object Vx_toolkit_scroll_bars;
238 238
239/* If a string, XTread_socket generates an event to display that string. 239/* If a string, XTread_socket generates an event to display that string.
240 (The display is done in read_char.) */ 240 (The display is done in read_char.) */
241 241
242static Lisp_Object help_echo; 242static Lisp_Object help_echo;
243static Lisp_Object help_echo_window; 243static Lisp_Object help_echo_window;
244static Lisp_Object help_echo_object; 244static Lisp_Object help_echo_object;
@@ -299,7 +299,7 @@ XtAppContext Xt_app_con;
299static String Xt_default_resources[] = {0}; 299static String Xt_default_resources[] = {0};
300#endif /* USE_X_TOOLKIT */ 300#endif /* USE_X_TOOLKIT */
301 301
302/* Nominal cursor position -- where to draw output. 302/* Nominal cursor position -- where to draw output.
303 HPOS and VPOS are window relative glyph matrix coordinates. 303 HPOS and VPOS are window relative glyph matrix coordinates.
304 X and Y are window relative pixel coordinates. */ 304 X and Y are window relative pixel coordinates. */
305 305
@@ -496,7 +496,7 @@ static void x_update_cursor_in_window_tree P_ ((struct window *, int));
496static void x_update_window_cursor P_ ((struct window *, int)); 496static void x_update_window_cursor P_ ((struct window *, int));
497static void x_erase_phys_cursor P_ ((struct window *)); 497static void x_erase_phys_cursor P_ ((struct window *));
498void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int)); 498void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int));
499static void x_draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, 499static void x_draw_fringe_bitmap P_ ((struct window *, struct glyph_row *,
500 enum fringe_bitmap_type, int left_p)); 500 enum fringe_bitmap_type, int left_p));
501 501
502static void x_clip_to_row P_ ((struct window *, struct glyph_row *, 502static void x_clip_to_row P_ ((struct window *, struct glyph_row *,
@@ -546,7 +546,7 @@ x_flush (f)
546 XTread_socket calls XPending. Removing XFlush improves 546 XTread_socket calls XPending. Removing XFlush improves
547 performance. */ 547 performance. */
548 548
549#define XFlush(DISPLAY) (void) 0 549#define XFlush(DISPLAY) (void) 0
550 550
551 551
552/*********************************************************************** 552/***********************************************************************
@@ -558,7 +558,7 @@ x_flush (f)
558/* This is a function useful for recording debugging information about 558/* This is a function useful for recording debugging information about
559 the sequence of occurrences in this file. */ 559 the sequence of occurrences in this file. */
560 560
561struct record 561struct record
562{ 562{
563 char *locus; 563 char *locus;
564 int type; 564 int type;
@@ -604,7 +604,7 @@ x_display_info_for_display (dpy)
604/*********************************************************************** 604/***********************************************************************
605 Starting and ending an update 605 Starting and ending an update
606 ***********************************************************************/ 606 ***********************************************************************/
607 607
608/* Start an update of frame F. This function is installed as a hook 608/* Start an update of frame F. This function is installed as a hook
609 for update_begin, i.e. it is called when update_begin is called. 609 for update_begin, i.e. it is called when update_begin is called.
610 This function is called prior to calls to x_update_window_begin for 610 This function is called prior to calls to x_update_window_begin for
@@ -629,7 +629,7 @@ x_update_window_begin (w)
629{ 629{
630 struct frame *f = XFRAME (WINDOW_FRAME (w)); 630 struct frame *f = XFRAME (WINDOW_FRAME (w));
631 struct x_display_info *display_info = FRAME_X_DISPLAY_INFO (f); 631 struct x_display_info *display_info = FRAME_X_DISPLAY_INFO (f);
632 632
633 updated_window = w; 633 updated_window = w;
634 set_output_cursor (&w->cursor); 634 set_output_cursor (&w->cursor);
635 635
@@ -651,7 +651,7 @@ x_update_window_begin (w)
651 flag set. So, rows containing mouse-face glyphs are never 651 flag set. So, rows containing mouse-face glyphs are never
652 scrolled, and we don't have to switch the mouse highlight off 652 scrolled, and we don't have to switch the mouse highlight off
653 here to prevent it from being scrolled. */ 653 here to prevent it from being scrolled. */
654 654
655 /* Can we tell that this update does not affect the window 655 /* Can we tell that this update does not affect the window
656 where the mouse highlight is? If so, no need to turn off. 656 where the mouse highlight is? If so, no need to turn off.
657 Likewise, don't do anything if the frame is garbaged; 657 Likewise, don't do anything if the frame is garbaged;
@@ -684,7 +684,7 @@ x_draw_vertical_border (w)
684 struct window *w; 684 struct window *w;
685{ 685{
686 struct frame *f = XFRAME (WINDOW_FRAME (w)); 686 struct frame *f = XFRAME (WINDOW_FRAME (w));
687 687
688 /* Redraw borders between horizontally adjacent windows. Don't 688 /* Redraw borders between horizontally adjacent windows. Don't
689 do it for frames with vertical scroll bars because either the 689 do it for frames with vertical scroll bars because either the
690 right scroll bar of a window, or the left scroll bar of its 690 right scroll bar of a window, or the left scroll bar of its
@@ -697,13 +697,13 @@ x_draw_vertical_border (w)
697 window_box_edges (w, -1, &x0, &y0, &x1, &y1); 697 window_box_edges (w, -1, &x0, &y0, &x1, &y1);
698 x1 += FRAME_X_RIGHT_FRINGE_WIDTH (f); 698 x1 += FRAME_X_RIGHT_FRINGE_WIDTH (f);
699 y1 -= 1; 699 y1 -= 1;
700 700
701 XDrawLine (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 701 XDrawLine (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
702 f->output_data.x->normal_gc, x1, y0, x1, y1); 702 f->output_data.x->normal_gc, x1, y0, x1, y1);
703 } 703 }
704} 704}
705 705
706 706
707/* End update of window W (which is equal to updated_window). 707/* End update of window W (which is equal to updated_window).
708 708
709 Draw vertical borders between horizontally adjacent windows, and 709 Draw vertical borders between horizontally adjacent windows, and
@@ -723,7 +723,7 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p)
723 int cursor_on_p, mouse_face_overwritten_p; 723 int cursor_on_p, mouse_face_overwritten_p;
724{ 724{
725 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); 725 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame));
726 726
727 if (!w->pseudo_window_p) 727 if (!w->pseudo_window_p)
728 { 728 {
729 BLOCK_INPUT; 729 BLOCK_INPUT;
@@ -732,11 +732,11 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p)
732 x_display_and_set_cursor (w, 1, output_cursor.hpos, 732 x_display_and_set_cursor (w, 1, output_cursor.hpos,
733 output_cursor.vpos, 733 output_cursor.vpos,
734 output_cursor.x, output_cursor.y); 734 output_cursor.x, output_cursor.y);
735 735
736 x_draw_vertical_border (w); 736 x_draw_vertical_border (w);
737 UNBLOCK_INPUT; 737 UNBLOCK_INPUT;
738 } 738 }
739 739
740 /* If a row with mouse-face was overwritten, arrange for 740 /* If a row with mouse-face was overwritten, arrange for
741 XTframe_up_to_date to redisplay the mouse highlight. */ 741 XTframe_up_to_date to redisplay the mouse highlight. */
742 if (mouse_face_overwritten_p) 742 if (mouse_face_overwritten_p)
@@ -745,7 +745,7 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p)
745 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 745 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
746 dpyinfo->mouse_face_window = Qnil; 746 dpyinfo->mouse_face_window = Qnil;
747 } 747 }
748 748
749 updated_window = NULL; 749 updated_window = NULL;
750} 750}
751 751
@@ -807,16 +807,16 @@ x_after_update_window_line (desired_row)
807 struct window *w = updated_window; 807 struct window *w = updated_window;
808 struct frame *f; 808 struct frame *f;
809 int width, height; 809 int width, height;
810 810
811 xassert (w); 811 xassert (w);
812 812
813 if (!desired_row->mode_line_p && !w->pseudo_window_p) 813 if (!desired_row->mode_line_p && !w->pseudo_window_p)
814 { 814 {
815 BLOCK_INPUT; 815 BLOCK_INPUT;
816 x_draw_row_fringe_bitmaps (w, desired_row); 816 x_draw_row_fringe_bitmaps (w, desired_row);
817 UNBLOCK_INPUT; 817 UNBLOCK_INPUT;
818 } 818 }
819 819
820 /* When a window has disappeared, make sure that no rest of 820 /* When a window has disappeared, make sure that no rest of
821 full-width rows stays visible in the internal border. Could 821 full-width rows stays visible in the internal border. Could
822 check here if updated_window is the leftmost/rightmost window, 822 check here if updated_window is the leftmost/rightmost window,
@@ -837,7 +837,7 @@ x_after_update_window_line (desired_row)
837 if (WINDOWP (f->tool_bar_window) 837 if (WINDOWP (f->tool_bar_window)
838 && w == XWINDOW (f->tool_bar_window)) 838 && w == XWINDOW (f->tool_bar_window))
839 y -= width; 839 y -= width;
840 840
841 BLOCK_INPUT; 841 BLOCK_INPUT;
842 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 842 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
843 0, y, width, height, False); 843 0, y, width, height, False);
@@ -890,13 +890,13 @@ x_draw_fringe_bitmap (w, row, which, left_p)
890 h = left_height; 890 h = left_height;
891 bits = left_bits; 891 bits = left_bits;
892 break; 892 break;
893 893
894 case OVERLAY_ARROW_BITMAP: 894 case OVERLAY_ARROW_BITMAP:
895 wd = ov_width; 895 wd = ov_width;
896 h = ov_height; 896 h = ov_height;
897 bits = ov_bits; 897 bits = ov_bits;
898 break; 898 break;
899 899
900 case RIGHT_TRUNCATION_BITMAP: 900 case RIGHT_TRUNCATION_BITMAP:
901 wd = right_width; 901 wd = right_width;
902 h = right_height; 902 h = right_height;
@@ -908,7 +908,7 @@ x_draw_fringe_bitmap (w, row, which, left_p)
908 h = continued_height; 908 h = continued_height;
909 bits = continued_bits; 909 bits = continued_bits;
910 break; 910 break;
911 911
912 case CONTINUATION_LINE_BITMAP: 912 case CONTINUATION_LINE_BITMAP:
913 wd = continuation_width; 913 wd = continuation_width;
914 h = continuation_height; 914 h = continuation_height;
@@ -975,7 +975,7 @@ x_draw_fringe_bitmap (w, row, which, left_p)
975 if (b1 >= 0) 975 if (b1 >= 0)
976 { 976 {
977 int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); 977 int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
978 978
979 /* In case the same realized face is used for fringes and 979 /* In case the same realized face is used for fringes and
980 for something displayed in the text (e.g. face `region' on 980 for something displayed in the text (e.g. face `region' on
981 mono-displays, the fill style may have been changed to 981 mono-displays, the fill style may have been changed to
@@ -984,7 +984,7 @@ x_draw_fringe_bitmap (w, row, which, left_p)
984 XSetFillStyle (display, face->gc, FillOpaqueStippled); 984 XSetFillStyle (display, face->gc, FillOpaqueStippled);
985 else 985 else
986 XSetForeground (display, face->gc, face->background); 986 XSetForeground (display, face->gc, face->background);
987 987
988 XFillRectangle (display, window, face->gc, 988 XFillRectangle (display, window, face->gc,
989 b1, 989 b1,
990 WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, 990 WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height,
@@ -1005,7 +1005,7 @@ x_draw_fringe_bitmap (w, row, which, left_p)
1005 XCopyArea (display, pixmap, window, gc, 0, 0, wd, h, x, y + dy); 1005 XCopyArea (display, pixmap, window, gc, 0, 0, wd, h, x, y + dy);
1006 XFreePixmap (display, pixmap); 1006 XFreePixmap (display, pixmap);
1007 } 1007 }
1008 1008
1009 XSetClipMask (display, gc, None); 1009 XSetClipMask (display, gc, None);
1010} 1010}
1011 1011
@@ -1105,7 +1105,7 @@ set_output_cursor (cursor)
1105 1105
1106 HPOS and VPOS are column/row positions in a window glyph matrix. X 1106 HPOS and VPOS are column/row positions in a window glyph matrix. X
1107 and Y are window text area relative pixel positions. 1107 and Y are window text area relative pixel positions.
1108 1108
1109 If this is done during an update, updated_window will contain the 1109 If this is done during an update, updated_window will contain the
1110 window that is being updated and the position is the future output 1110 window that is being updated and the position is the future output
1111 cursor position for that window. If updated_window is null, use 1111 cursor position for that window. If updated_window is null, use
@@ -1268,9 +1268,9 @@ x_encode_char (c, char2b, font_info)
1268 ccl->reg[1] = char2b->byte1; 1268 ccl->reg[1] = char2b->byte1;
1269 ccl->reg[2] = char2b->byte2; 1269 ccl->reg[2] = char2b->byte2;
1270 } 1270 }
1271 1271
1272 ccl_driver (ccl, NULL, NULL, 0, 0, NULL); 1272 ccl_driver (ccl, NULL, NULL, 0, 0, NULL);
1273 1273
1274 /* We assume that MSBs are appropriately set/reset by CCL 1274 /* We assume that MSBs are appropriately set/reset by CCL
1275 program. */ 1275 program. */
1276 if (font->max_byte1 == 0) /* 1-byte font */ 1276 if (font->max_byte1 == 0) /* 1-byte font */
@@ -1283,11 +1283,11 @@ x_encode_char (c, char2b, font_info)
1283 /* Fixed encoding scheme. See fontset.h for the meaning of the 1283 /* Fixed encoding scheme. See fontset.h for the meaning of the
1284 encoding numbers. */ 1284 encoding numbers. */
1285 int enc = font_info->encoding[charset]; 1285 int enc = font_info->encoding[charset];
1286 1286
1287 if ((enc == 1 || enc == 2) 1287 if ((enc == 1 || enc == 2)
1288 && CHARSET_DIMENSION (charset) == 2) 1288 && CHARSET_DIMENSION (charset) == 2)
1289 char2b->byte1 |= 0x80; 1289 char2b->byte1 |= 0x80;
1290 1290
1291 if (enc == 1 || enc == 3) 1291 if (enc == 1 || enc == 3)
1292 char2b->byte2 |= 0x80; 1292 char2b->byte2 |= 0x80;
1293 } 1293 }
@@ -1328,7 +1328,7 @@ x_get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p, display_p)
1328 else 1328 else
1329 { 1329 {
1330 int c1, c2, charset; 1330 int c1, c2, charset;
1331 1331
1332 /* Split characters into bytes. If c2 is -1 afterwards, C is 1332 /* Split characters into bytes. If c2 is -1 afterwards, C is
1333 really a one-byte character so that byte1 is zero. */ 1333 really a one-byte character so that byte1 is zero. */
1334 SPLIT_CHAR (c, charset, c1, c2); 1334 SPLIT_CHAR (c, charset, c1, c2);
@@ -1353,7 +1353,7 @@ x_get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p, display_p)
1353 xassert (face != NULL); 1353 xassert (face != NULL);
1354 PREPARE_FACE_FOR_DISPLAY (f, face); 1354 PREPARE_FACE_FOR_DISPLAY (f, face);
1355 } 1355 }
1356 1356
1357 return face; 1357 return face;
1358} 1358}
1359 1359
@@ -1394,7 +1394,7 @@ x_get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p)
1394 else 1394 else
1395 { 1395 {
1396 int c1, c2, charset; 1396 int c1, c2, charset;
1397 1397
1398 /* Split characters into bytes. If c2 is -1 afterwards, C is 1398 /* Split characters into bytes. If c2 is -1 afterwards, C is
1399 really a one-byte character so that byte1 is zero. */ 1399 really a one-byte character so that byte1 is zero. */
1400 SPLIT_CHAR (glyph->u.ch, charset, c1, c2); 1400 SPLIT_CHAR (glyph->u.ch, charset, c1, c2);
@@ -1425,7 +1425,7 @@ x_get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p)
1425} 1425}
1426 1426
1427 1427
1428/* Store one glyph for IT->char_to_display in IT->glyph_row. 1428/* Store one glyph for IT->char_to_display in IT->glyph_row.
1429 Called from x_produce_glyphs when IT->glyph_row is non-null. */ 1429 Called from x_produce_glyphs when IT->glyph_row is non-null. */
1430 1430
1431static INLINE void 1431static INLINE void
@@ -1434,10 +1434,10 @@ x_append_glyph (it)
1434{ 1434{
1435 struct glyph *glyph; 1435 struct glyph *glyph;
1436 enum glyph_row_area area = it->area; 1436 enum glyph_row_area area = it->area;
1437 1437
1438 xassert (it->glyph_row); 1438 xassert (it->glyph_row);
1439 xassert (it->char_to_display != '\n' && it->char_to_display != '\t'); 1439 xassert (it->char_to_display != '\n' && it->char_to_display != '\t');
1440 1440
1441 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; 1441 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
1442 if (glyph < it->glyph_row->glyphs[area + 1]) 1442 if (glyph < it->glyph_row->glyphs[area + 1])
1443 { 1443 {
@@ -1459,7 +1459,7 @@ x_append_glyph (it)
1459 } 1459 }
1460} 1460}
1461 1461
1462/* Store one glyph for the composition IT->cmp_id in IT->glyph_row. 1462/* Store one glyph for the composition IT->cmp_id in IT->glyph_row.
1463 Called from x_produce_glyphs when IT->glyph_row is non-null. */ 1463 Called from x_produce_glyphs when IT->glyph_row is non-null. */
1464 1464
1465static INLINE void 1465static INLINE void
@@ -1468,9 +1468,9 @@ x_append_composite_glyph (it)
1468{ 1468{
1469 struct glyph *glyph; 1469 struct glyph *glyph;
1470 enum glyph_row_area area = it->area; 1470 enum glyph_row_area area = it->area;
1471 1471
1472 xassert (it->glyph_row); 1472 xassert (it->glyph_row);
1473 1473
1474 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; 1474 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
1475 if (glyph < it->glyph_row->glyphs[area + 1]) 1475 if (glyph < it->glyph_row->glyphs[area + 1])
1476 { 1476 {
@@ -1540,7 +1540,7 @@ x_produce_image_glyph (it)
1540 it->pixel_width = img->width + 2 * img->hmargin; 1540 it->pixel_width = img->width + 2 * img->hmargin;
1541 1541
1542 it->nglyphs = 1; 1542 it->nglyphs = 1;
1543 1543
1544 if (face->box != FACE_NO_BOX) 1544 if (face->box != FACE_NO_BOX)
1545 { 1545 {
1546 if (face->box_line_width > 0) 1546 if (face->box_line_width > 0)
@@ -1548,7 +1548,7 @@ x_produce_image_glyph (it)
1548 it->ascent += face->box_line_width; 1548 it->ascent += face->box_line_width;
1549 it->descent += face->box_line_width; 1549 it->descent += face->box_line_width;
1550 } 1550 }
1551 1551
1552 if (it->start_of_box_run_p) 1552 if (it->start_of_box_run_p)
1553 it->pixel_width += abs (face->box_line_width); 1553 it->pixel_width += abs (face->box_line_width);
1554 if (it->end_of_box_run_p) 1554 if (it->end_of_box_run_p)
@@ -1556,12 +1556,12 @@ x_produce_image_glyph (it)
1556 } 1556 }
1557 1557
1558 take_vertical_position_into_account (it); 1558 take_vertical_position_into_account (it);
1559 1559
1560 if (it->glyph_row) 1560 if (it->glyph_row)
1561 { 1561 {
1562 struct glyph *glyph; 1562 struct glyph *glyph;
1563 enum glyph_row_area area = it->area; 1563 enum glyph_row_area area = it->area;
1564 1564
1565 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; 1565 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
1566 if (glyph < it->glyph_row->glyphs[area + 1]) 1566 if (glyph < it->glyph_row->glyphs[area + 1])
1567 { 1567 {
@@ -1585,10 +1585,10 @@ x_produce_image_glyph (it)
1585 1585
1586 1586
1587/* Append a stretch glyph to IT->glyph_row. OBJECT is the source 1587/* Append a stretch glyph to IT->glyph_row. OBJECT is the source
1588 of the glyph, WIDTH and HEIGHT are the width and height of the 1588 of the glyph, WIDTH and HEIGHT are the width and height of the
1589 stretch. ASCENT is the percentage/100 of HEIGHT to use for the 1589 stretch. ASCENT is the percentage/100 of HEIGHT to use for the
1590 ascent of the glyph (0 <= ASCENT <= 1). */ 1590 ascent of the glyph (0 <= ASCENT <= 1). */
1591 1591
1592static void 1592static void
1593x_append_stretch_glyph (it, object, width, height, ascent) 1593x_append_stretch_glyph (it, object, width, height, ascent)
1594 struct it *it; 1594 struct it *it;
@@ -1600,7 +1600,7 @@ x_append_stretch_glyph (it, object, width, height, ascent)
1600 enum glyph_row_area area = it->area; 1600 enum glyph_row_area area = it->area;
1601 1601
1602 xassert (ascent >= 0 && ascent <= 1); 1602 xassert (ascent >= 0 && ascent <= 1);
1603 1603
1604 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; 1604 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
1605 if (glyph < it->glyph_row->glyphs[area + 1]) 1605 if (glyph < it->glyph_row->glyphs[area + 1])
1606 { 1606 {
@@ -1629,7 +1629,7 @@ x_append_stretch_glyph (it, object, width, height, ascent)
1629 being recognized: 1629 being recognized:
1630 1630
1631 1. `:width WIDTH' specifies that the space should be WIDTH * 1631 1. `:width WIDTH' specifies that the space should be WIDTH *
1632 canonical char width wide. WIDTH may be an integer or floating 1632 canonical char width wide. WIDTH may be an integer or floating
1633 point number. 1633 point number.
1634 1634
1635 2. `:relative-width FACTOR' specifies that the width of the stretch 1635 2. `:relative-width FACTOR' specifies that the width of the stretch
@@ -1639,7 +1639,7 @@ x_append_stretch_glyph (it, object, width, height, ascent)
1639 3. `:align-to HPOS' specifies that the space should be wide enough 1639 3. `:align-to HPOS' specifies that the space should be wide enough
1640 to reach HPOS, a value in canonical character units. 1640 to reach HPOS, a value in canonical character units.
1641 1641
1642 Exactly one of the above pairs must be present. 1642 Exactly one of the above pairs must be present.
1643 1643
1644 4. `:height HEIGHT' specifies that the height of the stretch produced 1644 4. `:height HEIGHT' specifies that the height of the stretch produced
1645 should be HEIGHT, measured in canonical character units. 1645 should be HEIGHT, measured in canonical character units.
@@ -1677,7 +1677,7 @@ x_produce_stretch_glyph (it)
1677 XFontStruct *font = face->font ? face->font : FRAME_FONT (it->f); 1677 XFontStruct *font = face->font ? face->font : FRAME_FONT (it->f);
1678 1678
1679 PREPARE_FACE_FOR_DISPLAY (it->f, face); 1679 PREPARE_FACE_FOR_DISPLAY (it->f, face);
1680 1680
1681 /* List should start with `space'. */ 1681 /* List should start with `space'. */
1682 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace)); 1682 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace));
1683 plist = XCDR (it->object); 1683 plist = XCDR (it->object);
@@ -1695,7 +1695,7 @@ x_produce_stretch_glyph (it)
1695 property. */ 1695 property. */
1696 struct it it2; 1696 struct it it2;
1697 unsigned char *p = BYTE_POS_ADDR (IT_BYTEPOS (*it)); 1697 unsigned char *p = BYTE_POS_ADDR (IT_BYTEPOS (*it));
1698 1698
1699 it2 = *it; 1699 it2 = *it;
1700 if (it->multibyte_p) 1700 if (it->multibyte_p)
1701 { 1701 {
@@ -1717,7 +1717,7 @@ x_produce_stretch_glyph (it)
1717 else 1717 else
1718 /* Nothing specified -> width defaults to canonical char width. */ 1718 /* Nothing specified -> width defaults to canonical char width. */
1719 width = CANON_X_UNIT (it->f); 1719 width = CANON_X_UNIT (it->f);
1720 1720
1721 /* Compute height. */ 1721 /* Compute height. */
1722 if (prop = Fplist_get (plist, QCheight), 1722 if (prop = Fplist_get (plist, QCheight),
1723 NUMVAL (prop) > 0) 1723 NUMVAL (prop) > 0)
@@ -1728,7 +1728,7 @@ x_produce_stretch_glyph (it)
1728 else 1728 else
1729 height = FONT_HEIGHT (font); 1729 height = FONT_HEIGHT (font);
1730 1730
1731 /* Compute percentage of height used for ascent. If 1731 /* Compute percentage of height used for ascent. If
1732 `:ascent ASCENT' is present and valid, use that. Otherwise, 1732 `:ascent ASCENT' is present and valid, use that. Otherwise,
1733 derive the ascent from the font in use. */ 1733 derive the ascent from the font in use. */
1734 if (prop = Fplist_get (plist, QCascent), 1734 if (prop = Fplist_get (plist, QCascent),
@@ -1762,13 +1762,13 @@ x_produce_stretch_glyph (it)
1762 it->ascent += face->box_line_width; 1762 it->ascent += face->box_line_width;
1763 it->descent += face->box_line_width; 1763 it->descent += face->box_line_width;
1764 } 1764 }
1765 1765
1766 if (it->start_of_box_run_p) 1766 if (it->start_of_box_run_p)
1767 it->pixel_width += abs (face->box_line_width); 1767 it->pixel_width += abs (face->box_line_width);
1768 if (it->end_of_box_run_p) 1768 if (it->end_of_box_run_p)
1769 it->pixel_width += abs (face->box_line_width); 1769 it->pixel_width += abs (face->box_line_width);
1770 } 1770 }
1771 1771
1772 take_vertical_position_into_account (it); 1772 take_vertical_position_into_account (it);
1773} 1773}
1774 1774
@@ -1859,7 +1859,7 @@ x_produce_glyphs (it)
1859 face = FACE_FROM_ID (it->f, it->face_id); 1859 face = FACE_FROM_ID (it->f, it->face_id);
1860 } 1860 }
1861 } 1861 }
1862 1862
1863 /* Get font to use. Encode IT->char_to_display. */ 1863 /* Get font to use. Encode IT->char_to_display. */
1864 x_get_char_face_and_encoding (it->f, it->char_to_display, 1864 x_get_char_face_and_encoding (it->f, it->char_to_display,
1865 it->face_id, &char2b, 1865 it->face_id, &char2b,
@@ -1920,7 +1920,7 @@ x_produce_glyphs (it)
1920 if (face->box != FACE_NO_BOX) 1920 if (face->box != FACE_NO_BOX)
1921 { 1921 {
1922 int thick = face->box_line_width; 1922 int thick = face->box_line_width;
1923 1923
1924 if (thick > 0) 1924 if (thick > 0)
1925 { 1925 {
1926 it->ascent += thick; 1926 it->ascent += thick;
@@ -1941,7 +1941,7 @@ x_produce_glyphs (it)
1941 it->ascent += 2; 1941 it->ascent += 2;
1942 1942
1943 take_vertical_position_into_account (it); 1943 take_vertical_position_into_account (it);
1944 1944
1945 /* If we have to actually produce glyphs, do it. */ 1945 /* If we have to actually produce glyphs, do it. */
1946 if (it->glyph_row) 1946 if (it->glyph_row)
1947 { 1947 {
@@ -1950,7 +1950,7 @@ x_produce_glyphs (it)
1950 /* Translate a space with a `space-width' property 1950 /* Translate a space with a `space-width' property
1951 into a stretch glyph. */ 1951 into a stretch glyph. */
1952 double ascent = (double) font->ascent / FONT_HEIGHT (font); 1952 double ascent = (double) font->ascent / FONT_HEIGHT (font);
1953 x_append_stretch_glyph (it, it->object, it->pixel_width, 1953 x_append_stretch_glyph (it, it->object, it->pixel_width,
1954 it->ascent + it->descent, ascent); 1954 it->ascent + it->descent, ascent);
1955 } 1955 }
1956 else 1956 else
@@ -1970,7 +1970,7 @@ x_produce_glyphs (it)
1970 it->nglyphs = 0; 1970 it->nglyphs = 0;
1971 it->ascent = it->phys_ascent = font->ascent + boff; 1971 it->ascent = it->phys_ascent = font->ascent + boff;
1972 it->descent = it->phys_descent = font->descent - boff; 1972 it->descent = it->phys_descent = font->descent - boff;
1973 1973
1974 if (face->box != FACE_NO_BOX 1974 if (face->box != FACE_NO_BOX
1975 && face->box_line_width > 0) 1975 && face->box_line_width > 0)
1976 { 1976 {
@@ -1989,20 +1989,20 @@ x_produce_glyphs (it)
1989 tab stop after that. */ 1989 tab stop after that. */
1990 if (next_tab_x - x < CANON_X_UNIT (it->f)) 1990 if (next_tab_x - x < CANON_X_UNIT (it->f))
1991 next_tab_x += tab_width; 1991 next_tab_x += tab_width;
1992 1992
1993 it->pixel_width = next_tab_x - x; 1993 it->pixel_width = next_tab_x - x;
1994 it->nglyphs = 1; 1994 it->nglyphs = 1;
1995 it->ascent = it->phys_ascent = font->ascent + boff; 1995 it->ascent = it->phys_ascent = font->ascent + boff;
1996 it->descent = it->phys_descent = font->descent - boff; 1996 it->descent = it->phys_descent = font->descent - boff;
1997 1997
1998 if (it->glyph_row) 1998 if (it->glyph_row)
1999 { 1999 {
2000 double ascent = (double) it->ascent / (it->ascent + it->descent); 2000 double ascent = (double) it->ascent / (it->ascent + it->descent);
2001 x_append_stretch_glyph (it, it->object, it->pixel_width, 2001 x_append_stretch_glyph (it, it->object, it->pixel_width,
2002 it->ascent + it->descent, ascent); 2002 it->ascent + it->descent, ascent);
2003 } 2003 }
2004 } 2004 }
2005 else 2005 else
2006 { 2006 {
2007 /* A multi-byte character. Assume that the display width of the 2007 /* A multi-byte character. Assume that the display width of the
2008 character is the width of the character multiplied by the 2008 character is the width of the character multiplied by the
@@ -2048,20 +2048,20 @@ x_produce_glyphs (it)
2048 } 2048 }
2049 else 2049 else
2050 thick = - thick; 2050 thick = - thick;
2051 2051
2052 if (it->start_of_box_run_p) 2052 if (it->start_of_box_run_p)
2053 it->pixel_width += thick; 2053 it->pixel_width += thick;
2054 if (it->end_of_box_run_p) 2054 if (it->end_of_box_run_p)
2055 it->pixel_width += thick; 2055 it->pixel_width += thick;
2056 } 2056 }
2057 2057
2058 /* If face has an overline, add the height of the overline 2058 /* If face has an overline, add the height of the overline
2059 (1 pixel) and a 1 pixel margin to the character height. */ 2059 (1 pixel) and a 1 pixel margin to the character height. */
2060 if (face->overline_p) 2060 if (face->overline_p)
2061 it->ascent += 2; 2061 it->ascent += 2;
2062 2062
2063 take_vertical_position_into_account (it); 2063 take_vertical_position_into_account (it);
2064 2064
2065 if (it->glyph_row) 2065 if (it->glyph_row)
2066 x_append_glyph (it); 2066 x_append_glyph (it);
2067 } 2067 }
@@ -2090,7 +2090,7 @@ x_produce_glyphs (it)
2090 { 2090 {
2091 it->char_to_display = unibyte_char_to_multibyte (it->c); 2091 it->char_to_display = unibyte_char_to_multibyte (it->c);
2092 } 2092 }
2093 2093
2094 /* Get face and font to use. Encode IT->char_to_display. */ 2094 /* Get face and font to use. Encode IT->char_to_display. */
2095 it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display); 2095 it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display);
2096 face = FACE_FROM_ID (it->f, it->face_id); 2096 face = FACE_FROM_ID (it->f, it->face_id);
@@ -2155,12 +2155,12 @@ x_produce_glyphs (it)
2155 ascent = font->ascent; 2155 ascent = font->ascent;
2156 descent = font->descent; 2156 descent = font->descent;
2157 } 2157 }
2158 2158
2159 rightmost = width; 2159 rightmost = width;
2160 lowest = - descent + boff; 2160 lowest = - descent + boff;
2161 highest = ascent + boff; 2161 highest = ascent + boff;
2162 leftmost = 0; 2162 leftmost = 0;
2163 2163
2164 if (font_info 2164 if (font_info
2165 && font_info->default_ascent 2165 && font_info->default_ascent
2166 && CHAR_TABLE_P (Vuse_default_ascent) 2166 && CHAR_TABLE_P (Vuse_default_ascent)
@@ -2180,7 +2180,7 @@ x_produce_glyphs (it)
2180 int left, right, btm, top; 2180 int left, right, btm, top;
2181 int ch = COMPOSITION_GLYPH (cmp, i); 2181 int ch = COMPOSITION_GLYPH (cmp, i);
2182 int face_id = FACE_FOR_CHAR (it->f, face, ch); 2182 int face_id = FACE_FOR_CHAR (it->f, face, ch);
2183 2183
2184 face = FACE_FROM_ID (it->f, face_id); 2184 face = FACE_FROM_ID (it->f, face_id);
2185 x_get_char_face_and_encoding (it->f, ch, face->id, &char2b, 2185 x_get_char_face_and_encoding (it->f, ch, face->id, &char2b,
2186 it->multibyte_p, 0); 2186 it->multibyte_p, 0);
@@ -2321,20 +2321,20 @@ x_produce_glyphs (it)
2321 } 2321 }
2322 else 2322 else
2323 thick = - thick; 2323 thick = - thick;
2324 2324
2325 if (it->start_of_box_run_p) 2325 if (it->start_of_box_run_p)
2326 it->pixel_width += thick; 2326 it->pixel_width += thick;
2327 if (it->end_of_box_run_p) 2327 if (it->end_of_box_run_p)
2328 it->pixel_width += thick; 2328 it->pixel_width += thick;
2329 } 2329 }
2330 2330
2331 /* If face has an overline, add the height of the overline 2331 /* If face has an overline, add the height of the overline
2332 (1 pixel) and a 1 pixel margin to the character height. */ 2332 (1 pixel) and a 1 pixel margin to the character height. */
2333 if (face->overline_p) 2333 if (face->overline_p)
2334 it->ascent += 2; 2334 it->ascent += 2;
2335 2335
2336 take_vertical_position_into_account (it); 2336 take_vertical_position_into_account (it);
2337 2337
2338 if (it->glyph_row) 2338 if (it->glyph_row)
2339 x_append_composite_glyph (it); 2339 x_append_composite_glyph (it);
2340 } 2340 }
@@ -2348,9 +2348,9 @@ x_produce_glyphs (it)
2348 xassert (it->ascent >= 0 && it->descent >= 0); 2348 xassert (it->ascent >= 0 && it->descent >= 0);
2349 if (it->area == TEXT_AREA) 2349 if (it->area == TEXT_AREA)
2350 it->current_x += it->pixel_width; 2350 it->current_x += it->pixel_width;
2351 2351
2352 it->descent += it->extra_line_spacing; 2352 it->descent += it->extra_line_spacing;
2353 2353
2354 it->max_ascent = max (it->max_ascent, it->ascent); 2354 it->max_ascent = max (it->max_ascent, it->ascent);
2355 it->max_descent = max (it->max_descent, it->descent); 2355 it->max_descent = max (it->max_descent, it->descent);
2356 it->max_phys_ascent = max (it->max_phys_ascent, it->phys_ascent); 2356 it->max_phys_ascent = max (it->max_phys_ascent, it->phys_ascent);
@@ -2381,7 +2381,7 @@ x_estimate_mode_line_height (f, face_id)
2381 height += 2 * face->box_line_width; 2381 height += 2 * face->box_line_width;
2382 } 2382 }
2383 } 2383 }
2384 2384
2385 return height; 2385 return height;
2386} 2386}
2387 2387
@@ -2551,7 +2551,7 @@ static int x_fill_glyph_string P_ ((struct glyph_string *, int, int, int,
2551static void x_init_glyph_string P_ ((struct glyph_string *, 2551static void x_init_glyph_string P_ ((struct glyph_string *,
2552 XChar2b *, struct window *, 2552 XChar2b *, struct window *,
2553 struct glyph_row *, 2553 struct glyph_row *,
2554 enum glyph_row_area, int, 2554 enum glyph_row_area, int,
2555 enum draw_glyphs_face)); 2555 enum draw_glyphs_face));
2556static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, 2556static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *,
2557 enum glyph_row_area, int, int, 2557 enum glyph_row_area, int, int,
@@ -2707,11 +2707,11 @@ x_set_cursor_gc (s)
2707 2707
2708 2708
2709/* Set up S->gc of glyph string S for drawing text in mouse face. */ 2709/* Set up S->gc of glyph string S for drawing text in mouse face. */
2710 2710
2711static void 2711static void
2712x_set_mouse_face_gc (s) 2712x_set_mouse_face_gc (s)
2713 struct glyph_string *s; 2713 struct glyph_string *s;
2714{ 2714{
2715 int face_id; 2715 int face_id;
2716 struct face *face; 2716 struct face *face;
2717 2717
@@ -2720,7 +2720,7 @@ x_set_mouse_face_gc (s)
2720 face = FACE_FROM_ID (s->f, face_id); 2720 face = FACE_FROM_ID (s->f, face_id);
2721 if (face == NULL) 2721 if (face == NULL)
2722 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 2722 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
2723 2723
2724 if (s->first_glyph->type == CHAR_GLYPH) 2724 if (s->first_glyph->type == CHAR_GLYPH)
2725 face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch); 2725 face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch);
2726 else 2726 else
@@ -2737,21 +2737,21 @@ x_set_mouse_face_gc (s)
2737 but font FONT. */ 2737 but font FONT. */
2738 XGCValues xgcv; 2738 XGCValues xgcv;
2739 unsigned long mask; 2739 unsigned long mask;
2740 2740
2741 xgcv.background = s->face->background; 2741 xgcv.background = s->face->background;
2742 xgcv.foreground = s->face->foreground; 2742 xgcv.foreground = s->face->foreground;
2743 IF_DEBUG (x_check_font (s->f, s->font)); 2743 IF_DEBUG (x_check_font (s->f, s->font));
2744 xgcv.font = s->font->fid; 2744 xgcv.font = s->font->fid;
2745 xgcv.graphics_exposures = False; 2745 xgcv.graphics_exposures = False;
2746 mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; 2746 mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures;
2747 2747
2748 if (FRAME_X_DISPLAY_INFO (s->f)->scratch_cursor_gc) 2748 if (FRAME_X_DISPLAY_INFO (s->f)->scratch_cursor_gc)
2749 XChangeGC (s->display, FRAME_X_DISPLAY_INFO (s->f)->scratch_cursor_gc, 2749 XChangeGC (s->display, FRAME_X_DISPLAY_INFO (s->f)->scratch_cursor_gc,
2750 mask, &xgcv); 2750 mask, &xgcv);
2751 else 2751 else
2752 FRAME_X_DISPLAY_INFO (s->f)->scratch_cursor_gc 2752 FRAME_X_DISPLAY_INFO (s->f)->scratch_cursor_gc
2753 = XCreateGC (s->display, s->window, mask, &xgcv); 2753 = XCreateGC (s->display, s->window, mask, &xgcv);
2754 2754
2755 s->gc = FRAME_X_DISPLAY_INFO (s->f)->scratch_cursor_gc; 2755 s->gc = FRAME_X_DISPLAY_INFO (s->f)->scratch_cursor_gc;
2756 } 2756 }
2757 2757
@@ -2766,7 +2766,7 @@ x_set_mouse_face_gc (s)
2766static INLINE void 2766static INLINE void
2767x_set_mode_line_face_gc (s) 2767x_set_mode_line_face_gc (s)
2768 struct glyph_string *s; 2768 struct glyph_string *s;
2769{ 2769{
2770 s->gc = s->face->gc; 2770 s->gc = s->face->gc;
2771} 2771}
2772 2772
@@ -2780,7 +2780,7 @@ x_set_glyph_string_gc (s)
2780 struct glyph_string *s; 2780 struct glyph_string *s;
2781{ 2781{
2782 PREPARE_FACE_FOR_DISPLAY (s->f, s->face); 2782 PREPARE_FACE_FOR_DISPLAY (s->f, s->face);
2783 2783
2784 if (s->hl == DRAW_NORMAL_TEXT) 2784 if (s->hl == DRAW_NORMAL_TEXT)
2785 { 2785 {
2786 s->gc = s->face->gc; 2786 s->gc = s->face->gc;
@@ -2829,7 +2829,7 @@ x_get_glyph_string_clip_rect (s, r)
2829 { 2829 {
2830 /* Draw full-width. X coordinates are relative to S->w->left. */ 2830 /* Draw full-width. X coordinates are relative to S->w->left. */
2831 int canon_x = CANON_X_UNIT (s->f); 2831 int canon_x = CANON_X_UNIT (s->f);
2832 2832
2833 r->x = WINDOW_LEFT_MARGIN (s->w) * canon_x; 2833 r->x = WINDOW_LEFT_MARGIN (s->w) * canon_x;
2834 r->width = XFASTINT (s->w->width) * canon_x; 2834 r->width = XFASTINT (s->w->width) * canon_x;
2835 2835
@@ -2839,9 +2839,9 @@ x_get_glyph_string_clip_rect (s, r)
2839 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (s->f)) 2839 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (s->f))
2840 r->x -= width; 2840 r->x -= width;
2841 } 2841 }
2842 2842
2843 r->x += FRAME_INTERNAL_BORDER_WIDTH (s->f); 2843 r->x += FRAME_INTERNAL_BORDER_WIDTH (s->f);
2844 2844
2845 /* Unless displaying a mode or menu bar line, which are always 2845 /* Unless displaying a mode or menu bar line, which are always
2846 fully visible, clip to the visible part of the row. */ 2846 fully visible, clip to the visible part of the row. */
2847 if (s->w->pseudo_window_p) 2847 if (s->w->pseudo_window_p)
@@ -2922,7 +2922,7 @@ x_compute_glyph_string_overhangs (s)
2922/* Compute overhangs and x-positions for glyph string S and its 2922/* Compute overhangs and x-positions for glyph string S and its
2923 predecessors, or successors. X is the starting x-position for S. 2923 predecessors, or successors. X is the starting x-position for S.
2924 BACKWARD_P non-zero means process predecessors. */ 2924 BACKWARD_P non-zero means process predecessors. */
2925 2925
2926static void 2926static void
2927x_compute_overhangs_and_x (s, x, backward_p) 2927x_compute_overhangs_and_x (s, x, backward_p)
2928 struct glyph_string *s; 2928 struct glyph_string *s;
@@ -2963,7 +2963,7 @@ x_get_glyph_overhangs (glyph, f, left, right)
2963 int *left, *right; 2963 int *left, *right;
2964{ 2964{
2965 *left = *right = 0; 2965 *left = *right = 0;
2966 2966
2967 if (glyph->type == CHAR_GLYPH) 2967 if (glyph->type == CHAR_GLYPH)
2968 { 2968 {
2969 XFontStruct *font; 2969 XFontStruct *font;
@@ -2996,7 +2996,7 @@ x_left_overwritten (s)
2996 struct glyph_string *s; 2996 struct glyph_string *s;
2997{ 2997{
2998 int k; 2998 int k;
2999 2999
3000 if (s->left_overhang) 3000 if (s->left_overhang)
3001 { 3001 {
3002 int x = 0, i; 3002 int x = 0, i;
@@ -3058,7 +3058,7 @@ x_right_overwritten (s)
3058 struct glyph *glyphs = s->row->glyphs[s->area]; 3058 struct glyph *glyphs = s->row->glyphs[s->area];
3059 int first = (s->first_glyph - glyphs) + (s->cmp ? 1 : s->nchars); 3059 int first = (s->first_glyph - glyphs) + (s->cmp ? 1 : s->nchars);
3060 int end = s->row->used[s->area]; 3060 int end = s->row->used[s->area];
3061 3061
3062 for (i = first; i < end && s->right_overhang > x; ++i) 3062 for (i = first; i < end && s->right_overhang > x; ++i)
3063 x += glyphs[i].pixel_width; 3063 x += glyphs[i].pixel_width;
3064 3064
@@ -3283,9 +3283,9 @@ x_frame_of_widget (widget)
3283 struct x_display_info *dpyinfo; 3283 struct x_display_info *dpyinfo;
3284 Lisp_Object tail; 3284 Lisp_Object tail;
3285 struct frame *f; 3285 struct frame *f;
3286 3286
3287 dpyinfo = x_display_info_for_display (XtDisplay (widget)); 3287 dpyinfo = x_display_info_for_display (XtDisplay (widget));
3288 3288
3289 /* Find the top-level shell of the widget. Note that this function 3289 /* Find the top-level shell of the widget. Note that this function
3290 can be called when the widget is not yet realized, so XtWindow 3290 can be called when the widget is not yet realized, so XtWindow
3291 (widget) == 0. That's the reason we can't simply use 3291 (widget) == 0. That's the reason we can't simply use
@@ -3426,7 +3426,7 @@ cvt_string_to_pixel (dpy, args, nargs, from, to, closure_ret)
3426 { 3426 {
3427 String params[1]; 3427 String params[1];
3428 Cardinal nparams = 1; 3428 Cardinal nparams = 1;
3429 3429
3430 params[0] = color_name; 3430 params[0] = color_name;
3431 XtAppWarningMsg (XtDisplayToApplicationContext (dpy), 3431 XtAppWarningMsg (XtDisplayToApplicationContext (dpy),
3432 "badValue", "cvt_string_to_pixel", 3432 "badValue", "cvt_string_to_pixel",
@@ -3442,7 +3442,7 @@ cvt_string_to_pixel (dpy, args, nargs, from, to, closure_ret)
3442 to->size = sizeof (Pixel); 3442 to->size = sizeof (Pixel);
3443 return False; 3443 return False;
3444 } 3444 }
3445 3445
3446 *(Pixel *) to->addr = pixel; 3446 *(Pixel *) to->addr = pixel;
3447 } 3447 }
3448 else 3448 else
@@ -3450,7 +3450,7 @@ cvt_string_to_pixel (dpy, args, nargs, from, to, closure_ret)
3450 cvt_string_to_pixel_value = pixel; 3450 cvt_string_to_pixel_value = pixel;
3451 to->addr = (XtPointer) &cvt_string_to_pixel_value; 3451 to->addr = (XtPointer) &cvt_string_to_pixel_value;
3452 } 3452 }
3453 3453
3454 to->size = sizeof (Pixel); 3454 to->size = sizeof (Pixel);
3455 return True; 3455 return True;
3456} 3456}
@@ -3513,16 +3513,16 @@ x_color_cells (dpy, ncells)
3513 { 3513 {
3514 Screen *screen = dpyinfo->screen; 3514 Screen *screen = dpyinfo->screen;
3515 int i; 3515 int i;
3516 3516
3517 dpyinfo->ncolor_cells 3517 dpyinfo->ncolor_cells
3518 = XDisplayCells (dpy, XScreenNumberOfScreen (screen)); 3518 = XDisplayCells (dpy, XScreenNumberOfScreen (screen));
3519 dpyinfo->color_cells 3519 dpyinfo->color_cells
3520 = (XColor *) xmalloc (dpyinfo->ncolor_cells 3520 = (XColor *) xmalloc (dpyinfo->ncolor_cells
3521 * sizeof *dpyinfo->color_cells); 3521 * sizeof *dpyinfo->color_cells);
3522 3522
3523 for (i = 0; i < dpyinfo->ncolor_cells; ++i) 3523 for (i = 0; i < dpyinfo->ncolor_cells; ++i)
3524 dpyinfo->color_cells[i].pixel = i; 3524 dpyinfo->color_cells[i].pixel = i;
3525 3525
3526 XQueryColors (dpy, dpyinfo->cmap, 3526 XQueryColors (dpy, dpyinfo->cmap,
3527 dpyinfo->color_cells, dpyinfo->ncolor_cells); 3527 dpyinfo->color_cells, dpyinfo->ncolor_cells);
3528 } 3528 }
@@ -3569,7 +3569,7 @@ x_query_color (f, color)
3569{ 3569{
3570 x_query_colors (f, color, 1); 3570 x_query_colors (f, color, 1);
3571} 3571}
3572 3572
3573 3573
3574/* Allocate the color COLOR->pixel on DISPLAY, colormap CMAP. If an 3574/* Allocate the color COLOR->pixel on DISPLAY, colormap CMAP. If an
3575 exact match can't be allocated, try the nearest color available. 3575 exact match can't be allocated, try the nearest color available.
@@ -3609,7 +3609,7 @@ x_alloc_nearest_color_1 (dpy, cmap, color)
3609 nearest_delta = delta; 3609 nearest_delta = delta;
3610 } 3610 }
3611 } 3611 }
3612 3612
3613 color->red = cells[nearest].red; 3613 color->red = cells[nearest].red;
3614 color->green = cells[nearest].green; 3614 color->green = cells[nearest].green;
3615 color->blue = cells[nearest].blue; 3615 color->blue = cells[nearest].blue;
@@ -3622,7 +3622,7 @@ x_alloc_nearest_color_1 (dpy, cmap, color)
3622 change in the colormap, so clear the color cache. */ 3622 change in the colormap, so clear the color cache. */
3623 struct x_display_info *dpyinfo = x_display_info_for_display (dpy); 3623 struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
3624 XColor *cached_color; 3624 XColor *cached_color;
3625 3625
3626 if (dpyinfo->color_cells 3626 if (dpyinfo->color_cells
3627 && (cached_color = &dpyinfo->color_cells[color->pixel], 3627 && (cached_color = &dpyinfo->color_cells[color->pixel],
3628 (cached_color->red != color->red 3628 (cached_color->red != color->red
@@ -3639,7 +3639,7 @@ x_alloc_nearest_color_1 (dpy, cmap, color)
3639 if (rc) 3639 if (rc)
3640 register_color (color->pixel); 3640 register_color (color->pixel);
3641#endif /* DEBUG_X_COLORS */ 3641#endif /* DEBUG_X_COLORS */
3642 3642
3643 return rc; 3643 return rc;
3644} 3644}
3645 3645
@@ -3788,7 +3788,7 @@ x_alloc_lighter_color (f, display, cmap, pixel, factor, delta)
3788 /* If we end up with the same color as before, try adding 3788 /* If we end up with the same color as before, try adding
3789 delta to the RGB values. */ 3789 delta to the RGB values. */
3790 x_free_colors (f, &new.pixel, 1); 3790 x_free_colors (f, &new.pixel, 1);
3791 3791
3792 new.red = min (0xffff, delta + color.red); 3792 new.red = min (0xffff, delta + color.red);
3793 new.green = min (0xffff, delta + color.green); 3793 new.green = min (0xffff, delta + color.green);
3794 new.blue = min (0xffff, delta + color.blue); 3794 new.blue = min (0xffff, delta + color.blue);
@@ -3798,7 +3798,7 @@ x_alloc_lighter_color (f, display, cmap, pixel, factor, delta)
3798 success_p = 1; 3798 success_p = 1;
3799 *pixel = new.pixel; 3799 *pixel = new.pixel;
3800 } 3800 }
3801 3801
3802 return success_p; 3802 return success_p;
3803} 3803}
3804 3804
@@ -3809,7 +3809,7 @@ x_alloc_lighter_color (f, display, cmap, pixel, factor, delta)
3809 DELTA lighter or darker than the relief's background which is found 3809 DELTA lighter or darker than the relief's background which is found
3810 in S->f->output_data.x->relief_background. If such a color cannot 3810 in S->f->output_data.x->relief_background. If such a color cannot
3811 be allocated, use DEFAULT_PIXEL, instead. */ 3811 be allocated, use DEFAULT_PIXEL, instead. */
3812 3812
3813static void 3813static void
3814x_setup_relief_color (f, relief, factor, delta, default_pixel) 3814x_setup_relief_color (f, relief, factor, delta, default_pixel)
3815 struct frame *f; 3815 struct frame *f;
@@ -3849,7 +3849,7 @@ x_setup_relief_color (f, relief, factor, delta, default_pixel)
3849 relief->allocated_p = 1; 3849 relief->allocated_p = 1;
3850 xgcv.foreground = relief->pixel = pixel; 3850 xgcv.foreground = relief->pixel = pixel;
3851 } 3851 }
3852 3852
3853 if (relief->gc == 0) 3853 if (relief->gc == 0)
3854 { 3854 {
3855 xgcv.stipple = dpyinfo->gray; 3855 xgcv.stipple = dpyinfo->gray;
@@ -3879,7 +3879,7 @@ x_setup_relief_colors (s)
3879 else 3879 else
3880 { 3880 {
3881 XGCValues xgcv; 3881 XGCValues xgcv;
3882 3882
3883 /* Get the background color of the face. */ 3883 /* Get the background color of the face. */
3884 XGetGCValues (s->display, s->gc, GCBackground, &xgcv); 3884 XGetGCValues (s->display, s->gc, GCBackground, &xgcv);
3885 color = xgcv.background; 3885 color = xgcv.background;
@@ -3916,7 +3916,7 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
3916 Window window = FRAME_X_WINDOW (f); 3916 Window window = FRAME_X_WINDOW (f);
3917 int i; 3917 int i;
3918 GC gc; 3918 GC gc;
3919 3919
3920 if (raised_p) 3920 if (raised_p)
3921 gc = f->output_data.x->white_relief.gc; 3921 gc = f->output_data.x->white_relief.gc;
3922 else 3922 else
@@ -3941,13 +3941,13 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
3941 else 3941 else
3942 gc = f->output_data.x->white_relief.gc; 3942 gc = f->output_data.x->white_relief.gc;
3943 XSetClipRectangles (dpy, gc, 0, 0, clip_rect, 1, Unsorted); 3943 XSetClipRectangles (dpy, gc, 0, 0, clip_rect, 1, Unsorted);
3944 3944
3945 /* Bottom. */ 3945 /* Bottom. */
3946 for (i = 0; i < width; ++i) 3946 for (i = 0; i < width; ++i)
3947 XDrawLine (dpy, window, gc, 3947 XDrawLine (dpy, window, gc,
3948 left_x + i * left_p, bottom_y - i, 3948 left_x + i * left_p, bottom_y - i,
3949 right_x + 1 - i * right_p, bottom_y - i); 3949 right_x + 1 - i * right_p, bottom_y - i);
3950 3950
3951 /* Right. */ 3951 /* Right. */
3952 if (right_p) 3952 if (right_p)
3953 for (i = 0; i < width; ++i) 3953 for (i = 0; i < width; ++i)
@@ -3973,11 +3973,11 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width,
3973 XRectangle *clip_rect; 3973 XRectangle *clip_rect;
3974{ 3974{
3975 XGCValues xgcv; 3975 XGCValues xgcv;
3976 3976
3977 XGetGCValues (s->display, s->gc, GCForeground, &xgcv); 3977 XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
3978 XSetForeground (s->display, s->gc, s->face->box_color); 3978 XSetForeground (s->display, s->gc, s->face->box_color);
3979 XSetClipRectangles (s->display, s->gc, 0, 0, clip_rect, 1, Unsorted); 3979 XSetClipRectangles (s->display, s->gc, 0, 0, clip_rect, 1, Unsorted);
3980 3980
3981 /* Top. */ 3981 /* Top. */
3982 XFillRectangle (s->display, s->window, s->gc, 3982 XFillRectangle (s->display, s->window, s->gc,
3983 left_x, top_y, right_x - left_x + 1, width); 3983 left_x, top_y, right_x - left_x + 1, width);
@@ -3990,7 +3990,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width,
3990 /* Bottom. */ 3990 /* Bottom. */
3991 XFillRectangle (s->display, s->window, s->gc, 3991 XFillRectangle (s->display, s->window, s->gc,
3992 left_x, bottom_y - width + 1, right_x - left_x + 1, width); 3992 left_x, bottom_y - width + 1, right_x - left_x + 1, width);
3993 3993
3994 /* Right. */ 3994 /* Right. */
3995 if (right_p) 3995 if (right_p)
3996 XFillRectangle (s->display, s->window, s->gc, 3996 XFillRectangle (s->display, s->window, s->gc,
@@ -4020,7 +4020,7 @@ x_draw_glyph_string_box (s)
4020 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f)) 4020 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f))
4021 last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f); 4021 last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f);
4022 } 4022 }
4023 4023
4024 /* The glyph that may have a right box line. */ 4024 /* The glyph that may have a right box line. */
4025 last_glyph = (s->cmp || s->img 4025 last_glyph = (s->cmp || s->img
4026 ? s->first_glyph 4026 ? s->first_glyph
@@ -4099,7 +4099,7 @@ x_draw_image_foreground (s)
4099 xgcv.clip_y_origin = y; 4099 xgcv.clip_y_origin = y;
4100 xgcv.function = GXcopy; 4100 xgcv.function = GXcopy;
4101 XChangeGC (s->display, s->gc, mask, &xgcv); 4101 XChangeGC (s->display, s->gc, mask, &xgcv);
4102 4102
4103 x_get_glyph_string_clip_rect (s, &clip_rect); 4103 x_get_glyph_string_clip_rect (s, &clip_rect);
4104 image_rect.x = x; 4104 image_rect.x = x;
4105 image_rect.y = y; 4105 image_rect.y = y;
@@ -4121,7 +4121,7 @@ x_draw_image_foreground (s)
4121 if (x_intersect_rectangles (&clip_rect, &image_rect, &r)) 4121 if (x_intersect_rectangles (&clip_rect, &image_rect, &r))
4122 XCopyArea (s->display, s->img->pixmap, s->window, s->gc, 4122 XCopyArea (s->display, s->img->pixmap, s->window, s->gc,
4123 r.x - x, r.y - y, r.width, r.height, r.x, r.y); 4123 r.x - x, r.y - y, r.width, r.height, r.x, r.y);
4124 4124
4125 /* When the image has a mask, we can expect that at 4125 /* When the image has a mask, we can expect that at
4126 least part of a mouse highlight or a block cursor will 4126 least part of a mouse highlight or a block cursor will
4127 be visible. If the image doesn't have a mask, make 4127 be visible. If the image doesn't have a mask, make
@@ -4154,7 +4154,7 @@ x_draw_image_relief (s)
4154 XRectangle r; 4154 XRectangle r;
4155 int x; 4155 int x;
4156 int y = s->ybase - image_ascent (s->img, s->face); 4156 int y = s->ybase - image_ascent (s->img, s->face);
4157 4157
4158 /* If first glyph of S has a left box line, start drawing it to the 4158 /* If first glyph of S has a left box line, start drawing it to the
4159 right of that line. */ 4159 right of that line. */
4160 if (s->face->box != FACE_NO_BOX 4160 if (s->face->box != FACE_NO_BOX
@@ -4162,12 +4162,12 @@ x_draw_image_relief (s)
4162 x = s->x + abs (s->face->box_line_width); 4162 x = s->x + abs (s->face->box_line_width);
4163 else 4163 else
4164 x = s->x; 4164 x = s->x;
4165 4165
4166 /* If there is a margin around the image, adjust x- and y-position 4166 /* If there is a margin around the image, adjust x- and y-position
4167 by that margin. */ 4167 by that margin. */
4168 x += s->img->hmargin; 4168 x += s->img->hmargin;
4169 y += s->img->vmargin; 4169 y += s->img->vmargin;
4170 4170
4171 if (s->hl == DRAW_IMAGE_SUNKEN 4171 if (s->hl == DRAW_IMAGE_SUNKEN
4172 || s->hl == DRAW_IMAGE_RAISED) 4172 || s->hl == DRAW_IMAGE_RAISED)
4173 { 4173 {
@@ -4179,12 +4179,12 @@ x_draw_image_relief (s)
4179 thick = abs (s->img->relief); 4179 thick = abs (s->img->relief);
4180 raised_p = s->img->relief > 0; 4180 raised_p = s->img->relief > 0;
4181 } 4181 }
4182 4182
4183 x0 = x - thick; 4183 x0 = x - thick;
4184 y0 = y - thick; 4184 y0 = y - thick;
4185 x1 = x + s->img->width + thick - 1; 4185 x1 = x + s->img->width + thick - 1;
4186 y1 = y + s->img->height + thick - 1; 4186 y1 = y + s->img->height + thick - 1;
4187 4187
4188 x_setup_relief_colors (s); 4188 x_setup_relief_colors (s);
4189 x_get_glyph_string_clip_rect (s, &r); 4189 x_get_glyph_string_clip_rect (s, &r);
4190 x_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, 1, 1, &r); 4190 x_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, 1, 1, &r);
@@ -4241,7 +4241,7 @@ x_draw_image_foreground_1 (s, pixmap)
4241 { 4241 {
4242 XCopyArea (s->display, s->img->pixmap, pixmap, s->gc, 4242 XCopyArea (s->display, s->img->pixmap, pixmap, s->gc,
4243 0, 0, s->img->width, s->img->height, x, y); 4243 0, 0, s->img->width, s->img->height, x, y);
4244 4244
4245 /* When the image has a mask, we can expect that at 4245 /* When the image has a mask, we can expect that at
4246 least part of a mouse highlight or a block cursor will 4246 least part of a mouse highlight or a block cursor will
4247 be visible. If the image doesn't have a mask, make 4247 be visible. If the image doesn't have a mask, make
@@ -4284,7 +4284,7 @@ x_draw_glyph_string_bg_rect (s, x, y, w, h)
4284} 4284}
4285 4285
4286 4286
4287/* Draw image glyph string S. 4287/* Draw image glyph string S.
4288 4288
4289 s->y 4289 s->y
4290 s->x +------------------------- 4290 s->x +-------------------------
@@ -4325,9 +4325,9 @@ x_draw_image_glyph_string (s)
4325 x = s->x + box_line_hwidth; 4325 x = s->x + box_line_hwidth;
4326 else 4326 else
4327 x = s->x; 4327 x = s->x;
4328 4328
4329 y = s->y + box_line_vwidth; 4329 y = s->y + box_line_vwidth;
4330 4330
4331 if (s->img->mask) 4331 if (s->img->mask)
4332 { 4332 {
4333 /* Create a pixmap as large as the glyph string. Fill it 4333 /* Create a pixmap as large as the glyph string. Fill it
@@ -4340,7 +4340,7 @@ x_draw_image_glyph_string (s)
4340 pixmap = XCreatePixmap (s->display, s->window, 4340 pixmap = XCreatePixmap (s->display, s->window,
4341 s->background_width, 4341 s->background_width,
4342 s->height, depth); 4342 s->height, depth);
4343 4343
4344 /* Don't clip in the following because we're working on the 4344 /* Don't clip in the following because we're working on the
4345 pixmap. */ 4345 pixmap. */
4346 XSetClipMask (s->display, s->gc, None); 4346 XSetClipMask (s->display, s->gc, None);
@@ -4367,7 +4367,7 @@ x_draw_image_glyph_string (s)
4367 } 4367 }
4368 else 4368 else
4369 x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height); 4369 x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height);
4370 4370
4371 s->background_filled_p = 1; 4371 s->background_filled_p = 1;
4372 } 4372 }
4373 4373
@@ -4426,10 +4426,10 @@ x_draw_stretch_glyph_string (s)
4426 } 4426 }
4427 else 4427 else
4428 gc = s->face->gc; 4428 gc = s->face->gc;
4429 4429
4430 x_get_glyph_string_clip_rect (s, &r); 4430 x_get_glyph_string_clip_rect (s, &r);
4431 XSetClipRectangles (s->display, gc, 0, 0, &r, 1, Unsorted); 4431 XSetClipRectangles (s->display, gc, 0, 0, &r, 1, Unsorted);
4432 4432
4433 if (s->face->stipple) 4433 if (s->face->stipple)
4434 { 4434 {
4435 /* Fill background with a stipple pattern. */ 4435 /* Fill background with a stipple pattern. */
@@ -4450,7 +4450,7 @@ x_draw_stretch_glyph_string (s)
4450 else if (!s->background_filled_p) 4450 else if (!s->background_filled_p)
4451 x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, 4451 x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width,
4452 s->height); 4452 s->height);
4453 4453
4454 s->background_filled_p = 1; 4454 s->background_filled_p = 1;
4455} 4455}
4456 4456
@@ -4543,7 +4543,7 @@ x_draw_glyph_string (s)
4543 4543
4544 ROUND ((maximum descent) / 2), with 4544 ROUND ((maximum descent) / 2), with
4545 ROUND(x) = floor (x + 0.5) */ 4545 ROUND(x) = floor (x + 0.5) */
4546 4546
4547 if (x_use_underline_position_properties 4547 if (x_use_underline_position_properties
4548 && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem)) 4548 && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem))
4549 y = s->ybase + (long) tem; 4549 y = s->ybase + (long) tem;
@@ -4551,7 +4551,7 @@ x_draw_glyph_string (s)
4551 y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2; 4551 y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2;
4552 else 4552 else
4553 y = s->y + s->height - h; 4553 y = s->y + s->height - h;
4554 4554
4555 if (s->face->underline_defaulted_p) 4555 if (s->face->underline_defaulted_p)
4556 XFillRectangle (s->display, s->window, s->gc, 4556 XFillRectangle (s->display, s->window, s->gc,
4557 s->x, y, s->width, h); 4557 s->x, y, s->width, h);
@@ -4584,7 +4584,7 @@ x_draw_glyph_string (s)
4584 XSetForeground (s->display, s->gc, xgcv.foreground); 4584 XSetForeground (s->display, s->gc, xgcv.foreground);
4585 } 4585 }
4586 } 4586 }
4587 4587
4588 /* Draw strike-through. */ 4588 /* Draw strike-through. */
4589 if (s->face->strike_through_p) 4589 if (s->face->strike_through_p)
4590 { 4590 {
@@ -4604,12 +4604,12 @@ x_draw_glyph_string (s)
4604 XSetForeground (s->display, s->gc, xgcv.foreground); 4604 XSetForeground (s->display, s->gc, xgcv.foreground);
4605 } 4605 }
4606 } 4606 }
4607 4607
4608 /* Draw relief if not yet drawn. */ 4608 /* Draw relief if not yet drawn. */
4609 if (!relief_drawn_p && s->face->box != FACE_NO_BOX) 4609 if (!relief_drawn_p && s->face->box != FACE_NO_BOX)
4610 x_draw_glyph_string_box (s); 4610 x_draw_glyph_string_box (s);
4611 } 4611 }
4612 4612
4613 /* Reset clipping. */ 4613 /* Reset clipping. */
4614 XSetClipMask (s->display, s->gc, None); 4614 XSetClipMask (s->display, s->gc, None);
4615} 4615}
@@ -4620,7 +4620,7 @@ static int x_fill_composite_glyph_string P_ ((struct glyph_string *,
4620 4620
4621 4621
4622/* Fill glyph string S with composition components specified by S->cmp. 4622/* Fill glyph string S with composition components specified by S->cmp.
4623 4623
4624 FACES is an array of faces for all components of this composition. 4624 FACES is an array of faces for all components of this composition.
4625 S->gidx is the index of the first component for S. 4625 S->gidx is the index of the first component for S.
4626 OVERLAPS_P non-zero means S should draw the foreground only, and 4626 OVERLAPS_P non-zero means S should draw the foreground only, and
@@ -4639,7 +4639,7 @@ x_fill_composite_glyph_string (s, faces, overlaps_p)
4639 xassert (s); 4639 xassert (s);
4640 4640
4641 s->for_overlaps_p = overlaps_p; 4641 s->for_overlaps_p = overlaps_p;
4642 4642
4643 s->face = faces[s->gidx]; 4643 s->face = faces[s->gidx];
4644 s->font = s->face->font; 4644 s->font = s->face->font;
4645 s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id); 4645 s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id);
@@ -4668,7 +4668,7 @@ x_fill_composite_glyph_string (s, faces, overlaps_p)
4668 4668
4669 /* Adjust base line for subscript/superscript text. */ 4669 /* Adjust base line for subscript/superscript text. */
4670 s->ybase += s->first_glyph->voffset; 4670 s->ybase += s->first_glyph->voffset;
4671 4671
4672 xassert (s->face && s->face->gc); 4672 xassert (s->face && s->face->gc);
4673 4673
4674 /* This glyph string must always be drawn with 16-bit functions. */ 4674 /* This glyph string must always be drawn with 16-bit functions. */
@@ -4679,7 +4679,7 @@ x_fill_composite_glyph_string (s, faces, overlaps_p)
4679 4679
4680 4680
4681/* Fill glyph string S from a sequence of character glyphs. 4681/* Fill glyph string S from a sequence of character glyphs.
4682 4682
4683 FACE_ID is the face id of the string. START is the index of the 4683 FACE_ID is the face id of the string. START is the index of the
4684 first glyph to consider, END is the index of the last + 1. 4684 first glyph to consider, END is the index of the last + 1.
4685 OVERLAPS_P non-zero means S should draw the foreground only, and 4685 OVERLAPS_P non-zero means S should draw the foreground only, and
@@ -4696,7 +4696,7 @@ x_fill_glyph_string (s, face_id, start, end, overlaps_p)
4696 struct glyph *glyph, *last; 4696 struct glyph *glyph, *last;
4697 int voffset; 4697 int voffset;
4698 int glyph_not_available_p; 4698 int glyph_not_available_p;
4699 4699
4700 xassert (s->f == XFRAME (s->w->frame)); 4700 xassert (s->f == XFRAME (s->w->frame));
4701 xassert (s->nchars == 0); 4701 xassert (s->nchars == 0);
4702 xassert (start >= 0 && end > start); 4702 xassert (start >= 0 && end > start);
@@ -4705,7 +4705,7 @@ x_fill_glyph_string (s, face_id, start, end, overlaps_p)
4705 glyph = s->row->glyphs[s->area] + start; 4705 glyph = s->row->glyphs[s->area] + start;
4706 last = s->row->glyphs[s->area] + end; 4706 last = s->row->glyphs[s->area] + end;
4707 voffset = glyph->voffset; 4707 voffset = glyph->voffset;
4708 4708
4709 glyph_not_available_p = glyph->glyph_not_available_p; 4709 glyph_not_available_p = glyph->glyph_not_available_p;
4710 4710
4711 while (glyph < last 4711 while (glyph < last
@@ -4729,7 +4729,7 @@ x_fill_glyph_string (s, face_id, start, end, overlaps_p)
4729 4729
4730 s->font = s->face->font; 4730 s->font = s->face->font;
4731 s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id); 4731 s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id);
4732 4732
4733 /* If the specified font could not be loaded, use the frame's font, 4733 /* If the specified font could not be loaded, use the frame's font,
4734 but record the fact that we couldn't load it in 4734 but record the fact that we couldn't load it in
4735 S->font_not_found_p so that we can draw rectangles for the 4735 S->font_not_found_p so that we can draw rectangles for the
@@ -4760,7 +4760,7 @@ x_fill_image_glyph_string (s)
4760 s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id); 4760 s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
4761 s->font = s->face->font; 4761 s->font = s->face->font;
4762 s->width = s->first_glyph->pixel_width; 4762 s->width = s->first_glyph->pixel_width;
4763 4763
4764 /* Adjust base line for subscript/superscript text. */ 4764 /* Adjust base line for subscript/superscript text. */
4765 s->ybase += s->first_glyph->voffset; 4765 s->ybase += s->first_glyph->voffset;
4766} 4766}
@@ -4783,9 +4783,9 @@ x_fill_stretch_glyph_string (s, row, area, start, end)
4783{ 4783{
4784 struct glyph *glyph, *last; 4784 struct glyph *glyph, *last;
4785 int voffset, face_id; 4785 int voffset, face_id;
4786 4786
4787 xassert (s->first_glyph->type == STRETCH_GLYPH); 4787 xassert (s->first_glyph->type == STRETCH_GLYPH);
4788 4788
4789 glyph = s->row->glyphs[s->area] + start; 4789 glyph = s->row->glyphs[s->area] + start;
4790 last = s->row->glyphs[s->area] + end; 4790 last = s->row->glyphs[s->area] + end;
4791 face_id = glyph->face_id; 4791 face_id = glyph->face_id;
@@ -4802,7 +4802,7 @@ x_fill_stretch_glyph_string (s, row, area, start, end)
4802 && glyph->face_id == face_id); 4802 && glyph->face_id == face_id);
4803 ++glyph) 4803 ++glyph)
4804 s->width += glyph->pixel_width; 4804 s->width += glyph->pixel_width;
4805 4805
4806 /* Adjust base line for subscript/superscript text. */ 4806 /* Adjust base line for subscript/superscript text. */
4807 s->ybase += voffset; 4807 s->ybase += voffset;
4808 4808
@@ -4820,7 +4820,7 @@ x_fill_stretch_glyph_string (s, row, area, start, end)
4820 and area within the row from which S is constructed. START is the 4820 and area within the row from which S is constructed. START is the
4821 index of the first glyph structure covered by S. HL is a 4821 index of the first glyph structure covered by S. HL is a
4822 face-override for drawing S. */ 4822 face-override for drawing S. */
4823 4823
4824static void 4824static void
4825x_init_glyph_string (s, char2b, w, row, area, start, hl) 4825x_init_glyph_string (s, char2b, w, row, area, start, hl)
4826 struct glyph_string *s; 4826 struct glyph_string *s;
@@ -4847,7 +4847,7 @@ x_init_glyph_string (s, char2b, w, row, area, start, hl)
4847 /* Display the internal border below the tool-bar window. */ 4847 /* Display the internal border below the tool-bar window. */
4848 if (s->w == XWINDOW (s->f->tool_bar_window)) 4848 if (s->w == XWINDOW (s->f->tool_bar_window))
4849 s->y -= s->f->output_data.x->internal_border_width; 4849 s->y -= s->f->output_data.x->internal_border_width;
4850 4850
4851 s->ybase = s->y + row->ascent; 4851 s->ybase = s->y + row->ascent;
4852} 4852}
4853 4853
@@ -4865,7 +4865,7 @@ x_set_glyph_string_background_width (s, start, last_x)
4865 /* If the face of this glyph string has to be drawn to the end of 4865 /* If the face of this glyph string has to be drawn to the end of
4866 the drawing area, set S->extends_to_end_of_line_p. */ 4866 the drawing area, set S->extends_to_end_of_line_p. */
4867 struct face *default_face = FACE_FROM_ID (s->f, DEFAULT_FACE_ID); 4867 struct face *default_face = FACE_FROM_ID (s->f, DEFAULT_FACE_ID);
4868 4868
4869 if (start == s->row->used[s->area] 4869 if (start == s->row->used[s->area]
4870 && s->area == TEXT_AREA 4870 && s->area == TEXT_AREA
4871 && ((s->hl == DRAW_NORMAL_TEXT 4871 && ((s->hl == DRAW_NORMAL_TEXT
@@ -4877,7 +4877,7 @@ x_set_glyph_string_background_width (s, start, last_x)
4877 || ((s->hl == DRAW_IMAGE_RAISED || s->hl == DRAW_IMAGE_SUNKEN) 4877 || ((s->hl == DRAW_IMAGE_RAISED || s->hl == DRAW_IMAGE_SUNKEN)
4878 && s->row->fill_line_p))) 4878 && s->row->fill_line_p)))
4879 s->extends_to_end_of_line_p = 1; 4879 s->extends_to_end_of_line_p = 1;
4880 4880
4881 /* If S extends its face to the end of the line, set its 4881 /* If S extends its face to the end of the line, set its
4882 background_width to the distance to the right edge of the drawing 4882 background_width to the distance to the right edge of the drawing
4883 area. */ 4883 area. */
@@ -4958,7 +4958,7 @@ x_set_glyph_string_background_width (s, start, last_x)
4958 OVERLAPS_P); \ 4958 OVERLAPS_P); \
4959 } \ 4959 } \
4960 while (0) 4960 while (0)
4961 4961
4962 4962
4963/* Add a glyph string for a composite sequence to the list of strings 4963/* Add a glyph string for a composite sequence to the list of strings
4964 between HEAD and TAIL. START is the index of the first glyph in 4964 between HEAD and TAIL. START is the index of the first glyph in
@@ -5014,7 +5014,7 @@ x_set_glyph_string_background_width (s, start, last_x)
5014 ++START; \ 5014 ++START; \
5015 s = first_s; \ 5015 s = first_s; \
5016 } while (0) 5016 } while (0)
5017 5017
5018 5018
5019/* Build a list of glyph strings between HEAD and TAIL for the glyphs 5019/* Build a list of glyph strings between HEAD and TAIL for the glyphs
5020 of AREA of glyph row ROW on window W between indices START and END. 5020 of AREA of glyph row ROW on window W between indices START and END.
@@ -5083,7 +5083,7 @@ x_set_glyph_string_background_width (s, start, last_x)
5083 and clip to the physical height of ROW. 5083 and clip to the physical height of ROW.
5084 5084
5085 Value is the x-position reached, relative to AREA of W. */ 5085 Value is the x-position reached, relative to AREA of W. */
5086 5086
5087static int 5087static int
5088x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) 5088x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
5089 struct window *w; 5089 struct window *w;
@@ -5164,7 +5164,7 @@ x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
5164 /* Prepend glyph strings for glyphs in front of the first glyph 5164 /* Prepend glyph strings for glyphs in front of the first glyph
5165 string that are overwritten because of the first glyph 5165 string that are overwritten because of the first glyph
5166 string's left overhang. The background of all strings 5166 string's left overhang. The background of all strings
5167 prepended must be drawn because the first glyph string 5167 prepended must be drawn because the first glyph string
5168 draws over it. */ 5168 draws over it. */
5169 i = x_left_overwritten (head); 5169 i = x_left_overwritten (head);
5170 if (i >= 0) 5170 if (i >= 0)
@@ -5242,10 +5242,10 @@ x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
5242 { 5242 {
5243 int x0 = head ? head->x : x; 5243 int x0 = head ? head->x : x;
5244 int x1 = tail ? tail->x + tail->background_width : x; 5244 int x1 = tail ? tail->x + tail->background_width : x;
5245 5245
5246 x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0); 5246 x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0);
5247 x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1); 5247 x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1);
5248 5248
5249 if (XFASTINT (w->left_margin_width) != 0) 5249 if (XFASTINT (w->left_margin_width) != 0)
5250 { 5250 {
5251 int left_area_width = window_box_width (w, LEFT_MARGIN_AREA); 5251 int left_area_width = window_box_width (w, LEFT_MARGIN_AREA);
@@ -5267,7 +5267,7 @@ x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
5267 if (area > TEXT_AREA) 5267 if (area > TEXT_AREA)
5268 x_reached -= window_box_width (w, TEXT_AREA); 5268 x_reached -= window_box_width (w, TEXT_AREA);
5269 } 5269 }
5270 5270
5271 return x_reached; 5271 return x_reached;
5272} 5272}
5273 5273
@@ -5281,9 +5281,9 @@ x_fix_overlapping_area (w, row, area)
5281 enum glyph_row_area area; 5281 enum glyph_row_area area;
5282{ 5282{
5283 int i, x; 5283 int i, x;
5284 5284
5285 BLOCK_INPUT; 5285 BLOCK_INPUT;
5286 5286
5287 if (area == LEFT_MARGIN_AREA) 5287 if (area == LEFT_MARGIN_AREA)
5288 x = 0; 5288 x = 0;
5289 else if (area == TEXT_AREA) 5289 else if (area == TEXT_AREA)
@@ -5315,7 +5315,7 @@ x_fix_overlapping_area (w, row, area)
5315 ++i; 5315 ++i;
5316 } 5316 }
5317 } 5317 }
5318 5318
5319 UNBLOCK_INPUT; 5319 UNBLOCK_INPUT;
5320} 5320}
5321 5321
@@ -5335,7 +5335,7 @@ x_write_glyphs (start, len)
5335 5335
5336 xassert (updated_window && updated_row); 5336 xassert (updated_window && updated_row);
5337 BLOCK_INPUT; 5337 BLOCK_INPUT;
5338 5338
5339 /* Write glyphs. */ 5339 /* Write glyphs. */
5340 5340
5341 hpos = start - updated_row->glyphs[updated_area]; 5341 hpos = start - updated_row->glyphs[updated_area];
@@ -5353,7 +5353,7 @@ x_write_glyphs (start, len)
5353 updated_window->phys_cursor_on_p = 0; 5353 updated_window->phys_cursor_on_p = 0;
5354 5354
5355 UNBLOCK_INPUT; 5355 UNBLOCK_INPUT;
5356 5356
5357 /* Advance the output cursor. */ 5357 /* Advance the output cursor. */
5358 output_cursor.hpos += len; 5358 output_cursor.hpos += len;
5359 output_cursor.x = x; 5359 output_cursor.x = x;
@@ -5406,7 +5406,7 @@ x_insert_glyphs (start, len)
5406 hpos = start - row->glyphs[updated_area]; 5406 hpos = start - row->glyphs[updated_area];
5407 x_draw_glyphs (w, output_cursor.x, row, updated_area, hpos, hpos + len, 5407 x_draw_glyphs (w, output_cursor.x, row, updated_area, hpos, hpos + len,
5408 DRAW_NORMAL_TEXT, 0); 5408 DRAW_NORMAL_TEXT, 0);
5409 5409
5410 /* Advance the output cursor. */ 5410 /* Advance the output cursor. */
5411 output_cursor.hpos += len; 5411 output_cursor.hpos += len;
5412 output_cursor.x += shift_by_width; 5412 output_cursor.x += shift_by_width;
@@ -5456,10 +5456,10 @@ x_clear_end_of_line (to_x)
5456 struct window *w = updated_window; 5456 struct window *w = updated_window;
5457 int max_x, min_y, max_y; 5457 int max_x, min_y, max_y;
5458 int from_x, from_y, to_y; 5458 int from_x, from_y, to_y;
5459 5459
5460 xassert (updated_window && updated_row); 5460 xassert (updated_window && updated_row);
5461 f = XFRAME (w->frame); 5461 f = XFRAME (w->frame);
5462 5462
5463 if (updated_row->full_width_p) 5463 if (updated_row->full_width_p)
5464 { 5464 {
5465 max_x = XFASTINT (w->width) * CANON_X_UNIT (f); 5465 max_x = XFASTINT (w->width) * CANON_X_UNIT (f);
@@ -5481,7 +5481,7 @@ x_clear_end_of_line (to_x)
5481 to_x = min (to_x, max_x); 5481 to_x = min (to_x, max_x);
5482 5482
5483 to_y = min (max_y, output_cursor.y + updated_row->height); 5483 to_y = min (max_y, output_cursor.y + updated_row->height);
5484 5484
5485 /* Notice if the cursor will be cleared by this operation. */ 5485 /* Notice if the cursor will be cleared by this operation. */
5486 if (!updated_row->full_width_p) 5486 if (!updated_row->full_width_p)
5487 notice_overwritten_cursor (w, updated_area, 5487 notice_overwritten_cursor (w, updated_area,
@@ -5490,7 +5490,7 @@ x_clear_end_of_line (to_x)
5490 MATRIX_ROW_BOTTOM_Y (updated_row)); 5490 MATRIX_ROW_BOTTOM_Y (updated_row));
5491 5491
5492 from_x = output_cursor.x; 5492 from_x = output_cursor.x;
5493 5493
5494 /* Translate to frame coordinates. */ 5494 /* Translate to frame coordinates. */
5495 if (updated_row->full_width_p) 5495 if (updated_row->full_width_p)
5496 { 5496 {
@@ -5502,11 +5502,11 @@ x_clear_end_of_line (to_x)
5502 from_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, from_x); 5502 from_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, from_x);
5503 to_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, to_x); 5503 to_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, to_x);
5504 } 5504 }
5505 5505
5506 min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); 5506 min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
5507 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y)); 5507 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y));
5508 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y); 5508 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y);
5509 5509
5510 /* Prevent inadvertently clearing to end of the X window. */ 5510 /* Prevent inadvertently clearing to end of the X window. */
5511 if (to_x > from_x && to_y > from_y) 5511 if (to_x > from_x && to_y > from_y)
5512 { 5512 {
@@ -5576,7 +5576,7 @@ timeval_subtract (result, x, y)
5576 y.tv_usec -= 1000000 * nsec; 5576 y.tv_usec -= 1000000 * nsec;
5577 y.tv_sec += nsec; 5577 y.tv_sec += nsec;
5578 } 5578 }
5579 5579
5580 if (x.tv_usec - y.tv_usec > 1000000) 5580 if (x.tv_usec - y.tv_usec > 1000000)
5581 { 5581 {
5582 int nsec = (y.tv_usec - x.tv_usec) / 1000000; 5582 int nsec = (y.tv_usec - x.tv_usec) / 1000000;
@@ -5660,7 +5660,7 @@ XTflash (f)
5660 width, flash_height); 5660 width, flash_height);
5661 } 5661 }
5662 else 5662 else
5663 /* If it is short, flash it all. */ 5663 /* If it is short, flash it all. */
5664 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, 5664 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
5665 flash_left, FRAME_INTERNAL_BORDER_WIDTH (f), 5665 flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
5666 width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); 5666 width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
@@ -5714,7 +5714,7 @@ XTflash (f)
5714 width, flash_height); 5714 width, flash_height);
5715 } 5715 }
5716 else 5716 else
5717 /* If it is short, flash it all. */ 5717 /* If it is short, flash it all. */
5718 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, 5718 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
5719 flash_left, FRAME_INTERNAL_BORDER_WIDTH (f), 5719 flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
5720 width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); 5720 width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
@@ -5736,7 +5736,7 @@ void
5736XTring_bell () 5736XTring_bell ()
5737{ 5737{
5738 struct frame *f = SELECTED_FRAME (); 5738 struct frame *f = SELECTED_FRAME ();
5739 5739
5740 if (FRAME_X_DISPLAY (f)) 5740 if (FRAME_X_DISPLAY (f))
5741 { 5741 {
5742#if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT) 5742#if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT)
@@ -5824,7 +5824,7 @@ x_scroll_run (w, run)
5824 } 5824 }
5825 5825
5826 BLOCK_INPUT; 5826 BLOCK_INPUT;
5827 5827
5828 /* Cursor off. Will be switched on again in x_update_window_end. */ 5828 /* Cursor off. Will be switched on again in x_update_window_end. */
5829 updated_window = w; 5829 updated_window = w;
5830 x_clear_cursor (w); 5830 x_clear_cursor (w);
@@ -5835,7 +5835,7 @@ x_scroll_run (w, run)
5835 x, from_y, 5835 x, from_y,
5836 width, height, 5836 width, height,
5837 x, to_y); 5837 x, to_y);
5838 5838
5839 UNBLOCK_INPUT; 5839 UNBLOCK_INPUT;
5840} 5840}
5841 5841
@@ -5844,7 +5844,7 @@ x_scroll_run (w, run)
5844/*********************************************************************** 5844/***********************************************************************
5845 Exposure Events 5845 Exposure Events
5846 ***********************************************************************/ 5846 ***********************************************************************/
5847 5847
5848/* Redisplay an exposed area of frame F. X and Y are the upper-left 5848/* Redisplay an exposed area of frame F. X and Y are the upper-left
5849 corner of the exposed rectangle. W and H are width and height of 5849 corner of the exposed rectangle. W and H are width and height of
5850 the exposed area. All are pixel values. W or H zero means redraw 5850 the exposed area. All are pixel values. W or H zero means redraw
@@ -5939,7 +5939,7 @@ expose_window_tree (w, r)
5939{ 5939{
5940 struct frame *f = XFRAME (w->frame); 5940 struct frame *f = XFRAME (w->frame);
5941 int mouse_face_overwritten_p = 0; 5941 int mouse_face_overwritten_p = 0;
5942 5942
5943 while (w && !FRAME_GARBAGED_P (f)) 5943 while (w && !FRAME_GARBAGED_P (f))
5944 { 5944 {
5945 if (!NILP (w->hchild)) 5945 if (!NILP (w->hchild))
@@ -5950,7 +5950,7 @@ expose_window_tree (w, r)
5950 |= expose_window_tree (XWINDOW (w->vchild), r); 5950 |= expose_window_tree (XWINDOW (w->vchild), r);
5951 else 5951 else
5952 mouse_face_overwritten_p |= expose_window (w, r); 5952 mouse_face_overwritten_p |= expose_window (w, r);
5953 5953
5954 w = NILP (w->next) ? NULL : XWINDOW (w->next); 5954 w = NILP (w->next) ? NULL : XWINDOW (w->next);
5955 } 5955 }
5956 5956
@@ -5998,7 +5998,7 @@ expose_area (w, row, r, area)
5998 x += first->pixel_width; 5998 x += first->pixel_width;
5999 ++first; 5999 ++first;
6000 } 6000 }
6001 6001
6002 /* Find the last one. */ 6002 /* Find the last one. */
6003 last = first; 6003 last = first;
6004 first_x = x; 6004 first_x = x;
@@ -6008,7 +6008,7 @@ expose_area (w, row, r, area)
6008 x += last->pixel_width; 6008 x += last->pixel_width;
6009 ++last; 6009 ++last;
6010 } 6010 }
6011 6011
6012 /* Repaint. */ 6012 /* Repaint. */
6013 if (last > first) 6013 if (last > first)
6014 x_draw_glyphs (w, first_x - start_x, row, area, 6014 x_draw_glyphs (w, first_x - start_x, row, area,
@@ -6017,7 +6017,7 @@ expose_area (w, row, r, area)
6017 DRAW_NORMAL_TEXT, 0); 6017 DRAW_NORMAL_TEXT, 0);
6018 } 6018 }
6019} 6019}
6020 6020
6021 6021
6022/* Redraw the parts of the glyph row ROW on window W intersecting 6022/* Redraw the parts of the glyph row ROW on window W intersecting
6023 rectangle R. R is in window-relative coordinates. Value is 6023 rectangle R. R is in window-relative coordinates. Value is
@@ -6030,7 +6030,7 @@ expose_line (w, row, r)
6030 XRectangle *r; 6030 XRectangle *r;
6031{ 6031{
6032 xassert (row->enabled_p); 6032 xassert (row->enabled_p);
6033 6033
6034 if (row->mode_line_p || w->pseudo_window_p) 6034 if (row->mode_line_p || w->pseudo_window_p)
6035 x_draw_glyphs (w, 0, row, TEXT_AREA, 0, row->used[TEXT_AREA], 6035 x_draw_glyphs (w, 0, row, TEXT_AREA, 0, row->used[TEXT_AREA],
6036 DRAW_NORMAL_TEXT, 0); 6036 DRAW_NORMAL_TEXT, 0);
@@ -6088,18 +6088,18 @@ expose_overlaps (w, first_overlapping_row, last_overlapping_row)
6088 struct glyph_row *last_overlapping_row; 6088 struct glyph_row *last_overlapping_row;
6089{ 6089{
6090 struct glyph_row *row; 6090 struct glyph_row *row;
6091 6091
6092 for (row = first_overlapping_row; row <= last_overlapping_row; ++row) 6092 for (row = first_overlapping_row; row <= last_overlapping_row; ++row)
6093 if (row->overlapping_p) 6093 if (row->overlapping_p)
6094 { 6094 {
6095 xassert (row->enabled_p && !row->mode_line_p); 6095 xassert (row->enabled_p && !row->mode_line_p);
6096 6096
6097 if (row->used[LEFT_MARGIN_AREA]) 6097 if (row->used[LEFT_MARGIN_AREA])
6098 x_fix_overlapping_area (w, row, LEFT_MARGIN_AREA); 6098 x_fix_overlapping_area (w, row, LEFT_MARGIN_AREA);
6099 6099
6100 if (row->used[TEXT_AREA]) 6100 if (row->used[TEXT_AREA])
6101 x_fix_overlapping_area (w, row, TEXT_AREA); 6101 x_fix_overlapping_area (w, row, TEXT_AREA);
6102 6102
6103 if (row->used[RIGHT_MARGIN_AREA]) 6103 if (row->used[RIGHT_MARGIN_AREA])
6104 x_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA); 6104 x_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA);
6105 } 6105 }
@@ -6148,7 +6148,7 @@ expose_window (w, fr)
6148 struct glyph_row *row; 6148 struct glyph_row *row;
6149 int cursor_cleared_p; 6149 int cursor_cleared_p;
6150 struct glyph_row *first_overlapping_row, *last_overlapping_row; 6150 struct glyph_row *first_overlapping_row, *last_overlapping_row;
6151 6151
6152 TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n", 6152 TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n",
6153 r.x, r.y, r.width, r.height)); 6153 r.x, r.y, r.width, r.height));
6154 6154
@@ -6174,7 +6174,7 @@ expose_window (w, fr)
6174 { 6174 {
6175 int y0 = row->y; 6175 int y0 = row->y;
6176 int y1 = MATRIX_ROW_BOTTOM_Y (row); 6176 int y1 = MATRIX_ROW_BOTTOM_Y (row);
6177 6177
6178 if ((y0 >= r.y && y0 < r.y + r.height) 6178 if ((y0 >= r.y && y0 < r.y + r.height)
6179 || (y1 > r.y && y1 < r.y + r.height) 6179 || (y1 > r.y && y1 < r.y + r.height)
6180 || (r.y >= y0 && r.y < y1) 6180 || (r.y >= y0 && r.y < y1)
@@ -6186,11 +6186,11 @@ expose_window (w, fr)
6186 first_overlapping_row = row; 6186 first_overlapping_row = row;
6187 last_overlapping_row = row; 6187 last_overlapping_row = row;
6188 } 6188 }
6189 6189
6190 if (expose_line (w, row, &r)) 6190 if (expose_line (w, row, &r))
6191 mouse_face_overwritten_p = 1; 6191 mouse_face_overwritten_p = 1;
6192 } 6192 }
6193 6193
6194 if (y1 >= yb) 6194 if (y1 >= yb)
6195 break; 6195 break;
6196 } 6196 }
@@ -6210,10 +6210,10 @@ expose_window (w, fr)
6210 /* Fix the display of overlapping rows. */ 6210 /* Fix the display of overlapping rows. */
6211 if (first_overlapping_row) 6211 if (first_overlapping_row)
6212 expose_overlaps (w, first_overlapping_row, last_overlapping_row); 6212 expose_overlaps (w, first_overlapping_row, last_overlapping_row);
6213 6213
6214 /* Draw border between windows. */ 6214 /* Draw border between windows. */
6215 x_draw_vertical_border (w); 6215 x_draw_vertical_border (w);
6216 6216
6217 /* Turn the cursor on again. */ 6217 /* Turn the cursor on again. */
6218 if (cursor_cleared_p) 6218 if (cursor_cleared_p)
6219 x_update_window_cursor (w, 1); 6219 x_update_window_cursor (w, 1);
@@ -6235,7 +6235,7 @@ x_intersect_rectangles (r1, r2, result)
6235 XRectangle *left, *right; 6235 XRectangle *left, *right;
6236 XRectangle *upper, *lower; 6236 XRectangle *upper, *lower;
6237 int intersection_p = 0; 6237 int intersection_p = 0;
6238 6238
6239 /* Rearrange so that R1 is the left-most rectangle. */ 6239 /* Rearrange so that R1 is the left-most rectangle. */
6240 if (r1->x < r2->x) 6240 if (r1->x < r2->x)
6241 left = r1, right = r2; 6241 left = r1, right = r2;
@@ -6247,7 +6247,7 @@ x_intersect_rectangles (r1, r2, result)
6247 if (right->x <= left->x + left->width) 6247 if (right->x <= left->x + left->width)
6248 { 6248 {
6249 result->x = right->x; 6249 result->x = right->x;
6250 6250
6251 /* The right end of the intersection is the minimum of the 6251 /* The right end of the intersection is the minimum of the
6252 the right ends of left and right. */ 6252 the right ends of left and right. */
6253 result->width = (min (left->x + left->width, right->x + right->width) 6253 result->width = (min (left->x + left->width, right->x + right->width)
@@ -6264,10 +6264,10 @@ x_intersect_rectangles (r1, r2, result)
6264 if (lower->y <= upper->y + upper->height) 6264 if (lower->y <= upper->y + upper->height)
6265 { 6265 {
6266 result->y = lower->y; 6266 result->y = lower->y;
6267 6267
6268 /* The lower end of the intersection is the minimum of the lower 6268 /* The lower end of the intersection is the minimum of the lower
6269 ends of upper and lower. */ 6269 ends of upper and lower. */
6270 result->height = (min (lower->y + lower->height, 6270 result->height = (min (lower->y + lower->height,
6271 upper->y + upper->height) 6271 upper->y + upper->height)
6272 - result->y); 6272 - result->y);
6273 intersection_p = 1; 6273 intersection_p = 1;
@@ -6352,7 +6352,7 @@ x_new_focus_frame (dpyinfo, frame)
6352 6352
6353/* Handle FocusIn and FocusOut state changes for FRAME. 6353/* Handle FocusIn and FocusOut state changes for FRAME.
6354 If FRAME has focus and there exists more than one frame, puts 6354 If FRAME has focus and there exists more than one frame, puts
6355 an FOCUS_IN_EVENT into BUFP. 6355 a FOCUS_IN_EVENT into BUFP.
6356 Returns number of events inserted into BUFP. */ 6356 Returns number of events inserted into BUFP. */
6357 6357
6358static int 6358static int
@@ -6372,7 +6372,7 @@ x_focus_changed (type, state, dpyinfo, frame, bufp, numchars)
6372 { 6372 {
6373 x_new_focus_frame (dpyinfo, frame); 6373 x_new_focus_frame (dpyinfo, frame);
6374 dpyinfo->x_focus_event_frame = frame; 6374 dpyinfo->x_focus_event_frame = frame;
6375 6375
6376 /* Don't stop displaying the initial startup message 6376 /* Don't stop displaying the initial startup message
6377 for a switch-frame event we don't need. */ 6377 for a switch-frame event we don't need. */
6378 if (numchars > 0 6378 if (numchars > 0
@@ -6399,7 +6399,7 @@ x_focus_changed (type, state, dpyinfo, frame, bufp, numchars)
6399 else if (type == FocusOut) 6399 else if (type == FocusOut)
6400 { 6400 {
6401 frame->output_data.x->focus_state &= ~state; 6401 frame->output_data.x->focus_state &= ~state;
6402 6402
6403 if (dpyinfo->x_focus_event_frame == frame) 6403 if (dpyinfo->x_focus_event_frame == frame)
6404 { 6404 {
6405 dpyinfo->x_focus_event_frame = 0; 6405 dpyinfo->x_focus_event_frame = 0;
@@ -6429,10 +6429,10 @@ x_detect_focus_change (dpyinfo, event, bufp, numchars)
6429{ 6429{
6430 struct frame *frame; 6430 struct frame *frame;
6431 int nr_events = 0; 6431 int nr_events = 0;
6432 6432
6433 frame = x_top_window_to_frame (dpyinfo, event->xany.window); 6433 frame = x_top_window_to_frame (dpyinfo, event->xany.window);
6434 if (! frame) return nr_events; 6434 if (! frame) return nr_events;
6435 6435
6436 switch (event->type) 6436 switch (event->type)
6437 { 6437 {
6438 case EnterNotify: 6438 case EnterNotify:
@@ -6638,7 +6638,7 @@ x_x_to_emacs_modifiers (dpyinfo, state)
6638 EMACS_UINT mod_hyper = hyper_modifier; 6638 EMACS_UINT mod_hyper = hyper_modifier;
6639 EMACS_UINT mod_super = super_modifier; 6639 EMACS_UINT mod_super = super_modifier;
6640 Lisp_Object tem; 6640 Lisp_Object tem;
6641 6641
6642 tem = Fget (Vx_alt_keysym, Qmodifier_value); 6642 tem = Fget (Vx_alt_keysym, Qmodifier_value);
6643 if (! EQ (tem, Qnil)) mod_alt = XUINT (tem); 6643 if (! EQ (tem, Qnil)) mod_alt = XUINT (tem);
6644 tem = Fget (Vx_meta_keysym, Qmodifier_value); 6644 tem = Fget (Vx_meta_keysym, Qmodifier_value);
@@ -6647,7 +6647,7 @@ x_x_to_emacs_modifiers (dpyinfo, state)
6647 if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem); 6647 if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem);
6648 tem = Fget (Vx_super_keysym, Qmodifier_value); 6648 tem = Fget (Vx_super_keysym, Qmodifier_value);
6649 if (! EQ (tem, Qnil)) mod_super = XUINT (tem); 6649 if (! EQ (tem, Qnil)) mod_super = XUINT (tem);
6650 6650
6651 6651
6652 return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0) 6652 return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0)
6653 | ((state & ControlMask) ? ctrl_modifier : 0) 6653 | ((state & ControlMask) ? ctrl_modifier : 0)
@@ -6666,9 +6666,9 @@ x_emacs_to_x_modifiers (dpyinfo, state)
6666 EMACS_UINT mod_alt = alt_modifier; 6666 EMACS_UINT mod_alt = alt_modifier;
6667 EMACS_UINT mod_hyper = hyper_modifier; 6667 EMACS_UINT mod_hyper = hyper_modifier;
6668 EMACS_UINT mod_super = super_modifier; 6668 EMACS_UINT mod_super = super_modifier;
6669 6669
6670 Lisp_Object tem; 6670 Lisp_Object tem;
6671 6671
6672 tem = Fget (Vx_alt_keysym, Qmodifier_value); 6672 tem = Fget (Vx_alt_keysym, Qmodifier_value);
6673 if (! EQ (tem, Qnil)) mod_alt = XUINT (tem); 6673 if (! EQ (tem, Qnil)) mod_alt = XUINT (tem);
6674 tem = Fget (Vx_meta_keysym, Qmodifier_value); 6674 tem = Fget (Vx_meta_keysym, Qmodifier_value);
@@ -6677,8 +6677,8 @@ x_emacs_to_x_modifiers (dpyinfo, state)
6677 if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem); 6677 if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem);
6678 tem = Fget (Vx_super_keysym, Qmodifier_value); 6678 tem = Fget (Vx_super_keysym, Qmodifier_value);
6679 if (! EQ (tem, Qnil)) mod_super = XUINT (tem); 6679 if (! EQ (tem, Qnil)) mod_super = XUINT (tem);
6680 6680
6681 6681
6682 return ( ((state & mod_alt) ? dpyinfo->alt_mod_mask : 0) 6682 return ( ((state & mod_alt) ? dpyinfo->alt_mod_mask : 0)
6683 | ((state & mod_super) ? dpyinfo->super_mod_mask : 0) 6683 | ((state & mod_super) ? dpyinfo->super_mod_mask : 0)
6684 | ((state & mod_hyper) ? dpyinfo->hyper_mod_mask : 0) 6684 | ((state & mod_hyper) ? dpyinfo->hyper_mod_mask : 0)
@@ -6947,7 +6947,7 @@ x_y_to_hpos_vpos (w, x, y, hpos, vpos, area, buffer_only_p)
6947 else if (!buffer_only_p || BUFFERP (glyph->object)) 6947 else if (!buffer_only_p || BUFFERP (glyph->object))
6948 break; 6948 break;
6949 } 6949 }
6950 6950
6951 x0 += glyph->pixel_width; 6951 x0 += glyph->pixel_width;
6952 ++glyph; 6952 ++glyph;
6953 } 6953 }
@@ -6991,7 +6991,7 @@ frame_to_window_pixel_xy (w, x, y)
6991 display area of W, so the width of bitmap areas and scroll bars 6991 display area of W, so the width of bitmap areas and scroll bars
6992 must be subtracted to get a position relative to the start of the 6992 must be subtracted to get a position relative to the start of the
6993 mode line. */ 6993 mode line. */
6994 6994
6995static void 6995static void
6996note_mode_line_or_margin_highlight (w, x, y, portion) 6996note_mode_line_or_margin_highlight (w, x, y, portion)
6997 struct window *w; 6997 struct window *w;
@@ -7011,7 +7011,7 @@ note_mode_line_or_margin_highlight (w, x, y, portion)
7011 if (STRINGP (string)) 7011 if (STRINGP (string))
7012 { 7012 {
7013 pos = make_number (charpos); 7013 pos = make_number (charpos);
7014 7014
7015 /* If we're on a string with `help-echo' text property, arrange 7015 /* If we're on a string with `help-echo' text property, arrange
7016 for the help to be displayed. This is done by setting the 7016 for the help to be displayed. This is done by setting the
7017 global variable help_echo to the help string. */ 7017 global variable help_echo to the help string. */
@@ -7031,7 +7031,7 @@ note_mode_line_or_margin_highlight (w, x, y, portion)
7031 if (KEYMAPP (map)) 7031 if (KEYMAPP (map))
7032 cursor = f->output_data.x->nontext_cursor; 7032 cursor = f->output_data.x->nontext_cursor;
7033 } 7033 }
7034 7034
7035 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor); 7035 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor);
7036} 7036}
7037 7037
@@ -7105,7 +7105,7 @@ note_mouse_highlight (f, x, y)
7105 note_mode_line_or_margin_highlight (w, x, y, portion); 7105 note_mode_line_or_margin_highlight (w, x, y, portion);
7106 return; 7106 return;
7107 } 7107 }
7108 7108
7109 if (portion == 2) 7109 if (portion == 2)
7110 cursor = f->output_data.x->horizontal_drag_cursor; 7110 cursor = f->output_data.x->horizontal_drag_cursor;
7111 else 7111 else
@@ -7214,13 +7214,13 @@ note_mouse_highlight (f, x, y)
7214 if (!NILP (mouse_face)) 7214 if (!NILP (mouse_face))
7215 overlay = overlay_vec[i]; 7215 overlay = overlay_vec[i];
7216 } 7216 }
7217 7217
7218 /* If we're actually highlighting the same overlay as 7218 /* If we're actually highlighting the same overlay as
7219 before, there's no need to do that again. */ 7219 before, there's no need to do that again. */
7220 if (!NILP (overlay) 7220 if (!NILP (overlay)
7221 && EQ (overlay, dpyinfo->mouse_face_overlay)) 7221 && EQ (overlay, dpyinfo->mouse_face_overlay))
7222 goto check_help_echo; 7222 goto check_help_echo;
7223 7223
7224 dpyinfo->mouse_face_overlay = overlay; 7224 dpyinfo->mouse_face_overlay = overlay;
7225 7225
7226 /* Clear the display of the old active region, if any. */ 7226 /* Clear the display of the old active region, if any. */
@@ -7247,7 +7247,7 @@ note_mouse_highlight (f, x, y)
7247 &dpyinfo->mouse_face_beg_row, 7247 &dpyinfo->mouse_face_beg_row,
7248 &dpyinfo->mouse_face_beg_x, 7248 &dpyinfo->mouse_face_beg_x,
7249 &dpyinfo->mouse_face_beg_y, Qnil); 7249 &dpyinfo->mouse_face_beg_y, Qnil);
7250 7250
7251 dpyinfo->mouse_face_past_end 7251 dpyinfo->mouse_face_past_end
7252 = !fast_find_position (w, XFASTINT (after), 7252 = !fast_find_position (w, XFASTINT (after),
7253 &dpyinfo->mouse_face_end_col, 7253 &dpyinfo->mouse_face_end_col,
@@ -7281,7 +7281,7 @@ note_mouse_highlight (f, x, y)
7281 after 7281 after
7282 = Fnext_single_property_change (position, Qmouse_face, 7282 = Fnext_single_property_change (position, Qmouse_face,
7283 object, end); 7283 object, end);
7284 7284
7285 /* Record this as the current active region. */ 7285 /* Record this as the current active region. */
7286 fast_find_position (w, XFASTINT (before), 7286 fast_find_position (w, XFASTINT (before),
7287 &dpyinfo->mouse_face_beg_col, 7287 &dpyinfo->mouse_face_beg_col,
@@ -7309,7 +7309,7 @@ note_mouse_highlight (f, x, y)
7309 { 7309 {
7310 Lisp_Object b, e; 7310 Lisp_Object b, e;
7311 int ignore; 7311 int ignore;
7312 7312
7313 b = Fprevious_single_property_change (make_number (pos + 1), 7313 b = Fprevious_single_property_change (make_number (pos + 1),
7314 Qmouse_face, 7314 Qmouse_face,
7315 object, Qnil); 7315 object, Qnil);
@@ -7343,7 +7343,7 @@ note_mouse_highlight (f, x, y)
7343 the text ``under'' it might have. */ 7343 the text ``under'' it might have. */
7344 struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); 7344 struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos);
7345 int start = MATRIX_ROW_START_CHARPOS (r); 7345 int start = MATRIX_ROW_START_CHARPOS (r);
7346 7346
7347 pos = string_buffer_position (w, object, start); 7347 pos = string_buffer_position (w, object, start);
7348 if (pos > 0) 7348 if (pos > 0)
7349 mouse_face = get_char_property_and_overlay (make_number (pos), 7349 mouse_face = get_char_property_and_overlay (make_number (pos),
@@ -7367,7 +7367,7 @@ note_mouse_highlight (f, x, y)
7367 &dpyinfo->mouse_face_beg_x, 7367 &dpyinfo->mouse_face_beg_x,
7368 &dpyinfo->mouse_face_beg_y, 7368 &dpyinfo->mouse_face_beg_y,
7369 object); 7369 object);
7370 7370
7371 dpyinfo->mouse_face_past_end 7371 dpyinfo->mouse_face_past_end
7372 = !fast_find_position (w, XFASTINT (after), 7372 = !fast_find_position (w, XFASTINT (after),
7373 &dpyinfo->mouse_face_end_col, 7373 &dpyinfo->mouse_face_end_col,
@@ -7412,7 +7412,7 @@ note_mouse_highlight (f, x, y)
7412 { 7412 {
7413 Lisp_Object object = glyph->object; 7413 Lisp_Object object = glyph->object;
7414 int charpos = glyph->charpos; 7414 int charpos = glyph->charpos;
7415 7415
7416 /* Try text properties. */ 7416 /* Try text properties. */
7417 if (STRINGP (object) 7417 if (STRINGP (object)
7418 && charpos >= 0 7418 && charpos >= 0
@@ -7445,7 +7445,7 @@ note_mouse_highlight (f, x, y)
7445 && charpos < ZV) 7445 && charpos < ZV)
7446 help = Fget_text_property (make_number (charpos), Qhelp_echo, 7446 help = Fget_text_property (make_number (charpos), Qhelp_echo,
7447 object); 7447 object);
7448 7448
7449 if (!NILP (help)) 7449 if (!NILP (help))
7450 { 7450 {
7451 help_echo = help; 7451 help_echo = help;
@@ -7455,14 +7455,14 @@ note_mouse_highlight (f, x, y)
7455 } 7455 }
7456 } 7456 }
7457 } 7457 }
7458 7458
7459 BEGV = obegv; 7459 BEGV = obegv;
7460 ZV = ozv; 7460 ZV = ozv;
7461 current_buffer = obuf; 7461 current_buffer = obuf;
7462 } 7462 }
7463 7463
7464 set_cursor: 7464 set_cursor:
7465 7465
7466 if (cursor != None) 7466 if (cursor != None)
7467 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor); 7467 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), cursor);
7468} 7468}
@@ -7533,7 +7533,7 @@ x_tool_bar_item (f, x, y, glyph, hpos, vpos, prop_idx)
7533 || *hpos < dpyinfo->mouse_face_end_col 7533 || *hpos < dpyinfo->mouse_face_end_col
7534 || dpyinfo->mouse_face_past_end)) 7534 || dpyinfo->mouse_face_past_end))
7535 return 0; 7535 return 0;
7536 7536
7537 return 1; 7537 return 1;
7538} 7538}
7539 7539
@@ -7554,7 +7554,7 @@ x_handle_tool_bar_click (f, button_event)
7554 Lisp_Object enabled_p; 7554 Lisp_Object enabled_p;
7555 int x = button_event->x; 7555 int x = button_event->x;
7556 int y = button_event->y; 7556 int y = button_event->y;
7557 7557
7558 /* If not on the highlighted tool-bar item, return. */ 7558 /* If not on the highlighted tool-bar item, return. */
7559 frame_to_window_pixel_xy (w, &x, &y); 7559 frame_to_window_pixel_xy (w, &x, &y);
7560 if (x_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0) 7560 if (x_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0)
@@ -7564,7 +7564,7 @@ x_handle_tool_bar_click (f, button_event)
7564 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); 7564 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P);
7565 if (NILP (enabled_p)) 7565 if (NILP (enabled_p))
7566 return; 7566 return;
7567 7567
7568 if (button_event->type == ButtonPress) 7568 if (button_event->type == ButtonPress)
7569 { 7569 {
7570 /* Show item in pressed state. */ 7570 /* Show item in pressed state. */
@@ -7640,7 +7640,7 @@ note_tool_bar_highlight (f, x, y)
7640 goto set_help_echo; 7640 goto set_help_echo;
7641 7641
7642 clear_mouse_face (dpyinfo); 7642 clear_mouse_face (dpyinfo);
7643 7643
7644 /* Mouse is down, but on different tool-bar item? */ 7644 /* Mouse is down, but on different tool-bar item? */
7645 mouse_down_p = (dpyinfo->grabbed 7645 mouse_down_p = (dpyinfo->grabbed
7646 && f == last_mouse_frame 7646 && f == last_mouse_frame
@@ -7651,7 +7651,7 @@ note_tool_bar_highlight (f, x, y)
7651 7651
7652 dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT; 7652 dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT;
7653 draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; 7653 draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED;
7654 7654
7655 /* If tool-bar item is not enabled, don't highlight it. */ 7655 /* If tool-bar item is not enabled, don't highlight it. */
7656 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); 7656 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P);
7657 if (!NILP (enabled_p)) 7657 if (!NILP (enabled_p))
@@ -7661,28 +7661,28 @@ note_tool_bar_highlight (f, x, y)
7661 row = MATRIX_ROW (w->current_matrix, vpos); 7661 row = MATRIX_ROW (w->current_matrix, vpos);
7662 for (i = x = 0; i < hpos; ++i) 7662 for (i = x = 0; i < hpos; ++i)
7663 x += row->glyphs[TEXT_AREA][i].pixel_width; 7663 x += row->glyphs[TEXT_AREA][i].pixel_width;
7664 7664
7665 /* Record this as the current active region. */ 7665 /* Record this as the current active region. */
7666 dpyinfo->mouse_face_beg_col = hpos; 7666 dpyinfo->mouse_face_beg_col = hpos;
7667 dpyinfo->mouse_face_beg_row = vpos; 7667 dpyinfo->mouse_face_beg_row = vpos;
7668 dpyinfo->mouse_face_beg_x = x; 7668 dpyinfo->mouse_face_beg_x = x;
7669 dpyinfo->mouse_face_beg_y = row->y; 7669 dpyinfo->mouse_face_beg_y = row->y;
7670 dpyinfo->mouse_face_past_end = 0; 7670 dpyinfo->mouse_face_past_end = 0;
7671 7671
7672 dpyinfo->mouse_face_end_col = hpos + 1; 7672 dpyinfo->mouse_face_end_col = hpos + 1;
7673 dpyinfo->mouse_face_end_row = vpos; 7673 dpyinfo->mouse_face_end_row = vpos;
7674 dpyinfo->mouse_face_end_x = x + glyph->pixel_width; 7674 dpyinfo->mouse_face_end_x = x + glyph->pixel_width;
7675 dpyinfo->mouse_face_end_y = row->y; 7675 dpyinfo->mouse_face_end_y = row->y;
7676 dpyinfo->mouse_face_window = window; 7676 dpyinfo->mouse_face_window = window;
7677 dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; 7677 dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID;
7678 7678
7679 /* Display it as active. */ 7679 /* Display it as active. */
7680 show_mouse_face (dpyinfo, draw); 7680 show_mouse_face (dpyinfo, draw);
7681 dpyinfo->mouse_face_image_state = draw; 7681 dpyinfo->mouse_face_image_state = draw;
7682 } 7682 }
7683 7683
7684 set_help_echo: 7684 set_help_echo:
7685 7685
7686 /* Set help_echo to a help string to display for this tool-bar item. 7686 /* Set help_echo to a help string to display for this tool-bar item.
7687 XTread_socket does the rest. */ 7687 XTread_socket does the rest. */
7688 help_echo_object = help_echo_window = Qnil; 7688 help_echo_object = help_echo_window = Qnil;
@@ -7704,7 +7704,7 @@ note_tool_bar_highlight (f, x, y)
7704#if 0 /* This is a version of fast_find_position that's more correct 7704#if 0 /* This is a version of fast_find_position that's more correct
7705 in the presence of hscrolling, for example. I didn't install 7705 in the presence of hscrolling, for example. I didn't install
7706 it right away because the problem fixed is minor, it failed 7706 it right away because the problem fixed is minor, it failed
7707 in 20.x as well, and I think it's too risky to install 7707 in 20.x as well, and I think it's too risky to install
7708 so near the release of 21.1. 2001-09-25 gerd. */ 7708 so near the release of 21.1. 2001-09-25 gerd. */
7709 7709
7710static int 7710static int
@@ -7737,10 +7737,10 @@ fast_find_position (w, charpos, hpos, vpos, x, y, stop)
7737 *x = row->x; 7737 *x = row->x;
7738 *y = row->y; 7738 *y = row->y;
7739 *vpos = MATRIX_ROW_VPOS (row, w->current_matrix); 7739 *vpos = MATRIX_ROW_VPOS (row, w->current_matrix);
7740 7740
7741 glyph = row->glyphs[TEXT_AREA]; 7741 glyph = row->glyphs[TEXT_AREA];
7742 end = glyph + row->used[TEXT_AREA]; 7742 end = glyph + row->used[TEXT_AREA];
7743 7743
7744 /* Skip over glyphs not having an object at the start of the row. 7744 /* Skip over glyphs not having an object at the start of the row.
7745 These are special glyphs like truncation marks on terminal 7745 These are special glyphs like truncation marks on terminal
7746 frames. */ 7746 frames. */
@@ -7814,11 +7814,11 @@ fast_find_position (w, pos, hpos, vpos, x, y, stop)
7814 7814
7815 if (row->y + row->height >= yb) 7815 if (row->y + row->height >= yb)
7816 break; 7816 break;
7817 7817
7818 ++row; 7818 ++row;
7819 ++row_vpos; 7819 ++row_vpos;
7820 } 7820 }
7821 7821
7822 /* Find the right column within BEST_ROW. */ 7822 /* Find the right column within BEST_ROW. */
7823 lastcol = 0; 7823 lastcol = 0;
7824 current_x = best_row->x; 7824 current_x = best_row->x;
@@ -7942,7 +7942,7 @@ fast_find_string_pos (w, pos, object, hpos, vpos, x, y, right_p)
7942 *x += best_glyph->pixel_width; 7942 *x += best_glyph->pixel_width;
7943 ++*hpos; 7943 ++*hpos;
7944 } 7944 }
7945 7945
7946 *y = best_row->y; 7946 *y = best_row->y;
7947 *vpos = best_row - w->current_matrix->rows; 7947 *vpos = best_row - w->current_matrix->rows;
7948 } 7948 }
@@ -7976,7 +7976,7 @@ show_mouse_face (dpyinfo, draw)
7976 7976
7977 first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); 7977 first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row);
7978 last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); 7978 last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row);
7979 7979
7980 for (row = first; row <= last && row->enabled_p; ++row) 7980 for (row = first; row <= last && row->enabled_p; ++row)
7981 { 7981 {
7982 int start_hpos, end_hpos, start_x; 7982 int start_hpos, end_hpos, start_x;
@@ -8000,7 +8000,7 @@ show_mouse_face (dpyinfo, draw)
8000 8000
8001 if (end_hpos > start_hpos) 8001 if (end_hpos > start_hpos)
8002 { 8002 {
8003 x_draw_glyphs (w, start_x, row, TEXT_AREA, 8003 x_draw_glyphs (w, start_x, row, TEXT_AREA,
8004 start_hpos, end_hpos, draw, 0); 8004 start_hpos, end_hpos, draw, 0);
8005 8005
8006 row->mouse_face_p 8006 row->mouse_face_p
@@ -8037,7 +8037,7 @@ clear_mouse_face (dpyinfo)
8037 struct x_display_info *dpyinfo; 8037 struct x_display_info *dpyinfo;
8038{ 8038{
8039 int cleared = 0; 8039 int cleared = 0;
8040 8040
8041 if (!NILP (dpyinfo->mouse_face_window)) 8041 if (!NILP (dpyinfo->mouse_face_window))
8042 { 8042 {
8043 show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT); 8043 show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT);
@@ -8116,14 +8116,14 @@ glyph_rect (f, x, y, rect)
8116 struct glyph_row *end = r + w->current_matrix->nrows - 1; 8116 struct glyph_row *end = r + w->current_matrix->nrows - 1;
8117 8117
8118 frame_to_window_pixel_xy (w, &x, &y); 8118 frame_to_window_pixel_xy (w, &x, &y);
8119 8119
8120 for (; !found && r < end && r->enabled_p; ++r) 8120 for (; !found && r < end && r->enabled_p; ++r)
8121 if (r->y >= y) 8121 if (r->y >= y)
8122 { 8122 {
8123 struct glyph *g = r->glyphs[TEXT_AREA]; 8123 struct glyph *g = r->glyphs[TEXT_AREA];
8124 struct glyph *end = g + r->used[TEXT_AREA]; 8124 struct glyph *end = g + r->used[TEXT_AREA];
8125 int gx; 8125 int gx;
8126 8126
8127 for (gx = r->x; !found && g < end; gx += g->pixel_width, ++g) 8127 for (gx = r->x; !found && g < end; gx += g->pixel_width, ++g)
8128 if (gx >= x) 8128 if (gx >= x)
8129 { 8129 {
@@ -8326,7 +8326,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
8326 8326
8327 int width, height, gx, gy; 8327 int width, height, gx, gy;
8328 XRectangle rect; 8328 XRectangle rect;
8329 8329
8330 if (glyph_rect (f1, win_x, win_y, &rect)) 8330 if (glyph_rect (f1, win_x, win_y, &rect))
8331 last_mouse_glyph = rect; 8331 last_mouse_glyph = rect;
8332 else 8332 else
@@ -8335,7 +8335,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
8335 height = FRAME_SMALLEST_FONT_HEIGHT (f1); 8335 height = FRAME_SMALLEST_FONT_HEIGHT (f1);
8336 gx = win_x; 8336 gx = win_x;
8337 gy = win_y; 8337 gy = win_y;
8338 8338
8339 /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to 8339 /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to
8340 round down even for negative values. */ 8340 round down even for negative values. */
8341 if (gx < 0) 8341 if (gx < 0)
@@ -8344,7 +8344,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
8344 gy -= height - 1; 8344 gy -= height - 1;
8345 gx = (gx + width - 1) / width * width; 8345 gx = (gx + width - 1) / width * width;
8346 gy = (gy + height - 1) / height * height; 8346 gy = (gy + height - 1) / height * height;
8347 8347
8348 last_mouse_glyph.width = width; 8348 last_mouse_glyph.width = width;
8349 last_mouse_glyph.height = height; 8349 last_mouse_glyph.height = height;
8350 last_mouse_glyph.x = gx; 8350 last_mouse_glyph.x = gx;
@@ -8439,14 +8439,14 @@ x_window_to_menu_bar (window)
8439 Window window; 8439 Window window;
8440{ 8440{
8441 Lisp_Object tail; 8441 Lisp_Object tail;
8442 8442
8443 for (tail = Vframe_list; 8443 for (tail = Vframe_list;
8444 XGCTYPE (tail) == Lisp_Cons; 8444 XGCTYPE (tail) == Lisp_Cons;
8445 tail = XCDR (tail)) 8445 tail = XCDR (tail))
8446 { 8446 {
8447 Lisp_Object frame = XCAR (tail); 8447 Lisp_Object frame = XCAR (tail);
8448 Widget menu_bar = XFRAME (frame)->output_data.x->menubar_widget; 8448 Widget menu_bar = XFRAME (frame)->output_data.x->menubar_widget;
8449 8449
8450 if (menu_bar && xlwmenu_window_p (menu_bar, window)) 8450 if (menu_bar && xlwmenu_window_p (menu_bar, window))
8451 return menu_bar; 8451 return menu_bar;
8452 } 8452 }
@@ -8513,7 +8513,7 @@ xt_action_hook (widget, client_data, action_name, event, params,
8513{ 8513{
8514 int scroll_bar_p; 8514 int scroll_bar_p;
8515 char *end_action; 8515 char *end_action;
8516 8516
8517#ifdef USE_MOTIF 8517#ifdef USE_MOTIF
8518 scroll_bar_p = XmIsScrollBar (widget); 8518 scroll_bar_p = XmIsScrollBar (widget);
8519 end_action = "Release"; 8519 end_action = "Release";
@@ -8527,7 +8527,7 @@ xt_action_hook (widget, client_data, action_name, event, params,
8527 && WINDOWP (window_being_scrolled)) 8527 && WINDOWP (window_being_scrolled))
8528 { 8528 {
8529 struct window *w; 8529 struct window *w;
8530 8530
8531 x_send_scroll_bar_event (window_being_scrolled, 8531 x_send_scroll_bar_event (window_being_scrolled,
8532 scroll_bar_end_scroll, 0, 0); 8532 scroll_bar_end_scroll, 0, 0);
8533 w = XWINDOW (window_being_scrolled); 8533 w = XWINDOW (window_being_scrolled);
@@ -8564,7 +8564,7 @@ x_send_scroll_bar_event (window, part, portion, whole)
8564 int i; 8564 int i;
8565 8565
8566 BLOCK_INPUT; 8566 BLOCK_INPUT;
8567 8567
8568 /* Construct a ClientMessage event to send to the frame. */ 8568 /* Construct a ClientMessage event to send to the frame. */
8569 ev->type = ClientMessage; 8569 ev->type = ClientMessage;
8570 ev->message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_Scrollbar; 8570 ev->message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_Scrollbar;
@@ -8585,7 +8585,7 @@ x_send_scroll_bar_event (window, part, portion, whole)
8585 int new_size = max (10, 2 * scroll_bar_windows_size); 8585 int new_size = max (10, 2 * scroll_bar_windows_size);
8586 size_t nbytes = new_size * sizeof *scroll_bar_windows; 8586 size_t nbytes = new_size * sizeof *scroll_bar_windows;
8587 size_t old_nbytes = scroll_bar_windows_size * sizeof *scroll_bar_windows; 8587 size_t old_nbytes = scroll_bar_windows_size * sizeof *scroll_bar_windows;
8588 8588
8589 scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows, 8589 scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows,
8590 nbytes); 8590 nbytes);
8591 bzero (&scroll_bar_windows[i], nbytes - old_nbytes); 8591 bzero (&scroll_bar_windows[i], nbytes - old_nbytes);
@@ -8622,13 +8622,13 @@ x_scroll_bar_to_input_event (event, ievent)
8622 Lisp_Object window; 8622 Lisp_Object window;
8623 struct frame *f; 8623 struct frame *f;
8624 struct window *w; 8624 struct window *w;
8625 8625
8626 w = scroll_bar_windows[ev->data.l[0]]; 8626 w = scroll_bar_windows[ev->data.l[0]];
8627 scroll_bar_windows[ev->data.l[0]] = NULL; 8627 scroll_bar_windows[ev->data.l[0]] = NULL;
8628 8628
8629 XSETWINDOW (window, w); 8629 XSETWINDOW (window, w);
8630 f = XFRAME (w->frame); 8630 f = XFRAME (w->frame);
8631 8631
8632 ievent->kind = SCROLL_BAR_CLICK_EVENT; 8632 ievent->kind = SCROLL_BAR_CLICK_EVENT;
8633 ievent->frame_or_window = window; 8633 ievent->frame_or_window = window;
8634 ievent->arg = Qnil; 8634 ievent->arg = Qnil;
@@ -8689,7 +8689,7 @@ xm_scroll_callback (widget, client_data, call_data)
8689 bar->dragging = Qnil; 8689 bar->dragging = Qnil;
8690 part = scroll_bar_to_top; 8690 part = scroll_bar_to_top;
8691 break; 8691 break;
8692 8692
8693 case XmCR_TO_BOTTOM: 8693 case XmCR_TO_BOTTOM:
8694 bar->dragging = Qnil; 8694 bar->dragging = Qnil;
8695 part = scroll_bar_to_bottom; 8695 part = scroll_bar_to_bottom;
@@ -8712,7 +8712,7 @@ xm_scroll_callback (widget, client_data, call_data)
8712 bar->dragging = make_number (cs->value); 8712 bar->dragging = make_number (cs->value);
8713 } 8713 }
8714 break; 8714 break;
8715 8715
8716 case XmCR_VALUE_CHANGED: 8716 case XmCR_VALUE_CHANGED:
8717 break; 8717 break;
8718 }; 8718 };
@@ -8846,14 +8846,14 @@ x_create_toolkit_scroll_bar (f, bar)
8846 XtSetArg (av[ac], XmNforeground, pixel); 8846 XtSetArg (av[ac], XmNforeground, pixel);
8847 ++ac; 8847 ++ac;
8848 } 8848 }
8849 8849
8850 pixel = f->output_data.x->scroll_bar_background_pixel; 8850 pixel = f->output_data.x->scroll_bar_background_pixel;
8851 if (pixel != -1) 8851 if (pixel != -1)
8852 { 8852 {
8853 XtSetArg (av[ac], XmNbackground, pixel); 8853 XtSetArg (av[ac], XmNbackground, pixel);
8854 ++ac; 8854 ++ac;
8855 } 8855 }
8856 8856
8857 widget = XmCreateScrollBar (f->output_data.x->edit_widget, 8857 widget = XmCreateScrollBar (f->output_data.x->edit_widget,
8858 scroll_bar_name, av, ac); 8858 scroll_bar_name, av, ac);
8859 8859
@@ -8872,7 +8872,7 @@ x_create_toolkit_scroll_bar (f, bar)
8872 (XtPointer) bar); 8872 (XtPointer) bar);
8873 XtAddCallback (widget, XmNtoTopCallback, xm_scroll_callback, 8873 XtAddCallback (widget, XmNtoTopCallback, xm_scroll_callback,
8874 (XtPointer) bar); 8874 (XtPointer) bar);
8875 8875
8876 /* Realize the widget. Only after that is the X window created. */ 8876 /* Realize the widget. Only after that is the X window created. */
8877 XtRealizeWidget (widget); 8877 XtRealizeWidget (widget);
8878 8878
@@ -8880,9 +8880,9 @@ x_create_toolkit_scroll_bar (f, bar)
8880 And I'm wondering why it hasn't an arrow cursor by default. */ 8880 And I'm wondering why it hasn't an arrow cursor by default. */
8881 XDefineCursor (XtDisplay (widget), XtWindow (widget), 8881 XDefineCursor (XtDisplay (widget), XtWindow (widget),
8882 f->output_data.x->nontext_cursor); 8882 f->output_data.x->nontext_cursor);
8883 8883
8884#else /* !USE_MOTIF i.e. use Xaw */ 8884#else /* !USE_MOTIF i.e. use Xaw */
8885 8885
8886 /* Set resources. Create the widget. The background of the 8886 /* Set resources. Create the widget. The background of the
8887 Xaw3d scroll bar widget is a little bit light for my taste. 8887 Xaw3d scroll bar widget is a little bit light for my taste.
8888 We don't alter it here to let users change it according 8888 We don't alter it here to let users change it according
@@ -8891,14 +8891,14 @@ x_create_toolkit_scroll_bar (f, bar)
8891 XtSetArg (av[ac], XtNorientation, XtorientVertical); ++ac; 8891 XtSetArg (av[ac], XtNorientation, XtorientVertical); ++ac;
8892 /* For smoother scrolling with Xaw3d -sm */ 8892 /* For smoother scrolling with Xaw3d -sm */
8893 /* XtSetArg (av[ac], XtNpickTop, True); ++ac; */ 8893 /* XtSetArg (av[ac], XtNpickTop, True); ++ac; */
8894 8894
8895 pixel = f->output_data.x->scroll_bar_foreground_pixel; 8895 pixel = f->output_data.x->scroll_bar_foreground_pixel;
8896 if (pixel != -1) 8896 if (pixel != -1)
8897 { 8897 {
8898 XtSetArg (av[ac], XtNforeground, pixel); 8898 XtSetArg (av[ac], XtNforeground, pixel);
8899 ++ac; 8899 ++ac;
8900 } 8900 }
8901 8901
8902 pixel = f->output_data.x->scroll_bar_background_pixel; 8902 pixel = f->output_data.x->scroll_bar_background_pixel;
8903 if (pixel != -1) 8903 if (pixel != -1)
8904 { 8904 {
@@ -8975,22 +8975,22 @@ x_create_toolkit_scroll_bar (f, bar)
8975 XtVaSetValues (widget, XtNcursorName, "top_left_arrow", NULL); 8975 XtVaSetValues (widget, XtNcursorName, "top_left_arrow", NULL);
8976 } 8976 }
8977 } 8977 }
8978 8978
8979 /* Define callbacks. */ 8979 /* Define callbacks. */
8980 XtAddCallback (widget, XtNjumpProc, xaw_jump_callback, (XtPointer) bar); 8980 XtAddCallback (widget, XtNjumpProc, xaw_jump_callback, (XtPointer) bar);
8981 XtAddCallback (widget, XtNscrollProc, xaw_scroll_callback, 8981 XtAddCallback (widget, XtNscrollProc, xaw_scroll_callback,
8982 (XtPointer) bar); 8982 (XtPointer) bar);
8983 8983
8984 /* Realize the widget. Only after that is the X window created. */ 8984 /* Realize the widget. Only after that is the X window created. */
8985 XtRealizeWidget (widget); 8985 XtRealizeWidget (widget);
8986 8986
8987#endif /* !USE_MOTIF */ 8987#endif /* !USE_MOTIF */
8988 8988
8989 /* Install an action hook that lets us detect when the user 8989 /* Install an action hook that lets us detect when the user
8990 finishes interacting with a scroll bar. */ 8990 finishes interacting with a scroll bar. */
8991 if (action_hook_id == 0) 8991 if (action_hook_id == 0)
8992 action_hook_id = XtAppAddActionHook (Xt_app_con, xt_action_hook, 0); 8992 action_hook_id = XtAppAddActionHook (Xt_app_con, xt_action_hook, 0);
8993 8993
8994 /* Remember X window and widget in the scroll bar vector. */ 8994 /* Remember X window and widget in the scroll bar vector. */
8995 SET_SCROLL_BAR_X_WIDGET (bar, widget); 8995 SET_SCROLL_BAR_X_WIDGET (bar, widget);
8996 xwindow = XtWindow (widget); 8996 xwindow = XtWindow (widget);
@@ -9055,7 +9055,7 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
9055 value = top * XM_SB_RANGE; 9055 value = top * XM_SB_RANGE;
9056 value = min (value, XM_SB_MAX - size); 9056 value = min (value, XM_SB_MAX - size);
9057 value = max (value, XM_SB_MIN); 9057 value = max (value, XM_SB_MIN);
9058 9058
9059 XmScrollBarSetValues (widget, value, size, 0, 0, False); 9059 XmScrollBarSetValues (widget, value, size, 0, 0, False);
9060 } 9060 }
9061#else /* !USE_MOTIF i.e. use Xaw */ 9061#else /* !USE_MOTIF i.e. use Xaw */
@@ -9097,7 +9097,7 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
9097#ifdef HAVE_XAW3D 9097#ifdef HAVE_XAW3D
9098 ScrollbarWidget sb = (ScrollbarWidget) widget; 9098 ScrollbarWidget sb = (ScrollbarWidget) widget;
9099 int scroll_mode = 0; 9099 int scroll_mode = 0;
9100 9100
9101 /* `scroll_mode' only exists with Xaw3d + ARROW_SCROLLBAR. */ 9101 /* `scroll_mode' only exists with Xaw3d + ARROW_SCROLLBAR. */
9102 if (xaw3d_arrow_scroll) 9102 if (xaw3d_arrow_scroll)
9103 { 9103 {
@@ -9111,9 +9111,9 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
9111 /* Try to make the scrolling a tad smoother. */ 9111 /* Try to make the scrolling a tad smoother. */
9112 if (!xaw3d_pick_top) 9112 if (!xaw3d_pick_top)
9113 shown = min (shown, old_shown); 9113 shown = min (shown, old_shown);
9114 9114
9115 XawScrollbarSetThumb (widget, top, shown); 9115 XawScrollbarSetThumb (widget, top, shown);
9116 9116
9117#ifdef HAVE_XAW3D 9117#ifdef HAVE_XAW3D
9118 if (xaw3d_arrow_scroll && scroll_mode == 2) 9118 if (xaw3d_arrow_scroll && scroll_mode == 2)
9119 sb->scrollbar.scroll_mode = scroll_mode; 9119 sb->scrollbar.scroll_mode = scroll_mode;
@@ -9133,7 +9133,7 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
9133/************************************************************************ 9133/************************************************************************
9134 Scroll bars, general 9134 Scroll bars, general
9135 ************************************************************************/ 9135 ************************************************************************/
9136 9136
9137/* Create a scroll bar and return the scroll bar vector for it. W is 9137/* Create a scroll bar and return the scroll bar vector for it. W is
9138 the Emacs window on which to create the scroll bar. TOP, LEFT, 9138 the Emacs window on which to create the scroll bar. TOP, LEFT,
9139 WIDTH and HEIGHT are the pixel coordinates and dimensions of the 9139 WIDTH and HEIGHT are the pixel coordinates and dimensions of the
@@ -9161,7 +9161,7 @@ x_scroll_bar_create (w, top, left, width, height)
9161 a.background_pixel = f->output_data.x->scroll_bar_background_pixel; 9161 a.background_pixel = f->output_data.x->scroll_bar_background_pixel;
9162 if (a.background_pixel == -1) 9162 if (a.background_pixel == -1)
9163 a.background_pixel = f->output_data.x->background_pixel; 9163 a.background_pixel = f->output_data.x->background_pixel;
9164 9164
9165 a.event_mask = (ButtonPressMask | ButtonReleaseMask 9165 a.event_mask = (ButtonPressMask | ButtonReleaseMask
9166 | ButtonMotionMask | PointerMotionHintMask 9166 | ButtonMotionMask | PointerMotionHintMask
9167 | ExposureMask); 9167 | ExposureMask);
@@ -9231,7 +9231,7 @@ x_scroll_bar_create (w, top, left, width, height)
9231 9231
9232 9232
9233/* Draw BAR's handle in the proper position. 9233/* Draw BAR's handle in the proper position.
9234 9234
9235 If the handle is already drawn from START to END, don't bother 9235 If the handle is already drawn from START to END, don't bother
9236 redrawing it, unless REBUILD is non-zero; in that case, always 9236 redrawing it, unless REBUILD is non-zero; in that case, always
9237 redraw it. (REBUILD is handy for drawing the handle after expose 9237 redraw it. (REBUILD is handy for drawing the handle after expose
@@ -9358,7 +9358,7 @@ x_scroll_bar_remove (bar)
9358#else 9358#else
9359 XDestroyWindow (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (bar)); 9359 XDestroyWindow (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (bar));
9360#endif 9360#endif
9361 9361
9362 /* Disassociate this scroll bar from its window. */ 9362 /* Disassociate this scroll bar from its window. */
9363 XWINDOW (bar->window)->vertical_scroll_bar = Qnil; 9363 XWINDOW (bar->window)->vertical_scroll_bar = Qnil;
9364 9364
@@ -9405,16 +9405,16 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
9405 /* Compute the left edge of the scroll bar. */ 9405 /* Compute the left edge of the scroll bar. */
9406#ifdef USE_TOOLKIT_SCROLL_BARS 9406#ifdef USE_TOOLKIT_SCROLL_BARS
9407 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) 9407 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))
9408 sb_left = left + width - sb_width - (width - sb_width) / 2; 9408 sb_left = left + width - sb_width - (width - sb_width) / 2;
9409 else 9409 else
9410 sb_left = left + (width - sb_width) / 2; 9410 sb_left = left + (width - sb_width) / 2;
9411#else 9411#else
9412 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) 9412 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))
9413 sb_left = left + width - sb_width; 9413 sb_left = left + width - sb_width;
9414 else 9414 else
9415 sb_left = left; 9415 sb_left = left;
9416#endif 9416#endif
9417 9417
9418 /* Does the scroll bar exist yet? */ 9418 /* Does the scroll bar exist yet? */
9419 if (NILP (w->vertical_scroll_bar)) 9419 if (NILP (w->vertical_scroll_bar))
9420 { 9420 {
@@ -9425,14 +9425,14 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
9425 left, top, width, height, False); 9425 left, top, width, height, False);
9426 UNBLOCK_INPUT; 9426 UNBLOCK_INPUT;
9427 } 9427 }
9428 9428
9429 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); 9429 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height);
9430 } 9430 }
9431 else 9431 else
9432 { 9432 {
9433 /* It may just need to be moved and resized. */ 9433 /* It may just need to be moved and resized. */
9434 unsigned int mask = 0; 9434 unsigned int mask = 0;
9435 9435
9436 bar = XSCROLL_BAR (w->vertical_scroll_bar); 9436 bar = XSCROLL_BAR (w->vertical_scroll_bar);
9437 9437
9438 BLOCK_INPUT; 9438 BLOCK_INPUT;
@@ -9443,9 +9443,9 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
9443 mask |= CWY; 9443 mask |= CWY;
9444 if (sb_width != XINT (bar->width)) 9444 if (sb_width != XINT (bar->width))
9445 mask |= CWWidth; 9445 mask |= CWWidth;
9446 if (height != XINT (bar->height)) 9446 if (height != XINT (bar->height))
9447 mask |= CWHeight; 9447 mask |= CWHeight;
9448 9448
9449#ifdef USE_TOOLKIT_SCROLL_BARS 9449#ifdef USE_TOOLKIT_SCROLL_BARS
9450 9450
9451 /* Since toolkit scroll bars are smaller than the space reserved 9451 /* Since toolkit scroll bars are smaller than the space reserved
@@ -9463,7 +9463,7 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
9463 max (height, 1), 0); 9463 max (height, 1), 0);
9464 9464
9465#else /* not USE_TOOLKIT_SCROLL_BARS */ 9465#else /* not USE_TOOLKIT_SCROLL_BARS */
9466 9466
9467 /* Clear areas not covered by the scroll bar because of 9467 /* Clear areas not covered by the scroll bar because of
9468 VERTICAL_SCROLL_BAR_WIDTH_TRIM. */ 9468 VERTICAL_SCROLL_BAR_WIDTH_TRIM. */
9469 if (VERTICAL_SCROLL_BAR_WIDTH_TRIM) 9469 if (VERTICAL_SCROLL_BAR_WIDTH_TRIM)
@@ -9495,12 +9495,12 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
9495 left, top, rest, height, False); 9495 left, top, rest, height, False);
9496 } 9496 }
9497 } 9497 }
9498 9498
9499 /* Move/size the scroll bar window. */ 9499 /* Move/size the scroll bar window. */
9500 if (mask) 9500 if (mask)
9501 { 9501 {
9502 XWindowChanges wc; 9502 XWindowChanges wc;
9503 9503
9504 wc.x = sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM; 9504 wc.x = sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM;
9505 wc.y = top; 9505 wc.y = top;
9506 wc.width = sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2; 9506 wc.width = sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2;
@@ -9508,7 +9508,7 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
9508 XConfigureWindow (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (bar), 9508 XConfigureWindow (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (bar),
9509 mask, &wc); 9509 mask, &wc);
9510 } 9510 }
9511 9511
9512#endif /* not USE_TOOLKIT_SCROLL_BARS */ 9512#endif /* not USE_TOOLKIT_SCROLL_BARS */
9513 9513
9514 /* Remember new settings. */ 9514 /* Remember new settings. */
@@ -9516,7 +9516,7 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
9516 XSETINT (bar->top, top); 9516 XSETINT (bar->top, top);
9517 XSETINT (bar->width, sb_width); 9517 XSETINT (bar->width, sb_width);
9518 XSETINT (bar->height, height); 9518 XSETINT (bar->height, height);
9519 9519
9520 UNBLOCK_INPUT; 9520 UNBLOCK_INPUT;
9521 } 9521 }
9522 9522
@@ -9680,7 +9680,7 @@ x_scroll_bar_expose (bar, event)
9680 0, 0, 9680 0, 0,
9681 XINT (bar->width) - 1 - width_trim - width_trim, 9681 XINT (bar->width) - 1 - width_trim - width_trim,
9682 XINT (bar->height) - 1); 9682 XINT (bar->height) - 1);
9683 9683
9684 UNBLOCK_INPUT; 9684 UNBLOCK_INPUT;
9685 9685
9686#endif /* not USE_TOOLKIT_SCROLL_BARS */ 9686#endif /* not USE_TOOLKIT_SCROLL_BARS */
@@ -9706,7 +9706,7 @@ x_scroll_bar_handle_click (bar, event, emacs_event)
9706 emacs_event->kind = SCROLL_BAR_CLICK_EVENT; 9706 emacs_event->kind = SCROLL_BAR_CLICK_EVENT;
9707 emacs_event->code = event->xbutton.button - Button1; 9707 emacs_event->code = event->xbutton.button - Button1;
9708 emacs_event->modifiers 9708 emacs_event->modifiers
9709 = (x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO 9709 = (x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO
9710 (XFRAME (WINDOW_FRAME (XWINDOW (bar->window)))), 9710 (XFRAME (WINDOW_FRAME (XWINDOW (bar->window)))),
9711 event->xbutton.state) 9711 event->xbutton.state)
9712 | (event->type == ButtonRelease 9712 | (event->type == ButtonRelease
@@ -10125,7 +10125,7 @@ XTread_socket (sd, bufp, numchars, expected)
10125 abort (); /* Don't think this happens. */ 10125 abort (); /* Don't think this happens. */
10126 10126
10127 ++handling_signal; 10127 ++handling_signal;
10128 10128
10129 /* Find the display we are supposed to read input for. 10129 /* Find the display we are supposed to read input for.
10130 It's the one communicating on descriptor SD. */ 10130 It's the one communicating on descriptor SD. */
10131 for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next) 10131 for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
@@ -10221,7 +10221,7 @@ XTread_socket (sd, bufp, numchars, expected)
10221 below are temporally close (on a fast machine), the call 10221 below are temporally close (on a fast machine), the call
10222 below can generate additional FocusIn events which confuse 10222 below can generate additional FocusIn events which confuse
10223 Emacs. */ 10223 Emacs. */
10224 10224
10225 /* Since we set WM_TAKE_FOCUS, we must call 10225 /* Since we set WM_TAKE_FOCUS, we must call
10226 XSetInputFocus explicitly. But not if f is null, 10226 XSetInputFocus explicitly. But not if f is null,
10227 since that might be an event for a deleted frame. */ 10227 since that might be an event for a deleted frame. */
@@ -10240,7 +10240,7 @@ XTread_socket (sd, bufp, numchars, expected)
10240 if there is an error. */ 10240 if there is an error. */
10241 XSync (d, False); 10241 XSync (d, False);
10242 x_uncatch_errors (d, count); 10242 x_uncatch_errors (d, count);
10243 } 10243 }
10244 /* Not certain about handling scroll bars here */ 10244 /* Not certain about handling scroll bars here */
10245#endif /* 0 */ 10245#endif /* 0 */
10246 } 10246 }
@@ -10528,7 +10528,7 @@ XTread_socket (sd, bufp, numchars, expected)
10528 tip_window = 0; 10528 tip_window = 0;
10529 redo_mouse_highlight (); 10529 redo_mouse_highlight ();
10530 } 10530 }
10531 10531
10532 f = x_top_window_to_frame (dpyinfo, event.xunmap.window); 10532 f = x_top_window_to_frame (dpyinfo, event.xunmap.window);
10533 if (f) /* F may no longer exist if 10533 if (f) /* F may no longer exist if
10534 the frame was deleted. */ 10534 the frame was deleted. */
@@ -10562,7 +10562,7 @@ XTread_socket (sd, bufp, numchars, expected)
10562 /* The tooltip has been drawn already. Avoid 10562 /* The tooltip has been drawn already. Avoid
10563 the SET_FRAME_GARBAGED below. */ 10563 the SET_FRAME_GARBAGED below. */
10564 goto OTHER; 10564 goto OTHER;
10565 10565
10566 /* We use x_top_window_to_frame because map events can 10566 /* We use x_top_window_to_frame because map events can
10567 come for sub-windows and they don't mean that the 10567 come for sub-windows and they don't mean that the
10568 frame is visible. */ 10568 frame is visible. */
@@ -10881,7 +10881,7 @@ XTread_socket (sd, bufp, numchars, expected)
10881 else 10881 else
10882 c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, 10882 c = STRING_CHAR_AND_LENGTH (copy_bufptr + i,
10883 nbytes - i, len); 10883 nbytes - i, len);
10884 10884
10885 bufp->kind = (SINGLE_BYTE_CHAR_P (c) 10885 bufp->kind = (SINGLE_BYTE_CHAR_P (c)
10886 ? ASCII_KEYSTROKE_EVENT 10886 ? ASCII_KEYSTROKE_EVENT
10887 : MULTIBYTE_CHAR_KEYSTROKE_EVENT); 10887 : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
@@ -10935,7 +10935,7 @@ XTread_socket (sd, bufp, numchars, expected)
10935 { 10935 {
10936 bufp += n, count += n, numchars -= n; 10936 bufp += n, count += n, numchars -= n;
10937 } 10937 }
10938 10938
10939 f = x_any_window_to_frame (dpyinfo, event.xcrossing.window); 10939 f = x_any_window_to_frame (dpyinfo, event.xcrossing.window);
10940 10940
10941#if 0 10941#if 0
@@ -11033,7 +11033,7 @@ XTread_socket (sd, bufp, numchars, expected)
11033 previous_help_echo = help_echo; 11033 previous_help_echo = help_echo;
11034 help_echo = help_echo_object = help_echo_window = Qnil; 11034 help_echo = help_echo_object = help_echo_window = Qnil;
11035 help_echo_pos = -1; 11035 help_echo_pos = -1;
11036 11036
11037 if (dpyinfo->grabbed && last_mouse_frame 11037 if (dpyinfo->grabbed && last_mouse_frame
11038 && FRAME_LIVE_P (last_mouse_frame)) 11038 && FRAME_LIVE_P (last_mouse_frame))
11039 f = last_mouse_frame; 11039 f = last_mouse_frame;
@@ -11111,7 +11111,7 @@ XTread_socket (sd, bufp, numchars, expected)
11111 help_echo_pos); 11111 help_echo_pos);
11112 bufp += n, count += n, numchars -= n; 11112 bufp += n, count += n, numchars -= n;
11113 } 11113 }
11114 11114
11115 goto OTHER; 11115 goto OTHER;
11116 } 11116 }
11117 11117
@@ -11131,7 +11131,7 @@ XTread_socket (sd, bufp, numchars, expected)
11131 int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width); 11131 int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width);
11132 if (dont_resize) 11132 if (dont_resize)
11133 goto OTHER; 11133 goto OTHER;
11134 11134
11135 /* In the toolkit version, change_frame_size 11135 /* In the toolkit version, change_frame_size
11136 is called by the code that handles resizing 11136 is called by the code that handles resizing
11137 of the EmacsFrame widget. */ 11137 of the EmacsFrame widget. */
@@ -11184,7 +11184,7 @@ XTread_socket (sd, bufp, numchars, expected)
11184 by the rest of Emacs, we put it here. */ 11184 by the rest of Emacs, we put it here. */
11185 struct input_event emacs_event; 11185 struct input_event emacs_event;
11186 int tool_bar_p = 0; 11186 int tool_bar_p = 0;
11187 11187
11188 emacs_event.kind = NO_EVENT; 11188 emacs_event.kind = NO_EVENT;
11189 bzero (&compose_status, sizeof (compose_status)); 11189 bzero (&compose_status, sizeof (compose_status));
11190 11190
@@ -11242,7 +11242,7 @@ XTread_socket (sd, bufp, numchars, expected)
11242 the ButtonPress. */ 11242 the ButtonPress. */
11243 if (f != 0) 11243 if (f != 0)
11244 f->mouse_moved = 0; 11244 f->mouse_moved = 0;
11245 11245
11246 if (!tool_bar_p) 11246 if (!tool_bar_p)
11247 last_tool_bar_item = -1; 11247 last_tool_bar_item = -1;
11248 } 11248 }
@@ -11306,7 +11306,7 @@ XTread_socket (sd, bufp, numchars, expected)
11306 11306
11307 case CirculateNotify: 11307 case CirculateNotify:
11308 goto OTHER; 11308 goto OTHER;
11309 11309
11310 case CirculateRequest: 11310 case CirculateRequest:
11311 goto OTHER; 11311 goto OTHER;
11312 11312
@@ -11420,7 +11420,7 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1)
11420 the buffer and window end because update_text_area 11420 the buffer and window end because update_text_area
11421 doesn't draw that row. (Except when it does, but 11421 doesn't draw that row. (Except when it does, but
11422 that's handled in update_text_area.) */ 11422 that's handled in update_text_area.) */
11423 11423
11424 if (((y0 >= cy0 && y0 < cy1) || (y1 > cy0 && y1 < cy1)) 11424 if (((y0 >= cy0 && y0 < cy1) || (y1 > cy0 && y1 < cy1))
11425 && w->current_matrix->rows[w->phys_cursor.vpos].displays_text_p) 11425 && w->current_matrix->rows[w->phys_cursor.vpos].displays_text_p)
11426 w->phys_cursor_on_p = 0; 11426 w->phys_cursor_on_p = 0;
@@ -11506,7 +11506,7 @@ x_draw_hollow_cursor (w, row)
11506 && !x_stretch_cursor_p) 11506 && !x_stretch_cursor_p)
11507 wd = min (CANON_X_UNIT (f), wd); 11507 wd = min (CANON_X_UNIT (f), wd);
11508 w->phys_cursor_width = wd; 11508 w->phys_cursor_width = wd;
11509 11509
11510 /* The foreground of cursor_gc is typically the same as the normal 11510 /* The foreground of cursor_gc is typically the same as the normal
11511 background color, which can cause the cursor box to be invisible. */ 11511 background color, which can cause the cursor box to be invisible. */
11512 xgcv.foreground = f->output_data.x->cursor_pixel; 11512 xgcv.foreground = f->output_data.x->cursor_pixel;
@@ -11540,7 +11540,7 @@ x_draw_bar_cursor (w, row, width, kind)
11540{ 11540{
11541 struct frame *f = XFRAME (w->frame); 11541 struct frame *f = XFRAME (w->frame);
11542 struct glyph *cursor_glyph; 11542 struct glyph *cursor_glyph;
11543 11543
11544 /* If cursor is out of bounds, don't draw garbage. This can happen 11544 /* If cursor is out of bounds, don't draw garbage. This can happen
11545 in mini-buffer windows when switching between echo area glyphs 11545 in mini-buffer windows when switching between echo area glyphs
11546 and mini-buffer. */ 11546 and mini-buffer. */
@@ -11576,7 +11576,7 @@ x_draw_bar_cursor (w, row, width, kind)
11576 else 11576 else
11577 xgcv.background = xgcv.foreground = f->output_data.x->cursor_pixel; 11577 xgcv.background = xgcv.foreground = f->output_data.x->cursor_pixel;
11578 xgcv.graphics_exposures = 0; 11578 xgcv.graphics_exposures = 0;
11579 11579
11580 if (gc) 11580 if (gc)
11581 XChangeGC (dpy, gc, mask, &xgcv); 11581 XChangeGC (dpy, gc, mask, &xgcv);
11582 else 11582 else
@@ -11584,14 +11584,14 @@ x_draw_bar_cursor (w, row, width, kind)
11584 gc = XCreateGC (dpy, window, mask, &xgcv); 11584 gc = XCreateGC (dpy, window, mask, &xgcv);
11585 FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc = gc; 11585 FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc = gc;
11586 } 11586 }
11587 11587
11588 if (width < 0) 11588 if (width < 0)
11589 width = FRAME_CURSOR_WIDTH (f); 11589 width = FRAME_CURSOR_WIDTH (f);
11590 width = min (cursor_glyph->pixel_width, width); 11590 width = min (cursor_glyph->pixel_width, width);
11591 11591
11592 w->phys_cursor_width = width; 11592 w->phys_cursor_width = width;
11593 x_clip_to_row (w, row, gc, 0); 11593 x_clip_to_row (w, row, gc, 0);
11594 11594
11595 if (kind == BAR_CURSOR) 11595 if (kind == BAR_CURSOR)
11596 XFillRectangle (dpy, window, gc, 11596 XFillRectangle (dpy, window, gc,
11597 WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), 11597 WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x),
@@ -11639,7 +11639,7 @@ x_draw_phys_cursor_glyph (w, row, hl)
11639 { 11639 {
11640 int on_p = w->phys_cursor_on_p; 11640 int on_p = w->phys_cursor_on_p;
11641 int x1; 11641 int x1;
11642 11642
11643 x1 = x_draw_glyphs (w, w->phys_cursor.x, row, TEXT_AREA, 11643 x1 = x_draw_glyphs (w, w->phys_cursor.x, row, TEXT_AREA,
11644 w->phys_cursor.hpos, w->phys_cursor.hpos + 1, 11644 w->phys_cursor.hpos, w->phys_cursor.hpos + 1,
11645 hl, 0); 11645 hl, 0);
@@ -11685,7 +11685,7 @@ x_erase_phys_cursor (w)
11685 screen. */ 11685 screen. */
11686 if (w->phys_cursor_type == NO_CURSOR) 11686 if (w->phys_cursor_type == NO_CURSOR)
11687 goto mark_cursor_off; 11687 goto mark_cursor_off;
11688 11688
11689 /* VPOS >= active_glyphs->nrows means that window has been resized. 11689 /* VPOS >= active_glyphs->nrows means that window has been resized.
11690 Don't bother to erase the cursor. */ 11690 Don't bother to erase the cursor. */
11691 if (vpos >= active_glyphs->nrows) 11691 if (vpos >= active_glyphs->nrows)
@@ -11696,13 +11696,13 @@ x_erase_phys_cursor (w)
11696 cursor_row = MATRIX_ROW (active_glyphs, vpos); 11696 cursor_row = MATRIX_ROW (active_glyphs, vpos);
11697 if (!cursor_row->enabled_p) 11697 if (!cursor_row->enabled_p)
11698 goto mark_cursor_off; 11698 goto mark_cursor_off;
11699 11699
11700 /* If row is completely invisible, don't attempt to delete a cursor which 11700 /* If row is completely invisible, don't attempt to delete a cursor which
11701 isn't there. This can happen if cursor is at top of a window, and 11701 isn't there. This can happen if cursor is at top of a window, and
11702 we switch to a buffer with a header line in that window. */ 11702 we switch to a buffer with a header line in that window. */
11703 if (cursor_row->visible_height <= 0) 11703 if (cursor_row->visible_height <= 0)
11704 goto mark_cursor_off; 11704 goto mark_cursor_off;
11705 11705
11706 /* This can happen when the new row is shorter than the old one. 11706 /* This can happen when the new row is shorter than the old one.
11707 In this case, either x_draw_glyphs or clear_end_of_line 11707 In this case, either x_draw_glyphs or clear_end_of_line
11708 should have cleared the cursor. Note that we wouldn't be 11708 should have cleared the cursor. Note that we wouldn't be
@@ -11710,7 +11710,7 @@ x_erase_phys_cursor (w)
11710 cursor glyph at hand. */ 11710 cursor glyph at hand. */
11711 if (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA]) 11711 if (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA])
11712 goto mark_cursor_off; 11712 goto mark_cursor_off;
11713 11713
11714 /* If the cursor is in the mouse face area, redisplay that when 11714 /* If the cursor is in the mouse face area, redisplay that when
11715 we clear the cursor. */ 11715 we clear the cursor. */
11716 if (! NILP (dpyinfo->mouse_face_window) 11716 if (! NILP (dpyinfo->mouse_face_window)
@@ -11738,7 +11738,7 @@ x_erase_phys_cursor (w)
11738 goto mark_cursor_off; 11738 goto mark_cursor_off;
11739 11739
11740 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 11740 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
11741 11741
11742 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 11742 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
11743 x, 11743 x,
11744 WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, 11744 WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height,
@@ -11747,7 +11747,7 @@ x_erase_phys_cursor (w)
11747 cursor_row->visible_height, 11747 cursor_row->visible_height,
11748 False); 11748 False);
11749 } 11749 }
11750 11750
11751 /* Erase the cursor by redrawing the character underneath it. */ 11751 /* Erase the cursor by redrawing the character underneath it. */
11752 if (mouse_face_here_p) 11752 if (mouse_face_here_p)
11753 hl = DRAW_MOUSE_FACE; 11753 hl = DRAW_MOUSE_FACE;
@@ -11769,7 +11769,7 @@ cursor_in_mouse_face_p (w)
11769{ 11769{
11770 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); 11770 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame));
11771 int in_mouse_face = 0; 11771 int in_mouse_face = 0;
11772 11772
11773 if (WINDOWP (dpyinfo->mouse_face_window) 11773 if (WINDOWP (dpyinfo->mouse_face_window)
11774 && XWINDOW (dpyinfo->mouse_face_window) == w) 11774 && XWINDOW (dpyinfo->mouse_face_window) == w)
11775 { 11775 {
@@ -11823,8 +11823,8 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
11823 current_glyphs = w->current_matrix; 11823 current_glyphs = w->current_matrix;
11824 glyph_row = MATRIX_ROW (current_glyphs, vpos); 11824 glyph_row = MATRIX_ROW (current_glyphs, vpos);
11825 glyph = glyph_row->glyphs[TEXT_AREA] + hpos; 11825 glyph = glyph_row->glyphs[TEXT_AREA] + hpos;
11826 11826
11827 /* If cursor row is not enabled, we don't really know where to 11827 /* If cursor row is not enabled, we don't really know where to
11828 display the cursor. */ 11828 display the cursor. */
11829 if (!glyph_row->enabled_p) 11829 if (!glyph_row->enabled_p)
11830 { 11830 {
@@ -11858,7 +11858,7 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
11858 { 11858 {
11859 w->phys_cursor_ascent = glyph_row->ascent; 11859 w->phys_cursor_ascent = glyph_row->ascent;
11860 w->phys_cursor_height = glyph_row->height; 11860 w->phys_cursor_height = glyph_row->height;
11861 11861
11862 /* Set phys_cursor_.* before x_draw_.* is called because some 11862 /* Set phys_cursor_.* before x_draw_.* is called because some
11863 of them may need the information. */ 11863 of them may need the information. */
11864 w->phys_cursor.x = x; 11864 w->phys_cursor.x = x;
@@ -11893,7 +11893,7 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
11893 default: 11893 default:
11894 abort (); 11894 abort ();
11895 } 11895 }
11896 11896
11897#ifdef HAVE_X_I18N 11897#ifdef HAVE_X_I18N
11898 if (w == XWINDOW (f->selected_window)) 11898 if (w == XWINDOW (f->selected_window))
11899 if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMPreeditPosition)) 11899 if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMPreeditPosition))
@@ -12188,10 +12188,10 @@ x_trace_wire ()
12188 12188
12189/* Handle SIGPIPE, which can happen when the connection to a server 12189/* Handle SIGPIPE, which can happen when the connection to a server
12190 simply goes away. SIGPIPE is handled by x_connection_signal. 12190 simply goes away. SIGPIPE is handled by x_connection_signal.
12191 Don't need to do anything, because the write which caused the 12191 Don't need to do anything, because the write which caused the
12192 SIGPIPE will fail, causing Xlib to invoke the X IO error handler, 12192 SIGPIPE will fail, causing Xlib to invoke the X IO error handler,
12193 which will do the appropriate cleanup for us. */ 12193 which will do the appropriate cleanup for us. */
12194 12194
12195static SIGTYPE 12195static SIGTYPE
12196x_connection_signal (signalnum) /* If we don't have an argument, */ 12196x_connection_signal (signalnum) /* If we don't have an argument, */
12197 int signalnum; /* some compilers complain in signal calls. */ 12197 int signalnum; /* some compilers complain in signal calls. */
@@ -12234,17 +12234,17 @@ x_connection_closed (dpy, error_message)
12234 struct x_display_info *dpyinfo = x_display_info_for_display (dpy); 12234 struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
12235 Lisp_Object frame, tail; 12235 Lisp_Object frame, tail;
12236 int count; 12236 int count;
12237 12237
12238 error_msg = (char *) alloca (strlen (error_message) + 1); 12238 error_msg = (char *) alloca (strlen (error_message) + 1);
12239 strcpy (error_msg, error_message); 12239 strcpy (error_msg, error_message);
12240 handling_signal = 0; 12240 handling_signal = 0;
12241 12241
12242 /* Prevent being called recursively because of an error condition 12242 /* Prevent being called recursively because of an error condition
12243 below. Otherwise, we might end up with printing ``can't find per 12243 below. Otherwise, we might end up with printing ``can't find per
12244 display information'' in the recursive call instead of printing 12244 display information'' in the recursive call instead of printing
12245 the original message here. */ 12245 the original message here. */
12246 count = x_catch_errors (dpy); 12246 count = x_catch_errors (dpy);
12247 12247
12248 /* We have to close the display to inform Xt that it doesn't 12248 /* We have to close the display to inform Xt that it doesn't
12249 exist anymore. If we don't, Xt will continue to wait for 12249 exist anymore. If we don't, Xt will continue to wait for
12250 events from the display. As a consequence, a sequence of 12250 events from the display. As a consequence, a sequence of
@@ -12259,7 +12259,7 @@ x_connection_closed (dpy, error_message)
12259 Closing the display is reported to lead to a bus error on 12259 Closing the display is reported to lead to a bus error on
12260 OpenWindows in certain situations. I suspect that is a bug 12260 OpenWindows in certain situations. I suspect that is a bug
12261 in OpenWindows. I don't know how to cicumvent it here. */ 12261 in OpenWindows. I don't know how to cicumvent it here. */
12262 12262
12263#ifdef USE_X_TOOLKIT 12263#ifdef USE_X_TOOLKIT
12264 /* If DPYINFO is null, this means we didn't open the display 12264 /* If DPYINFO is null, this means we didn't open the display
12265 in the first place, so don't try to close it. */ 12265 in the first place, so don't try to close it. */
@@ -12307,7 +12307,7 @@ x_connection_closed (dpy, error_message)
12307 x_delete_display (dpyinfo); 12307 x_delete_display (dpyinfo);
12308 12308
12309 x_uncatch_errors (dpy, count); 12309 x_uncatch_errors (dpy, count);
12310 12310
12311 if (x_display_list == 0) 12311 if (x_display_list == 0)
12312 { 12312 {
12313 fprintf (stderr, "%s\n", error_msg); 12313 fprintf (stderr, "%s\n", error_msg);
@@ -12475,7 +12475,7 @@ x_new_fontset (f, fontsetname)
12475 && (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea))) 12475 && (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea)))
12476 xic_set_xfontset (f, SDATA (fontset_ascii (fontset))); 12476 xic_set_xfontset (f, SDATA (fontset_ascii (fontset)));
12477#endif 12477#endif
12478 12478
12479 return build_string (fontsetname); 12479 return build_string (fontsetname);
12480} 12480}
12481 12481
@@ -12584,9 +12584,9 @@ xim_destroy_callback (xim, client_data, call_data)
12584{ 12584{
12585 struct x_display_info *dpyinfo = (struct x_display_info *) client_data; 12585 struct x_display_info *dpyinfo = (struct x_display_info *) client_data;
12586 Lisp_Object frame, tail; 12586 Lisp_Object frame, tail;
12587 12587
12588 BLOCK_INPUT; 12588 BLOCK_INPUT;
12589 12589
12590 /* No need to call XDestroyIC.. */ 12590 /* No need to call XDestroyIC.. */
12591 FOR_EACH_FRAME (tail, frame) 12591 FOR_EACH_FRAME (tail, frame)
12592 { 12592 {
@@ -12601,7 +12601,7 @@ xim_destroy_callback (xim, client_data, call_data)
12601 } 12601 }
12602 } 12602 }
12603 } 12603 }
12604 12604
12605 /* No need to call XCloseIM. */ 12605 /* No need to call XCloseIM. */
12606 dpyinfo->xim = NULL; 12606 dpyinfo->xim = NULL;
12607 XFree (dpyinfo->xim_styles); 12607 XFree (dpyinfo->xim_styles);
@@ -12629,10 +12629,10 @@ xim_open_dpy (dpyinfo, resource_name)
12629#ifdef HAVE_X11R6 12629#ifdef HAVE_X11R6
12630 XIMCallback destroy; 12630 XIMCallback destroy;
12631#endif 12631#endif
12632 12632
12633 /* Get supported styles and XIM values. */ 12633 /* Get supported styles and XIM values. */
12634 XGetIMValues (xim, XNQueryInputStyle, &dpyinfo->xim_styles, NULL); 12634 XGetIMValues (xim, XNQueryInputStyle, &dpyinfo->xim_styles, NULL);
12635 12635
12636#ifdef HAVE_X11R6 12636#ifdef HAVE_X11R6
12637 destroy.callback = xim_destroy_callback; 12637 destroy.callback = xim_destroy_callback;
12638 destroy.client_data = (XPointer)dpyinfo; 12638 destroy.client_data = (XPointer)dpyinfo;
@@ -12640,7 +12640,7 @@ xim_open_dpy (dpyinfo, resource_name)
12640 XSetIMValues (xim, XNDestroyCallback, &destroy, NULL); 12640 XSetIMValues (xim, XNDestroyCallback, &destroy, NULL);
12641#endif 12641#endif
12642 } 12642 }
12643 12643
12644#else /* not USE_XIM */ 12644#else /* not USE_XIM */
12645 dpyinfo->xim = NULL; 12645 dpyinfo->xim = NULL;
12646#endif /* not USE_XIM */ 12646#endif /* not USE_XIM */
@@ -12672,7 +12672,7 @@ xim_instantiate_callback (display, client_data, call_data)
12672 /* We don't support multiple XIM connections. */ 12672 /* We don't support multiple XIM connections. */
12673 if (dpyinfo->xim) 12673 if (dpyinfo->xim)
12674 return; 12674 return;
12675 12675
12676 xim_open_dpy (dpyinfo, xim_inst->resource_name); 12676 xim_open_dpy (dpyinfo, xim_inst->resource_name);
12677 12677
12678 /* Create XIC for the existing frames on the same display, as long 12678 /* Create XIC for the existing frames on the same display, as long
@@ -12685,7 +12685,7 @@ xim_instantiate_callback (display, client_data, call_data)
12685 FOR_EACH_FRAME (tail, frame) 12685 FOR_EACH_FRAME (tail, frame)
12686 { 12686 {
12687 struct frame *f = XFRAME (frame); 12687 struct frame *f = XFRAME (frame);
12688 12688
12689 if (FRAME_X_DISPLAY_INFO (f) == xim_inst->dpyinfo) 12689 if (FRAME_X_DISPLAY_INFO (f) == xim_inst->dpyinfo)
12690 if (FRAME_XIC (f) == NULL) 12690 if (FRAME_XIC (f) == NULL)
12691 { 12691 {
@@ -12699,7 +12699,7 @@ xim_instantiate_callback (display, client_data, call_data)
12699 } 12699 }
12700 } 12700 }
12701 } 12701 }
12702 12702
12703 UNBLOCK_INPUT; 12703 UNBLOCK_INPUT;
12704 } 12704 }
12705} 12705}
@@ -12721,7 +12721,7 @@ xim_initialize (dpyinfo, resource_name)
12721#ifdef HAVE_X11R6_XIM 12721#ifdef HAVE_X11R6_XIM
12722 struct xim_inst_t *xim_inst; 12722 struct xim_inst_t *xim_inst;
12723 int len; 12723 int len;
12724 12724
12725 dpyinfo->xim = NULL; 12725 dpyinfo->xim = NULL;
12726 xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t)); 12726 xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t));
12727 xim_inst->dpyinfo = dpyinfo; 12727 xim_inst->dpyinfo = dpyinfo;
@@ -12739,7 +12739,7 @@ xim_initialize (dpyinfo, resource_name)
12739 dpyinfo->xim = NULL; 12739 dpyinfo->xim = NULL;
12740 xim_open_dpy (dpyinfo, resource_name); 12740 xim_open_dpy (dpyinfo, resource_name);
12741#endif /* not HAVE_X11R6_XIM */ 12741#endif /* not HAVE_X11R6_XIM */
12742 12742
12743#else /* not USE_XIM */ 12743#else /* not USE_XIM */
12744 dpyinfo->xim = NULL; 12744 dpyinfo->xim = NULL;
12745#endif /* not USE_XIM */ 12745#endif /* not USE_XIM */
@@ -12861,7 +12861,7 @@ x_calc_absolute_position (f)
12861 12861
12862 It's not obvious where the initial small difference comes from. 12862 It's not obvious where the initial small difference comes from.
12863 2000-12-01, gerd. */ 12863 2000-12-01, gerd. */
12864 12864
12865 XtVaGetValues (f->output_data.x->column_widget, XtNheight, &height, NULL); 12865 XtVaGetValues (f->output_data.x->column_widget, XtNheight, &height, NULL);
12866#endif 12866#endif
12867 12867
@@ -12872,7 +12872,7 @@ x_calc_absolute_position (f)
12872 - height 12872 - height
12873 + f->output_data.x->top_pos); 12873 + f->output_data.x->top_pos);
12874 } 12874 }
12875 12875
12876 /* The left_pos and top_pos 12876 /* The left_pos and top_pos
12877 are now relative to the top and left screen edges, 12877 are now relative to the top and left screen edges,
12878 so the flags should correspond. */ 12878 so the flags should correspond. */
@@ -12941,12 +12941,12 @@ x_check_fullscreen (f)
12941 if (f->output_data.x->want_fullscreen & FULLSCREEN_BOTH) 12941 if (f->output_data.x->want_fullscreen & FULLSCREEN_BOTH)
12942 { 12942 {
12943 int width, height, ign; 12943 int width, height, ign;
12944 12944
12945 x_real_positions (f, &f->output_data.x->left_pos, 12945 x_real_positions (f, &f->output_data.x->left_pos,
12946 &f->output_data.x->top_pos); 12946 &f->output_data.x->top_pos);
12947 12947
12948 x_fullscreen_adjust (f, &width, &height, &ign, &ign); 12948 x_fullscreen_adjust (f, &width, &height, &ign, &ign);
12949 12949
12950 /* We do not need to move the window, it shall be taken care of 12950 /* We do not need to move the window, it shall be taken care of
12951 when setting WM manager hints. 12951 when setting WM manager hints.
12952 If the frame is visible already, the position is checked by 12952 If the frame is visible already, the position is checked by
@@ -12959,7 +12959,7 @@ x_check_fullscreen (f)
12959 12959
12960 /* Wait for the change of frame size to occur */ 12960 /* Wait for the change of frame size to occur */
12961 f->output_data.x->want_fullscreen |= FULLSCREEN_WAIT; 12961 f->output_data.x->want_fullscreen |= FULLSCREEN_WAIT;
12962 12962
12963 } 12963 }
12964 } 12964 }
12965} 12965}
@@ -12983,7 +12983,7 @@ x_check_fullscreen_move (f)
12983 expect_top = 0; 12983 expect_top = 0;
12984 if (f->output_data.x->want_fullscreen & FULLSCREEN_WIDTH) 12984 if (f->output_data.x->want_fullscreen & FULLSCREEN_WIDTH)
12985 expect_left = 0; 12985 expect_left = 0;
12986 12986
12987 if (expect_top != f->output_data.x->top_pos 12987 if (expect_top != f->output_data.x->top_pos
12988 || expect_left != f->output_data.x->left_pos) 12988 || expect_left != f->output_data.x->left_pos)
12989 x_set_offset (f, expect_left, expect_top, 1); 12989 x_set_offset (f, expect_left, expect_top, 1);
@@ -13011,11 +13011,11 @@ x_fullscreen_adjust (f, width, height, top_pos, left_pos)
13011 13011
13012 *top_pos = f->output_data.x->top_pos; 13012 *top_pos = f->output_data.x->top_pos;
13013 *left_pos = f->output_data.x->left_pos; 13013 *left_pos = f->output_data.x->left_pos;
13014 13014
13015 if (f->output_data.x->want_fullscreen & FULLSCREEN_HEIGHT) 13015 if (f->output_data.x->want_fullscreen & FULLSCREEN_HEIGHT)
13016 { 13016 {
13017 int ph; 13017 int ph;
13018 13018
13019 ph = FRAME_X_DISPLAY_INFO (f)->height; 13019 ph = FRAME_X_DISPLAY_INFO (f)->height;
13020 newheight = PIXEL_TO_CHAR_HEIGHT (f, ph); 13020 newheight = PIXEL_TO_CHAR_HEIGHT (f, ph);
13021 ph = CHAR_TO_PIXEL_HEIGHT (f, newheight) 13021 ph = CHAR_TO_PIXEL_HEIGHT (f, newheight)
@@ -13027,7 +13027,7 @@ x_fullscreen_adjust (f, width, height, top_pos, left_pos)
13027 if (f->output_data.x->want_fullscreen & FULLSCREEN_WIDTH) 13027 if (f->output_data.x->want_fullscreen & FULLSCREEN_WIDTH)
13028 { 13028 {
13029 int pw; 13029 int pw;
13030 13030
13031 pw = FRAME_X_DISPLAY_INFO (f)->width; 13031 pw = FRAME_X_DISPLAY_INFO (f)->width;
13032 newwidth = PIXEL_TO_CHAR_WIDTH (f, pw); 13032 newwidth = PIXEL_TO_CHAR_WIDTH (f, pw);
13033 pw = CHAR_TO_PIXEL_WIDTH (f, newwidth) 13033 pw = CHAR_TO_PIXEL_WIDTH (f, newwidth)
@@ -13115,7 +13115,7 @@ x_set_window_size (f, change_gravity, cols, rows)
13115 BLOCK_INPUT; 13115 BLOCK_INPUT;
13116 13116
13117#ifdef USE_X_TOOLKIT 13117#ifdef USE_X_TOOLKIT
13118 13118
13119 if (f->output_data.x->widget != NULL) 13119 if (f->output_data.x->widget != NULL)
13120 { 13120 {
13121 /* The x and y position of the widget is clobbered by the 13121 /* The x and y position of the widget is clobbered by the
@@ -13130,18 +13130,18 @@ x_set_window_size (f, change_gravity, cols, rows)
13130 } 13130 }
13131 else 13131 else
13132 x_set_window_size_1 (f, change_gravity, cols, rows); 13132 x_set_window_size_1 (f, change_gravity, cols, rows);
13133 13133
13134#else /* not USE_X_TOOLKIT */ 13134#else /* not USE_X_TOOLKIT */
13135 13135
13136 x_set_window_size_1 (f, change_gravity, cols, rows); 13136 x_set_window_size_1 (f, change_gravity, cols, rows);
13137 13137
13138#endif /* not USE_X_TOOLKIT */ 13138#endif /* not USE_X_TOOLKIT */
13139 13139
13140 /* If cursor was outside the new size, mark it as off. */ 13140 /* If cursor was outside the new size, mark it as off. */
13141 mark_window_cursors_off (XWINDOW (f->root_window)); 13141 mark_window_cursors_off (XWINDOW (f->root_window));
13142 13142
13143 /* Clear out any recollection of where the mouse highlighting was, 13143 /* Clear out any recollection of where the mouse highlighting was,
13144 since it might be in a place that's outside the new frame size. 13144 since it might be in a place that's outside the new frame size.
13145 Actually checking whether it is outside is a pain in the neck, 13145 Actually checking whether it is outside is a pain in the neck,
13146 so don't try--just let the highlighting be done afresh with new size. */ 13146 so don't try--just let the highlighting be done afresh with new size. */
13147 cancel_mouse_face (f); 13147 cancel_mouse_face (f);
@@ -13357,7 +13357,7 @@ x_make_frame_visible (f)
13357 Drawable rootw; 13357 Drawable rootw;
13358 int x, y; 13358 int x, y;
13359 unsigned int width, height, border, depth; 13359 unsigned int width, height, border, depth;
13360 13360
13361 BLOCK_INPUT; 13361 BLOCK_INPUT;
13362 13362
13363 /* On some window managers (such as FVWM) moving an existing 13363 /* On some window managers (such as FVWM) moving an existing
@@ -13420,7 +13420,7 @@ x_make_frame_visible (f)
13420 FreeBSD, Linux and Solaris. It turns out that, for some 13420 FreeBSD, Linux and Solaris. It turns out that, for some
13421 unknown reason, the call to XtMapWidget is completely ignored. 13421 unknown reason, the call to XtMapWidget is completely ignored.
13422 Mapping the widget a second time works. */ 13422 Mapping the widget a second time works. */
13423 13423
13424 if (!FRAME_VISIBLE_P (f) && --retry_count > 0) 13424 if (!FRAME_VISIBLE_P (f) && --retry_count > 0)
13425 goto retry; 13425 goto retry;
13426 } 13426 }
@@ -13697,7 +13697,7 @@ x_free_frame_resources (f)
13697 13697
13698 if (FRAME_FACE_CACHE (f)) 13698 if (FRAME_FACE_CACHE (f))
13699 free_frame_faces (f); 13699 free_frame_faces (f);
13700 13700
13701 x_free_gcs (f); 13701 x_free_gcs (f);
13702 XFlush (FRAME_X_DISPLAY (f)); 13702 XFlush (FRAME_X_DISPLAY (f));
13703 } 13703 }
@@ -13707,7 +13707,7 @@ x_free_frame_resources (f)
13707 13707
13708 xfree (f->output_data.x); 13708 xfree (f->output_data.x);
13709 f->output_data.x = NULL; 13709 f->output_data.x = NULL;
13710 13710
13711 if (f == dpyinfo->x_focus_frame) 13711 if (f == dpyinfo->x_focus_frame)
13712 dpyinfo->x_focus_frame = 0; 13712 dpyinfo->x_focus_frame = 0;
13713 if (f == dpyinfo->x_focus_event_frame) 13713 if (f == dpyinfo->x_focus_event_frame)
@@ -13961,7 +13961,7 @@ x_wm_set_icon_pixmap (f, pixmap_id)
13961 } 13961 }
13962 13962
13963#else /* not USE_X_TOOLKIT */ 13963#else /* not USE_X_TOOLKIT */
13964 13964
13965 f->output_data.x->wm_hints.flags |= IconPixmapHint; 13965 f->output_data.x->wm_hints.flags |= IconPixmapHint;
13966 XSetWMHints (FRAME_X_DISPLAY (f), window, &f->output_data.x->wm_hints); 13966 XSetWMHints (FRAME_X_DISPLAY (f), window, &f->output_data.x->wm_hints);
13967 13967
@@ -14141,7 +14141,7 @@ x_list_fonts (f, pattern, size, maxnames)
14141 int width = 0; 14141 int width = 0;
14142 char *p = names[i]; 14142 char *p = names[i];
14143 int average_width = -1, dashes = 0; 14143 int average_width = -1, dashes = 0;
14144 14144
14145 /* Count the number of dashes in NAMES[I]. If there are 14145 /* Count the number of dashes in NAMES[I]. If there are
14146 14 dashes, and the field value following 12th dash 14146 14 dashes, and the field value following 12th dash
14147 (AVERAGE_WIDTH) is 0, this is a auto-scaled font which 14147 (AVERAGE_WIDTH) is 0, this is a auto-scaled font which
@@ -14156,7 +14156,7 @@ x_list_fonts (f, pattern, size, maxnames)
14156 else if (dashes == 12) /* AVERAGE_WIDTH field */ 14156 else if (dashes == 12) /* AVERAGE_WIDTH field */
14157 average_width = atoi (p); 14157 average_width = atoi (p);
14158 } 14158 }
14159 14159
14160 if (allow_scalable_fonts_p 14160 if (allow_scalable_fonts_p
14161 || dashes < 14 || average_width != 0) 14161 || dashes < 14 || average_width != 0)
14162 { 14162 {
@@ -14176,7 +14176,7 @@ x_list_fonts (f, pattern, size, maxnames)
14176 } 14176 }
14177 } 14177 }
14178 } 14178 }
14179 14179
14180 if (!try_XLoadQueryFont) 14180 if (!try_XLoadQueryFont)
14181 { 14181 {
14182 BLOCK_INPUT; 14182 BLOCK_INPUT;
@@ -14276,7 +14276,7 @@ x_list_fonts (f, pattern, size, maxnames)
14276 } 14276 }
14277 14277
14278 return newlist; 14278 return newlist;
14279} 14279}
14280 14280
14281 14281
14282#if GLYPH_DEBUG 14282#if GLYPH_DEBUG
@@ -14295,7 +14295,7 @@ x_check_font (f, font)
14295 xassert (font != NULL); 14295 xassert (font != NULL);
14296 14296
14297 for (i = 0; i < dpyinfo->n_fonts; i++) 14297 for (i = 0; i < dpyinfo->n_fonts; i++)
14298 if (dpyinfo->font_table[i].name 14298 if (dpyinfo->font_table[i].name
14299 && font == dpyinfo->font_table[i].font) 14299 && font == dpyinfo->font_table[i].font)
14300 break; 14300 break;
14301 14301
@@ -14341,20 +14341,20 @@ x_compute_min_glyph_bounds (f)
14341 XFontStruct *font; 14341 XFontStruct *font;
14342 int old_width = dpyinfo->smallest_char_width; 14342 int old_width = dpyinfo->smallest_char_width;
14343 int old_height = dpyinfo->smallest_font_height; 14343 int old_height = dpyinfo->smallest_font_height;
14344 14344
14345 dpyinfo->smallest_font_height = 100000; 14345 dpyinfo->smallest_font_height = 100000;
14346 dpyinfo->smallest_char_width = 100000; 14346 dpyinfo->smallest_char_width = 100000;
14347 14347
14348 for (i = 0; i < dpyinfo->n_fonts; ++i) 14348 for (i = 0; i < dpyinfo->n_fonts; ++i)
14349 if (dpyinfo->font_table[i].name) 14349 if (dpyinfo->font_table[i].name)
14350 { 14350 {
14351 struct font_info *fontp = dpyinfo->font_table + i; 14351 struct font_info *fontp = dpyinfo->font_table + i;
14352 int w, h; 14352 int w, h;
14353 14353
14354 font = (XFontStruct *) fontp->font; 14354 font = (XFontStruct *) fontp->font;
14355 xassert (font != (XFontStruct *) ~0); 14355 xassert (font != (XFontStruct *) ~0);
14356 x_font_min_bounds (font, &w, &h); 14356 x_font_min_bounds (font, &w, &h);
14357 14357
14358 dpyinfo->smallest_font_height = min (dpyinfo->smallest_font_height, h); 14358 dpyinfo->smallest_font_height = min (dpyinfo->smallest_font_height, h);
14359 dpyinfo->smallest_char_width = min (dpyinfo->smallest_char_width, w); 14359 dpyinfo->smallest_char_width = min (dpyinfo->smallest_char_width, w);
14360 } 14360 }
@@ -14489,7 +14489,7 @@ x_load_font (f, fontname, size)
14489 14489
14490 XFree (name); 14490 XFree (name);
14491 } 14491 }
14492 14492
14493 if (full_name != 0) 14493 if (full_name != 0)
14494 fontp->full_name = full_name; 14494 fontp->full_name = full_name;
14495 else 14495 else
@@ -14621,7 +14621,7 @@ x_find_ccl_program (fontp)
14621 >= 0))) 14621 >= 0)))
14622 break; 14622 break;
14623 } 14623 }
14624 14624
14625 if (! NILP (list)) 14625 if (! NILP (list))
14626 { 14626 {
14627 struct ccl_program *ccl 14627 struct ccl_program *ccl
@@ -14824,7 +14824,7 @@ x_term_init (display_name, xrm_option, resource_name)
14824 dpyinfo->next = x_display_list; 14824 dpyinfo->next = x_display_list;
14825 x_display_list = dpyinfo; 14825 x_display_list = dpyinfo;
14826 14826
14827 /* Put it on x_display_name_list as well, to keep them parallel. */ 14827 /* Put it on x_display_name_list as well, to keep them parallel. */
14828 x_display_name_list = Fcons (Fcons (display_name, Qnil), 14828 x_display_name_list = Fcons (Fcons (display_name, Qnil),
14829 x_display_name_list); 14829 x_display_name_list);
14830 dpyinfo->name_list_element = XCAR (x_display_name_list); 14830 dpyinfo->name_list_element = XCAR (x_display_name_list);
@@ -14911,7 +14911,7 @@ x_term_init (display_name, xrm_option, resource_name)
14911 else 14911 else
14912 dpyinfo->cmap = XCreateColormap (dpyinfo->display, dpyinfo->root_window, 14912 dpyinfo->cmap = XCreateColormap (dpyinfo->display, dpyinfo->root_window,
14913 dpyinfo->visual, AllocNone); 14913 dpyinfo->visual, AllocNone);
14914 14914
14915 { 14915 {
14916 int screen_number = XScreenNumberOfScreen (dpyinfo->screen); 14916 int screen_number = XScreenNumberOfScreen (dpyinfo->screen);
14917 double pixels = DisplayHeight (dpyinfo->display, screen_number); 14917 double pixels = DisplayHeight (dpyinfo->display, screen_number);
@@ -14921,7 +14921,7 @@ x_term_init (display_name, xrm_option, resource_name)
14921 mm = DisplayWidthMM (dpyinfo->display, screen_number); 14921 mm = DisplayWidthMM (dpyinfo->display, screen_number);
14922 dpyinfo->resx = pixels * 25.4 / mm; 14922 dpyinfo->resx = pixels * 25.4 / mm;
14923 } 14923 }
14924 14924
14925 dpyinfo->Xatom_wm_protocols 14925 dpyinfo->Xatom_wm_protocols
14926 = XInternAtom (dpyinfo->display, "WM_PROTOCOLS", False); 14926 = XInternAtom (dpyinfo->display, "WM_PROTOCOLS", False);
14927 dpyinfo->Xatom_wm_take_focus 14927 dpyinfo->Xatom_wm_take_focus
@@ -14975,7 +14975,7 @@ x_term_init (display_name, xrm_option, resource_name)
14975 /* Ghostscript support. */ 14975 /* Ghostscript support. */
14976 dpyinfo->Xatom_PAGE = XInternAtom (dpyinfo->display, "PAGE", False); 14976 dpyinfo->Xatom_PAGE = XInternAtom (dpyinfo->display, "PAGE", False);
14977 dpyinfo->Xatom_DONE = XInternAtom (dpyinfo->display, "DONE", False); 14977 dpyinfo->Xatom_DONE = XInternAtom (dpyinfo->display, "DONE", False);
14978 14978
14979 dpyinfo->Xatom_Scrollbar = XInternAtom (dpyinfo->display, "SCROLLBAR", 14979 dpyinfo->Xatom_Scrollbar = XInternAtom (dpyinfo->display, "SCROLLBAR",
14980 False); 14980 False);
14981 14981
@@ -14990,7 +14990,7 @@ x_term_init (display_name, xrm_option, resource_name)
14990 null_bits[0] = 0x00; 14990 null_bits[0] = 0x00;
14991 14991
14992 dpyinfo->null_pixel 14992 dpyinfo->null_pixel
14993 = XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window, 14993 = XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window,
14994 null_bits, 1, 1, (long) 0, (long) 0, 14994 null_bits, 1, 1, (long) 0, (long) 0,
14995 1); 14995 1);
14996 } 14996 }
@@ -15008,7 +15008,7 @@ x_term_init (display_name, xrm_option, resource_name)
15008#ifdef HAVE_X_I18N 15008#ifdef HAVE_X_I18N
15009 xim_initialize (dpyinfo, resource_name); 15009 xim_initialize (dpyinfo, resource_name);
15010#endif 15010#endif
15011 15011
15012#ifdef subprocesses 15012#ifdef subprocesses
15013 /* This is only needed for distinguishing keyboard and process input. */ 15013 /* This is only needed for distinguishing keyboard and process input. */
15014 if (connection != 0) 15014 if (connection != 0)
@@ -15040,7 +15040,7 @@ x_term_init (display_name, xrm_option, resource_name)
15040 XrmValue d, fr, to; 15040 XrmValue d, fr, to;
15041 Font font; 15041 Font font;
15042 int count; 15042 int count;
15043 15043
15044 d.addr = (XPointer)&dpy; 15044 d.addr = (XPointer)&dpy;
15045 d.size = sizeof (Display *); 15045 d.size = sizeof (Display *);
15046 fr.addr = XtDefaultFont; 15046 fr.addr = XtDefaultFont;
@@ -15070,7 +15070,7 @@ x_term_init (display_name, xrm_option, resource_name)
15070 || !strcmp (SDATA (value), "on"))) 15070 || !strcmp (SDATA (value), "on")))
15071 XSynchronize (dpyinfo->display, True); 15071 XSynchronize (dpyinfo->display, True);
15072 } 15072 }
15073 15073
15074 UNBLOCK_INPUT; 15074 UNBLOCK_INPUT;
15075 15075
15076 return dpyinfo; 15076 return dpyinfo;
@@ -15133,7 +15133,7 @@ x_delete_display (dpyinfo)
15133 if (dpyinfo->xim) 15133 if (dpyinfo->xim)
15134 xim_close_dpy (dpyinfo); 15134 xim_close_dpy (dpyinfo);
15135#endif 15135#endif
15136 15136
15137 xfree (dpyinfo->font_table); 15137 xfree (dpyinfo->font_table);
15138 xfree (dpyinfo->x_id_name); 15138 xfree (dpyinfo->x_id_name);
15139 xfree (dpyinfo->color_cells); 15139 xfree (dpyinfo->color_cells);
@@ -15196,7 +15196,7 @@ x_initialize ()
15196 x_noop_count = 0; 15196 x_noop_count = 0;
15197 last_tool_bar_item = -1; 15197 last_tool_bar_item = -1;
15198 any_help_event_p = 0; 15198 any_help_event_p = 0;
15199 15199
15200 /* Try to use interrupt input; if we can't, then start polling. */ 15200 /* Try to use interrupt input; if we can't, then start polling. */
15201 Fset_input_mode (Qt, Qnil, Qt, Qnil); 15201 Fset_input_mode (Qt, Qnil, Qt, Qnil);
15202 15202
@@ -15204,7 +15204,7 @@ x_initialize ()
15204 XtToolkitInitialize (); 15204 XtToolkitInitialize ();
15205 15205
15206 Xt_app_con = XtCreateApplicationContext (); 15206 Xt_app_con = XtCreateApplicationContext ();
15207 15207
15208 /* Register a converter from strings to pixels, which uses 15208 /* Register a converter from strings to pixels, which uses
15209 Emacs' color allocation infrastructure. */ 15209 Emacs' color allocation infrastructure. */
15210 XtAppSetTypeConverter (Xt_app_con, 15210 XtAppSetTypeConverter (Xt_app_con,
@@ -15226,7 +15226,7 @@ x_initialize ()
15226 start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0); 15226 start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0);
15227 } 15227 }
15228#endif 15228#endif
15229 15229
15230#ifdef USE_TOOLKIT_SCROLL_BARS 15230#ifdef USE_TOOLKIT_SCROLL_BARS
15231 xaw3d_arrow_scroll = False; 15231 xaw3d_arrow_scroll = False;
15232 xaw3d_pick_top = True; 15232 xaw3d_pick_top = True;
@@ -15319,7 +15319,7 @@ Otherwise, value is a symbol describing the X toolkit. */);
15319 15319
15320 staticpro (&last_mouse_motion_frame); 15320 staticpro (&last_mouse_motion_frame);
15321 last_mouse_motion_frame = Qnil; 15321 last_mouse_motion_frame = Qnil;
15322 15322
15323 Qmodifier_value = intern ("modifier-value"); 15323 Qmodifier_value = intern ("modifier-value");
15324 Qalt = intern ("alt"); 15324 Qalt = intern ("alt");
15325 Fput (Qalt, Qmodifier_value, make_number (alt_modifier)); 15325 Fput (Qalt, Qmodifier_value, make_number (alt_modifier));
@@ -15329,28 +15329,28 @@ Otherwise, value is a symbol describing the X toolkit. */);
15329 Fput (Qmeta, Qmodifier_value, make_number (meta_modifier)); 15329 Fput (Qmeta, Qmodifier_value, make_number (meta_modifier));
15330 Qsuper = intern ("super"); 15330 Qsuper = intern ("super");
15331 Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); 15331 Fput (Qsuper, Qmodifier_value, make_number (super_modifier));
15332 15332
15333 DEFVAR_LISP ("x-alt-keysym", &Vx_alt_keysym, 15333 DEFVAR_LISP ("x-alt-keysym", &Vx_alt_keysym,
15334 doc: /* Which keys Emacs uses for the alt modifier. 15334 doc: /* Which keys Emacs uses for the alt modifier.
15335This should be one of the symbols `alt', `hyper', `meta', `super'. 15335This should be one of the symbols `alt', `hyper', `meta', `super'.
15336For example, `alt' means use the Alt_L and Alt_R keysyms. The default 15336For example, `alt' means use the Alt_L and Alt_R keysyms. The default
15337is nil, which is the same as `alt'. */); 15337is nil, which is the same as `alt'. */);
15338 Vx_alt_keysym = Qnil; 15338 Vx_alt_keysym = Qnil;
15339 15339
15340 DEFVAR_LISP ("x-hyper-keysym", &Vx_hyper_keysym, 15340 DEFVAR_LISP ("x-hyper-keysym", &Vx_hyper_keysym,
15341 doc: /* Which keys Emacs uses for the hyper modifier. 15341 doc: /* Which keys Emacs uses for the hyper modifier.
15342This should be one of the symbols `alt', `hyper', `meta', `super'. 15342This should be one of the symbols `alt', `hyper', `meta', `super'.
15343For example, `hyper' means use the Hyper_L and Hyper_R keysyms. The 15343For example, `hyper' means use the Hyper_L and Hyper_R keysyms. The
15344default is nil, which is the same as `hyper'. */); 15344default is nil, which is the same as `hyper'. */);
15345 Vx_hyper_keysym = Qnil; 15345 Vx_hyper_keysym = Qnil;
15346 15346
15347 DEFVAR_LISP ("x-meta-keysym", &Vx_meta_keysym, 15347 DEFVAR_LISP ("x-meta-keysym", &Vx_meta_keysym,
15348 doc: /* Which keys Emacs uses for the meta modifier. 15348 doc: /* Which keys Emacs uses for the meta modifier.
15349This should be one of the symbols `alt', `hyper', `meta', `super'. 15349This should be one of the symbols `alt', `hyper', `meta', `super'.
15350For example, `meta' means use the Meta_L and Meta_R keysyms. The 15350For example, `meta' means use the Meta_L and Meta_R keysyms. The
15351default is nil, which is the same as `meta'. */); 15351default is nil, which is the same as `meta'. */);
15352 Vx_meta_keysym = Qnil; 15352 Vx_meta_keysym = Qnil;
15353 15353
15354 DEFVAR_LISP ("x-super-keysym", &Vx_super_keysym, 15354 DEFVAR_LISP ("x-super-keysym", &Vx_super_keysym,
15355 doc: /* Which keys Emacs uses for the super modifier. 15355 doc: /* Which keys Emacs uses for the super modifier.
15356This should be one of the symbols `alt', `hyper', `meta', `super'. 15356This should be one of the symbols `alt', `hyper', `meta', `super'.