diff options
| author | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-12-10 19:13:08 -0500 |
|---|---|---|
| committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-12-10 19:13:08 -0500 |
| commit | 2c302df3a13236bfbf8ea1b771d13618fcda8d71 (patch) | |
| tree | f26dc9f22861dc37610de319d05255de058c221b /src | |
| parent | 0c747cb143fa227e78f350ac353d703f489209df (diff) | |
| parent | 175069efeb080517afefdd44a06f7a779ea8c25c (diff) | |
Merge from trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/.gdbinit | 26 | ||||
| -rw-r--r-- | src/ChangeLog.9 | 7 | ||||
| -rw-r--r-- | src/ChangeLog.trunk | 1495 | ||||
| -rw-r--r-- | src/Makefile.in | 17 | ||||
| -rw-r--r-- | src/alloc.c | 22 | ||||
| -rw-r--r-- | src/atimer.c | 6 | ||||
| -rw-r--r-- | src/buffer.c | 41 | ||||
| -rw-r--r-- | src/buffer.h | 17 | ||||
| -rw-r--r-- | src/callproc.c | 49 | ||||
| -rw-r--r-- | src/charset.c | 6 | ||||
| -rw-r--r-- | src/charset.h | 2 | ||||
| -rw-r--r-- | src/cmds.c | 8 | ||||
| -rw-r--r-- | src/coding.c | 29 | ||||
| -rw-r--r-- | src/config.in | 42 | ||||
| -rw-r--r-- | src/data.c | 15 | ||||
| -rw-r--r-- | src/dbusbind.c | 38 | ||||
| -rw-r--r-- | src/dispextern.h | 87 | ||||
| -rw-r--r-- | src/dispnew.c | 42 | ||||
| -rw-r--r-- | src/editfns.c | 4 | ||||
| -rw-r--r-- | src/emacs.c | 73 | ||||
| -rw-r--r-- | src/eval.c | 2 | ||||
| -rw-r--r-- | src/fileio.c | 14 | ||||
| -rw-r--r-- | src/filelock.c | 6 | ||||
| -rw-r--r-- | src/font.c | 19 | ||||
| -rw-r--r-- | src/font.h | 4 | ||||
| -rw-r--r-- | src/frame.c | 66 | ||||
| -rw-r--r-- | src/frame.h | 14 | ||||
| -rw-r--r-- | src/ftfont.c | 4 | ||||
| -rw-r--r-- | src/gnutls.c | 9 | ||||
| -rw-r--r-- | src/gtkutil.c | 99 | ||||
| -rw-r--r-- | src/image.c | 47 | ||||
| -rw-r--r-- | src/insdel.c | 6 | ||||
| -rw-r--r-- | src/intervals.c | 18 | ||||
| -rw-r--r-- | src/intervals.h | 4 | ||||
| -rw-r--r-- | src/keyboard.c | 278 | ||||
| -rw-r--r-- | src/keyboard.h | 4 | ||||
| -rw-r--r-- | src/lisp.h | 67 | ||||
| -rw-r--r-- | src/lread.c | 130 | ||||
| -rw-r--r-- | src/m/alpha.h | 7 | ||||
| -rw-r--r-- | src/m/amdx86-64.h | 7 | ||||
| -rw-r--r-- | src/m/arm.h | 22 | ||||
| -rw-r--r-- | src/m/hp800.h | 29 | ||||
| -rw-r--r-- | src/m/ia64.h | 7 | ||||
| -rw-r--r-- | src/m/ibms390.h | 7 | ||||
| -rw-r--r-- | src/m/ibms390x.h | 7 | ||||
| -rw-r--r-- | src/m/iris4d.h | 7 | ||||
| -rw-r--r-- | src/m/m68k.h | 7 | ||||
| -rw-r--r-- | src/m/mips.h | 29 | ||||
| -rw-r--r-- | src/m/sh3.h | 4 | ||||
| -rw-r--r-- | src/m/sparc.h | 4 | ||||
| -rw-r--r-- | src/m/template.h | 7 | ||||
| -rw-r--r-- | src/m/xtensa.h | 6 | ||||
| -rw-r--r-- | src/minibuf.c | 4 | ||||
| -rw-r--r-- | src/mktime.c | 30 | ||||
| -rw-r--r-- | src/msdos.c | 695 | ||||
| -rw-r--r-- | src/msdos.h | 1 | ||||
| -rw-r--r-- | src/nsfns.m | 28 | ||||
| -rw-r--r-- | src/nsfont.m | 8 | ||||
| -rw-r--r-- | src/nsimage.m | 4 | ||||
| -rw-r--r-- | src/nsmenu.m | 14 | ||||
| -rw-r--r-- | src/nsterm.h | 18 | ||||
| -rw-r--r-- | src/nsterm.m | 254 | ||||
| -rw-r--r-- | src/print.c | 2 | ||||
| -rw-r--r-- | src/process.c | 14 | ||||
| -rw-r--r-- | src/regex.c | 48 | ||||
| -rw-r--r-- | src/s/cygwin.h | 3 | ||||
| -rw-r--r-- | src/s/ms-w32.h | 1 | ||||
| -rw-r--r-- | src/sound.c | 2 | ||||
| -rw-r--r-- | src/strftime.c | 79 | ||||
| -rw-r--r-- | src/syntax.c | 15 | ||||
| -rw-r--r-- | src/sysdep.c | 47 | ||||
| -rw-r--r-- | src/systty.h | 54 | ||||
| -rw-r--r-- | src/term.c | 635 | ||||
| -rw-r--r-- | src/termchar.h | 48 | ||||
| -rw-r--r-- | src/termhooks.h | 5 | ||||
| -rw-r--r-- | src/unexcoff.c | 3 | ||||
| -rw-r--r-- | src/w16select.c | 48 | ||||
| -rw-r--r-- | src/w32.c | 6 | ||||
| -rw-r--r-- | src/w32fns.c | 157 | ||||
| -rw-r--r-- | src/w32font.c | 4 | ||||
| -rw-r--r-- | src/w32gui.h | 6 | ||||
| -rw-r--r-- | src/w32heap.c | 5 | ||||
| -rw-r--r-- | src/w32inevt.c | 7 | ||||
| -rw-r--r-- | src/w32proc.c | 7 | ||||
| -rw-r--r-- | src/w32select.c | 45 | ||||
| -rw-r--r-- | src/w32term.c | 236 | ||||
| -rw-r--r-- | src/w32term.h | 33 | ||||
| -rw-r--r-- | src/window.c | 232 | ||||
| -rw-r--r-- | src/window.h | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 1828 | ||||
| -rw-r--r-- | src/xfaces.c | 13 | ||||
| -rw-r--r-- | src/xfns.c | 204 | ||||
| -rw-r--r-- | src/xftfont.c | 21 | ||||
| -rw-r--r-- | src/xmenu.c | 10 | ||||
| -rw-r--r-- | src/xml.c | 5 | ||||
| -rw-r--r-- | src/xrdb.c | 5 | ||||
| -rw-r--r-- | src/xselect.c | 26 | ||||
| -rw-r--r-- | src/xsettings.c | 10 | ||||
| -rw-r--r-- | src/xsmfns.c | 4 | ||||
| -rw-r--r-- | src/xterm.c | 548 | ||||
| -rw-r--r-- | src/xterm.h | 55 |
101 files changed, 5053 insertions, 3445 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 end # COMPOSITE_GLYPH if ($g->type == 1) - printf "COMP[%d (%d..%d)]", $g->u.cmp.id, $g->u.cmp.from, $g->u.cmp.to + printf "COMP[%d (%d..%d)]", $g->u.cmp.id, $g->slice.cmp.from, $g->slice.cmp.to end - # IMAGE_GLYPH + # GLYPHLESS_GLYPH if ($g->type == 2) + printf "GLYPHLESS[" + if ($g->u.glyphless.method == 0) + printf "THIN]" + end + if ($g->u.glyphless.method == 1) + printf "EMPTY]" + end + if ($g->u.glyphless.method == 2) + printf "ACRO]" + end + if ($g->u.glyphless.method == 3) + printf "HEX]" + end + end + # IMAGE_GLYPH + if ($g->type == 3) printf "IMAGE[%d]", $g->u.img_id end # STRETCH_GLYPH - if ($g->type == 3) + if ($g->type == 4) printf "STRETCH[%d+%d]", $g->u.stretch.height, $g->u.stretch.ascent end xgettype ($g->object) @@ -544,8 +560,8 @@ define pgx if ($g->right_box_line_p) printf " ]" end - if ($g->slice.x || $g->slice.y || $g->slice.width || $g->slice.height) - printf " slice=%d,%d,%d,%d" ,$g->slice.x, $g->slice.y, $g->slice.width, $g->slice.height + if ($g->slice.img.x || $g->slice.img.y || $g->slice.img.width || $g->slice.img.height) + printf " slice=%d,%d,%d,%d" ,$g->slice.img.x, $g->slice.img.y, $g->slice.img.width, $g->slice.img.height end printf "\n" end 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 @@ * atimer.c (stop_other_atimers): Don't call cancel_atimer because that unblocks alarms. - * alloc.c, bytecode.c, data.c, dispnew.c, ecrt0.c, editfns.c, - emacs.c, floatfns.c, fns.c, lread.c, print.c, config.in, lisp.h, - Makefile.in: Remove `LISP_FLOAT_TYPE' and `standalone'. + * alloc.c, bytecode.c, data.c, dispnew.c, ecrt0.c, editfns.c: + * emacs.c, floatfns.c, fns.c, lread.c, print.c, config.in, lisp.h: + * Makefile.in: Remove `LISP_FLOAT_TYPE' and `standalone'. * frame.c (make_frame): Set frame initially to `garbaged'. @@ -13312,4 +13312,3 @@ See ChangeLog.8 for earlier changes. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. -;;; 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 @@ +2010-12-08 Glenn Morris <rgm@gnu.org> + + * fileio.c (Fverify_visited_file_modtime): Default to current buffer. + +2010-12-06 Lars Magne Ingebrigtsen <larsi@gnus.org> + + * xml.c (parse_region): Ignore blank HTML nodes. + (make_dom): Return CDATA sections (like <style>foo</style>) as + text nodes. + +2010-12-06 Stefan Monnier <monnier@iro.umontreal.ca> + + * lread.c (read1): Allow newstyle unquote outside of backquote. + Disallow old-style backquotes inside new-style backquotes. + Don't count unquotes to figure out when we're "syntactically inside + but semantically outside of a backquote" any more. + Extend the restriction no-unescaped-commas-and-backquotes-in-symbols + to all contexts. + +2010-12-05 Chong Yidong <cyd@stupidchicken.com> + + * process.c: Remove checks for HAVE_SYS_IOCTL_H (Bug#7484). + +2010-12-04 Andreas Schwab <schwab@linux-m68k.org> + + * Makefile.in (M_FILE): Substitute @M_FILE@ instead of @machfile@. + (S_FILE): Substitute @S_FILE@ instead of @opsysfile@. + * m/arm.h, m/sh3.h, m/xtensa.h: Remove files. + +2010-12-03 Andreas Schwab <schwab@linux-m68k.org> + + * lisp.h (union Lisp_Object): Explicitly declare signedness of + bit-field. + (XINT): Remove variant for EXPLICIT_SIGN_EXTEND. + * m/alpha.h (EXPLICIT_SIGN_EXTEND): Don't define. + * m/amdx86-64.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/ia64.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/ibms390.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/ibms390x.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/iris4d.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/m68k.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/sparc.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/template.h (EXPLICIT_SIGN_EXTEND): Likewise. + * m/hp800.h: Remove file. + * m/mips.h: Remove file. + +2010-12-03 Jan Djärv <jan.h.d@swipnet.se> + + * nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background + with cursor color and draw a rectangle around the image (Bug#7412). + +2010-12-03 Andreas Schwab <schwab@linux-m68k.org> + + * frame.c (x_set_font): Remove unused variable. + +2010-12-02 Jan Djärv <jan.h.d@swipnet.se> + + * nsmenu.m (update_frame_tool_bar): Remove NSLog on invalid image. + + * nsterm.m (ns_draw_glyph_string): Switch fore- and background if + drawing text under filled box cursor (Bug#7479). + +2010-11-27 Kenichi Handa <handa@m17n.org> + + * charset.c (emacs_mule_charset): Make it an array of charset ID; + i.e. integer. + (Fdefine_charset_internal): Adjust for the above change. + (init_charset_once): Likewise. + + * charset.h (emacs_mule_charset): Adjust the prototype. + Delete duplicated extern. + + * coding.c (emacs_mule_char): Adjust for the change of + emacs_mule_charset. + + * lread.c (read_emacs_mule_char): Adjust for the change of + emacs_mule_charset. + +2010-11-27 Eli Zaretskii <eliz@gnu.org> + + * w32.c (_PROCESS_MEMORY_COUNTERS_EX): Don't define with versions + of w32api >= 3.15. (Bug#6989) (Bug#7452) + +2010-11-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * alloc.c (mark_terminals): Ensure that the image cache is marked + even if the terminal object was marked earlier (Bug#6301). + +2010-11-21 Chong Yidong <cyd@stupidchicken.com> + + * editfns.c (Fbyte_to_string): Signal an error arg is not a byte. + +2010-11-27 Jan Djärv <jan.h.d@swipnet.se> + + * gtkutil.c (menubar_map_cb): New function (Bug#7425). + (xg_update_frame_menubar): Connect signal map to menubar_map_cb. + Use 23 as menubar height if 0. (Bug#7425). + +2010-11-26 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (set_message_1): Force paragraph direction in echo area + be left-to-right. + + * keyboard.c (make_lispy_position): Put a meaningful value in yret + when the click is on the header or mode line. + +2010-11-25 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (set_cursor_from_row): Don't forget to consider the + `cursor' property of the first character in overlay strings. + (Bug#7474) (Bug#7481) + +2010-11-24 Jan Djärv <jan.h.d@swipnet.se> + + * nsterm.m (NSLeftControlKeyMask, NSLeftCommandKeyMask) + (NSLeftAlternateKeyMask): New defines. + (keyDown): Parse left and right keys separately (Bug#7458). + Compare Left key masks exactly (Bug#7458). + +2010-11-23 Eli Zaretskii <eliz@gnu.org> + + * intervals.c (temp_set_point_both): Define before calling, to + avoid GCC warnings. + +2010-11-23 Dan Nicolaescu <dann@ics.uci.edu> + + * nsmenu.m: Use #include <config.h> instead of "config.h". + + * term.c (Qglyphless_char,last_glyphless_glyph_frame) + (last_glyphless_glyph_face_id. last_glyphless_glyph_merged_face_id): + Move declarations ... + * lisp.h (Qglyphless_char,last_glyphless_glyph_frame) + (last_glyphless_glyph_face_id. last_glyphless_glyph_merged_face_id): + ... here. + + * emacs.c (gdb_use_union, gdb_valbits,gdb_gctypebits) + (gdb_data_seg_bits, gdb_array_mark_flag, PVEC_FLAG) + (gdb_pvec_type): + * print.c (print_output_debug_flag): + * lisp.h (debug_print): Mark as EXTERNALLY_VISIBLE. + (safe_debug_print): New declaration. + + * xterm.c: + * systty.h: + * sound.c: Include <sys/ioctl.h> unconditionally. + +2010-11-22 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * alloc.c (mark_maybe_object): Return early if given a Lisp + integer (Bug#6301). + +2010-11-21 Ken Brown <kbrown@cornell.edu> + + * sheap.c (STATIC_HEAP_SIZE): Revert previous change. + +2010-11-21 Jan Djärv <jan.h.d@swipnet.se> + + * nsterm.m (ns_right_command_modifier, ns_right_control_modifier): + Define (Bug#7458). + (NSRightCommandKeyMask, NSRightControlKeyMask): Define (Bug#7458). + (EV_MODIFIERS): Check for NSRightCommandKeyMask and + NSRightControlKeyMask also (Bug#7458). + (keyDown): Ditto (Bug#7458). + (syms_of_nsterm): Defvar ns-right-command-modifier and + ns-right-control-modifier (Bug#7458). + +2010-11-21 Dan Nicolaescu <dann@ics.uci.edu> + + * sysdep.c (sys_subshell): Remove SET_EMACS_PRIORITY. + * emacs.c (emacs_priority, syms_of_emacs): Remove emacs_priority. + + * intervals.h (temp_set_point, temp_set_point_both): + * buffer.h (offset_intervals, copy_intervals): Remove INLINE. + +2010-11-20 Ken Brown <kbrown@cornell.edu> + + * sheap.c (STATIC_HEAP_SIZE): Increase to 13MB. + +2010-11-20 Eli Zaretskii <eliz@gnu.org> + + * term.c (produce_glyphless_glyph): Use \uNNNN, \UNNNNNN, or + \xNNNNNN for hex-code display of glyphless characters. + +2010-11-20 Jan Djärv <jan.h.d@swipnet.se> + + * gtkutil.c (xg_make_tool_item): Take vert_only as argument. + Set important to ! vert_only. + (xg_show_toolbar_item): Don't show label horizontally if + tool item isn't important. + (update_frame_tool_bar): Get TOOL_BAR_ITEM_VERT_ONLY and pass it to + xg_make_tool_item, or update important on existing tool item. + + * keyboard.c (QCvert_only): New variable. + (parse_tool_bar_item): Check for QCvert_only. + (syms_of_keyboard): Initialize QCvert_only. + + * dispextern.h (tool_bar_item_idx): Add TOOL_BAR_ITEM_VERT_ONLY. + +2010-11-20 Eli Zaretskii <eliz@gnu.org> + + * msdos.c (dos_rawgetc): Use gen_help_event, instead of doing the + same in-line. + +2010-11-20 Andreas Schwab <schwab@linux-m68k.org> + + * xfaces.c (lookup_face): Make static. + * dispnew.c (copy_row_except_pointers): Likewise. + * syntax.c (dec_bytepos): Likewise. + (inc_bytepos): Remove. + * dispextern.h (lookup_face): Remove declaration. + +2010-11-19 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (set_cursor_from_row): Display cursor after all the + glyphs that come from an overlay. Don't overstep the last glyph + when skipping glyphs from an overlay. (Bug#6687) + +2010-11-18 Dan Nicolaescu <dann@ics.uci.edu> + + * alloc.c (refill_memory_reserve): Move declaration ... + * lisp.h (refill_memory_reserve): ... here. + + * strftime.c (_strftime_copytm): Add declaration. + + * callproc.c (syms_of_callproc): Use intern_c_string. + + Move declarations from .c files to .h files. + * process.c (timers_run): + * minibuf.c (quit_char): + * lread.c (read_emacs_mule_char): + * keyboard.c (minibuf_level, message_enable_multibyte) + (pending_malloc_warning): + * insdel.c (Vselect_active_regions, Vsaved_region_selection) + (Qonly): Remove declarations. + * lisp.h (pending_malloc_warning, Vsaved_region_selection) + (Vselect_active_regions): + * keyboard.h (timers_run): Add declarations. + + * strftime.c (my_strftime_gmtime_r, my_strftime_localtime_r) + (tm_diff): Convert definitions to standard C. + (extra_args_spec_iso): Remove, unused. + +2010-11-18 Jan Djärv <jan.h.d@swipnet.se> + + * xsettings.c (init_gconf): Check HAVE_G_TYPE_INIT. + + * config.in (HAVE_G_TYPE_INIT): New symbol. + +2010-11-18 Eli Zaretskii <eliz@gnu.org> + + * lread.c (Fload): Mention `load-in-progress' and + `load-file-name'. (Bug#7346) + + * keyboard.c (kbd_buffer_nr_stored): Define only ifdef subprocesses. + (kbd_buffer_store_event_hold, kbd_buffer_get_event) + (tty_read_avail_input): Call kbd_buffer_nr_stored only ifdef + subprocesses. Use buffer_free only ifdef subprocesses. + + * process.c (init_process) [subprocesses]: Init kbd_is_on_hold in + the subprocesses version, not in the non-subprocesses one. + + * Makefile.in: Don't use ## comment, it breaks the MSDOS build. + +2010-11-17 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (set_cursor_from_row): Fix cursor positioning in empty + lines on text-mode terminals. (bug#7417) + +2010-11-17 Stefan Monnier <monnier@iro.umontreal.ca> + + * xterm.c (get_current_wm_state): Rename from get_current_vm_state. + (do_ewmh_fullscreen, x_handle_net_wm_state): Update callers. + +2010-11-17 Kenichi Handa <handa@m17n.org> + + * coding.c (Fset_terminal_coding_system_internal): Fix previous + change (set charset-ID list instead of charset-symbol list). + +2010-11-16 Chong Yidong <cyd@stupidchicken.com> + + * keyboard.c (make_lispy_position): For text area clicks, record Y + pixel position relative to the text area, excluding header line. + Also change X and Y to Lisp_Objects, not pointers; don't return + coordinate values via pointers. Pass ON_TEXT_AREA coordinate to + buffer_posn_from_coords counting from the start of the text area. + (Fposn_at_x_y, make_lispy_event): Callers changed. + + * window.c (coordinates_in_window): Change X and Y to ints rather + than pointers; don't return coordinates via pointers. + (struct check_window_data): Change X and Y from pointers to ints. + (window_from_coordinates): Remove args WX and WY; don't return + coordinates via pointers. + (Fcoordinates_in_window_p, window_from_coordinates): + (check_window_containing, Fwindow_at): Callers changed. + (window_relative_x_coord): New function. + + * window.h (window_from_coordinates, window_relative_x_coord): + Update prototypes. + + * dispnew.c (buffer_posn_from_coords): Assume that X counts from + the start of the text area. + + * xdisp.c (remember_mouse_glyph): Change window_from_coordinates + call. Use window_relative_x_coord. + (note_mouse_highlight): Change window_from_coordinates call. + + * w32term.c (w32_read_socket): + * msdos.c (dos_rawgetc): + * xterm.c (handle_one_xevent): Likewise. + +2010-11-16 Dan Nicolaescu <dann@ics.uci.edu> + + * strftime.c (LOCALE_PARAM_DECL): Update for standard C. + (LOCALE_PARAM, LOCALE_PARAM_PROTO): Remove, unused. + (memcpy_lowcase, so_week_days, extra_args_spec, emacs_strftimeu): + Convert definitions to standard C. + * regex.c: Do not include <stdlib.h>, config.h does it. + Include unistd.h. + (xrealloc, init_syntax_once, re_match, regcomp, regexec) + (regerror, regfree): Convert definitions to standard C. + * mktime.c (my_mktime_localtime_r, ydhms_tm_diff, ranged_convert) + (__mktime_internal): Convert definitions to standard C. + +2010-11-15 Dan Nicolaescu <dann@ics.uci.edu> + + * w32proc.c: + * w32inevt.c: + * w32heap.c: + * w32.c: Remove config.h include guards. + + * callproc.c (child_setup): Reorder code to simplify #ifdefs. + No code changes. + + * process.c: Include <sys/ioctl.h> unconditionally, + keyboard.c already does it. + + * keyboard.c (pending_malloc_warning): Add const to match + definition in alloc.c. + (Fset_input_interrupt_mode): Simplify #ifdefs. + +2010-11-15 Dan Nicolaescu <dann@ics.uci.edu> + + Clean up systty.h macros. + * systty.h (EMACS_GET_TTY_PGRP, EMACS_SET_TTY_PGRP, EMACS_GET_TTY) + (EMACS_SET_TTY): Remove unneeded abstraction, instead inline the + definition in all uses. + (EMACS_TTY_TABS_OK): Remove, it has a single user. + * sysdep.c (discard_tty_input, child_setup_tty) + (init_sys_modes, tabs_safe_p, reset_sys_modes): + * emacs.c (shut_down_emacs): + * callproc.c (child_setup): + * term.c (dissociate_if_controlling_tty): Inline removed macros. + + * data.c (sign_extend_temp, sign_extend_lisp_int): Remove, unused. + +2010-11-14 Chong Yidong <cyd@stupidchicken.com> + + * w32fns.c (Fx_create_frame): + * nsfns.m (Fx_create_frame): Don't check for the cursorColor + resource here; it's now done at startup. + +2010-11-14 Jan Djärv <jan.h.d@swipnet.se> + + * xterm.c (set_wm_state): Add Qnil to final cons. + + * xselect.c (x_send_client_event): Remove unused variables cons and + size. + +2010-11-14 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * keyboard.c (modify_event_symbol) : Add const to array elements of + arg NAME_TABLE. + (lispy_accent_keys, lispy_function_keys, lispy_multimedia_keys) + (lispy_kana_keys, iso_lispy_function_keys, lispy_wheel_names) + (lispy_wheel_names, lispy_drag_n_drop_names, modifier_names): + Add const to array elements. + (scroll_bar_parts): Make static. Fix position of const. + + * w32fns.c (lispy_function_keys): Add const to extern. + + * w32inevt.c (lispy_function_keys): Likewise. + +2010-11-14 Chong Yidong <cyd@stupidchicken.com> + + * xfns.c (Fx_create_frame): Don't check for the cursorColor + resource here; it's now done at startup. + +2010-11-13 Dan Nicolaescu <dann@ics.uci.edu> + + * xmenu.c: Make it clear that ../lwlib/lwlib.h is only needed for Motif. + + Fix compilation on Solaris. + * sysdep.c: Do not #include <term.h>. + (tputs): Add declaration, similar to what cm.c does. (Bug#7178) + + * s/ms-w32.h (HAVE_TERMIOS_H): Do not undef, not used anymore. + +2010-11-13 Jan Djärv <jan.h.d@swipnet.se> + + * xterm.c (set_wm_state): Don't put Atom in cons, call + make_fixnum_or_float on them first. + (x_term_init): Initialize Xatom_net_supporting_wm_check and + Xatom_net_supported correctly. + + * xselect.c (x_send_client_event): Move CHECK_STRING ... + (Fx_send_client_event): to here. + +2010-11-13 Martin Rudalics <rudalics@gmx.at> + + * window.c (Fwindow_use_time): New function. + +2010-11-13 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (set_cursor_from_row): Fix cursor positioning on + zero-width characters. + + * .gdbinit (pgx): Adapt to latest changes in `struct glyph'. + + * w32term.c (x_draw_glyphless_glyph_string_foreground): Draw the + box before drawing the glyphs inside it. + + * xdisp.c (syms_of_xdisp) <glyphless-char-display>: Doc fix. + + * dispextern.h (enum glyphless_display_method): + Rename GLYPHLESS_DISPLAY_HEXA_CODE to GLYPHLESS_DISPLAY_HEX_CODE. + All users changed. + + * term.c (append_glyphless_glyph, produce_glyphless_glyph): + Fix comments. + (produce_glyphless_glyph): Enclose "U+nnnn" and "empty box" + whitespace in "[]", to simulate a box. Don't use uninitialized + variable `width'. + +2010-11-11 Julien Danjou <julien@danjou.info> + + * xsettings.c (init_xsettings): Use already fetch atoms. + + * xsmfns.c (create_client_leader_window): Use SM_CLIENT_ID atom + from dpyinfo. + + * xselect.c (Fx_send_client_event): Split and create + x_send_client_event. + + * lisp.h: Do not EXFUN Fx_send_client_event. + + * xterm.c (x_set_frame_alpha): Use _NET_WM_WINDOW_OPACITY atom + from dpyinfo. + (wm_supports): Use atoms from dpyinfo. + (do_ewmh_fullscreen): Use atoms from dpyinfo. + (x_ewmh_activate_frame): Use atoms from dpyinfo. + (xembed_set_info): Use atoms from dpyinfo. + (x_term_init): Fetch _XEMBED_INFO, _NET_SUPPORTED, + _NET_SUPPORTING_WM_CHECK, _NET_WM_WINDOW_OPACITY and + _NET_ACTIVE_WINDOW, XSETTINGS atoms. + Get all atoms in one round-trip. + (set_wm_state): Use x_send_client_event rather than + Fx_send_client_event, using Atom directly. + (x_ewmh_activate_frame): Ditto. + (x_set_sticky): Pass atoms to set_wm_state. + (do_ewmh_fullscreen): Ditto. + + + * xterm.h (x_display_info): Add Xatom_net_supported, + Xatom_net_supporting_wm_check, Xatom_net_active_window, + Xatom_net_wm_window_opacity, Xatom_XEMBED_INFO, SM_CLIENT_ID. + + * xfns.c (Fx_show_tip): Fix typo in docstring. + +2010-11-11 Stefan Monnier <monnier@iro.umontreal.ca> + + * cmds.c (Fself_insert_command): Don't call XFASTINT without checking + it's not negative. + +2010-11-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * font.c (font_filter_properties): Add const to array elements of + properties args. + + * font.h (font_filter_properties): Likewise. + + * ftfont.c (ftfont_booleans, ftfont_non_booleans): Add const to array + elements. + + * w32font.c (w32font_booleans, w32font_non_booleans): Likewise. + +2010-11-10 Michael Albinus <michael.albinus@gmx.de> + + * dbusbind.c (QCdbus_type_unix_fd): New Lisp object. + (XD_BASIC_DBUS_TYPE, xd_symbol_to_dbus_type, xd_signature) + (xd_append_arg, xd_retrieve_arg): Support DBUS_TYPE_UNIX_FD. + (Fdbus_call_method): Add DBUS_TYPE_UNIX_FD type mapping to doc string. + (syms_of_dbusbind): Initialize QCdbus_type_unix_fd). + +2010-11-10 Glenn Morris <rgm@gnu.org> + + * emacs.c (syms_of_emacs) <system-type>: Doc fix. + +2010-11-09 Eli Zaretskii <eliz@gnu.org> + + * xfns.c (x_real_positions): Fix declaration-after-statement problem. + +2010-11-09 Chong Yidong <cyd@stupidchicken.com> + + * image.c (free_image): Don't garbage the frame here, since this + function can be called while redisplaying (Bug#7210). + (uncache_image): Garbage the frame here (Bug#6426). + +2010-11-09 Jan Djärv <jan.h.d@swipnet.se> + + * xfns.c (x_real_positions): Only use _NET_FRAME_EXTENTS if our + parent is the root window. Check this after traversing window tree. + + * xterm.c (x_term_init): Initialize Xatom_net_frame_extents. + + * xterm.h (struct x_display_info): Xatom_net_frame_extents is new. + + * xfns.c (x_real_positions): Try to get _NET_FRAME_EXTENTS first + before traversing window tree (Bug#5721). + +2010-11-07 Jan Djärv <jan.h.d@swipnet.se> + + * xfns.c (set_machine_and_pid_properties): Let X set WM_CLIENT_MACHINE. + + * xdisp.c (note_mode_line_or_margin_highlight): + Initialize Cursor to No_Cursor for HAVE_WINDOW_SYSTEM also. + +2010-11-06 Eli Zaretskii <eliz@gnu.org> + + * xfns.c (Fx_show_tip): If any of the tool-tip text lines is R2L, + adjust width of tool-tip frame to the width of text, excluding the + stretch glyph at the beginning of R2L glyph rows. + + * w32fns.c (Fx_show_tip): Likewise. + +2010-11-06 Jan Djärv <jan.h.d@swipnet.se> + + * nsfont.m: Include termchar for new mouse-highlight. + (nsfont_draw): Use MOUSE_HL_INFO. + +2010-11-05 Eli Zaretskii <eliz@gnu.org> + + Unify mouse-highlight code for all GUI and TTY sessions. + + * term.c: Remove static mouse_face_* variables. All users + changed. + (term_show_mouse_face, term_clear_mouse_face) + (fast_find_position, term_mouse_highlight): Functions deleted. + (tty_draw_row_with_mouse_face): New function. + (term_mouse_movement): Call note_mouse_highlight instead of + term_mouse_highlight. + + * nsterm.m (ns_update_window_begin, ns_update_window_end) + (ns_update_end, x_destroy_window, ns_frame_up_to_date) + (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background) + (ns_dumpglyphs_image, ns_dumpglyphs_stretch) + (ns_initialize_display_info, keyDown, mouseMoved, mouseExited): + Replace Display_Info with Mouse_HLInfo everywhere where + mouse_face_* members were accessed for mouse highlight purposes. + + * xterm.c (x_update_window_begin, x_update_window_end) + (x_update_end, XTframe_up_to_date, x_set_mouse_face_gc) + (handle_one_xevent, x_free_frame_resources, x_term_init): + Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* + members were accessed for mouse highlight purposes. + + * w32term.c (x_update_window_begin, x_update_window_end) + (x_update_end, w32_read_socket, x_free_frame_resources) + (w32_initialize_display_info): Replace Display_Info with + Mouse_HLInfo everywhere where mouse_face_* members were accessed + for mouse highlight purposes. + + * xdisp.c (show_mouse_face, note_mode_line_or_margin_highlight) + (note_mouse_highlight) [HAVE_WINDOW_SYSTEM]: Don't run GUI code + unless the frame is on a window-system. + (get_tool_bar_item, handle_tool_bar_click) + (note_tool_bar_highlight, draw_glyphs, erase_phys_cursor) + (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) + (note_mode_line_or_margin_highlight, note_mouse_highlight) + (x_clear_window_mouse_face, cancel_mouse_face, expose_frame): + Replace Display_Info with Mouse_HLInfo everywhere where + mouse_face_* members were accessed for mouse highlight purposes. + (coords_in_mouse_face_p): Move prototype out of the + HAVE_WINDOW_SYSTEM conditional. + (x_y_to_hpos_vpos, frame_to_window_pixel_xy): Move out of the + HAVE_WINDOW_SYSTEM block. + (try_window_id) [HAVE_GPM || MSDOS]: + Call x_clear_window_mouse_face. + (draw_row_with_mouse_face): Implementation for HAVE_WINDOW_SYSTEM + systems. Call tty_draw_row_with_mouse_face for TTY systems. + (show_mouse_face): Call draw_row_with_mouse_face, instead of + calling draw_glyphs directly. + (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) + (cursor_in_mouse_face_p, rows_from_pos_range) + (mouse_face_from_buffer_pos, mouse_face_from_string_pos) + (note_mode_line_or_margin_highlight, note_mouse_highlight) + (x_clear_window_mouse_face, cancel_mouse_face): Move out of the + HAVE_WINDOW_SYSTEM block. Ifdef away window-system specific + fragments. + (note_mouse_highlight): Call popup_activated for MSDOS as well. + Clear mouse highlight if pointer is over glyphs whose OBJECT is an + integer. + (mouse_face_from_buffer_pos): Add parentheses around && within ||. + (x_consider_frame_title, tool_bar_lines_needed): + Move prototypes to HAVE_WINDOW_SYSTEM-only part. + (get_window_cursor_type): Move inside a HAVE_WINDOW_SYSTEM-only + part. Remove "#ifdef HAVE_WINDOW_SYSTEM" from body of function. + (null_glyph_slice): Move declaration into HAVE_WINDOW_SYSTEM-only + part. + + * dispnew.c (mirror_make_current): Set Y coordinate of the + mode-line and header-line rows. + (init_display): Setup initial frame's output_data for text + terminal frames. + + * xmenu.c (popup_activated): Don't define on MSDOS, which now has + its own definition on msdos.c. + + * msdos.c (show_mouse_face, clear_mouse_face) + (fast_find_position, IT_note_mode_line_highlight) + (IT_note_mouse_highlight): Functions deleted. + (IT_frame_up_to_date, dos_rawgetc): Call note_mouse_highlight + instead of IT_note_mouse_highlight. + (draw_row_with_mouse_face, popup_activated): New functions. + (dos_set_window_size, draw_row_with_mouse_face, IT_update_begin) + (IT_update_end, IT_frame_up_to_date, internal_terminal_init) + (dos_rawgetc): Replace Display_Info with Mouse_HLInfo everywhere + where mouse_face_* members were accessed for mouse highlight + purposes. + + * msdos.h (initialize_msdos_display): Add prototype. + + * frame.h (MOUSE_HL_INFO): New macro. + + * lisp.h (Mouse_HLInfo): New data type. + + * xterm.h (struct x_display_info): + * w32term.h (struct w32_display_info): + * nsterm.h (struct ns_display_info): + * termchar.h (struct tty_display_info): Use it instead of + mouse_face_* members. + + * dispextern.h (show_mouse_face, clear_mouse_face): Update type of + 1st argument. + (frame_to_window_pixel_xy, note_mouse_highlight) + (x_clear_window_mouse_face, cancel_mouse_face, clear_mouse_face) + (show_mouse_face, cursor_in_mouse_face_p): Move prototypes out of + HAVE_WINDOW_SYSTEM conditional. + (draw_row_with_mouse_face): Declare prototype. + (tty_draw_row_with_mouse_face): Declare prototype. + +2010-11-05 Eli Zaretskii <eliz@gnu.org> + + * term.c (append_glyphless_glyph, produce_glyphless_glyph): + Remove unused variables. + +2010-11-05 Adrian Robert <Adrian.B.Robert@gmail.com> + + * nsterm.m (EmacsView-mouseExited:): Correct error in conditional + logic pointed out by Eli Zaretskii. + +2010-11-04 Lars Magne Ingebrigtsen <larsi@gnus.org> + + * coding.c (coding-category-list): Refer to set-coding-system-priority + instead of the obsolete set-coding-priority in the doc string. + + +2010-11-04 Adrian Robert <Adrian.B.Robert@gmail.com> + + * nsfont.m (nsfont_draw): Correct previous patch to return + correct value. + * nsimage.m (EmacsImage-setXBMColor:): Correct previous patch: + don't change the method signature, change the return. + +2010-11-04 Ismail Donmez <ismail@namtrac.org> (tiny change) + + * nsfont.m (nsfont_draw) + * nsimage.m (EmacsImage-setXBMColor:) + * nsterm.m (EmacsView-performDragOperation:): Correct empty return. + +2010-11-03 Julien Danjou <julien@danjou.info> + + * image.c (gif_load): Add support for transparency and specified + :background. + +2010-11-01 Kenichi Handa <handa@m17n.org> + + * dispextern.h (lookup_glyphless_char_display): Extern it. + + * termhooks.h (struct terminal): New member charset_list. + + * coding.c (Fset_terminal_coding_system_internal): Set the + `charset_list' member of struct terminal. + + * term.c (produce_glyphs): Handle the case it->what == IT_GLYPHLESS. + (append_glyphless_glyph, produce_glyphless_glyph): New functions. + + * xdisp.c (lookup_glyphless_char_display): Make it non-static. + (lookup_glyphless_char_display): Set it->what at the end. + (last_glyphless_glyph_frame, last_glyphless_glyph_face_id) + (last_glyphless_glyph_merged_face_id): Make them non-static. + + * w32term.c (x_draw_glyphless_glyph_string_foreground): + Fix the arg with_background for font->driver->draw. + +2010-11-01 Kenichi Handa <handa@m17n.org> + + * w32gui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): + Surround chp by parentheses. + +2010-11-01 Kenichi Handa <handa@m17n.org> + + Implement various display methods for glyphless characters. + + * xdisp.c (Qglyphless_char, Vglyphless_char_display) + (Qglyphless_char_display, Qhexa_code, Qempty_box, Qthin_space) + (Qzero_width): New variables. + (THIN_SPACE_WIDTH): New macro. + (lookup_glyphless_char_display): New funciton. + (last_glyphless_glyph_frame, last_glyphless_glyph_face_id) + (last_glyphless_glyph_merged_face_id): New variables. + (get_next_display_element): Check glyphless characters. + (redisplay_internal): Initialize last_glyphless_glyph_frame and + last_glyphless_glyph_face_id. + (fill_glyphless_glyph_string): New function. + (BUILD_GLYPHLESS_GLYPH_STRING): New macro. + (BUILD_GLYPH_STRINGS): Handle the case GLYPHLESS_GLYPH. + (append_glyphless_glyph, produce_glyphless_glyph): New functions. + (x_produce_glyphs): If a suitable font is not found, produce a + glyphless glyph. Handle the case it->what == IT_GLYPHLESS. + (syms_of_xdisp): Intern and staticpro Qglyphless_char, + Qglyphless_char_display, Qhexa_code, Qempty_box, Qthin_space, and + Qzero_width. + (Vglyphless_char_display): Declare it as a Lisp variable. + + * dispextern.h (enum glyph_type): Add GLYPHLESS_GLYPH. + (struct glyph): Change the size of the member "type" to 3. + Add glyphless to the union slice and u. + (enum display_element_type): Add IT_GLYPHLESS. + (enum glyphless_display_method): New enum. + (struct it): New member glyphless_method. + (Vglyphless_char_display): Extern it. + + * xterm.c (x_draw_glyphless_glyph_string_foreground): New function. + (x_draw_glyph_string): Handle the case GLYPHLESS_GLYPH. + + * w32term.c (x_draw_glyphless_glyph_string_foreground): New function. + (x_draw_glyph_string): Handle the case GLYPHLESS_GLYPH. + + * nsterm.m (ns_draw_glyph_string): Handle the case + GLYPHLESS_GLYPH (the detail is not yet implemented). + +2010-10-31 Glenn Morris <rgm@gnu.org> + + * xterm.c (x_connection_closed) [USE_X_TOOLKIT]: Fix merge, maybe. + + * frame.c (syms_of_frame) <tool-bar-mode>: + Default to nil if !HAVE_WINDOW_SYSTEM. (Bug#7299) + +2010-10-31 Chong Yidong <cyd@stupidchicken.com> + + * xterm.c (x_connection_closed): Print informative error message + when aborting on GTK. This requires using shut_down_emacs + directly instead of Fkill_emacs. + +2010-10-29 Eli Zaretskii <eliz@gnu.org> + + * emacs.c (main): Call syms_of_filelock unconditionally. + + * filelock.c (syms_of_filelock): Move out of #ifdef CLASH_DETECTION + clause, but keep part of it conditioned on CLASH_DETECTION. + +2010-10-29 Glenn Morris <rgm@gnu.org> + + * nsfns.m (Fx-display-save-under, Fx-open-connection) + (Fxw-color-defined-p, Fxw-display-color-p, Fx-show-tip): + * w32fns.c (Fxw_color_defined_p, Fx_open_connection): + * xfns.c (Fxw_color_defined_p, Fx_open_connection): + Sync docs between X, W32, NS. + + * buffer.c (syms_of_buffer) <abbrev-mode, transient-mark-mode>: + * frame.c (syms_of_frame) <tool-bar-mode>: Move doc here from Lisp. + +2010-10-26 Juanma Barranquero <lekktu@gmail.com> + + * eval.c (init_eval_once): Set max_lisp_eval_depth to 600; + otherwise, bootstrapping on Windows fails to compile macroexp.el. + +2010-10-26 Eli Zaretskii <eliz@gnu.org> + + * cmds.c (internal_self_insert): Don't insert if argument N is + zero or negative. (Bug#7281) + +2010-10-26 Jan Djärv <jan.h.d@swipnet.se> + + * gtkutil.c (qttip_cb): Set title to empty for ATK (Bug#7278). + +2010-10-25 Glenn Morris <rgm@gnu.org> + + * Makefile.in (SOME_MACHINE_LISP): Remove easymenu.elc. + +2010-10-24 Glenn Morris <rgm@gnu.org> + + * w32fns.c (Fx_synchronize, Fx_change_window_property) + (Fx_window_property, Fx_file_dialog): + * xfns.c (Fx_synchronize, Fx_change_window_property) + (Fx_window_property, Fx_file_dialog): Sync docs between w32 and X. + +2010-10-24 Chong Yidong <cyd@stupidchicken.com> + + * xterm.c (x_connection_closed): Kill Emacs unconditionally. + +2010-10-24 Eli Zaretskii <eliz@gnu.org> + + * frame.c (Fframep, Fwindow_system): Deprecate use as a predicate. + + * dispnew.c (syms_of_display) <initial-window-system, window-system>: + Deprecate use as a boolean flag. + +2010-10-24 Jim Meyering <jim@meyering.net> + + * emacs.c (argmatch): Don't treat "--" as "--chdir". + +2010-10-24 Glenn Morris <rgm@gnu.org> + + * w16select.c (syms_of_win16select) <selection-coding-system>: + <next-selection-coding-system>: + * w32select.c (syms_of_w32select) <selection-coding-system>: + <next-selection-coding-system>: + Sync docs with select.el. + + * xfaces.c (syms_of_xfaces) <tty-defined-color-alist>: Sync doc with + Lisp version. + + * w32term.c (syms_of_w32term) <x-use-underline-position-properties>: + Sync doc with the xterm.c version. + + * w32term.c (syms_of_w32term) <x-toolkit-scroll-bars>: + * xterm.c (syms_of_xterm) <x-toolkit-scroll-bars>: Sync docs. + +2010-10-23 Glenn Morris <rgm@gnu.org> + + * buffer.c (syms_of_buffer) <cursor-in-non-selected-windows>: + * frame.c (syms_of_frame) <menu-bar-mode>: + * xdisp.c (syms_of_xdisp) <auto-hscroll-mode, display-hourglass>: + <hourglass-delay>: Sync docs with Lisp. + +2010-10-23 Eli Zaretskii <eliz@gnu.org> + + Implement mouse highlight for bidi-reordered lines. + + * xdisp.c (fast_find_string_pos): #ifdef away, not used anymore. + (mouse_face_from_string_pos): New function, replaces + fast_find_string_pos. + (note_mouse_highlight): Call it instead of fast_find_string_pos. + (note_mode_line_or_margin_highlight): Support bidi-reordered + strings and R2L glyph rows. Fix comments. + (note_mouse_highlight): When bidi reordering is turned on in a + buffer, call next-single-property-change and + previous-single-property-change with last argument nil. Clear + mouse highlight when mouse pointer is in a R2L row on the stretch + glyph that stands for no text beyond the line end. + (row_containing_pos): Don't return too early when CHARPOS is in a + bidi-reordered continued line. Return immediately when the first + hit is found in a line that is not continued, or when an exact + match for CHARPOS is found. + (rows_from_pos_range): New function. + (mouse_face_from_buffer_pos): Use it instead of calling + row_containing_pos for START_CHARPOS and END_CHARPOS. Rewrite the + function to support mouse highlight in bidi-reordered lines and + not to assume that START_CHARPOS is always in mouse_face_beg_row. + If necessary, swap mouse_face_beg_row and mouse_face_end_row so + that the former is always above the latter or identical to it. + (show_mouse_face): Support drawing highlighted R2L lines. + (coords_in_mouse_face_p): New function, bidi-aware. + (cursor_in_mouse_face_p, note_mouse_highlight, erase_phys_cursor): + Call it instead of comparing with mouse-face members of dpyinfo. + (note_mode_line_or_margin_highlight): Fix confusingly swapped + usage of hpos and vpos. + +2010-10-22 Jan Djärv <jan.h.d@swipnet.se> + + * xrdb.c: Include keyboard.h for MOTIF. + + * xmenu.c: Revert 2010-07-27 change: lwlib.h is needed for + MOTIF (Bug#7263). + + * xfns.c: Include Xm/TextF and Xm/List. + (file_dialog_cb, file_dialog_unmap_cb, clean_up_file_dialog): + Make ANSI prototypes. + +2010-10-22 Glenn Morris <rgm@gnu.org> + + * Makefile.in (SOME_MACHINE_LISP): Add w32-vars. + Remove ccl and duplicate mouse. + +2010-10-21 Chong Yidong <cyd@stupidchicken.com> + + * insdel.c (prepare_to_modify_buffer): Don't set + saved-region-selection if modification hooks are disabled. + +2010-10-19 Chong Yidong <cyd@stupidchicken.com> + + * cmds.c (Fdelete_char): Doc fix. + +2010-10-19 Ken Brown <kbrown@cornell.edu> + + * s/cygwin.h (SIGNALS_VIA_CHARACTERS): New define (bug#7225). + +2010-10-19 Kenichi Handa <handa@m17n.org> + + Fix incorrect font metrics when the same font is opened with + different pixelsizes. + + * xftfont.c: Include composite.h. + (xftfont_shape): New function. + (syms_of_xftfont): Set xftfont_driver.shape. + +2010-10-18 Julien Danjou <julien@danjou.info> + + * frame.c (Fframe_pointer_visible_p): + Add `frame-pointer-visible-p' to get the pointer visibility. + +2010-10-18 Lars Magne Ingebrigtsen <larsi@gnus.org> + + * gnutls.c (emacs_gnutls_read): Return 0 if we get a + non-"EAGAIN"-like error to signal to Emacs that the socket should + be closed. + 2010-10-15 Eli Zaretskii <eliz@gnu.org> + * unexcoff.c (make_hdr): Fix prototype according to changes in + 2010-10-03T13:59:56Z!dann@ics.uci.edu. + * image.c (tiff_load): Cast 3rd argument to avoid compiler warning. 2010-10-15 Tassilo Horn <tassilo@member.fsf.org> @@ -236,8 +1167,8 @@ anything on any platform. Remove unused code. - * sysdep.c (select_alarm, sys_select, read_input_waiting): Remove - select emulation, all systems support select. + * sysdep.c (select_alarm, sys_select, read_input_waiting): + Remove select emulation, all systems support select. (set_exclusive_use): Remove, the only user is in an #if 0 block. * process.c (create_process): Remove #if 0 code. @@ -302,7 +1233,7 @@ 2010-10-02 Lars Magne Ingebrigtsen <larsi@gnus.org> * xml.c (Flibxml_parse_xml_region, Flibxml_parse_html_region) - (parse_region): Reworked to take regions instead of strings, and + (parse_region): Rework to take regions instead of strings, and renamed to reflect that these are the libxml functions. 2010-10-01 Eli Zaretskii <eliz@gnu.org> @@ -340,7 +1271,8 @@ * msdos.c: * charset.c: Do not include stdlib.h and string.h, config.h does it. - * callproc.c (SIGCHLD): Remove conditional definition, syssignal.h defines it. + * callproc.c (SIGCHLD): Remove conditional definition, syssignal.h + defines it. * process.c: Move #include <pty.h> earlier. (SIGCHLD): Remove conditional definition, syssignal.h defines it. @@ -430,8 +1362,8 @@ (find_last_unchanged_at_beg_row) (find_first_unchanged_at_end_row, row_containing_pos) (trailing_whitespace_p, display_mode_element, decode_mode_spec) - (display_count_lines, x_produce_glyphs, note_mouse_highlight): Use - EMACS_INT for buffer and string positions. + (display_count_lines, x_produce_glyphs, note_mouse_highlight): + Use EMACS_INT for buffer and string positions. * dispextern.h (struct it) <string_nchars>: Declare EMACS_INT. (row_containing_pos): Adjust prototype. @@ -518,7 +1450,7 @@ * dispextern.h (struct glyph): Change the member "slice" to union. Remove u.cmp.from and u.cmp.to. Give more bits to u.cmp.id. - (GLYPH_SLICE_EQUAL_P): Adjusted for the above change. + (GLYPH_SLICE_EQUAL_P): Adjust for the above change. * dispnew.c (buffer_posn_from_coords): Use glyph->slice.img instead of glyph->slice. @@ -714,8 +1646,8 @@ positions. * xdisp.c (redisplay_internal, try_window_id) - (set_cursor_from_row, find_first_unchanged_at_end_row): Use - EMACS_INT for buffer positions. + (set_cursor_from_row, find_first_unchanged_at_end_row): + Use EMACS_INT for buffer positions. * dispextern.h (set_cursor_from_row): Adjust prototype. @@ -725,8 +1657,8 @@ positions. * dispextern.h (mode_line_string, marginal_area_string) - (increment_matrix_positions, increment_row_positions): Adjust - prototypes. + (increment_matrix_positions, increment_row_positions): + Adjust prototypes. * data.c (Faref, Faset): Use EMACS_INT for string length and positions. @@ -739,8 +1671,8 @@ * syntax.c (scan_words, update_syntax_table) (prev_char_comend_first, back_comment, skip_chars) - (skip_syntaxes, Fforward_comment, Fbackward_prefix_chars): Use - EMACS_INT for buffer and string positions. + (skip_syntaxes, Fforward_comment, Fbackward_prefix_chars): + Use EMACS_INT for buffer and string positions. * syntax.h (scan_words, update_syntax_table): Adjust prototypes. @@ -788,8 +1720,8 @@ (modify_overlay, Fmove_overlay, report_overlay_modification) (evaporate_overlays): Use EMACS_INT for buffer positions. - * lisp.h (fix_start_end_in_overlays, overlay_touches_p): Adjust - prototypes. + * lisp.h (fix_start_end_in_overlays, overlay_touches_p): + Adjust prototypes. * dispextern.h (struct bidi_saved_info): Use EMACS_INT for buffer positions. @@ -880,13 +1812,13 @@ * indent.c (compute_motion): Use EMACS_INT for arguments to region_cache_forward. - * region-cache.c (struct boundary, struct region_cache): Use - EMACS_INT for positions. + * region-cache.c (struct boundary, struct region_cache): + Use EMACS_INT for positions. (find_cache_boundary, move_cache_gap, insert_cache_boundary) (delete_cache_boundaries, set_cache_region) (invalidate_region_cache, know_region_cache) - (region_cache_forward, region_cache_backward, pp_cache): Use - EMACS_INT for buffer positions. + (region_cache_forward, region_cache_backward, pp_cache): + Use EMACS_INT for buffer positions. * region-cache.h (know_region_cache, invalidate_region_cache) (region_cache_forward, region_cache_backward): Adjust prototypes. @@ -907,8 +1839,8 @@ (Fline_beginning_position, Fline_end_position, Fprevious_char) (Fchar_after, Fchar_before, Finsert_char) (Finsert_buffer_substring, Fcompare_buffer_substrings) - (Fsubst_char_in_region, Fformat, Ftranspose_regions): Use - EMACS_INT for buffer and string position variables. + (Fsubst_char_in_region, Fformat, Ftranspose_regions): + Use EMACS_INT for buffer and string position variables. (Finsert_char): Protect against too large insertions. * lisp.h (clip_to_bounds): Adjust prototype. @@ -945,8 +1877,8 @@ * editfns.c (Fformat): Use EMACS_INT for string size variables. - * xdisp.c (store_mode_line_noprop, display_mode_element): Use - EMACS_INT for string positions. + * xdisp.c (store_mode_line_noprop, display_mode_element): + Use EMACS_INT for string positions. * intervals.c (get_property_and_range): Use EMACS_INT for buffer position arguments. @@ -956,13 +1888,13 @@ * character.c (parse_str_as_multibyte, str_as_multibyte) (parse_str_to_multibyte, str_to_multibyte, str_as_unibyte) (string_count_byte8, string_escape_byte8, c_string_width) - (strwidth, lisp_string_width, multibyte_chars_in_text): Use - EMACS_INT for string length variables and arguments. + (strwidth, lisp_string_width, multibyte_chars_in_text): + Use EMACS_INT for string length variables and arguments. * character.h (parse_str_as_multibyte, str_as_multibyte) (parse_str_to_multibyte, str_to_multibyte, str_as_unibyte) - (c_string_width, strwidth, lisp_string_width): Adjust - prototypes. + (c_string_width, strwidth, lisp_string_width): + Adjust prototypes. * font.c (font_intern_prop): Use EMACS_INT for string length variables. @@ -982,8 +1914,8 @@ (allocate_string_data, compact_small_strings, Fmake_string) (Fmake_bool_vector, make_string, make_unibyte_string) (make_multibyte_string, make_string_from_bytes) - (make_specified_string_string, Fmake_list, Fmake_vector): Use - EMACS_INT for string length variables and arguments. + (make_specified_string_string, Fmake_list, Fmake_vector): + Use EMACS_INT for string length variables and arguments. (find_string_data_in_pure, make_pure_string, make_pure_c_string) (Fpurecopy): Use EMACS_INT for string size. (mark_vectorlike, mark_char_table, mark_object): Use EMACS_UINT @@ -1248,8 +2180,8 @@ 2010-09-04 Eli Zaretskii <eliz@gnu.org> - * w32uniscribe.c (uniscribe_shape): Update commentary. Don't - try to reorder grapheme clusters, since LGSTRING should always + * w32uniscribe.c (uniscribe_shape): Update commentary. + Don't try to reorder grapheme clusters, since LGSTRING should always hold them in the logical order. (uniscribe_encode_char, uniscribe_shape): Force ScriptShape to return glyph codes in the logical order. @@ -1448,16 +2380,16 @@ Do not define EMACS_HAVE_TTY_PGRP. Only define EMACS_GET_TTY_PGRP for !DOS_NT. * sysdep.c: Include sysselect.h unconditionally. Do not include - sys/ioctl.h and termios.h, systty.h does it. Use - HAVE_SYS_UTSNAME_H instead of USG as an include guard. + sys/ioctl.h and termios.h, systty.h does it. + Use HAVE_SYS_UTSNAME_H instead of USG as an include guard. (init_baud_rate): Remove HAVE_TERMIO code. (child_setup_tty): Remove HAVE_TERMIO code. (emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS code. Use !DOS_NT instead of HAVE_TCATTR. (new_ltchars, new_tchars): Remove, unused. (init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS - code. Remove special casing for __mips__, it was a no-op. Remove - HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS. + code. Remove special casing for __mips__, it was a no-op. + Remove HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS. (init_sys_modes): Remove HPUX special case. * process.c: Include stdlib.h unconditionally. Do not include fcntl.h, systty.h does it. Remove conditional code for @@ -2181,8 +3113,8 @@ (initial_argv, last_nonmenu_event, load_in_progress) (noninteractive_need_newline, scroll_margin): Add declarations. - * keyboard.h (xmalloc_widget_value, digest_single_submenu): Remove - declarations, menu.h has them. + * keyboard.h (xmalloc_widget_value, digest_single_submenu): + Remove declarations, menu.h has them. (QCbutton, QCtoggle, QCradio, QClabel, extra_keyboard_modifiers) (Vinput_method_function, Qinput_method_function) (Qevent_symbol_element_mask, last_event_timestamp): @@ -2489,8 +3421,8 @@ * term.c (Qspace, QCalign_to, QCwidth): Remove declarations. (encode_terminal_code, produce_composite_glyph): Remove unused variables. - (set_tty_color_mode, term_mouse_highlight, term_get_fkeys): Remove - local extern declarations. + (set_tty_color_mode, term_mouse_highlight, term_get_fkeys): + Remove local extern declarations. * xmenu.c: Do not included lwlib.h, not needed. @@ -2855,8 +3787,8 @@ (cvt_pixel_dtor, x_window_to_menu_bar, xt_action_hook) (xaw_jump_callback, xaw_scroll_callback) (x_create_toolkit_scroll_bar, x_set_toolkit_scroll_bar_thumb) - (x_wm_set_size_hint, x_activate_timeout_atimer): Convert - definitions to standard C. + (x_wm_set_size_hint, x_activate_timeout_atimer): + Convert definitions to standard C. * xmenu.c (menubar_id_to_frame, popup_get_selection) (popup_activate_callback, popup_deactivate_callback) (menu_highlight_callback, menubar_selection_callback) @@ -2969,7 +3901,7 @@ (Ffont_put): Accept font-entity and font-object too. (Ffont_get_glyhphs): Renamed from Fget_font_glyphs. Arguments and return value changed. - (syms_of_font): Adjusted for the above change. + (syms_of_font): Adjust for the above change. 2010-07-11 Andreas Schwab <schwab@linux-m68k.org> @@ -3060,8 +3992,8 @@ * frame.c (make_frame): Initialize menu_bar_lines and tool_bar_lines members. - (make_initial_frame, make_terminal_frame): Initialize - menu_bar_lines using value of menu-bar-mode. + (make_initial_frame, make_terminal_frame): + Initialize menu_bar_lines using value of menu-bar-mode. * msdos.c (IT_set_frame_parameters): Don't set menu-bar-lines. @@ -3509,8 +4441,8 @@ * xsmfns.c (SSDATA): New macro. (smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings passed to strlen/strcpy/strcat. - (create_client_leader_window): Surround with #ifndef USE_GTK. Cast - 7:th arg to XChangeProperty to (unsigned char *). + (create_client_leader_window): Surround with #ifndef USE_GTK. + Cast 7:th arg to XChangeProperty to (unsigned char *). * xsettings.c (something_changedCB, parse_settings) (apply_xft_settings): Reformat prototype. @@ -3668,8 +4600,8 @@ * msdos.c (IT_set_frame_parameters): Fix setting of colors in frames other than the initial one. Fix reversal of colors when - `reverse' is specified in the frame parameters. Call - update_face_from_frame_parameter instead of + `reverse' is specified in the frame parameters. + Call update_face_from_frame_parameter instead of internal-set-lisp-face-attribute. Initialize screen colors from initial_screen_colors[] when f->default_face_done_p is zero, instead of depending on being called with default-frame-alist as @@ -3854,8 +4786,8 @@ 2010-06-30 Chong Yidong <cyd@stupidchicken.com> - * frame.c (get_future_frame_param, Fmake_terminal_frame): Don't - check default-frame-alist. + * frame.c (get_future_frame_param, Fmake_terminal_frame): + Don't check default-frame-alist. 2010-06-30 Andreas Schwab <schwab@linux-m68k.org> @@ -3947,8 +4879,8 @@ (Bug#6526). * xterm.h (gtk_widget_get_window, gtk_widget_get_mapped) - (gtk_adjustment_get_page_size, gtk_adjustment_get_upper): New - defines based on what configure finds. + (gtk_adjustment_get_page_size, gtk_adjustment_get_upper): + New defines based on what configure finds. * xterm.c (XTflash): Use gtk_widget_get_window. (xg_scroll_callback): Use gtk_adjustment_get_upper and @@ -3962,8 +4894,8 @@ * gtkutil.h: Replace HAVE_GTK_FILE_BOTH with HAVE_GTK_FILE_SELECTION_NEW. - * gtkutil.c (xg_display_open, xg_display_close): Remove - HAVE_GTK_MULTIDISPLAY, it is always defined. + * gtkutil.c (xg_display_open, xg_display_close): + Remove HAVE_GTK_MULTIDISPLAY, it is always defined. (xg_display_open): Return type is void. (gtk_widget_set_has_window) (gtk_dialog_get_action_area, gtk_dialog_get_content_area) @@ -3972,8 +4904,8 @@ (gtk_adjustment_get_step_increment): #define these if not found by configure. (remove_submenu): New define based on Gtk+ version. - (xg_set_cursor, xg_frame_resized, xg_event_is_for_scrollbar): Use - gtk_widget_get_window. + (xg_set_cursor, xg_frame_resized, xg_event_is_for_scrollbar): + Use gtk_widget_get_window. (xg_frame_resized, xg_update_frame_menubar): Use gtk_widget_get_mapped. (xg_create_frame_widgets): Use gtk_widget_set_has_window. (create_dialog): Use gtk_dialog_get_action_area and @@ -3981,10 +4913,10 @@ (xg_uses_old_file_dialog, xg_get_file_name): Remove HAVE_GTK_FILE_BOTH and HAVE_GTK_FILE_CHOOSER_DIALOG_NEW. File chooser is always available, so checking for HAVE_GTK_FILE_SELECTION_NEW is enough. - (xg_update_menubar, xg_update_submenu, xg_show_toolbar_item): Use - g_object_ref and g_object_unref. - (xg_update_menu_item, xg_tool_bar_menu_proxy): Use - gtk_widget_get_sensitive. + (xg_update_menubar, xg_update_submenu, xg_show_toolbar_item): + Use g_object_ref and g_object_unref. + (xg_update_menu_item, xg_tool_bar_menu_proxy): + Use gtk_widget_get_sensitive. (xg_update_submenu): Use remove_submenu. (xg_update_scrollbar_pos): Don't use GtkFixedChild, use child properties instead to get old x and y position. @@ -4517,8 +5449,8 @@ Move static/dynamic dependency stuff to deps.mk/autodeps.mk. * deps.mk, autodeps.mk: New files, extracted from Makefile.in. - * bidi.c (bidi_cache_shrink, bidi_cache_iterator_state): Fix - reallocation of the cache. (Bug#6210) + * bidi.c (bidi_cache_shrink, bidi_cache_iterator_state): + Fix reallocation of the cache. (Bug#6210) 2010-05-19 Glenn Morris <rgm@gnu.org> @@ -5225,8 +6157,8 @@ Reduce CPP usage. * Makefile.in (LIB_X11_LIB): Remove, inline in the only user. (obj): Use autoconf for unexec instead of cpp. - (C_SWITCH_SYSTEM, C_SWITCH_MACHINE, C_SWITCH_X_SITE): Remove - definitions and undefs. Inline definitions in the only user. + (C_SWITCH_SYSTEM, C_SWITCH_MACHINE, C_SWITCH_X_SITE): + Remove definitions and undefs. Inline definitions in the only user. (ALL_CFLAGS): Substitute C_SWITCH_X_SYSTEM using autoconf. 2010-04-27 Glenn Morris <rgm@gnu.org> @@ -5337,8 +6269,8 @@ the only user: s/unixware.h. * ecrt0.c: Remove #ifndef static. Inline CRT0_DUMMIES definition from m/intel386.h. - * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): Definitions - moved here from m/intel386.h. + * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): + Definitions moved here from m/intel386.h. * m/mips.h: Remove #if 0 code. @@ -5420,14 +6352,14 @@ HAVE_XFT. (something_changedCB): store_font_changed_event is now store_config_changed_event. - (parse_settings): Rename from parse_xft_settings. Read - non-xft xsettings outside #ifdef HAVE_XFT. + (parse_settings): Rename from parse_xft_settings. + Read non-xft xsettings outside #ifdef HAVE_XFT. (read_settings): Renamed from read_xft_settings. (apply_xft_settings): Take current settings as parameter. Do not call read_(xft)_settings. (read_and_apply_settings): New function. - (xft_settings_event): Do non-xft stuff out of HAVE_XFT. Call - read_and_apply_settings if there are settings to be read. + (xft_settings_event): Do non-xft stuff out of HAVE_XFT. + Call read_and_apply_settings if there are settings to be read. (init_xsettings): Renamed from init_xfd_settings. Call read_and_apply_settings unconditionally. (xsettings_initialize): Call init_xsettings. @@ -5555,19 +6487,19 @@ * xdisp.c [HAVE_WINDOW_SYSTEM]: Add prototype for append_stretch_glyph. - (set_cursor_from_row) <cursor_x>: Remove unused variable. Fix - off-by-one error in computing x at end of text in the row. + (set_cursor_from_row) <cursor_x>: Remove unused variable. + Fix off-by-one error in computing x at end of text in the row. (append_stretch_glyph): In reversed row, prepend the glyph rather than append it. Set resolved_level and bidi_type of the glyph. (extend_face_to_end_of_line): If the row is reversed, prepend a stretch glyph whose width is such that the rightmost glyph will be drawn at the right margin of the window. Fix off-by-one error on - TTY frames in testing whether a line needs face extension. Fix - face extension at ZV. If this is the last glyph row, use + TTY frames in testing whether a line needs face extension. + Fix face extension at ZV. If this is the last glyph row, use DEFAULT_FACE_ID, to avoid painting the rest of the window with the region face. - (set_cursor_from_row, display_line): Use - MATRIX_ROW_CONTINUATION_LINE_P instead of testing value of + (set_cursor_from_row, display_line): + Use MATRIX_ROW_CONTINUATION_LINE_P instead of testing value of row->continuation_lines_width. (next_element_from_buffer): Don't call bidi_paragraph_init if we are at ZV. Fixes a crash when reseated to ZV by @@ -5933,8 +6865,8 @@ * xmenu.c: include xsettings.h and xlwmenu.h if USE_LUCID. (apply_systemfont_to_menu): New function. - (set_frame_menubar, create_and_show_popup_menu): Call - apply_systemfont_to_menu. + (set_frame_menubar, create_and_show_popup_menu): + Call apply_systemfont_to_menu. 2010-04-07 Jan Djärv <jan.h.d@swipnet.se> @@ -5962,8 +6894,8 @@ 2010-04-03 Eli Zaretskii <eliz@gnu.org> - * bidi.c (bidi_resolve_explicit, bidi_level_of_next_char): Check - bidi_it->bytepos against ZV_BYTE instead of bidi_it->ch against + * bidi.c (bidi_resolve_explicit, bidi_level_of_next_char): + Check bidi_it->bytepos against ZV_BYTE instead of bidi_it->ch against BIDI_EOB. Fixes infloop with vertical cursor motion at ZV. * w32fns.c (x_create_tip_frame): Copy `parms' before we modify it @@ -6186,8 +7118,8 @@ (prepare_desired_row): Preserve the reversed_p flag. (row_equal_p): Compare the reversed_p attributes as well. - * xdisp.c (init_iterator): Initialize it->bidi_p. Call - bidi_init_it and set it->paragraph_embedding from the current + * xdisp.c (init_iterator): Initialize it->bidi_p. + Call bidi_init_it and set it->paragraph_embedding from the current buffer's value of bidi_paragraph_direction. (reseat_1): Initialize bidi_it.first_elt. (set_iterator_to_next, next_element_from_buffer): Use the value of @@ -6198,8 +7130,8 @@ (next_element_from_buffer): If bidi_it.first_elt is set, initialize paragraph direction and find the first character to display in the visual order. If reseated to a middle of a line, - prime the bidi iterator starting at the line's beginning. Handle - the situation where we overstepped stop_charpos due to + prime the bidi iterator starting at the line's beginning. + Handle the situation where we overstepped stop_charpos due to non-linearity of the bidi iteration. Likewise for when we back up beyond the previous stop_charpos. When moving across stop_charpos, record it in prev_stop. @@ -6220,8 +7152,8 @@ now EMACS_INT; all callers changed. (set_cursor_from_row): Rewritten to support bidirectional text and reversed glyph rows. - (text_outside_line_unchanged_p, try_window_id): Disable - optimizations if we are reordering bidirectional text and the + (text_outside_line_unchanged_p, try_window_id): + Disable optimizations if we are reordering bidirectional text and the paragraph direction can be affected by the change. (append_glyph, append_composite_glyph) (produce_image_glyph, append_stretch_glyph): Set the @@ -8374,8 +9306,8 @@ 2009-09-18 Adrian Robert <Adrian.B.Robert@gmail.com> * emacs.c (inhibit_x_resources): Update doc string for NS. - (main) [HAVE_NS]: Don't process --no-init-file option. Remove - legacy code for -NXHost. Fix error printf in daemon case. + (main) [HAVE_NS]: Don't process --no-init-file option. + Remove legacy code for -NXHost. Fix error printf in daemon case. * nsterm.h (ns_no_defaults): Remove. @@ -8384,8 +9316,8 @@ (ns_use_qd_smoothing): Remove legacy variable. (EmacsView-windowShouldZoom:): Set frame left_pos, top_pos and don't update the NSWindow itself. - (EmacsView-windowWillUseStandardFrame:defaultFrame:): Improve - state detection and store user rect ourselves. (Bug #3581) + (EmacsView-windowWillUseStandardFrame:defaultFrame:): + Improve state detection and store user rect ourselves. (Bug #3581) * nsfont.m (nsfont_draw) [NS_IMPL_COCOA]: Don't use ns_use_qd_smoothing. @@ -8688,8 +9620,8 @@ 2009-08-21 Adrian Robert <Adrian.B.Robert@gmail.com> * nsterm.m (ns_get_color): Update documentation properly for last - change, and clean up loose ends in the code left by it. Fix - longstanding bug with 16-bit hex parsing, and add support for + change, and clean up loose ends in the code left by it. + Fix longstanding bug with 16-bit hex parsing, and add support for yet another X11 format (rgb:r/g/b) for compatibility. * nsfns.m (EmacsDialogPanel-runDialogAt): Add declaration of timer_check() to avoid crash on Leopard/PPC. Bug #2154. @@ -10584,8 +11516,8 @@ (Fdefine_coding_system_internal): Likewise. (setup_coding_system): Likewise. Remove unneeded casts. (detect_coding_iso_2022): Compare Viso_2022_charset_list with - CODING_ATTR_CHARSET_LIST, not CODING_ATTR_SAFE_CHARSETS. Remove - unneeded casts. + CODING_ATTR_CHARSET_LIST, not CODING_ATTR_SAFE_CHARSETS. + Remove unneeded casts. * insdel.c (del_range_2): Don't modify gap contents when called from decode_coding_object. (Bug#1809) @@ -10598,8 +11530,8 @@ * lisp.h: Define Qfont_spec, Qfont_entity, Qfont_object extern. - * font.c (Qfont_spec, Qfont_entity, Qfont_object): Definitions - moved to data.c. + * font.c (Qfont_spec, Qfont_entity, Qfont_object): + Definitions moved to data.c. 2009-02-20 Adrian Robert <Adrian.B.Robert@gmail.com> @@ -11615,8 +12547,8 @@ here; it will be done in init_frame_faces. * xterm.h (struct xim_inst_t): Definition moved from xterm.c. - (struct x_display_info): Remove unused member null_pixel. New - member xim_callback_data. + (struct x_display_info): Remove unused member null_pixel. + New member xim_callback_data. * xterm.c (struct xim_inst_t): Definition moved to xterm.h. (xim_initialize): Save pointer to callback function data. @@ -11641,8 +12573,8 @@ 2008-12-12 Jason Rumney <jasonr@gnu.org> - * w32fns.c (x_display_info_for_name, Fx_open_connection): Set - Vwindow_system_version to the real w32 major version. + * w32fns.c (x_display_info_for_name, Fx_open_connection): + Set Vwindow_system_version to the real w32 major version. 2008-12-12 Dan Nicolaescu <dann@ics.uci.edu> @@ -11892,7 +12824,7 @@ (set_category_set): Extern it. * category.c (hash_get_category_set): New function. - (Fmodify_category_entry): Adjusted for the change of + (Fmodify_category_entry): Adjust for the change of char_table_ref_and_range. Call hash_get_category_set to get a category set to store in the table. @@ -11910,8 +12842,8 @@ (SET_TEMP_CHARSET_WORK_ENCODER, GET_TEMP_CHARSET_WORK_ENCODER) (SET_TEMP_CHARSET_WORK_DECODER, GET_TEMP_CHARSET_WORK_DECODER): New macros. - (load_charset_map): Meaning of control_flag changed. If - inhibit_load_charset_map is nonzero, setup a table in + (load_charset_map): Meaning of control_flag changed. + If inhibit_load_charset_map is nonzero, setup a table in temp_charset_work. (load_charset): New argument control_flag. (map_charset_for_dump): New function. @@ -11930,18 +12862,18 @@ (syms_of_charset): Make `inhibit-load-charset-map' a Lisp variable. - * chartab.c (sub_char_table_ref_and_range): Adjusted for the + * chartab.c (sub_char_table_ref_and_range): Adjust for the change of char_table_ref_and_range. (char_table_ref_and_range): Change the meaning of argument FROM and TO. Now the caller must provide initial values for *FROM and *TO. - * fontset.c (fontset_add): Adjusted for the change of + * fontset.c (fontset_add): Adjust for the change of char_table_ref_and_range. (fontset_get_font_group): Likewise. (Ffontset_info): Likewise. - * keymap.c (describe_vector): Adjusted for the change of + * keymap.c (describe_vector): Adjust for the change of char_table_ref_and_range. For char-table, put boundary between non-ASCII and 8-bit characters. @@ -13755,8 +14687,8 @@ * s/darwin.h: Add #define DARWIN_OS. Get rid of C_SWITCH_SYSTEM def. Change LIBS_MACGUI to LIBS_NSGUI. Move temacs-conditionalized defs - closer to C_SWITCH_SYSTEM_TEMACS so usage is understood. Expand - comment on NO_SOCK_SIGIO. + closer to C_SWITCH_SYSTEM_TEMACS so usage is understood. + Expand comment on NO_SOCK_SIGIO. 2008-08-03 Chong Yidong <cyd@stupidchicken.com> @@ -14748,8 +15680,8 @@ 2008-07-15 Chris Hall <chris@web.workinglinux.com> (tiny change) - * callproc.c (set_initial_environment): Initialize - Vprocess_environment under CANNOT_DUMP (fixes crash when + * callproc.c (set_initial_environment): + Initialize Vprocess_environment under CANNOT_DUMP (fixes crash when batch-compiling for bootstrap). 2008-07-15 Chris Hall <chris@web.workinglinux.com> (tiny change) @@ -15165,8 +16097,8 @@ * xftfont.c (struct xftfont_info): New member ft_size. Make the member order compatible with struct ftfont_info. - (xftfont_open): Add FC_CHARSET to the pattern. Set - xftfont_info->ft_size. Don't unlock the face. Check BDF + (xftfont_open): Add FC_CHARSET to the pattern. + Set xftfont_info->ft_size. Don't unlock the face. Check BDF properties if appropriate. (xftfont_close): Unlock the face. (xftfont_anchor_point, xftfont_shape): Deleted. @@ -15592,8 +16524,8 @@ truncate only if the window width is below that integer. (start_display, resize_mini_window, produce_stretch_glyph) (display_string, move_it_in_display_line_to): Use line_wrap. - (back_to_previous_visible_line_start, reseat_1): Reset - string_from_display_prop_p. + (back_to_previous_visible_line_start, reseat_1): + Reset string_from_display_prop_p. (display_line): Extend default face to end of line when wrapping. 2008-06-24 Kim F. Storm <storm@cua.dk> @@ -16961,8 +17893,8 @@ (struct glyph_string): New member underline_position and underline_thickness. (enum lface_attribute_index): Remove LFACE_AVGWIDTH_INDEX. - (struct face): Change type of `font' to `struct font *'. Remove - members `font_name', `font_info_id'. + (struct face): Change type of `font' to `struct font *'. + Remove members `font_name', `font_info_id'. (per_char_metric, encode_char): Delete externs. (calc_pixel_width_or_height): Adjust the prototype. @@ -16990,8 +17922,8 @@ (CHECK_FONT_GET_OBJECT): Likewise. (XFONT_SPEC, XFONT_ENTITY, XFONT_OBJECT, XSETFONT): New macros. (PT_PER_INCH, POINT_TO_PIXEL, PIXEL_TO_POINT): Moved from font.h. - (struct font_driver): New members case_sensitive anc check. Type - of the member list and open changed. + (struct font_driver): New members case_sensitive anc check. + Type of the member list and open changed. (enable_font_backend, font_symbolic_weight, font_symbolic_slant) (font_symbolic_width, font_find_object, font_get_spec) (font_set_lface_from_name): Delete extern. @@ -17011,7 +17943,7 @@ (font_make_spec, font_make_entity, font_make_object) (font_intern_prop): Renamed from intern_downcase. Don't downcase the string. Callers changed. - (font_pixel_size): Adjusted for the format change of font-related + (font_pixel_size): Adjust for the format change of font-related objects. (prop_name_to_numeric, prop_numeric_to_name): Delete them. (font_style_to_value, font_style_symbolic): New function. @@ -17019,19 +17951,19 @@ (font_registry_charsets): Use Fassoc_string instead of assq_no_quit. (font_prop_validate_symbol): Don't return null_string. - (font_prop_validate_style): Adjusted for the change of + (font_prop_validate_style): Adjust for the change of style-related values in a font vector. (font_property_table): Delete entries for QClanguage and QCantialias, add entries for QCavgwidth. (get_font_prop_index): Delete the 2nd argument FROM. (font_prop_validate): Arguments changed. - (font_put_extra): Adjusted for the change of font-related objects. + (font_put_extra): Adjust for the change of font-related objects. (font_expand_wildcards, font_parse_xlfd, font_unparse_xlfd) (font_parse_fcname, font_unparse_fcname) (font_prepare_composition): Likewise. (font_parse_family_registry): Renamed from font_merge_old_spec. (otf_open): Delete the 1st arg entity. - (font_otf_capability): Adjusted for the above change. + (font_otf_capability): Adjust for the above change. (font_score): New arg alternate_families. Adjusted for the change of font-related objects. (font_sort_entites): New arg best_only. @@ -17040,27 +17972,27 @@ (font_match_p): Check alternate families. (font_find_object): Delete it. (font_check_object): New function. - (font_clear_cache): Adjusted for the change of font-related objects. + (font_clear_cache): Adjust for the change of font-related objects. (font_delete_unmatched): New arg. (font_list_entities): Call font_driver->list with a spec that doesn't specify style-related properties. (font_matching_entity): Arguments changed. Caller changed. - (font_open_entity): Adjusted for the change of font-related objects. + (font_open_entity): Adjust for the change of font-related objects. (font_close_object, font_has_char, font_encode_char) (font_get_name, font_get_spec): Likewise. (font_spec_from_name, font_clear_prop, font_update_lface): New functions. (font_find_for_lface, font_open_for_lface, font_load_for_lface) (font_prepare_for_face, font_done_for_face, font_open_by_name) - (font_at): Adjusted for the change of font-related objects. + (font_at): Adjust for the change of font-related objects. (font_range): New function. (Ffontp, Ffont_spec, Ffont_get, Ffont_put, Flist_fonts) - (Ffont_xlfd_name): Adjusted for the change of font-related objects. + (Ffont_xlfd_name): Adjust for the change of font-related objects. (Fcopy_font_spec, Fmerge_font_spec): New function. (Ffont_family_list): Renamed from list-families. (Finternal_set_font_style_table): Arguments changed. (Ffont_fill_gstring, Ffont_shape_text, Fopen_font) - (Ffont_drive_otf, Fquery_font, Ffont_match_p): Adjusted for the + (Ffont_drive_otf, Fquery_font, Ffont_match_p): Adjust for the change of font-related objects. (syms_of_font): Delete "ifdef USE_FONT_BACKEND". DEFSYM new symbols. @@ -17070,8 +18002,8 @@ (enum FONT_SPEC_INDEX): Delete it. (font_info, list_fonts_func, load_font_func, query_font_func) (set_frame_fontset_func, find_ccl_program_func) - (get_font_repertory_func, new_fontset_from_font_name): Delete - externs. + (get_font_repertory_func, new_fontset_from_font_name): + Delete externs. (fontset_from_font_name): Extern it. (FS_LOAD_FONT, FONT_INFO_ID, FONT_INFO_FROM_ID) (FONT_INFO_FROM_FACE): Deleted. @@ -17101,7 +18033,7 @@ (face_for_char): Likewise. Call face_for_char with font_object. (fs_load_font): Delete. Delete #pragma surrounding it. (fs_query_fontset): Use strcasecmp instead of strcmp. - (generate_ascii_font_name): Adjusted for the format change of + (generate_ascii_font_name): Adjust for the format change of font-spec. (Fset_fontset_font): Likewise. Use new macros to set elements of font-def. @@ -17112,7 +18044,7 @@ a fontset is already created for the font. FIx updating of Vfontset_alias_alist. (fontset_ascii_font): Deleted. - (Ffont_info): Adjusted for the format change of font-spec. + (Ffont_info): Adjust for the format change of font-spec. (Finternal_char_font): Likewise. (Ffontset_info): Likewise. (syms_of_fontset): Don't check load_font_func. @@ -17128,13 +18060,13 @@ (x_set_font_backend): Use FRAME_FONT macro to check if a font is already set for the frame. - * ftfont.c (ftfont_pattern_entity): Argument FRAME removed. Make - a font-entity by font_make_entity. Use font_intern_prop instead + * ftfont.c (ftfont_pattern_entity): Argument FRAME removed. + Make a font-entity by font_make_entity. Use font_intern_prop instead of intern_downcase. Use FONT_SET_STYLE to set a style-related font property. If a font is scalable, set avgwidth property to 0. Set font-entity property by font_put_extra. (ftfont_list_generic_family): Argument SPEC and REGISTRY removed. - (ffont_driver): Adjusted for the change of struct font_driver. + (ffont_driver): Adjust for the change of struct font_driver. (ftfont_spec_pattern): New function. (ftfont_list): Return a list, not vector. (ftfont_match): Use ftfont_spec_pattern to get a pattern. @@ -17145,7 +18077,7 @@ font property. Don't update dpyinfo->smallest_font_height and dpyinfo->smallest_char_width. (ftfont_close): Don't free `struct font'. - (ftfont_has_char): Adjusted for the format change of font-entity. + (ftfont_has_char): Adjust for the format change of font-entity. (ftfont_encode_char, ftfont_text_extents): Likewise. * ftxfont.c (ftxfont_list): Return a list, not vector. @@ -17154,10 +18086,10 @@ font property. Don't update dpyinfo->smallest_font_height and dpyinfo->smallest_char_width. (ftxfont_close): Don't decrease FRAME_X_DISPLAY_INFO (f)->n_fonts. - (ftxfont_draw): Adjusted for the change of struct font. + (ftxfont_draw): Adjust for the change of struct font. - * image.c (image_ascent): Don't include "charset.h". Include - "character.h" and "font.h". + * image.c (image_ascent): Don't include "charset.h". + Include "character.h" and "font.h". * lisp.h (enum pvec_type): New member PREV_FONT. (Fassoc_string): EXFUN it. @@ -17175,19 +18107,19 @@ 'struct font *'. (get_char_face_and_encoding): Assign the whole encoding task to the `encode-char' method of a font driver. - (fill_composite_glyph_string): Adjusted for the change of `struct + (fill_composite_glyph_string): Adjust for the change of `struct face' and `struct glyph_string'. (fill_glyph_string): Likewise. (get_per_char_metric): Arguments changed. - (x_get_glyph_overhangs): Adjusted for the change of `struct face' + (x_get_glyph_overhangs): Adjust for the change of `struct face' and `struct glyph_string'. (produce_stretch_glyph, calc_line_height_property) (x_produce_glyphs): Likewise. * xfaces.c: Throughout the file, delete all USE_FONT_BACKEND conditionals. Don't check enable_font_backend. Delete all codes - used only when USE_FONT_BACKEND is not defined. Use - FONT_XXX_NAME_NUMERIC instead of face_numeric_xxx. + used only when USE_FONT_BACKEND is not defined. + Use FONT_XXX_NAME_NUMERIC instead of face_numeric_xxx. (QCfoundry, QCadstyle, QCregistry, QCspacing, QCsize, QCavgwidth) (Qp): Extern them. (clear_font_table, load_face_font, xlfd_lookup_field_contents): @@ -17260,7 +18192,7 @@ (xfont_query_font): Deleted. (xfont_find_ccl_program): Renamed from x_find_ccl_program and moved from xterm.c. - (xfont_driver): Adjusted for the change of struct font_driver. + (xfont_driver): Adjust for the change of struct font_driver. (compare_font_names): New function. (xfont_list_pattern): Sort font names case insensitively. Make font_entity by calling font_make_entity. Avoid auto-scaled fonts. @@ -17272,16 +18204,16 @@ font property. Don't update dpyinfo->smallest_font_height and dpyinfo->smallest_char_width. (xfont_close): Don't free struct font. - (xfont_prepare_face): Adjusted for the change of struct font. + (xfont_prepare_face): Adjust for the change of struct font. (xfont_done_face): Deleted. - (xfont_has_char): Adjusted for the change of struct font. + (xfont_has_char): Adjust for the change of struct font. (xfont_encode_char, xfont_draw): Likewise. (xfont_check): New function. - * xftfont.c (xftfont_list): Adjusted for the change of `list' + * xftfont.c (xftfont_list): Adjust for the change of `list' callback function. - (xftfont_match): Adjusted for the format change of font-entity. - (xftfont_open): Adjusted for the format change of font-entity and + (xftfont_match): Adjust for the format change of font-entity. + (xftfont_open): Adjust for the format change of font-entity and font-object. Adjusted for the change of struct font. Return a font-object. Don't update dpyinfo->smallest_font_height and dpyinfo->smallest_char_width. @@ -17305,7 +18237,7 @@ used only when USE_FONT_BACKEND is not defined. Don't include ccl.h. (x_per_char_metric, x_encode_char): Deleted. (x_set_cursor_gc, x_set_mouse_face_gc): Don't set GCFont. - (x_compute_glyph_string_overhangs): Adjusted for the change of + (x_compute_glyph_string_overhangs): Adjust for the change of `struct face'. (x_draw_glyph_string_foreground) (x_draw_composite_glyph_string_foreground): Likewise. @@ -17317,7 +18249,7 @@ (x_font_min_bounds, x_compute_min_glyph_bounds, x_load_font) (x_query_font, x_get_font_repertory): Deleted. (x_find_ccl_program): Renamed and moved to xfont.c. - (x_redisplay_interface): Adjusted for the change of `struct + (x_redisplay_interface): Adjust for the change of `struct redisplay_interface'. * w32fns.c: Throughout the file, delete all USE_FONT_BACKEND @@ -17352,19 +18284,19 @@ Use FONT_SET_STYLE to set a style-related font property. If a font is scalable, set avgwidth property to 0. Set font-entity property by font_put_extra. - (font_matches_spec): Adjusted for the format change of font-entity. + (font_matches_spec): Adjust for the format change of font-entity. (w32_weight_table, w32_decode_weight): New variables. (w32_encode_weight): New function. - (fill_in_logfont): Adjusted for the format change of font-spec. + (fill_in_logfont): Adjust for the format change of font-spec. (w32font_full_name): Use FONT_WEIGHT_SYMBOLIC to get a symbol weight value. - (w32font_driver): Adjusted for the change of struct font_driver. + (w32font_driver): Adjust for the change of struct font_driver. * w32term.h: Throughout the file, delete all USE_FONT_BACKEND conditionals. Don't check enable_font_backend. Surround non-used code by "#ifdef OLD_FONT" and "endif". (FONT_WIDTH, FONT_HEIGHT, FONT_BASE, FONT_DESCENT) - (FONT_AVG_WIDTH): Adjusted for the change of struct font. + (FONT_AVG_WIDTH): Adjust for the change of struct font. * w32term.c: Throughout the file, delete all USE_FONT_BACKEND conditionals. Don't check enable_font_backend. Delete all codes @@ -17374,9 +18306,9 @@ * w32uniscribe.c: Delete USE_FONT_BACKEND conditional. (uniscribe_open): Return value changed to font-object. Adjusted for the format change of font-object. - (uniscribe_otf_capability): Adjusted for the change of struct font. + (uniscribe_otf_capability): Adjust for the change of struct font. (add_opentype_font_name_to_list): Don't downcase names. - (uniscribe_font_driver): Adjusted for the change of struct + (uniscribe_font_driver): Adjust for the change of struct font_driver. 2008-05-13 Chong Yidong <cyd@stupidchicken.com> @@ -19527,8 +20459,8 @@ 2008-02-01 Kenichi Handa <handa@ni.aist.go.jp> - * coding.c (decode_coding_object, encode_coding_object): Adjust - marker positions after conversion. + * coding.c (decode_coding_object, encode_coding_object): + Adjust marker positions after conversion. * lisp.h (struct Lisp_Marker): New member need_adjustment. @@ -20097,8 +21029,8 @@ 2008-02-01 Jason Rumney <jasonr@gnu.org> - * w32term.c (x_set_glyph_string_clipping): Use - get_glyph_string_clip_rects. + * w32term.c (x_set_glyph_string_clipping): + Use get_glyph_string_clip_rects. (x_set_glyph_string_clipping_exactly, x_draw_glyph_string): Adjust for the change of struct glyph_string. @@ -20109,8 +21041,8 @@ * xftfont.c (xftfont_draw): Adjust for the change of struct glyph_string. - * xterm.c (x_set_glyph_string_clipping): Use - get_glyph_string_clip_rects. + * xterm.c (x_set_glyph_string_clipping): + Use get_glyph_string_clip_rects. (x_set_glyph_string_clipping_exactly, x_draw_glyph_string): Adjust for the change of struct glyph_string. @@ -20287,8 +21219,8 @@ constant. Save QCspacing value. Save list of scripts instead of binary subranges. (w32_generic_family, logfonts_match, font_matches_spec): New functions. - (add_font_entity_to_list): Use font_callback_data struct. Filter - unwanted fonts. + (add_font_entity_to_list): Use font_callback_data struct. + Filter unwanted fonts. (add_one_font_entity_to_list): Use font_callback_data struct. (w32_registry): Default to iso10646_1. (fill_in_logfont): Use dpi from extra slot. Don't bother with @@ -20509,8 +21441,8 @@ 2008-02-01 Kenichi Handa <handa@m17n.org> - * xterm.c (x_draw_composite_glyph_string_foreground): Fix - indexing into elements of s->cmp and s->char2b. + * xterm.c (x_draw_composite_glyph_string_foreground): + Fix indexing into elements of s->cmp and s->char2b. 2008-02-01 Juanma Barranquero <lekktu@gmail.com> @@ -20748,8 +21680,8 @@ * font.c (font_parse_fcname, font_parse_name): Don't change :name property of FONT. - (LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE, check_gstring): Define - them unconditionally. + (LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE, check_gstring): + Define them unconditionally. (font_matching_entity): New function. (font_open_by_name): Try font_matching_entity if exact match is not found. @@ -20794,8 +21726,8 @@ (font_prepare_composition): Set cmp->glyph_len. (font_open_entity): Set font->scalable. (Ffont_get): Handle :otf property. - (Ffont_otf_gsub, Ffont_otf_gpos, Ffont_otf_alternates): New - functions. + (Ffont_otf_gsub, Ffont_otf_gpos, Ffont_otf_alternates): + New functions. (Fquery_font): Use font->font.full_name. (syms_of_font): Defsubr Sfont_otf_gsub, Sfont_otf_gpos, and Sfont_otf_alternates. @@ -20864,8 +21796,8 @@ (font_at): New function. (Ffont_get): If FONT is a font-object, get entity from it. (Ffont_make_gstring): Initialize elements of glyphs with nil. - (Ffont_fill_gstring): Use macro LGSTRING_XXX and LGLYPH_XXX. Fix - range check. + (Ffont_fill_gstring): Use macro LGSTRING_XXX and LGLYPH_XXX. + Fix range check. (Ffont_at): New function. (syms_of_font): Defsubr Sfont_at. @@ -20896,7 +21828,7 @@ 2008-02-01 Kenichi Handa <handa@m17n.org> * font.h (LGLYPH_XOFF, LGLYPH_YOFF, LGLYPH_WIDTH, LGLYPH_WADJUST) - (LGLYPH_SET_WIDTH): Adjusted for the change of LGLYPH format. + (LGLYPH_SET_WIDTH): Adjust for the change of LGLYPH format. (LGLYPH_ADJUSTMENT, LGLYPH_SET_ADJUSTMENT): New macros. * font.c (font_merge_old_spec): Treat '*' in foundry as a wild card. @@ -20958,8 +21890,8 @@ (font_prop_validate_extra): Delete. (font_prop_validate_spacing): New function. (font_property_table): Add elements for all known properties. - (get_font_prop_index): Rename from check_font_prop_name. New - argument FROM. Change caller. + (get_font_prop_index): Rename from check_font_prop_name. + New argument FROM. Change caller. (font_prop_validate): Validate all known properties. (font_put_extra): Delete argument force. Change caller. (font_expand_wildcards): Make it static. Fix the way of shrinking @@ -21031,8 +21963,8 @@ (font_open_for_lface, font_open_by_name): Fix handling of font size. (Ffont_spec): Add QCname property that contains only unknown properties. - * ftfont.c (ftfont_list): Use assq_no_quit, not Fassq. Don't - include weight in listing pattern, instead check weight of each + * ftfont.c (ftfont_list): Use assq_no_quit, not Fassq. + Don't include weight in listing pattern, instead check weight of each listed font. Don't include scalable in pattern. Pay attention to FONT_PIXEL_SIZE_QUANTUM. @@ -21067,8 +21999,8 @@ * font.c (XLFD_SMALLNUM_MASK): Delete this macro. (XLFD_LARGENUM_MASK): Delete XLFD_ENCODING_MASK from it. - (font_expand_wildcards): Fix handling ENCODING field. Avoid - unnecessary checks for weight, slant, and swidth. + (font_expand_wildcards): Fix handling ENCODING field. + Avoid unnecessary checks for weight, slant, and swidth. (font_parse_fcname): New function. (font_unparse_fcname): New function. (font_parse_name): New function. @@ -21302,8 +22234,8 @@ * xfns.c [USE_FONT_BACKEND]: Include "font.h". (x_default_font_parameter) [USE_FONT_BACKEND]: New function. (Fx_create_frame) [USE_FONT_BACKEND]: If enable_font_backend is - nonzero, register all available font drivers. Call - x_default_font_parameter for deciding a font. + nonzero, register all available font drivers. + Call x_default_font_parameter for deciding a font. (x_create_tip_frame) [USE_FONT_BACKEND]: Likewise. * xterm.c [USE_FONT_BACKEND]: Include "font.h". @@ -21347,8 +22279,8 @@ 2008-02-01 Kenichi Handa <handa@m17n.org> - * coding.c (DECODE_EMACS_MULE_20_RELATIVE_COMPOSITION): Fix - condition to terminate the loop. + * coding.c (DECODE_EMACS_MULE_20_RELATIVE_COMPOSITION): + Fix condition to terminate the loop. 2008-02-01 Kenichi Handa <handa@m17n.org> @@ -21381,8 +22313,8 @@ 2008-02-01 Kenichi Handa <handa@m17n.org> - * xterm.c (x_set_glyph_string_clipping_exactly): Set - src->clip_head and src->clip_tail temporarily instead of src->hl. + * xterm.c (x_set_glyph_string_clipping_exactly): + Set src->clip_head and src->clip_tail temporarily instead of src->hl. * ccl.c (CCL_WRITE_STRING): Handle a flag bit for multibyte character sequence. @@ -21414,8 +22346,8 @@ (BUILD_COMPOSITE_GLYPH_STRING): If C is TAB, set s->face to NULL. (x_produce_glyphs): If CH is TAB, set cmp->offsets properly. - * xterm.c (x_draw_composite_glyph_string_foreground): Check - s->face is NULL or not. + * xterm.c (x_draw_composite_glyph_string_foreground): + Check s->face is NULL or not. 2008-02-01 Kenichi Handa <handa@m17n.org> @@ -21465,8 +22397,8 @@ Qnil. Use JIS_TO_SJIS instead of ENCODE_SJIS. (decode_mac_font_name): Use decode_coding_c_string instead of decode_coding. - (x_load_font): Initialize fontp->fontset to -1. Set - fontp->encoding_type. + (x_load_font): Initialize fontp->fontset to -1. + Set fontp->encoding_type. 2008-02-01 Kenichi Handa <handa@m17n.org> @@ -21513,8 +22445,8 @@ (emacs${EXEEXT}): Run $(RUN_TEMACS) unconditionally. (UNIDATA): New variable. (${lispsource}international/charprop.el): Depends on ${UNIDATA}. - (bootstrap-emacs${EXEEXT}): Depends on charprop.el. Run - $(RUN_TEMACS) unconditionally. + (bootstrap-emacs${EXEEXT}): Depends on charprop.el. + Run $(RUN_TEMACS) unconditionally. 2008-02-01 Kenichi Handa <handa@m17n.org> @@ -21531,10 +22463,10 @@ * w32select.c (validate_coding_system) (setup_windows_coding_system): New functions. - (convert_to_handle_as_coded, Fw32_get_clipboard_data): Use - setup_windows_coding_system. - (setup_config, Fw32_get_clipboard_data): Use - validate_coding_system. + (convert_to_handle_as_coded, Fw32_get_clipboard_data): + Use setup_windows_coding_system. + (setup_config, Fw32_get_clipboard_data): + Use validate_coding_system. (Fx_selection_exists): Move call to setup_config to a place where signals are allowed. @@ -21616,8 +22548,8 @@ * fontset.c (fs_load_font): Use fast_string_match_ignore_case instead of fast_c_string_match_ignore_case. - (find_font_encoding): Change argument to Lisp_Object. Use - fast_string_match_ignore_case instead of + (find_font_encoding): Change argument to Lisp_Object. + Use fast_string_match_ignore_case instead of fast_c_string_match_ignore_case. Change caller. 2008-02-01 Kenichi Handa <handa@m17n.org> @@ -21644,13 +22576,13 @@ Qundecided. (Fterminal_coding_system): Return nil if terminal coding system is `undecided'. - (syms_of_coding): Define coding-system `undecided' here. Setup - terminal_coding as `undecided'. + (syms_of_coding): Define coding-system `undecided' here. + Setup terminal_coding as `undecided'. 2008-02-01 Kenichi Handa <handa@m17n.org> - * xdisp.c (message_dolog, set_message_1): Call - unibyte_char_to_multibyte with arg type int. + * xdisp.c (message_dolog, set_message_1): + Call unibyte_char_to_multibyte with arg type int. * lread.c (read1): Fix reading of a char-table. @@ -21748,8 +22680,8 @@ 2008-02-01 Kenichi Handa <handa@m17n.org> - * coding.c (Ffind_coding_systems_region_internal): Include - raw-text and no-conversion in the result. + * coding.c (Ffind_coding_systems_region_internal): + Include raw-text and no-conversion in the result. 2008-02-01 Kenichi Handa <handa@m17n.org> @@ -21805,16 +22737,16 @@ * fontset.c: Include "intervals.h". (fontset_face): Fix comparing of Lisp_Objects. - (free_face_fontset, new_fontset_from_font_name): Fix - Lisp_Object/int mixup. + (free_face_fontset, new_fontset_from_font_name): + Fix Lisp_Object/int mixup. * editfns.c (Ftranslate_region_internal): Fix Lisp_Object/int mixup. * coding.c: Add many prototypes for static functions. (get_translation_table): Allow max_lookup to be NULL. (decode_coding, Ffind_coding_systems_region_internal) - (Funencodable_char_position, Fcheck_coding_systems_region): Call - get_translation_table with max_lookup NULL. + (Funencodable_char_position, Fcheck_coding_systems_region): + Call get_translation_table with max_lookup NULL. 2008-02-01 Kenichi Handa <handa@m17n.org> @@ -21943,8 +22875,8 @@ (Fdefine_coding_system_internal): Accept list of translation tables as :encode-translation-table and :decode-translation-table. (Fcoding_system_put): New function. - (syms_of_coding): Declare new symbols. Defsubr - Scoding_system_put. + (syms_of_coding): Declare new symbols. + Defsubr Scoding_system_put. (decode_coding_sjis, encode_coding_sjis): Handle 4th charset, typically JISX0212. @@ -22065,8 +22997,8 @@ * chartab.c (map_sub_char_table_for_charset): Fix args to c_function with. - * coding.h (enum coding_result_code): Delete - CODING_RESULT_INSUFFICIENT_CMP, add CODING_RESULT_INVALID_SRC. + * coding.h (enum coding_result_code): + Delete CODING_RESULT_INSUFFICIENT_CMP, add CODING_RESULT_INVALID_SRC. * coding.c (Qinsufficient_source, Qinconsistent_eol) (Qinvalid_source, Qinterrupted, Qinsufficient_memory): New variables. @@ -22278,8 +23210,8 @@ * w32console.c: Include character.h. Use terminal_encode_buffer from term.c. - (write_glyphs): Use new version of encode_terminal_code. Use - encode_coding_object in place of encode_coding. + (write_glyphs): Use new version of encode_terminal_code. + Use encode_coding_object in place of encode_coding. * w32bdf.c (w32_load_bdf_font): Clear font_info before filling. encoding becomes encoding_type. @@ -22303,16 +23235,16 @@ * charset.h (charset_unicode): Extern it. * charset.c (string_xstring_p): Check by (C >= 0x100). - (find_charsets_in_text): Change format of the arc CHARSETS. New - arg MULTIBYTE. + (find_charsets_in_text): Change format of the arc CHARSETS. + New arg MULTIBYTE. (Ffind_charset_region, Ffind_charset_string): Adjust for the change of find_charsets_in_text. (Fsplit_char): Fix doc. Never return unknown. * chartab.c (char_table_translate): Use CHARACTERP, not INTEGERP. - * coding.c (Fdefine_coding_system_alias): Update - Vcoding_system_list. + * coding.c (Fdefine_coding_system_alias): + Update Vcoding_system_list. * fontset.c (load_font_get_repertory): Pay attention to the case that ENCODING of a font is specified by a char-table. @@ -22322,16 +23254,16 @@ 2008-02-01 Kenichi Handa <handa@m17n.org> - * term.c (encode_terminal_code): Don't handle glyph-table. Check - if a character is encodable by the terminal coding system. If - not, produces proper number of `?'s. Update + * term.c (encode_terminal_code): Don't handle glyph-table. + Check if a character is encodable by the terminal coding system. + If not, produces proper number of `?'s. Update terminal_encode_buffer and terminal_encode_buf_size if necessary. (produce_glyphs): Check by CHAR_BYTE8_P, not SINGLE_BYTE_CHAR_P. 2008-02-01 Kenichi Handa <handa@m17n.org> - * term.c (terminal_encode_buffer, terminal_encode_buf_size): New - variables. + * term.c (terminal_encode_buffer, terminal_encode_buf_size): + New variables. (encode_terminal_code): Change argument. Encode multiple characters at once. Store the result of encoding in terminal_encode_buffer. @@ -22409,8 +23341,8 @@ * casetab.c (set_case_table): Remove unused var. - * window.c (Fdisplay_buffer, Fframe_selected_window): Remove - unused vars. + * window.c (Fdisplay_buffer, Fframe_selected_window): + Remove unused vars. 2008-02-01 Dave Love <fx@gnu.org> @@ -22438,8 +23370,8 @@ (update_compositions, Ffind_composition_internal): Make buffer positions EMACS_INT. - * composite.h (find_composition, update_compositions): Make - position args EMACS_INT. + * composite.h (find_composition, update_compositions): + Make position args EMACS_INT. * keyboard.c (adjust_point_for_property): Make beg and end EMACS_INT. @@ -22463,8 +23395,8 @@ 2008-02-01 Andreas Schwab <schwab@suse.de> - * chartab.c (map_char_table, map_char_table_for_charset): Protect - `range' from GC. + * chartab.c (map_char_table, map_char_table_for_charset): + Protect `range' from GC. 2008-02-01 Kenichi Handa <handa@m17n.org> @@ -22526,8 +23458,8 @@ (re_match_2_internal): Don't check RE_TARGET_MULTIBYTE_P (bufp). It is the same as RE_MULTIBYTE_P (bufp) now. <exactn>: Translate via multibyte. - <anychar>: Fetch a character by RE_STRING_CHAR_AND_LENGTH. Don't - translate it. + <anychar>: Fetch a character by RE_STRING_CHAR_AND_LENGTH. + Don't translate it. <charset, charset_not>: Fetch a character by RE_STRING_CHAR_AND_LENGTH. Translate via multibyte. <duplicate>: Call bcmp_translate with the last arg `multibyte'. @@ -22748,8 +23680,8 @@ FONT_SPEC_INDEX. If font_spec is a string, extract the registry name by using split_font_name_into_vector. (Fnew_fontset): If no ASCII font is specified in FONTLIST, - generate a proper font name from the fontset name. Update - Vfontset_alias_alist. + generate a proper font name from the fontset name. + Update Vfontset_alias_alist. (n_auto_fontsets): New variable. (new_fontset_from_font_name): New function. (Ffont_info): Store the information about fonts generated from the @@ -22814,8 +23746,8 @@ sequence is valid in this coding system. Change callers. (MAX_ANNOTATION_LENGTH): New macro. (ADD_ANNOTATION_DATA): New macro. - (ADD_COMPOSITION_DATA): Change argument. Change callers. Call - ADD_ANNOTATION_DATA. Change the format of annotation data. + (ADD_COMPOSITION_DATA): Change argument. Change callers. + Call ADD_ANNOTATION_DATA. Change the format of annotation data. (ADD_CHARSET_DATA): New macro. (emacs_mule_char): New argument ID. Change callers. (decode_coding_emacs_mule, decode_coding_iso_2022) @@ -22829,8 +23761,8 @@ (produce_composition): Adjust for the new annotation data format. (produce_charset): New function. (produce_annotation): Handle charset annotation. - (handle_composition_annotation, handle_charset_annotation): New - functions. + (handle_composition_annotation, handle_charset_annotation): + New functions. (consume_chars): Handle charset annotation. Utilize the above two functions. (encode_coding_object): If SRC_OBJECT and DST_OBJECT are the same @@ -22960,8 +23892,8 @@ * coding.c (detect_coding_charset): If only ASCII bytes are found, return 0. - (Fdefine_coding_system_internal): Setup - CODING_ATTR_ASCII_COMPAT (attrs) correctly. + (Fdefine_coding_system_internal): + Setup CODING_ATTR_ASCII_COMPAT (attrs) correctly. 2008-02-01 Dave Love <fx@gnu.org> @@ -22971,8 +23903,8 @@ 2008-02-01 Kenichi Handa <handa@m17n.org> - * coding.c (decode_coding): Fix args to translate_chars. Pay - attention to Vstandard_translation_table_for_decode. + * coding.c (decode_coding): Fix args to translate_chars. + Pay attention to Vstandard_translation_table_for_decode. (encode_coding): Fix args to translate_chars. Pay attention to Vstandard_translation_table_for_encode. @@ -23022,8 +23954,8 @@ * character.h (CHAR_STRING, CHAR_STRING_ADVANCE): Call char_string if C is greater than MAX_3_BYTE_CHAR. - (STRING_CHAR, STRING_CHAR_AND_LENGTH, STRING_CHAR_ADVANCE): Call - string_char instead of string_char_with_unification. + (STRING_CHAR, STRING_CHAR_AND_LENGTH, STRING_CHAR_ADVANCE): + Call string_char instead of string_char_with_unification. 2008-02-01 Dave Love <fx@gnu.org> @@ -23081,8 +24013,8 @@ * keyboard.c (read_key_sequence): Fix type error. - * buffer.c (Fset_buffer_multibyte, Fset_buffer_multibyte): Fix - type error. + * buffer.c (Fset_buffer_multibyte, Fset_buffer_multibyte): + Fix type error. * fontset.c (fontset_add): Return Lisp_Object. @@ -23134,8 +24066,8 @@ * regex.h (struct re_pattern_buffer): New member target_multibyte. * regex.c (RE_TARGET_MULTIBYTE_P): New macro. - (GET_CHAR_BEFORE_2): Check target_multibyte, not multibyte. If - that is zero, convert an eight-bit char to multibyte. + (GET_CHAR_BEFORE_2): Check target_multibyte, not multibyte. + If that is zero, convert an eight-bit char to multibyte. (MAKE_CHAR_MULTIBYTE, CHAR_LEADING_CODE): New dummy new macros for non-emacs case. (PATFETCH): Convert an eight-bit char to multibyte. @@ -23154,14 +24086,14 @@ multibyte always 1. (re_search_2): In emacs, set the locale variable multibyte to 1, otherwise to 0. New local variable target_multibyte. Check it - to decide the multibyteness of STR1 and STR2. If - target_multibyte is zero, convert unibyte chars to multibyte + to decide the multibyteness of STR1 and STR2. + If target_multibyte is zero, convert unibyte chars to multibyte before translating and checking fastmap. (TARGET_CHAR_AND_LENGTH): New macro. (re_match_2_internal): In emacs, set the locale variable multibyte - to 1, otherwise to 0. New local variable target_multibyte. Check - it to decide the multibyteness of STR1 and STR2. Use - TARGET_CHAR_AND_LENGTH to fetch a character from D. + to 1, otherwise to 0. New local variable target_multibyte. + Check it to decide the multibyteness of STR1 and STR2. + Use TARGET_CHAR_AND_LENGTH to fetch a character from D. <charset, charset_not>: If multibyte is nonzero, check fastmap only for ASCII chars. Call bcmp_translate with target_multibyte, not with multibyte. @@ -23369,8 +24301,8 @@ * lisp.h (Fset_buffer_multibyte): Adjust prototype. - * xdisp.c (setup_echo_area_for_printing, set_message_1): Adjust - for the change of Fset_buffer_multibyte. + * xdisp.c (setup_echo_area_for_printing, set_message_1): + Adjust for the change of Fset_buffer_multibyte. * fns.c (Fstring_to_multibyte): New function. (syms_of_fns): Declare Fstring_to_multibyte as Lisp subroutine. @@ -23465,11 +24397,11 @@ (find_font_encoding): New function. (list_fontsets): Use STRINGP, not ! NILP. (accumulate_script_ranges): New function. - (Fset_fontset_font, Fnew_fontset, Ffontset_info): Completely - re-written to handle new fontset structure. + (Fset_fontset_font, Fnew_fontset, Ffontset_info): + Completely re-written to handle new fontset structure. (Ffontset_font): Return a copy of element. - (syms_of_fontset): Define symbols Qprepend and Qappend. Fix - docstring of font-encoding-alist. + (syms_of_fontset): Define symbols Qprepend and Qappend. + Fix docstring of font-encoding-alist. * lisp.h (CHAR_TABLE_REF): Remove unnecessary check (IDX >= 0). (Fset_fotset_font): Fix arguments to 5. @@ -23559,8 +24491,8 @@ 2008-02-01 Kenichi Handa <handa@m17n.org> - * xdisp.c (face_before_or_after_it_pos): Call - FETCH_MULTIBYTE_CHAR with byte postion, not char position. + * xdisp.c (face_before_or_after_it_pos): + Call FETCH_MULTIBYTE_CHAR with byte postion, not char position. 2008-02-01 Kenichi Handa <handa@m17n.org> @@ -23588,8 +24520,8 @@ deunify instead of unify a charset. (string_xstring_p): Add `const' to local variables. (find_charsets_in_text): Add `const' to arguments and local variables. - (encode_char): Adjust for the change of Funify_charset. Fix - detecting of invalid code. + (encode_char): Adjust for the change of Funify_charset. + Fix detecting of invalid code. (Fset_charset_priority): Increment charset_ordered_list_tick. (Fmap_charset_chars): Fix handling of default value for FROM_CODE and TO_CODE. @@ -23622,8 +24554,8 @@ 2008-02-01 Dave Love <fx@gnu.org> - * casetab.c (init_casetab_once, init_casetab_once): Fix - CHAR_TABLE_SET call. + * casetab.c (init_casetab_once, init_casetab_once): + Fix CHAR_TABLE_SET call. * category.c (Fmodify_category_entry): Fix CATEGORY_MEMBER call. @@ -23698,8 +24630,8 @@ 2008-02-01 Kenichi Handa <handa@m17n.org> * category.c (Fmodify_category_entry): Don't modify the contents - of category_set for characters out of the range. Avoid - unnecessary modification. + of category_set for characters out of the range. + Avoid unnecessary modification. * character.h (MAYBE_UNIFY_CHAR): Adjust for the change of Vchar_unify_table. The default value of the table is now nil. @@ -23707,8 +24639,8 @@ * character.c (syms_of_character): Setup Vchar_width_table for eight-bit-control and raw-byte chars. - * charset.h (enum define_charset_arg_index): Delete - charset_arg_parents and add charset_arg_subset and + * charset.h (enum define_charset_arg_index): + Delete charset_arg_parents and add charset_arg_subset and charset_arg_superset. (enum charset_attr_index): Delete charset_parents and add charset_subset and charset_superset. @@ -23724,8 +24656,8 @@ * charset.c (load_charset_map): Set the default value of encoder and deunifier char-tables to nil. - (map_charset_chars): Change argument. Change callers. Use - map_char_table_for_charset instead of map_char_table. + (map_charset_chars): Change argument. Change callers. + Use map_char_table_for_charset instead of map_char_table. (Fmap_charset_chars): New optional args from_code and to_code. (Fdefine_charset_internal): Adjust for the change of `define-charset' (:parents -> :subset or :superset). @@ -23734,8 +24666,8 @@ Fdefine_charset_internal. (Ffind_charset_string): Setup the vector `charsets' correctly. - * chartab.c (sub_char_table_ref_and_range): New arg default. Fix - the previous change. + * chartab.c (sub_char_table_ref_and_range): New arg default. + Fix the previous change. (char_table_ref_and_range): Adjust for the above change. (map_sub_char_table_for_charset): New function. (map_char_table_for_charset): New function. @@ -23878,8 +24810,8 @@ 2008-02-01 Kenichi Handa <handa@m17n.org> * coding.c (ONE_MORE_BYTE_NO_CHECK): Increment consumed_chars. - (emacs_mule_char): New arg src. Delete arg `composition'. Change - caller. Handle 2-byte and 3-byte charsets correctly. + (emacs_mule_char): New arg src. Delete arg `composition'. + Change caller. Handle 2-byte and 3-byte charsets correctly. (DECODE_EMACS_MULE_COMPOSITION_RULE_20): Rename from DECODE_EMACS_MULE_COMPOSITION_RULE. Change caller. (DECODE_EMACS_MULE_COMPOSITION_RULE_21): New macro. @@ -23924,8 +24856,8 @@ * character.h (string_escape_byte8): Declare. - * charset.c (load_charset_map, load_charset_map_from_file): Remove - unused vars. + * charset.c (load_charset_map, load_charset_map_from_file): + Remove unused vars. (Fdefine_charset_internal, Fsplit_char, syms_of_charset) (Fmap_charset_chars): Doc fix. @@ -23996,8 +24928,8 @@ * coding.c (coding_set_source): Delete the local variable beg_byte. (encode_coding_charset, Fdefine_coding_system_internal): Delete the local variable charset. - (Fdefine_coding_system_internal): Setup - attrs[coding_attr_charset_valids] correctly. + (Fdefine_coding_system_internal): + Setup attrs[coding_attr_charset_valids] correctly. * charset.c (CODE_POINT_TO_INDEX): Utilize `code_space_mask' member to check if CODE is valid or not. @@ -24019,8 +24951,8 @@ 2008-02-01 Kenichi Handa <handa@m17n.org> - * coding.c (decode_coding_charset, encode_coding_charset): Handle - multiple charsets correctly. + * coding.c (decode_coding_charset, encode_coding_charset): + Handle multiple charsets correctly. 2008-02-01 Kenichi Handa <handa@m17n.org> @@ -28193,10 +29125,10 @@ See ChangeLog.10 for earlier changes. ;; Local Variables: ;; coding: utf-8 -;; add-log-time-zone-rule: t ;; End: - Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -28213,4 +29145,3 @@ See ChangeLog.10 for earlier changes. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. -;; 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 @@ +# src/Makefile for GNU Emacs. -# Makefile for GNU Emacs. # Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. @@ -54,8 +54,8 @@ lwlibdir = ../lwlib lispdir = ../lisp # Configuration files for .o files to depend on. -M_FILE = $(srcdir)/@machfile@ -S_FILE = $(srcdir)/@opsysfile@ +M_FILE = @M_FILE@ +S_FILE = @S_FILE@ config_h = config.h $(M_FILE) $(S_FILE) bootstrap_exe = $(abs_builddir)/bootstrap-emacs$(EXEEXT) @@ -177,7 +177,7 @@ OLDXMENU_TARGET=@OLDXMENU_TARGET@ ## If !HAVE_X11 || USE_GTK, empty. ## Else if USE_X_TOOLKIT, $(lwlibdir)/liblw.a. -## Else $(oldxmenudir)/libXMenu11.a. +## Else $(oldXMenudir)/libXMenu11.a. ## (Actually, rather than being empty, it is set to "nothing". ## It is never actually used for anything in this case. ## This is done because there is a rule with target $(OLDXMENU) below, @@ -575,23 +575,22 @@ shortlisp= \ ## Like $shortlisp, but includes only those files from $lisp that are loaded ## conditionally (i.e., only on some platforms). +## Confusingly, term/internal is not in loadup, but is unconditionally +## loaded by pc-win, which is. SOME_MACHINE_LISP = ../lisp/mouse.elc \ ../lisp/select.elc ../lisp/scroll-bar.elc \ ../lisp/ls-lisp.elc ../lisp/dos-fns.elc \ ../lisp/w32-fns.elc ../lisp/dos-w32.elc \ - ../lisp/disp-table.elc ../lisp/dos-vars.elc \ + ../lisp/disp-table.elc ../lisp/dos-vars.elc ../lisp/w32-vars.elc \ ../lisp/tooltip.elc ../lisp/image.elc \ ../lisp/fringe.elc ../lisp/dnd.elc \ ../lisp/mwheel.elc ../lisp/tool-bar.elc \ ../lisp/x-dnd.elc ../lisp/dynamic-setting.elc \ - ../lisp/international/ccl.elc \ ../lisp/international/fontset.elc \ - ../lisp/mouse.elc \ ../lisp/term/common-win.elc \ ../lisp/term/x-win.elc \ ../lisp/term/pc-win.elc ../lisp/term/internal.elc \ - ../lisp/term/ns-win.elc ../lisp/term/w32-win.elc \ - ../lisp/emacs-lisp/easymenu.elc + ../lisp/term/ns-win.elc ../lisp/term/w32-win.elc ## Construct full set of libraries to be linked. ## 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 static POINTER_TYPE *lisp_align_malloc (size_t, enum mem_type); static POINTER_TYPE *lisp_malloc (size_t, enum mem_type); -void refill_memory_reserve (void); #if GC_MARK_STACK || defined GC_MALLOC_CHECK @@ -4043,8 +4042,14 @@ DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", static INLINE void mark_maybe_object (Lisp_Object obj) { - void *po = (void *) XPNTR (obj); - struct mem_node *m = mem_find (po); + void *po; + struct mem_node *m; + + if (INTEGERP (obj)) + return; + + po = (void *) XPNTR (obj); + m = mem_find (po); if (m != MEM_NIL) { @@ -5694,13 +5699,14 @@ mark_terminals (void) for (t = terminal_list; t; t = t->next_terminal) { eassert (t->name != NULL); - if (!VECTOR_MARKED_P (t)) - { #ifdef HAVE_WINDOW_SYSTEM - mark_image_cache (t->image_cache); + /* If a terminal object is reachable from a stacpro'ed object, + it might have been marked already. Make sure the image cache + gets marked. */ + mark_image_cache (t->image_cache); #endif /* HAVE_WINDOW_SYSTEM */ - mark_vectorlike ((struct Lisp_Vector *)t); - } + if (!VECTOR_MARKED_P (t)) + mark_vectorlike ((struct Lisp_Vector *)t); } } 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) for (t = *list, prev = NULL; t && t != timer; prev = t, t = t->next) ; - /* If it is, take it off the its list, and put in on the - free-list. We don't bother to arrange for setting a - different alarm time, since a too early one doesn't hurt. */ + /* If it is, take it off its list, and put in on the free-list. + We don't bother to arrange for setting a different alarm time, + since a too early one doesn't hurt. */ if (t) { 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 @@ /* Buffer manipulation primitives for GNU Emacs. - Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, - 1995, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, 1997, + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -5601,7 +5601,8 @@ Format with `format-mode-line' to produce a string value. */); doc: /* Local (mode-specific) abbrev table of current buffer. */); DEFVAR_PER_BUFFER ("abbrev-mode", ¤t_buffer->abbrev_mode, Qnil, - doc: /* Non-nil turns on automatic expansion of abbrevs as they are inserted. */); + doc: /* Non-nil if Abbrev mode is enabled. +Use the command `abbrev-mode' to change this variable. */); DEFVAR_PER_BUFFER ("case-fold-search", ¤t_buffer->case_fold_search, Qnil, @@ -6099,11 +6100,23 @@ to the value obtained by calling `current-time'. If the buffer has never been shown in a window, the value is nil. */); DEFVAR_LISP ("transient-mark-mode", &Vtransient_mark_mode, - doc: /* */); + doc: /* Non-nil if Transient Mark mode is enabled. +See the command `transient-mark-mode' for a description of this minor mode. + +Non-nil also enables highlighting of the region whenever the mark is active. +The variable `highlight-nonselected-windows' controls whether to highlight +all windows or just the selected window. + +If the value is `lambda', that enables Transient Mark mode temporarily. +After any subsequent action that would normally deactivate the mark +\(such as buffer modification), Transient Mark mode is turned off. + +If the value is (only . OLDVAL), that enables Transient Mark mode +temporarily. After any subsequent point motion command that is not +shift-translated, or any other action that would normally deactivate +the mark (such as buffer modification), the value of +`transient-mark-mode' is set to OLDVAL. */); Vtransient_mark_mode = Qnil; - /* The docstring is in simple.el. If we put it here, it would be - overwritten when transient-mark-mode is defined using - define-minor-mode. */ DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only, 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. */) DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", ¤t_buffer->cursor_in_non_selected_windows, Qnil, - doc: /* *Cursor type to display in non-selected windows. -The value t means to use hollow box cursor. See `cursor-type' for other values. */); + doc: /* *Non-nil means show a cursor in non-selected windows. +If nil, only shows a cursor in the selected window. +If t, displays a cursor related to the usual cursor type +\(a solid box becomes hollow, a bar becomes a narrower bar). +You can also specify the cursor type as in the `cursor-type' variable. +Use Custom to set this variable and update the display." */); DEFVAR_LISP ("kill-buffer-query-functions", &Vkill_buffer_query_functions, doc: /* List of functions called with no args to query before killing a buffer. @@ -6219,5 +6236,3 @@ keys_of_buffer (void) Fput (intern_c_string ("erase-buffer"), Qdisabled, Qt); } -/* arch-tag: e48569bf-69a9-4b65-a23b-8e68769436e1 - (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 @@ /* Header file for the buffer manipulation primitives. - Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -226,10 +227,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ (temp_set_point ((buffer), (position))) extern void set_point (EMACS_INT); -extern INLINE void temp_set_point (struct buffer *, EMACS_INT); +extern void temp_set_point (struct buffer *, EMACS_INT); extern void set_point_both (EMACS_INT, EMACS_INT); -extern INLINE void temp_set_point_both (struct buffer *, - EMACS_INT, EMACS_INT); +extern void temp_set_point_both (struct buffer *, + EMACS_INT, EMACS_INT); extern void enlarge_buffer_text (struct buffer *, EMACS_INT); @@ -459,7 +460,7 @@ struct buffer_text struct Lisp_Marker *markers; /* Usually 0. Temporarily set to 1 in decode_coding_gap to - prevent Fgarbage_collect from shrinking the gap and loosing + prevent Fgarbage_collect from shrinking the gap and losing not-yet-decoded bytes. */ int inhibit_shrinking; }; @@ -1019,5 +1020,3 @@ extern int last_per_buffer_idx; #define PER_BUFFER_VALUE(BUFFER, OFFSET) \ (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) -/* arch-tag: 679305dd-d41c-4a50-b170-3caf5c97b2d1 - (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 #ifdef WINDOWSNT prepare_standard_handles (in, out, err, handles); set_process_dir (SDATA (current_dir)); + /* Spawn the child. (See ntproc.c:Spawnve). */ + cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); + reset_standard_handles (in, out, err, handles); + if (cpid == -1) + /* An error occurred while trying to spawn the process. */ + report_file_error ("Spawning child process", Qnil); + return cpid; + #else /* not WINDOWSNT */ /* Make sure that in, out, and err are not actually already in 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 emacs_close (out); if (err != in && err != out) emacs_close (err); -#endif /* not MSDOS */ -#endif /* not WINDOWSNT */ #if defined(USG) #ifndef SETPGRP_RELEASES_CTTY setpgrp (); /* No arguments but equivalent in this case */ #endif -#else +#else /* not USG */ setpgrp (pid, pid); -#endif /* USG */ +#endif /* not USG */ -#ifdef MSDOS - pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); - xfree (pwd_var); - if (pid == -1) - /* An error occurred while trying to run the subprocess. */ - report_file_error ("Spawning child process", Qnil); - return pid; -#else /* not MSDOS */ -#ifdef WINDOWSNT - /* Spawn the child. (See ntproc.c:Spawnve). */ - cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); - reset_standard_handles (in, out, err, handles); - if (cpid == -1) - /* An error occurred while trying to spawn the process. */ - report_file_error ("Spawning child process", Qnil); - return cpid; -#else /* not WINDOWSNT */ /* setpgrp_of_tty is incorrect here; it uses input_fd. */ - EMACS_SET_TTY_PGRP (0, &pid); + tcsetpgrp (0, pid); /* execvp does not accept an environment arg so the only way 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 emacs_write (1, new_argv[0], strlen (new_argv[0])); emacs_write (1, "\n", 1); _exit (1); -#endif /* not WINDOWSNT */ -#endif /* not MSDOS */ + +#else /* MSDOS */ + pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); + xfree (pwd_var); + if (pid == -1) + /* An error occurred while trying to run the subprocess. */ + report_file_error ("Spawning child process", Qnil); + return pid; +#endif /* MSDOS */ +#endif /* not WINDOWSNT */ } #ifndef WINDOWSNT @@ -1519,7 +1516,7 @@ void syms_of_callproc (void) { #ifdef DOS_NT - Qbuffer_file_type = intern ("buffer-file-type"); + Qbuffer_file_type = intern_c_string ("buffer-file-type"); staticpro (&Qbuffer_file_type); #endif /* DOS_NT */ @@ -1609,5 +1606,3 @@ See `setenv' and `getenv'. */); defsubr (&Scall_process_region); } -/* arch-tag: 769b8045-1df7-4d2b-8968-e3fb49017f95 - (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; /* List of emacs-mule charsets. */ Lisp_Object Vemacs_mule_charset_list; -struct charset *emacs_mule_charset[256]; +int emacs_mule_charset[256]; /* Mapping table from ISO2022's charset (specified by DIMENSION, CHARS, and FINAL-CHAR) to Emacs' charset. */ @@ -1210,7 +1210,7 @@ usage: (define-charset-internal ...) */) if (charset.emacs_mule_id >= 0) { - emacs_mule_charset[charset.emacs_mule_id] = CHARSET_FROM_ID (id); + emacs_mule_charset[charset.emacs_mule_id] = id; if (charset.emacs_mule_id < 0xA0) emacs_mule_bytes[charset.emacs_mule_id] = charset.dimension + 1; else @@ -2330,7 +2330,7 @@ init_charset_once (void) iso_charset_table[i][j][k] = -1; for (i = 0; i < 256; i++) - emacs_mule_charset[i] = NULL; + emacs_mule_charset[i] = -1; charset_jisx0201_roman = -1; 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; extern Lisp_Object Viso_2022_charset_list; extern Lisp_Object Vemacs_mule_charset_list; -extern struct charset *emacs_mule_charset[256]; +extern int emacs_mule_charset[256]; extern Lisp_Object Vcurrent_iso639_language; 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). Interactively, N is the prefix arg, and KILLFLAG is set if N was explicitly specified. -The command `delete-forward' is preferable for interactive use. */) +The command `delete-forward-char' is preferable for interactive use. */) (Lisp_Object n, Lisp_Object killflag) { EMACS_INT pos; @@ -276,7 +276,7 @@ After insertion, the value of `auto-fill-function' is called if the (Lisp_Object n) { int remove_boundary = 1; - CHECK_NUMBER (n); + CHECK_NATNUM (n); if (!EQ (Vthis_command, current_kboard->Vlast_command)) nonundocount = 0; @@ -453,7 +453,7 @@ internal_self_insert (int c, EMACS_INT n) && SINGLE_BYTE_CHAR_P (c)) ? UNIBYTE_TO_CHAR (c) : c); Lisp_Object string = Fmake_string (make_number (n), make_number (mc)); - + if (spaces_to_insert) { tem = Fmake_string (make_number (spaces_to_insert), @@ -474,7 +474,7 @@ internal_self_insert (int c, EMACS_INT n) insert_and_inherit (strn, p - strn); SAFE_FREE (); } - else + else if (n > 0) insert_and_inherit (str, len); 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, const unsigned char *src_end = coding->source + coding->src_bytes; const unsigned char *src_base = src; int multibytep = coding->src_multibyte; - struct charset *charset; + int charset_id; unsigned code; int c; int consumed_chars = 0; @@ -2063,7 +2063,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, if (c < 0) { c = -c; - charset = emacs_mule_charset[0]; + charset_id = emacs_mule_charset[0]; } else { @@ -2099,7 +2099,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, switch (emacs_mule_bytes[c]) { case 2: - if (! (charset = emacs_mule_charset[c])) + if ((charset_id = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2112,7 +2112,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) { ONE_MORE_BYTE (c); - if (c < 0xA0 || ! (charset = emacs_mule_charset[c])) + if (c < 0xA0 || (charset_id = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2121,7 +2121,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, } else { - if (! (charset = emacs_mule_charset[c])) + if ((charset_id = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2136,7 +2136,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, case 4: ONE_MORE_BYTE (c); - if (c < 0 || ! (charset = emacs_mule_charset[c])) + if (c < 0 || (charset_id = emacs_mule_charset[c]) < 0) goto invalid_code; ONE_MORE_BYTE (c); if (c < 0xA0) @@ -2150,21 +2150,21 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, case 1: code = c; - charset = CHARSET_FROM_ID (ASCII_BYTE_P (code) - ? charset_ascii : charset_eight_bit); + charset_id = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; break; default: abort (); } - CODING_DECODE_CHAR (coding, src, src_base, src_end, charset, code, c); + CODING_DECODE_CHAR (coding, src, src_base, src_end, + CHARSET_FROM_ID (charset_id), code, c); if (c < 0) goto invalid_code; } *nbytes = src - src_base; *nchars = consumed_chars; if (id) - *id = charset->id; + *id = charset_id; return (mseq_found ? -c : c); no_more_source: @@ -9297,7 +9297,8 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern doc: /* Internal use only. */) (Lisp_Object coding_system, Lisp_Object terminal) { - struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); + struct terminal *term = get_terminal (terminal, 1); + struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (term); CHECK_SYMBOL (coding_system); setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding); /* We had better not send unsafe characters to terminal. */ @@ -9306,6 +9307,10 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; terminal_coding->src_multibyte = 1; terminal_coding->dst_multibyte = 0; + if (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK) + term->charset_list = coding_charset_list (terminal_coding); + else + term->charset_list = Fcons (make_number (charset_ascii), Qnil); return Qnil; } @@ -10554,7 +10559,7 @@ associated with each coding-category one by one in this order. When one algorithm agrees with a byte sequence of source text, the coding system bound to the corresponding coding-category is selected. -Don't modify this variable directly, but use `set-coding-priority'. */); +Don't modify this variable directly, but use `set-coding-system-priority'. */); { int i; 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/>. */ /* Define to 1 if you have the `gtk_widget_set_has_window' function. */ #undef HAVE_GTK_WIDGET_SET_HAS_WINDOW +/* Define to 1 if you have the `g_type_init' function. */ +#undef HAVE_G_TYPE_INIT + /* Define to 1 if netdb.h declares h_errno. */ #undef HAVE_H_ERRNO @@ -660,9 +663,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you have the `sysinfo' function. */ #undef HAVE_SYSINFO -/* Define to 1 if you have the <sys/ioctl.h> header file. */ -#undef HAVE_SYS_IOCTL_H - /* Define to 1 if you have the <sys/mman.h> header file. */ #undef HAVE_SYS_MMAN_H @@ -687,9 +687,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you have the <sys/systeminfo.h> header file. */ #undef HAVE_SYS_SYSTEMINFO_H -/* Define to 1 if you have the <sys/timeb.h> header file. */ -#undef HAVE_SYS_TIMEB_H - /* Define to 1 if you have the <sys/time.h> header file. */ #undef HAVE_SYS_TIME_H @@ -711,9 +708,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you have the <sys/_mbstate_t.h> header file. */ #undef HAVE_SYS__MBSTATE_T_H -/* Define to 1 if you have the <termios.h> header file. */ -#undef HAVE_TERMIOS_H - /* Define to 1 if you have the <term.h> header file. */ #undef HAVE_TERM_H @@ -1059,6 +1053,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to `int' if <sys/types.h> does not define. */ #undef pid_t +/* Define to `unsigned int' if <sys/types.h> does not define. */ +#undef size_t + /* Define to any substitute for sys_siglist. */ #undef sys_siglist @@ -1079,7 +1076,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Don't try to switch on inline handling as detected by AC_C_INLINE generally, because even if non-gcc compilers accept `inline', they may reject `extern inline'. */ -#if defined (__GNUC__) && defined (OPTIMIZE) +#if defined (__GNUC__) #define INLINE __inline__ #else #define INLINE @@ -1095,19 +1092,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Include the os and machine dependent files. */ #include config_opsysfile -#include config_machfile +#ifdef config_machfile +# include config_machfile +#endif -/* Set up some defines, C and LD flags for NeXTstep interface on GNUstep. - (There is probably a better place to do this, but right now the Cocoa - side does this in s/darwin.h and we cannot - parallel this exactly since GNUstep is multi-OS. */ -#ifdef HAVE_NS -# ifdef NS_IMPL_GNUSTEP /* GNUstep needs a bit more pure memory. Of the existing knobs, -SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */ + SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. + (There is probably a better place to do this, but right now the + Cocoa side does this in s/darwin.h and we cannot parallel this + exactly since GNUstep is multi-OS. */ +#if defined HAVE_NS && defined NS_IMPL_GNUSTEP # define SYSTEM_PURESIZE_EXTRA 30000 -# endif /* NS_IMPL_GNUSTEP */ -#endif /* HAVE_NS */ +#endif /* SIGTYPE is the macro we actually use. */ #ifndef SIGTYPE @@ -1206,6 +1202,12 @@ typedef unsigned size_t; #define NO_INLINE #endif +#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) +#define EXTERNALLY_VISIBLE __attribute__((externally_visible)) +#else +#define EXTERNALLY_VISIBLE +#endif + /* Some versions of GNU/Linux define noinline in their headers. */ #ifdef noinline #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) xsignal3 (Qargs_out_of_range, a1, a2, a3); } -/* On some machines, XINT needs a temporary location. - Here it is, in case it is needed. */ - -int sign_extend_temp; - -/* On a few machines, XINT can only be done by calling this. */ - -int -sign_extend_lisp_int (EMACS_INT num) -{ - if (num & (((EMACS_INT) 1) << (VALBITS - 1))) - return num | (((EMACS_INT) (-1)) << VALBITS); - else - return num & ((((EMACS_INT) 1) << VALBITS) - 1); -} /* Data type predicates */ 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; Lisp_Object QCdbus_type_int64, QCdbus_type_uint64; Lisp_Object QCdbus_type_double, QCdbus_type_string; Lisp_Object QCdbus_type_object_path, QCdbus_type_signature; +#ifdef DBUS_TYPE_UNIX_FD +Lisp_Object QCdbus_type_unix_fd; +#endif Lisp_Object QCdbus_type_array, QCdbus_type_variant; Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry; @@ -147,6 +150,22 @@ int xd_in_read_queued_messages = 0; #endif /* Check whether TYPE is a basic DBusType. */ +#ifdef DBUS_TYPE_UNIX_FD +#define XD_BASIC_DBUS_TYPE(type) \ + ((type == DBUS_TYPE_BYTE) \ + || (type == DBUS_TYPE_BOOLEAN) \ + || (type == DBUS_TYPE_INT16) \ + || (type == DBUS_TYPE_UINT16) \ + || (type == DBUS_TYPE_INT32) \ + || (type == DBUS_TYPE_UINT32) \ + || (type == DBUS_TYPE_INT64) \ + || (type == DBUS_TYPE_UINT64) \ + || (type == DBUS_TYPE_DOUBLE) \ + || (type == DBUS_TYPE_STRING) \ + || (type == DBUS_TYPE_OBJECT_PATH) \ + || (type == DBUS_TYPE_SIGNATURE) \ + || (type == DBUS_TYPE_UNIX_FD)) +#else #define XD_BASIC_DBUS_TYPE(type) \ ((type == DBUS_TYPE_BYTE) \ || (type == DBUS_TYPE_BOOLEAN) \ @@ -160,6 +179,7 @@ int xd_in_read_queued_messages = 0; || (type == DBUS_TYPE_STRING) \ || (type == DBUS_TYPE_OBJECT_PATH) \ || (type == DBUS_TYPE_SIGNATURE)) +#endif /* This was a macro. On Solaris 2.11 it was said to compile for hours, when optimzation is enabled. So we have transferred it into @@ -182,6 +202,9 @@ xd_symbol_to_dbus_type (Lisp_Object object) : (EQ (object, QCdbus_type_string)) ? DBUS_TYPE_STRING : (EQ (object, QCdbus_type_object_path)) ? DBUS_TYPE_OBJECT_PATH : (EQ (object, QCdbus_type_signature)) ? DBUS_TYPE_SIGNATURE +#ifdef DBUS_TYPE_UNIX_FD + : (EQ (object, QCdbus_type_unix_fd)) ? DBUS_TYPE_UNIX_FD +#endif : (EQ (object, QCdbus_type_array)) ? DBUS_TYPE_ARRAY : (EQ (object, QCdbus_type_variant)) ? DBUS_TYPE_VARIANT : (EQ (object, QCdbus_type_struct)) ? DBUS_TYPE_STRUCT @@ -238,6 +261,9 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis case DBUS_TYPE_UINT16: case DBUS_TYPE_UINT32: case DBUS_TYPE_UINT64: +#ifdef DBUS_TYPE_UNIX_FD + case DBUS_TYPE_UNIX_FD: +#endif CHECK_NATNUM (object); sprintf (signature, "%c", dtype); break; @@ -451,6 +477,9 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) } case DBUS_TYPE_UINT32: +#ifdef DBUS_TYPE_UNIX_FD + case DBUS_TYPE_UNIX_FD: +#endif CHECK_NUMBER (object); { dbus_uint32_t val = XUINT (object); @@ -648,6 +677,9 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter) } case DBUS_TYPE_UINT32: +#ifdef DBUS_TYPE_UNIX_FD + case DBUS_TYPE_UNIX_FD: +#endif { dbus_uint32_t val; dbus_message_iter_get_basic (iter, &val); @@ -983,6 +1015,7 @@ input arguments. It follows the mapping rules: DBUS_TYPE_UINT16 => number DBUS_TYPE_INT16 => integer DBUS_TYPE_UINT32 => number or float + DBUS_TYPE_UNIX_FD => number or float DBUS_TYPE_INT32 => integer or float DBUS_TYPE_UINT64 => number or float DBUS_TYPE_INT64 => integer or float @@ -2104,6 +2137,11 @@ syms_of_dbusbind (void) QCdbus_type_signature = intern_c_string (":signature"); staticpro (&QCdbus_type_signature); +#ifdef DBUS_TYPE_UNIX_FD + QCdbus_type_unix_fd = intern_c_string (":unix-fd"); + staticpro (&QCdbus_type_unix_fd); +#endif + QCdbus_type_array = intern_c_string (":array"); staticpro (&QCdbus_type_array); 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; typedef XImagePtr XImagePtr_or_DC; #endif +#ifndef HAVE_WINDOW_SYSTEM +typedef int Cursor; +#define No_Cursor (0) +#endif + #ifndef NativeRectangle #define NativeRectangle int #endif @@ -279,6 +284,9 @@ enum glyph_type /* Glyph describes a static composition. */ COMPOSITE_GLYPH, + /* Glyph describes a glyphless character. */ + GLYPHLESS_GLYPH, + /* Glyph describes an image. */ IMAGE_GLYPH, @@ -333,7 +341,7 @@ struct glyph /* Which kind of glyph this is---character, image etc. Value should be an enumerator of type enum glyph_type. */ - unsigned type : 2; + unsigned type : 3; /* 1 means this glyph was produced from multibyte text. Zero means it was produced from unibyte text, i.e. charsets aren't @@ -363,12 +371,11 @@ struct glyph displaying. The member `pixel_width' above is set to 1. */ unsigned padding_p : 1; - /* 1 means the actual glyph is not available, draw a box instead. - This can happen when a font couldn't be loaded, or a character - doesn't have a glyph in a font. */ + /* 1 means the actual glyph is not available, draw using `struct + glyphless' below instead. This can happen when a font couldn't + be loaded, or a character doesn't have a glyph in a font. */ unsigned glyph_not_available_p : 1; - /* Non-zero means don't display cursor here. */ unsigned avoid_cursor_p : 1; @@ -402,6 +409,11 @@ struct glyph /* Start and end indices of glyphs of a graphme cluster of a composition (type == COMPOSITE_GLYPH). */ struct { int from, to; } cmp; + /* Pixel offsets for upper and lower part of the acronym. */ + struct { + short upper_xoff, upper_yoff; + short lower_xoff, lower_yoff; + } glyphless; } slice; /* A union of sub-structures for different glyph types. */ @@ -433,6 +445,19 @@ struct glyph } stretch; + /* Sub-stretch for type == GLYPHLESS_GLYPH. */ + struct + { + /* Value is an enum of the type glyphless_display_method. */ + unsigned method : 2; + /* 1 iff this glyph is for a character of no font. */ + unsigned for_no_font : 1; + /* Length of acronym or hexadecimal code string (at most 8). */ + unsigned len : 4; + /* Character to display. Actually we need only 22 bits. */ + unsigned ch : 26; + } glyphless; + /* Used to compare all bit-fields above in one step. */ unsigned val; } u; @@ -1918,6 +1943,9 @@ enum display_element_type /* A composition (static and automatic). */ IT_COMPOSITION, + /* A glyphless character (e.g. ZWNJ, LRE). */ + IT_GLYPHLESS, + /* An image. */ IT_IMAGE, @@ -1964,6 +1992,21 @@ enum line_wrap_method WINDOW_WRAP }; +/* An enumerator for the method of displaying glyphless characters. */ + +enum glyphless_display_method + { + /* Display a thin (1-pixel width) space. On a TTY, display a + 1-character width space. */ + GLYPHLESS_DISPLAY_THIN_SPACE, + /* Display an empty box of proper width. */ + GLYPHLESS_DISPLAY_EMPTY_BOX, + /* Display an acronym string in a box. */ + GLYPHLESS_DISPLAY_ACRONYM, + /* Display the hexadecimal code of the character in a box. */ + GLYPHLESS_DISPLAY_HEX_CODE + }; + struct it_slice { Lisp_Object x; @@ -2295,6 +2338,10 @@ struct it PRODUCE_GLYPHS, this should be set beforehand too. */ int char_to_display; + /* If what == IT_GLYPHLESS, the method to display such a + character. */ + enum glyphless_display_method glyphless_method; + /* If what == IT_IMAGE, the id of the image to display. */ int image_id; @@ -2840,6 +2887,9 @@ enum tool_bar_item_idx /* Label to show when text labels are enabled. */ TOOL_BAR_ITEM_LABEL, + /* If we shall show the label only below the icon and not beside it. */ + TOOL_BAR_ITEM_VERT_ONLY, + /* Sentinel = number of slots in tool_bar_items occupied by one tool-bar item. */ TOOL_BAR_ITEM_NSLOTS @@ -2976,9 +3026,10 @@ extern int last_tool_bar_item; extern Lisp_Object Vmouse_autoselect_window; extern int unibyte_display_via_language_environment; extern EMACS_INT underline_minimum_offset; +extern Lisp_Object Vglyphless_char_display; extern void reseat_at_previous_visible_line_start (struct it *); - +extern Lisp_Object lookup_glyphless_char_display (int, struct it *); extern int calc_pixel_width_or_height (double *, struct it *, Lisp_Object, struct font *, int, int *); @@ -3017,28 +3068,31 @@ extern void x_update_cursor (struct frame *, int); extern void x_clear_cursor (struct window *); extern void x_draw_vertical_border (struct window *w); -extern void frame_to_window_pixel_xy (struct window *, int *, int *); extern int get_glyph_string_clip_rects (struct glyph_string *, NativeRectangle *, int); extern void get_glyph_string_clip_rect (struct glyph_string *, NativeRectangle *nr); extern Lisp_Object find_hot_spot (Lisp_Object, int, int); -extern void note_mouse_highlight (struct frame *, int, int); -extern void x_clear_window_mouse_face (struct window *); -extern void cancel_mouse_face (struct frame *); extern void handle_tool_bar_click (struct frame *, int, int, int, unsigned int); -/* msdos.c defines its own versions of these functions. */ -extern int clear_mouse_face (Display_Info *); -extern void show_mouse_face (Display_Info *, enum draw_glyphs_face); -extern int cursor_in_mouse_face_p (struct window *w); - extern void expose_frame (struct frame *, int, int, int, int); extern int x_intersect_rectangles (XRectangle *, XRectangle *, XRectangle *); -#endif +#endif /* HAVE_WINDOW_SYSTEM */ + +extern void frame_to_window_pixel_xy (struct window *, int *, int *); +extern void note_mouse_highlight (struct frame *, int, int); +extern void x_clear_window_mouse_face (struct window *); +extern void cancel_mouse_face (struct frame *); +extern int clear_mouse_face (Mouse_HLInfo *); +extern void show_mouse_face (Mouse_HLInfo *, enum draw_glyphs_face); +extern int cursor_in_mouse_face_p (struct window *w); +extern void draw_row_with_mouse_face (struct window *, int, struct glyph_row *, + int, int, enum draw_glyphs_face); +extern void tty_draw_row_with_mouse_face (struct window *, struct glyph_row *, + int, int, enum draw_glyphs_face); /* Flags passed to try_window. */ #define TRY_WINDOW_CHECK_MARGINS (1 << 0) @@ -3124,7 +3178,6 @@ char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, int ascii_face_of_lisp_face (struct frame *, int); void prepare_face_for_display (struct frame *, struct face *); int xstrcasecmp (const unsigned char *, const unsigned char *); -int lookup_face (struct frame *, Lisp_Object *); int lookup_named_face (struct frame *, Lisp_Object, int); int lookup_basic_face (struct frame *, int); int 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) /* Copy glyph row structure FROM to glyph row structure TO, except that glyph pointers in the structures are left unchanged. */ -INLINE void +static INLINE void copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from) { struct glyph *pointers[1 + LAST_AREA]; @@ -2893,6 +2893,14 @@ mirror_make_current (struct window *w, int frame_row) else swap_glyph_pointers (desired_row, current_row); current_row->enabled_p = 1; + + /* Set the Y coordinate of the mode/header line's row. + It is needed in draw_row_with_mouse_face to find the + screen coordinates. (Window-based redisplay sets + this in update_window, but no one seems to do that + for frame-based redisplay.) */ + if (current_row->mode_line_p) + current_row->y = row; } } @@ -5385,7 +5393,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp))); start_display (&it, w, startp); - x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w); + x0 = *x; /* First, move to the beginning of the row corresponding to *Y. We need to be in that row to get the correct value of base paragraph @@ -6416,6 +6424,12 @@ init_display (void) f->terminal = t; t->reference_count++; +#ifdef MSDOS + f->output_data.tty->display_info = &the_only_display_info; +#else + if (f->output_method == output_termcap) + create_tty_output (f); +#endif t->display_info.tty->top_frame = selected_frame; change_frame_size (XFRAME (selected_frame), FrameRows (t->display_info.tty), @@ -6583,13 +6597,29 @@ It is up to you to set this variable if your terminal can do that. */); DEFVAR_LISP ("initial-window-system", &Vinitial_window_system, doc: /* Name of the window system that Emacs uses for the first frame. -The value is a symbol--for instance, `x' for X windows. -The value is nil if Emacs is using a text-only terminal. */); +The value is a symbol: + nil for a termcap frame (a character-only terminal), + 'x' for an Emacs frame that is really an X window, + 'w32' for an Emacs frame that is a window on MS-Windows display, + 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, + 'pc' for a direct-write MS-DOS frame. + +Use of this variable as a boolean is deprecated. Instead, +use `display-graphic-p' or any of the other `display-*-p' +predicates which report frame's specific UI-related capabilities. */); DEFVAR_KBOARD ("window-system", Vwindow_system, doc: /* Name of window system through which the selected frame is displayed. -The value is a symbol--for instance, `x' for X windows. -The value is nil if the selected frame is on a text-only-terminal. */); +The value is a symbol: + nil for a termcap frame (a character-only terminal), + 'x' for an Emacs frame that is really an X window, + 'w32' for an Emacs frame that is a window on MS-Windows display, + 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, + 'pc' for a direct-write MS-DOS frame. + +Use of this variable as a boolean is deprecated. Instead, +use `display-graphic-p' or any of the other `display-*-p' +predicates which report frame's specific UI-related capabilities. */); DEFVAR_LISP ("window-system-version", &Vwindow_system_version, 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) */) } DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0, - doc: /* Convert arg BYTE to a string containing that byte. */) + doc: /* Convert arg BYTE to a unibyte string containing that byte. */) (Lisp_Object byte) { unsigned char b; CHECK_NUMBER (byte); + if (XINT (byte) < 0 || XINT (byte) > 255) + error ("Invalid byte"); b = XINT (byte); return make_string_from_bytes (&b, 1, 1); } 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 @@ /* Fully extensible Emacs, running on Unix, intended for GNU. - Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999, + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -99,27 +100,27 @@ static const char emacs_version[] = "24.0.50"; /* Make these values available in GDB, which doesn't see macros. */ #ifdef USE_LSB_TAG -int gdb_use_lsb = 1; +int gdb_use_lsb EXTERNALLY_VISIBLE = 1; #else -int gdb_use_lsb = 0; +int gdb_use_lsb EXTERNALLY_VISIBLE = 0; #endif #ifndef USE_LISP_UNION_TYPE -int gdb_use_union = 0; +int gdb_use_union EXTERNALLY_VISIBLE = 0; #else -int gdb_use_union = 1; +int gdb_use_union EXTERNALLY_VISIBLE = 1; #endif -EMACS_INT gdb_valbits = VALBITS; -EMACS_INT gdb_gctypebits = GCTYPEBITS; +EMACS_INT gdb_valbits EXTERNALLY_VISIBLE = VALBITS; +EMACS_INT gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS; #if defined (DATA_SEG_BITS) && ! defined (USE_LSB_TAG) -EMACS_INT gdb_data_seg_bits = DATA_SEG_BITS; +EMACS_INT gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS; #else -EMACS_INT gdb_data_seg_bits = 0; +EMACS_INT gdb_data_seg_bits EXTERNALLY_VISIBLE = 0; #endif -EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG; -EMACS_INT gdb_array_mark_flag = ARRAY_MARK_FLAG; +EMACS_INT PVEC_FLAG EXTERNALLY_VISIBLE = PSEUDOVECTOR_FLAG; +EMACS_INT gdb_array_mark_flag EXTERNALLY_VISIBLE = ARRAY_MARK_FLAG; /* GDB might say "No enum type named pvec_type" if we don't have at least one symbol with that type, and then xbacktrace could fail. */ -enum pvec_type gdb_pvec_type = PVEC_TYPE_MASK; +enum pvec_type gdb_pvec_type EXTERNALLY_VISIBLE = PVEC_TYPE_MASK; /* Command line args from shell, as list of strings. */ Lisp_Object Vcommand_line_args; @@ -194,11 +195,6 @@ Lisp_Object Vdynamic_library_alist; but instead should use the virtual terminal under which it was started. */ int inhibit_window_system; -/* If nonzero, set Emacs to run at this priority. This is also used - in child_setup and sys_suspend to make sure subshells run at normal - priority; those functions have their own extern declaration. */ -EMACS_INT emacs_priority; - /* If non-zero, a filter or a sentinel is running. Tested to save the match data on the first attempt to change it inside asynchronous code. */ int running_asynch_code; @@ -829,13 +825,14 @@ main (int argc, char **argv) printf ("see the file named COPYING.\n"); exit (0); } - if (argmatch (argv, argc, "-chdir", "--chdir", 2, &ch_to_dir, &skip_args)) - if (chdir (ch_to_dir) == -1) - { - fprintf (stderr, "%s: Can't chdir to %s: %s\n", - argv[0], ch_to_dir, strerror (errno)); - exit (1); - } + + if (argmatch (argv, argc, "-chdir", "--chdir", 4, &ch_to_dir, &skip_args)) + if (chdir (ch_to_dir) == -1) + { + fprintf (stderr, "%s: Can't chdir to %s: %s\n", + argv[0], ch_to_dir, strerror (errno)); + exit (1); + } #ifdef HAVE_PERSONALITY_LINUX32 @@ -1508,9 +1505,7 @@ main (int argc, char **argv) syms_of_doc (); syms_of_editfns (); syms_of_emacs (); -#ifdef CLASH_DETECTION syms_of_filelock (); -#endif /* CLASH_DETECTION */ syms_of_indent (); syms_of_insdel (); /* syms_of_keymap (); */ @@ -2053,10 +2048,8 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff) #ifndef DOS_NT { int pgrp = EMACS_GETPGRP (0); - - int tpgrp; - if (EMACS_GET_TTY_PGRP (0, &tpgrp) != -1 - && tpgrp == pgrp) + int tpgrp = tcgetpgrp (0); + if ((tpgrp != -1) && tpgrp == pgrp) { reset_all_sys_modes (); if (sig && sig != SIGTERM) @@ -2412,9 +2405,10 @@ Special values: `ms-dos' compiled as an MS-DOS application. `windows-nt' compiled as a native W32 application. `cygwin' compiled using the Cygwin library. -Anything else (in Emacs 23.1, the possibilities are: aix, berkeley-unix, -hpux, irix, lynxos 3.0.1, usg-unix-v) indicates some sort of Unix system. */); +Anything else (in Emacs 24.1, the possibilities are: aix, berkeley-unix, +hpux, irix, usg-unix-v) indicates some sort of Unix system. */); Vsystem_type = intern_c_string (SYSTEM_TYPE); + /* Above values are from SYSTEM_TYPE in src/s/*.h. */ DEFVAR_LISP ("system-configuration", &Vsystem_configuration, 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 `noninteractive' was non-nil. */); Vkill_emacs_hook = Qnil; - DEFVAR_INT ("emacs-priority", &emacs_priority, - doc: /* Priority for Emacs to run at. -This value is effective only if set before Emacs is dumped, -and only if the Emacs executable is installed with setuid to permit -it to change priority. (Emacs sets its uid back to the real uid.) -Currently, you need to define SET_EMACS_PRIORITY in `config.h' -before you compile Emacs, to enable the code for this feature. */); - emacs_priority = 0; - DEFVAR_LISP ("path-separator", &Vpath_separator, doc: /* String containing the character that separates directories in search paths, such as PATH and other similar environment variables. */); @@ -2532,5 +2517,3 @@ libraries; only those already known by Emacs will be loaded. */); daemon_pipe[1] = 0; } -/* arch-tag: 7bfd356a-c720-4612-8ab6-aa4222931c2e - (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) specpdl_ptr = specpdl; /* Don't forget to update docs (lispref node "Local Variables"). */ max_specpdl_size = 1200; /* 1000 is not enough for CEDET's c-by.el. */ - max_lisp_eval_depth = 500; + max_lisp_eval_depth = 600; Vrun_hooks = Qnil; } 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 } DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime, - Sverify_visited_file_modtime, 1, 1, 0, + Sverify_visited_file_modtime, 0, 1, 0, doc: /* Return t if last mod time of BUF's visited file matches what BUF records. This means that the file has not been changed since it was visited or saved. +If BUF is omitted or nil, it defaults to the current buffer. See Info node `(elisp)Modification Time' for more details. */) (Lisp_Object buf) { @@ -5055,8 +5056,13 @@ See Info node `(elisp)Modification Time' for more details. */) Lisp_Object handler; Lisp_Object filename; - CHECK_BUFFER (buf); - b = XBUFFER (buf); + if (NILP (buf)) + b = current_buffer; + else + { + CHECK_BUFFER (buf); + b = XBUFFER (buf); + } if (!STRINGP (b->filename)) return Qt; if (b->modtime == 0) return Qt; @@ -5863,5 +5869,3 @@ This includes interactive calls to `delete-file' and #endif } -/* arch-tag: 64ba3fd7-f844-4fb2-ba4b-427eb928786c - (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) boot_time_initialized = 0; } +#endif /* CLASH_DETECTION */ + void syms_of_filelock (void) { @@ -737,12 +739,12 @@ syms_of_filelock (void) doc: /* The directory for writing temporary files. */); Vtemporary_file_directory = Qnil; +#ifdef CLASH_DETECTION defsubr (&Sunlock_buffer); defsubr (&Slock_buffer); defsubr (&Sfile_locked_p); +#endif } -#endif /* CLASH_DETECTION */ - /* arch-tag: e062676d-50b2-4be0-ab96-197c81b181a1 (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 @@ /* font.c -- "Font" primitives. - Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - Copyright (C) 2006, 2007, 2008, 2009, 2010 - National Institute of Advanced Industrial Science and Technology (AIST) - Registration Number H13PRO009 + +Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright (C) 2006, 2007, 2008, 2009, 2010 + National Institute of Advanced Industrial Science and Technology (AIST) + Registration Number H13PRO009 This file is part of GNU Emacs. @@ -3443,7 +3444,7 @@ font_load_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec) if (NILP (entity)) return Qnil; } - /* Don't loose the original name that was put in initially. We need + /* Don't lose the original name that was put in initially. We need it to re-apply the font when font parameters (like hinting or dpi) have changed. */ entity = font_open_for_lface (f, entity, attrs, spec); @@ -3514,7 +3515,7 @@ font_open_by_name (FRAME_PTR f, const char *name) args[1] = make_unibyte_string (name, strlen (name)); spec = Ffont_spec (2, args); ret = font_open_by_spec (f, spec); - /* Do not loose name originally put in. */ + /* Do not lose name originally put in. */ if (!NILP (ret)) font_put_extra (ret, QCuser_spec, args[1]); @@ -3731,8 +3732,8 @@ font_get_frame_data (FRAME_PTR f, struct font_driver *driver) void font_filter_properties (Lisp_Object font, Lisp_Object alist, - const char *boolean_properties[], - const char *non_boolean_properties[]) + const char *const boolean_properties[], + const char *const non_boolean_properties[]) { Lisp_Object it; int i; @@ -5399,5 +5400,3 @@ init_font (void) Vfont_log = egetenv ("EMACS_FONT_LOG") ? Qnil : Qt; } -/* arch-tag: 74c9475d-5976-4c93-a327-942ae3072846 - (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, extern void font_filter_properties (Lisp_Object font, Lisp_Object alist, - const char *boolean_properties[], - const char *non_boolean_properties[]); + const char *const boolean_properties[], + const char *const non_boolean_properties[]); #ifdef HAVE_FREETYPE extern 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 @@ /* Generic frame functions. - Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, + 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -201,11 +203,12 @@ Lisp_Object Vframe_list; DEFUN ("framep", Fframep, Sframep, 1, 1, 0, doc: /* Return non-nil if OBJECT is a frame. -Value is t for a termcap frame (a character-only terminal), -`x' for an Emacs frame that is really an X window, -`w32' for an Emacs frame that is a window on MS-Windows display, -`ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, -`pc' for a direct-write MS-DOS frame. +Value is: + t for a termcap frame (a character-only terminal), + 'x' for an Emacs frame that is really an X window, + 'w32' for an Emacs frame that is a window on MS-Windows display, + 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, + 'pc' for a direct-write MS-DOS frame. See also `frame-live-p'. */) (Lisp_Object object) { @@ -247,10 +250,18 @@ return values. */) DEFUN ("window-system", Fwindow_system, Swindow_system, 0, 1, 0, doc: /* The name of the window system that FRAME is displaying through. -The value is a symbol---for instance, 'x' for X windows. -The value is nil if Emacs is using a text-only terminal. +The value is a symbol: + nil for a termcap frame (a character-only terminal), + 'x' for an Emacs frame that is really an X window, + 'w32' for an Emacs frame that is a window on MS-Windows display, + 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, + 'pc' for a direct-write MS-DOS frame. -FRAME defaults to the currently selected frame. */) +FRAME defaults to the currently selected frame. + +Use of this function as a predicate is deprecated. Instead, +use `display-graphic-p' or any of the other `display-*-p' +predicates which report frame's specific UI-related capabilities. */) (Lisp_Object frame) { Lisp_Object type; @@ -3300,7 +3311,7 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu void x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { - Lisp_Object frame, font_object, font_param = Qnil; + Lisp_Object font_object, font_param = Qnil; int fontset = -1; /* Set the frame parameter back to the old value because we may @@ -4314,6 +4325,20 @@ frame_make_pointer_visible (void) } } +DEFUN ("frame-pointer-visible-p", Fframe_pointer_visible_p, + Sframe_pointer_visible_p, 0, 1, 0, + doc: /* Return t if the mouse pointer displayed on FRAME is visible. +Otherwise it returns nil. FRAME omitted or nil means the +selected frame. This is useful when `make-pointer-invisible' is set. */) + (Lisp_Object frame) +{ + if (NILP (frame)) + frame = selected_frame; + + CHECK_FRAME (frame); + + return (XFRAME (frame)->pointer_invisible ? Qnil : Qt); +} /*********************************************************************** @@ -4538,12 +4563,24 @@ recursively). */); staticpro (&Qdelete_frame_functions); DEFVAR_LISP ("menu-bar-mode", &Vmenu_bar_mode, - doc: /* Non-nil if Menu-Bar mode is enabled. */); + doc: /* Non-nil if Menu-Bar mode is enabled. +See the command `menu-bar-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `menu-bar-mode'. */); Vmenu_bar_mode = Qt; DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode, - doc: /* Non-nil if Tool-Bar mode is enabled. */); + doc: /* Non-nil if Tool-Bar mode is enabled. +See the command `tool-bar-mode' for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `tool-bar-mode'. */); +#ifdef HAVE_WINDOW_SYSTEM Vtool_bar_mode = Qt; +#else + Vtool_bar_mode = Qnil; +#endif DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame, doc: /* Minibufferless frames use this frame's minibuffer. @@ -4623,6 +4660,7 @@ automatically. See also `mouse-autoselect-window'. */); defsubr (&Sset_frame_width); defsubr (&Sset_frame_size); defsubr (&Sset_frame_position); + defsubr (&Sframe_pointer_visible_p); #ifdef HAVE_WINDOW_SYSTEM defsubr (&Sx_get_resource); @@ -4631,5 +4669,3 @@ automatically. See also `mouse-autoselect-window'. */); } -/* arch-tag: 7dbf2c69-9aad-45f8-8296-db893d6dd039 - (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; #define FRAME_WINDOW_P(f) (0) #endif +/* Return a pointer to the structure holding information about the + region of text, if any, that is currently shown in mouse-face on + frame F. We need to define two versions because a TTY-only build + does not have FRAME_X_DISPLAY_INFO. */ +#ifdef HAVE_WINDOW_SYSTEM +# define MOUSE_HL_INFO(F) \ + (FRAME_WINDOW_P(F) \ + ? &(FRAME_X_DISPLAY_INFO(F)->mouse_highlight) \ + : &(((F)->output_data.tty->display_info)->mouse_highlight)) +#else +# define MOUSE_HL_INFO(F) \ + (&(((F)->output_data.tty->display_info)->mouse_highlight)) +#endif + /* Nonzero if frame F is still alive (not deleted). */ #define FRAME_LIVE_P(f) ((f)->terminal != 0) 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) return intern ("unknown"); } -static const char *ftfont_booleans [] = { +static const char *const ftfont_booleans [] = { ":antialias", ":hinting", ":verticallayout", @@ -2611,7 +2611,7 @@ static const char *ftfont_booleans [] = { NULL, }; -static const char *ftfont_non_booleans [] = { +static const char *const ftfont_non_booleans [] = { ":family", ":familylang", ":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, rtnval = gnutls_read (state, buf, nbyte); if (rtnval >= 0) return rtnval; - else - return -1; + else { + if (rtnval == GNUTLS_E_AGAIN || + rtnval == GNUTLS_E_INTERRUPTED) + return -1; + else + return 0; + } } /* 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, FRAME_PTR f = (FRAME_PTR) user_data; struct x_output *x = f->output_data.x; GtkWidget *top = gtk_widget_get_toplevel (x->ttip_lbl); - + if (! top || ! GTK_IS_WINDOW (top)) gtk_widget_hide (previous_toplevel); } @@ -580,7 +580,7 @@ qttip_cb (GtkWidget *widget, { FRAME_PTR f = (FRAME_PTR) user_data; struct x_output *x = f->output_data.x; - if (x->ttip_widget == NULL) + if (x->ttip_widget == NULL) { g_object_set (G_OBJECT (widget), "has-tooltip", FALSE, NULL); x->ttip_widget = tooltip; @@ -589,6 +589,8 @@ qttip_cb (GtkWidget *widget, g_object_ref (G_OBJECT (x->ttip_lbl)); gtk_tooltip_set_custom (tooltip, x->ttip_lbl); x->ttip_window = GTK_WINDOW (gtk_widget_get_toplevel (x->ttip_lbl)); + /* ATK needs an empty title for some reason. */ + gtk_window_set_title (x->ttip_window, ""); /* Realize so we can safely get screen later on. */ gtk_widget_realize (GTK_WIDGET (x->ttip_window)); gtk_widget_realize (x->ttip_lbl); @@ -631,14 +633,14 @@ xg_prepare_tooltip (FRAME_PTR f, screen = gdk_drawable_get_screen (gwin); settings = gtk_settings_get_for_screen (screen); g_object_get (settings, "gtk-enable-tooltips", &tt_enabled, NULL); - if (tt_enabled) + if (tt_enabled) { g_object_set (settings, "gtk-enable-tooltips", FALSE, NULL); /* Record that we disabled it so it can be enabled again. */ g_object_set_data (G_OBJECT (x->ttip_window), "restore-tt", (gpointer)f); } - + /* Prevent Gtk+ from hiding tooltip on mouse move and such. */ g_object_set_data (G_OBJECT (gtk_widget_get_display (GTK_WIDGET (x->ttip_window))), @@ -652,7 +654,7 @@ xg_prepare_tooltip (FRAME_PTR f, gtk_widget_size_request (GTK_WIDGET (x->ttip_window), &req); if (width) *width = req.width; if (height) *height = req.height; - + UNBLOCK_INPUT; return 1; @@ -799,7 +801,7 @@ xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight) &pixelwidth, &pixelheight, 0); else return; } - + rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight); columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth); @@ -1073,7 +1075,7 @@ xg_create_frame_widgets (FRAME_PTR f) f->output_data.x->ttip_widget = 0; f->output_data.x->ttip_lbl = 0; f->output_data.x->ttip_window = 0; - gtk_widget_set_tooltip_text (wtop, "Dummy text"); + gtk_widget_set_tooltip_text (wtop, "Dummy text"); g_signal_connect (wtop, "query-tooltip", G_CALLBACK (qttip_cb), f); #endif @@ -1452,7 +1454,7 @@ pop_down_dialog (Lisp_Object arg) g_main_loop_quit (dd->loop); g_main_loop_unref (dd->loop); - + UNBLOCK_INPUT; return Qnil; @@ -1480,7 +1482,7 @@ xg_maybe_add_timer (gpointer data) return FALSE; } - + /* Pops up a modal dialog W and waits for response. We don't use gtk_dialog_run because we want to process emacs timers. The dialog W is not destroyed when this function returns. */ @@ -1514,7 +1516,7 @@ xg_dialog_run (FRAME_PTR f, GtkWidget *w) (void) xg_maybe_add_timer (&dd); g_main_loop_run (dd.loop); - + dd.w = 0; unbind_to (count, Qnil); @@ -3072,6 +3074,23 @@ xg_modify_menubar_widgets (GtkWidget *menubar, FRAME_PTR f, widget_value *val, gtk_widget_show_all (menubar); } +/* Callback called when the menu bar W is mapped. + Used to find the height of the menu bar if we didn't get it + after showing the widget. */ + +static void +menubar_map_cb (GtkWidget *w, gpointer user_data) +{ + GtkRequisition req; + FRAME_PTR f = (FRAME_PTR) user_data; + gtk_widget_size_request (w, &req); + if (FRAME_MENUBAR_HEIGHT (f) != req.height) + { + FRAME_MENUBAR_HEIGHT (f) = req.height; + xg_height_or_width_changed (f); + } +} + /* Recompute all the widgets of frame F, when the menu bar has been changed. Value is non-zero if widgets were updated. */ @@ -3093,10 +3112,20 @@ xg_update_frame_menubar (FRAME_PTR f) FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->menubar_widget, 0); + g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f); gtk_widget_show_all (x->menubar_widget); gtk_widget_size_request (x->menubar_widget, &req); - FRAME_MENUBAR_HEIGHT (f) = req.height; - xg_height_or_width_changed (f); + + /* If menu bar doesn't know its height yet, cheat a little so the frame + doesn't jump so much when resized later in menubar_map_cb. */ + if (req.height == 0) + req.height = 23; + + if (FRAME_MENUBAR_HEIGHT (f) != req.height) + { + FRAME_MENUBAR_HEIGHT (f) = req.height; + xg_height_or_width_changed (f); + } UNBLOCK_INPUT; return 1; @@ -3339,7 +3368,7 @@ xg_create_scroll_bar (FRAME_PTR f, "button-release-event", end_callback, (gpointer) bar); - + /* The scroll bar widget does not draw on a window of its own. Instead it draws on the parent window, in this case the edit widget. So whenever the edit widget is cleared, the scroll bar needs to redraw @@ -3428,11 +3457,11 @@ xg_update_scrollbar_pos (FRAME_PTR f, FRAME_X_WINDOW (f), oldx, oldy, oldw, oldh, 0); } - + /* GTK does not redraw until the main loop is entered again, but if there are no X events pending we will not enter it. So we sync here to get some events. */ - + x_sync (f); SET_FRAME_GARBAGED (f); cancel_mouse_face (f); @@ -3547,7 +3576,7 @@ xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event) GtkWidget *w = gtk_grab_get_current (); retval = w != 0 && GTK_IS_SCROLLBAR (w); } - + return retval; } @@ -3635,7 +3664,7 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data) this is written. */ event.modifiers = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), mod); kbd_buffer_store_event (&event); - + /* Return focus to the frame after we have clicked on a detached tool bar button. */ Fx_focus_frame (frame); @@ -3672,7 +3701,7 @@ xg_tool_bar_proxy_help_callback (GtkWidget *w, { GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_PROXY_BUTTON)); - + return xg_tool_bar_help_callback (wbutton, event, client_data); } @@ -3775,7 +3804,7 @@ xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data) G_CALLBACK (xg_tool_bar_proxy_callback), user_data); - + g_object_set_data (G_OBJECT (wmenuitem), XG_TOOL_BAR_PROXY_BUTTON, (gpointer) wbutton); 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) x->toolbar_widget); } - if (into_hbox) + if (into_hbox) { gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), GTK_POS_TOP); @@ -4057,18 +4086,23 @@ xg_make_tool_item (FRAME_PTR f, GtkWidget *wimage, GtkWidget **wbutton, const char *label, - int i) + int i, + int vert_only) { GtkToolItem *ti = gtk_tool_item_new (); Lisp_Object style = Ftool_bar_get_system_style (); int both_horiz = EQ (style, Qboth_horiz); int text_image = EQ (style, Qtext_image_horiz); - + GtkWidget *vb = both_horiz || text_image ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0); GtkWidget *wb = gtk_button_new (); GtkWidget *weventbox = gtk_event_box_new (); + /* We are not letting Gtk+ alter display on this, we only keep it here + so we can get it later in xg_show_toolbar_item. */ + gtk_tool_item_set_is_important (ti, !vert_only); + if (wimage && ! text_image) gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0); @@ -4113,7 +4147,7 @@ xg_make_tool_item (FRAME_PTR f, NULL); g_object_set_data (G_OBJECT (wb), XG_FRAME_DATA, (gpointer)f); - + /* Use enter/leave notify to show help. We use the events rather than the GtkButton specific signals "enter" and "leave", so we can have only one callback. The event @@ -4128,7 +4162,7 @@ xg_make_tool_item (FRAME_PTR f, G_CALLBACK (xg_tool_bar_help_callback), (gpointer) (EMACS_INT) i); } - + if (wbutton) *wbutton = wb; return ti; @@ -4142,7 +4176,8 @@ xg_show_toolbar_item (GtkToolItem *ti) int text_image = EQ (style, Qtext_image_horiz); int horiz = both_horiz || text_image; - int show_label = ! EQ (style, Qimage); + int vert_only = ! gtk_tool_item_get_is_important (ti); + int show_label = ! EQ (style, Qimage) && ! (vert_only && horiz); int show_image = ! EQ (style, Qtext); GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti)); @@ -4213,7 +4248,7 @@ xg_update_tool_bar_sizes (FRAME_PTR f) if (pos == 0 || (pos == 1 && x->menubar_widget)) nt = req.height; else nb = req.height; } - + if (nl != FRAME_TOOLBAR_LEFT_WIDTH (f) || nr != FRAME_TOOLBAR_RIGHT_WIDTH (f) || nt != FRAME_TOOLBAR_TOP_HEIGHT (f) @@ -4279,7 +4314,7 @@ update_frame_tool_bar (FRAME_PTR f) wtoolbar = GTK_TOOLBAR (x->toolbar_widget); dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar)); - + for (i = 0; i < f->n_tool_bar_items; ++i) { int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); @@ -4299,7 +4334,8 @@ update_frame_tool_bar (FRAME_PTR f) Lisp_Object specified_file; const char *label = (STRINGP (PROP (TOOL_BAR_ITEM_LABEL)) ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL)) : ""); - + int vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY)); + ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i); if (ti) @@ -4389,7 +4425,7 @@ update_frame_tool_bar (FRAME_PTR f) else { /* Insert an empty (non-image) button */ - ti = xg_make_tool_item (f, NULL, NULL, "", i); + ti = xg_make_tool_item (f, NULL, NULL, "", i, 0); gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1); } continue; @@ -4423,7 +4459,7 @@ update_frame_tool_bar (FRAME_PTR f) } gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); - ti = xg_make_tool_item (f, w, &wbutton, label, i); + ti = xg_make_tool_item (f, w, &wbutton, label, i, vert_only); gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1); gtk_widget_set_sensitive (wbutton, enabled_p); } @@ -4440,6 +4476,7 @@ update_frame_tool_bar (FRAME_PTR f) gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME); gtk_label_set_text (GTK_LABEL (wlbl), label); + gtk_tool_item_set_is_important (ti, !vert_only); if (stock_name && (! old_stock_name || strcmp (old_stock_name, stock_name) != 0)) { @@ -4523,7 +4560,7 @@ free_frame_tool_bar (FRAME_PTR f) BLOCK_INPUT; /* We may have created the toolbar_widget in xg_create_tool_bar, but not the x->handlebox_widget which is created in xg_pack_tool_bar. */ - if (is_packed) + if (is_packed) { if (x->toolbar_in_hbox) 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) /* Free resources, then free IMG. */ img->type->free (f, img); xfree (img); - - /* As display glyphs may still be referring to the image ID, we - must garbage the frame (Bug#6426). */ - SET_FRAME_GARBAGED (f); } } @@ -1471,7 +1467,12 @@ uncache_image (struct frame *f, Lisp_Object spec) { struct image *img = search_image_cache (f, spec, sxhash (spec, 0)); if (img) - free_image (f, img); + { + free_image (f, img); + /* As display glyphs may still be referring to the image ID, we + must garbage the frame (Bug#6426). */ + SET_FRAME_GARBAGED (f); + } } @@ -7096,12 +7097,15 @@ gif_read_from_memory (GifFileType *file, GifByteType *buf, int len) static const int interlace_start[] = {0, 4, 2, 1}; static const int interlace_increment[] = {8, 8, 4, 2}; +#define GIF_LOCAL_DESCRIPTOR_EXTENSION 249 + static int gif_load (struct frame *f, struct image *img) { Lisp_Object file, specified_file; Lisp_Object specified_data; int rc, width, height, x, y, i; + boolean transparent_p; XImagePtr ximg; ColorMapObject *gif_color_map; unsigned long pixel_colors[256]; @@ -7110,6 +7114,7 @@ gif_load (struct frame *f, struct image *img) int ino, image_height, image_width; gif_memory_source memsrc; unsigned char *raster; + unsigned int transparency_color_index; specified_file = image_spec_value (img->spec, QCfile, NULL); specified_data = image_spec_value (img->spec, QCdata, NULL); @@ -7182,6 +7187,18 @@ gif_load (struct frame *f, struct image *img) return 0; } + for (i = 0; i < gif->SavedImages[ino].ExtensionBlockCount; i++) + if ((gif->SavedImages[ino].ExtensionBlocks[i].Function + == GIF_LOCAL_DESCRIPTOR_EXTENSION) + && gif->SavedImages[ino].ExtensionBlocks[i].ByteCount == 4 + /* Transparency enabled? */ + && gif->SavedImages[ino].ExtensionBlocks[i].Bytes[0] & 1) + { + transparent_p = 1; + transparency_color_index + = (unsigned char) gif->SavedImages[ino].ExtensionBlocks[i].Bytes[3]; + } + img->corners[TOP_CORNER] = gif->SavedImages[ino].ImageDesc.Top; img->corners[LEFT_CORNER] = gif->SavedImages[ino].ImageDesc.Left; image_height = gif->SavedImages[ino].ImageDesc.Height; @@ -7220,10 +7237,22 @@ gif_load (struct frame *f, struct image *img) if (gif_color_map) for (i = 0; i < gif_color_map->ColorCount; ++i) { - int r = gif_color_map->Colors[i].Red << 8; - int g = gif_color_map->Colors[i].Green << 8; - int b = gif_color_map->Colors[i].Blue << 8; - pixel_colors[i] = lookup_rgb_color (f, r, g, b); + if (transparent_p && transparency_color_index == i) + { + Lisp_Object specified_bg + = image_spec_value (img->spec, QCbackground, NULL); + pixel_colors[i] = STRINGP (specified_bg) + ? x_alloc_image_color (f, img, specified_bg, + FRAME_BACKGROUND_PIXEL (f)) + : FRAME_BACKGROUND_PIXEL (f); + } + else + { + int r = gif_color_map->Colors[i].Red << 8; + int g = gif_color_map->Colors[i].Green << 8; + int b = gif_color_map->Colors[i].Blue << 8; + pixel_colors[i] = lookup_rgb_color (f, r, g, b); + } } #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; Lisp_Object combine_after_change_buffer; Lisp_Object Qinhibit_modification_hooks; - -extern Lisp_Object Vselect_active_regions, Vsaved_region_selection, Qonly; - /* Check all markers in the current buffer, looking for something invalid. */ @@ -2051,6 +2048,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, /* If `select-active-regions' is non-nil, save the region text. */ if (!NILP (current_buffer->mark_active) + && !inhibit_modification_hooks && XMARKER (current_buffer->mark)->buffer && NILP (Vsaved_region_selection) && (EQ (Vselect_active_regions, Qonly) @@ -2394,5 +2392,3 @@ as well as hooks attached to text properties and overlays. */); defsubr (&Scombine_after_change_execute); } -/* arch-tag: 9b34b886-47d7-465e-a234-299af411b23d - (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 } -/* Set point "temporarily", without checking any text properties. */ - -INLINE void -temp_set_point (struct buffer *buffer, EMACS_INT charpos) -{ - temp_set_point_both (buffer, charpos, - buf_charpos_to_bytepos (buffer, charpos)); -} - /* Set point in BUFFER "temporarily" to CHARPOS, which corresponds to byte position BYTEPOS. */ @@ -1906,6 +1897,15 @@ temp_set_point_both (struct buffer *buffer, BUF_PT (buffer) = charpos; } +/* Set point "temporarily", without checking any text properties. */ + +INLINE void +temp_set_point (struct buffer *buffer, EMACS_INT charpos) +{ + temp_set_point_both (buffer, charpos, + buf_charpos_to_bytepos (buffer, charpos)); +} + /* Set point in BUFFER to CHARPOS. If the target position is before an intangible character, move to an ok place. */ 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); extern INTERVAL merge_interval_left (INTERVAL); extern INTERVAL merge_interval_right (INTERVAL); extern void delete_interval (INTERVAL); -extern INLINE void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT); +extern void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT); extern void graft_intervals_into_buffer (INTERVAL, EMACS_INT, EMACS_INT, struct buffer *, int); extern void verify_interval_modification (struct buffer *, int, int); extern INTERVAL balance_intervals (INTERVAL); -extern INLINE void copy_intervals_to_string (Lisp_Object, struct buffer *, +extern void copy_intervals_to_string (Lisp_Object, struct buffer *, EMACS_INT, EMACS_INT); extern INTERVAL copy_intervals (INTERVAL, EMACS_INT, EMACS_INT); extern 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; static int before_command_key_count; static int before_command_echo_length; -extern int minbuf_level; - -extern int message_enable_multibyte; - /* If non-nil, the function that implements the display of help. It's called with one argument, the help string to display. */ @@ -431,8 +427,6 @@ FILE *dribble; /* Nonzero if input is available. */ int input_pending; -extern char *pending_malloc_warning; - /* Circular buffer for pre-read keyboard input. */ static struct input_event kbd_buffer[KBD_BUFFER_SIZE]; @@ -495,10 +489,10 @@ Lisp_Object Qconfig_changed_event; Lisp_Object Qevent_kind; Lisp_Object Qevent_symbol_elements; -/* menu item parts */ +/* menu and tool bar item parts */ Lisp_Object Qmenu_enable; Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence; -Lisp_Object QCbutton, QCtoggle, QCradio, QClabel; +Lisp_Object QCbutton, QCtoggle, QCradio, QClabel, QCvert_only; /* An event header symbol HEAD may have a property named 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, unsigned long); #endif static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object, - Lisp_Object, const char **, + Lisp_Object, const char *const *, Lisp_Object *, unsigned); static Lisp_Object make_lispy_switch_frame (Lisp_Object); static void save_getcjmp (jmp_buf); @@ -3601,6 +3595,7 @@ event_to_kboard (struct input_event *event) return FRAME_KBOARD (XFRAME (frame)); } +#ifdef subprocesses /* Return the number of slots occupied in kbd_buffer. */ static int @@ -3613,6 +3608,7 @@ kbd_buffer_nr_stored (void) : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr + (kbd_store_ptr - kbd_buffer))); } +#endif /* subprocesses */ Lisp_Object Vthrow_on_input; @@ -3734,6 +3730,7 @@ kbd_buffer_store_event_hold (register struct input_event *event, { *kbd_store_ptr = *event; ++kbd_store_ptr; +#ifdef subprocesses if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ()) { /* 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, #endif stop_polling (); } +#endif /* subprocesses */ } /* If we're inside while-no-input, and this event qualifies @@ -3905,6 +3903,7 @@ kbd_buffer_get_event (KBOARD **kbp, register int c; Lisp_Object obj; +#ifdef subprocesses if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4) { /* Start reading input again, we have processed enough so we can @@ -3916,6 +3915,7 @@ kbd_buffer_get_event (KBOARD **kbp, #endif /* SIGIO */ start_polling (); } +#endif /* subprocesses */ if (noninteractive /* In case we are running as a daemon, only do this before @@ -4752,7 +4752,7 @@ static const int lispy_accent_codes[] = /* This is a list of Lisp names for special "accent" characters. It parallels lispy_accent_codes. */ -static const char *lispy_accent_keys[] = +static const char *const lispy_accent_keys[] = { "dead-circumflex", "dead-grave", @@ -4779,7 +4779,7 @@ static const char *lispy_accent_keys[] = #ifdef HAVE_NTGUI #define FUNCTION_KEY_OFFSET 0x0 -char const *lispy_function_keys[] = +const char *const lispy_function_keys[] = { 0, /* 0 */ @@ -4973,7 +4973,7 @@ char const *lispy_function_keys[] = /* Some of these duplicate the "Media keys" on newer keyboards, but they are delivered to the application in a different way. */ -static const char *lispy_multimedia_keys[] = +static const char *const lispy_multimedia_keys[] = { 0, "browser-back", @@ -5037,7 +5037,7 @@ static const char *lispy_multimedia_keys[] = the XK_kana_A case below. */ #if 0 #ifdef XK_kana_A -static const char *lispy_kana_keys[] = +static const char *const lispy_kana_keys[] = { /* X Keysym value */ 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[] = /* You'll notice that this table is arranged to be conveniently indexed by X Windows keysym values. */ -static const char *lispy_function_keys[] = +static const char *const lispy_function_keys[] = { /* X Keysym value */ @@ -5162,7 +5162,7 @@ static const char *lispy_function_keys[] = /* ISO 9995 Function and Modifier Keys; the first byte is 0xFE. */ #define ISO_FUNCTION_KEY_OFFSET 0xfe00 -static const char *iso_lispy_function_keys[] = +static const char *const iso_lispy_function_keys[] = { 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe00 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xfe08 */ @@ -5185,14 +5185,14 @@ static const char *iso_lispy_function_keys[] = Lisp_Object Vlispy_mouse_stem; -static const char *lispy_wheel_names[] = +static const char *const lispy_wheel_names[] = { "wheel-up", "wheel-down", "wheel-left", "wheel-right" }; /* drag-n-drop events are generated when a set of selected files are dragged from another application and dropped onto an Emacs window. */ -static const char *lispy_drag_n_drop_names[] = +static const char *const lispy_drag_n_drop_names[] = { "drag-n-drop" }; @@ -5203,7 +5203,7 @@ Lisp_Object Qup, Qdown, Qbottom, Qend_scroll; Lisp_Object Qtop, Qratio; /* An array of scroll bar parts, indexed by an enum scroll_bar_part value. */ -const Lisp_Object *scroll_bar_parts[] = { +static Lisp_Object *const scroll_bar_parts[] = { &Qabove_handle, &Qhandle, &Qbelow_handle, &Qup, &Qdown, &Qtop, &Qbottom, &Qend_scroll, &Qratio }; @@ -5243,24 +5243,22 @@ EMACS_INT double_click_fuzz; int double_click_count; -/* Return position of a mouse click or wheel event */ +/* X and Y are frame-relative coordinates for a click or wheel event. + Return a Lisp-style event list. */ static Lisp_Object -make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, +make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, unsigned long time) { - Lisp_Object window; enum window_part part; Lisp_Object posn = Qnil; Lisp_Object extra_info = Qnil; - int wx, wy; - - /* Set `window' to the window under frame pixel coordinates (x,y) */ - if (f) - window = window_from_coordinates (f, XINT (*x), XINT (*y), - &part, &wx, &wy, 0); - else - window = Qnil; + /* Coordinate pixel positions to return. */ + int xret = 0, yret = 0; + /* The window under frame pixel coordinates (x,y) */ + Lisp_Object window = f + ? window_from_coordinates (f, XINT (x), XINT (y), &part, 0) + : Qnil; if (WINDOWP (window)) { @@ -5268,102 +5266,114 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, struct window *w = XWINDOW (window); Lisp_Object string_info = Qnil; EMACS_INT textpos = -1; - int rx = -1, ry = -1; - int dx = -1, dy = -1; + int col = -1, row = -1; + int dx = -1, dy = -1; int width = -1, height = -1; Lisp_Object object = Qnil; - /* Set event coordinates to window-relative coordinates - for constructing the Lisp event below. */ - XSETINT (*x, wx); - XSETINT (*y, wy); + /* Pixel coordinates relative to the window corner. */ + int wx = XINT (x) - WINDOW_LEFT_EDGE_X (w); + int wy = XINT (y) - WINDOW_TOP_EDGE_Y (w); + /* For text area clicks, return X, Y relative to the corner of + this text area. Note that dX, dY etc are set below, by + buffer_posn_from_coords. */ if (part == ON_TEXT) { - wx += WINDOW_LEFT_MARGIN_WIDTH (w); + xret = XINT (x) - window_box_left (w, TEXT_AREA); + yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } + /* For mode line and header line clicks, return X, Y relative to + the left window edge. Use mode_line_string to look for a + string on the click position. */ else if (part == ON_MODE_LINE || part == ON_HEADER_LINE) { - /* Mode line or header line. Look for a string under - the mouse that may have a `local-map' property. */ Lisp_Object string; EMACS_INT charpos; - posn = part == ON_MODE_LINE ? Qmode_line : Qheader_line; - rx = wx, ry = wy; - string = mode_line_string (w, part, &rx, &ry, &charpos, + posn = (part == ON_MODE_LINE) ? Qmode_line : Qheader_line; + /* Note that mode_line_string takes COL, ROW as pixels and + converts them to characters. */ + col = wx; + row = wy; + string = mode_line_string (w, part, &col, &row, &charpos, &object, &dx, &dy, &width, &height); if (STRINGP (string)) string_info = Fcons (string, make_number (charpos)); - if (w == XWINDOW (selected_window) - && current_buffer == XBUFFER (w->buffer)) - textpos = PT; - else - textpos = XMARKER (w->pointm)->charpos; - } - else if (part == ON_VERTICAL_BORDER) - { - posn = Qvertical_line; - wx = -1; - dx = 0; - width = 1; + textpos = (w == XWINDOW (selected_window) + && current_buffer == XBUFFER (w->buffer)) + ? PT : XMARKER (w->pointm)->charpos; + + xret = wx; + yret = wy; } + /* For fringes and margins, Y is relative to the area's (and the + window's) top edge, while X is meaningless. */ else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) { Lisp_Object string; EMACS_INT charpos; posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; - rx = wx, ry = wy; - string = marginal_area_string (w, part, &rx, &ry, &charpos, + col = wx; + row = wy; + string = marginal_area_string (w, part, &col, &row, &charpos, &object, &dx, &dy, &width, &height); if (STRINGP (string)) string_info = Fcons (string, make_number (charpos)); - if (part == ON_LEFT_MARGIN) - wx = 0; - else - wx = window_box_right_offset (w, TEXT_AREA) - 1; + yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } else if (part == ON_LEFT_FRINGE) { posn = Qleft_fringe; - rx = 0; - dx = wx; - wx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? 0 - : window_box_width (w, LEFT_MARGIN_AREA)); - dx -= wx; + col = 0; + dx = wx + - (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? 0 : window_box_width (w, LEFT_MARGIN_AREA)); + dy = yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } else if (part == ON_RIGHT_FRINGE) { posn = Qright_fringe; - rx = 0; - dx = wx; - wx = (window_box_width (w, LEFT_MARGIN_AREA) - + window_box_width (w, TEXT_AREA) - + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? window_box_width (w, RIGHT_MARGIN_AREA) - : 0)); - dx -= wx; + col = 0; + dx = wx + - window_box_width (w, LEFT_MARGIN_AREA) + - window_box_width (w, TEXT_AREA) + - (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? window_box_width (w, RIGHT_MARGIN_AREA) + : 0); + dy = yret = wy - WINDOW_HEADER_LINE_HEIGHT (w); } - else + else if (part == ON_VERTICAL_BORDER) { - /* Note: We have no special posn for part == ON_SCROLL_BAR. */ - wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); + posn = Qvertical_line; + width = 1; + dx = 0; + dy = yret = wy; } + /* Nothing special for part == ON_SCROLL_BAR. */ + /* For clicks in the text area, fringes, or margins, call + buffer_posn_from_coords to extract TEXTPOS, the buffer + position nearest to the click. */ if (textpos < 0) { Lisp_Object string2, object2 = Qnil; struct display_pos p; int dx2, dy2; int width2, height2; - string2 = buffer_posn_from_coords (w, &wx, &wy, &p, + /* The pixel X coordinate passed to buffer_posn_from_coords + is the X coordinate relative to the text area for + text-area clicks, zero otherwise. */ + int x2 = (part == ON_TEXT) ? xret : 0; + int y2 = wy; + + string2 = buffer_posn_from_coords (w, &x2, &y2, &p, &object2, &dx2, &dy2, &width2, &height2); textpos = CHARPOS (p.pos); - if (rx < 0) rx = wx; - if (ry < 0) ry = wy; + if (col < 0) col = x2; + if (row < 0) row = y2; if (dx < 0) dx = dx2; if (dy < 0) dy = dy2; if (width < 0) width = width2; @@ -5394,34 +5404,27 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, #endif /* Object info */ - extra_info = Fcons (object, - Fcons (Fcons (make_number (dx), - make_number (dy)), - Fcons (Fcons (make_number (width), - make_number (height)), - Qnil))); + extra_info + = list3 (object, + Fcons (make_number (dx), make_number (dy)), + Fcons (make_number (width), make_number (height))); /* String info */ extra_info = Fcons (string_info, Fcons (make_number (textpos), - Fcons (Fcons (make_number (rx), - make_number (ry)), + Fcons (Fcons (make_number (col), + make_number (row)), extra_info))); } else if (f != 0) - { - XSETFRAME (window, f); - } + XSETFRAME (window, f); else - { - window = Qnil; - XSETFASTINT (*x, 0); - XSETFASTINT (*y, 0); - } + window = Qnil; return Fcons (window, Fcons (posn, - Fcons (Fcons (*x, *y), + Fcons (Fcons (make_number (xret), + make_number (yret)), Fcons (make_number (time), extra_info)))); } @@ -5610,14 +5613,6 @@ make_lispy_event (struct input_event *event) int hpos; int i; -#if 0 - /* Activate the menu bar on the down event. If the - up event comes in before the menu code can deal with it, - just ignore it. */ - if (! (event->modifiers & down_modifier)) - return Qnil; -#endif - /* Find the menu bar item under `column'. */ item = Qnil; items = FRAME_MENU_BAR_ITEMS (f); @@ -5649,7 +5644,7 @@ make_lispy_event (struct input_event *event) } #endif /* not USE_X_TOOLKIT && not USE_GTK && not HAVE_NS */ - position = make_lispy_position (f, &event->x, &event->y, + position = make_lispy_position (f, event->x, event->y, event->timestamp); } #ifndef USE_TOOLKIT_SCROLL_BARS @@ -5749,23 +5744,21 @@ make_lispy_event (struct input_event *event) return Qnil; event->modifiers &= ~up_modifier; -#if 0 /* Formerly we treated an up with no down as a click event. */ - if (!CONSP (start_pos)) - event->modifiers |= click_modifier; - else -#endif + { - Lisp_Object down; + Lisp_Object new_down, down; EMACS_INT xdiff = double_click_fuzz, ydiff = double_click_fuzz; /* The third element of every position should be the (x,y) pair. */ down = Fcar (Fcdr (Fcdr (start_pos))); + new_down = Fcar (Fcdr (Fcdr (position))); + if (CONSP (down) && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down))) { - xdiff = XINT (event->x) - XINT (XCAR (down)); - ydiff = XINT (event->y) - XINT (XCDR (down)); + xdiff = XINT (XCAR (new_down)) - XINT (XCAR (down)); + ydiff = XINT (XCDR (new_down)) - XINT (XCDR (down)); } if (ignore_mouse_drag_p) @@ -5848,7 +5841,7 @@ make_lispy_event (struct input_event *event) if (! FRAME_LIVE_P (f)) return Qnil; - position = make_lispy_position (f, &event->x, &event->y, + position = make_lispy_position (f, event->x, event->y, event->timestamp); /* Set double or triple modifiers to indicate the wheel speed. */ @@ -5868,10 +5861,8 @@ make_lispy_event (struct input_event *event) else abort (); - if (FRAME_WINDOW_P (f)) - fuzz = double_click_fuzz; - else - fuzz = double_click_fuzz / 8; + fuzz = FRAME_WINDOW_P (f) + ? double_click_fuzz : double_click_fuzz / 8; if (event->modifiers & up_modifier) { @@ -6009,7 +6000,7 @@ make_lispy_event (struct input_event *event) if (! FRAME_LIVE_P (f)) return Qnil; - position = make_lispy_position (f, &event->x, &event->y, + position = make_lispy_position (f, event->x, event->y, event->timestamp); head = modify_event_symbol (0, event->modifiers, @@ -6092,8 +6083,8 @@ make_lispy_event (struct input_event *event) start_pos_ptr = &AREF (button_down_location, button); start_pos = *start_pos_ptr; - position = make_lispy_position (f, &event->x, &event->y, - event->timestamp); + position = make_lispy_position (f, event->x, event->y, + event->timestamp); if (event->modifiers & down_modifier) *start_pos_ptr = Fcopy_alist (position); @@ -6152,25 +6143,19 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa part_sym = *scroll_bar_parts[(int) part]; return Fcons (Qscroll_bar_movement, - (Fcons (Fcons (bar_window, - Fcons (Qvertical_scroll_bar, - Fcons (Fcons (x, y), - Fcons (make_number (time), - Fcons (part_sym, - Qnil))))), - Qnil))); + Fcons (list5 (bar_window, + Qvertical_scroll_bar, + Fcons (x, y), + make_number (time), + part_sym), + Qnil)); } - /* Or is it an ordinary mouse movement? */ else { Lisp_Object position; - - position = make_lispy_position (frame, &x, &y, time); - - return Fcons (Qmouse_movement, - Fcons (position, - Qnil)); + position = make_lispy_position (frame, x, y, time); + return list2 (Qmouse_movement, position); } } @@ -6351,7 +6336,7 @@ apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_ } -static const char *modifier_names[] = +static const char *const modifier_names[] = { "up", "down", "drag", "click", "double", "triple", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -6571,7 +6556,7 @@ reorder_modifiers (Lisp_Object symbol) static Lisp_Object modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object symbol_kind, - Lisp_Object name_alist_or_stem, const char **name_table, + Lisp_Object name_alist_or_stem, const char *const *name_table, Lisp_Object *symbol_table, unsigned int table_size) { Lisp_Object value; @@ -7074,10 +7059,12 @@ tty_read_avail_input (struct terminal *terminal, int n_to_read, i; struct tty_display_info *tty = terminal->display_info.tty; int nread = 0; +#ifdef subprocesses int buffer_free = KBD_BUFFER_SIZE - kbd_buffer_nr_stored () - 1; if (kbd_on_hold_p () || buffer_free <= 0) return 0; +#endif /* subprocesses */ if (!terminal->name) /* Don't read from a dead terminal. */ return 0; @@ -7159,9 +7146,11 @@ tty_read_avail_input (struct terminal *terminal, #endif #endif +#ifdef subprocesses /* Don't read more than we can store. */ if (n_to_read > buffer_free) n_to_read = buffer_free; +#endif /* subprocesses */ /* Now read; for one reason or another, this will not block. NREAD is set to the number of chars read. */ @@ -8281,9 +8270,12 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) if (NILP (menu_item_eval_property (value))) return 0; } - else if (EQ (key, QChelp)) + else if (EQ (key, QChelp)) /* `:help HELP-STRING'. */ PROP (TOOL_BAR_ITEM_HELP) = value; + else if (EQ (key, QCvert_only)) + /* `:vert-only t/nil'. */ + PROP (TOOL_BAR_ITEM_VERT_ONLY) = value; else if (EQ (key, QClabel)) { const char *bad_label = "!!?GARBLED ITEM?!!"; @@ -11100,10 +11092,10 @@ See also `current-input-mode'. */) #ifndef DOS_NT /* this causes startup screen to be restored and messes with the mouse */ reset_all_sys_modes (); -#endif interrupt_input = new_interrupt_input; -#ifndef DOS_NT init_all_sys_modes (); +#else + interrupt_input = new_interrupt_input; #endif #ifdef POLL_FOR_INPUT @@ -11327,7 +11319,7 @@ The `posn-' functions access elements of such lists. */) CHECK_LIVE_FRAME (frame_or_window); - return make_lispy_position (XFRAME (frame_or_window), &x, &y, 0); + return make_lispy_position (XFRAME (frame_or_window), x, y, 0); } DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_point, 0, 2, 0, @@ -11641,6 +11633,8 @@ syms_of_keyboard (void) staticpro (&QCradio); QClabel = intern_c_string (":label"); staticpro (&QClabel); + QCvert_only = intern_c_string (":vert-only"); + staticpro (&QCvert_only); Qmode_line = intern_c_string ("mode-line"); staticpro (&Qmode_line); @@ -12440,5 +12434,3 @@ mark_kboards (void) } } -/* arch-tag: 774e34d7-6d31-42f3-8397-e079a4e4c9ca - (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; extern int quit_char; +extern int timers_run; + extern int parse_menu_item (Lisp_Object, int); extern void echo_now (void); @@ -534,5 +536,3 @@ extern int tty_read_avail_input (struct terminal *, int, struct input_event *); extern EMACS_TIME timer_check (int); -/* arch-tag: 769cbade-1ba9-4950-b886-db265b061aa3 - (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 struct { - EMACS_INT val : VALBITS; + /* Use explict signed, the signedness of a bit-field of type + int is implementation defined. */ + signed EMACS_INT val : VALBITS; enum Lisp_Type type : GCTYPEBITS; } s; struct @@ -290,7 +292,9 @@ union Lisp_Object struct { enum Lisp_Type type : GCTYPEBITS; - EMACS_INT val : VALBITS; + /* Use explict signed, the signedness of a bit-field of type + int is implementation defined. */ + signed EMACS_INT val : VALBITS; } s; struct { @@ -447,20 +451,8 @@ enum pvec_type #endif #define XHASH(a) ((a).i) - #define XTYPE(a) ((enum Lisp_Type) (a).u.type) - -#ifdef EXPLICIT_SIGN_EXTEND -/* Make sure we sign-extend; compilers have been known to fail to do so. - We additionally cast to EMACS_INT since it seems that some compilers - have been known to fail to do so, even though the bitfield is declared - as EMACS_INT already. */ -#define XINT(a) ((((EMACS_INT) (a).s.val) << (BITS_PER_EMACS_INT - VALBITS)) \ - >> (BITS_PER_EMACS_INT - VALBITS)) -#else #define XINT(a) ((a).s.val) -#endif /* EXPLICIT_SIGN_EXTEND */ - #define XUINT(a) ((a).u.val) #ifdef USE_LSB_TAG @@ -1589,6 +1581,41 @@ typedef struct { /* The ID of the mode line highlighting face. */ #define GLYPH_MODE_LINE_FACE 1 +/* Structure to hold mouse highlight data. This is here because other + header files need it for defining struct x_output etc. */ +typedef struct { + /* These variables describe the range of text currently shown in its + mouse-face, together with the window they apply to. As long as + the mouse stays within this range, we need not redraw anything on + its account. Rows and columns are glyph matrix positions in + MOUSE_FACE_WINDOW. */ + int mouse_face_beg_row, mouse_face_beg_col; + int mouse_face_beg_x, mouse_face_beg_y; + int mouse_face_end_row, mouse_face_end_col; + int mouse_face_end_x, mouse_face_end_y; + int mouse_face_past_end; + Lisp_Object mouse_face_window; + int mouse_face_face_id; + Lisp_Object mouse_face_overlay; + + /* 1 if a mouse motion event came and we didn't handle it right away because + gc was in progress. */ + int mouse_face_deferred_gc; + + /* FRAME and X, Y position of mouse when last checked for + highlighting. X and Y can be negative or out of range for the frame. */ + struct frame *mouse_face_mouse_frame; + int mouse_face_mouse_x, mouse_face_mouse_y; + + /* Nonzero means defer mouse-motion highlighting. */ + int mouse_face_defer; + + /* Nonzero means that the mouse highlight should not be shown. */ + int mouse_face_hidden; + + int mouse_face_image_state; +} Mouse_HLInfo; + /* Data type checking */ #define NILP(x) EQ (x, Qnil) @@ -2665,11 +2692,15 @@ extern Lisp_Object Qimage, Qtext, Qboth, Qboth_horiz, Qtext_image_horiz; extern Lisp_Object Qspace, Qcenter, QCalign_to; extern Lisp_Object Qbar, Qhbar, Qbox, Qhollow; extern Lisp_Object Qleft_margin, Qright_margin; +extern Lisp_Object Qglyphless_char; extern Lisp_Object Vmessage_log_max; extern Lisp_Object QCdata, QCfile; extern Lisp_Object QCmap; extern Lisp_Object Qrisky_local_variable; extern Lisp_Object Vinhibit_redisplay; +extern struct frame *last_glyphless_glyph_frame; +extern unsigned last_glyphless_glyph_face_id; +extern int last_glyphless_glyph_merged_face_id; extern int message_enable_multibyte; extern int noninteractive_need_newline; extern EMACS_INT scroll_margin; @@ -2727,6 +2758,8 @@ extern void memory_full (void) NO_RETURN; extern void buffer_memory_full (void) NO_RETURN; extern int survives_gc_p (Lisp_Object); extern void mark_object (Lisp_Object); +extern void refill_memory_reserve (void); +extern const char *pending_malloc_warning; extern Lisp_Object Vpurify_flag; extern Lisp_Object Vmemory_full; extern Lisp_Object *stack_base; @@ -2823,7 +2856,8 @@ extern void syms_of_chartab (void); /* Defined in print.c */ extern Lisp_Object Vprin1_to_string_buffer; extern Lisp_Object Vprint_level, Vprint_length; -extern void debug_print (Lisp_Object); +extern void debug_print (Lisp_Object) EXTERNALLY_VISIBLE; +extern void safe_debug_print (Lisp_Object) EXTERNALLY_VISIBLE; EXFUN (Fprin1, 2); EXFUN (Fprin1_to_string, 2); EXFUN (Fprinc, 2); @@ -3226,6 +3260,8 @@ extern Lisp_Object Qdisabled, QCfilter; extern Lisp_Object Qabove_handle, Qhandle, Qbelow_handle; extern Lisp_Object Qup, Qdown, Qbottom, Qend_scroll; extern Lisp_Object Qtop, Qratio; +extern Lisp_Object Vsaved_region_selection; +extern Lisp_Object Vselect_active_regions; extern Lisp_Object Vtty_erase_char, Vhelp_form, Vtop_level; extern Lisp_Object Vthrow_on_input; extern int input_pending; @@ -3595,7 +3631,6 @@ extern void syms_of_xfns (void); extern void syms_of_xsmfns (void); /* Defined in xselect.c */ -EXFUN (Fx_send_client_event, 6); extern void syms_of_xselect (void); /* 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 @@ /* Lisp parsing and input streams. - Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, - 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, 1997, + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -557,8 +558,6 @@ readbyte_from_string (int c, Lisp_Object readcharfun) encoded in `emacs-mule' and the first byte is already read in C. */ -extern char emacs_mule_bytes[256]; - static int read_emacs_mule_char (int c, int (*readbyte) (int, Lisp_Object), Lisp_Object readcharfun) { @@ -589,7 +588,7 @@ read_emacs_mule_char (int c, int (*readbyte) (int, Lisp_Object), Lisp_Object rea if (len == 2) { - charset = emacs_mule_charset[buf[0]]; + charset = CHARSET_FROM_ID (emacs_mule_charset[buf[0]]); code = buf[1] & 0x7F; } else if (len == 3) @@ -597,18 +596,18 @@ read_emacs_mule_char (int c, int (*readbyte) (int, Lisp_Object), Lisp_Object rea if (buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_11 || buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_12) { - charset = emacs_mule_charset[buf[1]]; + charset = CHARSET_FROM_ID (emacs_mule_charset[buf[1]]); code = buf[2] & 0x7F; } else { - charset = emacs_mule_charset[buf[0]]; + charset = CHARSET_FROM_ID (emacs_mule_charset[buf[0]]); code = ((buf[1] << 8) | buf[2]) & 0x7F7F; } } else { - charset = emacs_mule_charset[buf[1]]; + charset = CHARSET_FROM_ID (emacs_mule_charset[buf[1]]); code = ((buf[2] << 8) | buf[3]) & 0x7F7F; } c = DECODE_CHAR (charset, code); @@ -1082,6 +1081,10 @@ Loading a file records its definitions, and its `provide' and `require' calls, in an element of `load-history' whose car is the file name loaded. See `load-history'. +While the file is in the process of being loaded, the variable +`load-in-progress' is non-nil and the variable `load-file-name' +is bound to the file's name. + Return t if the file exists and loads successfully. */) (Lisp_Object file, Lisp_Object noerror, Lisp_Object nomessage, Lisp_Object nosuffix, Lisp_Object must_suffix) { @@ -2770,7 +2773,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) old-style. For Emacs-25, we should completely remove this first_in_list exception (old-style can still be obtained via "(\`" anyway). */ - if (first_in_list && next_char == ' ') + if (!new_backquote_flag && first_in_list && next_char == ' ') { Vold_style_backquotes = Qt; goto default_label; @@ -2787,33 +2790,48 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) } } case ',': - if (new_backquote_flag) - { - Lisp_Object comma_type = Qnil; - Lisp_Object value; - int ch = READCHAR; - - if (ch == '@') - comma_type = Qcomma_at; - else if (ch == '.') - comma_type = Qcomma_dot; - else - { - if (ch >= 0) UNREAD (ch); - comma_type = Qcomma; - } + { + int next_char = READCHAR; + UNREAD (next_char); + /* Transition from old-style to new-style: + It used to be impossible to have a new-style , other than within + a new-style `. This is sufficient when ` and , are used in the + normal way, but ` and , can also appear in args to macros that + will not interpret them in the usual way, in which case , may be + used without any ` anywhere near. + So we now use the same heuristic as for backquote: old-style + unquotes are only recognized when first on a list, and when + followed by a space. + Because it's more difficult to peak 2 chars ahead, a new-style + ,@ can still not be used outside of a `, unless it's in the middle + of a list. */ + if (new_backquote_flag + || !first_in_list + || (next_char != ' ' && next_char != '@')) + { + Lisp_Object comma_type = Qnil; + Lisp_Object value; + int ch = READCHAR; - new_backquote_flag--; - value = read0 (readcharfun); - new_backquote_flag++; - return Fcons (comma_type, Fcons (value, Qnil)); - } - else - { - Vold_style_backquotes = Qt; - goto default_label; - } + if (ch == '@') + comma_type = Qcomma_at; + else if (ch == '.') + comma_type = Qcomma_dot; + else + { + if (ch >= 0) UNREAD (ch); + comma_type = Qcomma; + } + value = read0 (readcharfun); + return Fcons (comma_type, Fcons (value, Qnil)); + } + else + { + Vold_style_backquotes = Qt; + goto default_label; + } + } case '?': { int modifiers; @@ -2840,26 +2858,9 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) c |= modifiers; next_char = READCHAR; - if (next_char == '.') - { - /* Only a dotted-pair dot is valid after a char constant. */ - int next_next_char = READCHAR; - UNREAD (next_next_char); - - ok = (next_next_char <= 040 - || (next_next_char < 0200 - && (strchr ("\"';([#?", next_next_char) - || (!first_in_list && next_next_char == '`') - || (new_backquote_flag && next_next_char == ',')))); - } - else - { - ok = (next_char <= 040 - || (next_char < 0200 - && (strchr ("\"';()[]#?", next_char) - || (!first_in_list && next_char == '`') - || (new_backquote_flag && next_char == ',')))); - } + ok = (next_char <= 040 + || (next_char < 0200 + && (strchr ("\"';()[]#?`,.", next_char)))); UNREAD (next_char); if (ok) return make_number (c); @@ -3001,9 +3002,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) if (next_char <= 040 || (next_char < 0200 - && (strchr ("\"';([#?", next_char) - || (!first_in_list && next_char == '`') - || (new_backquote_flag && next_char == ',')))) + && (strchr ("\"';([#?`,", next_char)))) { *pch = c; return Qnil; @@ -3028,9 +3027,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) while (c > 040 && c != 0x8a0 /* NBSP */ && (c >= 0200 - || (!strchr ("\"';()[]#", c) - && !(!first_in_list && c == '`') - && !(new_backquote_flag && c == ',')))) + || !(strchr ("\"';()[]#`,", c)))) { if (end - p < MAX_MULTIBYTE_LENGTH) { @@ -4046,9 +4043,9 @@ defalias (sname, string) } #endif /* NOTDEF */ -/* Define an "integer variable"; a symbol whose value is forwarded - to a C variable of type int. Sample call: - DEFVAR_INT ("emacs-priority", &emacs_priority, "Documentation"); */ +/* Define an "integer variable"; a symbol whose value is forwarded to a + C variable of type int. Sample call (munged w "xx" to fool make-docfile): + DEFxxVAR_INT ("emacs-priority", &emacs_priority, "Documentation"); */ void defvar_int (struct Lisp_Intfwd *i_fwd, const char *namestring, EMACS_INT *address) @@ -4550,8 +4547,7 @@ to load. See also `load-dangerous-libraries'. */); doc: /* If non-nil, use lexical binding when evaluating code. This only applies to code evaluated by `eval-buffer' and `eval-region'. This variable is automatically set from the file variables of an interpreted - lisp file read using `load'. -This variable automatically becomes buffer-local when set. */); + lisp file read using `load'. */); Fmake_variable_buffer_local (Qlexical_binding); DEFVAR_LISP ("eval-buffer-list", &Veval_buffer_list, @@ -4646,5 +4642,3 @@ This variable automatically becomes buffer-local when set. */); staticpro (&Qrehash_threshold); } -/* arch-tag: a0d02733-0f96-4844-a659-9fd53c4f414d - (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/>. */ /* __alpha defined automatically */ -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long 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/>. */ #define EMACS_INT long #define EMACS_UINT unsigned long -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long 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 @@ -/* Machine description file for ARM-based non-RISCiX machines. - -Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ - -/* arch-tag: 07856f0c-f0c8-4bd8-99af-0b7fa1e5ee42 - (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 @@ -/* machine description file for hp9000 series 800 machines. - -Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ - -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - -/* arch-tag: 809436e6-1645-4b92-b40d-2de5d6e7227c - (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/>. */ #define EMACS_INT long #define EMACS_UINT unsigned long -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long 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 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long 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/>. */ #define EMACS_INT long #define EMACS_UINT unsigned long -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#undef EXPLICIT_SIGN_EXTEND - /* On the 64 bit architecture, we can use 60 bits for addresses */ #define VALBITS 60 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 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for 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/>. */ #define m68k #endif -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - #ifdef GNU_LINUX #ifdef __ELF__ #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 @@ -/* m- file for Mips machines. - -Copyright (C) 1987, 1992, 1999, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ - -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - -/* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee - (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 @@ -/* Machine description file for SuperH. */ - -/* arch-tag: 1b01b84f-f044-4afa-aa4b-caa54ec38966 - (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/>. */ /* __sparc__ is defined by the compiler by default. */ -/* XINT must explicitly sign-extend - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long 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/>. */ does not define it automatically. Ones defined so far include m68k and many others */ -/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend - the 24-bit bit field into an int. In other words, if bit fields - are always unsigned. - - This flag only matters if you use USE_LISP_UNION_TYPE. */ -#define EXPLICIT_SIGN_EXTEND - /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long 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 @@ -/* Machine description file for Tensilica Xtensa. - -Add a license notice if this grows to > 10 lines of code. */ - -/* arch-tag: fe5872de-d565-4d81-8fe0-ea19865b3e6a - (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/>. */ #include "keymap.h" #include "termhooks.h" -extern int quit_char; - /* List of buffers for use as minibuffers. The first element of the list is used for the outermost minibuffer invocation, the next element is used for a recursive minibuffer @@ -2242,5 +2240,3 @@ properties. */); defsubr (&Scompleting_read); } -/* arch-tag: 8f69b601-fba3-484c-a6dd-ceaee54a7a73 - (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] = localtime to localtime_r, since many localtime_r implementations are buggy. */ static struct tm * -my_mktime_localtime_r (t, tp) - const time_t *t; - struct tm *tp; +my_mktime_localtime_r (const time_t *t, struct tm *tp) { struct tm *l = localtime (t); if (! l) @@ -130,9 +128,7 @@ my_mktime_localtime_r (t, tp) If TP is null, return a nonzero value. If overflow occurs, yield the low order bits of the correct answer. */ static time_t -ydhms_tm_diff (year, yday, hour, min, sec, tp) - int year, yday, hour, min, sec; - const struct tm *tp; +ydhms_tm_diff (int year, int yday, int hour, int min, int sec, const struct tm *tp) { if (!tp) return 1; @@ -163,14 +159,8 @@ ydhms_tm_diff (year, yday, hour, min, sec, tp) If *T is out of range for conversion, adjust it so that it is the nearest in-range value and then convert that. */ static struct tm * -ranged_convert (convert, t, tp) -#ifdef PROTOTYPES - struct tm *(*convert) (const time_t *, struct tm *); -#else - struct tm *(*convert)(); -#endif - time_t *t; - struct tm *tp; +ranged_convert (struct tm *(*convert) (const time_t *, struct tm *), + time_t *t, struct tm *tp) { struct tm *r; @@ -217,14 +207,8 @@ ranged_convert (convert, t, tp) compared to what the result would be for UTC without leap seconds. If *OFFSET's guess is correct, only one CONVERT call is needed. */ time_t -__mktime_internal (tp, convert, offset) - struct tm *tp; -#ifdef PROTOTYPES - struct tm *(*convert) (const time_t *, struct tm *); -#else - struct tm *(*convert)(); -#endif - time_t *offset; +__mktime_internal (struct tm *tp, struct tm *(*convert) (const time_t *, struct tm *), + time_t *offset) { time_t t, dt, t0, t1, t2; struct tm tm; @@ -558,5 +542,3 @@ compile-command: "gcc -DDEBUG -DHAVE_LIMITS_H -DSTDC_HEADERS -Wall -W -O -g mkti End: */ -/* arch-tag: 9456752f-7ddd-47cb-8286-fa807b1355ae - (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) if (current_rows != *rows || current_cols != *cols) { struct frame *f = SELECTED_FRAME(); - struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); - Lisp_Object window = dpyinfo->mouse_face_window; + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); + Lisp_Object window = hlinfo->mouse_face_window; if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) { - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; } } @@ -941,551 +941,79 @@ static Lisp_Object last_mouse_window; static int mouse_preempted = 0; /* non-zero when XMenu gobbles mouse events */ -/* Set the mouse pointer shape according to whether it is in the - area where the mouse highlight is in effect. */ -static void -IT_set_mouse_pointer (int mode) +int +popup_activated (void) { - /* A no-op for now. DOS text-mode mouse pointer doesn't offer too - many possibilities to change its shape, and the available - functionality pretty much sucks (e.g., almost every reasonable - shape will conceal the character it is on). Since the color of - the pointer changes in the highlighted area, it is not clear to - me whether anything else is required, anyway. */ + return mouse_preempted; } -/* Display the active region described by mouse_face_* - in its mouse-face if HL > 0, in its normal face if HL = 0. */ -static void -show_mouse_face (struct tty_display_info *dpyinfo, int hl) +/* Draw TEXT_AREA glyphs between START and END of glyph row ROW on + window W. X is relative to TEXT_AREA in W. HL is a face override + for drawing the glyphs. */ +void +tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row, + int start_hpos, int end_hpos, + enum draw_glyphs_face hl) { - struct window *w = XWINDOW (dpyinfo->mouse_face_window); struct frame *f = XFRAME (WINDOW_FRAME (w)); - int i; - struct face *fp; struct tty_display_info *tty = FRAME_TTY (f); + Mouse_HLInfo *hlinfo = &tty->mouse_highlight; - - /* If window is in the process of being destroyed, don't bother - doing anything. */ - if (w->current_matrix == NULL) - goto set_cursor_shape; - - /* Recognize when we are called to operate on rows that don't exist - anymore. This can happen when a window is split. */ - if (dpyinfo->mouse_face_end_row >= w->current_matrix->nrows) - goto set_cursor_shape; - - /* There's no sense to do anything if the mouse face isn't realized. */ - if (hl > 0) - { - if (dpyinfo->mouse_face_hidden) - goto set_cursor_shape; - - fp = FACE_FROM_ID (SELECTED_FRAME(), dpyinfo->mouse_face_face_id); - if (!fp) - goto set_cursor_shape; - } - - /* Note that mouse_face_beg_row etc. are window relative. */ - for (i = dpyinfo->mouse_face_beg_row; - i <= dpyinfo->mouse_face_end_row; - i++) - { - int start_hpos, end_hpos; - struct glyph_row *row = MATRIX_ROW (w->current_matrix, i); - - /* Don't do anything if row doesn't have valid contents. */ - if (!row->enabled_p) - continue; - - /* For all but the first row, the highlight starts at column 0. */ - if (i == dpyinfo->mouse_face_beg_row) - start_hpos = dpyinfo->mouse_face_beg_col; - else - start_hpos = 0; - - if (i == dpyinfo->mouse_face_end_row) - end_hpos = dpyinfo->mouse_face_end_col; - else - end_hpos = row->used[TEXT_AREA]; - - if (end_hpos <= start_hpos) - continue; - /* Record that some glyphs of this row are displayed in - mouse-face. */ - row->mouse_face_p = hl > 0; - if (hl > 0) - { - int vpos = row->y + WINDOW_TOP_EDGE_Y (w); - int kstart = start_hpos + WINDOW_LEFT_EDGE_X (w); - int nglyphs = end_hpos - start_hpos; - int offset = ScreenPrimary + 2*(vpos*screen_size_X + kstart) + 1; - int start_offset = offset; - - if (tty->termscript) - fprintf (tty->termscript, "\n<MH+ %d-%d:%d>", - kstart, kstart + nglyphs - 1, vpos); - - mouse_off (); - IT_set_face (dpyinfo->mouse_face_face_id); - /* Since we are going to change only the _colors_ of the - displayed text, there's no need to go through all the - pain of generating and encoding the text from the glyphs. - Instead, we simply poke the attribute byte of each - affected position in video memory with the colors - computed by IT_set_face! */ - _farsetsel (_dos_ds); - while (nglyphs--) - { - _farnspokeb (offset, ScreenAttrib); - offset += 2; - } - if (screen_virtual_segment) - dosv_refresh_virtual_screen (start_offset, end_hpos - start_hpos); - mouse_on (); - } - else - { - /* We are removing a previously-drawn mouse highlight. The - safest way to do so is to redraw the glyphs anew, since - all kinds of faces and display tables could have changed - behind our back. */ - int nglyphs = end_hpos - start_hpos; - int save_x = new_pos_X, save_y = new_pos_Y; - - if (end_hpos >= row->used[TEXT_AREA]) - nglyphs = row->used[TEXT_AREA] - start_hpos; - - /* IT_write_glyphs writes at cursor position, so we need to - temporarily move cursor coordinates to the beginning of - the highlight region. */ - new_pos_X = start_hpos + WINDOW_LEFT_EDGE_X (w); - new_pos_Y = row->y + WINDOW_TOP_EDGE_Y (w); - - if (tty->termscript) - fprintf (tty->termscript, "<MH- %d-%d:%d>", - new_pos_X, new_pos_X + nglyphs - 1, new_pos_Y); - IT_write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); - if (tty->termscript) - fputs ("\n", tty->termscript); - new_pos_X = save_x; - new_pos_Y = save_y; - } - } - - set_cursor_shape: - /* Change the mouse pointer shape. */ - IT_set_mouse_pointer (hl); -} - -/* Clear out the mouse-highlighted active region. - Redraw it un-highlighted first. */ -static void -clear_mouse_face (struct tty_display_info *dpyinfo) -{ - if (!dpyinfo->mouse_face_hidden && ! NILP (dpyinfo->mouse_face_window)) - show_mouse_face (dpyinfo, 0); - - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; -} - -/* Find the glyph matrix position of buffer position POS in window W. - *HPOS and *VPOS are set to the positions found. W's current glyphs - must be up to date. If POS is above window start return (0, 0). - If POS is after end of W, return end of last line in W. */ -static int -fast_find_position (struct window *w, int pos, int *hpos, int *vpos) -{ - int i, lastcol, line_start_position, maybe_next_line_p = 0; - int yb = window_text_bottom_y (w); - struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row; - - while (row->y < yb) - { - if (row->used[TEXT_AREA]) - line_start_position = row->glyphs[TEXT_AREA]->charpos; - else - line_start_position = 0; - - if (line_start_position > pos) - break; - /* If the position sought is the end of the buffer, - don't include the blank lines at the bottom of the window. */ - else if (line_start_position == pos - && pos == BUF_ZV (XBUFFER (w->buffer))) - { - maybe_next_line_p = 1; - break; - } - else if (line_start_position > 0) - best_row = row; - - /* Don't overstep the last matrix row, lest we get into the - never-never land... */ - if (row->y + 1 >= yb) - break; - - ++row; - } - - /* Find the right column within BEST_ROW. */ - lastcol = 0; - row = best_row; - for (i = 0; i < row->used[TEXT_AREA]; i++) - { - struct glyph *glyph = row->glyphs[TEXT_AREA] + i; - int charpos; - - charpos = glyph->charpos; - if (charpos == pos) - { - *hpos = i; - *vpos = row->y; - return 1; - } - else if (charpos > pos) - break; - else if (charpos > 0) - lastcol = i; - } - - /* If we're looking for the end of the buffer, - and we didn't find it in the line we scanned, - use the start of the following line. */ - if (maybe_next_line_p) + if (hl == DRAW_MOUSE_FACE) { - ++row; - lastcol = 0; - } + int vpos = row->y + WINDOW_TOP_EDGE_Y (w); + int kstart = start_hpos + WINDOW_LEFT_EDGE_X (w); + int nglyphs = end_hpos - start_hpos; + int offset = ScreenPrimary + 2*(vpos*screen_size_X + kstart) + 1; + int start_offset = offset; - *vpos = row->y; - *hpos = lastcol + 1; - return 0; -} - -/* Take proper action when mouse has moved to the mode or top line of - window W, x-position X. MODE_LINE_P non-zero means mouse is on the - mode line. X is relative to the start of the text display area of - W, so the width of fringes and scroll bars must be subtracted - to get a position relative to the start of the mode line. */ -static void -IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p) -{ - struct glyph_row *row; - - if (mode_line_p) - row = MATRIX_MODE_LINE_ROW (w->current_matrix); - else - row = MATRIX_HEADER_LINE_ROW (w->current_matrix); - - if (row->enabled_p) - { - struct glyph *glyph, *end; - Lisp_Object help; + if (tty->termscript) + fprintf (tty->termscript, "\n<MH+ %d-%d:%d>", + kstart, kstart + nglyphs - 1, vpos); - /* Find the glyph under X. */ - glyph = (row->glyphs[TEXT_AREA] - + x - /* in case someone implements scroll bars some day... */ - - WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w)); - end = glyph + row->used[TEXT_AREA]; - if (glyph < end - && STRINGP (glyph->object) - && STRING_INTERVALS (glyph->object) - && glyph->charpos >= 0 - && glyph->charpos < SCHARS (glyph->object)) + mouse_off (); + IT_set_face (hlinfo->mouse_face_face_id); + /* Since we are going to change only the _colors_ of already + displayed text, there's no need to go through all the pain of + generating and encoding the text from the glyphs. Instead, + we simply poke the attribute byte of each affected position + in video memory with the colors computed by IT_set_face! */ + _farsetsel (_dos_ds); + while (nglyphs--) { - /* If we're on a string with `help-echo' text property, - arrange for the help to be displayed. This is done by - setting the global variable help_echo to the help string. */ - help = Fget_text_property (make_number (glyph->charpos), - Qhelp_echo, glyph->object); - if (!NILP (help)) - { - help_echo_string = help; - XSETWINDOW (help_echo_window, w); - help_echo_object = glyph->object; - help_echo_pos = glyph->charpos; - } + _farnspokeb (offset, ScreenAttrib); + offset += 2; } + if (screen_virtual_segment) + dosv_refresh_virtual_screen (start_offset, end_hpos - start_hpos); + mouse_on (); } -} - -/* Take proper action when the mouse has moved to position X, Y on - frame F as regards highlighting characters that have mouse-face - properties. Also de-highlighting chars where the mouse was before. - X and Y can be negative or out of range. */ -static void -IT_note_mouse_highlight (struct frame *f, int x, int y) -{ - struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); - enum window_part part = ON_NOTHING; - Lisp_Object window; - struct window *w; - - /* When a menu is active, don't highlight because this looks odd. */ - if (mouse_preempted) - return; - - if (NILP (Vmouse_highlight) - || !f->glyphs_initialized_p) - return; - - dpyinfo->mouse_face_mouse_x = x; - dpyinfo->mouse_face_mouse_y = y; - dpyinfo->mouse_face_mouse_frame = f; - - if (dpyinfo->mouse_face_defer) - return; - - if (gc_in_progress) - { - dpyinfo->mouse_face_deferred_gc = 1; - return; - } - - /* Which window is that in? */ - window = window_from_coordinates (f, x, y, &part, &x, &y, 0); - - /* If we were displaying active text in another window, clear that. */ - if (! EQ (window, dpyinfo->mouse_face_window)) - clear_mouse_face (dpyinfo); - - /* Not on a window -> return. */ - if (!WINDOWP (window)) - return; - - /* Convert to window-relative coordinates. */ - w = XWINDOW (window); - - if (part == ON_MODE_LINE || part == ON_HEADER_LINE) - { - /* Mouse is on the mode or top line. */ - IT_note_mode_line_highlight (w, x, part == ON_MODE_LINE); - return; - } - - IT_set_mouse_pointer (0); - - /* Are we in a window whose display is up to date? - And verify the buffer's text has not changed. */ - if (part == ON_TEXT - && EQ (w->window_end_valid, w->buffer) - && XFASTINT (w->last_modified) == BUF_MODIFF (XBUFFER (w->buffer)) - && (XFASTINT (w->last_overlay_modified) - == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer)))) + else if (hl == DRAW_NORMAL_TEXT) { - int pos, i, nrows = w->current_matrix->nrows; - struct glyph_row *row; - struct glyph *glyph; + /* We are removing a previously-drawn mouse highlight. The + safest way to do so is to redraw the glyphs anew, since all + kinds of faces and display tables could have changed behind + our back. */ + int nglyphs = end_hpos - start_hpos; + int save_x = new_pos_X, save_y = new_pos_Y; - /* Find the glyph under X/Y. */ - glyph = NULL; - if (y >= 0 && y < nrows) - { - row = MATRIX_ROW (w->current_matrix, y); - /* Give up if some row before the one we are looking for is - not enabled. */ - for (i = 0; i <= y; i++) - if (!MATRIX_ROW (w->current_matrix, i)->enabled_p) - break; - if (i > y /* all rows upto and including the one at Y are enabled */ - && row->displays_text_p - && x < window_box_width (w, TEXT_AREA)) - { - glyph = row->glyphs[TEXT_AREA]; - if (x >= row->used[TEXT_AREA]) - glyph = NULL; - else - { - glyph += x; - if (!BUFFERP (glyph->object)) - glyph = NULL; - } - } - } - - /* Clear mouse face if X/Y not over text. */ - if (glyph == NULL) - { - clear_mouse_face (dpyinfo); - return; - } + if (end_hpos >= row->used[TEXT_AREA]) + nglyphs = row->used[TEXT_AREA] - start_hpos; - if (!BUFFERP (glyph->object)) - abort (); - pos = glyph->charpos; - - /* Check for mouse-face and help-echo. */ - { - Lisp_Object mouse_face, overlay, position, *overlay_vec; - int noverlays, obegv, ozv; - struct buffer *obuf; + /* IT_write_glyphs writes at cursor position, so we need to + temporarily move cursor coordinates to the beginning of + the highlight region. */ + new_pos_X = start_hpos + WINDOW_LEFT_EDGE_X (w); + new_pos_Y = row->y + WINDOW_TOP_EDGE_Y (w); - /* If we get an out-of-range value, return now; avoid an error. */ - if (pos > BUF_Z (XBUFFER (w->buffer))) - return; - - /* Make the window's buffer temporarily current for - overlays_at and compute_char_face. */ - obuf = current_buffer; - current_buffer = XBUFFER (w->buffer); - obegv = BEGV; - ozv = ZV; - BEGV = BEG; - ZV = Z; - - /* Is this char mouse-active or does it have help-echo? */ - XSETINT (position, pos); - - /* Put all the overlays we want in a vector in overlay_vec. */ - GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0); - /* Sort overlays into increasing priority order. */ - noverlays = sort_overlays (overlay_vec, noverlays, w); - - /* Check mouse-face highlighting. */ - if (! (EQ (window, dpyinfo->mouse_face_window) - && y >= dpyinfo->mouse_face_beg_row - && y <= dpyinfo->mouse_face_end_row - && (y > dpyinfo->mouse_face_beg_row - || x >= dpyinfo->mouse_face_beg_col) - && (y < dpyinfo->mouse_face_end_row - || x < dpyinfo->mouse_face_end_col - || dpyinfo->mouse_face_past_end))) - { - /* Clear the display of the old active region, if any. */ - clear_mouse_face (dpyinfo); - - /* Find highest priority overlay that has a mouse-face prop. */ - overlay = Qnil; - for (i = noverlays - 1; i >= 0; --i) - { - mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face); - if (!NILP (mouse_face)) - { - overlay = overlay_vec[i]; - break; - } - } - - /* If no overlay applies, get a text property. */ - if (NILP (overlay)) - mouse_face = Fget_text_property (position, Qmouse_face, - w->buffer); - - /* Handle the overlay case. */ - if (! NILP (overlay)) - { - /* Find the range of text around this char that - should be active. */ - Lisp_Object before, after; - EMACS_INT ignore; - - before = Foverlay_start (overlay); - after = Foverlay_end (overlay); - /* Record this as the current active region. */ - fast_find_position (w, XFASTINT (before), - &dpyinfo->mouse_face_beg_col, - &dpyinfo->mouse_face_beg_row); - dpyinfo->mouse_face_past_end - = !fast_find_position (w, XFASTINT (after), - &dpyinfo->mouse_face_end_col, - &dpyinfo->mouse_face_end_row); - dpyinfo->mouse_face_window = window; - dpyinfo->mouse_face_face_id - = face_at_buffer_position (w, pos, 0, 0, - &ignore, pos + 1, - !dpyinfo->mouse_face_hidden, - -1); - - /* Display it as active. */ - show_mouse_face (dpyinfo, 1); - } - /* Handle the text property case. */ - else if (! NILP (mouse_face)) - { - /* Find the range of text around this char that - should be active. */ - Lisp_Object before, after, beginning, end; - EMACS_INT ignore; - - beginning = Fmarker_position (w->start); - XSETINT (end, (BUF_Z (XBUFFER (w->buffer)) - - XFASTINT (w->window_end_pos))); - before - = Fprevious_single_property_change (make_number (pos + 1), - Qmouse_face, - w->buffer, beginning); - after - = Fnext_single_property_change (position, Qmouse_face, - w->buffer, end); - /* Record this as the current active region. */ - fast_find_position (w, XFASTINT (before), - &dpyinfo->mouse_face_beg_col, - &dpyinfo->mouse_face_beg_row); - dpyinfo->mouse_face_past_end - = !fast_find_position (w, XFASTINT (after), - &dpyinfo->mouse_face_end_col, - &dpyinfo->mouse_face_end_row); - dpyinfo->mouse_face_window = window; - dpyinfo->mouse_face_face_id - = face_at_buffer_position (w, pos, 0, 0, - &ignore, pos + 1, - !dpyinfo->mouse_face_hidden, - -1); - - /* Display it as active. */ - show_mouse_face (dpyinfo, 1); - } - } - - /* Look for a `help-echo' property. */ - { - Lisp_Object help; - - /* Check overlays first. */ - help = Qnil; - for (i = noverlays - 1; i >= 0 && NILP (help); --i) - { - overlay = overlay_vec[i]; - help = Foverlay_get (overlay, Qhelp_echo); - } - - if (!NILP (help)) - { - help_echo_string = help; - help_echo_window = window; - help_echo_object = overlay; - help_echo_pos = pos; - } - /* Try text properties. */ - else if (NILP (help) - && ((STRINGP (glyph->object) - && glyph->charpos >= 0 - && glyph->charpos < SCHARS (glyph->object)) - || (BUFFERP (glyph->object) - && glyph->charpos >= BEGV - && glyph->charpos < ZV))) - { - help = Fget_text_property (make_number (glyph->charpos), - Qhelp_echo, glyph->object); - if (!NILP (help)) - { - help_echo_string = help; - help_echo_window = window; - help_echo_object = glyph->object; - help_echo_pos = glyph->charpos; - } - } - } - - BEGV = obegv; - ZV = ozv; - current_buffer = obuf; - } + if (tty->termscript) + fprintf (tty->termscript, "<MH- %d-%d:%d>", + new_pos_X, new_pos_X + nglyphs - 1, new_pos_Y); + IT_write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); + if (tty->termscript) + fputs ("\n", tty->termscript); + new_pos_X = save_x; + new_pos_Y = save_y; } } @@ -1689,7 +1217,8 @@ static void IT_update_begin (struct frame *f) { struct tty_display_info *display_info = FRAME_X_DISPLAY_INFO (f); - struct frame *mouse_face_frame = display_info->mouse_face_mouse_frame; + Mouse_HLInfo *hlinfo = &display_info->mouse_highlight; + struct frame *mouse_face_frame = hlinfo->mouse_face_mouse_frame; if (display_info->termscript) fprintf (display_info->termscript, "\n\n<UPDATE_BEGIN"); @@ -1699,28 +1228,28 @@ IT_update_begin (struct frame *f) if (f && f == mouse_face_frame) { /* Don't do highlighting for mouse motion during the update. */ - display_info->mouse_face_defer = 1; + hlinfo->mouse_face_defer = 1; /* If F needs to be redrawn, simply forget about any prior mouse highlighting. */ if (FRAME_GARBAGED_P (f)) - display_info->mouse_face_window = Qnil; + hlinfo->mouse_face_window = Qnil; /* Can we tell that this update does not affect the window where the mouse highlight is? If so, no need to turn off. Likewise, don't do anything if none of the enabled rows contains glyphs highlighted in mouse face. */ - if (!NILP (display_info->mouse_face_window) - && WINDOWP (display_info->mouse_face_window)) + if (!NILP (hlinfo->mouse_face_window) + && WINDOWP (hlinfo->mouse_face_window)) { - struct window *w = XWINDOW (display_info->mouse_face_window); + struct window *w = XWINDOW (hlinfo->mouse_face_window); int i; /* If the mouse highlight is in the window that was deleted (e.g., if it was popped by completion), clear highlight unconditionally. */ if (NILP (w->buffer)) - display_info->mouse_face_window = Qnil; + hlinfo->mouse_face_window = Qnil; else { for (i = 0; i < w->desired_matrix->nrows; ++i) @@ -1730,18 +1259,18 @@ IT_update_begin (struct frame *f) } if (NILP (w->buffer) || i < w->desired_matrix->nrows) - clear_mouse_face (display_info); + clear_mouse_face (hlinfo); } } else if (mouse_face_frame && !FRAME_LIVE_P (mouse_face_frame)) { /* If the frame with mouse highlight was deleted, invalidate the highlight info. */ - display_info->mouse_face_beg_row = display_info->mouse_face_beg_col = -1; - display_info->mouse_face_end_row = display_info->mouse_face_end_col = -1; - display_info->mouse_face_window = Qnil; - display_info->mouse_face_deferred_gc = 0; - display_info->mouse_face_mouse_frame = NULL; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_deferred_gc = 0; + hlinfo->mouse_face_mouse_frame = NULL; } UNBLOCK_INPUT; @@ -1754,25 +1283,25 @@ IT_update_end (struct frame *f) if (dpyinfo->termscript) fprintf (dpyinfo->termscript, "\n<UPDATE_END\n"); - dpyinfo->mouse_face_defer = 0; + dpyinfo->mouse_highlight.mouse_face_defer = 0; } static void IT_frame_up_to_date (struct frame *f) { - struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); Lisp_Object new_cursor, frame_desired_cursor; struct window *sw; - if (dpyinfo->mouse_face_deferred_gc - || (f && f == dpyinfo->mouse_face_mouse_frame)) + if (hlinfo->mouse_face_deferred_gc + || (f && f == hlinfo->mouse_face_mouse_frame)) { BLOCK_INPUT; - if (dpyinfo->mouse_face_mouse_frame) - IT_note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, - dpyinfo->mouse_face_mouse_x, - dpyinfo->mouse_face_mouse_y); - dpyinfo->mouse_face_deferred_gc = 0; + if (hlinfo->mouse_face_mouse_frame) + note_mouse_highlight (hlinfo->mouse_face_mouse_frame, + hlinfo->mouse_face_mouse_x, + hlinfo->mouse_face_mouse_y); + hlinfo->mouse_face_deferred_gc = 0; UNBLOCK_INPUT; } @@ -2317,18 +1846,18 @@ internal_terminal_init (void) if (colors[1] >= 0 && colors[1] < 16) FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1]; } - the_only_display_info.mouse_face_mouse_frame = NULL; - the_only_display_info.mouse_face_deferred_gc = 0; - the_only_display_info.mouse_face_beg_row = - the_only_display_info.mouse_face_beg_col = -1; - the_only_display_info.mouse_face_end_row = - the_only_display_info.mouse_face_end_col = -1; - the_only_display_info.mouse_face_face_id = DEFAULT_FACE_ID; - the_only_display_info.mouse_face_window = Qnil; - the_only_display_info.mouse_face_mouse_x = - the_only_display_info.mouse_face_mouse_y = 0; - the_only_display_info.mouse_face_defer = 0; - the_only_display_info.mouse_face_hidden = 0; + the_only_display_info.mouse_highlight.mouse_face_mouse_frame = NULL; + the_only_display_info.mouse_highlight.mouse_face_deferred_gc = 0; + the_only_display_info.mouse_highlight.mouse_face_beg_row = + the_only_display_info.mouse_highlight.mouse_face_beg_col = -1; + the_only_display_info.mouse_highlight.mouse_face_end_row = + the_only_display_info.mouse_highlight.mouse_face_end_col = -1; + the_only_display_info.mouse_highlight.mouse_face_face_id = DEFAULT_FACE_ID; + the_only_display_info.mouse_highlight.mouse_face_window = Qnil; + the_only_display_info.mouse_highlight.mouse_face_mouse_x = + the_only_display_info.mouse_highlight.mouse_face_mouse_y = 0; + the_only_display_info.mouse_highlight.mouse_face_defer = 0; + the_only_display_info.mouse_highlight.mouse_face_hidden = 0; if (have_mouse) /* detected in dos_ttraw, which see */ { @@ -2916,7 +2445,7 @@ dos_rawgetc (void) { struct input_event event; union REGS regs; - struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME()); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (SELECTED_FRAME()); EVENT_INIT (event); #ifndef HAVE_X_WINDOWS @@ -3126,10 +2655,10 @@ dos_rawgetc (void) if (code == 0) continue; - if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) + if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_hidden = 1; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_hidden = 1; } if (code >= 0x100) @@ -3157,10 +2686,10 @@ dos_rawgetc (void) might need to update mouse highlight. */ if (mouse_last_x != mouse_prev_x || mouse_last_y != mouse_prev_y) { - if (dpyinfo->mouse_face_hidden) + if (hlinfo->mouse_face_hidden) { - dpyinfo->mouse_face_hidden = 0; - clear_mouse_face (dpyinfo); + hlinfo->mouse_face_hidden = 0; + clear_mouse_face (hlinfo); } /* Generate SELECT_WINDOW_EVENTs when needed. */ @@ -3169,7 +2698,7 @@ dos_rawgetc (void) mouse_window = window_from_coordinates (SELECTED_FRAME(), mouse_last_x, mouse_last_y, - 0, 0, 0, 0); + 0, 0); /* A window will be selected only when it is not selected now, and the last mouse movement event was not in it. A minibuffer window will be selected iff @@ -3192,22 +2721,12 @@ dos_rawgetc (void) previous_help_echo_string = help_echo_string; help_echo_string = help_echo_object = help_echo_window = Qnil; help_echo_pos = -1; - IT_note_mouse_highlight (SELECTED_FRAME(), - mouse_last_x, mouse_last_y); + note_mouse_highlight (SELECTED_FRAME(), mouse_last_x, mouse_last_y); /* If the contents of the global variable help_echo has changed, generate a HELP_EVENT. */ if (!NILP (help_echo_string) || !NILP (previous_help_echo_string)) - { - event.kind = HELP_EVENT; - event.frame_or_window = selected_frame; - event.arg = help_echo_object; - event.x = WINDOWP (help_echo_window) - ? help_echo_window : selected_frame; - event.y = help_echo_string; - event.timestamp = event_timestamp (); - event.code = help_echo_pos; - kbd_buffer_store_event (&event); - } + gen_help_event (help_echo_string, selected_frame, help_echo_window, + help_echo_object, help_echo_pos); } 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 *); char *rootrelativepath (char *); void init_environment (int, char **, int); void internal_terminal_init (void); +void initialize_msdos_display (struct terminal *); extern int have_mouse; void 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 @@ /* Functions for the NeXT/Open/GNUstep and MacOSX window system. - Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -1223,8 +1224,6 @@ be shared by the new frame. */) "foreground", "Foreground", RES_TYPE_STRING); x_default_parameter (f, parms, Qbackground_color, build_string ("White"), "background", "Background", RES_TYPE_STRING); - x_default_parameter (f, parms, Qcursor_color, build_string ("grey"), - "cursorColor", "CursorColor", RES_TYPE_STRING); /* FIXME: not suppported yet in Nextstep */ x_default_parameter (f, parms, Qline_spacing, Qnil, "lineSpacing", "LineSpacing", RES_TYPE_NUMBER); @@ -1697,7 +1696,7 @@ If omitted or nil, the selected frame's display is used. */) DEFUN ("x-display-save-under", Fx_display_save_under, Sx_display_save_under, 0, 1, 0, - doc: /* Non-nil if the Nextstep display server supports the save-under feature. + doc: /* Return t if DISPLAY supports the save-under feature. The optional argument DISPLAY specifies which display to ask about. DISPLAY should be a frame, the display name as a string, or a terminal ID. If 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. */) DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, 1, 3, 0, - doc: /* Open a connection to a Nextstep display server. + doc: /* Open a connection to a display server. DISPLAY is the name of the display to connect to. -Optional arguments XRM-STRING and MUST-SUCCEED are currently ignored. */) +Optional second arg XRM-STRING is a string of resources in xrdb format. +If the optional third arg MUST-SUCCEED is non-nil, +terminate Emacs if we can't open the connection. +\(In the Nextstep version, the last two arguments are currently ignored.) */) (Lisp_Object display, Lisp_Object resource_string, Lisp_Object must_succeed) { struct ns_display_info *dpyinfo; @@ -2201,8 +2203,8 @@ x_sync (struct frame *f) DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, - doc: /* Return t if the current Nextstep display supports the color COLOR. -The optional argument FRAME is currently ignored. */) + doc: /* Internal function called by `color-defined-p', which see. +\(Note that the Nextstep version of this function ignores FRAME.) */) (Lisp_Object color, Lisp_Object frame) { NSColor * col; @@ -2233,10 +2235,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, - doc: /* Return t if the Nextstep display supports color. -The optional argument DISPLAY specifies which display to ask about. -DISPLAY should be either a frame, a display name (a string), or terminal ID. -If omitted or nil, that stands for the selected frame's display. */) + doc: /* Internal function called by `display-color-p', which see. */) (Lisp_Object display) { NSWindowDepth depth; @@ -2430,6 +2429,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, doc: /* Show STRING in a \"tooltip\" window on frame FRAME. A tooltip window is a small window displaying a string. +This is an internal function; Lisp code should call `tooltip-show'. + FRAME nil or omitted means use the selected frame. PARMS 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. */); } -// 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) #include "frame.h" #include "character.h" #include "font.h" +#include "termchar.h" /* TODO: Drop once we can assume gnustep-gui 0.17.1. */ #ifdef NS_IMPL_GNUSTEP @@ -1040,8 +1041,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, face = s->face; break; case NS_DUMPGLYPH_MOUSEFACE: - face = FACE_FROM_ID (s->f, - FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id); + face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id); if (!face) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); break; @@ -1211,7 +1211,6 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, DPSstroke (context); DPSgrestore (context); - return to-from; } #else /* NS_IMPL_COCOA */ @@ -1280,10 +1279,9 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, } CGContextRestoreGState (gcontext); - return; } #endif /* NS_IMPL_COCOA */ - + return to-from; } 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; NSColor *rgbColor; if (bmRep == nil || color == nil) - return; + return self; if ([color colorSpaceName] != NSCalibratedRGBColorSpace) rgbColor = [color colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; @@ -361,6 +361,8 @@ static EmacsImage *ImageList = nil; planes[2][i] = bb; } } + + return self; } 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. */ /* This should be the first include, as it may set up #defines affecting interpretation of even the system includes. */ -#include "config.h" +#include <config.h> #include <setjmp.h> #include "lisp.h" @@ -1049,10 +1049,15 @@ update_frame_tool_bar (FRAME_PTR f) { idx = -1; } + helpObj = TOOLPROP (TOOL_BAR_ITEM_HELP); + if (NILP (helpObj)) + helpObj = TOOLPROP (TOOL_BAR_ITEM_CAPTION); + helpText = NILP (helpObj) ? "" : (char *)SDATA (helpObj); + /* Ignore invalid image specifications. */ if (!valid_image_p (image)) { - NSLog (@"Invalid image for toolbar item"); + /* Don't log anything, GNUS makes invalid images all the time. */ continue; } @@ -1066,11 +1071,6 @@ update_frame_tool_bar (FRAME_PTR f) continue; } - helpObj = TOOLPROP (TOOL_BAR_ITEM_HELP); - if (NILP (helpObj)) - helpObj = TOOLPROP (TOOL_BAR_ITEM_CAPTION); - helpText = NILP (helpObj) ? "" : (char *)SDATA (helpObj); - [toolbar addDisplayItemWithImage: img->pixmap idx: i helpText: helpText enabled: enabled_p]; #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 /* The cursor to use for vertical scroll bars. */ Cursor vertical_scroll_bar_cursor; - /* most mouse face stuff moved in here as of 21+ (and reasonably so) */ - int mouse_face_beg_row, mouse_face_beg_col; - int mouse_face_end_row, mouse_face_end_col; - int mouse_face_beg_x, mouse_face_beg_y; - int mouse_face_end_x, mouse_face_end_y; - int mouse_face_past_end; - Lisp_Object mouse_face_window; - int mouse_face_face_id; - int mouse_face_deferred_gc; - Lisp_Object mouse_face_overlay; - FRAME_PTR mouse_face_mouse_frame; - int mouse_face_mouse_x, mouse_face_mouse_y; - int mouse_face_defer; - int mouse_face_hidden; - int mouse_face_image_state; + /* Information about the range of text currently shown in + mouse-face. */ + Mouse_HLInfo mouse_highlight; struct frame *x_highlight_frame; 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; Lisp_Object ns_command_modifier; /* Specifies which emacs modifier should be generated when NS receives + the right Command modifier. Has same values as ns_command_modifier plus + the value Qleft which means whatever value ns_command_modifier has. */ +Lisp_Object ns_right_command_modifier; + +/* Specifies which emacs modifier should be generated when NS receives the Control modifier. May be any of the modifier lisp symbols. */ Lisp_Object ns_control_modifier; /* Specifies which emacs modifier should be generated when NS receives + the right Control modifier. Has same values as ns_control_modifier plus + the value Qleft which means whatever value ns_control_modifier has. */ +Lisp_Object ns_right_control_modifier; + +/* Specifies which emacs modifier should be generated when NS receives the Function modifier (laptops). May be any of the modifier lisp symbols. */ Lisp_Object ns_function_modifier; @@ -223,6 +233,11 @@ static BOOL inNsSelect = 0; /* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */ #define NS_FUNCTION_KEY_MASK 0x800000 +#define NSLeftControlKeyMask (0x000001 | NSControlKeyMask) +#define NSRightControlKeyMask (0x002000 | NSControlKeyMask) +#define NSLeftCommandKeyMask (0x000008 | NSCommandKeyMask) +#define NSRightCommandKeyMask (0x000010 | NSCommandKeyMask) +#define NSLeftAlternateKeyMask (0x000020 | NSAlternateKeyMask) #define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) #define EV_MODIFIERS(e) \ ((([e modifierFlags] & NSHelpKeyMask) ? \ @@ -235,10 +250,18 @@ static BOOL inNsSelect = 0; parse_solitary_modifier (ns_alternate_modifier) : 0) \ | (([e modifierFlags] & NSShiftKeyMask) ? \ shift_modifier : 0) \ + | (!EQ (ns_right_control_modifier, Qleft) && \ + (([e modifierFlags] & NSRightControlKeyMask) \ + == NSRightControlKeyMask) ? \ + parse_solitary_modifier (ns_right_control_modifier) : 0) \ | (([e modifierFlags] & NSControlKeyMask) ? \ parse_solitary_modifier (ns_control_modifier) : 0) \ | (([e modifierFlags] & NS_FUNCTION_KEY_MASK) ? \ parse_solitary_modifier (ns_function_modifier) : 0) \ + | (!EQ (ns_right_command_modifier, Qleft) && \ + (([e modifierFlags] & NSRightCommandKeyMask) \ + == NSRightCommandKeyMask) ? \ + parse_solitary_modifier (ns_right_command_modifier) : 0) \ | (([e modifierFlags] & NSCommandKeyMask) ? \ parse_solitary_modifier (ns_command_modifier):0)) @@ -553,7 +576,7 @@ ns_update_window_begin (struct window *w) -------------------------------------------------------------------------- */ { struct frame *f = XFRAME (WINDOW_FRAME (w)); - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); NSTRACE (ns_update_window_begin); updated_window = w; @@ -561,15 +584,15 @@ ns_update_window_begin (struct window *w) BLOCK_INPUT; - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { /* Don't do highlighting for mouse motion during the update. */ - dpyinfo->mouse_face_defer = 1; + hlinfo->mouse_face_defer = 1; /* If the frame needs to be redrawn, simply forget about any prior mouse highlighting. */ if (FRAME_GARBAGED_P (f)) - dpyinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_window = Qnil; /* (further code for mouse faces ifdef'd out in other terms elided) */ } @@ -586,7 +609,7 @@ ns_update_window_end (struct window *w, int cursor_on_p, external (RIF) call; for one window called before update_end -------------------------------------------------------------------------- */ { - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); /* note: this fn is nearly identical in all terms */ if (!w->pseudo_window_p) @@ -608,9 +631,9 @@ ns_update_window_end (struct window *w, int cursor_on_p, frame_up_to_date to redisplay the mouse highlight. */ if (mouse_face_overwritten_p) { - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; } updated_window = NULL; @@ -627,8 +650,8 @@ ns_update_end (struct frame *f) { NSView *view = FRAME_NS_VIEW (f); -/* if (f == FRAME_NS_DISPLAY_INFO (f)->mouse_face_mouse_frame) */ - FRAME_NS_DISPLAY_INFO (f)->mouse_face_defer = 0; +/* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ + MOUSE_HL_INFO (f)->mouse_face_defer = 0; BLOCK_INPUT; @@ -1032,6 +1055,7 @@ x_destroy_window (struct frame *f) { NSView *view = FRAME_NS_VIEW (f); struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); NSTRACE (x_destroy_window); check_ns (); @@ -1048,13 +1072,13 @@ x_destroy_window (struct frame *f) dpyinfo->x_focus_frame = 0; if (f == dpyinfo->x_highlight_frame) dpyinfo->x_highlight_frame = 0; - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_deferred_gc = 0; - dpyinfo->mouse_face_mouse_frame = 0; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_deferred_gc = 0; + hlinfo->mouse_face_mouse_frame = 0; } xfree (f->output_data.ns); @@ -1772,18 +1796,18 @@ ns_frame_up_to_date (struct frame *f) if (FRAME_NS_P (f)) { - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); - if ((dpyinfo->mouse_face_deferred_gc||f ==dpyinfo->mouse_face_mouse_frame) - /*&& dpyinfo->mouse_face_mouse_frame*/) + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); + if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame) + /*&& hlinfo->mouse_face_mouse_frame*/) { BLOCK_INPUT; - ns_update_begin(f); - if (dpyinfo->mouse_face_mouse_frame) - note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, - dpyinfo->mouse_face_mouse_x, - dpyinfo->mouse_face_mouse_y); - dpyinfo->mouse_face_deferred_gc = 0; - ns_update_end(f); + ns_update_begin(f); + if (hlinfo->mouse_face_mouse_frame) + note_mouse_highlight (hlinfo->mouse_face_mouse_frame, + hlinfo->mouse_face_mouse_x, + hlinfo->mouse_face_mouse_y); + hlinfo->mouse_face_deferred_gc = 0; + ns_update_end(f); UNBLOCK_INPUT; } } @@ -2595,8 +2619,7 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s) if (s->hl == DRAW_MOUSE_FACE) { - face = FACE_FROM_ID - (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id); + face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id); if (!face) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); } @@ -2663,8 +2686,8 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, char force_p) struct face *face; if (s->hl == DRAW_MOUSE_FACE) { - face = FACE_FROM_ID - (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id); + face = FACE_FROM_ID (s->f, + MOUSE_HL_INFO (s->f)->mouse_face_face_id); if (!face) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); } @@ -2749,15 +2772,17 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) with its background color), we must clear just the image area. */ if (s->hl == DRAW_MOUSE_FACE) { - face = FACE_FROM_ID - (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id); + face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id); if (!face) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); } else face = FACE_FROM_ID (s->f, s->first_glyph->face_id); - [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set]; + if (s->hl == DRAW_CURSOR) + [FRAME_CURSOR_COLOR (s->f) set]; + else + [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set]; if (bg_height > s->slice.height || s->img->hmargin || s->img->vmargin || 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) s->slice.x == 0, s->slice.x + s->slice.width == s->img->width, s); } + + /* If there is no mask, the background won't be seen, + so draw a rectangle on the image for the cursor. + Do this for all images, getting trancparency right is not reliable. */ + if (s->hl == DRAW_CURSOR) + { + int thickness = abs (s->img->relief); + if (thickness == 0) thickness = 1; + ns_draw_box (br, thickness, FRAME_CURSOR_COLOR (s->f), 1, 1); + } } @@ -2873,8 +2908,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s) if (s->hl == DRAW_MOUSE_FACE) { - face = FACE_FROM_ID - (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id); + face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id); if (!face) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); } @@ -2975,11 +3009,41 @@ ns_draw_glyph_string (struct glyph_string *s) if (ns_tmp_font == NULL) ns_tmp_font = (struct nsfont_info *)FRAME_FONT (s->f); + if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR) + { + unsigned long tmp = NS_FACE_BACKGROUND (s->face); + NS_FACE_BACKGROUND (s->face) = NS_FACE_FOREGROUND (s->face); + NS_FACE_FOREGROUND (s->face) = tmp; + } + ns_tmp_font->font.driver->draw (s, 0, s->nchars, s->x, s->y, (ns_tmp_flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p) || ns_tmp_flags == NS_DUMPGLYPH_MOUSEFACE); + if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR) + { + unsigned long tmp = NS_FACE_BACKGROUND (s->face); + NS_FACE_BACKGROUND (s->face) = NS_FACE_FOREGROUND (s->face); + NS_FACE_FOREGROUND (s->face) = tmp; + } + + ns_unfocus (s->f); + break; + + case GLYPHLESS_GLYPH: + n = ns_get_glyph_string_clip_rect (s, r); + ns_focus (s->f, r, n); + + if (s->for_overlaps || (s->cmp_from > 0 + && ! s->first_glyph->u.cmp.automatic)) + s->background_filled_p = 1; + else + ns_maybe_dumpglyphs_background + (s, s->first_glyph->type == COMPOSITE_GLYPH); + /* ... */ + /* Not yet implemented. */ + /* ... */ ns_unfocus (s->f); break; @@ -3529,6 +3593,7 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo) { NSScreen *screen = [NSScreen mainScreen]; NSWindowDepth depth = [screen depth]; + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; dpyinfo->resx = 72.27; /* used 75.0, but this makes pt == pixel, expected */ dpyinfo->resy = 72.27; @@ -3543,16 +3608,16 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo) dpyinfo->color_table->colors = NULL; dpyinfo->root_window = 42; /* a placeholder.. */ - dpyinfo->mouse_face_mouse_frame = NULL; - dpyinfo->mouse_face_deferred_gc = 0; - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; - dpyinfo->mouse_face_window = dpyinfo->mouse_face_overlay = Qnil; - dpyinfo->mouse_face_hidden = 0; + hlinfo->mouse_face_mouse_frame = NULL; + hlinfo->mouse_face_deferred_gc = 0; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; + hlinfo->mouse_face_window = hlinfo->mouse_face_overlay = Qnil; + hlinfo->mouse_face_hidden = 0; - dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; - dpyinfo->mouse_face_defer = 0; + hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0; + hlinfo->mouse_face_defer = 0; dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame = NULL; @@ -4335,7 +4400,7 @@ ns_term_shutdown (int sig) - (void)keyDown: (NSEvent *)theEvent { - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); int code; unsigned fnKeysym = 0; int flags; @@ -4373,10 +4438,10 @@ ns_term_shutdown (int sig) [NSCursor setHiddenUntilMouseMoves: YES]; - if (dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) + if (hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_hidden = 1; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_hidden = 1; } if (!processingCompose) @@ -4384,7 +4449,7 @@ ns_term_shutdown (int sig) code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; /* (Carbon way: [theEvent keyCode]) */ - + /* is it a "function key"? */ fnKeysym = ns_convert_key (code); if (fnKeysym) @@ -4407,9 +4472,17 @@ ns_term_shutdown (int sig) if (flags & NSShiftKeyMask) emacs_event->modifiers |= shift_modifier; - if (flags & NSCommandKeyMask) + if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask) + emacs_event->modifiers |= parse_solitary_modifier + (EQ (ns_right_command_modifier, Qleft) + ? ns_command_modifier + : ns_right_command_modifier); + + if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask) { - emacs_event->modifiers |= parse_solitary_modifier (ns_command_modifier); + emacs_event->modifiers |= parse_solitary_modifier + (ns_command_modifier); + /* if super (default), take input manager's word so things like dvorak / qwerty layout work */ if (EQ (ns_command_modifier, Qsuper) @@ -4442,23 +4515,43 @@ ns_term_shutdown (int sig) } } - if (flags & NSControlKeyMask) - emacs_event->modifiers |= - parse_solitary_modifier (ns_control_modifier); + if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask) + emacs_event->modifiers |= parse_solitary_modifier + (EQ (ns_right_control_modifier, Qleft) + ? ns_control_modifier + : ns_right_control_modifier); + + if ((flags & NSLeftControlKeyMask) == NSLeftControlKeyMask) + emacs_event->modifiers |= parse_solitary_modifier + (ns_control_modifier); if (flags & NS_FUNCTION_KEY_MASK && !fnKeysym) emacs_event->modifiers |= parse_solitary_modifier (ns_function_modifier); - if (!EQ (ns_right_alternate_modifier, Qleft) - && ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask)) - { - emacs_event->modifiers |= parse_solitary_modifier - (ns_right_alternate_modifier); - } - else if (flags & NSAlternateKeyMask) /* default = meta */ + if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask) { - if ((NILP (ns_alternate_modifier) || EQ (ns_alternate_modifier, Qnone)) + if ((NILP (ns_right_alternate_modifier) + || EQ (ns_right_alternate_modifier, Qnone)) + && !fnKeysym) + { /* accept pre-interp alt comb */ + if ([[theEvent characters] length] > 0) + code = [[theEvent characters] characterAtIndex: 0]; + /*HACK: clear lone shift modifier to stop next if from firing */ + if (emacs_event->modifiers == shift_modifier) + emacs_event->modifiers = 0; + } + else + emacs_event->modifiers |= parse_solitary_modifier + (EQ (ns_right_alternate_modifier, Qleft) + ? ns_alternate_modifier + : ns_right_alternate_modifier); + } + + if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask) /* default = meta */ + { + if ((NILP (ns_alternate_modifier) + || EQ (ns_alternate_modifier, Qnone)) && !fnKeysym) { /* accept pre-interp alt comb */ if ([[theEvent characters] length] > 0) @@ -4813,7 +4906,7 @@ ns_term_shutdown (int sig) /* Tell emacs the mouse has moved. */ - (void)mouseMoved: (NSEvent *)e { - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); Lisp_Object frame; // NSTRACE (mouseMoved); @@ -4823,10 +4916,10 @@ ns_term_shutdown (int sig) = [self convertPoint: [e locationInWindow] fromView: nil]; /* update any mouse face */ - if (dpyinfo->mouse_face_hidden) + if (hlinfo->mouse_face_hidden) { - dpyinfo->mouse_face_hidden = 0; - clear_mouse_face (dpyinfo); + hlinfo->mouse_face_hidden = 0; + clear_mouse_face (hlinfo); } /* tooltip handling */ @@ -5292,20 +5385,19 @@ ns_term_shutdown (int sig) { NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; NSRect r; - struct ns_display_info *dpyinfo - = emacsframe ? FRAME_NS_DISPLAY_INFO (emacsframe) : NULL; + Mouse_HLInfo *hlinfo = emacsframe ? MOUSE_HL_INFO (emacsframe) : NULL; NSTRACE (mouseExited); - if (dpyinfo || !emacsframe) + if (!hlinfo) return; last_mouse_movement_time = EV_TIMESTAMP (theEvent); - if (emacsframe == dpyinfo->mouse_face_mouse_frame) + if (emacsframe == hlinfo->mouse_face_mouse_frame) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_mouse_frame = 0; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_mouse_frame = 0; } } @@ -5420,7 +5512,7 @@ ns_term_shutdown (int sig) NSTRACE (performDragOperation); if (!emacs_event) - return; + return NO; position = [self convertPoint: [sender draggingLocation] fromView: nil]; 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."); Set to control, meta, alt, super, or hyper means it is taken to be that key."); ns_command_modifier = Qsuper; + DEFVAR_LISP ("ns-right-command-modifier", &ns_right_command_modifier, + "This variable describes the behavior of the right command key.\n\ +Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ +Set to left means be the same key as `ns-command-modifier'.\n\ +Set to none means that the command / option key is not interpreted by Emacs\n\ +at all, allowing it to be used at a lower level for accented character entry."); + ns_right_command_modifier = Qleft; + DEFVAR_LISP ("ns-control-modifier", &ns_control_modifier, "This variable describes the behavior of the control key.\n\ Set to control, meta, alt, super, or hyper means it is taken to be that key."); ns_control_modifier = Qcontrol; + DEFVAR_LISP ("ns-right-control-modifier", &ns_right_control_modifier, + "This variable describes the behavior of the right control key.\n\ +Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\ +Set to left means be the same key as `ns-control-modifier'.\n\ +Set to none means that the control / option key is not interpreted by Emacs\n\ +at all, allowing it to be used at a lower level for accented character entry."); + ns_right_control_modifier = Qleft; + DEFVAR_LISP ("ns-function-modifier", &ns_function_modifier, "This variable describes the behavior of the function key (on laptops).\n\ Set 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; void print_interval (INTERVAL interval, Lisp_Object printcharfun); /* GDB resets this to zero on W32 to disable OutputDebugString calls. */ -int print_output_debug_flag = 1; +int print_output_debug_flag EXTERNALLY_VISIBLE = 1; /* 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/>. */ #endif #endif -#if defined(HAVE_SYS_IOCTL_H) #include <sys/ioctl.h> #if defined(HAVE_NET_IF_H) #include <net/if.h> #endif /* HAVE_NET_IF_H */ -#endif /* HAVE_SYS_IOCTL_H */ #ifdef NEED_BSDTTY #include <bsdtty.h> @@ -115,8 +113,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "nsterm.h" #endif -extern int timers_run; - Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime; Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs; @@ -3811,7 +3807,7 @@ usage: (make-network-process &rest ARGS) */) } -#if defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) +#if defined(HAVE_NET_IF_H) #ifdef SIOCGIFCONF DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0, @@ -4054,7 +4050,7 @@ FLAGS is the current flags of the interface. */) return any ? res : Qnil; } #endif -#endif /* defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) */ +#endif /* defined(HAVE_NET_IF_H) */ /* Turn off input and output for process PROC. */ @@ -7708,14 +7704,14 @@ The variable takes effect when `start-process' is called. */); defsubr (&Sset_network_process_option); defsubr (&Smake_network_process); defsubr (&Sformat_network_address); -#if defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) +#if defined(HAVE_NET_IF_H) #ifdef SIOCGIFCONF defsubr (&Snetwork_interface_list); #endif #if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS) defsubr (&Snetwork_interface_info); #endif -#endif /* defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) */ +#endif /* defined(HAVE_NET_IF_H) */ #ifdef DATAGRAM_SOCKETS defsubr (&Sprocess_datagram_address); defsubr (&Sset_process_datagram_address); @@ -7746,5 +7742,3 @@ The variable takes effect when `start-process' is called. */); defsubr (&Sprocess_attributes); } -/* arch-tag: 3706c011-7b9a-4117-bd4f-59e7f701a4c4 - (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 @@ even if config.h says that we can. */ # undef REL_ALLOC -# if defined STDC_HEADERS || defined _LIBC -# include <stdlib.h> -# else -char *malloc (); -char *realloc (); +# ifdef HAVE_UNISTD_H +# include <unistd.h> # endif /* When used in Emacs's lib-src, we need xmalloc and xrealloc. */ void * -xmalloc (size) - size_t size; +xmalloc (size_t size) { register void *val; val = (void *) malloc (size); @@ -220,9 +216,7 @@ xmalloc (size) } void * -xrealloc (block, size) - void *block; - size_t size; +xrealloc (void *block, size_t size) { register void *val; /* We must call malloc explicitly when BLOCK is 0, since some @@ -435,7 +429,7 @@ extern char *re_syntax_table; static char re_syntax_table[CHAR_SET_SIZE]; static void -init_syntax_once () +init_syntax_once (void) { register int c; static int done = 0; @@ -4978,11 +4972,8 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const r /* re_match is like re_match_2 except it takes only a single string. */ int -re_match (bufp, string, size, pos, regs) - struct re_pattern_buffer *bufp; - const char *string; - int size, pos; - struct re_registers *regs; +re_match (struct re_pattern_buffer *bufp, const char *string, + int size, int pos, struct re_registers *regs) { int result = re_match_2_internal (bufp, NULL, 0, (re_char*) string, size, pos, regs, size); @@ -6534,10 +6525,8 @@ re_exec (s) the return codes and their meanings.) */ int -regcomp (preg, pattern, cflags) - regex_t *__restrict preg; - const char *__restrict pattern; - int cflags; +regcomp (regex_t *__restrict preg, const char *__restrict pattern, + int cflags) { reg_errcode_t ret; reg_syntax_t syntax @@ -6619,12 +6608,8 @@ WEAK_ALIAS (__regcomp, regcomp) We return 0 if we find a match and REG_NOMATCH if not. */ int -regexec (preg, string, nmatch, pmatch, eflags) - const regex_t *__restrict preg; - const char *__restrict string; - size_t nmatch; - regmatch_t pmatch[__restrict_arr]; - int eflags; +regexec (const regex_t *__restrict preg, const char *__restrict string, + size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags) { int ret; struct re_registers regs; @@ -6696,11 +6681,7 @@ WEAK_ALIAS (__regexec, regexec) error with msvc8 compiler. */ size_t -regerror (err_code, preg, errbuf, errbuf_size) - int err_code; - const regex_t *preg; - char *errbuf; - size_t errbuf_size; +regerror (int err_code, const regex_t *preg, char *errbuf, size_t errbuf_size) { const char *msg; size_t msg_size; @@ -6736,8 +6717,7 @@ WEAK_ALIAS (__regerror, regerror) /* Free dynamically allocated space used by PREG. */ void -regfree (preg) - regex_t *preg; +regfree (regex_t *preg) { free (preg->buffer); preg->buffer = NULL; @@ -6756,5 +6736,3 @@ WEAK_ALIAS (__regfree, regfree) #endif /* not emacs */ -/* arch-tag: 4ffd68ba-2a9e-435b-a21a-018990f9eeb2 - (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/>. */ returns ENOSYS. A workaround is to set G_SLICE=always-malloc. */ #define G_SLICE_ALWAYS_MALLOC +/* Send signals to subprocesses by "typing" special chars at them. */ +#define SIGNALS_VIA_CHARACTERS + /* arch-tag: 5ae7ba00-83b0-4ab3-806a-3e845779191b (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 { #undef HAVE_UTIME_H #undef HAVE_LINUX_VERSION_H #undef HAVE_SYS_SYSTEMINFO_H -#undef HAVE_TERMIOS_H #define HAVE_LIMITS_H 1 #define HAVE_STRING_H 1 #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/>. */ /* BEGIN: Non Windows Includes */ #ifndef WINDOWSNT -#ifndef MSDOS #include <sys/ioctl.h> -#endif /* FreeBSD has machine/soundcard.h. Voxware sound driver docs mention 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[]; Similarly for localtime_r. */ # if ! HAVE_TM_GMTOFF -static struct tm *my_strftime_gmtime_r (const time_t *, struct tm *); static struct tm * -my_strftime_gmtime_r (t, tp) - const time_t *t; - struct tm *tp; +my_strftime_gmtime_r (const time_t *t, struct tm *tp) { struct tm *l = gmtime (t); if (! l) @@ -192,11 +189,8 @@ my_strftime_gmtime_r (t, tp) return tp; } -static struct tm *my_strftime_localtime_r (const time_t *, struct tm *); static struct tm * -my_strftime_localtime_r (t, tp) - const time_t *t; - struct tm *tp; +my_strftime_localtime_r (const time_t *t, struct tm *tp) { struct tm *l = localtime (t); if (! l) @@ -318,14 +312,10 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */ # undef _NL_CURRENT # define _NL_CURRENT(category, item) \ (current->values[_NL_ITEM_INDEX (item)].string) -# define LOCALE_PARAM , loc # define LOCALE_ARG , loc -# define LOCALE_PARAM_DECL __locale_t loc; -# define LOCALE_PARAM_PROTO , __locale_t loc +# define LOCALE_PARAM_DECL , __locale_t loc # define HELPER_LOCALE_ARG , current #else -# define LOCALE_PARAM -# define LOCALE_PARAM_PROTO # define LOCALE_ARG # define LOCALE_PARAM_DECL # ifdef _LIBC @@ -363,30 +353,16 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */ more reliable way to accept other sets of digits. */ #define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9) -static CHAR_T *memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, - size_t len LOCALE_PARAM_PROTO); - static CHAR_T * -memcpy_lowcase (dest, src, len LOCALE_PARAM) - CHAR_T *dest; - const CHAR_T *src; - size_t len; - LOCALE_PARAM_DECL +memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL) { while (len-- > 0) dest[len] = TOLOWER ((UCHAR_T) src[len], loc); return dest; } -static CHAR_T *memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, - size_t len LOCALE_PARAM_PROTO); - static CHAR_T * -memcpy_uppcase (dest, src, len LOCALE_PARAM) - CHAR_T *dest; - const CHAR_T *src; - size_t len; - LOCALE_PARAM_DECL +memcpy_uppcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM_DECL) { while (len-- > 0) dest[len] = TOUPPER ((UCHAR_T) src[len], loc); @@ -398,11 +374,8 @@ memcpy_uppcase (dest, src, len LOCALE_PARAM) /* Yield the difference between *A and *B, measured in seconds, ignoring leap seconds. */ # define tm_diff ftime_tm_diff -static int tm_diff (const struct tm *, const struct tm *); static int -tm_diff (a, b) - const struct tm *a; - const struct tm *b; +tm_diff (const struct tm *a, const struct tm *b) { /* Compute intervening leap days correctly even if year is negative. Take care to avoid int overflow in leap day calculations, @@ -437,9 +410,7 @@ static int iso_week_days (int, int); __inline__ #endif static int -iso_week_days (yday, wday) - int yday; - int wday; +iso_week_days (int yday, int wday) { /* Add enough to the first operand of % to make it nonnegative. */ int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7; @@ -470,8 +441,7 @@ static CHAR_T const month_name[][10] = #ifdef my_strftime # define extra_args , ut, ns -# define extra_args_spec int ut; int ns; -# define extra_args_spec_iso , int ut, int ns +# define extra_args_spec , int ut, int ns #else # ifdef COMPILE_WIDE # define my_strftime wcsftime @@ -482,7 +452,6 @@ static CHAR_T const month_name[][10] = # endif # define extra_args # define extra_args_spec -# define extra_args_spec_iso /* We don't have this information in general. */ # define ut 0 # define ns 0 @@ -491,15 +460,12 @@ static CHAR_T const month_name[][10] = #if !defined _LIBC && !defined(WINDOWSNT) && HAVE_TZNAME && HAVE_TZSET /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime. Work around this bug by copying *tp before it might be munged. */ - size_t _strftime_copytm (char *, size_t, const char *, - const struct tm * extra_args_spec_iso); size_t - my_strftime (s, maxsize, format, tp extra_args) - CHAR_T *s; - size_t maxsize; - const CHAR_T *format; - const struct tm *tp; - extra_args_spec + _strftime_copytm (CHAR_T *s, size_t maxsize, const CHAR_T *format, + const struct tm *tp extra_args_spec LOCALE_PARAM_DECL); + size_t + my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, + const struct tm *tp extra_args_spec) { struct tm tmcopy; tmcopy = *tp; @@ -517,13 +483,8 @@ static CHAR_T const month_name[][10] = anywhere, so to determine how many characters would be written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */ size_t -my_strftime (s, maxsize, format, tp extra_args LOCALE_PARAM) - CHAR_T *s; - size_t maxsize; - const CHAR_T *format; - const struct tm *tp; - extra_args_spec - LOCALE_PARAM_DECL +my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, + const struct tm *tp extra_args_spec LOCALE_PARAM_DECL) { #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL struct locale_data *const current = loc->__locales[LC_TIME]; @@ -1474,16 +1435,10 @@ libc_hidden_def (my_strftime) /* For Emacs we have a separate interface which corresponds to the normal strftime function plus the ut argument, but without the ns argument. */ size_t -emacs_strftimeu (s, maxsize, format, tp, ut) - char *s; - size_t maxsize; - const char *format; - const struct tm *tp; - int ut; +emacs_strftimeu (char *s, size_t maxsize, const char *format, + const struct tm *tp, int ut) { return my_strftime (s, maxsize, format, tp, ut, 0); } #endif -/* arch-tag: 662bc9c4-f8e2-41b6-bf96-b8346d0ce0d8 - (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) return quoted; } -/* Return the bytepos one character after BYTEPOS. - We assume that BYTEPOS is not at the end of the buffer. */ - -INLINE EMACS_INT -inc_bytepos (EMACS_INT bytepos) -{ - if (NILP (current_buffer->enable_multibyte_characters)) - return bytepos + 1; - - INC_POS (bytepos); - return bytepos; -} - /* Return the bytepos one character before BYTEPOS. We assume that BYTEPOS is not at the start of the buffer. */ -INLINE EMACS_INT +static INLINE EMACS_INT dec_bytepos (EMACS_INT bytepos) { 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/>. */ #include "dispextern.h" #include "process.h" #include "cm.h" /* for reset_sys_modes */ -#ifdef HAVE_TERM_H -/* Include this last. If it is ncurses header file, it adds a lot of - defines that interfere with stuff in other headers. Someone responsible - for ncurses messed up bigtime. See bug#6812. */ -#include <term.h> -#endif #ifdef WINDOWSNT #include <direct.h> @@ -123,6 +117,9 @@ struct utimbuf { #endif #endif +/* Declare here, including term.h is problematic on some systems. */ +extern void tputs (const char *, int, int (*)(int)); + static const int baud_convert[] = { 0, 50, 75, 110, 135, 150, 200, 300, 600, 1200, @@ -232,8 +229,8 @@ discard_tty_input (void) { if (tty->input) /* Is the device suspended? */ { - EMACS_GET_TTY (fileno (tty->input), &buf); - EMACS_SET_TTY (fileno (tty->input), &buf, 0); + emacs_get_tty (fileno (tty->input), &buf); + emacs_set_tty (fileno (tty->input), &buf, 0); } } } @@ -369,7 +366,7 @@ child_setup_tty (int out) #ifndef WINDOWSNT struct emacs_tty s; - EMACS_GET_TTY (out, &s); + emacs_get_tty (out, &s); s.main.c_oflag |= OPOST; /* Enable output postprocessing */ s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ #ifdef NLDLY @@ -447,7 +444,7 @@ child_setup_tty (int out) s.main.c_cc[VTIME] = 0; #endif - EMACS_SET_TTY (out, &s, 0); + emacs_set_tty (out, &s, 0); #endif /* not WINDOWSNT */ } #endif /* not MSDOS */ @@ -557,15 +554,6 @@ sys_subshell (void) close_process_descs (); /* Close Emacs's pipes/ptys */ -#ifdef SET_EMACS_PRIORITY - { - extern EMACS_INT emacs_priority; - - if (emacs_priority < 0) - nice (-emacs_priority); - } -#endif - #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ { char *epwd = getenv ("PWD"); @@ -859,7 +847,7 @@ init_sys_modes (struct tty_display_info *tty_out) if (! tty_out->old_tty) tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); - EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty); + emacs_get_tty (fileno (tty_out->input), tty_out->old_tty); tty = *tty_out->old_tty; @@ -1005,7 +993,7 @@ init_sys_modes (struct tty_display_info *tty_out) dos_ttraw (tty_out); #endif - EMACS_SET_TTY (fileno (tty_out->input), &tty, 0); + emacs_set_tty (fileno (tty_out->input), &tty, 0); /* This code added to insure that, if flow-control is not to be used, we have an unlocked terminal at the start. */ @@ -1097,8 +1085,16 @@ tabs_safe_p (int fd) { struct emacs_tty etty; - EMACS_GET_TTY (fd, &etty); - return EMACS_TTY_TABS_OK (&etty); + emacs_get_tty (fd, &etty); +#ifndef DOS_NT +#ifdef TABDLY + return ((etty.main.c_oflag & TABDLY) != TAB3); +#else /* not TABDLY */ + return 1; +#endif /* not TABDLY */ +#else /* DOS_NT */ + return 0; +#endif /* DOS_NT */ } /* Get terminal size from system. @@ -1260,7 +1256,7 @@ reset_sys_modes (struct tty_display_info *tty_out) #endif /* F_SETFL */ if (tty_out->old_tty) - while (EMACS_SET_TTY (fileno (tty_out->input), + while (emacs_set_tty (fileno (tty_out->input), tty_out->old_tty, 0) < 0 && errno == EINTR) ; @@ -3071,6 +3067,3 @@ system_process_attributes (Lisp_Object pid) #endif /* !defined (WINDOWSNT) */ - -/* arch-tag: edb43589-4e09-4544-b325-978b5b121dcf - (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/>. */ #include <fcntl.h> #endif /* not DOS_NT */ -#ifdef HAVE_SYS_IOCTL_H #include <sys/ioctl.h> -#endif #ifdef HPUX #include <sys/bsdtty.h> @@ -86,17 +84,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Manipulate a terminal's current process group. */ -/* EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's - current process group. Return -1 if there is an error. - - EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's - current process group to *PGID. Return -1 if there is an error. */ - -#ifndef DOS_NT -#define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd))) -#define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid))) -#endif /* not DOS_NT */ - /* EMACS_GETPGRP (arg) returns the process group of the process. */ #if defined (GETPGRP_VOID) @@ -112,21 +99,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ state, for example a struct tchars, a struct sgttyb, a struct tchars, a struct ltchars, and a struct pagechars, struct emacs_tty should contain an element for each parameter struct - that Emacs may change. - - EMACS_GET_TTY (int FD, struct emacs_tty *P) stores the parameters - of the tty on FD in *P. Return zero if all's well, or -1 if we ran - into an error we couldn't deal with. - - EMACS_SET_TTY (int FD, struct emacs_tty *P, int flushp) - sets the parameters of the tty on FD according to the contents of - *P. If flushp is non-zero, we discard queued input to be - written before making the change. - Return 0 if all went well, and -1 if anything failed. - - EMACS_TTY_TABS_OK (struct emacs_tty *P) is false if the kernel - expands tabs to spaces upon output; in that case, there is no - advantage to using tabs over spaces. */ + that Emacs may change. */ /* For each tty parameter structure that Emacs might want to save and restore, @@ -145,31 +118,6 @@ struct emacs_tty { #endif /* DOS_NT */ }; -/* Define EMACS_GET_TTY and EMACS_SET_TTY, - the macros for reading and setting parts of `struct emacs_tty'. - - These got pretty unmanageable (huge macros are hard to debug), and - finally needed some code which couldn't be done as part of an - expression, so we moved them out to their own functions in sysdep.c. */ -#define EMACS_GET_TTY(fd, p) (emacs_get_tty ((fd), (p))) -#define EMACS_SET_TTY(fd, p, waitp) (emacs_set_tty ((fd), (p), (waitp))) extern int emacs_get_tty (int, struct emacs_tty *); extern int emacs_set_tty (int, struct emacs_tty *, int); - -/* Define EMACS_TTY_TABS_OK. */ - -#ifndef DOS_NT - -#ifdef TABDLY -#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) -#else /* not TABDLY */ -#define EMACS_TTY_TABS_OK(p) 1 -#endif /* not TABDLY */ - -#else /* DOS_NT */ -#define EMACS_TTY_TABS_OK(p) 0 -#endif /* DOS_NT */ - -/* arch-tag: cf4b90bc-be41-401c-be98-40619178a712 - (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 *); extern int tgetflag (char *id); extern int tgetnum (char *id); +char *tparam (char *, char *, int, int, ...); + +extern char *tgetstr (char *, char **); + #include "cm.h" #ifdef HAVE_X_WINDOWS #include "xterm.h" @@ -176,32 +180,15 @@ static int no_controlling_tty; static int system_uses_terminfo; -char *tparam (char *, char *, int, int, ...); - -extern char *tgetstr (char *, char **); #ifdef HAVE_GPM #include <sys/fcntl.h> -static void term_clear_mouse_face (void); -static void term_mouse_highlight (struct frame *f, int x, int y); - /* The device for which we have enabled gpm support (or NULL). */ struct tty_display_info *gpm_tty = NULL; -/* These variables describe the range of text currently shown in its - mouse-face, together with the window they apply to. As long as - the mouse stays within this range, we need not redraw anything on - its account. Rows and columns are glyph matrix positions in - MOUSE_FACE_WINDOW. */ -static int mouse_face_beg_row, mouse_face_beg_col; -static int mouse_face_end_row, mouse_face_end_col; -static int mouse_face_past_end; -static Lisp_Object mouse_face_window; -static int mouse_face_face_id; - -static int pos_x, pos_y; +/* Last recorded mouse coordinates. */ static int last_mouse_x, last_mouse_y; #endif /* HAVE_GPM */ @@ -1501,6 +1488,8 @@ static void append_glyph (struct it *); static void produce_stretch_glyph (struct it *); static void append_composite_glyph (struct it *); static void produce_composite_glyph (struct it *); +static void append_glyphless_glyph (struct it *, int, char *); +static void produce_glyphless_glyph (struct it *, int, Lisp_Object); /* Append glyphs to IT's glyph_row. Called from produce_glyphs for terminal frames if IT->glyph_row != NULL. IT->char_to_display is @@ -1609,6 +1598,12 @@ produce_glyphs (struct it *it) goto done; } + if (it->what == IT_GLYPHLESS) + { + produce_glyphless_glyph (it, 0, Qnil); + goto done; + } + if (it->char_to_display >= 040 && it->char_to_display < 0177) { it->pixel_width = it->nglyphs = 1; @@ -1660,11 +1655,22 @@ produce_glyphs (struct it *it) } else { - it->pixel_width = CHAR_WIDTH (it->char_to_display); - it->nglyphs = it->pixel_width; + Lisp_Object charset_list = FRAME_TERMINAL (it->f)->charset_list; - if (it->glyph_row) - append_glyph (it); + if (char_charset (it->char_to_display, charset_list, NULL)) + { + it->pixel_width = CHAR_WIDTH (it->char_to_display); + it->nglyphs = it->pixel_width; + if (it->glyph_row) + append_glyph (it); + } + else + { + Lisp_Object acronym = lookup_glyphless_char_display (-1, it); + + xassert (it->what == IT_GLYPHLESS); + produce_glyphless_glyph (it, 1, acronym); + } } done: @@ -1844,6 +1850,152 @@ produce_composite_glyph (struct it *it) } +/* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID + is a face ID to be used for the glyph. What is actually appended + are glyphs of type CHAR_GLYPH whose characters are in STR (which + comes from it->nglyphs bytes). */ + +static void +append_glyphless_glyph (struct it *it, int face_id, char *str) +{ + struct glyph *glyph, *end; + int i; + + xassert (it->glyph_row); + glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area]; + end = it->glyph_row->glyphs[1 + it->area]; + + /* If the glyph row is reversed, we need to prepend the glyph rather + than append it. */ + if (it->glyph_row->reversed_p && it->area == TEXT_AREA) + { + struct glyph *g; + int move_by = it->pixel_width; + + /* Make room for the new glyphs. */ + if (move_by > end - glyph) /* don't overstep end of this area */ + move_by = end - glyph; + for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--) + g[move_by] = *g; + glyph = it->glyph_row->glyphs[it->area]; + end = glyph + move_by; + } + + if (glyph >= end) + return; + glyph->type = CHAR_GLYPH; + glyph->pixel_width = 1; + glyph->face_id = face_id; + glyph->padding_p = 0; + glyph->charpos = CHARPOS (it->position); + glyph->object = it->object; + if (it->bidi_p) + { + glyph->resolved_level = it->bidi_it.resolved_level; + if ((it->bidi_it.type & 7) != it->bidi_it.type) + abort (); + glyph->bidi_type = it->bidi_it.type; + } + else + { + glyph->resolved_level = 0; + glyph->bidi_type = UNKNOWN_BT; + } + + /* BIDI Note: we put the glyphs of characters left to right, even in + the REVERSED_P case because we write to the terminal + left-to-right. */ + for (i = 0; i < it->nglyphs && glyph < end; ++i) + { + if (i > 0) + glyph[0] = glyph[-1]; + glyph->u.ch = str[i]; + ++it->glyph_row->used[it->area]; + ++glyph; + } +} + +/* Produce glyphs for a glyphless character for iterator IT. + IT->glyphless_method specifies which method to use for displaying + the character. See the description of enum + glyphless_display_method in dispextern.h for the details. + + FOR_NO_FONT is nonzero if and only if this is for a character that + is not supproted by the coding system of the terminal. ACRONYM, if + non-nil, is an acronym string for the character. + + The glyphs actually produced are of type CHAR_GLYPH. */ + +static void +produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) +{ + int face_id; + int len; + char buf[9], *str = " "; + + /* Get a face ID for the glyph by utilizing a cache (the same way as + done for `escape-glyph' in get_next_display_element). */ + if (it->f == last_glyphless_glyph_frame + && it->face_id == last_glyphless_glyph_face_id) + { + face_id = last_glyphless_glyph_merged_face_id; + } + else + { + /* Merge the `glyphless-char' face into the current face. */ + face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id); + last_glyphless_glyph_frame = it->f; + last_glyphless_glyph_face_id = it->face_id; + last_glyphless_glyph_merged_face_id = face_id; + } + + if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) + { + /* As there's no way to produce a thin space, we produce a space + of canonical width. */ + len = 1; + } + else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX) + { + len = CHAR_WIDTH (it->c); + if (len == 0) + len = 1; + else if (len > 4) + len = 4; + sprintf (buf, "[%.*s]", len, str); + len += 2; + str = buf; + } + else + { + if (it->glyphless_method == GLYPHLESS_DISPLAY_ACRONYM) + { + if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display)) + acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c); + buf[0] = '['; + str = STRINGP (acronym) ? (char *) SDATA (acronym) : ""; + for (len = 0; len < 6 && str[len] && ASCII_BYTE_P (str[len]); len++) + buf[1 + len] = str[len]; + buf[1 + len] = ']'; + len += 2; + } + else + { + xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE); + len = (it->c < 0x10000 ? sprintf (buf, "\\u%04X", it->c) + : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "\\U%06X", it->c) + : sprintf (buf, "\\x%06X", it->c)); + } + str = buf; + } + + it->pixel_width = len; + it->nglyphs = len; + if (len > 0 && it->glyph_row) + append_glyphless_glyph (it, face_id, str); +} + + /* Get information about special display element WHAT in an environment described by IT. WHAT is one of IT_TRUNCATION or IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a @@ -2517,416 +2669,36 @@ term_mouse_moveto (int x, int y) last_mouse_y = y; */ } -static void -term_show_mouse_face (enum draw_glyphs_face draw) +/* Implementation of draw_row_with_mouse_face for TTY/GPM. */ +void +tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row, + int start_hpos, int end_hpos, + enum draw_glyphs_face draw) { - struct window *w = XWINDOW (mouse_face_window); - int save_x, save_y; - int i; - - struct frame *f = XFRAME (w->frame); + int nglyphs = end_hpos - start_hpos; + struct frame *f = XFRAME (WINDOW_FRAME (w)); struct tty_display_info *tty = FRAME_TTY (f); + int face_id = tty->mouse_highlight.mouse_face_face_id; + int save_x, save_y, pos_x, pos_y; - if (/* If window is in the process of being destroyed, don't bother - to do anything. */ - w->current_matrix != NULL - /* Recognize when we are called to operate on rows that don't exist - anymore. This can happen when a window is split. */ - && mouse_face_end_row < w->current_matrix->nrows) - { - /* write_glyphs writes at cursor position, so we need to - temporarily move cursor coordinates to the beginning of - the highlight region. */ - - /* Save current cursor co-ordinates */ - save_y = curY (tty); - save_x = curX (tty); - - /* Note that mouse_face_beg_row etc. are window relative. */ - for (i = mouse_face_beg_row; i <= mouse_face_end_row; i++) - { - int start_hpos, end_hpos, nglyphs; - struct glyph_row *row = MATRIX_ROW (w->current_matrix, i); - - /* Don't do anything if row doesn't have valid contents. */ - if (!row->enabled_p) - continue; - - /* For all but the first row, the highlight starts at column 0. */ - if (i == mouse_face_beg_row) - start_hpos = mouse_face_beg_col; - else - start_hpos = 0; - - if (i == mouse_face_end_row) - end_hpos = mouse_face_end_col; - else - { - end_hpos = row->used[TEXT_AREA]; - if (draw == DRAW_NORMAL_TEXT) - row->fill_line_p = 1; /* Clear to end of line */ - } - - if (end_hpos <= start_hpos) - continue; - /* Record that some glyphs of this row are displayed in - mouse-face. */ - row->mouse_face_p = draw > 0; - - nglyphs = end_hpos - start_hpos; - - if (end_hpos >= row->used[TEXT_AREA]) - nglyphs = row->used[TEXT_AREA] - start_hpos; + if (end_hpos >= row->used[TEXT_AREA]) + nglyphs = row->used[TEXT_AREA] - start_hpos; - pos_y = row->y + WINDOW_TOP_EDGE_Y (w); - pos_x = row->used[LEFT_MARGIN_AREA] + start_hpos - + WINDOW_LEFT_EDGE_X (w); + pos_y = row->y + WINDOW_TOP_EDGE_Y (w); + pos_x = row->used[LEFT_MARGIN_AREA] + start_hpos + WINDOW_LEFT_EDGE_X (w); - cursor_to (f, pos_y, pos_x); + /* Save current cursor co-ordinates. */ + save_y = curY (tty); + save_x = curX (tty); + cursor_to (f, pos_y, pos_x); - if (draw == DRAW_MOUSE_FACE) - { - tty_write_glyphs_with_face (f, row->glyphs[TEXT_AREA] + start_hpos, - nglyphs, mouse_face_face_id); - } - else /* draw == DRAW_NORMAL_TEXT */ - write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); - } - cursor_to (f, save_y, save_x); - } -} - -static void -term_clear_mouse_face (void) -{ - if (!NILP (mouse_face_window)) - term_show_mouse_face (DRAW_NORMAL_TEXT); - - mouse_face_beg_row = mouse_face_beg_col = -1; - mouse_face_end_row = mouse_face_end_col = -1; - mouse_face_window = Qnil; -} - -/* Find the glyph matrix position of buffer position POS in window W. - *HPOS and *VPOS are set to the positions found. W's current glyphs - must be up to date. If POS is above window start return (0, 0). - If POS is after end of W, return end of last line in W. - - taken from msdos.c */ -static int -fast_find_position (struct window *w, EMACS_INT pos, int *hpos, int *vpos) -{ - int i, lastcol, maybe_next_line_p = 0; - EMACS_INT line_start_position; - int yb = window_text_bottom_y (w); - struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row; - - while (row->y < yb) - { - if (row->used[TEXT_AREA]) - line_start_position = row->glyphs[TEXT_AREA]->charpos; - else - line_start_position = 0; - - if (line_start_position > pos) - break; - /* If the position sought is the end of the buffer, - don't include the blank lines at the bottom of the window. */ - else if (line_start_position == pos - && pos == BUF_ZV (XBUFFER (w->buffer))) - { - maybe_next_line_p = 1; - break; - } - else if (line_start_position > 0) - best_row = row; - - /* Don't overstep the last matrix row, lest we get into the - never-never land... */ - if (row->y + 1 >= yb) - break; - - ++row; - } - - /* Find the right column within BEST_ROW. */ - lastcol = 0; - row = best_row; - for (i = 0; i < row->used[TEXT_AREA]; i++) - { - struct glyph *glyph = row->glyphs[TEXT_AREA] + i; - EMACS_INT charpos; - - charpos = glyph->charpos; - if (charpos == pos) - { - *hpos = i; - *vpos = row->y; - return 1; - } - else if (charpos > pos) - break; - else if (charpos > 0) - lastcol = i; - } - - /* If we're looking for the end of the buffer, - and we didn't find it in the line we scanned, - use the start of the following line. */ - if (maybe_next_line_p) - { - ++row; - lastcol = 0; - } - - *vpos = row->y; - *hpos = lastcol + 1; - return 0; -} - -static void -term_mouse_highlight (struct frame *f, int x, int y) -{ - enum window_part part; - Lisp_Object window; - struct window *w; - struct buffer *b; - - if (NILP (Vmouse_highlight) - || !f->glyphs_initialized_p) - return; - - /* Which window is that in? */ - window = window_from_coordinates (f, x, y, &part, &x, &y, 0); - - /* Not on a window -> return. */ - if (!WINDOWP (window)) - return; - - if (!EQ (window, mouse_face_window)) - term_clear_mouse_face (); - - w = XWINDOW (window); - - /* Are we in a window whose display is up to date? - And verify the buffer's text has not changed. */ - b = XBUFFER (w->buffer); - if (part == ON_TEXT - && EQ (w->window_end_valid, w->buffer) - && XFASTINT (w->last_modified) == BUF_MODIFF (b) - && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) - { - int i, nrows = w->current_matrix->nrows; - EMACS_INT pos; - struct glyph_row *row; - struct glyph *glyph; - - /* Find the glyph under X/Y. */ - glyph = NULL; - if (y >= 0 && y < nrows) - { - row = MATRIX_ROW (w->current_matrix, y); - /* Give up if some row before the one we are looking for is - not enabled. */ - for (i = 0; i <= y; i++) - if (!MATRIX_ROW (w->current_matrix, i)->enabled_p) - break; - if (i > y /* all rows upto and including the one at Y are enabled */ - && row->displays_text_p - && x < window_box_width (w, TEXT_AREA)) - { - glyph = row->glyphs[TEXT_AREA]; - if (x >= row->used[TEXT_AREA]) - glyph = NULL; - else - { - glyph += x; - if (!BUFFERP (glyph->object)) - glyph = NULL; - } - } - } - - /* Clear mouse face if X/Y not over text. */ - if (glyph == NULL) - { - term_clear_mouse_face (); - return; - } - - if (!BUFFERP (glyph->object)) - abort (); - pos = glyph->charpos; - - /* Check for mouse-face. */ - { - Lisp_Object mouse_face, overlay, position, *overlay_vec; - int noverlays; - EMACS_INT obegv, ozv; - struct buffer *obuf; - - /* If we get an out-of-range value, return now; avoid an error. */ - if (pos > BUF_Z (b)) - return; - - /* Make the window's buffer temporarily current for - overlays_at and compute_char_face. */ - obuf = current_buffer; - current_buffer = b; - obegv = BEGV; - ozv = ZV; - BEGV = BEG; - ZV = Z; - - /* Is this char mouse-active? */ - XSETINT (position, pos); - - /* Put all the overlays we want in a vector in overlay_vec. */ - GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0); - /* Sort overlays into increasing priority order. */ - noverlays = sort_overlays (overlay_vec, noverlays, w); - - /* Check mouse-face highlighting. */ - if (!(EQ (window, mouse_face_window) - && y >= mouse_face_beg_row - && y <= mouse_face_end_row - && (y > mouse_face_beg_row - || x >= mouse_face_beg_col) - && (y < mouse_face_end_row - || x < mouse_face_end_col - || mouse_face_past_end))) - { - /* Clear the display of the old active region, if any. */ - term_clear_mouse_face (); - - /* Find the highest priority overlay that has a mouse-face - property. */ - overlay = Qnil; - for (i = noverlays - 1; i >= 0; --i) - { - mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face); - if (!NILP (mouse_face)) - { - overlay = overlay_vec[i]; - break; - } - } - - /* If no overlay applies, get a text property. */ - if (NILP (overlay)) - mouse_face = Fget_text_property (position, Qmouse_face, - w->buffer); - - /* Handle the overlay case. */ - if (!NILP (overlay)) - { - /* Find the range of text around this char that - should be active. */ - Lisp_Object before, after; - EMACS_INT ignore; - - - before = Foverlay_start (overlay); - after = Foverlay_end (overlay); - /* Record this as the current active region. */ - fast_find_position (w, XFASTINT (before), - &mouse_face_beg_col, - &mouse_face_beg_row); - - mouse_face_past_end - = !fast_find_position (w, XFASTINT (after), - &mouse_face_end_col, - &mouse_face_end_row); - mouse_face_window = window; + if (draw == DRAW_MOUSE_FACE) + tty_write_glyphs_with_face (f, row->glyphs[TEXT_AREA] + start_hpos, + nglyphs, face_id); + else if (draw == DRAW_NORMAL_TEXT) + write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); - mouse_face_face_id - = face_at_buffer_position (w, pos, 0, 0, - &ignore, pos + 1, 1, -1); - - /* Display it as active. */ - term_show_mouse_face (DRAW_MOUSE_FACE); - } - /* Handle the text property case. */ - else if (!NILP (mouse_face)) - { - /* Find the range of text around this char that - should be active. */ - Lisp_Object before, after, beginning, end; - EMACS_INT ignore; - - beginning = Fmarker_position (w->start); - XSETINT (end, (BUF_Z (b) - XFASTINT (w->window_end_pos))); - before - = Fprevious_single_property_change (make_number (pos + 1), - Qmouse_face, - w->buffer, beginning); - after - = Fnext_single_property_change (position, Qmouse_face, - w->buffer, end); - - /* Record this as the current active region. */ - fast_find_position (w, XFASTINT (before), - &mouse_face_beg_col, - &mouse_face_beg_row); - mouse_face_past_end - = !fast_find_position (w, XFASTINT (after), - &mouse_face_end_col, - &mouse_face_end_row); - mouse_face_window = window; - - mouse_face_face_id - = face_at_buffer_position (w, pos, 0, 0, - &ignore, pos + 1, 1, -1); - - /* Display it as active. */ - term_show_mouse_face (DRAW_MOUSE_FACE); - } - } - - /* Look for a `help-echo' property. */ - { - Lisp_Object help; - - /* Check overlays first. */ - help = Qnil; - for (i = noverlays - 1; i >= 0 && NILP (help); --i) - { - overlay = overlay_vec[i]; - help = Foverlay_get (overlay, Qhelp_echo); - } - - if (!NILP (help)) - { - help_echo_string = help; - help_echo_window = window; - help_echo_object = overlay; - help_echo_pos = pos; - } - /* Try text properties. */ - else if (NILP (help) - && ((STRINGP (glyph->object) - && glyph->charpos >= 0 - && glyph->charpos < SCHARS (glyph->object)) - || (BUFFERP (glyph->object) - && glyph->charpos >= BEGV - && glyph->charpos < ZV))) - { - help = Fget_text_property (make_number (glyph->charpos), - Qhelp_echo, glyph->object); - if (!NILP (help)) - { - help_echo_string = help; - help_echo_window = window; - help_echo_object = glyph->object; - help_echo_pos = glyph->charpos; - } - } - } - - BEGV = obegv; - ZV = ozv; - current_buffer = obuf; - } - } + cursor_to (f, save_y, save_x); } static int @@ -2936,7 +2708,7 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) if (event->x != last_mouse_x || event->y != last_mouse_y) { frame->mouse_moved = 1; - term_mouse_highlight (frame, event->x, event->y); + note_mouse_highlight (frame, event->x, event->y); /* Remember which glyph we're now on. */ last_mouse_x = event->x; last_mouse_y = event->y; @@ -3309,8 +3081,7 @@ static void dissociate_if_controlling_tty (int fd) { #ifndef DOS_NT - int pgid; - EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */ + int pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */ if (pgid != -1) { #if defined (USG5) @@ -3407,7 +3178,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) #ifdef HAVE_GPM terminal->mouse_position_hook = term_mouse_position; - mouse_face_window = Qnil; + tty->mouse_highlight.mouse_face_window = Qnil; #endif @@ -4042,8 +3813,6 @@ bigger, or it may make it blink, or it may do nothing at all. */); #ifdef HAVE_GPM defsubr (&Sgpm_mouse_start); defsubr (&Sgpm_mouse_stop); - - staticpro (&mouse_face_window); #endif /* HAVE_GPM */ #ifndef DOS_NT @@ -4056,7 +3825,3 @@ bigger, or it may make it blink, or it may do nothing at all. */); encode_terminal_dst = NULL; } - - -/* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193 - (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 struct tty_display_info { struct tty_display_info *next; /* Chain of all tty devices. */ - + char *name; /* The name of the device file or 0 if stdin/stdout. */ char *type; /* The type of the tty. */ - + /* Input/output */ - + FILE *input; /* The stream to be used for terminal input. NULL if the terminal is suspended. */ FILE *output; /* The stream to be used for terminal output. NULL if the terminal is suspended. */ - + FILE *termscript; /* If nonzero, send all terminal output characters to this stream also. */ @@ -65,38 +65,14 @@ struct tty_display_info /* Redisplay. */ Lisp_Object top_frame; /* The topmost frame on this tty. */ - + /* The previous frame we displayed on this tty. */ struct frame *previous_frame; int previous_color_mode; -#ifdef MSDOS - /* These variables describe the range of text currently shown in its - mouse-face, together with the window they apply to. As long as - the mouse stays within this range, we need not redraw anything on - its account. Rows and columns are glyph matrix positions in - MOUSE_FACE_WINDOW. */ - int mouse_face_beg_row, mouse_face_beg_col; - int mouse_face_end_row, mouse_face_end_col; - int mouse_face_past_end; - Lisp_Object mouse_face_window; - int mouse_face_face_id; - - /* 1 if a mouse motion event came and we didn't handle it right away because - gc was in progress. */ - int mouse_face_deferred_gc; - - /* FRAME and X, Y position of mouse when last checked for - highlighting. X and Y can be negative or out of range for the frame. */ - struct frame *mouse_face_mouse_frame; - int mouse_face_mouse_x, mouse_face_mouse_y; - - /* Nonzero means defer mouse-motion highlighting. */ - int mouse_face_defer; - - /* Nonzero means that the mouse highlight should not be shown. */ - int mouse_face_hidden; -#endif /* !MSDOS */ + /* Information about the range of text currently shown in + mouse-face. */ + Mouse_HLInfo mouse_highlight; /* Buffer used internally by termcap (see tgetent in the Termcap manual). Only init_tty and delete_tty should change this. */ @@ -190,12 +166,12 @@ struct tty_display_info int RPov; /* # chars to start a TS_repeat */ int delete_in_insert_mode; /* delete mode == insert mode */ - + int se_is_so; /* 1 if same string both enters and leaves standout mode */ - + int costs_set; /* Nonzero if costs have been calculated. */ - + int insert_mode; /* Nonzero when in insert mode. */ int standout_mode; /* Nonzero when in standout mode. */ @@ -214,7 +190,7 @@ struct tty_display_info lines from those operations. */ int specified_window; - + /* Flag used in tty_show/hide_cursor. */ 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 /* Parameter alist of this terminal. */ Lisp_Object param_alist; + /* List of charsets supported by the terminal. It is set by + Fset_terminal_coding_system_internal along with + the member terminal_coding. */ + Lisp_Object charset_list; + /* All fields before `next_terminal' should be Lisp_Object and are traced by the GC. All fields afterwards are ignored by the GC. */ 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) error (msg, a1, a2); } -static int make_hdr (int, int, unsigned, unsigned, unsigned, - const char *, const char *); +static int make_hdr (int, int, const char *, const char *); static int copy_text_and_data (int, int); static int copy_sym (int, int, const char *, const char *); static 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 @@ /* 16-bit Windows Selection processing for emacs on MS-Windows - Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -693,18 +694,43 @@ syms_of_win16select (void) defsubr (&Sx_selection_exists_p); DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system, - doc: /* Coding system for communicating with other X clients. -When sending or receiving text via cut_buffer, selection, and clipboard, -the text is encoded or decoded by this coding system. -The default value is `iso-latin-1-dos'. */); + doc: /* Coding system for communicating with other programs. + +For MS-Windows and MS-DOS: +When sending or receiving text via selection and clipboard, the text +is encoded or decoded by this coding system. The default value is +the current system default encoding on 9x/Me, `utf-16le-dos' +\(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS. + +For X Windows: +When sending text via selection and clipboard, if the target +data-type matches with the type of this coding system, it is used +for encoding the text. Otherwise (including the case that this +variable is nil), a proper coding system is used as below: + +data-type coding system +--------- ------------- +UTF8_STRING utf-8 +COMPOUND_TEXT compound-text-with-extensions +STRING iso-latin-1 +C_STRING no-conversion + +When receiving text, if this coding system is non-nil, it is used +for decoding regardless of the data-type. If this is nil, a +proper coding system is used according to the data-type as above. + +See also the documentation of the variable `x-select-request-type' how +to control which data-type to request for receiving text. + +The default value is nil. */); Vselection_coding_system = intern ("iso-latin-1-dos"); DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system, - doc: /* Coding system for the next communication with other X clients. + doc: /* Coding system for the next communication with other programs. Usually, `selection-coding-system' is used for communicating with -other X clients. But, if this variable is set, it is used for the -next communication only. After the communication, this variable is -set to nil. */); +other programs (X Windows clients or MS Windows programs). But, if this +variable is set, it is used for the next communication only. +After the communication, this variable is set to nil. */); Vnext_selection_coding_system = Qnil; QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); @@ -713,5 +739,3 @@ set to nil. */); #endif /* MSDOS */ -/* arch-tag: 085a22c8-7324-436e-a6da-102464ce95d8 - (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/>. */ /* must include CRT headers *before* config.h */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif #undef access #undef chdir @@ -97,7 +95,7 @@ typedef struct _MEMORY_STATUS_EX { #include <w32api.h> #if !defined(__MINGW32__) || __W32API_MAJOR_VERSION < 3 || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 15) /* This either is not in psapi.h or guarded by higher value of - _WIN32_WINNT than what we use. w32api suplied with MinGW 3.15 + _WIN32_WINNT than what we use. w32api supplied with MinGW 3.15 defines it in psapi.h */ typedef struct _PROCESS_MEMORY_COUNTERS_EX { DWORD cb; @@ -6086,5 +6084,3 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact) /* end of w32.c */ -/* arch-tag: 90442dd3-37be-482b-b272-ac752e3049f1 - (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 @@ /* Graphical user interface functions for the Microsoft W32 API. - Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -81,7 +82,7 @@ extern const char *map_w32_filename (const char *, const char **); extern int quit_char; -extern char *lispy_function_keys[]; +extern const char *const lispy_function_keys[]; /* The colormap for converting color names to RGB values */ Lisp_Object Vw32_color_map; @@ -4344,8 +4345,6 @@ This function is an internal primitive--use `make-frame' instead. */) "background", "Background", RES_TYPE_STRING); x_default_parameter (f, parameters, Qmouse_color, build_string ("black"), "pointerColor", "Foreground", RES_TYPE_STRING); - x_default_parameter (f, parameters, Qcursor_color, build_string ("black"), - "cursorColor", "Foreground", RES_TYPE_STRING); x_default_parameter (f, parameters, Qborder_color, build_string ("black"), "borderColor", "BorderColor", RES_TYPE_STRING); 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, DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, - doc: /* Internal function called by `color-defined-p', which see. */) + doc: /* Internal function called by `color-defined-p', which see. +\(Note that the Nextstep version of this function ignores FRAME.) */) (Lisp_Object color, Lisp_Object frame) { XColor foo; @@ -4850,11 +4850,12 @@ x_display_info_for_name (Lisp_Object name) } DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, - 1, 3, 0, doc: /* Open a connection to a server. + 1, 3, 0, doc: /* Open a connection to a display server. DISPLAY is the name of the display to connect to. Optional second arg XRM-STRING is a string of resources in xrdb format. If the optional third arg MUST-SUCCEED is non-nil, -terminate Emacs if we can't open the connection. */) +terminate Emacs if we can't open the connection. +\(In the Nextstep version, the last two arguments are currently ignored.) */) (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed) { unsigned char *xrm_option; @@ -4974,7 +4975,17 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, } DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, - doc: /* This is a noop on W32 systems. */) + doc: /* If ON is non-nil, report X errors as soon as the erring request is made. +This function only has an effect on X Windows. With MS Windows, it is +defined but does nothing. + +If ON is nil, allow buffering of requests. +Turning on synchronization prohibits the Xlib routines from buffering +requests and seriously degrades performance, but makes debugging much +easier. +The optional second argument TERMINAL specifies which display to act on. +TERMINAL should be a terminal object, a frame or a display name (a string). +If TERMINAL is omitted or nil, that stands for the selected frame's display. */) (Lisp_Object on, Lisp_Object display) { return Qnil; @@ -4989,11 +5000,12 @@ DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, DEFUN ("x-change-window-property", Fx_change_window_property, Sx_change_window_property, 2, 6, 0, doc: /* Change window property PROP to VALUE on the X window of FRAME. -VALUE may be a string or a list of conses, numbers and/or strings. -If an element in the list is a string, it is converted to -an Atom and the value of the Atom is used. If an element is a cons, -it is converted to a 32 bit number where the car is the 16 top bits and the -cdr is the lower 16 bits. +PROP must be a string. VALUE may be a string or a list of conses, +numbers and/or strings. If an element in the list is a string, it is +converted to an atom and the value of the Atom is used. If an element +is a cons, it is converted to a 32 bit number where the car is the 16 +top bits and the cdr is the lower 16 bits. + FRAME nil or omitted means use the selected frame. If TYPE is given and non-nil, it is the name of the type of VALUE. If 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. It must be one of 8, 16 or 32. If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8. If OUTER_P is non-nil, the property is changed for the outer X window of -FRAME. Default is to change on the edit X window. - -Value is VALUE. */) +FRAME. Default is to change on the edit X window. */) (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) { #if 0 /* TODO : port window properties to W32 */ @@ -5057,9 +5067,20 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */) DEFUN ("x-window-property", Fx_window_property, Sx_window_property, 1, 2, 0, doc: /* Value is the value of window property PROP on FRAME. -If FRAME is nil or omitted, use the selected frame. Value is nil -if FRAME hasn't a property with name PROP or if PROP has no string -value. */) +If FRAME is nil or omitted, use the selected frame. + +On MS Windows, this function only accepts the PROP and FRAME arguments. + +On X Windows, the following optional arguments are also accepted: +If TYPE is nil or omitted, get the property as a string. +Otherwise TYPE is the name of the atom that denotes the type expected. +If SOURCE is non-nil, get the property on that window instead of from +FRAME. The number 0 denotes the root window. +If DELETE_P is non-nil, delete the property after retreiving it. +If VECTOR_RET_P is non-nil, don't return a string but a vector of values. + +Value is nil if FRAME hasn't a property with name PROP or if PROP has +no value of TYPE (always string in the MS Windows case). */) (Lisp_Object prop, Lisp_Object frame) { #if 0 /* TODO : port window properties to W32 */ @@ -5634,7 +5655,7 @@ Text larger than the specified size is clipped. */) int root_x, root_y; struct buffer *old_buffer; struct text_pos pos; - int i, width, height; + int i, width, height, seen_reversed_p; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; int old_windows_or_buffers_changed = windows_or_buffers_changed; int count = SPECPDL_INDEX (); @@ -5764,7 +5785,7 @@ Text larger than the specified size is clipped. */) try_window (FRAME_ROOT_WINDOW (f), pos, 0); /* Compute width and height of the tooltip. */ - width = height = 0; + width = height = seen_reversed_p = 0; for (i = 0; i < w->desired_matrix->nrows; ++i) { struct glyph_row *row = &w->desired_matrix->rows[i]; @@ -5778,24 +5799,83 @@ Text larger than the specified size is clipped. */) /* Let the row go over the full width of the frame. */ row->full_width_p = 1; -#ifdef TODO /* Investigate why some fonts need more width than is - calculated for some tooltips. */ - /* There's a glyph at the end of rows that is use to place - the cursor there. Don't include the width of this glyph. */ + row_width = row->pixel_width; if (row->used[TEXT_AREA]) { - last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; - row_width = row->pixel_width - last->pixel_width; - } - else + if (!row->reversed_p) + { +#ifdef TODO /* Investigate why some fonts need more width than is + calculated for some tooltips. */ + + /* There's a glyph at the end of rows that is used to + place the cursor there. Don't include the width of + this glyph. */ + last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; + if (INTEGERP (last->object)) + row_width -= last->pixel_width; #endif - row_width = row->pixel_width; + } + else + { + /* There could be a stretch glyph at the beginning of R2L + rows that is produced by extend_face_to_end_of_line. + Don't count that glyph. */ + struct glyph *g = row->glyphs[TEXT_AREA]; + + if (g->type == STRETCH_GLYPH && INTEGERP (g->object)) + { + row_width -= g->pixel_width; + seen_reversed_p = 1; + } + } + } /* TODO: find why tips do not draw along baseline as instructed. */ height += row->height; width = max (width, row_width); } + /* If we've seen partial-length R2L rows, we need to re-adjust the + tool-tip frame width and redisplay it again, to avoid over-wide + tips due to the stretch glyph that extends R2L lines to full + width of the frame. */ + if (seen_reversed_p) + { + /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, + not in pixels. */ + width /= WINDOW_FRAME_COLUMN_WIDTH (w); + w->total_cols = make_number (width); + FRAME_TOTAL_COLS (f) = width; + adjust_glyphs (f); + clear_glyph_matrix (w->desired_matrix); + clear_glyph_matrix (w->current_matrix); + try_window (FRAME_ROOT_WINDOW (f), pos, 0); + width = height = 0; + /* Recompute width and height of the tooltip. */ + for (i = 0; i < w->desired_matrix->nrows; ++i) + { + struct glyph_row *row = &w->desired_matrix->rows[i]; + struct glyph *last; + int row_width; + + if (!row->enabled_p || !row->displays_text_p) + break; + row->full_width_p = 1; + row_width = row->pixel_width; +#ifdef TODO /* See above. */ + if (row->used[TEXT_AREA] && !row->reversed_p) + { + last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; + if (INTEGERP (last->object)) + row_width -= last->pixel_width; + } +#endif + + height += row->height; + width = max (width, row_width); + } + } + /* Add the frame's internal border to the width and height the X window should have. */ height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); @@ -5948,10 +6028,13 @@ typedef struct DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, doc: /* Read file name, prompting with PROMPT in directory DIR. -Use a file selection dialog. -Select DEFAULT-FILENAME in the dialog's file selection box, if -specified. Ensure that file exists if MUSTMATCH is non-nil. -If ONLY-DIR-P is non-nil, the user can only select directories. */) +Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file +selection box, if specified. If MUSTMATCH is non-nil, the returned file +or directory must exist. + +This function is only defined on MS Windows, and X Windows with the +Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. +Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) { struct frame *f = SELECTED_FRAME (); @@ -7243,5 +7326,3 @@ w32_last_error (void) return GetLastError (); } -/* arch-tag: 707589ab-b9be-4638-8cdd-74629cc9b446 - (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. */) return DECODE_SYSTEM (build_string (buf)); } -static const char *w32font_booleans [] = { +static const char *const w32font_booleans [] = { NULL, }; -static const char *w32font_non_booleans [] = { +static const char *const w32font_non_booleans [] = { ":script", ":antialias", ":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; /* Dealing with bits of wchar_t as if they were an XChar2b. */ #define STORE_XCHAR2B(chp, byte1, byte2) \ - ((*chp) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff)))) + ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff)))) #define XCHAR2B_BYTE1(chp) \ - (((*chp) & 0xff00) >> 8) + (((*(chp)) & 0xff00) >> 8) #define XCHAR2B_BYTE2(chp) \ - ((*chp) & 0x00ff) + ((*(chp)) & 0x00ff) /* 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/>. */ Geoff Voelker (voelker@cs.washington.edu) 7-29-94 */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif - #include <stdio.h> #include <setjmp.h> @@ -301,5 +298,3 @@ _heap_term (void) #endif -/* arch-tag: 9a6a9860-040d-422d-8905-450dd535cd9c - (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/>. */ */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif - #include <stdio.h> #include <windows.h> #include <setjmp.h> @@ -282,7 +279,7 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event) } -extern char *lispy_function_keys[]; +extern const char *const lispy_function_keys[]; static int faked_key = 0; @@ -784,5 +781,3 @@ w32_console_read_socket (struct terminal *terminal, return ret; } -/* arch-tag: 0bcb39b7-d085-4b85-9070-6750e8c03047 - (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/>. */ #include <setjmp.h> /* must include CRT headers *before* config.h */ - -#ifdef HAVE_CONFIG_H #include <config.h> -#endif #undef signal #undef wait @@ -2370,7 +2367,5 @@ where the performance impact may be noticeable even on modern hardware. */); staticpro (&Vw32_valid_locale_ids); staticpro (&Vw32_valid_codepages); } -/* end of ntproc.c */ +/* end of w32proc.c */ -/* arch-tag: 23d3a34c-06d2-48a1-833b-ac7609aa5250 - (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 @@ /* Selection processing for Emacs on the Microsoft W32 API. - Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -1069,10 +1070,34 @@ syms_of_w32select (void) DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system, doc: /* Coding system for communicating with other programs. -When sending or receiving text via cut_buffer, selection, and -clipboard, the text is encoded or decoded by this coding system. -The default value is the current system default encoding on 9x/Me and -`utf-16le-dos' (Unicode) on NT/W2K/XP. */); + +For MS-Windows and MS-DOS: +When sending or receiving text via selection and clipboard, the text +is encoded or decoded by this coding system. The default value is +the current system default encoding on 9x/Me, `utf-16le-dos' +\(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS. + +For X Windows: +When sending text via selection and clipboard, if the target +data-type matches with the type of this coding system, it is used +for encoding the text. Otherwise (including the case that this +variable is nil), a proper coding system is used as below: + +data-type coding system +--------- ------------- +UTF8_STRING utf-8 +COMPOUND_TEXT compound-text-with-extensions +STRING iso-latin-1 +C_STRING no-conversion + +When receiving text, if this coding system is non-nil, it is used +for decoding regardless of the data-type. If this is nil, a +proper coding system is used according to the data-type as above. + +See also the documentation of the variable `x-select-request-type' how +to control which data-type to request for receiving text. + +The default value is nil. */); /* The actual value is set dynamically in the dumped Emacs, see below. */ Vselection_coding_system = Qnil; @@ -1080,9 +1105,9 @@ The default value is the current system default encoding on 9x/Me and DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system, doc: /* Coding system for the next communication with other programs. Usually, `selection-coding-system' is used for communicating with -other programs. But, if this variable is set, it is used for the -next communication only. After the communication, this variable is -set to nil. */); +other programs (X Windows clients or MS Windows programs). But, if this +variable is set, it is used for the next communication only. +After the communication, this variable is set to nil. */); Vnext_selection_coding_system = Qnil; DEFSYM (QCLIPBOARD, "CLIPBOARD"); @@ -1123,5 +1148,3 @@ globals_of_w32select (void) clipboard_owner = create_owner (); } -/* arch-tag: c96e9724-5eb1-4dad-be07-289f092fd2af - (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 @@ /* Implementation of GUI terminal on the Microsoft W32 API. - Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -504,7 +505,7 @@ static void x_update_window_begin (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); /* Hide the system caret during an update. */ if (w32_use_visible_system_caret && w32_system_caret_hwnd) @@ -517,15 +518,15 @@ x_update_window_begin (struct window *w) BLOCK_INPUT; - if (f == display_info->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { /* Don't do highlighting for mouse motion during the update. */ - display_info->mouse_face_defer = 1; + hlinfo->mouse_face_defer = 1; /* If F needs to be redrawn, simply forget about any prior mouse highlighting. */ if (FRAME_GARBAGED_P (f)) - display_info->mouse_face_window = Qnil; + hlinfo->mouse_face_window = Qnil; #if 0 /* Rows in a current matrix containing glyphs in mouse-face have their mouse_face_p flag set, which means that they are always @@ -539,8 +540,8 @@ x_update_window_begin (struct window *w) Likewise, don't do anything if the frame is garbaged; in that case, the frame's current matrix that we would use is all wrong, and we will redisplay that line anyway. */ - if (!NILP (display_info->mouse_face_window) - && w == XWINDOW (display_info->mouse_face_window)) + if (!NILP (hlinfo->mouse_face_window) + && w == XWINDOW (hlinfo->mouse_face_window)) { int i; @@ -549,7 +550,7 @@ x_update_window_begin (struct window *w) break; if (i < w->desired_matrix->nrows) - clear_mouse_face (display_info); + clear_mouse_face (hlinfo); } #endif /* 0 */ } @@ -600,7 +601,7 @@ static void x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) { - struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); if (!w->pseudo_window_p) { @@ -621,9 +622,9 @@ x_update_window_end (struct window *w, int cursor_on_p, XTframe_up_to_date to redisplay the mouse highlight. */ if (mouse_face_overwritten_p) { - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; } /* Unhide the caret. This won't actually show the cursor, unless it @@ -648,7 +649,7 @@ x_update_end (struct frame *f) return; /* Mouse highlight may be displayed again. */ - FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 0; + MOUSE_HL_INFO (f)->mouse_face_defer = 0; } @@ -661,17 +662,17 @@ w32_frame_up_to_date (struct frame *f) { if (FRAME_W32_P (f)) { - struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - if (dpyinfo->mouse_face_deferred_gc - || f == dpyinfo->mouse_face_mouse_frame) + if (hlinfo->mouse_face_deferred_gc + || f == hlinfo->mouse_face_mouse_frame) { BLOCK_INPUT; - if (dpyinfo->mouse_face_mouse_frame) - note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, - dpyinfo->mouse_face_mouse_x, - dpyinfo->mouse_face_mouse_y); - dpyinfo->mouse_face_deferred_gc = 0; + if (hlinfo->mouse_face_mouse_frame) + note_mouse_highlight (hlinfo->mouse_face_mouse_frame, + hlinfo->mouse_face_mouse_x, + hlinfo->mouse_face_mouse_y); + hlinfo->mouse_face_deferred_gc = 0; UNBLOCK_INPUT; } } @@ -998,7 +999,7 @@ x_set_mouse_face_gc (struct glyph_string *s) struct face *face; /* What face has to be used last for the mouse face? */ - face_id = FRAME_W32_DISPLAY_INFO (s->f)->mouse_face_face_id; + face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id; face = FACE_FROM_ID (s->f, face_id); if (face == NULL) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); @@ -1393,6 +1394,94 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s) } +/* Draw the foreground of glyph string S for glyphless characters. */ + +static void +x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) +{ + struct glyph *glyph = s->first_glyph; + XChar2b char2b[8]; + int x, i, j; + int with_background; + + /* If first glyph of S has a left box line, start drawing the text + of S to the right of that box line. */ + if (s->face->box != FACE_NO_BOX + && s->first_glyph->left_box_line_p) + x = s->x + eabs (s->face->box_line_width); + else + x = s->x; + + SetTextColor (s->hdc, s->gc->foreground); + SetBkColor (s->hdc, s->gc->background); + SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT); + + s->char2b = char2b; + with_background = ! (s->for_overlaps + || (s->background_filled_p && s->hl != DRAW_CURSOR)); + for (i = 0; i < s->nchars; i++, glyph++) + { + char buf[7], *str = NULL; + int len = glyph->u.glyphless.len; + + if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM) + { + if (len > 1 + && CHAR_TABLE_P (Vglyphless_char_display) + && (CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) + >= 1)) + { + Lisp_Object acronym + = (! glyph->u.glyphless.for_no_font + ? CHAR_TABLE_REF (Vglyphless_char_display, + glyph->u.glyphless.ch) + : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); + if (STRINGP (acronym)) + str = (char *) SDATA (acronym); + } + } + else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE) + { + sprintf ((char *) buf, "%0*X", + glyph->u.glyphless.ch < 0x10000 ? 4 : 6, + glyph->u.glyphless.ch); + str = buf; + } + + if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) + w32_draw_rectangle (s->hdc, s->gc, + x, s->ybase - glyph->ascent, + glyph->pixel_width - 1, + glyph->ascent + glyph->descent - 1); + if (str) + { + struct font *font = s->font; + int upper_len = (len + 1) / 2; + unsigned code; + HFONT old_font; + + old_font = SelectObject (s->hdc, FONT_HANDLE (font)); + /* It is certain that all LEN characters in STR are ASCII. */ + for (j = 0; j < len; j++) + { + code = font->driver->encode_char (font, str[j]); + STORE_XCHAR2B (char2b + j, code >> 8, code & 0xFF); + } + font->driver->draw (s, 0, upper_len, + x + glyph->slice.glyphless.upper_xoff, + s->ybase + glyph->slice.glyphless.upper_yoff, + with_background); + font->driver->draw (s, upper_len, len, + x + glyph->slice.glyphless.lower_xoff, + s->ybase + glyph->slice.glyphless.lower_yoff, + with_background); + SelectObject (s->hdc, old_font); + } + x += glyph->pixel_width; + } +} + + /* Brightness beyond which a color won't have its highlight brightness boosted. @@ -2281,6 +2370,14 @@ x_draw_glyph_string (struct glyph_string *s) x_draw_composite_glyph_string_foreground (s); break; + case GLYPHLESS_GLYPH: + if (s->for_overlaps) + s->background_filled_p = 1; + else + x_draw_glyph_string_background (s, 0); + x_draw_glyphless_glyph_string_foreground (s); + break; + default: abort (); } @@ -3963,6 +4060,7 @@ w32_read_socket (struct terminal *terminal, int expected, W32Msg msg; struct frame *f; struct w32_display_info *dpyinfo = &one_w32_display_info; + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; if (interrupt_input_blocked) { @@ -4063,11 +4161,11 @@ w32_read_socket (struct terminal *terminal, int expected, if (f && !f->iconified) { - if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) - && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) + if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) + && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_hidden = 1; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_hidden = 1; } if (temp_index == sizeof temp_buffer / sizeof (short)) @@ -4088,11 +4186,11 @@ w32_read_socket (struct terminal *terminal, int expected, if (f && !f->iconified) { - if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) - && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) + if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) + && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_hidden = 1; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_hidden = 1; } if (temp_index == sizeof temp_buffer / sizeof (short)) @@ -4166,11 +4264,11 @@ w32_read_socket (struct terminal *terminal, int expected, if (f && !f->iconified) { - if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) - && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) + if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) + && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_hidden = 1; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_hidden = 1; } if (temp_index == sizeof temp_buffer / sizeof (short)) @@ -4204,10 +4302,10 @@ w32_read_socket (struct terminal *terminal, int expected, else f = x_window_to_frame (dpyinfo, msg.msg.hwnd); - if (dpyinfo->mouse_face_hidden) + if (hlinfo->mouse_face_hidden) { - dpyinfo->mouse_face_hidden = 0; - clear_mouse_face (dpyinfo); + hlinfo->mouse_face_hidden = 0; + clear_mouse_face (hlinfo); } if (f) @@ -4219,7 +4317,7 @@ w32_read_socket (struct terminal *terminal, int expected, int x = LOWORD (msg.msg.lParam); int y = HIWORD (msg.msg.lParam); - window = window_from_coordinates (f, x, y, 0, 0, 0, 0); + window = window_from_coordinates (f, x, y, 0, 0); /* Window will be selected only when it is not selected now and last mouse movement event was @@ -4248,7 +4346,7 @@ w32_read_socket (struct terminal *terminal, int expected, { /* If we move outside the frame, then we're certainly no longer on any text in the frame. */ - clear_mouse_face (dpyinfo); + clear_mouse_face (hlinfo); } /* If the contents of the global variable help_echo_string @@ -4298,7 +4396,7 @@ w32_read_socket (struct terminal *terminal, int expected, int x = XFASTINT (inev.x); int y = XFASTINT (inev.y); - window = window_from_coordinates (f, x, y, 0, 0, 0, 1); + window = window_from_coordinates (f, x, y, 0, 1); if (EQ (window, f->tool_bar_window)) { @@ -4537,12 +4635,12 @@ w32_read_socket (struct terminal *terminal, int expected, f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) { - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { /* If we move outside the frame, then we're certainly no longer on any text in the frame. */ - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_mouse_frame = 0; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_mouse_frame = 0; } /* Generate a nil HELP_EVENT to cancel a help-echo. @@ -4572,12 +4670,12 @@ w32_read_socket (struct terminal *terminal, int expected, if (f == dpyinfo->w32_focus_frame) x_new_focus_frame (dpyinfo, 0); - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { /* If we move outside the frame, then we're certainly no longer on any text in the frame. */ - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_mouse_frame = 0; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_mouse_frame = 0; } /* Generate a nil HELP_EVENT to cancel a help-echo. @@ -5725,6 +5823,7 @@ void x_free_frame_resources (struct frame *f) { struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); BLOCK_INPUT; @@ -5763,15 +5862,15 @@ x_free_frame_resources (struct frame *f) if (f == dpyinfo->x_highlight_frame) dpyinfo->x_highlight_frame = 0; - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { - dpyinfo->mouse_face_beg_row - = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row - = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_deferred_gc = 0; - dpyinfo->mouse_face_mouse_frame = 0; + hlinfo->mouse_face_beg_row + = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row + = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_deferred_gc = 0; + hlinfo->mouse_face_mouse_frame = 0; } UNBLOCK_INPUT; @@ -5837,6 +5936,7 @@ void w32_initialize_display_info (Lisp_Object display_name) { struct w32_display_info *dpyinfo = &one_w32_display_info; + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; memset (dpyinfo, 0, sizeof (*dpyinfo)); @@ -5862,12 +5962,12 @@ w32_initialize_display_info (Lisp_Object display_name) dpyinfo->smallest_font_height = 1; dpyinfo->smallest_char_width = 1; - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_overlay = Qnil; - dpyinfo->mouse_face_hidden = 0; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_overlay = Qnil; + hlinfo->mouse_face_hidden = 0; dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW); /* TODO: dpyinfo->gray */ @@ -6336,7 +6436,9 @@ the cursor have no effect. */); doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties. A value of nil means ignore them. If you encounter fonts with bogus UNDERLINE_POSITION font properties, for example 7x13 on XFree prior -to 4.1, set this to nil. */); +to 4.1, set this to nil. You can also use `underline-minimum-offset' +to override the font's UNDERLINE_POSITION for small font display +sizes. */); x_use_underline_position_properties = 0; DEFVAR_BOOL ("x-underline-at-descent-line", @@ -6348,12 +6450,14 @@ baseline level. The default value is nil. */); x_underline_at_descent_line = 0; DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, - doc: /* If not nil, Emacs uses toolkit scroll bars. */); + doc: /* Which toolkit scroll bars Emacs uses, if any. +A value of nil means Emacs doesn't use toolkit scroll bars. +With the X Window system, the value is a symbol describing the +X toolkit. Possible values are: gtk, motif, xaw, or xaw3d. +With MS Windows, the value is t. */); Vx_toolkit_scroll_bars = Qt; staticpro (&last_mouse_motion_frame); last_mouse_motion_frame = Qnil; } -/* arch-tag: 5fa70624-ab86-499c-8a85-473958ee4646 - (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 /* Reusable Graphics Context for drawing a cursor in a non-default face. */ XGCValues *scratch_cursor_gc; - /* These variables describe the range of text currently shown in its - mouse-face, together with the window they apply to. As long as - the mouse stays within this range, we need not redraw anything on - its account. Rows and columns are glyph matrix positions in - MOUSE_FACE_WINDOW. */ - int mouse_face_beg_row, mouse_face_beg_col; - int mouse_face_beg_x, mouse_face_beg_y; - int mouse_face_end_row, mouse_face_end_col; - int mouse_face_end_x, mouse_face_end_y; - int mouse_face_past_end; - Lisp_Object mouse_face_window; - int mouse_face_face_id; - Lisp_Object mouse_face_overlay; - - /* 1 if a mouse motion event came and we didn't handle it right away because - gc was in progress. */ - int mouse_face_deferred_gc; - - /* FRAME and X, Y position of mouse when last checked for - highlighting. X and Y can be negative or out of range for the frame. */ - struct frame *mouse_face_mouse_frame; - int mouse_face_mouse_x, mouse_face_mouse_y; - - /* Nonzero means defer mouse-motion highlighting. */ - int mouse_face_defer; - - /* Nonzero means that the mouse highlight should not be shown. */ - int mouse_face_hidden; - - int mouse_face_image_state; + /* Information about the range of text currently shown in + mouse-face. */ + Mouse_HLInfo mouse_highlight; char *w32_id_name; 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. */) - WINDOW_MODE_LINE_HEIGHT (w) + add_y)); } -/* Test if the character at column *X, row *Y is within window W. +/* Test if the character at column X, row Y is within window W. If it is not, return ON_NOTHING; - if it is in the window's text area, - set *x and *y to its location relative to the upper left corner - of the window, and - return ON_TEXT; + if it is in the window's text area, return ON_TEXT; if it is on the window's modeline, return ON_MODE_LINE; if it is on the border between the window and its right sibling, return ON_VERTICAL_BORDER. - if it is on a scroll bar, - return ON_SCROLL_BAR. + if it is on a scroll bar, return ON_SCROLL_BAR. if it is on the window's top line, return ON_HEADER_LINE; if it is in left or right fringe of the window, - return ON_LEFT_FRINGE or ON_RIGHT_FRINGE, and convert *X and *Y - to window-relative coordinates; + return ON_LEFT_FRINGE or ON_RIGHT_FRINGE; if it is in the marginal area to the left/right of the window, - return ON_LEFT_MARGIN or ON_RIGHT_MARGIN, and convert *X and *Y - to window-relative coordinates. + return ON_LEFT_MARGIN or ON_RIGHT_MARGIN. X and Y are frame relative pixel coordinates. */ static enum window_part -coordinates_in_window (register struct window *w, register int *x, register int *y) +coordinates_in_window (register struct window *w, int x, int y) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - int left_x, right_x, top_y, bottom_y; + int left_x, right_x; enum window_part part; int ux = FRAME_COLUMN_WIDTH (f); int x0 = WINDOW_LEFT_EDGE_X (w); @@ -789,6 +783,12 @@ coordinates_in_window (register struct window *w, register int *x, register int (Between mode lines for instance. */ int grabbable_width = ux; int lmargin_width, rmargin_width, text_left, text_right; + int top_y = WINDOW_TOP_EDGE_Y (w); + int bottom_y = WINDOW_BOTTOM_EDGE_Y (w); + + /* Outside any interesting row? */ + if (y < top_y || y >= bottom_y) + return ON_NOTHING; /* In what's below, we subtract 1 when computing right_x because we 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 { left_x = 0; right_x = WINDOW_TOTAL_WIDTH (w) - 1; - top_y = WINDOW_TOP_EDGE_Y (w); - bottom_y = WINDOW_BOTTOM_EDGE_Y (w); } else { left_x = WINDOW_BOX_LEFT_EDGE_X (w); right_x = WINDOW_BOX_RIGHT_EDGE_X (w) - 1; - top_y = WINDOW_TOP_EDGE_Y (w); - bottom_y = WINDOW_BOTTOM_EDGE_Y (w); } - /* Outside any interesting row? */ - if (*y < top_y || *y >= bottom_y) - return ON_NOTHING; - /* On the mode line or header line? If it's near the start of the mode or header line of window that's has a horizontal 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 scroll bars. */ if (WINDOW_WANTS_MODELINE_P (w) - && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) + && y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) { part = ON_MODE_LINE; @@ -827,60 +819,37 @@ coordinates_in_window (register struct window *w, register int *x, register int between mode lines of horizontally adjacent mode lines as the vertical border. If scroll bars on the left, return the right window. */ - if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) - || WINDOW_RIGHTMOST_P (w)) - { - if (!WINDOW_LEFTMOST_P (w) && eabs (*x - x0) < grabbable_width) - { - /* Convert X and Y to window relative coordinates. - Vertical border is at the left edge of window. */ - *x = max (0, *x - x0); - *y -= top_y; - return ON_VERTICAL_BORDER; - } - } - else - { - /* Make sure we're not at the rightmost position of a - mode-/header-line and there's yet another window on - the right. (Bug#1372) */ - if ((WINDOW_RIGHTMOST_P (w) || *x < x1) - && eabs (*x - x1) < grabbable_width) - { - /* Convert X and Y to window relative coordinates. - Vertical border is at the right edge of window. */ - *x = min (x1, *x) - x0; - *y -= top_y; - return ON_VERTICAL_BORDER; - } - } + if ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) + || WINDOW_RIGHTMOST_P (w)) + && !WINDOW_LEFTMOST_P (w) + && eabs (x - x0) < grabbable_width) + return ON_VERTICAL_BORDER; + + /* Make sure we're not at the rightmost position of a + mode-/header-line and there's yet another window on the + right. (Bug#1372) */ + else if ((WINDOW_RIGHTMOST_P (w) || x < x1) + && eabs (x - x1) < grabbable_width) + return ON_VERTICAL_BORDER; - if (*x < x0 || *x >= x1) + if (x < x0 || x >= x1) return ON_NOTHING; - /* Convert X and Y to window relative coordinates. - Mode line starts at left edge of window. */ - *x -= x0; - *y -= top_y; return part; } if (WINDOW_WANTS_HEADER_LINE_P (w) - && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) + && y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) { part = ON_HEADER_LINE; goto header_vertical_border_check; } - if (*x < x0 || *x >= x1) - return ON_NOTHING; + if (x < x0 || x >= x1) return ON_NOTHING; /* Outside any interesting column? */ - if (*x < left_x || *x > right_x) - { - *y -= top_y; - return ON_SCROLL_BAR; - } + if (x < left_x || x > right_x) + return ON_SCROLL_BAR; lmargin_width = window_box_width (w, LEFT_MARGIN_AREA); 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 if (!w->pseudo_window_p && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w) && !WINDOW_RIGHTMOST_P (w) - && (eabs (*x - right_x) < grabbable_width)) - { - /* Convert X and Y to window relative coordinates. - Vertical border is at the right edge of window. */ - *x = min (right_x, *x) - left_x; - *y -= top_y; - return ON_VERTICAL_BORDER; - } - } - else - { - /* Need to say "*x > right_x" rather than >=, since on character - terminals, the vertical line's x coordinate is right_x. */ - if (!w->pseudo_window_p - && !WINDOW_RIGHTMOST_P (w) - && *x > right_x - ux) - { - /* On the border on the right side of the window? Assume that - this area begins at RIGHT_X minus a canonical char width. */ - *x = min (right_x, *x) - left_x; - *y -= top_y; - return ON_VERTICAL_BORDER; - } + && (eabs (x - right_x) < grabbable_width)) + return ON_VERTICAL_BORDER; } + /* Need to say "x > right_x" rather than >=, since on character + terminals, the vertical line's x coordinate is right_x. */ + else if (!w->pseudo_window_p + && !WINDOW_RIGHTMOST_P (w) + && x > right_x - ux) + return ON_VERTICAL_BORDER; - if (*x < text_left) + if (x < text_left) { if (lmargin_width > 0 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? (*x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w)) - : (*x < left_x + lmargin_width))) - { - *x -= left_x; - if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) - *x -= WINDOW_LEFT_FRINGE_WIDTH (w); - *y -= top_y; - return ON_LEFT_MARGIN; - } + ? (x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w)) + : (x < left_x + lmargin_width))) + return ON_LEFT_MARGIN; - /* Convert X and Y to window-relative pixel coordinates. */ - *x -= left_x; - *y -= top_y; return ON_LEFT_FRINGE; } - if (*x >= text_right) + if (x >= text_right) { if (rmargin_width > 0 && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? (*x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) - : (*x >= right_x - rmargin_width))) - { - *x -= right_x - rmargin_width; - if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) - *x += WINDOW_RIGHT_FRINGE_WIDTH (w); - *y -= top_y; - return ON_RIGHT_MARGIN; - } + ? (x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) + : (x >= right_x - rmargin_width))) + return ON_RIGHT_MARGIN; - /* Convert X and Y to window-relative pixel coordinates. */ - *x -= left_x + WINDOW_LEFT_FRINGE_WIDTH (w); - *y -= top_y; return ON_RIGHT_FRINGE; } /* Everything special ruled out - must be on text area */ - *x -= text_left; - *y -= top_y; return ON_TEXT; } +/* Take X is the frame-relative pixel x-coordinate, and return the + x-coordinate relative to part PART of window W. */ +int +window_relative_x_coord (struct window *w, enum window_part part, int x) +{ + int left_x = (w->pseudo_window_p) ? 0 : WINDOW_BOX_LEFT_EDGE_X (w); + + switch (part) + { + case ON_TEXT: + return x - window_box_left (w, TEXT_AREA); + + case ON_LEFT_FRINGE: + return x - left_x; + + case ON_RIGHT_FRINGE: + return x - left_x - WINDOW_LEFT_FRINGE_WIDTH (w); + + case ON_LEFT_MARGIN: + return (x - left_x + - ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) + ? WINDOW_LEFT_FRINGE_WIDTH (w) : 0)); + + case ON_RIGHT_MARGIN: + return (x + 1 + - ((w->pseudo_window_p) + ? WINDOW_TOTAL_WIDTH (w) + : WINDOW_BOX_RIGHT_EDGE_X (w)) + + window_box_width (w, RIGHT_MARGIN_AREA) + + ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) + ? WINDOW_RIGHT_FRINGE_WIDTH (w) : 0)); + } + + /* ON_SCROLL_BAR, ON_NOTHING, and ON_VERTICAL_BORDER: */ + return 0; +} + DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, 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\ x = FRAME_PIXEL_X_FROM_CANON_X (f, lx) + FRAME_INTERNAL_BORDER_WIDTH (f); y = FRAME_PIXEL_Y_FROM_CANON_Y (f, ly) + FRAME_INTERNAL_BORDER_WIDTH (f); - switch (coordinates_in_window (w, &x, &y)) + switch (coordinates_in_window (w, x, y)) { case ON_NOTHING: return Qnil; case ON_TEXT: - /* X and Y are now window relative pixel coordinates. Convert - them to canonical char units before returning them. */ + /* Convert X and Y to window relative pixel coordinates, and + return the canonical char units. */ + x -= window_box_left (w, TEXT_AREA); + y -= WINDOW_TOP_EDGE_Y (w); return Fcons (FRAME_CANON_X_FROM_PIXEL_X (f, x), FRAME_CANON_Y_FROM_PIXEL_Y (f, y)); @@ -1054,7 +1027,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ struct check_window_data { Lisp_Object *window; - int *x, *y; + int x, y; enum window_part *part; }; @@ -1081,8 +1054,7 @@ check_window_containing (struct window *w, void *user_data) return it as a Lisp_Object. If X, Y is on one of the window's special `window_part' elements, - set *PART to the id of that element, and return X and Y converted - to window relative coordinates in WX and WY. + set *PART to the id of that element. If there is no window under X, Y return nil and leave *PART unmodified. TOOL_BAR_P non-zero means detect tool-bar windows. @@ -1097,7 +1069,8 @@ check_window_containing (struct window *w, void *user_data) case. */ Lisp_Object -window_from_coordinates (struct frame *f, int x, int y, enum window_part *part, int *wx, int *wy, int tool_bar_p) +window_from_coordinates (struct frame *f, int x, int y, + enum window_part *part, int tool_bar_p) { Lisp_Object window; struct check_window_data cw; @@ -1107,7 +1080,7 @@ window_from_coordinates (struct frame *f, int x, int y, enum window_part *part, part = &dummy; window = Qnil; - cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part; + cw.window = &window, cw.x = x, cw.y = y; cw.part = part; foreach_window (f, check_window_containing, &cw); /* 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, && tool_bar_p && WINDOWP (f->tool_bar_window) && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0 - && (coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y) + && (coordinates_in_window (XWINDOW (f->tool_bar_window), x, y) != ON_NOTHING)) { *part = ON_TEXT; window = f->tool_bar_window; } - if (wx) *wx = x; - if (wy) *wy = y; - return window; } @@ -1152,7 +1122,7 @@ column 0. */) + FRAME_INTERNAL_BORDER_WIDTH (f)), (FRAME_PIXEL_Y_FROM_CANON_Y (f, y) + FRAME_INTERNAL_BORDER_WIDTH (f)), - 0, 0, 0, 0); + 0, 0); } DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, @@ -2420,6 +2390,16 @@ check_all_windows (void) window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); } +DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, + doc: /* Return WINDOW's use time. +WINDOW defaults to the selected window. The window with the highest use +time is the most recently selected one. The window with the lowest use +time is the least recently selected one. */) + (Lisp_Object window) +{ + return decode_window (window)->use_time; +} + DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0, doc: /* Return the window least recently selected or used for display. \(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); extern Lisp_Object make_window (void); extern void delete_window (Lisp_Object); extern Lisp_Object window_from_coordinates (struct frame *, int, int, - enum window_part *, - int *, int*, int); + enum window_part *, int); EXFUN (Fwindow_dedicated_p, 1); extern int window_height (Lisp_Object); extern int window_width (Lisp_Object); @@ -804,6 +803,7 @@ extern void foreach_window (struct frame *, void *); extern void grow_mini_window (struct window *, int); extern void shrink_mini_window (struct window *); +extern int window_relative_x_coord (struct window *, enum window_part, int); void run_window_configuration_change_hook (struct frame *f); 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 @@ /* Display generation from window structure and buffer text. - Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, - 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1997, 1998, + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, + 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -214,11 +214,41 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ leftmost character with special glyphs, which will display as, well, empty. On text terminals, these special glyphs are simply blank characters. On graphics terminals, there's a single stretch - glyph with suitably computed width. Both the blanks and the + glyph of a suitably computed width. Both the blanks and the stretch glyph are given the face of the background of the line. This way, the terminal-specific back-end can still draw the glyphs left to right, even for R2L lines. + Bidirectional display and character compositions + + Some scripts cannot be displayed by drawing each character + individually, because adjacent characters change each other's shape + on display. For example, Arabic and Indic scripts belong to this + category. + + Emacs display supports this by providing "character compositions", + most of which is implemented in composite.c. During the buffer + scan that delivers characters to PRODUCE_GLYPHS, if the next + character to be delivered is a composed character, the iteration + calls composition_reseat_it and next_element_from_composition. If + they succeed to compose the character with one or more of the + following characters, the whole sequence of characters that where + composed is recorded in the `struct composition_it' object that is + part of the buffer iterator. The composed sequence could produce + one or more font glyphs (called "grapheme clusters") on the screen. + Each of these grapheme clusters is then delivered to PRODUCE_GLYPHS + in the direction corresponding to the current bidi scan direction + (recorded in the scan_dir member of the `struct bidi_it' object + that is part of the buffer iterator). In particular, if the bidi + iterator currently scans the buffer backwards, the grapheme + clusters are delivered back to front. This reorders the grapheme + clusters as appropriate for the current bidi context. Note that + this means that the grapheme clusters are always stored in the + LGSTRING object (see composite.c) in the logical order. + + Moving an iterator in bidirectional text + without producing glyphs + Note one important detail mentioned above: that the bidi reordering engine, driven by the iterator, produces characters in R2L rows starting at the character that will be the rightmost on display. @@ -888,6 +918,9 @@ static int clear_face_cache_count; #ifdef HAVE_WINDOW_SYSTEM #define CLEAR_IMAGE_CACHE_COUNT 101 static int clear_image_cache_count; + +/* Null glyph slice */ +static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 }; #endif /* Non-zero while redisplay_internal is in progress. */ @@ -913,10 +946,6 @@ EMACS_INT help_echo_pos; Lisp_Object previous_help_echo_string; -/* Null glyph slice */ - -static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 }; - /* Platform-independent portion of hourglass implementation. */ /* Non-zero means we're allowed to display a hourglass pointer. */ @@ -932,6 +961,21 @@ struct atimer *hourglass_atimer; /* Number of seconds to wait before displaying an hourglass cursor. */ Lisp_Object Vhourglass_delay; +/* Name of the face used to display glyphless characters. */ +Lisp_Object Qglyphless_char; + +/* Char-table to control the display of glyphless characters. */ +Lisp_Object Vglyphless_char_display; + +/* Symbol for the purpose of Vglyphless_char_display. */ +Lisp_Object Qglyphless_char_display; + +/* Method symbols for Vglyphless_char_display. */ +static Lisp_Object Qhex_code, Qempty_box, Qthin_space, Qzero_width; + +/* Default pixel width of `thin-space' display method. */ +#define THIN_SPACE_WIDTH 1 + /* Default number of seconds to wait before displaying an hourglass cursor. */ #define DEFAULT_HOURGLASS_DELAY 1 @@ -960,10 +1004,8 @@ static int text_outside_line_unchanged_p (struct window *, EMACS_INT, EMACS_INT); static void store_mode_line_noprop_char (char); static int store_mode_line_noprop (const unsigned char *, int, int); -static void x_consider_frame_title (Lisp_Object); static void handle_stop (struct it *); static void handle_stop_backwards (struct it *, EMACS_INT); -static int tool_bar_lines_needed (struct frame *, int *); static int single_display_spec_intangible_p (Lisp_Object); static void ensure_echo_area_buffers (void); static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object); @@ -1076,6 +1118,8 @@ static int in_ellipses_for_invisible_text_p (struct display_pos *, #ifdef HAVE_WINDOW_SYSTEM +static void x_consider_frame_title (Lisp_Object); +static int tool_bar_lines_needed (struct frame *, int *); static void update_tool_bar (struct frame *, int); static void build_desired_tool_bar_string (struct frame *f); static int redisplay_tool_bar (struct frame *); @@ -1087,9 +1131,11 @@ static void append_stretch_glyph (struct it *, Lisp_Object, int, int, int); - #endif /* HAVE_WINDOW_SYSTEM */ +static int coords_in_mouse_face_p (struct window *, int, int); + + /*********************************************************************** Window display dimensions @@ -1781,8 +1827,6 @@ glyph_to_pixel_coords (struct window *w, int hpos, int vpos, } -#ifdef HAVE_WINDOW_SYSTEM - /* Find the glyph under window-relative coordinates X/Y in window W. Consider only glyphs from buffer text, i.e. no glyphs from overlay 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, return glyph; } - /* EXPORT: Convert frame-relative x/y to coordinates relative to window W. Takes pseudo-windows into account. */ @@ -1888,6 +1931,8 @@ frame_to_window_pixel_xy (struct window *w, int *x, int *y) } } +#ifdef HAVE_WINDOW_SYSTEM + /* EXPORT: Return in RECTS[] at most N clipping rectangles for glyph string S. Return the number of stored rectangles. */ @@ -2173,7 +2218,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) frame pixel coordinates X/Y on frame F. */ if (!f->glyphs_initialized_p - || (window = window_from_coordinates (f, gx, gy, &part, &x, &y, 0), + || (window = window_from_coordinates (f, gx, gy, &part, 0), NILP (window))) { width = FRAME_SMALLEST_CHAR_WIDTH (f); @@ -2185,6 +2230,9 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) width = WINDOW_FRAME_COLUMN_WIDTH (w); height = WINDOW_FRAME_LINE_HEIGHT (w); + x = window_relative_x_coord (w, part, gx); + y = gy - WINDOW_TOP_EDGE_Y (w); + r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); @@ -5731,6 +5779,57 @@ static int (* get_next_element[NUM_IT_METHODS]) (struct it *it) = (IT)->string))) +/* Lookup the char-table Vglyphless_char_display for character C (-1 + if we want information for no-font case), and return the display + method symbol. By side-effect, update it->what and + it->glyphless_method. This function is called from + get_next_display_element for each character element, and from + x_produce_glyphs when no suitable font was found. */ + +Lisp_Object +lookup_glyphless_char_display (int c, struct it *it) +{ + Lisp_Object glyphless_method = Qnil; + + if (CHAR_TABLE_P (Vglyphless_char_display) + && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= 1) + glyphless_method = (c >= 0 + ? CHAR_TABLE_REF (Vglyphless_char_display, c) + : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); + retry: + if (NILP (glyphless_method)) + { + if (c >= 0) + /* The default is to display the character by a proper font. */ + return Qnil; + /* The default for the no-font case is to display an empty box. */ + glyphless_method = Qempty_box; + } + if (EQ (glyphless_method, Qzero_width)) + { + if (c >= 0) + return glyphless_method; + /* This method can't be used for the no-font case. */ + glyphless_method = Qempty_box; + } + if (EQ (glyphless_method, Qthin_space)) + it->glyphless_method = GLYPHLESS_DISPLAY_THIN_SPACE; + else if (EQ (glyphless_method, Qempty_box)) + it->glyphless_method = GLYPHLESS_DISPLAY_EMPTY_BOX; + else if (EQ (glyphless_method, Qhex_code)) + it->glyphless_method = GLYPHLESS_DISPLAY_HEX_CODE; + else if (STRINGP (glyphless_method)) + it->glyphless_method = GLYPHLESS_DISPLAY_ACRONYM; + else + { + /* Invalid value. We use the default method. */ + glyphless_method = Qnil; + goto retry; + } + it->what = IT_GLYPHLESS; + return glyphless_method; +} + /* Load IT's display element fields with information about the next display element from the current position of IT. Value is zero if end of buffer (or C string) is reached. */ @@ -5739,6 +5838,10 @@ static struct frame *last_escape_glyph_frame = NULL; static unsigned last_escape_glyph_face_id = (1 << FACE_ID_BITS); static int last_escape_glyph_merged_face_id = 0; +struct frame *last_glyphless_glyph_frame = NULL; +unsigned last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); +int last_glyphless_glyph_merged_face_id = 0; + int get_next_display_element (struct it *it) { @@ -5817,6 +5920,15 @@ get_next_display_element (struct it *it) goto get_next; } + if (! NILP (lookup_glyphless_char_display (c, it))) + { + if (it->what == IT_GLYPHLESS) + goto done; + /* Don't display this character. */ + set_iterator_to_next (it, 0); + goto get_next; + } + if (! ASCII_CHAR_P (c) && ! NILP (Vnobreak_char_display)) nbsp_or_shy = (c == 0xA0 ? char_is_nbsp : c == 0xAD ? char_is_soft_hyphen @@ -6031,6 +6143,7 @@ get_next_display_element (struct it *it) } #endif + done: /* Is this character the last one of a run of characters with box? If yes, set IT->end_of_box_run_p to 1. */ if (it->face_box_p @@ -9271,6 +9384,8 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); current_buffer->truncate_lines = message_truncate_lines ? Qt : Qnil; + if (!NILP (current_buffer->bidi_display_reordering)) + current_buffer->bidi_paragraph_direction = Qleft_to_right; /* Insert new message at BEG. */ TEMP_SET_PT_BOTH (BEG, BEG_BYTE); @@ -10737,7 +10852,7 @@ static int get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, int *hpos, int *vpos, int *prop_idx) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); struct window *w = XWINDOW (f->tool_bar_window); int area; @@ -10752,14 +10867,14 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, return -1; /* Is mouse on the highlighted item? */ - if (EQ (f->tool_bar_window, dpyinfo->mouse_face_window) - && *vpos >= dpyinfo->mouse_face_beg_row - && *vpos <= dpyinfo->mouse_face_end_row - && (*vpos > dpyinfo->mouse_face_beg_row - || *hpos >= dpyinfo->mouse_face_beg_col) - && (*vpos < dpyinfo->mouse_face_end_row - || *hpos < dpyinfo->mouse_face_end_col - || dpyinfo->mouse_face_past_end)) + if (EQ (f->tool_bar_window, hlinfo->mouse_face_window) + && *vpos >= hlinfo->mouse_face_beg_row + && *vpos <= hlinfo->mouse_face_end_row + && (*vpos > hlinfo->mouse_face_beg_row + || *hpos >= hlinfo->mouse_face_beg_col) + && (*vpos < hlinfo->mouse_face_end_row + || *hpos < hlinfo->mouse_face_end_col + || hlinfo->mouse_face_past_end)) return 0; return 1; @@ -10776,7 +10891,7 @@ void handle_tool_bar_click (struct frame *f, int x, int y, int down_p, unsigned int modifiers) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); struct window *w = XWINDOW (f->tool_bar_window); int hpos, vpos, prop_idx; struct glyph *glyph; @@ -10795,8 +10910,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, if (down_p) { /* Show item in pressed state. */ - show_mouse_face (dpyinfo, DRAW_IMAGE_SUNKEN); - dpyinfo->mouse_face_image_state = DRAW_IMAGE_SUNKEN; + show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN); + hlinfo->mouse_face_image_state = DRAW_IMAGE_SUNKEN; last_tool_bar_item = prop_idx; } else @@ -10806,8 +10921,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, EVENT_INIT (event); /* Show item in released state. */ - show_mouse_face (dpyinfo, DRAW_IMAGE_RAISED); - dpyinfo->mouse_face_image_state = DRAW_IMAGE_RAISED; + show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); + hlinfo->mouse_face_image_state = DRAW_IMAGE_RAISED; key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); @@ -10837,6 +10952,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) Lisp_Object window = f->tool_bar_window; struct window *w = XWINDOW (window); Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); int hpos, vpos; struct glyph *glyph; struct glyph_row *row; @@ -10850,7 +10966,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) values when mouse moves outside of the frame. */ if (x <= 0 || y <= 0) { - clear_mouse_face (dpyinfo); + clear_mouse_face (hlinfo); return; } @@ -10858,14 +10974,14 @@ note_tool_bar_highlight (struct frame *f, int x, int y) if (rc < 0) { /* Not on tool-bar item. */ - clear_mouse_face (dpyinfo); + clear_mouse_face (hlinfo); return; } else if (rc == 0) /* On same tool-bar item as before. */ goto set_help_echo; - clear_mouse_face (dpyinfo); + clear_mouse_face (hlinfo); /* Mouse is down, but on different tool-bar item? */ mouse_down_p = (dpyinfo->grabbed @@ -10875,7 +10991,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) && last_tool_bar_item != prop_idx) return; - dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT; + hlinfo->mouse_face_image_state = DRAW_NORMAL_TEXT; draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; /* 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) x += row->glyphs[TEXT_AREA][i].pixel_width; /* Record this as the current active region. */ - dpyinfo->mouse_face_beg_col = hpos; - dpyinfo->mouse_face_beg_row = vpos; - dpyinfo->mouse_face_beg_x = x; - dpyinfo->mouse_face_beg_y = row->y; - dpyinfo->mouse_face_past_end = 0; + hlinfo->mouse_face_beg_col = hpos; + hlinfo->mouse_face_beg_row = vpos; + hlinfo->mouse_face_beg_x = x; + hlinfo->mouse_face_beg_y = row->y; + hlinfo->mouse_face_past_end = 0; - dpyinfo->mouse_face_end_col = hpos + 1; - dpyinfo->mouse_face_end_row = vpos; - dpyinfo->mouse_face_end_x = x + glyph->pixel_width; - dpyinfo->mouse_face_end_y = row->y; - dpyinfo->mouse_face_window = window; - dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; + hlinfo->mouse_face_end_col = hpos + 1; + hlinfo->mouse_face_end_row = vpos; + hlinfo->mouse_face_end_x = x + glyph->pixel_width; + hlinfo->mouse_face_end_y = row->y; + hlinfo->mouse_face_window = window; + hlinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; /* Display it as active. */ - show_mouse_face (dpyinfo, draw); - dpyinfo->mouse_face_image_state = draw; + show_mouse_face (hlinfo, draw); + hlinfo->mouse_face_image_state = draw; } set_help_echo: @@ -11578,6 +11694,8 @@ redisplay_internal (int preserve_echo_area) reconsider_clip_changes (w, current_buffer); last_escape_glyph_frame = NULL; last_escape_glyph_face_id = (1 << FACE_ID_BITS); + last_glyphless_glyph_frame = NULL; + last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); /* If new fonts have been loaded that make a glyph matrix adjustment necessary, do it. */ @@ -12723,6 +12841,15 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, && BUFFERP (glyph->object) && glyph->charpos == pt_old) && bpos_covered < pt_old) { + /* An empty line has a single glyph whose OBJECT is zero and + whose CHARPOS is the position of a newline on that line. + Note that on a TTY, there are more glyphs after that, which + were produced by extend_face_to_end_of_line, but their + CHARPOS is zero or negative. */ + int empty_line_p = + (row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end) + && INTEGERP (glyph->object) && glyph->charpos > 0; + if (row->ends_in_ellipsis_p && pos_after == last_pos) { EMACS_INT ellipsis_pos; @@ -12758,10 +12885,11 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, || (row->truncated_on_left_p && pt_old < bpos_min) || (row->truncated_on_right_p && pt_old > bpos_max) /* Zero-width characters produce no glyphs. */ - || ((row->reversed_p - ? glyph_after > glyphs_end - : glyph_after < glyphs_end) - && eabs (glyph_after - glyph_before) == 1)) + || (!string_seen + && !empty_line_p + && (row->reversed_p + ? glyph_after > glyphs_end + : glyph_after < glyphs_end))) { cursor = glyph_after; x = -1; @@ -12815,8 +12943,9 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, cursor on that character's glyph. */ EMACS_INT strpos = glyph->charpos; - cursor = glyph; - for (glyph += incr; + if (tem) + cursor = glyph; + for ( ; (row->reversed_p ? glyph > stop : glyph < stop) && EQ (glyph->object, str); glyph += incr) @@ -12832,7 +12961,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, cursor = glyph; break; } - if (glyph->charpos < strpos) + if (tem && glyph->charpos < strpos) { strpos = glyph->charpos; cursor = glyph; @@ -12847,10 +12976,9 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, } /* This string is not what we want; skip all of the glyphs that came from it. */ - do - glyph += incr; while ((row->reversed_p ? glyph > stop : glyph < stop) - && EQ (glyph->object, str)); + && EQ (glyph->object, str)) + glyph += incr; } else glyph += incr; @@ -15333,10 +15461,12 @@ row_containing_pos (struct window *w, EMACS_INT charpos, { struct glyph *g; - if (NILP (XBUFFER (w->buffer)->bidi_display_reordering)) + if (NILP (XBUFFER (w->buffer)->bidi_display_reordering) + || (!best_row && !row->continued_p)) return row; /* In bidi-reordered rows, there could be several rows - occluding point. We need to find the one which fits + occluding point, all of them belonging to the same + continued line. We need to find the row which fits CHARPOS the best. */ for (g = row->glyphs[TEXT_AREA]; g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]; @@ -15348,11 +15478,14 @@ row_containing_pos (struct window *w, EMACS_INT charpos, { mindif = eabs (g->charpos - charpos); best_row = row; + /* Exact match always wins. */ + if (mindif == 0) + return best_row; } } } } - else if (best_row) + else if (best_row && !row->continued_p) return best_row; ++row; } @@ -15897,6 +16030,9 @@ try_window_id (struct window *w) + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) + window_internal_height (w)); +#if defined (HAVE_GPM) || defined (MSDOS) + x_clear_window_mouse_face (w); +#endif /* Perform the operation on the screen. */ if (dvpos > 0) { @@ -20651,6 +20787,42 @@ fill_gstring_glyph_string (struct glyph_string *s, int face_id, } +/* Fill glyph string S from a sequence glyphs for glyphless characters. + See the comment of fill_glyph_string for arguments. + Value is the index of the first glyph not in S. */ + + +static int +fill_glyphless_glyph_string (struct glyph_string *s, int face_id, + int start, int end, int overlaps) +{ + struct glyph *glyph, *last; + int voffset; + + xassert (s->first_glyph->type == GLYPHLESS_GLYPH); + s->for_overlaps = overlaps; + glyph = s->row->glyphs[s->area] + start; + last = s->row->glyphs[s->area] + end; + voffset = glyph->voffset; + s->face = FACE_FROM_ID (s->f, face_id); + s->font = s->face->font; + s->nchars = 1; + s->width = glyph->pixel_width; + glyph++; + while (glyph < last + && glyph->type == GLYPHLESS_GLYPH + && glyph->voffset == voffset + && glyph->face_id == face_id) + { + s->nchars++; + s->width += glyph->pixel_width; + glyph++; + } + s->ybase += voffset; + return glyph - s->row->glyphs[s->area]; +} + + /* Fill glyph string S from a sequence of character glyphs. 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) } while (0) +/* Add a glyph string for a sequence of glyphless character's glyphs + to the list of strings between HEAD and TAIL. The meanings of + arguments are the same as those of BUILD_CHAR_GLYPH_STRINGS. */ + +#define BUILD_GLYPHLESS_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \ + do \ + { \ + int face_id; \ + XChar2b *char2b; \ + \ + face_id = (row)->glyphs[area][START].face_id; \ + \ + s = (struct glyph_string *) alloca (sizeof *s); \ + INIT_GLYPH_STRING (s, NULL, w, row, area, START, HL); \ + append_glyph_string (&HEAD, &TAIL, s); \ + s->x = (X); \ + START = fill_glyphless_glyph_string (s, face_id, START, END, \ + overlaps); \ + } \ + while (0) + + /* Build a list of glyph strings between HEAD and TAIL for the glyphs of AREA of glyph row ROW on window W between indices START and END. 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) BUILD_CHAR_GLYPH_STRINGS (START, END, HEAD, TAIL, \ HL, X, LAST_X); \ break; \ - \ + \ case COMPOSITE_GLYPH: \ if (first_glyph->u.cmp.automatic) \ 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) BUILD_COMPOSITE_GLYPH_STRING (START, END, HEAD, TAIL, \ HL, X, LAST_X); \ break; \ - \ + \ case STRETCH_GLYPH: \ BUILD_STRETCH_GLYPH_STRING (START, END, HEAD, TAIL, \ HL, X, LAST_X); \ break; \ - \ + \ case IMAGE_GLYPH: \ BUILD_IMAGE_GLYPH_STRING (START, END, HEAD, TAIL, \ HL, X, LAST_X); \ break; \ - \ + \ + case GLYPHLESS_GLYPH: \ + BUILD_GLYPHLESS_GLYPH_STRING (START, END, HEAD, TAIL, \ + HL, X, LAST_X); \ + break; \ + \ default: \ abort (); \ } \ - \ + \ if (s) \ { \ set_glyph_string_background_width (s, START, LAST_X); \ @@ -21291,7 +21490,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row, if (head && !overlaps && row->contains_overlapping_glyphs_p) { struct glyph_string *h, *t; - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); int mouse_beg_col, mouse_end_col, check_mouse_face = 0; int dummy_x = 0; @@ -21301,16 +21500,16 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row, { struct glyph_row *mouse_beg_row, *mouse_end_row; - mouse_beg_row = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); - mouse_end_row = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); + mouse_beg_row = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row); + mouse_end_row = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_end_row); if (row >= mouse_beg_row && row <= mouse_end_row) { check_mouse_face = 1; mouse_beg_col = (row == mouse_beg_row) - ? dpyinfo->mouse_face_beg_col : 0; + ? hlinfo->mouse_face_beg_col : 0; mouse_end_col = (row == mouse_end_row) - ? dpyinfo->mouse_face_end_col + ? hlinfo->mouse_face_end_col : row->used[TEXT_AREA]; } } @@ -22103,6 +22302,229 @@ calc_line_height_property (struct it *it, Lisp_Object val, struct font *font, } +/* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID + is a face ID to be used for the glyph. FOR_NO_FONT is nonzero if + and only if this is for a character for which no font was found. + + If the display method (it->glyphless_method) is + GLYPHLESS_DISPLAY_ACRONYM or GLYPHLESS_DISPLAY_HEX_CODE, LEN is a + length of the acronym or the hexadecimal string, UPPER_XOFF and + UPPER_YOFF are pixel offsets for the upper part of the string, + LOWER_XOFF and LOWER_YOFF are for the lower part. + + For the other display methods, LEN through LOWER_YOFF are zero. */ + +static void +append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len, + short upper_xoff, short upper_yoff, + short lower_xoff, short lower_yoff) +{ + struct glyph *glyph; + enum glyph_row_area area = it->area; + + glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; + if (glyph < it->glyph_row->glyphs[area + 1]) + { + /* If the glyph row is reversed, we need to prepend the glyph + rather than append it. */ + if (it->glyph_row->reversed_p && area == TEXT_AREA) + { + struct glyph *g; + + /* Make room for the additional glyph. */ + for (g = glyph - 1; g >= it->glyph_row->glyphs[area]; g--) + g[1] = *g; + glyph = it->glyph_row->glyphs[area]; + } + glyph->charpos = CHARPOS (it->position); + glyph->object = it->object; + glyph->pixel_width = it->pixel_width; + glyph->ascent = it->ascent; + glyph->descent = it->descent; + glyph->voffset = it->voffset; + glyph->type = GLYPHLESS_GLYPH; + glyph->u.glyphless.method = it->glyphless_method; + glyph->u.glyphless.for_no_font = for_no_font; + glyph->u.glyphless.len = len; + glyph->u.glyphless.ch = it->c; + glyph->slice.glyphless.upper_xoff = upper_xoff; + glyph->slice.glyphless.upper_yoff = upper_yoff; + glyph->slice.glyphless.lower_xoff = lower_xoff; + glyph->slice.glyphless.lower_yoff = lower_yoff; + glyph->avoid_cursor_p = it->avoid_cursor_p; + glyph->multibyte_p = it->multibyte_p; + glyph->left_box_line_p = it->start_of_box_run_p; + glyph->right_box_line_p = it->end_of_box_run_p; + glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent + || it->phys_descent > it->descent); + glyph->padding_p = 0; + glyph->glyph_not_available_p = 0; + glyph->face_id = face_id; + glyph->font_type = FONT_TYPE_UNKNOWN; + if (it->bidi_p) + { + glyph->resolved_level = it->bidi_it.resolved_level; + if ((it->bidi_it.type & 7) != it->bidi_it.type) + abort (); + glyph->bidi_type = it->bidi_it.type; + } + ++it->glyph_row->used[area]; + } + else + IT_EXPAND_MATRIX_WIDTH (it, area); +} + + +/* Produce a glyph for a glyphless character for iterator IT. + IT->glyphless_method specifies which method to use for displaying + the character. See the description of enum + glyphless_display_method in dispextern.h for the detail. + + FOR_NO_FONT is nonzero if and only if this is for a character for + which no font was found. ACRONYM, if non-nil, is an acronym string + for the character. */ + +static void +produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) +{ + int face_id; + struct face *face; + struct font *font; + int base_width, base_height, width, height; + short upper_xoff, upper_yoff, lower_xoff, lower_yoff; + int len; + + /* Get the metrics of the base font. We always refer to the current + ASCII face. */ + face = FACE_FROM_ID (it->f, it->face_id)->ascii_face; + font = face->font ? face->font : FRAME_FONT (it->f); + it->ascent = FONT_BASE (font) + font->baseline_offset; + it->descent = FONT_DESCENT (font) - font->baseline_offset; + base_height = it->ascent + it->descent; + base_width = font->average_width; + + /* Get a face ID for the glyph by utilizing a cache (the same way as + doen for `escape-glyph' in get_next_display_element). */ + if (it->f == last_glyphless_glyph_frame + && it->face_id == last_glyphless_glyph_face_id) + { + face_id = last_glyphless_glyph_merged_face_id; + } + else + { + /* Merge the `glyphless-char' face into the current face. */ + face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id); + last_glyphless_glyph_frame = it->f; + last_glyphless_glyph_face_id = it->face_id; + last_glyphless_glyph_merged_face_id = face_id; + } + + if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) + { + it->pixel_width = THIN_SPACE_WIDTH; + len = 0; + upper_xoff = upper_yoff = lower_xoff = lower_yoff = 0; + } + else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX) + { + width = CHAR_WIDTH (it->c); + if (width == 0) + width = 1; + else if (width > 4) + width = 4; + it->pixel_width = base_width * width; + len = 0; + upper_xoff = upper_yoff = lower_xoff = lower_yoff = 0; + } + else + { + char buf[7], *str; + unsigned int code[6]; + int upper_len; + int ascent, descent; + struct font_metrics metrics_upper, metrics_lower; + + face = FACE_FROM_ID (it->f, face_id); + font = face->font ? face->font : FRAME_FONT (it->f); + PREPARE_FACE_FOR_DISPLAY (it->f, face); + + if (it->glyphless_method == GLYPHLESS_DISPLAY_ACRONYM) + { + if (! STRINGP (acronym) && CHAR_TABLE_P (Vglyphless_char_display)) + acronym = CHAR_TABLE_REF (Vglyphless_char_display, it->c); + str = STRINGP (acronym) ? (char *) SDATA (acronym) : ""; + } + else + { + xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE); + sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c); + str = buf; + } + for (len = 0; str[len] && ASCII_BYTE_P (str[len]); len++) + code[len] = font->driver->encode_char (font, str[len]); + upper_len = (len + 1) / 2; + font->driver->text_extents (font, code, upper_len, + &metrics_upper); + font->driver->text_extents (font, code + upper_len, len - upper_len, + &metrics_lower); + + + + /* +4 is for vertical bars of a box plus 1-pixel spaces at both side. */ + width = max (metrics_upper.width, metrics_lower.width) + 4; + upper_xoff = upper_yoff = 2; /* the typical case */ + if (base_width >= width) + { + /* Align the upper to the left, the lower to the right. */ + it->pixel_width = base_width; + lower_xoff = base_width - 2 - metrics_lower.width; + } + else + { + /* Center the shorter one. */ + it->pixel_width = width; + if (metrics_upper.width >= metrics_lower.width) + lower_xoff = (width - metrics_lower.width) / 2; + else + upper_xoff = (width - metrics_upper.width) / 2; + } + + /* +5 is for horizontal bars of a box plus 1-pixel spaces at + top, bottom, and between upper and lower strings. */ + height = (metrics_upper.ascent + metrics_upper.descent + + metrics_lower.ascent + metrics_lower.descent) + 5; + /* Center vertically. + H:base_height, D:base_descent + h:height, ld:lower_descent, la:lower_ascent, ud:upper_descent + + ascent = - (D - H/2 - h/2 + 1); "+ 1" for rounding up + descent = D - H/2 + h/2; + lower_yoff = descent - 2 - ld; + upper_yoff = lower_yoff - la - 1 - ud; */ + ascent = - (it->descent - (base_height + height + 1) / 2); + descent = it->descent - (base_height - height) / 2; + lower_yoff = descent - 2 - metrics_lower.descent; + upper_yoff = (lower_yoff - metrics_lower.ascent - 1 + - metrics_upper.descent); + /* Don't make the height shorter than the base height. */ + if (height > base_height) + { + it->ascent = ascent; + it->descent = descent; + } + } + + it->phys_ascent = it->ascent; + it->phys_descent = it->descent; + if (it->glyph_row) + append_glyphless_glyph (it, face_id, for_no_font, len, + upper_xoff, upper_yoff, + lower_xoff, lower_yoff); + it->nglyphs = 1; + take_vertical_position_into_account (it); +} + + /* RIF: Produce glyphs/get display metrics for the display element IT is loaded with. See the description of struct it in dispextern.h @@ -22120,29 +22542,25 @@ x_produce_glyphs (struct it *it) XChar2b char2b; struct face *face = FACE_FROM_ID (it->f, it->face_id); struct font *font = face->font; - int font_not_found_p = font == NULL; struct font_metrics *pcm = NULL; int boff; /* baseline offset */ - if (font_not_found_p) - { - /* When no suitable font found, display an empty box based - on the metrics of the font of the default face (or what - remapped). */ - struct face *no_font_face - = FACE_FROM_ID (it->f, - NILP (Vface_remapping_alist) ? DEFAULT_FACE_ID - : lookup_basic_face (it->f, DEFAULT_FACE_ID)); - font = no_font_face->font; - boff = font->baseline_offset; - } - else + if (font == NULL) { - boff = font->baseline_offset; - if (font->vertical_centering) - boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; + /* When no suitable font is found, display this character by + the method specified in the first extra slot of + Vglyphless_char_display. */ + Lisp_Object acronym = lookup_glyphless_char_display (-1, it); + + xassert (it->what == IT_GLYPHLESS); + produce_glyphless_glyph (it, 1, STRINGP (acronym) ? acronym : Qnil); + goto done; } + boff = font->baseline_offset; + if (font->vertical_centering) + boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; + if (it->char_to_display != '\n' && it->char_to_display != '\t') { int stretched_p; @@ -22161,8 +22579,7 @@ x_produce_glyphs (struct it *it) it->descent = FONT_DESCENT (font) - boff; } - if (! font_not_found_p - && get_char_glyph_code (it->char_to_display, font, &char2b)) + if (get_char_glyph_code (it->char_to_display, font, &char2b)) { pcm = get_per_char_metric (it->f, font, &char2b); if (pcm->width == 0 @@ -22752,11 +23169,14 @@ x_produce_glyphs (struct it *it) if (it->glyph_row) append_composite_glyph (it); } + else if (it->what == IT_GLYPHLESS) + produce_glyphless_glyph (it, 0, Qnil); else if (it->what == IT_IMAGE) produce_image_glyph (it); else if (it->what == IT_STRETCH) produce_stretch_glyph (it); + done: /* Accumulate dimensions. Note: can't assume that it->descent > 0 because this isn't true for images with `:ascent 100'. */ xassert (it->ascent >= 0 && it->descent >= 0); @@ -23028,6 +23448,8 @@ set_frame_cursor_types (struct frame *f, Lisp_Object arg) } +#ifdef HAVE_WINDOW_SYSTEM + /* Return the cursor we want to be displayed in window W. Return width of bar/hbar cursor through WIDTH arg. Return with 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, /* Detect a nonselected window or nonselected frame. */ else if (w != XWINDOW (f->selected_window) -#ifdef HAVE_WINDOW_SYSTEM - || f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame -#endif - ) + || f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame) { *active_cursor = 0; @@ -23117,7 +23536,6 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, /* Use normal cursor if not blinked off. */ if (!w->cursor_off_p) { -#ifdef HAVE_WINDOW_SYSTEM if (glyph != NULL && glyph->type == IMAGE_GLYPH) { if (cursor_type == FILLED_BOX_CURSOR) @@ -23145,7 +23563,6 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, cursor_type = HOLLOW_BOX_CURSOR; } } -#endif return cursor_type; } @@ -23187,8 +23604,6 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, } -#ifdef HAVE_WINDOW_SYSTEM - /* Notice when the text cursor of window W has been completely overwritten by a drawing operation that outputs glyphs in AREA starting at X0 and ending at X1 in the line starting at Y0 and @@ -23354,7 +23769,7 @@ void erase_phys_cursor (struct window *w) { struct frame *f = XFRAME (w->frame); - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); int hpos = w->phys_cursor.hpos; int vpos = w->phys_cursor.vpos; int mouse_face_here_p = 0; @@ -23410,14 +23825,8 @@ erase_phys_cursor (struct window *w) /* If the cursor is in the mouse face area, redisplay that when we clear the cursor. */ - if (! NILP (dpyinfo->mouse_face_window) - && w == XWINDOW (dpyinfo->mouse_face_window) - && (vpos > dpyinfo->mouse_face_beg_row - || (vpos == dpyinfo->mouse_face_beg_row - && hpos >= dpyinfo->mouse_face_beg_col)) - && (vpos < dpyinfo->mouse_face_end_row - || (vpos == dpyinfo->mouse_face_end_row - && hpos < dpyinfo->mouse_face_end_col)) + if (! NILP (hlinfo->mouse_face_window) + && coords_in_mouse_face_p (w, hpos, vpos) /* Don't redraw the cursor's spot in mouse face if it is at the end of a line (on a newline). The cursor appears there, but mouse highlighting does not. */ @@ -23608,30 +24017,50 @@ x_clear_cursor (struct window *w) update_window_cursor (w, 0); } +#endif /* HAVE_WINDOW_SYSTEM */ + +/* Implementation of draw_row_with_mouse_face for GUI sessions, GPM, + and MSDOS. */ +void +draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row, + int start_hpos, int end_hpos, + enum draw_glyphs_face draw) +{ +#ifdef HAVE_WINDOW_SYSTEM + if (FRAME_WINDOW_P (XFRAME (w->frame))) + { + draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0); + return; + } +#endif +#if defined (HAVE_GPM) || defined (MSDOS) + tty_draw_row_with_mouse_face (w, row, start_hpos, end_hpos, draw); +#endif +} /* EXPORT: Display the active region described by mouse_face_* according to DRAW. */ void -show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) +show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) { - struct window *w = XWINDOW (dpyinfo->mouse_face_window); + struct window *w = XWINDOW (hlinfo->mouse_face_window); struct frame *f = XFRAME (WINDOW_FRAME (w)); if (/* If window is in the process of being destroyed, don't bother to do anything. */ w->current_matrix != NULL /* Don't update mouse highlight if hidden */ - && (draw != DRAW_MOUSE_FACE || !dpyinfo->mouse_face_hidden) + && (draw != DRAW_MOUSE_FACE || !hlinfo->mouse_face_hidden) /* Recognize when we are called to operate on rows that don't exist anymore. This can happen when a window is split. */ - && dpyinfo->mouse_face_end_row < w->current_matrix->nrows) + && hlinfo->mouse_face_end_row < w->current_matrix->nrows) { int phys_cursor_on_p = w->phys_cursor_on_p; struct glyph_row *row, *first, *last; - first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); - last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); + first = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row); + last = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_end_row); for (row = first; row <= last && row->enabled_p; ++row) { @@ -23640,8 +24069,30 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) /* For all but the first row, the highlight starts at column 0. */ if (row == first) { - start_hpos = dpyinfo->mouse_face_beg_col; - start_x = dpyinfo->mouse_face_beg_x; + /* R2L rows have BEG and END in reversed order, but the + screen drawing geometry is always left to right. So + we need to mirror the beginning and end of the + highlighted area in R2L rows. */ + if (!row->reversed_p) + { + start_hpos = hlinfo->mouse_face_beg_col; + start_x = hlinfo->mouse_face_beg_x; + } + else if (row == last) + { + start_hpos = hlinfo->mouse_face_end_col; + start_x = hlinfo->mouse_face_end_x; + } + else + { + start_hpos = 0; + start_x = 0; + } + } + else if (row->reversed_p && row == last) + { + start_hpos = hlinfo->mouse_face_end_col; + start_x = hlinfo->mouse_face_end_x; } else { @@ -23650,7 +24101,20 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) } if (row == last) - end_hpos = dpyinfo->mouse_face_end_col; + { + if (!row->reversed_p) + end_hpos = hlinfo->mouse_face_end_col; + else if (row == first) + end_hpos = hlinfo->mouse_face_beg_col; + else + { + end_hpos = row->used[TEXT_AREA]; + if (draw == DRAW_NORMAL_TEXT) + row->fill_line_p = 1; /* Clear to end of line */ + } + } + else if (row->reversed_p && row == first) + end_hpos = hlinfo->mouse_face_beg_col; else { end_hpos = row->used[TEXT_AREA]; @@ -23660,18 +24124,19 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) if (end_hpos > start_hpos) { - draw_glyphs (w, start_x, row, TEXT_AREA, - start_hpos, end_hpos, - draw, 0); + draw_row_with_mouse_face (w, start_x, row, + start_hpos, end_hpos, draw); row->mouse_face_p = draw == DRAW_MOUSE_FACE || draw == DRAW_IMAGE_RAISED; } } +#ifdef HAVE_WINDOW_SYSTEM /* When we've written over the cursor, arrange for it to be displayed again. */ - if (phys_cursor_on_p && !w->phys_cursor_on_p) + if (FRAME_WINDOW_P (f) + && phys_cursor_on_p && !w->phys_cursor_on_p) { BLOCK_INPUT; display_and_set_cursor (w, 1, @@ -23679,15 +24144,22 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) w->phys_cursor.x, w->phys_cursor.y); UNBLOCK_INPUT; } +#endif /* HAVE_WINDOW_SYSTEM */ } +#ifdef HAVE_WINDOW_SYSTEM /* Change the mouse cursor. */ - if (draw == DRAW_NORMAL_TEXT && !EQ (dpyinfo->mouse_face_window, f->tool_bar_window)) - FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); - else if (draw == DRAW_MOUSE_FACE) - FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); - else - FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor); + if (FRAME_WINDOW_P (f)) + { + if (draw == DRAW_NORMAL_TEXT + && !EQ (hlinfo->mouse_face_window, f->tool_bar_window)) + FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); + else if (draw == DRAW_MOUSE_FACE) + FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); + else + FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor); + } +#endif /* HAVE_WINDOW_SYSTEM */ } /* EXPORT: @@ -23696,23 +24168,70 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) face was actually drawn unhighlighted. */ int -clear_mouse_face (Display_Info *dpyinfo) +clear_mouse_face (Mouse_HLInfo *hlinfo) { int cleared = 0; - if (!dpyinfo->mouse_face_hidden && !NILP (dpyinfo->mouse_face_window)) + if (!hlinfo->mouse_face_hidden && !NILP (hlinfo->mouse_face_window)) { - show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT); + show_mouse_face (hlinfo, DRAW_NORMAL_TEXT); cleared = 1; } - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_overlay = Qnil; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_overlay = Qnil; return cleared; } +/* Return non-zero if the coordinates HPOS and VPOS on windows W are + within the mouse face on that window. */ +static int +coords_in_mouse_face_p (struct window *w, int hpos, int vpos) +{ + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); + + /* Quickly resolve the easy cases. */ + if (!(WINDOWP (hlinfo->mouse_face_window) + && XWINDOW (hlinfo->mouse_face_window) == w)) + return 0; + if (vpos < hlinfo->mouse_face_beg_row + || vpos > hlinfo->mouse_face_end_row) + return 0; + if (vpos > hlinfo->mouse_face_beg_row + && vpos < hlinfo->mouse_face_end_row) + return 1; + + if (!MATRIX_ROW (w->current_matrix, vpos)->reversed_p) + { + if (hlinfo->mouse_face_beg_row == hlinfo->mouse_face_end_row) + { + if (hlinfo->mouse_face_beg_col <= hpos && hpos < hlinfo->mouse_face_end_col) + return 1; + } + else if ((vpos == hlinfo->mouse_face_beg_row + && hpos >= hlinfo->mouse_face_beg_col) + || (vpos == hlinfo->mouse_face_end_row + && hpos < hlinfo->mouse_face_end_col)) + return 1; + } + else + { + if (hlinfo->mouse_face_beg_row == hlinfo->mouse_face_end_row) + { + if (hlinfo->mouse_face_end_col < hpos && hpos <= hlinfo->mouse_face_beg_col) + return 1; + } + else if ((vpos == hlinfo->mouse_face_beg_row + && hpos <= hlinfo->mouse_face_beg_col) + || (vpos == hlinfo->mouse_face_end_row + && hpos > hlinfo->mouse_face_end_col)) + return 1; + } + return 0; +} + /* EXPORT: Non-zero if physical cursor of window W is within mouse face. */ @@ -23720,32 +24239,135 @@ clear_mouse_face (Display_Info *dpyinfo) int cursor_in_mouse_face_p (struct window *w) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); - int in_mouse_face = 0; + return coords_in_mouse_face_p (w, w->phys_cursor.hpos, w->phys_cursor.vpos); +} + + + +/* Find the glyph rows START_ROW and END_ROW of window W that display + characters between buffer positions START_CHARPOS and END_CHARPOS + (excluding END_CHARPOS). This is similar to row_containing_pos, + but is more accurate when bidi reordering makes buffer positions + change non-linearly with glyph rows. */ +static void +rows_from_pos_range (struct window *w, + EMACS_INT start_charpos, EMACS_INT end_charpos, + struct glyph_row **start, struct glyph_row **end) +{ + struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); + int last_y = window_text_bottom_y (w); + struct glyph_row *row; + + *start = NULL; + *end = NULL; + + while (!first->enabled_p + && first < MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w)) + first++; - if (WINDOWP (dpyinfo->mouse_face_window) - && XWINDOW (dpyinfo->mouse_face_window) == w) + /* Find the START row. */ + for (row = first; + row->enabled_p && MATRIX_ROW_BOTTOM_Y (row) <= last_y; + row++) { - int hpos = w->phys_cursor.hpos; - int vpos = w->phys_cursor.vpos; + /* A row can potentially be the START row if the range of the + characters it displays intersects the range + [START_CHARPOS..END_CHARPOS). */ + if (! ((start_charpos < MATRIX_ROW_START_CHARPOS (row) + && end_charpos < MATRIX_ROW_START_CHARPOS (row)) + /* See the commentary in row_containing_pos, for the + explanation of the complicated way to check whether + some position is beyond the end of the characters + displayed by a row. */ + || ((start_charpos > MATRIX_ROW_END_CHARPOS (row) + || (start_charpos == MATRIX_ROW_END_CHARPOS (row) + && !row->ends_at_zv_p + && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))) + && (end_charpos > MATRIX_ROW_END_CHARPOS (row) + || (end_charpos == MATRIX_ROW_END_CHARPOS (row) + && !row->ends_at_zv_p + && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)))))) + { + /* Found a candidate row. Now make sure at least one of the + glyphs it displays has a charpos from the range + [START_CHARPOS..END_CHARPOS). + + This is not obvious because bidi reordering could make + buffer positions of a row be 1,2,3,102,101,100, and if we + want to highlight characters in [50..60), we don't want + this row, even though [50..60) does intersect [1..103), + the range of character positions given by the row's start + and end positions. */ + struct glyph *g = row->glyphs[TEXT_AREA]; + struct glyph *e = g + row->used[TEXT_AREA]; - if (vpos >= dpyinfo->mouse_face_beg_row - && vpos <= dpyinfo->mouse_face_end_row - && (vpos > dpyinfo->mouse_face_beg_row - || hpos >= dpyinfo->mouse_face_beg_col) - && (vpos < dpyinfo->mouse_face_end_row - || hpos < dpyinfo->mouse_face_end_col - || dpyinfo->mouse_face_past_end)) - in_mouse_face = 1; + while (g < e) + { + if (BUFFERP (g->object) + && start_charpos <= g->charpos && g->charpos < end_charpos) + *start = row; + g++; + } + if (*start) + break; + } } - return in_mouse_face; -} + /* Find the END row. */ + if (!*start + /* If the last row is partially visible, start looking for END + from that row, instead of starting from FIRST. */ + && !(row->enabled_p + && row->y < last_y && MATRIX_ROW_BOTTOM_Y (row) > last_y)) + row = first; + for ( ; row->enabled_p && MATRIX_ROW_BOTTOM_Y (row) <= last_y; row++) + { + struct glyph_row *next = row + 1; + if (!next->enabled_p + || next >= MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w) + /* The first row >= START whose range of displayed characters + does NOT intersect the range [START_CHARPOS..END_CHARPOS] + is the row END + 1. */ + || (start_charpos < MATRIX_ROW_START_CHARPOS (next) + && end_charpos < MATRIX_ROW_START_CHARPOS (next)) + || ((start_charpos > MATRIX_ROW_END_CHARPOS (next) + || (start_charpos == MATRIX_ROW_END_CHARPOS (next) + && !next->ends_at_zv_p + && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (next))) + && (end_charpos > MATRIX_ROW_END_CHARPOS (next) + || (end_charpos == MATRIX_ROW_END_CHARPOS (next) + && !next->ends_at_zv_p + && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (next))))) + { + *end = row; + break; + } + else + { + /* If the next row's edges intersect [START_CHARPOS..END_CHARPOS], + but none of the characters it displays are in the range, it is + also END + 1. */ + struct glyph *g = next->glyphs[TEXT_AREA]; + struct glyph *e = g + next->used[TEXT_AREA]; + while (g < e) + { + if (BUFFERP (g->object) + && start_charpos <= g->charpos && g->charpos < end_charpos) + break; + g++; + } + if (g == e) + { + *end = row; + break; + } + } + } +} - -/* This function sets the mouse_face_* elements of DPYINFO, assuming +/* This function sets the mouse_face_* elements of HLINFO, assuming the mouse cursor is on a glyph with buffer charpos MOUSE_CHARPOS in window WINDOW. START_CHARPOS and END_CHARPOS are buffer positions for the overlay or run of text properties specifying the mouse @@ -23756,7 +24378,7 @@ cursor_in_mouse_face_p (struct window *w) static void mouse_face_from_buffer_pos (Lisp_Object window, - Display_Info *dpyinfo, + Mouse_HLInfo *hlinfo, EMACS_INT mouse_charpos, EMACS_INT start_charpos, EMACS_INT end_charpos, @@ -23766,166 +24388,313 @@ mouse_face_from_buffer_pos (Lisp_Object window, { struct window *w = XWINDOW (window); struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); - struct glyph_row *row; + struct glyph_row *r1, *r2; struct glyph *glyph, *end; - EMACS_INT ignore; + EMACS_INT ignore, pos; int x; xassert (NILP (display_string) || STRINGP (display_string)); xassert (NILP (before_string) || STRINGP (before_string)); xassert (NILP (after_string) || STRINGP (after_string)); - /* Find the first highlighted glyph. */ - if (start_charpos < MATRIX_ROW_START_CHARPOS (first)) + /* Find the rows corresponding to START_CHARPOS and END_CHARPOS. */ + rows_from_pos_range (w, start_charpos, end_charpos, &r1, &r2); + if (r1 == NULL) + r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + /* If the before-string or display-string contains newlines, + rows_from_pos_range skips to its last row. Move back. */ + if (!NILP (before_string) || !NILP (display_string)) { - dpyinfo->mouse_face_beg_col = 0; - dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (first, w->current_matrix); - dpyinfo->mouse_face_beg_x = first->x; - dpyinfo->mouse_face_beg_y = first->y; + struct glyph_row *prev; + while ((prev = r1 - 1, prev >= first) + && MATRIX_ROW_END_CHARPOS (prev) == start_charpos + && prev->used[TEXT_AREA] > 0) + { + struct glyph *beg = prev->glyphs[TEXT_AREA]; + glyph = beg + prev->used[TEXT_AREA]; + while (--glyph >= beg && INTEGERP (glyph->object)); + if (glyph < beg + || !(EQ (glyph->object, before_string) + || EQ (glyph->object, display_string))) + break; + r1 = prev; + } } - else + if (r2 == NULL) + { + r2 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + hlinfo->mouse_face_past_end = 1; + } + else if (!NILP (after_string)) { - row = row_containing_pos (w, start_charpos, first, NULL, 0); - if (row == NULL) - row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + /* If the after-string has newlines, advance to its last row. */ + struct glyph_row *next; + struct glyph_row *last + = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); - /* If the before-string or display-string contains newlines, - row_containing_pos skips to its last row. Move back. */ - if (!NILP (before_string) || !NILP (display_string)) - { - struct glyph_row *prev; - while ((prev = row - 1, prev >= first) - && MATRIX_ROW_END_CHARPOS (prev) == start_charpos - && prev->used[TEXT_AREA] > 0) - { - struct glyph *beg = prev->glyphs[TEXT_AREA]; - glyph = beg + prev->used[TEXT_AREA]; - while (--glyph >= beg && INTEGERP (glyph->object)); - if (glyph < beg - || !(EQ (glyph->object, before_string) - || EQ (glyph->object, display_string))) - break; - row = prev; - } - } + for (next = r2 + 1; + next <= last + && next->used[TEXT_AREA] > 0 + && EQ (next->glyphs[TEXT_AREA]->object, after_string); + ++next) + r2 = next; + } + /* The rest of the display engine assumes that mouse_face_beg_row is + either above below mouse_face_end_row or identical to it. But + with bidi-reordered continued lines, the row for START_CHARPOS + could be below the row for END_CHARPOS. If so, swap the rows and + store them in correct order. */ + if (r1->y > r2->y) + { + struct glyph_row *tem = r2; + + r2 = r1; + r1 = tem; + } - glyph = row->glyphs[TEXT_AREA]; - end = glyph + row->used[TEXT_AREA]; - x = row->x; - dpyinfo->mouse_face_beg_y = row->y; - dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (row, w->current_matrix); + hlinfo->mouse_face_beg_y = r1->y; + hlinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (r1, w->current_matrix); + hlinfo->mouse_face_end_y = r2->y; + hlinfo->mouse_face_end_row = MATRIX_ROW_VPOS (r2, w->current_matrix); + + /* For a bidi-reordered row, the positions of BEFORE_STRING, + AFTER_STRING, DISPLAY_STRING, START_CHARPOS, and END_CHARPOS + could be anywhere in the row and in any order. The strategy + below is to find the leftmost and the rightmost glyph that + belongs to either of these 3 strings, or whose position is + between START_CHARPOS and END_CHARPOS, and highlight all the + glyphs between those two. This may cover more than just the text + between START_CHARPOS and END_CHARPOS if the range of characters + strides the bidi level boundary, e.g. if the beginning is in R2L + text while the end is in L2R text or vice versa. */ + if (!r1->reversed_p) + { + /* This row is in a left to right paragraph. Scan it left to + right. */ + glyph = r1->glyphs[TEXT_AREA]; + end = glyph + r1->used[TEXT_AREA]; + x = r1->x; /* Skip truncation glyphs at the start of the glyph row. */ - if (row->displays_text_p) + if (r1->displays_text_p) for (; glyph < end && INTEGERP (glyph->object) && glyph->charpos < 0; ++glyph) x += glyph->pixel_width; - /* Scan the glyph row, stopping before BEFORE_STRING or - DISPLAY_STRING or START_CHARPOS. */ + /* Scan the glyph row, looking for BEFORE_STRING, AFTER_STRING, + or DISPLAY_STRING, and the first glyph from buffer whose + position is between START_CHARPOS and END_CHARPOS. */ for (; glyph < end && !INTEGERP (glyph->object) - && !EQ (glyph->object, before_string) && !EQ (glyph->object, display_string) && !(BUFFERP (glyph->object) - && glyph->charpos >= start_charpos); + && (glyph->charpos >= start_charpos + && glyph->charpos < end_charpos)); ++glyph) - x += glyph->pixel_width; - - dpyinfo->mouse_face_beg_x = x; - dpyinfo->mouse_face_beg_col = glyph - row->glyphs[TEXT_AREA]; - } - - /* Find the last highlighted glyph. */ - row = row_containing_pos (w, end_charpos, first, NULL, 0); - if (row == NULL) - { - row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); - dpyinfo->mouse_face_past_end = 1; + { + /* BEFORE_STRING or AFTER_STRING are only relevant if they + are present at buffer positions between START_CHARPOS and + END_CHARPOS, or if they come from an overlay. */ + if (EQ (glyph->object, before_string)) + { + pos = string_buffer_position (w, before_string, + start_charpos); + /* If pos == 0, it means before_string came from an + overlay, not from a buffer position. */ + if (!pos || (pos >= start_charpos && pos < end_charpos)) + break; + } + else if (EQ (glyph->object, after_string)) + { + pos = string_buffer_position (w, after_string, end_charpos); + if (!pos || (pos >= start_charpos && pos < end_charpos)) + break; + } + x += glyph->pixel_width; + } + hlinfo->mouse_face_beg_x = x; + hlinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA]; } - else if (!NILP (after_string)) + else { - /* If the after-string has newlines, advance to its last row. */ - struct glyph_row *next; - struct glyph_row *last - = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + /* This row is in a right to left paragraph. Scan it right to + left. */ + struct glyph *g; - for (next = row + 1; - next <= last - && next->used[TEXT_AREA] > 0 - && EQ (next->glyphs[TEXT_AREA]->object, after_string); - ++next) - row = next; - } + end = r1->glyphs[TEXT_AREA] - 1; + glyph = end + r1->used[TEXT_AREA]; - glyph = row->glyphs[TEXT_AREA]; - end = glyph + row->used[TEXT_AREA]; - x = row->x; - dpyinfo->mouse_face_end_y = row->y; - dpyinfo->mouse_face_end_row = MATRIX_ROW_VPOS (row, w->current_matrix); + /* Skip truncation glyphs at the start of the glyph row. */ + if (r1->displays_text_p) + for (; glyph > end + && INTEGERP (glyph->object) + && glyph->charpos < 0; + --glyph) + ; - /* Skip truncation glyphs at the start of the row. */ - if (row->displays_text_p) - for (; glyph < end - && INTEGERP (glyph->object) - && glyph->charpos < 0; - ++glyph) - x += glyph->pixel_width; + /* Scan the glyph row, looking for BEFORE_STRING, AFTER_STRING, + or DISPLAY_STRING, and the first glyph from buffer whose + position is between START_CHARPOS and END_CHARPOS. */ + for (; glyph > end + && !INTEGERP (glyph->object) + && !EQ (glyph->object, display_string) + && !(BUFFERP (glyph->object) + && (glyph->charpos >= start_charpos + && glyph->charpos < end_charpos)); + --glyph) + { + /* BEFORE_STRING or AFTER_STRING are only relevant if they + are present at buffer positions between START_CHARPOS and + END_CHARPOS, or if they come from an overlay. */ + if (EQ (glyph->object, before_string)) + { + pos = string_buffer_position (w, before_string, start_charpos); + /* If pos == 0, it means before_string came from an + overlay, not from a buffer position. */ + if (!pos || (pos >= start_charpos && pos < end_charpos)) + break; + } + else if (EQ (glyph->object, after_string)) + { + pos = string_buffer_position (w, after_string, end_charpos); + if (!pos || (pos >= start_charpos && pos < end_charpos)) + break; + } + } - /* Scan the glyph row, stopping at END_CHARPOS or when we encounter - AFTER_STRING. */ - for (; glyph < end - && !INTEGERP (glyph->object) - && !EQ (glyph->object, after_string) - && !(BUFFERP (glyph->object) && glyph->charpos >= end_charpos); - ++glyph) - x += glyph->pixel_width; + glyph++; /* first glyph to the right of the highlighted area */ + for (g = r1->glyphs[TEXT_AREA], x = r1->x; g < glyph; g++) + x += g->pixel_width; + hlinfo->mouse_face_beg_x = x; + hlinfo->mouse_face_beg_col = glyph - r1->glyphs[TEXT_AREA]; + } - /* If we found AFTER_STRING, consume it and stop. */ - if (EQ (glyph->object, after_string)) + /* If the highlight ends in a different row, compute GLYPH and END + for the end row. Otherwise, reuse the values computed above for + the row where the highlight begins. */ + if (r2 != r1) { - for (; EQ (glyph->object, after_string) && glyph < end; ++glyph) + if (!r2->reversed_p) + { + glyph = r2->glyphs[TEXT_AREA]; + end = glyph + r2->used[TEXT_AREA]; + x = r2->x; + } + else + { + end = r2->glyphs[TEXT_AREA] - 1; + glyph = end + r2->used[TEXT_AREA]; + } + } + + if (!r2->reversed_p) + { + /* Skip truncation and continuation glyphs near the end of the + row, and also blanks and stretch glyphs inserted by + extend_face_to_end_of_line. */ + while (end > glyph + && INTEGERP ((end - 1)->object) + && (end - 1)->charpos <= 0) + --end; + /* Scan the rest of the glyph row from the end, looking for the + first glyph that comes from BEFORE_STRING, AFTER_STRING, or + DISPLAY_STRING, or whose position is between START_CHARPOS + and END_CHARPOS */ + for (--end; + end > glyph + && !INTEGERP (end->object) + && !EQ (end->object, display_string) + && !(BUFFERP (end->object) + && (end->charpos >= start_charpos + && end->charpos < end_charpos)); + --end) + { + /* BEFORE_STRING or AFTER_STRING are only relevant if they + are present at buffer positions between START_CHARPOS and + END_CHARPOS, or if they come from an overlay. */ + if (EQ (end->object, before_string)) + { + pos = string_buffer_position (w, before_string, start_charpos); + if (!pos || (pos >= start_charpos && pos < end_charpos)) + break; + } + else if (EQ (end->object, after_string)) + { + pos = string_buffer_position (w, after_string, end_charpos); + if (!pos || (pos >= start_charpos && pos < end_charpos)) + break; + } + } + /* Find the X coordinate of the last glyph to be highlighted. */ + for (; glyph <= end; ++glyph) x += glyph->pixel_width; + + hlinfo->mouse_face_end_x = x; + hlinfo->mouse_face_end_col = glyph - r2->glyphs[TEXT_AREA]; } else { - /* If there's no after-string, we must check if we overshot, - which might be the case if we stopped after a string glyph. - That glyph may belong to a before-string or display-string - associated with the end position, which must not be - highlighted. */ - Lisp_Object prev_object; - EMACS_INT pos; - - while (glyph > row->glyphs[TEXT_AREA]) + /* Skip truncation and continuation glyphs near the end of the + row, and also blanks and stretch glyphs inserted by + extend_face_to_end_of_line. */ + x = r2->x; + end++; + while (end < glyph + && INTEGERP (end->object) + && end->charpos <= 0) { - prev_object = (glyph - 1)->object; - if (!STRINGP (prev_object) || EQ (prev_object, display_string)) - break; - - pos = string_buffer_position (w, prev_object, end_charpos); - if (pos && pos < end_charpos) - break; - - for (; glyph > row->glyphs[TEXT_AREA] - && EQ ((glyph - 1)->object, prev_object); - --glyph) - x -= (glyph - 1)->pixel_width; + x += end->pixel_width; + ++end; } + /* Scan the rest of the glyph row from the end, looking for the + first glyph that comes from BEFORE_STRING, AFTER_STRING, or + DISPLAY_STRING, or whose position is between START_CHARPOS + and END_CHARPOS */ + for ( ; + end < glyph + && !INTEGERP (end->object) + && !EQ (end->object, display_string) + && !(BUFFERP (end->object) + && (end->charpos >= start_charpos + && end->charpos < end_charpos)); + ++end) + { + /* BEFORE_STRING or AFTER_STRING are only relevant if they + are present at buffer positions between START_CHARPOS and + END_CHARPOS, or if they come from an overlay. */ + if (EQ (end->object, before_string)) + { + pos = string_buffer_position (w, before_string, start_charpos); + if (!pos || (pos >= start_charpos && pos < end_charpos)) + break; + } + else if (EQ (end->object, after_string)) + { + pos = string_buffer_position (w, after_string, end_charpos); + if (!pos || (pos >= start_charpos && pos < end_charpos)) + break; + } + x += end->pixel_width; + } + hlinfo->mouse_face_end_x = x; + hlinfo->mouse_face_end_col = end - r2->glyphs[TEXT_AREA]; } - dpyinfo->mouse_face_end_x = x; - dpyinfo->mouse_face_end_col = glyph - row->glyphs[TEXT_AREA]; - dpyinfo->mouse_face_window = window; - dpyinfo->mouse_face_face_id + hlinfo->mouse_face_window = window; + hlinfo->mouse_face_face_id = face_at_buffer_position (w, mouse_charpos, 0, 0, &ignore, mouse_charpos + 1, - !dpyinfo->mouse_face_hidden, -1); - show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); + !hlinfo->mouse_face_hidden, -1); + show_mouse_face (hlinfo, DRAW_MOUSE_FACE); } +/* The following function is not used anymore (replaced with + mouse_face_from_string_pos), but I leave it here for the time + being, in case someone would. */ + +#if 0 /* not used */ /* Find the position of the glyph for position POS in OBJECT in 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, return best_glyph != NULL; } +#endif /* not used */ + +/* Find the positions of the first and the last glyphs in window W's + current matrix that occlude positions [STARTPOS..ENDPOS] in OBJECT + (assumed to be a string), and return in HLINFO's mouse_face_* + members the pixel and column/row coordinates of those glyphs. */ + +static void +mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, + Lisp_Object object, + EMACS_INT startpos, EMACS_INT endpos) +{ + int yb = window_text_bottom_y (w); + struct glyph_row *r; + struct glyph *g, *e; + int gx; + int found = 0; + + /* Find the glyph row with at least one position in the range + [STARTPOS..ENDPOS], and the first glyph in that row whose + position belongs to that range. */ + for (r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); + r->enabled_p && r->y < yb; + ++r) + { + if (!r->reversed_p) + { + g = r->glyphs[TEXT_AREA]; + e = g + r->used[TEXT_AREA]; + for (gx = r->x; g < e; gx += g->pixel_width, ++g) + if (EQ (g->object, object) + && startpos <= g->charpos && g->charpos <= endpos) + { + hlinfo->mouse_face_beg_row = r - w->current_matrix->rows; + hlinfo->mouse_face_beg_y = r->y; + hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; + hlinfo->mouse_face_beg_x = gx; + found = 1; + break; + } + } + else + { + struct glyph *g1; + + e = r->glyphs[TEXT_AREA]; + g = e + r->used[TEXT_AREA]; + for ( ; g > e; --g) + if (EQ ((g-1)->object, object) + && startpos <= (g-1)->charpos && (g-1)->charpos <= endpos) + { + hlinfo->mouse_face_beg_row = r - w->current_matrix->rows; + hlinfo->mouse_face_beg_y = r->y; + hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; + for (gx = r->x, g1 = r->glyphs[TEXT_AREA]; g1 < g; ++g1) + gx += g1->pixel_width; + hlinfo->mouse_face_beg_x = gx; + found = 1; + break; + } + } + if (found) + break; + } + + if (!found) + return; + + /* Starting with the next row, look for the first row which does NOT + include any glyphs whose positions are in the range. */ + for (++r; r->enabled_p && r->y < yb; ++r) + { + g = r->glyphs[TEXT_AREA]; + e = g + r->used[TEXT_AREA]; + found = 0; + for ( ; g < e; ++g) + if (EQ (g->object, object) + && startpos <= g->charpos && g->charpos <= endpos) + { + found = 1; + break; + } + if (!found) + break; + } + + /* The highlighted region ends on the previous row. */ + r--; + + /* Set the end row and its vertical pixel coordinate. */ + hlinfo->mouse_face_end_row = r - w->current_matrix->rows; + hlinfo->mouse_face_end_y = r->y; + + /* Compute and set the end column and the end column's horizontal + pixel coordinate. */ + if (!r->reversed_p) + { + g = r->glyphs[TEXT_AREA]; + e = g + r->used[TEXT_AREA]; + for ( ; e > g; --e) + if (EQ ((e-1)->object, object) + && startpos <= (e-1)->charpos && (e-1)->charpos <= endpos) + break; + hlinfo->mouse_face_end_col = e - g; + + for (gx = r->x; g < e; ++g) + gx += g->pixel_width; + hlinfo->mouse_face_end_x = gx; + } + else + { + e = r->glyphs[TEXT_AREA]; + g = e + r->used[TEXT_AREA]; + for (gx = r->x ; e < g; ++e) + { + if (EQ (e->object, object) + && startpos <= e->charpos && e->charpos <= endpos) + break; + gx += e->pixel_width; + } + hlinfo->mouse_face_end_col = e - r->glyphs[TEXT_AREA]; + hlinfo->mouse_face_end_x = gx; + } +} +#ifdef HAVE_WINDOW_SYSTEM /* See if position X, Y is within a hot-spot of an image. */ @@ -24175,6 +25069,8 @@ define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer) FRAME_RIF (f)->define_frame_cursor (f, cursor); } +#endif /* HAVE_WINDOW_SYSTEM */ + /* Take proper action when mouse has moved to the mode or header line or marginal area AREA of window W, x-position X and y-position Y. 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, { struct window *w = XWINDOW (window); struct frame *f = XFRAME (w->frame); - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); - Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); +#ifdef HAVE_WINDOW_SYSTEM + Display_Info *dpyinfo; +#endif + Cursor cursor = No_Cursor; Lisp_Object pointer = Qnil; int dx, dy, width, height; EMACS_INT charpos; @@ -24205,6 +25104,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, int x0; struct glyph *end; + /* Kludge alert: mode_line_string takes X/Y in pixels, but + returns them in row/column units! */ string = mode_line_string (w, area, &x, &y, &charpos, &object, &dx, &dy, &width, &height); @@ -24212,7 +25113,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, ? MATRIX_MODE_LINE_ROW (w->current_matrix) : MATRIX_HEADER_LINE_ROW (w->current_matrix)); - /* Find glyph */ + /* Find the glyph under the mouse pointer. */ if (row->mode_line_p && row->enabled_p) { 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, else { x -= WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w); + /* Kludge alert: marginal_area_string takes X/Y in pixels, but + returns them in row/column units! */ string = marginal_area_string (w, area, &x, &y, &charpos, &object, &dx, &dy, &width, &height); } help = Qnil; +#ifdef HAVE_WINDOW_SYSTEM if (IMAGEP (object)) { Lisp_Object image_map, hotspot; @@ -24272,6 +25176,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, if (NILP (pointer)) pointer = Fplist_get (XCDR (object), QCpointer); } +#endif /* HAVE_WINDOW_SYSTEM */ if (STRINGP (string)) { @@ -24291,19 +25196,27 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, } } - if (NILP (pointer)) - pointer = Fget_text_property (pos, Qpointer, string); - - /* Change the mouse pointer according to what is under X/Y. */ - if (NILP (pointer) && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE))) +#ifdef HAVE_WINDOW_SYSTEM + if (FRAME_WINDOW_P (f)) { - Lisp_Object map; - map = Fget_text_property (pos, Qlocal_map, string); - if (!KEYMAPP (map)) - map = Fget_text_property (pos, Qkeymap, string); - if (!KEYMAPP (map)) - cursor = dpyinfo->vertical_scroll_bar_cursor; + dpyinfo = FRAME_X_DISPLAY_INFO (f); + cursor = FRAME_X_OUTPUT (f)->nontext_cursor; + if (NILP (pointer)) + pointer = Fget_text_property (pos, Qpointer, string); + + /* Change the mouse pointer according to what is under X/Y. */ + if (NILP (pointer) + && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE))) + { + Lisp_Object map; + map = Fget_text_property (pos, Qlocal_map, string); + if (!KEYMAPP (map)) + map = Fget_text_property (pos, Qkeymap, string); + if (!KEYMAPP (map)) + cursor = dpyinfo->vertical_scroll_bar_cursor; + } } +#endif /* Change the mouse face according to what is under X/Y. */ 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, int gpos; int gseq_length; int total_pixel_width; - EMACS_INT ignore; + EMACS_INT begpos, endpos, ignore; int vpos, hpos; b = Fprevious_single_property_change (make_number (charpos + 1), Qmouse_face, string, Qnil); if (NILP (b)) - b = make_number (0); + begpos = 0; + else + begpos = XINT (b); e = Fnext_single_property_change (pos, Qmouse_face, string, Qnil); if (NILP (e)) - e = make_number (SCHARS (string)); + endpos = SCHARS (string); + else + endpos = XINT (e); - /* Calculate the position(glyph position: GPOS) of GLYPH in - displayed string. GPOS is different from CHARPOS. + /* Calculate the glyph position GPOS of GLYPH in the + displayed string, relative to the beginning of the + highlighted part of the string. - CHARPOS is the position of glyph in internal string - object. A mode line string format has structures which - is converted to a flatten by emacs lisp interpreter. - The internal string is an element of the structures. - The displayed string is the flatten string. */ - gpos = 0; - if (glyph > row_start_glyph) - { - tmp_glyph = glyph - 1; - while (tmp_glyph >= row_start_glyph - && tmp_glyph->charpos >= XINT (b) - && EQ (tmp_glyph->object, glyph->object)) - { - tmp_glyph--; - gpos++; - } - } + Note: GPOS is different from CHARPOS. CHARPOS is the + position of GLYPH in the internal string object. A mode + line string format has structures which are converted to + a flattened string by the Emacs Lisp interpreter. The + internal string is an element of those structures. The + displayed string is the flattened string. */ + tmp_glyph = row_start_glyph; + while (tmp_glyph < glyph + && (!(EQ (tmp_glyph->object, glyph->object) + && begpos <= tmp_glyph->charpos + && tmp_glyph->charpos < endpos))) + tmp_glyph++; + gpos = glyph - tmp_glyph; - /* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of - displayed string holding GLYPH. - - GSEQ_LENGTH is different from SCHARS (STRING). - SCHARS (STRING) returns the length of the internal string. */ - for (tmp_glyph = glyph, gseq_length = gpos; - tmp_glyph->charpos < XINT (e); - tmp_glyph++, gseq_length++) - { - if (!EQ (tmp_glyph->object, glyph->object)) - break; - } + /* Calculate the length GSEQ_LENGTH of the glyph sequence of + the highlighted part of the displayed string to which + GLYPH belongs. Note: GSEQ_LENGTH is different from + SCHARS (STRING), because the latter returns the length of + the internal string. */ + for (tmp_glyph = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1; + tmp_glyph > glyph + && (!(EQ (tmp_glyph->object, glyph->object) + && begpos <= tmp_glyph->charpos + && tmp_glyph->charpos < endpos)); + tmp_glyph--) + ; + gseq_length = gpos + (tmp_glyph - glyph) + 1; + /* Calculate the total pixel width of all the glyphs between + the beginning of the highlighted area and GLYPH. */ total_pixel_width = 0; for (tmp_glyph = glyph - gpos; tmp_glyph != glyph; tmp_glyph++) total_pixel_width += tmp_glyph->pixel_width; - /* Pre calculation of re-rendering position */ - vpos = (x - gpos); - hpos = (area == ON_MODE_LINE + /* Pre calculation of re-rendering position. Note: X is in + column units here, after the call to mode_line_string or + marginal_area_string. */ + hpos = x - gpos; + vpos = (area == ON_MODE_LINE ? (w->current_matrix)->nrows - 1 : 0); - /* If the re-rendering position is included in the last - re-rendering area, we should do nothing. */ - if ( EQ (window, dpyinfo->mouse_face_window) - && dpyinfo->mouse_face_beg_col <= vpos - && vpos < dpyinfo->mouse_face_end_col - && dpyinfo->mouse_face_beg_row == hpos ) + /* If GLYPH's position is included in the region that is + already drawn in mouse face, we have nothing to do. */ + if ( EQ (window, hlinfo->mouse_face_window) + && (!row->reversed_p + ? (hlinfo->mouse_face_beg_col <= hpos + && hpos < hlinfo->mouse_face_end_col) + /* In R2L rows we swap BEG and END, see below. */ + : (hlinfo->mouse_face_end_col <= hpos + && hpos < hlinfo->mouse_face_beg_col)) + && hlinfo->mouse_face_beg_row == vpos ) return; - if (clear_mouse_face (dpyinfo)) + if (clear_mouse_face (hlinfo)) cursor = No_Cursor; - dpyinfo->mouse_face_beg_col = vpos; - dpyinfo->mouse_face_beg_row = hpos; - - dpyinfo->mouse_face_beg_x = original_x_pixel - (total_pixel_width + dx); - dpyinfo->mouse_face_beg_y = 0; - - dpyinfo->mouse_face_end_col = vpos + gseq_length; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row; - - dpyinfo->mouse_face_end_x = 0; - dpyinfo->mouse_face_end_y = 0; + if (!row->reversed_p) + { + hlinfo->mouse_face_beg_col = hpos; + hlinfo->mouse_face_beg_x = original_x_pixel + - (total_pixel_width + dx); + hlinfo->mouse_face_end_col = hpos + gseq_length; + hlinfo->mouse_face_end_x = 0; + } + else + { + /* In R2L rows, show_mouse_face expects BEG and END + coordinates to be swapped. */ + hlinfo->mouse_face_end_col = hpos; + hlinfo->mouse_face_end_x = original_x_pixel + - (total_pixel_width + dx); + hlinfo->mouse_face_beg_col = hpos + gseq_length; + hlinfo->mouse_face_beg_x = 0; + } - dpyinfo->mouse_face_past_end = 0; - dpyinfo->mouse_face_window = window; + hlinfo->mouse_face_beg_row = vpos; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_beg_row; + hlinfo->mouse_face_beg_y = 0; + hlinfo->mouse_face_end_y = 0; + hlinfo->mouse_face_past_end = 0; + hlinfo->mouse_face_window = window; - dpyinfo->mouse_face_face_id = face_at_string_position (w, string, - charpos, - 0, 0, 0, &ignore, - glyph->face_id, 1); - show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); + hlinfo->mouse_face_face_id = face_at_string_position (w, string, + charpos, + 0, 0, 0, + &ignore, + glyph->face_id, + 1); + show_mouse_face (hlinfo, DRAW_MOUSE_FACE); if (NILP (pointer)) pointer = Qhand; } else if ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) - clear_mouse_face (dpyinfo); + clear_mouse_face (hlinfo); } - define_frame_cursor1 (f, cursor, pointer); +#ifdef HAVE_WINDOW_SYSTEM + if (FRAME_WINDOW_P (f)) + define_frame_cursor1 (f, cursor, pointer); +#endif } @@ -24426,7 +25365,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, void note_mouse_highlight (struct frame *f, int x, int y) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); enum window_part part; Lisp_Object window; struct window *w; @@ -24435,7 +25374,7 @@ note_mouse_highlight (struct frame *f, int x, int y) struct buffer *b; /* When a menu is active, don't highlight because this looks odd. */ -#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) +#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) || defined (MSDOS) if (popup_activated ()) return; #endif @@ -24445,28 +25384,28 @@ note_mouse_highlight (struct frame *f, int x, int y) || f->pointer_invisible) return; - dpyinfo->mouse_face_mouse_x = x; - dpyinfo->mouse_face_mouse_y = y; - dpyinfo->mouse_face_mouse_frame = f; + hlinfo->mouse_face_mouse_x = x; + hlinfo->mouse_face_mouse_y = y; + hlinfo->mouse_face_mouse_frame = f; - if (dpyinfo->mouse_face_defer) + if (hlinfo->mouse_face_defer) return; if (gc_in_progress) { - dpyinfo->mouse_face_deferred_gc = 1; + hlinfo->mouse_face_deferred_gc = 1; return; } /* Which window is that in? */ - window = window_from_coordinates (f, x, y, &part, 0, 0, 1); + window = window_from_coordinates (f, x, y, &part, 1); /* If we were displaying active text in another window, clear that. Also clear if we move out of text area in same window. */ - if (! EQ (window, dpyinfo->mouse_face_window) + if (! EQ (window, hlinfo->mouse_face_window) || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE - && !NILP (dpyinfo->mouse_face_window))) - clear_mouse_face (dpyinfo); + && !NILP (hlinfo->mouse_face_window))) + clear_mouse_face (hlinfo); /* Not on a window -> return. */ if (!WINDOWP (window)) @@ -24479,6 +25418,7 @@ note_mouse_highlight (struct frame *f, int x, int y) w = XWINDOW (window); frame_to_window_pixel_xy (w, &x, &y); +#ifdef HAVE_WINDOW_SYSTEM /* Handle tool-bar window differently since it doesn't display a buffer. */ if (EQ (window, f->tool_bar_window)) @@ -24486,6 +25426,7 @@ note_mouse_highlight (struct frame *f, int x, int y) note_tool_bar_highlight (f, x, y); return; } +#endif /* Mouse is on the mode, header line or margin? */ if (part == ON_MODE_LINE || part == ON_HEADER_LINE @@ -24495,6 +25436,7 @@ note_mouse_highlight (struct frame *f, int x, int y) return; } +#ifdef HAVE_WINDOW_SYSTEM if (part == ON_VERTICAL_BORDER) { cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor; @@ -24505,6 +25447,7 @@ note_mouse_highlight (struct frame *f, int x, int y) cursor = FRAME_X_OUTPUT (f)->nontext_cursor; else cursor = FRAME_X_OUTPUT (f)->text_cursor; +#endif /* Are we in a window whose display is up to date? And verify the buffer's text has not changed. */ @@ -24528,6 +25471,7 @@ note_mouse_highlight (struct frame *f, int x, int y) /* Find the glyph under X/Y. */ glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &dx, &dy, &area); +#ifdef HAVE_WINDOW_SYSTEM /* Look for :pointer property on image. */ if (glyph != NULL && glyph->type == IMAGE_GLYPH) { @@ -24569,21 +25513,38 @@ note_mouse_highlight (struct frame *f, int x, int y) pointer = Fplist_get (XCDR (img->spec), QCpointer); } } +#endif /* HAVE_WINDOW_SYSTEM */ /* Clear mouse face if X/Y not over text. */ if (glyph == NULL || area != TEXT_AREA - || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p) + || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p + /* Glyph's OBJECT is an integer for glyphs inserted by the + display engine for its internal purposes, like truncation + and continuation glyphs and blanks beyond the end of + line's text on text terminals. If we are over such a + glyph, we are not over any text. */ + || INTEGERP (glyph->object) + /* R2L rows have a stretch glyph at their front, which + stands for no text, whereas L2R rows have no glyphs at + all beyond the end of text. Treat such stretch glyphs + like we do with NULL glyphs in L2R rows. */ + || (MATRIX_ROW (w->current_matrix, vpos)->reversed_p + && glyph == MATRIX_ROW (w->current_matrix, vpos)->glyphs[TEXT_AREA] + && glyph->type == STRETCH_GLYPH + && glyph->avoid_cursor_p)) { - if (clear_mouse_face (dpyinfo)) + if (clear_mouse_face (hlinfo)) cursor = No_Cursor; - if (NILP (pointer)) +#ifdef HAVE_WINDOW_SYSTEM + if (FRAME_WINDOW_P (f) && NILP (pointer)) { if (area != TEXT_AREA) cursor = FRAME_X_OUTPUT (f)->nontext_cursor; else pointer = Vvoid_text_area_pointer; } +#endif goto set_cursor; } @@ -24618,14 +25579,7 @@ note_mouse_highlight (struct frame *f, int x, int y) else noverlays = 0; - same_region = (EQ (window, dpyinfo->mouse_face_window) - && vpos >= dpyinfo->mouse_face_beg_row - && vpos <= dpyinfo->mouse_face_end_row - && (vpos > dpyinfo->mouse_face_beg_row - || hpos >= dpyinfo->mouse_face_beg_col) - && (vpos < dpyinfo->mouse_face_end_row - || hpos < dpyinfo->mouse_face_end_col - || dpyinfo->mouse_face_past_end)); + same_region = coords_in_mouse_face_p (w, hpos, vpos); if (same_region) cursor = No_Cursor; @@ -24636,8 +25590,8 @@ note_mouse_highlight (struct frame *f, int x, int y) the one we are currently highlighting, we have to check if we enter the overlapping overlay, and then highlight only that. */ - || (OVERLAYP (dpyinfo->mouse_face_overlay) - && mouse_face_overlay_overlaps (dpyinfo->mouse_face_overlay))) + || (OVERLAYP (hlinfo->mouse_face_overlay) + && mouse_face_overlay_overlaps (hlinfo->mouse_face_overlay))) { /* Find the highest priority overlay with a mouse-face. */ overlay = Qnil; @@ -24650,12 +25604,12 @@ note_mouse_highlight (struct frame *f, int x, int y) /* If we're highlighting the same overlay as before, there's no need to do that again. */ - if (!NILP (overlay) && EQ (overlay, dpyinfo->mouse_face_overlay)) + if (!NILP (overlay) && EQ (overlay, hlinfo->mouse_face_overlay)) goto check_help_echo; - dpyinfo->mouse_face_overlay = overlay; + hlinfo->mouse_face_overlay = overlay; /* Clear the display of the old active region, if any. */ - if (clear_mouse_face (dpyinfo)) + if (clear_mouse_face (hlinfo)) cursor = No_Cursor; /* If no overlay applies, get a text property. */ @@ -24679,23 +25633,14 @@ note_mouse_highlight (struct frame *f, int x, int y) b = make_number (0); if (NILP (e)) e = make_number (SCHARS (object) - 1); - - fast_find_string_pos (w, XINT (b), object, - &dpyinfo->mouse_face_beg_col, - &dpyinfo->mouse_face_beg_row, - &dpyinfo->mouse_face_beg_x, - &dpyinfo->mouse_face_beg_y, 0); - fast_find_string_pos (w, XINT (e), object, - &dpyinfo->mouse_face_end_col, - &dpyinfo->mouse_face_end_row, - &dpyinfo->mouse_face_end_x, - &dpyinfo->mouse_face_end_y, 1); - dpyinfo->mouse_face_past_end = 0; - dpyinfo->mouse_face_window = window; - dpyinfo->mouse_face_face_id + mouse_face_from_string_pos (w, hlinfo, object, + XINT (b), XINT (e)); + hlinfo->mouse_face_past_end = 0; + hlinfo->mouse_face_window = window; + hlinfo->mouse_face_face_id = face_at_string_position (w, object, pos, 0, 0, 0, &ignore, glyph->face_id, 1); - show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); + show_mouse_face (hlinfo, DRAW_MOUSE_FACE); cursor = No_Cursor; } else @@ -24729,17 +25674,33 @@ note_mouse_highlight (struct frame *f, int x, int y) { Lisp_Object before, after; Lisp_Object before_string, after_string; + /* To correctly find the limits of mouse highlight + in a bidi-reordered buffer, we must not use the + optimization of limiting the search in + previous-single-property-change and + next-single-property-change, because + rows_from_pos_range needs the real start and end + positions to DTRT in this case. That's because + the first row visible in a window does not + necessarily display the character whose position + is the smallest. */ + Lisp_Object lim1 = + NILP (XBUFFER (buffer)->bidi_display_reordering) + ? Fmarker_position (w->start) + : Qnil; + Lisp_Object lim2 = + NILP (XBUFFER (buffer)->bidi_display_reordering) + ? make_number (BUF_Z (XBUFFER (buffer)) + - XFASTINT (w->window_end_pos)) + : Qnil; if (NILP (overlay)) { /* Handle the text property case. */ before = Fprevious_single_property_change - (make_number (pos + 1), Qmouse_face, buffer, - Fmarker_position (w->start)); + (make_number (pos + 1), Qmouse_face, buffer, lim1); after = Fnext_single_property_change - (make_number (pos), Qmouse_face, buffer, - make_number (BUF_Z (XBUFFER (buffer)) - - XFASTINT (w->window_end_pos))); + (make_number (pos), Qmouse_face, buffer, lim2); before_string = after_string = Qnil; } else @@ -24754,7 +25715,7 @@ note_mouse_highlight (struct frame *f, int x, int y) if (!STRINGP (after_string)) after_string = Qnil; } - mouse_face_from_buffer_pos (window, dpyinfo, pos, + mouse_face_from_buffer_pos (window, hlinfo, pos, XFASTINT (before), XFASTINT (after), before_string, after_string, @@ -24833,8 +25794,9 @@ note_mouse_highlight (struct frame *f, int x, int y) } } +#ifdef HAVE_WINDOW_SYSTEM /* Look for a `pointer' property. */ - if (NILP (pointer)) + if (FRAME_WINDOW_P (f) && NILP (pointer)) { /* Check overlays first. */ for (i = noverlays - 1; i >= 0 && NILP (pointer); --i) @@ -24873,6 +25835,7 @@ note_mouse_highlight (struct frame *f, int x, int y) Qpointer, object); } } +#endif /* HAVE_WINDOW_SYSTEM */ BEGV = obegv; ZV = ozv; @@ -24881,7 +25844,14 @@ note_mouse_highlight (struct frame *f, int x, int y) set_cursor: - define_frame_cursor1 (f, cursor, pointer); +#ifdef HAVE_WINDOW_SYSTEM + if (FRAME_WINDOW_P (f)) + define_frame_cursor1 (f, cursor, pointer); +#else + /* This is here to prevent a compiler error, about "label at end of + compound statement". */ + return; +#endif } @@ -24893,13 +25863,13 @@ note_mouse_highlight (struct frame *f, int x, int y) void x_clear_window_mouse_face (struct window *w) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); Lisp_Object window; BLOCK_INPUT; XSETWINDOW (window, w); - if (EQ (window, dpyinfo->mouse_face_window)) - clear_mouse_face (dpyinfo); + if (EQ (window, hlinfo->mouse_face_window)) + clear_mouse_face (hlinfo); UNBLOCK_INPUT; } @@ -24912,20 +25882,18 @@ void cancel_mouse_face (struct frame *f) { Lisp_Object window; - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - window = dpyinfo->mouse_face_window; + window = hlinfo->mouse_face_window; if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) { - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; } } -#endif /* HAVE_WINDOW_SYSTEM */ - /*********************************************************************** Exposure Events @@ -25382,12 +26350,12 @@ expose_frame (struct frame *f, int x, int y, int w, int h) focus-follows-mouse with delayed raise. --jason 2001-10-12 */ if (mouse_face_overwritten_p && !FRAME_GARBAGED_P (f)) { - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); - if (f == dpyinfo->mouse_face_mouse_frame) + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); + if (f == hlinfo->mouse_face_mouse_frame) { - int x = dpyinfo->mouse_face_mouse_x; - int y = dpyinfo->mouse_face_mouse_y; - clear_mouse_face (dpyinfo); + int x = hlinfo->mouse_face_mouse_x; + int y = hlinfo->mouse_face_mouse_y; + clear_mouse_face (hlinfo); note_mouse_highlight (f, x, y); } } @@ -25974,7 +26942,9 @@ the frame's other specifications determine how to blink the cursor off. */); Vblink_cursor_alist = Qnil; DEFVAR_BOOL ("auto-hscroll-mode", &automatic_hscrolling_p, - doc: /* *Non-nil means scroll the display automatically to make point visible. */); + doc: /* Allow or disallow automatic horizontal scrolling of windows. +If non-nil, windows are automatically scrolled horizontally to make +point visible. */); automatic_hscrolling_p = 1; Qauto_hscroll_mode = intern_c_string ("auto-hscroll-mode"); staticpro (&Qauto_hscroll_mode); @@ -26089,16 +27059,46 @@ baseline. The default value is 1. */); underline_minimum_offset = 1; DEFVAR_BOOL ("display-hourglass", &display_hourglass_p, - doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */); + doc: /* Non-nil means show an hourglass pointer, when Emacs is busy. +This feature only works when on a window system that can change +cursor shapes. */); display_hourglass_p = 1; DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, - doc: /* *Seconds to wait before displaying an hourglass pointer. -Value must be an integer or float. */); + doc: /* *Seconds to wait before displaying an hourglass pointer when Emacs is busy. */); Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY); hourglass_atimer = NULL; hourglass_shown_p = 0; + + DEFSYM (Qglyphless_char, "glyphless-char"); + DEFSYM (Qhex_code, "hex-code"); + DEFSYM (Qempty_box, "empty-box"); + DEFSYM (Qthin_space, "thin-space"); + DEFSYM (Qzero_width, "zero-width"); + + DEFSYM (Qglyphless_char_display, "glyphless-char-display"); + /* Intern this now in case it isn't already done. + Setting this variable twice is harmless. + But don't staticpro it here--that is done in alloc.c. */ + Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots"); + Fput (Qglyphless_char_display, Qchar_table_extra_slots, make_number (1)); + + DEFVAR_LISP ("glyphless-char-display", &Vglyphless_char_display, + doc: /* Char-table to control displaying of glyphless characters. +Each element, if non-nil, is an ASCII acronym string (displayed in a box) +or one of these symbols: + hex-code: display the hexadecimal code of a character in a box + empty-box: display as an empty box + thin-space: display as 1-pixel width space + zero-width: don't display + +It has one extra slot to control the display of a character for which +no font is found. The value of the slot is `hex-code' or `empty-box'. +The default is `empty-box'. */); + Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil); + Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0), + Qempty_box); } @@ -26216,5 +27216,3 @@ cancel_hourglass (void) } #endif /* ! WINDOWSNT */ -/* arch-tag: eacc864d-bb6a-4b74-894a-1a4399a1358b - (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 @@ /* xfaces.c -- "Face" primitives. - Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -4538,7 +4540,7 @@ uncache_face (struct face_cache *c, struct face *face) Value is the ID of the face found. If no suitable face is found, realize a new one. */ -INLINE int +static INLINE int lookup_face (struct frame *f, Lisp_Object *attr) { struct face_cache *cache = FRAME_FACE_CACHE (f); @@ -6731,7 +6733,8 @@ See `set-face-stipple' for possible values for this variable. */); Vface_default_stipple = make_pure_c_string ("gray3"); DEFVAR_LISP ("tty-defined-color-alist", &Vtty_defined_color_alist, - doc: /* An alist of defined terminal colors and their RGB values. */); + doc: /* An alist of defined terminal colors and their RGB values. +See the docstring of `tty-color-alist' for the details. */); Vtty_defined_color_alist = Qnil; 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. */); #endif } -/* arch-tag: 8a0f7598-5517-408d-9ab3-1da6fcd4c749 - (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 @@ /* Functions for the X window system. - Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -99,6 +100,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <Xm/Xm.h> #include <Xm/DialogS.h> #include <Xm/FileSB.h> +#include <Xm/List.h> +#include <Xm/TextF.h> #endif #ifdef USE_LUCID @@ -516,12 +519,20 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr) int real_x = 0, real_y = 0; int had_errors = 0; Window win = f->output_data.x->parent_desc; + Atom actual_type; + unsigned long actual_size, bytes_remaining; + int i, rc, actual_format; + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + long max_len = 400; + Display *dpy = FRAME_X_DISPLAY (f); + unsigned char *tmp_data = NULL; + Atom target_type = XA_CARDINAL; BLOCK_INPUT; - x_catch_errors (FRAME_X_DISPLAY (f)); + x_catch_errors (dpy); - if (win == FRAME_X_DISPLAY_INFO (f)->root_window) + if (win == dpyinfo->root_window) win = FRAME_OUTER_WINDOW (f); /* 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) had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); } + + if (dpyinfo->root_window == f->output_data.x->parent_desc) + { + /* Try _NET_FRAME_EXTENTS if our parent is the root window. */ + rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_frame_extents, + 0, max_len, False, target_type, + &actual_type, &actual_format, &actual_size, + &bytes_remaining, &tmp_data); + + if (rc == Success && actual_type == target_type && !x_had_errors_p (dpy) + && actual_size == 4 && actual_format == 32) + { + int ign; + Window rootw; + long *fe = (long *)tmp_data; + + XGetGeometry (FRAME_X_DISPLAY (f), win, + &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign); + outer_x = -fe[0]; + outer_y = -fe[2]; + real_x -= fe[0]; + real_y -= fe[2]; + } + } + + if (tmp_data) XFree (tmp_data); + x_uncatch_errors (); UNBLOCK_INPUT; @@ -3075,25 +3113,11 @@ If FRAME is nil, use the selected frame. */) static void set_machine_and_pid_properties (struct frame *f) { - /* See the above comment "Note: Encoding strategy". */ - XTextProperty text; - int bytes, stringp; - int do_free_text_value = 0; long pid = (long) getpid (); - text.value = x_encode_text (Vsystem_name, - Qcompound_text, 0, &bytes, &stringp, - &do_free_text_value); - text.encoding = (stringp ? XA_STRING - : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); - text.format = 8; - text.nitems = bytes; - XSetWMClientMachine (FRAME_X_DISPLAY (f), - FRAME_OUTER_WINDOW (f), - &text); - if (do_free_text_value) - xfree (text.value); - + /* This will set WM_CLIENT_MACHINE and WM_LOCALE_NAME. */ + XSetWMProperties (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), NULL, NULL, + NULL, 0, NULL, NULL, NULL); XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), XInternAtom (FRAME_X_DISPLAY (f), @@ -3343,8 +3367,6 @@ This function is an internal primitive--use `make-frame' instead. */) "background", "Background", RES_TYPE_STRING); x_default_parameter (f, parms, Qmouse_color, build_string ("black"), "pointerColor", "Foreground", RES_TYPE_STRING); - x_default_parameter (f, parms, Qcursor_color, build_string ("black"), - "cursorColor", "Foreground", RES_TYPE_STRING); x_default_parameter (f, parms, Qborder_color, build_string ("black"), "borderColor", "BorderColor", RES_TYPE_STRING); x_default_parameter (f, parms, Qscreen_gamma, Qnil, @@ -3578,7 +3600,8 @@ FRAME nil means use the selected frame. */) DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, - doc: /* Internal function called by `color-defined-p', which see. */) + doc: /* Internal function called by `color-defined-p', which see +.\(Note that the Nextstep version of this function ignores FRAME.) */) (Lisp_Object color, Lisp_Object frame) { XColor foo; @@ -4096,11 +4119,12 @@ x_display_info_for_name (Lisp_Object name) DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, 1, 3, 0, - doc: /* Open a connection to an X server. + doc: /* Open a connection to a display server. DISPLAY is the name of the display to connect to. Optional second arg XRM-STRING is a string of resources in xrdb format. If the optional third arg MUST-SUCCEED is non-nil, -terminate Emacs if we can't open the connection. */) +terminate Emacs if we can't open the connection. +\(In the Nextstep version, the last two arguments are currently ignored.) */) (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed) { unsigned char *xrm_option; @@ -4179,6 +4203,9 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, doc: /* If ON is non-nil, report X errors as soon as the erring request is made. +This function only has an effect on X Windows. With MS Windows, it is +defined but does nothing. + If ON is nil, allow buffering of requests. Turning on synchronization prohibits the Xlib routines from buffering requests and seriously degrades performance, but makes debugging much @@ -4213,12 +4240,12 @@ x_sync (FRAME_PTR f) DEFUN ("x-change-window-property", Fx_change_window_property, Sx_change_window_property, 2, 6, 0, doc: /* Change window property PROP to VALUE on the X window of FRAME. -PROP must be a string. -VALUE may be a string or a list of conses, numbers and/or strings. -If an element in the list is a string, it is converted to -an Atom and the value of the Atom is used. If an element is a cons, -it is converted to a 32 bit number where the car is the 16 top bits and the -cdr is the lower 16 bits. +PROP must be a string. VALUE may be a string or a list of conses, +numbers and/or strings. If an element in the list is a string, it is +converted to an atom and the value of the atom is used. If an element +is a cons, it is converted to a 32 bit number where the car is the 16 +top bits and the cdr is the lower 16 bits. + FRAME nil or omitted means use the selected frame. If TYPE is given and non-nil, it is the name of the type of VALUE. If 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. It must be one of 8, 16 or 32. If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8. If OUTER_P is non-nil, the property is changed for the outer X window of -FRAME. Default is to change on the edit X window. - -Value is VALUE. */) +FRAME. Default is to change on the edit X window. */) (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) { struct frame *f = check_x_frame (frame); @@ -4329,15 +4354,19 @@ DEFUN ("x-window-property", Fx_window_property, Sx_window_property, 1, 6, 0, doc: /* Value is the value of window property PROP on FRAME. If FRAME is nil or omitted, use the selected frame. -If TYPE is nil or omitted, get the property as a string. Otherwise TYPE -is the name of the Atom that denotes the type expected. + +On MS Windows, this function only accepts the PROP and FRAME arguments. + +On X Windows, the following optional arguments are also accepted: +If TYPE is nil or omitted, get the property as a string. +Otherwise TYPE is the name of the atom that denotes the type expected. If SOURCE is non-nil, get the property on that window instead of from FRAME. The number 0 denotes the root window. If DELETE_P is non-nil, delete the property after retreiving it. If VECTOR_RET_P is non-nil, don't return a string but a vector of values. Value is nil if FRAME hasn't a property with name PROP or if PROP has -no value of TYPE. */) +no value of TYPE (always string in the MS Windows case). */) (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p) { struct frame *f = check_x_frame (frame); @@ -4990,7 +5019,7 @@ change the tooltip's appearance. Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil means use the default timeout of 5 seconds. -If the list of frame parameters PARAMS contains a `left' parameters, +If the list of frame parameters PARMS contains a `left' parameters, the tooltip is displayed at that x-position. Otherwise it is displayed at the mouse position, with offset DX added (default is 5 if DX isn't specified). Likewise for the y-position; if a `top' frame @@ -5007,7 +5036,7 @@ Text larger than the specified size is clipped. */) int root_x, root_y; struct buffer *old_buffer; struct text_pos pos; - int i, width, height; + int i, width, height, seen_reversed_p; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; int old_windows_or_buffers_changed = windows_or_buffers_changed; int count = SPECPDL_INDEX (); @@ -5148,7 +5177,7 @@ Text larger than the specified size is clipped. */) try_window (FRAME_ROOT_WINDOW (f), pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); /* Compute width and height of the tooltip. */ - width = height = 0; + width = height = seen_reversed_p = 0; for (i = 0; i < w->desired_matrix->nrows; ++i) { struct glyph_row *row = &w->desired_matrix->rows[i]; @@ -5163,19 +5192,74 @@ Text larger than the specified size is clipped. */) row->full_width_p = 1; row_width = row->pixel_width; - /* There's a glyph at the end of rows that is used to place - the cursor there. Don't include the width of this glyph. */ if (row->used[TEXT_AREA]) { - last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; - if (INTEGERP (last->object)) - row_width -= last->pixel_width; + /* There's a glyph at the end of rows that is used to place + the cursor there. Don't include the width of this glyph. */ + if (!row->reversed_p) + { + last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; + if (INTEGERP (last->object)) + row_width -= last->pixel_width; + } + else + { + /* There could be a stretch glyph at the beginning of R2L + rows that is produced by extend_face_to_end_of_line. + Don't count that glyph. */ + struct glyph *g = row->glyphs[TEXT_AREA]; + + if (g->type == STRETCH_GLYPH && INTEGERP (g->object)) + { + row_width -= g->pixel_width; + seen_reversed_p = 1; + } + } } height += row->height; width = max (width, row_width); } + /* If we've seen partial-length R2L rows, we need to re-adjust the + tool-tip frame width and redisplay it again, to avoid over-wide + tips due to the stretch glyph that extends R2L lines to full + width of the frame. */ + if (seen_reversed_p) + { + /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, + not in pixels. */ + width /= WINDOW_FRAME_COLUMN_WIDTH (w); + w->total_cols = make_number (width); + FRAME_TOTAL_COLS (f) = width; + adjust_glyphs (f); + clear_glyph_matrix (w->desired_matrix); + clear_glyph_matrix (w->current_matrix); + try_window (FRAME_ROOT_WINDOW (f), pos, 0); + width = height = 0; + /* Recompute width and height of the tooltip. */ + for (i = 0; i < w->desired_matrix->nrows; ++i) + { + struct glyph_row *row = &w->desired_matrix->rows[i]; + struct glyph *last; + int row_width; + + if (!row->enabled_p || !row->displays_text_p) + break; + row->full_width_p = 1; + row_width = row->pixel_width; + if (row->used[TEXT_AREA] && !row->reversed_p) + { + last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; + if (INTEGERP (last->object)) + row_width -= last->pixel_width; + } + + height += row->height; + width = max (width, row_width); + } + } + /* Add the frame's internal border to the width and height the X window should have. */ height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); @@ -5299,9 +5383,7 @@ DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog, /* Callback for "OK" and "Cancel" on file selection dialog. */ static void -file_dialog_cb (widget, client_data, call_data) - Widget widget; - XtPointer call_data, client_data; +file_dialog_cb (Widget widget, XtPointer client_data, XtPointer call_data) { int *result = (int *) client_data; XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *) call_data; @@ -5315,17 +5397,14 @@ file_dialog_cb (widget, client_data, call_data) in this case. */ static void -file_dialog_unmap_cb (widget, client_data, call_data) - Widget widget; - XtPointer call_data, client_data; +file_dialog_unmap_cb (Widget widget, XtPointer client_data, XtPointer call_data) { int *result = (int *) client_data; *result = XmCR_CANCEL; } static Lisp_Object -clean_up_file_dialog (arg) - Lisp_Object arg; +clean_up_file_dialog (Lisp_Object arg) { struct Lisp_Save_Value *p = XSAVE_VALUE (arg); Widget dialog = (Widget) p->pointer; @@ -5345,7 +5424,11 @@ DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, doc: /* Read file name, prompting with PROMPT in directory DIR. Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file selection box, if specified. If MUSTMATCH is non-nil, the returned file -or directory must exist. ONLY-DIR-P is ignored." */) +or directory must exist. + +This function is only defined on MS Windows, and X Windows with the +Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. +Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) { int result; @@ -5514,8 +5597,11 @@ DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, doc: /* Read file name, prompting with PROMPT in directory DIR. Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file selection box, if specified. If MUSTMATCH is non-nil, the returned file -or directory must exist. If ONLY-DIR-P is non-nil, the user can only select -directories. */) +or directory must exist. + +This function is only defined on MS Windows, and X Windows with the +Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. +Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) { FRAME_PTR f = SELECTED_FRAME (); @@ -6019,5 +6105,3 @@ When using Gtk+ tooltips, the tooltip face is not used. */); #endif /* HAVE_X_WINDOWS */ -/* arch-tag: 55040d02-5485-4d58-8b22-95a7a05f3288 - (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/>. */ #include "blockinput.h" #include "character.h" #include "charset.h" +#include "composite.h" #include "fontset.h" #include "font.h" #include "ftfont.h" @@ -664,6 +665,23 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_b return len; } +Lisp_Object +xftfont_shape (Lisp_Object lgstring) +{ + struct font *font; + struct xftfont_info *xftfont_info; + FT_Face ft_face; + Lisp_Object val; + + CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); + xftfont_info = (struct xftfont_info *) font; + ft_face = XftLockFace (xftfont_info->xftfont); + xftfont_info->ft_size = ft_face->size; + val = ftfont_driver.shape (lgstring); + XftUnlockFace (xftfont_info->xftfont); + return val; +} + static int xftfont_end_for_frame (FRAME_PTR f) { @@ -753,6 +771,9 @@ syms_of_xftfont (void) xftfont_driver.draw = xftfont_draw; xftfont_driver.end_for_frame = xftfont_end_for_frame; xftfont_driver.cached_font_ok = xftfont_cached_font_ok; +#if defined (HAVE_M17N_FLT) && defined (HAVE_LIBOTF) + xftfont_driver.shape = xftfont_shape; +#endif register_font_driver (&xftfont_driver, NULL); } 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/>. */ #include <X11/Xaw/Paned.h> #endif /* HAVE_XAW3D */ #endif /* USE_LUCID */ +#ifdef USE_MOTIF +#include "../lwlib/lwlib.h" +#endif #else /* not USE_X_TOOLKIT */ #ifndef USE_GTK #include "../oldXMenu/XMenu.h" @@ -2532,13 +2535,16 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, #endif /* HAVE_MENUS */ -/* Detect if a dialog or menu has been posted. */ +#ifndef MSDOS +/* Detect if a dialog or menu has been posted. MSDOS has its own + implementation on msdos.c. */ int popup_activated (void) { return popup_activated_flag; } +#endif /* not MSDOS */ /* The following is used by delayed window autoselection. */ @@ -2577,5 +2583,3 @@ syms_of_xmenu (void) #endif } -/* arch-tag: 92ea573c-398e-496e-ac73-2436f7d63242 - (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) return Fnreverse (result); } - else if (node->type == XML_TEXT_NODE) + else if (node->type == XML_TEXT_NODE || node->type == XML_CDATA_SECTION_NODE) { if (node->content) return build_string (node->content); @@ -105,7 +105,8 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html doc = htmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), bytes, burl, "utf-8", HTML_PARSE_RECOVER|HTML_PARSE_NONET| - HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR); + HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR| + HTML_PARSE_NOBLANKS); else doc = xmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), 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/>. */ #include "lisp.h" +#ifdef USE_MOTIF +/* For Vdouble_click_time. */ +#include "keyboard.h" +#endif + extern char *getenv (const char *); extern 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. */) (Lisp_Object display, Lisp_Object dest, Lisp_Object from, Lisp_Object message_type, Lisp_Object format, Lisp_Object values) { struct x_display_info *dpyinfo = check_x_display_info (display); + + CHECK_STRING (message_type); + x_send_client_event(display, dest, from, + XInternAtom (dpyinfo->display, + SDATA (message_type), + False), + format, values); + + return Qnil; +} + +void +x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, Atom message_type, Lisp_Object format, Lisp_Object values) +{ + struct x_display_info *dpyinfo = check_x_display_info (display); Window wdest; XEvent event; - Lisp_Object cons; - int size; struct frame *f = check_x_frame (from); int to_root; - CHECK_STRING (message_type); CHECK_NUMBER (format); CHECK_CONS (values); @@ -2579,13 +2591,9 @@ are ignored. */) if (wdest == 0) wdest = dpyinfo->root_window; to_root = wdest == dpyinfo->root_window; - for (cons = values, size = 0; CONSP (cons); cons = XCDR (cons), ++size) - ; - BLOCK_INPUT; - event.xclient.message_type - = XInternAtom (dpyinfo->display, SDATA (message_type), False); + event.xclient.message_type = message_type; event.xclient.display = dpyinfo->display; /* Some clients (metacity for example) expects sending window to be here @@ -2610,8 +2618,6 @@ are ignored. */) } x_uncatch_errors (); UNBLOCK_INPUT; - - return Qnil; } 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) #if defined (HAVE_GCONF) && defined (HAVE_XFT) char *s; +#ifdef HAVE_G_TYPE_INIT g_type_init (); +#endif gconf_client = gconf_client_get_default (); s = gconf_client_get_string (gconf_client, SYSTEM_MONO_FONT, NULL); if (s) @@ -656,18 +658,10 @@ init_gconf (void) static void init_xsettings (struct x_display_info *dpyinfo) { - char sel[64]; Display *dpy = dpyinfo->display; BLOCK_INPUT; - sprintf (sel, "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen)); - dpyinfo->Xatom_xsettings_sel = XInternAtom (dpy, sel, False); - dpyinfo->Xatom_xsettings_prop = XInternAtom (dpy, - "_XSETTINGS_SETTINGS", - False); - dpyinfo->Xatom_xsettings_mgr = XInternAtom (dpy, "MANAGER", False); - /* Select events so we can detect client messages sent when selection owner changes. */ 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) XSetClassHint (dpyinfo->display, w, &class_hints); XStoreName (dpyinfo->display, w, class_hints.res_name); - sm_id = XInternAtom (dpyinfo->display, "SM_CLIENT_ID", False); - XChangeProperty (dpyinfo->display, w, sm_id, XA_STRING, 8, PropModeReplace, + XChangeProperty (dpyinfo->display, w, dpyinfo->Xatom_SM_CLIENT_ID, + XA_STRING, 8, PropModeReplace, (unsigned char *)client_id, strlen (client_id)); 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 @@ /* X Communication module for terminals which understand the X protocol. - Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + +Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -46,9 +47,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <sys/types.h> #endif /* makedev */ -#ifdef HAVE_SYS_IOCTL_H #include <sys/ioctl.h> -#endif /* ! defined (HAVE_SYS_IOCTL_H) */ #include "systime.h" @@ -441,7 +440,6 @@ x_display_info_for_display (Display *dpy) } #define OPAQUE 0xffffffff -#define OPACITY "_NET_WM_WINDOW_OPACITY" void x_set_frame_alpha (struct frame *f) @@ -485,7 +483,7 @@ x_set_frame_alpha (struct frame *f) unsigned long n, left; x_catch_errors (dpy); - rc = XGetWindowProperty (dpy, win, XInternAtom(dpy, OPACITY, False), + rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, &data); @@ -503,7 +501,7 @@ x_set_frame_alpha (struct frame *f) } x_catch_errors (dpy); - XChangeProperty (dpy, win, XInternAtom (dpy, OPACITY, False), + XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &opac, 1L); x_uncatch_errors (); @@ -547,22 +545,22 @@ static void x_update_window_begin (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - struct x_display_info *display_info = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); updated_window = w; set_output_cursor (&w->cursor); BLOCK_INPUT; - if (f == display_info->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { /* Don't do highlighting for mouse motion during the update. */ - display_info->mouse_face_defer = 1; + hlinfo->mouse_face_defer = 1; /* If F needs to be redrawn, simply forget about any prior mouse highlighting. */ if (FRAME_GARBAGED_P (f)) - display_info->mouse_face_window = Qnil; + hlinfo->mouse_face_window = Qnil; } UNBLOCK_INPUT; @@ -602,7 +600,7 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1) static void x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) { - struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); if (!w->pseudo_window_p) { @@ -623,9 +621,9 @@ x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritt XTframe_up_to_date to redisplay the mouse highlight. */ if (mouse_face_overwritten_p) { - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; } updated_window = NULL; @@ -639,7 +637,7 @@ static void x_update_end (struct frame *f) { /* Mouse highlight may be displayed again. */ - FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 0; + MOUSE_HL_INFO (f)->mouse_face_defer = 0; #ifndef XFlush BLOCK_INPUT; @@ -658,17 +656,17 @@ XTframe_up_to_date (struct frame *f) { if (FRAME_X_P (f)) { - struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - if (dpyinfo->mouse_face_deferred_gc - || f == dpyinfo->mouse_face_mouse_frame) + if (hlinfo->mouse_face_deferred_gc + || f == hlinfo->mouse_face_mouse_frame) { BLOCK_INPUT; - if (dpyinfo->mouse_face_mouse_frame) - note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, - dpyinfo->mouse_face_mouse_x, - dpyinfo->mouse_face_mouse_y); - dpyinfo->mouse_face_deferred_gc = 0; + if (hlinfo->mouse_face_mouse_frame) + note_mouse_highlight (hlinfo->mouse_face_mouse_frame, + hlinfo->mouse_face_mouse_x, + hlinfo->mouse_face_mouse_y); + hlinfo->mouse_face_deferred_gc = 0; UNBLOCK_INPUT; } } @@ -969,7 +967,7 @@ x_set_mouse_face_gc (struct glyph_string *s) struct face *face; /* What face has to be used last for the mouse face? */ - face_id = FRAME_X_DISPLAY_INFO (s->f)->mouse_face_face_id; + face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id; face = FACE_FROM_ID (s->f, face_id); if (face == NULL) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); @@ -1329,6 +1327,83 @@ x_draw_composite_glyph_string_foreground (struct glyph_string *s) } +/* Draw the foreground of glyph string S for glyphless characters. */ + +static void +x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) +{ + struct glyph *glyph = s->first_glyph; + XChar2b char2b[8]; + int x, i, j; + + /* If first glyph of S has a left box line, start drawing the text + of S to the right of that box line. */ + if (s->face && s->face->box != FACE_NO_BOX + && s->first_glyph->left_box_line_p) + x = s->x + eabs (s->face->box_line_width); + else + x = s->x; + + s->char2b = char2b; + + for (i = 0; i < s->nchars; i++, glyph++) + { + char buf[7], *str = NULL; + int len = glyph->u.glyphless.len; + + if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM) + { + if (len > 0 + && CHAR_TABLE_P (Vglyphless_char_display) + && (CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) + >= 1)) + { + Lisp_Object acronym + = (! glyph->u.glyphless.for_no_font + ? CHAR_TABLE_REF (Vglyphless_char_display, + glyph->u.glyphless.ch) + : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); + if (STRINGP (acronym)) + str = (char *) SDATA (acronym); + } + } + else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE) + { + sprintf ((char *) buf, "%0*X", + glyph->u.glyphless.ch < 0x10000 ? 4 : 6, + glyph->u.glyphless.ch); + str = buf; + } + + if (str) + { + int upper_len = (len + 1) / 2; + unsigned code; + + /* It is assured that all LEN characters in STR is ASCII. */ + for (j = 0; j < len; j++) + { + code = s->font->driver->encode_char (s->font, str[j]); + STORE_XCHAR2B (char2b + j, code >> 8, code & 0xFF); + } + s->font->driver->draw (s, 0, upper_len, + x + glyph->slice.glyphless.upper_xoff, + s->ybase + glyph->slice.glyphless.upper_yoff, + 0); + s->font->driver->draw (s, upper_len, len, + x + glyph->slice.glyphless.lower_xoff, + s->ybase + glyph->slice.glyphless.lower_yoff, + 0); + } + if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) + XDrawRectangle (s->display, s->window, s->gc, + x, s->ybase - glyph->ascent, + glyph->pixel_width - 1, + glyph->ascent + glyph->descent - 1); + x += glyph->pixel_width; + } +} + #ifdef USE_X_TOOLKIT static struct frame *x_frame_of_widget (Widget); @@ -2655,6 +2730,14 @@ x_draw_glyph_string (struct glyph_string *s) x_draw_composite_glyph_string_foreground (s); break; + case GLYPHLESS_GLYPH: + if (s->for_overlaps) + s->background_filled_p = 1; + else + x_draw_glyph_string_background (s, 1); + x_draw_glyphless_glyph_string_foreground (s); + break; + default: abort (); } @@ -5702,6 +5785,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, struct frame *f = NULL; struct coding_system coding; XEvent event = *eventp; + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; *finish = X_EVENT_NORMAL; @@ -6151,12 +6235,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, /* If mouse-highlight is an integer, input clears out mouse highlighting. */ - if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) + if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) && (f == 0 - || !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))) + || !EQ (f->tool_bar_window, hlinfo->mouse_face_window))) { - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_hidden = 1; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_hidden = 1; } #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, f = x_top_window_to_frame (dpyinfo, event.xcrossing.window); if (f) { - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { /* If we move outside the frame, then we're certainly no longer on any text in the frame. */ - clear_mouse_face (dpyinfo); - dpyinfo->mouse_face_mouse_frame = 0; + clear_mouse_face (hlinfo); + hlinfo->mouse_face_mouse_frame = 0; } /* 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, else f = x_window_to_frame (dpyinfo, event.xmotion.window); - if (dpyinfo->mouse_face_hidden) + if (hlinfo->mouse_face_hidden) { - dpyinfo->mouse_face_hidden = 0; - clear_mouse_face (dpyinfo); + hlinfo->mouse_face_hidden = 0; + clear_mouse_face (hlinfo); } #ifdef USE_GTK @@ -6572,7 +6656,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, window = window_from_coordinates (f, event.xmotion.x, event.xmotion.y, - 0, 0, 0, 0); + 0, 0); /* Window will be selected only when it is not selected now and 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, /* If we move outside the frame, then we're certainly no longer on any text in the frame. */ - clear_mouse_face (dpyinfo); + clear_mouse_face (hlinfo); } /* 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, int x = event.xbutton.x; int y = event.xbutton.y; - window = window_from_coordinates (f, x, y, 0, 0, 0, 1); + window = window_from_coordinates (f, x, y, 0, 1); tool_bar_p = EQ (window, f->tool_bar_window); if (tool_bar_p && event.xbutton.button < 4) @@ -7669,44 +7753,43 @@ x_connection_closed (Display *dpy, const char *error_message) delete_frame (frame, Qnoelisp); } - /* We have to close the display to inform Xt that it doesn't - exist anymore. If we don't, Xt will continue to wait for - events from the display. As a consequence, a sequence of - - M-x make-frame-on-display RET :1 RET - ...kill the new frame, so that we get an IO error... - M-x make-frame-on-display RET :1 RET - - will indefinitely wait in Xt for events for display `:1', opened - in the first call to make-frame-on-display. - - Closing the display is reported to lead to a bus error on - OpenWindows in certain situations. I suspect that is a bug - in OpenWindows. I don't know how to circumvent it here. */ - + /* If DPYINFO is null, this means we didn't open the display in the + first place, so don't try to close it. */ if (dpyinfo) { #ifdef USE_X_TOOLKIT - /* If DPYINFO is null, this means we didn't open the display - in the first place, so don't try to close it. */ - { - fatal_error_signal_hook = x_fatal_error_signal; - XtCloseDisplay (dpy); - fatal_error_signal_hook = NULL; - } -#endif + /* We have to close the display to inform Xt that it doesn't + exist anymore. If we don't, Xt will continue to wait for + events from the display. As a consequence, a sequence of + + M-x make-frame-on-display RET :1 RET + ...kill the new frame, so that we get an IO error... + M-x make-frame-on-display RET :1 RET + + will indefinitely wait in Xt for events for display `:1', + opened in the first call to make-frame-on-display. + + Closing the display is reported to lead to a bus error on + OpenWindows in certain situations. I suspect that is a bug + in OpenWindows. I don't know how to circumvent it here. */ + fatal_error_signal_hook = x_fatal_error_signal; + XtCloseDisplay (dpy); + fatal_error_signal_hook = NULL; +#endif /* USE_X_TOOLKIT */ #ifdef USE_GTK - /* Due to bugs in some Gtk+ versions, just exit here if this - is the last display/terminal. */ - if (terminal_list->next_terminal == NULL) - { - fprintf (stderr, "%s\n", error_msg); - Fkill_emacs (make_number (70)); - /* NOTREACHED */ - } - xg_display_close (dpyinfo->display); -#endif + /* A long-standing GTK bug prevents proper disconnect handling + (https://bugzilla.gnome.org/show_bug.cgi?id=85715). Once, + the resulting Glib error message loop filled a user's disk. + To avoid this, kill Emacs unconditionally on disconnect. */ + shut_down_emacs (0, 0, Qnil); + fprintf (stderr, "%s\n\ +When compiled with GTK, Emacs cannot recover from X disconnects.\n\ +This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715\n\ +For details, see etc/PROBLEMS.\n", + error_msg); + abort (); +#endif /* USE_GTK */ /* Indicate that this display is dead. */ dpyinfo->display = 0; @@ -8199,12 +8282,11 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_ http://freedesktop.org/wiki/Specifications/wm-spec. */ static int -wm_supports (struct frame *f, const char *atomname) +wm_supports (struct frame *f, Atom want_atom) { Atom actual_type; unsigned long actual_size, bytes_remaining; int i, rc, actual_format; - Atom prop_atom; Window wmcheck_window; struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Window target_window = dpyinfo->root_window; @@ -8212,15 +8294,13 @@ wm_supports (struct frame *f, const char *atomname) Display *dpy = FRAME_X_DISPLAY (f); unsigned char *tmp_data = NULL; Atom target_type = XA_WINDOW; - Atom want_atom; BLOCK_INPUT; - prop_atom = XInternAtom (dpy, "_NET_SUPPORTING_WM_CHECK", False); - x_catch_errors (dpy); rc = XGetWindowProperty (dpy, target_window, - prop_atom, 0, max_len, False, target_type, + dpyinfo->Xatom_net_supporting_wm_check, + 0, max_len, False, target_type, &actual_type, &actual_format, &actual_size, &bytes_remaining, &tmp_data); @@ -8255,10 +8335,10 @@ wm_supports (struct frame *f, const char *atomname) dpyinfo->net_supported_window = 0; target_type = XA_ATOM; - prop_atom = XInternAtom (dpy, "_NET_SUPPORTED", False); tmp_data = NULL; rc = XGetWindowProperty (dpy, target_window, - prop_atom, 0, max_len, False, target_type, + dpyinfo->Xatom_net_supported, + 0, max_len, False, target_type, &actual_type, &actual_format, &actual_size, &bytes_remaining, &tmp_data); @@ -8276,7 +8356,6 @@ wm_supports (struct frame *f, const char *atomname) } rc = 0; - want_atom = XInternAtom (dpy, atomname, False); for (i = 0; rc == 0 && i < dpyinfo->nr_net_supported_atoms; ++i) rc = dpyinfo->net_supported_atoms[i] == want_atom; @@ -8288,31 +8367,33 @@ wm_supports (struct frame *f, const char *atomname) } static void -set_wm_state (Lisp_Object frame, int add, const char *what, const char *what2) +set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value) { - const char *atom = "_NET_WM_STATE"; - Fx_send_client_event (frame, make_number (0), frame, - make_unibyte_string (atom, strlen (atom)), - make_number (32), - /* 1 = add, 0 = remove */ + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (frame)); + + x_send_client_event (frame, make_number (0), frame, + dpyinfo->Xatom_net_wm_state, + make_number (32), + /* 1 = add, 0 = remove */ + Fcons + (make_number (add ? 1 : 0), Fcons - (make_number (add ? 1 : 0), - Fcons - (make_unibyte_string (what, strlen (what)), - what2 != 0 - ? Fcons (make_unibyte_string (what2, strlen (what2)), - Qnil) - : Qnil))); + (make_fixnum_or_float (atom), + value != 0 + ? Fcons (make_fixnum_or_float (value), Qnil) + : Qnil))); } void x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { Lisp_Object frame; + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); XSETFRAME (frame, f); + set_wm_state (frame, NILP (new_value) ? 0 : 1, - "_NET_WM_STATE_STICKY", NULL); + dpyinfo->Xatom_net_wm_state_sticky, None); } /* Return the current _NET_WM_STATE. @@ -8320,7 +8401,7 @@ x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) STICKY is set to 1 if the sticky state is set, 0 if not. */ static void -get_current_vm_state (struct frame *f, +get_current_wm_state (struct frame *f, Window window, int *size_state, int *sticky) @@ -8371,7 +8452,7 @@ get_current_vm_state (struct frame *f, else *size_state = FULLSCREEN_HEIGHT; } - else if (a == dpyinfo->Xatom_net_wm_state_fullscreen_atom) + else if (a == dpyinfo->Xatom_net_wm_state_fullscreen) *size_state = FULLSCREEN_BOTH; else if (a == dpyinfo->Xatom_net_wm_state_sticky) *sticky = 1; @@ -8386,23 +8467,21 @@ get_current_vm_state (struct frame *f, static int do_ewmh_fullscreen (struct frame *f) { - int have_net_atom = wm_supports (f, "_NET_WM_STATE"); + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + int have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state); Lisp_Object lval = get_frame_param (f, Qfullscreen); int cur, dummy; - get_current_vm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy); + get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy); /* Some window managers don't say they support _NET_WM_STATE, but they do say they support _NET_WM_STATE_FULLSCREEN. Try that also. */ if (!have_net_atom) - have_net_atom = wm_supports (f, "_NET_WM_STATE_FULLSCREEN"); + have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen); if (have_net_atom && cur != f->want_fullscreen) { Lisp_Object frame; - const char *fs = "_NET_WM_STATE_FULLSCREEN"; - const char *fw = "_NET_WM_STATE_MAXIMIZED_HORZ"; - const char *fh = "_NET_WM_STATE_MAXIMIZED_VERT"; XSETFRAME (frame, f); @@ -8414,33 +8493,38 @@ do_ewmh_fullscreen (struct frame *f) case FULLSCREEN_BOTH: if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED || cur == FULLSCREEN_HEIGHT) - set_wm_state (frame, 0, fw, fh); - set_wm_state (frame, 1, fs, NULL); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz, + dpyinfo->Xatom_net_wm_state_maximized_vert); + set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_fullscreen, None); break; case FULLSCREEN_WIDTH: if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT || cur == FULLSCREEN_MAXIMIZED) - set_wm_state (frame, 0, fs, fh); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, + dpyinfo->Xatom_net_wm_state_maximized_vert); if (cur != FULLSCREEN_MAXIMIZED) - set_wm_state (frame, 1, fw, NULL); + set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, None); break; case FULLSCREEN_HEIGHT: if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED) - set_wm_state (frame, 0, fs, fw); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, + dpyinfo->Xatom_net_wm_state_maximized_horz); if (cur != FULLSCREEN_MAXIMIZED) - set_wm_state (frame, 1, fh, NULL); + set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_vert, None); break; case FULLSCREEN_MAXIMIZED: if (cur == FULLSCREEN_BOTH) - set_wm_state (frame, 0, fs, NULL); - set_wm_state (frame, 1, fw, fh); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None); + set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, + dpyinfo->Xatom_net_wm_state_maximized_vert); break; case FULLSCREEN_NONE: if (cur == FULLSCREEN_BOTH) - set_wm_state (frame, 0, fs, NULL); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None); else - set_wm_state (frame, 0, fw, fh); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz, + dpyinfo->Xatom_net_wm_state_maximized_vert); } f->want_fullscreen = FULLSCREEN_NONE; @@ -8470,7 +8554,7 @@ x_handle_net_wm_state (struct frame *f, XPropertyEvent *event) Lisp_Object lval; int sticky = 0; - get_current_vm_state (f, event->window, &value, &sticky); + get_current_wm_state (f, event->window, &value, &sticky); lval = Qnil; switch (value) { @@ -8880,17 +8964,17 @@ x_ewmh_activate_frame (FRAME_PTR f) /* See Window Manager Specification/Extended Window Manager Hints at http://freedesktop.org/wiki/Specifications/wm-spec */ - const char *atom = "_NET_ACTIVE_WINDOW"; - if (f->async_visible && wm_supports (f, atom)) + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + if (f->async_visible && wm_supports (f, dpyinfo->Xatom_net_active_window)) { Lisp_Object frame; XSETFRAME (frame, f); - Fx_send_client_event (frame, make_number (0), frame, - make_unibyte_string (atom, strlen (atom)), - make_number (32), - Fcons (make_number (1), - Fcons (make_number (last_user_time), - Qnil))); + x_send_client_event (frame, make_number (0), frame, + dpyinfo->Xatom_net_active_window, + make_number (32), + Fcons (make_number (1), + Fcons (make_number (last_user_time), + Qnil))); } } @@ -8910,13 +8994,13 @@ xembed_set_info (struct frame *f, enum xembed_info flags) { Atom atom; unsigned long data[2]; - - atom = XInternAtom (FRAME_X_DISPLAY (f), "_XEMBED_INFO", False); + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); data[0] = XEMBED_VERSION; data[1] = flags; - XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), atom, atom, + XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), + dpyinfo->Xatom_XEMBED_INFO, dpyinfo->Xatom_XEMBED_INFO, 32, PropModeReplace, (unsigned char *) data, 2); } @@ -9300,6 +9384,7 @@ x_free_frame_resources (struct frame *f) struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Lisp_Object bar; struct scroll_bar *b; + Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; BLOCK_INPUT; @@ -9393,15 +9478,15 @@ x_free_frame_resources (struct frame *f) if (f == dpyinfo->x_highlight_frame) dpyinfo->x_highlight_frame = 0; - if (f == dpyinfo->mouse_face_mouse_frame) + if (f == hlinfo->mouse_face_mouse_frame) { - dpyinfo->mouse_face_beg_row - = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row - = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_deferred_gc = 0; - dpyinfo->mouse_face_mouse_frame = 0; + hlinfo->mouse_face_beg_row + = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row + = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_deferred_gc = 0; + hlinfo->mouse_face_mouse_frame = 0; } UNBLOCK_INPUT; @@ -9778,6 +9863,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) struct terminal *terminal; struct x_display_info *dpyinfo; XrmDatabase xrdb; + Mouse_HLInfo *hlinfo; BLOCK_INPUT; @@ -9908,6 +9994,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info)); memset (dpyinfo, 0, sizeof *dpyinfo); + hlinfo = &dpyinfo->mouse_highlight; terminal = x_create_terminal (dpyinfo); @@ -10030,16 +10117,16 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo->bitmaps_size = 0; dpyinfo->bitmaps_last = 0; dpyinfo->scratch_cursor_gc = 0; - dpyinfo->mouse_face_mouse_frame = 0; - dpyinfo->mouse_face_deferred_gc = 0; - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_overlay = Qnil; - dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; - dpyinfo->mouse_face_defer = 0; - dpyinfo->mouse_face_hidden = 0; + hlinfo->mouse_face_mouse_frame = 0; + hlinfo->mouse_face_deferred_gc = 0; + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; + hlinfo->mouse_face_window = Qnil; + hlinfo->mouse_face_overlay = Qnil; + hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0; + hlinfo->mouse_face_defer = 0; + hlinfo->mouse_face_hidden = 0; dpyinfo->x_focus_frame = 0; dpyinfo->x_focus_event_frame = 0; dpyinfo->x_highlight_frame = 0; @@ -10107,88 +10194,97 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm; } - dpyinfo->Xatom_wm_protocols - = XInternAtom (dpyinfo->display, "WM_PROTOCOLS", False); - dpyinfo->Xatom_wm_take_focus - = XInternAtom (dpyinfo->display, "WM_TAKE_FOCUS", False); - dpyinfo->Xatom_wm_save_yourself - = XInternAtom (dpyinfo->display, "WM_SAVE_YOURSELF", False); - dpyinfo->Xatom_wm_delete_window - = XInternAtom (dpyinfo->display, "WM_DELETE_WINDOW", False); - dpyinfo->Xatom_wm_change_state - = XInternAtom (dpyinfo->display, "WM_CHANGE_STATE", False); - dpyinfo->Xatom_wm_configure_denied - = XInternAtom (dpyinfo->display, "WM_CONFIGURE_DENIED", False); - dpyinfo->Xatom_wm_window_moved - = XInternAtom (dpyinfo->display, "WM_MOVED", False); - dpyinfo->Xatom_wm_client_leader - = XInternAtom (dpyinfo->display, "WM_CLIENT_LEADER", False); - dpyinfo->Xatom_editres - = XInternAtom (dpyinfo->display, "Editres", False); - dpyinfo->Xatom_CLIPBOARD - = XInternAtom (dpyinfo->display, "CLIPBOARD", False); - dpyinfo->Xatom_TIMESTAMP - = XInternAtom (dpyinfo->display, "TIMESTAMP", False); - dpyinfo->Xatom_TEXT - = XInternAtom (dpyinfo->display, "TEXT", False); - dpyinfo->Xatom_COMPOUND_TEXT - = XInternAtom (dpyinfo->display, "COMPOUND_TEXT", False); - dpyinfo->Xatom_UTF8_STRING - = XInternAtom (dpyinfo->display, "UTF8_STRING", False); - dpyinfo->Xatom_DELETE - = XInternAtom (dpyinfo->display, "DELETE", False); - dpyinfo->Xatom_MULTIPLE - = XInternAtom (dpyinfo->display, "MULTIPLE", False); - dpyinfo->Xatom_INCR - = XInternAtom (dpyinfo->display, "INCR", False); - dpyinfo->Xatom_EMACS_TMP - = XInternAtom (dpyinfo->display, "_EMACS_TMP_", False); - dpyinfo->Xatom_TARGETS - = XInternAtom (dpyinfo->display, "TARGETS", False); - dpyinfo->Xatom_NULL - = XInternAtom (dpyinfo->display, "NULL", False); - dpyinfo->Xatom_ATOM_PAIR - = XInternAtom (dpyinfo->display, "ATOM_PAIR", False); - /* For properties of font. */ - dpyinfo->Xatom_PIXEL_SIZE - = XInternAtom (dpyinfo->display, "PIXEL_SIZE", False); - dpyinfo->Xatom_AVERAGE_WIDTH - = XInternAtom (dpyinfo->display, "AVERAGE_WIDTH", False); - dpyinfo->Xatom_MULE_BASELINE_OFFSET - = XInternAtom (dpyinfo->display, "_MULE_BASELINE_OFFSET", False); - dpyinfo->Xatom_MULE_RELATIVE_COMPOSE - = XInternAtom (dpyinfo->display, "_MULE_RELATIVE_COMPOSE", False); - dpyinfo->Xatom_MULE_DEFAULT_ASCENT - = XInternAtom (dpyinfo->display, "_MULE_DEFAULT_ASCENT", False); + { + const struct + { + const char *name; + Atom *atom; + } atom_refs[] = { + { "WM_PROTOCOLS", &dpyinfo->Xatom_wm_protocols }, + { "WM_TAKE_FOCUS", &dpyinfo->Xatom_wm_take_focus }, + { "WM_SAVE_YOURSELF", &dpyinfo->Xatom_wm_save_yourself }, + { "WM_DELETE_WINDOW", &dpyinfo->Xatom_wm_delete_window }, + { "WM_CHANGE_STATE", &dpyinfo->Xatom_wm_change_state }, + { "WM_CONFIGURE_DENIED", &dpyinfo->Xatom_wm_configure_denied }, + { "WM_MOVED", &dpyinfo->Xatom_wm_window_moved }, + { "WM_CLIENT_LEADER", &dpyinfo->Xatom_wm_client_leader }, + { "Editres", &dpyinfo->Xatom_editres }, + { "CLIPBOARD", &dpyinfo->Xatom_CLIPBOARD }, + { "TIMESTAMP", &dpyinfo->Xatom_TIMESTAMP }, + { "TEXT", &dpyinfo->Xatom_TEXT }, + { "COMPOUND_TEXT", &dpyinfo->Xatom_COMPOUND_TEXT }, + { "UTF8_STRING", &dpyinfo->Xatom_UTF8_STRING }, + { "DELETE", &dpyinfo->Xatom_DELETE }, + { "MULTIPLE", &dpyinfo->Xatom_MULTIPLE }, + { "INCR", &dpyinfo->Xatom_INCR }, + { "_EMACS_TMP_", &dpyinfo->Xatom_EMACS_TMP }, + { "TARGETS", &dpyinfo->Xatom_TARGETS }, + { "NULL", &dpyinfo->Xatom_NULL }, + { "ATOM_PAIR", &dpyinfo->Xatom_ATOM_PAIR }, + { "_XEMBED_INFO", &dpyinfo->Xatom_XEMBED_INFO }, + /* For properties of font. */ + { "PIXEL_SIZE", &dpyinfo->Xatom_PIXEL_SIZE }, + { "AVERAGE_WIDTH", &dpyinfo->Xatom_AVERAGE_WIDTH }, + { "_MULE_BASELINE_OFFSET", &dpyinfo->Xatom_MULE_BASELINE_OFFSET }, + { "_MULE_RELATIVE_COMPOSE", &dpyinfo->Xatom_MULE_RELATIVE_COMPOSE }, + { "_MULE_DEFAULT_ASCENT", &dpyinfo->Xatom_MULE_DEFAULT_ASCENT }, + /* Ghostscript support. */ + { "DONE", &dpyinfo->Xatom_DONE }, + { "PAGE", &dpyinfo->Xatom_PAGE }, + { "SCROLLBAR", &dpyinfo->Xatom_Scrollbar }, + { "_XEMBED", &dpyinfo->Xatom_XEMBED }, + /* EWMH */ + { "_NET_WM_STATE", &dpyinfo->Xatom_net_wm_state }, + { "_NET_WM_STATE_FULLSCREEN", &dpyinfo->Xatom_net_wm_state_fullscreen }, + { "_NET_WM_STATE_MAXIMIZED_HORZ", + &dpyinfo->Xatom_net_wm_state_maximized_horz }, + { "_NET_WM_STATE_MAXIMIZED_VERT", + &dpyinfo->Xatom_net_wm_state_maximized_vert }, + { "_NET_WM_STATE_STICKY", &dpyinfo->Xatom_net_wm_state_sticky }, + { "_NET_WM_WINDOW_TYPE", &dpyinfo->Xatom_net_window_type }, + { "_NET_WM_WINDOW_TYPE_TOOLTIP", + &dpyinfo->Xatom_net_window_type_tooltip }, + { "_NET_WM_ICON_NAME", &dpyinfo->Xatom_net_wm_icon_name }, + { "_NET_WM_NAME", &dpyinfo->Xatom_net_wm_name }, + { "_NET_SUPPORTED", &dpyinfo->Xatom_net_supported }, + { "_NET_SUPPORTING_WM_CHECK", &dpyinfo->Xatom_net_supporting_wm_check }, + { "_NET_WM_WINDOW_OPACITY", &dpyinfo->Xatom_net_wm_window_opacity }, + { "_NET_ACTIVE_WINDOW", &dpyinfo->Xatom_net_active_window }, + { "_NET_FRAME_EXTENTS", &dpyinfo->Xatom_net_frame_extents }, + /* Session management */ + { "SM_CLIENT_ID", &dpyinfo->Xatom_SM_CLIENT_ID }, + { "_XSETTINGS_SETTINGS", &dpyinfo->Xatom_xsettings_prop }, + { "MANAGER", &dpyinfo->Xatom_xsettings_mgr }, + }; + + int i; + const int atom_count = sizeof (atom_refs) / sizeof (atom_refs[0]); + /* 1 for _XSETTINGS_SN */ + const int total_atom_count = 1 + atom_count; + Atom *atoms_return = xmalloc (sizeof (Atom) * total_atom_count); + char **atom_names = xmalloc (sizeof (char *) * total_atom_count); + char xsettings_atom_name[64]; + + for (i = 0; i < atom_count; i++) + atom_names[i] = (char *) atom_refs[i].name; - /* Ghostscript support. */ - dpyinfo->Xatom_PAGE = XInternAtom (dpyinfo->display, "PAGE", False); - dpyinfo->Xatom_DONE = XInternAtom (dpyinfo->display, "DONE", False); + /* Build _XSETTINGS_SN atom name */ + snprintf (xsettings_atom_name, sizeof (xsettings_atom_name), + "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen)); + atom_names[i] = xsettings_atom_name; - dpyinfo->Xatom_Scrollbar = XInternAtom (dpyinfo->display, "SCROLLBAR", - False); + XInternAtoms (dpyinfo->display, atom_names, total_atom_count, + False, atoms_return); - dpyinfo->Xatom_XEMBED = XInternAtom (dpyinfo->display, "_XEMBED", - False); + for (i = 0; i < atom_count; i++) + *atom_refs[i].atom = atoms_return[i]; - dpyinfo->Xatom_net_wm_state - = XInternAtom (dpyinfo->display, "_NET_WM_STATE", False); - dpyinfo->Xatom_net_wm_state_fullscreen_atom - = XInternAtom (dpyinfo->display, "_NET_WM_STATE_FULLSCREEN", False); - dpyinfo->Xatom_net_wm_state_maximized_horz - = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); - dpyinfo->Xatom_net_wm_state_maximized_vert - = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_VERT", False); - dpyinfo->Xatom_net_wm_state_sticky - = XInternAtom (dpyinfo->display, "_NET_WM_STATE_STICKY", False); - dpyinfo->Xatom_net_window_type - = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE", False); - dpyinfo->Xatom_net_window_type_tooltip - = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False); - dpyinfo->Xatom_net_wm_icon_name - = XInternAtom (dpyinfo->display, "_NET_WM_ICON_NAME", False); - dpyinfo->Xatom_net_wm_name - = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False); + /* Manual copy of last atom */ + dpyinfo->Xatom_xsettings_sel = atoms_return[i]; + + xfree (atom_names); + xfree (atoms_return); + } dpyinfo->x_dnd_atoms_size = 8; dpyinfo->x_dnd_atoms_length = 0; @@ -10682,9 +10778,11 @@ selected window or cursor position is preserved. */); x_mouse_click_focus_ignore_position = 0; DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, - doc: /* What X toolkit scroll bars Emacs uses. -A value of nil means Emacs doesn't use X toolkit scroll bars. -Otherwise, value is a symbol describing the X toolkit. */); + doc: /* Which toolkit scroll bars Emacs uses, if any. +A value of nil means Emacs doesn't use toolkit scroll bars. +With the X Window system, the value is a symbol describing the +X toolkit. Possible values are: gtk, motif, xaw, or xaw3d. +With MS Windows, the value is t. */); #ifdef USE_TOOLKIT_SCROLL_BARS #ifdef USE_MOTIF Vx_toolkit_scroll_bars = intern_c_string ("motif"); @@ -10750,5 +10848,3 @@ default is nil, which is the same as `super'. */); #endif /* HAVE_X_WINDOWS */ -/* arch-tag: 6d4e4cb7-abc1-4302-9585-d84dcfb09d0f - (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 /* Reusable Graphics Context for drawing a cursor in a non-default face. */ GC scratch_cursor_gc; - /* These variables describe the range of text currently shown in its - mouse-face, together with the window they apply to. As long as - the mouse stays within this range, we need not redraw anything on - its account. Rows and columns are glyph matrix positions in - MOUSE_FACE_WINDOW. */ - int mouse_face_beg_row, mouse_face_beg_col; - int mouse_face_beg_x, mouse_face_beg_y; - int mouse_face_end_row, mouse_face_end_col; - int mouse_face_end_x, mouse_face_end_y; - int mouse_face_past_end; - Lisp_Object mouse_face_window; - int mouse_face_face_id; - Lisp_Object mouse_face_overlay; - - /* 1 if a mouse motion event came and we didn't handle it right away because - gc was in progress. */ - int mouse_face_deferred_gc; - - /* FRAME and X, Y position of mouse when last checked for - highlighting. X and Y can be negative or out of range for the frame. */ - struct frame *mouse_face_mouse_frame; - int mouse_face_mouse_x, mouse_face_mouse_y; - - /* Nonzero means defer mouse-motion highlighting. */ - int mouse_face_defer; - - /* Nonzero means that the mouse highlight should not be shown. */ - int mouse_face_hidden; - - int mouse_face_image_state; + /* Information about the range of text currently shown in + mouse-face. */ + Mouse_HLInfo mouse_highlight; char *x_id_name; @@ -297,7 +270,7 @@ struct x_display_info Atom Xatom_Scrollbar; /* Atom used in XEmbed client messages. */ - Atom Xatom_XEMBED; + Atom Xatom_XEMBED, Xatom_XEMBED_INFO;; /* The frame (if any) which has the X window that has keyboard focus. Zero if none. This is examined by Ffocus_frame in xfns.c. Note @@ -359,15 +332,17 @@ struct x_display_info /* Extended window manager hints, Atoms supported by the window manager and atoms for settig the window type. */ + Atom Xatom_net_supported, Xatom_net_supporting_wm_check; Atom *net_supported_atoms; int nr_net_supported_atoms; Window net_supported_window; Atom Xatom_net_window_type, Xatom_net_window_type_tooltip; + Atom Xatom_net_active_window; - /* Atoms dealing with maximization and fullscreen */ - Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen_atom, + /* Atoms dealing with EWMH (i.e. _NET_...) */ + Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen, Xatom_net_wm_state_maximized_horz, Xatom_net_wm_state_maximized_vert, - Xatom_net_wm_state_sticky; + Xatom_net_wm_state_sticky, Xatom_net_frame_extents; /* XSettings atoms and windows. */ Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr; @@ -375,6 +350,11 @@ struct x_display_info /* Frame name and icon name */ Atom Xatom_net_wm_name, Xatom_net_wm_icon_name; + /* Frame opacity */ + Atom Xatom_net_wm_window_opacity; + + /* SM */ + Atom Xatom_SM_CLIENT_ID; }; #ifdef HAVE_X_I18N @@ -1038,6 +1018,13 @@ extern void x_handle_selection_notify (XSelectionEvent *); extern void x_handle_selection_event (struct input_event *); extern void x_clear_frame_selections (struct frame *); +extern void x_send_client_event (Lisp_Object display, + Lisp_Object dest, + Lisp_Object from, + Atom message_type, + Lisp_Object format, + Lisp_Object values); + extern int x_handle_dnd_message (struct frame *, XClientMessageEvent *, struct x_display_info *, |
