aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit26
-rw-r--r--src/ChangeLog.97
-rw-r--r--src/ChangeLog.trunk1495
-rw-r--r--src/Makefile.in17
-rw-r--r--src/alloc.c22
-rw-r--r--src/atimer.c6
-rw-r--r--src/buffer.c41
-rw-r--r--src/buffer.h17
-rw-r--r--src/callproc.c49
-rw-r--r--src/charset.c6
-rw-r--r--src/charset.h2
-rw-r--r--src/cmds.c8
-rw-r--r--src/coding.c29
-rw-r--r--src/config.in44
-rw-r--r--src/data.c15
-rw-r--r--src/dbusbind.c38
-rw-r--r--src/dispextern.h87
-rw-r--r--src/dispnew.c42
-rw-r--r--src/editfns.c4
-rw-r--r--src/emacs.c73
-rw-r--r--src/eval.c2
-rw-r--r--src/fileio.c14
-rw-r--r--src/filelock.c6
-rw-r--r--src/font.c19
-rw-r--r--src/font.h4
-rw-r--r--src/frame.c68
-rw-r--r--src/frame.h14
-rw-r--r--src/ftfont.c4
-rw-r--r--src/gnutls.c9
-rw-r--r--src/gtkutil.c99
-rw-r--r--src/image.c47
-rw-r--r--src/insdel.c6
-rw-r--r--src/intervals.c18
-rw-r--r--src/intervals.h4
-rw-r--r--src/keyboard.c278
-rw-r--r--src/keyboard.h4
-rw-r--r--src/lisp.h67
-rw-r--r--src/lread.c130
-rw-r--r--src/m/alpha.h7
-rw-r--r--src/m/amdx86-64.h7
-rw-r--r--src/m/arm.h22
-rw-r--r--src/m/hp800.h29
-rw-r--r--src/m/ia64.h7
-rw-r--r--src/m/ibms390.h7
-rw-r--r--src/m/ibms390x.h7
-rw-r--r--src/m/iris4d.h7
-rw-r--r--src/m/m68k.h7
-rw-r--r--src/m/mips.h29
-rw-r--r--src/m/sh3.h4
-rw-r--r--src/m/sparc.h4
-rw-r--r--src/m/template.h7
-rw-r--r--src/m/xtensa.h6
-rw-r--r--src/minibuf.c4
-rw-r--r--src/mktime.c30
-rw-r--r--src/msdos.c699
-rw-r--r--src/msdos.h1
-rw-r--r--src/nsfns.m28
-rw-r--r--src/nsfont.m8
-rw-r--r--src/nsimage.m4
-rw-r--r--src/nsmenu.m14
-rw-r--r--src/nsterm.h18
-rw-r--r--src/nsterm.m254
-rw-r--r--src/print.c2
-rw-r--r--src/process.c14
-rw-r--r--src/regex.c48
-rw-r--r--src/s/cygwin.h3
-rw-r--r--src/s/ms-w32.h1
-rw-r--r--src/sound.c2
-rw-r--r--src/strftime.c79
-rw-r--r--src/syntax.c15
-rw-r--r--src/sysdep.c47
-rw-r--r--src/systty.h54
-rw-r--r--src/term.c635
-rw-r--r--src/termchar.h48
-rw-r--r--src/termhooks.h5
-rw-r--r--src/unexcoff.c3
-rw-r--r--src/w16select.c48
-rw-r--r--src/w32.c6
-rw-r--r--src/w32fns.c157
-rw-r--r--src/w32font.c4
-rw-r--r--src/w32gui.h6
-rw-r--r--src/w32heap.c5
-rw-r--r--src/w32inevt.c7
-rw-r--r--src/w32proc.c7
-rw-r--r--src/w32select.c45
-rw-r--r--src/w32term.c236
-rw-r--r--src/w32term.h33
-rw-r--r--src/window.c234
-rw-r--r--src/window.h4
-rw-r--r--src/xdisp.c1850
-rw-r--r--src/xfaces.c13
-rw-r--r--src/xfns.c204
-rw-r--r--src/xftfont.c21
-rw-r--r--src/xmenu.c10
-rw-r--r--src/xml.c5
-rw-r--r--src/xrdb.c5
-rw-r--r--src/xselect.c26
-rw-r--r--src/xsettings.c10
-rw-r--r--src/xsmfns.c4
-rw-r--r--src/xterm.c556
-rw-r--r--src/xterm.h55
101 files changed, 5073 insertions, 3465 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index b3bb6b58267..73fecea5972 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -494,14 +494,30 @@ define pgx
494 end 494 end
495 # COMPOSITE_GLYPH 495 # COMPOSITE_GLYPH
496 if ($g->type == 1) 496 if ($g->type == 1)
497 printf "COMP[%d (%d..%d)]", $g->u.cmp.id, $g->u.cmp.from, $g->u.cmp.to 497 printf "COMP[%d (%d..%d)]", $g->u.cmp.id, $g->slice.cmp.from, $g->slice.cmp.to
498 end 498 end
499 # IMAGE_GLYPH 499 # GLYPHLESS_GLYPH
500 if ($g->type == 2) 500 if ($g->type == 2)
501 printf "GLYPHLESS["
502 if ($g->u.glyphless.method == 0)
503 printf "THIN]"
504 end
505 if ($g->u.glyphless.method == 1)
506 printf "EMPTY]"
507 end
508 if ($g->u.glyphless.method == 2)
509 printf "ACRO]"
510 end
511 if ($g->u.glyphless.method == 3)
512 printf "HEX]"
513 end
514 end
515 # IMAGE_GLYPH
516 if ($g->type == 3)
501 printf "IMAGE[%d]", $g->u.img_id 517 printf "IMAGE[%d]", $g->u.img_id
502 end 518 end
503 # STRETCH_GLYPH 519 # STRETCH_GLYPH
504 if ($g->type == 3) 520 if ($g->type == 4)
505 printf "STRETCH[%d+%d]", $g->u.stretch.height, $g->u.stretch.ascent 521 printf "STRETCH[%d+%d]", $g->u.stretch.height, $g->u.stretch.ascent
506 end 522 end
507 xgettype ($g->object) 523 xgettype ($g->object)
@@ -544,8 +560,8 @@ define pgx
544 if ($g->right_box_line_p) 560 if ($g->right_box_line_p)
545 printf " ]" 561 printf " ]"
546 end 562 end
547 if ($g->slice.x || $g->slice.y || $g->slice.width || $g->slice.height) 563 if ($g->slice.img.x || $g->slice.img.y || $g->slice.img.width || $g->slice.img.height)
548 printf " slice=%d,%d,%d,%d" ,$g->slice.x, $g->slice.y, $g->slice.width, $g->slice.height 564 printf " slice=%d,%d,%d,%d" ,$g->slice.img.x, $g->slice.img.y, $g->slice.img.width, $g->slice.img.height
549 end 565 end
550 printf "\n" 566 printf "\n"
551end 567end
diff --git a/src/ChangeLog.9 b/src/ChangeLog.9
index fc4f2d4ad37..3c3a5068939 100644
--- a/src/ChangeLog.9
+++ b/src/ChangeLog.9
@@ -12476,9 +12476,9 @@
12476 * atimer.c (stop_other_atimers): Don't call cancel_atimer because 12476 * atimer.c (stop_other_atimers): Don't call cancel_atimer because
12477 that unblocks alarms. 12477 that unblocks alarms.
12478 12478
12479 * alloc.c, bytecode.c, data.c, dispnew.c, ecrt0.c, editfns.c, 12479 * alloc.c, bytecode.c, data.c, dispnew.c, ecrt0.c, editfns.c:
12480 emacs.c, floatfns.c, fns.c, lread.c, print.c, config.in, lisp.h, 12480 * emacs.c, floatfns.c, fns.c, lread.c, print.c, config.in, lisp.h:
12481 Makefile.in: Remove `LISP_FLOAT_TYPE' and `standalone'. 12481 * Makefile.in: Remove `LISP_FLOAT_TYPE' and `standalone'.
12482 12482
12483 * frame.c (make_frame): Set frame initially to `garbaged'. 12483 * frame.c (make_frame): Set frame initially to `garbaged'.
12484 12484
@@ -13312,4 +13312,3 @@ See ChangeLog.8 for earlier changes.
13312 You should have received a copy of the GNU General Public License 13312 You should have received a copy of the GNU General Public License
13313 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 13313 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
13314 13314
13315;;; arch-tag: 38875948-6e89-4f08-b0ca-ff328f1e8b72
diff --git a/src/ChangeLog.trunk b/src/ChangeLog.trunk
index 567bf2868e7..eeba4192e25 100644
--- a/src/ChangeLog.trunk
+++ b/src/ChangeLog.trunk
@@ -1,5 +1,936 @@
12010-12-08 Glenn Morris <rgm@gnu.org>
2
3 * fileio.c (Fverify_visited_file_modtime): Default to current buffer.
4
52010-12-06 Lars Magne Ingebrigtsen <larsi@gnus.org>
6
7 * xml.c (parse_region): Ignore blank HTML nodes.
8 (make_dom): Return CDATA sections (like <style>foo</style>) as
9 text nodes.
10
112010-12-06 Stefan Monnier <monnier@iro.umontreal.ca>
12
13 * lread.c (read1): Allow newstyle unquote outside of backquote.
14 Disallow old-style backquotes inside new-style backquotes.
15 Don't count unquotes to figure out when we're "syntactically inside
16 but semantically outside of a backquote" any more.
17 Extend the restriction no-unescaped-commas-and-backquotes-in-symbols
18 to all contexts.
19
202010-12-05 Chong Yidong <cyd@stupidchicken.com>
21
22 * process.c: Remove checks for HAVE_SYS_IOCTL_H (Bug#7484).
23
242010-12-04 Andreas Schwab <schwab@linux-m68k.org>
25
26 * Makefile.in (M_FILE): Substitute @M_FILE@ instead of @machfile@.
27 (S_FILE): Substitute @S_FILE@ instead of @opsysfile@.
28 * m/arm.h, m/sh3.h, m/xtensa.h: Remove files.
29
302010-12-03 Andreas Schwab <schwab@linux-m68k.org>
31
32 * lisp.h (union Lisp_Object): Explicitly declare signedness of
33 bit-field.
34 (XINT): Remove variant for EXPLICIT_SIGN_EXTEND.
35 * m/alpha.h (EXPLICIT_SIGN_EXTEND): Don't define.
36 * m/amdx86-64.h (EXPLICIT_SIGN_EXTEND): Likewise.
37 * m/ia64.h (EXPLICIT_SIGN_EXTEND): Likewise.
38 * m/ibms390.h (EXPLICIT_SIGN_EXTEND): Likewise.
39 * m/ibms390x.h (EXPLICIT_SIGN_EXTEND): Likewise.
40 * m/iris4d.h (EXPLICIT_SIGN_EXTEND): Likewise.
41 * m/m68k.h (EXPLICIT_SIGN_EXTEND): Likewise.
42 * m/sparc.h (EXPLICIT_SIGN_EXTEND): Likewise.
43 * m/template.h (EXPLICIT_SIGN_EXTEND): Likewise.
44 * m/hp800.h: Remove file.
45 * m/mips.h: Remove file.
46
472010-12-03 Jan Djärv <jan.h.d@swipnet.se>
48
49 * nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background
50 with cursor color and draw a rectangle around the image (Bug#7412).
51
522010-12-03 Andreas Schwab <schwab@linux-m68k.org>
53
54 * frame.c (x_set_font): Remove unused variable.
55
562010-12-02 Jan Djärv <jan.h.d@swipnet.se>
57
58 * nsmenu.m (update_frame_tool_bar): Remove NSLog on invalid image.
59
60 * nsterm.m (ns_draw_glyph_string): Switch fore- and background if
61 drawing text under filled box cursor (Bug#7479).
62
632010-11-27 Kenichi Handa <handa@m17n.org>
64
65 * charset.c (emacs_mule_charset): Make it an array of charset ID;
66 i.e. integer.
67 (Fdefine_charset_internal): Adjust for the above change.
68 (init_charset_once): Likewise.
69
70 * charset.h (emacs_mule_charset): Adjust the prototype.
71 Delete duplicated extern.
72
73 * coding.c (emacs_mule_char): Adjust for the change of
74 emacs_mule_charset.
75
76 * lread.c (read_emacs_mule_char): Adjust for the change of
77 emacs_mule_charset.
78
792010-11-27 Eli Zaretskii <eliz@gnu.org>
80
81 * w32.c (_PROCESS_MEMORY_COUNTERS_EX): Don't define with versions
82 of w32api >= 3.15. (Bug#6989) (Bug#7452)
83
842010-11-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
85
86 * alloc.c (mark_terminals): Ensure that the image cache is marked
87 even if the terminal object was marked earlier (Bug#6301).
88
892010-11-21 Chong Yidong <cyd@stupidchicken.com>
90
91 * editfns.c (Fbyte_to_string): Signal an error arg is not a byte.
92
932010-11-27 Jan Djärv <jan.h.d@swipnet.se>
94
95 * gtkutil.c (menubar_map_cb): New function (Bug#7425).
96 (xg_update_frame_menubar): Connect signal map to menubar_map_cb.
97 Use 23 as menubar height if 0. (Bug#7425).
98
992010-11-26 Eli Zaretskii <eliz@gnu.org>
100
101 * xdisp.c (set_message_1): Force paragraph direction in echo area
102 be left-to-right.
103
104 * keyboard.c (make_lispy_position): Put a meaningful value in yret
105 when the click is on the header or mode line.
106
1072010-11-25 Eli Zaretskii <eliz@gnu.org>
108
109 * xdisp.c (set_cursor_from_row): Don't forget to consider the
110 `cursor' property of the first character in overlay strings.
111 (Bug#7474) (Bug#7481)
112
1132010-11-24 Jan Djärv <jan.h.d@swipnet.se>
114
115 * nsterm.m (NSLeftControlKeyMask, NSLeftCommandKeyMask)
116 (NSLeftAlternateKeyMask): New defines.
117 (keyDown): Parse left and right keys separately (Bug#7458).
118 Compare Left key masks exactly (Bug#7458).
119
1202010-11-23 Eli Zaretskii <eliz@gnu.org>
121
122 * intervals.c (temp_set_point_both): Define before calling, to
123 avoid GCC warnings.
124
1252010-11-23 Dan Nicolaescu <dann@ics.uci.edu>
126
127 * nsmenu.m: Use #include <config.h> instead of "config.h".
128
129 * term.c (Qglyphless_char,last_glyphless_glyph_frame)
130 (last_glyphless_glyph_face_id. last_glyphless_glyph_merged_face_id):
131 Move declarations ...
132 * lisp.h (Qglyphless_char,last_glyphless_glyph_frame)
133 (last_glyphless_glyph_face_id. last_glyphless_glyph_merged_face_id):
134 ... here.
135
136 * emacs.c (gdb_use_union, gdb_valbits,gdb_gctypebits)
137 (gdb_data_seg_bits, gdb_array_mark_flag, PVEC_FLAG)
138 (gdb_pvec_type):
139 * print.c (print_output_debug_flag):
140 * lisp.h (debug_print): Mark as EXTERNALLY_VISIBLE.
141 (safe_debug_print): New declaration.
142
143 * xterm.c:
144 * systty.h:
145 * sound.c: Include <sys/ioctl.h> unconditionally.
146
1472010-11-22 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
148
149 * alloc.c (mark_maybe_object): Return early if given a Lisp
150 integer (Bug#6301).
151
1522010-11-21 Ken Brown <kbrown@cornell.edu>
153
154 * sheap.c (STATIC_HEAP_SIZE): Revert previous change.
155
1562010-11-21 Jan Djärv <jan.h.d@swipnet.se>
157
158 * nsterm.m (ns_right_command_modifier, ns_right_control_modifier):
159 Define (Bug#7458).
160 (NSRightCommandKeyMask, NSRightControlKeyMask): Define (Bug#7458).
161 (EV_MODIFIERS): Check for NSRightCommandKeyMask and
162 NSRightControlKeyMask also (Bug#7458).
163 (keyDown): Ditto (Bug#7458).
164 (syms_of_nsterm): Defvar ns-right-command-modifier and
165 ns-right-control-modifier (Bug#7458).
166
1672010-11-21 Dan Nicolaescu <dann@ics.uci.edu>
168
169 * sysdep.c (sys_subshell): Remove SET_EMACS_PRIORITY.
170 * emacs.c (emacs_priority, syms_of_emacs): Remove emacs_priority.
171
172 * intervals.h (temp_set_point, temp_set_point_both):
173 * buffer.h (offset_intervals, copy_intervals): Remove INLINE.
174
1752010-11-20 Ken Brown <kbrown@cornell.edu>
176
177 * sheap.c (STATIC_HEAP_SIZE): Increase to 13MB.
178
1792010-11-20 Eli Zaretskii <eliz@gnu.org>
180
181 * term.c (produce_glyphless_glyph): Use \uNNNN, \UNNNNNN, or
182 \xNNNNNN for hex-code display of glyphless characters.
183
1842010-11-20 Jan Djärv <jan.h.d@swipnet.se>
185
186 * gtkutil.c (xg_make_tool_item): Take vert_only as argument.
187 Set important to ! vert_only.
188 (xg_show_toolbar_item): Don't show label horizontally if
189 tool item isn't important.
190 (update_frame_tool_bar): Get TOOL_BAR_ITEM_VERT_ONLY and pass it to
191 xg_make_tool_item, or update important on existing tool item.
192
193 * keyboard.c (QCvert_only): New variable.
194 (parse_tool_bar_item): Check for QCvert_only.
195 (syms_of_keyboard): Initialize QCvert_only.
196
197 * dispextern.h (tool_bar_item_idx): Add TOOL_BAR_ITEM_VERT_ONLY.
198
1992010-11-20 Eli Zaretskii <eliz@gnu.org>
200
201 * msdos.c (dos_rawgetc): Use gen_help_event, instead of doing the
202 same in-line.
203
2042010-11-20 Andreas Schwab <schwab@linux-m68k.org>
205
206 * xfaces.c (lookup_face): Make static.
207 * dispnew.c (copy_row_except_pointers): Likewise.
208 * syntax.c (dec_bytepos): Likewise.
209 (inc_bytepos): Remove.
210 * dispextern.h (lookup_face): Remove declaration.
211
2122010-11-19 Eli Zaretskii <eliz@gnu.org>
213
214 * xdisp.c (set_cursor_from_row): Display cursor after all the
215 glyphs that come from an overlay. Don't overstep the last glyph
216 when skipping glyphs from an overlay. (Bug#6687)
217
2182010-11-18 Dan Nicolaescu <dann@ics.uci.edu>
219
220 * alloc.c (refill_memory_reserve): Move declaration ...
221 * lisp.h (refill_memory_reserve): ... here.
222
223 * strftime.c (_strftime_copytm): Add declaration.
224
225 * callproc.c (syms_of_callproc): Use intern_c_string.
226
227 Move declarations from .c files to .h files.
228 * process.c (timers_run):
229 * minibuf.c (quit_char):
230 * lread.c (read_emacs_mule_char):
231 * keyboard.c (minibuf_level, message_enable_multibyte)
232 (pending_malloc_warning):
233 * insdel.c (Vselect_active_regions, Vsaved_region_selection)
234 (Qonly): Remove declarations.
235 * lisp.h (pending_malloc_warning, Vsaved_region_selection)
236 (Vselect_active_regions):
237 * keyboard.h (timers_run): Add declarations.
238
239 * strftime.c (my_strftime_gmtime_r, my_strftime_localtime_r)
240 (tm_diff): Convert definitions to standard C.
241 (extra_args_spec_iso): Remove, unused.
242
2432010-11-18 Jan Djärv <jan.h.d@swipnet.se>
244
245 * xsettings.c (init_gconf): Check HAVE_G_TYPE_INIT.
246
247 * config.in (HAVE_G_TYPE_INIT): New symbol.
248
2492010-11-18 Eli Zaretskii <eliz@gnu.org>
250
251 * lread.c (Fload): Mention `load-in-progress' and
252 `load-file-name'. (Bug#7346)
253
254 * keyboard.c (kbd_buffer_nr_stored): Define only ifdef subprocesses.
255 (kbd_buffer_store_event_hold, kbd_buffer_get_event)
256 (tty_read_avail_input): Call kbd_buffer_nr_stored only ifdef
257 subprocesses. Use buffer_free only ifdef subprocesses.
258
259 * process.c (init_process) [subprocesses]: Init kbd_is_on_hold in
260 the subprocesses version, not in the non-subprocesses one.
261
262 * Makefile.in: Don't use ## comment, it breaks the MSDOS build.
263
2642010-11-17 Eli Zaretskii <eliz@gnu.org>
265
266 * xdisp.c (set_cursor_from_row): Fix cursor positioning in empty
267 lines on text-mode terminals. (bug#7417)
268
2692010-11-17 Stefan Monnier <monnier@iro.umontreal.ca>
270
271 * xterm.c (get_current_wm_state): Rename from get_current_vm_state.
272 (do_ewmh_fullscreen, x_handle_net_wm_state): Update callers.
273
2742010-11-17 Kenichi Handa <handa@m17n.org>
275
276 * coding.c (Fset_terminal_coding_system_internal): Fix previous
277 change (set charset-ID list instead of charset-symbol list).
278
2792010-11-16 Chong Yidong <cyd@stupidchicken.com>
280
281 * keyboard.c (make_lispy_position): For text area clicks, record Y
282 pixel position relative to the text area, excluding header line.
283 Also change X and Y to Lisp_Objects, not pointers; don't return
284 coordinate values via pointers. Pass ON_TEXT_AREA coordinate to
285 buffer_posn_from_coords counting from the start of the text area.
286 (Fposn_at_x_y, make_lispy_event): Callers changed.
287
288 * window.c (coordinates_in_window): Change X and Y to ints rather
289 than pointers; don't return coordinates via pointers.
290 (struct check_window_data): Change X and Y from pointers to ints.
291 (window_from_coordinates): Remove args WX and WY; don't return
292 coordinates via pointers.
293 (Fcoordinates_in_window_p, window_from_coordinates):
294 (check_window_containing, Fwindow_at): Callers changed.
295 (window_relative_x_coord): New function.
296
297 * window.h (window_from_coordinates, window_relative_x_coord):
298 Update prototypes.
299
300 * dispnew.c (buffer_posn_from_coords): Assume that X counts from
301 the start of the text area.
302
303 * xdisp.c (remember_mouse_glyph): Change window_from_coordinates
304 call. Use window_relative_x_coord.
305 (note_mouse_highlight): Change window_from_coordinates call.
306
307 * w32term.c (w32_read_socket):
308 * msdos.c (dos_rawgetc):
309 * xterm.c (handle_one_xevent): Likewise.
310
3112010-11-16 Dan Nicolaescu <dann@ics.uci.edu>
312
313 * strftime.c (LOCALE_PARAM_DECL): Update for standard C.
314 (LOCALE_PARAM, LOCALE_PARAM_PROTO): Remove, unused.
315 (memcpy_lowcase, so_week_days, extra_args_spec, emacs_strftimeu):
316 Convert definitions to standard C.
317 * regex.c: Do not include <stdlib.h>, config.h does it.
318 Include unistd.h.
319 (xrealloc, init_syntax_once, re_match, regcomp, regexec)
320 (regerror, regfree): Convert definitions to standard C.
321 * mktime.c (my_mktime_localtime_r, ydhms_tm_diff, ranged_convert)
322 (__mktime_internal): Convert definitions to standard C.
323
3242010-11-15 Dan Nicolaescu <dann@ics.uci.edu>
325
326 * w32proc.c:
327 * w32inevt.c:
328 * w32heap.c:
329 * w32.c: Remove config.h include guards.
330
331 * callproc.c (child_setup): Reorder code to simplify #ifdefs.
332 No code changes.
333
334 * process.c: Include <sys/ioctl.h> unconditionally,
335 keyboard.c already does it.
336
337 * keyboard.c (pending_malloc_warning): Add const to match
338 definition in alloc.c.
339 (Fset_input_interrupt_mode): Simplify #ifdefs.
340
3412010-11-15 Dan Nicolaescu <dann@ics.uci.edu>
342
343 Clean up systty.h macros.
344 * systty.h (EMACS_GET_TTY_PGRP, EMACS_SET_TTY_PGRP, EMACS_GET_TTY)
345 (EMACS_SET_TTY): Remove unneeded abstraction, instead inline the
346 definition in all uses.
347 (EMACS_TTY_TABS_OK): Remove, it has a single user.
348 * sysdep.c (discard_tty_input, child_setup_tty)
349 (init_sys_modes, tabs_safe_p, reset_sys_modes):
350 * emacs.c (shut_down_emacs):
351 * callproc.c (child_setup):
352 * term.c (dissociate_if_controlling_tty): Inline removed macros.
353
354 * data.c (sign_extend_temp, sign_extend_lisp_int): Remove, unused.
355
3562010-11-14 Chong Yidong <cyd@stupidchicken.com>
357
358 * w32fns.c (Fx_create_frame):
359 * nsfns.m (Fx_create_frame): Don't check for the cursorColor
360 resource here; it's now done at startup.
361
3622010-11-14 Jan Djärv <jan.h.d@swipnet.se>
363
364 * xterm.c (set_wm_state): Add Qnil to final cons.
365
366 * xselect.c (x_send_client_event): Remove unused variables cons and
367 size.
368
3692010-11-14 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
370
371 * keyboard.c (modify_event_symbol) : Add const to array elements of
372 arg NAME_TABLE.
373 (lispy_accent_keys, lispy_function_keys, lispy_multimedia_keys)
374 (lispy_kana_keys, iso_lispy_function_keys, lispy_wheel_names)
375 (lispy_wheel_names, lispy_drag_n_drop_names, modifier_names):
376 Add const to array elements.
377 (scroll_bar_parts): Make static. Fix position of const.
378
379 * w32fns.c (lispy_function_keys): Add const to extern.
380
381 * w32inevt.c (lispy_function_keys): Likewise.
382
3832010-11-14 Chong Yidong <cyd@stupidchicken.com>
384
385 * xfns.c (Fx_create_frame): Don't check for the cursorColor
386 resource here; it's now done at startup.
387
3882010-11-13 Dan Nicolaescu <dann@ics.uci.edu>
389
390 * xmenu.c: Make it clear that ../lwlib/lwlib.h is only needed for Motif.
391
392 Fix compilation on Solaris.
393 * sysdep.c: Do not #include <term.h>.
394 (tputs): Add declaration, similar to what cm.c does. (Bug#7178)
395
396 * s/ms-w32.h (HAVE_TERMIOS_H): Do not undef, not used anymore.
397
3982010-11-13 Jan Djärv <jan.h.d@swipnet.se>
399
400 * xterm.c (set_wm_state): Don't put Atom in cons, call
401 make_fixnum_or_float on them first.
402 (x_term_init): Initialize Xatom_net_supporting_wm_check and
403 Xatom_net_supported correctly.
404
405 * xselect.c (x_send_client_event): Move CHECK_STRING ...
406 (Fx_send_client_event): to here.
407
4082010-11-13 Martin Rudalics <rudalics@gmx.at>
409
410 * window.c (Fwindow_use_time): New function.
411
4122010-11-13 Eli Zaretskii <eliz@gnu.org>
413
414 * xdisp.c (set_cursor_from_row): Fix cursor positioning on
415 zero-width characters.
416
417 * .gdbinit (pgx): Adapt to latest changes in `struct glyph'.
418
419 * w32term.c (x_draw_glyphless_glyph_string_foreground): Draw the
420 box before drawing the glyphs inside it.
421
422 * xdisp.c (syms_of_xdisp) <glyphless-char-display>: Doc fix.
423
424 * dispextern.h (enum glyphless_display_method):
425 Rename GLYPHLESS_DISPLAY_HEXA_CODE to GLYPHLESS_DISPLAY_HEX_CODE.
426 All users changed.
427
428 * term.c (append_glyphless_glyph, produce_glyphless_glyph):
429 Fix comments.
430 (produce_glyphless_glyph): Enclose "U+nnnn" and "empty box"
431 whitespace in "[]", to simulate a box. Don't use uninitialized
432 variable `width'.
433
4342010-11-11 Julien Danjou <julien@danjou.info>
435
436 * xsettings.c (init_xsettings): Use already fetch atoms.
437
438 * xsmfns.c (create_client_leader_window): Use SM_CLIENT_ID atom
439 from dpyinfo.
440
441 * xselect.c (Fx_send_client_event): Split and create
442 x_send_client_event.
443
444 * lisp.h: Do not EXFUN Fx_send_client_event.
445
446 * xterm.c (x_set_frame_alpha): Use _NET_WM_WINDOW_OPACITY atom
447 from dpyinfo.
448 (wm_supports): Use atoms from dpyinfo.
449 (do_ewmh_fullscreen): Use atoms from dpyinfo.
450 (x_ewmh_activate_frame): Use atoms from dpyinfo.
451 (xembed_set_info): Use atoms from dpyinfo.
452 (x_term_init): Fetch _XEMBED_INFO, _NET_SUPPORTED,
453 _NET_SUPPORTING_WM_CHECK, _NET_WM_WINDOW_OPACITY and
454 _NET_ACTIVE_WINDOW, XSETTINGS atoms.
455 Get all atoms in one round-trip.
456 (set_wm_state): Use x_send_client_event rather than
457 Fx_send_client_event, using Atom directly.
458 (x_ewmh_activate_frame): Ditto.
459 (x_set_sticky): Pass atoms to set_wm_state.
460 (do_ewmh_fullscreen): Ditto.
461
462
463 * xterm.h (x_display_info): Add Xatom_net_supported,
464 Xatom_net_supporting_wm_check, Xatom_net_active_window,
465 Xatom_net_wm_window_opacity, Xatom_XEMBED_INFO, SM_CLIENT_ID.
466
467 * xfns.c (Fx_show_tip): Fix typo in docstring.
468
4692010-11-11 Stefan Monnier <monnier@iro.umontreal.ca>
470
471 * cmds.c (Fself_insert_command): Don't call XFASTINT without checking
472 it's not negative.
473
4742010-11-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
475
476 * font.c (font_filter_properties): Add const to array elements of
477 properties args.
478
479 * font.h (font_filter_properties): Likewise.
480
481 * ftfont.c (ftfont_booleans, ftfont_non_booleans): Add const to array
482 elements.
483
484 * w32font.c (w32font_booleans, w32font_non_booleans): Likewise.
485
4862010-11-10 Michael Albinus <michael.albinus@gmx.de>
487
488 * dbusbind.c (QCdbus_type_unix_fd): New Lisp object.
489 (XD_BASIC_DBUS_TYPE, xd_symbol_to_dbus_type, xd_signature)
490 (xd_append_arg, xd_retrieve_arg): Support DBUS_TYPE_UNIX_FD.
491 (Fdbus_call_method): Add DBUS_TYPE_UNIX_FD type mapping to doc string.
492 (syms_of_dbusbind): Initialize QCdbus_type_unix_fd).
493
4942010-11-10 Glenn Morris <rgm@gnu.org>
495
496 * emacs.c (syms_of_emacs) <system-type>: Doc fix.
497
4982010-11-09 Eli Zaretskii <eliz@gnu.org>
499
500 * xfns.c (x_real_positions): Fix declaration-after-statement problem.
501
5022010-11-09 Chong Yidong <cyd@stupidchicken.com>
503
504 * image.c (free_image): Don't garbage the frame here, since this
505 function can be called while redisplaying (Bug#7210).
506 (uncache_image): Garbage the frame here (Bug#6426).
507
5082010-11-09 Jan Djärv <jan.h.d@swipnet.se>
509
510 * xfns.c (x_real_positions): Only use _NET_FRAME_EXTENTS if our
511 parent is the root window. Check this after traversing window tree.
512
513 * xterm.c (x_term_init): Initialize Xatom_net_frame_extents.
514
515 * xterm.h (struct x_display_info): Xatom_net_frame_extents is new.
516
517 * xfns.c (x_real_positions): Try to get _NET_FRAME_EXTENTS first
518 before traversing window tree (Bug#5721).
519
5202010-11-07 Jan Djärv <jan.h.d@swipnet.se>
521
522 * xfns.c (set_machine_and_pid_properties): Let X set WM_CLIENT_MACHINE.
523
524 * xdisp.c (note_mode_line_or_margin_highlight):
525 Initialize Cursor to No_Cursor for HAVE_WINDOW_SYSTEM also.
526
5272010-11-06 Eli Zaretskii <eliz@gnu.org>
528
529 * xfns.c (Fx_show_tip): If any of the tool-tip text lines is R2L,
530 adjust width of tool-tip frame to the width of text, excluding the
531 stretch glyph at the beginning of R2L glyph rows.
532
533 * w32fns.c (Fx_show_tip): Likewise.
534
5352010-11-06 Jan Djärv <jan.h.d@swipnet.se>
536
537 * nsfont.m: Include termchar for new mouse-highlight.
538 (nsfont_draw): Use MOUSE_HL_INFO.
539
5402010-11-05 Eli Zaretskii <eliz@gnu.org>
541
542 Unify mouse-highlight code for all GUI and TTY sessions.
543
544 * term.c: Remove static mouse_face_* variables. All users
545 changed.
546 (term_show_mouse_face, term_clear_mouse_face)
547 (fast_find_position, term_mouse_highlight): Functions deleted.
548 (tty_draw_row_with_mouse_face): New function.
549 (term_mouse_movement): Call note_mouse_highlight instead of
550 term_mouse_highlight.
551
552 * nsterm.m (ns_update_window_begin, ns_update_window_end)
553 (ns_update_end, x_destroy_window, ns_frame_up_to_date)
554 (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background)
555 (ns_dumpglyphs_image, ns_dumpglyphs_stretch)
556 (ns_initialize_display_info, keyDown, mouseMoved, mouseExited):
557 Replace Display_Info with Mouse_HLInfo everywhere where
558 mouse_face_* members were accessed for mouse highlight purposes.
559
560 * xterm.c (x_update_window_begin, x_update_window_end)
561 (x_update_end, XTframe_up_to_date, x_set_mouse_face_gc)
562 (handle_one_xevent, x_free_frame_resources, x_term_init):
563 Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_*
564 members were accessed for mouse highlight purposes.
565
566 * w32term.c (x_update_window_begin, x_update_window_end)
567 (x_update_end, w32_read_socket, x_free_frame_resources)
568 (w32_initialize_display_info): Replace Display_Info with
569 Mouse_HLInfo everywhere where mouse_face_* members were accessed
570 for mouse highlight purposes.
571
572 * xdisp.c (show_mouse_face, note_mode_line_or_margin_highlight)
573 (note_mouse_highlight) [HAVE_WINDOW_SYSTEM]: Don't run GUI code
574 unless the frame is on a window-system.
575 (get_tool_bar_item, handle_tool_bar_click)
576 (note_tool_bar_highlight, draw_glyphs, erase_phys_cursor)
577 (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p)
578 (note_mode_line_or_margin_highlight, note_mouse_highlight)
579 (x_clear_window_mouse_face, cancel_mouse_face, expose_frame):
580 Replace Display_Info with Mouse_HLInfo everywhere where
581 mouse_face_* members were accessed for mouse highlight purposes.
582 (coords_in_mouse_face_p): Move prototype out of the
583 HAVE_WINDOW_SYSTEM conditional.
584 (x_y_to_hpos_vpos, frame_to_window_pixel_xy): Move out of the
585 HAVE_WINDOW_SYSTEM block.
586 (try_window_id) [HAVE_GPM || MSDOS]:
587 Call x_clear_window_mouse_face.
588 (draw_row_with_mouse_face): Implementation for HAVE_WINDOW_SYSTEM
589 systems. Call tty_draw_row_with_mouse_face for TTY systems.
590 (show_mouse_face): Call draw_row_with_mouse_face, instead of
591 calling draw_glyphs directly.
592 (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p)
593 (cursor_in_mouse_face_p, rows_from_pos_range)
594 (mouse_face_from_buffer_pos, mouse_face_from_string_pos)
595 (note_mode_line_or_margin_highlight, note_mouse_highlight)
596 (x_clear_window_mouse_face, cancel_mouse_face): Move out of the
597 HAVE_WINDOW_SYSTEM block. Ifdef away window-system specific
598 fragments.
599 (note_mouse_highlight): Call popup_activated for MSDOS as well.
600 Clear mouse highlight if pointer is over glyphs whose OBJECT is an
601 integer.
602 (mouse_face_from_buffer_pos): Add parentheses around && within ||.
603 (x_consider_frame_title, tool_bar_lines_needed):
604 Move prototypes to HAVE_WINDOW_SYSTEM-only part.
605 (get_window_cursor_type): Move inside a HAVE_WINDOW_SYSTEM-only
606 part. Remove "#ifdef HAVE_WINDOW_SYSTEM" from body of function.
607 (null_glyph_slice): Move declaration into HAVE_WINDOW_SYSTEM-only
608 part.
609
610 * dispnew.c (mirror_make_current): Set Y coordinate of the
611 mode-line and header-line rows.
612 (init_display): Setup initial frame's output_data for text
613 terminal frames.
614
615 * xmenu.c (popup_activated): Don't define on MSDOS, which now has
616 its own definition on msdos.c.
617
618 * msdos.c (show_mouse_face, clear_mouse_face)
619 (fast_find_position, IT_note_mode_line_highlight)
620 (IT_note_mouse_highlight): Functions deleted.
621 (IT_frame_up_to_date, dos_rawgetc): Call note_mouse_highlight
622 instead of IT_note_mouse_highlight.
623 (draw_row_with_mouse_face, popup_activated): New functions.
624 (dos_set_window_size, draw_row_with_mouse_face, IT_update_begin)
625 (IT_update_end, IT_frame_up_to_date, internal_terminal_init)
626 (dos_rawgetc): Replace Display_Info with Mouse_HLInfo everywhere
627 where mouse_face_* members were accessed for mouse highlight
628 purposes.
629
630 * msdos.h (initialize_msdos_display): Add prototype.
631
632 * frame.h (MOUSE_HL_INFO): New macro.
633
634 * lisp.h (Mouse_HLInfo): New data type.
635
636 * xterm.h (struct x_display_info):
637 * w32term.h (struct w32_display_info):
638 * nsterm.h (struct ns_display_info):
639 * termchar.h (struct tty_display_info): Use it instead of
640 mouse_face_* members.
641
642 * dispextern.h (show_mouse_face, clear_mouse_face): Update type of
643 1st argument.
644 (frame_to_window_pixel_xy, note_mouse_highlight)
645 (x_clear_window_mouse_face, cancel_mouse_face, clear_mouse_face)
646 (show_mouse_face, cursor_in_mouse_face_p): Move prototypes out of
647 HAVE_WINDOW_SYSTEM conditional.
648 (draw_row_with_mouse_face): Declare prototype.
649 (tty_draw_row_with_mouse_face): Declare prototype.
650
6512010-11-05 Eli Zaretskii <eliz@gnu.org>
652
653 * term.c (append_glyphless_glyph, produce_glyphless_glyph):
654 Remove unused variables.
655
6562010-11-05 Adrian Robert <Adrian.B.Robert@gmail.com>
657
658 * nsterm.m (EmacsView-mouseExited:): Correct error in conditional
659 logic pointed out by Eli Zaretskii.
660
6612010-11-04 Lars Magne Ingebrigtsen <larsi@gnus.org>
662
663 * coding.c (coding-category-list): Refer to set-coding-system-priority
664 instead of the obsolete set-coding-priority in the doc string.
665
666
6672010-11-04 Adrian Robert <Adrian.B.Robert@gmail.com>
668
669 * nsfont.m (nsfont_draw): Correct previous patch to return
670 correct value.
671 * nsimage.m (EmacsImage-setXBMColor:): Correct previous patch:
672 don't change the method signature, change the return.
673
6742010-11-04 Ismail Donmez <ismail@namtrac.org> (tiny change)
675
676 * nsfont.m (nsfont_draw)
677 * nsimage.m (EmacsImage-setXBMColor:)
678 * nsterm.m (EmacsView-performDragOperation:): Correct empty return.
679
6802010-11-03 Julien Danjou <julien@danjou.info>
681
682 * image.c (gif_load): Add support for transparency and specified
683 :background.
684
6852010-11-01 Kenichi Handa <handa@m17n.org>
686
687 * dispextern.h (lookup_glyphless_char_display): Extern it.
688
689 * termhooks.h (struct terminal): New member charset_list.
690
691 * coding.c (Fset_terminal_coding_system_internal): Set the
692 `charset_list' member of struct terminal.
693
694 * term.c (produce_glyphs): Handle the case it->what == IT_GLYPHLESS.
695 (append_glyphless_glyph, produce_glyphless_glyph): New functions.
696
697 * xdisp.c (lookup_glyphless_char_display): Make it non-static.
698 (lookup_glyphless_char_display): Set it->what at the end.
699 (last_glyphless_glyph_frame, last_glyphless_glyph_face_id)
700 (last_glyphless_glyph_merged_face_id): Make them non-static.
701
702 * w32term.c (x_draw_glyphless_glyph_string_foreground):
703 Fix the arg with_background for font->driver->draw.
704
7052010-11-01 Kenichi Handa <handa@m17n.org>
706
707 * w32gui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
708 Surround chp by parentheses.
709
7102010-11-01 Kenichi Handa <handa@m17n.org>
711
712 Implement various display methods for glyphless characters.
713
714 * xdisp.c (Qglyphless_char, Vglyphless_char_display)
715 (Qglyphless_char_display, Qhexa_code, Qempty_box, Qthin_space)
716 (Qzero_width): New variables.
717 (THIN_SPACE_WIDTH): New macro.
718 (lookup_glyphless_char_display): New funciton.
719 (last_glyphless_glyph_frame, last_glyphless_glyph_face_id)
720 (last_glyphless_glyph_merged_face_id): New variables.
721 (get_next_display_element): Check glyphless characters.
722 (redisplay_internal): Initialize last_glyphless_glyph_frame and
723 last_glyphless_glyph_face_id.
724 (fill_glyphless_glyph_string): New function.
725 (BUILD_GLYPHLESS_GLYPH_STRING): New macro.
726 (BUILD_GLYPH_STRINGS): Handle the case GLYPHLESS_GLYPH.
727 (append_glyphless_glyph, produce_glyphless_glyph): New functions.
728 (x_produce_glyphs): If a suitable font is not found, produce a
729 glyphless glyph. Handle the case it->what == IT_GLYPHLESS.
730 (syms_of_xdisp): Intern and staticpro Qglyphless_char,
731 Qglyphless_char_display, Qhexa_code, Qempty_box, Qthin_space, and
732 Qzero_width.
733 (Vglyphless_char_display): Declare it as a Lisp variable.
734
735 * dispextern.h (enum glyph_type): Add GLYPHLESS_GLYPH.
736 (struct glyph): Change the size of the member "type" to 3.
737 Add glyphless to the union slice and u.
738 (enum display_element_type): Add IT_GLYPHLESS.
739 (enum glyphless_display_method): New enum.
740 (struct it): New member glyphless_method.
741 (Vglyphless_char_display): Extern it.
742
743 * xterm.c (x_draw_glyphless_glyph_string_foreground): New function.
744 (x_draw_glyph_string): Handle the case GLYPHLESS_GLYPH.
745
746 * w32term.c (x_draw_glyphless_glyph_string_foreground): New function.
747 (x_draw_glyph_string): Handle the case GLYPHLESS_GLYPH.
748
749 * nsterm.m (ns_draw_glyph_string): Handle the case
750 GLYPHLESS_GLYPH (the detail is not yet implemented).
751
7522010-10-31 Glenn Morris <rgm@gnu.org>
753
754 * xterm.c (x_connection_closed) [USE_X_TOOLKIT]: Fix merge, maybe.
755
756 * frame.c (syms_of_frame) <tool-bar-mode>:
757 Default to nil if !HAVE_WINDOW_SYSTEM. (Bug#7299)
758
7592010-10-31 Chong Yidong <cyd@stupidchicken.com>
760
761 * xterm.c (x_connection_closed): Print informative error message
762 when aborting on GTK. This requires using shut_down_emacs
763 directly instead of Fkill_emacs.
764
7652010-10-29 Eli Zaretskii <eliz@gnu.org>
766
767 * emacs.c (main): Call syms_of_filelock unconditionally.
768
769 * filelock.c (syms_of_filelock): Move out of #ifdef CLASH_DETECTION
770 clause, but keep part of it conditioned on CLASH_DETECTION.
771
7722010-10-29 Glenn Morris <rgm@gnu.org>
773
774 * nsfns.m (Fx-display-save-under, Fx-open-connection)
775 (Fxw-color-defined-p, Fxw-display-color-p, Fx-show-tip):
776 * w32fns.c (Fxw_color_defined_p, Fx_open_connection):
777 * xfns.c (Fxw_color_defined_p, Fx_open_connection):
778 Sync docs between X, W32, NS.
779
780 * buffer.c (syms_of_buffer) <abbrev-mode, transient-mark-mode>:
781 * frame.c (syms_of_frame) <tool-bar-mode>: Move doc here from Lisp.
782
7832010-10-26 Juanma Barranquero <lekktu@gmail.com>
784
785 * eval.c (init_eval_once): Set max_lisp_eval_depth to 600;
786 otherwise, bootstrapping on Windows fails to compile macroexp.el.
787
7882010-10-26 Eli Zaretskii <eliz@gnu.org>
789
790 * cmds.c (internal_self_insert): Don't insert if argument N is
791 zero or negative. (Bug#7281)
792
7932010-10-26 Jan Djärv <jan.h.d@swipnet.se>
794
795 * gtkutil.c (qttip_cb): Set title to empty for ATK (Bug#7278).
796
7972010-10-25 Glenn Morris <rgm@gnu.org>
798
799 * Makefile.in (SOME_MACHINE_LISP): Remove easymenu.elc.
800
8012010-10-24 Glenn Morris <rgm@gnu.org>
802
803 * w32fns.c (Fx_synchronize, Fx_change_window_property)
804 (Fx_window_property, Fx_file_dialog):
805 * xfns.c (Fx_synchronize, Fx_change_window_property)
806 (Fx_window_property, Fx_file_dialog): Sync docs between w32 and X.
807
8082010-10-24 Chong Yidong <cyd@stupidchicken.com>
809
810 * xterm.c (x_connection_closed): Kill Emacs unconditionally.
811
8122010-10-24 Eli Zaretskii <eliz@gnu.org>
813
814 * frame.c (Fframep, Fwindow_system): Deprecate use as a predicate.
815
816 * dispnew.c (syms_of_display) <initial-window-system, window-system>:
817 Deprecate use as a boolean flag.
818
8192010-10-24 Jim Meyering <jim@meyering.net>
820
821 * emacs.c (argmatch): Don't treat "--" as "--chdir".
822
8232010-10-24 Glenn Morris <rgm@gnu.org>
824
825 * w16select.c (syms_of_win16select) <selection-coding-system>:
826 <next-selection-coding-system>:
827 * w32select.c (syms_of_w32select) <selection-coding-system>:
828 <next-selection-coding-system>:
829 Sync docs with select.el.
830
831 * xfaces.c (syms_of_xfaces) <tty-defined-color-alist>: Sync doc with
832 Lisp version.
833
834 * w32term.c (syms_of_w32term) <x-use-underline-position-properties>:
835 Sync doc with the xterm.c version.
836
837 * w32term.c (syms_of_w32term) <x-toolkit-scroll-bars>:
838 * xterm.c (syms_of_xterm) <x-toolkit-scroll-bars>: Sync docs.
839
8402010-10-23 Glenn Morris <rgm@gnu.org>
841
842 * buffer.c (syms_of_buffer) <cursor-in-non-selected-windows>:
843 * frame.c (syms_of_frame) <menu-bar-mode>:
844 * xdisp.c (syms_of_xdisp) <auto-hscroll-mode, display-hourglass>:
845 <hourglass-delay>: Sync docs with Lisp.
846
8472010-10-23 Eli Zaretskii <eliz@gnu.org>
848
849 Implement mouse highlight for bidi-reordered lines.
850
851 * xdisp.c (fast_find_string_pos): #ifdef away, not used anymore.
852 (mouse_face_from_string_pos): New function, replaces
853 fast_find_string_pos.
854 (note_mouse_highlight): Call it instead of fast_find_string_pos.
855 (note_mode_line_or_margin_highlight): Support bidi-reordered
856 strings and R2L glyph rows. Fix comments.
857 (note_mouse_highlight): When bidi reordering is turned on in a
858 buffer, call next-single-property-change and
859 previous-single-property-change with last argument nil. Clear
860 mouse highlight when mouse pointer is in a R2L row on the stretch
861 glyph that stands for no text beyond the line end.
862 (row_containing_pos): Don't return too early when CHARPOS is in a
863 bidi-reordered continued line. Return immediately when the first
864 hit is found in a line that is not continued, or when an exact
865 match for CHARPOS is found.
866 (rows_from_pos_range): New function.
867 (mouse_face_from_buffer_pos): Use it instead of calling
868 row_containing_pos for START_CHARPOS and END_CHARPOS. Rewrite the
869 function to support mouse highlight in bidi-reordered lines and
870 not to assume that START_CHARPOS is always in mouse_face_beg_row.
871 If necessary, swap mouse_face_beg_row and mouse_face_end_row so
872 that the former is always above the latter or identical to it.
873 (show_mouse_face): Support drawing highlighted R2L lines.
874 (coords_in_mouse_face_p): New function, bidi-aware.
875 (cursor_in_mouse_face_p, note_mouse_highlight, erase_phys_cursor):
876 Call it instead of comparing with mouse-face members of dpyinfo.
877 (note_mode_line_or_margin_highlight): Fix confusingly swapped
878 usage of hpos and vpos.
879
8802010-10-22 Jan Djärv <jan.h.d@swipnet.se>
881
882 * xrdb.c: Include keyboard.h for MOTIF.
883
884 * xmenu.c: Revert 2010-07-27 change: lwlib.h is needed for
885 MOTIF (Bug#7263).
886
887 * xfns.c: Include Xm/TextF and Xm/List.
888 (file_dialog_cb, file_dialog_unmap_cb, clean_up_file_dialog):
889 Make ANSI prototypes.
890
8912010-10-22 Glenn Morris <rgm@gnu.org>
892
893 * Makefile.in (SOME_MACHINE_LISP): Add w32-vars.
894 Remove ccl and duplicate mouse.
895
8962010-10-21 Chong Yidong <cyd@stupidchicken.com>
897
898 * insdel.c (prepare_to_modify_buffer): Don't set
899 saved-region-selection if modification hooks are disabled.
900
9012010-10-19 Chong Yidong <cyd@stupidchicken.com>
902
903 * cmds.c (Fdelete_char): Doc fix.
904
9052010-10-19 Ken Brown <kbrown@cornell.edu>
906
907 * s/cygwin.h (SIGNALS_VIA_CHARACTERS): New define (bug#7225).
908
9092010-10-19 Kenichi Handa <handa@m17n.org>
910
911 Fix incorrect font metrics when the same font is opened with
912 different pixelsizes.
913
914 * xftfont.c: Include composite.h.
915 (xftfont_shape): New function.
916 (syms_of_xftfont): Set xftfont_driver.shape.
917
9182010-10-18 Julien Danjou <julien@danjou.info>
919
920 * frame.c (Fframe_pointer_visible_p):
921 Add `frame-pointer-visible-p' to get the pointer visibility.
922
9232010-10-18 Lars Magne Ingebrigtsen <larsi@gnus.org>
924
925 * gnutls.c (emacs_gnutls_read): Return 0 if we get a
926 non-"EAGAIN"-like error to signal to Emacs that the socket should
927 be closed.
928
12010-10-15 Eli Zaretskii <eliz@gnu.org> 9292010-10-15 Eli Zaretskii <eliz@gnu.org>
2 930
931 * unexcoff.c (make_hdr): Fix prototype according to changes in
932 2010-10-03T13:59:56Z!dann@ics.uci.edu.
933
3 * image.c (tiff_load): Cast 3rd argument to avoid compiler warning. 934 * image.c (tiff_load): Cast 3rd argument to avoid compiler warning.
4 935
52010-10-15 Tassilo Horn <tassilo@member.fsf.org> 9362010-10-15 Tassilo Horn <tassilo@member.fsf.org>
@@ -236,8 +1167,8 @@
236 anything on any platform. 1167 anything on any platform.
237 1168
238 Remove unused code. 1169 Remove unused code.
239 * sysdep.c (select_alarm, sys_select, read_input_waiting): Remove 1170 * sysdep.c (select_alarm, sys_select, read_input_waiting):
240 select emulation, all systems support select. 1171 Remove select emulation, all systems support select.
241 (set_exclusive_use): Remove, the only user is in an #if 0 block. 1172 (set_exclusive_use): Remove, the only user is in an #if 0 block.
242 * process.c (create_process): Remove #if 0 code. 1173 * process.c (create_process): Remove #if 0 code.
243 1174
@@ -302,7 +1233,7 @@
3022010-10-02 Lars Magne Ingebrigtsen <larsi@gnus.org> 12332010-10-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
303 1234
304 * xml.c (Flibxml_parse_xml_region, Flibxml_parse_html_region) 1235 * xml.c (Flibxml_parse_xml_region, Flibxml_parse_html_region)
305 (parse_region): Reworked to take regions instead of strings, and 1236 (parse_region): Rework to take regions instead of strings, and
306 renamed to reflect that these are the libxml functions. 1237 renamed to reflect that these are the libxml functions.
307 1238
3082010-10-01 Eli Zaretskii <eliz@gnu.org> 12392010-10-01 Eli Zaretskii <eliz@gnu.org>
@@ -340,7 +1271,8 @@
340 * msdos.c: 1271 * msdos.c:
341 * charset.c: Do not include stdlib.h and string.h, config.h does it. 1272 * charset.c: Do not include stdlib.h and string.h, config.h does it.
342 1273
343 * callproc.c (SIGCHLD): Remove conditional definition, syssignal.h defines it. 1274 * callproc.c (SIGCHLD): Remove conditional definition, syssignal.h
1275 defines it.
344 1276
345 * process.c: Move #include <pty.h> earlier. 1277 * process.c: Move #include <pty.h> earlier.
346 (SIGCHLD): Remove conditional definition, syssignal.h defines it. 1278 (SIGCHLD): Remove conditional definition, syssignal.h defines it.
@@ -430,8 +1362,8 @@
430 (find_last_unchanged_at_beg_row) 1362 (find_last_unchanged_at_beg_row)
431 (find_first_unchanged_at_end_row, row_containing_pos) 1363 (find_first_unchanged_at_end_row, row_containing_pos)
432 (trailing_whitespace_p, display_mode_element, decode_mode_spec) 1364 (trailing_whitespace_p, display_mode_element, decode_mode_spec)
433 (display_count_lines, x_produce_glyphs, note_mouse_highlight): Use 1365 (display_count_lines, x_produce_glyphs, note_mouse_highlight):
434 EMACS_INT for buffer and string positions. 1366 Use EMACS_INT for buffer and string positions.
435 1367
436 * dispextern.h (struct it) <string_nchars>: Declare EMACS_INT. 1368 * dispextern.h (struct it) <string_nchars>: Declare EMACS_INT.
437 (row_containing_pos): Adjust prototype. 1369 (row_containing_pos): Adjust prototype.
@@ -518,7 +1450,7 @@
518 1450
519 * dispextern.h (struct glyph): Change the member "slice" to union. 1451 * dispextern.h (struct glyph): Change the member "slice" to union.
520 Remove u.cmp.from and u.cmp.to. Give more bits to u.cmp.id. 1452 Remove u.cmp.from and u.cmp.to. Give more bits to u.cmp.id.
521 (GLYPH_SLICE_EQUAL_P): Adjusted for the above change. 1453 (GLYPH_SLICE_EQUAL_P): Adjust for the above change.
522 1454
523 * dispnew.c (buffer_posn_from_coords): Use glyph->slice.img 1455 * dispnew.c (buffer_posn_from_coords): Use glyph->slice.img
524 instead of glyph->slice. 1456 instead of glyph->slice.
@@ -714,8 +1646,8 @@
714 positions. 1646 positions.
715 1647
716 * xdisp.c (redisplay_internal, try_window_id) 1648 * xdisp.c (redisplay_internal, try_window_id)
717 (set_cursor_from_row, find_first_unchanged_at_end_row): Use 1649 (set_cursor_from_row, find_first_unchanged_at_end_row):
718 EMACS_INT for buffer positions. 1650 Use EMACS_INT for buffer positions.
719 1651
720 * dispextern.h (set_cursor_from_row): Adjust prototype. 1652 * dispextern.h (set_cursor_from_row): Adjust prototype.
721 1653
@@ -725,8 +1657,8 @@
725 positions. 1657 positions.
726 1658
727 * dispextern.h (mode_line_string, marginal_area_string) 1659 * dispextern.h (mode_line_string, marginal_area_string)
728 (increment_matrix_positions, increment_row_positions): Adjust 1660 (increment_matrix_positions, increment_row_positions):
729 prototypes. 1661 Adjust prototypes.
730 1662
731 * data.c (Faref, Faset): Use EMACS_INT for string length and 1663 * data.c (Faref, Faset): Use EMACS_INT for string length and
732 positions. 1664 positions.
@@ -739,8 +1671,8 @@
739 1671
740 * syntax.c (scan_words, update_syntax_table) 1672 * syntax.c (scan_words, update_syntax_table)
741 (prev_char_comend_first, back_comment, skip_chars) 1673 (prev_char_comend_first, back_comment, skip_chars)
742 (skip_syntaxes, Fforward_comment, Fbackward_prefix_chars): Use 1674 (skip_syntaxes, Fforward_comment, Fbackward_prefix_chars):
743 EMACS_INT for buffer and string positions. 1675 Use EMACS_INT for buffer and string positions.
744 1676
745 * syntax.h (scan_words, update_syntax_table): Adjust prototypes. 1677 * syntax.h (scan_words, update_syntax_table): Adjust prototypes.
746 1678
@@ -788,8 +1720,8 @@
788 (modify_overlay, Fmove_overlay, report_overlay_modification) 1720 (modify_overlay, Fmove_overlay, report_overlay_modification)
789 (evaporate_overlays): Use EMACS_INT for buffer positions. 1721 (evaporate_overlays): Use EMACS_INT for buffer positions.
790 1722
791 * lisp.h (fix_start_end_in_overlays, overlay_touches_p): Adjust 1723 * lisp.h (fix_start_end_in_overlays, overlay_touches_p):
792 prototypes. 1724 Adjust prototypes.
793 1725
794 * dispextern.h (struct bidi_saved_info): Use EMACS_INT for buffer 1726 * dispextern.h (struct bidi_saved_info): Use EMACS_INT for buffer
795 positions. 1727 positions.
@@ -880,13 +1812,13 @@
880 * indent.c (compute_motion): Use EMACS_INT for arguments to 1812 * indent.c (compute_motion): Use EMACS_INT for arguments to
881 region_cache_forward. 1813 region_cache_forward.
882 1814
883 * region-cache.c (struct boundary, struct region_cache): Use 1815 * region-cache.c (struct boundary, struct region_cache):
884 EMACS_INT for positions. 1816 Use EMACS_INT for positions.
885 (find_cache_boundary, move_cache_gap, insert_cache_boundary) 1817 (find_cache_boundary, move_cache_gap, insert_cache_boundary)
886 (delete_cache_boundaries, set_cache_region) 1818 (delete_cache_boundaries, set_cache_region)
887 (invalidate_region_cache, know_region_cache) 1819 (invalidate_region_cache, know_region_cache)
888 (region_cache_forward, region_cache_backward, pp_cache): Use 1820 (region_cache_forward, region_cache_backward, pp_cache):
889 EMACS_INT for buffer positions. 1821 Use EMACS_INT for buffer positions.
890 1822
891 * region-cache.h (know_region_cache, invalidate_region_cache) 1823 * region-cache.h (know_region_cache, invalidate_region_cache)
892 (region_cache_forward, region_cache_backward): Adjust prototypes. 1824 (region_cache_forward, region_cache_backward): Adjust prototypes.
@@ -907,8 +1839,8 @@
907 (Fline_beginning_position, Fline_end_position, Fprevious_char) 1839 (Fline_beginning_position, Fline_end_position, Fprevious_char)
908 (Fchar_after, Fchar_before, Finsert_char) 1840 (Fchar_after, Fchar_before, Finsert_char)
909 (Finsert_buffer_substring, Fcompare_buffer_substrings) 1841 (Finsert_buffer_substring, Fcompare_buffer_substrings)
910 (Fsubst_char_in_region, Fformat, Ftranspose_regions): Use 1842 (Fsubst_char_in_region, Fformat, Ftranspose_regions):
911 EMACS_INT for buffer and string position variables. 1843 Use EMACS_INT for buffer and string position variables.
912 (Finsert_char): Protect against too large insertions. 1844 (Finsert_char): Protect against too large insertions.
913 1845
914 * lisp.h (clip_to_bounds): Adjust prototype. 1846 * lisp.h (clip_to_bounds): Adjust prototype.
@@ -945,8 +1877,8 @@
945 1877
946 * editfns.c (Fformat): Use EMACS_INT for string size variables. 1878 * editfns.c (Fformat): Use EMACS_INT for string size variables.
947 1879
948 * xdisp.c (store_mode_line_noprop, display_mode_element): Use 1880 * xdisp.c (store_mode_line_noprop, display_mode_element):
949 EMACS_INT for string positions. 1881 Use EMACS_INT for string positions.
950 1882
951 * intervals.c (get_property_and_range): Use EMACS_INT for buffer 1883 * intervals.c (get_property_and_range): Use EMACS_INT for buffer
952 position arguments. 1884 position arguments.
@@ -956,13 +1888,13 @@
956 * character.c (parse_str_as_multibyte, str_as_multibyte) 1888 * character.c (parse_str_as_multibyte, str_as_multibyte)
957 (parse_str_to_multibyte, str_to_multibyte, str_as_unibyte) 1889 (parse_str_to_multibyte, str_to_multibyte, str_as_unibyte)
958 (string_count_byte8, string_escape_byte8, c_string_width) 1890 (string_count_byte8, string_escape_byte8, c_string_width)
959 (strwidth, lisp_string_width, multibyte_chars_in_text): Use 1891 (strwidth, lisp_string_width, multibyte_chars_in_text):
960 EMACS_INT for string length variables and arguments. 1892 Use EMACS_INT for string length variables and arguments.
961 1893
962 * character.h (parse_str_as_multibyte, str_as_multibyte) 1894 * character.h (parse_str_as_multibyte, str_as_multibyte)
963 (parse_str_to_multibyte, str_to_multibyte, str_as_unibyte) 1895 (parse_str_to_multibyte, str_to_multibyte, str_as_unibyte)
964 (c_string_width, strwidth, lisp_string_width): Adjust 1896 (c_string_width, strwidth, lisp_string_width):
965 prototypes. 1897 Adjust prototypes.
966 1898
967 * font.c (font_intern_prop): Use EMACS_INT for string length 1899 * font.c (font_intern_prop): Use EMACS_INT for string length
968 variables. 1900 variables.
@@ -982,8 +1914,8 @@
982 (allocate_string_data, compact_small_strings, Fmake_string) 1914 (allocate_string_data, compact_small_strings, Fmake_string)
983 (Fmake_bool_vector, make_string, make_unibyte_string) 1915 (Fmake_bool_vector, make_string, make_unibyte_string)
984 (make_multibyte_string, make_string_from_bytes) 1916 (make_multibyte_string, make_string_from_bytes)
985 (make_specified_string_string, Fmake_list, Fmake_vector): Use 1917 (make_specified_string_string, Fmake_list, Fmake_vector):
986 EMACS_INT for string length variables and arguments. 1918 Use EMACS_INT for string length variables and arguments.
987 (find_string_data_in_pure, make_pure_string, make_pure_c_string) 1919 (find_string_data_in_pure, make_pure_string, make_pure_c_string)
988 (Fpurecopy): Use EMACS_INT for string size. 1920 (Fpurecopy): Use EMACS_INT for string size.
989 (mark_vectorlike, mark_char_table, mark_object): Use EMACS_UINT 1921 (mark_vectorlike, mark_char_table, mark_object): Use EMACS_UINT
@@ -1248,8 +2180,8 @@
1248 2180
12492010-09-04 Eli Zaretskii <eliz@gnu.org> 21812010-09-04 Eli Zaretskii <eliz@gnu.org>
1250 2182
1251 * w32uniscribe.c (uniscribe_shape): Update commentary. Don't 2183 * w32uniscribe.c (uniscribe_shape): Update commentary.
1252 try to reorder grapheme clusters, since LGSTRING should always 2184 Don't try to reorder grapheme clusters, since LGSTRING should always
1253 hold them in the logical order. 2185 hold them in the logical order.
1254 (uniscribe_encode_char, uniscribe_shape): Force ScriptShape to 2186 (uniscribe_encode_char, uniscribe_shape): Force ScriptShape to
1255 return glyph codes in the logical order. 2187 return glyph codes in the logical order.
@@ -1448,16 +2380,16 @@
1448 Do not define EMACS_HAVE_TTY_PGRP. Only define 2380 Do not define EMACS_HAVE_TTY_PGRP. Only define
1449 EMACS_GET_TTY_PGRP for !DOS_NT. 2381 EMACS_GET_TTY_PGRP for !DOS_NT.
1450 * sysdep.c: Include sysselect.h unconditionally. Do not include 2382 * sysdep.c: Include sysselect.h unconditionally. Do not include
1451 sys/ioctl.h and termios.h, systty.h does it. Use 2383 sys/ioctl.h and termios.h, systty.h does it.
1452 HAVE_SYS_UTSNAME_H instead of USG as an include guard. 2384 Use HAVE_SYS_UTSNAME_H instead of USG as an include guard.
1453 (init_baud_rate): Remove HAVE_TERMIO code. 2385 (init_baud_rate): Remove HAVE_TERMIO code.
1454 (child_setup_tty): Remove HAVE_TERMIO code. 2386 (child_setup_tty): Remove HAVE_TERMIO code.
1455 (emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS 2387 (emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS
1456 and HAVE_LTCHARS code. Use !DOS_NT instead of HAVE_TCATTR. 2388 and HAVE_LTCHARS code. Use !DOS_NT instead of HAVE_TCATTR.
1457 (new_ltchars, new_tchars): Remove, unused. 2389 (new_ltchars, new_tchars): Remove, unused.
1458 (init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS 2390 (init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS
1459 code. Remove special casing for __mips__, it was a no-op. Remove 2391 code. Remove special casing for __mips__, it was a no-op.
1460 HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS. 2392 Remove HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS.
1461 (init_sys_modes): Remove HPUX special case. 2393 (init_sys_modes): Remove HPUX special case.
1462 * process.c: Include stdlib.h unconditionally. Do not include 2394 * process.c: Include stdlib.h unconditionally. Do not include
1463 fcntl.h, systty.h does it. Remove conditional code for 2395 fcntl.h, systty.h does it. Remove conditional code for
@@ -2181,8 +3113,8 @@
2181 (initial_argv, last_nonmenu_event, load_in_progress) 3113 (initial_argv, last_nonmenu_event, load_in_progress)
2182 (noninteractive_need_newline, scroll_margin): Add declarations. 3114 (noninteractive_need_newline, scroll_margin): Add declarations.
2183 3115
2184 * keyboard.h (xmalloc_widget_value, digest_single_submenu): Remove 3116 * keyboard.h (xmalloc_widget_value, digest_single_submenu):
2185 declarations, menu.h has them. 3117 Remove declarations, menu.h has them.
2186 (QCbutton, QCtoggle, QCradio, QClabel, extra_keyboard_modifiers) 3118 (QCbutton, QCtoggle, QCradio, QClabel, extra_keyboard_modifiers)
2187 (Vinput_method_function, Qinput_method_function) 3119 (Vinput_method_function, Qinput_method_function)
2188 (Qevent_symbol_element_mask, last_event_timestamp): 3120 (Qevent_symbol_element_mask, last_event_timestamp):
@@ -2489,8 +3421,8 @@
2489 3421
2490 * term.c (Qspace, QCalign_to, QCwidth): Remove declarations. 3422 * term.c (Qspace, QCalign_to, QCwidth): Remove declarations.
2491 (encode_terminal_code, produce_composite_glyph): Remove unused variables. 3423 (encode_terminal_code, produce_composite_glyph): Remove unused variables.
2492 (set_tty_color_mode, term_mouse_highlight, term_get_fkeys): Remove 3424 (set_tty_color_mode, term_mouse_highlight, term_get_fkeys):
2493 local extern declarations. 3425 Remove local extern declarations.
2494 3426
2495 * xmenu.c: Do not included lwlib.h, not needed. 3427 * xmenu.c: Do not included lwlib.h, not needed.
2496 3428
@@ -2855,8 +3787,8 @@
2855 (cvt_pixel_dtor, x_window_to_menu_bar, xt_action_hook) 3787 (cvt_pixel_dtor, x_window_to_menu_bar, xt_action_hook)
2856 (xaw_jump_callback, xaw_scroll_callback) 3788 (xaw_jump_callback, xaw_scroll_callback)
2857 (x_create_toolkit_scroll_bar, x_set_toolkit_scroll_bar_thumb) 3789 (x_create_toolkit_scroll_bar, x_set_toolkit_scroll_bar_thumb)
2858 (x_wm_set_size_hint, x_activate_timeout_atimer): Convert 3790 (x_wm_set_size_hint, x_activate_timeout_atimer):
2859 definitions to standard C. 3791 Convert definitions to standard C.
2860 * xmenu.c (menubar_id_to_frame, popup_get_selection) 3792 * xmenu.c (menubar_id_to_frame, popup_get_selection)
2861 (popup_activate_callback, popup_deactivate_callback) 3793 (popup_activate_callback, popup_deactivate_callback)
2862 (menu_highlight_callback, menubar_selection_callback) 3794 (menu_highlight_callback, menubar_selection_callback)
@@ -2969,7 +3901,7 @@
2969 (Ffont_put): Accept font-entity and font-object too. 3901 (Ffont_put): Accept font-entity and font-object too.
2970 (Ffont_get_glyhphs): Renamed from Fget_font_glyphs. Arguments and 3902 (Ffont_get_glyhphs): Renamed from Fget_font_glyphs. Arguments and
2971 return value changed. 3903 return value changed.
2972 (syms_of_font): Adjusted for the above change. 3904 (syms_of_font): Adjust for the above change.
2973 3905
29742010-07-11 Andreas Schwab <schwab@linux-m68k.org> 39062010-07-11 Andreas Schwab <schwab@linux-m68k.org>
2975 3907
@@ -3060,8 +3992,8 @@
3060 3992
3061 * frame.c (make_frame): Initialize menu_bar_lines and 3993 * frame.c (make_frame): Initialize menu_bar_lines and
3062 tool_bar_lines members. 3994 tool_bar_lines members.
3063 (make_initial_frame, make_terminal_frame): Initialize 3995 (make_initial_frame, make_terminal_frame):
3064 menu_bar_lines using value of menu-bar-mode. 3996 Initialize menu_bar_lines using value of menu-bar-mode.
3065 3997
3066 * msdos.c (IT_set_frame_parameters): Don't set menu-bar-lines. 3998 * msdos.c (IT_set_frame_parameters): Don't set menu-bar-lines.
3067 3999
@@ -3509,8 +4441,8 @@
3509 * xsmfns.c (SSDATA): New macro. 4441 * xsmfns.c (SSDATA): New macro.
3510 (smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings 4442 (smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings
3511 passed to strlen/strcpy/strcat. 4443 passed to strlen/strcpy/strcat.
3512 (create_client_leader_window): Surround with #ifndef USE_GTK. Cast 4444 (create_client_leader_window): Surround with #ifndef USE_GTK.
3513 7:th arg to XChangeProperty to (unsigned char *). 4445 Cast 7:th arg to XChangeProperty to (unsigned char *).
3514 4446
3515 * xsettings.c (something_changedCB, parse_settings) 4447 * xsettings.c (something_changedCB, parse_settings)
3516 (apply_xft_settings): Reformat prototype. 4448 (apply_xft_settings): Reformat prototype.
@@ -3668,8 +4600,8 @@
3668 4600
3669 * msdos.c (IT_set_frame_parameters): Fix setting of colors in 4601 * msdos.c (IT_set_frame_parameters): Fix setting of colors in
3670 frames other than the initial one. Fix reversal of colors when 4602 frames other than the initial one. Fix reversal of colors when
3671 `reverse' is specified in the frame parameters. Call 4603 `reverse' is specified in the frame parameters.
3672 update_face_from_frame_parameter instead of 4604 Call update_face_from_frame_parameter instead of
3673 internal-set-lisp-face-attribute. Initialize screen colors from 4605 internal-set-lisp-face-attribute. Initialize screen colors from
3674 initial_screen_colors[] when f->default_face_done_p is zero, 4606 initial_screen_colors[] when f->default_face_done_p is zero,
3675 instead of depending on being called with default-frame-alist as 4607 instead of depending on being called with default-frame-alist as
@@ -3854,8 +4786,8 @@
3854 4786
38552010-06-30 Chong Yidong <cyd@stupidchicken.com> 47872010-06-30 Chong Yidong <cyd@stupidchicken.com>
3856 4788
3857 * frame.c (get_future_frame_param, Fmake_terminal_frame): Don't 4789 * frame.c (get_future_frame_param, Fmake_terminal_frame):
3858 check default-frame-alist. 4790 Don't check default-frame-alist.
3859 4791
38602010-06-30 Andreas Schwab <schwab@linux-m68k.org> 47922010-06-30 Andreas Schwab <schwab@linux-m68k.org>
3861 4793
@@ -3947,8 +4879,8 @@
3947 (Bug#6526). 4879 (Bug#6526).
3948 4880
3949 * xterm.h (gtk_widget_get_window, gtk_widget_get_mapped) 4881 * xterm.h (gtk_widget_get_window, gtk_widget_get_mapped)
3950 (gtk_adjustment_get_page_size, gtk_adjustment_get_upper): New 4882 (gtk_adjustment_get_page_size, gtk_adjustment_get_upper):
3951 defines based on what configure finds. 4883 New defines based on what configure finds.
3952 4884
3953 * xterm.c (XTflash): Use gtk_widget_get_window. 4885 * xterm.c (XTflash): Use gtk_widget_get_window.
3954 (xg_scroll_callback): Use gtk_adjustment_get_upper and 4886 (xg_scroll_callback): Use gtk_adjustment_get_upper and
@@ -3962,8 +4894,8 @@
3962 * gtkutil.h: Replace HAVE_GTK_FILE_BOTH with 4894 * gtkutil.h: Replace HAVE_GTK_FILE_BOTH with
3963 HAVE_GTK_FILE_SELECTION_NEW. 4895 HAVE_GTK_FILE_SELECTION_NEW.
3964 4896
3965 * gtkutil.c (xg_display_open, xg_display_close): Remove 4897 * gtkutil.c (xg_display_open, xg_display_close):
3966 HAVE_GTK_MULTIDISPLAY, it is always defined. 4898 Remove HAVE_GTK_MULTIDISPLAY, it is always defined.
3967 (xg_display_open): Return type is void. 4899 (xg_display_open): Return type is void.
3968 (gtk_widget_set_has_window) 4900 (gtk_widget_set_has_window)
3969 (gtk_dialog_get_action_area, gtk_dialog_get_content_area) 4901 (gtk_dialog_get_action_area, gtk_dialog_get_content_area)
@@ -3972,8 +4904,8 @@
3972 (gtk_adjustment_get_step_increment): #define these if not found 4904 (gtk_adjustment_get_step_increment): #define these if not found
3973 by configure. 4905 by configure.
3974 (remove_submenu): New define based on Gtk+ version. 4906 (remove_submenu): New define based on Gtk+ version.
3975 (xg_set_cursor, xg_frame_resized, xg_event_is_for_scrollbar): Use 4907 (xg_set_cursor, xg_frame_resized, xg_event_is_for_scrollbar):
3976 gtk_widget_get_window. 4908 Use gtk_widget_get_window.
3977 (xg_frame_resized, xg_update_frame_menubar): Use gtk_widget_get_mapped. 4909 (xg_frame_resized, xg_update_frame_menubar): Use gtk_widget_get_mapped.
3978 (xg_create_frame_widgets): Use gtk_widget_set_has_window. 4910 (xg_create_frame_widgets): Use gtk_widget_set_has_window.
3979 (create_dialog): Use gtk_dialog_get_action_area and 4911 (create_dialog): Use gtk_dialog_get_action_area and
@@ -3981,10 +4913,10 @@
3981 (xg_uses_old_file_dialog, xg_get_file_name): Remove HAVE_GTK_FILE_BOTH 4913 (xg_uses_old_file_dialog, xg_get_file_name): Remove HAVE_GTK_FILE_BOTH
3982 and HAVE_GTK_FILE_CHOOSER_DIALOG_NEW. File chooser is always 4914 and HAVE_GTK_FILE_CHOOSER_DIALOG_NEW. File chooser is always
3983 available, so checking for HAVE_GTK_FILE_SELECTION_NEW is enough. 4915 available, so checking for HAVE_GTK_FILE_SELECTION_NEW is enough.
3984 (xg_update_menubar, xg_update_submenu, xg_show_toolbar_item): Use 4916 (xg_update_menubar, xg_update_submenu, xg_show_toolbar_item):
3985 g_object_ref and g_object_unref. 4917 Use g_object_ref and g_object_unref.
3986 (xg_update_menu_item, xg_tool_bar_menu_proxy): Use 4918 (xg_update_menu_item, xg_tool_bar_menu_proxy):
3987 gtk_widget_get_sensitive. 4919 Use gtk_widget_get_sensitive.
3988 (xg_update_submenu): Use remove_submenu. 4920 (xg_update_submenu): Use remove_submenu.
3989 (xg_update_scrollbar_pos): Don't use GtkFixedChild, use child 4921 (xg_update_scrollbar_pos): Don't use GtkFixedChild, use child
3990 properties instead to get old x and y position. 4922 properties instead to get old x and y position.
@@ -4517,8 +5449,8 @@
4517 Move static/dynamic dependency stuff to deps.mk/autodeps.mk. 5449 Move static/dynamic dependency stuff to deps.mk/autodeps.mk.
4518 * deps.mk, autodeps.mk: New files, extracted from Makefile.in. 5450 * deps.mk, autodeps.mk: New files, extracted from Makefile.in.
4519 5451
4520 * bidi.c (bidi_cache_shrink, bidi_cache_iterator_state): Fix 5452 * bidi.c (bidi_cache_shrink, bidi_cache_iterator_state):
4521 reallocation of the cache. (Bug#6210) 5453 Fix reallocation of the cache. (Bug#6210)
4522 5454
45232010-05-19 Glenn Morris <rgm@gnu.org> 54552010-05-19 Glenn Morris <rgm@gnu.org>
4524 5456
@@ -5225,8 +6157,8 @@
5225 Reduce CPP usage. 6157 Reduce CPP usage.
5226 * Makefile.in (LIB_X11_LIB): Remove, inline in the only user. 6158 * Makefile.in (LIB_X11_LIB): Remove, inline in the only user.
5227 (obj): Use autoconf for unexec instead of cpp. 6159 (obj): Use autoconf for unexec instead of cpp.
5228 (C_SWITCH_SYSTEM, C_SWITCH_MACHINE, C_SWITCH_X_SITE): Remove 6160 (C_SWITCH_SYSTEM, C_SWITCH_MACHINE, C_SWITCH_X_SITE):
5229 definitions and undefs. Inline definitions in the only user. 6161 Remove definitions and undefs. Inline definitions in the only user.
5230 (ALL_CFLAGS): Substitute C_SWITCH_X_SYSTEM using autoconf. 6162 (ALL_CFLAGS): Substitute C_SWITCH_X_SYSTEM using autoconf.
5231 6163
52322010-04-27 Glenn Morris <rgm@gnu.org> 61642010-04-27 Glenn Morris <rgm@gnu.org>
@@ -5337,8 +6269,8 @@
5337 the only user: s/unixware.h. 6269 the only user: s/unixware.h.
5338 * ecrt0.c: Remove #ifndef static. Inline CRT0_DUMMIES definition 6270 * ecrt0.c: Remove #ifndef static. Inline CRT0_DUMMIES definition
5339 from m/intel386.h. 6271 from m/intel386.h.
5340 * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): Definitions 6272 * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE):
5341 moved here from m/intel386.h. 6273 Definitions moved here from m/intel386.h.
5342 6274
5343 * m/mips.h: Remove #if 0 code. 6275 * m/mips.h: Remove #if 0 code.
5344 6276
@@ -5420,14 +6352,14 @@
5420 HAVE_XFT. 6352 HAVE_XFT.
5421 (something_changedCB): store_font_changed_event is now 6353 (something_changedCB): store_font_changed_event is now
5422 store_config_changed_event. 6354 store_config_changed_event.
5423 (parse_settings): Rename from parse_xft_settings. Read 6355 (parse_settings): Rename from parse_xft_settings.
5424 non-xft xsettings outside #ifdef HAVE_XFT. 6356 Read non-xft xsettings outside #ifdef HAVE_XFT.
5425 (read_settings): Renamed from read_xft_settings. 6357 (read_settings): Renamed from read_xft_settings.
5426 (apply_xft_settings): Take current settings as parameter. Do not 6358 (apply_xft_settings): Take current settings as parameter. Do not
5427 call read_(xft)_settings. 6359 call read_(xft)_settings.
5428 (read_and_apply_settings): New function. 6360 (read_and_apply_settings): New function.
5429 (xft_settings_event): Do non-xft stuff out of HAVE_XFT. Call 6361 (xft_settings_event): Do non-xft stuff out of HAVE_XFT.
5430 read_and_apply_settings if there are settings to be read. 6362 Call read_and_apply_settings if there are settings to be read.
5431 (init_xsettings): Renamed from init_xfd_settings. 6363 (init_xsettings): Renamed from init_xfd_settings.
5432 Call read_and_apply_settings unconditionally. 6364 Call read_and_apply_settings unconditionally.
5433 (xsettings_initialize): Call init_xsettings. 6365 (xsettings_initialize): Call init_xsettings.
@@ -5555,19 +6487,19 @@
5555 6487
5556 * xdisp.c [HAVE_WINDOW_SYSTEM]: Add prototype for 6488 * xdisp.c [HAVE_WINDOW_SYSTEM]: Add prototype for
5557 append_stretch_glyph. 6489 append_stretch_glyph.
5558 (set_cursor_from_row) <cursor_x>: Remove unused variable. Fix 6490 (set_cursor_from_row) <cursor_x>: Remove unused variable.
5559 off-by-one error in computing x at end of text in the row. 6491 Fix off-by-one error in computing x at end of text in the row.
5560 (append_stretch_glyph): In reversed row, prepend the glyph rather 6492 (append_stretch_glyph): In reversed row, prepend the glyph rather
5561 than append it. Set resolved_level and bidi_type of the glyph. 6493 than append it. Set resolved_level and bidi_type of the glyph.
5562 (extend_face_to_end_of_line): If the row is reversed, prepend a 6494 (extend_face_to_end_of_line): If the row is reversed, prepend a
5563 stretch glyph whose width is such that the rightmost glyph will be 6495 stretch glyph whose width is such that the rightmost glyph will be
5564 drawn at the right margin of the window. Fix off-by-one error on 6496 drawn at the right margin of the window. Fix off-by-one error on
5565 TTY frames in testing whether a line needs face extension. Fix 6497 TTY frames in testing whether a line needs face extension.
5566 face extension at ZV. If this is the last glyph row, use 6498 Fix face extension at ZV. If this is the last glyph row, use
5567 DEFAULT_FACE_ID, to avoid painting the rest of the window with the 6499 DEFAULT_FACE_ID, to avoid painting the rest of the window with the
5568 region face. 6500 region face.
5569 (set_cursor_from_row, display_line): Use 6501 (set_cursor_from_row, display_line):
5570 MATRIX_ROW_CONTINUATION_LINE_P instead of testing value of 6502 Use MATRIX_ROW_CONTINUATION_LINE_P instead of testing value of
5571 row->continuation_lines_width. 6503 row->continuation_lines_width.
5572 (next_element_from_buffer): Don't call bidi_paragraph_init if we 6504 (next_element_from_buffer): Don't call bidi_paragraph_init if we
5573 are at ZV. Fixes a crash when reseated to ZV by 6505 are at ZV. Fixes a crash when reseated to ZV by
@@ -5933,8 +6865,8 @@
5933 6865
5934 * xmenu.c: include xsettings.h and xlwmenu.h if USE_LUCID. 6866 * xmenu.c: include xsettings.h and xlwmenu.h if USE_LUCID.
5935 (apply_systemfont_to_menu): New function. 6867 (apply_systemfont_to_menu): New function.
5936 (set_frame_menubar, create_and_show_popup_menu): Call 6868 (set_frame_menubar, create_and_show_popup_menu):
5937 apply_systemfont_to_menu. 6869 Call apply_systemfont_to_menu.
5938 6870
59392010-04-07 Jan Djärv <jan.h.d@swipnet.se> 68712010-04-07 Jan Djärv <jan.h.d@swipnet.se>
5940 6872
@@ -5962,8 +6894,8 @@
5962 6894
59632010-04-03 Eli Zaretskii <eliz@gnu.org> 68952010-04-03 Eli Zaretskii <eliz@gnu.org>
5964 6896
5965 * bidi.c (bidi_resolve_explicit, bidi_level_of_next_char): Check 6897 * bidi.c (bidi_resolve_explicit, bidi_level_of_next_char):
5966 bidi_it->bytepos against ZV_BYTE instead of bidi_it->ch against 6898 Check bidi_it->bytepos against ZV_BYTE instead of bidi_it->ch against
5967 BIDI_EOB. Fixes infloop with vertical cursor motion at ZV. 6899 BIDI_EOB. Fixes infloop with vertical cursor motion at ZV.
5968 6900
5969 * w32fns.c (x_create_tip_frame): Copy `parms' before we modify it 6901 * w32fns.c (x_create_tip_frame): Copy `parms' before we modify it
@@ -6186,8 +7118,8 @@
6186 (prepare_desired_row): Preserve the reversed_p flag. 7118 (prepare_desired_row): Preserve the reversed_p flag.
6187 (row_equal_p): Compare the reversed_p attributes as well. 7119 (row_equal_p): Compare the reversed_p attributes as well.
6188 7120
6189 * xdisp.c (init_iterator): Initialize it->bidi_p. Call 7121 * xdisp.c (init_iterator): Initialize it->bidi_p.
6190 bidi_init_it and set it->paragraph_embedding from the current 7122 Call bidi_init_it and set it->paragraph_embedding from the current
6191 buffer's value of bidi_paragraph_direction. 7123 buffer's value of bidi_paragraph_direction.
6192 (reseat_1): Initialize bidi_it.first_elt. 7124 (reseat_1): Initialize bidi_it.first_elt.
6193 (set_iterator_to_next, next_element_from_buffer): Use the value of 7125 (set_iterator_to_next, next_element_from_buffer): Use the value of
@@ -6198,8 +7130,8 @@
6198 (next_element_from_buffer): If bidi_it.first_elt is set, 7130 (next_element_from_buffer): If bidi_it.first_elt is set,
6199 initialize paragraph direction and find the first character to 7131 initialize paragraph direction and find the first character to
6200 display in the visual order. If reseated to a middle of a line, 7132 display in the visual order. If reseated to a middle of a line,
6201 prime the bidi iterator starting at the line's beginning. Handle 7133 prime the bidi iterator starting at the line's beginning.
6202 the situation where we overstepped stop_charpos due to 7134 Handle the situation where we overstepped stop_charpos due to
6203 non-linearity of the bidi iteration. Likewise for when we back up 7135 non-linearity of the bidi iteration. Likewise for when we back up
6204 beyond the previous stop_charpos. When moving across stop_charpos, 7136 beyond the previous stop_charpos. When moving across stop_charpos,
6205 record it in prev_stop. 7137 record it in prev_stop.
@@ -6220,8 +7152,8 @@
6220 now EMACS_INT; all callers changed. 7152 now EMACS_INT; all callers changed.
6221 (set_cursor_from_row): Rewritten to support bidirectional text and 7153 (set_cursor_from_row): Rewritten to support bidirectional text and
6222 reversed glyph rows. 7154 reversed glyph rows.
6223 (text_outside_line_unchanged_p, try_window_id): Disable 7155 (text_outside_line_unchanged_p, try_window_id):
6224 optimizations if we are reordering bidirectional text and the 7156 Disable optimizations if we are reordering bidirectional text and the
6225 paragraph direction can be affected by the change. 7157 paragraph direction can be affected by the change.
6226 (append_glyph, append_composite_glyph) 7158 (append_glyph, append_composite_glyph)
6227 (produce_image_glyph, append_stretch_glyph): Set the 7159 (produce_image_glyph, append_stretch_glyph): Set the
@@ -8374,8 +9306,8 @@
83742009-09-18 Adrian Robert <Adrian.B.Robert@gmail.com> 93062009-09-18 Adrian Robert <Adrian.B.Robert@gmail.com>
8375 9307
8376 * emacs.c (inhibit_x_resources): Update doc string for NS. 9308 * emacs.c (inhibit_x_resources): Update doc string for NS.
8377 (main) [HAVE_NS]: Don't process --no-init-file option. Remove 9309 (main) [HAVE_NS]: Don't process --no-init-file option.
8378 legacy code for -NXHost. Fix error printf in daemon case. 9310 Remove legacy code for -NXHost. Fix error printf in daemon case.
8379 9311
8380 * nsterm.h (ns_no_defaults): Remove. 9312 * nsterm.h (ns_no_defaults): Remove.
8381 9313
@@ -8384,8 +9316,8 @@
8384 (ns_use_qd_smoothing): Remove legacy variable. 9316 (ns_use_qd_smoothing): Remove legacy variable.
8385 (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and 9317 (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and
8386 don't update the NSWindow itself. 9318 don't update the NSWindow itself.
8387 (EmacsView-windowWillUseStandardFrame:defaultFrame:): Improve 9319 (EmacsView-windowWillUseStandardFrame:defaultFrame:):
8388 state detection and store user rect ourselves. (Bug #3581) 9320 Improve state detection and store user rect ourselves. (Bug #3581)
8389 9321
8390 * nsfont.m (nsfont_draw) [NS_IMPL_COCOA]: Don't use 9322 * nsfont.m (nsfont_draw) [NS_IMPL_COCOA]: Don't use
8391 ns_use_qd_smoothing. 9323 ns_use_qd_smoothing.
@@ -8688,8 +9620,8 @@
86882009-08-21 Adrian Robert <Adrian.B.Robert@gmail.com> 96202009-08-21 Adrian Robert <Adrian.B.Robert@gmail.com>
8689 9621
8690 * nsterm.m (ns_get_color): Update documentation properly for last 9622 * nsterm.m (ns_get_color): Update documentation properly for last
8691 change, and clean up loose ends in the code left by it. Fix 9623 change, and clean up loose ends in the code left by it.
8692 longstanding bug with 16-bit hex parsing, and add support for 9624 Fix longstanding bug with 16-bit hex parsing, and add support for
8693 yet another X11 format (rgb:r/g/b) for compatibility. 9625 yet another X11 format (rgb:r/g/b) for compatibility.
8694 * nsfns.m (EmacsDialogPanel-runDialogAt): Add declaration of 9626 * nsfns.m (EmacsDialogPanel-runDialogAt): Add declaration of
8695 timer_check() to avoid crash on Leopard/PPC. Bug #2154. 9627 timer_check() to avoid crash on Leopard/PPC. Bug #2154.
@@ -10584,8 +11516,8 @@
10584 (Fdefine_coding_system_internal): Likewise. 11516 (Fdefine_coding_system_internal): Likewise.
10585 (setup_coding_system): Likewise. Remove unneeded casts. 11517 (setup_coding_system): Likewise. Remove unneeded casts.
10586 (detect_coding_iso_2022): Compare Viso_2022_charset_list with 11518 (detect_coding_iso_2022): Compare Viso_2022_charset_list with
10587 CODING_ATTR_CHARSET_LIST, not CODING_ATTR_SAFE_CHARSETS. Remove 11519 CODING_ATTR_CHARSET_LIST, not CODING_ATTR_SAFE_CHARSETS.
10588 unneeded casts. 11520 Remove unneeded casts.
10589 11521
10590 * insdel.c (del_range_2): Don't modify gap contents when called 11522 * insdel.c (del_range_2): Don't modify gap contents when called
10591 from decode_coding_object. (Bug#1809) 11523 from decode_coding_object. (Bug#1809)
@@ -10598,8 +11530,8 @@
10598 11530
10599 * lisp.h: Define Qfont_spec, Qfont_entity, Qfont_object extern. 11531 * lisp.h: Define Qfont_spec, Qfont_entity, Qfont_object extern.
10600 11532
10601 * font.c (Qfont_spec, Qfont_entity, Qfont_object): Definitions 11533 * font.c (Qfont_spec, Qfont_entity, Qfont_object):
10602 moved to data.c. 11534 Definitions moved to data.c.
10603 11535
106042009-02-20 Adrian Robert <Adrian.B.Robert@gmail.com> 115362009-02-20 Adrian Robert <Adrian.B.Robert@gmail.com>
10605 11537
@@ -11615,8 +12547,8 @@
11615 here; it will be done in init_frame_faces. 12547 here; it will be done in init_frame_faces.
11616 12548
11617 * xterm.h (struct xim_inst_t): Definition moved from xterm.c. 12549 * xterm.h (struct xim_inst_t): Definition moved from xterm.c.
11618 (struct x_display_info): Remove unused member null_pixel. New 12550 (struct x_display_info): Remove unused member null_pixel.
11619 member xim_callback_data. 12551 New member xim_callback_data.
11620 12552
11621 * xterm.c (struct xim_inst_t): Definition moved to xterm.h. 12553 * xterm.c (struct xim_inst_t): Definition moved to xterm.h.
11622 (xim_initialize): Save pointer to callback function data. 12554 (xim_initialize): Save pointer to callback function data.
@@ -11641,8 +12573,8 @@
11641 12573
116422008-12-12 Jason Rumney <jasonr@gnu.org> 125742008-12-12 Jason Rumney <jasonr@gnu.org>
11643 12575
11644 * w32fns.c (x_display_info_for_name, Fx_open_connection): Set 12576 * w32fns.c (x_display_info_for_name, Fx_open_connection):
11645 Vwindow_system_version to the real w32 major version. 12577 Set Vwindow_system_version to the real w32 major version.
11646 12578
116472008-12-12 Dan Nicolaescu <dann@ics.uci.edu> 125792008-12-12 Dan Nicolaescu <dann@ics.uci.edu>
11648 12580
@@ -11892,7 +12824,7 @@
11892 (set_category_set): Extern it. 12824 (set_category_set): Extern it.
11893 12825
11894 * category.c (hash_get_category_set): New function. 12826 * category.c (hash_get_category_set): New function.
11895 (Fmodify_category_entry): Adjusted for the change of 12827 (Fmodify_category_entry): Adjust for the change of
11896 char_table_ref_and_range. Call hash_get_category_set to get a 12828 char_table_ref_and_range. Call hash_get_category_set to get a
11897 category set to store in the table. 12829 category set to store in the table.
11898 12830
@@ -11910,8 +12842,8 @@
11910 (SET_TEMP_CHARSET_WORK_ENCODER, GET_TEMP_CHARSET_WORK_ENCODER) 12842 (SET_TEMP_CHARSET_WORK_ENCODER, GET_TEMP_CHARSET_WORK_ENCODER)
11911 (SET_TEMP_CHARSET_WORK_DECODER, GET_TEMP_CHARSET_WORK_DECODER): 12843 (SET_TEMP_CHARSET_WORK_DECODER, GET_TEMP_CHARSET_WORK_DECODER):
11912 New macros. 12844 New macros.
11913 (load_charset_map): Meaning of control_flag changed. If 12845 (load_charset_map): Meaning of control_flag changed.
11914 inhibit_load_charset_map is nonzero, setup a table in 12846 If inhibit_load_charset_map is nonzero, setup a table in
11915 temp_charset_work. 12847 temp_charset_work.
11916 (load_charset): New argument control_flag. 12848 (load_charset): New argument control_flag.
11917 (map_charset_for_dump): New function. 12849 (map_charset_for_dump): New function.
@@ -11930,18 +12862,18 @@
11930 (syms_of_charset): Make `inhibit-load-charset-map' a Lisp 12862 (syms_of_charset): Make `inhibit-load-charset-map' a Lisp
11931 variable. 12863 variable.
11932 12864
11933 * chartab.c (sub_char_table_ref_and_range): Adjusted for the 12865 * chartab.c (sub_char_table_ref_and_range): Adjust for the
11934 change of char_table_ref_and_range. 12866 change of char_table_ref_and_range.
11935 (char_table_ref_and_range): Change the meaning of argument FROM 12867 (char_table_ref_and_range): Change the meaning of argument FROM
11936 and TO. Now the caller must provide initial values for *FROM 12868 and TO. Now the caller must provide initial values for *FROM
11937 and *TO. 12869 and *TO.
11938 12870
11939 * fontset.c (fontset_add): Adjusted for the change of 12871 * fontset.c (fontset_add): Adjust for the change of
11940 char_table_ref_and_range. 12872 char_table_ref_and_range.
11941 (fontset_get_font_group): Likewise. 12873 (fontset_get_font_group): Likewise.
11942 (Ffontset_info): Likewise. 12874 (Ffontset_info): Likewise.
11943 12875
11944 * keymap.c (describe_vector): Adjusted for the change of 12876 * keymap.c (describe_vector): Adjust for the change of
11945 char_table_ref_and_range. For char-table, put boundary between 12877 char_table_ref_and_range. For char-table, put boundary between
11946 non-ASCII and 8-bit characters. 12878 non-ASCII and 8-bit characters.
11947 12879
@@ -13755,8 +14687,8 @@
13755 14687
13756 * s/darwin.h: Add #define DARWIN_OS. Get rid of C_SWITCH_SYSTEM def. 14688 * s/darwin.h: Add #define DARWIN_OS. Get rid of C_SWITCH_SYSTEM def.
13757 Change LIBS_MACGUI to LIBS_NSGUI. Move temacs-conditionalized defs 14689 Change LIBS_MACGUI to LIBS_NSGUI. Move temacs-conditionalized defs
13758 closer to C_SWITCH_SYSTEM_TEMACS so usage is understood. Expand 14690 closer to C_SWITCH_SYSTEM_TEMACS so usage is understood.
13759 comment on NO_SOCK_SIGIO. 14691 Expand comment on NO_SOCK_SIGIO.
13760 14692
137612008-08-03 Chong Yidong <cyd@stupidchicken.com> 146932008-08-03 Chong Yidong <cyd@stupidchicken.com>
13762 14694
@@ -14748,8 +15680,8 @@
14748 15680
147492008-07-15 Chris Hall <chris@web.workinglinux.com> (tiny change) 156812008-07-15 Chris Hall <chris@web.workinglinux.com> (tiny change)
14750 15682
14751 * callproc.c (set_initial_environment): Initialize 15683 * callproc.c (set_initial_environment):
14752 Vprocess_environment under CANNOT_DUMP (fixes crash when 15684 Initialize Vprocess_environment under CANNOT_DUMP (fixes crash when
14753 batch-compiling for bootstrap). 15685 batch-compiling for bootstrap).
14754 15686
147552008-07-15 Chris Hall <chris@web.workinglinux.com> (tiny change) 156872008-07-15 Chris Hall <chris@web.workinglinux.com> (tiny change)
@@ -15165,8 +16097,8 @@
15165 16097
15166 * xftfont.c (struct xftfont_info): New member ft_size. Make the 16098 * xftfont.c (struct xftfont_info): New member ft_size. Make the
15167 member order compatible with struct ftfont_info. 16099 member order compatible with struct ftfont_info.
15168 (xftfont_open): Add FC_CHARSET to the pattern. Set 16100 (xftfont_open): Add FC_CHARSET to the pattern.
15169 xftfont_info->ft_size. Don't unlock the face. Check BDF 16101 Set xftfont_info->ft_size. Don't unlock the face. Check BDF
15170 properties if appropriate. 16102 properties if appropriate.
15171 (xftfont_close): Unlock the face. 16103 (xftfont_close): Unlock the face.
15172 (xftfont_anchor_point, xftfont_shape): Deleted. 16104 (xftfont_anchor_point, xftfont_shape): Deleted.
@@ -15592,8 +16524,8 @@
15592 truncate only if the window width is below that integer. 16524 truncate only if the window width is below that integer.
15593 (start_display, resize_mini_window, produce_stretch_glyph) 16525 (start_display, resize_mini_window, produce_stretch_glyph)
15594 (display_string, move_it_in_display_line_to): Use line_wrap. 16526 (display_string, move_it_in_display_line_to): Use line_wrap.
15595 (back_to_previous_visible_line_start, reseat_1): Reset 16527 (back_to_previous_visible_line_start, reseat_1):
15596 string_from_display_prop_p. 16528 Reset string_from_display_prop_p.
15597 (display_line): Extend default face to end of line when wrapping. 16529 (display_line): Extend default face to end of line when wrapping.
15598 16530
155992008-06-24 Kim F. Storm <storm@cua.dk> 165312008-06-24 Kim F. Storm <storm@cua.dk>
@@ -16961,8 +17893,8 @@
16961 (struct glyph_string): New member underline_position and 17893 (struct glyph_string): New member underline_position and
16962 underline_thickness. 17894 underline_thickness.
16963 (enum lface_attribute_index): Remove LFACE_AVGWIDTH_INDEX. 17895 (enum lface_attribute_index): Remove LFACE_AVGWIDTH_INDEX.
16964 (struct face): Change type of `font' to `struct font *'. Remove 17896 (struct face): Change type of `font' to `struct font *'.
16965 members `font_name', `font_info_id'. 17897 Remove members `font_name', `font_info_id'.
16966 (per_char_metric, encode_char): Delete externs. 17898 (per_char_metric, encode_char): Delete externs.
16967 (calc_pixel_width_or_height): Adjust the prototype. 17899 (calc_pixel_width_or_height): Adjust the prototype.
16968 17900
@@ -16990,8 +17922,8 @@
16990 (CHECK_FONT_GET_OBJECT): Likewise. 17922 (CHECK_FONT_GET_OBJECT): Likewise.
16991 (XFONT_SPEC, XFONT_ENTITY, XFONT_OBJECT, XSETFONT): New macros. 17923 (XFONT_SPEC, XFONT_ENTITY, XFONT_OBJECT, XSETFONT): New macros.
16992 (PT_PER_INCH, POINT_TO_PIXEL, PIXEL_TO_POINT): Moved from font.h. 17924 (PT_PER_INCH, POINT_TO_PIXEL, PIXEL_TO_POINT): Moved from font.h.
16993 (struct font_driver): New members case_sensitive anc check. Type 17925 (struct font_driver): New members case_sensitive anc check.
16994 of the member list and open changed. 17926 Type of the member list and open changed.
16995 (enable_font_backend, font_symbolic_weight, font_symbolic_slant) 17927 (enable_font_backend, font_symbolic_weight, font_symbolic_slant)
16996 (font_symbolic_width, font_find_object, font_get_spec) 17928 (font_symbolic_width, font_find_object, font_get_spec)
16997 (font_set_lface_from_name): Delete extern. 17929 (font_set_lface_from_name): Delete extern.
@@ -17011,7 +17943,7 @@
17011 (font_make_spec, font_make_entity, font_make_object) 17943 (font_make_spec, font_make_entity, font_make_object)
17012 (font_intern_prop): Renamed from intern_downcase. Don't downcase 17944 (font_intern_prop): Renamed from intern_downcase. Don't downcase
17013 the string. Callers changed. 17945 the string. Callers changed.
17014 (font_pixel_size): Adjusted for the format change of font-related 17946 (font_pixel_size): Adjust for the format change of font-related
17015 objects. 17947 objects.
17016 (prop_name_to_numeric, prop_numeric_to_name): Delete them. 17948 (prop_name_to_numeric, prop_numeric_to_name): Delete them.
17017 (font_style_to_value, font_style_symbolic): New function. 17949 (font_style_to_value, font_style_symbolic): New function.
@@ -17019,19 +17951,19 @@
17019 (font_registry_charsets): Use Fassoc_string instead of 17951 (font_registry_charsets): Use Fassoc_string instead of
17020 assq_no_quit. 17952 assq_no_quit.
17021 (font_prop_validate_symbol): Don't return null_string. 17953 (font_prop_validate_symbol): Don't return null_string.
17022 (font_prop_validate_style): Adjusted for the change of 17954 (font_prop_validate_style): Adjust for the change of
17023 style-related values in a font vector. 17955 style-related values in a font vector.
17024 (font_property_table): Delete entries for QClanguage and 17956 (font_property_table): Delete entries for QClanguage and
17025 QCantialias, add entries for QCavgwidth. 17957 QCantialias, add entries for QCavgwidth.
17026 (get_font_prop_index): Delete the 2nd argument FROM. 17958 (get_font_prop_index): Delete the 2nd argument FROM.
17027 (font_prop_validate): Arguments changed. 17959 (font_prop_validate): Arguments changed.
17028 (font_put_extra): Adjusted for the change of font-related objects. 17960 (font_put_extra): Adjust for the change of font-related objects.
17029 (font_expand_wildcards, font_parse_xlfd, font_unparse_xlfd) 17961 (font_expand_wildcards, font_parse_xlfd, font_unparse_xlfd)
17030 (font_parse_fcname, font_unparse_fcname) 17962 (font_parse_fcname, font_unparse_fcname)
17031 (font_prepare_composition): Likewise. 17963 (font_prepare_composition): Likewise.
17032 (font_parse_family_registry): Renamed from font_merge_old_spec. 17964 (font_parse_family_registry): Renamed from font_merge_old_spec.
17033 (otf_open): Delete the 1st arg entity. 17965 (otf_open): Delete the 1st arg entity.
17034 (font_otf_capability): Adjusted for the above change. 17966 (font_otf_capability): Adjust for the above change.
17035 (font_score): New arg alternate_families. Adjusted for the change 17967 (font_score): New arg alternate_families. Adjusted for the change
17036 of font-related objects. 17968 of font-related objects.
17037 (font_sort_entites): New arg best_only. 17969 (font_sort_entites): New arg best_only.
@@ -17040,27 +17972,27 @@
17040 (font_match_p): Check alternate families. 17972 (font_match_p): Check alternate families.
17041 (font_find_object): Delete it. 17973 (font_find_object): Delete it.
17042 (font_check_object): New function. 17974 (font_check_object): New function.
17043 (font_clear_cache): Adjusted for the change of font-related objects. 17975 (font_clear_cache): Adjust for the change of font-related objects.
17044 (font_delete_unmatched): New arg. 17976 (font_delete_unmatched): New arg.
17045 (font_list_entities): Call font_driver->list with a spec that 17977 (font_list_entities): Call font_driver->list with a spec that
17046 doesn't specify style-related properties. 17978 doesn't specify style-related properties.
17047 (font_matching_entity): Arguments changed. Caller changed. 17979 (font_matching_entity): Arguments changed. Caller changed.
17048 (font_open_entity): Adjusted for the change of font-related objects. 17980 (font_open_entity): Adjust for the change of font-related objects.
17049 (font_close_object, font_has_char, font_encode_char) 17981 (font_close_object, font_has_char, font_encode_char)
17050 (font_get_name, font_get_spec): Likewise. 17982 (font_get_name, font_get_spec): Likewise.
17051 (font_spec_from_name, font_clear_prop, font_update_lface): 17983 (font_spec_from_name, font_clear_prop, font_update_lface):
17052 New functions. 17984 New functions.
17053 (font_find_for_lface, font_open_for_lface, font_load_for_lface) 17985 (font_find_for_lface, font_open_for_lface, font_load_for_lface)
17054 (font_prepare_for_face, font_done_for_face, font_open_by_name) 17986 (font_prepare_for_face, font_done_for_face, font_open_by_name)
17055 (font_at): Adjusted for the change of font-related objects. 17987 (font_at): Adjust for the change of font-related objects.
17056 (font_range): New function. 17988 (font_range): New function.
17057 (Ffontp, Ffont_spec, Ffont_get, Ffont_put, Flist_fonts) 17989 (Ffontp, Ffont_spec, Ffont_get, Ffont_put, Flist_fonts)
17058 (Ffont_xlfd_name): Adjusted for the change of font-related objects. 17990 (Ffont_xlfd_name): Adjust for the change of font-related objects.
17059 (Fcopy_font_spec, Fmerge_font_spec): New function. 17991 (Fcopy_font_spec, Fmerge_font_spec): New function.
17060 (Ffont_family_list): Renamed from list-families. 17992 (Ffont_family_list): Renamed from list-families.
17061 (Finternal_set_font_style_table): Arguments changed. 17993 (Finternal_set_font_style_table): Arguments changed.
17062 (Ffont_fill_gstring, Ffont_shape_text, Fopen_font) 17994 (Ffont_fill_gstring, Ffont_shape_text, Fopen_font)
17063 (Ffont_drive_otf, Fquery_font, Ffont_match_p): Adjusted for the 17995 (Ffont_drive_otf, Fquery_font, Ffont_match_p): Adjust for the
17064 change of font-related objects. 17996 change of font-related objects.
17065 (syms_of_font): Delete "ifdef USE_FONT_BACKEND". DEFSYM new symbols. 17997 (syms_of_font): Delete "ifdef USE_FONT_BACKEND". DEFSYM new symbols.
17066 17998
@@ -17070,8 +18002,8 @@
17070 (enum FONT_SPEC_INDEX): Delete it. 18002 (enum FONT_SPEC_INDEX): Delete it.
17071 (font_info, list_fonts_func, load_font_func, query_font_func) 18003 (font_info, list_fonts_func, load_font_func, query_font_func)
17072 (set_frame_fontset_func, find_ccl_program_func) 18004 (set_frame_fontset_func, find_ccl_program_func)
17073 (get_font_repertory_func, new_fontset_from_font_name): Delete 18005 (get_font_repertory_func, new_fontset_from_font_name):
17074 externs. 18006 Delete externs.
17075 (fontset_from_font_name): Extern it. 18007 (fontset_from_font_name): Extern it.
17076 (FS_LOAD_FONT, FONT_INFO_ID, FONT_INFO_FROM_ID) 18008 (FS_LOAD_FONT, FONT_INFO_ID, FONT_INFO_FROM_ID)
17077 (FONT_INFO_FROM_FACE): Deleted. 18009 (FONT_INFO_FROM_FACE): Deleted.
@@ -17101,7 +18033,7 @@
17101 (face_for_char): Likewise. Call face_for_char with font_object. 18033 (face_for_char): Likewise. Call face_for_char with font_object.
17102 (fs_load_font): Delete. Delete #pragma surrounding it. 18034 (fs_load_font): Delete. Delete #pragma surrounding it.
17103 (fs_query_fontset): Use strcasecmp instead of strcmp. 18035 (fs_query_fontset): Use strcasecmp instead of strcmp.
17104 (generate_ascii_font_name): Adjusted for the format change of 18036 (generate_ascii_font_name): Adjust for the format change of
17105 font-spec. 18037 font-spec.
17106 (Fset_fontset_font): Likewise. Use new macros to set elements of 18038 (Fset_fontset_font): Likewise. Use new macros to set elements of
17107 font-def. 18039 font-def.
@@ -17112,7 +18044,7 @@
17112 a fontset is already created for the font. FIx updating of 18044 a fontset is already created for the font. FIx updating of
17113 Vfontset_alias_alist. 18045 Vfontset_alias_alist.
17114 (fontset_ascii_font): Deleted. 18046 (fontset_ascii_font): Deleted.
17115 (Ffont_info): Adjusted for the format change of font-spec. 18047 (Ffont_info): Adjust for the format change of font-spec.
17116 (Finternal_char_font): Likewise. 18048 (Finternal_char_font): Likewise.
17117 (Ffontset_info): Likewise. 18049 (Ffontset_info): Likewise.
17118 (syms_of_fontset): Don't check load_font_func. 18050 (syms_of_fontset): Don't check load_font_func.
@@ -17128,13 +18060,13 @@
17128 (x_set_font_backend): Use FRAME_FONT macro to check if a font is 18060 (x_set_font_backend): Use FRAME_FONT macro to check if a font is
17129 already set for the frame. 18061 already set for the frame.
17130 18062
17131 * ftfont.c (ftfont_pattern_entity): Argument FRAME removed. Make 18063 * ftfont.c (ftfont_pattern_entity): Argument FRAME removed.
17132 a font-entity by font_make_entity. Use font_intern_prop instead 18064 Make a font-entity by font_make_entity. Use font_intern_prop instead
17133 of intern_downcase. Use FONT_SET_STYLE to set a style-related 18065 of intern_downcase. Use FONT_SET_STYLE to set a style-related
17134 font property. If a font is scalable, set avgwidth property to 0. 18066 font property. If a font is scalable, set avgwidth property to 0.
17135 Set font-entity property by font_put_extra. 18067 Set font-entity property by font_put_extra.
17136 (ftfont_list_generic_family): Argument SPEC and REGISTRY removed. 18068 (ftfont_list_generic_family): Argument SPEC and REGISTRY removed.
17137 (ffont_driver): Adjusted for the change of struct font_driver. 18069 (ffont_driver): Adjust for the change of struct font_driver.
17138 (ftfont_spec_pattern): New function. 18070 (ftfont_spec_pattern): New function.
17139 (ftfont_list): Return a list, not vector. 18071 (ftfont_list): Return a list, not vector.
17140 (ftfont_match): Use ftfont_spec_pattern to get a pattern. 18072 (ftfont_match): Use ftfont_spec_pattern to get a pattern.
@@ -17145,7 +18077,7 @@
17145 font property. Don't update dpyinfo->smallest_font_height and 18077 font property. Don't update dpyinfo->smallest_font_height and
17146 dpyinfo->smallest_char_width. 18078 dpyinfo->smallest_char_width.
17147 (ftfont_close): Don't free `struct font'. 18079 (ftfont_close): Don't free `struct font'.
17148 (ftfont_has_char): Adjusted for the format change of font-entity. 18080 (ftfont_has_char): Adjust for the format change of font-entity.
17149 (ftfont_encode_char, ftfont_text_extents): Likewise. 18081 (ftfont_encode_char, ftfont_text_extents): Likewise.
17150 18082
17151 * ftxfont.c (ftxfont_list): Return a list, not vector. 18083 * ftxfont.c (ftxfont_list): Return a list, not vector.
@@ -17154,10 +18086,10 @@
17154 font property. Don't update dpyinfo->smallest_font_height and 18086 font property. Don't update dpyinfo->smallest_font_height and
17155 dpyinfo->smallest_char_width. 18087 dpyinfo->smallest_char_width.
17156 (ftxfont_close): Don't decrease FRAME_X_DISPLAY_INFO (f)->n_fonts. 18088 (ftxfont_close): Don't decrease FRAME_X_DISPLAY_INFO (f)->n_fonts.
17157 (ftxfont_draw): Adjusted for the change of struct font. 18089 (ftxfont_draw): Adjust for the change of struct font.
17158 18090
17159 * image.c (image_ascent): Don't include "charset.h". Include 18091 * image.c (image_ascent): Don't include "charset.h".
17160 "character.h" and "font.h". 18092 Include "character.h" and "font.h".
17161 18093
17162 * lisp.h (enum pvec_type): New member PREV_FONT. 18094 * lisp.h (enum pvec_type): New member PREV_FONT.
17163 (Fassoc_string): EXFUN it. 18095 (Fassoc_string): EXFUN it.
@@ -17175,19 +18107,19 @@
17175 'struct font *'. 18107 'struct font *'.
17176 (get_char_face_and_encoding): Assign the whole encoding task to 18108 (get_char_face_and_encoding): Assign the whole encoding task to
17177 the `encode-char' method of a font driver. 18109 the `encode-char' method of a font driver.
17178 (fill_composite_glyph_string): Adjusted for the change of `struct 18110 (fill_composite_glyph_string): Adjust for the change of `struct
17179 face' and `struct glyph_string'. 18111 face' and `struct glyph_string'.
17180 (fill_glyph_string): Likewise. 18112 (fill_glyph_string): Likewise.
17181 (get_per_char_metric): Arguments changed. 18113 (get_per_char_metric): Arguments changed.
17182 (x_get_glyph_overhangs): Adjusted for the change of `struct face' 18114 (x_get_glyph_overhangs): Adjust for the change of `struct face'
17183 and `struct glyph_string'. 18115 and `struct glyph_string'.
17184 (produce_stretch_glyph, calc_line_height_property) 18116 (produce_stretch_glyph, calc_line_height_property)
17185 (x_produce_glyphs): Likewise. 18117 (x_produce_glyphs): Likewise.
17186 18118
17187 * xfaces.c: Throughout the file, delete all USE_FONT_BACKEND 18119 * xfaces.c: Throughout the file, delete all USE_FONT_BACKEND
17188 conditionals. Don't check enable_font_backend. Delete all codes 18120 conditionals. Don't check enable_font_backend. Delete all codes
17189 used only when USE_FONT_BACKEND is not defined. Use 18121 used only when USE_FONT_BACKEND is not defined.
17190 FONT_XXX_NAME_NUMERIC instead of face_numeric_xxx. 18122 Use FONT_XXX_NAME_NUMERIC instead of face_numeric_xxx.
17191 (QCfoundry, QCadstyle, QCregistry, QCspacing, QCsize, QCavgwidth) 18123 (QCfoundry, QCadstyle, QCregistry, QCspacing, QCsize, QCavgwidth)
17192 (Qp): Extern them. 18124 (Qp): Extern them.
17193 (clear_font_table, load_face_font, xlfd_lookup_field_contents): 18125 (clear_font_table, load_face_font, xlfd_lookup_field_contents):
@@ -17260,7 +18192,7 @@
17260 (xfont_query_font): Deleted. 18192 (xfont_query_font): Deleted.
17261 (xfont_find_ccl_program): Renamed from x_find_ccl_program and 18193 (xfont_find_ccl_program): Renamed from x_find_ccl_program and
17262 moved from xterm.c. 18194 moved from xterm.c.
17263 (xfont_driver): Adjusted for the change of struct font_driver. 18195 (xfont_driver): Adjust for the change of struct font_driver.
17264 (compare_font_names): New function. 18196 (compare_font_names): New function.
17265 (xfont_list_pattern): Sort font names case insensitively. Make 18197 (xfont_list_pattern): Sort font names case insensitively. Make
17266 font_entity by calling font_make_entity. Avoid auto-scaled fonts. 18198 font_entity by calling font_make_entity. Avoid auto-scaled fonts.
@@ -17272,16 +18204,16 @@
17272 font property. Don't update dpyinfo->smallest_font_height and 18204 font property. Don't update dpyinfo->smallest_font_height and
17273 dpyinfo->smallest_char_width. 18205 dpyinfo->smallest_char_width.
17274 (xfont_close): Don't free struct font. 18206 (xfont_close): Don't free struct font.
17275 (xfont_prepare_face): Adjusted for the change of struct font. 18207 (xfont_prepare_face): Adjust for the change of struct font.
17276 (xfont_done_face): Deleted. 18208 (xfont_done_face): Deleted.
17277 (xfont_has_char): Adjusted for the change of struct font. 18209 (xfont_has_char): Adjust for the change of struct font.
17278 (xfont_encode_char, xfont_draw): Likewise. 18210 (xfont_encode_char, xfont_draw): Likewise.
17279 (xfont_check): New function. 18211 (xfont_check): New function.
17280 18212
17281 * xftfont.c (xftfont_list): Adjusted for the change of `list' 18213 * xftfont.c (xftfont_list): Adjust for the change of `list'
17282 callback function. 18214 callback function.
17283 (xftfont_match): Adjusted for the format change of font-entity. 18215 (xftfont_match): Adjust for the format change of font-entity.
17284 (xftfont_open): Adjusted for the format change of font-entity and 18216 (xftfont_open): Adjust for the format change of font-entity and
17285 font-object. Adjusted for the change of struct font. Return a 18217 font-object. Adjusted for the change of struct font. Return a
17286 font-object. Don't update dpyinfo->smallest_font_height and 18218 font-object. Don't update dpyinfo->smallest_font_height and
17287 dpyinfo->smallest_char_width. 18219 dpyinfo->smallest_char_width.
@@ -17305,7 +18237,7 @@
17305 used only when USE_FONT_BACKEND is not defined. Don't include ccl.h. 18237 used only when USE_FONT_BACKEND is not defined. Don't include ccl.h.
17306 (x_per_char_metric, x_encode_char): Deleted. 18238 (x_per_char_metric, x_encode_char): Deleted.
17307 (x_set_cursor_gc, x_set_mouse_face_gc): Don't set GCFont. 18239 (x_set_cursor_gc, x_set_mouse_face_gc): Don't set GCFont.
17308 (x_compute_glyph_string_overhangs): Adjusted for the change of 18240 (x_compute_glyph_string_overhangs): Adjust for the change of
17309 `struct face'. 18241 `struct face'.
17310 (x_draw_glyph_string_foreground) 18242 (x_draw_glyph_string_foreground)
17311 (x_draw_composite_glyph_string_foreground): Likewise. 18243 (x_draw_composite_glyph_string_foreground): Likewise.
@@ -17317,7 +18249,7 @@
17317 (x_font_min_bounds, x_compute_min_glyph_bounds, x_load_font) 18249 (x_font_min_bounds, x_compute_min_glyph_bounds, x_load_font)
17318 (x_query_font, x_get_font_repertory): Deleted. 18250 (x_query_font, x_get_font_repertory): Deleted.
17319 (x_find_ccl_program): Renamed and moved to xfont.c. 18251 (x_find_ccl_program): Renamed and moved to xfont.c.
17320 (x_redisplay_interface): Adjusted for the change of `struct 18252 (x_redisplay_interface): Adjust for the change of `struct
17321 redisplay_interface'. 18253 redisplay_interface'.
17322 18254
17323 * w32fns.c: Throughout the file, delete all USE_FONT_BACKEND 18255 * w32fns.c: Throughout the file, delete all USE_FONT_BACKEND
@@ -17352,19 +18284,19 @@
17352 Use FONT_SET_STYLE to set a style-related font property. If a 18284 Use FONT_SET_STYLE to set a style-related font property. If a
17353 font is scalable, set avgwidth property to 0. Set font-entity 18285 font is scalable, set avgwidth property to 0. Set font-entity
17354 property by font_put_extra. 18286 property by font_put_extra.
17355 (font_matches_spec): Adjusted for the format change of font-entity. 18287 (font_matches_spec): Adjust for the format change of font-entity.
17356 (w32_weight_table, w32_decode_weight): New variables. 18288 (w32_weight_table, w32_decode_weight): New variables.
17357 (w32_encode_weight): New function. 18289 (w32_encode_weight): New function.
17358 (fill_in_logfont): Adjusted for the format change of font-spec. 18290 (fill_in_logfont): Adjust for the format change of font-spec.
17359 (w32font_full_name): Use FONT_WEIGHT_SYMBOLIC to get a symbol 18291 (w32font_full_name): Use FONT_WEIGHT_SYMBOLIC to get a symbol
17360 weight value. 18292 weight value.
17361 (w32font_driver): Adjusted for the change of struct font_driver. 18293 (w32font_driver): Adjust for the change of struct font_driver.
17362 18294
17363 * w32term.h: Throughout the file, delete all USE_FONT_BACKEND 18295 * w32term.h: Throughout the file, delete all USE_FONT_BACKEND
17364 conditionals. Don't check enable_font_backend. Surround non-used 18296 conditionals. Don't check enable_font_backend. Surround non-used
17365 code by "#ifdef OLD_FONT" and "endif". 18297 code by "#ifdef OLD_FONT" and "endif".
17366 (FONT_WIDTH, FONT_HEIGHT, FONT_BASE, FONT_DESCENT) 18298 (FONT_WIDTH, FONT_HEIGHT, FONT_BASE, FONT_DESCENT)
17367 (FONT_AVG_WIDTH): Adjusted for the change of struct font. 18299 (FONT_AVG_WIDTH): Adjust for the change of struct font.
17368 18300
17369 * w32term.c: Throughout the file, delete all USE_FONT_BACKEND 18301 * w32term.c: Throughout the file, delete all USE_FONT_BACKEND
17370 conditionals. Don't check enable_font_backend. Delete all codes 18302 conditionals. Don't check enable_font_backend. Delete all codes
@@ -17374,9 +18306,9 @@
17374 * w32uniscribe.c: Delete USE_FONT_BACKEND conditional. 18306 * w32uniscribe.c: Delete USE_FONT_BACKEND conditional.
17375 (uniscribe_open): Return value changed to font-object. 18307 (uniscribe_open): Return value changed to font-object.
17376 Adjusted for the format change of font-object. 18308 Adjusted for the format change of font-object.
17377 (uniscribe_otf_capability): Adjusted for the change of struct font. 18309 (uniscribe_otf_capability): Adjust for the change of struct font.
17378 (add_opentype_font_name_to_list): Don't downcase names. 18310 (add_opentype_font_name_to_list): Don't downcase names.
17379 (uniscribe_font_driver): Adjusted for the change of struct 18311 (uniscribe_font_driver): Adjust for the change of struct
17380 font_driver. 18312 font_driver.
17381 18313
173822008-05-13 Chong Yidong <cyd@stupidchicken.com> 183142008-05-13 Chong Yidong <cyd@stupidchicken.com>
@@ -19527,8 +20459,8 @@
19527 20459
195282008-02-01 Kenichi Handa <handa@ni.aist.go.jp> 204602008-02-01 Kenichi Handa <handa@ni.aist.go.jp>
19529 20461
19530 * coding.c (decode_coding_object, encode_coding_object): Adjust 20462 * coding.c (decode_coding_object, encode_coding_object):
19531 marker positions after conversion. 20463 Adjust marker positions after conversion.
19532 20464
19533 * lisp.h (struct Lisp_Marker): New member need_adjustment. 20465 * lisp.h (struct Lisp_Marker): New member need_adjustment.
19534 20466
@@ -20097,8 +21029,8 @@
20097 21029
200982008-02-01 Jason Rumney <jasonr@gnu.org> 210302008-02-01 Jason Rumney <jasonr@gnu.org>
20099 21031
20100 * w32term.c (x_set_glyph_string_clipping): Use 21032 * w32term.c (x_set_glyph_string_clipping):
20101 get_glyph_string_clip_rects. 21033 Use get_glyph_string_clip_rects.
20102 (x_set_glyph_string_clipping_exactly, x_draw_glyph_string): 21034 (x_set_glyph_string_clipping_exactly, x_draw_glyph_string):
20103 Adjust for the change of struct glyph_string. 21035 Adjust for the change of struct glyph_string.
20104 21036
@@ -20109,8 +21041,8 @@
20109 * xftfont.c (xftfont_draw): Adjust for the change of struct 21041 * xftfont.c (xftfont_draw): Adjust for the change of struct
20110 glyph_string. 21042 glyph_string.
20111 21043
20112 * xterm.c (x_set_glyph_string_clipping): Use 21044 * xterm.c (x_set_glyph_string_clipping):
20113 get_glyph_string_clip_rects. 21045 Use get_glyph_string_clip_rects.
20114 (x_set_glyph_string_clipping_exactly, x_draw_glyph_string): 21046 (x_set_glyph_string_clipping_exactly, x_draw_glyph_string):
20115 Adjust for the change of struct glyph_string. 21047 Adjust for the change of struct glyph_string.
20116 21048
@@ -20287,8 +21219,8 @@
20287 constant. Save QCspacing value. Save list of scripts instead of 21219 constant. Save QCspacing value. Save list of scripts instead of
20288 binary subranges. 21220 binary subranges.
20289 (w32_generic_family, logfonts_match, font_matches_spec): New functions. 21221 (w32_generic_family, logfonts_match, font_matches_spec): New functions.
20290 (add_font_entity_to_list): Use font_callback_data struct. Filter 21222 (add_font_entity_to_list): Use font_callback_data struct.
20291 unwanted fonts. 21223 Filter unwanted fonts.
20292 (add_one_font_entity_to_list): Use font_callback_data struct. 21224 (add_one_font_entity_to_list): Use font_callback_data struct.
20293 (w32_registry): Default to iso10646_1. 21225 (w32_registry): Default to iso10646_1.
20294 (fill_in_logfont): Use dpi from extra slot. Don't bother with 21226 (fill_in_logfont): Use dpi from extra slot. Don't bother with
@@ -20509,8 +21441,8 @@
20509 21441
205102008-02-01 Kenichi Handa <handa@m17n.org> 214422008-02-01 Kenichi Handa <handa@m17n.org>
20511 21443
20512 * xterm.c (x_draw_composite_glyph_string_foreground): Fix 21444 * xterm.c (x_draw_composite_glyph_string_foreground):
20513 indexing into elements of s->cmp and s->char2b. 21445 Fix indexing into elements of s->cmp and s->char2b.
20514 21446
205152008-02-01 Juanma Barranquero <lekktu@gmail.com> 214472008-02-01 Juanma Barranquero <lekktu@gmail.com>
20516 21448
@@ -20748,8 +21680,8 @@
20748 21680
20749 * font.c (font_parse_fcname, font_parse_name): Don't change :name 21681 * font.c (font_parse_fcname, font_parse_name): Don't change :name
20750 property of FONT. 21682 property of FONT.
20751 (LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE, check_gstring): Define 21683 (LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE, check_gstring):
20752 them unconditionally. 21684 Define them unconditionally.
20753 (font_matching_entity): New function. 21685 (font_matching_entity): New function.
20754 (font_open_by_name): Try font_matching_entity if exact match is 21686 (font_open_by_name): Try font_matching_entity if exact match is
20755 not found. 21687 not found.
@@ -20794,8 +21726,8 @@
20794 (font_prepare_composition): Set cmp->glyph_len. 21726 (font_prepare_composition): Set cmp->glyph_len.
20795 (font_open_entity): Set font->scalable. 21727 (font_open_entity): Set font->scalable.
20796 (Ffont_get): Handle :otf property. 21728 (Ffont_get): Handle :otf property.
20797 (Ffont_otf_gsub, Ffont_otf_gpos, Ffont_otf_alternates): New 21729 (Ffont_otf_gsub, Ffont_otf_gpos, Ffont_otf_alternates):
20798 functions. 21730 New functions.
20799 (Fquery_font): Use font->font.full_name. 21731 (Fquery_font): Use font->font.full_name.
20800 (syms_of_font): Defsubr Sfont_otf_gsub, Sfont_otf_gpos, and 21732 (syms_of_font): Defsubr Sfont_otf_gsub, Sfont_otf_gpos, and
20801 Sfont_otf_alternates. 21733 Sfont_otf_alternates.
@@ -20864,8 +21796,8 @@
20864 (font_at): New function. 21796 (font_at): New function.
20865 (Ffont_get): If FONT is a font-object, get entity from it. 21797 (Ffont_get): If FONT is a font-object, get entity from it.
20866 (Ffont_make_gstring): Initialize elements of glyphs with nil. 21798 (Ffont_make_gstring): Initialize elements of glyphs with nil.
20867 (Ffont_fill_gstring): Use macro LGSTRING_XXX and LGLYPH_XXX. Fix 21799 (Ffont_fill_gstring): Use macro LGSTRING_XXX and LGLYPH_XXX.
20868 range check. 21800 Fix range check.
20869 (Ffont_at): New function. 21801 (Ffont_at): New function.
20870 (syms_of_font): Defsubr Sfont_at. 21802 (syms_of_font): Defsubr Sfont_at.
20871 21803
@@ -20896,7 +21828,7 @@
208962008-02-01 Kenichi Handa <handa@m17n.org> 218282008-02-01 Kenichi Handa <handa@m17n.org>
20897 21829
20898 * font.h (LGLYPH_XOFF, LGLYPH_YOFF, LGLYPH_WIDTH, LGLYPH_WADJUST) 21830 * font.h (LGLYPH_XOFF, LGLYPH_YOFF, LGLYPH_WIDTH, LGLYPH_WADJUST)
20899 (LGLYPH_SET_WIDTH): Adjusted for the change of LGLYPH format. 21831 (LGLYPH_SET_WIDTH): Adjust for the change of LGLYPH format.
20900 (LGLYPH_ADJUSTMENT, LGLYPH_SET_ADJUSTMENT): New macros. 21832 (LGLYPH_ADJUSTMENT, LGLYPH_SET_ADJUSTMENT): New macros.
20901 21833
20902 * font.c (font_merge_old_spec): Treat '*' in foundry as a wild card. 21834 * font.c (font_merge_old_spec): Treat '*' in foundry as a wild card.
@@ -20958,8 +21890,8 @@
20958 (font_prop_validate_extra): Delete. 21890 (font_prop_validate_extra): Delete.
20959 (font_prop_validate_spacing): New function. 21891 (font_prop_validate_spacing): New function.
20960 (font_property_table): Add elements for all known properties. 21892 (font_property_table): Add elements for all known properties.
20961 (get_font_prop_index): Rename from check_font_prop_name. New 21893 (get_font_prop_index): Rename from check_font_prop_name.
20962 argument FROM. Change caller. 21894 New argument FROM. Change caller.
20963 (font_prop_validate): Validate all known properties. 21895 (font_prop_validate): Validate all known properties.
20964 (font_put_extra): Delete argument force. Change caller. 21896 (font_put_extra): Delete argument force. Change caller.
20965 (font_expand_wildcards): Make it static. Fix the way of shrinking 21897 (font_expand_wildcards): Make it static. Fix the way of shrinking
@@ -21031,8 +21963,8 @@
21031 (font_open_for_lface, font_open_by_name): Fix handling of font size. 21963 (font_open_for_lface, font_open_by_name): Fix handling of font size.
21032 (Ffont_spec): Add QCname property that contains only unknown properties. 21964 (Ffont_spec): Add QCname property that contains only unknown properties.
21033 21965
21034 * ftfont.c (ftfont_list): Use assq_no_quit, not Fassq. Don't 21966 * ftfont.c (ftfont_list): Use assq_no_quit, not Fassq.
21035 include weight in listing pattern, instead check weight of each 21967 Don't include weight in listing pattern, instead check weight of each
21036 listed font. Don't include scalable in pattern. Pay attention to 21968 listed font. Don't include scalable in pattern. Pay attention to
21037 FONT_PIXEL_SIZE_QUANTUM. 21969 FONT_PIXEL_SIZE_QUANTUM.
21038 21970
@@ -21067,8 +21999,8 @@
21067 21999
21068 * font.c (XLFD_SMALLNUM_MASK): Delete this macro. 22000 * font.c (XLFD_SMALLNUM_MASK): Delete this macro.
21069 (XLFD_LARGENUM_MASK): Delete XLFD_ENCODING_MASK from it. 22001 (XLFD_LARGENUM_MASK): Delete XLFD_ENCODING_MASK from it.
21070 (font_expand_wildcards): Fix handling ENCODING field. Avoid 22002 (font_expand_wildcards): Fix handling ENCODING field.
21071 unnecessary checks for weight, slant, and swidth. 22003 Avoid unnecessary checks for weight, slant, and swidth.
21072 (font_parse_fcname): New function. 22004 (font_parse_fcname): New function.
21073 (font_unparse_fcname): New function. 22005 (font_unparse_fcname): New function.
21074 (font_parse_name): New function. 22006 (font_parse_name): New function.
@@ -21302,8 +22234,8 @@
21302 * xfns.c [USE_FONT_BACKEND]: Include "font.h". 22234 * xfns.c [USE_FONT_BACKEND]: Include "font.h".
21303 (x_default_font_parameter) [USE_FONT_BACKEND]: New function. 22235 (x_default_font_parameter) [USE_FONT_BACKEND]: New function.
21304 (Fx_create_frame) [USE_FONT_BACKEND]: If enable_font_backend is 22236 (Fx_create_frame) [USE_FONT_BACKEND]: If enable_font_backend is
21305 nonzero, register all available font drivers. Call 22237 nonzero, register all available font drivers.
21306 x_default_font_parameter for deciding a font. 22238 Call x_default_font_parameter for deciding a font.
21307 (x_create_tip_frame) [USE_FONT_BACKEND]: Likewise. 22239 (x_create_tip_frame) [USE_FONT_BACKEND]: Likewise.
21308 22240
21309 * xterm.c [USE_FONT_BACKEND]: Include "font.h". 22241 * xterm.c [USE_FONT_BACKEND]: Include "font.h".
@@ -21347,8 +22279,8 @@
21347 22279
213482008-02-01 Kenichi Handa <handa@m17n.org> 222802008-02-01 Kenichi Handa <handa@m17n.org>
21349 22281
21350 * coding.c (DECODE_EMACS_MULE_20_RELATIVE_COMPOSITION): Fix 22282 * coding.c (DECODE_EMACS_MULE_20_RELATIVE_COMPOSITION):
21351 condition to terminate the loop. 22283 Fix condition to terminate the loop.
21352 22284
213532008-02-01 Kenichi Handa <handa@m17n.org> 222852008-02-01 Kenichi Handa <handa@m17n.org>
21354 22286
@@ -21381,8 +22313,8 @@
21381 22313
213822008-02-01 Kenichi Handa <handa@m17n.org> 223142008-02-01 Kenichi Handa <handa@m17n.org>
21383 22315
21384 * xterm.c (x_set_glyph_string_clipping_exactly): Set 22316 * xterm.c (x_set_glyph_string_clipping_exactly):
21385 src->clip_head and src->clip_tail temporarily instead of src->hl. 22317 Set src->clip_head and src->clip_tail temporarily instead of src->hl.
21386 22318
21387 * ccl.c (CCL_WRITE_STRING): Handle a flag bit for multibyte 22319 * ccl.c (CCL_WRITE_STRING): Handle a flag bit for multibyte
21388 character sequence. 22320 character sequence.
@@ -21414,8 +22346,8 @@
21414 (BUILD_COMPOSITE_GLYPH_STRING): If C is TAB, set s->face to NULL. 22346 (BUILD_COMPOSITE_GLYPH_STRING): If C is TAB, set s->face to NULL.
21415 (x_produce_glyphs): If CH is TAB, set cmp->offsets properly. 22347 (x_produce_glyphs): If CH is TAB, set cmp->offsets properly.
21416 22348
21417 * xterm.c (x_draw_composite_glyph_string_foreground): Check 22349 * xterm.c (x_draw_composite_glyph_string_foreground):
21418 s->face is NULL or not. 22350 Check s->face is NULL or not.
21419 22351
214202008-02-01 Kenichi Handa <handa@m17n.org> 223522008-02-01 Kenichi Handa <handa@m17n.org>
21421 22353
@@ -21465,8 +22397,8 @@
21465 Qnil. Use JIS_TO_SJIS instead of ENCODE_SJIS. 22397 Qnil. Use JIS_TO_SJIS instead of ENCODE_SJIS.
21466 (decode_mac_font_name): Use decode_coding_c_string instead of 22398 (decode_mac_font_name): Use decode_coding_c_string instead of
21467 decode_coding. 22399 decode_coding.
21468 (x_load_font): Initialize fontp->fontset to -1. Set 22400 (x_load_font): Initialize fontp->fontset to -1.
21469 fontp->encoding_type. 22401 Set fontp->encoding_type.
21470 22402
214712008-02-01 Kenichi Handa <handa@m17n.org> 224032008-02-01 Kenichi Handa <handa@m17n.org>
21472 22404
@@ -21513,8 +22445,8 @@
21513 (emacs${EXEEXT}): Run $(RUN_TEMACS) unconditionally. 22445 (emacs${EXEEXT}): Run $(RUN_TEMACS) unconditionally.
21514 (UNIDATA): New variable. 22446 (UNIDATA): New variable.
21515 (${lispsource}international/charprop.el): Depends on ${UNIDATA}. 22447 (${lispsource}international/charprop.el): Depends on ${UNIDATA}.
21516 (bootstrap-emacs${EXEEXT}): Depends on charprop.el. Run 22448 (bootstrap-emacs${EXEEXT}): Depends on charprop.el.
21517 $(RUN_TEMACS) unconditionally. 22449 Run $(RUN_TEMACS) unconditionally.
21518 22450
215192008-02-01 Kenichi Handa <handa@m17n.org> 224512008-02-01 Kenichi Handa <handa@m17n.org>
21520 22452
@@ -21531,10 +22463,10 @@
21531 22463
21532 * w32select.c (validate_coding_system) 22464 * w32select.c (validate_coding_system)
21533 (setup_windows_coding_system): New functions. 22465 (setup_windows_coding_system): New functions.
21534 (convert_to_handle_as_coded, Fw32_get_clipboard_data): Use 22466 (convert_to_handle_as_coded, Fw32_get_clipboard_data):
21535 setup_windows_coding_system. 22467 Use setup_windows_coding_system.
21536 (setup_config, Fw32_get_clipboard_data): Use 22468 (setup_config, Fw32_get_clipboard_data):
21537 validate_coding_system. 22469 Use validate_coding_system.
21538 (Fx_selection_exists): Move call to setup_config to a place 22470 (Fx_selection_exists): Move call to setup_config to a place
21539 where signals are allowed. 22471 where signals are allowed.
21540 22472
@@ -21616,8 +22548,8 @@
21616 22548
21617 * fontset.c (fs_load_font): Use fast_string_match_ignore_case 22549 * fontset.c (fs_load_font): Use fast_string_match_ignore_case
21618 instead of fast_c_string_match_ignore_case. 22550 instead of fast_c_string_match_ignore_case.
21619 (find_font_encoding): Change argument to Lisp_Object. Use 22551 (find_font_encoding): Change argument to Lisp_Object.
21620 fast_string_match_ignore_case instead of 22552 Use fast_string_match_ignore_case instead of
21621 fast_c_string_match_ignore_case. Change caller. 22553 fast_c_string_match_ignore_case. Change caller.
21622 22554
216232008-02-01 Kenichi Handa <handa@m17n.org> 225552008-02-01 Kenichi Handa <handa@m17n.org>
@@ -21644,13 +22576,13 @@
21644 Qundecided. 22576 Qundecided.
21645 (Fterminal_coding_system): Return nil if terminal coding system is 22577 (Fterminal_coding_system): Return nil if terminal coding system is
21646 `undecided'. 22578 `undecided'.
21647 (syms_of_coding): Define coding-system `undecided' here. Setup 22579 (syms_of_coding): Define coding-system `undecided' here.
21648 terminal_coding as `undecided'. 22580 Setup terminal_coding as `undecided'.
21649 22581
216502008-02-01 Kenichi Handa <handa@m17n.org> 225822008-02-01 Kenichi Handa <handa@m17n.org>
21651 22583
21652 * xdisp.c (message_dolog, set_message_1): Call 22584 * xdisp.c (message_dolog, set_message_1):
21653 unibyte_char_to_multibyte with arg type int. 22585 Call unibyte_char_to_multibyte with arg type int.
21654 22586
21655 * lread.c (read1): Fix reading of a char-table. 22587 * lread.c (read1): Fix reading of a char-table.
21656 22588
@@ -21748,8 +22680,8 @@
21748 22680
217492008-02-01 Kenichi Handa <handa@m17n.org> 226812008-02-01 Kenichi Handa <handa@m17n.org>
21750 22682
21751 * coding.c (Ffind_coding_systems_region_internal): Include 22683 * coding.c (Ffind_coding_systems_region_internal):
21752 raw-text and no-conversion in the result. 22684 Include raw-text and no-conversion in the result.
21753 22685
217542008-02-01 Kenichi Handa <handa@m17n.org> 226862008-02-01 Kenichi Handa <handa@m17n.org>
21755 22687
@@ -21805,16 +22737,16 @@
21805 22737
21806 * fontset.c: Include "intervals.h". 22738 * fontset.c: Include "intervals.h".
21807 (fontset_face): Fix comparing of Lisp_Objects. 22739 (fontset_face): Fix comparing of Lisp_Objects.
21808 (free_face_fontset, new_fontset_from_font_name): Fix 22740 (free_face_fontset, new_fontset_from_font_name):
21809 Lisp_Object/int mixup. 22741 Fix Lisp_Object/int mixup.
21810 22742
21811 * editfns.c (Ftranslate_region_internal): Fix Lisp_Object/int mixup. 22743 * editfns.c (Ftranslate_region_internal): Fix Lisp_Object/int mixup.
21812 22744
21813 * coding.c: Add many prototypes for static functions. 22745 * coding.c: Add many prototypes for static functions.
21814 (get_translation_table): Allow max_lookup to be NULL. 22746 (get_translation_table): Allow max_lookup to be NULL.
21815 (decode_coding, Ffind_coding_systems_region_internal) 22747 (decode_coding, Ffind_coding_systems_region_internal)
21816 (Funencodable_char_position, Fcheck_coding_systems_region): Call 22748 (Funencodable_char_position, Fcheck_coding_systems_region):
21817 get_translation_table with max_lookup NULL. 22749 Call get_translation_table with max_lookup NULL.
21818 22750
218192008-02-01 Kenichi Handa <handa@m17n.org> 227512008-02-01 Kenichi Handa <handa@m17n.org>
21820 22752
@@ -21943,8 +22875,8 @@
21943 (Fdefine_coding_system_internal): Accept list of translation 22875 (Fdefine_coding_system_internal): Accept list of translation
21944 tables as :encode-translation-table and :decode-translation-table. 22876 tables as :encode-translation-table and :decode-translation-table.
21945 (Fcoding_system_put): New function. 22877 (Fcoding_system_put): New function.
21946 (syms_of_coding): Declare new symbols. Defsubr 22878 (syms_of_coding): Declare new symbols.
21947 Scoding_system_put. 22879 Defsubr Scoding_system_put.
21948 (decode_coding_sjis, encode_coding_sjis): Handle 4th charset, 22880 (decode_coding_sjis, encode_coding_sjis): Handle 4th charset,
21949 typically JISX0212. 22881 typically JISX0212.
21950 22882
@@ -22065,8 +22997,8 @@
22065 * chartab.c (map_sub_char_table_for_charset): Fix args to 22997 * chartab.c (map_sub_char_table_for_charset): Fix args to
22066 c_function with. 22998 c_function with.
22067 22999
22068 * coding.h (enum coding_result_code): Delete 23000 * coding.h (enum coding_result_code):
22069 CODING_RESULT_INSUFFICIENT_CMP, add CODING_RESULT_INVALID_SRC. 23001 Delete CODING_RESULT_INSUFFICIENT_CMP, add CODING_RESULT_INVALID_SRC.
22070 23002
22071 * coding.c (Qinsufficient_source, Qinconsistent_eol) 23003 * coding.c (Qinsufficient_source, Qinconsistent_eol)
22072 (Qinvalid_source, Qinterrupted, Qinsufficient_memory): New variables. 23004 (Qinvalid_source, Qinterrupted, Qinsufficient_memory): New variables.
@@ -22278,8 +23210,8 @@
22278 23210
22279 * w32console.c: Include character.h. Use terminal_encode_buffer 23211 * w32console.c: Include character.h. Use terminal_encode_buffer
22280 from term.c. 23212 from term.c.
22281 (write_glyphs): Use new version of encode_terminal_code. Use 23213 (write_glyphs): Use new version of encode_terminal_code.
22282 encode_coding_object in place of encode_coding. 23214 Use encode_coding_object in place of encode_coding.
22283 23215
22284 * w32bdf.c (w32_load_bdf_font): Clear font_info before filling. 23216 * w32bdf.c (w32_load_bdf_font): Clear font_info before filling.
22285 encoding becomes encoding_type. 23217 encoding becomes encoding_type.
@@ -22303,16 +23235,16 @@
22303 * charset.h (charset_unicode): Extern it. 23235 * charset.h (charset_unicode): Extern it.
22304 23236
22305 * charset.c (string_xstring_p): Check by (C >= 0x100). 23237 * charset.c (string_xstring_p): Check by (C >= 0x100).
22306 (find_charsets_in_text): Change format of the arc CHARSETS. New 23238 (find_charsets_in_text): Change format of the arc CHARSETS.
22307 arg MULTIBYTE. 23239 New arg MULTIBYTE.
22308 (Ffind_charset_region, Ffind_charset_string): Adjust for the 23240 (Ffind_charset_region, Ffind_charset_string): Adjust for the
22309 change of find_charsets_in_text. 23241 change of find_charsets_in_text.
22310 (Fsplit_char): Fix doc. Never return unknown. 23242 (Fsplit_char): Fix doc. Never return unknown.
22311 23243
22312 * chartab.c (char_table_translate): Use CHARACTERP, not INTEGERP. 23244 * chartab.c (char_table_translate): Use CHARACTERP, not INTEGERP.
22313 23245
22314 * coding.c (Fdefine_coding_system_alias): Update 23246 * coding.c (Fdefine_coding_system_alias):
22315 Vcoding_system_list. 23247 Update Vcoding_system_list.
22316 23248
22317 * fontset.c (load_font_get_repertory): Pay attention to the case 23249 * fontset.c (load_font_get_repertory): Pay attention to the case
22318 that ENCODING of a font is specified by a char-table. 23250 that ENCODING of a font is specified by a char-table.
@@ -22322,16 +23254,16 @@
22322 23254
223232008-02-01 Kenichi Handa <handa@m17n.org> 232552008-02-01 Kenichi Handa <handa@m17n.org>
22324 23256
22325 * term.c (encode_terminal_code): Don't handle glyph-table. Check 23257 * term.c (encode_terminal_code): Don't handle glyph-table.
22326 if a character is encodable by the terminal coding system. If 23258 Check if a character is encodable by the terminal coding system.
22327 not, produces proper number of `?'s. Update 23259 If not, produces proper number of `?'s. Update
22328 terminal_encode_buffer and terminal_encode_buf_size if necessary. 23260 terminal_encode_buffer and terminal_encode_buf_size if necessary.
22329 (produce_glyphs): Check by CHAR_BYTE8_P, not SINGLE_BYTE_CHAR_P. 23261 (produce_glyphs): Check by CHAR_BYTE8_P, not SINGLE_BYTE_CHAR_P.
22330 23262
223312008-02-01 Kenichi Handa <handa@m17n.org> 232632008-02-01 Kenichi Handa <handa@m17n.org>
22332 23264
22333 * term.c (terminal_encode_buffer, terminal_encode_buf_size): New 23265 * term.c (terminal_encode_buffer, terminal_encode_buf_size):
22334 variables. 23266 New variables.
22335 (encode_terminal_code): Change argument. Encode multiple 23267 (encode_terminal_code): Change argument. Encode multiple
22336 characters at once. Store the result of encoding in 23268 characters at once. Store the result of encoding in
22337 terminal_encode_buffer. 23269 terminal_encode_buffer.
@@ -22409,8 +23341,8 @@
22409 23341
22410 * casetab.c (set_case_table): Remove unused var. 23342 * casetab.c (set_case_table): Remove unused var.
22411 23343
22412 * window.c (Fdisplay_buffer, Fframe_selected_window): Remove 23344 * window.c (Fdisplay_buffer, Fframe_selected_window):
22413 unused vars. 23345 Remove unused vars.
22414 23346
224152008-02-01 Dave Love <fx@gnu.org> 233472008-02-01 Dave Love <fx@gnu.org>
22416 23348
@@ -22438,8 +23370,8 @@
22438 (update_compositions, Ffind_composition_internal): Make buffer 23370 (update_compositions, Ffind_composition_internal): Make buffer
22439 positions EMACS_INT. 23371 positions EMACS_INT.
22440 23372
22441 * composite.h (find_composition, update_compositions): Make 23373 * composite.h (find_composition, update_compositions):
22442 position args EMACS_INT. 23374 Make position args EMACS_INT.
22443 23375
22444 * keyboard.c (adjust_point_for_property): Make beg and end EMACS_INT. 23376 * keyboard.c (adjust_point_for_property): Make beg and end EMACS_INT.
22445 23377
@@ -22463,8 +23395,8 @@
22463 23395
224642008-02-01 Andreas Schwab <schwab@suse.de> 233962008-02-01 Andreas Schwab <schwab@suse.de>
22465 23397
22466 * chartab.c (map_char_table, map_char_table_for_charset): Protect 23398 * chartab.c (map_char_table, map_char_table_for_charset):
22467 `range' from GC. 23399 Protect `range' from GC.
22468 23400
224692008-02-01 Kenichi Handa <handa@m17n.org> 234012008-02-01 Kenichi Handa <handa@m17n.org>
22470 23402
@@ -22526,8 +23458,8 @@
22526 (re_match_2_internal): Don't check RE_TARGET_MULTIBYTE_P (bufp). 23458 (re_match_2_internal): Don't check RE_TARGET_MULTIBYTE_P (bufp).
22527 It is the same as RE_MULTIBYTE_P (bufp) now. 23459 It is the same as RE_MULTIBYTE_P (bufp) now.
22528 <exactn>: Translate via multibyte. 23460 <exactn>: Translate via multibyte.
22529 <anychar>: Fetch a character by RE_STRING_CHAR_AND_LENGTH. Don't 23461 <anychar>: Fetch a character by RE_STRING_CHAR_AND_LENGTH.
22530 translate it. 23462 Don't translate it.
22531 <charset, charset_not>: Fetch a character by 23463 <charset, charset_not>: Fetch a character by
22532 RE_STRING_CHAR_AND_LENGTH. Translate via multibyte. 23464 RE_STRING_CHAR_AND_LENGTH. Translate via multibyte.
22533 <duplicate>: Call bcmp_translate with the last arg `multibyte'. 23465 <duplicate>: Call bcmp_translate with the last arg `multibyte'.
@@ -22748,8 +23680,8 @@
22748 FONT_SPEC_INDEX. If font_spec is a string, extract the registry 23680 FONT_SPEC_INDEX. If font_spec is a string, extract the registry
22749 name by using split_font_name_into_vector. 23681 name by using split_font_name_into_vector.
22750 (Fnew_fontset): If no ASCII font is specified in FONTLIST, 23682 (Fnew_fontset): If no ASCII font is specified in FONTLIST,
22751 generate a proper font name from the fontset name. Update 23683 generate a proper font name from the fontset name.
22752 Vfontset_alias_alist. 23684 Update Vfontset_alias_alist.
22753 (n_auto_fontsets): New variable. 23685 (n_auto_fontsets): New variable.
22754 (new_fontset_from_font_name): New function. 23686 (new_fontset_from_font_name): New function.
22755 (Ffont_info): Store the information about fonts generated from the 23687 (Ffont_info): Store the information about fonts generated from the
@@ -22814,8 +23746,8 @@
22814 sequence is valid in this coding system. Change callers. 23746 sequence is valid in this coding system. Change callers.
22815 (MAX_ANNOTATION_LENGTH): New macro. 23747 (MAX_ANNOTATION_LENGTH): New macro.
22816 (ADD_ANNOTATION_DATA): New macro. 23748 (ADD_ANNOTATION_DATA): New macro.
22817 (ADD_COMPOSITION_DATA): Change argument. Change callers. Call 23749 (ADD_COMPOSITION_DATA): Change argument. Change callers.
22818 ADD_ANNOTATION_DATA. Change the format of annotation data. 23750 Call ADD_ANNOTATION_DATA. Change the format of annotation data.
22819 (ADD_CHARSET_DATA): New macro. 23751 (ADD_CHARSET_DATA): New macro.
22820 (emacs_mule_char): New argument ID. Change callers. 23752 (emacs_mule_char): New argument ID. Change callers.
22821 (decode_coding_emacs_mule, decode_coding_iso_2022) 23753 (decode_coding_emacs_mule, decode_coding_iso_2022)
@@ -22829,8 +23761,8 @@
22829 (produce_composition): Adjust for the new annotation data format. 23761 (produce_composition): Adjust for the new annotation data format.
22830 (produce_charset): New function. 23762 (produce_charset): New function.
22831 (produce_annotation): Handle charset annotation. 23763 (produce_annotation): Handle charset annotation.
22832 (handle_composition_annotation, handle_charset_annotation): New 23764 (handle_composition_annotation, handle_charset_annotation):
22833 functions. 23765 New functions.
22834 (consume_chars): Handle charset annotation. Utilize the above two 23766 (consume_chars): Handle charset annotation. Utilize the above two
22835 functions. 23767 functions.
22836 (encode_coding_object): If SRC_OBJECT and DST_OBJECT are the same 23768 (encode_coding_object): If SRC_OBJECT and DST_OBJECT are the same
@@ -22960,8 +23892,8 @@
22960 23892
22961 * coding.c (detect_coding_charset): If only ASCII bytes are found, 23893 * coding.c (detect_coding_charset): If only ASCII bytes are found,
22962 return 0. 23894 return 0.
22963 (Fdefine_coding_system_internal): Setup 23895 (Fdefine_coding_system_internal):
22964 CODING_ATTR_ASCII_COMPAT (attrs) correctly. 23896 Setup CODING_ATTR_ASCII_COMPAT (attrs) correctly.
22965 23897
229662008-02-01 Dave Love <fx@gnu.org> 238982008-02-01 Dave Love <fx@gnu.org>
22967 23899
@@ -22971,8 +23903,8 @@
22971 23903
229722008-02-01 Kenichi Handa <handa@m17n.org> 239042008-02-01 Kenichi Handa <handa@m17n.org>
22973 23905
22974 * coding.c (decode_coding): Fix args to translate_chars. Pay 23906 * coding.c (decode_coding): Fix args to translate_chars.
22975 attention to Vstandard_translation_table_for_decode. 23907 Pay attention to Vstandard_translation_table_for_decode.
22976 (encode_coding): Fix args to translate_chars. Pay attention to 23908 (encode_coding): Fix args to translate_chars. Pay attention to
22977 Vstandard_translation_table_for_encode. 23909 Vstandard_translation_table_for_encode.
22978 23910
@@ -23022,8 +23954,8 @@
23022 23954
23023 * character.h (CHAR_STRING, CHAR_STRING_ADVANCE): Call char_string 23955 * character.h (CHAR_STRING, CHAR_STRING_ADVANCE): Call char_string
23024 if C is greater than MAX_3_BYTE_CHAR. 23956 if C is greater than MAX_3_BYTE_CHAR.
23025 (STRING_CHAR, STRING_CHAR_AND_LENGTH, STRING_CHAR_ADVANCE): Call 23957 (STRING_CHAR, STRING_CHAR_AND_LENGTH, STRING_CHAR_ADVANCE):
23026 string_char instead of string_char_with_unification. 23958 Call string_char instead of string_char_with_unification.
23027 23959
230282008-02-01 Dave Love <fx@gnu.org> 239602008-02-01 Dave Love <fx@gnu.org>
23029 23961
@@ -23081,8 +24013,8 @@
23081 24013
23082 * keyboard.c (read_key_sequence): Fix type error. 24014 * keyboard.c (read_key_sequence): Fix type error.
23083 24015
23084 * buffer.c (Fset_buffer_multibyte, Fset_buffer_multibyte): Fix 24016 * buffer.c (Fset_buffer_multibyte, Fset_buffer_multibyte):
23085 type error. 24017 Fix type error.
23086 24018
23087 * fontset.c (fontset_add): Return Lisp_Object. 24019 * fontset.c (fontset_add): Return Lisp_Object.
23088 24020
@@ -23134,8 +24066,8 @@
23134 * regex.h (struct re_pattern_buffer): New member target_multibyte. 24066 * regex.h (struct re_pattern_buffer): New member target_multibyte.
23135 24067
23136 * regex.c (RE_TARGET_MULTIBYTE_P): New macro. 24068 * regex.c (RE_TARGET_MULTIBYTE_P): New macro.
23137 (GET_CHAR_BEFORE_2): Check target_multibyte, not multibyte. If 24069 (GET_CHAR_BEFORE_2): Check target_multibyte, not multibyte.
23138 that is zero, convert an eight-bit char to multibyte. 24070 If that is zero, convert an eight-bit char to multibyte.
23139 (MAKE_CHAR_MULTIBYTE, CHAR_LEADING_CODE): New dummy new macros for 24071 (MAKE_CHAR_MULTIBYTE, CHAR_LEADING_CODE): New dummy new macros for
23140 non-emacs case. 24072 non-emacs case.
23141 (PATFETCH): Convert an eight-bit char to multibyte. 24073 (PATFETCH): Convert an eight-bit char to multibyte.
@@ -23154,14 +24086,14 @@
23154 multibyte always 1. 24086 multibyte always 1.
23155 (re_search_2): In emacs, set the locale variable multibyte to 1, 24087 (re_search_2): In emacs, set the locale variable multibyte to 1,
23156 otherwise to 0. New local variable target_multibyte. Check it 24088 otherwise to 0. New local variable target_multibyte. Check it
23157 to decide the multibyteness of STR1 and STR2. If 24089 to decide the multibyteness of STR1 and STR2.
23158 target_multibyte is zero, convert unibyte chars to multibyte 24090 If target_multibyte is zero, convert unibyte chars to multibyte
23159 before translating and checking fastmap. 24091 before translating and checking fastmap.
23160 (TARGET_CHAR_AND_LENGTH): New macro. 24092 (TARGET_CHAR_AND_LENGTH): New macro.
23161 (re_match_2_internal): In emacs, set the locale variable multibyte 24093 (re_match_2_internal): In emacs, set the locale variable multibyte
23162 to 1, otherwise to 0. New local variable target_multibyte. Check 24094 to 1, otherwise to 0. New local variable target_multibyte.
23163 it to decide the multibyteness of STR1 and STR2. Use 24095 Check it to decide the multibyteness of STR1 and STR2.
23164 TARGET_CHAR_AND_LENGTH to fetch a character from D. 24096 Use TARGET_CHAR_AND_LENGTH to fetch a character from D.
23165 <charset, charset_not>: If multibyte is nonzero, check fastmap 24097 <charset, charset_not>: If multibyte is nonzero, check fastmap
23166 only for ASCII chars. Call bcmp_translate with 24098 only for ASCII chars. Call bcmp_translate with
23167 target_multibyte, not with multibyte. 24099 target_multibyte, not with multibyte.
@@ -23369,8 +24301,8 @@
23369 24301
23370 * lisp.h (Fset_buffer_multibyte): Adjust prototype. 24302 * lisp.h (Fset_buffer_multibyte): Adjust prototype.
23371 24303
23372 * xdisp.c (setup_echo_area_for_printing, set_message_1): Adjust 24304 * xdisp.c (setup_echo_area_for_printing, set_message_1):
23373 for the change of Fset_buffer_multibyte. 24305 Adjust for the change of Fset_buffer_multibyte.
23374 24306
23375 * fns.c (Fstring_to_multibyte): New function. 24307 * fns.c (Fstring_to_multibyte): New function.
23376 (syms_of_fns): Declare Fstring_to_multibyte as Lisp subroutine. 24308 (syms_of_fns): Declare Fstring_to_multibyte as Lisp subroutine.
@@ -23465,11 +24397,11 @@
23465 (find_font_encoding): New function. 24397 (find_font_encoding): New function.
23466 (list_fontsets): Use STRINGP, not ! NILP. 24398 (list_fontsets): Use STRINGP, not ! NILP.
23467 (accumulate_script_ranges): New function. 24399 (accumulate_script_ranges): New function.
23468 (Fset_fontset_font, Fnew_fontset, Ffontset_info): Completely 24400 (Fset_fontset_font, Fnew_fontset, Ffontset_info):
23469 re-written to handle new fontset structure. 24401 Completely re-written to handle new fontset structure.
23470 (Ffontset_font): Return a copy of element. 24402 (Ffontset_font): Return a copy of element.
23471 (syms_of_fontset): Define symbols Qprepend and Qappend. Fix 24403 (syms_of_fontset): Define symbols Qprepend and Qappend.
23472 docstring of font-encoding-alist. 24404 Fix docstring of font-encoding-alist.
23473 24405
23474 * lisp.h (CHAR_TABLE_REF): Remove unnecessary check (IDX >= 0). 24406 * lisp.h (CHAR_TABLE_REF): Remove unnecessary check (IDX >= 0).
23475 (Fset_fotset_font): Fix arguments to 5. 24407 (Fset_fotset_font): Fix arguments to 5.
@@ -23559,8 +24491,8 @@
23559 24491
235602008-02-01 Kenichi Handa <handa@m17n.org> 244922008-02-01 Kenichi Handa <handa@m17n.org>
23561 24493
23562 * xdisp.c (face_before_or_after_it_pos): Call 24494 * xdisp.c (face_before_or_after_it_pos):
23563 FETCH_MULTIBYTE_CHAR with byte postion, not char position. 24495 Call FETCH_MULTIBYTE_CHAR with byte postion, not char position.
23564 24496
235652008-02-01 Kenichi Handa <handa@m17n.org> 244972008-02-01 Kenichi Handa <handa@m17n.org>
23566 24498
@@ -23588,8 +24520,8 @@
23588 deunify instead of unify a charset. 24520 deunify instead of unify a charset.
23589 (string_xstring_p): Add `const' to local variables. 24521 (string_xstring_p): Add `const' to local variables.
23590 (find_charsets_in_text): Add `const' to arguments and local variables. 24522 (find_charsets_in_text): Add `const' to arguments and local variables.
23591 (encode_char): Adjust for the change of Funify_charset. Fix 24523 (encode_char): Adjust for the change of Funify_charset.
23592 detecting of invalid code. 24524 Fix detecting of invalid code.
23593 (Fset_charset_priority): Increment charset_ordered_list_tick. 24525 (Fset_charset_priority): Increment charset_ordered_list_tick.
23594 (Fmap_charset_chars): Fix handling of default value for FROM_CODE 24526 (Fmap_charset_chars): Fix handling of default value for FROM_CODE
23595 and TO_CODE. 24527 and TO_CODE.
@@ -23622,8 +24554,8 @@
23622 24554
236232008-02-01 Dave Love <fx@gnu.org> 245552008-02-01 Dave Love <fx@gnu.org>
23624 24556
23625 * casetab.c (init_casetab_once, init_casetab_once): Fix 24557 * casetab.c (init_casetab_once, init_casetab_once):
23626 CHAR_TABLE_SET call. 24558 Fix CHAR_TABLE_SET call.
23627 24559
23628 * category.c (Fmodify_category_entry): Fix CATEGORY_MEMBER call. 24560 * category.c (Fmodify_category_entry): Fix CATEGORY_MEMBER call.
23629 24561
@@ -23698,8 +24630,8 @@
236982008-02-01 Kenichi Handa <handa@m17n.org> 246302008-02-01 Kenichi Handa <handa@m17n.org>
23699 24631
23700 * category.c (Fmodify_category_entry): Don't modify the contents 24632 * category.c (Fmodify_category_entry): Don't modify the contents
23701 of category_set for characters out of the range. Avoid 24633 of category_set for characters out of the range.
23702 unnecessary modification. 24634 Avoid unnecessary modification.
23703 24635
23704 * character.h (MAYBE_UNIFY_CHAR): Adjust for the change of 24636 * character.h (MAYBE_UNIFY_CHAR): Adjust for the change of
23705 Vchar_unify_table. The default value of the table is now nil. 24637 Vchar_unify_table. The default value of the table is now nil.
@@ -23707,8 +24639,8 @@
23707 * character.c (syms_of_character): Setup Vchar_width_table for 24639 * character.c (syms_of_character): Setup Vchar_width_table for
23708 eight-bit-control and raw-byte chars. 24640 eight-bit-control and raw-byte chars.
23709 24641
23710 * charset.h (enum define_charset_arg_index): Delete 24642 * charset.h (enum define_charset_arg_index):
23711 charset_arg_parents and add charset_arg_subset and 24643 Delete charset_arg_parents and add charset_arg_subset and
23712 charset_arg_superset. 24644 charset_arg_superset.
23713 (enum charset_attr_index): Delete charset_parents and add 24645 (enum charset_attr_index): Delete charset_parents and add
23714 charset_subset and charset_superset. 24646 charset_subset and charset_superset.
@@ -23724,8 +24656,8 @@
23724 24656
23725 * charset.c (load_charset_map): Set the default value of encoder 24657 * charset.c (load_charset_map): Set the default value of encoder
23726 and deunifier char-tables to nil. 24658 and deunifier char-tables to nil.
23727 (map_charset_chars): Change argument. Change callers. Use 24659 (map_charset_chars): Change argument. Change callers.
23728 map_char_table_for_charset instead of map_char_table. 24660 Use map_char_table_for_charset instead of map_char_table.
23729 (Fmap_charset_chars): New optional args from_code and to_code. 24661 (Fmap_charset_chars): New optional args from_code and to_code.
23730 (Fdefine_charset_internal): Adjust for the change of 24662 (Fdefine_charset_internal): Adjust for the change of
23731 `define-charset' (:parents -> :subset or :superset). 24663 `define-charset' (:parents -> :subset or :superset).
@@ -23734,8 +24666,8 @@
23734 Fdefine_charset_internal. 24666 Fdefine_charset_internal.
23735 (Ffind_charset_string): Setup the vector `charsets' correctly. 24667 (Ffind_charset_string): Setup the vector `charsets' correctly.
23736 24668
23737 * chartab.c (sub_char_table_ref_and_range): New arg default. Fix 24669 * chartab.c (sub_char_table_ref_and_range): New arg default.
23738 the previous change. 24670 Fix the previous change.
23739 (char_table_ref_and_range): Adjust for the above change. 24671 (char_table_ref_and_range): Adjust for the above change.
23740 (map_sub_char_table_for_charset): New function. 24672 (map_sub_char_table_for_charset): New function.
23741 (map_char_table_for_charset): New function. 24673 (map_char_table_for_charset): New function.
@@ -23878,8 +24810,8 @@
238782008-02-01 Kenichi Handa <handa@m17n.org> 248102008-02-01 Kenichi Handa <handa@m17n.org>
23879 24811
23880 * coding.c (ONE_MORE_BYTE_NO_CHECK): Increment consumed_chars. 24812 * coding.c (ONE_MORE_BYTE_NO_CHECK): Increment consumed_chars.
23881 (emacs_mule_char): New arg src. Delete arg `composition'. Change 24813 (emacs_mule_char): New arg src. Delete arg `composition'.
23882 caller. Handle 2-byte and 3-byte charsets correctly. 24814 Change caller. Handle 2-byte and 3-byte charsets correctly.
23883 (DECODE_EMACS_MULE_COMPOSITION_RULE_20): Rename from 24815 (DECODE_EMACS_MULE_COMPOSITION_RULE_20): Rename from
23884 DECODE_EMACS_MULE_COMPOSITION_RULE. Change caller. 24816 DECODE_EMACS_MULE_COMPOSITION_RULE. Change caller.
23885 (DECODE_EMACS_MULE_COMPOSITION_RULE_21): New macro. 24817 (DECODE_EMACS_MULE_COMPOSITION_RULE_21): New macro.
@@ -23924,8 +24856,8 @@
23924 24856
23925 * character.h (string_escape_byte8): Declare. 24857 * character.h (string_escape_byte8): Declare.
23926 24858
23927 * charset.c (load_charset_map, load_charset_map_from_file): Remove 24859 * charset.c (load_charset_map, load_charset_map_from_file):
23928 unused vars. 24860 Remove unused vars.
23929 (Fdefine_charset_internal, Fsplit_char, syms_of_charset) 24861 (Fdefine_charset_internal, Fsplit_char, syms_of_charset)
23930 (Fmap_charset_chars): Doc fix. 24862 (Fmap_charset_chars): Doc fix.
23931 24863
@@ -23996,8 +24928,8 @@
23996 * coding.c (coding_set_source): Delete the local variable beg_byte. 24928 * coding.c (coding_set_source): Delete the local variable beg_byte.
23997 (encode_coding_charset, Fdefine_coding_system_internal): 24929 (encode_coding_charset, Fdefine_coding_system_internal):
23998 Delete the local variable charset. 24930 Delete the local variable charset.
23999 (Fdefine_coding_system_internal): Setup 24931 (Fdefine_coding_system_internal):
24000 attrs[coding_attr_charset_valids] correctly. 24932 Setup attrs[coding_attr_charset_valids] correctly.
24001 24933
24002 * charset.c (CODE_POINT_TO_INDEX): Utilize `code_space_mask' 24934 * charset.c (CODE_POINT_TO_INDEX): Utilize `code_space_mask'
24003 member to check if CODE is valid or not. 24935 member to check if CODE is valid or not.
@@ -24019,8 +24951,8 @@
24019 24951
240202008-02-01 Kenichi Handa <handa@m17n.org> 249522008-02-01 Kenichi Handa <handa@m17n.org>
24021 24953
24022 * coding.c (decode_coding_charset, encode_coding_charset): Handle 24954 * coding.c (decode_coding_charset, encode_coding_charset):
24023 multiple charsets correctly. 24955 Handle multiple charsets correctly.
24024 24956
240252008-02-01 Kenichi Handa <handa@m17n.org> 249572008-02-01 Kenichi Handa <handa@m17n.org>
24026 24958
@@ -28193,10 +29125,10 @@ See ChangeLog.10 for earlier changes.
28193 29125
28194;; Local Variables: 29126;; Local Variables:
28195;; coding: utf-8 29127;; coding: utf-8
28196;; add-log-time-zone-rule: t
28197;; End: 29128;; End:
28198 29129
28199 Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 29130 Copyright (C) 2007, 2008, 2009, 2010
29131 Free Software Foundation, Inc.
28200 29132
28201 This file is part of GNU Emacs. 29133 This file is part of GNU Emacs.
28202 29134
@@ -28213,4 +29145,3 @@ See ChangeLog.10 for earlier changes.
28213 You should have received a copy of the GNU General Public License 29145 You should have received a copy of the GNU General Public License
28214 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 29146 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28215 29147
28216;; arch-tag: dfb6ad96-1550-4905-9e53-d2059ee84c40
diff --git a/src/Makefile.in b/src/Makefile.in
index 0d496aea73a..61b42f17030 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,5 +1,5 @@
1# src/Makefile for GNU Emacs.
1 2
2# Makefile for GNU Emacs.
3# Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 3# Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
4# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 4# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5# Free Software Foundation, Inc. 5# Free Software Foundation, Inc.
@@ -54,8 +54,8 @@ lwlibdir = ../lwlib
54lispdir = ../lisp 54lispdir = ../lisp
55 55
56# Configuration files for .o files to depend on. 56# Configuration files for .o files to depend on.
57M_FILE = $(srcdir)/@machfile@ 57M_FILE = @M_FILE@
58S_FILE = $(srcdir)/@opsysfile@ 58S_FILE = @S_FILE@
59config_h = config.h $(M_FILE) $(S_FILE) 59config_h = config.h $(M_FILE) $(S_FILE)
60 60
61bootstrap_exe = $(abs_builddir)/bootstrap-emacs$(EXEEXT) 61bootstrap_exe = $(abs_builddir)/bootstrap-emacs$(EXEEXT)
@@ -177,7 +177,7 @@ OLDXMENU_TARGET=@OLDXMENU_TARGET@
177 177
178## If !HAVE_X11 || USE_GTK, empty. 178## If !HAVE_X11 || USE_GTK, empty.
179## Else if USE_X_TOOLKIT, $(lwlibdir)/liblw.a. 179## Else if USE_X_TOOLKIT, $(lwlibdir)/liblw.a.
180## Else $(oldxmenudir)/libXMenu11.a. 180## Else $(oldXMenudir)/libXMenu11.a.
181## (Actually, rather than being empty, it is set to "nothing". 181## (Actually, rather than being empty, it is set to "nothing".
182## It is never actually used for anything in this case. 182## It is never actually used for anything in this case.
183## This is done because there is a rule with target $(OLDXMENU) below, 183## This is done because there is a rule with target $(OLDXMENU) below,
@@ -575,23 +575,22 @@ shortlisp= \
575 575
576## Like $shortlisp, but includes only those files from $lisp that are loaded 576## Like $shortlisp, but includes only those files from $lisp that are loaded
577## conditionally (i.e., only on some platforms). 577## conditionally (i.e., only on some platforms).
578## Confusingly, term/internal is not in loadup, but is unconditionally
579## loaded by pc-win, which is.
578SOME_MACHINE_LISP = ../lisp/mouse.elc \ 580SOME_MACHINE_LISP = ../lisp/mouse.elc \
579 ../lisp/select.elc ../lisp/scroll-bar.elc \ 581 ../lisp/select.elc ../lisp/scroll-bar.elc \
580 ../lisp/ls-lisp.elc ../lisp/dos-fns.elc \ 582 ../lisp/ls-lisp.elc ../lisp/dos-fns.elc \
581 ../lisp/w32-fns.elc ../lisp/dos-w32.elc \ 583 ../lisp/w32-fns.elc ../lisp/dos-w32.elc \
582 ../lisp/disp-table.elc ../lisp/dos-vars.elc \ 584 ../lisp/disp-table.elc ../lisp/dos-vars.elc ../lisp/w32-vars.elc \
583 ../lisp/tooltip.elc ../lisp/image.elc \ 585 ../lisp/tooltip.elc ../lisp/image.elc \
584 ../lisp/fringe.elc ../lisp/dnd.elc \ 586 ../lisp/fringe.elc ../lisp/dnd.elc \
585 ../lisp/mwheel.elc ../lisp/tool-bar.elc \ 587 ../lisp/mwheel.elc ../lisp/tool-bar.elc \
586 ../lisp/x-dnd.elc ../lisp/dynamic-setting.elc \ 588 ../lisp/x-dnd.elc ../lisp/dynamic-setting.elc \
587 ../lisp/international/ccl.elc \
588 ../lisp/international/fontset.elc \ 589 ../lisp/international/fontset.elc \
589 ../lisp/mouse.elc \
590 ../lisp/term/common-win.elc \ 590 ../lisp/term/common-win.elc \
591 ../lisp/term/x-win.elc \ 591 ../lisp/term/x-win.elc \
592 ../lisp/term/pc-win.elc ../lisp/term/internal.elc \ 592 ../lisp/term/pc-win.elc ../lisp/term/internal.elc \
593 ../lisp/term/ns-win.elc ../lisp/term/w32-win.elc \ 593 ../lisp/term/ns-win.elc ../lisp/term/w32-win.elc
594 ../lisp/emacs-lisp/easymenu.elc
595 594
596## Construct full set of libraries to be linked. 595## Construct full set of libraries to be linked.
597## Note that SunOS needs -lm to come before -lc; otherwise, you get 596## Note that SunOS needs -lm to come before -lc; otherwise, you get
diff --git a/src/alloc.c b/src/alloc.c
index 0f83f375d40..b18fd6feb3d 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -351,7 +351,6 @@ enum mem_type
351 351
352static POINTER_TYPE *lisp_align_malloc (size_t, enum mem_type); 352static POINTER_TYPE *lisp_align_malloc (size_t, enum mem_type);
353static POINTER_TYPE *lisp_malloc (size_t, enum mem_type); 353static POINTER_TYPE *lisp_malloc (size_t, enum mem_type);
354void refill_memory_reserve (void);
355 354
356 355
357#if GC_MARK_STACK || defined GC_MALLOC_CHECK 356#if GC_MARK_STACK || defined GC_MALLOC_CHECK
@@ -4043,8 +4042,14 @@ DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "",
4043static INLINE void 4042static INLINE void
4044mark_maybe_object (Lisp_Object obj) 4043mark_maybe_object (Lisp_Object obj)
4045{ 4044{
4046 void *po = (void *) XPNTR (obj); 4045 void *po;
4047 struct mem_node *m = mem_find (po); 4046 struct mem_node *m;
4047
4048 if (INTEGERP (obj))
4049 return;
4050
4051 po = (void *) XPNTR (obj);
4052 m = mem_find (po);
4048 4053
4049 if (m != MEM_NIL) 4054 if (m != MEM_NIL)
4050 { 4055 {
@@ -5694,13 +5699,14 @@ mark_terminals (void)
5694 for (t = terminal_list; t; t = t->next_terminal) 5699 for (t = terminal_list; t; t = t->next_terminal)
5695 { 5700 {
5696 eassert (t->name != NULL); 5701 eassert (t->name != NULL);
5697 if (!VECTOR_MARKED_P (t))
5698 {
5699#ifdef HAVE_WINDOW_SYSTEM 5702#ifdef HAVE_WINDOW_SYSTEM
5700 mark_image_cache (t->image_cache); 5703 /* If a terminal object is reachable from a stacpro'ed object,
5704 it might have been marked already. Make sure the image cache
5705 gets marked. */
5706 mark_image_cache (t->image_cache);
5701#endif /* HAVE_WINDOW_SYSTEM */ 5707#endif /* HAVE_WINDOW_SYSTEM */
5702 mark_vectorlike ((struct Lisp_Vector *)t); 5708 if (!VECTOR_MARKED_P (t))
5703 } 5709 mark_vectorlike ((struct Lisp_Vector *)t);
5704 } 5710 }
5705} 5711}
5706 5712
diff --git a/src/atimer.c b/src/atimer.c
index 9fd9dee835e..6258908e0b2 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -171,9 +171,9 @@ cancel_atimer (struct atimer *timer)
171 for (t = *list, prev = NULL; t && t != timer; prev = t, t = t->next) 171 for (t = *list, prev = NULL; t && t != timer; prev = t, t = t->next)
172 ; 172 ;
173 173
174 /* If it is, take it off the its list, and put in on the 174 /* If it is, take it off its list, and put in on the free-list.
175 free-list. We don't bother to arrange for setting a 175 We don't bother to arrange for setting a different alarm time,
176 different alarm time, since a too early one doesn't hurt. */ 176 since a too early one doesn't hurt. */
177 if (t) 177 if (t)
178 { 178 {
179 if (prev) 179 if (prev)
diff --git a/src/buffer.c b/src/buffer.c
index 3eb96beeb0f..8f8bfb54a21 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1,8 +1,8 @@
1/* Buffer manipulation primitives for GNU Emacs. 1/* Buffer manipulation primitives for GNU Emacs.
2 Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 2
3 1995, 1997, 1998, 1999, 2000, 2001, 2002, 3Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, 1997,
4 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 4 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
5 Free Software Foundation, Inc. 5 2009, 2010 Free Software Foundation, Inc.
6 6
7This file is part of GNU Emacs. 7This file is part of GNU Emacs.
8 8
@@ -5601,7 +5601,8 @@ Format with `format-mode-line' to produce a string value. */);
5601 doc: /* Local (mode-specific) abbrev table of current buffer. */); 5601 doc: /* Local (mode-specific) abbrev table of current buffer. */);
5602 5602
5603 DEFVAR_PER_BUFFER ("abbrev-mode", &current_buffer->abbrev_mode, Qnil, 5603 DEFVAR_PER_BUFFER ("abbrev-mode", &current_buffer->abbrev_mode, Qnil,
5604 doc: /* Non-nil turns on automatic expansion of abbrevs as they are inserted. */); 5604 doc: /* Non-nil if Abbrev mode is enabled.
5605Use the command `abbrev-mode' to change this variable. */);
5605 5606
5606 DEFVAR_PER_BUFFER ("case-fold-search", &current_buffer->case_fold_search, 5607 DEFVAR_PER_BUFFER ("case-fold-search", &current_buffer->case_fold_search,
5607 Qnil, 5608 Qnil,
@@ -6099,11 +6100,23 @@ to the value obtained by calling `current-time'.
6099If the buffer has never been shown in a window, the value is nil. */); 6100If the buffer has never been shown in a window, the value is nil. */);
6100 6101
6101 DEFVAR_LISP ("transient-mark-mode", &Vtransient_mark_mode, 6102 DEFVAR_LISP ("transient-mark-mode", &Vtransient_mark_mode,
6102 doc: /* */); 6103 doc: /* Non-nil if Transient Mark mode is enabled.
6104See the command `transient-mark-mode' for a description of this minor mode.
6105
6106Non-nil also enables highlighting of the region whenever the mark is active.
6107The variable `highlight-nonselected-windows' controls whether to highlight
6108all windows or just the selected window.
6109
6110If the value is `lambda', that enables Transient Mark mode temporarily.
6111After any subsequent action that would normally deactivate the mark
6112\(such as buffer modification), Transient Mark mode is turned off.
6113
6114If the value is (only . OLDVAL), that enables Transient Mark mode
6115temporarily. After any subsequent point motion command that is not
6116shift-translated, or any other action that would normally deactivate
6117the mark (such as buffer modification), the value of
6118`transient-mark-mode' is set to OLDVAL. */);
6103 Vtransient_mark_mode = Qnil; 6119 Vtransient_mark_mode = Qnil;
6104 /* The docstring is in simple.el. If we put it here, it would be
6105 overwritten when transient-mark-mode is defined using
6106 define-minor-mode. */
6107 6120
6108 DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only, 6121 DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only,
6109 doc: /* *Non-nil means disregard read-only status of buffers or characters. 6122 doc: /* *Non-nil means disregard read-only status of buffers or characters.
@@ -6141,8 +6154,12 @@ to the default frame line height. A value of nil means add no extra space. */)
6141 6154
6142 DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", 6155 DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows",
6143 &current_buffer->cursor_in_non_selected_windows, Qnil, 6156 &current_buffer->cursor_in_non_selected_windows, Qnil,
6144 doc: /* *Cursor type to display in non-selected windows. 6157 doc: /* *Non-nil means show a cursor in non-selected windows.
6145The value t means to use hollow box cursor. See `cursor-type' for other values. */); 6158If nil, only shows a cursor in the selected window.
6159If t, displays a cursor related to the usual cursor type
6160\(a solid box becomes hollow, a bar becomes a narrower bar).
6161You can also specify the cursor type as in the `cursor-type' variable.
6162Use Custom to set this variable and update the display." */);
6146 6163
6147 DEFVAR_LISP ("kill-buffer-query-functions", &Vkill_buffer_query_functions, 6164 DEFVAR_LISP ("kill-buffer-query-functions", &Vkill_buffer_query_functions,
6148 doc: /* List of functions called with no args to query before killing a buffer. 6165 doc: /* List of functions called with no args to query before killing a buffer.
@@ -6219,5 +6236,3 @@ keys_of_buffer (void)
6219 Fput (intern_c_string ("erase-buffer"), Qdisabled, Qt); 6236 Fput (intern_c_string ("erase-buffer"), Qdisabled, Qt);
6220} 6237}
6221 6238
6222/* arch-tag: e48569bf-69a9-4b65-a23b-8e68769436e1
6223 (do not change this comment) */
diff --git a/src/buffer.h b/src/buffer.h
index 3a4dd106360..79acd16b6fd 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -1,7 +1,8 @@
1/* Header file for the buffer manipulation primitives. 1/* Header file for the buffer manipulation primitives.
2 Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2
3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 3Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000,
4 Free Software Foundation, Inc. 4 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5 Free Software Foundation, Inc.
5 6
6This file is part of GNU Emacs. 7This file is part of GNU Emacs.
7 8
@@ -226,10 +227,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
226 (temp_set_point ((buffer), (position))) 227 (temp_set_point ((buffer), (position)))
227 228
228extern void set_point (EMACS_INT); 229extern void set_point (EMACS_INT);
229extern INLINE void temp_set_point (struct buffer *, EMACS_INT); 230extern void temp_set_point (struct buffer *, EMACS_INT);
230extern void set_point_both (EMACS_INT, EMACS_INT); 231extern void set_point_both (EMACS_INT, EMACS_INT);
231extern INLINE void temp_set_point_both (struct buffer *, 232extern void temp_set_point_both (struct buffer *,
232 EMACS_INT, EMACS_INT); 233 EMACS_INT, EMACS_INT);
233extern void enlarge_buffer_text (struct buffer *, EMACS_INT); 234extern void enlarge_buffer_text (struct buffer *, EMACS_INT);
234 235
235 236
@@ -459,7 +460,7 @@ struct buffer_text
459 struct Lisp_Marker *markers; 460 struct Lisp_Marker *markers;
460 461
461 /* Usually 0. Temporarily set to 1 in decode_coding_gap to 462 /* Usually 0. Temporarily set to 1 in decode_coding_gap to
462 prevent Fgarbage_collect from shrinking the gap and loosing 463 prevent Fgarbage_collect from shrinking the gap and losing
463 not-yet-decoded bytes. */ 464 not-yet-decoded bytes. */
464 int inhibit_shrinking; 465 int inhibit_shrinking;
465 }; 466 };
@@ -1019,5 +1020,3 @@ extern int last_per_buffer_idx;
1019#define PER_BUFFER_VALUE(BUFFER, OFFSET) \ 1020#define PER_BUFFER_VALUE(BUFFER, OFFSET) \
1020 (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) 1021 (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER)))
1021 1022
1022/* arch-tag: 679305dd-d41c-4a50-b170-3caf5c97b2d1
1023 (do not change this comment) */
diff --git a/src/callproc.c b/src/callproc.c
index ee0872b5562..59067040fd9 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1154,6 +1154,14 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
1154#ifdef WINDOWSNT 1154#ifdef WINDOWSNT
1155 prepare_standard_handles (in, out, err, handles); 1155 prepare_standard_handles (in, out, err, handles);
1156 set_process_dir (SDATA (current_dir)); 1156 set_process_dir (SDATA (current_dir));
1157 /* Spawn the child. (See ntproc.c:Spawnve). */
1158 cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env);
1159 reset_standard_handles (in, out, err, handles);
1160 if (cpid == -1)
1161 /* An error occurred while trying to spawn the process. */
1162 report_file_error ("Spawning child process", Qnil);
1163 return cpid;
1164
1157#else /* not WINDOWSNT */ 1165#else /* not WINDOWSNT */
1158 /* Make sure that in, out, and err are not actually already in 1166 /* Make sure that in, out, and err are not actually already in
1159 descriptors zero, one, or two; this could happen if Emacs is 1167 descriptors zero, one, or two; this could happen if Emacs is
@@ -1192,36 +1200,17 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
1192 emacs_close (out); 1200 emacs_close (out);
1193 if (err != in && err != out) 1201 if (err != in && err != out)
1194 emacs_close (err); 1202 emacs_close (err);
1195#endif /* not MSDOS */
1196#endif /* not WINDOWSNT */
1197 1203
1198#if defined(USG) 1204#if defined(USG)
1199#ifndef SETPGRP_RELEASES_CTTY 1205#ifndef SETPGRP_RELEASES_CTTY
1200 setpgrp (); /* No arguments but equivalent in this case */ 1206 setpgrp (); /* No arguments but equivalent in this case */
1201#endif 1207#endif
1202#else 1208#else /* not USG */
1203 setpgrp (pid, pid); 1209 setpgrp (pid, pid);
1204#endif /* USG */ 1210#endif /* not USG */
1205 1211
1206#ifdef MSDOS
1207 pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env);
1208 xfree (pwd_var);
1209 if (pid == -1)
1210 /* An error occurred while trying to run the subprocess. */
1211 report_file_error ("Spawning child process", Qnil);
1212 return pid;
1213#else /* not MSDOS */
1214#ifdef WINDOWSNT
1215 /* Spawn the child. (See ntproc.c:Spawnve). */
1216 cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env);
1217 reset_standard_handles (in, out, err, handles);
1218 if (cpid == -1)
1219 /* An error occurred while trying to spawn the process. */
1220 report_file_error ("Spawning child process", Qnil);
1221 return cpid;
1222#else /* not WINDOWSNT */
1223 /* setpgrp_of_tty is incorrect here; it uses input_fd. */ 1212 /* setpgrp_of_tty is incorrect here; it uses input_fd. */
1224 EMACS_SET_TTY_PGRP (0, &pid); 1213 tcsetpgrp (0, pid);
1225 1214
1226 /* execvp does not accept an environment arg so the only way 1215 /* execvp does not accept an environment arg so the only way
1227 to pass this environment is to set environ. Our caller 1216 to pass this environment is to set environ. Our caller
@@ -1233,8 +1222,16 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
1233 emacs_write (1, new_argv[0], strlen (new_argv[0])); 1222 emacs_write (1, new_argv[0], strlen (new_argv[0]));
1234 emacs_write (1, "\n", 1); 1223 emacs_write (1, "\n", 1);
1235 _exit (1); 1224 _exit (1);
1236#endif /* not WINDOWSNT */ 1225
1237#endif /* not MSDOS */ 1226#else /* MSDOS */
1227 pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env);
1228 xfree (pwd_var);
1229 if (pid == -1)
1230 /* An error occurred while trying to run the subprocess. */
1231 report_file_error ("Spawning child process", Qnil);
1232 return pid;
1233#endif /* MSDOS */
1234#endif /* not WINDOWSNT */
1238} 1235}
1239 1236
1240#ifndef WINDOWSNT 1237#ifndef WINDOWSNT
@@ -1519,7 +1516,7 @@ void
1519syms_of_callproc (void) 1516syms_of_callproc (void)
1520{ 1517{
1521#ifdef DOS_NT 1518#ifdef DOS_NT
1522 Qbuffer_file_type = intern ("buffer-file-type"); 1519 Qbuffer_file_type = intern_c_string ("buffer-file-type");
1523 staticpro (&Qbuffer_file_type); 1520 staticpro (&Qbuffer_file_type);
1524#endif /* DOS_NT */ 1521#endif /* DOS_NT */
1525 1522
@@ -1609,5 +1606,3 @@ See `setenv' and `getenv'. */);
1609 defsubr (&Scall_process_region); 1606 defsubr (&Scall_process_region);
1610} 1607}
1611 1608
1612/* arch-tag: 769b8045-1df7-4d2b-8968-e3fb49017f95
1613 (do not change this comment) */
diff --git a/src/charset.c b/src/charset.c
index 0ab776b6914..39a376a947f 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -114,7 +114,7 @@ Lisp_Object Viso_2022_charset_list;
114/* List of emacs-mule charsets. */ 114/* List of emacs-mule charsets. */
115Lisp_Object Vemacs_mule_charset_list; 115Lisp_Object Vemacs_mule_charset_list;
116 116
117struct charset *emacs_mule_charset[256]; 117int emacs_mule_charset[256];
118 118
119/* Mapping table from ISO2022's charset (specified by DIMENSION, 119/* Mapping table from ISO2022's charset (specified by DIMENSION,
120 CHARS, and FINAL-CHAR) to Emacs' charset. */ 120 CHARS, and FINAL-CHAR) to Emacs' charset. */
@@ -1210,7 +1210,7 @@ usage: (define-charset-internal ...) */)
1210 1210
1211 if (charset.emacs_mule_id >= 0) 1211 if (charset.emacs_mule_id >= 0)
1212 { 1212 {
1213 emacs_mule_charset[charset.emacs_mule_id] = CHARSET_FROM_ID (id); 1213 emacs_mule_charset[charset.emacs_mule_id] = id;
1214 if (charset.emacs_mule_id < 0xA0) 1214 if (charset.emacs_mule_id < 0xA0)
1215 emacs_mule_bytes[charset.emacs_mule_id] = charset.dimension + 1; 1215 emacs_mule_bytes[charset.emacs_mule_id] = charset.dimension + 1;
1216 else 1216 else
@@ -2330,7 +2330,7 @@ init_charset_once (void)
2330 iso_charset_table[i][j][k] = -1; 2330 iso_charset_table[i][j][k] = -1;
2331 2331
2332 for (i = 0; i < 256; i++) 2332 for (i = 0; i < 256; i++)
2333 emacs_mule_charset[i] = NULL; 2333 emacs_mule_charset[i] = -1;
2334 2334
2335 charset_jisx0201_roman = -1; 2335 charset_jisx0201_roman = -1;
2336 charset_jisx0208_1978 = -1; 2336 charset_jisx0208_1978 = -1;
diff --git a/src/charset.h b/src/charset.h
index dbe9c776a0d..6e6422f3c73 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -255,7 +255,7 @@ extern Lisp_Object Vcharset_list;
255extern Lisp_Object Viso_2022_charset_list; 255extern Lisp_Object Viso_2022_charset_list;
256extern Lisp_Object Vemacs_mule_charset_list; 256extern Lisp_Object Vemacs_mule_charset_list;
257 257
258extern struct charset *emacs_mule_charset[256]; 258extern int emacs_mule_charset[256];
259 259
260extern Lisp_Object Vcurrent_iso639_language; 260extern Lisp_Object Vcurrent_iso639_language;
261 261
diff --git a/src/cmds.c b/src/cmds.c
index e12d7c370d9..b2f454199f5 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -230,7 +230,7 @@ Optional second arg KILLFLAG non-nil means kill instead (save in kill ring).
230Interactively, N is the prefix arg, and KILLFLAG is set if 230Interactively, N is the prefix arg, and KILLFLAG is set if
231N was explicitly specified. 231N was explicitly specified.
232 232
233The command `delete-forward' is preferable for interactive use. */) 233The command `delete-forward-char' is preferable for interactive use. */)
234 (Lisp_Object n, Lisp_Object killflag) 234 (Lisp_Object n, Lisp_Object killflag)
235{ 235{
236 EMACS_INT pos; 236 EMACS_INT pos;
@@ -276,7 +276,7 @@ After insertion, the value of `auto-fill-function' is called if the
276 (Lisp_Object n) 276 (Lisp_Object n)
277{ 277{
278 int remove_boundary = 1; 278 int remove_boundary = 1;
279 CHECK_NUMBER (n); 279 CHECK_NATNUM (n);
280 280
281 if (!EQ (Vthis_command, current_kboard->Vlast_command)) 281 if (!EQ (Vthis_command, current_kboard->Vlast_command))
282 nonundocount = 0; 282 nonundocount = 0;
@@ -453,7 +453,7 @@ internal_self_insert (int c, EMACS_INT n)
453 && SINGLE_BYTE_CHAR_P (c)) 453 && SINGLE_BYTE_CHAR_P (c))
454 ? UNIBYTE_TO_CHAR (c) : c); 454 ? UNIBYTE_TO_CHAR (c) : c);
455 Lisp_Object string = Fmake_string (make_number (n), make_number (mc)); 455 Lisp_Object string = Fmake_string (make_number (n), make_number (mc));
456 456
457 if (spaces_to_insert) 457 if (spaces_to_insert)
458 { 458 {
459 tem = Fmake_string (make_number (spaces_to_insert), 459 tem = Fmake_string (make_number (spaces_to_insert),
@@ -474,7 +474,7 @@ internal_self_insert (int c, EMACS_INT n)
474 insert_and_inherit (strn, p - strn); 474 insert_and_inherit (strn, p - strn);
475 SAFE_FREE (); 475 SAFE_FREE ();
476 } 476 }
477 else 477 else if (n > 0)
478 insert_and_inherit (str, len); 478 insert_and_inherit (str, len);
479 479
480 if ((CHAR_TABLE_P (Vauto_fill_chars) 480 if ((CHAR_TABLE_P (Vauto_fill_chars)
diff --git a/src/coding.c b/src/coding.c
index 7a3bc40b9c7..a7b7c7d6b23 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -2053,7 +2053,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2053 const unsigned char *src_end = coding->source + coding->src_bytes; 2053 const unsigned char *src_end = coding->source + coding->src_bytes;
2054 const unsigned char *src_base = src; 2054 const unsigned char *src_base = src;
2055 int multibytep = coding->src_multibyte; 2055 int multibytep = coding->src_multibyte;
2056 struct charset *charset; 2056 int charset_id;
2057 unsigned code; 2057 unsigned code;
2058 int c; 2058 int c;
2059 int consumed_chars = 0; 2059 int consumed_chars = 0;
@@ -2063,7 +2063,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2063 if (c < 0) 2063 if (c < 0)
2064 { 2064 {
2065 c = -c; 2065 c = -c;
2066 charset = emacs_mule_charset[0]; 2066 charset_id = emacs_mule_charset[0];
2067 } 2067 }
2068 else 2068 else
2069 { 2069 {
@@ -2099,7 +2099,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2099 switch (emacs_mule_bytes[c]) 2099 switch (emacs_mule_bytes[c])
2100 { 2100 {
2101 case 2: 2101 case 2:
2102 if (! (charset = emacs_mule_charset[c])) 2102 if ((charset_id = emacs_mule_charset[c]) < 0)
2103 goto invalid_code; 2103 goto invalid_code;
2104 ONE_MORE_BYTE (c); 2104 ONE_MORE_BYTE (c);
2105 if (c < 0xA0) 2105 if (c < 0xA0)
@@ -2112,7 +2112,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2112 || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) 2112 || c == EMACS_MULE_LEADING_CODE_PRIVATE_12)
2113 { 2113 {
2114 ONE_MORE_BYTE (c); 2114 ONE_MORE_BYTE (c);
2115 if (c < 0xA0 || ! (charset = emacs_mule_charset[c])) 2115 if (c < 0xA0 || (charset_id = emacs_mule_charset[c]) < 0)
2116 goto invalid_code; 2116 goto invalid_code;
2117 ONE_MORE_BYTE (c); 2117 ONE_MORE_BYTE (c);
2118 if (c < 0xA0) 2118 if (c < 0xA0)
@@ -2121,7 +2121,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2121 } 2121 }
2122 else 2122 else
2123 { 2123 {
2124 if (! (charset = emacs_mule_charset[c])) 2124 if ((charset_id = emacs_mule_charset[c]) < 0)
2125 goto invalid_code; 2125 goto invalid_code;
2126 ONE_MORE_BYTE (c); 2126 ONE_MORE_BYTE (c);
2127 if (c < 0xA0) 2127 if (c < 0xA0)
@@ -2136,7 +2136,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2136 2136
2137 case 4: 2137 case 4:
2138 ONE_MORE_BYTE (c); 2138 ONE_MORE_BYTE (c);
2139 if (c < 0 || ! (charset = emacs_mule_charset[c])) 2139 if (c < 0 || (charset_id = emacs_mule_charset[c]) < 0)
2140 goto invalid_code; 2140 goto invalid_code;
2141 ONE_MORE_BYTE (c); 2141 ONE_MORE_BYTE (c);
2142 if (c < 0xA0) 2142 if (c < 0xA0)
@@ -2150,21 +2150,21 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2150 2150
2151 case 1: 2151 case 1:
2152 code = c; 2152 code = c;
2153 charset = CHARSET_FROM_ID (ASCII_BYTE_P (code) 2153 charset_id = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit;
2154 ? charset_ascii : charset_eight_bit);
2155 break; 2154 break;
2156 2155
2157 default: 2156 default:
2158 abort (); 2157 abort ();
2159 } 2158 }
2160 CODING_DECODE_CHAR (coding, src, src_base, src_end, charset, code, c); 2159 CODING_DECODE_CHAR (coding, src, src_base, src_end,
2160 CHARSET_FROM_ID (charset_id), code, c);
2161 if (c < 0) 2161 if (c < 0)
2162 goto invalid_code; 2162 goto invalid_code;
2163 } 2163 }
2164 *nbytes = src - src_base; 2164 *nbytes = src - src_base;
2165 *nchars = consumed_chars; 2165 *nchars = consumed_chars;
2166 if (id) 2166 if (id)
2167 *id = charset->id; 2167 *id = charset_id;
2168 return (mseq_found ? -c : c); 2168 return (mseq_found ? -c : c);
2169 2169
2170 no_more_source: 2170 no_more_source:
@@ -9297,7 +9297,8 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern
9297 doc: /* Internal use only. */) 9297 doc: /* Internal use only. */)
9298 (Lisp_Object coding_system, Lisp_Object terminal) 9298 (Lisp_Object coding_system, Lisp_Object terminal)
9299{ 9299{
9300 struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); 9300 struct terminal *term = get_terminal (terminal, 1);
9301 struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (term);
9301 CHECK_SYMBOL (coding_system); 9302 CHECK_SYMBOL (coding_system);
9302 setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding); 9303 setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding);
9303 /* We had better not send unsafe characters to terminal. */ 9304 /* We had better not send unsafe characters to terminal. */
@@ -9306,6 +9307,10 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern
9306 terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; 9307 terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK;
9307 terminal_coding->src_multibyte = 1; 9308 terminal_coding->src_multibyte = 1;
9308 terminal_coding->dst_multibyte = 0; 9309 terminal_coding->dst_multibyte = 0;
9310 if (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK)
9311 term->charset_list = coding_charset_list (terminal_coding);
9312 else
9313 term->charset_list = Fcons (make_number (charset_ascii), Qnil);
9309 return Qnil; 9314 return Qnil;
9310} 9315}
9311 9316
@@ -10554,7 +10559,7 @@ associated with each coding-category one by one in this order. When
10554one algorithm agrees with a byte sequence of source text, the coding 10559one algorithm agrees with a byte sequence of source text, the coding
10555system bound to the corresponding coding-category is selected. 10560system bound to the corresponding coding-category is selected.
10556 10561
10557Don't modify this variable directly, but use `set-coding-priority'. */); 10562Don't modify this variable directly, but use `set-coding-system-priority'. */);
10558 { 10563 {
10559 int i; 10564 int i;
10560 10565
diff --git a/src/config.in b/src/config.in
index add2ac73d55..105f343870c 100644
--- a/src/config.in
+++ b/src/config.in
@@ -294,6 +294,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
294/* Define to 1 if you have the `gtk_widget_set_has_window' function. */ 294/* Define to 1 if you have the `gtk_widget_set_has_window' function. */
295#undef HAVE_GTK_WIDGET_SET_HAS_WINDOW 295#undef HAVE_GTK_WIDGET_SET_HAS_WINDOW
296 296
297/* Define to 1 if you have the `g_type_init' function. */
298#undef HAVE_G_TYPE_INIT
299
297/* Define to 1 if netdb.h declares h_errno. */ 300/* Define to 1 if netdb.h declares h_errno. */
298#undef HAVE_H_ERRNO 301#undef HAVE_H_ERRNO
299 302
@@ -660,9 +663,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
660/* Define to 1 if you have the `sysinfo' function. */ 663/* Define to 1 if you have the `sysinfo' function. */
661#undef HAVE_SYSINFO 664#undef HAVE_SYSINFO
662 665
663/* Define to 1 if you have the <sys/ioctl.h> header file. */
664#undef HAVE_SYS_IOCTL_H
665
666/* Define to 1 if you have the <sys/mman.h> header file. */ 666/* Define to 1 if you have the <sys/mman.h> header file. */
667#undef HAVE_SYS_MMAN_H 667#undef HAVE_SYS_MMAN_H
668 668
@@ -687,9 +687,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
687/* Define to 1 if you have the <sys/systeminfo.h> header file. */ 687/* Define to 1 if you have the <sys/systeminfo.h> header file. */
688#undef HAVE_SYS_SYSTEMINFO_H 688#undef HAVE_SYS_SYSTEMINFO_H
689 689
690/* Define to 1 if you have the <sys/timeb.h> header file. */
691#undef HAVE_SYS_TIMEB_H
692
693/* Define to 1 if you have the <sys/time.h> header file. */ 690/* Define to 1 if you have the <sys/time.h> header file. */
694#undef HAVE_SYS_TIME_H 691#undef HAVE_SYS_TIME_H
695 692
@@ -711,9 +708,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
711/* Define to 1 if you have the <sys/_mbstate_t.h> header file. */ 708/* Define to 1 if you have the <sys/_mbstate_t.h> header file. */
712#undef HAVE_SYS__MBSTATE_T_H 709#undef HAVE_SYS__MBSTATE_T_H
713 710
714/* Define to 1 if you have the <termios.h> header file. */
715#undef HAVE_TERMIOS_H
716
717/* Define to 1 if you have the <term.h> header file. */ 711/* Define to 1 if you have the <term.h> header file. */
718#undef HAVE_TERM_H 712#undef HAVE_TERM_H
719 713
@@ -1059,6 +1053,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1059/* Define to `int' if <sys/types.h> does not define. */ 1053/* Define to `int' if <sys/types.h> does not define. */
1060#undef pid_t 1054#undef pid_t
1061 1055
1056/* Define to `unsigned int' if <sys/types.h> does not define. */
1057#undef size_t
1058
1062/* Define to any substitute for sys_siglist. */ 1059/* Define to any substitute for sys_siglist. */
1063#undef sys_siglist 1060#undef sys_siglist
1064 1061
@@ -1079,7 +1076,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1079/* Don't try to switch on inline handling as detected by AC_C_INLINE 1076/* Don't try to switch on inline handling as detected by AC_C_INLINE
1080 generally, because even if non-gcc compilers accept `inline', they 1077 generally, because even if non-gcc compilers accept `inline', they
1081 may reject `extern inline'. */ 1078 may reject `extern inline'. */
1082#if defined (__GNUC__) && defined (OPTIMIZE) 1079#if defined (__GNUC__)
1083#define INLINE __inline__ 1080#define INLINE __inline__
1084#else 1081#else
1085#define INLINE 1082#define INLINE
@@ -1095,19 +1092,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1095 1092
1096/* Include the os and machine dependent files. */ 1093/* Include the os and machine dependent files. */
1097#include config_opsysfile 1094#include config_opsysfile
1098#include config_machfile 1095#ifdef config_machfile
1099 1096# include config_machfile
1100/* Set up some defines, C and LD flags for NeXTstep interface on GNUstep. 1097#endif
1101 (There is probably a better place to do this, but right now the Cocoa 1098
1102 side does this in s/darwin.h and we cannot
1103 parallel this exactly since GNUstep is multi-OS. */
1104#ifdef HAVE_NS
1105# ifdef NS_IMPL_GNUSTEP
1106/* GNUstep needs a bit more pure memory. Of the existing knobs, 1099/* GNUstep needs a bit more pure memory. Of the existing knobs,
1107SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */ 1100 SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.
1101 (There is probably a better place to do this, but right now the
1102 Cocoa side does this in s/darwin.h and we cannot parallel this
1103 exactly since GNUstep is multi-OS. */
1104#if defined HAVE_NS && defined NS_IMPL_GNUSTEP
1108# define SYSTEM_PURESIZE_EXTRA 30000 1105# define SYSTEM_PURESIZE_EXTRA 30000
1109# endif /* NS_IMPL_GNUSTEP */ 1106#endif
1110#endif /* HAVE_NS */
1111 1107
1112/* SIGTYPE is the macro we actually use. */ 1108/* SIGTYPE is the macro we actually use. */
1113#ifndef SIGTYPE 1109#ifndef SIGTYPE
@@ -1206,6 +1202,12 @@ typedef unsigned size_t;
1206#define NO_INLINE 1202#define NO_INLINE
1207#endif 1203#endif
1208 1204
1205#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
1206#define EXTERNALLY_VISIBLE __attribute__((externally_visible))
1207#else
1208#define EXTERNALLY_VISIBLE
1209#endif
1210
1209/* Some versions of GNU/Linux define noinline in their headers. */ 1211/* Some versions of GNU/Linux define noinline in their headers. */
1210#ifdef noinline 1212#ifdef noinline
1211#undef noinline 1213#undef noinline
diff --git a/src/data.c b/src/data.c
index 78ccb75ca89..924a717cf3d 100644
--- a/src/data.c
+++ b/src/data.c
@@ -135,21 +135,6 @@ args_out_of_range_3 (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3)
135 xsignal3 (Qargs_out_of_range, a1, a2, a3); 135 xsignal3 (Qargs_out_of_range, a1, a2, a3);
136} 136}
137 137
138/* On some machines, XINT needs a temporary location.
139 Here it is, in case it is needed. */
140
141int sign_extend_temp;
142
143/* On a few machines, XINT can only be done by calling this. */
144
145int
146sign_extend_lisp_int (EMACS_INT num)
147{
148 if (num & (((EMACS_INT) 1) << (VALBITS - 1)))
149 return num | (((EMACS_INT) (-1)) << VALBITS);
150 else
151 return num & ((((EMACS_INT) 1) << VALBITS) - 1);
152}
153 138
154/* Data type predicates */ 139/* Data type predicates */
155 140
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 683b7cb583b..6ab976b58da 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -57,6 +57,9 @@ Lisp_Object QCdbus_type_int32, QCdbus_type_uint32;
57Lisp_Object QCdbus_type_int64, QCdbus_type_uint64; 57Lisp_Object QCdbus_type_int64, QCdbus_type_uint64;
58Lisp_Object QCdbus_type_double, QCdbus_type_string; 58Lisp_Object QCdbus_type_double, QCdbus_type_string;
59Lisp_Object QCdbus_type_object_path, QCdbus_type_signature; 59Lisp_Object QCdbus_type_object_path, QCdbus_type_signature;
60#ifdef DBUS_TYPE_UNIX_FD
61Lisp_Object QCdbus_type_unix_fd;
62#endif
60Lisp_Object QCdbus_type_array, QCdbus_type_variant; 63Lisp_Object QCdbus_type_array, QCdbus_type_variant;
61Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry; 64Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry;
62 65
@@ -147,6 +150,22 @@ int xd_in_read_queued_messages = 0;
147#endif 150#endif
148 151
149/* Check whether TYPE is a basic DBusType. */ 152/* Check whether TYPE is a basic DBusType. */
153#ifdef DBUS_TYPE_UNIX_FD
154#define XD_BASIC_DBUS_TYPE(type) \
155 ((type == DBUS_TYPE_BYTE) \
156 || (type == DBUS_TYPE_BOOLEAN) \
157 || (type == DBUS_TYPE_INT16) \
158 || (type == DBUS_TYPE_UINT16) \
159 || (type == DBUS_TYPE_INT32) \
160 || (type == DBUS_TYPE_UINT32) \
161 || (type == DBUS_TYPE_INT64) \
162 || (type == DBUS_TYPE_UINT64) \
163 || (type == DBUS_TYPE_DOUBLE) \
164 || (type == DBUS_TYPE_STRING) \
165 || (type == DBUS_TYPE_OBJECT_PATH) \
166 || (type == DBUS_TYPE_SIGNATURE) \
167 || (type == DBUS_TYPE_UNIX_FD))
168#else
150#define XD_BASIC_DBUS_TYPE(type) \ 169#define XD_BASIC_DBUS_TYPE(type) \
151 ((type == DBUS_TYPE_BYTE) \ 170 ((type == DBUS_TYPE_BYTE) \
152 || (type == DBUS_TYPE_BOOLEAN) \ 171 || (type == DBUS_TYPE_BOOLEAN) \
@@ -160,6 +179,7 @@ int xd_in_read_queued_messages = 0;
160 || (type == DBUS_TYPE_STRING) \ 179 || (type == DBUS_TYPE_STRING) \
161 || (type == DBUS_TYPE_OBJECT_PATH) \ 180 || (type == DBUS_TYPE_OBJECT_PATH) \
162 || (type == DBUS_TYPE_SIGNATURE)) 181 || (type == DBUS_TYPE_SIGNATURE))
182#endif
163 183
164/* This was a macro. On Solaris 2.11 it was said to compile for 184/* This was a macro. On Solaris 2.11 it was said to compile for
165 hours, when optimzation is enabled. So we have transferred it into 185 hours, when optimzation is enabled. So we have transferred it into
@@ -182,6 +202,9 @@ xd_symbol_to_dbus_type (Lisp_Object object)
182 : (EQ (object, QCdbus_type_string)) ? DBUS_TYPE_STRING 202 : (EQ (object, QCdbus_type_string)) ? DBUS_TYPE_STRING
183 : (EQ (object, QCdbus_type_object_path)) ? DBUS_TYPE_OBJECT_PATH 203 : (EQ (object, QCdbus_type_object_path)) ? DBUS_TYPE_OBJECT_PATH
184 : (EQ (object, QCdbus_type_signature)) ? DBUS_TYPE_SIGNATURE 204 : (EQ (object, QCdbus_type_signature)) ? DBUS_TYPE_SIGNATURE
205#ifdef DBUS_TYPE_UNIX_FD
206 : (EQ (object, QCdbus_type_unix_fd)) ? DBUS_TYPE_UNIX_FD
207#endif
185 : (EQ (object, QCdbus_type_array)) ? DBUS_TYPE_ARRAY 208 : (EQ (object, QCdbus_type_array)) ? DBUS_TYPE_ARRAY
186 : (EQ (object, QCdbus_type_variant)) ? DBUS_TYPE_VARIANT 209 : (EQ (object, QCdbus_type_variant)) ? DBUS_TYPE_VARIANT
187 : (EQ (object, QCdbus_type_struct)) ? DBUS_TYPE_STRUCT 210 : (EQ (object, QCdbus_type_struct)) ? DBUS_TYPE_STRUCT
@@ -238,6 +261,9 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis
238 case DBUS_TYPE_UINT16: 261 case DBUS_TYPE_UINT16:
239 case DBUS_TYPE_UINT32: 262 case DBUS_TYPE_UINT32:
240 case DBUS_TYPE_UINT64: 263 case DBUS_TYPE_UINT64:
264#ifdef DBUS_TYPE_UNIX_FD
265 case DBUS_TYPE_UNIX_FD:
266#endif
241 CHECK_NATNUM (object); 267 CHECK_NATNUM (object);
242 sprintf (signature, "%c", dtype); 268 sprintf (signature, "%c", dtype);
243 break; 269 break;
@@ -451,6 +477,9 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
451 } 477 }
452 478
453 case DBUS_TYPE_UINT32: 479 case DBUS_TYPE_UINT32:
480#ifdef DBUS_TYPE_UNIX_FD
481 case DBUS_TYPE_UNIX_FD:
482#endif
454 CHECK_NUMBER (object); 483 CHECK_NUMBER (object);
455 { 484 {
456 dbus_uint32_t val = XUINT (object); 485 dbus_uint32_t val = XUINT (object);
@@ -648,6 +677,9 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter)
648 } 677 }
649 678
650 case DBUS_TYPE_UINT32: 679 case DBUS_TYPE_UINT32:
680#ifdef DBUS_TYPE_UNIX_FD
681 case DBUS_TYPE_UNIX_FD:
682#endif
651 { 683 {
652 dbus_uint32_t val; 684 dbus_uint32_t val;
653 dbus_message_iter_get_basic (iter, &val); 685 dbus_message_iter_get_basic (iter, &val);
@@ -983,6 +1015,7 @@ input arguments. It follows the mapping rules:
983 DBUS_TYPE_UINT16 => number 1015 DBUS_TYPE_UINT16 => number
984 DBUS_TYPE_INT16 => integer 1016 DBUS_TYPE_INT16 => integer
985 DBUS_TYPE_UINT32 => number or float 1017 DBUS_TYPE_UINT32 => number or float
1018 DBUS_TYPE_UNIX_FD => number or float
986 DBUS_TYPE_INT32 => integer or float 1019 DBUS_TYPE_INT32 => integer or float
987 DBUS_TYPE_UINT64 => number or float 1020 DBUS_TYPE_UINT64 => number or float
988 DBUS_TYPE_INT64 => integer or float 1021 DBUS_TYPE_INT64 => integer or float
@@ -2104,6 +2137,11 @@ syms_of_dbusbind (void)
2104 QCdbus_type_signature = intern_c_string (":signature"); 2137 QCdbus_type_signature = intern_c_string (":signature");
2105 staticpro (&QCdbus_type_signature); 2138 staticpro (&QCdbus_type_signature);
2106 2139
2140#ifdef DBUS_TYPE_UNIX_FD
2141 QCdbus_type_unix_fd = intern_c_string (":unix-fd");
2142 staticpro (&QCdbus_type_unix_fd);
2143#endif
2144
2107 QCdbus_type_array = intern_c_string (":array"); 2145 QCdbus_type_array = intern_c_string (":array");
2108 staticpro (&QCdbus_type_array); 2146 staticpro (&QCdbus_type_array);
2109 2147
diff --git a/src/dispextern.h b/src/dispextern.h
index 20e074d2393..7426c03b5ec 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -69,6 +69,11 @@ typedef Pixmap XImagePtr;
69typedef XImagePtr XImagePtr_or_DC; 69typedef XImagePtr XImagePtr_or_DC;
70#endif 70#endif
71 71
72#ifndef HAVE_WINDOW_SYSTEM
73typedef int Cursor;
74#define No_Cursor (0)
75#endif
76
72#ifndef NativeRectangle 77#ifndef NativeRectangle
73#define NativeRectangle int 78#define NativeRectangle int
74#endif 79#endif
@@ -279,6 +284,9 @@ enum glyph_type
279 /* Glyph describes a static composition. */ 284 /* Glyph describes a static composition. */
280 COMPOSITE_GLYPH, 285 COMPOSITE_GLYPH,
281 286
287 /* Glyph describes a glyphless character. */
288 GLYPHLESS_GLYPH,
289
282 /* Glyph describes an image. */ 290 /* Glyph describes an image. */
283 IMAGE_GLYPH, 291 IMAGE_GLYPH,
284 292
@@ -333,7 +341,7 @@ struct glyph
333 341
334 /* Which kind of glyph this is---character, image etc. Value 342 /* Which kind of glyph this is---character, image etc. Value
335 should be an enumerator of type enum glyph_type. */ 343 should be an enumerator of type enum glyph_type. */
336 unsigned type : 2; 344 unsigned type : 3;
337 345
338 /* 1 means this glyph was produced from multibyte text. Zero 346 /* 1 means this glyph was produced from multibyte text. Zero
339 means it was produced from unibyte text, i.e. charsets aren't 347 means it was produced from unibyte text, i.e. charsets aren't
@@ -363,12 +371,11 @@ struct glyph
363 displaying. The member `pixel_width' above is set to 1. */ 371 displaying. The member `pixel_width' above is set to 1. */
364 unsigned padding_p : 1; 372 unsigned padding_p : 1;
365 373
366 /* 1 means the actual glyph is not available, draw a box instead. 374 /* 1 means the actual glyph is not available, draw using `struct
367 This can happen when a font couldn't be loaded, or a character 375 glyphless' below instead. This can happen when a font couldn't
368 doesn't have a glyph in a font. */ 376 be loaded, or a character doesn't have a glyph in a font. */
369 unsigned glyph_not_available_p : 1; 377 unsigned glyph_not_available_p : 1;
370 378
371
372 /* Non-zero means don't display cursor here. */ 379 /* Non-zero means don't display cursor here. */
373 unsigned avoid_cursor_p : 1; 380 unsigned avoid_cursor_p : 1;
374 381
@@ -402,6 +409,11 @@ struct glyph
402 /* Start and end indices of glyphs of a graphme cluster of a 409 /* Start and end indices of glyphs of a graphme cluster of a
403 composition (type == COMPOSITE_GLYPH). */ 410 composition (type == COMPOSITE_GLYPH). */
404 struct { int from, to; } cmp; 411 struct { int from, to; } cmp;
412 /* Pixel offsets for upper and lower part of the acronym. */
413 struct {
414 short upper_xoff, upper_yoff;
415 short lower_xoff, lower_yoff;
416 } glyphless;
405 } slice; 417 } slice;
406 418
407 /* A union of sub-structures for different glyph types. */ 419 /* A union of sub-structures for different glyph types. */
@@ -433,6 +445,19 @@ struct glyph
433 } 445 }
434 stretch; 446 stretch;
435 447
448 /* Sub-stretch for type == GLYPHLESS_GLYPH. */
449 struct
450 {
451 /* Value is an enum of the type glyphless_display_method. */
452 unsigned method : 2;
453 /* 1 iff this glyph is for a character of no font. */
454 unsigned for_no_font : 1;
455 /* Length of acronym or hexadecimal code string (at most 8). */
456 unsigned len : 4;
457 /* Character to display. Actually we need only 22 bits. */
458 unsigned ch : 26;
459 } glyphless;
460
436 /* Used to compare all bit-fields above in one step. */ 461 /* Used to compare all bit-fields above in one step. */
437 unsigned val; 462 unsigned val;
438 } u; 463 } u;
@@ -1918,6 +1943,9 @@ enum display_element_type
1918 /* A composition (static and automatic). */ 1943 /* A composition (static and automatic). */
1919 IT_COMPOSITION, 1944 IT_COMPOSITION,
1920 1945
1946 /* A glyphless character (e.g. ZWNJ, LRE). */
1947 IT_GLYPHLESS,
1948
1921 /* An image. */ 1949 /* An image. */
1922 IT_IMAGE, 1950 IT_IMAGE,
1923 1951
@@ -1964,6 +1992,21 @@ enum line_wrap_method
1964 WINDOW_WRAP 1992 WINDOW_WRAP
1965}; 1993};
1966 1994
1995/* An enumerator for the method of displaying glyphless characters. */
1996
1997enum glyphless_display_method
1998 {
1999 /* Display a thin (1-pixel width) space. On a TTY, display a
2000 1-character width space. */
2001 GLYPHLESS_DISPLAY_THIN_SPACE,
2002 /* Display an empty box of proper width. */
2003 GLYPHLESS_DISPLAY_EMPTY_BOX,
2004 /* Display an acronym string in a box. */
2005 GLYPHLESS_DISPLAY_ACRONYM,
2006 /* Display the hexadecimal code of the character in a box. */
2007 GLYPHLESS_DISPLAY_HEX_CODE
2008 };
2009
1967struct it_slice 2010struct it_slice
1968{ 2011{
1969 Lisp_Object x; 2012 Lisp_Object x;
@@ -2295,6 +2338,10 @@ struct it
2295 PRODUCE_GLYPHS, this should be set beforehand too. */ 2338 PRODUCE_GLYPHS, this should be set beforehand too. */
2296 int char_to_display; 2339 int char_to_display;
2297 2340
2341 /* If what == IT_GLYPHLESS, the method to display such a
2342 character. */
2343 enum glyphless_display_method glyphless_method;
2344
2298 /* If what == IT_IMAGE, the id of the image to display. */ 2345 /* If what == IT_IMAGE, the id of the image to display. */
2299 int image_id; 2346 int image_id;
2300 2347
@@ -2840,6 +2887,9 @@ enum tool_bar_item_idx
2840 /* Label to show when text labels are enabled. */ 2887 /* Label to show when text labels are enabled. */
2841 TOOL_BAR_ITEM_LABEL, 2888 TOOL_BAR_ITEM_LABEL,
2842 2889
2890 /* If we shall show the label only below the icon and not beside it. */
2891 TOOL_BAR_ITEM_VERT_ONLY,
2892
2843 /* Sentinel = number of slots in tool_bar_items occupied by one 2893 /* Sentinel = number of slots in tool_bar_items occupied by one
2844 tool-bar item. */ 2894 tool-bar item. */
2845 TOOL_BAR_ITEM_NSLOTS 2895 TOOL_BAR_ITEM_NSLOTS
@@ -2976,9 +3026,10 @@ extern int last_tool_bar_item;
2976extern Lisp_Object Vmouse_autoselect_window; 3026extern Lisp_Object Vmouse_autoselect_window;
2977extern int unibyte_display_via_language_environment; 3027extern int unibyte_display_via_language_environment;
2978extern EMACS_INT underline_minimum_offset; 3028extern EMACS_INT underline_minimum_offset;
3029extern Lisp_Object Vglyphless_char_display;
2979 3030
2980extern void reseat_at_previous_visible_line_start (struct it *); 3031extern void reseat_at_previous_visible_line_start (struct it *);
2981 3032extern Lisp_Object lookup_glyphless_char_display (int, struct it *);
2982extern int calc_pixel_width_or_height (double *, struct it *, Lisp_Object, 3033extern int calc_pixel_width_or_height (double *, struct it *, Lisp_Object,
2983 struct font *, int, int *); 3034 struct font *, int, int *);
2984 3035
@@ -3017,28 +3068,31 @@ extern void x_update_cursor (struct frame *, int);
3017extern void x_clear_cursor (struct window *); 3068extern void x_clear_cursor (struct window *);
3018extern void x_draw_vertical_border (struct window *w); 3069extern void x_draw_vertical_border (struct window *w);
3019 3070
3020extern void frame_to_window_pixel_xy (struct window *, int *, int *);
3021extern int get_glyph_string_clip_rects (struct glyph_string *, 3071extern int get_glyph_string_clip_rects (struct glyph_string *,
3022 NativeRectangle *, int); 3072 NativeRectangle *, int);
3023extern void get_glyph_string_clip_rect (struct glyph_string *, 3073extern void get_glyph_string_clip_rect (struct glyph_string *,
3024 NativeRectangle *nr); 3074 NativeRectangle *nr);
3025extern Lisp_Object find_hot_spot (Lisp_Object, int, int); 3075extern Lisp_Object find_hot_spot (Lisp_Object, int, int);
3026extern void note_mouse_highlight (struct frame *, int, int);
3027extern void x_clear_window_mouse_face (struct window *);
3028extern void cancel_mouse_face (struct frame *);
3029 3076
3030extern void handle_tool_bar_click (struct frame *, 3077extern void handle_tool_bar_click (struct frame *,
3031 int, int, int, unsigned int); 3078 int, int, int, unsigned int);
3032 3079
3033/* msdos.c defines its own versions of these functions. */
3034extern int clear_mouse_face (Display_Info *);
3035extern void show_mouse_face (Display_Info *, enum draw_glyphs_face);
3036extern int cursor_in_mouse_face_p (struct window *w);
3037
3038extern void expose_frame (struct frame *, int, int, int, int); 3080extern void expose_frame (struct frame *, int, int, int, int);
3039extern int x_intersect_rectangles (XRectangle *, XRectangle *, 3081extern int x_intersect_rectangles (XRectangle *, XRectangle *,
3040 XRectangle *); 3082 XRectangle *);
3041#endif 3083#endif /* HAVE_WINDOW_SYSTEM */
3084
3085extern void frame_to_window_pixel_xy (struct window *, int *, int *);
3086extern void note_mouse_highlight (struct frame *, int, int);
3087extern void x_clear_window_mouse_face (struct window *);
3088extern void cancel_mouse_face (struct frame *);
3089extern int clear_mouse_face (Mouse_HLInfo *);
3090extern void show_mouse_face (Mouse_HLInfo *, enum draw_glyphs_face);
3091extern int cursor_in_mouse_face_p (struct window *w);
3092extern void draw_row_with_mouse_face (struct window *, int, struct glyph_row *,
3093 int, int, enum draw_glyphs_face);
3094extern void tty_draw_row_with_mouse_face (struct window *, struct glyph_row *,
3095 int, int, enum draw_glyphs_face);
3042 3096
3043/* Flags passed to try_window. */ 3097/* Flags passed to try_window. */
3044#define TRY_WINDOW_CHECK_MARGINS (1 << 0) 3098#define TRY_WINDOW_CHECK_MARGINS (1 << 0)
@@ -3124,7 +3178,6 @@ char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object,
3124int ascii_face_of_lisp_face (struct frame *, int); 3178int ascii_face_of_lisp_face (struct frame *, int);
3125void prepare_face_for_display (struct frame *, struct face *); 3179void prepare_face_for_display (struct frame *, struct face *);
3126int xstrcasecmp (const unsigned char *, const unsigned char *); 3180int xstrcasecmp (const unsigned char *, const unsigned char *);
3127int lookup_face (struct frame *, Lisp_Object *);
3128int lookup_named_face (struct frame *, Lisp_Object, int); 3181int lookup_named_face (struct frame *, Lisp_Object, int);
3129int lookup_basic_face (struct frame *, int); 3182int lookup_basic_face (struct frame *, int);
3130int smaller_face (struct frame *, int, int); 3183int smaller_face (struct frame *, int, int);
diff --git a/src/dispnew.c b/src/dispnew.c
index f9729fc28cb..5d4ce012530 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1180,7 +1180,7 @@ swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b)
1180/* Copy glyph row structure FROM to glyph row structure TO, except 1180/* Copy glyph row structure FROM to glyph row structure TO, except
1181 that glyph pointers in the structures are left unchanged. */ 1181 that glyph pointers in the structures are left unchanged. */
1182 1182
1183INLINE void 1183static INLINE void
1184copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from) 1184copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from)
1185{ 1185{
1186 struct glyph *pointers[1 + LAST_AREA]; 1186 struct glyph *pointers[1 + LAST_AREA];
@@ -2893,6 +2893,14 @@ mirror_make_current (struct window *w, int frame_row)
2893 else 2893 else
2894 swap_glyph_pointers (desired_row, current_row); 2894 swap_glyph_pointers (desired_row, current_row);
2895 current_row->enabled_p = 1; 2895 current_row->enabled_p = 1;
2896
2897 /* Set the Y coordinate of the mode/header line's row.
2898 It is needed in draw_row_with_mouse_face to find the
2899 screen coordinates. (Window-based redisplay sets
2900 this in update_window, but no one seems to do that
2901 for frame-based redisplay.) */
2902 if (current_row->mode_line_p)
2903 current_row->y = row;
2896 } 2904 }
2897 } 2905 }
2898 2906
@@ -5385,7 +5393,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
5385 BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp))); 5393 BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp)));
5386 start_display (&it, w, startp); 5394 start_display (&it, w, startp);
5387 5395
5388 x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w); 5396 x0 = *x;
5389 5397
5390 /* First, move to the beginning of the row corresponding to *Y. We 5398 /* First, move to the beginning of the row corresponding to *Y. We
5391 need to be in that row to get the correct value of base paragraph 5399 need to be in that row to get the correct value of base paragraph
@@ -6416,6 +6424,12 @@ init_display (void)
6416 f->terminal = t; 6424 f->terminal = t;
6417 6425
6418 t->reference_count++; 6426 t->reference_count++;
6427#ifdef MSDOS
6428 f->output_data.tty->display_info = &the_only_display_info;
6429#else
6430 if (f->output_method == output_termcap)
6431 create_tty_output (f);
6432#endif
6419 t->display_info.tty->top_frame = selected_frame; 6433 t->display_info.tty->top_frame = selected_frame;
6420 change_frame_size (XFRAME (selected_frame), 6434 change_frame_size (XFRAME (selected_frame),
6421 FrameRows (t->display_info.tty), 6435 FrameRows (t->display_info.tty),
@@ -6583,13 +6597,29 @@ It is up to you to set this variable if your terminal can do that. */);
6583 6597
6584 DEFVAR_LISP ("initial-window-system", &Vinitial_window_system, 6598 DEFVAR_LISP ("initial-window-system", &Vinitial_window_system,
6585 doc: /* Name of the window system that Emacs uses for the first frame. 6599 doc: /* Name of the window system that Emacs uses for the first frame.
6586The value is a symbol--for instance, `x' for X windows. 6600The value is a symbol:
6587The value is nil if Emacs is using a text-only terminal. */); 6601 nil for a termcap frame (a character-only terminal),
6602 'x' for an Emacs frame that is really an X window,
6603 'w32' for an Emacs frame that is a window on MS-Windows display,
6604 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display,
6605 'pc' for a direct-write MS-DOS frame.
6606
6607Use of this variable as a boolean is deprecated. Instead,
6608use `display-graphic-p' or any of the other `display-*-p'
6609predicates which report frame's specific UI-related capabilities. */);
6588 6610
6589 DEFVAR_KBOARD ("window-system", Vwindow_system, 6611 DEFVAR_KBOARD ("window-system", Vwindow_system,
6590 doc: /* Name of window system through which the selected frame is displayed. 6612 doc: /* Name of window system through which the selected frame is displayed.
6591The value is a symbol--for instance, `x' for X windows. 6613The value is a symbol:
6592The value is nil if the selected frame is on a text-only-terminal. */); 6614 nil for a termcap frame (a character-only terminal),
6615 'x' for an Emacs frame that is really an X window,
6616 'w32' for an Emacs frame that is a window on MS-Windows display,
6617 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display,
6618 'pc' for a direct-write MS-DOS frame.
6619
6620Use of this variable as a boolean is deprecated. Instead,
6621use `display-graphic-p' or any of the other `display-*-p'
6622predicates which report frame's specific UI-related capabilities. */);
6593 6623
6594 DEFVAR_LISP ("window-system-version", &Vwindow_system_version, 6624 DEFVAR_LISP ("window-system-version", &Vwindow_system_version,
6595 doc: /* The version number of the window system in use. 6625 doc: /* The version number of the window system in use.
diff --git a/src/editfns.c b/src/editfns.c
index f76beb5e678..4a9e2314a84 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -218,11 +218,13 @@ usage: (char-to-string CHAR) */)
218} 218}
219 219
220DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0, 220DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0,
221 doc: /* Convert arg BYTE to a string containing that byte. */) 221 doc: /* Convert arg BYTE to a unibyte string containing that byte. */)
222 (Lisp_Object byte) 222 (Lisp_Object byte)
223{ 223{
224 unsigned char b; 224 unsigned char b;
225 CHECK_NUMBER (byte); 225 CHECK_NUMBER (byte);
226 if (XINT (byte) < 0 || XINT (byte) > 255)
227 error ("Invalid byte");
226 b = XINT (byte); 228 b = XINT (byte);
227 return make_string_from_bytes (&b, 1, 1); 229 return make_string_from_bytes (&b, 1, 1);
228} 230}
diff --git a/src/emacs.c b/src/emacs.c
index 70a0fae4ebf..49716c7eb4a 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1,7 +1,8 @@
1/* Fully extensible Emacs, running on Unix, intended for GNU. 1/* Fully extensible Emacs, running on Unix, intended for GNU.
2 Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2
3 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 3Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999,
4 2010 Free Software Foundation, Inc. 4 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5 Free Software Foundation, Inc.
5 6
6This file is part of GNU Emacs. 7This file is part of GNU Emacs.
7 8
@@ -99,27 +100,27 @@ static const char emacs_version[] = "24.0.50";
99/* Make these values available in GDB, which doesn't see macros. */ 100/* Make these values available in GDB, which doesn't see macros. */
100 101
101#ifdef USE_LSB_TAG 102#ifdef USE_LSB_TAG
102int gdb_use_lsb = 1; 103int gdb_use_lsb EXTERNALLY_VISIBLE = 1;
103#else 104#else
104int gdb_use_lsb = 0; 105int gdb_use_lsb EXTERNALLY_VISIBLE = 0;
105#endif 106#endif
106#ifndef USE_LISP_UNION_TYPE 107#ifndef USE_LISP_UNION_TYPE
107int gdb_use_union = 0; 108int gdb_use_union EXTERNALLY_VISIBLE = 0;
108#else 109#else
109int gdb_use_union = 1; 110int gdb_use_union EXTERNALLY_VISIBLE = 1;
110#endif 111#endif
111EMACS_INT gdb_valbits = VALBITS; 112EMACS_INT gdb_valbits EXTERNALLY_VISIBLE = VALBITS;
112EMACS_INT gdb_gctypebits = GCTYPEBITS; 113EMACS_INT gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS;
113#if defined (DATA_SEG_BITS) && ! defined (USE_LSB_TAG) 114#if defined (DATA_SEG_BITS) && ! defined (USE_LSB_TAG)
114EMACS_INT gdb_data_seg_bits = DATA_SEG_BITS; 115EMACS_INT gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS;
115#else 116#else
116EMACS_INT gdb_data_seg_bits = 0; 117EMACS_INT gdb_data_seg_bits EXTERNALLY_VISIBLE = 0;
117#endif 118#endif
118EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG; 119EMACS_INT PVEC_FLAG EXTERNALLY_VISIBLE = PSEUDOVECTOR_FLAG;
119EMACS_INT gdb_array_mark_flag = ARRAY_MARK_FLAG; 120EMACS_INT gdb_array_mark_flag EXTERNALLY_VISIBLE = ARRAY_MARK_FLAG;
120/* GDB might say "No enum type named pvec_type" if we don't have at 121/* GDB might say "No enum type named pvec_type" if we don't have at
121 least one symbol with that type, and then xbacktrace could fail. */ 122 least one symbol with that type, and then xbacktrace could fail. */
122enum pvec_type gdb_pvec_type = PVEC_TYPE_MASK; 123enum pvec_type gdb_pvec_type EXTERNALLY_VISIBLE = PVEC_TYPE_MASK;
123 124
124/* Command line args from shell, as list of strings. */ 125/* Command line args from shell, as list of strings. */
125Lisp_Object Vcommand_line_args; 126Lisp_Object Vcommand_line_args;
@@ -194,11 +195,6 @@ Lisp_Object Vdynamic_library_alist;
194 but instead should use the virtual terminal under which it was started. */ 195 but instead should use the virtual terminal under which it was started. */
195int inhibit_window_system; 196int inhibit_window_system;
196 197
197/* If nonzero, set Emacs to run at this priority. This is also used
198 in child_setup and sys_suspend to make sure subshells run at normal
199 priority; those functions have their own extern declaration. */
200EMACS_INT emacs_priority;
201
202/* If non-zero, a filter or a sentinel is running. Tested to save the match 198/* If non-zero, a filter or a sentinel is running. Tested to save the match
203 data on the first attempt to change it inside asynchronous code. */ 199 data on the first attempt to change it inside asynchronous code. */
204int running_asynch_code; 200int running_asynch_code;
@@ -829,13 +825,14 @@ main (int argc, char **argv)
829 printf ("see the file named COPYING.\n"); 825 printf ("see the file named COPYING.\n");
830 exit (0); 826 exit (0);
831 } 827 }
832 if (argmatch (argv, argc, "-chdir", "--chdir", 2, &ch_to_dir, &skip_args)) 828
833 if (chdir (ch_to_dir) == -1) 829 if (argmatch (argv, argc, "-chdir", "--chdir", 4, &ch_to_dir, &skip_args))
834 { 830 if (chdir (ch_to_dir) == -1)
835 fprintf (stderr, "%s: Can't chdir to %s: %s\n", 831 {
836 argv[0], ch_to_dir, strerror (errno)); 832 fprintf (stderr, "%s: Can't chdir to %s: %s\n",
837 exit (1); 833 argv[0], ch_to_dir, strerror (errno));
838 } 834 exit (1);
835 }
839 836
840 837
841#ifdef HAVE_PERSONALITY_LINUX32 838#ifdef HAVE_PERSONALITY_LINUX32
@@ -1508,9 +1505,7 @@ main (int argc, char **argv)
1508 syms_of_doc (); 1505 syms_of_doc ();
1509 syms_of_editfns (); 1506 syms_of_editfns ();
1510 syms_of_emacs (); 1507 syms_of_emacs ();
1511#ifdef CLASH_DETECTION
1512 syms_of_filelock (); 1508 syms_of_filelock ();
1513#endif /* CLASH_DETECTION */
1514 syms_of_indent (); 1509 syms_of_indent ();
1515 syms_of_insdel (); 1510 syms_of_insdel ();
1516 /* syms_of_keymap (); */ 1511 /* syms_of_keymap (); */
@@ -2053,10 +2048,8 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
2053#ifndef DOS_NT 2048#ifndef DOS_NT
2054 { 2049 {
2055 int pgrp = EMACS_GETPGRP (0); 2050 int pgrp = EMACS_GETPGRP (0);
2056 2051 int tpgrp = tcgetpgrp (0);
2057 int tpgrp; 2052 if ((tpgrp != -1) && tpgrp == pgrp)
2058 if (EMACS_GET_TTY_PGRP (0, &tpgrp) != -1
2059 && tpgrp == pgrp)
2060 { 2053 {
2061 reset_all_sys_modes (); 2054 reset_all_sys_modes ();
2062 if (sig && sig != SIGTERM) 2055 if (sig && sig != SIGTERM)
@@ -2412,9 +2405,10 @@ Special values:
2412 `ms-dos' compiled as an MS-DOS application. 2405 `ms-dos' compiled as an MS-DOS application.
2413 `windows-nt' compiled as a native W32 application. 2406 `windows-nt' compiled as a native W32 application.
2414 `cygwin' compiled using the Cygwin library. 2407 `cygwin' compiled using the Cygwin library.
2415Anything else (in Emacs 23.1, the possibilities are: aix, berkeley-unix, 2408Anything else (in Emacs 24.1, the possibilities are: aix, berkeley-unix,
2416hpux, irix, lynxos 3.0.1, usg-unix-v) indicates some sort of Unix system. */); 2409hpux, irix, usg-unix-v) indicates some sort of Unix system. */);
2417 Vsystem_type = intern_c_string (SYSTEM_TYPE); 2410 Vsystem_type = intern_c_string (SYSTEM_TYPE);
2411 /* Above values are from SYSTEM_TYPE in src/s/*.h. */
2418 2412
2419 DEFVAR_LISP ("system-configuration", &Vsystem_configuration, 2413 DEFVAR_LISP ("system-configuration", &Vsystem_configuration,
2420 doc: /* Value is string indicating configuration Emacs was built for. 2414 doc: /* Value is string indicating configuration Emacs was built for.
@@ -2440,15 +2434,6 @@ Before Emacs 24.1, the hook was not run in batch mode, i.e., if
2440`noninteractive' was non-nil. */); 2434`noninteractive' was non-nil. */);
2441 Vkill_emacs_hook = Qnil; 2435 Vkill_emacs_hook = Qnil;
2442 2436
2443 DEFVAR_INT ("emacs-priority", &emacs_priority,
2444 doc: /* Priority for Emacs to run at.
2445This value is effective only if set before Emacs is dumped,
2446and only if the Emacs executable is installed with setuid to permit
2447it to change priority. (Emacs sets its uid back to the real uid.)
2448Currently, you need to define SET_EMACS_PRIORITY in `config.h'
2449before you compile Emacs, to enable the code for this feature. */);
2450 emacs_priority = 0;
2451
2452 DEFVAR_LISP ("path-separator", &Vpath_separator, 2437 DEFVAR_LISP ("path-separator", &Vpath_separator,
2453 doc: /* String containing the character that separates directories in 2438 doc: /* String containing the character that separates directories in
2454search paths, such as PATH and other similar environment variables. */); 2439search paths, such as PATH and other similar environment variables. */);
@@ -2532,5 +2517,3 @@ libraries; only those already known by Emacs will be loaded. */);
2532 daemon_pipe[1] = 0; 2517 daemon_pipe[1] = 0;
2533} 2518}
2534 2519
2535/* arch-tag: 7bfd356a-c720-4612-8ab6-aa4222931c2e
2536 (do not change this comment) */
diff --git a/src/eval.c b/src/eval.c
index c07e7a37323..574c4ebf361 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -187,7 +187,7 @@ init_eval_once (void)
187 specpdl_ptr = specpdl; 187 specpdl_ptr = specpdl;
188 /* Don't forget to update docs (lispref node "Local Variables"). */ 188 /* Don't forget to update docs (lispref node "Local Variables"). */
189 max_specpdl_size = 1200; /* 1000 is not enough for CEDET's c-by.el. */ 189 max_specpdl_size = 1200; /* 1000 is not enough for CEDET's c-by.el. */
190 max_lisp_eval_depth = 500; 190 max_lisp_eval_depth = 600;
191 191
192 Vrun_hooks = Qnil; 192 Vrun_hooks = Qnil;
193} 193}
diff --git a/src/fileio.c b/src/fileio.c
index 36b6cc3ca8b..886e5ebc411 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5044,9 +5044,10 @@ e_write (int desc, Lisp_Object string, int start, int end, struct coding_system
5044} 5044}
5045 5045
5046DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime, 5046DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime,
5047 Sverify_visited_file_modtime, 1, 1, 0, 5047 Sverify_visited_file_modtime, 0, 1, 0,
5048 doc: /* Return t if last mod time of BUF's visited file matches what BUF records. 5048 doc: /* Return t if last mod time of BUF's visited file matches what BUF records.
5049This means that the file has not been changed since it was visited or saved. 5049This means that the file has not been changed since it was visited or saved.
5050If BUF is omitted or nil, it defaults to the current buffer.
5050See Info node `(elisp)Modification Time' for more details. */) 5051See Info node `(elisp)Modification Time' for more details. */)
5051 (Lisp_Object buf) 5052 (Lisp_Object buf)
5052{ 5053{
@@ -5055,8 +5056,13 @@ See Info node `(elisp)Modification Time' for more details. */)
5055 Lisp_Object handler; 5056 Lisp_Object handler;
5056 Lisp_Object filename; 5057 Lisp_Object filename;
5057 5058
5058 CHECK_BUFFER (buf); 5059 if (NILP (buf))
5059 b = XBUFFER (buf); 5060 b = current_buffer;
5061 else
5062 {
5063 CHECK_BUFFER (buf);
5064 b = XBUFFER (buf);
5065 }
5060 5066
5061 if (!STRINGP (b->filename)) return Qt; 5067 if (!STRINGP (b->filename)) return Qt;
5062 if (b->modtime == 0) return Qt; 5068 if (b->modtime == 0) return Qt;
@@ -5863,5 +5869,3 @@ This includes interactive calls to `delete-file' and
5863#endif 5869#endif
5864} 5870}
5865 5871
5866/* arch-tag: 64ba3fd7-f844-4fb2-ba4b-427eb928786c
5867 (do not change this comment) */
diff --git a/src/filelock.c b/src/filelock.c
index acca7234419..ae0584c447a 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -730,6 +730,8 @@ init_filelock (void)
730 boot_time_initialized = 0; 730 boot_time_initialized = 0;
731} 731}
732 732
733#endif /* CLASH_DETECTION */
734
733void 735void
734syms_of_filelock (void) 736syms_of_filelock (void)
735{ 737{
@@ -737,12 +739,12 @@ syms_of_filelock (void)
737 doc: /* The directory for writing temporary files. */); 739 doc: /* The directory for writing temporary files. */);
738 Vtemporary_file_directory = Qnil; 740 Vtemporary_file_directory = Qnil;
739 741
742#ifdef CLASH_DETECTION
740 defsubr (&Sunlock_buffer); 743 defsubr (&Sunlock_buffer);
741 defsubr (&Slock_buffer); 744 defsubr (&Slock_buffer);
742 defsubr (&Sfile_locked_p); 745 defsubr (&Sfile_locked_p);
746#endif
743} 747}
744 748
745#endif /* CLASH_DETECTION */
746
747/* arch-tag: e062676d-50b2-4be0-ab96-197c81b181a1 749/* arch-tag: e062676d-50b2-4be0-ab96-197c81b181a1
748 (do not change this comment) */ 750 (do not change this comment) */
diff --git a/src/font.c b/src/font.c
index aee6b483353..ae933df75c8 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1,8 +1,9 @@
1/* font.c -- "Font" primitives. 1/* font.c -- "Font" primitives.
2 Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 2
3 Copyright (C) 2006, 2007, 2008, 2009, 2010 3Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 National Institute of Advanced Industrial Science and Technology (AIST) 4Copyright (C) 2006, 2007, 2008, 2009, 2010
5 Registration Number H13PRO009 5 National Institute of Advanced Industrial Science and Technology (AIST)
6 Registration Number H13PRO009
6 7
7This file is part of GNU Emacs. 8This file is part of GNU Emacs.
8 9
@@ -3443,7 +3444,7 @@ font_load_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
3443 if (NILP (entity)) 3444 if (NILP (entity))
3444 return Qnil; 3445 return Qnil;
3445 } 3446 }
3446 /* Don't loose the original name that was put in initially. We need 3447 /* Don't lose the original name that was put in initially. We need
3447 it to re-apply the font when font parameters (like hinting or dpi) have 3448 it to re-apply the font when font parameters (like hinting or dpi) have
3448 changed. */ 3449 changed. */
3449 entity = font_open_for_lface (f, entity, attrs, spec); 3450 entity = font_open_for_lface (f, entity, attrs, spec);
@@ -3514,7 +3515,7 @@ font_open_by_name (FRAME_PTR f, const char *name)
3514 args[1] = make_unibyte_string (name, strlen (name)); 3515 args[1] = make_unibyte_string (name, strlen (name));
3515 spec = Ffont_spec (2, args); 3516 spec = Ffont_spec (2, args);
3516 ret = font_open_by_spec (f, spec); 3517 ret = font_open_by_spec (f, spec);
3517 /* Do not loose name originally put in. */ 3518 /* Do not lose name originally put in. */
3518 if (!NILP (ret)) 3519 if (!NILP (ret))
3519 font_put_extra (ret, QCuser_spec, args[1]); 3520 font_put_extra (ret, QCuser_spec, args[1]);
3520 3521
@@ -3731,8 +3732,8 @@ font_get_frame_data (FRAME_PTR f, struct font_driver *driver)
3731void 3732void
3732font_filter_properties (Lisp_Object font, 3733font_filter_properties (Lisp_Object font,
3733 Lisp_Object alist, 3734 Lisp_Object alist,
3734 const char *boolean_properties[], 3735 const char *const boolean_properties[],
3735 const char *non_boolean_properties[]) 3736 const char *const non_boolean_properties[])
3736{ 3737{
3737 Lisp_Object it; 3738 Lisp_Object it;
3738 int i; 3739 int i;
@@ -5399,5 +5400,3 @@ init_font (void)
5399 Vfont_log = egetenv ("EMACS_FONT_LOG") ? Qnil : Qt; 5400 Vfont_log = egetenv ("EMACS_FONT_LOG") ? Qnil : Qt;
5400} 5401}
5401 5402
5402/* arch-tag: 74c9475d-5976-4c93-a327-942ae3072846
5403 (do not change this comment) */
diff --git a/src/font.h b/src/font.h
index b2d7e49fa29..940eb3d001d 100644
--- a/src/font.h
+++ b/src/font.h
@@ -823,8 +823,8 @@ extern void *font_get_frame_data (FRAME_PTR f,
823 823
824extern void font_filter_properties (Lisp_Object font, 824extern void font_filter_properties (Lisp_Object font,
825 Lisp_Object alist, 825 Lisp_Object alist,
826 const char *boolean_properties[], 826 const char *const boolean_properties[],
827 const char *non_boolean_properties[]); 827 const char *const non_boolean_properties[]);
828 828
829#ifdef HAVE_FREETYPE 829#ifdef HAVE_FREETYPE
830extern struct font_driver ftfont_driver; 830extern struct font_driver ftfont_driver;
diff --git a/src/frame.c b/src/frame.c
index 04cc1ca07da..6cf46f1a0ba 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1,6 +1,8 @@
1/* Generic frame functions. 1/* Generic frame functions.
2 Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2
3 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003,
4 2004, 2005, 2006, 2007, 2008, 2009, 2010
5 Free Software Foundation, Inc.
4 6
5This file is part of GNU Emacs. 7This file is part of GNU Emacs.
6 8
@@ -201,11 +203,12 @@ Lisp_Object Vframe_list;
201 203
202DEFUN ("framep", Fframep, Sframep, 1, 1, 0, 204DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
203 doc: /* Return non-nil if OBJECT is a frame. 205 doc: /* Return non-nil if OBJECT is a frame.
204Value is t for a termcap frame (a character-only terminal), 206Value is:
205`x' for an Emacs frame that is really an X window, 207 t for a termcap frame (a character-only terminal),
206`w32' for an Emacs frame that is a window on MS-Windows display, 208 'x' for an Emacs frame that is really an X window,
207`ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, 209 'w32' for an Emacs frame that is a window on MS-Windows display,
208`pc' for a direct-write MS-DOS frame. 210 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display,
211 'pc' for a direct-write MS-DOS frame.
209See also `frame-live-p'. */) 212See also `frame-live-p'. */)
210 (Lisp_Object object) 213 (Lisp_Object object)
211{ 214{
@@ -247,10 +250,18 @@ return values. */)
247 250
248DEFUN ("window-system", Fwindow_system, Swindow_system, 0, 1, 0, 251DEFUN ("window-system", Fwindow_system, Swindow_system, 0, 1, 0,
249 doc: /* The name of the window system that FRAME is displaying through. 252 doc: /* The name of the window system that FRAME is displaying through.
250The value is a symbol---for instance, 'x' for X windows. 253The value is a symbol:
251The value is nil if Emacs is using a text-only terminal. 254 nil for a termcap frame (a character-only terminal),
252 255 'x' for an Emacs frame that is really an X window,
253FRAME defaults to the currently selected frame. */) 256 'w32' for an Emacs frame that is a window on MS-Windows display,
257 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display,
258 'pc' for a direct-write MS-DOS frame.
259
260FRAME defaults to the currently selected frame.
261
262Use of this function as a predicate is deprecated. Instead,
263use `display-graphic-p' or any of the other `display-*-p'
264predicates which report frame's specific UI-related capabilities. */)
254 (Lisp_Object frame) 265 (Lisp_Object frame)
255{ 266{
256 Lisp_Object type; 267 Lisp_Object type;
@@ -3300,7 +3311,7 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
3300void 3311void
3301x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 3312x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3302{ 3313{
3303 Lisp_Object frame, font_object, font_param = Qnil; 3314 Lisp_Object font_object, font_param = Qnil;
3304 int fontset = -1; 3315 int fontset = -1;
3305 3316
3306 /* Set the frame parameter back to the old value because we may 3317 /* Set the frame parameter back to the old value because we may
@@ -4314,6 +4325,20 @@ frame_make_pointer_visible (void)
4314 } 4325 }
4315} 4326}
4316 4327
4328DEFUN ("frame-pointer-visible-p", Fframe_pointer_visible_p,
4329 Sframe_pointer_visible_p, 0, 1, 0,
4330 doc: /* Return t if the mouse pointer displayed on FRAME is visible.
4331Otherwise it returns nil. FRAME omitted or nil means the
4332selected frame. This is useful when `make-pointer-invisible' is set. */)
4333 (Lisp_Object frame)
4334{
4335 if (NILP (frame))
4336 frame = selected_frame;
4337
4338 CHECK_FRAME (frame);
4339
4340 return (XFRAME (frame)->pointer_invisible ? Qnil : Qt);
4341}
4317 4342
4318 4343
4319/*********************************************************************** 4344/***********************************************************************
@@ -4538,12 +4563,24 @@ recursively). */);
4538 staticpro (&Qdelete_frame_functions); 4563 staticpro (&Qdelete_frame_functions);
4539 4564
4540 DEFVAR_LISP ("menu-bar-mode", &Vmenu_bar_mode, 4565 DEFVAR_LISP ("menu-bar-mode", &Vmenu_bar_mode,
4541 doc: /* Non-nil if Menu-Bar mode is enabled. */); 4566 doc: /* Non-nil if Menu-Bar mode is enabled.
4567See the command `menu-bar-mode' for a description of this minor mode.
4568Setting this variable directly does not take effect;
4569either customize it (see the info node `Easy Customization')
4570or call the function `menu-bar-mode'. */);
4542 Vmenu_bar_mode = Qt; 4571 Vmenu_bar_mode = Qt;
4543 4572
4544 DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode, 4573 DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode,
4545 doc: /* Non-nil if Tool-Bar mode is enabled. */); 4574 doc: /* Non-nil if Tool-Bar mode is enabled.
4575See the command `tool-bar-mode' for a description of this minor mode.
4576Setting this variable directly does not take effect;
4577either customize it (see the info node `Easy Customization')
4578or call the function `tool-bar-mode'. */);
4579#ifdef HAVE_WINDOW_SYSTEM
4546 Vtool_bar_mode = Qt; 4580 Vtool_bar_mode = Qt;
4581#else
4582 Vtool_bar_mode = Qnil;
4583#endif
4547 4584
4548 DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame, 4585 DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame,
4549 doc: /* Minibufferless frames use this frame's minibuffer. 4586 doc: /* Minibufferless frames use this frame's minibuffer.
@@ -4623,6 +4660,7 @@ automatically. See also `mouse-autoselect-window'. */);
4623 defsubr (&Sset_frame_width); 4660 defsubr (&Sset_frame_width);
4624 defsubr (&Sset_frame_size); 4661 defsubr (&Sset_frame_size);
4625 defsubr (&Sset_frame_position); 4662 defsubr (&Sset_frame_position);
4663 defsubr (&Sframe_pointer_visible_p);
4626 4664
4627#ifdef HAVE_WINDOW_SYSTEM 4665#ifdef HAVE_WINDOW_SYSTEM
4628 defsubr (&Sx_get_resource); 4666 defsubr (&Sx_get_resource);
@@ -4631,5 +4669,3 @@ automatically. See also `mouse-autoselect-window'. */);
4631 4669
4632} 4670}
4633 4671
4634/* arch-tag: 7dbf2c69-9aad-45f8-8296-db893d6dd039
4635 (do not change this comment) */
diff --git a/src/frame.h b/src/frame.h
index e66fd9341c7..31f601737c8 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -544,6 +544,20 @@ typedef struct frame *FRAME_PTR;
544#define FRAME_WINDOW_P(f) (0) 544#define FRAME_WINDOW_P(f) (0)
545#endif 545#endif
546 546
547/* Return a pointer to the structure holding information about the
548 region of text, if any, that is currently shown in mouse-face on
549 frame F. We need to define two versions because a TTY-only build
550 does not have FRAME_X_DISPLAY_INFO. */
551#ifdef HAVE_WINDOW_SYSTEM
552# define MOUSE_HL_INFO(F) \
553 (FRAME_WINDOW_P(F) \
554 ? &(FRAME_X_DISPLAY_INFO(F)->mouse_highlight) \
555 : &(((F)->output_data.tty->display_info)->mouse_highlight))
556#else
557# define MOUSE_HL_INFO(F) \
558 (&(((F)->output_data.tty->display_info)->mouse_highlight))
559#endif
560
547/* Nonzero if frame F is still alive (not deleted). */ 561/* Nonzero if frame F is still alive (not deleted). */
548#define FRAME_LIVE_P(f) ((f)->terminal != 0) 562#define FRAME_LIVE_P(f) ((f)->terminal != 0)
549 563
diff --git a/src/ftfont.c b/src/ftfont.c
index b0d10791379..d9ae9be0905 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -2598,7 +2598,7 @@ ftfont_font_format (FcPattern *pattern, Lisp_Object filename)
2598 return intern ("unknown"); 2598 return intern ("unknown");
2599} 2599}
2600 2600
2601static const char *ftfont_booleans [] = { 2601static const char *const ftfont_booleans [] = {
2602 ":antialias", 2602 ":antialias",
2603 ":hinting", 2603 ":hinting",
2604 ":verticallayout", 2604 ":verticallayout",
@@ -2611,7 +2611,7 @@ static const char *ftfont_booleans [] = {
2611 NULL, 2611 NULL,
2612}; 2612};
2613 2613
2614static const char *ftfont_non_booleans [] = { 2614static const char *const ftfont_non_booleans [] = {
2615 ":family", 2615 ":family",
2616 ":familylang", 2616 ":familylang",
2617 ":style", 2617 ":style",
diff --git a/src/gnutls.c b/src/gnutls.c
index 577cca247ee..1cc258a5096 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -125,8 +125,13 @@ emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf,
125 rtnval = gnutls_read (state, buf, nbyte); 125 rtnval = gnutls_read (state, buf, nbyte);
126 if (rtnval >= 0) 126 if (rtnval >= 0)
127 return rtnval; 127 return rtnval;
128 else 128 else {
129 return -1; 129 if (rtnval == GNUTLS_E_AGAIN ||
130 rtnval == GNUTLS_E_INTERRUPTED)
131 return -1;
132 else
133 return 0;
134 }
130} 135}
131 136
132/* convert an integer error to a Lisp_Object; it will be either a 137/* convert an integer error to a Lisp_Object; it will be either a
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 3b7e6888753..6fd4b969819 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -559,7 +559,7 @@ hierarchy_ch_cb (GtkWidget *widget,
559 FRAME_PTR f = (FRAME_PTR) user_data; 559 FRAME_PTR f = (FRAME_PTR) user_data;
560 struct x_output *x = f->output_data.x; 560 struct x_output *x = f->output_data.x;
561 GtkWidget *top = gtk_widget_get_toplevel (x->ttip_lbl); 561 GtkWidget *top = gtk_widget_get_toplevel (x->ttip_lbl);
562 562
563 if (! top || ! GTK_IS_WINDOW (top)) 563 if (! top || ! GTK_IS_WINDOW (top))
564 gtk_widget_hide (previous_toplevel); 564 gtk_widget_hide (previous_toplevel);
565} 565}
@@ -580,7 +580,7 @@ qttip_cb (GtkWidget *widget,
580{ 580{
581 FRAME_PTR f = (FRAME_PTR) user_data; 581 FRAME_PTR f = (FRAME_PTR) user_data;
582 struct x_output *x = f->output_data.x; 582 struct x_output *x = f->output_data.x;
583 if (x->ttip_widget == NULL) 583 if (x->ttip_widget == NULL)
584 { 584 {
585 g_object_set (G_OBJECT (widget), "has-tooltip", FALSE, NULL); 585 g_object_set (G_OBJECT (widget), "has-tooltip", FALSE, NULL);
586 x->ttip_widget = tooltip; 586 x->ttip_widget = tooltip;
@@ -589,6 +589,8 @@ qttip_cb (GtkWidget *widget,
589 g_object_ref (G_OBJECT (x->ttip_lbl)); 589 g_object_ref (G_OBJECT (x->ttip_lbl));
590 gtk_tooltip_set_custom (tooltip, x->ttip_lbl); 590 gtk_tooltip_set_custom (tooltip, x->ttip_lbl);
591 x->ttip_window = GTK_WINDOW (gtk_widget_get_toplevel (x->ttip_lbl)); 591 x->ttip_window = GTK_WINDOW (gtk_widget_get_toplevel (x->ttip_lbl));
592 /* ATK needs an empty title for some reason. */
593 gtk_window_set_title (x->ttip_window, "");
592 /* Realize so we can safely get screen later on. */ 594 /* Realize so we can safely get screen later on. */
593 gtk_widget_realize (GTK_WIDGET (x->ttip_window)); 595 gtk_widget_realize (GTK_WIDGET (x->ttip_window));
594 gtk_widget_realize (x->ttip_lbl); 596 gtk_widget_realize (x->ttip_lbl);
@@ -631,14 +633,14 @@ xg_prepare_tooltip (FRAME_PTR f,
631 screen = gdk_drawable_get_screen (gwin); 633 screen = gdk_drawable_get_screen (gwin);
632 settings = gtk_settings_get_for_screen (screen); 634 settings = gtk_settings_get_for_screen (screen);
633 g_object_get (settings, "gtk-enable-tooltips", &tt_enabled, NULL); 635 g_object_get (settings, "gtk-enable-tooltips", &tt_enabled, NULL);
634 if (tt_enabled) 636 if (tt_enabled)
635 { 637 {
636 g_object_set (settings, "gtk-enable-tooltips", FALSE, NULL); 638 g_object_set (settings, "gtk-enable-tooltips", FALSE, NULL);
637 /* Record that we disabled it so it can be enabled again. */ 639 /* Record that we disabled it so it can be enabled again. */
638 g_object_set_data (G_OBJECT (x->ttip_window), "restore-tt", 640 g_object_set_data (G_OBJECT (x->ttip_window), "restore-tt",
639 (gpointer)f); 641 (gpointer)f);
640 } 642 }
641 643
642 /* Prevent Gtk+ from hiding tooltip on mouse move and such. */ 644 /* Prevent Gtk+ from hiding tooltip on mouse move and such. */
643 g_object_set_data (G_OBJECT 645 g_object_set_data (G_OBJECT
644 (gtk_widget_get_display (GTK_WIDGET (x->ttip_window))), 646 (gtk_widget_get_display (GTK_WIDGET (x->ttip_window))),
@@ -652,7 +654,7 @@ xg_prepare_tooltip (FRAME_PTR f,
652 gtk_widget_size_request (GTK_WIDGET (x->ttip_window), &req); 654 gtk_widget_size_request (GTK_WIDGET (x->ttip_window), &req);
653 if (width) *width = req.width; 655 if (width) *width = req.width;
654 if (height) *height = req.height; 656 if (height) *height = req.height;
655 657
656 UNBLOCK_INPUT; 658 UNBLOCK_INPUT;
657 659
658 return 1; 660 return 1;
@@ -799,7 +801,7 @@ xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight)
799 &pixelwidth, &pixelheight, 0); 801 &pixelwidth, &pixelheight, 0);
800 else return; 802 else return;
801 } 803 }
802 804
803 805
804 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight); 806 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight);
805 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth); 807 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth);
@@ -1073,7 +1075,7 @@ xg_create_frame_widgets (FRAME_PTR f)
1073 f->output_data.x->ttip_widget = 0; 1075 f->output_data.x->ttip_widget = 0;
1074 f->output_data.x->ttip_lbl = 0; 1076 f->output_data.x->ttip_lbl = 0;
1075 f->output_data.x->ttip_window = 0; 1077 f->output_data.x->ttip_window = 0;
1076 gtk_widget_set_tooltip_text (wtop, "Dummy text"); 1078 gtk_widget_set_tooltip_text (wtop, "Dummy text");
1077 g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f); 1079 g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f);
1078#endif 1080#endif
1079 1081
@@ -1452,7 +1454,7 @@ pop_down_dialog (Lisp_Object arg)
1452 1454
1453 g_main_loop_quit (dd->loop); 1455 g_main_loop_quit (dd->loop);
1454 g_main_loop_unref (dd->loop); 1456 g_main_loop_unref (dd->loop);
1455 1457
1456 UNBLOCK_INPUT; 1458 UNBLOCK_INPUT;
1457 1459
1458 return Qnil; 1460 return Qnil;
@@ -1480,7 +1482,7 @@ xg_maybe_add_timer (gpointer data)
1480 return FALSE; 1482 return FALSE;
1481} 1483}
1482 1484
1483 1485
1484/* Pops up a modal dialog W and waits for response. 1486/* Pops up a modal dialog W and waits for response.
1485 We don't use gtk_dialog_run because we want to process emacs timers. 1487 We don't use gtk_dialog_run because we want to process emacs timers.
1486 The dialog W is not destroyed when this function returns. */ 1488 The dialog W is not destroyed when this function returns. */
@@ -1514,7 +1516,7 @@ xg_dialog_run (FRAME_PTR f, GtkWidget *w)
1514 1516
1515 (void) xg_maybe_add_timer (&dd); 1517 (void) xg_maybe_add_timer (&dd);
1516 g_main_loop_run (dd.loop); 1518 g_main_loop_run (dd.loop);
1517 1519
1518 dd.w = 0; 1520 dd.w = 0;
1519 unbind_to (count, Qnil); 1521 unbind_to (count, Qnil);
1520 1522
@@ -3072,6 +3074,23 @@ xg_modify_menubar_widgets (GtkWidget *menubar, FRAME_PTR f, widget_value *val,
3072 gtk_widget_show_all (menubar); 3074 gtk_widget_show_all (menubar);
3073} 3075}
3074 3076
3077/* Callback called when the menu bar W is mapped.
3078 Used to find the height of the menu bar if we didn't get it
3079 after showing the widget. */
3080
3081static void
3082menubar_map_cb (GtkWidget *w, gpointer user_data)
3083{
3084 GtkRequisition req;
3085 FRAME_PTR f = (FRAME_PTR) user_data;
3086 gtk_widget_size_request (w, &req);
3087 if (FRAME_MENUBAR_HEIGHT (f) != req.height)
3088 {
3089 FRAME_MENUBAR_HEIGHT (f) = req.height;
3090 xg_height_or_width_changed (f);
3091 }
3092}
3093
3075/* Recompute all the widgets of frame F, when the menu bar has been 3094/* Recompute all the widgets of frame F, when the menu bar has been
3076 changed. Value is non-zero if widgets were updated. */ 3095 changed. Value is non-zero if widgets were updated. */
3077 3096
@@ -3093,10 +3112,20 @@ xg_update_frame_menubar (FRAME_PTR f)
3093 FALSE, FALSE, 0); 3112 FALSE, FALSE, 0);
3094 gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->menubar_widget, 0); 3113 gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->menubar_widget, 0);
3095 3114
3115 g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f);
3096 gtk_widget_show_all (x->menubar_widget); 3116 gtk_widget_show_all (x->menubar_widget);
3097 gtk_widget_size_request (x->menubar_widget, &req); 3117 gtk_widget_size_request (x->menubar_widget, &req);
3098 FRAME_MENUBAR_HEIGHT (f) = req.height; 3118
3099 xg_height_or_width_changed (f); 3119 /* If menu bar doesn't know its height yet, cheat a little so the frame
3120 doesn't jump so much when resized later in menubar_map_cb. */
3121 if (req.height == 0)
3122 req.height = 23;
3123
3124 if (FRAME_MENUBAR_HEIGHT (f) != req.height)
3125 {
3126 FRAME_MENUBAR_HEIGHT (f) = req.height;
3127 xg_height_or_width_changed (f);
3128 }
3100 UNBLOCK_INPUT; 3129 UNBLOCK_INPUT;
3101 3130
3102 return 1; 3131 return 1;
@@ -3339,7 +3368,7 @@ xg_create_scroll_bar (FRAME_PTR f,
3339 "button-release-event", 3368 "button-release-event",
3340 end_callback, 3369 end_callback,
3341 (gpointer) bar); 3370 (gpointer) bar);
3342 3371
3343 /* The scroll bar widget does not draw on a window of its own. Instead 3372 /* The scroll bar widget does not draw on a window of its own. Instead
3344 it draws on the parent window, in this case the edit widget. So 3373 it draws on the parent window, in this case the edit widget. So
3345 whenever the edit widget is cleared, the scroll bar needs to redraw 3374 whenever the edit widget is cleared, the scroll bar needs to redraw
@@ -3428,11 +3457,11 @@ xg_update_scrollbar_pos (FRAME_PTR f,
3428 FRAME_X_WINDOW (f), 3457 FRAME_X_WINDOW (f),
3429 oldx, oldy, oldw, oldh, 0); 3458 oldx, oldy, oldw, oldh, 0);
3430 } 3459 }
3431 3460
3432 /* GTK does not redraw until the main loop is entered again, but 3461 /* GTK does not redraw until the main loop is entered again, but
3433 if there are no X events pending we will not enter it. So we sync 3462 if there are no X events pending we will not enter it. So we sync
3434 here to get some events. */ 3463 here to get some events. */
3435 3464
3436 x_sync (f); 3465 x_sync (f);
3437 SET_FRAME_GARBAGED (f); 3466 SET_FRAME_GARBAGED (f);
3438 cancel_mouse_face (f); 3467 cancel_mouse_face (f);
@@ -3547,7 +3576,7 @@ xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event)
3547 GtkWidget *w = gtk_grab_get_current (); 3576 GtkWidget *w = gtk_grab_get_current ();
3548 retval = w != 0 && GTK_IS_SCROLLBAR (w); 3577 retval = w != 0 && GTK_IS_SCROLLBAR (w);
3549 } 3578 }
3550 3579
3551 return retval; 3580 return retval;
3552} 3581}
3553 3582
@@ -3635,7 +3664,7 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data)
3635 this is written. */ 3664 this is written. */
3636 event.modifiers = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), mod); 3665 event.modifiers = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), mod);
3637 kbd_buffer_store_event (&event); 3666 kbd_buffer_store_event (&event);
3638 3667
3639 /* Return focus to the frame after we have clicked on a detached 3668 /* Return focus to the frame after we have clicked on a detached
3640 tool bar button. */ 3669 tool bar button. */
3641 Fx_focus_frame (frame); 3670 Fx_focus_frame (frame);
@@ -3672,7 +3701,7 @@ xg_tool_bar_proxy_help_callback (GtkWidget *w,
3672{ 3701{
3673 GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w), 3702 GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w),
3674 XG_TOOL_BAR_PROXY_BUTTON)); 3703 XG_TOOL_BAR_PROXY_BUTTON));
3675 3704
3676 return xg_tool_bar_help_callback (wbutton, event, client_data); 3705 return xg_tool_bar_help_callback (wbutton, event, client_data);
3677} 3706}
3678 3707
@@ -3775,7 +3804,7 @@ xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data)
3775 G_CALLBACK (xg_tool_bar_proxy_callback), 3804 G_CALLBACK (xg_tool_bar_proxy_callback),
3776 user_data); 3805 user_data);
3777 3806
3778 3807
3779 g_object_set_data (G_OBJECT (wmenuitem), XG_TOOL_BAR_PROXY_BUTTON, 3808 g_object_set_data (G_OBJECT (wmenuitem), XG_TOOL_BAR_PROXY_BUTTON,
3780 (gpointer) wbutton); 3809 (gpointer) wbutton);
3781 gtk_tool_item_set_proxy_menu_item (toolitem, "Emacs toolbar item", wmenuitem); 3810 gtk_tool_item_set_proxy_menu_item (toolitem, "Emacs toolbar item", wmenuitem);
@@ -3973,7 +4002,7 @@ xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos)
3973 x->toolbar_widget); 4002 x->toolbar_widget);
3974 } 4003 }
3975 4004
3976 if (into_hbox) 4005 if (into_hbox)
3977 { 4006 {
3978 gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), 4007 gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget),
3979 GTK_POS_TOP); 4008 GTK_POS_TOP);
@@ -4057,18 +4086,23 @@ xg_make_tool_item (FRAME_PTR f,
4057 GtkWidget *wimage, 4086 GtkWidget *wimage,
4058 GtkWidget **wbutton, 4087 GtkWidget **wbutton,
4059 const char *label, 4088 const char *label,
4060 int i) 4089 int i,
4090 int vert_only)
4061{ 4091{
4062 GtkToolItem *ti = gtk_tool_item_new (); 4092 GtkToolItem *ti = gtk_tool_item_new ();
4063 Lisp_Object style = Ftool_bar_get_system_style (); 4093 Lisp_Object style = Ftool_bar_get_system_style ();
4064 int both_horiz = EQ (style, Qboth_horiz); 4094 int both_horiz = EQ (style, Qboth_horiz);
4065 int text_image = EQ (style, Qtext_image_horiz); 4095 int text_image = EQ (style, Qtext_image_horiz);
4066 4096
4067 GtkWidget *vb = both_horiz || text_image 4097 GtkWidget *vb = both_horiz || text_image
4068 ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0); 4098 ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0);
4069 GtkWidget *wb = gtk_button_new (); 4099 GtkWidget *wb = gtk_button_new ();
4070 GtkWidget *weventbox = gtk_event_box_new (); 4100 GtkWidget *weventbox = gtk_event_box_new ();
4071 4101
4102 /* We are not letting Gtk+ alter display on this, we only keep it here
4103 so we can get it later in xg_show_toolbar_item. */
4104 gtk_tool_item_set_is_important (ti, !vert_only);
4105
4072 if (wimage && ! text_image) 4106 if (wimage && ! text_image)
4073 gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0); 4107 gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
4074 4108
@@ -4113,7 +4147,7 @@ xg_make_tool_item (FRAME_PTR f,
4113 NULL); 4147 NULL);
4114 4148
4115 g_object_set_data (G_OBJECT (wb), XG_FRAME_DATA, (gpointer)f); 4149 g_object_set_data (G_OBJECT (wb), XG_FRAME_DATA, (gpointer)f);
4116 4150
4117 /* Use enter/leave notify to show help. We use the events 4151 /* Use enter/leave notify to show help. We use the events
4118 rather than the GtkButton specific signals "enter" and 4152 rather than the GtkButton specific signals "enter" and
4119 "leave", so we can have only one callback. The event 4153 "leave", so we can have only one callback. The event
@@ -4128,7 +4162,7 @@ xg_make_tool_item (FRAME_PTR f,
4128 G_CALLBACK (xg_tool_bar_help_callback), 4162 G_CALLBACK (xg_tool_bar_help_callback),
4129 (gpointer) (EMACS_INT) i); 4163 (gpointer) (EMACS_INT) i);
4130 } 4164 }
4131 4165
4132 if (wbutton) *wbutton = wb; 4166 if (wbutton) *wbutton = wb;
4133 4167
4134 return ti; 4168 return ti;
@@ -4142,7 +4176,8 @@ xg_show_toolbar_item (GtkToolItem *ti)
4142 int text_image = EQ (style, Qtext_image_horiz); 4176 int text_image = EQ (style, Qtext_image_horiz);
4143 4177
4144 int horiz = both_horiz || text_image; 4178 int horiz = both_horiz || text_image;
4145 int show_label = ! EQ (style, Qimage); 4179 int vert_only = ! gtk_tool_item_get_is_important (ti);
4180 int show_label = ! EQ (style, Qimage) && ! (vert_only && horiz);
4146 int show_image = ! EQ (style, Qtext); 4181 int show_image = ! EQ (style, Qtext);
4147 4182
4148 GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti)); 4183 GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti));
@@ -4213,7 +4248,7 @@ xg_update_tool_bar_sizes (FRAME_PTR f)
4213 if (pos == 0 || (pos == 1 && x->menubar_widget)) nt = req.height; 4248 if (pos == 0 || (pos == 1 && x->menubar_widget)) nt = req.height;
4214 else nb = req.height; 4249 else nb = req.height;
4215 } 4250 }
4216 4251
4217 if (nl != FRAME_TOOLBAR_LEFT_WIDTH (f) 4252 if (nl != FRAME_TOOLBAR_LEFT_WIDTH (f)
4218 || nr != FRAME_TOOLBAR_RIGHT_WIDTH (f) 4253 || nr != FRAME_TOOLBAR_RIGHT_WIDTH (f)
4219 || nt != FRAME_TOOLBAR_TOP_HEIGHT (f) 4254 || nt != FRAME_TOOLBAR_TOP_HEIGHT (f)
@@ -4279,7 +4314,7 @@ update_frame_tool_bar (FRAME_PTR f)
4279 4314
4280 wtoolbar = GTK_TOOLBAR (x->toolbar_widget); 4315 wtoolbar = GTK_TOOLBAR (x->toolbar_widget);
4281 dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar)); 4316 dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar));
4282 4317
4283 for (i = 0; i < f->n_tool_bar_items; ++i) 4318 for (i = 0; i < f->n_tool_bar_items; ++i)
4284 { 4319 {
4285 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); 4320 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
@@ -4299,7 +4334,8 @@ update_frame_tool_bar (FRAME_PTR f)
4299 Lisp_Object specified_file; 4334 Lisp_Object specified_file;
4300 const char *label = (STRINGP (PROP (TOOL_BAR_ITEM_LABEL)) 4335 const char *label = (STRINGP (PROP (TOOL_BAR_ITEM_LABEL))
4301 ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL)) : ""); 4336 ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL)) : "");
4302 4337 int vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY));
4338
4303 ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i); 4339 ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i);
4304 4340
4305 if (ti) 4341 if (ti)
@@ -4389,7 +4425,7 @@ update_frame_tool_bar (FRAME_PTR f)
4389 else 4425 else
4390 { 4426 {
4391 /* Insert an empty (non-image) button */ 4427 /* Insert an empty (non-image) button */
4392 ti = xg_make_tool_item (f, NULL, NULL, "", i); 4428 ti = xg_make_tool_item (f, NULL, NULL, "", i, 0);
4393 gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1); 4429 gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1);
4394 } 4430 }
4395 continue; 4431 continue;
@@ -4423,7 +4459,7 @@ update_frame_tool_bar (FRAME_PTR f)
4423 } 4459 }
4424 4460
4425 gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); 4461 gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
4426 ti = xg_make_tool_item (f, w, &wbutton, label, i); 4462 ti = xg_make_tool_item (f, w, &wbutton, label, i, vert_only);
4427 gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1); 4463 gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1);
4428 gtk_widget_set_sensitive (wbutton, enabled_p); 4464 gtk_widget_set_sensitive (wbutton, enabled_p);
4429 } 4465 }
@@ -4440,6 +4476,7 @@ update_frame_tool_bar (FRAME_PTR f)
4440 gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage), 4476 gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage),
4441 XG_TOOL_BAR_ICON_NAME); 4477 XG_TOOL_BAR_ICON_NAME);
4442 gtk_label_set_text (GTK_LABEL (wlbl), label); 4478 gtk_label_set_text (GTK_LABEL (wlbl), label);
4479 gtk_tool_item_set_is_important (ti, !vert_only);
4443 if (stock_name && 4480 if (stock_name &&
4444 (! old_stock_name || strcmp (old_stock_name, stock_name) != 0)) 4481 (! old_stock_name || strcmp (old_stock_name, stock_name) != 0))
4445 { 4482 {
@@ -4523,7 +4560,7 @@ free_frame_tool_bar (FRAME_PTR f)
4523 BLOCK_INPUT; 4560 BLOCK_INPUT;
4524 /* We may have created the toolbar_widget in xg_create_tool_bar, but 4561 /* We may have created the toolbar_widget in xg_create_tool_bar, but
4525 not the x->handlebox_widget which is created in xg_pack_tool_bar. */ 4562 not the x->handlebox_widget which is created in xg_pack_tool_bar. */
4526 if (is_packed) 4563 if (is_packed)
4527 { 4564 {
4528 if (x->toolbar_in_hbox) 4565 if (x->toolbar_in_hbox)
4529 gtk_container_remove (GTK_CONTAINER (x->hbox_widget), 4566 gtk_container_remove (GTK_CONTAINER (x->hbox_widget),
diff --git a/src/image.c b/src/image.c
index 4cdd7f2bbab..e16b63ae0f4 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1049,10 +1049,6 @@ free_image (struct frame *f, struct image *img)
1049 /* Free resources, then free IMG. */ 1049 /* Free resources, then free IMG. */
1050 img->type->free (f, img); 1050 img->type->free (f, img);
1051 xfree (img); 1051 xfree (img);
1052
1053 /* As display glyphs may still be referring to the image ID, we
1054 must garbage the frame (Bug#6426). */
1055 SET_FRAME_GARBAGED (f);
1056 } 1052 }
1057} 1053}
1058 1054
@@ -1471,7 +1467,12 @@ uncache_image (struct frame *f, Lisp_Object spec)
1471{ 1467{
1472 struct image *img = search_image_cache (f, spec, sxhash (spec, 0)); 1468 struct image *img = search_image_cache (f, spec, sxhash (spec, 0));
1473 if (img) 1469 if (img)
1474 free_image (f, img); 1470 {
1471 free_image (f, img);
1472 /* As display glyphs may still be referring to the image ID, we
1473 must garbage the frame (Bug#6426). */
1474 SET_FRAME_GARBAGED (f);
1475 }
1475} 1476}
1476 1477
1477 1478
@@ -7096,12 +7097,15 @@ gif_read_from_memory (GifFileType *file, GifByteType *buf, int len)
7096static const int interlace_start[] = {0, 4, 2, 1}; 7097static const int interlace_start[] = {0, 4, 2, 1};
7097static const int interlace_increment[] = {8, 8, 4, 2}; 7098static const int interlace_increment[] = {8, 8, 4, 2};
7098 7099
7100#define GIF_LOCAL_DESCRIPTOR_EXTENSION 249
7101
7099static int 7102static int
7100gif_load (struct frame *f, struct image *img) 7103gif_load (struct frame *f, struct image *img)
7101{ 7104{
7102 Lisp_Object file, specified_file; 7105 Lisp_Object file, specified_file;
7103 Lisp_Object specified_data; 7106 Lisp_Object specified_data;
7104 int rc, width, height, x, y, i; 7107 int rc, width, height, x, y, i;
7108 boolean transparent_p;
7105 XImagePtr ximg; 7109 XImagePtr ximg;
7106 ColorMapObject *gif_color_map; 7110 ColorMapObject *gif_color_map;
7107 unsigned long pixel_colors[256]; 7111 unsigned long pixel_colors[256];
@@ -7110,6 +7114,7 @@ gif_load (struct frame *f, struct image *img)
7110 int ino, image_height, image_width; 7114 int ino, image_height, image_width;
7111 gif_memory_source memsrc; 7115 gif_memory_source memsrc;
7112 unsigned char *raster; 7116 unsigned char *raster;
7117 unsigned int transparency_color_index;
7113 7118
7114 specified_file = image_spec_value (img->spec, QCfile, NULL); 7119 specified_file = image_spec_value (img->spec, QCfile, NULL);
7115 specified_data = image_spec_value (img->spec, QCdata, NULL); 7120 specified_data = image_spec_value (img->spec, QCdata, NULL);
@@ -7182,6 +7187,18 @@ gif_load (struct frame *f, struct image *img)
7182 return 0; 7187 return 0;
7183 } 7188 }
7184 7189
7190 for (i = 0; i < gif->SavedImages[ino].ExtensionBlockCount; i++)
7191 if ((gif->SavedImages[ino].ExtensionBlocks[i].Function
7192 == GIF_LOCAL_DESCRIPTOR_EXTENSION)
7193 && gif->SavedImages[ino].ExtensionBlocks[i].ByteCount == 4
7194 /* Transparency enabled? */
7195 && gif->SavedImages[ino].ExtensionBlocks[i].Bytes[0] & 1)
7196 {
7197 transparent_p = 1;
7198 transparency_color_index
7199 = (unsigned char) gif->SavedImages[ino].ExtensionBlocks[i].Bytes[3];
7200 }
7201
7185 img->corners[TOP_CORNER] = gif->SavedImages[ino].ImageDesc.Top; 7202 img->corners[TOP_CORNER] = gif->SavedImages[ino].ImageDesc.Top;
7186 img->corners[LEFT_CORNER] = gif->SavedImages[ino].ImageDesc.Left; 7203 img->corners[LEFT_CORNER] = gif->SavedImages[ino].ImageDesc.Left;
7187 image_height = gif->SavedImages[ino].ImageDesc.Height; 7204 image_height = gif->SavedImages[ino].ImageDesc.Height;
@@ -7220,10 +7237,22 @@ gif_load (struct frame *f, struct image *img)
7220 if (gif_color_map) 7237 if (gif_color_map)
7221 for (i = 0; i < gif_color_map->ColorCount; ++i) 7238 for (i = 0; i < gif_color_map->ColorCount; ++i)
7222 { 7239 {
7223 int r = gif_color_map->Colors[i].Red << 8; 7240 if (transparent_p && transparency_color_index == i)
7224 int g = gif_color_map->Colors[i].Green << 8; 7241 {
7225 int b = gif_color_map->Colors[i].Blue << 8; 7242 Lisp_Object specified_bg
7226 pixel_colors[i] = lookup_rgb_color (f, r, g, b); 7243 = image_spec_value (img->spec, QCbackground, NULL);
7244 pixel_colors[i] = STRINGP (specified_bg)
7245 ? x_alloc_image_color (f, img, specified_bg,
7246 FRAME_BACKGROUND_PIXEL (f))
7247 : FRAME_BACKGROUND_PIXEL (f);
7248 }
7249 else
7250 {
7251 int r = gif_color_map->Colors[i].Red << 8;
7252 int g = gif_color_map->Colors[i].Green << 8;
7253 int b = gif_color_map->Colors[i].Blue << 8;
7254 pixel_colors[i] = lookup_rgb_color (f, r, g, b);
7255 }
7227 } 7256 }
7228 7257
7229#ifdef COLOR_TABLE_SUPPORT 7258#ifdef COLOR_TABLE_SUPPORT
diff --git a/src/insdel.c b/src/insdel.c
index abe6f350585..b62889082fd 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -73,9 +73,6 @@ Lisp_Object combine_after_change_list;
73Lisp_Object combine_after_change_buffer; 73Lisp_Object combine_after_change_buffer;
74 74
75Lisp_Object Qinhibit_modification_hooks; 75Lisp_Object Qinhibit_modification_hooks;
76
77extern Lisp_Object Vselect_active_regions, Vsaved_region_selection, Qonly;
78
79 76
80/* Check all markers in the current buffer, looking for something invalid. */ 77/* Check all markers in the current buffer, looking for something invalid. */
81 78
@@ -2051,6 +2048,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end,
2051 2048
2052 /* If `select-active-regions' is non-nil, save the region text. */ 2049 /* If `select-active-regions' is non-nil, save the region text. */
2053 if (!NILP (current_buffer->mark_active) 2050 if (!NILP (current_buffer->mark_active)
2051 && !inhibit_modification_hooks
2054 && XMARKER (current_buffer->mark)->buffer 2052 && XMARKER (current_buffer->mark)->buffer
2055 && NILP (Vsaved_region_selection) 2053 && NILP (Vsaved_region_selection)
2056 && (EQ (Vselect_active_regions, Qonly) 2054 && (EQ (Vselect_active_regions, Qonly)
@@ -2394,5 +2392,3 @@ as well as hooks attached to text properties and overlays. */);
2394 defsubr (&Scombine_after_change_execute); 2392 defsubr (&Scombine_after_change_execute);
2395} 2393}
2396 2394
2397/* arch-tag: 9b34b886-47d7-465e-a234-299af411b23d
2398 (do not change this comment) */
diff --git a/src/intervals.c b/src/intervals.c
index 5e08e13d23b..def63c43cc4 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1875,15 +1875,6 @@ lookup_char_property (Lisp_Object plist, register Lisp_Object prop, int textprop
1875} 1875}
1876 1876
1877 1877
1878/* Set point "temporarily", without checking any text properties. */
1879
1880INLINE void
1881temp_set_point (struct buffer *buffer, EMACS_INT charpos)
1882{
1883 temp_set_point_both (buffer, charpos,
1884 buf_charpos_to_bytepos (buffer, charpos));
1885}
1886
1887/* Set point in BUFFER "temporarily" to CHARPOS, which corresponds to 1878/* Set point in BUFFER "temporarily" to CHARPOS, which corresponds to
1888 byte position BYTEPOS. */ 1879 byte position BYTEPOS. */
1889 1880
@@ -1906,6 +1897,15 @@ temp_set_point_both (struct buffer *buffer,
1906 BUF_PT (buffer) = charpos; 1897 BUF_PT (buffer) = charpos;
1907} 1898}
1908 1899
1900/* Set point "temporarily", without checking any text properties. */
1901
1902INLINE void
1903temp_set_point (struct buffer *buffer, EMACS_INT charpos)
1904{
1905 temp_set_point_both (buffer, charpos,
1906 buf_charpos_to_bytepos (buffer, charpos));
1907}
1908
1909/* Set point in BUFFER to CHARPOS. If the target position is 1909/* Set point in BUFFER to CHARPOS. If the target position is
1910 before an intangible character, move to an ok place. */ 1910 before an intangible character, move to an ok place. */
1911 1911
diff --git a/src/intervals.h b/src/intervals.h
index b39fbd6899d..47eb8d4bcb1 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -264,12 +264,12 @@ extern INTERVAL previous_interval (INTERVAL);
264extern INTERVAL merge_interval_left (INTERVAL); 264extern INTERVAL merge_interval_left (INTERVAL);
265extern INTERVAL merge_interval_right (INTERVAL); 265extern INTERVAL merge_interval_right (INTERVAL);
266extern void delete_interval (INTERVAL); 266extern void delete_interval (INTERVAL);
267extern INLINE void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT); 267extern void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT);
268extern void graft_intervals_into_buffer (INTERVAL, EMACS_INT, EMACS_INT, 268extern void graft_intervals_into_buffer (INTERVAL, EMACS_INT, EMACS_INT,
269 struct buffer *, int); 269 struct buffer *, int);
270extern void verify_interval_modification (struct buffer *, int, int); 270extern void verify_interval_modification (struct buffer *, int, int);
271extern INTERVAL balance_intervals (INTERVAL); 271extern INTERVAL balance_intervals (INTERVAL);
272extern INLINE void copy_intervals_to_string (Lisp_Object, struct buffer *, 272extern void copy_intervals_to_string (Lisp_Object, struct buffer *,
273 EMACS_INT, EMACS_INT); 273 EMACS_INT, EMACS_INT);
274extern INTERVAL copy_intervals (INTERVAL, EMACS_INT, EMACS_INT); 274extern INTERVAL copy_intervals (INTERVAL, EMACS_INT, EMACS_INT);
275extern int compare_string_intervals (Lisp_Object, Lisp_Object); 275extern int compare_string_intervals (Lisp_Object, Lisp_Object);
diff --git a/src/keyboard.c b/src/keyboard.c
index 7f770ae4df1..17819170640 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -144,10 +144,6 @@ int this_single_command_key_start;
144static int before_command_key_count; 144static int before_command_key_count;
145static int before_command_echo_length; 145static int before_command_echo_length;
146 146
147extern int minbuf_level;
148
149extern int message_enable_multibyte;
150
151/* If non-nil, the function that implements the display of help. 147/* If non-nil, the function that implements the display of help.
152 It's called with one argument, the help string to display. */ 148 It's called with one argument, the help string to display. */
153 149
@@ -431,8 +427,6 @@ FILE *dribble;
431/* Nonzero if input is available. */ 427/* Nonzero if input is available. */
432int input_pending; 428int input_pending;
433 429
434extern char *pending_malloc_warning;
435
436/* Circular buffer for pre-read keyboard input. */ 430/* Circular buffer for pre-read keyboard input. */
437 431
438static struct input_event kbd_buffer[KBD_BUFFER_SIZE]; 432static struct input_event kbd_buffer[KBD_BUFFER_SIZE];
@@ -495,10 +489,10 @@ Lisp_Object Qconfig_changed_event;
495Lisp_Object Qevent_kind; 489Lisp_Object Qevent_kind;
496Lisp_Object Qevent_symbol_elements; 490Lisp_Object Qevent_symbol_elements;
497 491
498/* menu item parts */ 492/* menu and tool bar item parts */
499Lisp_Object Qmenu_enable; 493Lisp_Object Qmenu_enable;
500Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence; 494Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence;
501Lisp_Object QCbutton, QCtoggle, QCradio, QClabel; 495Lisp_Object QCbutton, QCtoggle, QCradio, QClabel, QCvert_only;
502 496
503/* An event header symbol HEAD may have a property named 497/* An event header symbol HEAD may have a property named
504 Qevent_symbol_element_mask, which is of the form (BASE MODIFIERS); 498 Qevent_symbol_element_mask, which is of the form (BASE MODIFIERS);
@@ -620,7 +614,7 @@ static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object,
620 unsigned long); 614 unsigned long);
621#endif 615#endif
622static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object, 616static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object,
623 Lisp_Object, const char **, 617 Lisp_Object, const char *const *,
624 Lisp_Object *, unsigned); 618 Lisp_Object *, unsigned);
625static Lisp_Object make_lispy_switch_frame (Lisp_Object); 619static Lisp_Object make_lispy_switch_frame (Lisp_Object);
626static void save_getcjmp (jmp_buf); 620static void save_getcjmp (jmp_buf);
@@ -3601,6 +3595,7 @@ event_to_kboard (struct input_event *event)
3601 return FRAME_KBOARD (XFRAME (frame)); 3595 return FRAME_KBOARD (XFRAME (frame));
3602} 3596}
3603 3597
3598#ifdef subprocesses
3604/* Return the number of slots occupied in kbd_buffer. */ 3599/* Return the number of slots occupied in kbd_buffer. */
3605 3600
3606static int 3601static int
@@ -3613,6 +3608,7 @@ kbd_buffer_nr_stored (void)
3613 : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr 3608 : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr
3614 + (kbd_store_ptr - kbd_buffer))); 3609 + (kbd_store_ptr - kbd_buffer)));
3615} 3610}
3611#endif /* subprocesses */
3616 3612
3617Lisp_Object Vthrow_on_input; 3613Lisp_Object Vthrow_on_input;
3618 3614
@@ -3734,6 +3730,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3734 { 3730 {
3735 *kbd_store_ptr = *event; 3731 *kbd_store_ptr = *event;
3736 ++kbd_store_ptr; 3732 ++kbd_store_ptr;
3733#ifdef subprocesses
3737 if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ()) 3734 if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ())
3738 { 3735 {
3739 /* Don't read keyboard input until we have processed kbd_buffer. 3736 /* Don't read keyboard input until we have processed kbd_buffer.
@@ -3745,6 +3742,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3745#endif 3742#endif
3746 stop_polling (); 3743 stop_polling ();
3747 } 3744 }
3745#endif /* subprocesses */
3748 } 3746 }
3749 3747
3750 /* If we're inside while-no-input, and this event qualifies 3748 /* If we're inside while-no-input, and this event qualifies
@@ -3905,6 +3903,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3905 register int c; 3903 register int c;
3906 Lisp_Object obj; 3904 Lisp_Object obj;
3907 3905
3906#ifdef subprocesses
3908 if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4) 3907 if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4)
3909 { 3908 {
3910 /* Start reading input again, we have processed enough so we can 3909 /* Start reading input again, we have processed enough so we can
@@ -3916,6 +3915,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3916#endif /* SIGIO */ 3915#endif /* SIGIO */
3917 start_polling (); 3916 start_polling ();
3918 } 3917 }
3918#endif /* subprocesses */
3919 3919
3920 if (noninteractive 3920 if (noninteractive
3921 /* In case we are running as a daemon, only do this before 3921 /* In case we are running as a daemon, only do this before
@@ -4752,7 +4752,7 @@ static const int lispy_accent_codes[] =
4752/* This is a list of Lisp names for special "accent" characters. 4752/* This is a list of Lisp names for special "accent" characters.
4753 It parallels lispy_accent_codes. */ 4753 It parallels lispy_accent_codes. */
4754 4754
4755static const char *lispy_accent_keys[] = 4755static const char *const lispy_accent_keys[] =
4756{ 4756{
4757 "dead-circumflex", 4757 "dead-circumflex",
4758 "dead-grave", 4758 "dead-grave",
@@ -4779,7 +4779,7 @@ static const char *lispy_accent_keys[] =
4779#ifdef HAVE_NTGUI 4779#ifdef HAVE_NTGUI
4780#define FUNCTION_KEY_OFFSET 0x0 4780#define FUNCTION_KEY_OFFSET 0x0
4781 4781
4782char const *lispy_function_keys[] = 4782const char *const lispy_function_keys[] =
4783 { 4783 {
4784 0, /* 0 */ 4784 0, /* 0 */
4785 4785
@@ -4973,7 +4973,7 @@ char const *lispy_function_keys[] =
4973 4973
4974/* Some of these duplicate the "Media keys" on newer keyboards, 4974/* Some of these duplicate the "Media keys" on newer keyboards,
4975 but they are delivered to the application in a different way. */ 4975 but they are delivered to the application in a different way. */
4976static const char *lispy_multimedia_keys[] = 4976static const char *const lispy_multimedia_keys[] =
4977 { 4977 {
4978 0, 4978 0,
4979 "browser-back", 4979 "browser-back",
@@ -5037,7 +5037,7 @@ static const char *lispy_multimedia_keys[] =
5037 the XK_kana_A case below. */ 5037 the XK_kana_A case below. */
5038#if 0 5038#if 0
5039#ifdef XK_kana_A 5039#ifdef XK_kana_A
5040static const char *lispy_kana_keys[] = 5040static const char *const lispy_kana_keys[] =
5041 { 5041 {
5042 /* X Keysym value */ 5042 /* X Keysym value */
5043 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x400 .. 0x40f */ 5043 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x400 .. 0x40f */
@@ -5076,7 +5076,7 @@ static const char *lispy_kana_keys[] =
5076 5076
5077/* You'll notice that this table is arranged to be conveniently 5077/* You'll notice that this table is arranged to be conveniently
5078 indexed by X Windows keysym values. */ 5078 indexed by X Windows keysym values. */
5079static const char *lispy_function_keys[] = 5079static const char *const lispy_function_keys[] =
5080 { 5080 {
5081 /* X Keysym value */ 5081 /* X Keysym value */
5082 5082
@@ -5162,7 +5162,7 @@ static const char *lispy_function_keys[] =
5162/* ISO 9995 Function and Modifier Keys; the first byte is 0xFE. */ 5162/* ISO 9995 Function and Modifier Keys; the first byte is 0xFE. */
5163#define ISO_FUNCTION_KEY_OFFSET 0xfe00 5163#define ISO_FUNCTION_KEY_OFFSET 0xfe00
5164 5164
5165static const char *iso_lispy_function_keys[] = 5165static const char *const iso_lispy_function_keys[] =
5166 { 5166 {
5167 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe00 */ 5167 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe00 */
5168 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe08 */ 5168 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe08 */
@@ -5185,14 +5185,14 @@ static const char *iso_lispy_function_keys[] =
5185 5185
5186Lisp_Object Vlispy_mouse_stem; 5186Lisp_Object Vlispy_mouse_stem;
5187 5187
5188static const char *lispy_wheel_names[] = 5188static const char *const lispy_wheel_names[] =
5189{ 5189{
5190 "wheel-up", "wheel-down", "wheel-left", "wheel-right" 5190 "wheel-up", "wheel-down", "wheel-left", "wheel-right"
5191}; 5191};
5192 5192
5193/* drag-n-drop events are generated when a set of selected files are 5193/* drag-n-drop events are generated when a set of selected files are
5194 dragged from another application and dropped onto an Emacs window. */ 5194 dragged from another application and dropped onto an Emacs window. */
5195static const char *lispy_drag_n_drop_names[] = 5195static const char *const lispy_drag_n_drop_names[] =
5196{ 5196{
5197 "drag-n-drop" 5197 "drag-n-drop"
5198}; 5198};
@@ -5203,7 +5203,7 @@ Lisp_Object Qup, Qdown, Qbottom, Qend_scroll;
5203Lisp_Object Qtop, Qratio; 5203Lisp_Object Qtop, Qratio;
5204 5204
5205/* An array of scroll bar parts, indexed by an enum scroll_bar_part value. */ 5205/* An array of scroll bar parts, indexed by an enum scroll_bar_part value. */
5206const Lisp_Object *scroll_bar_parts[] = { 5206static Lisp_Object *const scroll_bar_parts[] = {
5207 &Qabove_handle, &Qhandle, &Qbelow_handle, 5207 &Qabove_handle, &Qhandle, &Qbelow_handle,
5208 &Qup, &Qdown, &Qtop, &Qbottom, &Qend_scroll, &Qratio 5208 &Qup, &Qdown, &Qtop, &Qbottom, &Qend_scroll, &Qratio
5209}; 5209};
@@ -5243,24 +5243,22 @@ EMACS_INT double_click_fuzz;
5243 5243
5244int double_click_count; 5244int double_click_count;
5245 5245
5246/* Return position of a mouse click or wheel event */ 5246/* X and Y are frame-relative coordinates for a click or wheel event.
5247 Return a Lisp-style event list. */
5247 5248
5248static Lisp_Object 5249static Lisp_Object
5249make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, 5250make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5250 unsigned long time) 5251 unsigned long time)
5251{ 5252{
5252 Lisp_Object window;
5253 enum window_part part; 5253 enum window_part part;
5254 Lisp_Object posn = Qnil; 5254 Lisp_Object posn = Qnil;
5255 Lisp_Object extra_info = Qnil; 5255 Lisp_Object extra_info = Qnil;
5256 int wx, wy; 5256 /* Coordinate pixel positions to return. */
5257 5257 int xret = 0, yret = 0;
5258 /* Set `window' to the window under frame pixel coordinates (x,y) */ 5258 /* The window under frame pixel coordinates (x,y) */
5259 if (f) 5259 Lisp_Object window = f
5260 window = window_from_coordinates (f, XINT (*x), XINT (*y), 5260 ? window_from_coordinates (f, XINT (x), XINT (y), &part, 0)
5261 &part, &wx, &wy, 0); 5261 : Qnil;
5262 else
5263 window = Qnil;
5264 5262
5265 if (WINDOWP (window)) 5263 if (WINDOWP (window))
5266 { 5264 {
@@ -5268,102 +5266,114 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y,
5268 struct window *w = XWINDOW (window); 5266 struct window *w = XWINDOW (window);
5269 Lisp_Object string_info = Qnil; 5267 Lisp_Object string_info = Qnil;
5270 EMACS_INT textpos = -1; 5268 EMACS_INT textpos = -1;
5271 int rx = -1, ry = -1; 5269 int col = -1, row = -1;
5272 int dx = -1, dy = -1; 5270 int dx = -1, dy = -1;
5273 int width = -1, height = -1; 5271 int width = -1, height = -1;
5274 Lisp_Object object = Qnil; 5272 Lisp_Object object = Qnil;
5275 5273
5276 /* Set event coordinates to window-relative coordinates 5274 /* Pixel coordinates relative to the window corner. */
5277 for constructing the Lisp event below. */ 5275 int wx = XINT (x) - WINDOW_LEFT_EDGE_X (w);
5278 XSETINT (*x, wx); 5276 int wy = XINT (y) - WINDOW_TOP_EDGE_Y (w);
5279 XSETINT (*y, wy);
5280 5277
5278 /* For text area clicks, return X, Y relative to the corner of
5279 this text area. Note that dX, dY etc are set below, by
5280 buffer_posn_from_coords. */
5281 if (part == ON_TEXT) 5281 if (part == ON_TEXT)
5282 { 5282 {
5283 wx += WINDOW_LEFT_MARGIN_WIDTH (w); 5283 xret = XINT (x) - window_box_left (w, TEXT_AREA);
5284 yret = wy - WINDOW_HEADER_LINE_HEIGHT (w);
5284 } 5285 }
5286 /* For mode line and header line clicks, return X, Y relative to
5287 the left window edge. Use mode_line_string to look for a
5288 string on the click position. */
5285 else if (part == ON_MODE_LINE || part == ON_HEADER_LINE) 5289 else if (part == ON_MODE_LINE || part == ON_HEADER_LINE)
5286 { 5290 {
5287 /* Mode line or header line. Look for a string under
5288 the mouse that may have a `local-map' property. */
5289 Lisp_Object string; 5291 Lisp_Object string;
5290 EMACS_INT charpos; 5292 EMACS_INT charpos;
5291 5293
5292 posn = part == ON_MODE_LINE ? Qmode_line : Qheader_line; 5294 posn = (part == ON_MODE_LINE) ? Qmode_line : Qheader_line;
5293 rx = wx, ry = wy; 5295 /* Note that mode_line_string takes COL, ROW as pixels and
5294 string = mode_line_string (w, part, &rx, &ry, &charpos, 5296 converts them to characters. */
5297 col = wx;
5298 row = wy;
5299 string = mode_line_string (w, part, &col, &row, &charpos,
5295 &object, &dx, &dy, &width, &height); 5300 &object, &dx, &dy, &width, &height);
5296 if (STRINGP (string)) 5301 if (STRINGP (string))
5297 string_info = Fcons (string, make_number (charpos)); 5302 string_info = Fcons (string, make_number (charpos));
5298 if (w == XWINDOW (selected_window) 5303 textpos = (w == XWINDOW (selected_window)
5299 && current_buffer == XBUFFER (w->buffer)) 5304 && current_buffer == XBUFFER (w->buffer))
5300 textpos = PT; 5305 ? PT : XMARKER (w->pointm)->charpos;
5301 else 5306
5302 textpos = XMARKER (w->pointm)->charpos; 5307 xret = wx;
5303 } 5308 yret = wy;
5304 else if (part == ON_VERTICAL_BORDER)
5305 {
5306 posn = Qvertical_line;
5307 wx = -1;
5308 dx = 0;
5309 width = 1;
5310 } 5309 }
5310 /* For fringes and margins, Y is relative to the area's (and the
5311 window's) top edge, while X is meaningless. */
5311 else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) 5312 else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN)
5312 { 5313 {
5313 Lisp_Object string; 5314 Lisp_Object string;
5314 EMACS_INT charpos; 5315 EMACS_INT charpos;
5315 5316
5316 posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; 5317 posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin;
5317 rx = wx, ry = wy; 5318 col = wx;
5318 string = marginal_area_string (w, part, &rx, &ry, &charpos, 5319 row = wy;
5320 string = marginal_area_string (w, part, &col, &row, &charpos,
5319 &object, &dx, &dy, &width, &height); 5321 &object, &dx, &dy, &width, &height);
5320 if (STRINGP (string)) 5322 if (STRINGP (string))
5321 string_info = Fcons (string, make_number (charpos)); 5323 string_info = Fcons (string, make_number (charpos));
5322 if (part == ON_LEFT_MARGIN) 5324 yret = wy - WINDOW_HEADER_LINE_HEIGHT (w);
5323 wx = 0;
5324 else
5325 wx = window_box_right_offset (w, TEXT_AREA) - 1;
5326 } 5325 }
5327 else if (part == ON_LEFT_FRINGE) 5326 else if (part == ON_LEFT_FRINGE)
5328 { 5327 {
5329 posn = Qleft_fringe; 5328 posn = Qleft_fringe;
5330 rx = 0; 5329 col = 0;
5331 dx = wx; 5330 dx = wx
5332 wx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) 5331 - (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
5333 ? 0 5332 ? 0 : window_box_width (w, LEFT_MARGIN_AREA));
5334 : window_box_width (w, LEFT_MARGIN_AREA)); 5333 dy = yret = wy - WINDOW_HEADER_LINE_HEIGHT (w);
5335 dx -= wx;
5336 } 5334 }
5337 else if (part == ON_RIGHT_FRINGE) 5335 else if (part == ON_RIGHT_FRINGE)
5338 { 5336 {
5339 posn = Qright_fringe; 5337 posn = Qright_fringe;
5340 rx = 0; 5338 col = 0;
5341 dx = wx; 5339 dx = wx
5342 wx = (window_box_width (w, LEFT_MARGIN_AREA) 5340 - window_box_width (w, LEFT_MARGIN_AREA)
5343 + window_box_width (w, TEXT_AREA) 5341 - window_box_width (w, TEXT_AREA)
5344 + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) 5342 - (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
5345 ? window_box_width (w, RIGHT_MARGIN_AREA) 5343 ? window_box_width (w, RIGHT_MARGIN_AREA)
5346 : 0)); 5344 : 0);
5347 dx -= wx; 5345 dy = yret = wy - WINDOW_HEADER_LINE_HEIGHT (w);
5348 } 5346 }
5349 else 5347 else if (part == ON_VERTICAL_BORDER)
5350 { 5348 {
5351 /* Note: We have no special posn for part == ON_SCROLL_BAR. */ 5349 posn = Qvertical_line;
5352 wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); 5350 width = 1;
5351 dx = 0;
5352 dy = yret = wy;
5353 } 5353 }
5354 /* Nothing special for part == ON_SCROLL_BAR. */
5354 5355
5356 /* For clicks in the text area, fringes, or margins, call
5357 buffer_posn_from_coords to extract TEXTPOS, the buffer
5358 position nearest to the click. */
5355 if (textpos < 0) 5359 if (textpos < 0)
5356 { 5360 {
5357 Lisp_Object string2, object2 = Qnil; 5361 Lisp_Object string2, object2 = Qnil;
5358 struct display_pos p; 5362 struct display_pos p;
5359 int dx2, dy2; 5363 int dx2, dy2;
5360 int width2, height2; 5364 int width2, height2;
5361 string2 = buffer_posn_from_coords (w, &wx, &wy, &p, 5365 /* The pixel X coordinate passed to buffer_posn_from_coords
5366 is the X coordinate relative to the text area for
5367 text-area clicks, zero otherwise. */
5368 int x2 = (part == ON_TEXT) ? xret : 0;
5369 int y2 = wy;
5370
5371 string2 = buffer_posn_from_coords (w, &x2, &y2, &p,
5362 &object2, &dx2, &dy2, 5372 &object2, &dx2, &dy2,
5363 &width2, &height2); 5373 &width2, &height2);
5364 textpos = CHARPOS (p.pos); 5374 textpos = CHARPOS (p.pos);
5365 if (rx < 0) rx = wx; 5375 if (col < 0) col = x2;
5366 if (ry < 0) ry = wy; 5376 if (row < 0) row = y2;
5367 if (dx < 0) dx = dx2; 5377 if (dx < 0) dx = dx2;
5368 if (dy < 0) dy = dy2; 5378 if (dy < 0) dy = dy2;
5369 if (width < 0) width = width2; 5379 if (width < 0) width = width2;
@@ -5394,34 +5404,27 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y,
5394#endif 5404#endif
5395 5405
5396 /* Object info */ 5406 /* Object info */
5397 extra_info = Fcons (object, 5407 extra_info
5398 Fcons (Fcons (make_number (dx), 5408 = list3 (object,
5399 make_number (dy)), 5409 Fcons (make_number (dx), make_number (dy)),
5400 Fcons (Fcons (make_number (width), 5410 Fcons (make_number (width), make_number (height)));
5401 make_number (height)),
5402 Qnil)));
5403 5411
5404 /* String info */ 5412 /* String info */
5405 extra_info = Fcons (string_info, 5413 extra_info = Fcons (string_info,
5406 Fcons (make_number (textpos), 5414 Fcons (make_number (textpos),
5407 Fcons (Fcons (make_number (rx), 5415 Fcons (Fcons (make_number (col),
5408 make_number (ry)), 5416 make_number (row)),
5409 extra_info))); 5417 extra_info)));
5410 } 5418 }
5411 else if (f != 0) 5419 else if (f != 0)
5412 { 5420 XSETFRAME (window, f);
5413 XSETFRAME (window, f);
5414 }
5415 else 5421 else
5416 { 5422 window = Qnil;
5417 window = Qnil;
5418 XSETFASTINT (*x, 0);
5419 XSETFASTINT (*y, 0);
5420 }
5421 5423
5422 return Fcons (window, 5424 return Fcons (window,
5423 Fcons (posn, 5425 Fcons (posn,
5424 Fcons (Fcons (*x, *y), 5426 Fcons (Fcons (make_number (xret),
5427 make_number (yret)),
5425 Fcons (make_number (time), 5428 Fcons (make_number (time),
5426 extra_info)))); 5429 extra_info))));
5427} 5430}
@@ -5610,14 +5613,6 @@ make_lispy_event (struct input_event *event)
5610 int hpos; 5613 int hpos;
5611 int i; 5614 int i;
5612 5615
5613#if 0
5614 /* Activate the menu bar on the down event. If the
5615 up event comes in before the menu code can deal with it,
5616 just ignore it. */
5617 if (! (event->modifiers & down_modifier))
5618 return Qnil;
5619#endif
5620
5621 /* Find the menu bar item under `column'. */ 5616 /* Find the menu bar item under `column'. */
5622 item = Qnil; 5617 item = Qnil;
5623 items = FRAME_MENU_BAR_ITEMS (f); 5618 items = FRAME_MENU_BAR_ITEMS (f);
@@ -5649,7 +5644,7 @@ make_lispy_event (struct input_event *event)
5649 } 5644 }
5650#endif /* not USE_X_TOOLKIT && not USE_GTK && not HAVE_NS */ 5645#endif /* not USE_X_TOOLKIT && not USE_GTK && not HAVE_NS */
5651 5646
5652 position = make_lispy_position (f, &event->x, &event->y, 5647 position = make_lispy_position (f, event->x, event->y,
5653 event->timestamp); 5648 event->timestamp);
5654 } 5649 }
5655#ifndef USE_TOOLKIT_SCROLL_BARS 5650#ifndef USE_TOOLKIT_SCROLL_BARS
@@ -5749,23 +5744,21 @@ make_lispy_event (struct input_event *event)
5749 return Qnil; 5744 return Qnil;
5750 5745
5751 event->modifiers &= ~up_modifier; 5746 event->modifiers &= ~up_modifier;
5752#if 0 /* Formerly we treated an up with no down as a click event. */ 5747
5753 if (!CONSP (start_pos))
5754 event->modifiers |= click_modifier;
5755 else
5756#endif
5757 { 5748 {
5758 Lisp_Object down; 5749 Lisp_Object new_down, down;
5759 EMACS_INT xdiff = double_click_fuzz, ydiff = double_click_fuzz; 5750 EMACS_INT xdiff = double_click_fuzz, ydiff = double_click_fuzz;
5760 5751
5761 /* The third element of every position 5752 /* The third element of every position
5762 should be the (x,y) pair. */ 5753 should be the (x,y) pair. */
5763 down = Fcar (Fcdr (Fcdr (start_pos))); 5754 down = Fcar (Fcdr (Fcdr (start_pos)));
5755 new_down = Fcar (Fcdr (Fcdr (position)));
5756
5764 if (CONSP (down) 5757 if (CONSP (down)
5765 && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down))) 5758 && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down)))
5766 { 5759 {
5767 xdiff = XINT (event->x) - XINT (XCAR (down)); 5760 xdiff = XINT (XCAR (new_down)) - XINT (XCAR (down));
5768 ydiff = XINT (event->y) - XINT (XCDR (down)); 5761 ydiff = XINT (XCDR (new_down)) - XINT (XCDR (down));
5769 } 5762 }
5770 5763
5771 if (ignore_mouse_drag_p) 5764 if (ignore_mouse_drag_p)
@@ -5848,7 +5841,7 @@ make_lispy_event (struct input_event *event)
5848 if (! FRAME_LIVE_P (f)) 5841 if (! FRAME_LIVE_P (f))
5849 return Qnil; 5842 return Qnil;
5850 5843
5851 position = make_lispy_position (f, &event->x, &event->y, 5844 position = make_lispy_position (f, event->x, event->y,
5852 event->timestamp); 5845 event->timestamp);
5853 5846
5854 /* Set double or triple modifiers to indicate the wheel speed. */ 5847 /* Set double or triple modifiers to indicate the wheel speed. */
@@ -5868,10 +5861,8 @@ make_lispy_event (struct input_event *event)
5868 else 5861 else
5869 abort (); 5862 abort ();
5870 5863
5871 if (FRAME_WINDOW_P (f)) 5864 fuzz = FRAME_WINDOW_P (f)
5872 fuzz = double_click_fuzz; 5865 ? double_click_fuzz : double_click_fuzz / 8;
5873 else
5874 fuzz = double_click_fuzz / 8;
5875 5866
5876 if (event->modifiers & up_modifier) 5867 if (event->modifiers & up_modifier)
5877 { 5868 {
@@ -6009,7 +6000,7 @@ make_lispy_event (struct input_event *event)
6009 if (! FRAME_LIVE_P (f)) 6000 if (! FRAME_LIVE_P (f))
6010 return Qnil; 6001 return Qnil;
6011 6002
6012 position = make_lispy_position (f, &event->x, &event->y, 6003 position = make_lispy_position (f, event->x, event->y,
6013 event->timestamp); 6004 event->timestamp);
6014 6005
6015 head = modify_event_symbol (0, event->modifiers, 6006 head = modify_event_symbol (0, event->modifiers,
@@ -6092,8 +6083,8 @@ make_lispy_event (struct input_event *event)
6092 start_pos_ptr = &AREF (button_down_location, button); 6083 start_pos_ptr = &AREF (button_down_location, button);
6093 start_pos = *start_pos_ptr; 6084 start_pos = *start_pos_ptr;
6094 6085
6095 position = make_lispy_position (f, &event->x, &event->y, 6086 position = make_lispy_position (f, event->x, event->y,
6096 event->timestamp); 6087 event->timestamp);
6097 6088
6098 if (event->modifiers & down_modifier) 6089 if (event->modifiers & down_modifier)
6099 *start_pos_ptr = Fcopy_alist (position); 6090 *start_pos_ptr = Fcopy_alist (position);
@@ -6152,25 +6143,19 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa
6152 6143
6153 part_sym = *scroll_bar_parts[(int) part]; 6144 part_sym = *scroll_bar_parts[(int) part];
6154 return Fcons (Qscroll_bar_movement, 6145 return Fcons (Qscroll_bar_movement,
6155 (Fcons (Fcons (bar_window, 6146 Fcons (list5 (bar_window,
6156 Fcons (Qvertical_scroll_bar, 6147 Qvertical_scroll_bar,
6157 Fcons (Fcons (x, y), 6148 Fcons (x, y),
6158 Fcons (make_number (time), 6149 make_number (time),
6159 Fcons (part_sym, 6150 part_sym),
6160 Qnil))))), 6151 Qnil));
6161 Qnil)));
6162 } 6152 }
6163
6164 /* Or is it an ordinary mouse movement? */ 6153 /* Or is it an ordinary mouse movement? */
6165 else 6154 else
6166 { 6155 {
6167 Lisp_Object position; 6156 Lisp_Object position;
6168 6157 position = make_lispy_position (frame, x, y, time);
6169 position = make_lispy_position (frame, &x, &y, time); 6158 return list2 (Qmouse_movement, position);
6170
6171 return Fcons (Qmouse_movement,
6172 Fcons (position,
6173 Qnil));
6174 } 6159 }
6175} 6160}
6176 6161
@@ -6351,7 +6336,7 @@ apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_
6351} 6336}
6352 6337
6353 6338
6354static const char *modifier_names[] = 6339static const char *const modifier_names[] =
6355{ 6340{
6356 "up", "down", "drag", "click", "double", "triple", 0, 0, 6341 "up", "down", "drag", "click", "double", "triple", 0, 0,
6357 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6342 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -6571,7 +6556,7 @@ reorder_modifiers (Lisp_Object symbol)
6571 6556
6572static Lisp_Object 6557static Lisp_Object
6573modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object symbol_kind, 6558modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object symbol_kind,
6574 Lisp_Object name_alist_or_stem, const char **name_table, 6559 Lisp_Object name_alist_or_stem, const char *const *name_table,
6575 Lisp_Object *symbol_table, unsigned int table_size) 6560 Lisp_Object *symbol_table, unsigned int table_size)
6576{ 6561{
6577 Lisp_Object value; 6562 Lisp_Object value;
@@ -7074,10 +7059,12 @@ tty_read_avail_input (struct terminal *terminal,
7074 int n_to_read, i; 7059 int n_to_read, i;
7075 struct tty_display_info *tty = terminal->display_info.tty; 7060 struct tty_display_info *tty = terminal->display_info.tty;
7076 int nread = 0; 7061 int nread = 0;
7062#ifdef subprocesses
7077 int buffer_free = KBD_BUFFER_SIZE - kbd_buffer_nr_stored () - 1; 7063 int buffer_free = KBD_BUFFER_SIZE - kbd_buffer_nr_stored () - 1;
7078 7064
7079 if (kbd_on_hold_p () || buffer_free <= 0) 7065 if (kbd_on_hold_p () || buffer_free <= 0)
7080 return 0; 7066 return 0;
7067#endif /* subprocesses */
7081 7068
7082 if (!terminal->name) /* Don't read from a dead terminal. */ 7069 if (!terminal->name) /* Don't read from a dead terminal. */
7083 return 0; 7070 return 0;
@@ -7159,9 +7146,11 @@ tty_read_avail_input (struct terminal *terminal,
7159#endif 7146#endif
7160#endif 7147#endif
7161 7148
7149#ifdef subprocesses
7162 /* Don't read more than we can store. */ 7150 /* Don't read more than we can store. */
7163 if (n_to_read > buffer_free) 7151 if (n_to_read > buffer_free)
7164 n_to_read = buffer_free; 7152 n_to_read = buffer_free;
7153#endif /* subprocesses */
7165 7154
7166 /* Now read; for one reason or another, this will not block. 7155 /* Now read; for one reason or another, this will not block.
7167 NREAD is set to the number of chars read. */ 7156 NREAD is set to the number of chars read. */
@@ -8281,9 +8270,12 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8281 if (NILP (menu_item_eval_property (value))) 8270 if (NILP (menu_item_eval_property (value)))
8282 return 0; 8271 return 0;
8283 } 8272 }
8284 else if (EQ (key, QChelp)) 8273 else if (EQ (key, QChelp))
8285 /* `:help HELP-STRING'. */ 8274 /* `:help HELP-STRING'. */
8286 PROP (TOOL_BAR_ITEM_HELP) = value; 8275 PROP (TOOL_BAR_ITEM_HELP) = value;
8276 else if (EQ (key, QCvert_only))
8277 /* `:vert-only t/nil'. */
8278 PROP (TOOL_BAR_ITEM_VERT_ONLY) = value;
8287 else if (EQ (key, QClabel)) 8279 else if (EQ (key, QClabel))
8288 { 8280 {
8289 const char *bad_label = "!!?GARBLED ITEM?!!"; 8281 const char *bad_label = "!!?GARBLED ITEM?!!";
@@ -11100,10 +11092,10 @@ See also `current-input-mode'. */)
11100#ifndef DOS_NT 11092#ifndef DOS_NT
11101 /* this causes startup screen to be restored and messes with the mouse */ 11093 /* this causes startup screen to be restored and messes with the mouse */
11102 reset_all_sys_modes (); 11094 reset_all_sys_modes ();
11103#endif
11104 interrupt_input = new_interrupt_input; 11095 interrupt_input = new_interrupt_input;
11105#ifndef DOS_NT
11106 init_all_sys_modes (); 11096 init_all_sys_modes ();
11097#else
11098 interrupt_input = new_interrupt_input;
11107#endif 11099#endif
11108 11100
11109#ifdef POLL_FOR_INPUT 11101#ifdef POLL_FOR_INPUT
@@ -11327,7 +11319,7 @@ The `posn-' functions access elements of such lists. */)
11327 11319
11328 CHECK_LIVE_FRAME (frame_or_window); 11320 CHECK_LIVE_FRAME (frame_or_window);
11329 11321
11330 return make_lispy_position (XFRAME (frame_or_window), &x, &y, 0); 11322 return make_lispy_position (XFRAME (frame_or_window), x, y, 0);
11331} 11323}
11332 11324
11333DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_point, 0, 2, 0, 11325DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_point, 0, 2, 0,
@@ -11641,6 +11633,8 @@ syms_of_keyboard (void)
11641 staticpro (&QCradio); 11633 staticpro (&QCradio);
11642 QClabel = intern_c_string (":label"); 11634 QClabel = intern_c_string (":label");
11643 staticpro (&QClabel); 11635 staticpro (&QClabel);
11636 QCvert_only = intern_c_string (":vert-only");
11637 staticpro (&QCvert_only);
11644 11638
11645 Qmode_line = intern_c_string ("mode-line"); 11639 Qmode_line = intern_c_string ("mode-line");
11646 staticpro (&Qmode_line); 11640 staticpro (&Qmode_line);
@@ -12440,5 +12434,3 @@ mark_kboards (void)
12440 } 12434 }
12441} 12435}
12442 12436
12443/* arch-tag: 774e34d7-6d31-42f3-8397-e079a4e4c9ca
12444 (do not change this comment) */
diff --git a/src/keyboard.h b/src/keyboard.h
index 9fd3b48eba9..7f36691a5a3 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -490,6 +490,8 @@ extern unsigned long last_event_timestamp;
490 490
491extern int quit_char; 491extern int quit_char;
492 492
493extern int timers_run;
494
493extern int parse_menu_item (Lisp_Object, int); 495extern int parse_menu_item (Lisp_Object, int);
494 496
495extern void echo_now (void); 497extern void echo_now (void);
@@ -534,5 +536,3 @@ extern int tty_read_avail_input (struct terminal *, int,
534 struct input_event *); 536 struct input_event *);
535extern EMACS_TIME timer_check (int); 537extern EMACS_TIME timer_check (int);
536 538
537/* arch-tag: 769cbade-1ba9-4950-b886-db265b061aa3
538 (do not change this comment) */
diff --git a/src/lisp.h b/src/lisp.h
index 89d01ec6872..36653e91e4e 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -267,7 +267,9 @@ union Lisp_Object
267 267
268 struct 268 struct
269 { 269 {
270 EMACS_INT val : VALBITS; 270 /* Use explict signed, the signedness of a bit-field of type
271 int is implementation defined. */
272 signed EMACS_INT val : VALBITS;
271 enum Lisp_Type type : GCTYPEBITS; 273 enum Lisp_Type type : GCTYPEBITS;
272 } s; 274 } s;
273 struct 275 struct
@@ -290,7 +292,9 @@ union Lisp_Object
290 struct 292 struct
291 { 293 {
292 enum Lisp_Type type : GCTYPEBITS; 294 enum Lisp_Type type : GCTYPEBITS;
293 EMACS_INT val : VALBITS; 295 /* Use explict signed, the signedness of a bit-field of type
296 int is implementation defined. */
297 signed EMACS_INT val : VALBITS;
294 } s; 298 } s;
295 struct 299 struct
296 { 300 {
@@ -447,20 +451,8 @@ enum pvec_type
447#endif 451#endif
448 452
449#define XHASH(a) ((a).i) 453#define XHASH(a) ((a).i)
450
451#define XTYPE(a) ((enum Lisp_Type) (a).u.type) 454#define XTYPE(a) ((enum Lisp_Type) (a).u.type)
452
453#ifdef EXPLICIT_SIGN_EXTEND
454/* Make sure we sign-extend; compilers have been known to fail to do so.
455 We additionally cast to EMACS_INT since it seems that some compilers
456 have been known to fail to do so, even though the bitfield is declared
457 as EMACS_INT already. */
458#define XINT(a) ((((EMACS_INT) (a).s.val) << (BITS_PER_EMACS_INT - VALBITS)) \
459 >> (BITS_PER_EMACS_INT - VALBITS))
460#else
461#define XINT(a) ((a).s.val) 455#define XINT(a) ((a).s.val)
462#endif /* EXPLICIT_SIGN_EXTEND */
463
464#define XUINT(a) ((a).u.val) 456#define XUINT(a) ((a).u.val)
465 457
466#ifdef USE_LSB_TAG 458#ifdef USE_LSB_TAG
@@ -1589,6 +1581,41 @@ typedef struct {
1589/* The ID of the mode line highlighting face. */ 1581/* The ID of the mode line highlighting face. */
1590#define GLYPH_MODE_LINE_FACE 1 1582#define GLYPH_MODE_LINE_FACE 1
1591 1583
1584/* Structure to hold mouse highlight data. This is here because other
1585 header files need it for defining struct x_output etc. */
1586typedef struct {
1587 /* These variables describe the range of text currently shown in its
1588 mouse-face, together with the window they apply to. As long as
1589 the mouse stays within this range, we need not redraw anything on
1590 its account. Rows and columns are glyph matrix positions in
1591 MOUSE_FACE_WINDOW. */
1592 int mouse_face_beg_row, mouse_face_beg_col;
1593 int mouse_face_beg_x, mouse_face_beg_y;
1594 int mouse_face_end_row, mouse_face_end_col;
1595 int mouse_face_end_x, mouse_face_end_y;
1596 int mouse_face_past_end;
1597 Lisp_Object mouse_face_window;
1598 int mouse_face_face_id;
1599 Lisp_Object mouse_face_overlay;
1600
1601 /* 1 if a mouse motion event came and we didn't handle it right away because
1602 gc was in progress. */
1603 int mouse_face_deferred_gc;
1604
1605 /* FRAME and X, Y position of mouse when last checked for
1606 highlighting. X and Y can be negative or out of range for the frame. */
1607 struct frame *mouse_face_mouse_frame;
1608 int mouse_face_mouse_x, mouse_face_mouse_y;
1609
1610 /* Nonzero means defer mouse-motion highlighting. */
1611 int mouse_face_defer;
1612
1613 /* Nonzero means that the mouse highlight should not be shown. */
1614 int mouse_face_hidden;
1615
1616 int mouse_face_image_state;
1617} Mouse_HLInfo;
1618
1592/* Data type checking */ 1619/* Data type checking */
1593 1620
1594#define NILP(x) EQ (x, Qnil) 1621#define NILP(x) EQ (x, Qnil)
@@ -2665,11 +2692,15 @@ extern Lisp_Object Qimage, Qtext, Qboth, Qboth_horiz, Qtext_image_horiz;
2665extern Lisp_Object Qspace, Qcenter, QCalign_to; 2692extern Lisp_Object Qspace, Qcenter, QCalign_to;
2666extern Lisp_Object Qbar, Qhbar, Qbox, Qhollow; 2693extern Lisp_Object Qbar, Qhbar, Qbox, Qhollow;
2667extern Lisp_Object Qleft_margin, Qright_margin; 2694extern Lisp_Object Qleft_margin, Qright_margin;
2695extern Lisp_Object Qglyphless_char;
2668extern Lisp_Object Vmessage_log_max; 2696extern Lisp_Object Vmessage_log_max;
2669extern Lisp_Object QCdata, QCfile; 2697extern Lisp_Object QCdata, QCfile;
2670extern Lisp_Object QCmap; 2698extern Lisp_Object QCmap;
2671extern Lisp_Object Qrisky_local_variable; 2699extern Lisp_Object Qrisky_local_variable;
2672extern Lisp_Object Vinhibit_redisplay; 2700extern Lisp_Object Vinhibit_redisplay;
2701extern struct frame *last_glyphless_glyph_frame;
2702extern unsigned last_glyphless_glyph_face_id;
2703extern int last_glyphless_glyph_merged_face_id;
2673extern int message_enable_multibyte; 2704extern int message_enable_multibyte;
2674extern int noninteractive_need_newline; 2705extern int noninteractive_need_newline;
2675extern EMACS_INT scroll_margin; 2706extern EMACS_INT scroll_margin;
@@ -2727,6 +2758,8 @@ extern void memory_full (void) NO_RETURN;
2727extern void buffer_memory_full (void) NO_RETURN; 2758extern void buffer_memory_full (void) NO_RETURN;
2728extern int survives_gc_p (Lisp_Object); 2759extern int survives_gc_p (Lisp_Object);
2729extern void mark_object (Lisp_Object); 2760extern void mark_object (Lisp_Object);
2761extern void refill_memory_reserve (void);
2762extern const char *pending_malloc_warning;
2730extern Lisp_Object Vpurify_flag; 2763extern Lisp_Object Vpurify_flag;
2731extern Lisp_Object Vmemory_full; 2764extern Lisp_Object Vmemory_full;
2732extern Lisp_Object *stack_base; 2765extern Lisp_Object *stack_base;
@@ -2823,7 +2856,8 @@ extern void syms_of_chartab (void);
2823/* Defined in print.c */ 2856/* Defined in print.c */
2824extern Lisp_Object Vprin1_to_string_buffer; 2857extern Lisp_Object Vprin1_to_string_buffer;
2825extern Lisp_Object Vprint_level, Vprint_length; 2858extern Lisp_Object Vprint_level, Vprint_length;
2826extern void debug_print (Lisp_Object); 2859extern void debug_print (Lisp_Object) EXTERNALLY_VISIBLE;
2860extern void safe_debug_print (Lisp_Object) EXTERNALLY_VISIBLE;
2827EXFUN (Fprin1, 2); 2861EXFUN (Fprin1, 2);
2828EXFUN (Fprin1_to_string, 2); 2862EXFUN (Fprin1_to_string, 2);
2829EXFUN (Fprinc, 2); 2863EXFUN (Fprinc, 2);
@@ -3226,6 +3260,8 @@ extern Lisp_Object Qdisabled, QCfilter;
3226extern Lisp_Object Qabove_handle, Qhandle, Qbelow_handle; 3260extern Lisp_Object Qabove_handle, Qhandle, Qbelow_handle;
3227extern Lisp_Object Qup, Qdown, Qbottom, Qend_scroll; 3261extern Lisp_Object Qup, Qdown, Qbottom, Qend_scroll;
3228extern Lisp_Object Qtop, Qratio; 3262extern Lisp_Object Qtop, Qratio;
3263extern Lisp_Object Vsaved_region_selection;
3264extern Lisp_Object Vselect_active_regions;
3229extern Lisp_Object Vtty_erase_char, Vhelp_form, Vtop_level; 3265extern Lisp_Object Vtty_erase_char, Vhelp_form, Vtop_level;
3230extern Lisp_Object Vthrow_on_input; 3266extern Lisp_Object Vthrow_on_input;
3231extern int input_pending; 3267extern int input_pending;
@@ -3595,7 +3631,6 @@ extern void syms_of_xfns (void);
3595extern void syms_of_xsmfns (void); 3631extern void syms_of_xsmfns (void);
3596 3632
3597/* Defined in xselect.c */ 3633/* Defined in xselect.c */
3598EXFUN (Fx_send_client_event, 6);
3599extern void syms_of_xselect (void); 3634extern void syms_of_xselect (void);
3600 3635
3601/* Defined in xterm.c */ 3636/* Defined in xterm.c */
diff --git a/src/lread.c b/src/lread.c
index e150078f6e2..83c94b02e23 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1,7 +1,8 @@
1/* Lisp parsing and input streams. 1/* Lisp parsing and input streams.
2 Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, 2
3 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, 1997,
4 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
5 2009, 2010 Free Software Foundation, Inc.
5 6
6This file is part of GNU Emacs. 7This file is part of GNU Emacs.
7 8
@@ -557,8 +558,6 @@ readbyte_from_string (int c, Lisp_Object readcharfun)
557 encoded in `emacs-mule' and the first byte is already read in 558 encoded in `emacs-mule' and the first byte is already read in
558 C. */ 559 C. */
559 560
560extern char emacs_mule_bytes[256];
561
562static int 561static int
563read_emacs_mule_char (int c, int (*readbyte) (int, Lisp_Object), Lisp_Object readcharfun) 562read_emacs_mule_char (int c, int (*readbyte) (int, Lisp_Object), Lisp_Object readcharfun)
564{ 563{
@@ -589,7 +588,7 @@ read_emacs_mule_char (int c, int (*readbyte) (int, Lisp_Object), Lisp_Object rea
589 588
590 if (len == 2) 589 if (len == 2)
591 { 590 {
592 charset = emacs_mule_charset[buf[0]]; 591 charset = CHARSET_FROM_ID (emacs_mule_charset[buf[0]]);
593 code = buf[1] & 0x7F; 592 code = buf[1] & 0x7F;
594 } 593 }
595 else if (len == 3) 594 else if (len == 3)
@@ -597,18 +596,18 @@ read_emacs_mule_char (int c, int (*readbyte) (int, Lisp_Object), Lisp_Object rea
597 if (buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_11 596 if (buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_11
598 || buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_12) 597 || buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_12)
599 { 598 {
600 charset = emacs_mule_charset[buf[1]]; 599 charset = CHARSET_FROM_ID (emacs_mule_charset[buf[1]]);
601 code = buf[2] & 0x7F; 600 code = buf[2] & 0x7F;
602 } 601 }
603 else 602 else
604 { 603 {
605 charset = emacs_mule_charset[buf[0]]; 604 charset = CHARSET_FROM_ID (emacs_mule_charset[buf[0]]);
606 code = ((buf[1] << 8) | buf[2]) & 0x7F7F; 605 code = ((buf[1] << 8) | buf[2]) & 0x7F7F;
607 } 606 }
608 } 607 }
609 else 608 else
610 { 609 {
611 charset = emacs_mule_charset[buf[1]]; 610 charset = CHARSET_FROM_ID (emacs_mule_charset[buf[1]]);
612 code = ((buf[2] << 8) | buf[3]) & 0x7F7F; 611 code = ((buf[2] << 8) | buf[3]) & 0x7F7F;
613 } 612 }
614 c = DECODE_CHAR (charset, code); 613 c = DECODE_CHAR (charset, code);
@@ -1082,6 +1081,10 @@ Loading a file records its definitions, and its `provide' and
1082`require' calls, in an element of `load-history' whose 1081`require' calls, in an element of `load-history' whose
1083car is the file name loaded. See `load-history'. 1082car is the file name loaded. See `load-history'.
1084 1083
1084While the file is in the process of being loaded, the variable
1085`load-in-progress' is non-nil and the variable `load-file-name'
1086is bound to the file's name.
1087
1085Return t if the file exists and loads successfully. */) 1088Return t if the file exists and loads successfully. */)
1086 (Lisp_Object file, Lisp_Object noerror, Lisp_Object nomessage, Lisp_Object nosuffix, Lisp_Object must_suffix) 1089 (Lisp_Object file, Lisp_Object noerror, Lisp_Object nomessage, Lisp_Object nosuffix, Lisp_Object must_suffix)
1087{ 1090{
@@ -2770,7 +2773,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2770 old-style. For Emacs-25, we should completely remove this 2773 old-style. For Emacs-25, we should completely remove this
2771 first_in_list exception (old-style can still be obtained via 2774 first_in_list exception (old-style can still be obtained via
2772 "(\`" anyway). */ 2775 "(\`" anyway). */
2773 if (first_in_list && next_char == ' ') 2776 if (!new_backquote_flag && first_in_list && next_char == ' ')
2774 { 2777 {
2775 Vold_style_backquotes = Qt; 2778 Vold_style_backquotes = Qt;
2776 goto default_label; 2779 goto default_label;
@@ -2787,33 +2790,48 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2787 } 2790 }
2788 } 2791 }
2789 case ',': 2792 case ',':
2790 if (new_backquote_flag) 2793 {
2791 { 2794 int next_char = READCHAR;
2792 Lisp_Object comma_type = Qnil; 2795 UNREAD (next_char);
2793 Lisp_Object value; 2796 /* Transition from old-style to new-style:
2794 int ch = READCHAR; 2797 It used to be impossible to have a new-style , other than within
2795 2798 a new-style `. This is sufficient when ` and , are used in the
2796 if (ch == '@') 2799 normal way, but ` and , can also appear in args to macros that
2797 comma_type = Qcomma_at; 2800 will not interpret them in the usual way, in which case , may be
2798 else if (ch == '.') 2801 used without any ` anywhere near.
2799 comma_type = Qcomma_dot; 2802 So we now use the same heuristic as for backquote: old-style
2800 else 2803 unquotes are only recognized when first on a list, and when
2801 { 2804 followed by a space.
2802 if (ch >= 0) UNREAD (ch); 2805 Because it's more difficult to peak 2 chars ahead, a new-style
2803 comma_type = Qcomma; 2806 ,@ can still not be used outside of a `, unless it's in the middle
2804 } 2807 of a list. */
2808 if (new_backquote_flag
2809 || !first_in_list
2810 || (next_char != ' ' && next_char != '@'))
2811 {
2812 Lisp_Object comma_type = Qnil;
2813 Lisp_Object value;
2814 int ch = READCHAR;
2805 2815
2806 new_backquote_flag--; 2816 if (ch == '@')
2807 value = read0 (readcharfun); 2817 comma_type = Qcomma_at;
2808 new_backquote_flag++; 2818 else if (ch == '.')
2809 return Fcons (comma_type, Fcons (value, Qnil)); 2819 comma_type = Qcomma_dot;
2810 } 2820 else
2811 else 2821 {
2812 { 2822 if (ch >= 0) UNREAD (ch);
2813 Vold_style_backquotes = Qt; 2823 comma_type = Qcomma;
2814 goto default_label; 2824 }
2815 }
2816 2825
2826 value = read0 (readcharfun);
2827 return Fcons (comma_type, Fcons (value, Qnil));
2828 }
2829 else
2830 {
2831 Vold_style_backquotes = Qt;
2832 goto default_label;
2833 }
2834 }
2817 case '?': 2835 case '?':
2818 { 2836 {
2819 int modifiers; 2837 int modifiers;
@@ -2840,26 +2858,9 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2840 c |= modifiers; 2858 c |= modifiers;
2841 2859
2842 next_char = READCHAR; 2860 next_char = READCHAR;
2843 if (next_char == '.') 2861 ok = (next_char <= 040
2844 { 2862 || (next_char < 0200
2845 /* Only a dotted-pair dot is valid after a char constant. */ 2863 && (strchr ("\"';()[]#?`,.", next_char))));
2846 int next_next_char = READCHAR;
2847 UNREAD (next_next_char);
2848
2849 ok = (next_next_char <= 040
2850 || (next_next_char < 0200
2851 && (strchr ("\"';([#?", next_next_char)
2852 || (!first_in_list && next_next_char == '`')
2853 || (new_backquote_flag && next_next_char == ','))));
2854 }
2855 else
2856 {
2857 ok = (next_char <= 040
2858 || (next_char < 0200
2859 && (strchr ("\"';()[]#?", next_char)
2860 || (!first_in_list && next_char == '`')
2861 || (new_backquote_flag && next_char == ','))));
2862 }
2863 UNREAD (next_char); 2864 UNREAD (next_char);
2864 if (ok) 2865 if (ok)
2865 return make_number (c); 2866 return make_number (c);
@@ -3001,9 +3002,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3001 3002
3002 if (next_char <= 040 3003 if (next_char <= 040
3003 || (next_char < 0200 3004 || (next_char < 0200
3004 && (strchr ("\"';([#?", next_char) 3005 && (strchr ("\"';([#?`,", next_char))))
3005 || (!first_in_list && next_char == '`')
3006 || (new_backquote_flag && next_char == ','))))
3007 { 3006 {
3008 *pch = c; 3007 *pch = c;
3009 return Qnil; 3008 return Qnil;
@@ -3028,9 +3027,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3028 while (c > 040 3027 while (c > 040
3029 && c != 0x8a0 /* NBSP */ 3028 && c != 0x8a0 /* NBSP */
3030 && (c >= 0200 3029 && (c >= 0200
3031 || (!strchr ("\"';()[]#", c) 3030 || !(strchr ("\"';()[]#`,", c))))
3032 && !(!first_in_list && c == '`')
3033 && !(new_backquote_flag && c == ','))))
3034 { 3031 {
3035 if (end - p < MAX_MULTIBYTE_LENGTH) 3032 if (end - p < MAX_MULTIBYTE_LENGTH)
3036 { 3033 {
@@ -4046,9 +4043,9 @@ defalias (sname, string)
4046} 4043}
4047#endif /* NOTDEF */ 4044#endif /* NOTDEF */
4048 4045
4049/* Define an "integer variable"; a symbol whose value is forwarded 4046/* Define an "integer variable"; a symbol whose value is forwarded to a
4050 to a C variable of type int. Sample call: 4047 C variable of type int. Sample call (munged w "xx" to fool make-docfile):
4051 DEFVAR_INT ("emacs-priority", &emacs_priority, "Documentation"); */ 4048 DEFxxVAR_INT ("emacs-priority", &emacs_priority, "Documentation"); */
4052void 4049void
4053defvar_int (struct Lisp_Intfwd *i_fwd, 4050defvar_int (struct Lisp_Intfwd *i_fwd,
4054 const char *namestring, EMACS_INT *address) 4051 const char *namestring, EMACS_INT *address)
@@ -4550,8 +4547,7 @@ to load. See also `load-dangerous-libraries'. */);
4550 doc: /* If non-nil, use lexical binding when evaluating code. 4547 doc: /* If non-nil, use lexical binding when evaluating code.
4551This only applies to code evaluated by `eval-buffer' and `eval-region'. 4548This only applies to code evaluated by `eval-buffer' and `eval-region'.
4552This variable is automatically set from the file variables of an interpreted 4549This variable is automatically set from the file variables of an interpreted
4553 lisp file read using `load'. 4550 lisp file read using `load'. */);
4554This variable automatically becomes buffer-local when set. */);
4555 Fmake_variable_buffer_local (Qlexical_binding); 4551 Fmake_variable_buffer_local (Qlexical_binding);
4556 4552
4557 DEFVAR_LISP ("eval-buffer-list", &Veval_buffer_list, 4553 DEFVAR_LISP ("eval-buffer-list", &Veval_buffer_list,
@@ -4646,5 +4642,3 @@ This variable automatically becomes buffer-local when set. */);
4646 staticpro (&Qrehash_threshold); 4642 staticpro (&Qrehash_threshold);
4647} 4643}
4648 4644
4649/* arch-tag: a0d02733-0f96-4844-a659-9fd53c4f414d
4650 (do not change this comment) */
diff --git a/src/m/alpha.h b/src/m/alpha.h
index 3b6d7da92df..0e7d182fee7 100644
--- a/src/m/alpha.h
+++ b/src/m/alpha.h
@@ -30,13 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30/* __alpha defined automatically */ 30/* __alpha defined automatically */
31 31
32 32
33/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
34 the 24-bit bit field into an int. In other words, if bit fields
35 are always unsigned.
36
37 This flag only matters if you use USE_LISP_UNION_TYPE. */
38#define EXPLICIT_SIGN_EXTEND
39
40/* Data type of load average, as read out of kmem. */ 33/* Data type of load average, as read out of kmem. */
41#define LOAD_AVE_TYPE long 34#define LOAD_AVE_TYPE long
42 35
diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h
index 30aa2678717..867d65f6606 100644
--- a/src/m/amdx86-64.h
+++ b/src/m/amdx86-64.h
@@ -31,13 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#define EMACS_INT long 31#define EMACS_INT long
32#define EMACS_UINT unsigned long 32#define EMACS_UINT unsigned long
33 33
34/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
35 the 24-bit bit field into an int. In other words, if bit fields
36 are always unsigned.
37
38 This flag only matters if you use USE_LISP_UNION_TYPE. */
39#define EXPLICIT_SIGN_EXTEND
40
41/* Data type of load average, as read out of kmem. */ 34/* Data type of load average, as read out of kmem. */
42#define LOAD_AVE_TYPE long 35#define LOAD_AVE_TYPE long
43 36
diff --git a/src/m/arm.h b/src/m/arm.h
deleted file mode 100644
index 8b659bb5bd0..00000000000
--- a/src/m/arm.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* Machine description file for ARM-based non-RISCiX machines.
2
3Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 2009, 2010 Free Software Foundation, Inc.
5
6This file is part of GNU Emacs.
7
8GNU Emacs is free software: you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation, either version 3 of the License, or
11(at your option) any later version.
12
13GNU Emacs is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20
21/* arch-tag: 07856f0c-f0c8-4bd8-99af-0b7fa1e5ee42
22 (do not change this comment) */
diff --git a/src/m/hp800.h b/src/m/hp800.h
deleted file mode 100644
index 9998f701a6b..00000000000
--- a/src/m/hp800.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/* machine description file for hp9000 series 800 machines.
2
3Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 2009, 2010 Free Software Foundation, Inc.
5
6This file is part of GNU Emacs.
7
8GNU Emacs is free software: you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation, either version 3 of the License, or
11(at your option) any later version.
12
13GNU Emacs is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20
21/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
22 the bit field into an int. In other words, if bit fields
23 are always unsigned.
24
25 This flag only matters if you use USE_LISP_UNION_TYPE. */
26#define EXPLICIT_SIGN_EXTEND
27
28/* arch-tag: 809436e6-1645-4b92-b40d-2de5d6e7227c
29 (do not change this comment) */
diff --git a/src/m/ia64.h b/src/m/ia64.h
index bbf09ac878b..e9cf07b6789 100644
--- a/src/m/ia64.h
+++ b/src/m/ia64.h
@@ -31,13 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#define EMACS_INT long 31#define EMACS_INT long
32#define EMACS_UINT unsigned long 32#define EMACS_UINT unsigned long
33 33
34/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
35 the 24-bit bit field into an int. In other words, if bit fields
36 are always unsigned.
37
38 This flag only matters if you use USE_LISP_UNION_TYPE. */
39#define EXPLICIT_SIGN_EXTEND
40
41/* Data type of load average, as read out of kmem. */ 34/* Data type of load average, as read out of kmem. */
42#define LOAD_AVE_TYPE long 35#define LOAD_AVE_TYPE long
43 36
diff --git a/src/m/ibms390.h b/src/m/ibms390.h
index 0acc826a1ea..1a19f7233a0 100644
--- a/src/m/ibms390.h
+++ b/src/m/ibms390.h
@@ -19,13 +19,6 @@ You should have received a copy of the GNU General Public License
19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21 21
22/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
23 the 24-bit bit field into an int. In other words, if bit fields
24 are always unsigned.
25
26 This flag only matters if you use USE_LISP_UNION_TYPE. */
27#define EXPLICIT_SIGN_EXTEND
28
29/* Data type of load average, as read out of kmem. */ 22/* Data type of load average, as read out of kmem. */
30#define LOAD_AVE_TYPE long 23#define LOAD_AVE_TYPE long
31 24
diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h
index 6cbfbbcdbd4..2ef14a22945 100644
--- a/src/m/ibms390x.h
+++ b/src/m/ibms390x.h
@@ -27,13 +27,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#define EMACS_INT long 27#define EMACS_INT long
28#define EMACS_UINT unsigned long 28#define EMACS_UINT unsigned long
29 29
30/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
31 the 24-bit bit field into an int. In other words, if bit fields
32 are always unsigned.
33
34 This flag only matters if you use USE_LISP_UNION_TYPE. */
35#undef EXPLICIT_SIGN_EXTEND
36
37/* On the 64 bit architecture, we can use 60 bits for addresses */ 30/* On the 64 bit architecture, we can use 60 bits for addresses */
38#define VALBITS 60 31#define VALBITS 60
39 32
diff --git a/src/m/iris4d.h b/src/m/iris4d.h
index 31f08d05cfc..9e80324ee92 100644
--- a/src/m/iris4d.h
+++ b/src/m/iris4d.h
@@ -19,13 +19,6 @@ You should have received a copy of the GNU General Public License
19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21 21
22/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
23 the bit field into an int. In other words, if bit fields
24 are always unsigned.
25
26 This flag only matters if you use USE_LISP_UNION_TYPE. */
27#define EXPLICIT_SIGN_EXTEND
28
29/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which 22/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which
30 were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for 23 were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for
31 the value field of a LISP_OBJECT). */ 24 the value field of a LISP_OBJECT). */
diff --git a/src/m/m68k.h b/src/m/m68k.h
index 8d53424ccec..df930d511f7 100644
--- a/src/m/m68k.h
+++ b/src/m/m68k.h
@@ -24,13 +24,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
24#define m68k 24#define m68k
25#endif 25#endif
26 26
27/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
28 the 24-bit bit field into an int. In other words, if bit fields
29 are always unsigned.
30
31 This flag only matters if you use USE_LISP_UNION_TYPE. */
32#define EXPLICIT_SIGN_EXTEND
33
34#ifdef GNU_LINUX 27#ifdef GNU_LINUX
35#ifdef __ELF__ 28#ifdef __ELF__
36#define DATA_SEG_BITS 0x80000000 29#define DATA_SEG_BITS 0x80000000
diff --git a/src/m/mips.h b/src/m/mips.h
deleted file mode 100644
index b3a754c2b61..00000000000
--- a/src/m/mips.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/* m- file for Mips machines.
2
3Copyright (C) 1987, 1992, 1999, 2001, 2002, 2003, 2004, 2005, 2006,
4 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5
6This file is part of GNU Emacs.
7
8GNU Emacs is free software: you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation, either version 3 of the License, or
11(at your option) any later version.
12
13GNU Emacs is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20
21/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
22 the 24-bit bit field into an int. In other words, if bit fields
23 are always unsigned.
24
25 This flag only matters if you use USE_LISP_UNION_TYPE. */
26#define EXPLICIT_SIGN_EXTEND
27
28/* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee
29 (do not change this comment) */
diff --git a/src/m/sh3.h b/src/m/sh3.h
deleted file mode 100644
index ebfdb5b2d64..00000000000
--- a/src/m/sh3.h
+++ /dev/null
@@ -1,4 +0,0 @@
1/* Machine description file for SuperH. */
2
3/* arch-tag: 1b01b84f-f044-4afa-aa4b-caa54ec38966
4 (do not change this comment) */
diff --git a/src/m/sparc.h b/src/m/sparc.h
index 26ca3caaebe..fc5ea95c0eb 100644
--- a/src/m/sparc.h
+++ b/src/m/sparc.h
@@ -20,10 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21/* __sparc__ is defined by the compiler by default. */ 21/* __sparc__ is defined by the compiler by default. */
22 22
23/* XINT must explicitly sign-extend
24 This flag only matters if you use USE_LISP_UNION_TYPE. */
25#define EXPLICIT_SIGN_EXTEND
26
27/* Data type of load average, as read out of kmem. */ 23/* Data type of load average, as read out of kmem. */
28#define LOAD_AVE_TYPE long 24#define LOAD_AVE_TYPE long
29 25
diff --git a/src/m/template.h b/src/m/template.h
index 4efc9158a45..0d8e78622a6 100644
--- a/src/m/template.h
+++ b/src/m/template.h
@@ -22,13 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 does not define it automatically. 22 does not define it automatically.
23 Ones defined so far include m68k and many others */ 23 Ones defined so far include m68k and many others */
24 24
25/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
26 the 24-bit bit field into an int. In other words, if bit fields
27 are always unsigned.
28
29 This flag only matters if you use USE_LISP_UNION_TYPE. */
30#define EXPLICIT_SIGN_EXTEND
31
32/* Data type of load average, as read out of kmem. */ 25/* Data type of load average, as read out of kmem. */
33#define LOAD_AVE_TYPE long 26#define LOAD_AVE_TYPE long
34 27
diff --git a/src/m/xtensa.h b/src/m/xtensa.h
deleted file mode 100644
index 8e1da54b25b..00000000000
--- a/src/m/xtensa.h
+++ /dev/null
@@ -1,6 +0,0 @@
1/* Machine description file for Tensilica Xtensa.
2
3Add a license notice if this grows to > 10 lines of code. */
4
5/* arch-tag: fe5872de-d565-4d81-8fe0-ea19865b3e6a
6 (do not change this comment) */
diff --git a/src/minibuf.c b/src/minibuf.c
index f3a24afc199..0f3def614f2 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -36,8 +36,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
36#include "keymap.h" 36#include "keymap.h"
37#include "termhooks.h" 37#include "termhooks.h"
38 38
39extern int quit_char;
40
41/* List of buffers for use as minibuffers. 39/* List of buffers for use as minibuffers.
42 The first element of the list is used for the outermost minibuffer 40 The first element of the list is used for the outermost minibuffer
43 invocation, the next element is used for a recursive minibuffer 41 invocation, the next element is used for a recursive minibuffer
@@ -2242,5 +2240,3 @@ properties. */);
2242 defsubr (&Scompleting_read); 2240 defsubr (&Scompleting_read);
2243} 2241}
2244 2242
2245/* arch-tag: 8f69b601-fba3-484c-a6dd-ceaee54a7a73
2246 (do not change this comment) */
diff --git a/src/mktime.c b/src/mktime.c
index 3570cecd451..ede151981f4 100644
--- a/src/mktime.c
+++ b/src/mktime.c
@@ -110,9 +110,7 @@ const unsigned short int __mon_yday[2][13] =
110 localtime to localtime_r, since many localtime_r implementations 110 localtime to localtime_r, since many localtime_r implementations
111 are buggy. */ 111 are buggy. */
112static struct tm * 112static struct tm *
113my_mktime_localtime_r (t, tp) 113my_mktime_localtime_r (const time_t *t, struct tm *tp)
114 const time_t *t;
115 struct tm *tp;
116{ 114{
117 struct tm *l = localtime (t); 115 struct tm *l = localtime (t);
118 if (! l) 116 if (! l)
@@ -130,9 +128,7 @@ my_mktime_localtime_r (t, tp)
130 If TP is null, return a nonzero value. 128 If TP is null, return a nonzero value.
131 If overflow occurs, yield the low order bits of the correct answer. */ 129 If overflow occurs, yield the low order bits of the correct answer. */
132static time_t 130static time_t
133ydhms_tm_diff (year, yday, hour, min, sec, tp) 131ydhms_tm_diff (int year, int yday, int hour, int min, int sec, const struct tm *tp)
134 int year, yday, hour, min, sec;
135 const struct tm *tp;
136{ 132{
137 if (!tp) 133 if (!tp)
138 return 1; 134 return 1;
@@ -163,14 +159,8 @@ ydhms_tm_diff (year, yday, hour, min, sec, tp)
163 If *T is out of range for conversion, adjust it so that 159 If *T is out of range for conversion, adjust it so that
164 it is the nearest in-range value and then convert that. */ 160 it is the nearest in-range value and then convert that. */
165static struct tm * 161static struct tm *
166ranged_convert (convert, t, tp) 162ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
167#ifdef PROTOTYPES 163 time_t *t, struct tm *tp)
168 struct tm *(*convert) (const time_t *, struct tm *);
169#else
170 struct tm *(*convert)();
171#endif
172 time_t *t;
173 struct tm *tp;
174{ 164{
175 struct tm *r; 165 struct tm *r;
176 166
@@ -217,14 +207,8 @@ ranged_convert (convert, t, tp)
217 compared to what the result would be for UTC without leap seconds. 207 compared to what the result would be for UTC without leap seconds.
218 If *OFFSET's guess is correct, only one CONVERT call is needed. */ 208 If *OFFSET's guess is correct, only one CONVERT call is needed. */
219time_t 209time_t
220__mktime_internal (tp, convert, offset) 210__mktime_internal (struct tm *tp, struct tm *(*convert) (const time_t *, struct tm *),
221 struct tm *tp; 211 time_t *offset)
222#ifdef PROTOTYPES
223 struct tm *(*convert) (const time_t *, struct tm *);
224#else
225 struct tm *(*convert)();
226#endif
227 time_t *offset;
228{ 212{
229 time_t t, dt, t0, t1, t2; 213 time_t t, dt, t0, t1, t2;
230 struct tm tm; 214 struct tm tm;
@@ -558,5 +542,3 @@ compile-command: "gcc -DDEBUG -DHAVE_LIMITS_H -DSTDC_HEADERS -Wall -W -O -g mkti
558End: 542End:
559*/ 543*/
560 544
561/* arch-tag: 9456752f-7ddd-47cb-8286-fa807b1355ae
562 (do not change this comment) */
diff --git a/src/msdos.c b/src/msdos.c
index 0957221f597..0f9a2ff29e5 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -584,14 +584,14 @@ dos_set_window_size (int *rows, int *cols)
584 if (current_rows != *rows || current_cols != *cols) 584 if (current_rows != *rows || current_cols != *cols)
585 { 585 {
586 struct frame *f = SELECTED_FRAME(); 586 struct frame *f = SELECTED_FRAME();
587 struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 587 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
588 Lisp_Object window = dpyinfo->mouse_face_window; 588 Lisp_Object window = hlinfo->mouse_face_window;
589 589
590 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) 590 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f)
591 { 591 {
592 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 592 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
593 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 593 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
594 dpyinfo->mouse_face_window = Qnil; 594 hlinfo->mouse_face_window = Qnil;
595 } 595 }
596 } 596 }
597 597
@@ -941,551 +941,79 @@ static Lisp_Object last_mouse_window;
941 941
942static int mouse_preempted = 0; /* non-zero when XMenu gobbles mouse events */ 942static int mouse_preempted = 0; /* non-zero when XMenu gobbles mouse events */
943 943
944/* Set the mouse pointer shape according to whether it is in the 944int
945 area where the mouse highlight is in effect. */ 945popup_activated (void)
946static void
947IT_set_mouse_pointer (int mode)
948{ 946{
949 /* A no-op for now. DOS text-mode mouse pointer doesn't offer too 947 return mouse_preempted;
950 many possibilities to change its shape, and the available
951 functionality pretty much sucks (e.g., almost every reasonable
952 shape will conceal the character it is on). Since the color of
953 the pointer changes in the highlighted area, it is not clear to
954 me whether anything else is required, anyway. */
955} 948}
956 949
957/* Display the active region described by mouse_face_* 950/* Draw TEXT_AREA glyphs between START and END of glyph row ROW on
958 in its mouse-face if HL > 0, in its normal face if HL = 0. */ 951 window W. X is relative to TEXT_AREA in W. HL is a face override
959static void 952 for drawing the glyphs. */
960show_mouse_face (struct tty_display_info *dpyinfo, int hl) 953void
954tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row,
955 int start_hpos, int end_hpos,
956 enum draw_glyphs_face hl)
961{ 957{
962 struct window *w = XWINDOW (dpyinfo->mouse_face_window);
963 struct frame *f = XFRAME (WINDOW_FRAME (w)); 958 struct frame *f = XFRAME (WINDOW_FRAME (w));
964 int i;
965 struct face *fp;
966 struct tty_display_info *tty = FRAME_TTY (f); 959 struct tty_display_info *tty = FRAME_TTY (f);
960 Mouse_HLInfo *hlinfo = &tty->mouse_highlight;
967 961
968 962 if (hl == DRAW_MOUSE_FACE)
969 /* If window is in the process of being destroyed, don't bother
970 doing anything. */
971 if (w->current_matrix == NULL)
972 goto set_cursor_shape;
973
974 /* Recognize when we are called to operate on rows that don't exist
975 anymore. This can happen when a window is split. */
976 if (dpyinfo->mouse_face_end_row >= w->current_matrix->nrows)
977 goto set_cursor_shape;
978
979 /* There's no sense to do anything if the mouse face isn't realized. */
980 if (hl > 0)
981 {
982 if (dpyinfo->mouse_face_hidden)
983 goto set_cursor_shape;
984
985 fp = FACE_FROM_ID (SELECTED_FRAME(), dpyinfo->mouse_face_face_id);
986 if (!fp)
987 goto set_cursor_shape;
988 }
989
990 /* Note that mouse_face_beg_row etc. are window relative. */
991 for (i = dpyinfo->mouse_face_beg_row;
992 i <= dpyinfo->mouse_face_end_row;
993 i++)
994 {
995 int start_hpos, end_hpos;
996 struct glyph_row *row = MATRIX_ROW (w->current_matrix, i);
997
998 /* Don't do anything if row doesn't have valid contents. */
999 if (!row->enabled_p)
1000 continue;
1001
1002 /* For all but the first row, the highlight starts at column 0. */
1003 if (i == dpyinfo->mouse_face_beg_row)
1004 start_hpos = dpyinfo->mouse_face_beg_col;
1005 else
1006 start_hpos = 0;
1007
1008 if (i == dpyinfo->mouse_face_end_row)
1009 end_hpos = dpyinfo->mouse_face_end_col;
1010 else
1011 end_hpos = row->used[TEXT_AREA];
1012
1013 if (end_hpos <= start_hpos)
1014 continue;
1015 /* Record that some glyphs of this row are displayed in
1016 mouse-face. */
1017 row->mouse_face_p = hl > 0;
1018 if (hl > 0)
1019 {
1020 int vpos = row->y + WINDOW_TOP_EDGE_Y (w);
1021 int kstart = start_hpos + WINDOW_LEFT_EDGE_X (w);
1022 int nglyphs = end_hpos - start_hpos;
1023 int offset = ScreenPrimary + 2*(vpos*screen_size_X + kstart) + 1;
1024 int start_offset = offset;
1025
1026 if (tty->termscript)
1027 fprintf (tty->termscript, "\n<MH+ %d-%d:%d>",
1028 kstart, kstart + nglyphs - 1, vpos);
1029
1030 mouse_off ();
1031 IT_set_face (dpyinfo->mouse_face_face_id);
1032 /* Since we are going to change only the _colors_ of the
1033 displayed text, there's no need to go through all the
1034 pain of generating and encoding the text from the glyphs.
1035 Instead, we simply poke the attribute byte of each
1036 affected position in video memory with the colors
1037 computed by IT_set_face! */
1038 _farsetsel (_dos_ds);
1039 while (nglyphs--)
1040 {
1041 _farnspokeb (offset, ScreenAttrib);
1042 offset += 2;
1043 }
1044 if (screen_virtual_segment)
1045 dosv_refresh_virtual_screen (start_offset, end_hpos - start_hpos);
1046 mouse_on ();
1047 }
1048 else
1049 {
1050 /* We are removing a previously-drawn mouse highlight. The
1051 safest way to do so is to redraw the glyphs anew, since
1052 all kinds of faces and display tables could have changed
1053 behind our back. */
1054 int nglyphs = end_hpos - start_hpos;
1055 int save_x = new_pos_X, save_y = new_pos_Y;
1056
1057 if (end_hpos >= row->used[TEXT_AREA])
1058 nglyphs = row->used[TEXT_AREA] - start_hpos;
1059
1060 /* IT_write_glyphs writes at cursor position, so we need to
1061 temporarily move cursor coordinates to the beginning of
1062 the highlight region. */
1063 new_pos_X = start_hpos + WINDOW_LEFT_EDGE_X (w);
1064 new_pos_Y = row->y + WINDOW_TOP_EDGE_Y (w);
1065
1066 if (tty->termscript)
1067 fprintf (tty->termscript, "<MH- %d-%d:%d>",
1068 new_pos_X, new_pos_X + nglyphs - 1, new_pos_Y);
1069 IT_write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs);
1070 if (tty->termscript)
1071 fputs ("\n", tty->termscript);
1072 new_pos_X = save_x;
1073 new_pos_Y = save_y;
1074 }
1075 }
1076
1077 set_cursor_shape:
1078 /* Change the mouse pointer shape. */
1079 IT_set_mouse_pointer (hl);
1080}
1081
1082/* Clear out the mouse-highlighted active region.
1083 Redraw it un-highlighted first. */
1084static void
1085clear_mouse_face (struct tty_display_info *dpyinfo)
1086{
1087 if (!dpyinfo->mouse_face_hidden && ! NILP (dpyinfo->mouse_face_window))
1088 show_mouse_face (dpyinfo, 0);
1089
1090 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
1091 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
1092 dpyinfo->mouse_face_window = Qnil;
1093}
1094
1095/* Find the glyph matrix position of buffer position POS in window W.
1096 *HPOS and *VPOS are set to the positions found. W's current glyphs
1097 must be up to date. If POS is above window start return (0, 0).
1098 If POS is after end of W, return end of last line in W. */
1099static int
1100fast_find_position (struct window *w, int pos, int *hpos, int *vpos)
1101{
1102 int i, lastcol, line_start_position, maybe_next_line_p = 0;
1103 int yb = window_text_bottom_y (w);
1104 struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row;
1105
1106 while (row->y < yb)
1107 {
1108 if (row->used[TEXT_AREA])
1109 line_start_position = row->glyphs[TEXT_AREA]->charpos;
1110 else
1111 line_start_position = 0;
1112
1113 if (line_start_position > pos)
1114 break;
1115 /* If the position sought is the end of the buffer,
1116 don't include the blank lines at the bottom of the window. */
1117 else if (line_start_position == pos
1118 && pos == BUF_ZV (XBUFFER (w->buffer)))
1119 {
1120 maybe_next_line_p = 1;
1121 break;
1122 }
1123 else if (line_start_position > 0)
1124 best_row = row;
1125
1126 /* Don't overstep the last matrix row, lest we get into the
1127 never-never land... */
1128 if (row->y + 1 >= yb)
1129 break;
1130
1131 ++row;
1132 }
1133
1134 /* Find the right column within BEST_ROW. */
1135 lastcol = 0;
1136 row = best_row;
1137 for (i = 0; i < row->used[TEXT_AREA]; i++)
1138 { 963 {
1139 struct glyph *glyph = row->glyphs[TEXT_AREA] + i; 964 int vpos = row->y + WINDOW_TOP_EDGE_Y (w);
1140 int charpos; 965 int kstart = start_hpos + WINDOW_LEFT_EDGE_X (w);
966 int nglyphs = end_hpos - start_hpos;
967 int offset = ScreenPrimary + 2*(vpos*screen_size_X + kstart) + 1;
968 int start_offset = offset;
1141 969
1142 charpos = glyph->charpos; 970 if (tty->termscript)
1143 if (charpos == pos) 971 fprintf (tty->termscript, "\n<MH+ %d-%d:%d>",
1144 { 972 kstart, kstart + nglyphs - 1, vpos);
1145 *hpos = i;
1146 *vpos = row->y;
1147 return 1;
1148 }
1149 else if (charpos > pos)
1150 break;
1151 else if (charpos > 0)
1152 lastcol = i;
1153 }
1154
1155 /* If we're looking for the end of the buffer,
1156 and we didn't find it in the line we scanned,
1157 use the start of the following line. */
1158 if (maybe_next_line_p)
1159 {
1160 ++row;
1161 lastcol = 0;
1162 }
1163
1164 *vpos = row->y;
1165 *hpos = lastcol + 1;
1166 return 0;
1167}
1168
1169/* Take proper action when mouse has moved to the mode or top line of
1170 window W, x-position X. MODE_LINE_P non-zero means mouse is on the
1171 mode line. X is relative to the start of the text display area of
1172 W, so the width of fringes and scroll bars must be subtracted
1173 to get a position relative to the start of the mode line. */
1174static void
1175IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p)
1176{
1177 struct glyph_row *row;
1178
1179 if (mode_line_p)
1180 row = MATRIX_MODE_LINE_ROW (w->current_matrix);
1181 else
1182 row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
1183 973
1184 if (row->enabled_p) 974 mouse_off ();
1185 { 975 IT_set_face (hlinfo->mouse_face_face_id);
1186 struct glyph *glyph, *end; 976 /* Since we are going to change only the _colors_ of already
1187 Lisp_Object help; 977 displayed text, there's no need to go through all the pain of
1188 978 generating and encoding the text from the glyphs. Instead,
1189 /* Find the glyph under X. */ 979 we simply poke the attribute byte of each affected position
1190 glyph = (row->glyphs[TEXT_AREA] 980 in video memory with the colors computed by IT_set_face! */
1191 + x 981 _farsetsel (_dos_ds);
1192 /* in case someone implements scroll bars some day... */ 982 while (nglyphs--)
1193 - WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w));
1194 end = glyph + row->used[TEXT_AREA];
1195 if (glyph < end
1196 && STRINGP (glyph->object)
1197 && STRING_INTERVALS (glyph->object)
1198 && glyph->charpos >= 0
1199 && glyph->charpos < SCHARS (glyph->object))
1200 { 983 {
1201 /* If we're on a string with `help-echo' text property, 984 _farnspokeb (offset, ScreenAttrib);
1202 arrange for the help to be displayed. This is done by 985 offset += 2;
1203 setting the global variable help_echo to the help string. */
1204 help = Fget_text_property (make_number (glyph->charpos),
1205 Qhelp_echo, glyph->object);
1206 if (!NILP (help))
1207 {
1208 help_echo_string = help;
1209 XSETWINDOW (help_echo_window, w);
1210 help_echo_object = glyph->object;
1211 help_echo_pos = glyph->charpos;
1212 }
1213 } 986 }
987 if (screen_virtual_segment)
988 dosv_refresh_virtual_screen (start_offset, end_hpos - start_hpos);
989 mouse_on ();
1214 } 990 }
1215} 991 else if (hl == DRAW_NORMAL_TEXT)
1216
1217/* Take proper action when the mouse has moved to position X, Y on
1218 frame F as regards highlighting characters that have mouse-face
1219 properties. Also de-highlighting chars where the mouse was before.
1220 X and Y can be negative or out of range. */
1221static void
1222IT_note_mouse_highlight (struct frame *f, int x, int y)
1223{
1224 struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
1225 enum window_part part = ON_NOTHING;
1226 Lisp_Object window;
1227 struct window *w;
1228
1229 /* When a menu is active, don't highlight because this looks odd. */
1230 if (mouse_preempted)
1231 return;
1232
1233 if (NILP (Vmouse_highlight)
1234 || !f->glyphs_initialized_p)
1235 return;
1236
1237 dpyinfo->mouse_face_mouse_x = x;
1238 dpyinfo->mouse_face_mouse_y = y;
1239 dpyinfo->mouse_face_mouse_frame = f;
1240
1241 if (dpyinfo->mouse_face_defer)
1242 return;
1243
1244 if (gc_in_progress)
1245 {
1246 dpyinfo->mouse_face_deferred_gc = 1;
1247 return;
1248 }
1249
1250 /* Which window is that in? */
1251 window = window_from_coordinates (f, x, y, &part, &x, &y, 0);
1252
1253 /* If we were displaying active text in another window, clear that. */
1254 if (! EQ (window, dpyinfo->mouse_face_window))
1255 clear_mouse_face (dpyinfo);
1256
1257 /* Not on a window -> return. */
1258 if (!WINDOWP (window))
1259 return;
1260
1261 /* Convert to window-relative coordinates. */
1262 w = XWINDOW (window);
1263
1264 if (part == ON_MODE_LINE || part == ON_HEADER_LINE)
1265 {
1266 /* Mouse is on the mode or top line. */
1267 IT_note_mode_line_highlight (w, x, part == ON_MODE_LINE);
1268 return;
1269 }
1270
1271 IT_set_mouse_pointer (0);
1272
1273 /* Are we in a window whose display is up to date?
1274 And verify the buffer's text has not changed. */
1275 if (part == ON_TEXT
1276 && EQ (w->window_end_valid, w->buffer)
1277 && XFASTINT (w->last_modified) == BUF_MODIFF (XBUFFER (w->buffer))
1278 && (XFASTINT (w->last_overlay_modified)
1279 == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer))))
1280 { 992 {
1281 int pos, i, nrows = w->current_matrix->nrows; 993 /* We are removing a previously-drawn mouse highlight. The
1282 struct glyph_row *row; 994 safest way to do so is to redraw the glyphs anew, since all
1283 struct glyph *glyph; 995 kinds of faces and display tables could have changed behind
1284 996 our back. */
1285 /* Find the glyph under X/Y. */ 997 int nglyphs = end_hpos - start_hpos;
1286 glyph = NULL; 998 int save_x = new_pos_X, save_y = new_pos_Y;
1287 if (y >= 0 && y < nrows) 999
1288 { 1000 if (end_hpos >= row->used[TEXT_AREA])
1289 row = MATRIX_ROW (w->current_matrix, y); 1001 nglyphs = row->used[TEXT_AREA] - start_hpos;
1290 /* Give up if some row before the one we are looking for is 1002
1291 not enabled. */ 1003 /* IT_write_glyphs writes at cursor position, so we need to
1292 for (i = 0; i <= y; i++) 1004 temporarily move cursor coordinates to the beginning of
1293 if (!MATRIX_ROW (w->current_matrix, i)->enabled_p) 1005 the highlight region. */
1294 break; 1006 new_pos_X = start_hpos + WINDOW_LEFT_EDGE_X (w);
1295 if (i > y /* all rows upto and including the one at Y are enabled */ 1007 new_pos_Y = row->y + WINDOW_TOP_EDGE_Y (w);
1296 && row->displays_text_p
1297 && x < window_box_width (w, TEXT_AREA))
1298 {
1299 glyph = row->glyphs[TEXT_AREA];
1300 if (x >= row->used[TEXT_AREA])
1301 glyph = NULL;
1302 else
1303 {
1304 glyph += x;
1305 if (!BUFFERP (glyph->object))
1306 glyph = NULL;
1307 }
1308 }
1309 }
1310 1008
1311 /* Clear mouse face if X/Y not over text. */ 1009 if (tty->termscript)
1312 if (glyph == NULL) 1010 fprintf (tty->termscript, "<MH- %d-%d:%d>",
1313 { 1011 new_pos_X, new_pos_X + nglyphs - 1, new_pos_Y);
1314 clear_mouse_face (dpyinfo); 1012 IT_write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs);
1315 return; 1013 if (tty->termscript)
1316 } 1014 fputs ("\n", tty->termscript);
1317 1015 new_pos_X = save_x;
1318 if (!BUFFERP (glyph->object)) 1016 new_pos_Y = save_y;
1319 abort ();
1320 pos = glyph->charpos;
1321
1322 /* Check for mouse-face and help-echo. */
1323 {
1324 Lisp_Object mouse_face, overlay, position, *overlay_vec;
1325 int noverlays, obegv, ozv;
1326 struct buffer *obuf;
1327
1328 /* If we get an out-of-range value, return now; avoid an error. */
1329 if (pos > BUF_Z (XBUFFER (w->buffer)))
1330 return;
1331
1332 /* Make the window's buffer temporarily current for
1333 overlays_at and compute_char_face. */
1334 obuf = current_buffer;
1335 current_buffer = XBUFFER (w->buffer);
1336 obegv = BEGV;
1337 ozv = ZV;
1338 BEGV = BEG;
1339 ZV = Z;
1340
1341 /* Is this char mouse-active or does it have help-echo? */
1342 XSETINT (position, pos);
1343
1344 /* Put all the overlays we want in a vector in overlay_vec. */
1345 GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0);
1346 /* Sort overlays into increasing priority order. */
1347 noverlays = sort_overlays (overlay_vec, noverlays, w);
1348
1349 /* Check mouse-face highlighting. */
1350 if (! (EQ (window, dpyinfo->mouse_face_window)
1351 && y >= dpyinfo->mouse_face_beg_row
1352 && y <= dpyinfo->mouse_face_end_row
1353 && (y > dpyinfo->mouse_face_beg_row
1354 || x >= dpyinfo->mouse_face_beg_col)
1355 && (y < dpyinfo->mouse_face_end_row
1356 || x < dpyinfo->mouse_face_end_col
1357 || dpyinfo->mouse_face_past_end)))
1358 {
1359 /* Clear the display of the old active region, if any. */
1360 clear_mouse_face (dpyinfo);
1361
1362 /* Find highest priority overlay that has a mouse-face prop. */
1363 overlay = Qnil;
1364 for (i = noverlays - 1; i >= 0; --i)
1365 {
1366 mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face);
1367 if (!NILP (mouse_face))
1368 {
1369 overlay = overlay_vec[i];
1370 break;
1371 }
1372 }
1373
1374 /* If no overlay applies, get a text property. */
1375 if (NILP (overlay))
1376 mouse_face = Fget_text_property (position, Qmouse_face,
1377 w->buffer);
1378
1379 /* Handle the overlay case. */
1380 if (! NILP (overlay))
1381 {
1382 /* Find the range of text around this char that
1383 should be active. */
1384 Lisp_Object before, after;
1385 EMACS_INT ignore;
1386
1387 before = Foverlay_start (overlay);
1388 after = Foverlay_end (overlay);
1389 /* Record this as the current active region. */
1390 fast_find_position (w, XFASTINT (before),
1391 &dpyinfo->mouse_face_beg_col,
1392 &dpyinfo->mouse_face_beg_row);
1393 dpyinfo->mouse_face_past_end
1394 = !fast_find_position (w, XFASTINT (after),
1395 &dpyinfo->mouse_face_end_col,
1396 &dpyinfo->mouse_face_end_row);
1397 dpyinfo->mouse_face_window = window;
1398 dpyinfo->mouse_face_face_id
1399 = face_at_buffer_position (w, pos, 0, 0,
1400 &ignore, pos + 1,
1401 !dpyinfo->mouse_face_hidden,
1402 -1);
1403
1404 /* Display it as active. */
1405 show_mouse_face (dpyinfo, 1);
1406 }
1407 /* Handle the text property case. */
1408 else if (! NILP (mouse_face))
1409 {
1410 /* Find the range of text around this char that
1411 should be active. */
1412 Lisp_Object before, after, beginning, end;
1413 EMACS_INT ignore;
1414
1415 beginning = Fmarker_position (w->start);
1416 XSETINT (end, (BUF_Z (XBUFFER (w->buffer))
1417 - XFASTINT (w->window_end_pos)));
1418 before
1419 = Fprevious_single_property_change (make_number (pos + 1),
1420 Qmouse_face,
1421 w->buffer, beginning);
1422 after
1423 = Fnext_single_property_change (position, Qmouse_face,
1424 w->buffer, end);
1425 /* Record this as the current active region. */
1426 fast_find_position (w, XFASTINT (before),
1427 &dpyinfo->mouse_face_beg_col,
1428 &dpyinfo->mouse_face_beg_row);
1429 dpyinfo->mouse_face_past_end
1430 = !fast_find_position (w, XFASTINT (after),
1431 &dpyinfo->mouse_face_end_col,
1432 &dpyinfo->mouse_face_end_row);
1433 dpyinfo->mouse_face_window = window;
1434 dpyinfo->mouse_face_face_id
1435 = face_at_buffer_position (w, pos, 0, 0,
1436 &ignore, pos + 1,
1437 !dpyinfo->mouse_face_hidden,
1438 -1);
1439
1440 /* Display it as active. */
1441 show_mouse_face (dpyinfo, 1);
1442 }
1443 }
1444
1445 /* Look for a `help-echo' property. */
1446 {
1447 Lisp_Object help;
1448
1449 /* Check overlays first. */
1450 help = Qnil;
1451 for (i = noverlays - 1; i >= 0 && NILP (help); --i)
1452 {
1453 overlay = overlay_vec[i];
1454 help = Foverlay_get (overlay, Qhelp_echo);
1455 }
1456
1457 if (!NILP (help))
1458 {
1459 help_echo_string = help;
1460 help_echo_window = window;
1461 help_echo_object = overlay;
1462 help_echo_pos = pos;
1463 }
1464 /* Try text properties. */
1465 else if (NILP (help)
1466 && ((STRINGP (glyph->object)
1467 && glyph->charpos >= 0
1468 && glyph->charpos < SCHARS (glyph->object))
1469 || (BUFFERP (glyph->object)
1470 && glyph->charpos >= BEGV
1471 && glyph->charpos < ZV)))
1472 {
1473 help = Fget_text_property (make_number (glyph->charpos),
1474 Qhelp_echo, glyph->object);
1475 if (!NILP (help))
1476 {
1477 help_echo_string = help;
1478 help_echo_window = window;
1479 help_echo_object = glyph->object;
1480 help_echo_pos = glyph->charpos;
1481 }
1482 }
1483 }
1484
1485 BEGV = obegv;
1486 ZV = ozv;
1487 current_buffer = obuf;
1488 }
1489 } 1017 }
1490} 1018}
1491 1019
@@ -1689,7 +1217,8 @@ static void
1689IT_update_begin (struct frame *f) 1217IT_update_begin (struct frame *f)
1690{ 1218{
1691 struct tty_display_info *display_info = FRAME_X_DISPLAY_INFO (f); 1219 struct tty_display_info *display_info = FRAME_X_DISPLAY_INFO (f);
1692 struct frame *mouse_face_frame = display_info->mouse_face_mouse_frame; 1220 Mouse_HLInfo *hlinfo = &display_info->mouse_highlight;
1221 struct frame *mouse_face_frame = hlinfo->mouse_face_mouse_frame;
1693 1222
1694 if (display_info->termscript) 1223 if (display_info->termscript)
1695 fprintf (display_info->termscript, "\n\n<UPDATE_BEGIN"); 1224 fprintf (display_info->termscript, "\n\n<UPDATE_BEGIN");
@@ -1699,28 +1228,28 @@ IT_update_begin (struct frame *f)
1699 if (f && f == mouse_face_frame) 1228 if (f && f == mouse_face_frame)
1700 { 1229 {
1701 /* Don't do highlighting for mouse motion during the update. */ 1230 /* Don't do highlighting for mouse motion during the update. */
1702 display_info->mouse_face_defer = 1; 1231 hlinfo->mouse_face_defer = 1;
1703 1232
1704 /* If F needs to be redrawn, simply forget about any prior mouse 1233 /* If F needs to be redrawn, simply forget about any prior mouse
1705 highlighting. */ 1234 highlighting. */
1706 if (FRAME_GARBAGED_P (f)) 1235 if (FRAME_GARBAGED_P (f))
1707 display_info->mouse_face_window = Qnil; 1236 hlinfo->mouse_face_window = Qnil;
1708 1237
1709 /* Can we tell that this update does not affect the window 1238 /* Can we tell that this update does not affect the window
1710 where the mouse highlight is? If so, no need to turn off. 1239 where the mouse highlight is? If so, no need to turn off.
1711 Likewise, don't do anything if none of the enabled rows 1240 Likewise, don't do anything if none of the enabled rows
1712 contains glyphs highlighted in mouse face. */ 1241 contains glyphs highlighted in mouse face. */
1713 if (!NILP (display_info->mouse_face_window) 1242 if (!NILP (hlinfo->mouse_face_window)
1714 && WINDOWP (display_info->mouse_face_window)) 1243 && WINDOWP (hlinfo->mouse_face_window))
1715 { 1244 {
1716 struct window *w = XWINDOW (display_info->mouse_face_window); 1245 struct window *w = XWINDOW (hlinfo->mouse_face_window);
1717 int i; 1246 int i;
1718 1247
1719 /* If the mouse highlight is in the window that was deleted 1248 /* If the mouse highlight is in the window that was deleted
1720 (e.g., if it was popped by completion), clear highlight 1249 (e.g., if it was popped by completion), clear highlight
1721 unconditionally. */ 1250 unconditionally. */
1722 if (NILP (w->buffer)) 1251 if (NILP (w->buffer))
1723 display_info->mouse_face_window = Qnil; 1252 hlinfo->mouse_face_window = Qnil;
1724 else 1253 else
1725 { 1254 {
1726 for (i = 0; i < w->desired_matrix->nrows; ++i) 1255 for (i = 0; i < w->desired_matrix->nrows; ++i)
@@ -1730,18 +1259,18 @@ IT_update_begin (struct frame *f)
1730 } 1259 }
1731 1260
1732 if (NILP (w->buffer) || i < w->desired_matrix->nrows) 1261 if (NILP (w->buffer) || i < w->desired_matrix->nrows)
1733 clear_mouse_face (display_info); 1262 clear_mouse_face (hlinfo);
1734 } 1263 }
1735 } 1264 }
1736 else if (mouse_face_frame && !FRAME_LIVE_P (mouse_face_frame)) 1265 else if (mouse_face_frame && !FRAME_LIVE_P (mouse_face_frame))
1737 { 1266 {
1738 /* If the frame with mouse highlight was deleted, invalidate the 1267 /* If the frame with mouse highlight was deleted, invalidate the
1739 highlight info. */ 1268 highlight info. */
1740 display_info->mouse_face_beg_row = display_info->mouse_face_beg_col = -1; 1269 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
1741 display_info->mouse_face_end_row = display_info->mouse_face_end_col = -1; 1270 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
1742 display_info->mouse_face_window = Qnil; 1271 hlinfo->mouse_face_window = Qnil;
1743 display_info->mouse_face_deferred_gc = 0; 1272 hlinfo->mouse_face_deferred_gc = 0;
1744 display_info->mouse_face_mouse_frame = NULL; 1273 hlinfo->mouse_face_mouse_frame = NULL;
1745 } 1274 }
1746 1275
1747 UNBLOCK_INPUT; 1276 UNBLOCK_INPUT;
@@ -1754,25 +1283,25 @@ IT_update_end (struct frame *f)
1754 1283
1755 if (dpyinfo->termscript) 1284 if (dpyinfo->termscript)
1756 fprintf (dpyinfo->termscript, "\n<UPDATE_END\n"); 1285 fprintf (dpyinfo->termscript, "\n<UPDATE_END\n");
1757 dpyinfo->mouse_face_defer = 0; 1286 dpyinfo->mouse_highlight.mouse_face_defer = 0;
1758} 1287}
1759 1288
1760static void 1289static void
1761IT_frame_up_to_date (struct frame *f) 1290IT_frame_up_to_date (struct frame *f)
1762{ 1291{
1763 struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 1292 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
1764 Lisp_Object new_cursor, frame_desired_cursor; 1293 Lisp_Object new_cursor, frame_desired_cursor;
1765 struct window *sw; 1294 struct window *sw;
1766 1295
1767 if (dpyinfo->mouse_face_deferred_gc 1296 if (hlinfo->mouse_face_deferred_gc
1768 || (f && f == dpyinfo->mouse_face_mouse_frame)) 1297 || (f && f == hlinfo->mouse_face_mouse_frame))
1769 { 1298 {
1770 BLOCK_INPUT; 1299 BLOCK_INPUT;
1771 if (dpyinfo->mouse_face_mouse_frame) 1300 if (hlinfo->mouse_face_mouse_frame)
1772 IT_note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, 1301 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
1773 dpyinfo->mouse_face_mouse_x, 1302 hlinfo->mouse_face_mouse_x,
1774 dpyinfo->mouse_face_mouse_y); 1303 hlinfo->mouse_face_mouse_y);
1775 dpyinfo->mouse_face_deferred_gc = 0; 1304 hlinfo->mouse_face_deferred_gc = 0;
1776 UNBLOCK_INPUT; 1305 UNBLOCK_INPUT;
1777 } 1306 }
1778 1307
@@ -2317,18 +1846,18 @@ internal_terminal_init (void)
2317 if (colors[1] >= 0 && colors[1] < 16) 1846 if (colors[1] >= 0 && colors[1] < 16)
2318 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1]; 1847 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1];
2319 } 1848 }
2320 the_only_display_info.mouse_face_mouse_frame = NULL; 1849 the_only_display_info.mouse_highlight.mouse_face_mouse_frame = NULL;
2321 the_only_display_info.mouse_face_deferred_gc = 0; 1850 the_only_display_info.mouse_highlight.mouse_face_deferred_gc = 0;
2322 the_only_display_info.mouse_face_beg_row = 1851 the_only_display_info.mouse_highlight.mouse_face_beg_row =
2323 the_only_display_info.mouse_face_beg_col = -1; 1852 the_only_display_info.mouse_highlight.mouse_face_beg_col = -1;
2324 the_only_display_info.mouse_face_end_row = 1853 the_only_display_info.mouse_highlight.mouse_face_end_row =
2325 the_only_display_info.mouse_face_end_col = -1; 1854 the_only_display_info.mouse_highlight.mouse_face_end_col = -1;
2326 the_only_display_info.mouse_face_face_id = DEFAULT_FACE_ID; 1855 the_only_display_info.mouse_highlight.mouse_face_face_id = DEFAULT_FACE_ID;
2327 the_only_display_info.mouse_face_window = Qnil; 1856 the_only_display_info.mouse_highlight.mouse_face_window = Qnil;
2328 the_only_display_info.mouse_face_mouse_x = 1857 the_only_display_info.mouse_highlight.mouse_face_mouse_x =
2329 the_only_display_info.mouse_face_mouse_y = 0; 1858 the_only_display_info.mouse_highlight.mouse_face_mouse_y = 0;
2330 the_only_display_info.mouse_face_defer = 0; 1859 the_only_display_info.mouse_highlight.mouse_face_defer = 0;
2331 the_only_display_info.mouse_face_hidden = 0; 1860 the_only_display_info.mouse_highlight.mouse_face_hidden = 0;
2332 1861
2333 if (have_mouse) /* detected in dos_ttraw, which see */ 1862 if (have_mouse) /* detected in dos_ttraw, which see */
2334 { 1863 {
@@ -2916,7 +2445,7 @@ dos_rawgetc (void)
2916{ 2445{
2917 struct input_event event; 2446 struct input_event event;
2918 union REGS regs; 2447 union REGS regs;
2919 struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME()); 2448 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (SELECTED_FRAME());
2920 EVENT_INIT (event); 2449 EVENT_INIT (event);
2921 2450
2922#ifndef HAVE_X_WINDOWS 2451#ifndef HAVE_X_WINDOWS
@@ -3126,10 +2655,10 @@ dos_rawgetc (void)
3126 if (code == 0) 2655 if (code == 0)
3127 continue; 2656 continue;
3128 2657
3129 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) 2658 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
3130 { 2659 {
3131 clear_mouse_face (dpyinfo); 2660 clear_mouse_face (hlinfo);
3132 dpyinfo->mouse_face_hidden = 1; 2661 hlinfo->mouse_face_hidden = 1;
3133 } 2662 }
3134 2663
3135 if (code >= 0x100) 2664 if (code >= 0x100)
@@ -3157,10 +2686,10 @@ dos_rawgetc (void)
3157 might need to update mouse highlight. */ 2686 might need to update mouse highlight. */
3158 if (mouse_last_x != mouse_prev_x || mouse_last_y != mouse_prev_y) 2687 if (mouse_last_x != mouse_prev_x || mouse_last_y != mouse_prev_y)
3159 { 2688 {
3160 if (dpyinfo->mouse_face_hidden) 2689 if (hlinfo->mouse_face_hidden)
3161 { 2690 {
3162 dpyinfo->mouse_face_hidden = 0; 2691 hlinfo->mouse_face_hidden = 0;
3163 clear_mouse_face (dpyinfo); 2692 clear_mouse_face (hlinfo);
3164 } 2693 }
3165 2694
3166 /* Generate SELECT_WINDOW_EVENTs when needed. */ 2695 /* Generate SELECT_WINDOW_EVENTs when needed. */
@@ -3169,7 +2698,7 @@ dos_rawgetc (void)
3169 mouse_window = window_from_coordinates (SELECTED_FRAME(), 2698 mouse_window = window_from_coordinates (SELECTED_FRAME(),
3170 mouse_last_x, 2699 mouse_last_x,
3171 mouse_last_y, 2700 mouse_last_y,
3172 0, 0, 0, 0); 2701 0, 0);
3173 /* A window will be selected only when it is not 2702 /* A window will be selected only when it is not
3174 selected now, and the last mouse movement event was 2703 selected now, and the last mouse movement event was
3175 not in it. A minibuffer window will be selected iff 2704 not in it. A minibuffer window will be selected iff
@@ -3192,22 +2721,12 @@ dos_rawgetc (void)
3192 previous_help_echo_string = help_echo_string; 2721 previous_help_echo_string = help_echo_string;
3193 help_echo_string = help_echo_object = help_echo_window = Qnil; 2722 help_echo_string = help_echo_object = help_echo_window = Qnil;
3194 help_echo_pos = -1; 2723 help_echo_pos = -1;
3195 IT_note_mouse_highlight (SELECTED_FRAME(), 2724 note_mouse_highlight (SELECTED_FRAME(), mouse_last_x, mouse_last_y);
3196 mouse_last_x, mouse_last_y);
3197 /* If the contents of the global variable help_echo has 2725 /* If the contents of the global variable help_echo has
3198 changed, generate a HELP_EVENT. */ 2726 changed, generate a HELP_EVENT. */
3199 if (!NILP (help_echo_string) || !NILP (previous_help_echo_string)) 2727 if (!NILP (help_echo_string) || !NILP (previous_help_echo_string))
3200 { 2728 gen_help_event (help_echo_string, selected_frame, help_echo_window,
3201 event.kind = HELP_EVENT; 2729 help_echo_object, help_echo_pos);
3202 event.frame_or_window = selected_frame;
3203 event.arg = help_echo_object;
3204 event.x = WINDOWP (help_echo_window)
3205 ? help_echo_window : selected_frame;
3206 event.y = help_echo_string;
3207 event.timestamp = event_timestamp ();
3208 event.code = help_echo_pos;
3209 kbd_buffer_store_event (&event);
3210 }
3211 } 2730 }
3212 2731
3213 for (but = 0; but < NUM_MOUSE_BUTTONS; but++) 2732 for (but = 0; but < NUM_MOUSE_BUTTONS; but++)
diff --git a/src/msdos.h b/src/msdos.h
index fe9964af25e..d07c28d410e 100644
--- a/src/msdos.h
+++ b/src/msdos.h
@@ -34,6 +34,7 @@ void dostounix_filename (char *);
34char *rootrelativepath (char *); 34char *rootrelativepath (char *);
35void init_environment (int, char **, int); 35void init_environment (int, char **, int);
36void internal_terminal_init (void); 36void internal_terminal_init (void);
37void initialize_msdos_display (struct terminal *);
37 38
38extern int have_mouse; 39extern int have_mouse;
39void mouse_init (void); 40void mouse_init (void);
diff --git a/src/nsfns.m b/src/nsfns.m
index db8bbeb5f76..0b105ab6ff1 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1,6 +1,7 @@
1/* Functions for the NeXT/Open/GNUstep and MacOSX window system. 1/* Functions for the NeXT/Open/GNUstep and MacOSX window system.
2 Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008, 2009, 2010 2
3 Free Software Foundation, Inc. 3Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008, 2009, 2010
4 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -1223,8 +1224,6 @@ be shared by the new frame. */)
1223 "foreground", "Foreground", RES_TYPE_STRING); 1224 "foreground", "Foreground", RES_TYPE_STRING);
1224 x_default_parameter (f, parms, Qbackground_color, build_string ("White"), 1225 x_default_parameter (f, parms, Qbackground_color, build_string ("White"),
1225 "background", "Background", RES_TYPE_STRING); 1226 "background", "Background", RES_TYPE_STRING);
1226 x_default_parameter (f, parms, Qcursor_color, build_string ("grey"),
1227 "cursorColor", "CursorColor", RES_TYPE_STRING);
1228 /* FIXME: not suppported yet in Nextstep */ 1227 /* FIXME: not suppported yet in Nextstep */
1229 x_default_parameter (f, parms, Qline_spacing, Qnil, 1228 x_default_parameter (f, parms, Qline_spacing, Qnil,
1230 "lineSpacing", "LineSpacing", RES_TYPE_NUMBER); 1229 "lineSpacing", "LineSpacing", RES_TYPE_NUMBER);
@@ -1697,7 +1696,7 @@ If omitted or nil, the selected frame's display is used. */)
1697 1696
1698DEFUN ("x-display-save-under", Fx_display_save_under, 1697DEFUN ("x-display-save-under", Fx_display_save_under,
1699 Sx_display_save_under, 0, 1, 0, 1698 Sx_display_save_under, 0, 1, 0,
1700 doc: /* Non-nil if the Nextstep display server supports the save-under feature. 1699 doc: /* Return t if DISPLAY supports the save-under feature.
1701The optional argument DISPLAY specifies which display to ask about. 1700The optional argument DISPLAY specifies which display to ask about.
1702DISPLAY should be a frame, the display name as a string, or a terminal ID. 1701DISPLAY should be a frame, the display name as a string, or a terminal ID.
1703If omitted or nil, the selected frame's display is used. */) 1702If omitted or nil, the selected frame's display is used. */)
@@ -1722,9 +1721,12 @@ If omitted or nil, the selected frame's display is used. */)
1722 1721
1723DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, 1722DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
1724 1, 3, 0, 1723 1, 3, 0,
1725 doc: /* Open a connection to a Nextstep display server. 1724 doc: /* Open a connection to a display server.
1726DISPLAY is the name of the display to connect to. 1725DISPLAY is the name of the display to connect to.
1727Optional arguments XRM-STRING and MUST-SUCCEED are currently ignored. */) 1726Optional second arg XRM-STRING is a string of resources in xrdb format.
1727If the optional third arg MUST-SUCCEED is non-nil,
1728terminate Emacs if we can't open the connection.
1729\(In the Nextstep version, the last two arguments are currently ignored.) */)
1728 (Lisp_Object display, Lisp_Object resource_string, Lisp_Object must_succeed) 1730 (Lisp_Object display, Lisp_Object resource_string, Lisp_Object must_succeed)
1729{ 1731{
1730 struct ns_display_info *dpyinfo; 1732 struct ns_display_info *dpyinfo;
@@ -2201,8 +2203,8 @@ x_sync (struct frame *f)
2201 2203
2202 2204
2203DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, 2205DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
2204 doc: /* Return t if the current Nextstep display supports the color COLOR. 2206 doc: /* Internal function called by `color-defined-p', which see.
2205The optional argument FRAME is currently ignored. */) 2207\(Note that the Nextstep version of this function ignores FRAME.) */)
2206 (Lisp_Object color, Lisp_Object frame) 2208 (Lisp_Object color, Lisp_Object frame)
2207{ 2209{
2208 NSColor * col; 2210 NSColor * col;
@@ -2233,10 +2235,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
2233 2235
2234 2236
2235DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, 2237DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
2236 doc: /* Return t if the Nextstep display supports color. 2238 doc: /* Internal function called by `display-color-p', which see. */)
2237The optional argument DISPLAY specifies which display to ask about.
2238DISPLAY should be either a frame, a display name (a string), or terminal ID.
2239If omitted or nil, that stands for the selected frame's display. */)
2240 (Lisp_Object display) 2239 (Lisp_Object display)
2241{ 2240{
2242 NSWindowDepth depth; 2241 NSWindowDepth depth;
@@ -2430,6 +2429,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
2430 doc: /* Show STRING in a \"tooltip\" window on frame FRAME. 2429 doc: /* Show STRING in a \"tooltip\" window on frame FRAME.
2431A tooltip window is a small window displaying a string. 2430A tooltip window is a small window displaying a string.
2432 2431
2432This is an internal function; Lisp code should call `tooltip-show'.
2433
2433FRAME nil or omitted means use the selected frame. 2434FRAME nil or omitted means use the selected frame.
2434 2435
2435PARMS is an optional list of frame parameters which can be used to 2436PARMS is an optional list of frame parameters which can be used to
@@ -2675,4 +2676,3 @@ be used as the image of the icon representing the frame. */);
2675 2676
2676} 2677}
2677 2678
2678// arch-tag: dc2a3f74-1123-4daa-8eed-fb78db6a5642
diff --git a/src/nsfont.m b/src/nsfont.m
index 115986774d8..b3898758869 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -37,6 +37,7 @@ Author: Adrian Robert (arobert@cogsci.ucsd.edu)
37#include "frame.h" 37#include "frame.h"
38#include "character.h" 38#include "character.h"
39#include "font.h" 39#include "font.h"
40#include "termchar.h"
40 41
41/* TODO: Drop once we can assume gnustep-gui 0.17.1. */ 42/* TODO: Drop once we can assume gnustep-gui 0.17.1. */
42#ifdef NS_IMPL_GNUSTEP 43#ifdef NS_IMPL_GNUSTEP
@@ -1040,8 +1041,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1040 face = s->face; 1041 face = s->face;
1041 break; 1042 break;
1042 case NS_DUMPGLYPH_MOUSEFACE: 1043 case NS_DUMPGLYPH_MOUSEFACE:
1043 face = FACE_FROM_ID (s->f, 1044 face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
1044 FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
1045 if (!face) 1045 if (!face)
1046 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 1046 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
1047 break; 1047 break;
@@ -1211,7 +1211,6 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1211 DPSstroke (context); 1211 DPSstroke (context);
1212 1212
1213 DPSgrestore (context); 1213 DPSgrestore (context);
1214 return to-from;
1215 } 1214 }
1216 1215
1217#else /* NS_IMPL_COCOA */ 1216#else /* NS_IMPL_COCOA */
@@ -1280,10 +1279,9 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1280 } 1279 }
1281 1280
1282 CGContextRestoreGState (gcontext); 1281 CGContextRestoreGState (gcontext);
1283 return;
1284 } 1282 }
1285#endif /* NS_IMPL_COCOA */ 1283#endif /* NS_IMPL_COCOA */
1286 1284 return to-from;
1287} 1285}
1288 1286
1289 1287
diff --git a/src/nsimage.m b/src/nsimage.m
index a42950d1f52..81198be0862 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -336,7 +336,7 @@ static EmacsImage *ImageList = nil;
336 NSColor *rgbColor; 336 NSColor *rgbColor;
337 337
338 if (bmRep == nil || color == nil) 338 if (bmRep == nil || color == nil)
339 return; 339 return self;
340 340
341 if ([color colorSpaceName] != NSCalibratedRGBColorSpace) 341 if ([color colorSpaceName] != NSCalibratedRGBColorSpace)
342 rgbColor = [color colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; 342 rgbColor = [color colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
@@ -361,6 +361,8 @@ static EmacsImage *ImageList = nil;
361 planes[2][i] = bb; 361 planes[2][i] = bb;
362 } 362 }
363 } 363 }
364
365 return self;
364} 366}
365 367
366 368
diff --git a/src/nsmenu.m b/src/nsmenu.m
index d0276c50bf7..973f2c15e2f 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -23,7 +23,7 @@ Carbon version by Yamamoto Mitsuharu. */
23 23
24/* This should be the first include, as it may set up #defines affecting 24/* This should be the first include, as it may set up #defines affecting
25 interpretation of even the system includes. */ 25 interpretation of even the system includes. */
26#include "config.h" 26#include <config.h>
27#include <setjmp.h> 27#include <setjmp.h>
28 28
29#include "lisp.h" 29#include "lisp.h"
@@ -1049,10 +1049,15 @@ update_frame_tool_bar (FRAME_PTR f)
1049 { 1049 {
1050 idx = -1; 1050 idx = -1;
1051 } 1051 }
1052 helpObj = TOOLPROP (TOOL_BAR_ITEM_HELP);
1053 if (NILP (helpObj))
1054 helpObj = TOOLPROP (TOOL_BAR_ITEM_CAPTION);
1055 helpText = NILP (helpObj) ? "" : (char *)SDATA (helpObj);
1056
1052 /* Ignore invalid image specifications. */ 1057 /* Ignore invalid image specifications. */
1053 if (!valid_image_p (image)) 1058 if (!valid_image_p (image))
1054 { 1059 {
1055 NSLog (@"Invalid image for toolbar item"); 1060 /* Don't log anything, GNUS makes invalid images all the time. */
1056 continue; 1061 continue;
1057 } 1062 }
1058 1063
@@ -1066,11 +1071,6 @@ update_frame_tool_bar (FRAME_PTR f)
1066 continue; 1071 continue;
1067 } 1072 }
1068 1073
1069 helpObj = TOOLPROP (TOOL_BAR_ITEM_HELP);
1070 if (NILP (helpObj))
1071 helpObj = TOOLPROP (TOOL_BAR_ITEM_CAPTION);
1072 helpText = NILP (helpObj) ? "" : (char *)SDATA (helpObj);
1073
1074 [toolbar addDisplayItemWithImage: img->pixmap idx: i helpText: helpText 1074 [toolbar addDisplayItemWithImage: img->pixmap idx: i helpText: helpText
1075 enabled: enabled_p]; 1075 enabled: enabled_p];
1076#undef TOOLPROP 1076#undef TOOLPROP
diff --git a/src/nsterm.h b/src/nsterm.h
index 21b18f15cae..7ee960bd7a6 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -492,21 +492,9 @@ struct ns_display_info
492 /* The cursor to use for vertical scroll bars. */ 492 /* The cursor to use for vertical scroll bars. */
493 Cursor vertical_scroll_bar_cursor; 493 Cursor vertical_scroll_bar_cursor;
494 494
495 /* most mouse face stuff moved in here as of 21+ (and reasonably so) */ 495 /* Information about the range of text currently shown in
496 int mouse_face_beg_row, mouse_face_beg_col; 496 mouse-face. */
497 int mouse_face_end_row, mouse_face_end_col; 497 Mouse_HLInfo mouse_highlight;
498 int mouse_face_beg_x, mouse_face_beg_y;
499 int mouse_face_end_x, mouse_face_end_y;
500 int mouse_face_past_end;
501 Lisp_Object mouse_face_window;
502 int mouse_face_face_id;
503 int mouse_face_deferred_gc;
504 Lisp_Object mouse_face_overlay;
505 FRAME_PTR mouse_face_mouse_frame;
506 int mouse_face_mouse_x, mouse_face_mouse_y;
507 int mouse_face_defer;
508 int mouse_face_hidden;
509 int mouse_face_image_state;
510 498
511 struct frame *x_highlight_frame; 499 struct frame *x_highlight_frame;
512 struct frame *x_focus_frame; 500 struct frame *x_focus_frame;
diff --git a/src/nsterm.m b/src/nsterm.m
index 247ef4dd40c..78d690c020d 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -158,10 +158,20 @@ Lisp_Object ns_right_alternate_modifier;
158Lisp_Object ns_command_modifier; 158Lisp_Object ns_command_modifier;
159 159
160/* Specifies which emacs modifier should be generated when NS receives 160/* Specifies which emacs modifier should be generated when NS receives
161 the right Command modifier. Has same values as ns_command_modifier plus
162 the value Qleft which means whatever value ns_command_modifier has. */
163Lisp_Object ns_right_command_modifier;
164
165/* Specifies which emacs modifier should be generated when NS receives
161 the Control modifier. May be any of the modifier lisp symbols. */ 166 the Control modifier. May be any of the modifier lisp symbols. */
162Lisp_Object ns_control_modifier; 167Lisp_Object ns_control_modifier;
163 168
164/* Specifies which emacs modifier should be generated when NS receives 169/* Specifies which emacs modifier should be generated when NS receives
170 the right Control modifier. Has same values as ns_control_modifier plus
171 the value Qleft which means whatever value ns_control_modifier has. */
172Lisp_Object ns_right_control_modifier;
173
174/* Specifies which emacs modifier should be generated when NS receives
165 the Function modifier (laptops). May be any of the modifier lisp symbols. */ 175 the Function modifier (laptops). May be any of the modifier lisp symbols. */
166Lisp_Object ns_function_modifier; 176Lisp_Object ns_function_modifier;
167 177
@@ -223,6 +233,11 @@ static BOOL inNsSelect = 0;
223 233
224/* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */ 234/* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */
225#define NS_FUNCTION_KEY_MASK 0x800000 235#define NS_FUNCTION_KEY_MASK 0x800000
236#define NSLeftControlKeyMask (0x000001 | NSControlKeyMask)
237#define NSRightControlKeyMask (0x002000 | NSControlKeyMask)
238#define NSLeftCommandKeyMask (0x000008 | NSCommandKeyMask)
239#define NSRightCommandKeyMask (0x000010 | NSCommandKeyMask)
240#define NSLeftAlternateKeyMask (0x000020 | NSAlternateKeyMask)
226#define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) 241#define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask)
227#define EV_MODIFIERS(e) \ 242#define EV_MODIFIERS(e) \
228 ((([e modifierFlags] & NSHelpKeyMask) ? \ 243 ((([e modifierFlags] & NSHelpKeyMask) ? \
@@ -235,10 +250,18 @@ static BOOL inNsSelect = 0;
235 parse_solitary_modifier (ns_alternate_modifier) : 0) \ 250 parse_solitary_modifier (ns_alternate_modifier) : 0) \
236 | (([e modifierFlags] & NSShiftKeyMask) ? \ 251 | (([e modifierFlags] & NSShiftKeyMask) ? \
237 shift_modifier : 0) \ 252 shift_modifier : 0) \
253 | (!EQ (ns_right_control_modifier, Qleft) && \
254 (([e modifierFlags] & NSRightControlKeyMask) \
255 == NSRightControlKeyMask) ? \
256 parse_solitary_modifier (ns_right_control_modifier) : 0) \
238 | (([e modifierFlags] & NSControlKeyMask) ? \ 257 | (([e modifierFlags] & NSControlKeyMask) ? \
239 parse_solitary_modifier (ns_control_modifier) : 0) \ 258 parse_solitary_modifier (ns_control_modifier) : 0) \
240 | (([e modifierFlags] & NS_FUNCTION_KEY_MASK) ? \ 259 | (([e modifierFlags] & NS_FUNCTION_KEY_MASK) ? \
241 parse_solitary_modifier (ns_function_modifier) : 0) \ 260 parse_solitary_modifier (ns_function_modifier) : 0) \
261 | (!EQ (ns_right_command_modifier, Qleft) && \
262 (([e modifierFlags] & NSRightCommandKeyMask) \
263 == NSRightCommandKeyMask) ? \
264 parse_solitary_modifier (ns_right_command_modifier) : 0) \
242 | (([e modifierFlags] & NSCommandKeyMask) ? \ 265 | (([e modifierFlags] & NSCommandKeyMask) ? \
243 parse_solitary_modifier (ns_command_modifier):0)) 266 parse_solitary_modifier (ns_command_modifier):0))
244 267
@@ -553,7 +576,7 @@ ns_update_window_begin (struct window *w)
553 -------------------------------------------------------------------------- */ 576 -------------------------------------------------------------------------- */
554{ 577{
555 struct frame *f = XFRAME (WINDOW_FRAME (w)); 578 struct frame *f = XFRAME (WINDOW_FRAME (w));
556 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); 579 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
557 NSTRACE (ns_update_window_begin); 580 NSTRACE (ns_update_window_begin);
558 581
559 updated_window = w; 582 updated_window = w;
@@ -561,15 +584,15 @@ ns_update_window_begin (struct window *w)
561 584
562 BLOCK_INPUT; 585 BLOCK_INPUT;
563 586
564 if (f == dpyinfo->mouse_face_mouse_frame) 587 if (f == hlinfo->mouse_face_mouse_frame)
565 { 588 {
566 /* Don't do highlighting for mouse motion during the update. */ 589 /* Don't do highlighting for mouse motion during the update. */
567 dpyinfo->mouse_face_defer = 1; 590 hlinfo->mouse_face_defer = 1;
568 591
569 /* If the frame needs to be redrawn, 592 /* If the frame needs to be redrawn,
570 simply forget about any prior mouse highlighting. */ 593 simply forget about any prior mouse highlighting. */
571 if (FRAME_GARBAGED_P (f)) 594 if (FRAME_GARBAGED_P (f))
572 dpyinfo->mouse_face_window = Qnil; 595 hlinfo->mouse_face_window = Qnil;
573 596
574 /* (further code for mouse faces ifdef'd out in other terms elided) */ 597 /* (further code for mouse faces ifdef'd out in other terms elided) */
575 } 598 }
@@ -586,7 +609,7 @@ ns_update_window_end (struct window *w, int cursor_on_p,
586 external (RIF) call; for one window called before update_end 609 external (RIF) call; for one window called before update_end
587 -------------------------------------------------------------------------- */ 610 -------------------------------------------------------------------------- */
588{ 611{
589 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (XFRAME (w->frame)); 612 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
590 613
591 /* note: this fn is nearly identical in all terms */ 614 /* note: this fn is nearly identical in all terms */
592 if (!w->pseudo_window_p) 615 if (!w->pseudo_window_p)
@@ -608,9 +631,9 @@ ns_update_window_end (struct window *w, int cursor_on_p,
608 frame_up_to_date to redisplay the mouse highlight. */ 631 frame_up_to_date to redisplay the mouse highlight. */
609 if (mouse_face_overwritten_p) 632 if (mouse_face_overwritten_p)
610 { 633 {
611 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 634 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
612 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 635 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
613 dpyinfo->mouse_face_window = Qnil; 636 hlinfo->mouse_face_window = Qnil;
614 } 637 }
615 638
616 updated_window = NULL; 639 updated_window = NULL;
@@ -627,8 +650,8 @@ ns_update_end (struct frame *f)
627{ 650{
628 NSView *view = FRAME_NS_VIEW (f); 651 NSView *view = FRAME_NS_VIEW (f);
629 652
630/* if (f == FRAME_NS_DISPLAY_INFO (f)->mouse_face_mouse_frame) */ 653/* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */
631 FRAME_NS_DISPLAY_INFO (f)->mouse_face_defer = 0; 654 MOUSE_HL_INFO (f)->mouse_face_defer = 0;
632 655
633 BLOCK_INPUT; 656 BLOCK_INPUT;
634 657
@@ -1032,6 +1055,7 @@ x_destroy_window (struct frame *f)
1032{ 1055{
1033 NSView *view = FRAME_NS_VIEW (f); 1056 NSView *view = FRAME_NS_VIEW (f);
1034 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); 1057 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
1058 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
1035 NSTRACE (x_destroy_window); 1059 NSTRACE (x_destroy_window);
1036 check_ns (); 1060 check_ns ();
1037 1061
@@ -1048,13 +1072,13 @@ x_destroy_window (struct frame *f)
1048 dpyinfo->x_focus_frame = 0; 1072 dpyinfo->x_focus_frame = 0;
1049 if (f == dpyinfo->x_highlight_frame) 1073 if (f == dpyinfo->x_highlight_frame)
1050 dpyinfo->x_highlight_frame = 0; 1074 dpyinfo->x_highlight_frame = 0;
1051 if (f == dpyinfo->mouse_face_mouse_frame) 1075 if (f == hlinfo->mouse_face_mouse_frame)
1052 { 1076 {
1053 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 1077 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
1054 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 1078 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
1055 dpyinfo->mouse_face_window = Qnil; 1079 hlinfo->mouse_face_window = Qnil;
1056 dpyinfo->mouse_face_deferred_gc = 0; 1080 hlinfo->mouse_face_deferred_gc = 0;
1057 dpyinfo->mouse_face_mouse_frame = 0; 1081 hlinfo->mouse_face_mouse_frame = 0;
1058 } 1082 }
1059 1083
1060 xfree (f->output_data.ns); 1084 xfree (f->output_data.ns);
@@ -1772,18 +1796,18 @@ ns_frame_up_to_date (struct frame *f)
1772 1796
1773 if (FRAME_NS_P (f)) 1797 if (FRAME_NS_P (f))
1774 { 1798 {
1775 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); 1799 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
1776 if ((dpyinfo->mouse_face_deferred_gc||f ==dpyinfo->mouse_face_mouse_frame) 1800 if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame)
1777 /*&& dpyinfo->mouse_face_mouse_frame*/) 1801 /*&& hlinfo->mouse_face_mouse_frame*/)
1778 { 1802 {
1779 BLOCK_INPUT; 1803 BLOCK_INPUT;
1780 ns_update_begin(f); 1804 ns_update_begin(f);
1781 if (dpyinfo->mouse_face_mouse_frame) 1805 if (hlinfo->mouse_face_mouse_frame)
1782 note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, 1806 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
1783 dpyinfo->mouse_face_mouse_x, 1807 hlinfo->mouse_face_mouse_x,
1784 dpyinfo->mouse_face_mouse_y); 1808 hlinfo->mouse_face_mouse_y);
1785 dpyinfo->mouse_face_deferred_gc = 0; 1809 hlinfo->mouse_face_deferred_gc = 0;
1786 ns_update_end(f); 1810 ns_update_end(f);
1787 UNBLOCK_INPUT; 1811 UNBLOCK_INPUT;
1788 } 1812 }
1789 } 1813 }
@@ -2595,8 +2619,7 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s)
2595 2619
2596 if (s->hl == DRAW_MOUSE_FACE) 2620 if (s->hl == DRAW_MOUSE_FACE)
2597 { 2621 {
2598 face = FACE_FROM_ID 2622 face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
2599 (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
2600 if (!face) 2623 if (!face)
2601 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 2624 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
2602 } 2625 }
@@ -2663,8 +2686,8 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, char force_p)
2663 struct face *face; 2686 struct face *face;
2664 if (s->hl == DRAW_MOUSE_FACE) 2687 if (s->hl == DRAW_MOUSE_FACE)
2665 { 2688 {
2666 face = FACE_FROM_ID 2689 face = FACE_FROM_ID (s->f,
2667 (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id); 2690 MOUSE_HL_INFO (s->f)->mouse_face_face_id);
2668 if (!face) 2691 if (!face)
2669 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 2692 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
2670 } 2693 }
@@ -2749,15 +2772,17 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
2749 with its background color), we must clear just the image area. */ 2772 with its background color), we must clear just the image area. */
2750 if (s->hl == DRAW_MOUSE_FACE) 2773 if (s->hl == DRAW_MOUSE_FACE)
2751 { 2774 {
2752 face = FACE_FROM_ID 2775 face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
2753 (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
2754 if (!face) 2776 if (!face)
2755 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 2777 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
2756 } 2778 }
2757 else 2779 else
2758 face = FACE_FROM_ID (s->f, s->first_glyph->face_id); 2780 face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
2759 2781
2760 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set]; 2782 if (s->hl == DRAW_CURSOR)
2783 [FRAME_CURSOR_COLOR (s->f) set];
2784 else
2785 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set];
2761 2786
2762 if (bg_height > s->slice.height || s->img->hmargin || s->img->vmargin 2787 if (bg_height > s->slice.height || s->img->hmargin || s->img->vmargin
2763 || s->img->mask || s->img->pixmap == 0 || s->width != s->background_width) 2788 || s->img->mask || s->img->pixmap == 0 || s->width != s->background_width)
@@ -2820,6 +2845,16 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
2820 s->slice.x == 0, 2845 s->slice.x == 0,
2821 s->slice.x + s->slice.width == s->img->width, s); 2846 s->slice.x + s->slice.width == s->img->width, s);
2822 } 2847 }
2848
2849 /* If there is no mask, the background won't be seen,
2850 so draw a rectangle on the image for the cursor.
2851 Do this for all images, getting trancparency right is not reliable. */
2852 if (s->hl == DRAW_CURSOR)
2853 {
2854 int thickness = abs (s->img->relief);
2855 if (thickness == 0) thickness = 1;
2856 ns_draw_box (br, thickness, FRAME_CURSOR_COLOR (s->f), 1, 1);
2857 }
2823} 2858}
2824 2859
2825 2860
@@ -2873,8 +2908,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
2873 2908
2874 if (s->hl == DRAW_MOUSE_FACE) 2909 if (s->hl == DRAW_MOUSE_FACE)
2875 { 2910 {
2876 face = FACE_FROM_ID 2911 face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
2877 (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
2878 if (!face) 2912 if (!face)
2879 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 2913 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
2880 } 2914 }
@@ -2975,11 +3009,41 @@ ns_draw_glyph_string (struct glyph_string *s)
2975 if (ns_tmp_font == NULL) 3009 if (ns_tmp_font == NULL)
2976 ns_tmp_font = (struct nsfont_info *)FRAME_FONT (s->f); 3010 ns_tmp_font = (struct nsfont_info *)FRAME_FONT (s->f);
2977 3011
3012 if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR)
3013 {
3014 unsigned long tmp = NS_FACE_BACKGROUND (s->face);
3015 NS_FACE_BACKGROUND (s->face) = NS_FACE_FOREGROUND (s->face);
3016 NS_FACE_FOREGROUND (s->face) = tmp;
3017 }
3018
2978 ns_tmp_font->font.driver->draw 3019 ns_tmp_font->font.driver->draw
2979 (s, 0, s->nchars, s->x, s->y, 3020 (s, 0, s->nchars, s->x, s->y,
2980 (ns_tmp_flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p) 3021 (ns_tmp_flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p)
2981 || ns_tmp_flags == NS_DUMPGLYPH_MOUSEFACE); 3022 || ns_tmp_flags == NS_DUMPGLYPH_MOUSEFACE);
2982 3023
3024 if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR)
3025 {
3026 unsigned long tmp = NS_FACE_BACKGROUND (s->face);
3027 NS_FACE_BACKGROUND (s->face) = NS_FACE_FOREGROUND (s->face);
3028 NS_FACE_FOREGROUND (s->face) = tmp;
3029 }
3030
3031 ns_unfocus (s->f);
3032 break;
3033
3034 case GLYPHLESS_GLYPH:
3035 n = ns_get_glyph_string_clip_rect (s, r);
3036 ns_focus (s->f, r, n);
3037
3038 if (s->for_overlaps || (s->cmp_from > 0
3039 && ! s->first_glyph->u.cmp.automatic))
3040 s->background_filled_p = 1;
3041 else
3042 ns_maybe_dumpglyphs_background
3043 (s, s->first_glyph->type == COMPOSITE_GLYPH);
3044 /* ... */
3045 /* Not yet implemented. */
3046 /* ... */
2983 ns_unfocus (s->f); 3047 ns_unfocus (s->f);
2984 break; 3048 break;
2985 3049
@@ -3529,6 +3593,7 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo)
3529{ 3593{
3530 NSScreen *screen = [NSScreen mainScreen]; 3594 NSScreen *screen = [NSScreen mainScreen];
3531 NSWindowDepth depth = [screen depth]; 3595 NSWindowDepth depth = [screen depth];
3596 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
3532 3597
3533 dpyinfo->resx = 72.27; /* used 75.0, but this makes pt == pixel, expected */ 3598 dpyinfo->resx = 72.27; /* used 75.0, but this makes pt == pixel, expected */
3534 dpyinfo->resy = 72.27; 3599 dpyinfo->resy = 72.27;
@@ -3543,16 +3608,16 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo)
3543 dpyinfo->color_table->colors = NULL; 3608 dpyinfo->color_table->colors = NULL;
3544 dpyinfo->root_window = 42; /* a placeholder.. */ 3609 dpyinfo->root_window = 42; /* a placeholder.. */
3545 3610
3546 dpyinfo->mouse_face_mouse_frame = NULL; 3611 hlinfo->mouse_face_mouse_frame = NULL;
3547 dpyinfo->mouse_face_deferred_gc = 0; 3612 hlinfo->mouse_face_deferred_gc = 0;
3548 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 3613 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
3549 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 3614 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
3550 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; 3615 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
3551 dpyinfo->mouse_face_window = dpyinfo->mouse_face_overlay = Qnil; 3616 hlinfo->mouse_face_window = hlinfo->mouse_face_overlay = Qnil;
3552 dpyinfo->mouse_face_hidden = 0; 3617 hlinfo->mouse_face_hidden = 0;
3553 3618
3554 dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; 3619 hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
3555 dpyinfo->mouse_face_defer = 0; 3620 hlinfo->mouse_face_defer = 0;
3556 3621
3557 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL; 3622 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL;
3558 3623
@@ -4335,7 +4400,7 @@ ns_term_shutdown (int sig)
4335 4400
4336- (void)keyDown: (NSEvent *)theEvent 4401- (void)keyDown: (NSEvent *)theEvent
4337{ 4402{
4338 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe); 4403 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe);
4339 int code; 4404 int code;
4340 unsigned fnKeysym = 0; 4405 unsigned fnKeysym = 0;
4341 int flags; 4406 int flags;
@@ -4373,10 +4438,10 @@ ns_term_shutdown (int sig)
4373 4438
4374 [NSCursor setHiddenUntilMouseMoves: YES]; 4439 [NSCursor setHiddenUntilMouseMoves: YES];
4375 4440
4376 if (dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) 4441 if (hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
4377 { 4442 {
4378 clear_mouse_face (dpyinfo); 4443 clear_mouse_face (hlinfo);
4379 dpyinfo->mouse_face_hidden = 1; 4444 hlinfo->mouse_face_hidden = 1;
4380 } 4445 }
4381 4446
4382 if (!processingCompose) 4447 if (!processingCompose)
@@ -4384,7 +4449,7 @@ ns_term_shutdown (int sig)
4384 code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? 4449 code = ([[theEvent charactersIgnoringModifiers] length] == 0) ?
4385 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; 4450 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0];
4386 /* (Carbon way: [theEvent keyCode]) */ 4451 /* (Carbon way: [theEvent keyCode]) */
4387 4452
4388 /* is it a "function key"? */ 4453 /* is it a "function key"? */
4389 fnKeysym = ns_convert_key (code); 4454 fnKeysym = ns_convert_key (code);
4390 if (fnKeysym) 4455 if (fnKeysym)
@@ -4407,9 +4472,17 @@ ns_term_shutdown (int sig)
4407 if (flags & NSShiftKeyMask) 4472 if (flags & NSShiftKeyMask)
4408 emacs_event->modifiers |= shift_modifier; 4473 emacs_event->modifiers |= shift_modifier;
4409 4474
4410 if (flags & NSCommandKeyMask) 4475 if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask)
4476 emacs_event->modifiers |= parse_solitary_modifier
4477 (EQ (ns_right_command_modifier, Qleft)
4478 ? ns_command_modifier
4479 : ns_right_command_modifier);
4480
4481 if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask)
4411 { 4482 {
4412 emacs_event->modifiers |= parse_solitary_modifier (ns_command_modifier); 4483 emacs_event->modifiers |= parse_solitary_modifier
4484 (ns_command_modifier);
4485
4413 /* if super (default), take input manager's word so things like 4486 /* if super (default), take input manager's word so things like
4414 dvorak / qwerty layout work */ 4487 dvorak / qwerty layout work */
4415 if (EQ (ns_command_modifier, Qsuper) 4488 if (EQ (ns_command_modifier, Qsuper)
@@ -4442,23 +4515,43 @@ ns_term_shutdown (int sig)
4442 } 4515 }
4443 } 4516 }
4444 4517
4445 if (flags & NSControlKeyMask) 4518 if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask)
4446 emacs_event->modifiers |= 4519 emacs_event->modifiers |= parse_solitary_modifier
4447 parse_solitary_modifier (ns_control_modifier); 4520 (EQ (ns_right_control_modifier, Qleft)
4521 ? ns_control_modifier
4522 : ns_right_control_modifier);
4523
4524 if ((flags & NSLeftControlKeyMask) == NSLeftControlKeyMask)
4525 emacs_event->modifiers |= parse_solitary_modifier
4526 (ns_control_modifier);
4448 4527
4449 if (flags & NS_FUNCTION_KEY_MASK && !fnKeysym) 4528 if (flags & NS_FUNCTION_KEY_MASK && !fnKeysym)
4450 emacs_event->modifiers |= 4529 emacs_event->modifiers |=
4451 parse_solitary_modifier (ns_function_modifier); 4530 parse_solitary_modifier (ns_function_modifier);
4452 4531
4453 if (!EQ (ns_right_alternate_modifier, Qleft) 4532 if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask)
4454 && ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask))
4455 {
4456 emacs_event->modifiers |= parse_solitary_modifier
4457 (ns_right_alternate_modifier);
4458 }
4459 else if (flags & NSAlternateKeyMask) /* default = meta */
4460 { 4533 {
4461 if ((NILP (ns_alternate_modifier) || EQ (ns_alternate_modifier, Qnone)) 4534 if ((NILP (ns_right_alternate_modifier)
4535 || EQ (ns_right_alternate_modifier, Qnone))
4536 && !fnKeysym)
4537 { /* accept pre-interp alt comb */
4538 if ([[theEvent characters] length] > 0)
4539 code = [[theEvent characters] characterAtIndex: 0];
4540 /*HACK: clear lone shift modifier to stop next if from firing */
4541 if (emacs_event->modifiers == shift_modifier)
4542 emacs_event->modifiers = 0;
4543 }
4544 else
4545 emacs_event->modifiers |= parse_solitary_modifier
4546 (EQ (ns_right_alternate_modifier, Qleft)
4547 ? ns_alternate_modifier
4548 : ns_right_alternate_modifier);
4549 }
4550
4551 if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask) /* default = meta */
4552 {
4553 if ((NILP (ns_alternate_modifier)
4554 || EQ (ns_alternate_modifier, Qnone))
4462 && !fnKeysym) 4555 && !fnKeysym)
4463 { /* accept pre-interp alt comb */ 4556 { /* accept pre-interp alt comb */
4464 if ([[theEvent characters] length] > 0) 4557 if ([[theEvent characters] length] > 0)
@@ -4813,7 +4906,7 @@ ns_term_shutdown (int sig)
4813/* Tell emacs the mouse has moved. */ 4906/* Tell emacs the mouse has moved. */
4814- (void)mouseMoved: (NSEvent *)e 4907- (void)mouseMoved: (NSEvent *)e
4815{ 4908{
4816 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe); 4909 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe);
4817 Lisp_Object frame; 4910 Lisp_Object frame;
4818 4911
4819// NSTRACE (mouseMoved); 4912// NSTRACE (mouseMoved);
@@ -4823,10 +4916,10 @@ ns_term_shutdown (int sig)
4823 = [self convertPoint: [e locationInWindow] fromView: nil]; 4916 = [self convertPoint: [e locationInWindow] fromView: nil];
4824 4917
4825 /* update any mouse face */ 4918 /* update any mouse face */
4826 if (dpyinfo->mouse_face_hidden) 4919 if (hlinfo->mouse_face_hidden)
4827 { 4920 {
4828 dpyinfo->mouse_face_hidden = 0; 4921 hlinfo->mouse_face_hidden = 0;
4829 clear_mouse_face (dpyinfo); 4922 clear_mouse_face (hlinfo);
4830 } 4923 }
4831 4924
4832 /* tooltip handling */ 4925 /* tooltip handling */
@@ -5292,20 +5385,19 @@ ns_term_shutdown (int sig)
5292{ 5385{
5293 NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; 5386 NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
5294 NSRect r; 5387 NSRect r;
5295 struct ns_display_info *dpyinfo 5388 Mouse_HLInfo *hlinfo = emacsframe ? MOUSE_HL_INFO (emacsframe) : NULL;
5296 = emacsframe ? FRAME_NS_DISPLAY_INFO (emacsframe) : NULL;
5297 5389
5298 NSTRACE (mouseExited); 5390 NSTRACE (mouseExited);
5299 5391
5300 if (dpyinfo || !emacsframe) 5392 if (!hlinfo)
5301 return; 5393 return;
5302 5394
5303 last_mouse_movement_time = EV_TIMESTAMP (theEvent); 5395 last_mouse_movement_time = EV_TIMESTAMP (theEvent);
5304 5396
5305 if (emacsframe == dpyinfo->mouse_face_mouse_frame) 5397 if (emacsframe == hlinfo->mouse_face_mouse_frame)
5306 { 5398 {
5307 clear_mouse_face (dpyinfo); 5399 clear_mouse_face (hlinfo);
5308 dpyinfo->mouse_face_mouse_frame = 0; 5400 hlinfo->mouse_face_mouse_frame = 0;
5309 } 5401 }
5310} 5402}
5311 5403
@@ -5420,7 +5512,7 @@ ns_term_shutdown (int sig)
5420 NSTRACE (performDragOperation); 5512 NSTRACE (performDragOperation);
5421 5513
5422 if (!emacs_event) 5514 if (!emacs_event)
5423 return; 5515 return NO;
5424 5516
5425 position = [self convertPoint: [sender draggingLocation] fromView: nil]; 5517 position = [self convertPoint: [sender draggingLocation] fromView: nil];
5426 x = lrint (position.x); y = lrint (position.y); 5518 x = lrint (position.x); y = lrint (position.y);
@@ -6232,11 +6324,27 @@ at all, allowing it to be used at a lower level for accented character entry.");
6232Set to control, meta, alt, super, or hyper means it is taken to be that key."); 6324Set to control, meta, alt, super, or hyper means it is taken to be that key.");
6233 ns_command_modifier = Qsuper; 6325 ns_command_modifier = Qsuper;
6234 6326
6327 DEFVAR_LISP ("ns-right-command-modifier", &ns_right_command_modifier,
6328 "This variable describes the behavior of the right command key.\n\
6329Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\
6330Set to left means be the same key as `ns-command-modifier'.\n\
6331Set to none means that the command / option key is not interpreted by Emacs\n\
6332at all, allowing it to be used at a lower level for accented character entry.");
6333 ns_right_command_modifier = Qleft;
6334
6235 DEFVAR_LISP ("ns-control-modifier", &ns_control_modifier, 6335 DEFVAR_LISP ("ns-control-modifier", &ns_control_modifier,
6236 "This variable describes the behavior of the control key.\n\ 6336 "This variable describes the behavior of the control key.\n\
6237Set to control, meta, alt, super, or hyper means it is taken to be that key."); 6337Set to control, meta, alt, super, or hyper means it is taken to be that key.");
6238 ns_control_modifier = Qcontrol; 6338 ns_control_modifier = Qcontrol;
6239 6339
6340 DEFVAR_LISP ("ns-right-control-modifier", &ns_right_control_modifier,
6341 "This variable describes the behavior of the right control key.\n\
6342Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\
6343Set to left means be the same key as `ns-control-modifier'.\n\
6344Set to none means that the control / option key is not interpreted by Emacs\n\
6345at all, allowing it to be used at a lower level for accented character entry.");
6346 ns_right_control_modifier = Qleft;
6347
6240 DEFVAR_LISP ("ns-function-modifier", &ns_function_modifier, 6348 DEFVAR_LISP ("ns-function-modifier", &ns_function_modifier,
6241 "This variable describes the behavior of the function key (on laptops).\n\ 6349 "This variable describes the behavior of the function key (on laptops).\n\
6242Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ 6350Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\
diff --git a/src/print.c b/src/print.c
index 0f8718877d2..77cc2916952 100644
--- a/src/print.c
+++ b/src/print.c
@@ -163,7 +163,7 @@ Lisp_Object Vprint_number_table;
163void print_interval (INTERVAL interval, Lisp_Object printcharfun); 163void print_interval (INTERVAL interval, Lisp_Object printcharfun);
164 164
165/* GDB resets this to zero on W32 to disable OutputDebugString calls. */ 165/* GDB resets this to zero on W32 to disable OutputDebugString calls. */
166int print_output_debug_flag = 1; 166int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
167 167
168 168
169/* Low level output routines for characters and strings */ 169/* Low level output routines for characters and strings */
diff --git a/src/process.c b/src/process.c
index e1515065957..6ffcc5b8099 100644
--- a/src/process.c
+++ b/src/process.c
@@ -56,12 +56,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
56#endif 56#endif
57#endif 57#endif
58 58
59#if defined(HAVE_SYS_IOCTL_H)
60#include <sys/ioctl.h> 59#include <sys/ioctl.h>
61#if defined(HAVE_NET_IF_H) 60#if defined(HAVE_NET_IF_H)
62#include <net/if.h> 61#include <net/if.h>
63#endif /* HAVE_NET_IF_H */ 62#endif /* HAVE_NET_IF_H */
64#endif /* HAVE_SYS_IOCTL_H */
65 63
66#ifdef NEED_BSDTTY 64#ifdef NEED_BSDTTY
67#include <bsdtty.h> 65#include <bsdtty.h>
@@ -115,8 +113,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
115#include "nsterm.h" 113#include "nsterm.h"
116#endif 114#endif
117 115
118extern int timers_run;
119
120Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; 116Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid;
121Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime; 117Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime;
122Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs; 118Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs;
@@ -3811,7 +3807,7 @@ usage: (make-network-process &rest ARGS) */)
3811} 3807}
3812 3808
3813 3809
3814#if defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) 3810#if defined(HAVE_NET_IF_H)
3815 3811
3816#ifdef SIOCGIFCONF 3812#ifdef SIOCGIFCONF
3817DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0, 3813DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0,
@@ -4054,7 +4050,7 @@ FLAGS is the current flags of the interface. */)
4054 return any ? res : Qnil; 4050 return any ? res : Qnil;
4055} 4051}
4056#endif 4052#endif
4057#endif /* defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) */ 4053#endif /* defined(HAVE_NET_IF_H) */
4058 4054
4059/* Turn off input and output for process PROC. */ 4055/* Turn off input and output for process PROC. */
4060 4056
@@ -7708,14 +7704,14 @@ The variable takes effect when `start-process' is called. */);
7708 defsubr (&Sset_network_process_option); 7704 defsubr (&Sset_network_process_option);
7709 defsubr (&Smake_network_process); 7705 defsubr (&Smake_network_process);
7710 defsubr (&Sformat_network_address); 7706 defsubr (&Sformat_network_address);
7711#if defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) 7707#if defined(HAVE_NET_IF_H)
7712#ifdef SIOCGIFCONF 7708#ifdef SIOCGIFCONF
7713 defsubr (&Snetwork_interface_list); 7709 defsubr (&Snetwork_interface_list);
7714#endif 7710#endif
7715#if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS) 7711#if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS)
7716 defsubr (&Snetwork_interface_info); 7712 defsubr (&Snetwork_interface_info);
7717#endif 7713#endif
7718#endif /* defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) */ 7714#endif /* defined(HAVE_NET_IF_H) */
7719#ifdef DATAGRAM_SOCKETS 7715#ifdef DATAGRAM_SOCKETS
7720 defsubr (&Sprocess_datagram_address); 7716 defsubr (&Sprocess_datagram_address);
7721 defsubr (&Sset_process_datagram_address); 7717 defsubr (&Sset_process_datagram_address);
@@ -7746,5 +7742,3 @@ The variable takes effect when `start-process' is called. */);
7746 defsubr (&Sprocess_attributes); 7742 defsubr (&Sprocess_attributes);
7747} 7743}
7748 7744
7749/* arch-tag: 3706c011-7b9a-4117-bd4f-59e7f701a4c4
7750 (do not change this comment) */
diff --git a/src/regex.c b/src/regex.c
index 17158552a95..31f188efa99 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -196,18 +196,14 @@
196 even if config.h says that we can. */ 196 even if config.h says that we can. */
197# undef REL_ALLOC 197# undef REL_ALLOC
198 198
199# if defined STDC_HEADERS || defined _LIBC 199# ifdef HAVE_UNISTD_H
200# include <stdlib.h> 200# include <unistd.h>
201# else
202char *malloc ();
203char *realloc ();
204# endif 201# endif
205 202
206/* When used in Emacs's lib-src, we need xmalloc and xrealloc. */ 203/* When used in Emacs's lib-src, we need xmalloc and xrealloc. */
207 204
208void * 205void *
209xmalloc (size) 206xmalloc (size_t size)
210 size_t size;
211{ 207{
212 register void *val; 208 register void *val;
213 val = (void *) malloc (size); 209 val = (void *) malloc (size);
@@ -220,9 +216,7 @@ xmalloc (size)
220} 216}
221 217
222void * 218void *
223xrealloc (block, size) 219xrealloc (void *block, size_t size)
224 void *block;
225 size_t size;
226{ 220{
227 register void *val; 221 register void *val;
228 /* We must call malloc explicitly when BLOCK is 0, since some 222 /* We must call malloc explicitly when BLOCK is 0, since some
@@ -435,7 +429,7 @@ extern char *re_syntax_table;
435static char re_syntax_table[CHAR_SET_SIZE]; 429static char re_syntax_table[CHAR_SET_SIZE];
436 430
437static void 431static void
438init_syntax_once () 432init_syntax_once (void)
439{ 433{
440 register int c; 434 register int c;
441 static int done = 0; 435 static int done = 0;
@@ -4978,11 +4972,8 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const r
4978/* re_match is like re_match_2 except it takes only a single string. */ 4972/* re_match is like re_match_2 except it takes only a single string. */
4979 4973
4980int 4974int
4981re_match (bufp, string, size, pos, regs) 4975re_match (struct re_pattern_buffer *bufp, const char *string,
4982 struct re_pattern_buffer *bufp; 4976 int size, int pos, struct re_registers *regs)
4983 const char *string;
4984 int size, pos;
4985 struct re_registers *regs;
4986{ 4977{
4987 int result = re_match_2_internal (bufp, NULL, 0, (re_char*) string, size, 4978 int result = re_match_2_internal (bufp, NULL, 0, (re_char*) string, size,
4988 pos, regs, size); 4979 pos, regs, size);
@@ -6534,10 +6525,8 @@ re_exec (s)
6534 the return codes and their meanings.) */ 6525 the return codes and their meanings.) */
6535 6526
6536int 6527int
6537regcomp (preg, pattern, cflags) 6528regcomp (regex_t *__restrict preg, const char *__restrict pattern,
6538 regex_t *__restrict preg; 6529 int cflags)
6539 const char *__restrict pattern;
6540 int cflags;
6541{ 6530{
6542 reg_errcode_t ret; 6531 reg_errcode_t ret;
6543 reg_syntax_t syntax 6532 reg_syntax_t syntax
@@ -6619,12 +6608,8 @@ WEAK_ALIAS (__regcomp, regcomp)
6619 We return 0 if we find a match and REG_NOMATCH if not. */ 6608 We return 0 if we find a match and REG_NOMATCH if not. */
6620 6609
6621int 6610int
6622regexec (preg, string, nmatch, pmatch, eflags) 6611regexec (const regex_t *__restrict preg, const char *__restrict string,
6623 const regex_t *__restrict preg; 6612 size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags)
6624 const char *__restrict string;
6625 size_t nmatch;
6626 regmatch_t pmatch[__restrict_arr];
6627 int eflags;
6628{ 6613{
6629 int ret; 6614 int ret;
6630 struct re_registers regs; 6615 struct re_registers regs;
@@ -6696,11 +6681,7 @@ WEAK_ALIAS (__regexec, regexec)
6696 error with msvc8 compiler. */ 6681 error with msvc8 compiler. */
6697 6682
6698size_t 6683size_t
6699regerror (err_code, preg, errbuf, errbuf_size) 6684regerror (int err_code, const regex_t *preg, char *errbuf, size_t errbuf_size)
6700 int err_code;
6701 const regex_t *preg;
6702 char *errbuf;
6703 size_t errbuf_size;
6704{ 6685{
6705 const char *msg; 6686 const char *msg;
6706 size_t msg_size; 6687 size_t msg_size;
@@ -6736,8 +6717,7 @@ WEAK_ALIAS (__regerror, regerror)
6736/* Free dynamically allocated space used by PREG. */ 6717/* Free dynamically allocated space used by PREG. */
6737 6718
6738void 6719void
6739regfree (preg) 6720regfree (regex_t *preg)
6740 regex_t *preg;
6741{ 6721{
6742 free (preg->buffer); 6722 free (preg->buffer);
6743 preg->buffer = NULL; 6723 preg->buffer = NULL;
@@ -6756,5 +6736,3 @@ WEAK_ALIAS (__regfree, regfree)
6756 6736
6757#endif /* not emacs */ 6737#endif /* not emacs */
6758 6738
6759/* arch-tag: 4ffd68ba-2a9e-435b-a21a-018990f9eeb2
6760 (do not change this comment) */
diff --git a/src/s/cygwin.h b/src/s/cygwin.h
index 4d58542e660..157ef72f550 100644
--- a/src/s/cygwin.h
+++ b/src/s/cygwin.h
@@ -101,5 +101,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
101 returns ENOSYS. A workaround is to set G_SLICE=always-malloc. */ 101 returns ENOSYS. A workaround is to set G_SLICE=always-malloc. */
102#define G_SLICE_ALWAYS_MALLOC 102#define G_SLICE_ALWAYS_MALLOC
103 103
104/* Send signals to subprocesses by "typing" special chars at them. */
105#define SIGNALS_VIA_CHARACTERS
106
104/* arch-tag: 5ae7ba00-83b0-4ab3-806a-3e845779191b 107/* arch-tag: 5ae7ba00-83b0-4ab3-806a-3e845779191b
105 (do not change this comment) */ 108 (do not change this comment) */
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 4ae5f32e873..826a02bc60f 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -112,7 +112,6 @@ struct sigaction {
112#undef HAVE_UTIME_H 112#undef HAVE_UTIME_H
113#undef HAVE_LINUX_VERSION_H 113#undef HAVE_LINUX_VERSION_H
114#undef HAVE_SYS_SYSTEMINFO_H 114#undef HAVE_SYS_SYSTEMINFO_H
115#undef HAVE_TERMIOS_H
116#define HAVE_LIMITS_H 1 115#define HAVE_LIMITS_H 1
117#define HAVE_STRING_H 1 116#define HAVE_STRING_H 1
118#define HAVE_STDLIB_H 1 117#define HAVE_STDLIB_H 1
diff --git a/src/sound.c b/src/sound.c
index 3869f3a57ff..6fd23c9ad64 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -56,9 +56,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
56/* BEGIN: Non Windows Includes */ 56/* BEGIN: Non Windows Includes */
57#ifndef WINDOWSNT 57#ifndef WINDOWSNT
58 58
59#ifndef MSDOS
60#include <sys/ioctl.h> 59#include <sys/ioctl.h>
61#endif
62 60
63/* FreeBSD has machine/soundcard.h. Voxware sound driver docs mention 61/* FreeBSD has machine/soundcard.h. Voxware sound driver docs mention
64 sys/soundcard.h. So, let's try whatever's there. */ 62 sys/soundcard.h. So, let's try whatever's there. */
diff --git a/src/strftime.c b/src/strftime.c
index a7617427793..5a0923e3723 100644
--- a/src/strftime.c
+++ b/src/strftime.c
@@ -179,11 +179,8 @@ extern char *tzname[];
179 Similarly for localtime_r. */ 179 Similarly for localtime_r. */
180 180
181# if ! HAVE_TM_GMTOFF 181# if ! HAVE_TM_GMTOFF
182static struct tm *my_strftime_gmtime_r (const time_t *, struct tm *);
183static struct tm * 182static struct tm *
184my_strftime_gmtime_r (t, tp) 183my_strftime_gmtime_r (const time_t *t, struct tm *tp)
185 const time_t *t;
186 struct tm *tp;
187{ 184{
188 struct tm *l = gmtime (t); 185 struct tm *l = gmtime (t);
189 if (! l) 186 if (! l)
@@ -192,11 +189,8 @@ my_strftime_gmtime_r (t, tp)
192 return tp; 189 return tp;
193} 190}
194 191
195static struct tm *my_strftime_localtime_r (const time_t *, struct tm *);
196static struct tm * 192static struct tm *
197my_strftime_localtime_r (t, tp) 193my_strftime_localtime_r (const time_t *t, struct tm *tp)
198 const time_t *t;
199 struct tm *tp;
200{ 194{
201 struct tm *l = localtime (t); 195 struct tm *l = localtime (t);
202 if (! l) 196 if (! l)
@@ -318,14 +312,10 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */
318# undef _NL_CURRENT 312# undef _NL_CURRENT
319# define _NL_CURRENT(category, item) \ 313# define _NL_CURRENT(category, item) \
320 (current->values[_NL_ITEM_INDEX (item)].string) 314 (current->values[_NL_ITEM_INDEX (item)].string)
321# define LOCALE_PARAM , loc
322# define LOCALE_ARG , loc 315# define LOCALE_ARG , loc
323# define LOCALE_PARAM_DECL __locale_t loc; 316# define LOCALE_PARAM_DECL , __locale_t loc
324# define LOCALE_PARAM_PROTO , __locale_t loc
325# define HELPER_LOCALE_ARG , current 317# define HELPER_LOCALE_ARG , current
326#else 318#else
327# define LOCALE_PARAM
328# define LOCALE_PARAM_PROTO
329# define LOCALE_ARG 319# define LOCALE_ARG
330# define LOCALE_PARAM_DECL 320# define LOCALE_PARAM_DECL
331# ifdef _LIBC 321# ifdef _LIBC
@@ -363,30 +353,16 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */
363 more reliable way to accept other sets of digits. */ 353 more reliable way to accept other sets of digits. */
364#define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9) 354#define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9)
365 355
366static CHAR_T *memcpy_lowcase (CHAR_T *dest, const CHAR_T *src,
367 size_t len LOCALE_PARAM_PROTO);
368
369static CHAR_T * 356static CHAR_T *
370memcpy_lowcase (dest, src, len LOCALE_PARAM) 357memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL)
371 CHAR_T *dest;
372 const CHAR_T *src;
373 size_t len;
374 LOCALE_PARAM_DECL
375{ 358{
376 while (len-- > 0) 359 while (len-- > 0)
377 dest[len] = TOLOWER ((UCHAR_T) src[len], loc); 360 dest[len] = TOLOWER ((UCHAR_T) src[len], loc);
378 return dest; 361 return dest;
379} 362}
380 363
381static CHAR_T *memcpy_uppcase (CHAR_T *dest, const CHAR_T *src,
382 size_t len LOCALE_PARAM_PROTO);
383
384static CHAR_T * 364static CHAR_T *
385memcpy_uppcase (dest, src, len LOCALE_PARAM) 365memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL)
386 CHAR_T *dest;
387 const CHAR_T *src;
388 size_t len;
389 LOCALE_PARAM_DECL
390{ 366{
391 while (len-- > 0) 367 while (len-- > 0)
392 dest[len] = TOUPPER ((UCHAR_T) src[len], loc); 368 dest[len] = TOUPPER ((UCHAR_T) src[len], loc);
@@ -398,11 +374,8 @@ memcpy_uppcase (dest, src, len LOCALE_PARAM)
398/* Yield the difference between *A and *B, 374/* Yield the difference between *A and *B,
399 measured in seconds, ignoring leap seconds. */ 375 measured in seconds, ignoring leap seconds. */
400# define tm_diff ftime_tm_diff 376# define tm_diff ftime_tm_diff
401static int tm_diff (const struct tm *, const struct tm *);
402static int 377static int
403tm_diff (a, b) 378tm_diff (const struct tm *a, const struct tm *b)
404 const struct tm *a;
405 const struct tm *b;
406{ 379{
407 /* Compute intervening leap days correctly even if year is negative. 380 /* Compute intervening leap days correctly even if year is negative.
408 Take care to avoid int overflow in leap day calculations, 381 Take care to avoid int overflow in leap day calculations,
@@ -437,9 +410,7 @@ static int iso_week_days (int, int);
437__inline__ 410__inline__
438#endif 411#endif
439static int 412static int
440iso_week_days (yday, wday) 413iso_week_days (int yday, int wday)
441 int yday;
442 int wday;
443{ 414{
444 /* Add enough to the first operand of % to make it nonnegative. */ 415 /* Add enough to the first operand of % to make it nonnegative. */
445 int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7; 416 int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
@@ -470,8 +441,7 @@ static CHAR_T const month_name[][10] =
470 441
471#ifdef my_strftime 442#ifdef my_strftime
472# define extra_args , ut, ns 443# define extra_args , ut, ns
473# define extra_args_spec int ut; int ns; 444# define extra_args_spec , int ut, int ns
474# define extra_args_spec_iso , int ut, int ns
475#else 445#else
476# ifdef COMPILE_WIDE 446# ifdef COMPILE_WIDE
477# define my_strftime wcsftime 447# define my_strftime wcsftime
@@ -482,7 +452,6 @@ static CHAR_T const month_name[][10] =
482# endif 452# endif
483# define extra_args 453# define extra_args
484# define extra_args_spec 454# define extra_args_spec
485# define extra_args_spec_iso
486/* We don't have this information in general. */ 455/* We don't have this information in general. */
487# define ut 0 456# define ut 0
488# define ns 0 457# define ns 0
@@ -491,15 +460,12 @@ static CHAR_T const month_name[][10] =
491#if !defined _LIBC && !defined(WINDOWSNT) && HAVE_TZNAME && HAVE_TZSET 460#if !defined _LIBC && !defined(WINDOWSNT) && HAVE_TZNAME && HAVE_TZSET
492 /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime. 461 /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
493 Work around this bug by copying *tp before it might be munged. */ 462 Work around this bug by copying *tp before it might be munged. */
494 size_t _strftime_copytm (char *, size_t, const char *,
495 const struct tm * extra_args_spec_iso);
496 size_t 463 size_t
497 my_strftime (s, maxsize, format, tp extra_args) 464 _strftime_copytm (CHAR_T *s, size_t maxsize, const CHAR_T *format,
498 CHAR_T *s; 465 const struct tm *tp extra_args_spec LOCALE_PARAM_DECL);
499 size_t maxsize; 466 size_t
500 const CHAR_T *format; 467 my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format,
501 const struct tm *tp; 468 const struct tm *tp extra_args_spec)
502 extra_args_spec
503 { 469 {
504 struct tm tmcopy; 470 struct tm tmcopy;
505 tmcopy = *tp; 471 tmcopy = *tp;
@@ -517,13 +483,8 @@ static CHAR_T const month_name[][10] =
517 anywhere, so to determine how many characters would be 483 anywhere, so to determine how many characters would be
518 written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */ 484 written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */
519size_t 485size_t
520my_strftime (s, maxsize, format, tp extra_args LOCALE_PARAM) 486my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format,
521 CHAR_T *s; 487 const struct tm *tp extra_args_spec LOCALE_PARAM_DECL)
522 size_t maxsize;
523 const CHAR_T *format;
524 const struct tm *tp;
525 extra_args_spec
526 LOCALE_PARAM_DECL
527{ 488{
528#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL 489#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL
529 struct locale_data *const current = loc->__locales[LC_TIME]; 490 struct locale_data *const current = loc->__locales[LC_TIME];
@@ -1474,16 +1435,10 @@ libc_hidden_def (my_strftime)
1474/* For Emacs we have a separate interface which corresponds to the normal 1435/* For Emacs we have a separate interface which corresponds to the normal
1475 strftime function plus the ut argument, but without the ns argument. */ 1436 strftime function plus the ut argument, but without the ns argument. */
1476size_t 1437size_t
1477emacs_strftimeu (s, maxsize, format, tp, ut) 1438emacs_strftimeu (char *s, size_t maxsize, const char *format,
1478 char *s; 1439 const struct tm *tp, int ut)
1479 size_t maxsize;
1480 const char *format;
1481 const struct tm *tp;
1482 int ut;
1483{ 1440{
1484 return my_strftime (s, maxsize, format, tp, ut, 0); 1441 return my_strftime (s, maxsize, format, tp, ut, 0);
1485} 1442}
1486#endif 1443#endif
1487 1444
1488/* arch-tag: 662bc9c4-f8e2-41b6-bf96-b8346d0ce0d8
1489 (do not change this comment) */
diff --git a/src/syntax.c b/src/syntax.c
index 2f4f5236a40..567f01385d7 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -371,23 +371,10 @@ char_quoted (EMACS_INT charpos, EMACS_INT bytepos)
371 return quoted; 371 return quoted;
372} 372}
373 373
374/* Return the bytepos one character after BYTEPOS.
375 We assume that BYTEPOS is not at the end of the buffer. */
376
377INLINE EMACS_INT
378inc_bytepos (EMACS_INT bytepos)
379{
380 if (NILP (current_buffer->enable_multibyte_characters))
381 return bytepos + 1;
382
383 INC_POS (bytepos);
384 return bytepos;
385}
386
387/* Return the bytepos one character before BYTEPOS. 374/* Return the bytepos one character before BYTEPOS.
388 We assume that BYTEPOS is not at the start of the buffer. */ 375 We assume that BYTEPOS is not at the start of the buffer. */
389 376
390INLINE EMACS_INT 377static INLINE EMACS_INT
391dec_bytepos (EMACS_INT bytepos) 378dec_bytepos (EMACS_INT bytepos)
392{ 379{
393 if (NILP (current_buffer->enable_multibyte_characters)) 380 if (NILP (current_buffer->enable_multibyte_characters))
diff --git a/src/sysdep.c b/src/sysdep.c
index f68d475d22c..ac766058d34 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -90,12 +90,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
90#include "dispextern.h" 90#include "dispextern.h"
91#include "process.h" 91#include "process.h"
92#include "cm.h" /* for reset_sys_modes */ 92#include "cm.h" /* for reset_sys_modes */
93#ifdef HAVE_TERM_H
94/* Include this last. If it is ncurses header file, it adds a lot of
95 defines that interfere with stuff in other headers. Someone responsible
96 for ncurses messed up bigtime. See bug#6812. */
97#include <term.h>
98#endif
99 93
100#ifdef WINDOWSNT 94#ifdef WINDOWSNT
101#include <direct.h> 95#include <direct.h>
@@ -123,6 +117,9 @@ struct utimbuf {
123#endif 117#endif
124#endif 118#endif
125 119
120/* Declare here, including term.h is problematic on some systems. */
121extern void tputs (const char *, int, int (*)(int));
122
126static const int baud_convert[] = 123static const int baud_convert[] =
127 { 124 {
128 0, 50, 75, 110, 135, 150, 200, 300, 600, 1200, 125 0, 50, 75, 110, 135, 150, 200, 300, 600, 1200,
@@ -232,8 +229,8 @@ discard_tty_input (void)
232 { 229 {
233 if (tty->input) /* Is the device suspended? */ 230 if (tty->input) /* Is the device suspended? */
234 { 231 {
235 EMACS_GET_TTY (fileno (tty->input), &buf); 232 emacs_get_tty (fileno (tty->input), &buf);
236 EMACS_SET_TTY (fileno (tty->input), &buf, 0); 233 emacs_set_tty (fileno (tty->input), &buf, 0);
237 } 234 }
238 } 235 }
239 } 236 }
@@ -369,7 +366,7 @@ child_setup_tty (int out)
369#ifndef WINDOWSNT 366#ifndef WINDOWSNT
370 struct emacs_tty s; 367 struct emacs_tty s;
371 368
372 EMACS_GET_TTY (out, &s); 369 emacs_get_tty (out, &s);
373 s.main.c_oflag |= OPOST; /* Enable output postprocessing */ 370 s.main.c_oflag |= OPOST; /* Enable output postprocessing */
374 s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ 371 s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */
375#ifdef NLDLY 372#ifdef NLDLY
@@ -447,7 +444,7 @@ child_setup_tty (int out)
447 s.main.c_cc[VTIME] = 0; 444 s.main.c_cc[VTIME] = 0;
448#endif 445#endif
449 446
450 EMACS_SET_TTY (out, &s, 0); 447 emacs_set_tty (out, &s, 0);
451#endif /* not WINDOWSNT */ 448#endif /* not WINDOWSNT */
452} 449}
453#endif /* not MSDOS */ 450#endif /* not MSDOS */
@@ -557,15 +554,6 @@ sys_subshell (void)
557 554
558 close_process_descs (); /* Close Emacs's pipes/ptys */ 555 close_process_descs (); /* Close Emacs's pipes/ptys */
559 556
560#ifdef SET_EMACS_PRIORITY
561 {
562 extern EMACS_INT emacs_priority;
563
564 if (emacs_priority < 0)
565 nice (-emacs_priority);
566 }
567#endif
568
569#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ 557#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */
570 { 558 {
571 char *epwd = getenv ("PWD"); 559 char *epwd = getenv ("PWD");
@@ -859,7 +847,7 @@ init_sys_modes (struct tty_display_info *tty_out)
859 if (! tty_out->old_tty) 847 if (! tty_out->old_tty)
860 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); 848 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty));
861 849
862 EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty); 850 emacs_get_tty (fileno (tty_out->input), tty_out->old_tty);
863 851
864 tty = *tty_out->old_tty; 852 tty = *tty_out->old_tty;
865 853
@@ -1005,7 +993,7 @@ init_sys_modes (struct tty_display_info *tty_out)
1005 dos_ttraw (tty_out); 993 dos_ttraw (tty_out);
1006#endif 994#endif
1007 995
1008 EMACS_SET_TTY (fileno (tty_out->input), &tty, 0); 996 emacs_set_tty (fileno (tty_out->input), &tty, 0);
1009 997
1010 /* This code added to insure that, if flow-control is not to be used, 998 /* This code added to insure that, if flow-control is not to be used,
1011 we have an unlocked terminal at the start. */ 999 we have an unlocked terminal at the start. */
@@ -1097,8 +1085,16 @@ tabs_safe_p (int fd)
1097{ 1085{
1098 struct emacs_tty etty; 1086 struct emacs_tty etty;
1099 1087
1100 EMACS_GET_TTY (fd, &etty); 1088 emacs_get_tty (fd, &etty);
1101 return EMACS_TTY_TABS_OK (&etty); 1089#ifndef DOS_NT
1090#ifdef TABDLY
1091 return ((etty.main.c_oflag & TABDLY) != TAB3);
1092#else /* not TABDLY */
1093 return 1;
1094#endif /* not TABDLY */
1095#else /* DOS_NT */
1096 return 0;
1097#endif /* DOS_NT */
1102} 1098}
1103 1099
1104/* Get terminal size from system. 1100/* Get terminal size from system.
@@ -1260,7 +1256,7 @@ reset_sys_modes (struct tty_display_info *tty_out)
1260#endif /* F_SETFL */ 1256#endif /* F_SETFL */
1261 1257
1262 if (tty_out->old_tty) 1258 if (tty_out->old_tty)
1263 while (EMACS_SET_TTY (fileno (tty_out->input), 1259 while (emacs_set_tty (fileno (tty_out->input),
1264 tty_out->old_tty, 0) < 0 && errno == EINTR) 1260 tty_out->old_tty, 0) < 0 && errno == EINTR)
1265 ; 1261 ;
1266 1262
@@ -3071,6 +3067,3 @@ system_process_attributes (Lisp_Object pid)
3071 3067
3072#endif /* !defined (WINDOWSNT) */ 3068#endif /* !defined (WINDOWSNT) */
3073 3069
3074
3075/* arch-tag: edb43589-4e09-4544-b325-978b5b121dcf
3076 (do not change this comment) */
diff --git a/src/systty.h b/src/systty.h
index 8c46411cedb..59850e7c321 100644
--- a/src/systty.h
+++ b/src/systty.h
@@ -26,9 +26,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26#include <fcntl.h> 26#include <fcntl.h>
27#endif /* not DOS_NT */ 27#endif /* not DOS_NT */
28 28
29#ifdef HAVE_SYS_IOCTL_H
30#include <sys/ioctl.h> 29#include <sys/ioctl.h>
31#endif
32 30
33#ifdef HPUX 31#ifdef HPUX
34#include <sys/bsdtty.h> 32#include <sys/bsdtty.h>
@@ -86,17 +84,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
86 84
87/* Manipulate a terminal's current process group. */ 85/* Manipulate a terminal's current process group. */
88 86
89/* EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's
90 current process group. Return -1 if there is an error.
91
92 EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's
93 current process group to *PGID. Return -1 if there is an error. */
94
95#ifndef DOS_NT
96#define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd)))
97#define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid)))
98#endif /* not DOS_NT */
99
100/* EMACS_GETPGRP (arg) returns the process group of the process. */ 87/* EMACS_GETPGRP (arg) returns the process group of the process. */
101 88
102#if defined (GETPGRP_VOID) 89#if defined (GETPGRP_VOID)
@@ -112,21 +99,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
112 state, for example a struct tchars, a struct sgttyb, a struct 99 state, for example a struct tchars, a struct sgttyb, a struct
113 tchars, a struct ltchars, and a struct pagechars, struct 100 tchars, a struct ltchars, and a struct pagechars, struct
114 emacs_tty should contain an element for each parameter struct 101 emacs_tty should contain an element for each parameter struct
115 that Emacs may change. 102 that Emacs may change. */
116
117 EMACS_GET_TTY (int FD, struct emacs_tty *P) stores the parameters
118 of the tty on FD in *P. Return zero if all's well, or -1 if we ran
119 into an error we couldn't deal with.
120
121 EMACS_SET_TTY (int FD, struct emacs_tty *P, int flushp)
122 sets the parameters of the tty on FD according to the contents of
123 *P. If flushp is non-zero, we discard queued input to be
124 written before making the change.
125 Return 0 if all went well, and -1 if anything failed.
126
127 EMACS_TTY_TABS_OK (struct emacs_tty *P) is false if the kernel
128 expands tabs to spaces upon output; in that case, there is no
129 advantage to using tabs over spaces. */
130 103
131 104
132/* For each tty parameter structure that Emacs might want to save and restore, 105/* For each tty parameter structure that Emacs might want to save and restore,
@@ -145,31 +118,6 @@ struct emacs_tty {
145#endif /* DOS_NT */ 118#endif /* DOS_NT */
146}; 119};
147 120
148/* Define EMACS_GET_TTY and EMACS_SET_TTY,
149 the macros for reading and setting parts of `struct emacs_tty'.
150
151 These got pretty unmanageable (huge macros are hard to debug), and
152 finally needed some code which couldn't be done as part of an
153 expression, so we moved them out to their own functions in sysdep.c. */
154#define EMACS_GET_TTY(fd, p) (emacs_get_tty ((fd), (p)))
155#define EMACS_SET_TTY(fd, p, waitp) (emacs_set_tty ((fd), (p), (waitp)))
156extern int emacs_get_tty (int, struct emacs_tty *); 121extern int emacs_get_tty (int, struct emacs_tty *);
157extern int emacs_set_tty (int, struct emacs_tty *, int); 122extern int emacs_set_tty (int, struct emacs_tty *, int);
158 123
159
160/* Define EMACS_TTY_TABS_OK. */
161
162#ifndef DOS_NT
163
164#ifdef TABDLY
165#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3)
166#else /* not TABDLY */
167#define EMACS_TTY_TABS_OK(p) 1
168#endif /* not TABDLY */
169
170#else /* DOS_NT */
171#define EMACS_TTY_TABS_OK(p) 0
172#endif /* DOS_NT */
173
174/* arch-tag: cf4b90bc-be41-401c-be98-40619178a712
175 (do not change this comment) */
diff --git a/src/term.c b/src/term.c
index 4baea231de3..a684edc5a85 100644
--- a/src/term.c
+++ b/src/term.c
@@ -66,6 +66,10 @@ extern int tgetent (char *, const char *);
66extern int tgetflag (char *id); 66extern int tgetflag (char *id);
67extern int tgetnum (char *id); 67extern int tgetnum (char *id);
68 68
69char *tparam (char *, char *, int, int, ...);
70
71extern char *tgetstr (char *, char **);
72
69#include "cm.h" 73#include "cm.h"
70#ifdef HAVE_X_WINDOWS 74#ifdef HAVE_X_WINDOWS
71#include "xterm.h" 75#include "xterm.h"
@@ -176,32 +180,15 @@ static int no_controlling_tty;
176 180
177static int system_uses_terminfo; 181static int system_uses_terminfo;
178 182
179char *tparam (char *, char *, int, int, ...);
180
181extern char *tgetstr (char *, char **);
182 183
183 184
184#ifdef HAVE_GPM 185#ifdef HAVE_GPM
185#include <sys/fcntl.h> 186#include <sys/fcntl.h>
186 187
187static void term_clear_mouse_face (void);
188static void term_mouse_highlight (struct frame *f, int x, int y);
189
190/* The device for which we have enabled gpm support (or NULL). */ 188/* The device for which we have enabled gpm support (or NULL). */
191struct tty_display_info *gpm_tty = NULL; 189struct tty_display_info *gpm_tty = NULL;
192 190
193/* These variables describe the range of text currently shown in its 191/* Last recorded mouse coordinates. */
194 mouse-face, together with the window they apply to. As long as
195 the mouse stays within this range, we need not redraw anything on
196 its account. Rows and columns are glyph matrix positions in
197 MOUSE_FACE_WINDOW. */
198static int mouse_face_beg_row, mouse_face_beg_col;
199static int mouse_face_end_row, mouse_face_end_col;
200static int mouse_face_past_end;
201static Lisp_Object mouse_face_window;
202static int mouse_face_face_id;
203
204static int pos_x, pos_y;
205static int last_mouse_x, last_mouse_y; 192static int last_mouse_x, last_mouse_y;
206#endif /* HAVE_GPM */ 193#endif /* HAVE_GPM */
207 194
@@ -1501,6 +1488,8 @@ static void append_glyph (struct it *);
1501static void produce_stretch_glyph (struct it *); 1488static void produce_stretch_glyph (struct it *);
1502static void append_composite_glyph (struct it *); 1489static void append_composite_glyph (struct it *);
1503static void produce_composite_glyph (struct it *); 1490static void produce_composite_glyph (struct it *);
1491static void append_glyphless_glyph (struct it *, int, char *);
1492static void produce_glyphless_glyph (struct it *, int, Lisp_Object);
1504 1493
1505/* Append glyphs to IT's glyph_row. Called from produce_glyphs for 1494/* Append glyphs to IT's glyph_row. Called from produce_glyphs for
1506 terminal frames if IT->glyph_row != NULL. IT->char_to_display is 1495 terminal frames if IT->glyph_row != NULL. IT->char_to_display is
@@ -1609,6 +1598,12 @@ produce_glyphs (struct it *it)
1609 goto done; 1598 goto done;
1610 } 1599 }
1611 1600
1601 if (it->what == IT_GLYPHLESS)
1602 {
1603 produce_glyphless_glyph (it, 0, Qnil);
1604 goto done;
1605 }
1606
1612 if (it->char_to_display >= 040 && it->char_to_display < 0177) 1607 if (it->char_to_display >= 040 && it->char_to_display < 0177)
1613 { 1608 {
1614 it->pixel_width = it->nglyphs = 1; 1609 it->pixel_width = it->nglyphs = 1;
@@ -1660,11 +1655,22 @@ produce_glyphs (struct it *it)
1660 } 1655 }
1661 else 1656 else
1662 { 1657 {
1663 it->pixel_width = CHAR_WIDTH (it->char_to_display); 1658 Lisp_Object charset_list = FRAME_TERMINAL (it->f)->charset_list;
1664 it->nglyphs = it->pixel_width;
1665 1659
1666 if (it->glyph_row) 1660 if (char_charset (it->char_to_display, charset_list, NULL))
1667 append_glyph (it); 1661 {
1662 it->pixel_width = CHAR_WIDTH (it->char_to_display);
1663 it->nglyphs = it->pixel_width;
1664 if (it->glyph_row)
1665 append_glyph (it);
1666 }
1667 else
1668 {
1669 Lisp_Object acronym = lookup_glyphless_char_display (-1, it);
1670
1671 xassert (it->what == IT_GLYPHLESS);
1672 produce_glyphless_glyph (it, 1, acronym);
1673 }
1668 } 1674 }
1669 1675
1670 done: 1676 done:
@@ -1844,6 +1850,152 @@ produce_composite_glyph (struct it *it)
1844} 1850}
1845 1851
1846 1852
1853/* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID
1854 is a face ID to be used for the glyph. What is actually appended
1855 are glyphs of type CHAR_GLYPH whose characters are in STR (which
1856 comes from it->nglyphs bytes). */
1857
1858static void
1859append_glyphless_glyph (struct it *it, int face_id, char *str)
1860{
1861 struct glyph *glyph, *end;
1862 int i;
1863
1864 xassert (it->glyph_row);
1865 glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area];
1866 end = it->glyph_row->glyphs[1 + it->area];
1867
1868 /* If the glyph row is reversed, we need to prepend the glyph rather
1869 than append it. */
1870 if (it->glyph_row->reversed_p && it->area == TEXT_AREA)
1871 {
1872 struct glyph *g;
1873 int move_by = it->pixel_width;
1874
1875 /* Make room for the new glyphs. */
1876 if (move_by > end - glyph) /* don't overstep end of this area */
1877 move_by = end - glyph;
1878 for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--)
1879 g[move_by] = *g;
1880 glyph = it->glyph_row->glyphs[it->area];
1881 end = glyph + move_by;
1882 }
1883
1884 if (glyph >= end)
1885 return;
1886 glyph->type = CHAR_GLYPH;
1887 glyph->pixel_width = 1;
1888 glyph->face_id = face_id;
1889 glyph->padding_p = 0;
1890 glyph->charpos = CHARPOS (it->position);
1891 glyph->object = it->object;
1892 if (it->bidi_p)
1893 {
1894 glyph->resolved_level = it->bidi_it.resolved_level;
1895 if ((it->bidi_it.type & 7) != it->bidi_it.type)
1896 abort ();
1897 glyph->bidi_type = it->bidi_it.type;
1898 }
1899 else
1900 {
1901 glyph->resolved_level = 0;
1902 glyph->bidi_type = UNKNOWN_BT;
1903 }
1904
1905 /* BIDI Note: we put the glyphs of characters left to right, even in
1906 the REVERSED_P case because we write to the terminal
1907 left-to-right. */
1908 for (i = 0; i < it->nglyphs && glyph < end; ++i)
1909 {
1910 if (i > 0)
1911 glyph[0] = glyph[-1];
1912 glyph->u.ch = str[i];
1913 ++it->glyph_row->used[it->area];
1914 ++glyph;
1915 }
1916}
1917
1918/* Produce glyphs for a glyphless character for iterator IT.
1919 IT->glyphless_method specifies which method to use for displaying
1920 the character. See the description of enum
1921 glyphless_display_method in dispextern.h for the details.
1922
1923 FOR_NO_FONT is nonzero if and only if this is for a character that
1924 is not supproted by the coding system of the terminal. ACRONYM, if
1925 non-nil, is an acronym string for the character.
1926
1927 The glyphs actually produced are of type CHAR_GLYPH. */
1928
1929static void
1930produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
1931{
1932 int face_id;
1933 int len;
1934 char buf[9], *str = " ";
1935
1936 /* Get a face ID for the glyph by utilizing a cache (the same way as
1937 done for `escape-glyph' in get_next_display_element). */
1938 if (it->f == last_glyphless_glyph_frame
1939 && it->face_id == last_glyphless_glyph_face_id)
1940 {
1941 face_id = last_glyphless_glyph_merged_face_id;
1942 }
1943 else
1944 {
1945 /* Merge the `glyphless-char' face into the current face. */
1946 face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id);
1947 last_glyphless_glyph_frame = it->f;
1948 last_glyphless_glyph_face_id = it->face_id;
1949 last_glyphless_glyph_merged_face_id = face_id;
1950 }
1951
1952 if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE)
1953 {
1954 /* As there's no way to produce a thin space, we produce a space
1955 of canonical width. */
1956 len = 1;
1957 }
1958 else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX)
1959 {
1960 len = CHAR_WIDTH (it->c);
1961 if (len == 0)
1962 len = 1;
1963 else if (len > 4)
1964 len = 4;
1965 sprintf (buf, "[%.*s]", len, str);
1966 len += 2;
1967 str = buf;
1968 }
1969 else
1970 {
1971 if (it->glyphless_method == GLYPHLESS_DISPLAY_ACRONYM)
1972 {
1973 if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display))
1974 acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c);
1975 buf[0] = '[';
1976 str = STRINGP (acronym) ? (char *) SDATA (acronym) : "";
1977 for (len = 0; len < 6 && str[len] && ASCII_BYTE_P (str[len]); len++)
1978 buf[1 + len] = str[len];
1979 buf[1 + len] = ']';
1980 len += 2;
1981 }
1982 else
1983 {
1984 xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE);
1985 len = (it->c < 0x10000 ? sprintf (buf, "\\u%04X", it->c)
1986 : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "\\U%06X", it->c)
1987 : sprintf (buf, "\\x%06X", it->c));
1988 }
1989 str = buf;
1990 }
1991
1992 it->pixel_width = len;
1993 it->nglyphs = len;
1994 if (len > 0 && it->glyph_row)
1995 append_glyphless_glyph (it, face_id, str);
1996}
1997
1998
1847/* Get information about special display element WHAT in an 1999/* Get information about special display element WHAT in an
1848 environment described by IT. WHAT is one of IT_TRUNCATION or 2000 environment described by IT. WHAT is one of IT_TRUNCATION or
1849 IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a 2001 IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a
@@ -2517,416 +2669,36 @@ term_mouse_moveto (int x, int y)
2517 last_mouse_y = y; */ 2669 last_mouse_y = y; */
2518} 2670}
2519 2671
2520static void 2672/* Implementation of draw_row_with_mouse_face for TTY/GPM. */
2521term_show_mouse_face (enum draw_glyphs_face draw) 2673void
2674tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row,
2675 int start_hpos, int end_hpos,
2676 enum draw_glyphs_face draw)
2522{ 2677{
2523 struct window *w = XWINDOW (mouse_face_window); 2678 int nglyphs = end_hpos - start_hpos;
2524 int save_x, save_y; 2679 struct frame *f = XFRAME (WINDOW_FRAME (w));
2525 int i;
2526
2527 struct frame *f = XFRAME (w->frame);
2528 struct tty_display_info *tty = FRAME_TTY (f); 2680 struct tty_display_info *tty = FRAME_TTY (f);
2681 int face_id = tty->mouse_highlight.mouse_face_face_id;
2682 int save_x, save_y, pos_x, pos_y;
2529 2683
2530 if (/* If window is in the process of being destroyed, don't bother 2684 if (end_hpos >= row->used[TEXT_AREA])
2531 to do anything. */ 2685 nglyphs = row->used[TEXT_AREA] - start_hpos;
2532 w->current_matrix != NULL
2533 /* Recognize when we are called to operate on rows that don't exist
2534 anymore. This can happen when a window is split. */
2535 && mouse_face_end_row < w->current_matrix->nrows)
2536 {
2537 /* write_glyphs writes at cursor position, so we need to
2538 temporarily move cursor coordinates to the beginning of
2539 the highlight region. */
2540
2541 /* Save current cursor co-ordinates */
2542 save_y = curY (tty);
2543 save_x = curX (tty);
2544 2686
2545 /* Note that mouse_face_beg_row etc. are window relative. */ 2687 pos_y = row->y + WINDOW_TOP_EDGE_Y (w);
2546 for (i = mouse_face_beg_row; i <= mouse_face_end_row; i++) 2688 pos_x = row->used[LEFT_MARGIN_AREA] + start_hpos + WINDOW_LEFT_EDGE_X (w);
2547 {
2548 int start_hpos, end_hpos, nglyphs;
2549 struct glyph_row *row = MATRIX_ROW (w->current_matrix, i);
2550
2551 /* Don't do anything if row doesn't have valid contents. */
2552 if (!row->enabled_p)
2553 continue;
2554 2689
2555 /* For all but the first row, the highlight starts at column 0. */ 2690 /* Save current cursor co-ordinates. */
2556 if (i == mouse_face_beg_row) 2691 save_y = curY (tty);
2557 start_hpos = mouse_face_beg_col; 2692 save_x = curX (tty);
2558 else 2693 cursor_to (f, pos_y, pos_x);
2559 start_hpos = 0;
2560 2694
2561 if (i == mouse_face_end_row) 2695 if (draw == DRAW_MOUSE_FACE)
2562 end_hpos = mouse_face_end_col; 2696 tty_write_glyphs_with_face (f, row->glyphs[TEXT_AREA] + start_hpos,
2563 else 2697 nglyphs, face_id);
2564 { 2698 else if (draw == DRAW_NORMAL_TEXT)
2565 end_hpos = row->used[TEXT_AREA]; 2699 write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs);
2566 if (draw == DRAW_NORMAL_TEXT)
2567 row->fill_line_p = 1; /* Clear to end of line */
2568 }
2569 2700
2570 if (end_hpos <= start_hpos) 2701 cursor_to (f, save_y, save_x);
2571 continue;
2572 /* Record that some glyphs of this row are displayed in
2573 mouse-face. */
2574 row->mouse_face_p = draw > 0;
2575
2576 nglyphs = end_hpos - start_hpos;
2577
2578 if (end_hpos >= row->used[TEXT_AREA])
2579 nglyphs = row->used[TEXT_AREA] - start_hpos;
2580
2581 pos_y = row->y + WINDOW_TOP_EDGE_Y (w);
2582 pos_x = row->used[LEFT_MARGIN_AREA] + start_hpos
2583 + WINDOW_LEFT_EDGE_X (w);
2584
2585 cursor_to (f, pos_y, pos_x);
2586
2587 if (draw == DRAW_MOUSE_FACE)
2588 {
2589 tty_write_glyphs_with_face (f, row->glyphs[TEXT_AREA] + start_hpos,
2590 nglyphs, mouse_face_face_id);
2591 }
2592 else /* draw == DRAW_NORMAL_TEXT */
2593 write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs);
2594 }
2595 cursor_to (f, save_y, save_x);
2596 }
2597}
2598
2599static void
2600term_clear_mouse_face (void)
2601{
2602 if (!NILP (mouse_face_window))
2603 term_show_mouse_face (DRAW_NORMAL_TEXT);
2604
2605 mouse_face_beg_row = mouse_face_beg_col = -1;
2606 mouse_face_end_row = mouse_face_end_col = -1;
2607 mouse_face_window = Qnil;
2608}
2609
2610/* Find the glyph matrix position of buffer position POS in window W.
2611 *HPOS and *VPOS are set to the positions found. W's current glyphs
2612 must be up to date. If POS is above window start return (0, 0).
2613 If POS is after end of W, return end of last line in W.
2614 - taken from msdos.c */
2615static int
2616fast_find_position (struct window *w, EMACS_INT pos, int *hpos, int *vpos)
2617{
2618 int i, lastcol, maybe_next_line_p = 0;
2619 EMACS_INT line_start_position;
2620 int yb = window_text_bottom_y (w);
2621 struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row;
2622
2623 while (row->y < yb)
2624 {
2625 if (row->used[TEXT_AREA])
2626 line_start_position = row->glyphs[TEXT_AREA]->charpos;
2627 else
2628 line_start_position = 0;
2629
2630 if (line_start_position > pos)
2631 break;
2632 /* If the position sought is the end of the buffer,
2633 don't include the blank lines at the bottom of the window. */
2634 else if (line_start_position == pos
2635 && pos == BUF_ZV (XBUFFER (w->buffer)))
2636 {
2637 maybe_next_line_p = 1;
2638 break;
2639 }
2640 else if (line_start_position > 0)
2641 best_row = row;
2642
2643 /* Don't overstep the last matrix row, lest we get into the
2644 never-never land... */
2645 if (row->y + 1 >= yb)
2646 break;
2647
2648 ++row;
2649 }
2650
2651 /* Find the right column within BEST_ROW. */
2652 lastcol = 0;
2653 row = best_row;
2654 for (i = 0; i < row->used[TEXT_AREA]; i++)
2655 {
2656 struct glyph *glyph = row->glyphs[TEXT_AREA] + i;
2657 EMACS_INT charpos;
2658
2659 charpos = glyph->charpos;
2660 if (charpos == pos)
2661 {
2662 *hpos = i;
2663 *vpos = row->y;
2664 return 1;
2665 }
2666 else if (charpos > pos)
2667 break;
2668 else if (charpos > 0)
2669 lastcol = i;
2670 }
2671
2672 /* If we're looking for the end of the buffer,
2673 and we didn't find it in the line we scanned,
2674 use the start of the following line. */
2675 if (maybe_next_line_p)
2676 {
2677 ++row;
2678 lastcol = 0;
2679 }
2680
2681 *vpos = row->y;
2682 *hpos = lastcol + 1;
2683 return 0;
2684}
2685
2686static void
2687term_mouse_highlight (struct frame *f, int x, int y)
2688{
2689 enum window_part part;
2690 Lisp_Object window;
2691 struct window *w;
2692 struct buffer *b;
2693
2694 if (NILP (Vmouse_highlight)
2695 || !f->glyphs_initialized_p)
2696 return;
2697
2698 /* Which window is that in? */
2699 window = window_from_coordinates (f, x, y, &part, &x, &y, 0);
2700
2701 /* Not on a window -> return. */
2702 if (!WINDOWP (window))
2703 return;
2704
2705 if (!EQ (window, mouse_face_window))
2706 term_clear_mouse_face ();
2707
2708 w = XWINDOW (window);
2709
2710 /* Are we in a window whose display is up to date?
2711 And verify the buffer's text has not changed. */
2712 b = XBUFFER (w->buffer);
2713 if (part == ON_TEXT
2714 && EQ (w->window_end_valid, w->buffer)
2715 && XFASTINT (w->last_modified) == BUF_MODIFF (b)
2716 && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b))
2717 {
2718 int i, nrows = w->current_matrix->nrows;
2719 EMACS_INT pos;
2720 struct glyph_row *row;
2721 struct glyph *glyph;
2722
2723 /* Find the glyph under X/Y. */
2724 glyph = NULL;
2725 if (y >= 0 && y < nrows)
2726 {
2727 row = MATRIX_ROW (w->current_matrix, y);
2728 /* Give up if some row before the one we are looking for is
2729 not enabled. */
2730 for (i = 0; i <= y; i++)
2731 if (!MATRIX_ROW (w->current_matrix, i)->enabled_p)
2732 break;
2733 if (i > y /* all rows upto and including the one at Y are enabled */
2734 && row->displays_text_p
2735 && x < window_box_width (w, TEXT_AREA))
2736 {
2737 glyph = row->glyphs[TEXT_AREA];
2738 if (x >= row->used[TEXT_AREA])
2739 glyph = NULL;
2740 else
2741 {
2742 glyph += x;
2743 if (!BUFFERP (glyph->object))
2744 glyph = NULL;
2745 }
2746 }
2747 }
2748
2749 /* Clear mouse face if X/Y not over text. */
2750 if (glyph == NULL)
2751 {
2752 term_clear_mouse_face ();
2753 return;
2754 }
2755
2756 if (!BUFFERP (glyph->object))
2757 abort ();
2758 pos = glyph->charpos;
2759
2760 /* Check for mouse-face. */
2761 {
2762 Lisp_Object mouse_face, overlay, position, *overlay_vec;
2763 int noverlays;
2764 EMACS_INT obegv, ozv;
2765 struct buffer *obuf;
2766
2767 /* If we get an out-of-range value, return now; avoid an error. */
2768 if (pos > BUF_Z (b))
2769 return;
2770
2771 /* Make the window's buffer temporarily current for
2772 overlays_at and compute_char_face. */
2773 obuf = current_buffer;
2774 current_buffer = b;
2775 obegv = BEGV;
2776 ozv = ZV;
2777 BEGV = BEG;
2778 ZV = Z;
2779
2780 /* Is this char mouse-active? */
2781 XSETINT (position, pos);
2782
2783 /* Put all the overlays we want in a vector in overlay_vec. */
2784 GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0);
2785 /* Sort overlays into increasing priority order. */
2786 noverlays = sort_overlays (overlay_vec, noverlays, w);
2787
2788 /* Check mouse-face highlighting. */
2789 if (!(EQ (window, mouse_face_window)
2790 && y >= mouse_face_beg_row
2791 && y <= mouse_face_end_row
2792 && (y > mouse_face_beg_row
2793 || x >= mouse_face_beg_col)
2794 && (y < mouse_face_end_row
2795 || x < mouse_face_end_col
2796 || mouse_face_past_end)))
2797 {
2798 /* Clear the display of the old active region, if any. */
2799 term_clear_mouse_face ();
2800
2801 /* Find the highest priority overlay that has a mouse-face
2802 property. */
2803 overlay = Qnil;
2804 for (i = noverlays - 1; i >= 0; --i)
2805 {
2806 mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face);
2807 if (!NILP (mouse_face))
2808 {
2809 overlay = overlay_vec[i];
2810 break;
2811 }
2812 }
2813
2814 /* If no overlay applies, get a text property. */
2815 if (NILP (overlay))
2816 mouse_face = Fget_text_property (position, Qmouse_face,
2817 w->buffer);
2818
2819 /* Handle the overlay case. */
2820 if (!NILP (overlay))
2821 {
2822 /* Find the range of text around this char that
2823 should be active. */
2824 Lisp_Object before, after;
2825 EMACS_INT ignore;
2826
2827
2828 before = Foverlay_start (overlay);
2829 after = Foverlay_end (overlay);
2830 /* Record this as the current active region. */
2831 fast_find_position (w, XFASTINT (before),
2832 &mouse_face_beg_col,
2833 &mouse_face_beg_row);
2834
2835 mouse_face_past_end
2836 = !fast_find_position (w, XFASTINT (after),
2837 &mouse_face_end_col,
2838 &mouse_face_end_row);
2839 mouse_face_window = window;
2840
2841 mouse_face_face_id
2842 = face_at_buffer_position (w, pos, 0, 0,
2843 &ignore, pos + 1, 1, -1);
2844
2845 /* Display it as active. */
2846 term_show_mouse_face (DRAW_MOUSE_FACE);
2847 }
2848 /* Handle the text property case. */
2849 else if (!NILP (mouse_face))
2850 {
2851 /* Find the range of text around this char that
2852 should be active. */
2853 Lisp_Object before, after, beginning, end;
2854 EMACS_INT ignore;
2855
2856 beginning = Fmarker_position (w->start);
2857 XSETINT (end, (BUF_Z (b) - XFASTINT (w->window_end_pos)));
2858 before
2859 = Fprevious_single_property_change (make_number (pos + 1),
2860 Qmouse_face,
2861 w->buffer, beginning);
2862 after
2863 = Fnext_single_property_change (position, Qmouse_face,
2864 w->buffer, end);
2865
2866 /* Record this as the current active region. */
2867 fast_find_position (w, XFASTINT (before),
2868 &mouse_face_beg_col,
2869 &mouse_face_beg_row);
2870 mouse_face_past_end
2871 = !fast_find_position (w, XFASTINT (after),
2872 &mouse_face_end_col,
2873 &mouse_face_end_row);
2874 mouse_face_window = window;
2875
2876 mouse_face_face_id
2877 = face_at_buffer_position (w, pos, 0, 0,
2878 &ignore, pos + 1, 1, -1);
2879
2880 /* Display it as active. */
2881 term_show_mouse_face (DRAW_MOUSE_FACE);
2882 }
2883 }
2884
2885 /* Look for a `help-echo' property. */
2886 {
2887 Lisp_Object help;
2888
2889 /* Check overlays first. */
2890 help = Qnil;
2891 for (i = noverlays - 1; i >= 0 && NILP (help); --i)
2892 {
2893 overlay = overlay_vec[i];
2894 help = Foverlay_get (overlay, Qhelp_echo);
2895 }
2896
2897 if (!NILP (help))
2898 {
2899 help_echo_string = help;
2900 help_echo_window = window;
2901 help_echo_object = overlay;
2902 help_echo_pos = pos;
2903 }
2904 /* Try text properties. */
2905 else if (NILP (help)
2906 && ((STRINGP (glyph->object)
2907 && glyph->charpos >= 0
2908 && glyph->charpos < SCHARS (glyph->object))
2909 || (BUFFERP (glyph->object)
2910 && glyph->charpos >= BEGV
2911 && glyph->charpos < ZV)))
2912 {
2913 help = Fget_text_property (make_number (glyph->charpos),
2914 Qhelp_echo, glyph->object);
2915 if (!NILP (help))
2916 {
2917 help_echo_string = help;
2918 help_echo_window = window;
2919 help_echo_object = glyph->object;
2920 help_echo_pos = glyph->charpos;
2921 }
2922 }
2923 }
2924
2925 BEGV = obegv;
2926 ZV = ozv;
2927 current_buffer = obuf;
2928 }
2929 }
2930} 2702}
2931 2703
2932static int 2704static int
@@ -2936,7 +2708,7 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event)
2936 if (event->x != last_mouse_x || event->y != last_mouse_y) 2708 if (event->x != last_mouse_x || event->y != last_mouse_y)
2937 { 2709 {
2938 frame->mouse_moved = 1; 2710 frame->mouse_moved = 1;
2939 term_mouse_highlight (frame, event->x, event->y); 2711 note_mouse_highlight (frame, event->x, event->y);
2940 /* Remember which glyph we're now on. */ 2712 /* Remember which glyph we're now on. */
2941 last_mouse_x = event->x; 2713 last_mouse_x = event->x;
2942 last_mouse_y = event->y; 2714 last_mouse_y = event->y;
@@ -3309,8 +3081,7 @@ static void
3309dissociate_if_controlling_tty (int fd) 3081dissociate_if_controlling_tty (int fd)
3310{ 3082{
3311#ifndef DOS_NT 3083#ifndef DOS_NT
3312 int pgid; 3084 int pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */
3313 EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */
3314 if (pgid != -1) 3085 if (pgid != -1)
3315 { 3086 {
3316#if defined (USG5) 3087#if defined (USG5)
@@ -3407,7 +3178,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
3407 3178
3408#ifdef HAVE_GPM 3179#ifdef HAVE_GPM
3409 terminal->mouse_position_hook = term_mouse_position; 3180 terminal->mouse_position_hook = term_mouse_position;
3410 mouse_face_window = Qnil; 3181 tty->mouse_highlight.mouse_face_window = Qnil;
3411#endif 3182#endif
3412 3183
3413 3184
@@ -4042,8 +3813,6 @@ bigger, or it may make it blink, or it may do nothing at all. */);
4042#ifdef HAVE_GPM 3813#ifdef HAVE_GPM
4043 defsubr (&Sgpm_mouse_start); 3814 defsubr (&Sgpm_mouse_start);
4044 defsubr (&Sgpm_mouse_stop); 3815 defsubr (&Sgpm_mouse_stop);
4045
4046 staticpro (&mouse_face_window);
4047#endif /* HAVE_GPM */ 3816#endif /* HAVE_GPM */
4048 3817
4049#ifndef DOS_NT 3818#ifndef DOS_NT
@@ -4056,7 +3825,3 @@ bigger, or it may make it blink, or it may do nothing at all. */);
4056 encode_terminal_dst = NULL; 3825 encode_terminal_dst = NULL;
4057} 3826}
4058 3827
4059
4060
4061/* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193
4062 (do not change this comment) */
diff --git a/src/termchar.h b/src/termchar.h
index 8135ac723e5..ac652640b17 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -34,18 +34,18 @@ struct tty_output
34struct tty_display_info 34struct tty_display_info
35{ 35{
36 struct tty_display_info *next; /* Chain of all tty devices. */ 36 struct tty_display_info *next; /* Chain of all tty devices. */
37 37
38 char *name; /* The name of the device file or 0 if 38 char *name; /* The name of the device file or 0 if
39 stdin/stdout. */ 39 stdin/stdout. */
40 char *type; /* The type of the tty. */ 40 char *type; /* The type of the tty. */
41 41
42 /* Input/output */ 42 /* Input/output */
43 43
44 FILE *input; /* The stream to be used for terminal input. 44 FILE *input; /* The stream to be used for terminal input.
45 NULL if the terminal is suspended. */ 45 NULL if the terminal is suspended. */
46 FILE *output; /* The stream to be used for terminal output. 46 FILE *output; /* The stream to be used for terminal output.
47 NULL if the terminal is suspended. */ 47 NULL if the terminal is suspended. */
48 48
49 FILE *termscript; /* If nonzero, send all terminal output 49 FILE *termscript; /* If nonzero, send all terminal output
50 characters to this stream also. */ 50 characters to this stream also. */
51 51
@@ -65,38 +65,14 @@ struct tty_display_info
65 /* Redisplay. */ 65 /* Redisplay. */
66 66
67 Lisp_Object top_frame; /* The topmost frame on this tty. */ 67 Lisp_Object top_frame; /* The topmost frame on this tty. */
68 68
69 /* The previous frame we displayed on this tty. */ 69 /* The previous frame we displayed on this tty. */
70 struct frame *previous_frame; 70 struct frame *previous_frame;
71 int previous_color_mode; 71 int previous_color_mode;
72 72
73#ifdef MSDOS 73 /* Information about the range of text currently shown in
74 /* These variables describe the range of text currently shown in its 74 mouse-face. */
75 mouse-face, together with the window they apply to. As long as 75 Mouse_HLInfo mouse_highlight;
76 the mouse stays within this range, we need not redraw anything on
77 its account. Rows and columns are glyph matrix positions in
78 MOUSE_FACE_WINDOW. */
79 int mouse_face_beg_row, mouse_face_beg_col;
80 int mouse_face_end_row, mouse_face_end_col;
81 int mouse_face_past_end;
82 Lisp_Object mouse_face_window;
83 int mouse_face_face_id;
84
85 /* 1 if a mouse motion event came and we didn't handle it right away because
86 gc was in progress. */
87 int mouse_face_deferred_gc;
88
89 /* FRAME and X, Y position of mouse when last checked for
90 highlighting. X and Y can be negative or out of range for the frame. */
91 struct frame *mouse_face_mouse_frame;
92 int mouse_face_mouse_x, mouse_face_mouse_y;
93
94 /* Nonzero means defer mouse-motion highlighting. */
95 int mouse_face_defer;
96
97 /* Nonzero means that the mouse highlight should not be shown. */
98 int mouse_face_hidden;
99#endif /* !MSDOS */
100 76
101 /* Buffer used internally by termcap (see tgetent in the Termcap 77 /* Buffer used internally by termcap (see tgetent in the Termcap
102 manual). Only init_tty and delete_tty should change this. */ 78 manual). Only init_tty and delete_tty should change this. */
@@ -190,12 +166,12 @@ struct tty_display_info
190 int RPov; /* # chars to start a TS_repeat */ 166 int RPov; /* # chars to start a TS_repeat */
191 167
192 int delete_in_insert_mode; /* delete mode == insert mode */ 168 int delete_in_insert_mode; /* delete mode == insert mode */
193 169
194 int se_is_so; /* 1 if same string both enters and leaves 170 int se_is_so; /* 1 if same string both enters and leaves
195 standout mode */ 171 standout mode */
196 172
197 int costs_set; /* Nonzero if costs have been calculated. */ 173 int costs_set; /* Nonzero if costs have been calculated. */
198 174
199 int insert_mode; /* Nonzero when in insert mode. */ 175 int insert_mode; /* Nonzero when in insert mode. */
200 int standout_mode; /* Nonzero when in standout mode. */ 176 int standout_mode; /* Nonzero when in standout mode. */
201 177
@@ -214,7 +190,7 @@ struct tty_display_info
214 lines from those operations. */ 190 lines from those operations. */
215 191
216 int specified_window; 192 int specified_window;
217 193
218 /* Flag used in tty_show/hide_cursor. */ 194 /* Flag used in tty_show/hide_cursor. */
219 195
220 int cursor_hidden; 196 int cursor_hidden;
diff --git a/src/termhooks.h b/src/termhooks.h
index b9358896bae..e71c1159f0c 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -328,6 +328,11 @@ struct terminal
328 /* Parameter alist of this terminal. */ 328 /* Parameter alist of this terminal. */
329 Lisp_Object param_alist; 329 Lisp_Object param_alist;
330 330
331 /* List of charsets supported by the terminal. It is set by
332 Fset_terminal_coding_system_internal along with
333 the member terminal_coding. */
334 Lisp_Object charset_list;
335
331 /* All fields before `next_terminal' should be Lisp_Object and are traced 336 /* All fields before `next_terminal' should be Lisp_Object and are traced
332 by the GC. All fields afterwards are ignored by the GC. */ 337 by the GC. All fields afterwards are ignored by the GC. */
333 338
diff --git a/src/unexcoff.c b/src/unexcoff.c
index 0c6af414d82..fb221dacda2 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -141,8 +141,7 @@ report_error_1 (int fd, const char *msg, int a1, int a2)
141 error (msg, a1, a2); 141 error (msg, a1, a2);
142} 142}
143 143
144static int make_hdr (int, int, unsigned, unsigned, unsigned, 144static int make_hdr (int, int, const char *, const char *);
145 const char *, const char *);
146static int copy_text_and_data (int, int); 145static int copy_text_and_data (int, int);
147static int copy_sym (int, int, const char *, const char *); 146static int copy_sym (int, int, const char *, const char *);
148static void mark_x (const char *); 147static void mark_x (const char *);
diff --git a/src/w16select.c b/src/w16select.c
index 4d471e97911..994ad9e543f 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -1,6 +1,7 @@
1/* 16-bit Windows Selection processing for emacs on MS-Windows 1/* 16-bit Windows Selection processing for emacs on MS-Windows
2 Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004, 2
3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 2008, 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -693,18 +694,43 @@ syms_of_win16select (void)
693 defsubr (&Sx_selection_exists_p); 694 defsubr (&Sx_selection_exists_p);
694 695
695 DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system, 696 DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system,
696 doc: /* Coding system for communicating with other X clients. 697 doc: /* Coding system for communicating with other programs.
697When sending or receiving text via cut_buffer, selection, and clipboard, 698
698the text is encoded or decoded by this coding system. 699For MS-Windows and MS-DOS:
699The default value is `iso-latin-1-dos'. */); 700When sending or receiving text via selection and clipboard, the text
701is encoded or decoded by this coding system. The default value is
702the current system default encoding on 9x/Me, `utf-16le-dos'
703\(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS.
704
705For X Windows:
706When sending text via selection and clipboard, if the target
707data-type matches with the type of this coding system, it is used
708for encoding the text. Otherwise (including the case that this
709variable is nil), a proper coding system is used as below:
710
711data-type coding system
712--------- -------------
713UTF8_STRING utf-8
714COMPOUND_TEXT compound-text-with-extensions
715STRING iso-latin-1
716C_STRING no-conversion
717
718When receiving text, if this coding system is non-nil, it is used
719for decoding regardless of the data-type. If this is nil, a
720proper coding system is used according to the data-type as above.
721
722See also the documentation of the variable `x-select-request-type' how
723to control which data-type to request for receiving text.
724
725The default value is nil. */);
700 Vselection_coding_system = intern ("iso-latin-1-dos"); 726 Vselection_coding_system = intern ("iso-latin-1-dos");
701 727
702 DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system, 728 DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system,
703 doc: /* Coding system for the next communication with other X clients. 729 doc: /* Coding system for the next communication with other programs.
704Usually, `selection-coding-system' is used for communicating with 730Usually, `selection-coding-system' is used for communicating with
705other X clients. But, if this variable is set, it is used for the 731other programs (X Windows clients or MS Windows programs). But, if this
706next communication only. After the communication, this variable is 732variable is set, it is used for the next communication only.
707set to nil. */); 733After the communication, this variable is set to nil. */);
708 Vnext_selection_coding_system = Qnil; 734 Vnext_selection_coding_system = Qnil;
709 735
710 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); 736 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY);
@@ -713,5 +739,3 @@ set to nil. */);
713 739
714#endif /* MSDOS */ 740#endif /* MSDOS */
715 741
716/* arch-tag: 085a22c8-7324-436e-a6da-102464ce95d8
717 (do not change this comment) */
diff --git a/src/w32.c b/src/w32.c
index ae34ac6aadb..d8c85bf5108 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -38,9 +38,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38 38
39/* must include CRT headers *before* config.h */ 39/* must include CRT headers *before* config.h */
40 40
41#ifdef HAVE_CONFIG_H
42#include <config.h> 41#include <config.h>
43#endif
44 42
45#undef access 43#undef access
46#undef chdir 44#undef chdir
@@ -97,7 +95,7 @@ typedef struct _MEMORY_STATUS_EX {
97#include <w32api.h> 95#include <w32api.h>
98#if !defined(__MINGW32__) || __W32API_MAJOR_VERSION < 3 || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 15) 96#if !defined(__MINGW32__) || __W32API_MAJOR_VERSION < 3 || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 15)
99/* This either is not in psapi.h or guarded by higher value of 97/* This either is not in psapi.h or guarded by higher value of
100 _WIN32_WINNT than what we use. w32api suplied with MinGW 3.15 98 _WIN32_WINNT than what we use. w32api supplied with MinGW 3.15
101 defines it in psapi.h */ 99 defines it in psapi.h */
102typedef struct _PROCESS_MEMORY_COUNTERS_EX { 100typedef struct _PROCESS_MEMORY_COUNTERS_EX {
103 DWORD cb; 101 DWORD cb;
@@ -6086,5 +6084,3 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
6086 6084
6087/* end of w32.c */ 6085/* end of w32.c */
6088 6086
6089/* arch-tag: 90442dd3-37be-482b-b272-ac752e3049f1
6090 (do not change this comment) */
diff --git a/src/w32fns.c b/src/w32fns.c
index 808503547f1..04358b77bf5 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1,7 +1,8 @@
1/* Graphical user interface functions for the Microsoft W32 API. 1/* Graphical user interface functions for the Microsoft W32 API.
2 Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2
3 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 3Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
4 Free Software Foundation, Inc. 4 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5 Free Software Foundation, Inc.
5 6
6This file is part of GNU Emacs. 7This file is part of GNU Emacs.
7 8
@@ -81,7 +82,7 @@ extern const char *map_w32_filename (const char *, const char **);
81 82
82extern int quit_char; 83extern int quit_char;
83 84
84extern char *lispy_function_keys[]; 85extern const char *const lispy_function_keys[];
85 86
86/* The colormap for converting color names to RGB values */ 87/* The colormap for converting color names to RGB values */
87Lisp_Object Vw32_color_map; 88Lisp_Object Vw32_color_map;
@@ -4344,8 +4345,6 @@ This function is an internal primitive--use `make-frame' instead. */)
4344 "background", "Background", RES_TYPE_STRING); 4345 "background", "Background", RES_TYPE_STRING);
4345 x_default_parameter (f, parameters, Qmouse_color, build_string ("black"), 4346 x_default_parameter (f, parameters, Qmouse_color, build_string ("black"),
4346 "pointerColor", "Foreground", RES_TYPE_STRING); 4347 "pointerColor", "Foreground", RES_TYPE_STRING);
4347 x_default_parameter (f, parameters, Qcursor_color, build_string ("black"),
4348 "cursorColor", "Foreground", RES_TYPE_STRING);
4349 x_default_parameter (f, parameters, Qborder_color, build_string ("black"), 4348 x_default_parameter (f, parameters, Qborder_color, build_string ("black"),
4350 "borderColor", "BorderColor", RES_TYPE_STRING); 4349 "borderColor", "BorderColor", RES_TYPE_STRING);
4351 x_default_parameter (f, parameters, Qscreen_gamma, Qnil, 4350 x_default_parameter (f, parameters, Qscreen_gamma, Qnil,
@@ -4510,7 +4509,8 @@ DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0,
4510 4509
4511 4510
4512DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, 4511DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
4513 doc: /* Internal function called by `color-defined-p', which see. */) 4512 doc: /* Internal function called by `color-defined-p', which see.
4513\(Note that the Nextstep version of this function ignores FRAME.) */)
4514 (Lisp_Object color, Lisp_Object frame) 4514 (Lisp_Object color, Lisp_Object frame)
4515{ 4515{
4516 XColor foo; 4516 XColor foo;
@@ -4850,11 +4850,12 @@ x_display_info_for_name (Lisp_Object name)
4850} 4850}
4851 4851
4852DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, 4852DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
4853 1, 3, 0, doc: /* Open a connection to a server. 4853 1, 3, 0, doc: /* Open a connection to a display server.
4854DISPLAY is the name of the display to connect to. 4854DISPLAY is the name of the display to connect to.
4855Optional second arg XRM-STRING is a string of resources in xrdb format. 4855Optional second arg XRM-STRING is a string of resources in xrdb format.
4856If the optional third arg MUST-SUCCEED is non-nil, 4856If the optional third arg MUST-SUCCEED is non-nil,
4857terminate Emacs if we can't open the connection. */) 4857terminate Emacs if we can't open the connection.
4858\(In the Nextstep version, the last two arguments are currently ignored.) */)
4858 (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed) 4859 (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed)
4859{ 4860{
4860 unsigned char *xrm_option; 4861 unsigned char *xrm_option;
@@ -4974,7 +4975,17 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
4974} 4975}
4975 4976
4976DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, 4977DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
4977 doc: /* This is a noop on W32 systems. */) 4978 doc: /* If ON is non-nil, report X errors as soon as the erring request is made.
4979This function only has an effect on X Windows. With MS Windows, it is
4980defined but does nothing.
4981
4982If ON is nil, allow buffering of requests.
4983Turning on synchronization prohibits the Xlib routines from buffering
4984requests and seriously degrades performance, but makes debugging much
4985easier.
4986The optional second argument TERMINAL specifies which display to act on.
4987TERMINAL should be a terminal object, a frame or a display name (a string).
4988If TERMINAL is omitted or nil, that stands for the selected frame's display. */)
4978 (Lisp_Object on, Lisp_Object display) 4989 (Lisp_Object on, Lisp_Object display)
4979{ 4990{
4980 return Qnil; 4991 return Qnil;
@@ -4989,11 +5000,12 @@ DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
4989DEFUN ("x-change-window-property", Fx_change_window_property, 5000DEFUN ("x-change-window-property", Fx_change_window_property,
4990 Sx_change_window_property, 2, 6, 0, 5001 Sx_change_window_property, 2, 6, 0,
4991 doc: /* Change window property PROP to VALUE on the X window of FRAME. 5002 doc: /* Change window property PROP to VALUE on the X window of FRAME.
4992VALUE may be a string or a list of conses, numbers and/or strings. 5003PROP must be a string. VALUE may be a string or a list of conses,
4993If an element in the list is a string, it is converted to 5004numbers and/or strings. If an element in the list is a string, it is
4994an Atom and the value of the Atom is used. If an element is a cons, 5005converted to an atom and the value of the Atom is used. If an element
4995it is converted to a 32 bit number where the car is the 16 top bits and the 5006is a cons, it is converted to a 32 bit number where the car is the 16
4996cdr is the lower 16 bits. 5007top bits and the cdr is the lower 16 bits.
5008
4997FRAME nil or omitted means use the selected frame. 5009FRAME nil or omitted means use the selected frame.
4998If TYPE is given and non-nil, it is the name of the type of VALUE. 5010If TYPE is given and non-nil, it is the name of the type of VALUE.
4999If TYPE is not given or nil, the type is STRING. 5011If TYPE is not given or nil, the type is STRING.
@@ -5001,9 +5013,7 @@ FORMAT gives the size in bits of each element if VALUE is a list.
5001It must be one of 8, 16 or 32. 5013It must be one of 8, 16 or 32.
5002If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8. 5014If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8.
5003If OUTER_P is non-nil, the property is changed for the outer X window of 5015If OUTER_P is non-nil, the property is changed for the outer X window of
5004FRAME. Default is to change on the edit X window. 5016FRAME. Default is to change on the edit X window. */)
5005
5006Value is VALUE. */)
5007 (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) 5017 (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p)
5008{ 5018{
5009#if 0 /* TODO : port window properties to W32 */ 5019#if 0 /* TODO : port window properties to W32 */
@@ -5057,9 +5067,20 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */)
5057DEFUN ("x-window-property", Fx_window_property, Sx_window_property, 5067DEFUN ("x-window-property", Fx_window_property, Sx_window_property,
5058 1, 2, 0, 5068 1, 2, 0,
5059 doc: /* Value is the value of window property PROP on FRAME. 5069 doc: /* Value is the value of window property PROP on FRAME.
5060If FRAME is nil or omitted, use the selected frame. Value is nil 5070If FRAME is nil or omitted, use the selected frame.
5061if FRAME hasn't a property with name PROP or if PROP has no string 5071
5062value. */) 5072On MS Windows, this function only accepts the PROP and FRAME arguments.
5073
5074On X Windows, the following optional arguments are also accepted:
5075If TYPE is nil or omitted, get the property as a string.
5076Otherwise TYPE is the name of the atom that denotes the type expected.
5077If SOURCE is non-nil, get the property on that window instead of from
5078FRAME. The number 0 denotes the root window.
5079If DELETE_P is non-nil, delete the property after retreiving it.
5080If VECTOR_RET_P is non-nil, don't return a string but a vector of values.
5081
5082Value is nil if FRAME hasn't a property with name PROP or if PROP has
5083no value of TYPE (always string in the MS Windows case). */)
5063 (Lisp_Object prop, Lisp_Object frame) 5084 (Lisp_Object prop, Lisp_Object frame)
5064{ 5085{
5065#if 0 /* TODO : port window properties to W32 */ 5086#if 0 /* TODO : port window properties to W32 */
@@ -5634,7 +5655,7 @@ Text larger than the specified size is clipped. */)
5634 int root_x, root_y; 5655 int root_x, root_y;
5635 struct buffer *old_buffer; 5656 struct buffer *old_buffer;
5636 struct text_pos pos; 5657 struct text_pos pos;
5637 int i, width, height; 5658 int i, width, height, seen_reversed_p;
5638 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 5659 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
5639 int old_windows_or_buffers_changed = windows_or_buffers_changed; 5660 int old_windows_or_buffers_changed = windows_or_buffers_changed;
5640 int count = SPECPDL_INDEX (); 5661 int count = SPECPDL_INDEX ();
@@ -5764,7 +5785,7 @@ Text larger than the specified size is clipped. */)
5764 try_window (FRAME_ROOT_WINDOW (f), pos, 0); 5785 try_window (FRAME_ROOT_WINDOW (f), pos, 0);
5765 5786
5766 /* Compute width and height of the tooltip. */ 5787 /* Compute width and height of the tooltip. */
5767 width = height = 0; 5788 width = height = seen_reversed_p = 0;
5768 for (i = 0; i < w->desired_matrix->nrows; ++i) 5789 for (i = 0; i < w->desired_matrix->nrows; ++i)
5769 { 5790 {
5770 struct glyph_row *row = &w->desired_matrix->rows[i]; 5791 struct glyph_row *row = &w->desired_matrix->rows[i];
@@ -5778,24 +5799,83 @@ Text larger than the specified size is clipped. */)
5778 /* Let the row go over the full width of the frame. */ 5799 /* Let the row go over the full width of the frame. */
5779 row->full_width_p = 1; 5800 row->full_width_p = 1;
5780 5801
5781#ifdef TODO /* Investigate why some fonts need more width than is 5802 row_width = row->pixel_width;
5782 calculated for some tooltips. */
5783 /* There's a glyph at the end of rows that is use to place
5784 the cursor there. Don't include the width of this glyph. */
5785 if (row->used[TEXT_AREA]) 5803 if (row->used[TEXT_AREA])
5786 { 5804 {
5787 last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; 5805 if (!row->reversed_p)
5788 row_width = row->pixel_width - last->pixel_width; 5806 {
5789 } 5807#ifdef TODO /* Investigate why some fonts need more width than is
5790 else 5808 calculated for some tooltips. */
5809
5810 /* There's a glyph at the end of rows that is used to
5811 place the cursor there. Don't include the width of
5812 this glyph. */
5813 last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1];
5814 if (INTEGERP (last->object))
5815 row_width -= last->pixel_width;
5791#endif 5816#endif
5792 row_width = row->pixel_width; 5817 }
5818 else
5819 {
5820 /* There could be a stretch glyph at the beginning of R2L
5821 rows that is produced by extend_face_to_end_of_line.
5822 Don't count that glyph. */
5823 struct glyph *g = row->glyphs[TEXT_AREA];
5824
5825 if (g->type == STRETCH_GLYPH && INTEGERP (g->object))
5826 {
5827 row_width -= g->pixel_width;
5828 seen_reversed_p = 1;
5829 }
5830 }
5831 }
5793 5832
5794 /* TODO: find why tips do not draw along baseline as instructed. */ 5833 /* TODO: find why tips do not draw along baseline as instructed. */
5795 height += row->height; 5834 height += row->height;
5796 width = max (width, row_width); 5835 width = max (width, row_width);
5797 } 5836 }
5798 5837
5838 /* If we've seen partial-length R2L rows, we need to re-adjust the
5839 tool-tip frame width and redisplay it again, to avoid over-wide
5840 tips due to the stretch glyph that extends R2L lines to full
5841 width of the frame. */
5842 if (seen_reversed_p)
5843 {
5844 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
5845 not in pixels. */
5846 width /= WINDOW_FRAME_COLUMN_WIDTH (w);
5847 w->total_cols = make_number (width);
5848 FRAME_TOTAL_COLS (f) = width;
5849 adjust_glyphs (f);
5850 clear_glyph_matrix (w->desired_matrix);
5851 clear_glyph_matrix (w->current_matrix);
5852 try_window (FRAME_ROOT_WINDOW (f), pos, 0);
5853 width = height = 0;
5854 /* Recompute width and height of the tooltip. */
5855 for (i = 0; i < w->desired_matrix->nrows; ++i)
5856 {
5857 struct glyph_row *row = &w->desired_matrix->rows[i];
5858 struct glyph *last;
5859 int row_width;
5860
5861 if (!row->enabled_p || !row->displays_text_p)
5862 break;
5863 row->full_width_p = 1;
5864 row_width = row->pixel_width;
5865#ifdef TODO /* See above. */
5866 if (row->used[TEXT_AREA] && !row->reversed_p)
5867 {
5868 last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1];
5869 if (INTEGERP (last->object))
5870 row_width -= last->pixel_width;
5871 }
5872#endif
5873
5874 height += row->height;
5875 width = max (width, row_width);
5876 }
5877 }
5878
5799 /* Add the frame's internal border to the width and height the X 5879 /* Add the frame's internal border to the width and height the X
5800 window should have. */ 5880 window should have. */
5801 height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); 5881 height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
@@ -5948,10 +6028,13 @@ typedef struct
5948 6028
5949DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, 6029DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
5950 doc: /* Read file name, prompting with PROMPT in directory DIR. 6030 doc: /* Read file name, prompting with PROMPT in directory DIR.
5951Use a file selection dialog. 6031Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file
5952Select DEFAULT-FILENAME in the dialog's file selection box, if 6032selection box, if specified. If MUSTMATCH is non-nil, the returned file
5953specified. Ensure that file exists if MUSTMATCH is non-nil. 6033or directory must exist.
5954If ONLY-DIR-P is non-nil, the user can only select directories. */) 6034
6035This function is only defined on MS Windows, and X Windows with the
6036Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
6037Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5955 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) 6038 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)
5956{ 6039{
5957 struct frame *f = SELECTED_FRAME (); 6040 struct frame *f = SELECTED_FRAME ();
@@ -7243,5 +7326,3 @@ w32_last_error (void)
7243 return GetLastError (); 7326 return GetLastError ();
7244} 7327}
7245 7328
7246/* arch-tag: 707589ab-b9be-4638-8cdd-74629cc9b446
7247 (do not change this comment) */
diff --git a/src/w32font.c b/src/w32font.c
index f489fe2d763..e7c34378e0d 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -2377,11 +2377,11 @@ in the font selection dialog. */)
2377 return DECODE_SYSTEM (build_string (buf)); 2377 return DECODE_SYSTEM (build_string (buf));
2378} 2378}
2379 2379
2380static const char *w32font_booleans [] = { 2380static const char *const w32font_booleans [] = {
2381 NULL, 2381 NULL,
2382}; 2382};
2383 2383
2384static const char *w32font_non_booleans [] = { 2384static const char *const w32font_non_booleans [] = {
2385 ":script", 2385 ":script",
2386 ":antialias", 2386 ":antialias",
2387 ":style", 2387 ":style",
diff --git a/src/w32gui.h b/src/w32gui.h
index 9cad4f21f21..079cd19a1f1 100644
--- a/src/w32gui.h
+++ b/src/w32gui.h
@@ -59,13 +59,13 @@ typedef HCURSOR Cursor;
59 59
60/* Dealing with bits of wchar_t as if they were an XChar2b. */ 60/* Dealing with bits of wchar_t as if they were an XChar2b. */
61#define STORE_XCHAR2B(chp, byte1, byte2) \ 61#define STORE_XCHAR2B(chp, byte1, byte2) \
62 ((*chp) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff)))) 62 ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
63 63
64#define XCHAR2B_BYTE1(chp) \ 64#define XCHAR2B_BYTE1(chp) \
65 (((*chp) & 0xff00) >> 8) 65 (((*(chp)) & 0xff00) >> 8)
66 66
67#define XCHAR2B_BYTE2(chp) \ 67#define XCHAR2B_BYTE2(chp) \
68 ((*chp) & 0x00ff) 68 ((*(chp)) & 0x00ff)
69 69
70 70
71/* Windows equivalent of XImage. */ 71/* Windows equivalent of XImage. */
diff --git a/src/w32heap.c b/src/w32heap.c
index 285325e3f8b..39ff1017466 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -21,10 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 Geoff Voelker (voelker@cs.washington.edu) 7-29-94 21 Geoff Voelker (voelker@cs.washington.edu) 7-29-94
22*/ 22*/
23 23
24#ifdef HAVE_CONFIG_H
25#include <config.h> 24#include <config.h>
26#endif
27
28#include <stdio.h> 25#include <stdio.h>
29#include <setjmp.h> 26#include <setjmp.h>
30 27
@@ -301,5 +298,3 @@ _heap_term (void)
301 298
302#endif 299#endif
303 300
304/* arch-tag: 9a6a9860-040d-422d-8905-450dd535cd9c
305 (do not change this comment) */
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 1111f8dfa44..65b57ffa1f7 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -23,10 +23,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23*/ 23*/
24 24
25 25
26#ifdef HAVE_CONFIG_H
27#include <config.h> 26#include <config.h>
28#endif
29
30#include <stdio.h> 27#include <stdio.h>
31#include <windows.h> 28#include <windows.h>
32#include <setjmp.h> 29#include <setjmp.h>
@@ -282,7 +279,7 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event)
282} 279}
283 280
284 281
285extern char *lispy_function_keys[]; 282extern const char *const lispy_function_keys[];
286 283
287static int faked_key = 0; 284static int faked_key = 0;
288 285
@@ -784,5 +781,3 @@ w32_console_read_socket (struct terminal *terminal,
784 return ret; 781 return ret;
785} 782}
786 783
787/* arch-tag: 0bcb39b7-d085-4b85-9070-6750e8c03047
788 (do not change this comment) */
diff --git a/src/w32proc.c b/src/w32proc.c
index 49687574472..ff6e22d2547 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -32,10 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
32#include <setjmp.h> 32#include <setjmp.h>
33 33
34/* must include CRT headers *before* config.h */ 34/* must include CRT headers *before* config.h */
35
36#ifdef HAVE_CONFIG_H
37#include <config.h> 35#include <config.h>
38#endif
39 36
40#undef signal 37#undef signal
41#undef wait 38#undef wait
@@ -2370,7 +2367,5 @@ where the performance impact may be noticeable even on modern hardware. */);
2370 staticpro (&Vw32_valid_locale_ids); 2367 staticpro (&Vw32_valid_locale_ids);
2371 staticpro (&Vw32_valid_codepages); 2368 staticpro (&Vw32_valid_codepages);
2372} 2369}
2373/* end of ntproc.c */ 2370/* end of w32proc.c */
2374 2371
2375/* arch-tag: 23d3a34c-06d2-48a1-833b-ac7609aa5250
2376 (do not change this comment) */
diff --git a/src/w32select.c b/src/w32select.c
index f9bab384062..18694d2d334 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -1,6 +1,7 @@
1/* Selection processing for Emacs on the Microsoft W32 API. 1/* Selection processing for Emacs on the Microsoft W32 API.
2 Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, 2
3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 2008, 2009, 2010 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -1069,10 +1070,34 @@ syms_of_w32select (void)
1069 1070
1070 DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system, 1071 DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system,
1071 doc: /* Coding system for communicating with other programs. 1072 doc: /* Coding system for communicating with other programs.
1072When sending or receiving text via cut_buffer, selection, and 1073
1073clipboard, the text is encoded or decoded by this coding system. 1074For MS-Windows and MS-DOS:
1074The default value is the current system default encoding on 9x/Me and 1075When sending or receiving text via selection and clipboard, the text
1075`utf-16le-dos' (Unicode) on NT/W2K/XP. */); 1076is encoded or decoded by this coding system. The default value is
1077the current system default encoding on 9x/Me, `utf-16le-dos'
1078\(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS.
1079
1080For X Windows:
1081When sending text via selection and clipboard, if the target
1082data-type matches with the type of this coding system, it is used
1083for encoding the text. Otherwise (including the case that this
1084variable is nil), a proper coding system is used as below:
1085
1086data-type coding system
1087--------- -------------
1088UTF8_STRING utf-8
1089COMPOUND_TEXT compound-text-with-extensions
1090STRING iso-latin-1
1091C_STRING no-conversion
1092
1093When receiving text, if this coding system is non-nil, it is used
1094for decoding regardless of the data-type. If this is nil, a
1095proper coding system is used according to the data-type as above.
1096
1097See also the documentation of the variable `x-select-request-type' how
1098to control which data-type to request for receiving text.
1099
1100The default value is nil. */);
1076 /* The actual value is set dynamically in the dumped Emacs, see 1101 /* The actual value is set dynamically in the dumped Emacs, see
1077 below. */ 1102 below. */
1078 Vselection_coding_system = Qnil; 1103 Vselection_coding_system = Qnil;
@@ -1080,9 +1105,9 @@ The default value is the current system default encoding on 9x/Me and
1080 DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system, 1105 DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system,
1081 doc: /* Coding system for the next communication with other programs. 1106 doc: /* Coding system for the next communication with other programs.
1082Usually, `selection-coding-system' is used for communicating with 1107Usually, `selection-coding-system' is used for communicating with
1083other programs. But, if this variable is set, it is used for the 1108other programs (X Windows clients or MS Windows programs). But, if this
1084next communication only. After the communication, this variable is 1109variable is set, it is used for the next communication only.
1085set to nil. */); 1110After the communication, this variable is set to nil. */);
1086 Vnext_selection_coding_system = Qnil; 1111 Vnext_selection_coding_system = Qnil;
1087 1112
1088 DEFSYM (QCLIPBOARD, "CLIPBOARD"); 1113 DEFSYM (QCLIPBOARD, "CLIPBOARD");
@@ -1123,5 +1148,3 @@ globals_of_w32select (void)
1123 clipboard_owner = create_owner (); 1148 clipboard_owner = create_owner ();
1124} 1149}
1125 1150
1126/* arch-tag: c96e9724-5eb1-4dad-be07-289f092fd2af
1127 (do not change this comment) */
diff --git a/src/w32term.c b/src/w32term.c
index 1f53860de2e..7145efbc604 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -1,7 +1,8 @@
1/* Implementation of GUI terminal on the Microsoft W32 API. 1/* Implementation of GUI terminal on the Microsoft W32 API.
2 Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 2
3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
4 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5 Free Software Foundation, Inc.
5 6
6This file is part of GNU Emacs. 7This file is part of GNU Emacs.
7 8
@@ -504,7 +505,7 @@ static void
504x_update_window_begin (struct window *w) 505x_update_window_begin (struct window *w)
505{ 506{
506 struct frame *f = XFRAME (WINDOW_FRAME (w)); 507 struct frame *f = XFRAME (WINDOW_FRAME (w));
507 struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); 508 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
508 509
509 /* Hide the system caret during an update. */ 510 /* Hide the system caret during an update. */
510 if (w32_use_visible_system_caret && w32_system_caret_hwnd) 511 if (w32_use_visible_system_caret && w32_system_caret_hwnd)
@@ -517,15 +518,15 @@ x_update_window_begin (struct window *w)
517 518
518 BLOCK_INPUT; 519 BLOCK_INPUT;
519 520
520 if (f == display_info->mouse_face_mouse_frame) 521 if (f == hlinfo->mouse_face_mouse_frame)
521 { 522 {
522 /* Don't do highlighting for mouse motion during the update. */ 523 /* Don't do highlighting for mouse motion during the update. */
523 display_info->mouse_face_defer = 1; 524 hlinfo->mouse_face_defer = 1;
524 525
525 /* If F needs to be redrawn, simply forget about any prior mouse 526 /* If F needs to be redrawn, simply forget about any prior mouse
526 highlighting. */ 527 highlighting. */
527 if (FRAME_GARBAGED_P (f)) 528 if (FRAME_GARBAGED_P (f))
528 display_info->mouse_face_window = Qnil; 529 hlinfo->mouse_face_window = Qnil;
529 530
530#if 0 /* Rows in a current matrix containing glyphs in mouse-face have 531#if 0 /* Rows in a current matrix containing glyphs in mouse-face have
531 their mouse_face_p flag set, which means that they are always 532 their mouse_face_p flag set, which means that they are always
@@ -539,8 +540,8 @@ x_update_window_begin (struct window *w)
539 Likewise, don't do anything if the frame is garbaged; 540 Likewise, don't do anything if the frame is garbaged;
540 in that case, the frame's current matrix that we would use 541 in that case, the frame's current matrix that we would use
541 is all wrong, and we will redisplay that line anyway. */ 542 is all wrong, and we will redisplay that line anyway. */
542 if (!NILP (display_info->mouse_face_window) 543 if (!NILP (hlinfo->mouse_face_window)
543 && w == XWINDOW (display_info->mouse_face_window)) 544 && w == XWINDOW (hlinfo->mouse_face_window))
544 { 545 {
545 int i; 546 int i;
546 547
@@ -549,7 +550,7 @@ x_update_window_begin (struct window *w)
549 break; 550 break;
550 551
551 if (i < w->desired_matrix->nrows) 552 if (i < w->desired_matrix->nrows)
552 clear_mouse_face (display_info); 553 clear_mouse_face (hlinfo);
553 } 554 }
554#endif /* 0 */ 555#endif /* 0 */
555 } 556 }
@@ -600,7 +601,7 @@ static void
600x_update_window_end (struct window *w, int cursor_on_p, 601x_update_window_end (struct window *w, int cursor_on_p,
601 int mouse_face_overwritten_p) 602 int mouse_face_overwritten_p)
602{ 603{
603 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (XFRAME (w->frame)); 604 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
604 605
605 if (!w->pseudo_window_p) 606 if (!w->pseudo_window_p)
606 { 607 {
@@ -621,9 +622,9 @@ x_update_window_end (struct window *w, int cursor_on_p,
621 XTframe_up_to_date to redisplay the mouse highlight. */ 622 XTframe_up_to_date to redisplay the mouse highlight. */
622 if (mouse_face_overwritten_p) 623 if (mouse_face_overwritten_p)
623 { 624 {
624 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 625 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
625 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 626 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
626 dpyinfo->mouse_face_window = Qnil; 627 hlinfo->mouse_face_window = Qnil;
627 } 628 }
628 629
629 /* Unhide the caret. This won't actually show the cursor, unless it 630 /* Unhide the caret. This won't actually show the cursor, unless it
@@ -648,7 +649,7 @@ x_update_end (struct frame *f)
648 return; 649 return;
649 650
650 /* Mouse highlight may be displayed again. */ 651 /* Mouse highlight may be displayed again. */
651 FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 0; 652 MOUSE_HL_INFO (f)->mouse_face_defer = 0;
652} 653}
653 654
654 655
@@ -661,17 +662,17 @@ w32_frame_up_to_date (struct frame *f)
661{ 662{
662 if (FRAME_W32_P (f)) 663 if (FRAME_W32_P (f))
663 { 664 {
664 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); 665 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
665 666
666 if (dpyinfo->mouse_face_deferred_gc 667 if (hlinfo->mouse_face_deferred_gc
667 || f == dpyinfo->mouse_face_mouse_frame) 668 || f == hlinfo->mouse_face_mouse_frame)
668 { 669 {
669 BLOCK_INPUT; 670 BLOCK_INPUT;
670 if (dpyinfo->mouse_face_mouse_frame) 671 if (hlinfo->mouse_face_mouse_frame)
671 note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, 672 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
672 dpyinfo->mouse_face_mouse_x, 673 hlinfo->mouse_face_mouse_x,
673 dpyinfo->mouse_face_mouse_y); 674 hlinfo->mouse_face_mouse_y);
674 dpyinfo->mouse_face_deferred_gc = 0; 675 hlinfo->mouse_face_deferred_gc = 0;
675 UNBLOCK_INPUT; 676 UNBLOCK_INPUT;
676 } 677 }
677 } 678 }
@@ -998,7 +999,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
998 struct face *face; 999 struct face *face;
999 1000
1000 /* What face has to be used last for the mouse face? */ 1001 /* What face has to be used last for the mouse face? */
1001 face_id = FRAME_W32_DISPLAY_INFO (s->f)->mouse_face_face_id; 1002 face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id;
1002 face = FACE_FROM_ID (s->f, face_id); 1003 face = FACE_FROM_ID (s->f, face_id);
1003 if (face == NULL) 1004 if (face == NULL)
1004 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 1005 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
@@ -1393,6 +1394,94 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s)
1393} 1394}
1394 1395
1395 1396
1397/* Draw the foreground of glyph string S for glyphless characters. */
1398
1399static void
1400x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
1401{
1402 struct glyph *glyph = s->first_glyph;
1403 XChar2b char2b[8];
1404 int x, i, j;
1405 int with_background;
1406
1407 /* If first glyph of S has a left box line, start drawing the text
1408 of S to the right of that box line. */
1409 if (s->face->box != FACE_NO_BOX
1410 && s->first_glyph->left_box_line_p)
1411 x = s->x + eabs (s->face->box_line_width);
1412 else
1413 x = s->x;
1414
1415 SetTextColor (s->hdc, s->gc->foreground);
1416 SetBkColor (s->hdc, s->gc->background);
1417 SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT);
1418
1419 s->char2b = char2b;
1420 with_background = ! (s->for_overlaps
1421 || (s->background_filled_p && s->hl != DRAW_CURSOR));
1422 for (i = 0; i < s->nchars; i++, glyph++)
1423 {
1424 char buf[7], *str = NULL;
1425 int len = glyph->u.glyphless.len;
1426
1427 if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM)
1428 {
1429 if (len > 1
1430 && CHAR_TABLE_P (Vglyphless_char_display)
1431 && (CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display))
1432 >= 1))
1433 {
1434 Lisp_Object acronym
1435 = (! glyph->u.glyphless.for_no_font
1436 ? CHAR_TABLE_REF (Vglyphless_char_display,
1437 glyph->u.glyphless.ch)
1438 : XCHAR_TABLE (Vglyphless_char_display)->extras[0]);
1439 if (STRINGP (acronym))
1440 str = (char *) SDATA (acronym);
1441 }
1442 }
1443 else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE)
1444 {
1445 sprintf ((char *) buf, "%0*X",
1446 glyph->u.glyphless.ch < 0x10000 ? 4 : 6,
1447 glyph->u.glyphless.ch);
1448 str = buf;
1449 }
1450
1451 if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE)
1452 w32_draw_rectangle (s->hdc, s->gc,
1453 x, s->ybase - glyph->ascent,
1454 glyph->pixel_width - 1,
1455 glyph->ascent + glyph->descent - 1);
1456 if (str)
1457 {
1458 struct font *font = s->font;
1459 int upper_len = (len + 1) / 2;
1460 unsigned code;
1461 HFONT old_font;
1462
1463 old_font = SelectObject (s->hdc, FONT_HANDLE (font));
1464 /* It is certain that all LEN characters in STR are ASCII. */
1465 for (j = 0; j < len; j++)
1466 {
1467 code = font->driver->encode_char (font, str[j]);
1468 STORE_XCHAR2B (char2b + j, code >> 8, code & 0xFF);
1469 }
1470 font->driver->draw (s, 0, upper_len,
1471 x + glyph->slice.glyphless.upper_xoff,
1472 s->ybase + glyph->slice.glyphless.upper_yoff,
1473 with_background);
1474 font->driver->draw (s, upper_len, len,
1475 x + glyph->slice.glyphless.lower_xoff,
1476 s->ybase + glyph->slice.glyphless.lower_yoff,
1477 with_background);
1478 SelectObject (s->hdc, old_font);
1479 }
1480 x += glyph->pixel_width;
1481 }
1482}
1483
1484
1396/* Brightness beyond which a color won't have its highlight brightness 1485/* Brightness beyond which a color won't have its highlight brightness
1397 boosted. 1486 boosted.
1398 1487
@@ -2281,6 +2370,14 @@ x_draw_glyph_string (struct glyph_string *s)
2281 x_draw_composite_glyph_string_foreground (s); 2370 x_draw_composite_glyph_string_foreground (s);
2282 break; 2371 break;
2283 2372
2373 case GLYPHLESS_GLYPH:
2374 if (s->for_overlaps)
2375 s->background_filled_p = 1;
2376 else
2377 x_draw_glyph_string_background (s, 0);
2378 x_draw_glyphless_glyph_string_foreground (s);
2379 break;
2380
2284 default: 2381 default:
2285 abort (); 2382 abort ();
2286 } 2383 }
@@ -3963,6 +4060,7 @@ w32_read_socket (struct terminal *terminal, int expected,
3963 W32Msg msg; 4060 W32Msg msg;
3964 struct frame *f; 4061 struct frame *f;
3965 struct w32_display_info *dpyinfo = &one_w32_display_info; 4062 struct w32_display_info *dpyinfo = &one_w32_display_info;
4063 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
3966 4064
3967 if (interrupt_input_blocked) 4065 if (interrupt_input_blocked)
3968 { 4066 {
@@ -4063,11 +4161,11 @@ w32_read_socket (struct terminal *terminal, int expected,
4063 4161
4064 if (f && !f->iconified) 4162 if (f && !f->iconified)
4065 { 4163 {
4066 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4164 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4067 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 4165 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
4068 { 4166 {
4069 clear_mouse_face (dpyinfo); 4167 clear_mouse_face (hlinfo);
4070 dpyinfo->mouse_face_hidden = 1; 4168 hlinfo->mouse_face_hidden = 1;
4071 } 4169 }
4072 4170
4073 if (temp_index == sizeof temp_buffer / sizeof (short)) 4171 if (temp_index == sizeof temp_buffer / sizeof (short))
@@ -4088,11 +4186,11 @@ w32_read_socket (struct terminal *terminal, int expected,
4088 4186
4089 if (f && !f->iconified) 4187 if (f && !f->iconified)
4090 { 4188 {
4091 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4189 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4092 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 4190 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
4093 { 4191 {
4094 clear_mouse_face (dpyinfo); 4192 clear_mouse_face (hlinfo);
4095 dpyinfo->mouse_face_hidden = 1; 4193 hlinfo->mouse_face_hidden = 1;
4096 } 4194 }
4097 4195
4098 if (temp_index == sizeof temp_buffer / sizeof (short)) 4196 if (temp_index == sizeof temp_buffer / sizeof (short))
@@ -4166,11 +4264,11 @@ w32_read_socket (struct terminal *terminal, int expected,
4166 4264
4167 if (f && !f->iconified) 4265 if (f && !f->iconified)
4168 { 4266 {
4169 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4267 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4170 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 4268 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
4171 { 4269 {
4172 clear_mouse_face (dpyinfo); 4270 clear_mouse_face (hlinfo);
4173 dpyinfo->mouse_face_hidden = 1; 4271 hlinfo->mouse_face_hidden = 1;
4174 } 4272 }
4175 4273
4176 if (temp_index == sizeof temp_buffer / sizeof (short)) 4274 if (temp_index == sizeof temp_buffer / sizeof (short))
@@ -4204,10 +4302,10 @@ w32_read_socket (struct terminal *terminal, int expected,
4204 else 4302 else
4205 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); 4303 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
4206 4304
4207 if (dpyinfo->mouse_face_hidden) 4305 if (hlinfo->mouse_face_hidden)
4208 { 4306 {
4209 dpyinfo->mouse_face_hidden = 0; 4307 hlinfo->mouse_face_hidden = 0;
4210 clear_mouse_face (dpyinfo); 4308 clear_mouse_face (hlinfo);
4211 } 4309 }
4212 4310
4213 if (f) 4311 if (f)
@@ -4219,7 +4317,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4219 int x = LOWORD (msg.msg.lParam); 4317 int x = LOWORD (msg.msg.lParam);
4220 int y = HIWORD (msg.msg.lParam); 4318 int y = HIWORD (msg.msg.lParam);
4221 4319
4222 window = window_from_coordinates (f, x, y, 0, 0, 0, 0); 4320 window = window_from_coordinates (f, x, y, 0, 0);
4223 4321
4224 /* Window will be selected only when it is not 4322 /* Window will be selected only when it is not
4225 selected now and last mouse movement event was 4323 selected now and last mouse movement event was
@@ -4248,7 +4346,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4248 { 4346 {
4249 /* If we move outside the frame, then we're 4347 /* If we move outside the frame, then we're
4250 certainly no longer on any text in the frame. */ 4348 certainly no longer on any text in the frame. */
4251 clear_mouse_face (dpyinfo); 4349 clear_mouse_face (hlinfo);
4252 } 4350 }
4253 4351
4254 /* If the contents of the global variable help_echo_string 4352 /* If the contents of the global variable help_echo_string
@@ -4298,7 +4396,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4298 int x = XFASTINT (inev.x); 4396 int x = XFASTINT (inev.x);
4299 int y = XFASTINT (inev.y); 4397 int y = XFASTINT (inev.y);
4300 4398
4301 window = window_from_coordinates (f, x, y, 0, 0, 0, 1); 4399 window = window_from_coordinates (f, x, y, 0, 1);
4302 4400
4303 if (EQ (window, f->tool_bar_window)) 4401 if (EQ (window, f->tool_bar_window))
4304 { 4402 {
@@ -4537,12 +4635,12 @@ w32_read_socket (struct terminal *terminal, int expected,
4537 f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd); 4635 f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd);
4538 if (f) 4636 if (f)
4539 { 4637 {
4540 if (f == dpyinfo->mouse_face_mouse_frame) 4638 if (f == hlinfo->mouse_face_mouse_frame)
4541 { 4639 {
4542 /* If we move outside the frame, then we're 4640 /* If we move outside the frame, then we're
4543 certainly no longer on any text in the frame. */ 4641 certainly no longer on any text in the frame. */
4544 clear_mouse_face (dpyinfo); 4642 clear_mouse_face (hlinfo);
4545 dpyinfo->mouse_face_mouse_frame = 0; 4643 hlinfo->mouse_face_mouse_frame = 0;
4546 } 4644 }
4547 4645
4548 /* Generate a nil HELP_EVENT to cancel a help-echo. 4646 /* Generate a nil HELP_EVENT to cancel a help-echo.
@@ -4572,12 +4670,12 @@ w32_read_socket (struct terminal *terminal, int expected,
4572 if (f == dpyinfo->w32_focus_frame) 4670 if (f == dpyinfo->w32_focus_frame)
4573 x_new_focus_frame (dpyinfo, 0); 4671 x_new_focus_frame (dpyinfo, 0);
4574 4672
4575 if (f == dpyinfo->mouse_face_mouse_frame) 4673 if (f == hlinfo->mouse_face_mouse_frame)
4576 { 4674 {
4577 /* If we move outside the frame, then we're 4675 /* If we move outside the frame, then we're
4578 certainly no longer on any text in the frame. */ 4676 certainly no longer on any text in the frame. */
4579 clear_mouse_face (dpyinfo); 4677 clear_mouse_face (hlinfo);
4580 dpyinfo->mouse_face_mouse_frame = 0; 4678 hlinfo->mouse_face_mouse_frame = 0;
4581 } 4679 }
4582 4680
4583 /* Generate a nil HELP_EVENT to cancel a help-echo. 4681 /* Generate a nil HELP_EVENT to cancel a help-echo.
@@ -5725,6 +5823,7 @@ void
5725x_free_frame_resources (struct frame *f) 5823x_free_frame_resources (struct frame *f)
5726{ 5824{
5727 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); 5825 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
5826 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
5728 5827
5729 BLOCK_INPUT; 5828 BLOCK_INPUT;
5730 5829
@@ -5763,15 +5862,15 @@ x_free_frame_resources (struct frame *f)
5763 if (f == dpyinfo->x_highlight_frame) 5862 if (f == dpyinfo->x_highlight_frame)
5764 dpyinfo->x_highlight_frame = 0; 5863 dpyinfo->x_highlight_frame = 0;
5765 5864
5766 if (f == dpyinfo->mouse_face_mouse_frame) 5865 if (f == hlinfo->mouse_face_mouse_frame)
5767 { 5866 {
5768 dpyinfo->mouse_face_beg_row 5867 hlinfo->mouse_face_beg_row
5769 = dpyinfo->mouse_face_beg_col = -1; 5868 = hlinfo->mouse_face_beg_col = -1;
5770 dpyinfo->mouse_face_end_row 5869 hlinfo->mouse_face_end_row
5771 = dpyinfo->mouse_face_end_col = -1; 5870 = hlinfo->mouse_face_end_col = -1;
5772 dpyinfo->mouse_face_window = Qnil; 5871 hlinfo->mouse_face_window = Qnil;
5773 dpyinfo->mouse_face_deferred_gc = 0; 5872 hlinfo->mouse_face_deferred_gc = 0;
5774 dpyinfo->mouse_face_mouse_frame = 0; 5873 hlinfo->mouse_face_mouse_frame = 0;
5775 } 5874 }
5776 5875
5777 UNBLOCK_INPUT; 5876 UNBLOCK_INPUT;
@@ -5837,6 +5936,7 @@ void
5837w32_initialize_display_info (Lisp_Object display_name) 5936w32_initialize_display_info (Lisp_Object display_name)
5838{ 5937{
5839 struct w32_display_info *dpyinfo = &one_w32_display_info; 5938 struct w32_display_info *dpyinfo = &one_w32_display_info;
5939 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
5840 5940
5841 memset (dpyinfo, 0, sizeof (*dpyinfo)); 5941 memset (dpyinfo, 0, sizeof (*dpyinfo));
5842 5942
@@ -5862,12 +5962,12 @@ w32_initialize_display_info (Lisp_Object display_name)
5862 dpyinfo->smallest_font_height = 1; 5962 dpyinfo->smallest_font_height = 1;
5863 dpyinfo->smallest_char_width = 1; 5963 dpyinfo->smallest_char_width = 1;
5864 5964
5865 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 5965 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
5866 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 5966 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
5867 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; 5967 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
5868 dpyinfo->mouse_face_window = Qnil; 5968 hlinfo->mouse_face_window = Qnil;
5869 dpyinfo->mouse_face_overlay = Qnil; 5969 hlinfo->mouse_face_overlay = Qnil;
5870 dpyinfo->mouse_face_hidden = 0; 5970 hlinfo->mouse_face_hidden = 0;
5871 5971
5872 dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW); 5972 dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW);
5873 /* TODO: dpyinfo->gray */ 5973 /* TODO: dpyinfo->gray */
@@ -6336,7 +6436,9 @@ the cursor have no effect. */);
6336 doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties. 6436 doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties.
6337A value of nil means ignore them. If you encounter fonts with bogus 6437A value of nil means ignore them. If you encounter fonts with bogus
6338UNDERLINE_POSITION font properties, for example 7x13 on XFree prior 6438UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
6339to 4.1, set this to nil. */); 6439to 4.1, set this to nil. You can also use `underline-minimum-offset'
6440to override the font's UNDERLINE_POSITION for small font display
6441sizes. */);
6340 x_use_underline_position_properties = 0; 6442 x_use_underline_position_properties = 0;
6341 6443
6342 DEFVAR_BOOL ("x-underline-at-descent-line", 6444 DEFVAR_BOOL ("x-underline-at-descent-line",
@@ -6348,12 +6450,14 @@ baseline level. The default value is nil. */);
6348 x_underline_at_descent_line = 0; 6450 x_underline_at_descent_line = 0;
6349 6451
6350 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, 6452 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
6351 doc: /* If not nil, Emacs uses toolkit scroll bars. */); 6453 doc: /* Which toolkit scroll bars Emacs uses, if any.
6454A value of nil means Emacs doesn't use toolkit scroll bars.
6455With the X Window system, the value is a symbol describing the
6456X toolkit. Possible values are: gtk, motif, xaw, or xaw3d.
6457With MS Windows, the value is t. */);
6352 Vx_toolkit_scroll_bars = Qt; 6458 Vx_toolkit_scroll_bars = Qt;
6353 6459
6354 staticpro (&last_mouse_motion_frame); 6460 staticpro (&last_mouse_motion_frame);
6355 last_mouse_motion_frame = Qnil; 6461 last_mouse_motion_frame = Qnil;
6356} 6462}
6357 6463
6358/* arch-tag: 5fa70624-ab86-499c-8a85-473958ee4646
6359 (do not change this comment) */
diff --git a/src/w32term.h b/src/w32term.h
index ea245144ac3..bd535cae57a 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -143,36 +143,9 @@ struct w32_display_info
143 /* Reusable Graphics Context for drawing a cursor in a non-default face. */ 143 /* Reusable Graphics Context for drawing a cursor in a non-default face. */
144 XGCValues *scratch_cursor_gc; 144 XGCValues *scratch_cursor_gc;
145 145
146 /* These variables describe the range of text currently shown in its 146 /* Information about the range of text currently shown in
147 mouse-face, together with the window they apply to. As long as 147 mouse-face. */
148 the mouse stays within this range, we need not redraw anything on 148 Mouse_HLInfo mouse_highlight;
149 its account. Rows and columns are glyph matrix positions in
150 MOUSE_FACE_WINDOW. */
151 int mouse_face_beg_row, mouse_face_beg_col;
152 int mouse_face_beg_x, mouse_face_beg_y;
153 int mouse_face_end_row, mouse_face_end_col;
154 int mouse_face_end_x, mouse_face_end_y;
155 int mouse_face_past_end;
156 Lisp_Object mouse_face_window;
157 int mouse_face_face_id;
158 Lisp_Object mouse_face_overlay;
159
160 /* 1 if a mouse motion event came and we didn't handle it right away because
161 gc was in progress. */
162 int mouse_face_deferred_gc;
163
164 /* FRAME and X, Y position of mouse when last checked for
165 highlighting. X and Y can be negative or out of range for the frame. */
166 struct frame *mouse_face_mouse_frame;
167 int mouse_face_mouse_x, mouse_face_mouse_y;
168
169 /* Nonzero means defer mouse-motion highlighting. */
170 int mouse_face_defer;
171
172 /* Nonzero means that the mouse highlight should not be shown. */
173 int mouse_face_hidden;
174
175 int mouse_face_image_state;
176 149
177 char *w32_id_name; 150 char *w32_id_name;
178 151
diff --git a/src/window.c b/src/window.c
index 7591401ee42..a2a0c793111 100644
--- a/src/window.c
+++ b/src/window.c
@@ -755,32 +755,26 @@ display margins, fringes, header line, and/or mode line. */)
755 - WINDOW_MODE_LINE_HEIGHT (w) + add_y)); 755 - WINDOW_MODE_LINE_HEIGHT (w) + add_y));
756} 756}
757 757
758/* Test if the character at column *X, row *Y is within window W. 758/* Test if the character at column X, row Y is within window W.
759 If it is not, return ON_NOTHING; 759 If it is not, return ON_NOTHING;
760 if it is in the window's text area, 760 if it is in the window's text area, return ON_TEXT;
761 set *x and *y to its location relative to the upper left corner
762 of the window, and
763 return ON_TEXT;
764 if it is on the window's modeline, return ON_MODE_LINE; 761 if it is on the window's modeline, return ON_MODE_LINE;
765 if it is on the border between the window and its right sibling, 762 if it is on the border between the window and its right sibling,
766 return ON_VERTICAL_BORDER. 763 return ON_VERTICAL_BORDER.
767 if it is on a scroll bar, 764 if it is on a scroll bar, return ON_SCROLL_BAR.
768 return ON_SCROLL_BAR.
769 if it is on the window's top line, return ON_HEADER_LINE; 765 if it is on the window's top line, return ON_HEADER_LINE;
770 if it is in left or right fringe of the window, 766 if it is in left or right fringe of the window,
771 return ON_LEFT_FRINGE or ON_RIGHT_FRINGE, and convert *X and *Y 767 return ON_LEFT_FRINGE or ON_RIGHT_FRINGE;
772 to window-relative coordinates;
773 if it is in the marginal area to the left/right of the window, 768 if it is in the marginal area to the left/right of the window,
774 return ON_LEFT_MARGIN or ON_RIGHT_MARGIN, and convert *X and *Y 769 return ON_LEFT_MARGIN or ON_RIGHT_MARGIN.
775 to window-relative coordinates.
776 770
777 X and Y are frame relative pixel coordinates. */ 771 X and Y are frame relative pixel coordinates. */
778 772
779static enum window_part 773static enum window_part
780coordinates_in_window (register struct window *w, register int *x, register int *y) 774coordinates_in_window (register struct window *w, int x, int y)
781{ 775{
782 struct frame *f = XFRAME (WINDOW_FRAME (w)); 776 struct frame *f = XFRAME (WINDOW_FRAME (w));
783 int left_x, right_x, top_y, bottom_y; 777 int left_x, right_x;
784 enum window_part part; 778 enum window_part part;
785 int ux = FRAME_COLUMN_WIDTH (f); 779 int ux = FRAME_COLUMN_WIDTH (f);
786 int x0 = WINDOW_LEFT_EDGE_X (w); 780 int x0 = WINDOW_LEFT_EDGE_X (w);
@@ -789,6 +783,12 @@ coordinates_in_window (register struct window *w, register int *x, register int
789 (Between mode lines for instance. */ 783 (Between mode lines for instance. */
790 int grabbable_width = ux; 784 int grabbable_width = ux;
791 int lmargin_width, rmargin_width, text_left, text_right; 785 int lmargin_width, rmargin_width, text_left, text_right;
786 int top_y = WINDOW_TOP_EDGE_Y (w);
787 int bottom_y = WINDOW_BOTTOM_EDGE_Y (w);
788
789 /* Outside any interesting row? */
790 if (y < top_y || y >= bottom_y)
791 return ON_NOTHING;
792 792
793 /* In what's below, we subtract 1 when computing right_x because we 793 /* In what's below, we subtract 1 when computing right_x because we
794 want the rightmost pixel, which is given by left_pixel+width-1. */ 794 want the rightmost pixel, which is given by left_pixel+width-1. */
@@ -796,21 +796,13 @@ coordinates_in_window (register struct window *w, register int *x, register int
796 { 796 {
797 left_x = 0; 797 left_x = 0;
798 right_x = WINDOW_TOTAL_WIDTH (w) - 1; 798 right_x = WINDOW_TOTAL_WIDTH (w) - 1;
799 top_y = WINDOW_TOP_EDGE_Y (w);
800 bottom_y = WINDOW_BOTTOM_EDGE_Y (w);
801 } 799 }
802 else 800 else
803 { 801 {
804 left_x = WINDOW_BOX_LEFT_EDGE_X (w); 802 left_x = WINDOW_BOX_LEFT_EDGE_X (w);
805 right_x = WINDOW_BOX_RIGHT_EDGE_X (w) - 1; 803 right_x = WINDOW_BOX_RIGHT_EDGE_X (w) - 1;
806 top_y = WINDOW_TOP_EDGE_Y (w);
807 bottom_y = WINDOW_BOTTOM_EDGE_Y (w);
808 } 804 }
809 805
810 /* Outside any interesting row? */
811 if (*y < top_y || *y >= bottom_y)
812 return ON_NOTHING;
813
814 /* On the mode line or header line? If it's near the start of 806 /* On the mode line or header line? If it's near the start of
815 the mode or header line of window that's has a horizontal 807 the mode or header line of window that's has a horizontal
816 sibling, say it's on the vertical line. That's to be able 808 sibling, say it's on the vertical line. That's to be able
@@ -818,7 +810,7 @@ coordinates_in_window (register struct window *w, register int *x, register int
818 scroll bars. */ 810 scroll bars. */
819 811
820 if (WINDOW_WANTS_MODELINE_P (w) 812 if (WINDOW_WANTS_MODELINE_P (w)
821 && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) 813 && y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w))
822 { 814 {
823 part = ON_MODE_LINE; 815 part = ON_MODE_LINE;
824 816
@@ -827,60 +819,37 @@ coordinates_in_window (register struct window *w, register int *x, register int
827 between mode lines of horizontally adjacent mode lines 819 between mode lines of horizontally adjacent mode lines
828 as the vertical border. If scroll bars on the left, 820 as the vertical border. If scroll bars on the left,
829 return the right window. */ 821 return the right window. */
830 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) 822 if ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)
831 || WINDOW_RIGHTMOST_P (w)) 823 || WINDOW_RIGHTMOST_P (w))
832 { 824 && !WINDOW_LEFTMOST_P (w)
833 if (!WINDOW_LEFTMOST_P (w) && eabs (*x - x0) < grabbable_width) 825 && eabs (x - x0) < grabbable_width)
834 { 826 return ON_VERTICAL_BORDER;
835 /* Convert X and Y to window relative coordinates. 827
836 Vertical border is at the left edge of window. */ 828 /* Make sure we're not at the rightmost position of a
837 *x = max (0, *x - x0); 829 mode-/header-line and there's yet another window on the
838 *y -= top_y; 830 right. (Bug#1372) */
839 return ON_VERTICAL_BORDER; 831 else if ((WINDOW_RIGHTMOST_P (w) || x < x1)
840 } 832 && eabs (x - x1) < grabbable_width)
841 } 833 return ON_VERTICAL_BORDER;
842 else 834
843 { 835 if (x < x0 || x >= x1)
844 /* Make sure we're not at the rightmost position of a
845 mode-/header-line and there's yet another window on
846 the right. (Bug#1372) */
847 if ((WINDOW_RIGHTMOST_P (w) || *x < x1)
848 && eabs (*x - x1) < grabbable_width)
849 {
850 /* Convert X and Y to window relative coordinates.
851 Vertical border is at the right edge of window. */
852 *x = min (x1, *x) - x0;
853 *y -= top_y;
854 return ON_VERTICAL_BORDER;
855 }
856 }
857
858 if (*x < x0 || *x >= x1)
859 return ON_NOTHING; 836 return ON_NOTHING;
860 837
861 /* Convert X and Y to window relative coordinates.
862 Mode line starts at left edge of window. */
863 *x -= x0;
864 *y -= top_y;
865 return part; 838 return part;
866 } 839 }
867 840
868 if (WINDOW_WANTS_HEADER_LINE_P (w) 841 if (WINDOW_WANTS_HEADER_LINE_P (w)
869 && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) 842 && y < top_y + CURRENT_HEADER_LINE_HEIGHT (w))
870 { 843 {
871 part = ON_HEADER_LINE; 844 part = ON_HEADER_LINE;
872 goto header_vertical_border_check; 845 goto header_vertical_border_check;
873 } 846 }
874 847
875 if (*x < x0 || *x >= x1) 848 if (x < x0 || x >= x1) return ON_NOTHING;
876 return ON_NOTHING;
877 849
878 /* Outside any interesting column? */ 850 /* Outside any interesting column? */
879 if (*x < left_x || *x > right_x) 851 if (x < left_x || x > right_x)
880 { 852 return ON_SCROLL_BAR;
881 *y -= top_y;
882 return ON_SCROLL_BAR;
883 }
884 853
885 lmargin_width = window_box_width (w, LEFT_MARGIN_AREA); 854 lmargin_width = window_box_width (w, LEFT_MARGIN_AREA);
886 rmargin_width = window_box_width (w, RIGHT_MARGIN_AREA); 855 rmargin_width = window_box_width (w, RIGHT_MARGIN_AREA);
@@ -893,77 +862,79 @@ coordinates_in_window (register struct window *w, register int *x, register int
893 if (!w->pseudo_window_p 862 if (!w->pseudo_window_p
894 && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w) 863 && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)
895 && !WINDOW_RIGHTMOST_P (w) 864 && !WINDOW_RIGHTMOST_P (w)
896 && (eabs (*x - right_x) < grabbable_width)) 865 && (eabs (x - right_x) < grabbable_width))
897 { 866 return ON_VERTICAL_BORDER;
898 /* Convert X and Y to window relative coordinates.
899 Vertical border is at the right edge of window. */
900 *x = min (right_x, *x) - left_x;
901 *y -= top_y;
902 return ON_VERTICAL_BORDER;
903 }
904 }
905 else
906 {
907 /* Need to say "*x > right_x" rather than >=, since on character
908 terminals, the vertical line's x coordinate is right_x. */
909 if (!w->pseudo_window_p
910 && !WINDOW_RIGHTMOST_P (w)
911 && *x > right_x - ux)
912 {
913 /* On the border on the right side of the window? Assume that
914 this area begins at RIGHT_X minus a canonical char width. */
915 *x = min (right_x, *x) - left_x;
916 *y -= top_y;
917 return ON_VERTICAL_BORDER;
918 }
919 } 867 }
868 /* Need to say "x > right_x" rather than >=, since on character
869 terminals, the vertical line's x coordinate is right_x. */
870 else if (!w->pseudo_window_p
871 && !WINDOW_RIGHTMOST_P (w)
872 && x > right_x - ux)
873 return ON_VERTICAL_BORDER;
920 874
921 if (*x < text_left) 875 if (x < text_left)
922 { 876 {
923 if (lmargin_width > 0 877 if (lmargin_width > 0
924 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) 878 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
925 ? (*x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w)) 879 ? (x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w))
926 : (*x < left_x + lmargin_width))) 880 : (x < left_x + lmargin_width)))
927 { 881 return ON_LEFT_MARGIN;
928 *x -= left_x;
929 if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w))
930 *x -= WINDOW_LEFT_FRINGE_WIDTH (w);
931 *y -= top_y;
932 return ON_LEFT_MARGIN;
933 }
934 882
935 /* Convert X and Y to window-relative pixel coordinates. */
936 *x -= left_x;
937 *y -= top_y;
938 return ON_LEFT_FRINGE; 883 return ON_LEFT_FRINGE;
939 } 884 }
940 885
941 if (*x >= text_right) 886 if (x >= text_right)
942 { 887 {
943 if (rmargin_width > 0 888 if (rmargin_width > 0
944 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) 889 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
945 ? (*x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) 890 ? (x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w))
946 : (*x >= right_x - rmargin_width))) 891 : (x >= right_x - rmargin_width)))
947 { 892 return ON_RIGHT_MARGIN;
948 *x -= right_x - rmargin_width;
949 if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w))
950 *x += WINDOW_RIGHT_FRINGE_WIDTH (w);
951 *y -= top_y;
952 return ON_RIGHT_MARGIN;
953 }
954 893
955 /* Convert X and Y to window-relative pixel coordinates. */
956 *x -= left_x + WINDOW_LEFT_FRINGE_WIDTH (w);
957 *y -= top_y;
958 return ON_RIGHT_FRINGE; 894 return ON_RIGHT_FRINGE;
959 } 895 }
960 896
961 /* Everything special ruled out - must be on text area */ 897 /* Everything special ruled out - must be on text area */
962 *x -= text_left;
963 *y -= top_y;
964 return ON_TEXT; 898 return ON_TEXT;
965} 899}
966 900
901/* Take X is the frame-relative pixel x-coordinate, and return the
902 x-coordinate relative to part PART of window W. */
903int
904window_relative_x_coord (struct window *w, enum window_part part, int x)
905{
906 int left_x = (w->pseudo_window_p) ? 0 : WINDOW_BOX_LEFT_EDGE_X (w);
907
908 switch (part)
909 {
910 case ON_TEXT:
911 return x - window_box_left (w, TEXT_AREA);
912
913 case ON_LEFT_FRINGE:
914 return x - left_x;
915
916 case ON_RIGHT_FRINGE:
917 return x - left_x - WINDOW_LEFT_FRINGE_WIDTH (w);
918
919 case ON_LEFT_MARGIN:
920 return (x - left_x
921 - ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w))
922 ? WINDOW_LEFT_FRINGE_WIDTH (w) : 0));
923
924 case ON_RIGHT_MARGIN:
925 return (x + 1
926 - ((w->pseudo_window_p)
927 ? WINDOW_TOTAL_WIDTH (w)
928 : WINDOW_BOX_RIGHT_EDGE_X (w))
929 + window_box_width (w, RIGHT_MARGIN_AREA)
930 + ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w))
931 ? WINDOW_RIGHT_FRINGE_WIDTH (w) : 0));
932 }
933
934 /* ON_SCROLL_BAR, ON_NOTHING, and ON_VERTICAL_BORDER: */
935 return 0;
936}
937
967 938
968DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, 939DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
969 Scoordinates_in_window_p, 2, 2, 0, 940 Scoordinates_in_window_p, 2, 2, 0,
@@ -1000,14 +971,16 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\
1000 x = FRAME_PIXEL_X_FROM_CANON_X (f, lx) + FRAME_INTERNAL_BORDER_WIDTH (f); 971 x = FRAME_PIXEL_X_FROM_CANON_X (f, lx) + FRAME_INTERNAL_BORDER_WIDTH (f);
1001 y = FRAME_PIXEL_Y_FROM_CANON_Y (f, ly) + FRAME_INTERNAL_BORDER_WIDTH (f); 972 y = FRAME_PIXEL_Y_FROM_CANON_Y (f, ly) + FRAME_INTERNAL_BORDER_WIDTH (f);
1002 973
1003 switch (coordinates_in_window (w, &x, &y)) 974 switch (coordinates_in_window (w, x, y))
1004 { 975 {
1005 case ON_NOTHING: 976 case ON_NOTHING:
1006 return Qnil; 977 return Qnil;
1007 978
1008 case ON_TEXT: 979 case ON_TEXT:
1009 /* X and Y are now window relative pixel coordinates. Convert 980 /* Convert X and Y to window relative pixel coordinates, and
1010 them to canonical char units before returning them. */ 981 return the canonical char units. */
982 x -= window_box_left (w, TEXT_AREA);
983 y -= WINDOW_TOP_EDGE_Y (w);
1011 return Fcons (FRAME_CANON_X_FROM_PIXEL_X (f, x), 984 return Fcons (FRAME_CANON_X_FROM_PIXEL_X (f, x),
1012 FRAME_CANON_Y_FROM_PIXEL_Y (f, y)); 985 FRAME_CANON_Y_FROM_PIXEL_Y (f, y));
1013 986
@@ -1054,7 +1027,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\
1054struct check_window_data 1027struct check_window_data
1055{ 1028{
1056 Lisp_Object *window; 1029 Lisp_Object *window;
1057 int *x, *y; 1030 int x, y;
1058 enum window_part *part; 1031 enum window_part *part;
1059}; 1032};
1060 1033
@@ -1081,8 +1054,7 @@ check_window_containing (struct window *w, void *user_data)
1081 return it as a Lisp_Object. 1054 return it as a Lisp_Object.
1082 1055
1083 If X, Y is on one of the window's special `window_part' elements, 1056 If X, Y is on one of the window's special `window_part' elements,
1084 set *PART to the id of that element, and return X and Y converted 1057 set *PART to the id of that element.
1085 to window relative coordinates in WX and WY.
1086 1058
1087 If there is no window under X, Y return nil and leave *PART 1059 If there is no window under X, Y return nil and leave *PART
1088 unmodified. TOOL_BAR_P non-zero means detect tool-bar windows. 1060 unmodified. TOOL_BAR_P non-zero means detect tool-bar windows.
@@ -1097,7 +1069,8 @@ check_window_containing (struct window *w, void *user_data)
1097 case. */ 1069 case. */
1098 1070
1099Lisp_Object 1071Lisp_Object
1100window_from_coordinates (struct frame *f, int x, int y, enum window_part *part, int *wx, int *wy, int tool_bar_p) 1072window_from_coordinates (struct frame *f, int x, int y,
1073 enum window_part *part, int tool_bar_p)
1101{ 1074{
1102 Lisp_Object window; 1075 Lisp_Object window;
1103 struct check_window_data cw; 1076 struct check_window_data cw;
@@ -1107,7 +1080,7 @@ window_from_coordinates (struct frame *f, int x, int y, enum window_part *part,
1107 part = &dummy; 1080 part = &dummy;
1108 1081
1109 window = Qnil; 1082 window = Qnil;
1110 cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part; 1083 cw.window = &window, cw.x = x, cw.y = y; cw.part = part;
1111 foreach_window (f, check_window_containing, &cw); 1084 foreach_window (f, check_window_containing, &cw);
1112 1085
1113 /* If not found above, see if it's in the tool bar window, if a tool 1086 /* If not found above, see if it's in the tool bar window, if a tool
@@ -1116,16 +1089,13 @@ window_from_coordinates (struct frame *f, int x, int y, enum window_part *part,
1116 && tool_bar_p 1089 && tool_bar_p
1117 && WINDOWP (f->tool_bar_window) 1090 && WINDOWP (f->tool_bar_window)
1118 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0 1091 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0
1119 && (coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y) 1092 && (coordinates_in_window (XWINDOW (f->tool_bar_window), x, y)
1120 != ON_NOTHING)) 1093 != ON_NOTHING))
1121 { 1094 {
1122 *part = ON_TEXT; 1095 *part = ON_TEXT;
1123 window = f->tool_bar_window; 1096 window = f->tool_bar_window;
1124 } 1097 }
1125 1098
1126 if (wx) *wx = x;
1127 if (wy) *wy = y;
1128
1129 return window; 1099 return window;
1130} 1100}
1131 1101
@@ -1152,7 +1122,7 @@ column 0. */)
1152 + FRAME_INTERNAL_BORDER_WIDTH (f)), 1122 + FRAME_INTERNAL_BORDER_WIDTH (f)),
1153 (FRAME_PIXEL_Y_FROM_CANON_Y (f, y) 1123 (FRAME_PIXEL_Y_FROM_CANON_Y (f, y)
1154 + FRAME_INTERNAL_BORDER_WIDTH (f)), 1124 + FRAME_INTERNAL_BORDER_WIDTH (f)),
1155 0, 0, 0, 0); 1125 0, 0);
1156} 1126}
1157 1127
1158DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, 1128DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0,
@@ -2420,6 +2390,16 @@ check_all_windows (void)
2420 window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); 2390 window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt);
2421} 2391}
2422 2392
2393DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0,
2394 doc: /* Return WINDOW's use time.
2395WINDOW defaults to the selected window. The window with the highest use
2396time is the most recently selected one. The window with the lowest use
2397time is the least recently selected one. */)
2398 (Lisp_Object window)
2399{
2400 return decode_window (window)->use_time;
2401}
2402
2423DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0, 2403DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0,
2424 doc: /* Return the window least recently selected or used for display. 2404 doc: /* Return the window least recently selected or used for display.
2425\(LRU means Least Recently Used.) 2405\(LRU means Least Recently Used.)
diff --git a/src/window.h b/src/window.h
index e9529487b14..c1148836d79 100644
--- a/src/window.h
+++ b/src/window.h
@@ -788,8 +788,7 @@ EXFUN (Fset_window_point, 2);
788extern Lisp_Object make_window (void); 788extern Lisp_Object make_window (void);
789extern void delete_window (Lisp_Object); 789extern void delete_window (Lisp_Object);
790extern Lisp_Object window_from_coordinates (struct frame *, int, int, 790extern Lisp_Object window_from_coordinates (struct frame *, int, int,
791 enum window_part *, 791 enum window_part *, int);
792 int *, int*, int);
793EXFUN (Fwindow_dedicated_p, 1); 792EXFUN (Fwindow_dedicated_p, 1);
794extern int window_height (Lisp_Object); 793extern int window_height (Lisp_Object);
795extern int window_width (Lisp_Object); 794extern int window_width (Lisp_Object);
@@ -804,6 +803,7 @@ extern void foreach_window (struct frame *,
804 void *); 803 void *);
805extern void grow_mini_window (struct window *, int); 804extern void grow_mini_window (struct window *, int);
806extern void shrink_mini_window (struct window *); 805extern void shrink_mini_window (struct window *);
806extern int window_relative_x_coord (struct window *, enum window_part, int);
807 807
808void run_window_configuration_change_hook (struct frame *f); 808void run_window_configuration_change_hook (struct frame *f);
809 809
diff --git a/src/xdisp.c b/src/xdisp.c
index 4c007e572ce..77e9db2e5eb 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1,8 +1,8 @@
1/* Display generation from window structure and buffer text. 1/* Display generation from window structure and buffer text.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 2
3 1997, 1998, 1999, 2000, 2001, 2002, 2003, 3Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1997, 1998,
4 2004, 2005, 2006, 2007, 2008, 2009, 2010 4 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
5 Free Software Foundation, Inc. 5 2010 Free Software Foundation, Inc.
6 6
7This file is part of GNU Emacs. 7This file is part of GNU Emacs.
8 8
@@ -214,11 +214,41 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
214 leftmost character with special glyphs, which will display as, 214 leftmost character with special glyphs, which will display as,
215 well, empty. On text terminals, these special glyphs are simply 215 well, empty. On text terminals, these special glyphs are simply
216 blank characters. On graphics terminals, there's a single stretch 216 blank characters. On graphics terminals, there's a single stretch
217 glyph with suitably computed width. Both the blanks and the 217 glyph of a suitably computed width. Both the blanks and the
218 stretch glyph are given the face of the background of the line. 218 stretch glyph are given the face of the background of the line.
219 This way, the terminal-specific back-end can still draw the glyphs 219 This way, the terminal-specific back-end can still draw the glyphs
220 left to right, even for R2L lines. 220 left to right, even for R2L lines.
221 221
222 Bidirectional display and character compositions
223
224 Some scripts cannot be displayed by drawing each character
225 individually, because adjacent characters change each other's shape
226 on display. For example, Arabic and Indic scripts belong to this
227 category.
228
229 Emacs display supports this by providing "character compositions",
230 most of which is implemented in composite.c. During the buffer
231 scan that delivers characters to PRODUCE_GLYPHS, if the next
232 character to be delivered is a composed character, the iteration
233 calls composition_reseat_it and next_element_from_composition. If
234 they succeed to compose the character with one or more of the
235 following characters, the whole sequence of characters that where
236 composed is recorded in the `struct composition_it' object that is
237 part of the buffer iterator. The composed sequence could produce
238 one or more font glyphs (called "grapheme clusters") on the screen.
239 Each of these grapheme clusters is then delivered to PRODUCE_GLYPHS
240 in the direction corresponding to the current bidi scan direction
241 (recorded in the scan_dir member of the `struct bidi_it' object
242 that is part of the buffer iterator). In particular, if the bidi
243 iterator currently scans the buffer backwards, the grapheme
244 clusters are delivered back to front. This reorders the grapheme
245 clusters as appropriate for the current bidi context. Note that
246 this means that the grapheme clusters are always stored in the
247 LGSTRING object (see composite.c) in the logical order.
248
249 Moving an iterator in bidirectional text
250 without producing glyphs
251
222 Note one important detail mentioned above: that the bidi reordering 252 Note one important detail mentioned above: that the bidi reordering
223 engine, driven by the iterator, produces characters in R2L rows 253 engine, driven by the iterator, produces characters in R2L rows
224 starting at the character that will be the rightmost on display. 254 starting at the character that will be the rightmost on display.
@@ -888,6 +918,9 @@ static int clear_face_cache_count;
888#ifdef HAVE_WINDOW_SYSTEM 918#ifdef HAVE_WINDOW_SYSTEM
889#define CLEAR_IMAGE_CACHE_COUNT 101 919#define CLEAR_IMAGE_CACHE_COUNT 101
890static int clear_image_cache_count; 920static int clear_image_cache_count;
921
922/* Null glyph slice */
923static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 };
891#endif 924#endif
892 925
893/* Non-zero while redisplay_internal is in progress. */ 926/* Non-zero while redisplay_internal is in progress. */
@@ -913,10 +946,6 @@ EMACS_INT help_echo_pos;
913 946
914Lisp_Object previous_help_echo_string; 947Lisp_Object previous_help_echo_string;
915 948
916/* Null glyph slice */
917
918static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 };
919
920/* Platform-independent portion of hourglass implementation. */ 949/* Platform-independent portion of hourglass implementation. */
921 950
922/* Non-zero means we're allowed to display a hourglass pointer. */ 951/* Non-zero means we're allowed to display a hourglass pointer. */
@@ -932,6 +961,21 @@ struct atimer *hourglass_atimer;
932/* Number of seconds to wait before displaying an hourglass cursor. */ 961/* Number of seconds to wait before displaying an hourglass cursor. */
933Lisp_Object Vhourglass_delay; 962Lisp_Object Vhourglass_delay;
934 963
964/* Name of the face used to display glyphless characters. */
965Lisp_Object Qglyphless_char;
966
967/* Char-table to control the display of glyphless characters. */
968Lisp_Object Vglyphless_char_display;
969
970/* Symbol for the purpose of Vglyphless_char_display. */
971Lisp_Object Qglyphless_char_display;
972
973/* Method symbols for Vglyphless_char_display. */
974static Lisp_Object Qhex_code, Qempty_box, Qthin_space, Qzero_width;
975
976/* Default pixel width of `thin-space' display method. */
977#define THIN_SPACE_WIDTH 1
978
935/* Default number of seconds to wait before displaying an hourglass 979/* Default number of seconds to wait before displaying an hourglass
936 cursor. */ 980 cursor. */
937#define DEFAULT_HOURGLASS_DELAY 1 981#define DEFAULT_HOURGLASS_DELAY 1
@@ -960,10 +1004,8 @@ static int text_outside_line_unchanged_p (struct window *,
960 EMACS_INT, EMACS_INT); 1004 EMACS_INT, EMACS_INT);
961static void store_mode_line_noprop_char (char); 1005static void store_mode_line_noprop_char (char);
962static int store_mode_line_noprop (const unsigned char *, int, int); 1006static int store_mode_line_noprop (const unsigned char *, int, int);
963static void x_consider_frame_title (Lisp_Object);
964static void handle_stop (struct it *); 1007static void handle_stop (struct it *);
965static void handle_stop_backwards (struct it *, EMACS_INT); 1008static void handle_stop_backwards (struct it *, EMACS_INT);
966static int tool_bar_lines_needed (struct frame *, int *);
967static int single_display_spec_intangible_p (Lisp_Object); 1009static int single_display_spec_intangible_p (Lisp_Object);
968static void ensure_echo_area_buffers (void); 1010static void ensure_echo_area_buffers (void);
969static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object); 1011static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object);
@@ -1076,6 +1118,8 @@ static int in_ellipses_for_invisible_text_p (struct display_pos *,
1076 1118
1077#ifdef HAVE_WINDOW_SYSTEM 1119#ifdef HAVE_WINDOW_SYSTEM
1078 1120
1121static void x_consider_frame_title (Lisp_Object);
1122static int tool_bar_lines_needed (struct frame *, int *);
1079static void update_tool_bar (struct frame *, int); 1123static void update_tool_bar (struct frame *, int);
1080static void build_desired_tool_bar_string (struct frame *f); 1124static void build_desired_tool_bar_string (struct frame *f);
1081static int redisplay_tool_bar (struct frame *); 1125static int redisplay_tool_bar (struct frame *);
@@ -1087,9 +1131,11 @@ static void append_stretch_glyph (struct it *, Lisp_Object,
1087 int, int, int); 1131 int, int, int);
1088 1132
1089 1133
1090
1091#endif /* HAVE_WINDOW_SYSTEM */ 1134#endif /* HAVE_WINDOW_SYSTEM */
1092 1135
1136static int coords_in_mouse_face_p (struct window *, int, int);
1137
1138
1093 1139
1094/*********************************************************************** 1140/***********************************************************************
1095 Window display dimensions 1141 Window display dimensions
@@ -1781,8 +1827,6 @@ glyph_to_pixel_coords (struct window *w, int hpos, int vpos,
1781} 1827}
1782 1828
1783 1829
1784#ifdef HAVE_WINDOW_SYSTEM
1785
1786/* Find the glyph under window-relative coordinates X/Y in window W. 1830/* Find the glyph under window-relative coordinates X/Y in window W.
1787 Consider only glyphs from buffer text, i.e. no glyphs from overlay 1831 Consider only glyphs from buffer text, i.e. no glyphs from overlay
1788 strings. Return in *HPOS and *VPOS the row and column number of 1832 strings. Return in *HPOS and *VPOS the row and column number of
@@ -1865,7 +1909,6 @@ x_y_to_hpos_vpos (struct window *w, int x, int y, int *hpos, int *vpos,
1865 return glyph; 1909 return glyph;
1866} 1910}
1867 1911
1868
1869/* EXPORT: 1912/* EXPORT:
1870 Convert frame-relative x/y to coordinates relative to window W. 1913 Convert frame-relative x/y to coordinates relative to window W.
1871 Takes pseudo-windows into account. */ 1914 Takes pseudo-windows into account. */
@@ -1888,6 +1931,8 @@ frame_to_window_pixel_xy (struct window *w, int *x, int *y)
1888 } 1931 }
1889} 1932}
1890 1933
1934#ifdef HAVE_WINDOW_SYSTEM
1935
1891/* EXPORT: 1936/* EXPORT:
1892 Return in RECTS[] at most N clipping rectangles for glyph string S. 1937 Return in RECTS[] at most N clipping rectangles for glyph string S.
1893 Return the number of stored rectangles. */ 1938 Return the number of stored rectangles. */
@@ -2173,7 +2218,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
2173 frame pixel coordinates X/Y on frame F. */ 2218 frame pixel coordinates X/Y on frame F. */
2174 2219
2175 if (!f->glyphs_initialized_p 2220 if (!f->glyphs_initialized_p
2176 || (window = window_from_coordinates (f, gx, gy, &part, &x, &y, 0), 2221 || (window = window_from_coordinates (f, gx, gy, &part, 0),
2177 NILP (window))) 2222 NILP (window)))
2178 { 2223 {
2179 width = FRAME_SMALLEST_CHAR_WIDTH (f); 2224 width = FRAME_SMALLEST_CHAR_WIDTH (f);
@@ -2185,6 +2230,9 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
2185 width = WINDOW_FRAME_COLUMN_WIDTH (w); 2230 width = WINDOW_FRAME_COLUMN_WIDTH (w);
2186 height = WINDOW_FRAME_LINE_HEIGHT (w); 2231 height = WINDOW_FRAME_LINE_HEIGHT (w);
2187 2232
2233 x = window_relative_x_coord (w, part, gx);
2234 y = gy - WINDOW_TOP_EDGE_Y (w);
2235
2188 r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 2236 r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
2189 end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); 2237 end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w);
2190 2238
@@ -5731,6 +5779,57 @@ static int (* get_next_element[NUM_IT_METHODS]) (struct it *it) =
5731 (IT)->string))) 5779 (IT)->string)))
5732 5780
5733 5781
5782/* Lookup the char-table Vglyphless_char_display for character C (-1
5783 if we want information for no-font case), and return the display
5784 method symbol. By side-effect, update it->what and
5785 it->glyphless_method. This function is called from
5786 get_next_display_element for each character element, and from
5787 x_produce_glyphs when no suitable font was found. */
5788
5789Lisp_Object
5790lookup_glyphless_char_display (int c, struct it *it)
5791{
5792 Lisp_Object glyphless_method = Qnil;
5793
5794 if (CHAR_TABLE_P (Vglyphless_char_display)
5795 && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= 1)
5796 glyphless_method = (c >= 0
5797 ? CHAR_TABLE_REF (Vglyphless_char_display, c)
5798 : XCHAR_TABLE (Vglyphless_char_display)->extras[0]);
5799 retry:
5800 if (NILP (glyphless_method))
5801 {
5802 if (c >= 0)
5803 /* The default is to display the character by a proper font. */
5804 return Qnil;
5805 /* The default for the no-font case is to display an empty box. */
5806 glyphless_method = Qempty_box;
5807 }
5808 if (EQ (glyphless_method, Qzero_width))
5809 {
5810 if (c >= 0)
5811 return glyphless_method;
5812 /* This method can't be used for the no-font case. */
5813 glyphless_method = Qempty_box;
5814 }
5815 if (EQ (glyphless_method, Qthin_space))
5816 it->glyphless_method = GLYPHLESS_DISPLAY_THIN_SPACE;
5817 else if (EQ (glyphless_method, Qempty_box))
5818 it->glyphless_method = GLYPHLESS_DISPLAY_EMPTY_BOX;
5819 else if (EQ (glyphless_method, Qhex_code))
5820 it->glyphless_method = GLYPHLESS_DISPLAY_HEX_CODE;
5821 else if (STRINGP (glyphless_method))
5822 it->glyphless_method = GLYPHLESS_DISPLAY_ACRONYM;
5823 else
5824 {
5825 /* Invalid value. We use the default method. */
5826 glyphless_method = Qnil;
5827 goto retry;
5828 }
5829 it->what = IT_GLYPHLESS;
5830 return glyphless_method;
5831}
5832
5734/* Load IT's display element fields with information about the next 5833/* Load IT's display element fields with information about the next
5735 display element from the current position of IT. Value is zero if 5834 display element from the current position of IT. Value is zero if
5736 end of buffer (or C string) is reached. */ 5835 end of buffer (or C string) is reached. */
@@ -5739,6 +5838,10 @@ static struct frame *last_escape_glyph_frame = NULL;
5739static unsigned last_escape_glyph_face_id = (1 << FACE_ID_BITS); 5838static unsigned last_escape_glyph_face_id = (1 << FACE_ID_BITS);
5740static int last_escape_glyph_merged_face_id = 0; 5839static int last_escape_glyph_merged_face_id = 0;
5741 5840
5841struct frame *last_glyphless_glyph_frame = NULL;
5842unsigned last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
5843int last_glyphless_glyph_merged_face_id = 0;
5844
5742int 5845int
5743get_next_display_element (struct it *it) 5846get_next_display_element (struct it *it)
5744{ 5847{
@@ -5817,6 +5920,15 @@ get_next_display_element (struct it *it)
5817 goto get_next; 5920 goto get_next;
5818 } 5921 }
5819 5922
5923 if (! NILP (lookup_glyphless_char_display (c, it)))
5924 {
5925 if (it->what == IT_GLYPHLESS)
5926 goto done;
5927 /* Don't display this character. */
5928 set_iterator_to_next (it, 0);
5929 goto get_next;
5930 }
5931
5820 if (! ASCII_CHAR_P (c) && ! NILP (Vnobreak_char_display)) 5932 if (! ASCII_CHAR_P (c) && ! NILP (Vnobreak_char_display))
5821 nbsp_or_shy = (c == 0xA0 ? char_is_nbsp 5933 nbsp_or_shy = (c == 0xA0 ? char_is_nbsp
5822 : c == 0xAD ? char_is_soft_hyphen 5934 : c == 0xAD ? char_is_soft_hyphen
@@ -6031,6 +6143,7 @@ get_next_display_element (struct it *it)
6031 } 6143 }
6032#endif 6144#endif
6033 6145
6146 done:
6034 /* Is this character the last one of a run of characters with 6147 /* Is this character the last one of a run of characters with
6035 box? If yes, set IT->end_of_box_run_p to 1. */ 6148 box? If yes, set IT->end_of_box_run_p to 1. */
6036 if (it->face_box_p 6149 if (it->face_box_p
@@ -9271,6 +9384,8 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
9271 Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); 9384 Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil);
9272 9385
9273 current_buffer->truncate_lines = message_truncate_lines ? Qt : Qnil; 9386 current_buffer->truncate_lines = message_truncate_lines ? Qt : Qnil;
9387 if (!NILP (current_buffer->bidi_display_reordering))
9388 current_buffer->bidi_paragraph_direction = Qleft_to_right;
9274 9389
9275 /* Insert new message at BEG. */ 9390 /* Insert new message at BEG. */
9276 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 9391 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -10737,7 +10852,7 @@ static int
10737get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, 10852get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph,
10738 int *hpos, int *vpos, int *prop_idx) 10853 int *hpos, int *vpos, int *prop_idx)
10739{ 10854{
10740 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 10855 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
10741 struct window *w = XWINDOW (f->tool_bar_window); 10856 struct window *w = XWINDOW (f->tool_bar_window);
10742 int area; 10857 int area;
10743 10858
@@ -10752,14 +10867,14 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph,
10752 return -1; 10867 return -1;
10753 10868
10754 /* Is mouse on the highlighted item? */ 10869 /* Is mouse on the highlighted item? */
10755 if (EQ (f->tool_bar_window, dpyinfo->mouse_face_window) 10870 if (EQ (f->tool_bar_window, hlinfo->mouse_face_window)
10756 && *vpos >= dpyinfo->mouse_face_beg_row 10871 && *vpos >= hlinfo->mouse_face_beg_row
10757 && *vpos <= dpyinfo->mouse_face_end_row 10872 && *vpos <= hlinfo->mouse_face_end_row
10758 && (*vpos > dpyinfo->mouse_face_beg_row 10873 && (*vpos > hlinfo->mouse_face_beg_row
10759 || *hpos >= dpyinfo->mouse_face_beg_col) 10874 || *hpos >= hlinfo->mouse_face_beg_col)
10760 && (*vpos < dpyinfo->mouse_face_end_row 10875 && (*vpos < hlinfo->mouse_face_end_row
10761 || *hpos < dpyinfo->mouse_face_end_col 10876 || *hpos < hlinfo->mouse_face_end_col
10762 || dpyinfo->mouse_face_past_end)) 10877 || hlinfo->mouse_face_past_end))
10763 return 0; 10878 return 0;
10764 10879
10765 return 1; 10880 return 1;
@@ -10776,7 +10891,7 @@ void
10776handle_tool_bar_click (struct frame *f, int x, int y, int down_p, 10891handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
10777 unsigned int modifiers) 10892 unsigned int modifiers)
10778{ 10893{
10779 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 10894 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
10780 struct window *w = XWINDOW (f->tool_bar_window); 10895 struct window *w = XWINDOW (f->tool_bar_window);
10781 int hpos, vpos, prop_idx; 10896 int hpos, vpos, prop_idx;
10782 struct glyph *glyph; 10897 struct glyph *glyph;
@@ -10795,8 +10910,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
10795 if (down_p) 10910 if (down_p)
10796 { 10911 {
10797 /* Show item in pressed state. */ 10912 /* Show item in pressed state. */
10798 show_mouse_face (dpyinfo, DRAW_IMAGE_SUNKEN); 10913 show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN);
10799 dpyinfo->mouse_face_image_state = DRAW_IMAGE_SUNKEN; 10914 hlinfo->mouse_face_image_state = DRAW_IMAGE_SUNKEN;
10800 last_tool_bar_item = prop_idx; 10915 last_tool_bar_item = prop_idx;
10801 } 10916 }
10802 else 10917 else
@@ -10806,8 +10921,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
10806 EVENT_INIT (event); 10921 EVENT_INIT (event);
10807 10922
10808 /* Show item in released state. */ 10923 /* Show item in released state. */
10809 show_mouse_face (dpyinfo, DRAW_IMAGE_RAISED); 10924 show_mouse_face (hlinfo, DRAW_IMAGE_RAISED);
10810 dpyinfo->mouse_face_image_state = DRAW_IMAGE_RAISED; 10925 hlinfo->mouse_face_image_state = DRAW_IMAGE_RAISED;
10811 10926
10812 key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); 10927 key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY);
10813 10928
@@ -10837,6 +10952,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
10837 Lisp_Object window = f->tool_bar_window; 10952 Lisp_Object window = f->tool_bar_window;
10838 struct window *w = XWINDOW (window); 10953 struct window *w = XWINDOW (window);
10839 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 10954 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
10955 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
10840 int hpos, vpos; 10956 int hpos, vpos;
10841 struct glyph *glyph; 10957 struct glyph *glyph;
10842 struct glyph_row *row; 10958 struct glyph_row *row;
@@ -10850,7 +10966,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
10850 values when mouse moves outside of the frame. */ 10966 values when mouse moves outside of the frame. */
10851 if (x <= 0 || y <= 0) 10967 if (x <= 0 || y <= 0)
10852 { 10968 {
10853 clear_mouse_face (dpyinfo); 10969 clear_mouse_face (hlinfo);
10854 return; 10970 return;
10855 } 10971 }
10856 10972
@@ -10858,14 +10974,14 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
10858 if (rc < 0) 10974 if (rc < 0)
10859 { 10975 {
10860 /* Not on tool-bar item. */ 10976 /* Not on tool-bar item. */
10861 clear_mouse_face (dpyinfo); 10977 clear_mouse_face (hlinfo);
10862 return; 10978 return;
10863 } 10979 }
10864 else if (rc == 0) 10980 else if (rc == 0)
10865 /* On same tool-bar item as before. */ 10981 /* On same tool-bar item as before. */
10866 goto set_help_echo; 10982 goto set_help_echo;
10867 10983
10868 clear_mouse_face (dpyinfo); 10984 clear_mouse_face (hlinfo);
10869 10985
10870 /* Mouse is down, but on different tool-bar item? */ 10986 /* Mouse is down, but on different tool-bar item? */
10871 mouse_down_p = (dpyinfo->grabbed 10987 mouse_down_p = (dpyinfo->grabbed
@@ -10875,7 +10991,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
10875 && last_tool_bar_item != prop_idx) 10991 && last_tool_bar_item != prop_idx)
10876 return; 10992 return;
10877 10993
10878 dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT; 10994 hlinfo->mouse_face_image_state = DRAW_NORMAL_TEXT;
10879 draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; 10995 draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED;
10880 10996
10881 /* If tool-bar item is not enabled, don't highlight it. */ 10997 /* If tool-bar item is not enabled, don't highlight it. */
@@ -10889,22 +11005,22 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
10889 x += row->glyphs[TEXT_AREA][i].pixel_width; 11005 x += row->glyphs[TEXT_AREA][i].pixel_width;
10890 11006
10891 /* Record this as the current active region. */ 11007 /* Record this as the current active region. */
10892 dpyinfo->mouse_face_beg_col = hpos; 11008 hlinfo->mouse_face_beg_col = hpos;
10893 dpyinfo->mouse_face_beg_row = vpos; 11009 hlinfo->mouse_face_beg_row = vpos;
10894 dpyinfo->mouse_face_beg_x = x; 11010 hlinfo->mouse_face_beg_x = x;
10895 dpyinfo->mouse_face_beg_y = row->y; 11011 hlinfo->mouse_face_beg_y = row->y;
10896 dpyinfo->mouse_face_past_end = 0; 11012 hlinfo->mouse_face_past_end = 0;
10897 11013
10898 dpyinfo->mouse_face_end_col = hpos + 1; 11014 hlinfo->mouse_face_end_col = hpos + 1;
10899 dpyinfo->mouse_face_end_row = vpos; 11015 hlinfo->mouse_face_end_row = vpos;
10900 dpyinfo->mouse_face_end_x = x + glyph->pixel_width; 11016 hlinfo->mouse_face_end_x = x + glyph->pixel_width;
10901 dpyinfo->mouse_face_end_y = row->y; 11017 hlinfo->mouse_face_end_y = row->y;
10902 dpyinfo->mouse_face_window = window; 11018 hlinfo->mouse_face_window = window;
10903 dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; 11019 hlinfo->mouse_face_face_id = TOOL_BAR_FACE_ID;
10904 11020
10905 /* Display it as active. */ 11021 /* Display it as active. */
10906 show_mouse_face (dpyinfo, draw); 11022 show_mouse_face (hlinfo, draw);
10907 dpyinfo->mouse_face_image_state = draw; 11023 hlinfo->mouse_face_image_state = draw;
10908 } 11024 }
10909 11025
10910 set_help_echo: 11026 set_help_echo:
@@ -11578,6 +11694,8 @@ redisplay_internal (int preserve_echo_area)
11578 reconsider_clip_changes (w, current_buffer); 11694 reconsider_clip_changes (w, current_buffer);
11579 last_escape_glyph_frame = NULL; 11695 last_escape_glyph_frame = NULL;
11580 last_escape_glyph_face_id = (1 << FACE_ID_BITS); 11696 last_escape_glyph_face_id = (1 << FACE_ID_BITS);
11697 last_glyphless_glyph_frame = NULL;
11698 last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
11581 11699
11582 /* If new fonts have been loaded that make a glyph matrix adjustment 11700 /* If new fonts have been loaded that make a glyph matrix adjustment
11583 necessary, do it. */ 11701 necessary, do it. */
@@ -12723,6 +12841,15 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12723 && BUFFERP (glyph->object) && glyph->charpos == pt_old) 12841 && BUFFERP (glyph->object) && glyph->charpos == pt_old)
12724 && bpos_covered < pt_old) 12842 && bpos_covered < pt_old)
12725 { 12843 {
12844 /* An empty line has a single glyph whose OBJECT is zero and
12845 whose CHARPOS is the position of a newline on that line.
12846 Note that on a TTY, there are more glyphs after that, which
12847 were produced by extend_face_to_end_of_line, but their
12848 CHARPOS is zero or negative. */
12849 int empty_line_p =
12850 (row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end)
12851 && INTEGERP (glyph->object) && glyph->charpos > 0;
12852
12726 if (row->ends_in_ellipsis_p && pos_after == last_pos) 12853 if (row->ends_in_ellipsis_p && pos_after == last_pos)
12727 { 12854 {
12728 EMACS_INT ellipsis_pos; 12855 EMACS_INT ellipsis_pos;
@@ -12758,10 +12885,11 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12758 || (row->truncated_on_left_p && pt_old < bpos_min) 12885 || (row->truncated_on_left_p && pt_old < bpos_min)
12759 || (row->truncated_on_right_p && pt_old > bpos_max) 12886 || (row->truncated_on_right_p && pt_old > bpos_max)
12760 /* Zero-width characters produce no glyphs. */ 12887 /* Zero-width characters produce no glyphs. */
12761 || ((row->reversed_p 12888 || (!string_seen
12762 ? glyph_after > glyphs_end 12889 && !empty_line_p
12763 : glyph_after < glyphs_end) 12890 && (row->reversed_p
12764 && eabs (glyph_after - glyph_before) == 1)) 12891 ? glyph_after > glyphs_end
12892 : glyph_after < glyphs_end)))
12765 { 12893 {
12766 cursor = glyph_after; 12894 cursor = glyph_after;
12767 x = -1; 12895 x = -1;
@@ -12815,8 +12943,9 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12815 cursor on that character's glyph. */ 12943 cursor on that character's glyph. */
12816 EMACS_INT strpos = glyph->charpos; 12944 EMACS_INT strpos = glyph->charpos;
12817 12945
12818 cursor = glyph; 12946 if (tem)
12819 for (glyph += incr; 12947 cursor = glyph;
12948 for ( ;
12820 (row->reversed_p ? glyph > stop : glyph < stop) 12949 (row->reversed_p ? glyph > stop : glyph < stop)
12821 && EQ (glyph->object, str); 12950 && EQ (glyph->object, str);
12822 glyph += incr) 12951 glyph += incr)
@@ -12832,7 +12961,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12832 cursor = glyph; 12961 cursor = glyph;
12833 break; 12962 break;
12834 } 12963 }
12835 if (glyph->charpos < strpos) 12964 if (tem && glyph->charpos < strpos)
12836 { 12965 {
12837 strpos = glyph->charpos; 12966 strpos = glyph->charpos;
12838 cursor = glyph; 12967 cursor = glyph;
@@ -12847,10 +12976,9 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12847 } 12976 }
12848 /* This string is not what we want; skip all of the 12977 /* This string is not what we want; skip all of the
12849 glyphs that came from it. */ 12978 glyphs that came from it. */
12850 do
12851 glyph += incr;
12852 while ((row->reversed_p ? glyph > stop : glyph < stop) 12979 while ((row->reversed_p ? glyph > stop : glyph < stop)
12853 && EQ (glyph->object, str)); 12980 && EQ (glyph->object, str))
12981 glyph += incr;
12854 } 12982 }
12855 else 12983 else
12856 glyph += incr; 12984 glyph += incr;
@@ -15333,10 +15461,12 @@ row_containing_pos (struct window *w, EMACS_INT charpos,
15333 { 15461 {
15334 struct glyph *g; 15462 struct glyph *g;
15335 15463
15336 if (NILP (XBUFFER (w->buffer)->bidi_display_reordering)) 15464 if (NILP (XBUFFER (w->buffer)->bidi_display_reordering)
15465 || (!best_row && !row->continued_p))
15337 return row; 15466 return row;
15338 /* In bidi-reordered rows, there could be several rows 15467 /* In bidi-reordered rows, there could be several rows
15339 occluding point. We need to find the one which fits 15468 occluding point, all of them belonging to the same
15469 continued line. We need to find the row which fits
15340 CHARPOS the best. */ 15470 CHARPOS the best. */
15341 for (g = row->glyphs[TEXT_AREA]; 15471 for (g = row->glyphs[TEXT_AREA];
15342 g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]; 15472 g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA];
@@ -15348,11 +15478,14 @@ row_containing_pos (struct window *w, EMACS_INT charpos,
15348 { 15478 {
15349 mindif = eabs (g->charpos - charpos); 15479 mindif = eabs (g->charpos - charpos);
15350 best_row = row; 15480 best_row = row;
15481 /* Exact match always wins. */
15482 if (mindif == 0)
15483 return best_row;
15351 } 15484 }
15352 } 15485 }
15353 } 15486 }
15354 } 15487 }
15355 else if (best_row) 15488 else if (best_row && !row->continued_p)
15356 return best_row; 15489 return best_row;
15357 ++row; 15490 ++row;
15358 } 15491 }
@@ -15897,6 +16030,9 @@ try_window_id (struct window *w)
15897 + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) 16030 + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0)
15898 + window_internal_height (w)); 16031 + window_internal_height (w));
15899 16032
16033#if defined (HAVE_GPM) || defined (MSDOS)
16034 x_clear_window_mouse_face (w);
16035#endif
15900 /* Perform the operation on the screen. */ 16036 /* Perform the operation on the screen. */
15901 if (dvpos > 0) 16037 if (dvpos > 0)
15902 { 16038 {
@@ -20651,6 +20787,42 @@ fill_gstring_glyph_string (struct glyph_string *s, int face_id,
20651} 20787}
20652 20788
20653 20789
20790/* Fill glyph string S from a sequence glyphs for glyphless characters.
20791 See the comment of fill_glyph_string for arguments.
20792 Value is the index of the first glyph not in S. */
20793
20794
20795static int
20796fill_glyphless_glyph_string (struct glyph_string *s, int face_id,
20797 int start, int end, int overlaps)
20798{
20799 struct glyph *glyph, *last;
20800 int voffset;
20801
20802 xassert (s->first_glyph->type == GLYPHLESS_GLYPH);
20803 s->for_overlaps = overlaps;
20804 glyph = s->row->glyphs[s->area] + start;
20805 last = s->row->glyphs[s->area] + end;
20806 voffset = glyph->voffset;
20807 s->face = FACE_FROM_ID (s->f, face_id);
20808 s->font = s->face->font;
20809 s->nchars = 1;
20810 s->width = glyph->pixel_width;
20811 glyph++;
20812 while (glyph < last
20813 && glyph->type == GLYPHLESS_GLYPH
20814 && glyph->voffset == voffset
20815 && glyph->face_id == face_id)
20816 {
20817 s->nchars++;
20818 s->width += glyph->pixel_width;
20819 glyph++;
20820 }
20821 s->ybase += voffset;
20822 return glyph - s->row->glyphs[s->area];
20823}
20824
20825
20654/* Fill glyph string S from a sequence of character glyphs. 20826/* Fill glyph string S from a sequence of character glyphs.
20655 20827
20656 FACE_ID is the face id of the string. START is the index of the 20828 FACE_ID is the face id of the string. START is the index of the
@@ -21161,6 +21333,28 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
21161 } while (0) 21333 } while (0)
21162 21334
21163 21335
21336/* Add a glyph string for a sequence of glyphless character's glyphs
21337 to the list of strings between HEAD and TAIL. The meanings of
21338 arguments are the same as those of BUILD_CHAR_GLYPH_STRINGS. */
21339
21340#define BUILD_GLYPHLESS_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \
21341 do \
21342 { \
21343 int face_id; \
21344 XChar2b *char2b; \
21345 \
21346 face_id = (row)->glyphs[area][START].face_id; \
21347 \
21348 s = (struct glyph_string *) alloca (sizeof *s); \
21349 INIT_GLYPH_STRING (s, NULL, w, row, area, START, HL); \
21350 append_glyph_string (&HEAD, &TAIL, s); \
21351 s->x = (X); \
21352 START = fill_glyphless_glyph_string (s, face_id, START, END, \
21353 overlaps); \
21354 } \
21355 while (0)
21356
21357
21164/* Build a list of glyph strings between HEAD and TAIL for the glyphs 21358/* Build a list of glyph strings between HEAD and TAIL for the glyphs
21165 of AREA of glyph row ROW on window W between indices START and END. 21359 of AREA of glyph row ROW on window W between indices START and END.
21166 HL overrides the face for drawing glyph strings, e.g. it is 21360 HL overrides the face for drawing glyph strings, e.g. it is
@@ -21184,7 +21378,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
21184 BUILD_CHAR_GLYPH_STRINGS (START, END, HEAD, TAIL, \ 21378 BUILD_CHAR_GLYPH_STRINGS (START, END, HEAD, TAIL, \
21185 HL, X, LAST_X); \ 21379 HL, X, LAST_X); \
21186 break; \ 21380 break; \
21187 \ 21381 \
21188 case COMPOSITE_GLYPH: \ 21382 case COMPOSITE_GLYPH: \
21189 if (first_glyph->u.cmp.automatic) \ 21383 if (first_glyph->u.cmp.automatic) \
21190 BUILD_GSTRING_GLYPH_STRING (START, END, HEAD, TAIL, \ 21384 BUILD_GSTRING_GLYPH_STRING (START, END, HEAD, TAIL, \
@@ -21193,21 +21387,26 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
21193 BUILD_COMPOSITE_GLYPH_STRING (START, END, HEAD, TAIL, \ 21387 BUILD_COMPOSITE_GLYPH_STRING (START, END, HEAD, TAIL, \
21194 HL, X, LAST_X); \ 21388 HL, X, LAST_X); \
21195 break; \ 21389 break; \
21196 \ 21390 \
21197 case STRETCH_GLYPH: \ 21391 case STRETCH_GLYPH: \
21198 BUILD_STRETCH_GLYPH_STRING (START, END, HEAD, TAIL, \ 21392 BUILD_STRETCH_GLYPH_STRING (START, END, HEAD, TAIL, \
21199 HL, X, LAST_X); \ 21393 HL, X, LAST_X); \
21200 break; \ 21394 break; \
21201 \ 21395 \
21202 case IMAGE_GLYPH: \ 21396 case IMAGE_GLYPH: \
21203 BUILD_IMAGE_GLYPH_STRING (START, END, HEAD, TAIL, \ 21397 BUILD_IMAGE_GLYPH_STRING (START, END, HEAD, TAIL, \
21204 HL, X, LAST_X); \ 21398 HL, X, LAST_X); \
21205 break; \ 21399 break; \
21206 \ 21400 \
21401 case GLYPHLESS_GLYPH: \
21402 BUILD_GLYPHLESS_GLYPH_STRING (START, END, HEAD, TAIL, \
21403 HL, X, LAST_X); \
21404 break; \
21405 \
21207 default: \ 21406 default: \
21208 abort (); \ 21407 abort (); \
21209 } \ 21408 } \
21210 \ 21409 \
21211 if (s) \ 21410 if (s) \
21212 { \ 21411 { \
21213 set_glyph_string_background_width (s, START, LAST_X); \ 21412 set_glyph_string_background_width (s, START, LAST_X); \
@@ -21291,7 +21490,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
21291 if (head && !overlaps && row->contains_overlapping_glyphs_p) 21490 if (head && !overlaps && row->contains_overlapping_glyphs_p)
21292 { 21491 {
21293 struct glyph_string *h, *t; 21492 struct glyph_string *h, *t;
21294 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 21493 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
21295 int mouse_beg_col, mouse_end_col, check_mouse_face = 0; 21494 int mouse_beg_col, mouse_end_col, check_mouse_face = 0;
21296 int dummy_x = 0; 21495 int dummy_x = 0;
21297 21496
@@ -21301,16 +21500,16 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
21301 { 21500 {
21302 struct glyph_row *mouse_beg_row, *mouse_end_row; 21501 struct glyph_row *mouse_beg_row, *mouse_end_row;
21303 21502
21304 mouse_beg_row = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); 21503 mouse_beg_row = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row);
21305 mouse_end_row = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); 21504 mouse_end_row = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_end_row);
21306 21505
21307 if (row >= mouse_beg_row && row <= mouse_end_row) 21506 if (row >= mouse_beg_row && row <= mouse_end_row)
21308 { 21507 {
21309 check_mouse_face = 1; 21508 check_mouse_face = 1;
21310 mouse_beg_col = (row == mouse_beg_row) 21509 mouse_beg_col = (row == mouse_beg_row)
21311 ? dpyinfo->mouse_face_beg_col : 0; 21510 ? hlinfo->mouse_face_beg_col : 0;
21312 mouse_end_col = (row == mouse_end_row) 21511 mouse_end_col = (row == mouse_end_row)
21313 ? dpyinfo->mouse_face_end_col 21512 ? hlinfo->mouse_face_end_col
21314 : row->used[TEXT_AREA]; 21513 : row->used[TEXT_AREA];
21315 } 21514 }
21316 } 21515 }
@@ -22103,6 +22302,229 @@ calc_line_height_property (struct it *it, Lisp_Object val, struct font *font,
22103} 22302}
22104 22303
22105 22304
22305/* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID
22306 is a face ID to be used for the glyph. FOR_NO_FONT is nonzero if
22307 and only if this is for a character for which no font was found.
22308
22309 If the display method (it->glyphless_method) is
22310 GLYPHLESS_DISPLAY_ACRONYM or GLYPHLESS_DISPLAY_HEX_CODE, LEN is a
22311 length of the acronym or the hexadecimal string, UPPER_XOFF and
22312 UPPER_YOFF are pixel offsets for the upper part of the string,
22313 LOWER_XOFF and LOWER_YOFF are for the lower part.
22314
22315 For the other display methods, LEN through LOWER_YOFF are zero. */
22316
22317static void
22318append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len,
22319 short upper_xoff, short upper_yoff,
22320 short lower_xoff, short lower_yoff)
22321{
22322 struct glyph *glyph;
22323 enum glyph_row_area area = it->area;
22324
22325 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
22326 if (glyph < it->glyph_row->glyphs[area + 1])
22327 {
22328 /* If the glyph row is reversed, we need to prepend the glyph
22329 rather than append it. */
22330 if (it->glyph_row->reversed_p && area == TEXT_AREA)
22331 {
22332 struct glyph *g;
22333
22334 /* Make room for the additional glyph. */
22335 for (g = glyph - 1; g >= it->glyph_row->glyphs[area]; g--)
22336 g[1] = *g;
22337 glyph = it->glyph_row->glyphs[area];
22338 }
22339 glyph->charpos = CHARPOS (it->position);
22340 glyph->object = it->object;
22341 glyph->pixel_width = it->pixel_width;
22342 glyph->ascent = it->ascent;
22343 glyph->descent = it->descent;
22344 glyph->voffset = it->voffset;
22345 glyph->type = GLYPHLESS_GLYPH;
22346 glyph->u.glyphless.method = it->glyphless_method;
22347 glyph->u.glyphless.for_no_font = for_no_font;
22348 glyph->u.glyphless.len = len;
22349 glyph->u.glyphless.ch = it->c;
22350 glyph->slice.glyphless.upper_xoff = upper_xoff;
22351 glyph->slice.glyphless.upper_yoff = upper_yoff;
22352 glyph->slice.glyphless.lower_xoff = lower_xoff;
22353 glyph->slice.glyphless.lower_yoff = lower_yoff;
22354 glyph->avoid_cursor_p = it->avoid_cursor_p;
22355 glyph->multibyte_p = it->multibyte_p;
22356 glyph->left_box_line_p = it->start_of_box_run_p;
22357 glyph->right_box_line_p = it->end_of_box_run_p;
22358 glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent
22359 || it->phys_descent > it->descent);
22360 glyph->padding_p = 0;
22361 glyph->glyph_not_available_p = 0;
22362 glyph->face_id = face_id;
22363 glyph->font_type = FONT_TYPE_UNKNOWN;
22364 if (it->bidi_p)
22365 {
22366 glyph->resolved_level = it->bidi_it.resolved_level;
22367 if ((it->bidi_it.type & 7) != it->bidi_it.type)
22368 abort ();
22369 glyph->bidi_type = it->bidi_it.type;
22370 }
22371 ++it->glyph_row->used[area];
22372 }
22373 else
22374 IT_EXPAND_MATRIX_WIDTH (it, area);
22375}
22376
22377
22378/* Produce a glyph for a glyphless character for iterator IT.
22379 IT->glyphless_method specifies which method to use for displaying
22380 the character. See the description of enum
22381 glyphless_display_method in dispextern.h for the detail.
22382
22383 FOR_NO_FONT is nonzero if and only if this is for a character for
22384 which no font was found. ACRONYM, if non-nil, is an acronym string
22385 for the character. */
22386
22387static void
22388produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
22389{
22390 int face_id;
22391 struct face *face;
22392 struct font *font;
22393 int base_width, base_height, width, height;
22394 short upper_xoff, upper_yoff, lower_xoff, lower_yoff;
22395 int len;
22396
22397 /* Get the metrics of the base font. We always refer to the current
22398 ASCII face. */
22399 face = FACE_FROM_ID (it->f, it->face_id)->ascii_face;
22400 font = face->font ? face->font : FRAME_FONT (it->f);
22401 it->ascent = FONT_BASE (font) + font->baseline_offset;
22402 it->descent = FONT_DESCENT (font) - font->baseline_offset;
22403 base_height = it->ascent + it->descent;
22404 base_width = font->average_width;
22405
22406 /* Get a face ID for the glyph by utilizing a cache (the same way as
22407 doen for `escape-glyph' in get_next_display_element). */
22408 if (it->f == last_glyphless_glyph_frame
22409 && it->face_id == last_glyphless_glyph_face_id)
22410 {
22411 face_id = last_glyphless_glyph_merged_face_id;
22412 }
22413 else
22414 {
22415 /* Merge the `glyphless-char' face into the current face. */
22416 face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id);
22417 last_glyphless_glyph_frame = it->f;
22418 last_glyphless_glyph_face_id = it->face_id;
22419 last_glyphless_glyph_merged_face_id = face_id;
22420 }
22421
22422 if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE)
22423 {
22424 it->pixel_width = THIN_SPACE_WIDTH;
22425 len = 0;
22426 upper_xoff = upper_yoff = lower_xoff = lower_yoff = 0;
22427 }
22428 else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX)
22429 {
22430 width = CHAR_WIDTH (it->c);
22431 if (width == 0)
22432 width = 1;
22433 else if (width > 4)
22434 width = 4;
22435 it->pixel_width = base_width * width;
22436 len = 0;
22437 upper_xoff = upper_yoff = lower_xoff = lower_yoff = 0;
22438 }
22439 else
22440 {
22441 char buf[7], *str;
22442 unsigned int code[6];
22443 int upper_len;
22444 int ascent, descent;
22445 struct font_metrics metrics_upper, metrics_lower;
22446
22447 face = FACE_FROM_ID (it->f, face_id);
22448 font = face->font ? face->font : FRAME_FONT (it->f);
22449 PREPARE_FACE_FOR_DISPLAY (it->f, face);
22450
22451 if (it->glyphless_method == GLYPHLESS_DISPLAY_ACRONYM)
22452 {
22453 if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display))
22454 acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c);
22455 str = STRINGP (acronym) ? (char *) SDATA (acronym) : "";
22456 }
22457 else
22458 {
22459 xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE);
22460 sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c);
22461 str = buf;
22462 }
22463 for (len = 0; str[len] && ASCII_BYTE_P (str[len]); len++)
22464 code[len] = font->driver->encode_char (font, str[len]);
22465 upper_len = (len + 1) / 2;
22466 font->driver->text_extents (font, code, upper_len,
22467 &metrics_upper);
22468 font->driver->text_extents (font, code + upper_len, len - upper_len,
22469 &metrics_lower);
22470
22471
22472
22473 /* +4 is for vertical bars of a box plus 1-pixel spaces at both side. */
22474 width = max (metrics_upper.width, metrics_lower.width) + 4;
22475 upper_xoff = upper_yoff = 2; /* the typical case */
22476 if (base_width >= width)
22477 {
22478 /* Align the upper to the left, the lower to the right. */
22479 it->pixel_width = base_width;
22480 lower_xoff = base_width - 2 - metrics_lower.width;
22481 }
22482 else
22483 {
22484 /* Center the shorter one. */
22485 it->pixel_width = width;
22486 if (metrics_upper.width >= metrics_lower.width)
22487 lower_xoff = (width - metrics_lower.width) / 2;
22488 else
22489 upper_xoff = (width - metrics_upper.width) / 2;
22490 }
22491
22492 /* +5 is for horizontal bars of a box plus 1-pixel spaces at
22493 top, bottom, and between upper and lower strings. */
22494 height = (metrics_upper.ascent + metrics_upper.descent
22495 + metrics_lower.ascent + metrics_lower.descent) + 5;
22496 /* Center vertically.
22497 H:base_height, D:base_descent
22498 h:height, ld:lower_descent, la:lower_ascent, ud:upper_descent
22499
22500 ascent = - (D - H/2 - h/2 + 1); "+ 1" for rounding up
22501 descent = D - H/2 + h/2;
22502 lower_yoff = descent - 2 - ld;
22503 upper_yoff = lower_yoff - la - 1 - ud; */
22504 ascent = - (it->descent - (base_height + height + 1) / 2);
22505 descent = it->descent - (base_height - height) / 2;
22506 lower_yoff = descent - 2 - metrics_lower.descent;
22507 upper_yoff = (lower_yoff - metrics_lower.ascent - 1
22508 - metrics_upper.descent);
22509 /* Don't make the height shorter than the base height. */
22510 if (height > base_height)
22511 {
22512 it->ascent = ascent;
22513 it->descent = descent;
22514 }
22515 }
22516
22517 it->phys_ascent = it->ascent;
22518 it->phys_descent = it->descent;
22519 if (it->glyph_row)
22520 append_glyphless_glyph (it, face_id, for_no_font, len,
22521 upper_xoff, upper_yoff,
22522 lower_xoff, lower_yoff);
22523 it->nglyphs = 1;
22524 take_vertical_position_into_account (it);
22525}
22526
22527
22106/* RIF: 22528/* RIF:
22107 Produce glyphs/get display metrics for the display element IT is 22529 Produce glyphs/get display metrics for the display element IT is
22108 loaded with. See the description of struct it in dispextern.h 22530 loaded with. See the description of struct it in dispextern.h
@@ -22120,29 +22542,25 @@ x_produce_glyphs (struct it *it)
22120 XChar2b char2b; 22542 XChar2b char2b;
22121 struct face *face = FACE_FROM_ID (it->f, it->face_id); 22543 struct face *face = FACE_FROM_ID (it->f, it->face_id);
22122 struct font *font = face->font; 22544 struct font *font = face->font;
22123 int font_not_found_p = font == NULL;
22124 struct font_metrics *pcm = NULL; 22545 struct font_metrics *pcm = NULL;
22125 int boff; /* baseline offset */ 22546 int boff; /* baseline offset */
22126 22547
22127 if (font_not_found_p) 22548 if (font == NULL)
22128 {
22129 /* When no suitable font found, display an empty box based
22130 on the metrics of the font of the default face (or what
22131 remapped). */
22132 struct face *no_font_face
22133 = FACE_FROM_ID (it->f,
22134 NILP (Vface_remapping_alist) ? DEFAULT_FACE_ID
22135 : lookup_basic_face (it->f, DEFAULT_FACE_ID));
22136 font = no_font_face->font;
22137 boff = font->baseline_offset;
22138 }
22139 else
22140 { 22549 {
22141 boff = font->baseline_offset; 22550 /* When no suitable font is found, display this character by
22142 if (font->vertical_centering) 22551 the method specified in the first extra slot of
22143 boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; 22552 Vglyphless_char_display. */
22553 Lisp_Object acronym = lookup_glyphless_char_display (-1, it);
22554
22555 xassert (it->what == IT_GLYPHLESS);
22556 produce_glyphless_glyph (it, 1, STRINGP (acronym) ? acronym : Qnil);
22557 goto done;
22144 } 22558 }
22145 22559
22560 boff = font->baseline_offset;
22561 if (font->vertical_centering)
22562 boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
22563
22146 if (it->char_to_display != '\n' && it->char_to_display != '\t') 22564 if (it->char_to_display != '\n' && it->char_to_display != '\t')
22147 { 22565 {
22148 int stretched_p; 22566 int stretched_p;
@@ -22161,8 +22579,7 @@ x_produce_glyphs (struct it *it)
22161 it->descent = FONT_DESCENT (font) - boff; 22579 it->descent = FONT_DESCENT (font) - boff;
22162 } 22580 }
22163 22581
22164 if (! font_not_found_p 22582 if (get_char_glyph_code (it->char_to_display, font, &char2b))
22165 && get_char_glyph_code (it->char_to_display, font, &char2b))
22166 { 22583 {
22167 pcm = get_per_char_metric (it->f, font, &char2b); 22584 pcm = get_per_char_metric (it->f, font, &char2b);
22168 if (pcm->width == 0 22585 if (pcm->width == 0
@@ -22752,11 +23169,14 @@ x_produce_glyphs (struct it *it)
22752 if (it->glyph_row) 23169 if (it->glyph_row)
22753 append_composite_glyph (it); 23170 append_composite_glyph (it);
22754 } 23171 }
23172 else if (it->what == IT_GLYPHLESS)
23173 produce_glyphless_glyph (it, 0, Qnil);
22755 else if (it->what == IT_IMAGE) 23174 else if (it->what == IT_IMAGE)
22756 produce_image_glyph (it); 23175 produce_image_glyph (it);
22757 else if (it->what == IT_STRETCH) 23176 else if (it->what == IT_STRETCH)
22758 produce_stretch_glyph (it); 23177 produce_stretch_glyph (it);
22759 23178
23179 done:
22760 /* Accumulate dimensions. Note: can't assume that it->descent > 0 23180 /* Accumulate dimensions. Note: can't assume that it->descent > 0
22761 because this isn't true for images with `:ascent 100'. */ 23181 because this isn't true for images with `:ascent 100'. */
22762 xassert (it->ascent >= 0 && it->descent >= 0); 23182 xassert (it->ascent >= 0 && it->descent >= 0);
@@ -23028,6 +23448,8 @@ set_frame_cursor_types (struct frame *f, Lisp_Object arg)
23028} 23448}
23029 23449
23030 23450
23451#ifdef HAVE_WINDOW_SYSTEM
23452
23031/* Return the cursor we want to be displayed in window W. Return 23453/* Return the cursor we want to be displayed in window W. Return
23032 width of bar/hbar cursor through WIDTH arg. Return with 23454 width of bar/hbar cursor through WIDTH arg. Return with
23033 ACTIVE_CURSOR arg set to 1 if cursor in window W is `active' 23455 ACTIVE_CURSOR arg set to 1 if cursor in window W is `active'
@@ -23073,10 +23495,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
23073 23495
23074 /* Detect a nonselected window or nonselected frame. */ 23496 /* Detect a nonselected window or nonselected frame. */
23075 else if (w != XWINDOW (f->selected_window) 23497 else if (w != XWINDOW (f->selected_window)
23076#ifdef HAVE_WINDOW_SYSTEM 23498 || f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame)
23077 || f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame
23078#endif
23079 )
23080 { 23499 {
23081 *active_cursor = 0; 23500 *active_cursor = 0;
23082 23501
@@ -23117,7 +23536,6 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
23117 /* Use normal cursor if not blinked off. */ 23536 /* Use normal cursor if not blinked off. */
23118 if (!w->cursor_off_p) 23537 if (!w->cursor_off_p)
23119 { 23538 {
23120#ifdef HAVE_WINDOW_SYSTEM
23121 if (glyph != NULL && glyph->type == IMAGE_GLYPH) 23539 if (glyph != NULL && glyph->type == IMAGE_GLYPH)
23122 { 23540 {
23123 if (cursor_type == FILLED_BOX_CURSOR) 23541 if (cursor_type == FILLED_BOX_CURSOR)
@@ -23145,7 +23563,6 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
23145 cursor_type = HOLLOW_BOX_CURSOR; 23563 cursor_type = HOLLOW_BOX_CURSOR;
23146 } 23564 }
23147 } 23565 }
23148#endif
23149 return cursor_type; 23566 return cursor_type;
23150 } 23567 }
23151 23568
@@ -23187,8 +23604,6 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
23187} 23604}
23188 23605
23189 23606
23190#ifdef HAVE_WINDOW_SYSTEM
23191
23192/* Notice when the text cursor of window W has been completely 23607/* Notice when the text cursor of window W has been completely
23193 overwritten by a drawing operation that outputs glyphs in AREA 23608 overwritten by a drawing operation that outputs glyphs in AREA
23194 starting at X0 and ending at X1 in the line starting at Y0 and 23609 starting at X0 and ending at X1 in the line starting at Y0 and
@@ -23354,7 +23769,7 @@ void
23354erase_phys_cursor (struct window *w) 23769erase_phys_cursor (struct window *w)
23355{ 23770{
23356 struct frame *f = XFRAME (w->frame); 23771 struct frame *f = XFRAME (w->frame);
23357 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 23772 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
23358 int hpos = w->phys_cursor.hpos; 23773 int hpos = w->phys_cursor.hpos;
23359 int vpos = w->phys_cursor.vpos; 23774 int vpos = w->phys_cursor.vpos;
23360 int mouse_face_here_p = 0; 23775 int mouse_face_here_p = 0;
@@ -23410,14 +23825,8 @@ erase_phys_cursor (struct window *w)
23410 23825
23411 /* If the cursor is in the mouse face area, redisplay that when 23826 /* If the cursor is in the mouse face area, redisplay that when
23412 we clear the cursor. */ 23827 we clear the cursor. */
23413 if (! NILP (dpyinfo->mouse_face_window) 23828 if (! NILP (hlinfo->mouse_face_window)
23414 && w == XWINDOW (dpyinfo->mouse_face_window) 23829 && coords_in_mouse_face_p (w, hpos, vpos)
23415 && (vpos > dpyinfo->mouse_face_beg_row
23416 || (vpos == dpyinfo->mouse_face_beg_row
23417 && hpos >= dpyinfo->mouse_face_beg_col))
23418 && (vpos < dpyinfo->mouse_face_end_row
23419 || (vpos == dpyinfo->mouse_face_end_row
23420 && hpos < dpyinfo->mouse_face_end_col))
23421 /* Don't redraw the cursor's spot in mouse face if it is at the 23830 /* Don't redraw the cursor's spot in mouse face if it is at the
23422 end of a line (on a newline). The cursor appears there, but 23831 end of a line (on a newline). The cursor appears there, but
23423 mouse highlighting does not. */ 23832 mouse highlighting does not. */
@@ -23608,30 +24017,50 @@ x_clear_cursor (struct window *w)
23608 update_window_cursor (w, 0); 24017 update_window_cursor (w, 0);
23609} 24018}
23610 24019
24020#endif /* HAVE_WINDOW_SYSTEM */
24021
24022/* Implementation of draw_row_with_mouse_face for GUI sessions, GPM,
24023 and MSDOS. */
24024void
24025draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row,
24026 int start_hpos, int end_hpos,
24027 enum draw_glyphs_face draw)
24028{
24029#ifdef HAVE_WINDOW_SYSTEM
24030 if (FRAME_WINDOW_P (XFRAME (w->frame)))
24031 {
24032 draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0);
24033 return;
24034 }
24035#endif
24036#if defined (HAVE_GPM) || defined (MSDOS)
24037 tty_draw_row_with_mouse_face (w, row, start_hpos, end_hpos, draw);
24038#endif
24039}
23611 24040
23612/* EXPORT: 24041/* EXPORT:
23613 Display the active region described by mouse_face_* according to DRAW. */ 24042 Display the active region described by mouse_face_* according to DRAW. */
23614 24043
23615void 24044void
23616show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) 24045show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
23617{ 24046{
23618 struct window *w = XWINDOW (dpyinfo->mouse_face_window); 24047 struct window *w = XWINDOW (hlinfo->mouse_face_window);
23619 struct frame *f = XFRAME (WINDOW_FRAME (w)); 24048 struct frame *f = XFRAME (WINDOW_FRAME (w));
23620 24049
23621 if (/* If window is in the process of being destroyed, don't bother 24050 if (/* If window is in the process of being destroyed, don't bother
23622 to do anything. */ 24051 to do anything. */
23623 w->current_matrix != NULL 24052 w->current_matrix != NULL
23624 /* Don't update mouse highlight if hidden */ 24053 /* Don't update mouse highlight if hidden */
23625 && (draw != DRAW_MOUSE_FACE || !dpyinfo->mouse_face_hidden) 24054 && (draw != DRAW_MOUSE_FACE || !hlinfo->mouse_face_hidden)
23626 /* Recognize when we are called to operate on rows that don't exist 24055 /* Recognize when we are called to operate on rows that don't exist
23627 anymore. This can happen when a window is split. */ 24056 anymore. This can happen when a window is split. */
23628 && dpyinfo->mouse_face_end_row < w->current_matrix->nrows) 24057 && hlinfo->mouse_face_end_row < w->current_matrix->nrows)
23629 { 24058 {
23630 int phys_cursor_on_p = w->phys_cursor_on_p; 24059 int phys_cursor_on_p = w->phys_cursor_on_p;
23631 struct glyph_row *row, *first, *last; 24060 struct glyph_row *row, *first, *last;
23632 24061
23633 first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); 24062 first = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row);
23634 last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); 24063 last = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_end_row);
23635 24064
23636 for (row = first; row <= last && row->enabled_p; ++row) 24065 for (row = first; row <= last && row->enabled_p; ++row)
23637 { 24066 {
@@ -23640,8 +24069,30 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw)
23640 /* For all but the first row, the highlight starts at column 0. */ 24069 /* For all but the first row, the highlight starts at column 0. */
23641 if (row == first) 24070 if (row == first)
23642 { 24071 {
23643 start_hpos = dpyinfo->mouse_face_beg_col; 24072 /* R2L rows have BEG and END in reversed order, but the
23644 start_x = dpyinfo->mouse_face_beg_x; 24073 screen drawing geometry is always left to right. So
24074 we need to mirror the beginning and end of the
24075 highlighted area in R2L rows. */
24076 if (!row->reversed_p)
24077 {
24078 start_hpos = hlinfo->mouse_face_beg_col;
24079 start_x = hlinfo->mouse_face_beg_x;
24080 }
24081 else if (row == last)
24082 {
24083 start_hpos = hlinfo->mouse_face_end_col;
24084 start_x = hlinfo->mouse_face_end_x;
24085 }
24086 else
24087 {
24088 start_hpos = 0;
24089 start_x = 0;
24090 }
24091 }
24092 else if (row->reversed_p && row == last)
24093 {
24094 start_hpos = hlinfo->mouse_face_end_col;
24095 start_x = hlinfo->mouse_face_end_x;
23645 } 24096 }
23646 else 24097 else
23647 { 24098 {
@@ -23650,7 +24101,20 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw)
23650 } 24101 }
23651 24102
23652 if (row == last) 24103 if (row == last)
23653 end_hpos = dpyinfo->mouse_face_end_col; 24104 {
24105 if (!row->reversed_p)
24106 end_hpos = hlinfo->mouse_face_end_col;
24107 else if (row == first)
24108 end_hpos = hlinfo->mouse_face_beg_col;
24109 else
24110 {
24111 end_hpos = row->used[TEXT_AREA];
24112 if (draw == DRAW_NORMAL_TEXT)
24113 row->fill_line_p = 1; /* Clear to end of line */
24114 }
24115 }
24116 else if (row->reversed_p && row == first)
24117 end_hpos = hlinfo->mouse_face_beg_col;
23654 else 24118 else
23655 { 24119 {
23656 end_hpos = row->used[TEXT_AREA]; 24120 end_hpos = row->used[TEXT_AREA];
@@ -23660,18 +24124,19 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw)
23660 24124
23661 if (end_hpos > start_hpos) 24125 if (end_hpos > start_hpos)
23662 { 24126 {
23663 draw_glyphs (w, start_x, row, TEXT_AREA, 24127 draw_row_with_mouse_face (w, start_x, row,
23664 start_hpos, end_hpos, 24128 start_hpos, end_hpos, draw);
23665 draw, 0);
23666 24129
23667 row->mouse_face_p 24130 row->mouse_face_p
23668 = draw == DRAW_MOUSE_FACE || draw == DRAW_IMAGE_RAISED; 24131 = draw == DRAW_MOUSE_FACE || draw == DRAW_IMAGE_RAISED;
23669 } 24132 }
23670 } 24133 }
23671 24134
24135#ifdef HAVE_WINDOW_SYSTEM
23672 /* When we've written over the cursor, arrange for it to 24136 /* When we've written over the cursor, arrange for it to
23673 be displayed again. */ 24137 be displayed again. */
23674 if (phys_cursor_on_p && !w->phys_cursor_on_p) 24138 if (FRAME_WINDOW_P (f)
24139 && phys_cursor_on_p && !w->phys_cursor_on_p)
23675 { 24140 {
23676 BLOCK_INPUT; 24141 BLOCK_INPUT;
23677 display_and_set_cursor (w, 1, 24142 display_and_set_cursor (w, 1,
@@ -23679,15 +24144,22 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw)
23679 w->phys_cursor.x, w->phys_cursor.y); 24144 w->phys_cursor.x, w->phys_cursor.y);
23680 UNBLOCK_INPUT; 24145 UNBLOCK_INPUT;
23681 } 24146 }
24147#endif /* HAVE_WINDOW_SYSTEM */
23682 } 24148 }
23683 24149
24150#ifdef HAVE_WINDOW_SYSTEM
23684 /* Change the mouse cursor. */ 24151 /* Change the mouse cursor. */
23685 if (draw == DRAW_NORMAL_TEXT && !EQ (dpyinfo->mouse_face_window, f->tool_bar_window)) 24152 if (FRAME_WINDOW_P (f))
23686 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); 24153 {
23687 else if (draw == DRAW_MOUSE_FACE) 24154 if (draw == DRAW_NORMAL_TEXT
23688 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); 24155 && !EQ (hlinfo->mouse_face_window, f->tool_bar_window))
23689 else 24156 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
23690 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor); 24157 else if (draw == DRAW_MOUSE_FACE)
24158 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
24159 else
24160 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor);
24161 }
24162#endif /* HAVE_WINDOW_SYSTEM */
23691} 24163}
23692 24164
23693/* EXPORT: 24165/* EXPORT:
@@ -23696,23 +24168,70 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw)
23696 face was actually drawn unhighlighted. */ 24168 face was actually drawn unhighlighted. */
23697 24169
23698int 24170int
23699clear_mouse_face (Display_Info *dpyinfo) 24171clear_mouse_face (Mouse_HLInfo *hlinfo)
23700{ 24172{
23701 int cleared = 0; 24173 int cleared = 0;
23702 24174
23703 if (!dpyinfo->mouse_face_hidden && !NILP (dpyinfo->mouse_face_window)) 24175 if (!hlinfo->mouse_face_hidden && !NILP (hlinfo->mouse_face_window))
23704 { 24176 {
23705 show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT); 24177 show_mouse_face (hlinfo, DRAW_NORMAL_TEXT);
23706 cleared = 1; 24178 cleared = 1;
23707 } 24179 }
23708 24180
23709 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 24181 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
23710 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 24182 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
23711 dpyinfo->mouse_face_window = Qnil; 24183 hlinfo->mouse_face_window = Qnil;
23712 dpyinfo->mouse_face_overlay = Qnil; 24184 hlinfo->mouse_face_overlay = Qnil;
23713 return cleared; 24185 return cleared;
23714} 24186}
23715 24187
24188/* Return non-zero if the coordinates HPOS and VPOS on windows W are
24189 within the mouse face on that window. */
24190static int
24191coords_in_mouse_face_p (struct window *w, int hpos, int vpos)
24192{
24193 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
24194
24195 /* Quickly resolve the easy cases. */
24196 if (!(WINDOWP (hlinfo->mouse_face_window)
24197 && XWINDOW (hlinfo->mouse_face_window) == w))
24198 return 0;
24199 if (vpos < hlinfo->mouse_face_beg_row
24200 || vpos > hlinfo->mouse_face_end_row)
24201 return 0;
24202 if (vpos > hlinfo->mouse_face_beg_row
24203 && vpos < hlinfo->mouse_face_end_row)
24204 return 1;
24205
24206 if (!MATRIX_ROW (w->current_matrix, vpos)->reversed_p)
24207 {
24208 if (hlinfo->mouse_face_beg_row == hlinfo->mouse_face_end_row)
24209 {
24210 if (hlinfo->mouse_face_beg_col <= hpos && hpos < hlinfo->mouse_face_end_col)
24211 return 1;
24212 }
24213 else if ((vpos == hlinfo->mouse_face_beg_row
24214 && hpos >= hlinfo->mouse_face_beg_col)
24215 || (vpos == hlinfo->mouse_face_end_row
24216 && hpos < hlinfo->mouse_face_end_col))
24217 return 1;
24218 }
24219 else
24220 {
24221 if (hlinfo->mouse_face_beg_row == hlinfo->mouse_face_end_row)
24222 {
24223 if (hlinfo->mouse_face_end_col < hpos && hpos <= hlinfo->mouse_face_beg_col)
24224 return 1;
24225 }
24226 else if ((vpos == hlinfo->mouse_face_beg_row
24227 && hpos <= hlinfo->mouse_face_beg_col)
24228 || (vpos == hlinfo->mouse_face_end_row
24229 && hpos > hlinfo->mouse_face_end_col))
24230 return 1;
24231 }
24232 return 0;
24233}
24234
23716 24235
23717/* EXPORT: 24236/* EXPORT:
23718 Non-zero if physical cursor of window W is within mouse face. */ 24237 Non-zero if physical cursor of window W is within mouse face. */
@@ -23720,32 +24239,135 @@ clear_mouse_face (Display_Info *dpyinfo)
23720int 24239int
23721cursor_in_mouse_face_p (struct window *w) 24240cursor_in_mouse_face_p (struct window *w)
23722{ 24241{
23723 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); 24242 return coords_in_mouse_face_p (w, w->phys_cursor.hpos, w->phys_cursor.vpos);
23724 int in_mouse_face = 0; 24243}
23725 24244
23726 if (WINDOWP (dpyinfo->mouse_face_window)
23727 && XWINDOW (dpyinfo->mouse_face_window) == w)
23728 {
23729 int hpos = w->phys_cursor.hpos;
23730 int vpos = w->phys_cursor.vpos;
23731 24245
23732 if (vpos >= dpyinfo->mouse_face_beg_row 24246
23733 && vpos <= dpyinfo->mouse_face_end_row 24247/* Find the glyph rows START_ROW and END_ROW of window W that display
23734 && (vpos > dpyinfo->mouse_face_beg_row 24248 characters between buffer positions START_CHARPOS and END_CHARPOS
23735 || hpos >= dpyinfo->mouse_face_beg_col) 24249 (excluding END_CHARPOS). This is similar to row_containing_pos,
23736 && (vpos < dpyinfo->mouse_face_end_row 24250 but is more accurate when bidi reordering makes buffer positions
23737 || hpos < dpyinfo->mouse_face_end_col 24251 change non-linearly with glyph rows. */
23738 || dpyinfo->mouse_face_past_end)) 24252static void
23739 in_mouse_face = 1; 24253rows_from_pos_range (struct window *w,
23740 } 24254 EMACS_INT start_charpos, EMACS_INT end_charpos,
24255 struct glyph_row **start, struct glyph_row **end)
24256{
24257 struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
24258 int last_y = window_text_bottom_y (w);
24259 struct glyph_row *row;
23741 24260
23742 return in_mouse_face; 24261 *start = NULL;
23743} 24262 *end = NULL;
24263
24264 while (!first->enabled_p
24265 && first < MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w))
24266 first++;
24267
24268 /* Find the START row. */
24269 for (row = first;
24270 row->enabled_p && MATRIX_ROW_BOTTOM_Y (row) <= last_y;
24271 row++)
24272 {
24273 /* A row can potentially be the START row if the range of the
24274 characters it displays intersects the range
24275 [START_CHARPOS..END_CHARPOS). */
24276 if (! ((start_charpos < MATRIX_ROW_START_CHARPOS (row)
24277 && end_charpos < MATRIX_ROW_START_CHARPOS (row))
24278 /* See the commentary in row_containing_pos, for the
24279 explanation of the complicated way to check whether
24280 some position is beyond the end of the characters
24281 displayed by a row. */
24282 || ((start_charpos > MATRIX_ROW_END_CHARPOS (row)
24283 || (start_charpos == MATRIX_ROW_END_CHARPOS (row)
24284 && !row->ends_at_zv_p
24285 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)))
24286 && (end_charpos > MATRIX_ROW_END_CHARPOS (row)
24287 || (end_charpos == MATRIX_ROW_END_CHARPOS (row)
24288 && !row->ends_at_zv_p
24289 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))))))
24290 {
24291 /* Found a candidate row. Now make sure at least one of the
24292 glyphs it displays has a charpos from the range
24293 [START_CHARPOS..END_CHARPOS).
24294
24295 This is not obvious because bidi reordering could make
24296 buffer positions of a row be 1,2,3,102,101,100, and if we
24297 want to highlight characters in [50..60), we don't want
24298 this row, even though [50..60) does intersect [1..103),
24299 the range of character positions given by the row's start
24300 and end positions. */
24301 struct glyph *g = row->glyphs[TEXT_AREA];
24302 struct glyph *e = g + row->used[TEXT_AREA];
24303
24304 while (g < e)
24305 {
24306 if (BUFFERP (g->object)
24307 && start_charpos <= g->charpos && g->charpos < end_charpos)
24308 *start = row;
24309 g++;
24310 }
24311 if (*start)
24312 break;
24313 }
24314 }
23744 24315
24316 /* Find the END row. */
24317 if (!*start
24318 /* If the last row is partially visible, start looking for END
24319 from that row, instead of starting from FIRST. */
24320 && !(row->enabled_p
24321 && row->y < last_y && MATRIX_ROW_BOTTOM_Y (row) > last_y))
24322 row = first;
24323 for ( ; row->enabled_p && MATRIX_ROW_BOTTOM_Y (row) <= last_y; row++)
24324 {
24325 struct glyph_row *next = row + 1;
24326
24327 if (!next->enabled_p
24328 || next >= MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w)
24329 /* The first row >= START whose range of displayed characters
24330 does NOT intersect the range [START_CHARPOS..END_CHARPOS]
24331 is the row END + 1. */
24332 || (start_charpos < MATRIX_ROW_START_CHARPOS (next)
24333 && end_charpos < MATRIX_ROW_START_CHARPOS (next))
24334 || ((start_charpos > MATRIX_ROW_END_CHARPOS (next)
24335 || (start_charpos == MATRIX_ROW_END_CHARPOS (next)
24336 && !next->ends_at_zv_p
24337 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (next)))
24338 && (end_charpos > MATRIX_ROW_END_CHARPOS (next)
24339 || (end_charpos == MATRIX_ROW_END_CHARPOS (next)
24340 && !next->ends_at_zv_p
24341 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (next)))))
24342 {
24343 *end = row;
24344 break;
24345 }
24346 else
24347 {
24348 /* If the next row's edges intersect [START_CHARPOS..END_CHARPOS],
24349 but none of the characters it displays are in the range, it is
24350 also END + 1. */
24351 struct glyph *g = next->glyphs[TEXT_AREA];
24352 struct glyph *e = g + next->used[TEXT_AREA];
23745 24353
24354 while (g < e)
24355 {
24356 if (BUFFERP (g->object)
24357 && start_charpos <= g->charpos && g->charpos < end_charpos)
24358 break;
24359 g++;
24360 }
24361 if (g == e)
24362 {
24363 *end = row;
24364 break;
24365 }
24366 }
24367 }
24368}
23746 24369
23747 24370/* This function sets the mouse_face_* elements of HLINFO, assuming
23748/* This function sets the mouse_face_* elements of DPYINFO, assuming
23749 the mouse cursor is on a glyph with buffer charpos MOUSE_CHARPOS in 24371 the mouse cursor is on a glyph with buffer charpos MOUSE_CHARPOS in
23750 window WINDOW. START_CHARPOS and END_CHARPOS are buffer positions 24372 window WINDOW. START_CHARPOS and END_CHARPOS are buffer positions
23751 for the overlay or run of text properties specifying the mouse 24373 for the overlay or run of text properties specifying the mouse
@@ -23756,7 +24378,7 @@ cursor_in_mouse_face_p (struct window *w)
23756 24378
23757static void 24379static void
23758mouse_face_from_buffer_pos (Lisp_Object window, 24380mouse_face_from_buffer_pos (Lisp_Object window,
23759 Display_Info *dpyinfo, 24381 Mouse_HLInfo *hlinfo,
23760 EMACS_INT mouse_charpos, 24382 EMACS_INT mouse_charpos,
23761 EMACS_INT start_charpos, 24383 EMACS_INT start_charpos,
23762 EMACS_INT end_charpos, 24384 EMACS_INT end_charpos,
@@ -23766,166 +24388,313 @@ mouse_face_from_buffer_pos (Lisp_Object window,
23766{ 24388{
23767 struct window *w = XWINDOW (window); 24389 struct window *w = XWINDOW (window);
23768 struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 24390 struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
23769 struct glyph_row *row; 24391 struct glyph_row *r1, *r2;
23770 struct glyph *glyph, *end; 24392 struct glyph *glyph, *end;
23771 EMACS_INT ignore; 24393 EMACS_INT ignore, pos;
23772 int x; 24394 int x;
23773 24395
23774 xassert (NILP (display_string) || STRINGP (display_string)); 24396 xassert (NILP (display_string) || STRINGP (display_string));
23775 xassert (NILP (before_string) || STRINGP (before_string)); 24397 xassert (NILP (before_string) || STRINGP (before_string));
23776 xassert (NILP (after_string) || STRINGP (after_string)); 24398 xassert (NILP (after_string) || STRINGP (after_string));
23777 24399
23778 /* Find the first highlighted glyph. */ 24400 /* Find the rows corresponding to START_CHARPOS and END_CHARPOS. */
23779 if (start_charpos < MATRIX_ROW_START_CHARPOS (first)) 24401 rows_from_pos_range (w, start_charpos, end_charpos, &r1, &r2);
24402 if (r1 == NULL)
24403 r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
24404 /* If the before-string or display-string contains newlines,
24405 rows_from_pos_range skips to its last row. Move back. */
24406 if (!NILP (before_string) || !NILP (display_string))
24407 {
24408 struct glyph_row *prev;
24409 while ((prev = r1 - 1, prev >= first)
24410 && MATRIX_ROW_END_CHARPOS (prev) == start_charpos
24411 && prev->used[TEXT_AREA] > 0)
24412 {
24413 struct glyph *beg = prev->glyphs[TEXT_AREA];
24414 glyph = beg + prev->used[TEXT_AREA];
24415 while (--glyph >= beg && INTEGERP (glyph->object));
24416 if (glyph < beg
24417 || !(EQ (glyph->object, before_string)
24418 || EQ (glyph->object, display_string)))
24419 break;
24420 r1 = prev;
24421 }
24422 }
24423 if (r2 == NULL)
23780 { 24424 {
23781 dpyinfo->mouse_face_beg_col = 0; 24425 r2 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
23782 dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (first, w->current_matrix); 24426 hlinfo->mouse_face_past_end = 1;
23783 dpyinfo->mouse_face_beg_x = first->x;
23784 dpyinfo->mouse_face_beg_y = first->y;
23785 } 24427 }
23786 else 24428 else if (!NILP (after_string))
23787 { 24429 {
23788 row = row_containing_pos (w, start_charpos, first, NULL, 0); 24430 /* If the after-string has newlines, advance to its last row. */
23789 if (row == NULL) 24431 struct glyph_row *next;
23790 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); 24432 struct glyph_row *last
23791 24433 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
23792 /* If the before-string or display-string contains newlines,
23793 row_containing_pos skips to its last row. Move back. */
23794 if (!NILP (before_string) || !NILP (display_string))
23795 {
23796 struct glyph_row *prev;
23797 while ((prev = row - 1, prev >= first)
23798 && MATRIX_ROW_END_CHARPOS (prev) == start_charpos
23799 && prev->used[TEXT_AREA] > 0)
23800 {
23801 struct glyph *beg = prev->glyphs[TEXT_AREA];
23802 glyph = beg + prev->used[TEXT_AREA];
23803 while (--glyph >= beg && INTEGERP (glyph->object));
23804 if (glyph < beg
23805 || !(EQ (glyph->object, before_string)
23806 || EQ (glyph->object, display_string)))
23807 break;
23808 row = prev;
23809 }
23810 }
23811 24434
23812 glyph = row->glyphs[TEXT_AREA]; 24435 for (next = r2 + 1;
23813 end = glyph + row->used[TEXT_AREA]; 24436 next <= last
23814 x = row->x; 24437 && next->used[TEXT_AREA] > 0
23815 dpyinfo->mouse_face_beg_y = row->y; 24438 && EQ (next->glyphs[TEXT_AREA]->object, after_string);
23816 dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (row, w->current_matrix); 24439 ++next)
24440 r2 = next;
24441 }
24442 /* The rest of the display engine assumes that mouse_face_beg_row is
24443 either above below mouse_face_end_row or identical to it. But
24444 with bidi-reordered continued lines, the row for START_CHARPOS
24445 could be below the row for END_CHARPOS. If so, swap the rows and
24446 store them in correct order. */
24447 if (r1->y > r2->y)
24448 {
24449 struct glyph_row *tem = r2;
24450
24451 r2 = r1;
24452 r1 = tem;
24453 }
24454
24455 hlinfo->mouse_face_beg_y = r1->y;
24456 hlinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (r1, w->current_matrix);
24457 hlinfo->mouse_face_end_y = r2->y;
24458 hlinfo->mouse_face_end_row = MATRIX_ROW_VPOS (r2, w->current_matrix);
24459
24460 /* For a bidi-reordered row, the positions of BEFORE_STRING,
24461 AFTER_STRING, DISPLAY_STRING, START_CHARPOS, and END_CHARPOS
24462 could be anywhere in the row and in any order. The strategy
24463 below is to find the leftmost and the rightmost glyph that
24464 belongs to either of these 3 strings, or whose position is
24465 between START_CHARPOS and END_CHARPOS, and highlight all the
24466 glyphs between those two. This may cover more than just the text
24467 between START_CHARPOS and END_CHARPOS if the range of characters
24468 strides the bidi level boundary, e.g. if the beginning is in R2L
24469 text while the end is in L2R text or vice versa. */
24470 if (!r1->reversed_p)
24471 {
24472 /* This row is in a left to right paragraph. Scan it left to
24473 right. */
24474 glyph = r1->glyphs[TEXT_AREA];
24475 end = glyph + r1->used[TEXT_AREA];
24476 x = r1->x;
23817 24477
23818 /* Skip truncation glyphs at the start of the glyph row. */ 24478 /* Skip truncation glyphs at the start of the glyph row. */
23819 if (row->displays_text_p) 24479 if (r1->displays_text_p)
23820 for (; glyph < end 24480 for (; glyph < end
23821 && INTEGERP (glyph->object) 24481 && INTEGERP (glyph->object)
23822 && glyph->charpos < 0; 24482 && glyph->charpos < 0;
23823 ++glyph) 24483 ++glyph)
23824 x += glyph->pixel_width; 24484 x += glyph->pixel_width;
23825 24485
23826 /* Scan the glyph row, stopping before BEFORE_STRING or 24486 /* Scan the glyph row, looking for BEFORE_STRING, AFTER_STRING,
23827 DISPLAY_STRING or START_CHARPOS. */ 24487 or DISPLAY_STRING, and the first glyph from buffer whose
24488 position is between START_CHARPOS and END_CHARPOS. */
23828 for (; glyph < end 24489 for (; glyph < end
23829 && !INTEGERP (glyph->object) 24490 && !INTEGERP (glyph->object)
23830 && !EQ (glyph->object, before_string)
23831 && !EQ (glyph->object, display_string) 24491 && !EQ (glyph->object, display_string)
23832 && !(BUFFERP (glyph->object) 24492 && !(BUFFERP (glyph->object)
23833 && glyph->charpos >= start_charpos); 24493 && (glyph->charpos >= start_charpos
24494 && glyph->charpos < end_charpos));
23834 ++glyph) 24495 ++glyph)
23835 x += glyph->pixel_width; 24496 {
23836 24497 /* BEFORE_STRING or AFTER_STRING are only relevant if they
23837 dpyinfo->mouse_face_beg_x = x; 24498 are present at buffer positions between START_CHARPOS and
23838 dpyinfo->mouse_face_beg_col = glyph - row->glyphs[TEXT_AREA]; 24499 END_CHARPOS, or if they come from an overlay. */
23839 } 24500 if (EQ (glyph->object, before_string))
23840 24501 {
23841 /* Find the last highlighted glyph. */ 24502 pos = string_buffer_position (w, before_string,
23842 row = row_containing_pos (w, end_charpos, first, NULL, 0); 24503 start_charpos);
23843 if (row == NULL) 24504 /* If pos == 0, it means before_string came from an
23844 { 24505 overlay, not from a buffer position. */
23845 row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); 24506 if (!pos || (pos >= start_charpos && pos < end_charpos))
23846 dpyinfo->mouse_face_past_end = 1; 24507 break;
24508 }
24509 else if (EQ (glyph->object, after_string))
24510 {
24511 pos = string_buffer_position (w, after_string, end_charpos);
24512 if (!pos || (pos >= start_charpos && pos < end_charpos))
24513 break;
24514 }
24515 x += glyph->pixel_width;
24516 }
24517 hlinfo->mouse_face_beg_x = x;
24518 hlinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA];
23847 } 24519 }
23848 else if (!NILP (after_string)) 24520 else
23849 { 24521 {
23850 /* If the after-string has newlines, advance to its last row. */ 24522 /* This row is in a right to left paragraph. Scan it right to
23851 struct glyph_row *next; 24523 left. */
23852 struct glyph_row *last 24524 struct glyph *g;
23853 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
23854 24525
23855 for (next = row + 1; 24526 end = r1->glyphs[TEXT_AREA] - 1;
23856 next <= last 24527 glyph = end + r1->used[TEXT_AREA];
23857 && next->used[TEXT_AREA] > 0
23858 && EQ (next->glyphs[TEXT_AREA]->object, after_string);
23859 ++next)
23860 row = next;
23861 }
23862 24528
23863 glyph = row->glyphs[TEXT_AREA]; 24529 /* Skip truncation glyphs at the start of the glyph row. */
23864 end = glyph + row->used[TEXT_AREA]; 24530 if (r1->displays_text_p)
23865 x = row->x; 24531 for (; glyph > end
23866 dpyinfo->mouse_face_end_y = row->y; 24532 && INTEGERP (glyph->object)
23867 dpyinfo->mouse_face_end_row = MATRIX_ROW_VPOS (row, w->current_matrix); 24533 && glyph->charpos < 0;
24534 --glyph)
24535 ;
23868 24536
23869 /* Skip truncation glyphs at the start of the row. */ 24537 /* Scan the glyph row, looking for BEFORE_STRING, AFTER_STRING,
23870 if (row->displays_text_p) 24538 or DISPLAY_STRING, and the first glyph from buffer whose
23871 for (; glyph < end 24539 position is between START_CHARPOS and END_CHARPOS. */
23872 && INTEGERP (glyph->object) 24540 for (; glyph > end
23873 && glyph->charpos < 0; 24541 && !INTEGERP (glyph->object)
23874 ++glyph) 24542 && !EQ (glyph->object, display_string)
23875 x += glyph->pixel_width; 24543 && !(BUFFERP (glyph->object)
23876 24544 && (glyph->charpos >= start_charpos
23877 /* Scan the glyph row, stopping at END_CHARPOS or when we encounter 24545 && glyph->charpos < end_charpos));
23878 AFTER_STRING. */ 24546 --glyph)
23879 for (; glyph < end 24547 {
23880 && !INTEGERP (glyph->object) 24548 /* BEFORE_STRING or AFTER_STRING are only relevant if they
23881 && !EQ (glyph->object, after_string) 24549 are present at buffer positions between START_CHARPOS and
23882 && !(BUFFERP (glyph->object) && glyph->charpos >= end_charpos); 24550 END_CHARPOS, or if they come from an overlay. */
23883 ++glyph) 24551 if (EQ (glyph->object, before_string))
23884 x += glyph->pixel_width; 24552 {
24553 pos = string_buffer_position (w, before_string, start_charpos);
24554 /* If pos == 0, it means before_string came from an
24555 overlay, not from a buffer position. */
24556 if (!pos || (pos >= start_charpos && pos < end_charpos))
24557 break;
24558 }
24559 else if (EQ (glyph->object, after_string))
24560 {
24561 pos = string_buffer_position (w, after_string, end_charpos);
24562 if (!pos || (pos >= start_charpos && pos < end_charpos))
24563 break;
24564 }
24565 }
24566
24567 glyph++; /* first glyph to the right of the highlighted area */
24568 for (g = r1->glyphs[TEXT_AREA], x = r1->x; g < glyph; g++)
24569 x += g->pixel_width;
24570 hlinfo->mouse_face_beg_x = x;
24571 hlinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA];
24572 }
23885 24573
23886 /* If we found AFTER_STRING, consume it and stop. */ 24574 /* If the highlight ends in a different row, compute GLYPH and END
23887 if (EQ (glyph->object, after_string)) 24575 for the end row. Otherwise, reuse the values computed above for
24576 the row where the highlight begins. */
24577 if (r2 != r1)
23888 { 24578 {
23889 for (; EQ (glyph->object, after_string) && glyph < end; ++glyph) 24579 if (!r2->reversed_p)
24580 {
24581 glyph = r2->glyphs[TEXT_AREA];
24582 end = glyph + r2->used[TEXT_AREA];
24583 x = r2->x;
24584 }
24585 else
24586 {
24587 end = r2->glyphs[TEXT_AREA] - 1;
24588 glyph = end + r2->used[TEXT_AREA];
24589 }
24590 }
24591
24592 if (!r2->reversed_p)
24593 {
24594 /* Skip truncation and continuation glyphs near the end of the
24595 row, and also blanks and stretch glyphs inserted by
24596 extend_face_to_end_of_line. */
24597 while (end > glyph
24598 && INTEGERP ((end - 1)->object)
24599 && (end - 1)->charpos <= 0)
24600 --end;
24601 /* Scan the rest of the glyph row from the end, looking for the
24602 first glyph that comes from BEFORE_STRING, AFTER_STRING, or
24603 DISPLAY_STRING, or whose position is between START_CHARPOS
24604 and END_CHARPOS */
24605 for (--end;
24606 end > glyph
24607 && !INTEGERP (end->object)
24608 && !EQ (end->object, display_string)
24609 && !(BUFFERP (end->object)
24610 && (end->charpos >= start_charpos
24611 && end->charpos < end_charpos));
24612 --end)
24613 {
24614 /* BEFORE_STRING or AFTER_STRING are only relevant if they
24615 are present at buffer positions between START_CHARPOS and
24616 END_CHARPOS, or if they come from an overlay. */
24617 if (EQ (end->object, before_string))
24618 {
24619 pos = string_buffer_position (w, before_string, start_charpos);
24620 if (!pos || (pos >= start_charpos && pos < end_charpos))
24621 break;
24622 }
24623 else if (EQ (end->object, after_string))
24624 {
24625 pos = string_buffer_position (w, after_string, end_charpos);
24626 if (!pos || (pos >= start_charpos && pos < end_charpos))
24627 break;
24628 }
24629 }
24630 /* Find the X coordinate of the last glyph to be highlighted. */
24631 for (; glyph <= end; ++glyph)
23890 x += glyph->pixel_width; 24632 x += glyph->pixel_width;
24633
24634 hlinfo->mouse_face_end_x = x;
24635 hlinfo->mouse_face_end_col = glyph - r2->glyphs[TEXT_AREA];
23891 } 24636 }
23892 else 24637 else
23893 { 24638 {
23894 /* If there's no after-string, we must check if we overshot, 24639 /* Skip truncation and continuation glyphs near the end of the
23895 which might be the case if we stopped after a string glyph. 24640 row, and also blanks and stretch glyphs inserted by
23896 That glyph may belong to a before-string or display-string 24641 extend_face_to_end_of_line. */
23897 associated with the end position, which must not be 24642 x = r2->x;
23898 highlighted. */ 24643 end++;
23899 Lisp_Object prev_object; 24644 while (end < glyph
23900 EMACS_INT pos; 24645 && INTEGERP (end->object)
23901 24646 && end->charpos <= 0)
23902 while (glyph > row->glyphs[TEXT_AREA]) 24647 {
23903 { 24648 x += end->pixel_width;
23904 prev_object = (glyph - 1)->object; 24649 ++end;
23905 if (!STRINGP (prev_object) || EQ (prev_object, display_string)) 24650 }
23906 break; 24651 /* Scan the rest of the glyph row from the end, looking for the
23907 24652 first glyph that comes from BEFORE_STRING, AFTER_STRING, or
23908 pos = string_buffer_position (w, prev_object, end_charpos); 24653 DISPLAY_STRING, or whose position is between START_CHARPOS
23909 if (pos && pos < end_charpos) 24654 and END_CHARPOS */
23910 break; 24655 for ( ;
23911 24656 end < glyph
23912 for (; glyph > row->glyphs[TEXT_AREA] 24657 && !INTEGERP (end->object)
23913 && EQ ((glyph - 1)->object, prev_object); 24658 && !EQ (end->object, display_string)
23914 --glyph) 24659 && !(BUFFERP (end->object)
23915 x -= (glyph - 1)->pixel_width; 24660 && (end->charpos >= start_charpos
24661 && end->charpos < end_charpos));
24662 ++end)
24663 {
24664 /* BEFORE_STRING or AFTER_STRING are only relevant if they
24665 are present at buffer positions between START_CHARPOS and
24666 END_CHARPOS, or if they come from an overlay. */
24667 if (EQ (end->object, before_string))
24668 {
24669 pos = string_buffer_position (w, before_string, start_charpos);
24670 if (!pos || (pos >= start_charpos && pos < end_charpos))
24671 break;
24672 }
24673 else if (EQ (end->object, after_string))
24674 {
24675 pos = string_buffer_position (w, after_string, end_charpos);
24676 if (!pos || (pos >= start_charpos && pos < end_charpos))
24677 break;
24678 }
24679 x += end->pixel_width;
23916 } 24680 }
24681 hlinfo->mouse_face_end_x = x;
24682 hlinfo->mouse_face_end_col = end - r2->glyphs[TEXT_AREA];
23917 } 24683 }
23918 24684
23919 dpyinfo->mouse_face_end_x = x; 24685 hlinfo->mouse_face_window = window;
23920 dpyinfo->mouse_face_end_col = glyph - row->glyphs[TEXT_AREA]; 24686 hlinfo->mouse_face_face_id
23921 dpyinfo->mouse_face_window = window;
23922 dpyinfo->mouse_face_face_id
23923 = face_at_buffer_position (w, mouse_charpos, 0, 0, &ignore, 24687 = face_at_buffer_position (w, mouse_charpos, 0, 0, &ignore,
23924 mouse_charpos + 1, 24688 mouse_charpos + 1,
23925 !dpyinfo->mouse_face_hidden, -1); 24689 !hlinfo->mouse_face_hidden, -1);
23926 show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); 24690 show_mouse_face (hlinfo, DRAW_MOUSE_FACE);
23927} 24691}
23928 24692
24693/* The following function is not used anymore (replaced with
24694 mouse_face_from_string_pos), but I leave it here for the time
24695 being, in case someone would. */
24696
24697#if 0 /* not used */
23929 24698
23930/* Find the position of the glyph for position POS in OBJECT in 24699/* Find the position of the glyph for position POS in OBJECT in
23931 window W's current matrix, and return in *X, *Y the pixel 24700 window W's current matrix, and return in *X, *Y the pixel
@@ -24003,7 +24772,132 @@ fast_find_string_pos (struct window *w, EMACS_INT pos, Lisp_Object object,
24003 24772
24004 return best_glyph != NULL; 24773 return best_glyph != NULL;
24005} 24774}
24775#endif /* not used */
24006 24776
24777/* Find the positions of the first and the last glyphs in window W's
24778 current matrix that occlude positions [STARTPOS..ENDPOS] in OBJECT
24779 (assumed to be a string), and return in HLINFO's mouse_face_*
24780 members the pixel and column/row coordinates of those glyphs. */
24781
24782static void
24783mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo,
24784 Lisp_Object object,
24785 EMACS_INT startpos, EMACS_INT endpos)
24786{
24787 int yb = window_text_bottom_y (w);
24788 struct glyph_row *r;
24789 struct glyph *g, *e;
24790 int gx;
24791 int found = 0;
24792
24793 /* Find the glyph row with at least one position in the range
24794 [STARTPOS..ENDPOS], and the first glyph in that row whose
24795 position belongs to that range. */
24796 for (r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
24797 r->enabled_p && r->y < yb;
24798 ++r)
24799 {
24800 if (!r->reversed_p)
24801 {
24802 g = r->glyphs[TEXT_AREA];
24803 e = g + r->used[TEXT_AREA];
24804 for (gx = r->x; g < e; gx += g->pixel_width, ++g)
24805 if (EQ (g->object, object)
24806 && startpos <= g->charpos && g->charpos <= endpos)
24807 {
24808 hlinfo->mouse_face_beg_row = r - w->current_matrix->rows;
24809 hlinfo->mouse_face_beg_y = r->y;
24810 hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA];
24811 hlinfo->mouse_face_beg_x = gx;
24812 found = 1;
24813 break;
24814 }
24815 }
24816 else
24817 {
24818 struct glyph *g1;
24819
24820 e = r->glyphs[TEXT_AREA];
24821 g = e + r->used[TEXT_AREA];
24822 for ( ; g > e; --g)
24823 if (EQ ((g-1)->object, object)
24824 && startpos <= (g-1)->charpos && (g-1)->charpos <= endpos)
24825 {
24826 hlinfo->mouse_face_beg_row = r - w->current_matrix->rows;
24827 hlinfo->mouse_face_beg_y = r->y;
24828 hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA];
24829 for (gx = r->x, g1 = r->glyphs[TEXT_AREA]; g1 < g; ++g1)
24830 gx += g1->pixel_width;
24831 hlinfo->mouse_face_beg_x = gx;
24832 found = 1;
24833 break;
24834 }
24835 }
24836 if (found)
24837 break;
24838 }
24839
24840 if (!found)
24841 return;
24842
24843 /* Starting with the next row, look for the first row which does NOT
24844 include any glyphs whose positions are in the range. */
24845 for (++r; r->enabled_p && r->y < yb; ++r)
24846 {
24847 g = r->glyphs[TEXT_AREA];
24848 e = g + r->used[TEXT_AREA];
24849 found = 0;
24850 for ( ; g < e; ++g)
24851 if (EQ (g->object, object)
24852 && startpos <= g->charpos && g->charpos <= endpos)
24853 {
24854 found = 1;
24855 break;
24856 }
24857 if (!found)
24858 break;
24859 }
24860
24861 /* The highlighted region ends on the previous row. */
24862 r--;
24863
24864 /* Set the end row and its vertical pixel coordinate. */
24865 hlinfo->mouse_face_end_row = r - w->current_matrix->rows;
24866 hlinfo->mouse_face_end_y = r->y;
24867
24868 /* Compute and set the end column and the end column's horizontal
24869 pixel coordinate. */
24870 if (!r->reversed_p)
24871 {
24872 g = r->glyphs[TEXT_AREA];
24873 e = g + r->used[TEXT_AREA];
24874 for ( ; e > g; --e)
24875 if (EQ ((e-1)->object, object)
24876 && startpos <= (e-1)->charpos && (e-1)->charpos <= endpos)
24877 break;
24878 hlinfo->mouse_face_end_col = e - g;
24879
24880 for (gx = r->x; g < e; ++g)
24881 gx += g->pixel_width;
24882 hlinfo->mouse_face_end_x = gx;
24883 }
24884 else
24885 {
24886 e = r->glyphs[TEXT_AREA];
24887 g = e + r->used[TEXT_AREA];
24888 for (gx = r->x ; e < g; ++e)
24889 {
24890 if (EQ (e->object, object)
24891 && startpos <= e->charpos && e->charpos <= endpos)
24892 break;
24893 gx += e->pixel_width;
24894 }
24895 hlinfo->mouse_face_end_col = e - r->glyphs[TEXT_AREA];
24896 hlinfo->mouse_face_end_x = gx;
24897 }
24898}
24899
24900#ifdef HAVE_WINDOW_SYSTEM
24007 24901
24008/* See if position X, Y is within a hot-spot of an image. */ 24902/* See if position X, Y is within a hot-spot of an image. */
24009 24903
@@ -24175,6 +25069,8 @@ define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer)
24175 FRAME_RIF (f)->define_frame_cursor (f, cursor); 25069 FRAME_RIF (f)->define_frame_cursor (f, cursor);
24176} 25070}
24177 25071
25072#endif /* HAVE_WINDOW_SYSTEM */
25073
24178/* Take proper action when mouse has moved to the mode or header line 25074/* Take proper action when mouse has moved to the mode or header line
24179 or marginal area AREA of window W, x-position X and y-position Y. 25075 or marginal area AREA of window W, x-position X and y-position Y.
24180 X is relative to the start of the text display area of W, so the 25076 X is relative to the start of the text display area of W, so the
@@ -24187,8 +25083,11 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24187{ 25083{
24188 struct window *w = XWINDOW (window); 25084 struct window *w = XWINDOW (window);
24189 struct frame *f = XFRAME (w->frame); 25085 struct frame *f = XFRAME (w->frame);
24190 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 25086 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
24191 Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor; 25087#ifdef HAVE_WINDOW_SYSTEM
25088 Display_Info *dpyinfo;
25089#endif
25090 Cursor cursor = No_Cursor;
24192 Lisp_Object pointer = Qnil; 25091 Lisp_Object pointer = Qnil;
24193 int dx, dy, width, height; 25092 int dx, dy, width, height;
24194 EMACS_INT charpos; 25093 EMACS_INT charpos;
@@ -24205,6 +25104,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24205 int x0; 25104 int x0;
24206 struct glyph *end; 25105 struct glyph *end;
24207 25106
25107 /* Kludge alert: mode_line_string takes X/Y in pixels, but
25108 returns them in row/column units! */
24208 string = mode_line_string (w, area, &x, &y, &charpos, 25109 string = mode_line_string (w, area, &x, &y, &charpos,
24209 &object, &dx, &dy, &width, &height); 25110 &object, &dx, &dy, &width, &height);
24210 25111
@@ -24212,7 +25113,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24212 ? MATRIX_MODE_LINE_ROW (w->current_matrix) 25113 ? MATRIX_MODE_LINE_ROW (w->current_matrix)
24213 : MATRIX_HEADER_LINE_ROW (w->current_matrix)); 25114 : MATRIX_HEADER_LINE_ROW (w->current_matrix));
24214 25115
24215 /* Find glyph */ 25116 /* Find the glyph under the mouse pointer. */
24216 if (row->mode_line_p && row->enabled_p) 25117 if (row->mode_line_p && row->enabled_p)
24217 { 25118 {
24218 glyph = row_start_glyph = row->glyphs[TEXT_AREA]; 25119 glyph = row_start_glyph = row->glyphs[TEXT_AREA];
@@ -24230,12 +25131,15 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24230 else 25131 else
24231 { 25132 {
24232 x -= WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w); 25133 x -= WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w);
25134 /* Kludge alert: marginal_area_string takes X/Y in pixels, but
25135 returns them in row/column units! */
24233 string = marginal_area_string (w, area, &x, &y, &charpos, 25136 string = marginal_area_string (w, area, &x, &y, &charpos,
24234 &object, &dx, &dy, &width, &height); 25137 &object, &dx, &dy, &width, &height);
24235 } 25138 }
24236 25139
24237 help = Qnil; 25140 help = Qnil;
24238 25141
25142#ifdef HAVE_WINDOW_SYSTEM
24239 if (IMAGEP (object)) 25143 if (IMAGEP (object))
24240 { 25144 {
24241 Lisp_Object image_map, hotspot; 25145 Lisp_Object image_map, hotspot;
@@ -24272,6 +25176,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24272 if (NILP (pointer)) 25176 if (NILP (pointer))
24273 pointer = Fplist_get (XCDR (object), QCpointer); 25177 pointer = Fplist_get (XCDR (object), QCpointer);
24274 } 25178 }
25179#endif /* HAVE_WINDOW_SYSTEM */
24275 25180
24276 if (STRINGP (string)) 25181 if (STRINGP (string))
24277 { 25182 {
@@ -24291,19 +25196,27 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24291 } 25196 }
24292 } 25197 }
24293 25198
24294 if (NILP (pointer)) 25199#ifdef HAVE_WINDOW_SYSTEM
24295 pointer = Fget_text_property (pos, Qpointer, string); 25200 if (FRAME_WINDOW_P (f))
24296
24297 /* Change the mouse pointer according to what is under X/Y. */
24298 if (NILP (pointer) && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)))
24299 { 25201 {
24300 Lisp_Object map; 25202 dpyinfo = FRAME_X_DISPLAY_INFO (f);
24301 map = Fget_text_property (pos, Qlocal_map, string); 25203 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
24302 if (!KEYMAPP (map)) 25204 if (NILP (pointer))
24303 map = Fget_text_property (pos, Qkeymap, string); 25205 pointer = Fget_text_property (pos, Qpointer, string);
24304 if (!KEYMAPP (map)) 25206
24305 cursor = dpyinfo->vertical_scroll_bar_cursor; 25207 /* Change the mouse pointer according to what is under X/Y. */
25208 if (NILP (pointer)
25209 && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)))
25210 {
25211 Lisp_Object map;
25212 map = Fget_text_property (pos, Qlocal_map, string);
25213 if (!KEYMAPP (map))
25214 map = Fget_text_property (pos, Qkeymap, string);
25215 if (!KEYMAPP (map))
25216 cursor = dpyinfo->vertical_scroll_bar_cursor;
25217 }
24306 } 25218 }
25219#endif
24307 25220
24308 /* Change the mouse face according to what is under X/Y. */ 25221 /* Change the mouse face according to what is under X/Y. */
24309 mouse_face = Fget_text_property (pos, Qmouse_face, string); 25222 mouse_face = Fget_text_property (pos, Qmouse_face, string);
@@ -24318,102 +25231,128 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24318 int gpos; 25231 int gpos;
24319 int gseq_length; 25232 int gseq_length;
24320 int total_pixel_width; 25233 int total_pixel_width;
24321 EMACS_INT ignore; 25234 EMACS_INT begpos, endpos, ignore;
24322 25235
24323 int vpos, hpos; 25236 int vpos, hpos;
24324 25237
24325 b = Fprevious_single_property_change (make_number (charpos + 1), 25238 b = Fprevious_single_property_change (make_number (charpos + 1),
24326 Qmouse_face, string, Qnil); 25239 Qmouse_face, string, Qnil);
24327 if (NILP (b)) 25240 if (NILP (b))
24328 b = make_number (0); 25241 begpos = 0;
25242 else
25243 begpos = XINT (b);
24329 25244
24330 e = Fnext_single_property_change (pos, Qmouse_face, string, Qnil); 25245 e = Fnext_single_property_change (pos, Qmouse_face, string, Qnil);
24331 if (NILP (e)) 25246 if (NILP (e))
24332 e = make_number (SCHARS (string)); 25247 endpos = SCHARS (string);
24333 25248 else
24334 /* Calculate the position(glyph position: GPOS) of GLYPH in 25249 endpos = XINT (e);
24335 displayed string. GPOS is different from CHARPOS. 25250
24336 25251 /* Calculate the glyph position GPOS of GLYPH in the
24337 CHARPOS is the position of glyph in internal string 25252 displayed string, relative to the beginning of the
24338 object. A mode line string format has structures which 25253 highlighted part of the string.
24339 is converted to a flatten by emacs lisp interpreter. 25254
24340 The internal string is an element of the structures. 25255 Note: GPOS is different from CHARPOS. CHARPOS is the
24341 The displayed string is the flatten string. */ 25256 position of GLYPH in the internal string object. A mode
24342 gpos = 0; 25257 line string format has structures which are converted to
24343 if (glyph > row_start_glyph) 25258 a flattened string by the Emacs Lisp interpreter. The
24344 { 25259 internal string is an element of those structures. The
24345 tmp_glyph = glyph - 1; 25260 displayed string is the flattened string. */
24346 while (tmp_glyph >= row_start_glyph 25261 tmp_glyph = row_start_glyph;
24347 && tmp_glyph->charpos >= XINT (b) 25262 while (tmp_glyph < glyph
24348 && EQ (tmp_glyph->object, glyph->object)) 25263 && (!(EQ (tmp_glyph->object, glyph->object)
24349 { 25264 && begpos <= tmp_glyph->charpos
24350 tmp_glyph--; 25265 && tmp_glyph->charpos < endpos)))
24351 gpos++; 25266 tmp_glyph++;
24352 } 25267 gpos = glyph - tmp_glyph;
24353 } 25268
24354 25269 /* Calculate the length GSEQ_LENGTH of the glyph sequence of
24355 /* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of 25270 the highlighted part of the displayed string to which
24356 displayed string holding GLYPH. 25271 GLYPH belongs. Note: GSEQ_LENGTH is different from
24357 25272 SCHARS (STRING), because the latter returns the length of
24358 GSEQ_LENGTH is different from SCHARS (STRING). 25273 the internal string. */
24359 SCHARS (STRING) returns the length of the internal string. */ 25274 for (tmp_glyph = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1;
24360 for (tmp_glyph = glyph, gseq_length = gpos; 25275 tmp_glyph > glyph
24361 tmp_glyph->charpos < XINT (e); 25276 && (!(EQ (tmp_glyph->object, glyph->object)
24362 tmp_glyph++, gseq_length++) 25277 && begpos <= tmp_glyph->charpos
24363 { 25278 && tmp_glyph->charpos < endpos));
24364 if (!EQ (tmp_glyph->object, glyph->object)) 25279 tmp_glyph--)
24365 break; 25280 ;
24366 } 25281 gseq_length = gpos + (tmp_glyph - glyph) + 1;
24367 25282
25283 /* Calculate the total pixel width of all the glyphs between
25284 the beginning of the highlighted area and GLYPH. */
24368 total_pixel_width = 0; 25285 total_pixel_width = 0;
24369 for (tmp_glyph = glyph - gpos; tmp_glyph != glyph; tmp_glyph++) 25286 for (tmp_glyph = glyph - gpos; tmp_glyph != glyph; tmp_glyph++)
24370 total_pixel_width += tmp_glyph->pixel_width; 25287 total_pixel_width += tmp_glyph->pixel_width;
24371 25288
24372 /* Pre calculation of re-rendering position */ 25289 /* Pre calculation of re-rendering position. Note: X is in
24373 vpos = (x - gpos); 25290 column units here, after the call to mode_line_string or
24374 hpos = (area == ON_MODE_LINE 25291 marginal_area_string. */
25292 hpos = x - gpos;
25293 vpos = (area == ON_MODE_LINE
24375 ? (w->current_matrix)->nrows - 1 25294 ? (w->current_matrix)->nrows - 1
24376 : 0); 25295 : 0);
24377 25296
24378 /* If the re-rendering position is included in the last 25297 /* If GLYPH's position is included in the region that is
24379 re-rendering area, we should do nothing. */ 25298 already drawn in mouse face, we have nothing to do. */
24380 if ( EQ (window, dpyinfo->mouse_face_window) 25299 if ( EQ (window, hlinfo->mouse_face_window)
24381 && dpyinfo->mouse_face_beg_col <= vpos 25300 && (!row->reversed_p
24382 && vpos < dpyinfo->mouse_face_end_col 25301 ? (hlinfo->mouse_face_beg_col <= hpos
24383 && dpyinfo->mouse_face_beg_row == hpos ) 25302 && hpos < hlinfo->mouse_face_end_col)
25303 /* In R2L rows we swap BEG and END, see below. */
25304 : (hlinfo->mouse_face_end_col <= hpos
25305 && hpos < hlinfo->mouse_face_beg_col))
25306 && hlinfo->mouse_face_beg_row == vpos )
24384 return; 25307 return;
24385 25308
24386 if (clear_mouse_face (dpyinfo)) 25309 if (clear_mouse_face (hlinfo))
24387 cursor = No_Cursor; 25310 cursor = No_Cursor;
24388 25311
24389 dpyinfo->mouse_face_beg_col = vpos; 25312 if (!row->reversed_p)
24390 dpyinfo->mouse_face_beg_row = hpos; 25313 {
24391 25314 hlinfo->mouse_face_beg_col = hpos;
24392 dpyinfo->mouse_face_beg_x = original_x_pixel - (total_pixel_width + dx); 25315 hlinfo->mouse_face_beg_x = original_x_pixel
24393 dpyinfo->mouse_face_beg_y = 0; 25316 - (total_pixel_width + dx);
24394 25317 hlinfo->mouse_face_end_col = hpos + gseq_length;
24395 dpyinfo->mouse_face_end_col = vpos + gseq_length; 25318 hlinfo->mouse_face_end_x = 0;
24396 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row; 25319 }
24397 25320 else
24398 dpyinfo->mouse_face_end_x = 0; 25321 {
24399 dpyinfo->mouse_face_end_y = 0; 25322 /* In R2L rows, show_mouse_face expects BEG and END
24400 25323 coordinates to be swapped. */
24401 dpyinfo->mouse_face_past_end = 0; 25324 hlinfo->mouse_face_end_col = hpos;
24402 dpyinfo->mouse_face_window = window; 25325 hlinfo->mouse_face_end_x = original_x_pixel
25326 - (total_pixel_width + dx);
25327 hlinfo->mouse_face_beg_col = hpos + gseq_length;
25328 hlinfo->mouse_face_beg_x = 0;
25329 }
24403 25330
24404 dpyinfo->mouse_face_face_id = face_at_string_position (w, string, 25331 hlinfo->mouse_face_beg_row = vpos;
24405 charpos, 25332 hlinfo->mouse_face_end_row = hlinfo->mouse_face_beg_row;
24406 0, 0, 0, &ignore, 25333 hlinfo->mouse_face_beg_y = 0;
24407 glyph->face_id, 1); 25334 hlinfo->mouse_face_end_y = 0;
24408 show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); 25335 hlinfo->mouse_face_past_end = 0;
25336 hlinfo->mouse_face_window = window;
25337
25338 hlinfo->mouse_face_face_id = face_at_string_position (w, string,
25339 charpos,
25340 0, 0, 0,
25341 &ignore,
25342 glyph->face_id,
25343 1);
25344 show_mouse_face (hlinfo, DRAW_MOUSE_FACE);
24409 25345
24410 if (NILP (pointer)) 25346 if (NILP (pointer))
24411 pointer = Qhand; 25347 pointer = Qhand;
24412 } 25348 }
24413 else if ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) 25349 else if ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE))
24414 clear_mouse_face (dpyinfo); 25350 clear_mouse_face (hlinfo);
24415 } 25351 }
24416 define_frame_cursor1 (f, cursor, pointer); 25352#ifdef HAVE_WINDOW_SYSTEM
25353 if (FRAME_WINDOW_P (f))
25354 define_frame_cursor1 (f, cursor, pointer);
25355#endif
24417} 25356}
24418 25357
24419 25358
@@ -24426,7 +25365,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24426void 25365void
24427note_mouse_highlight (struct frame *f, int x, int y) 25366note_mouse_highlight (struct frame *f, int x, int y)
24428{ 25367{
24429 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 25368 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
24430 enum window_part part; 25369 enum window_part part;
24431 Lisp_Object window; 25370 Lisp_Object window;
24432 struct window *w; 25371 struct window *w;
@@ -24435,7 +25374,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24435 struct buffer *b; 25374 struct buffer *b;
24436 25375
24437 /* When a menu is active, don't highlight because this looks odd. */ 25376 /* When a menu is active, don't highlight because this looks odd. */
24438#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) 25377#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) || defined (MSDOS)
24439 if (popup_activated ()) 25378 if (popup_activated ())
24440 return; 25379 return;
24441#endif 25380#endif
@@ -24445,28 +25384,28 @@ note_mouse_highlight (struct frame *f, int x, int y)
24445 || f->pointer_invisible) 25384 || f->pointer_invisible)
24446 return; 25385 return;
24447 25386
24448 dpyinfo->mouse_face_mouse_x = x; 25387 hlinfo->mouse_face_mouse_x = x;
24449 dpyinfo->mouse_face_mouse_y = y; 25388 hlinfo->mouse_face_mouse_y = y;
24450 dpyinfo->mouse_face_mouse_frame = f; 25389 hlinfo->mouse_face_mouse_frame = f;
24451 25390
24452 if (dpyinfo->mouse_face_defer) 25391 if (hlinfo->mouse_face_defer)
24453 return; 25392 return;
24454 25393
24455 if (gc_in_progress) 25394 if (gc_in_progress)
24456 { 25395 {
24457 dpyinfo->mouse_face_deferred_gc = 1; 25396 hlinfo->mouse_face_deferred_gc = 1;
24458 return; 25397 return;
24459 } 25398 }
24460 25399
24461 /* Which window is that in? */ 25400 /* Which window is that in? */
24462 window = window_from_coordinates (f, x, y, &part, 0, 0, 1); 25401 window = window_from_coordinates (f, x, y, &part, 1);
24463 25402
24464 /* If we were displaying active text in another window, clear that. 25403 /* If we were displaying active text in another window, clear that.
24465 Also clear if we move out of text area in same window. */ 25404 Also clear if we move out of text area in same window. */
24466 if (! EQ (window, dpyinfo->mouse_face_window) 25405 if (! EQ (window, hlinfo->mouse_face_window)
24467 || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE 25406 || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE
24468 && !NILP (dpyinfo->mouse_face_window))) 25407 && !NILP (hlinfo->mouse_face_window)))
24469 clear_mouse_face (dpyinfo); 25408 clear_mouse_face (hlinfo);
24470 25409
24471 /* Not on a window -> return. */ 25410 /* Not on a window -> return. */
24472 if (!WINDOWP (window)) 25411 if (!WINDOWP (window))
@@ -24479,6 +25418,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24479 w = XWINDOW (window); 25418 w = XWINDOW (window);
24480 frame_to_window_pixel_xy (w, &x, &y); 25419 frame_to_window_pixel_xy (w, &x, &y);
24481 25420
25421#ifdef HAVE_WINDOW_SYSTEM
24482 /* Handle tool-bar window differently since it doesn't display a 25422 /* Handle tool-bar window differently since it doesn't display a
24483 buffer. */ 25423 buffer. */
24484 if (EQ (window, f->tool_bar_window)) 25424 if (EQ (window, f->tool_bar_window))
@@ -24486,6 +25426,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24486 note_tool_bar_highlight (f, x, y); 25426 note_tool_bar_highlight (f, x, y);
24487 return; 25427 return;
24488 } 25428 }
25429#endif
24489 25430
24490 /* Mouse is on the mode, header line or margin? */ 25431 /* Mouse is on the mode, header line or margin? */
24491 if (part == ON_MODE_LINE || part == ON_HEADER_LINE 25432 if (part == ON_MODE_LINE || part == ON_HEADER_LINE
@@ -24495,6 +25436,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24495 return; 25436 return;
24496 } 25437 }
24497 25438
25439#ifdef HAVE_WINDOW_SYSTEM
24498 if (part == ON_VERTICAL_BORDER) 25440 if (part == ON_VERTICAL_BORDER)
24499 { 25441 {
24500 cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor; 25442 cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor;
@@ -24505,6 +25447,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24505 cursor = FRAME_X_OUTPUT (f)->nontext_cursor; 25447 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
24506 else 25448 else
24507 cursor = FRAME_X_OUTPUT (f)->text_cursor; 25449 cursor = FRAME_X_OUTPUT (f)->text_cursor;
25450#endif
24508 25451
24509 /* Are we in a window whose display is up to date? 25452 /* Are we in a window whose display is up to date?
24510 And verify the buffer's text has not changed. */ 25453 And verify the buffer's text has not changed. */
@@ -24528,6 +25471,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24528 /* Find the glyph under X/Y. */ 25471 /* Find the glyph under X/Y. */
24529 glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &dx, &dy, &area); 25472 glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &dx, &dy, &area);
24530 25473
25474#ifdef HAVE_WINDOW_SYSTEM
24531 /* Look for :pointer property on image. */ 25475 /* Look for :pointer property on image. */
24532 if (glyph != NULL && glyph->type == IMAGE_GLYPH) 25476 if (glyph != NULL && glyph->type == IMAGE_GLYPH)
24533 { 25477 {
@@ -24569,21 +25513,38 @@ note_mouse_highlight (struct frame *f, int x, int y)
24569 pointer = Fplist_get (XCDR (img->spec), QCpointer); 25513 pointer = Fplist_get (XCDR (img->spec), QCpointer);
24570 } 25514 }
24571 } 25515 }
25516#endif /* HAVE_WINDOW_SYSTEM */
24572 25517
24573 /* Clear mouse face if X/Y not over text. */ 25518 /* Clear mouse face if X/Y not over text. */
24574 if (glyph == NULL 25519 if (glyph == NULL
24575 || area != TEXT_AREA 25520 || area != TEXT_AREA
24576 || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p) 25521 || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p
24577 { 25522 /* Glyph's OBJECT is an integer for glyphs inserted by the
24578 if (clear_mouse_face (dpyinfo)) 25523 display engine for its internal purposes, like truncation
25524 and continuation glyphs and blanks beyond the end of
25525 line's text on text terminals. If we are over such a
25526 glyph, we are not over any text. */
25527 || INTEGERP (glyph->object)
25528 /* R2L rows have a stretch glyph at their front, which
25529 stands for no text, whereas L2R rows have no glyphs at
25530 all beyond the end of text. Treat such stretch glyphs
25531 like we do with NULL glyphs in L2R rows. */
25532 || (MATRIX_ROW (w->current_matrix, vpos)->reversed_p
25533 && glyph == MATRIX_ROW (w->current_matrix, vpos)->glyphs[TEXT_AREA]
25534 && glyph->type == STRETCH_GLYPH
25535 && glyph->avoid_cursor_p))
25536 {
25537 if (clear_mouse_face (hlinfo))
24579 cursor = No_Cursor; 25538 cursor = No_Cursor;
24580 if (NILP (pointer)) 25539#ifdef HAVE_WINDOW_SYSTEM
25540 if (FRAME_WINDOW_P (f) && NILP (pointer))
24581 { 25541 {
24582 if (area != TEXT_AREA) 25542 if (area != TEXT_AREA)
24583 cursor = FRAME_X_OUTPUT (f)->nontext_cursor; 25543 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
24584 else 25544 else
24585 pointer = Vvoid_text_area_pointer; 25545 pointer = Vvoid_text_area_pointer;
24586 } 25546 }
25547#endif
24587 goto set_cursor; 25548 goto set_cursor;
24588 } 25549 }
24589 25550
@@ -24618,14 +25579,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24618 else 25579 else
24619 noverlays = 0; 25580 noverlays = 0;
24620 25581
24621 same_region = (EQ (window, dpyinfo->mouse_face_window) 25582 same_region = coords_in_mouse_face_p (w, hpos, vpos);
24622 && vpos >= dpyinfo->mouse_face_beg_row
24623 && vpos <= dpyinfo->mouse_face_end_row
24624 && (vpos > dpyinfo->mouse_face_beg_row
24625 || hpos >= dpyinfo->mouse_face_beg_col)
24626 && (vpos < dpyinfo->mouse_face_end_row
24627 || hpos < dpyinfo->mouse_face_end_col
24628 || dpyinfo->mouse_face_past_end));
24629 25583
24630 if (same_region) 25584 if (same_region)
24631 cursor = No_Cursor; 25585 cursor = No_Cursor;
@@ -24636,8 +25590,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
24636 the one we are currently highlighting, we have to 25590 the one we are currently highlighting, we have to
24637 check if we enter the overlapping overlay, and then 25591 check if we enter the overlapping overlay, and then
24638 highlight only that. */ 25592 highlight only that. */
24639 || (OVERLAYP (dpyinfo->mouse_face_overlay) 25593 || (OVERLAYP (hlinfo->mouse_face_overlay)
24640 && mouse_face_overlay_overlaps (dpyinfo->mouse_face_overlay))) 25594 && mouse_face_overlay_overlaps (hlinfo->mouse_face_overlay)))
24641 { 25595 {
24642 /* Find the highest priority overlay with a mouse-face. */ 25596 /* Find the highest priority overlay with a mouse-face. */
24643 overlay = Qnil; 25597 overlay = Qnil;
@@ -24650,12 +25604,12 @@ note_mouse_highlight (struct frame *f, int x, int y)
24650 25604
24651 /* If we're highlighting the same overlay as before, there's 25605 /* If we're highlighting the same overlay as before, there's
24652 no need to do that again. */ 25606 no need to do that again. */
24653 if (!NILP (overlay) && EQ (overlay, dpyinfo->mouse_face_overlay)) 25607 if (!NILP (overlay) && EQ (overlay, hlinfo->mouse_face_overlay))
24654 goto check_help_echo; 25608 goto check_help_echo;
24655 dpyinfo->mouse_face_overlay = overlay; 25609 hlinfo->mouse_face_overlay = overlay;
24656 25610
24657 /* Clear the display of the old active region, if any. */ 25611 /* Clear the display of the old active region, if any. */
24658 if (clear_mouse_face (dpyinfo)) 25612 if (clear_mouse_face (hlinfo))
24659 cursor = No_Cursor; 25613 cursor = No_Cursor;
24660 25614
24661 /* If no overlay applies, get a text property. */ 25615 /* If no overlay applies, get a text property. */
@@ -24679,23 +25633,14 @@ note_mouse_highlight (struct frame *f, int x, int y)
24679 b = make_number (0); 25633 b = make_number (0);
24680 if (NILP (e)) 25634 if (NILP (e))
24681 e = make_number (SCHARS (object) - 1); 25635 e = make_number (SCHARS (object) - 1);
24682 25636 mouse_face_from_string_pos (w, hlinfo, object,
24683 fast_find_string_pos (w, XINT (b), object, 25637 XINT (b), XINT (e));
24684 &dpyinfo->mouse_face_beg_col, 25638 hlinfo->mouse_face_past_end = 0;
24685 &dpyinfo->mouse_face_beg_row, 25639 hlinfo->mouse_face_window = window;
24686 &dpyinfo->mouse_face_beg_x, 25640 hlinfo->mouse_face_face_id
24687 &dpyinfo->mouse_face_beg_y, 0);
24688 fast_find_string_pos (w, XINT (e), object,
24689 &dpyinfo->mouse_face_end_col,
24690 &dpyinfo->mouse_face_end_row,
24691 &dpyinfo->mouse_face_end_x,
24692 &dpyinfo->mouse_face_end_y, 1);
24693 dpyinfo->mouse_face_past_end = 0;
24694 dpyinfo->mouse_face_window = window;
24695 dpyinfo->mouse_face_face_id
24696 = face_at_string_position (w, object, pos, 0, 0, 0, &ignore, 25641 = face_at_string_position (w, object, pos, 0, 0, 0, &ignore,
24697 glyph->face_id, 1); 25642 glyph->face_id, 1);
24698 show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); 25643 show_mouse_face (hlinfo, DRAW_MOUSE_FACE);
24699 cursor = No_Cursor; 25644 cursor = No_Cursor;
24700 } 25645 }
24701 else 25646 else
@@ -24729,17 +25674,33 @@ note_mouse_highlight (struct frame *f, int x, int y)
24729 { 25674 {
24730 Lisp_Object before, after; 25675 Lisp_Object before, after;
24731 Lisp_Object before_string, after_string; 25676 Lisp_Object before_string, after_string;
25677 /* To correctly find the limits of mouse highlight
25678 in a bidi-reordered buffer, we must not use the
25679 optimization of limiting the search in
25680 previous-single-property-change and
25681 next-single-property-change, because
25682 rows_from_pos_range needs the real start and end
25683 positions to DTRT in this case. That's because
25684 the first row visible in a window does not
25685 necessarily display the character whose position
25686 is the smallest. */
25687 Lisp_Object lim1 =
25688 NILP (XBUFFER (buffer)->bidi_display_reordering)
25689 ? Fmarker_position (w->start)
25690 : Qnil;
25691 Lisp_Object lim2 =
25692 NILP (XBUFFER (buffer)->bidi_display_reordering)
25693 ? make_number (BUF_Z (XBUFFER (buffer))
25694 - XFASTINT (w->window_end_pos))
25695 : Qnil;
24732 25696
24733 if (NILP (overlay)) 25697 if (NILP (overlay))
24734 { 25698 {
24735 /* Handle the text property case. */ 25699 /* Handle the text property case. */
24736 before = Fprevious_single_property_change 25700 before = Fprevious_single_property_change
24737 (make_number (pos + 1), Qmouse_face, buffer, 25701 (make_number (pos + 1), Qmouse_face, buffer, lim1);
24738 Fmarker_position (w->start));
24739 after = Fnext_single_property_change 25702 after = Fnext_single_property_change
24740 (make_number (pos), Qmouse_face, buffer, 25703 (make_number (pos), Qmouse_face, buffer, lim2);
24741 make_number (BUF_Z (XBUFFER (buffer))
24742 - XFASTINT (w->window_end_pos)));
24743 before_string = after_string = Qnil; 25704 before_string = after_string = Qnil;
24744 } 25705 }
24745 else 25706 else
@@ -24754,7 +25715,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24754 if (!STRINGP (after_string)) after_string = Qnil; 25715 if (!STRINGP (after_string)) after_string = Qnil;
24755 } 25716 }
24756 25717
24757 mouse_face_from_buffer_pos (window, dpyinfo, pos, 25718 mouse_face_from_buffer_pos (window, hlinfo, pos,
24758 XFASTINT (before), 25719 XFASTINT (before),
24759 XFASTINT (after), 25720 XFASTINT (after),
24760 before_string, after_string, 25721 before_string, after_string,
@@ -24833,8 +25794,9 @@ note_mouse_highlight (struct frame *f, int x, int y)
24833 } 25794 }
24834 } 25795 }
24835 25796
25797#ifdef HAVE_WINDOW_SYSTEM
24836 /* Look for a `pointer' property. */ 25798 /* Look for a `pointer' property. */
24837 if (NILP (pointer)) 25799 if (FRAME_WINDOW_P (f) && NILP (pointer))
24838 { 25800 {
24839 /* Check overlays first. */ 25801 /* Check overlays first. */
24840 for (i = noverlays - 1; i >= 0 && NILP (pointer); --i) 25802 for (i = noverlays - 1; i >= 0 && NILP (pointer); --i)
@@ -24873,6 +25835,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24873 Qpointer, object); 25835 Qpointer, object);
24874 } 25836 }
24875 } 25837 }
25838#endif /* HAVE_WINDOW_SYSTEM */
24876 25839
24877 BEGV = obegv; 25840 BEGV = obegv;
24878 ZV = ozv; 25841 ZV = ozv;
@@ -24881,7 +25844,14 @@ note_mouse_highlight (struct frame *f, int x, int y)
24881 25844
24882 set_cursor: 25845 set_cursor:
24883 25846
24884 define_frame_cursor1 (f, cursor, pointer); 25847#ifdef HAVE_WINDOW_SYSTEM
25848 if (FRAME_WINDOW_P (f))
25849 define_frame_cursor1 (f, cursor, pointer);
25850#else
25851 /* This is here to prevent a compiler error, about "label at end of
25852 compound statement". */
25853 return;
25854#endif
24885} 25855}
24886 25856
24887 25857
@@ -24893,13 +25863,13 @@ note_mouse_highlight (struct frame *f, int x, int y)
24893void 25863void
24894x_clear_window_mouse_face (struct window *w) 25864x_clear_window_mouse_face (struct window *w)
24895{ 25865{
24896 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); 25866 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
24897 Lisp_Object window; 25867 Lisp_Object window;
24898 25868
24899 BLOCK_INPUT; 25869 BLOCK_INPUT;
24900 XSETWINDOW (window, w); 25870 XSETWINDOW (window, w);
24901 if (EQ (window, dpyinfo->mouse_face_window)) 25871 if (EQ (window, hlinfo->mouse_face_window))
24902 clear_mouse_face (dpyinfo); 25872 clear_mouse_face (hlinfo);
24903 UNBLOCK_INPUT; 25873 UNBLOCK_INPUT;
24904} 25874}
24905 25875
@@ -24912,20 +25882,18 @@ void
24912cancel_mouse_face (struct frame *f) 25882cancel_mouse_face (struct frame *f)
24913{ 25883{
24914 Lisp_Object window; 25884 Lisp_Object window;
24915 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 25885 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
24916 25886
24917 window = dpyinfo->mouse_face_window; 25887 window = hlinfo->mouse_face_window;
24918 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) 25888 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f)
24919 { 25889 {
24920 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 25890 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
24921 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 25891 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
24922 dpyinfo->mouse_face_window = Qnil; 25892 hlinfo->mouse_face_window = Qnil;
24923 } 25893 }
24924} 25894}
24925 25895
24926 25896
24927#endif /* HAVE_WINDOW_SYSTEM */
24928
24929 25897
24930/*********************************************************************** 25898/***********************************************************************
24931 Exposure Events 25899 Exposure Events
@@ -25382,12 +26350,12 @@ expose_frame (struct frame *f, int x, int y, int w, int h)
25382 focus-follows-mouse with delayed raise. --jason 2001-10-12 */ 26350 focus-follows-mouse with delayed raise. --jason 2001-10-12 */
25383 if (mouse_face_overwritten_p && !FRAME_GARBAGED_P (f)) 26351 if (mouse_face_overwritten_p && !FRAME_GARBAGED_P (f))
25384 { 26352 {
25385 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 26353 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
25386 if (f == dpyinfo->mouse_face_mouse_frame) 26354 if (f == hlinfo->mouse_face_mouse_frame)
25387 { 26355 {
25388 int x = dpyinfo->mouse_face_mouse_x; 26356 int x = hlinfo->mouse_face_mouse_x;
25389 int y = dpyinfo->mouse_face_mouse_y; 26357 int y = hlinfo->mouse_face_mouse_y;
25390 clear_mouse_face (dpyinfo); 26358 clear_mouse_face (hlinfo);
25391 note_mouse_highlight (f, x, y); 26359 note_mouse_highlight (f, x, y);
25392 } 26360 }
25393 } 26361 }
@@ -25974,7 +26942,9 @@ the frame's other specifications determine how to blink the cursor off. */);
25974 Vblink_cursor_alist = Qnil; 26942 Vblink_cursor_alist = Qnil;
25975 26943
25976 DEFVAR_BOOL ("auto-hscroll-mode", &automatic_hscrolling_p, 26944 DEFVAR_BOOL ("auto-hscroll-mode", &automatic_hscrolling_p,
25977 doc: /* *Non-nil means scroll the display automatically to make point visible. */); 26945 doc: /* Allow or disallow automatic horizontal scrolling of windows.
26946If non-nil, windows are automatically scrolled horizontally to make
26947point visible. */);
25978 automatic_hscrolling_p = 1; 26948 automatic_hscrolling_p = 1;
25979 Qauto_hscroll_mode = intern_c_string ("auto-hscroll-mode"); 26949 Qauto_hscroll_mode = intern_c_string ("auto-hscroll-mode");
25980 staticpro (&Qauto_hscroll_mode); 26950 staticpro (&Qauto_hscroll_mode);
@@ -26089,16 +27059,46 @@ baseline. The default value is 1. */);
26089 underline_minimum_offset = 1; 27059 underline_minimum_offset = 1;
26090 27060
26091 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p, 27061 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p,
26092 doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */); 27062 doc: /* Non-nil means show an hourglass pointer, when Emacs is busy.
27063This feature only works when on a window system that can change
27064cursor shapes. */);
26093 display_hourglass_p = 1; 27065 display_hourglass_p = 1;
26094 27066
26095 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, 27067 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay,
26096 doc: /* *Seconds to wait before displaying an hourglass pointer. 27068 doc: /* *Seconds to wait before displaying an hourglass pointer when Emacs is busy. */);
26097Value must be an integer or float. */);
26098 Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY); 27069 Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY);
26099 27070
26100 hourglass_atimer = NULL; 27071 hourglass_atimer = NULL;
26101 hourglass_shown_p = 0; 27072 hourglass_shown_p = 0;
27073
27074 DEFSYM (Qglyphless_char, "glyphless-char");
27075 DEFSYM (Qhex_code, "hex-code");
27076 DEFSYM (Qempty_box, "empty-box");
27077 DEFSYM (Qthin_space, "thin-space");
27078 DEFSYM (Qzero_width, "zero-width");
27079
27080 DEFSYM (Qglyphless_char_display, "glyphless-char-display");
27081 /* Intern this now in case it isn't already done.
27082 Setting this variable twice is harmless.
27083 But don't staticpro it here--that is done in alloc.c. */
27084 Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots");
27085 Fput (Qglyphless_char_display, Qchar_table_extra_slots, make_number (1));
27086
27087 DEFVAR_LISP ("glyphless-char-display", &Vglyphless_char_display,
27088 doc: /* Char-table to control displaying of glyphless characters.
27089Each element, if non-nil, is an ASCII acronym string (displayed in a box)
27090or one of these symbols:
27091 hex-code: display the hexadecimal code of a character in a box
27092 empty-box: display as an empty box
27093 thin-space: display as 1-pixel width space
27094 zero-width: don't display
27095
27096It has one extra slot to control the display of a character for which
27097no font is found. The value of the slot is `hex-code' or `empty-box'.
27098The default is `empty-box'. */);
27099 Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil);
27100 Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0),
27101 Qempty_box);
26102} 27102}
26103 27103
26104 27104
@@ -26216,5 +27216,3 @@ cancel_hourglass (void)
26216} 27216}
26217#endif /* ! WINDOWSNT */ 27217#endif /* ! WINDOWSNT */
26218 27218
26219/* arch-tag: eacc864d-bb6a-4b74-894a-1a4399a1358b
26220 (do not change this comment) */
diff --git a/src/xfaces.c b/src/xfaces.c
index 21adb948c91..5c7cfe67607 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1,6 +1,8 @@
1/* xfaces.c -- "Face" primitives. 1/* xfaces.c -- "Face" primitives.
2 Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2
3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 2005, 2006, 2007, 2008, 2009, 2010
5 Free Software Foundation, Inc.
4 6
5This file is part of GNU Emacs. 7This file is part of GNU Emacs.
6 8
@@ -4538,7 +4540,7 @@ uncache_face (struct face_cache *c, struct face *face)
4538 Value is the ID of the face found. If no suitable face is found, 4540 Value is the ID of the face found. If no suitable face is found,
4539 realize a new one. */ 4541 realize a new one. */
4540 4542
4541INLINE int 4543static INLINE int
4542lookup_face (struct frame *f, Lisp_Object *attr) 4544lookup_face (struct frame *f, Lisp_Object *attr)
4543{ 4545{
4544 struct face_cache *cache = FRAME_FACE_CACHE (f); 4546 struct face_cache *cache = FRAME_FACE_CACHE (f);
@@ -6731,7 +6733,8 @@ See `set-face-stipple' for possible values for this variable. */);
6731 Vface_default_stipple = make_pure_c_string ("gray3"); 6733 Vface_default_stipple = make_pure_c_string ("gray3");
6732 6734
6733 DEFVAR_LISP ("tty-defined-color-alist", &Vtty_defined_color_alist, 6735 DEFVAR_LISP ("tty-defined-color-alist", &Vtty_defined_color_alist,
6734 doc: /* An alist of defined terminal colors and their RGB values. */); 6736 doc: /* An alist of defined terminal colors and their RGB values.
6737See the docstring of `tty-color-alist' for the details. */);
6735 Vtty_defined_color_alist = Qnil; 6738 Vtty_defined_color_alist = Qnil;
6736 6739
6737 DEFVAR_LISP ("scalable-fonts-allowed", &Vscalable_fonts_allowed, 6740 DEFVAR_LISP ("scalable-fonts-allowed", &Vscalable_fonts_allowed,
@@ -6808,5 +6811,3 @@ a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point. */);
6808#endif 6811#endif
6809} 6812}
6810 6813
6811/* arch-tag: 8a0f7598-5517-408d-9ab3-1da6fcd4c749
6812 (do not change this comment) */
diff --git a/src/xfns.c b/src/xfns.c
index cb6733e8fa1..32e390e1e1e 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1,7 +1,8 @@
1/* Functions for the X window system. 1/* Functions for the X window system.
2 Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2
3 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 3Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 Free Software Foundation, Inc. 4 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5 Free Software Foundation, Inc.
5 6
6This file is part of GNU Emacs. 7This file is part of GNU Emacs.
7 8
@@ -99,6 +100,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
99#include <Xm/Xm.h> 100#include <Xm/Xm.h>
100#include <Xm/DialogS.h> 101#include <Xm/DialogS.h>
101#include <Xm/FileSB.h> 102#include <Xm/FileSB.h>
103#include <Xm/List.h>
104#include <Xm/TextF.h>
102#endif 105#endif
103 106
104#ifdef USE_LUCID 107#ifdef USE_LUCID
@@ -516,12 +519,20 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
516 int real_x = 0, real_y = 0; 519 int real_x = 0, real_y = 0;
517 int had_errors = 0; 520 int had_errors = 0;
518 Window win = f->output_data.x->parent_desc; 521 Window win = f->output_data.x->parent_desc;
522 Atom actual_type;
523 unsigned long actual_size, bytes_remaining;
524 int i, rc, actual_format;
525 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
526 long max_len = 400;
527 Display *dpy = FRAME_X_DISPLAY (f);
528 unsigned char *tmp_data = NULL;
529 Atom target_type = XA_CARDINAL;
519 530
520 BLOCK_INPUT; 531 BLOCK_INPUT;
521 532
522 x_catch_errors (FRAME_X_DISPLAY (f)); 533 x_catch_errors (dpy);
523 534
524 if (win == FRAME_X_DISPLAY_INFO (f)->root_window) 535 if (win == dpyinfo->root_window)
525 win = FRAME_OUTER_WINDOW (f); 536 win = FRAME_OUTER_WINDOW (f);
526 537
527 /* This loop traverses up the containment tree until we hit the root 538 /* This loop traverses up the containment tree until we hit the root
@@ -606,6 +617,33 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
606 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); 617 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
607 } 618 }
608 619
620
621 if (dpyinfo->root_window == f->output_data.x->parent_desc)
622 {
623 /* Try _NET_FRAME_EXTENTS if our parent is the root window. */
624 rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_frame_extents,
625 0, max_len, False, target_type,
626 &actual_type, &actual_format, &actual_size,
627 &bytes_remaining, &tmp_data);
628
629 if (rc == Success && actual_type == target_type && !x_had_errors_p (dpy)
630 && actual_size == 4 && actual_format == 32)
631 {
632 int ign;
633 Window rootw;
634 long *fe = (long *)tmp_data;
635
636 XGetGeometry (FRAME_X_DISPLAY (f), win,
637 &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign);
638 outer_x = -fe[0];
639 outer_y = -fe[2];
640 real_x -= fe[0];
641 real_y -= fe[2];
642 }
643 }
644
645 if (tmp_data) XFree (tmp_data);
646
609 x_uncatch_errors (); 647 x_uncatch_errors ();
610 648
611 UNBLOCK_INPUT; 649 UNBLOCK_INPUT;
@@ -3075,25 +3113,11 @@ If FRAME is nil, use the selected frame. */)
3075static void 3113static void
3076set_machine_and_pid_properties (struct frame *f) 3114set_machine_and_pid_properties (struct frame *f)
3077{ 3115{
3078 /* See the above comment "Note: Encoding strategy". */
3079 XTextProperty text;
3080 int bytes, stringp;
3081 int do_free_text_value = 0;
3082 long pid = (long) getpid (); 3116 long pid = (long) getpid ();
3083 3117
3084 text.value = x_encode_text (Vsystem_name, 3118 /* This will set WM_CLIENT_MACHINE and WM_LOCALE_NAME. */
3085 Qcompound_text, 0, &bytes, &stringp, 3119 XSetWMProperties (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), NULL, NULL,
3086 &do_free_text_value); 3120 NULL, 0, NULL, NULL, NULL);
3087 text.encoding = (stringp ? XA_STRING
3088 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
3089 text.format = 8;
3090 text.nitems = bytes;
3091 XSetWMClientMachine (FRAME_X_DISPLAY (f),
3092 FRAME_OUTER_WINDOW (f),
3093 &text);
3094 if (do_free_text_value)
3095 xfree (text.value);
3096
3097 XChangeProperty (FRAME_X_DISPLAY (f), 3121 XChangeProperty (FRAME_X_DISPLAY (f),
3098 FRAME_OUTER_WINDOW (f), 3122 FRAME_OUTER_WINDOW (f),
3099 XInternAtom (FRAME_X_DISPLAY (f), 3123 XInternAtom (FRAME_X_DISPLAY (f),
@@ -3343,8 +3367,6 @@ This function is an internal primitive--use `make-frame' instead. */)
3343 "background", "Background", RES_TYPE_STRING); 3367 "background", "Background", RES_TYPE_STRING);
3344 x_default_parameter (f, parms, Qmouse_color, build_string ("black"), 3368 x_default_parameter (f, parms, Qmouse_color, build_string ("black"),
3345 "pointerColor", "Foreground", RES_TYPE_STRING); 3369 "pointerColor", "Foreground", RES_TYPE_STRING);
3346 x_default_parameter (f, parms, Qcursor_color, build_string ("black"),
3347 "cursorColor", "Foreground", RES_TYPE_STRING);
3348 x_default_parameter (f, parms, Qborder_color, build_string ("black"), 3370 x_default_parameter (f, parms, Qborder_color, build_string ("black"),
3349 "borderColor", "BorderColor", RES_TYPE_STRING); 3371 "borderColor", "BorderColor", RES_TYPE_STRING);
3350 x_default_parameter (f, parms, Qscreen_gamma, Qnil, 3372 x_default_parameter (f, parms, Qscreen_gamma, Qnil,
@@ -3578,7 +3600,8 @@ FRAME nil means use the selected frame. */)
3578 3600
3579 3601
3580DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, 3602DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
3581 doc: /* Internal function called by `color-defined-p', which see. */) 3603 doc: /* Internal function called by `color-defined-p', which see
3604.\(Note that the Nextstep version of this function ignores FRAME.) */)
3582 (Lisp_Object color, Lisp_Object frame) 3605 (Lisp_Object color, Lisp_Object frame)
3583{ 3606{
3584 XColor foo; 3607 XColor foo;
@@ -4096,11 +4119,12 @@ x_display_info_for_name (Lisp_Object name)
4096 4119
4097DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, 4120DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
4098 1, 3, 0, 4121 1, 3, 0,
4099 doc: /* Open a connection to an X server. 4122 doc: /* Open a connection to a display server.
4100DISPLAY is the name of the display to connect to. 4123DISPLAY is the name of the display to connect to.
4101Optional second arg XRM-STRING is a string of resources in xrdb format. 4124Optional second arg XRM-STRING is a string of resources in xrdb format.
4102If the optional third arg MUST-SUCCEED is non-nil, 4125If the optional third arg MUST-SUCCEED is non-nil,
4103terminate Emacs if we can't open the connection. */) 4126terminate Emacs if we can't open the connection.
4127\(In the Nextstep version, the last two arguments are currently ignored.) */)
4104 (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed) 4128 (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed)
4105{ 4129{
4106 unsigned char *xrm_option; 4130 unsigned char *xrm_option;
@@ -4179,6 +4203,9 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
4179 4203
4180DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, 4204DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
4181 doc: /* If ON is non-nil, report X errors as soon as the erring request is made. 4205 doc: /* If ON is non-nil, report X errors as soon as the erring request is made.
4206This function only has an effect on X Windows. With MS Windows, it is
4207defined but does nothing.
4208
4182If ON is nil, allow buffering of requests. 4209If ON is nil, allow buffering of requests.
4183Turning on synchronization prohibits the Xlib routines from buffering 4210Turning on synchronization prohibits the Xlib routines from buffering
4184requests and seriously degrades performance, but makes debugging much 4211requests and seriously degrades performance, but makes debugging much
@@ -4213,12 +4240,12 @@ x_sync (FRAME_PTR f)
4213DEFUN ("x-change-window-property", Fx_change_window_property, 4240DEFUN ("x-change-window-property", Fx_change_window_property,
4214 Sx_change_window_property, 2, 6, 0, 4241 Sx_change_window_property, 2, 6, 0,
4215 doc: /* Change window property PROP to VALUE on the X window of FRAME. 4242 doc: /* Change window property PROP to VALUE on the X window of FRAME.
4216PROP must be a string. 4243PROP must be a string. VALUE may be a string or a list of conses,
4217VALUE may be a string or a list of conses, numbers and/or strings. 4244numbers and/or strings. If an element in the list is a string, it is
4218If an element in the list is a string, it is converted to 4245converted to an atom and the value of the atom is used. If an element
4219an Atom and the value of the Atom is used. If an element is a cons, 4246is a cons, it is converted to a 32 bit number where the car is the 16
4220it is converted to a 32 bit number where the car is the 16 top bits and the 4247top bits and the cdr is the lower 16 bits.
4221cdr is the lower 16 bits. 4248
4222FRAME nil or omitted means use the selected frame. 4249FRAME nil or omitted means use the selected frame.
4223If TYPE is given and non-nil, it is the name of the type of VALUE. 4250If TYPE is given and non-nil, it is the name of the type of VALUE.
4224If TYPE is not given or nil, the type is STRING. 4251If TYPE is not given or nil, the type is STRING.
@@ -4226,9 +4253,7 @@ FORMAT gives the size in bits of each element if VALUE is a list.
4226It must be one of 8, 16 or 32. 4253It must be one of 8, 16 or 32.
4227If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8. 4254If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8.
4228If OUTER_P is non-nil, the property is changed for the outer X window of 4255If OUTER_P is non-nil, the property is changed for the outer X window of
4229FRAME. Default is to change on the edit X window. 4256FRAME. Default is to change on the edit X window. */)
4230
4231Value is VALUE. */)
4232 (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) 4257 (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p)
4233{ 4258{
4234 struct frame *f = check_x_frame (frame); 4259 struct frame *f = check_x_frame (frame);
@@ -4329,15 +4354,19 @@ DEFUN ("x-window-property", Fx_window_property, Sx_window_property,
4329 1, 6, 0, 4354 1, 6, 0,
4330 doc: /* Value is the value of window property PROP on FRAME. 4355 doc: /* Value is the value of window property PROP on FRAME.
4331If FRAME is nil or omitted, use the selected frame. 4356If FRAME is nil or omitted, use the selected frame.
4332If TYPE is nil or omitted, get the property as a string. Otherwise TYPE 4357
4333is the name of the Atom that denotes the type expected. 4358On MS Windows, this function only accepts the PROP and FRAME arguments.
4359
4360On X Windows, the following optional arguments are also accepted:
4361If TYPE is nil or omitted, get the property as a string.
4362Otherwise TYPE is the name of the atom that denotes the type expected.
4334If SOURCE is non-nil, get the property on that window instead of from 4363If SOURCE is non-nil, get the property on that window instead of from
4335FRAME. The number 0 denotes the root window. 4364FRAME. The number 0 denotes the root window.
4336If DELETE_P is non-nil, delete the property after retreiving it. 4365If DELETE_P is non-nil, delete the property after retreiving it.
4337If VECTOR_RET_P is non-nil, don't return a string but a vector of values. 4366If VECTOR_RET_P is non-nil, don't return a string but a vector of values.
4338 4367
4339Value is nil if FRAME hasn't a property with name PROP or if PROP has 4368Value is nil if FRAME hasn't a property with name PROP or if PROP has
4340no value of TYPE. */) 4369no value of TYPE (always string in the MS Windows case). */)
4341 (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p) 4370 (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p)
4342{ 4371{
4343 struct frame *f = check_x_frame (frame); 4372 struct frame *f = check_x_frame (frame);
@@ -4990,7 +5019,7 @@ change the tooltip's appearance.
4990Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil 5019Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil
4991means use the default timeout of 5 seconds. 5020means use the default timeout of 5 seconds.
4992 5021
4993If the list of frame parameters PARAMS contains a `left' parameters, 5022If the list of frame parameters PARMS contains a `left' parameters,
4994the tooltip is displayed at that x-position. Otherwise it is 5023the tooltip is displayed at that x-position. Otherwise it is
4995displayed at the mouse position, with offset DX added (default is 5 if 5024displayed at the mouse position, with offset DX added (default is 5 if
4996DX isn't specified). Likewise for the y-position; if a `top' frame 5025DX isn't specified). Likewise for the y-position; if a `top' frame
@@ -5007,7 +5036,7 @@ Text larger than the specified size is clipped. */)
5007 int root_x, root_y; 5036 int root_x, root_y;
5008 struct buffer *old_buffer; 5037 struct buffer *old_buffer;
5009 struct text_pos pos; 5038 struct text_pos pos;
5010 int i, width, height; 5039 int i, width, height, seen_reversed_p;
5011 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 5040 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
5012 int old_windows_or_buffers_changed = windows_or_buffers_changed; 5041 int old_windows_or_buffers_changed = windows_or_buffers_changed;
5013 int count = SPECPDL_INDEX (); 5042 int count = SPECPDL_INDEX ();
@@ -5148,7 +5177,7 @@ Text larger than the specified size is clipped. */)
5148 try_window (FRAME_ROOT_WINDOW (f), pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); 5177 try_window (FRAME_ROOT_WINDOW (f), pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
5149 5178
5150 /* Compute width and height of the tooltip. */ 5179 /* Compute width and height of the tooltip. */
5151 width = height = 0; 5180 width = height = seen_reversed_p = 0;
5152 for (i = 0; i < w->desired_matrix->nrows; ++i) 5181 for (i = 0; i < w->desired_matrix->nrows; ++i)
5153 { 5182 {
5154 struct glyph_row *row = &w->desired_matrix->rows[i]; 5183 struct glyph_row *row = &w->desired_matrix->rows[i];
@@ -5163,19 +5192,74 @@ Text larger than the specified size is clipped. */)
5163 row->full_width_p = 1; 5192 row->full_width_p = 1;
5164 5193
5165 row_width = row->pixel_width; 5194 row_width = row->pixel_width;
5166 /* There's a glyph at the end of rows that is used to place
5167 the cursor there. Don't include the width of this glyph. */
5168 if (row->used[TEXT_AREA]) 5195 if (row->used[TEXT_AREA])
5169 { 5196 {
5170 last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; 5197 /* There's a glyph at the end of rows that is used to place
5171 if (INTEGERP (last->object)) 5198 the cursor there. Don't include the width of this glyph. */
5172 row_width -= last->pixel_width; 5199 if (!row->reversed_p)
5200 {
5201 last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1];
5202 if (INTEGERP (last->object))
5203 row_width -= last->pixel_width;
5204 }
5205 else
5206 {
5207 /* There could be a stretch glyph at the beginning of R2L
5208 rows that is produced by extend_face_to_end_of_line.
5209 Don't count that glyph. */
5210 struct glyph *g = row->glyphs[TEXT_AREA];
5211
5212 if (g->type == STRETCH_GLYPH && INTEGERP (g->object))
5213 {
5214 row_width -= g->pixel_width;
5215 seen_reversed_p = 1;
5216 }
5217 }
5173 } 5218 }
5174 5219
5175 height += row->height; 5220 height += row->height;
5176 width = max (width, row_width); 5221 width = max (width, row_width);
5177 } 5222 }
5178 5223
5224 /* If we've seen partial-length R2L rows, we need to re-adjust the
5225 tool-tip frame width and redisplay it again, to avoid over-wide
5226 tips due to the stretch glyph that extends R2L lines to full
5227 width of the frame. */
5228 if (seen_reversed_p)
5229 {
5230 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
5231 not in pixels. */
5232 width /= WINDOW_FRAME_COLUMN_WIDTH (w);
5233 w->total_cols = make_number (width);
5234 FRAME_TOTAL_COLS (f) = width;
5235 adjust_glyphs (f);
5236 clear_glyph_matrix (w->desired_matrix);
5237 clear_glyph_matrix (w->current_matrix);
5238 try_window (FRAME_ROOT_WINDOW (f), pos, 0);
5239 width = height = 0;
5240 /* Recompute width and height of the tooltip. */
5241 for (i = 0; i < w->desired_matrix->nrows; ++i)
5242 {
5243 struct glyph_row *row = &w->desired_matrix->rows[i];
5244 struct glyph *last;
5245 int row_width;
5246
5247 if (!row->enabled_p || !row->displays_text_p)
5248 break;
5249 row->full_width_p = 1;
5250 row_width = row->pixel_width;
5251 if (row->used[TEXT_AREA] && !row->reversed_p)
5252 {
5253 last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1];
5254 if (INTEGERP (last->object))
5255 row_width -= last->pixel_width;
5256 }
5257
5258 height += row->height;
5259 width = max (width, row_width);
5260 }
5261 }
5262
5179 /* Add the frame's internal border to the width and height the X 5263 /* Add the frame's internal border to the width and height the X
5180 window should have. */ 5264 window should have. */
5181 height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); 5265 height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
@@ -5299,9 +5383,7 @@ DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog,
5299/* Callback for "OK" and "Cancel" on file selection dialog. */ 5383/* Callback for "OK" and "Cancel" on file selection dialog. */
5300 5384
5301static void 5385static void
5302file_dialog_cb (widget, client_data, call_data) 5386file_dialog_cb (Widget widget, XtPointer client_data, XtPointer call_data)
5303 Widget widget;
5304 XtPointer call_data, client_data;
5305{ 5387{
5306 int *result = (int *) client_data; 5388 int *result = (int *) client_data;
5307 XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *) call_data; 5389 XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *) call_data;
@@ -5315,17 +5397,14 @@ file_dialog_cb (widget, client_data, call_data)
5315 in this case. */ 5397 in this case. */
5316 5398
5317static void 5399static void
5318file_dialog_unmap_cb (widget, client_data, call_data) 5400file_dialog_unmap_cb (Widget widget, XtPointer client_data, XtPointer call_data)
5319 Widget widget;
5320 XtPointer call_data, client_data;
5321{ 5401{
5322 int *result = (int *) client_data; 5402 int *result = (int *) client_data;
5323 *result = XmCR_CANCEL; 5403 *result = XmCR_CANCEL;
5324} 5404}
5325 5405
5326static Lisp_Object 5406static Lisp_Object
5327clean_up_file_dialog (arg) 5407clean_up_file_dialog (Lisp_Object arg)
5328 Lisp_Object arg;
5329{ 5408{
5330 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); 5409 struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
5331 Widget dialog = (Widget) p->pointer; 5410 Widget dialog = (Widget) p->pointer;
@@ -5345,7 +5424,11 @@ DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
5345 doc: /* Read file name, prompting with PROMPT in directory DIR. 5424 doc: /* Read file name, prompting with PROMPT in directory DIR.
5346Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file 5425Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file
5347selection box, if specified. If MUSTMATCH is non-nil, the returned file 5426selection box, if specified. If MUSTMATCH is non-nil, the returned file
5348or directory must exist. ONLY-DIR-P is ignored." */) 5427or directory must exist.
5428
5429This function is only defined on MS Windows, and X Windows with the
5430Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
5431Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5349 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) 5432 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)
5350{ 5433{
5351 int result; 5434 int result;
@@ -5514,8 +5597,11 @@ DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
5514 doc: /* Read file name, prompting with PROMPT in directory DIR. 5597 doc: /* Read file name, prompting with PROMPT in directory DIR.
5515Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file 5598Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file
5516selection box, if specified. If MUSTMATCH is non-nil, the returned file 5599selection box, if specified. If MUSTMATCH is non-nil, the returned file
5517or directory must exist. If ONLY-DIR-P is non-nil, the user can only select 5600or directory must exist.
5518directories. */) 5601
5602This function is only defined on MS Windows, and X Windows with the
5603Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
5604Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5519 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) 5605 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)
5520{ 5606{
5521 FRAME_PTR f = SELECTED_FRAME (); 5607 FRAME_PTR f = SELECTED_FRAME ();
@@ -6019,5 +6105,3 @@ When using Gtk+ tooltips, the tooltip face is not used. */);
6019 6105
6020#endif /* HAVE_X_WINDOWS */ 6106#endif /* HAVE_X_WINDOWS */
6021 6107
6022/* arch-tag: 55040d02-5485-4d58-8b22-95a7a05f3288
6023 (do not change this comment) */
diff --git a/src/xftfont.c b/src/xftfont.c
index dc82c28b215..a44921a11df 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -32,6 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
32#include "blockinput.h" 32#include "blockinput.h"
33#include "character.h" 33#include "character.h"
34#include "charset.h" 34#include "charset.h"
35#include "composite.h"
35#include "fontset.h" 36#include "fontset.h"
36#include "font.h" 37#include "font.h"
37#include "ftfont.h" 38#include "ftfont.h"
@@ -664,6 +665,23 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_b
664 return len; 665 return len;
665} 666}
666 667
668Lisp_Object
669xftfont_shape (Lisp_Object lgstring)
670{
671 struct font *font;
672 struct xftfont_info *xftfont_info;
673 FT_Face ft_face;
674 Lisp_Object val;
675
676 CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font);
677 xftfont_info = (struct xftfont_info *) font;
678 ft_face = XftLockFace (xftfont_info->xftfont);
679 xftfont_info->ft_size = ft_face->size;
680 val = ftfont_driver.shape (lgstring);
681 XftUnlockFace (xftfont_info->xftfont);
682 return val;
683}
684
667static int 685static int
668xftfont_end_for_frame (FRAME_PTR f) 686xftfont_end_for_frame (FRAME_PTR f)
669{ 687{
@@ -753,6 +771,9 @@ syms_of_xftfont (void)
753 xftfont_driver.draw = xftfont_draw; 771 xftfont_driver.draw = xftfont_draw;
754 xftfont_driver.end_for_frame = xftfont_end_for_frame; 772 xftfont_driver.end_for_frame = xftfont_end_for_frame;
755 xftfont_driver.cached_font_ok = xftfont_cached_font_ok; 773 xftfont_driver.cached_font_ok = xftfont_cached_font_ok;
774#if defined (HAVE_M17N_FLT) && defined (HAVE_LIBOTF)
775 xftfont_driver.shape = xftfont_shape;
776#endif
756 777
757 register_font_driver (&xftfont_driver, NULL); 778 register_font_driver (&xftfont_driver, NULL);
758} 779}
diff --git a/src/xmenu.c b/src/xmenu.c
index 68b442388a5..e8be9c6ad4c 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -89,6 +89,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
89#include <X11/Xaw/Paned.h> 89#include <X11/Xaw/Paned.h>
90#endif /* HAVE_XAW3D */ 90#endif /* HAVE_XAW3D */
91#endif /* USE_LUCID */ 91#endif /* USE_LUCID */
92#ifdef USE_MOTIF
93#include "../lwlib/lwlib.h"
94#endif
92#else /* not USE_X_TOOLKIT */ 95#else /* not USE_X_TOOLKIT */
93#ifndef USE_GTK 96#ifndef USE_GTK
94#include "../oldXMenu/XMenu.h" 97#include "../oldXMenu/XMenu.h"
@@ -2532,13 +2535,16 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2532 2535
2533#endif /* HAVE_MENUS */ 2536#endif /* HAVE_MENUS */
2534 2537
2535/* Detect if a dialog or menu has been posted. */ 2538#ifndef MSDOS
2539/* Detect if a dialog or menu has been posted. MSDOS has its own
2540 implementation on msdos.c. */
2536 2541
2537int 2542int
2538popup_activated (void) 2543popup_activated (void)
2539{ 2544{
2540 return popup_activated_flag; 2545 return popup_activated_flag;
2541} 2546}
2547#endif /* not MSDOS */
2542 2548
2543/* The following is used by delayed window autoselection. */ 2549/* The following is used by delayed window autoselection. */
2544 2550
@@ -2577,5 +2583,3 @@ syms_of_xmenu (void)
2577#endif 2583#endif
2578} 2584}
2579 2585
2580/* arch-tag: 92ea573c-398e-496e-ac73-2436f7d63242
2581 (do not change this comment) */
diff --git a/src/xml.c b/src/xml.c
index a686e55f0b0..fde9d4d382a 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -62,7 +62,7 @@ Lisp_Object make_dom (xmlNode *node)
62 62
63 return Fnreverse (result); 63 return Fnreverse (result);
64 } 64 }
65 else if (node->type == XML_TEXT_NODE) 65 else if (node->type == XML_TEXT_NODE || node->type == XML_CDATA_SECTION_NODE)
66 { 66 {
67 if (node->content) 67 if (node->content)
68 return build_string (node->content); 68 return build_string (node->content);
@@ -105,7 +105,8 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
105 doc = htmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), 105 doc = htmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
106 bytes, burl, "utf-8", 106 bytes, burl, "utf-8",
107 HTML_PARSE_RECOVER|HTML_PARSE_NONET| 107 HTML_PARSE_RECOVER|HTML_PARSE_NONET|
108 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR); 108 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
109 HTML_PARSE_NOBLANKS);
109 else 110 else
110 doc = xmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), 111 doc = xmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
111 bytes, burl, "utf-8", 112 bytes, burl, "utf-8",
diff --git a/src/xrdb.c b/src/xrdb.c
index d2898e1d8f8..90a85e287bb 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -48,6 +48,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
48 48
49#include "lisp.h" 49#include "lisp.h"
50 50
51#ifdef USE_MOTIF
52/* For Vdouble_click_time. */
53#include "keyboard.h"
54#endif
55
51extern char *getenv (const char *); 56extern char *getenv (const char *);
52 57
53extern struct passwd *getpwuid (uid_t); 58extern struct passwd *getpwuid (uid_t);
diff --git a/src/xselect.c b/src/xselect.c
index 7479f245a77..7b91d6f69b9 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -2527,14 +2527,26 @@ are ignored. */)
2527 (Lisp_Object display, Lisp_Object dest, Lisp_Object from, Lisp_Object message_type, Lisp_Object format, Lisp_Object values) 2527 (Lisp_Object display, Lisp_Object dest, Lisp_Object from, Lisp_Object message_type, Lisp_Object format, Lisp_Object values)
2528{ 2528{
2529 struct x_display_info *dpyinfo = check_x_display_info (display); 2529 struct x_display_info *dpyinfo = check_x_display_info (display);
2530
2531 CHECK_STRING (message_type);
2532 x_send_client_event(display, dest, from,
2533 XInternAtom (dpyinfo->display,
2534 SDATA (message_type),
2535 False),
2536 format, values);
2537
2538 return Qnil;
2539}
2540
2541void
2542x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, Atom message_type, Lisp_Object format, Lisp_Object values)
2543{
2544 struct x_display_info *dpyinfo = check_x_display_info (display);
2530 Window wdest; 2545 Window wdest;
2531 XEvent event; 2546 XEvent event;
2532 Lisp_Object cons;
2533 int size;
2534 struct frame *f = check_x_frame (from); 2547 struct frame *f = check_x_frame (from);
2535 int to_root; 2548 int to_root;
2536 2549
2537 CHECK_STRING (message_type);
2538 CHECK_NUMBER (format); 2550 CHECK_NUMBER (format);
2539 CHECK_CONS (values); 2551 CHECK_CONS (values);
2540 2552
@@ -2579,13 +2591,9 @@ are ignored. */)
2579 if (wdest == 0) wdest = dpyinfo->root_window; 2591 if (wdest == 0) wdest = dpyinfo->root_window;
2580 to_root = wdest == dpyinfo->root_window; 2592 to_root = wdest == dpyinfo->root_window;
2581 2593
2582 for (cons = values, size = 0; CONSP (cons); cons = XCDR (cons), ++size)
2583 ;
2584
2585 BLOCK_INPUT; 2594 BLOCK_INPUT;
2586 2595
2587 event.xclient.message_type 2596 event.xclient.message_type = message_type;
2588 = XInternAtom (dpyinfo->display, SDATA (message_type), False);
2589 event.xclient.display = dpyinfo->display; 2597 event.xclient.display = dpyinfo->display;
2590 2598
2591 /* Some clients (metacity for example) expects sending window to be here 2599 /* Some clients (metacity for example) expects sending window to be here
@@ -2610,8 +2618,6 @@ are ignored. */)
2610 } 2618 }
2611 x_uncatch_errors (); 2619 x_uncatch_errors ();
2612 UNBLOCK_INPUT; 2620 UNBLOCK_INPUT;
2613
2614 return Qnil;
2615} 2621}
2616 2622
2617 2623
diff --git a/src/xsettings.c b/src/xsettings.c
index 0d9c9cadb27..83ca87ed0bd 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -627,7 +627,9 @@ init_gconf (void)
627#if defined (HAVE_GCONF) && defined (HAVE_XFT) 627#if defined (HAVE_GCONF) && defined (HAVE_XFT)
628 char *s; 628 char *s;
629 629
630#ifdef HAVE_G_TYPE_INIT
630 g_type_init (); 631 g_type_init ();
632#endif
631 gconf_client = gconf_client_get_default (); 633 gconf_client = gconf_client_get_default ();
632 s = gconf_client_get_string (gconf_client, SYSTEM_MONO_FONT, NULL); 634 s = gconf_client_get_string (gconf_client, SYSTEM_MONO_FONT, NULL);
633 if (s) 635 if (s)
@@ -656,18 +658,10 @@ init_gconf (void)
656static void 658static void
657init_xsettings (struct x_display_info *dpyinfo) 659init_xsettings (struct x_display_info *dpyinfo)
658{ 660{
659 char sel[64];
660 Display *dpy = dpyinfo->display; 661 Display *dpy = dpyinfo->display;
661 662
662 BLOCK_INPUT; 663 BLOCK_INPUT;
663 664
664 sprintf (sel, "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen));
665 dpyinfo->Xatom_xsettings_sel = XInternAtom (dpy, sel, False);
666 dpyinfo->Xatom_xsettings_prop = XInternAtom (dpy,
667 "_XSETTINGS_SETTINGS",
668 False);
669 dpyinfo->Xatom_xsettings_mgr = XInternAtom (dpy, "MANAGER", False);
670
671 /* Select events so we can detect client messages sent when selection 665 /* Select events so we can detect client messages sent when selection
672 owner changes. */ 666 owner changes. */
673 XSelectInput (dpy, dpyinfo->root_window, StructureNotifyMask); 667 XSelectInput (dpy, dpyinfo->root_window, StructureNotifyMask);
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 79dccfa55e1..7b82fd4e61e 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -410,8 +410,8 @@ create_client_leader_window (struct x_display_info *dpyinfo, char *client_id)
410 XSetClassHint (dpyinfo->display, w, &class_hints); 410 XSetClassHint (dpyinfo->display, w, &class_hints);
411 XStoreName (dpyinfo->display, w, class_hints.res_name); 411 XStoreName (dpyinfo->display, w, class_hints.res_name);
412 412
413 sm_id = XInternAtom (dpyinfo->display, "SM_CLIENT_ID", False); 413 XChangeProperty (dpyinfo->display, w, dpyinfo->Xatom_SM_CLIENT_ID,
414 XChangeProperty (dpyinfo->display, w, sm_id, XA_STRING, 8, PropModeReplace, 414 XA_STRING, 8, PropModeReplace,
415 (unsigned char *)client_id, strlen (client_id)); 415 (unsigned char *)client_id, strlen (client_id));
416 416
417 dpyinfo->client_leader_window = w; 417 dpyinfo->client_leader_window = w;
diff --git a/src/xterm.c b/src/xterm.c
index d9d908d4396..a571d025571 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1,7 +1,8 @@
1/* X Communication module for terminals which understand the X protocol. 1/* X Communication module for terminals which understand the X protocol.
2 Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2
3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 3Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
4 Free Software Foundation, Inc. 4 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5 Free Software Foundation, Inc.
5 6
6This file is part of GNU Emacs. 7This file is part of GNU Emacs.
7 8
@@ -46,9 +47,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
46#include <sys/types.h> 47#include <sys/types.h>
47#endif /* makedev */ 48#endif /* makedev */
48 49
49#ifdef HAVE_SYS_IOCTL_H
50#include <sys/ioctl.h> 50#include <sys/ioctl.h>
51#endif /* ! defined (HAVE_SYS_IOCTL_H) */
52 51
53#include "systime.h" 52#include "systime.h"
54 53
@@ -441,7 +440,6 @@ x_display_info_for_display (Display *dpy)
441} 440}
442 441
443#define OPAQUE 0xffffffff 442#define OPAQUE 0xffffffff
444#define OPACITY "_NET_WM_WINDOW_OPACITY"
445 443
446void 444void
447x_set_frame_alpha (struct frame *f) 445x_set_frame_alpha (struct frame *f)
@@ -485,7 +483,7 @@ x_set_frame_alpha (struct frame *f)
485 unsigned long n, left; 483 unsigned long n, left;
486 484
487 x_catch_errors (dpy); 485 x_catch_errors (dpy);
488 rc = XGetWindowProperty (dpy, win, XInternAtom(dpy, OPACITY, False), 486 rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
489 0L, 1L, False, XA_CARDINAL, 487 0L, 1L, False, XA_CARDINAL,
490 &actual, &format, &n, &left, 488 &actual, &format, &n, &left,
491 &data); 489 &data);
@@ -503,7 +501,7 @@ x_set_frame_alpha (struct frame *f)
503 } 501 }
504 502
505 x_catch_errors (dpy); 503 x_catch_errors (dpy);
506 XChangeProperty (dpy, win, XInternAtom (dpy, OPACITY, False), 504 XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
507 XA_CARDINAL, 32, PropModeReplace, 505 XA_CARDINAL, 32, PropModeReplace,
508 (unsigned char *) &opac, 1L); 506 (unsigned char *) &opac, 1L);
509 x_uncatch_errors (); 507 x_uncatch_errors ();
@@ -547,22 +545,22 @@ static void
547x_update_window_begin (struct window *w) 545x_update_window_begin (struct window *w)
548{ 546{
549 struct frame *f = XFRAME (WINDOW_FRAME (w)); 547 struct frame *f = XFRAME (WINDOW_FRAME (w));
550 struct x_display_info *display_info = FRAME_X_DISPLAY_INFO (f); 548 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
551 549
552 updated_window = w; 550 updated_window = w;
553 set_output_cursor (&w->cursor); 551 set_output_cursor (&w->cursor);
554 552
555 BLOCK_INPUT; 553 BLOCK_INPUT;
556 554
557 if (f == display_info->mouse_face_mouse_frame) 555 if (f == hlinfo->mouse_face_mouse_frame)
558 { 556 {
559 /* Don't do highlighting for mouse motion during the update. */ 557 /* Don't do highlighting for mouse motion during the update. */
560 display_info->mouse_face_defer = 1; 558 hlinfo->mouse_face_defer = 1;
561 559
562 /* If F needs to be redrawn, simply forget about any prior mouse 560 /* If F needs to be redrawn, simply forget about any prior mouse
563 highlighting. */ 561 highlighting. */
564 if (FRAME_GARBAGED_P (f)) 562 if (FRAME_GARBAGED_P (f))
565 display_info->mouse_face_window = Qnil; 563 hlinfo->mouse_face_window = Qnil;
566 } 564 }
567 565
568 UNBLOCK_INPUT; 566 UNBLOCK_INPUT;
@@ -602,7 +600,7 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1)
602static void 600static void
603x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) 601x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p)
604{ 602{
605 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); 603 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
606 604
607 if (!w->pseudo_window_p) 605 if (!w->pseudo_window_p)
608 { 606 {
@@ -623,9 +621,9 @@ x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritt
623 XTframe_up_to_date to redisplay the mouse highlight. */ 621 XTframe_up_to_date to redisplay the mouse highlight. */
624 if (mouse_face_overwritten_p) 622 if (mouse_face_overwritten_p)
625 { 623 {
626 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 624 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
627 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 625 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
628 dpyinfo->mouse_face_window = Qnil; 626 hlinfo->mouse_face_window = Qnil;
629 } 627 }
630 628
631 updated_window = NULL; 629 updated_window = NULL;
@@ -639,7 +637,7 @@ static void
639x_update_end (struct frame *f) 637x_update_end (struct frame *f)
640{ 638{
641 /* Mouse highlight may be displayed again. */ 639 /* Mouse highlight may be displayed again. */
642 FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 0; 640 MOUSE_HL_INFO (f)->mouse_face_defer = 0;
643 641
644#ifndef XFlush 642#ifndef XFlush
645 BLOCK_INPUT; 643 BLOCK_INPUT;
@@ -658,17 +656,17 @@ XTframe_up_to_date (struct frame *f)
658{ 656{
659 if (FRAME_X_P (f)) 657 if (FRAME_X_P (f))
660 { 658 {
661 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 659 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
662 660
663 if (dpyinfo->mouse_face_deferred_gc 661 if (hlinfo->mouse_face_deferred_gc
664 || f == dpyinfo->mouse_face_mouse_frame) 662 || f == hlinfo->mouse_face_mouse_frame)
665 { 663 {
666 BLOCK_INPUT; 664 BLOCK_INPUT;
667 if (dpyinfo->mouse_face_mouse_frame) 665 if (hlinfo->mouse_face_mouse_frame)
668 note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, 666 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
669 dpyinfo->mouse_face_mouse_x, 667 hlinfo->mouse_face_mouse_x,
670 dpyinfo->mouse_face_mouse_y); 668 hlinfo->mouse_face_mouse_y);
671 dpyinfo->mouse_face_deferred_gc = 0; 669 hlinfo->mouse_face_deferred_gc = 0;
672 UNBLOCK_INPUT; 670 UNBLOCK_INPUT;
673 } 671 }
674 } 672 }
@@ -969,7 +967,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
969 struct face *face; 967 struct face *face;
970 968
971 /* What face has to be used last for the mouse face? */ 969 /* What face has to be used last for the mouse face? */
972 face_id = FRAME_X_DISPLAY_INFO (s->f)->mouse_face_face_id; 970 face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id;
973 face = FACE_FROM_ID (s->f, face_id); 971 face = FACE_FROM_ID (s->f, face_id);
974 if (face == NULL) 972 if (face == NULL)
975 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 973 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
@@ -1329,6 +1327,83 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s)
1329} 1327}
1330 1328
1331 1329
1330/* Draw the foreground of glyph string S for glyphless characters. */
1331
1332static void
1333x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
1334{
1335 struct glyph *glyph = s->first_glyph;
1336 XChar2b char2b[8];
1337 int x, i, j;
1338
1339 /* If first glyph of S has a left box line, start drawing the text
1340 of S to the right of that box line. */
1341 if (s->face && s->face->box != FACE_NO_BOX
1342 && s->first_glyph->left_box_line_p)
1343 x = s->x + eabs (s->face->box_line_width);
1344 else
1345 x = s->x;
1346
1347 s->char2b = char2b;
1348
1349 for (i = 0; i < s->nchars; i++, glyph++)
1350 {
1351 char buf[7], *str = NULL;
1352 int len = glyph->u.glyphless.len;
1353
1354 if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM)
1355 {
1356 if (len > 0
1357 && CHAR_TABLE_P (Vglyphless_char_display)
1358 && (CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display))
1359 >= 1))
1360 {
1361 Lisp_Object acronym
1362 = (! glyph->u.glyphless.for_no_font
1363 ? CHAR_TABLE_REF (Vglyphless_char_display,
1364 glyph->u.glyphless.ch)
1365 : XCHAR_TABLE (Vglyphless_char_display)->extras[0]);
1366 if (STRINGP (acronym))
1367 str = (char *) SDATA (acronym);
1368 }
1369 }
1370 else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE)
1371 {
1372 sprintf ((char *) buf, "%0*X",
1373 glyph->u.glyphless.ch < 0x10000 ? 4 : 6,
1374 glyph->u.glyphless.ch);
1375 str = buf;
1376 }
1377
1378 if (str)
1379 {
1380 int upper_len = (len + 1) / 2;
1381 unsigned code;
1382
1383 /* It is assured that all LEN characters in STR is ASCII. */
1384 for (j = 0; j < len; j++)
1385 {
1386 code = s->font->driver->encode_char (s->font, str[j]);
1387 STORE_XCHAR2B (char2b + j, code >> 8, code & 0xFF);
1388 }
1389 s->font->driver->draw (s, 0, upper_len,
1390 x + glyph->slice.glyphless.upper_xoff,
1391 s->ybase + glyph->slice.glyphless.upper_yoff,
1392 0);
1393 s->font->driver->draw (s, upper_len, len,
1394 x + glyph->slice.glyphless.lower_xoff,
1395 s->ybase + glyph->slice.glyphless.lower_yoff,
1396 0);
1397 }
1398 if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE)
1399 XDrawRectangle (s->display, s->window, s->gc,
1400 x, s->ybase - glyph->ascent,
1401 glyph->pixel_width - 1,
1402 glyph->ascent + glyph->descent - 1);
1403 x += glyph->pixel_width;
1404 }
1405}
1406
1332#ifdef USE_X_TOOLKIT 1407#ifdef USE_X_TOOLKIT
1333 1408
1334static struct frame *x_frame_of_widget (Widget); 1409static struct frame *x_frame_of_widget (Widget);
@@ -2655,6 +2730,14 @@ x_draw_glyph_string (struct glyph_string *s)
2655 x_draw_composite_glyph_string_foreground (s); 2730 x_draw_composite_glyph_string_foreground (s);
2656 break; 2731 break;
2657 2732
2733 case GLYPHLESS_GLYPH:
2734 if (s->for_overlaps)
2735 s->background_filled_p = 1;
2736 else
2737 x_draw_glyph_string_background (s, 1);
2738 x_draw_glyphless_glyph_string_foreground (s);
2739 break;
2740
2658 default: 2741 default:
2659 abort (); 2742 abort ();
2660 } 2743 }
@@ -5702,6 +5785,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
5702 struct frame *f = NULL; 5785 struct frame *f = NULL;
5703 struct coding_system coding; 5786 struct coding_system coding;
5704 XEvent event = *eventp; 5787 XEvent event = *eventp;
5788 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
5705 5789
5706 *finish = X_EVENT_NORMAL; 5790 *finish = X_EVENT_NORMAL;
5707 5791
@@ -6151,12 +6235,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6151 6235
6152 /* If mouse-highlight is an integer, input clears out 6236 /* If mouse-highlight is an integer, input clears out
6153 mouse highlighting. */ 6237 mouse highlighting. */
6154 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 6238 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
6155 && (f == 0 6239 && (f == 0
6156 || !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))) 6240 || !EQ (f->tool_bar_window, hlinfo->mouse_face_window)))
6157 { 6241 {
6158 clear_mouse_face (dpyinfo); 6242 clear_mouse_face (hlinfo);
6159 dpyinfo->mouse_face_hidden = 1; 6243 hlinfo->mouse_face_hidden = 1;
6160 } 6244 }
6161 6245
6162#if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS 6246#if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS
@@ -6513,12 +6597,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6513 f = x_top_window_to_frame (dpyinfo, event.xcrossing.window); 6597 f = x_top_window_to_frame (dpyinfo, event.xcrossing.window);
6514 if (f) 6598 if (f)
6515 { 6599 {
6516 if (f == dpyinfo->mouse_face_mouse_frame) 6600 if (f == hlinfo->mouse_face_mouse_frame)
6517 { 6601 {
6518 /* If we move outside the frame, then we're 6602 /* If we move outside the frame, then we're
6519 certainly no longer on any text in the frame. */ 6603 certainly no longer on any text in the frame. */
6520 clear_mouse_face (dpyinfo); 6604 clear_mouse_face (hlinfo);
6521 dpyinfo->mouse_face_mouse_frame = 0; 6605 hlinfo->mouse_face_mouse_frame = 0;
6522 } 6606 }
6523 6607
6524 /* Generate a nil HELP_EVENT to cancel a help-echo. 6608 /* Generate a nil HELP_EVENT to cancel a help-echo.
@@ -6551,10 +6635,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6551 else 6635 else
6552 f = x_window_to_frame (dpyinfo, event.xmotion.window); 6636 f = x_window_to_frame (dpyinfo, event.xmotion.window);
6553 6637
6554 if (dpyinfo->mouse_face_hidden) 6638 if (hlinfo->mouse_face_hidden)
6555 { 6639 {
6556 dpyinfo->mouse_face_hidden = 0; 6640 hlinfo->mouse_face_hidden = 0;
6557 clear_mouse_face (dpyinfo); 6641 clear_mouse_face (hlinfo);
6558 } 6642 }
6559 6643
6560#ifdef USE_GTK 6644#ifdef USE_GTK
@@ -6572,7 +6656,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6572 6656
6573 window = window_from_coordinates (f, 6657 window = window_from_coordinates (f,
6574 event.xmotion.x, event.xmotion.y, 6658 event.xmotion.x, event.xmotion.y,
6575 0, 0, 0, 0); 6659 0, 0);
6576 6660
6577 /* Window will be selected only when it is not selected now and 6661 /* Window will be selected only when it is not selected now and
6578 last mouse movement event was not in it. Minibuffer window 6662 last mouse movement event was not in it. Minibuffer window
@@ -6609,7 +6693,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6609 6693
6610 /* If we move outside the frame, then we're 6694 /* If we move outside the frame, then we're
6611 certainly no longer on any text in the frame. */ 6695 certainly no longer on any text in the frame. */
6612 clear_mouse_face (dpyinfo); 6696 clear_mouse_face (hlinfo);
6613 } 6697 }
6614 6698
6615 /* If the contents of the global variable help_echo_string 6699 /* If the contents of the global variable help_echo_string
@@ -6711,7 +6795,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6711 int x = event.xbutton.x; 6795 int x = event.xbutton.x;
6712 int y = event.xbutton.y; 6796 int y = event.xbutton.y;
6713 6797
6714 window = window_from_coordinates (f, x, y, 0, 0, 0, 1); 6798 window = window_from_coordinates (f, x, y, 0, 1);
6715 tool_bar_p = EQ (window, f->tool_bar_window); 6799 tool_bar_p = EQ (window, f->tool_bar_window);
6716 6800
6717 if (tool_bar_p && event.xbutton.button < 4) 6801 if (tool_bar_p && event.xbutton.button < 4)
@@ -7669,44 +7753,43 @@ x_connection_closed (Display *dpy, const char *error_message)
7669 delete_frame (frame, Qnoelisp); 7753 delete_frame (frame, Qnoelisp);
7670 } 7754 }
7671 7755
7672 /* We have to close the display to inform Xt that it doesn't 7756 /* If DPYINFO is null, this means we didn't open the display in the
7673 exist anymore. If we don't, Xt will continue to wait for 7757 first place, so don't try to close it. */
7674 events from the display. As a consequence, a sequence of
7675
7676 M-x make-frame-on-display RET :1 RET
7677 ...kill the new frame, so that we get an IO error...
7678 M-x make-frame-on-display RET :1 RET
7679
7680 will indefinitely wait in Xt for events for display `:1', opened
7681 in the first call to make-frame-on-display.
7682
7683 Closing the display is reported to lead to a bus error on
7684 OpenWindows in certain situations. I suspect that is a bug
7685 in OpenWindows. I don't know how to circumvent it here. */
7686
7687 if (dpyinfo) 7758 if (dpyinfo)
7688 { 7759 {
7689#ifdef USE_X_TOOLKIT 7760#ifdef USE_X_TOOLKIT
7690 /* If DPYINFO is null, this means we didn't open the display 7761 /* We have to close the display to inform Xt that it doesn't
7691 in the first place, so don't try to close it. */ 7762 exist anymore. If we don't, Xt will continue to wait for
7692 { 7763 events from the display. As a consequence, a sequence of
7693 fatal_error_signal_hook = x_fatal_error_signal; 7764
7694 XtCloseDisplay (dpy); 7765 M-x make-frame-on-display RET :1 RET
7695 fatal_error_signal_hook = NULL; 7766 ...kill the new frame, so that we get an IO error...
7696 } 7767 M-x make-frame-on-display RET :1 RET
7697#endif 7768
7769 will indefinitely wait in Xt for events for display `:1',
7770 opened in the first call to make-frame-on-display.
7771
7772 Closing the display is reported to lead to a bus error on
7773 OpenWindows in certain situations. I suspect that is a bug
7774 in OpenWindows. I don't know how to circumvent it here. */
7775 fatal_error_signal_hook = x_fatal_error_signal;
7776 XtCloseDisplay (dpy);
7777 fatal_error_signal_hook = NULL;
7778#endif /* USE_X_TOOLKIT */
7698 7779
7699#ifdef USE_GTK 7780#ifdef USE_GTK
7700 /* Due to bugs in some Gtk+ versions, just exit here if this 7781 /* A long-standing GTK bug prevents proper disconnect handling
7701 is the last display/terminal. */ 7782 (https://bugzilla.gnome.org/show_bug.cgi?id=85715). Once,
7702 if (terminal_list->next_terminal == NULL) 7783 the resulting Glib error message loop filled a user's disk.
7703 { 7784 To avoid this, kill Emacs unconditionally on disconnect. */
7704 fprintf (stderr, "%s\n", error_msg); 7785 shut_down_emacs (0, 0, Qnil);
7705 Fkill_emacs (make_number (70)); 7786 fprintf (stderr, "%s\n\
7706 /* NOTREACHED */ 7787When compiled with GTK, Emacs cannot recover from X disconnects.\n\
7707 } 7788This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715\n\
7708 xg_display_close (dpyinfo->display); 7789For details, see etc/PROBLEMS.\n",
7709#endif 7790 error_msg);
7791 abort ();
7792#endif /* USE_GTK */
7710 7793
7711 /* Indicate that this display is dead. */ 7794 /* Indicate that this display is dead. */
7712 dpyinfo->display = 0; 7795 dpyinfo->display = 0;
@@ -8199,12 +8282,11 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
8199 http://freedesktop.org/wiki/Specifications/wm-spec. */ 8282 http://freedesktop.org/wiki/Specifications/wm-spec. */
8200 8283
8201static int 8284static int
8202wm_supports (struct frame *f, const char *atomname) 8285wm_supports (struct frame *f, Atom want_atom)
8203{ 8286{
8204 Atom actual_type; 8287 Atom actual_type;
8205 unsigned long actual_size, bytes_remaining; 8288 unsigned long actual_size, bytes_remaining;
8206 int i, rc, actual_format; 8289 int i, rc, actual_format;
8207 Atom prop_atom;
8208 Window wmcheck_window; 8290 Window wmcheck_window;
8209 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 8291 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8210 Window target_window = dpyinfo->root_window; 8292 Window target_window = dpyinfo->root_window;
@@ -8212,15 +8294,13 @@ wm_supports (struct frame *f, const char *atomname)
8212 Display *dpy = FRAME_X_DISPLAY (f); 8294 Display *dpy = FRAME_X_DISPLAY (f);
8213 unsigned char *tmp_data = NULL; 8295 unsigned char *tmp_data = NULL;
8214 Atom target_type = XA_WINDOW; 8296 Atom target_type = XA_WINDOW;
8215 Atom want_atom;
8216 8297
8217 BLOCK_INPUT; 8298 BLOCK_INPUT;
8218 8299
8219 prop_atom = XInternAtom (dpy, "_NET_SUPPORTING_WM_CHECK", False);
8220
8221 x_catch_errors (dpy); 8300 x_catch_errors (dpy);
8222 rc = XGetWindowProperty (dpy, target_window, 8301 rc = XGetWindowProperty (dpy, target_window,
8223 prop_atom, 0, max_len, False, target_type, 8302 dpyinfo->Xatom_net_supporting_wm_check,
8303 0, max_len, False, target_type,
8224 &actual_type, &actual_format, &actual_size, 8304 &actual_type, &actual_format, &actual_size,
8225 &bytes_remaining, &tmp_data); 8305 &bytes_remaining, &tmp_data);
8226 8306
@@ -8255,10 +8335,10 @@ wm_supports (struct frame *f, const char *atomname)
8255 dpyinfo->net_supported_window = 0; 8335 dpyinfo->net_supported_window = 0;
8256 8336
8257 target_type = XA_ATOM; 8337 target_type = XA_ATOM;
8258 prop_atom = XInternAtom (dpy, "_NET_SUPPORTED", False);
8259 tmp_data = NULL; 8338 tmp_data = NULL;
8260 rc = XGetWindowProperty (dpy, target_window, 8339 rc = XGetWindowProperty (dpy, target_window,
8261 prop_atom, 0, max_len, False, target_type, 8340 dpyinfo->Xatom_net_supported,
8341 0, max_len, False, target_type,
8262 &actual_type, &actual_format, &actual_size, 8342 &actual_type, &actual_format, &actual_size,
8263 &bytes_remaining, &tmp_data); 8343 &bytes_remaining, &tmp_data);
8264 8344
@@ -8276,7 +8356,6 @@ wm_supports (struct frame *f, const char *atomname)
8276 } 8356 }
8277 8357
8278 rc = 0; 8358 rc = 0;
8279 want_atom = XInternAtom (dpy, atomname, False);
8280 8359
8281 for (i = 0; rc == 0 && i < dpyinfo->nr_net_supported_atoms; ++i) 8360 for (i = 0; rc == 0 && i < dpyinfo->nr_net_supported_atoms; ++i)
8282 rc = dpyinfo->net_supported_atoms[i] == want_atom; 8361 rc = dpyinfo->net_supported_atoms[i] == want_atom;
@@ -8288,31 +8367,33 @@ wm_supports (struct frame *f, const char *atomname)
8288} 8367}
8289 8368
8290static void 8369static void
8291set_wm_state (Lisp_Object frame, int add, const char *what, const char *what2) 8370set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value)
8292{ 8371{
8293 const char *atom = "_NET_WM_STATE"; 8372 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (frame));
8294 Fx_send_client_event (frame, make_number (0), frame, 8373
8295 make_unibyte_string (atom, strlen (atom)), 8374 x_send_client_event (frame, make_number (0), frame,
8296 make_number (32), 8375 dpyinfo->Xatom_net_wm_state,
8297 /* 1 = add, 0 = remove */ 8376 make_number (32),
8377 /* 1 = add, 0 = remove */
8378 Fcons
8379 (make_number (add ? 1 : 0),
8298 Fcons 8380 Fcons
8299 (make_number (add ? 1 : 0), 8381 (make_fixnum_or_float (atom),
8300 Fcons 8382 value != 0
8301 (make_unibyte_string (what, strlen (what)), 8383 ? Fcons (make_fixnum_or_float (value), Qnil)
8302 what2 != 0 8384 : Qnil)));
8303 ? Fcons (make_unibyte_string (what2, strlen (what2)),
8304 Qnil)
8305 : Qnil)));
8306} 8385}
8307 8386
8308void 8387void
8309x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) 8388x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
8310{ 8389{
8311 Lisp_Object frame; 8390 Lisp_Object frame;
8391 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8312 8392
8313 XSETFRAME (frame, f); 8393 XSETFRAME (frame, f);
8394
8314 set_wm_state (frame, NILP (new_value) ? 0 : 1, 8395 set_wm_state (frame, NILP (new_value) ? 0 : 1,
8315 "_NET_WM_STATE_STICKY", NULL); 8396 dpyinfo->Xatom_net_wm_state_sticky, None);
8316} 8397}
8317 8398
8318/* Return the current _NET_WM_STATE. 8399/* Return the current _NET_WM_STATE.
@@ -8320,7 +8401,7 @@ x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
8320 STICKY is set to 1 if the sticky state is set, 0 if not. */ 8401 STICKY is set to 1 if the sticky state is set, 0 if not. */
8321 8402
8322static void 8403static void
8323get_current_vm_state (struct frame *f, 8404get_current_wm_state (struct frame *f,
8324 Window window, 8405 Window window,
8325 int *size_state, 8406 int *size_state,
8326 int *sticky) 8407 int *sticky)
@@ -8371,7 +8452,7 @@ get_current_vm_state (struct frame *f,
8371 else 8452 else
8372 *size_state = FULLSCREEN_HEIGHT; 8453 *size_state = FULLSCREEN_HEIGHT;
8373 } 8454 }
8374 else if (a == dpyinfo->Xatom_net_wm_state_fullscreen_atom) 8455 else if (a == dpyinfo->Xatom_net_wm_state_fullscreen)
8375 *size_state = FULLSCREEN_BOTH; 8456 *size_state = FULLSCREEN_BOTH;
8376 else if (a == dpyinfo->Xatom_net_wm_state_sticky) 8457 else if (a == dpyinfo->Xatom_net_wm_state_sticky)
8377 *sticky = 1; 8458 *sticky = 1;
@@ -8386,23 +8467,21 @@ get_current_vm_state (struct frame *f,
8386static int 8467static int
8387do_ewmh_fullscreen (struct frame *f) 8468do_ewmh_fullscreen (struct frame *f)
8388{ 8469{
8389 int have_net_atom = wm_supports (f, "_NET_WM_STATE"); 8470 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8471 int have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state);
8390 Lisp_Object lval = get_frame_param (f, Qfullscreen); 8472 Lisp_Object lval = get_frame_param (f, Qfullscreen);
8391 int cur, dummy; 8473 int cur, dummy;
8392 8474
8393 get_current_vm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy); 8475 get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy);
8394 8476
8395 /* Some window managers don't say they support _NET_WM_STATE, but they do say 8477 /* Some window managers don't say they support _NET_WM_STATE, but they do say
8396 they support _NET_WM_STATE_FULLSCREEN. Try that also. */ 8478 they support _NET_WM_STATE_FULLSCREEN. Try that also. */
8397 if (!have_net_atom) 8479 if (!have_net_atom)
8398 have_net_atom = wm_supports (f, "_NET_WM_STATE_FULLSCREEN"); 8480 have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen);
8399 8481
8400 if (have_net_atom && cur != f->want_fullscreen) 8482 if (have_net_atom && cur != f->want_fullscreen)
8401 { 8483 {
8402 Lisp_Object frame; 8484 Lisp_Object frame;
8403 const char *fs = "_NET_WM_STATE_FULLSCREEN";
8404 const char *fw = "_NET_WM_STATE_MAXIMIZED_HORZ";
8405 const char *fh = "_NET_WM_STATE_MAXIMIZED_VERT";
8406 8485
8407 XSETFRAME (frame, f); 8486 XSETFRAME (frame, f);
8408 8487
@@ -8414,33 +8493,38 @@ do_ewmh_fullscreen (struct frame *f)
8414 case FULLSCREEN_BOTH: 8493 case FULLSCREEN_BOTH:
8415 if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED 8494 if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED
8416 || cur == FULLSCREEN_HEIGHT) 8495 || cur == FULLSCREEN_HEIGHT)
8417 set_wm_state (frame, 0, fw, fh); 8496 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz,
8418 set_wm_state (frame, 1, fs, NULL); 8497 dpyinfo->Xatom_net_wm_state_maximized_vert);
8498 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_fullscreen, None);
8419 break; 8499 break;
8420 case FULLSCREEN_WIDTH: 8500 case FULLSCREEN_WIDTH:
8421 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT 8501 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT
8422 || cur == FULLSCREEN_MAXIMIZED) 8502 || cur == FULLSCREEN_MAXIMIZED)
8423 set_wm_state (frame, 0, fs, fh); 8503 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen,
8504 dpyinfo->Xatom_net_wm_state_maximized_vert);
8424 if (cur != FULLSCREEN_MAXIMIZED) 8505 if (cur != FULLSCREEN_MAXIMIZED)
8425 set_wm_state (frame, 1, fw, NULL); 8506 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, None);
8426 break; 8507 break;
8427 case FULLSCREEN_HEIGHT: 8508 case FULLSCREEN_HEIGHT:
8428 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH 8509 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH
8429 || cur == FULLSCREEN_MAXIMIZED) 8510 || cur == FULLSCREEN_MAXIMIZED)
8430 set_wm_state (frame, 0, fs, fw); 8511 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen,
8512 dpyinfo->Xatom_net_wm_state_maximized_horz);
8431 if (cur != FULLSCREEN_MAXIMIZED) 8513 if (cur != FULLSCREEN_MAXIMIZED)
8432 set_wm_state (frame, 1, fh, NULL); 8514 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_vert, None);
8433 break; 8515 break;
8434 case FULLSCREEN_MAXIMIZED: 8516 case FULLSCREEN_MAXIMIZED:
8435 if (cur == FULLSCREEN_BOTH) 8517 if (cur == FULLSCREEN_BOTH)
8436 set_wm_state (frame, 0, fs, NULL); 8518 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None);
8437 set_wm_state (frame, 1, fw, fh); 8519 set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz,
8520 dpyinfo->Xatom_net_wm_state_maximized_vert);
8438 break; 8521 break;
8439 case FULLSCREEN_NONE: 8522 case FULLSCREEN_NONE:
8440 if (cur == FULLSCREEN_BOTH) 8523 if (cur == FULLSCREEN_BOTH)
8441 set_wm_state (frame, 0, fs, NULL); 8524 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None);
8442 else 8525 else
8443 set_wm_state (frame, 0, fw, fh); 8526 set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz,
8527 dpyinfo->Xatom_net_wm_state_maximized_vert);
8444 } 8528 }
8445 8529
8446 f->want_fullscreen = FULLSCREEN_NONE; 8530 f->want_fullscreen = FULLSCREEN_NONE;
@@ -8470,7 +8554,7 @@ x_handle_net_wm_state (struct frame *f, XPropertyEvent *event)
8470 Lisp_Object lval; 8554 Lisp_Object lval;
8471 int sticky = 0; 8555 int sticky = 0;
8472 8556
8473 get_current_vm_state (f, event->window, &value, &sticky); 8557 get_current_wm_state (f, event->window, &value, &sticky);
8474 lval = Qnil; 8558 lval = Qnil;
8475 switch (value) 8559 switch (value)
8476 { 8560 {
@@ -8880,17 +8964,17 @@ x_ewmh_activate_frame (FRAME_PTR f)
8880 /* See Window Manager Specification/Extended Window Manager Hints at 8964 /* See Window Manager Specification/Extended Window Manager Hints at
8881 http://freedesktop.org/wiki/Specifications/wm-spec */ 8965 http://freedesktop.org/wiki/Specifications/wm-spec */
8882 8966
8883 const char *atom = "_NET_ACTIVE_WINDOW"; 8967 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8884 if (f->async_visible && wm_supports (f, atom)) 8968 if (f->async_visible && wm_supports (f, dpyinfo->Xatom_net_active_window))
8885 { 8969 {
8886 Lisp_Object frame; 8970 Lisp_Object frame;
8887 XSETFRAME (frame, f); 8971 XSETFRAME (frame, f);
8888 Fx_send_client_event (frame, make_number (0), frame, 8972 x_send_client_event (frame, make_number (0), frame,
8889 make_unibyte_string (atom, strlen (atom)), 8973 dpyinfo->Xatom_net_active_window,
8890 make_number (32), 8974 make_number (32),
8891 Fcons (make_number (1), 8975 Fcons (make_number (1),
8892 Fcons (make_number (last_user_time), 8976 Fcons (make_number (last_user_time),
8893 Qnil))); 8977 Qnil)));
8894 } 8978 }
8895} 8979}
8896 8980
@@ -8910,13 +8994,13 @@ xembed_set_info (struct frame *f, enum xembed_info flags)
8910{ 8994{
8911 Atom atom; 8995 Atom atom;
8912 unsigned long data[2]; 8996 unsigned long data[2];
8913 8997 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8914 atom = XInternAtom (FRAME_X_DISPLAY (f), "_XEMBED_INFO", False);
8915 8998
8916 data[0] = XEMBED_VERSION; 8999 data[0] = XEMBED_VERSION;
8917 data[1] = flags; 9000 data[1] = flags;
8918 9001
8919 XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), atom, atom, 9002 XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
9003 dpyinfo->Xatom_XEMBED_INFO, dpyinfo->Xatom_XEMBED_INFO,
8920 32, PropModeReplace, (unsigned char *) data, 2); 9004 32, PropModeReplace, (unsigned char *) data, 2);
8921} 9005}
8922 9006
@@ -9300,6 +9384,7 @@ x_free_frame_resources (struct frame *f)
9300 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 9384 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
9301 Lisp_Object bar; 9385 Lisp_Object bar;
9302 struct scroll_bar *b; 9386 struct scroll_bar *b;
9387 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
9303 9388
9304 BLOCK_INPUT; 9389 BLOCK_INPUT;
9305 9390
@@ -9393,15 +9478,15 @@ x_free_frame_resources (struct frame *f)
9393 if (f == dpyinfo->x_highlight_frame) 9478 if (f == dpyinfo->x_highlight_frame)
9394 dpyinfo->x_highlight_frame = 0; 9479 dpyinfo->x_highlight_frame = 0;
9395 9480
9396 if (f == dpyinfo->mouse_face_mouse_frame) 9481 if (f == hlinfo->mouse_face_mouse_frame)
9397 { 9482 {
9398 dpyinfo->mouse_face_beg_row 9483 hlinfo->mouse_face_beg_row
9399 = dpyinfo->mouse_face_beg_col = -1; 9484 = hlinfo->mouse_face_beg_col = -1;
9400 dpyinfo->mouse_face_end_row 9485 hlinfo->mouse_face_end_row
9401 = dpyinfo->mouse_face_end_col = -1; 9486 = hlinfo->mouse_face_end_col = -1;
9402 dpyinfo->mouse_face_window = Qnil; 9487 hlinfo->mouse_face_window = Qnil;
9403 dpyinfo->mouse_face_deferred_gc = 0; 9488 hlinfo->mouse_face_deferred_gc = 0;
9404 dpyinfo->mouse_face_mouse_frame = 0; 9489 hlinfo->mouse_face_mouse_frame = 0;
9405 } 9490 }
9406 9491
9407 UNBLOCK_INPUT; 9492 UNBLOCK_INPUT;
@@ -9778,6 +9863,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9778 struct terminal *terminal; 9863 struct terminal *terminal;
9779 struct x_display_info *dpyinfo; 9864 struct x_display_info *dpyinfo;
9780 XrmDatabase xrdb; 9865 XrmDatabase xrdb;
9866 Mouse_HLInfo *hlinfo;
9781 9867
9782 BLOCK_INPUT; 9868 BLOCK_INPUT;
9783 9869
@@ -9908,6 +9994,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9908 9994
9909 dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info)); 9995 dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
9910 memset (dpyinfo, 0, sizeof *dpyinfo); 9996 memset (dpyinfo, 0, sizeof *dpyinfo);
9997 hlinfo = &dpyinfo->mouse_highlight;
9911 9998
9912 terminal = x_create_terminal (dpyinfo); 9999 terminal = x_create_terminal (dpyinfo);
9913 10000
@@ -10030,16 +10117,16 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10030 dpyinfo->bitmaps_size = 0; 10117 dpyinfo->bitmaps_size = 0;
10031 dpyinfo->bitmaps_last = 0; 10118 dpyinfo->bitmaps_last = 0;
10032 dpyinfo->scratch_cursor_gc = 0; 10119 dpyinfo->scratch_cursor_gc = 0;
10033 dpyinfo->mouse_face_mouse_frame = 0; 10120 hlinfo->mouse_face_mouse_frame = 0;
10034 dpyinfo->mouse_face_deferred_gc = 0; 10121 hlinfo->mouse_face_deferred_gc = 0;
10035 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 10122 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
10036 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 10123 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
10037 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; 10124 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
10038 dpyinfo->mouse_face_window = Qnil; 10125 hlinfo->mouse_face_window = Qnil;
10039 dpyinfo->mouse_face_overlay = Qnil; 10126 hlinfo->mouse_face_overlay = Qnil;
10040 dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; 10127 hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
10041 dpyinfo->mouse_face_defer = 0; 10128 hlinfo->mouse_face_defer = 0;
10042 dpyinfo->mouse_face_hidden = 0; 10129 hlinfo->mouse_face_hidden = 0;
10043 dpyinfo->x_focus_frame = 0; 10130 dpyinfo->x_focus_frame = 0;
10044 dpyinfo->x_focus_event_frame = 0; 10131 dpyinfo->x_focus_event_frame = 0;
10045 dpyinfo->x_highlight_frame = 0; 10132 dpyinfo->x_highlight_frame = 0;
@@ -10107,88 +10194,97 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10107 dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm; 10194 dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm;
10108 } 10195 }
10109 10196
10110 dpyinfo->Xatom_wm_protocols 10197 {
10111 = XInternAtom (dpyinfo->display, "WM_PROTOCOLS", False); 10198 const struct
10112 dpyinfo->Xatom_wm_take_focus 10199 {
10113 = XInternAtom (dpyinfo->display, "WM_TAKE_FOCUS", False); 10200 const char *name;
10114 dpyinfo->Xatom_wm_save_yourself 10201 Atom *atom;
10115 = XInternAtom (dpyinfo->display, "WM_SAVE_YOURSELF", False); 10202 } atom_refs[] = {
10116 dpyinfo->Xatom_wm_delete_window 10203 { "WM_PROTOCOLS", &dpyinfo->Xatom_wm_protocols },
10117 = XInternAtom (dpyinfo->display, "WM_DELETE_WINDOW", False); 10204 { "WM_TAKE_FOCUS", &dpyinfo->Xatom_wm_take_focus },
10118 dpyinfo->Xatom_wm_change_state 10205 { "WM_SAVE_YOURSELF", &dpyinfo->Xatom_wm_save_yourself },
10119 = XInternAtom (dpyinfo->display, "WM_CHANGE_STATE", False); 10206 { "WM_DELETE_WINDOW", &dpyinfo->Xatom_wm_delete_window },
10120 dpyinfo->Xatom_wm_configure_denied 10207 { "WM_CHANGE_STATE", &dpyinfo->Xatom_wm_change_state },
10121 = XInternAtom (dpyinfo->display, "WM_CONFIGURE_DENIED", False); 10208 { "WM_CONFIGURE_DENIED", &dpyinfo->Xatom_wm_configure_denied },
10122 dpyinfo->Xatom_wm_window_moved 10209 { "WM_MOVED", &dpyinfo->Xatom_wm_window_moved },
10123 = XInternAtom (dpyinfo->display, "WM_MOVED", False); 10210 { "WM_CLIENT_LEADER", &dpyinfo->Xatom_wm_client_leader },
10124 dpyinfo->Xatom_wm_client_leader 10211 { "Editres", &dpyinfo->Xatom_editres },
10125 = XInternAtom (dpyinfo->display, "WM_CLIENT_LEADER", False); 10212 { "CLIPBOARD", &dpyinfo->Xatom_CLIPBOARD },
10126 dpyinfo->Xatom_editres 10213 { "TIMESTAMP", &dpyinfo->Xatom_TIMESTAMP },
10127 = XInternAtom (dpyinfo->display, "Editres", False); 10214 { "TEXT", &dpyinfo->Xatom_TEXT },
10128 dpyinfo->Xatom_CLIPBOARD 10215 { "COMPOUND_TEXT", &dpyinfo->Xatom_COMPOUND_TEXT },
10129 = XInternAtom (dpyinfo->display, "CLIPBOARD", False); 10216 { "UTF8_STRING", &dpyinfo->Xatom_UTF8_STRING },
10130 dpyinfo->Xatom_TIMESTAMP 10217 { "DELETE", &dpyinfo->Xatom_DELETE },
10131 = XInternAtom (dpyinfo->display, "TIMESTAMP", False); 10218 { "MULTIPLE", &dpyinfo->Xatom_MULTIPLE },
10132 dpyinfo->Xatom_TEXT 10219 { "INCR", &dpyinfo->Xatom_INCR },
10133 = XInternAtom (dpyinfo->display, "TEXT", False); 10220 { "_EMACS_TMP_", &dpyinfo->Xatom_EMACS_TMP },
10134 dpyinfo->Xatom_COMPOUND_TEXT 10221 { "TARGETS", &dpyinfo->Xatom_TARGETS },
10135 = XInternAtom (dpyinfo->display, "COMPOUND_TEXT", False); 10222 { "NULL", &dpyinfo->Xatom_NULL },
10136 dpyinfo->Xatom_UTF8_STRING 10223 { "ATOM_PAIR", &dpyinfo->Xatom_ATOM_PAIR },
10137 = XInternAtom (dpyinfo->display, "UTF8_STRING", False); 10224 { "_XEMBED_INFO", &dpyinfo->Xatom_XEMBED_INFO },
10138 dpyinfo->Xatom_DELETE 10225 /* For properties of font. */
10139 = XInternAtom (dpyinfo->display, "DELETE", False); 10226 { "PIXEL_SIZE", &dpyinfo->Xatom_PIXEL_SIZE },
10140 dpyinfo->Xatom_MULTIPLE 10227 { "AVERAGE_WIDTH", &dpyinfo->Xatom_AVERAGE_WIDTH },
10141 = XInternAtom (dpyinfo->display, "MULTIPLE", False); 10228 { "_MULE_BASELINE_OFFSET", &dpyinfo->Xatom_MULE_BASELINE_OFFSET },
10142 dpyinfo->Xatom_INCR 10229 { "_MULE_RELATIVE_COMPOSE", &dpyinfo->Xatom_MULE_RELATIVE_COMPOSE },
10143 = XInternAtom (dpyinfo->display, "INCR", False); 10230 { "_MULE_DEFAULT_ASCENT", &dpyinfo->Xatom_MULE_DEFAULT_ASCENT },
10144 dpyinfo->Xatom_EMACS_TMP 10231 /* Ghostscript support. */
10145 = XInternAtom (dpyinfo->display, "_EMACS_TMP_", False); 10232 { "DONE", &dpyinfo->Xatom_DONE },
10146 dpyinfo->Xatom_TARGETS 10233 { "PAGE", &dpyinfo->Xatom_PAGE },
10147 = XInternAtom (dpyinfo->display, "TARGETS", False); 10234 { "SCROLLBAR", &dpyinfo->Xatom_Scrollbar },
10148 dpyinfo->Xatom_NULL 10235 { "_XEMBED", &dpyinfo->Xatom_XEMBED },
10149 = XInternAtom (dpyinfo->display, "NULL", False); 10236 /* EWMH */
10150 dpyinfo->Xatom_ATOM_PAIR 10237 { "_NET_WM_STATE", &dpyinfo->Xatom_net_wm_state },
10151 = XInternAtom (dpyinfo->display, "ATOM_PAIR", False); 10238 { "_NET_WM_STATE_FULLSCREEN", &dpyinfo->Xatom_net_wm_state_fullscreen },
10152 /* For properties of font. */ 10239 { "_NET_WM_STATE_MAXIMIZED_HORZ",
10153 dpyinfo->Xatom_PIXEL_SIZE 10240 &dpyinfo->Xatom_net_wm_state_maximized_horz },
10154 = XInternAtom (dpyinfo->display, "PIXEL_SIZE", False); 10241 { "_NET_WM_STATE_MAXIMIZED_VERT",
10155 dpyinfo->Xatom_AVERAGE_WIDTH 10242 &dpyinfo->Xatom_net_wm_state_maximized_vert },
10156 = XInternAtom (dpyinfo->display, "AVERAGE_WIDTH", False); 10243 { "_NET_WM_STATE_STICKY", &dpyinfo->Xatom_net_wm_state_sticky },
10157 dpyinfo->Xatom_MULE_BASELINE_OFFSET 10244 { "_NET_WM_WINDOW_TYPE", &dpyinfo->Xatom_net_window_type },
10158 = XInternAtom (dpyinfo->display, "_MULE_BASELINE_OFFSET", False); 10245 { "_NET_WM_WINDOW_TYPE_TOOLTIP",
10159 dpyinfo->Xatom_MULE_RELATIVE_COMPOSE 10246 &dpyinfo->Xatom_net_window_type_tooltip },
10160 = XInternAtom (dpyinfo->display, "_MULE_RELATIVE_COMPOSE", False); 10247 { "_NET_WM_ICON_NAME", &dpyinfo->Xatom_net_wm_icon_name },
10161 dpyinfo->Xatom_MULE_DEFAULT_ASCENT 10248 { "_NET_WM_NAME", &dpyinfo->Xatom_net_wm_name },
10162 = XInternAtom (dpyinfo->display, "_MULE_DEFAULT_ASCENT", False); 10249 { "_NET_SUPPORTED", &dpyinfo->Xatom_net_supported },
10163 10250 { "_NET_SUPPORTING_WM_CHECK", &dpyinfo->Xatom_net_supporting_wm_check },
10164 /* Ghostscript support. */ 10251 { "_NET_WM_WINDOW_OPACITY", &dpyinfo->Xatom_net_wm_window_opacity },
10165 dpyinfo->Xatom_PAGE = XInternAtom (dpyinfo->display, "PAGE", False); 10252 { "_NET_ACTIVE_WINDOW", &dpyinfo->Xatom_net_active_window },
10166 dpyinfo->Xatom_DONE = XInternAtom (dpyinfo->display, "DONE", False); 10253 { "_NET_FRAME_EXTENTS", &dpyinfo->Xatom_net_frame_extents },
10167 10254 /* Session management */
10168 dpyinfo->Xatom_Scrollbar = XInternAtom (dpyinfo->display, "SCROLLBAR", 10255 { "SM_CLIENT_ID", &dpyinfo->Xatom_SM_CLIENT_ID },
10169 False); 10256 { "_XSETTINGS_SETTINGS", &dpyinfo->Xatom_xsettings_prop },
10170 10257 { "MANAGER", &dpyinfo->Xatom_xsettings_mgr },
10171 dpyinfo->Xatom_XEMBED = XInternAtom (dpyinfo->display, "_XEMBED", 10258 };
10172 False); 10259
10173 10260 int i;
10174 dpyinfo->Xatom_net_wm_state 10261 const int atom_count = sizeof (atom_refs) / sizeof (atom_refs[0]);
10175 = XInternAtom (dpyinfo->display, "_NET_WM_STATE", False); 10262 /* 1 for _XSETTINGS_SN */
10176 dpyinfo->Xatom_net_wm_state_fullscreen_atom 10263 const int total_atom_count = 1 + atom_count;
10177 = XInternAtom (dpyinfo->display, "_NET_WM_STATE_FULLSCREEN", False); 10264 Atom *atoms_return = xmalloc (sizeof (Atom) * total_atom_count);
10178 dpyinfo->Xatom_net_wm_state_maximized_horz 10265 char **atom_names = xmalloc (sizeof (char *) * total_atom_count);
10179 = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); 10266 char xsettings_atom_name[64];
10180 dpyinfo->Xatom_net_wm_state_maximized_vert 10267
10181 = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_VERT", False); 10268 for (i = 0; i < atom_count; i++)
10182 dpyinfo->Xatom_net_wm_state_sticky 10269 atom_names[i] = (char *) atom_refs[i].name;
10183 = XInternAtom (dpyinfo->display, "_NET_WM_STATE_STICKY", False); 10270
10184 dpyinfo->Xatom_net_window_type 10271 /* Build _XSETTINGS_SN atom name */
10185 = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE", False); 10272 snprintf (xsettings_atom_name, sizeof (xsettings_atom_name),
10186 dpyinfo->Xatom_net_window_type_tooltip 10273 "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen));
10187 = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False); 10274 atom_names[i] = xsettings_atom_name;
10188 dpyinfo->Xatom_net_wm_icon_name 10275
10189 = XInternAtom (dpyinfo->display, "_NET_WM_ICON_NAME", False); 10276 XInternAtoms (dpyinfo->display, atom_names, total_atom_count,
10190 dpyinfo->Xatom_net_wm_name 10277 False, atoms_return);
10191 = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False); 10278
10279 for (i = 0; i < atom_count; i++)
10280 *atom_refs[i].atom = atoms_return[i];
10281
10282 /* Manual copy of last atom */
10283 dpyinfo->Xatom_xsettings_sel = atoms_return[i];
10284
10285 xfree (atom_names);
10286 xfree (atoms_return);
10287 }
10192 10288
10193 dpyinfo->x_dnd_atoms_size = 8; 10289 dpyinfo->x_dnd_atoms_size = 8;
10194 dpyinfo->x_dnd_atoms_length = 0; 10290 dpyinfo->x_dnd_atoms_length = 0;
@@ -10682,9 +10778,11 @@ selected window or cursor position is preserved. */);
10682 x_mouse_click_focus_ignore_position = 0; 10778 x_mouse_click_focus_ignore_position = 0;
10683 10779
10684 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, 10780 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
10685 doc: /* What X toolkit scroll bars Emacs uses. 10781 doc: /* Which toolkit scroll bars Emacs uses, if any.
10686A value of nil means Emacs doesn't use X toolkit scroll bars. 10782A value of nil means Emacs doesn't use toolkit scroll bars.
10687Otherwise, value is a symbol describing the X toolkit. */); 10783With the X Window system, the value is a symbol describing the
10784X toolkit. Possible values are: gtk, motif, xaw, or xaw3d.
10785With MS Windows, the value is t. */);
10688#ifdef USE_TOOLKIT_SCROLL_BARS 10786#ifdef USE_TOOLKIT_SCROLL_BARS
10689#ifdef USE_MOTIF 10787#ifdef USE_MOTIF
10690 Vx_toolkit_scroll_bars = intern_c_string ("motif"); 10788 Vx_toolkit_scroll_bars = intern_c_string ("motif");
@@ -10750,5 +10848,3 @@ default is nil, which is the same as `super'. */);
10750 10848
10751#endif /* HAVE_X_WINDOWS */ 10849#endif /* HAVE_X_WINDOWS */
10752 10850
10753/* arch-tag: 6d4e4cb7-abc1-4302-9585-d84dcfb09d0f
10754 (do not change this comment) */
diff --git a/src/xterm.h b/src/xterm.h
index d884945f985..fbfb043601a 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -190,36 +190,9 @@ struct x_display_info
190 /* Reusable Graphics Context for drawing a cursor in a non-default face. */ 190 /* Reusable Graphics Context for drawing a cursor in a non-default face. */
191 GC scratch_cursor_gc; 191 GC scratch_cursor_gc;
192 192
193 /* These variables describe the range of text currently shown in its 193 /* Information about the range of text currently shown in
194 mouse-face, together with the window they apply to. As long as 194 mouse-face. */
195 the mouse stays within this range, we need not redraw anything on 195 Mouse_HLInfo mouse_highlight;
196 its account. Rows and columns are glyph matrix positions in
197 MOUSE_FACE_WINDOW. */
198 int mouse_face_beg_row, mouse_face_beg_col;
199 int mouse_face_beg_x, mouse_face_beg_y;
200 int mouse_face_end_row, mouse_face_end_col;
201 int mouse_face_end_x, mouse_face_end_y;
202 int mouse_face_past_end;
203 Lisp_Object mouse_face_window;
204 int mouse_face_face_id;
205 Lisp_Object mouse_face_overlay;
206
207 /* 1 if a mouse motion event came and we didn't handle it right away because
208 gc was in progress. */
209 int mouse_face_deferred_gc;
210
211 /* FRAME and X, Y position of mouse when last checked for
212 highlighting. X and Y can be negative or out of range for the frame. */
213 struct frame *mouse_face_mouse_frame;
214 int mouse_face_mouse_x, mouse_face_mouse_y;
215
216 /* Nonzero means defer mouse-motion highlighting. */
217 int mouse_face_defer;
218
219 /* Nonzero means that the mouse highlight should not be shown. */
220 int mouse_face_hidden;
221
222 int mouse_face_image_state;
223 196
224 char *x_id_name; 197 char *x_id_name;
225 198
@@ -297,7 +270,7 @@ struct x_display_info
297 Atom Xatom_Scrollbar; 270 Atom Xatom_Scrollbar;
298 271
299 /* Atom used in XEmbed client messages. */ 272 /* Atom used in XEmbed client messages. */
300 Atom Xatom_XEMBED; 273 Atom Xatom_XEMBED, Xatom_XEMBED_INFO;;
301 274
302 /* The frame (if any) which has the X window that has keyboard focus. 275 /* The frame (if any) which has the X window that has keyboard focus.
303 Zero if none. This is examined by Ffocus_frame in xfns.c. Note 276 Zero if none. This is examined by Ffocus_frame in xfns.c. Note
@@ -359,15 +332,17 @@ struct x_display_info
359 332
360 /* Extended window manager hints, Atoms supported by the window manager and 333 /* Extended window manager hints, Atoms supported by the window manager and
361 atoms for settig the window type. */ 334 atoms for settig the window type. */
335 Atom Xatom_net_supported, Xatom_net_supporting_wm_check;
362 Atom *net_supported_atoms; 336 Atom *net_supported_atoms;
363 int nr_net_supported_atoms; 337 int nr_net_supported_atoms;
364 Window net_supported_window; 338 Window net_supported_window;
365 Atom Xatom_net_window_type, Xatom_net_window_type_tooltip; 339 Atom Xatom_net_window_type, Xatom_net_window_type_tooltip;
340 Atom Xatom_net_active_window;
366 341
367 /* Atoms dealing with maximization and fullscreen */ 342 /* Atoms dealing with EWMH (i.e. _NET_...) */
368 Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen_atom, 343 Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen,
369 Xatom_net_wm_state_maximized_horz, Xatom_net_wm_state_maximized_vert, 344 Xatom_net_wm_state_maximized_horz, Xatom_net_wm_state_maximized_vert,
370 Xatom_net_wm_state_sticky; 345 Xatom_net_wm_state_sticky, Xatom_net_frame_extents;
371 346
372 /* XSettings atoms and windows. */ 347 /* XSettings atoms and windows. */
373 Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr; 348 Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr;
@@ -375,6 +350,11 @@ struct x_display_info
375 350
376 /* Frame name and icon name */ 351 /* Frame name and icon name */
377 Atom Xatom_net_wm_name, Xatom_net_wm_icon_name; 352 Atom Xatom_net_wm_name, Xatom_net_wm_icon_name;
353 /* Frame opacity */
354 Atom Xatom_net_wm_window_opacity;
355
356 /* SM */
357 Atom Xatom_SM_CLIENT_ID;
378}; 358};
379 359
380#ifdef HAVE_X_I18N 360#ifdef HAVE_X_I18N
@@ -1038,6 +1018,13 @@ extern void x_handle_selection_notify (XSelectionEvent *);
1038extern void x_handle_selection_event (struct input_event *); 1018extern void x_handle_selection_event (struct input_event *);
1039extern void x_clear_frame_selections (struct frame *); 1019extern void x_clear_frame_selections (struct frame *);
1040 1020
1021extern void x_send_client_event (Lisp_Object display,
1022 Lisp_Object dest,
1023 Lisp_Object from,
1024 Atom message_type,
1025 Lisp_Object format,
1026 Lisp_Object values);
1027
1041extern int x_handle_dnd_message (struct frame *, 1028extern int x_handle_dnd_message (struct frame *,
1042 XClientMessageEvent *, 1029 XClientMessageEvent *,
1043 struct x_display_info *, 1030 struct x_display_info *,