diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/.gdbinit | 21 | ||||
| -rw-r--r-- | src/ChangeLog | 434 | ||||
| -rw-r--r-- | src/ChangeLog.3 | 2 | ||||
| -rw-r--r-- | src/Makefile.in | 32 | ||||
| -rw-r--r-- | src/alloc.c | 17 | ||||
| -rw-r--r-- | src/bidi.c | 14 | ||||
| -rw-r--r-- | src/data.c | 61 | ||||
| -rw-r--r-- | src/dispextern.h | 3 | ||||
| -rw-r--r-- | src/doc.c | 4 | ||||
| -rw-r--r-- | src/emacs.c | 12 | ||||
| -rw-r--r-- | src/epaths.in | 6 | ||||
| -rw-r--r-- | src/eval.c | 485 | ||||
| -rw-r--r-- | src/fileio.c | 10 | ||||
| -rw-r--r-- | src/frame.c | 7 | ||||
| -rw-r--r-- | src/frame.h | 2 | ||||
| -rw-r--r-- | src/gfilenotify.c | 283 | ||||
| -rw-r--r-- | src/keyboard.c | 83 | ||||
| -rw-r--r-- | src/keymap.c | 45 | ||||
| -rw-r--r-- | src/lisp.h | 117 | ||||
| -rw-r--r-- | src/lisp.mk | 1 | ||||
| -rw-r--r-- | src/nsfns.m | 71 | ||||
| -rw-r--r-- | src/nsfont.m | 42 | ||||
| -rw-r--r-- | src/nsimage.m | 4 | ||||
| -rw-r--r-- | src/nsmenu.m | 70 | ||||
| -rw-r--r-- | src/nsselect.m | 3 | ||||
| -rw-r--r-- | src/nsterm.h | 44 | ||||
| -rw-r--r-- | src/nsterm.m | 212 | ||||
| -rw-r--r-- | src/process.c | 44 | ||||
| -rw-r--r-- | src/process.h | 3 | ||||
| -rw-r--r-- | src/profiler.c | 17 | ||||
| -rw-r--r-- | src/puresize.h | 4 | ||||
| -rw-r--r-- | src/syssignal.h | 4 | ||||
| -rw-r--r-- | src/term.c | 9 | ||||
| -rw-r--r-- | src/termhooks.h | 2 | ||||
| -rw-r--r-- | src/w32.c | 2 | ||||
| -rw-r--r-- | src/w32console.c | 16 | ||||
| -rw-r--r-- | src/w32inevt.c | 8 | ||||
| -rw-r--r-- | src/w32notify.c | 2 | ||||
| -rw-r--r-- | src/w32term.c | 7 | ||||
| -rw-r--r-- | src/w32term.h | 2 | ||||
| -rw-r--r-- | src/window.c | 7 | ||||
| -rw-r--r-- | src/xdisp.c | 97 | ||||
| -rw-r--r-- | src/xgselect.c | 15 |
43 files changed, 1626 insertions, 698 deletions
diff --git a/src/.gdbinit b/src/.gdbinit index c4604e6e2b0..1bfc293c466 100644 --- a/src/.gdbinit +++ b/src/.gdbinit | |||
| @@ -1150,17 +1150,18 @@ Print $ assuming it is a list font (font-spec, font-entity, or font-object). | |||
| 1150 | end | 1150 | end |
| 1151 | 1151 | ||
| 1152 | define xbacktrace | 1152 | define xbacktrace |
| 1153 | set $bt = backtrace_list | 1153 | set $bt = backtrace_top () |
| 1154 | while $bt | 1154 | while backtrace_p ($bt) |
| 1155 | xgettype ($bt->function) | 1155 | set $fun = backtrace_function ($bt) |
| 1156 | xgettype $fun | ||
| 1156 | if $type == Lisp_Symbol | 1157 | if $type == Lisp_Symbol |
| 1157 | xprintsym ($bt->function) | 1158 | xprintsym $fun |
| 1158 | printf " (0x%x)\n", $bt->args | 1159 | printf " (0x%x)\n", backtrace_args ($bt) |
| 1159 | else | 1160 | else |
| 1160 | xgetptr $bt->function | 1161 | xgetptr $fun |
| 1161 | printf "0x%x ", $ptr | 1162 | printf "0x%x ", $ptr |
| 1162 | if $type == Lisp_Vectorlike | 1163 | if $type == Lisp_Vectorlike |
| 1163 | xgetptr ($bt->function) | 1164 | xgetptr $fun |
| 1164 | set $size = ((struct Lisp_Vector *) $ptr)->header.size | 1165 | set $size = ((struct Lisp_Vector *) $ptr)->header.size |
| 1165 | if ($size & PSEUDOVECTOR_FLAG) | 1166 | if ($size & PSEUDOVECTOR_FLAG) |
| 1166 | output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_AREA_BITS) | 1167 | output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_AREA_BITS) |
| @@ -1172,7 +1173,7 @@ define xbacktrace | |||
| 1172 | end | 1173 | end |
| 1173 | echo \n | 1174 | echo \n |
| 1174 | end | 1175 | end |
| 1175 | set $bt = $bt->next | 1176 | set $bt = backtrace_next ($bt) |
| 1176 | end | 1177 | end |
| 1177 | end | 1178 | end |
| 1178 | document xbacktrace | 1179 | document xbacktrace |
| @@ -1220,8 +1221,8 @@ end | |||
| 1220 | 1221 | ||
| 1221 | # Show Lisp backtrace after normal backtrace. | 1222 | # Show Lisp backtrace after normal backtrace. |
| 1222 | define hookpost-backtrace | 1223 | define hookpost-backtrace |
| 1223 | set $bt = backtrace_list | 1224 | set $bt = backtrace_top () |
| 1224 | if $bt | 1225 | if backtrace_p ($bt) |
| 1225 | echo \n | 1226 | echo \n |
| 1226 | echo Lisp Backtrace:\n | 1227 | echo Lisp Backtrace:\n |
| 1227 | xbacktrace | 1228 | xbacktrace |
diff --git a/src/ChangeLog b/src/ChangeLog index 4b1281c17e6..38eb460359c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,414 @@ | |||
| 1 | 2013-06-12 Xue Fuqiao <xfq.free@gmail.com> | ||
| 2 | |||
| 3 | * fileio.c (expand_file_name): Doc fix. | ||
| 4 | |||
| 5 | 2013-06-11 Paul Eggert <eggert@cs.ucla.edu> | ||
| 6 | |||
| 7 | Tickle glib by waiting for Emacs itself, not for process 0 (Bug#14569). | ||
| 8 | * process.c (init_process_emacs) [HAVE_GLIB && !WINDOWSNT]: | ||
| 9 | Wait for self, not for 0. This can't hurt on GNU or similar | ||
| 10 | system, and may help with Cygwin. | ||
| 11 | |||
| 12 | * keyboard.c: Don't use PROP (...) as an lvalue. | ||
| 13 | (parse_tool_bar_item) [!USE_GTK && !HAVE_NS]: | ||
| 14 | Use set_prop (A, B), not PROP (A) = B. | ||
| 15 | |||
| 16 | 2013-06-10 Eli Zaretskii <eliz@gnu.org> | ||
| 17 | |||
| 18 | * xdisp.c (get_it_property): Use it->window instead of generating | ||
| 19 | a Lisp object from it->w. | ||
| 20 | |||
| 21 | 2013-06-09 Eli Zaretskii <eliz@gnu.org> | ||
| 22 | |||
| 23 | * xdisp.c (get_it_property): If it->object is a buffer, pass to | ||
| 24 | get-char-property the window that is being rendered, instead of | ||
| 25 | the buffer, to support window-specific overlays. (Bug#14575) | ||
| 26 | (compute_display_string_pos): When W is NULL, use the current | ||
| 27 | buffer as the object to pass to get-char-property. | ||
| 28 | (Fcurrent_bidi_paragraph_direction): Assign NULL to the window | ||
| 29 | pointer member of the bidi iterator, since no window is pertinent | ||
| 30 | to this function. | ||
| 31 | |||
| 32 | 2013-06-08 Eli Zaretskii <eliz@gnu.org> | ||
| 33 | |||
| 34 | * bidi.c (bidi_fetch_char): Accept additional argument, the window | ||
| 35 | being displayed, and pass it to compute_display_string_pos. | ||
| 36 | (bidi_level_of_next_char, bidi_resolve_explicit_1) | ||
| 37 | (bidi_paragraph_init): All callers changed. | ||
| 38 | |||
| 39 | * xdisp.c (init_from_display_pos, init_iterator) | ||
| 40 | (handle_single_display_spec, next_overlay_string) | ||
| 41 | (get_overlay_strings_1, reseat_1, reseat_to_string) | ||
| 42 | (push_prefix_prop, Fcurrent_bidi_paragraph_direction): | ||
| 43 | Set bidi_it.w member from it->w. | ||
| 44 | (compute_display_string_pos): Accept additional argument, the | ||
| 45 | window being displayed, and pass it to Fget_char_property. | ||
| 46 | (Bug#14575) | ||
| 47 | |||
| 48 | * dispextern.h (struct bidi_it): New member w, the window being | ||
| 49 | displayed. | ||
| 50 | (compute_display_string_pos): Adjust prototype. | ||
| 51 | |||
| 52 | 2013-06-08 Jan Djärv <jan.h.d@swipnet.se> | ||
| 53 | |||
| 54 | * xgselect.c: Remove unneeded include xterm.h. | ||
| 55 | |||
| 56 | * process.c (wait_reading_process_output): Check for NS before GLIB. | ||
| 57 | GLIB may be linked in due to rsvg, but ns_select must be called. | ||
| 58 | |||
| 59 | * xgselect.c (xg_select): Remove call to window_system_available | ||
| 60 | and g_main_context_pending at the top, so Gdk events (i.e. file | ||
| 61 | notify) are processed when Emacs is started with -nw. | ||
| 62 | |||
| 63 | 2013-06-07 Eli Zaretskii <eliz@gnu.org> | ||
| 64 | |||
| 65 | * Makefile.in (ctagsfiles1, ctagsfiles2): Don't include *.m files. | ||
| 66 | (ctagsfiles3): New variable, includes only *.m files. | ||
| 67 | (TAGS): Use an explicit language name in the regular expressions, | ||
| 68 | to avoid transformation of '/SOMETHING' by MSYS to | ||
| 69 | 'c:\MSYS\SOMETHING'. | ||
| 70 | |||
| 71 | 2013-06-07 Richard Copley <rcopley@gmail.com> (tiny change) | ||
| 72 | |||
| 73 | * epaths.in: Fix commentary to PATH_SITELOADSEARCH. | ||
| 74 | |||
| 75 | 2013-06-06 Eli Zaretskii <eliz@gnu.org> | ||
| 76 | |||
| 77 | * xdisp.c (note_mouse_highlight): When mouse-highlight is off, | ||
| 78 | still need to set the mouse pointer shape and activate help-echo. | ||
| 79 | (Bug#14558) | ||
| 80 | |||
| 81 | 2013-06-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 82 | |||
| 83 | A few porting etc. fixes for the new file monitor code. | ||
| 84 | See the thread containing | ||
| 85 | <http://lists.gnu.org/archive/html/emacs-devel/2013-06/msg00109.html>. | ||
| 86 | * gfilenotify.c (dir_monitor_callback, Fgfile_add_watch) | ||
| 87 | (Fgfile_rm_watch): Don't assume EMACS_INT is the same width as a pointer. | ||
| 88 | (dir_monitor_callback, Fgfile_rm_watch): | ||
| 89 | Use assq_no_quit instead of Fassoc, for speed. | ||
| 90 | (dir_monitor_callback, Fgfile_rm_watch): | ||
| 91 | eassert that the monitor is a fixnum. | ||
| 92 | (dir_monitor_callback): No need for CDR_SAFE. | ||
| 93 | Simplify building of lisp with alternative tails. | ||
| 94 | (Fgfile_add_watch, Fgfile_rm_watch): | ||
| 95 | Do not assume glib functions set errno reliably on failure. | ||
| 96 | (Fgfile_add_watch): Check that the monitor survives the XIL trick, | ||
| 97 | and signal an error otherwise. | ||
| 98 | (Fgfile_rm_watch): Prefer CONSP to !NILP. | ||
| 99 | Use Fdelq instead of Fdelete, for speed. | ||
| 100 | |||
| 101 | 2013-06-05 Eli Zaretskii <eliz@gnu.org> | ||
| 102 | |||
| 103 | * xdisp.c (handle_tool_bar_click): When mouse-highlight is off, | ||
| 104 | don't insist on being invoked on a highlighted tool-bar button. | ||
| 105 | Avoids losing tool-bar functionality when mouse-highlight is nil. | ||
| 106 | (note_tool_bar_highlight, note_mode_line_or_margin_highlight): | ||
| 107 | Don't highlight when mouse-highlight is nil. | ||
| 108 | (note_mouse_highlight): When mouse-highlight is nil, don't return | ||
| 109 | right away; instead, run tool-bar and mode-line highlight | ||
| 110 | subroutine, clear any existing highlight, and revert the mouse | ||
| 111 | pointer to its default shape. (Bug#14558) | ||
| 112 | |||
| 113 | 2013-06-05 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 114 | |||
| 115 | * lisp.mk (lisp): Add prog-mode.el. | ||
| 116 | |||
| 117 | 2013-06-05 Paul Eggert <eggert@cs.ucla.edu> | ||
| 118 | |||
| 119 | Chain glib's SIGCHLD handler from Emacs's (Bug#14474). | ||
| 120 | * process.c (dummy_handler): New function. | ||
| 121 | (lib_child_handler): New static var. | ||
| 122 | (handle_child_signal): Invoke it. | ||
| 123 | (catch_child_signal): If a library has set up a signal handler, | ||
| 124 | save it into lib_child_handler. | ||
| 125 | (init_process_emacs): If using glib and not on Windows, tickle glib's | ||
| 126 | child-handling code so that it initializes its private SIGCHLD handler. | ||
| 127 | * syssignal.h (SA_SIGINFO): Default to 0. | ||
| 128 | * xterm.c (x_term_init): Remove D-bus hack that I installed on May | ||
| 129 | 31; it should no longer be needed now. | ||
| 130 | |||
| 131 | 2013-06-05 Michael Albinus <michael.albinus@gmx.de> | ||
| 132 | |||
| 133 | * emacs.c (main) [HAVE_GFILENOTIFY]: Call globals_of_gfilenotify. | ||
| 134 | |||
| 135 | * gfilenotify.c (globals_of_gfilenotify): New function. | ||
| 136 | (syms_of_gfilenotify): Move global initialization there. | ||
| 137 | |||
| 138 | * lisp.h (globals_of_gfilenotify) [HAVE_GFILENOTIFY]: Add prototype. | ||
| 139 | |||
| 140 | 2013-06-05 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 141 | |||
| 142 | * keymap.c (Fcurrent_active_maps, Fdescribe_buffer_bindings): | ||
| 143 | * keyboard.c (menu_bar_items, tool_bar_items): | ||
| 144 | * doc.c (Fsubstitute_command_keys): Voverriding_terminal_local_map does | ||
| 145 | not override local keymaps any more. | ||
| 146 | |||
| 147 | 2013-06-04 Eli Zaretskii <eliz@gnu.org> | ||
| 148 | |||
| 149 | * window.c (Fpos_visible_in_window_p): Doc fix. (Bug#14540) | ||
| 150 | |||
| 151 | 2013-06-03 Eli Zaretskii <eliz@gnu.org> | ||
| 152 | |||
| 153 | * w32console.c (initialize_w32_display): Return the dimensions of | ||
| 154 | the console window via 2 additional arguments, not via the current | ||
| 155 | frame. This avoids crashes due to overrunning the bounds of | ||
| 156 | frame's decode_mode_spec_buffer, which is not resized following | ||
| 157 | the change of the frame dimensions from the initial 10x10. | ||
| 158 | |||
| 159 | * w32term.h (w32_initialize_display_info): Adjust prototype. | ||
| 160 | |||
| 161 | * term.c (init_tty): Take dimensions of the frame from the values | ||
| 162 | returned by initialize_w32_display. | ||
| 163 | |||
| 164 | * Makefile.in (GFILENOTIFY_CFLAGS, GFILENOTIFY_LIBS): New variables. | ||
| 165 | (ALL_CFLAGS): Add $(GFILENOTIFY_CFLAGS). | ||
| 166 | (LIBES): Add $(GFILENOTIFY_LIBS). | ||
| 167 | |||
| 168 | * w32inevt.c (handle_file_notifications): Add dummy implementation | ||
| 169 | for !HAVE_W32NOTIFY. | ||
| 170 | |||
| 171 | * w32term.c: Wrap code with HAVE_W32NOTIFY. | ||
| 172 | |||
| 173 | 2013-06-03 Jan Djärv <jan.h.d@swipnet.se> | ||
| 174 | |||
| 175 | * xgselect.c: Replace #if defined ... with #ifdef HAVE_GLIB. | ||
| 176 | |||
| 177 | * process.c (wait_reading_process_output): Call xg_select if HAVE_GLIB. | ||
| 178 | |||
| 179 | * Makefile.in (XGSELOBJ): New, xgselect.o if GLib is used, or empty. | ||
| 180 | |||
| 181 | 2013-06-03 Paul Eggert <eggert@cs.ucla.edu> | ||
| 182 | |||
| 183 | Fix minor problems found by static checking. | ||
| 184 | * data.c (pure_write_error): | ||
| 185 | Use xsignal2, not Fsignal, as Fsignal might return. | ||
| 186 | * eval.c (set_backtrace_debug_on_exit): Now static. | ||
| 187 | (backtrace_p, backtrace_top, backtrace_next, record_in_backtrace): | ||
| 188 | No longer inline. EXTERN_INLINE is needed only for functions | ||
| 189 | defined in .h files. Reindent function header as per GNU style. | ||
| 190 | (backtrace_p, backtrace_top, backtrace_next): | ||
| 191 | Mark EXTERNALLY_VISIBLE so they don't get optimized away by the | ||
| 192 | compiler or linker. Add extern decls to pacify gcc -Wall. | ||
| 193 | * frame.c, frame.h (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): | ||
| 194 | Now static. | ||
| 195 | * frame.c (free_monitors): Define only on platforms that need it. | ||
| 196 | * nsterm.m (ns_term_init): | ||
| 197 | * process.c (catch_child_signal): | ||
| 198 | Don't worry about whether SIGCHLD is defined, as SIGCHLD is | ||
| 199 | defined on all porting targets these days. | ||
| 200 | * process.c, process.h (catch_child_signal): | ||
| 201 | Make it extern only if NS_IMPL_GNUSTEP is defined. | ||
| 202 | |||
| 203 | 2013-06-03 Eli Zaretskii <eliz@gnu.org> | ||
| 204 | |||
| 205 | * w32.c (gettimeofday): Make the signature identical to prototype | ||
| 206 | in nt/inc/sys/time.h. | ||
| 207 | |||
| 208 | 2013-06-03 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 209 | |||
| 210 | * eval.c (backtrace_p, backtrace_top, backtrace_next): Export them to | ||
| 211 | .gdbinit. | ||
| 212 | |||
| 213 | * keyboard.c (safe_run_hooks_error): Improve error message. | ||
| 214 | |||
| 215 | * data.c (pure_write_error): Add `object' argument. | ||
| 216 | * puresize.h (CHECK_IMPURE): Use it. | ||
| 217 | |||
| 218 | 2013-06-03 Michael Albinus <michael.albinus@gmx.de> | ||
| 219 | |||
| 220 | * Makefile.in (NOTIFY_OBJ): New variable. | ||
| 221 | (base_obj): Replace inotify.o by $(NOTIFY_OBJ). | ||
| 222 | |||
| 223 | * emacs.c (main): Use HAVE_W32NOTIFY to wrap respective code. | ||
| 224 | Call syms_of_gfilenotify. | ||
| 225 | |||
| 226 | * gfilenotify.c: New file. | ||
| 227 | |||
| 228 | * keyboard.c (Qfile_notify): New variable. Replaces Qfile_inotify | ||
| 229 | and Qfile_w32notify. | ||
| 230 | (top): Wrap respective code by HAVE_GFILENOTIFY, HAVE_INOTIFY, | ||
| 231 | HAVE_W32NOTIFY and USE_FILE_NOTIFY. | ||
| 232 | |||
| 233 | * lisp.h: Declare syms_of_gfilenotify. | ||
| 234 | |||
| 235 | * termhooks.h (e): Wrap enum by USE_FILE_NOTIFY. | ||
| 236 | |||
| 237 | 2013-06-03 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 238 | |||
| 239 | Merge the specpdl and backtrace stacks. Make the structure of the | ||
| 240 | specpdl entries more obvious via a tagged union of structs. | ||
| 241 | * lisp.h (BITS_PER_PTRDIFF_T): New constant. | ||
| 242 | (enum specbind_tag): New enum. | ||
| 243 | (struct specbinding): Make it a tagged union of structs. | ||
| 244 | Add a case for backtrace records. | ||
| 245 | (specpdl_symbol, specpdl_old_value, specpdl_where, specpdl_arg) | ||
| 246 | (specpdl_func, backtrace_function, backtrace_nargs, backtrace_args) | ||
| 247 | (backtrace_debug_on_exit): New accessors. | ||
| 248 | (struct backtrace): Remove. | ||
| 249 | (struct catchtag): Remove backlist field. | ||
| 250 | * data.c (let_shadows_buffer_binding_p, let_shadows_global_binding_p): | ||
| 251 | Move to eval.c. | ||
| 252 | (Flocal_variable_p): Speed up the common case where the binding is | ||
| 253 | already loaded. | ||
| 254 | * eval.c (backtrace_list): Remove. | ||
| 255 | (set_specpdl_symbol, set_specpdl_old_value): Remove. | ||
| 256 | (set_backtrace_args, set_backtrace_nargs) | ||
| 257 | (set_backtrace_debug_on_exit, backtrace_p, backtrace_top) | ||
| 258 | (backtrace_next): New functions. | ||
| 259 | (Fdefvaralias, Fdefvar): Adjust to new specpdl format. | ||
| 260 | (unwind_to_catch, internal_lisp_condition_case) | ||
| 261 | (internal_condition_case, internal_condition_case_1) | ||
| 262 | (internal_condition_case_2, internal_condition_case_n): Don't bother | ||
| 263 | with backtrace_list any more. | ||
| 264 | (Fsignal): Adjust to new backtrace format. | ||
| 265 | (grow_specpdl): Move up. | ||
| 266 | (record_in_backtrace): New function. | ||
| 267 | (eval_sub, Ffuncall): Use it. | ||
| 268 | (apply_lambda): Adjust to new backtrace format. | ||
| 269 | (let_shadows_buffer_binding_p, let_shadows_global_binding_p): Move from | ||
| 270 | data.c. | ||
| 271 | (specbind): Adjust to new specpdl format. Simplify. | ||
| 272 | (record_unwind_protect, unbind_to): Adjust to new specpdl format. | ||
| 273 | (Fbacktrace_debug, Fbacktrace, Fbacktrace_frame): Adjust to new | ||
| 274 | backtrace format. | ||
| 275 | (mark_backtrace): Remove. | ||
| 276 | (mark_specpdl, get_backtrace, backtrace_top_function): New functions. | ||
| 277 | * xdisp.c (redisplay_internal): Use record_in_backtrace. | ||
| 278 | * alloc.c (Fgarbage_collect): Use record_in_backtrace. | ||
| 279 | Use mark_specpdl. | ||
| 280 | * profiler.c (record_backtrace): Use get_backtrace. | ||
| 281 | (handle_profiler_signal): Use backtrace_top_function. | ||
| 282 | * .gdbinit (xbacktrace, hookpost-backtrace): Use new backtrace | ||
| 283 | accessor functions. | ||
| 284 | |||
| 285 | 2013-06-02 Jan Djärv <jan.h.d@swipnet.se> | ||
| 286 | |||
| 287 | * process.h (catch_child_signal): Declare. | ||
| 288 | |||
| 289 | * process.c (catch_child_signal): New function. | ||
| 290 | (init_process_emacs): Call it. | ||
| 291 | |||
| 292 | * nsterm.m: Include process.h if NS_IMPL_GNUSTEP. | ||
| 293 | (ns_menu_bar_is_hidden, menu_will_open_state): Define only if | ||
| 294 | NS_IMPL_COCOA. | ||
| 295 | (x_set_cursor_type): Remove declaration. | ||
| 296 | (ns_update_begin): Only use r and bp if NS_IMPL_COCOA. | ||
| 297 | (ns_update_end, ns_focus, ns_unfocus): Remove GNUStep specific code. | ||
| 298 | (x_set_window_size): Remove 3 pixels from toolbar if NS_IMPL_GNUSTEP. | ||
| 299 | (ns_get_color): Use F suffix on float. | ||
| 300 | (ns_color_to_lisp, ns_query_color): Use EmacsCGFloat. | ||
| 301 | (ns_get_rgb_color): Remove. | ||
| 302 | (x_set_frame_alpha): Move view inside NS_IMPL_COCOA. | ||
| 303 | (note_mouse_movement): x and y are CGFloat. | ||
| 304 | (ns_draw_fringe_bitmap): Remove unused rowY. | ||
| 305 | Change #if to COCOA && >= 10_6. | ||
| 306 | (ns_draw_window_cursor): Remove unused overspill. | ||
| 307 | (ns_draw_underwave): width and x are EamcsCGFloat. | ||
| 308 | (ns_draw_box): thickness is CGFloat. | ||
| 309 | (ns_dumpglyphs_image): Change #if to COCOA && >= 10_6. | ||
| 310 | (ns_send_appdefined): When NS_IMPL_GNUSTEP, redirect to main thread | ||
| 311 | if not in main thread. | ||
| 312 | (ns_get_pending_menu_title, ns_check_menu_open) | ||
| 313 | (ns_check_pending_open_menu): Put inside #if COCOA && >= 10_5. | ||
| 314 | (ns_term_init): Call catch_child_signal if NS_IMPL_GNUSTEP && SIGCHLD. | ||
| 315 | (sendFromMainThread:): New method. | ||
| 316 | (changeFont:): size is CGFloat. | ||
| 317 | (keyDown:): Check for Delete when NS_IMPL_GNUSTEP. | ||
| 318 | Disable warning about permanent text. | ||
| 319 | (characterIndexForPoint:): Adjust return type depending on GNUStep | ||
| 320 | version. | ||
| 321 | (mouseDown:): delta is CGFloat. | ||
| 322 | (updateFrameSize): Remove unised variable f. | ||
| 323 | (initFrameFromEmacs): Move toggleButton inside NS_IMPL_COCOA. | ||
| 324 | Cast float to EmacsCGFloat. | ||
| 325 | (windowWillUseStandardFrame:defaultFrame:): Set maximized_height | ||
| 326 | also to -1 when restoring. | ||
| 327 | (windowDidExitFullScreen:): Put call to updateCollectionBehaviour | ||
| 328 | inside NS_IMPL_COCOA. | ||
| 329 | (toggleFullScreen:): Put call to toggleFullScreen inside | ||
| 330 | NS_IMPL_COCOA. Cast float to EmacsCGFloat. | ||
| 331 | (setPosition:portion:whole:): por is CGFloat. | ||
| 332 | (getMouseMotionPart:window:x:y:): Add F suffix to float. | ||
| 333 | (mouseDown:): Use CGFloat. | ||
| 334 | (mouseDragged:): Remove unised variable edge. | ||
| 335 | (EmacsDocument): Implement for NS_IMPL_GNUSTEP. | ||
| 336 | |||
| 337 | * nsterm.h (EmacsCGFloat): Typedef for OSX and GNUStep when the size | ||
| 338 | of CGFloat differs. | ||
| 339 | (EmacsApp): New variable nextappdefined. Declare sendFromMainThread | ||
| 340 | when NS_IMPL_GNUSTEP. | ||
| 341 | (EmacsDocument): Declare when NS_IMPL_GNUSTEP. | ||
| 342 | (EmacsView): Remove unlockFocusNeedsFlush, add windowDidMove. | ||
| 343 | (EmacsToolbar): Add clearAll. Add tag argument to | ||
| 344 | addDisplayItemWithImage. | ||
| 345 | (EmacsSavePanel, EmacsOpenPanel): Remove getFilename and getDirectory. | ||
| 346 | |||
| 347 | * nsselect.m (ns_get_local_selection): Remove unused variable type. | ||
| 348 | |||
| 349 | * nsmenu.m (ns_update_menubar): Make static. | ||
| 350 | (x_activate_menubar): Surround with ifdef NS_IMPL_COCOA | ||
| 351 | (fillWithWidgetValue:): Add cast to SEL for setAction. | ||
| 352 | (addSubmenuWithTitle:forFrame:): Add cast to SEL for action. | ||
| 353 | (update_frame_tool_bar): Update code for GNUStep. | ||
| 354 | (clearAll): New method. | ||
| 355 | (addDisplayItemWithImage:idx:tag:helpText:enabled:): Handle new tag | ||
| 356 | argument. Call insertItemWithItemIdentifier when NS_IMPL_GNUSTEP. | ||
| 357 | Move identifierToItem setObject and activeIdentifiers addObject before | ||
| 358 | call to insertItemWithItemIdentifier. | ||
| 359 | (validateVisibleItems): Fix indentation. | ||
| 360 | (toolbarAllowedItemIdentifiers:): Return activeIdentifiers. | ||
| 361 | (initWithContentRect:styleMask:backing:defer:): Add ClosableWindow and | ||
| 362 | UtilityWindow to aStyle, remove call to setStyleMask. | ||
| 363 | |||
| 364 | * nsimage.m (setXBMColor:, getPixelAtX:Y:): Use EmacsCGFloat. | ||
| 365 | |||
| 366 | * nsfont.m (ns_attribute_fvalue, ns_spec_to_descriptor) | ||
| 367 | (ns_charset_covers, ns_get_covering_families, nsfont_open): | ||
| 368 | Use F suffix on floats. | ||
| 369 | (ns_char_width): Returns CGFloat. | ||
| 370 | (ns_ascii_average_width): w is CGFloat instead of float. | ||
| 371 | (nsfont_draw): cbuf and c are unsigned. Cast to char* in call to | ||
| 372 | DPSxshow. | ||
| 373 | (ns_glyph_metrics): CGFloat instead of float. | ||
| 374 | |||
| 375 | * nsfns.m (x_set_foreground_color, x_set_background_color): | ||
| 376 | Use EmacsCGFloat. | ||
| 377 | (ns_implicitly_set_icon_type, Fx_create_frame): Make static, | ||
| 378 | remove unused variables. | ||
| 379 | (Fns_read_file_name): Keep track if panel is for save. | ||
| 380 | Use ns_filename_from_panel/ns_directory_from_panel. | ||
| 381 | (Fns_list_services): delegate only used for COCOA. | ||
| 382 | (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. | ||
| 383 | Just return the input if GNUStep. | ||
| 384 | (x_screen_planes): Remove. | ||
| 385 | (Fxw_color_values): Use EmacsCGFloat | ||
| 386 | (Fns_display_monitor_attributes_list): Only get screen number for | ||
| 387 | Cocoa. | ||
| 388 | (getDirectory, getFilename): Removed from EmacsOpenPanel and | ||
| 389 | EmacsSavePanel. | ||
| 390 | (EmacsOpenPanel:ok:): Use ns_filename_from_panel and | ||
| 391 | ns_directory_from_panel. | ||
| 392 | |||
| 393 | 2013-06-01 Paul Eggert <eggert@cs.ucla.edu> | ||
| 394 | |||
| 395 | * process.c (handle_child_signal): Also use WCONTINUED. | ||
| 396 | This is so that list-processes doesn't mistakenly list the process | ||
| 397 | as stopped, when the process has actually been continued and is | ||
| 398 | now running. | ||
| 399 | |||
| 400 | 2013-05-31 Paul Eggert <eggert@cs.ucla.edu> | ||
| 401 | |||
| 402 | Don't let D-bus autolaunch mess up SIGCHLD handling (Bug#14474). | ||
| 403 | * xterm.c (x_term_init): Inhibit D-Bus autolaunch if D-Bus is | ||
| 404 | not already configured. | ||
| 405 | |||
| 406 | * fileio.c (Finsert_file_contents): Remove unused local (Bug#8447). | ||
| 407 | |||
| 408 | 2013-05-29 Eli Zaretskii <eliz@gnu.org> | ||
| 409 | |||
| 410 | * Makefile.in (mostlyclean): Remove *.res files. | ||
| 411 | |||
| 1 | 2013-05-29 Stefan Monnier <monnier@iro.umontreal.ca> | 412 | 2013-05-29 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 413 | ||
| 3 | * fileio.c (Finsert_file_contents): Preserve undo info when reverting | 414 | * fileio.c (Finsert_file_contents): Preserve undo info when reverting |
| @@ -85,7 +496,7 @@ | |||
| 85 | 2013-05-21 Dmitry Antipov <dmantipov@yandex.ru> | 496 | 2013-05-21 Dmitry Antipov <dmantipov@yandex.ru> |
| 86 | 497 | ||
| 87 | * xdisp.c (reseat_at_previous_visible_line_start): | 498 | * xdisp.c (reseat_at_previous_visible_line_start): |
| 88 | Already declared in dispextern.h, so remove it here. | 499 | Already declared in dispextern.h, so remove it here. |
| 89 | (move_it_vertically_backward): Likewise. | 500 | (move_it_vertically_backward): Likewise. |
| 90 | 501 | ||
| 91 | 2013-05-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 502 | 2013-05-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| @@ -96,7 +507,7 @@ | |||
| 96 | Mention `display-monitor-attributes-list' in docstrings. | 507 | Mention `display-monitor-attributes-list' in docstrings. |
| 97 | 508 | ||
| 98 | * nsfns.m (ns_get_screen): Remove function. All uses removed. | 509 | * nsfns.m (ns_get_screen): Remove function. All uses removed. |
| 99 | (check_ns_display_info): Sync with check_x_display_info in xfns.c. | 510 | (check_ns_display_info): Sync with check_x_display_info in xfns.c. |
| 100 | (Fx_server_max_request_size, Fx_server_vendor, Fx_server_version) | 511 | (Fx_server_max_request_size, Fx_server_vendor, Fx_server_version) |
| 101 | (Fx_display_screens, Fx_display_mm_width, Fx_display_mm_height) | 512 | (Fx_display_screens, Fx_display_mm_width, Fx_display_mm_height) |
| 102 | (Fx_display_backing_store, Fx_display_visual_class) | 513 | (Fx_display_backing_store, Fx_display_visual_class) |
| @@ -252,7 +663,7 @@ | |||
| 252 | 663 | ||
| 253 | 2013-05-07 Paul Eggert <eggert@cs.ucla.edu> | 664 | 2013-05-07 Paul Eggert <eggert@cs.ucla.edu> |
| 254 | 665 | ||
| 255 | Use Gnulib ACL implementation, for benefit of Solaris etc. (Bug#14295) | 666 | Use Gnulib ACL implementation, for benefit of Solaris etc. (Bug#14295) |
| 256 | * Makefile.in (LIB_ACL): New macro. | 667 | * Makefile.in (LIB_ACL): New macro. |
| 257 | (LIBACL_LIBS): Remove. | 668 | (LIBACL_LIBS): Remove. |
| 258 | (LIBES): Use LIB_ACL, not LIBACL_LIBS. | 669 | (LIBES): Use LIB_ACL, not LIBACL_LIBS. |
| @@ -2685,11 +3096,10 @@ | |||
| 2685 | 2012-12-31 Adam Sjøgren <asjo@koldfront.dk> (tiny change) | 3096 | 2012-12-31 Adam Sjøgren <asjo@koldfront.dk> (tiny change) |
| 2686 | 3097 | ||
| 2687 | * xterm.c (scroll-bar-adjust-thumb-portion): New variable to | 3098 | * xterm.c (scroll-bar-adjust-thumb-portion): New variable to |
| 2688 | determine whether scroll bar thumb size should be adjusted or | 3099 | determine whether scroll bar thumb size should be adjusted or not. |
| 2689 | not. Use variable for MOTIF. | 3100 | Use variable for MOTIF. |
| 2690 | 3101 | ||
| 2691 | * gtkutil.c (scroll-bar-adjust-thumb-portion): Use variable for | 3102 | * gtkutil.c (scroll-bar-adjust-thumb-portion): Use variable for GTK. |
| 2692 | GTK. | ||
| 2693 | 3103 | ||
| 2694 | 2013-01-13 Jan Djärv <jan.h.d@swipnet.se> | 3104 | 2013-01-13 Jan Djärv <jan.h.d@swipnet.se> |
| 2695 | 3105 | ||
| @@ -3234,7 +3644,7 @@ | |||
| 3234 | 3644 | ||
| 3235 | 2012-12-14 Paul Eggert <eggert@cs.ucla.edu> | 3645 | 2012-12-14 Paul Eggert <eggert@cs.ucla.edu> |
| 3236 | 3646 | ||
| 3237 | Fix permissions bugs with setgid directories etc. (Bug#13125) | 3647 | Fix permissions bugs with setgid directories etc. (Bug#13125) |
| 3238 | * dired.c (Ffile_attributes): Return t as the 9th attribute, | 3648 | * dired.c (Ffile_attributes): Return t as the 9th attribute, |
| 3239 | to mark it as a placeholder. The old value was often wrong. | 3649 | to mark it as a placeholder. The old value was often wrong. |
| 3240 | The only user of this attribute has been changed to use | 3650 | The only user of this attribute has been changed to use |
| @@ -3534,7 +3944,7 @@ | |||
| 3534 | Use xputenv instead of setenv or putenv, to detect memory exhaustion. | 3944 | Use xputenv instead of setenv or putenv, to detect memory exhaustion. |
| 3535 | * editfns.c (initial_tz): Move static var decl up. | 3945 | * editfns.c (initial_tz): Move static var decl up. |
| 3536 | (tzvalbuf_in_environ): New static var. | 3946 | (tzvalbuf_in_environ): New static var. |
| 3537 | (init_editfns): Initialize these two static vars. | 3947 | (init_editfns): Initialize these two static vars. |
| 3538 | (Fencode_time): Don't assume arbitrary limit on EMACS_INT width. | 3948 | (Fencode_time): Don't assume arbitrary limit on EMACS_INT width. |
| 3539 | Save old TZ value on stack, if it's small. | 3949 | Save old TZ value on stack, if it's small. |
| 3540 | (Fencode_time, set_time_zone_rule): Don't modify 'environ' directly; | 3950 | (Fencode_time, set_time_zone_rule): Don't modify 'environ' directly; |
| @@ -3813,7 +4223,7 @@ | |||
| 3813 | Use execve to avoid need to munge environ (Bug#13054). | 4223 | Use execve to avoid need to munge environ (Bug#13054). |
| 3814 | * callproc.c (Fcall_process): | 4224 | * callproc.c (Fcall_process): |
| 3815 | * process.c (create_process): | 4225 | * process.c (create_process): |
| 3816 | Don't save and restore environ; no longer needed. | 4226 | Don't save and restore environ; no longer needed. |
| 3817 | * callproc.c (child_setup): | 4227 | * callproc.c (child_setup): |
| 3818 | Use execve, not execvp, to preserve environ. | 4228 | Use execve, not execvp, to preserve environ. |
| 3819 | 4229 | ||
| @@ -4335,7 +4745,7 @@ | |||
| 4335 | * w32term.c (x_window_to_scroll_bar): Likewise. | 4745 | * w32term.c (x_window_to_scroll_bar): Likewise. |
| 4336 | * window.c (window_list): Likewise. | 4746 | * window.c (window_list): Likewise. |
| 4337 | * xdisp.c (x_consider_frame_title): Likewise. | 4747 | * xdisp.c (x_consider_frame_title): Likewise. |
| 4338 | * xfaces.c ( Fdisplay_supports_face_attributes_p): Likewise. | 4748 | * xfaces.c (Fdisplay_supports_face_attributes_p): Likewise. |
| 4339 | * xfns.c (x_window_to_frame, x_any_window_to_frame) | 4749 | * xfns.c (x_window_to_frame, x_any_window_to_frame) |
| 4340 | (x_menubar_window_to_frame, x_top_window_to_frame): Likewise. | 4750 | (x_menubar_window_to_frame, x_top_window_to_frame): Likewise. |
| 4341 | * xmenu.c (menubar_id_to_frame): Likewise. | 4751 | * xmenu.c (menubar_id_to_frame): Likewise. |
| @@ -17567,7 +17977,7 @@ | |||
| 17567 | 17977 | ||
| 17568 | Fix memory allocation problems in Cygwin build (Bug#9273). | 17978 | Fix memory allocation problems in Cygwin build (Bug#9273). |
| 17569 | 17979 | ||
| 17570 | * unexcw.c ( __malloc_initialized): Declare external variable. | 17980 | * unexcw.c (__malloc_initialized): Declare external variable. |
| 17571 | (fixup_executable): Force the dumped emacs to reinitialize malloc. | 17981 | (fixup_executable): Force the dumped emacs to reinitialize malloc. |
| 17572 | 17982 | ||
| 17573 | * gmalloc.c [CYGWIN] (bss_sbrk_heapbase, bss_sbrk_heapinfo): | 17983 | * gmalloc.c [CYGWIN] (bss_sbrk_heapbase, bss_sbrk_heapinfo): |
diff --git a/src/ChangeLog.3 b/src/ChangeLog.3 index 2f798e1f0bc..fb1b96f738c 100644 --- a/src/ChangeLog.3 +++ b/src/ChangeLog.3 | |||
| @@ -15447,7 +15447,7 @@ | |||
| 15447 | * xterm.c (XTread_socket_hook): For X11, on map and unmap events | 15447 | * xterm.c (XTread_socket_hook): For X11, on map and unmap events |
| 15448 | check the window manager hints for iconification status. | 15448 | check the window manager hints for iconification status. |
| 15449 | 15449 | ||
| 15450 | * xterm.c (x_make_widow_icon): For X11, just request | 15450 | * xterm.c (x_make_window_icon): For X11, just request |
| 15451 | iconification of the window manager. | 15451 | iconification of the window manager. |
| 15452 | 15452 | ||
| 15453 | 1989-05-08 Richard Stallman (rms@sugar-bombs.ai.mit.edu) | 15453 | 1989-05-08 Richard Stallman (rms@sugar-bombs.ai.mit.edu) |
diff --git a/src/Makefile.in b/src/Makefile.in index bf3c9bf3b6b..8d8133c9e6c 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -156,6 +156,13 @@ SETTINGS_LIBS = @SETTINGS_LIBS@ | |||
| 156 | ## gtkutil.o if USE_GTK, else empty. | 156 | ## gtkutil.o if USE_GTK, else empty. |
| 157 | GTK_OBJ=@GTK_OBJ@ | 157 | GTK_OBJ=@GTK_OBJ@ |
| 158 | 158 | ||
| 159 | ## gfilenotify.o if HAVE_GFILENOTIFY. | ||
| 160 | ## inotify.o if HAVE_INOTIFY. | ||
| 161 | ## w32notify.o if HAVE_W32NOTIFY. | ||
| 162 | NOTIFY_OBJ = @NOTIFY_OBJ@ | ||
| 163 | GFILENOTIFY_CFLAGS = @GFILENOTIFY_CFLAGS@ | ||
| 164 | GFILENOTIFY_LIBS = @GFILENOTIFY_LIBS@ | ||
| 165 | |||
| 159 | ## -ltermcap, or -lncurses, or -lcurses, or "". | 166 | ## -ltermcap, or -lncurses, or -lcurses, or "". |
| 160 | LIBS_TERMCAP=@LIBS_TERMCAP@ | 167 | LIBS_TERMCAP=@LIBS_TERMCAP@ |
| 161 | ## terminfo.o if TERMINFO, else tparam.o. | 168 | ## terminfo.o if TERMINFO, else tparam.o. |
| @@ -200,10 +207,13 @@ LIBXMENU=@LIBXMENU@ | |||
| 200 | 207 | ||
| 201 | ## xmenu.o if HAVE_X_WINDOWS, else empty. | 208 | ## xmenu.o if HAVE_X_WINDOWS, else empty. |
| 202 | XMENU_OBJ=@XMENU_OBJ@ | 209 | XMENU_OBJ=@XMENU_OBJ@ |
| 203 | ## xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o if | 210 | ## xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o if |
| 204 | ## HAVE_X_WINDOWS, else empty. | 211 | ## HAVE_X_WINDOWS, else empty. |
| 205 | XOBJ=@XOBJ@ | 212 | XOBJ=@XOBJ@ |
| 206 | 213 | ||
| 214 | # xgselect.o if linking with GLib, else empty | ||
| 215 | XGSELOBJ=@XGSELOBJ@ | ||
| 216 | |||
| 207 | TOOLKIT_LIBW=@TOOLKIT_LIBW@ | 217 | TOOLKIT_LIBW=@TOOLKIT_LIBW@ |
| 208 | 218 | ||
| 209 | ## Only used if HAVE_X11, in LIBX_OTHER. | 219 | ## Only used if HAVE_X11, in LIBX_OTHER. |
| @@ -347,7 +357,7 @@ ALL_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \ | |||
| 347 | $(WEBKIT_CFLAGS) $(CLUTTER_CFLAGS) $(GIR_CFLAGS) \ | 357 | $(WEBKIT_CFLAGS) $(CLUTTER_CFLAGS) $(GIR_CFLAGS) \ |
| 348 | $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ | 358 | $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ |
| 349 | $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \ | 359 | $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \ |
| 350 | $(LIBGNUTLS_CFLAGS) \ | 360 | $(LIBGNUTLS_CFLAGS) $(GFILENOTIFY_CFLAGS) \ |
| 351 | $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) | 361 | $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) |
| 352 | ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) | 362 | ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) |
| 353 | 363 | ||
| @@ -373,11 +383,11 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ | |||
| 373 | syntax.o $(UNEXEC_OBJ) bytecode.o \ | 383 | syntax.o $(UNEXEC_OBJ) bytecode.o \ |
| 374 | process.o gnutls.o callproc.o \ | 384 | process.o gnutls.o callproc.o \ |
| 375 | region-cache.o sound.o atimer.o \ | 385 | region-cache.o sound.o atimer.o \ |
| 376 | doprnt.o intervals.o textprop.o composite.o xml.o inotify.o \ | 386 | doprnt.o intervals.o textprop.o composite.o xml.o $(NOTIFY_OBJ) \ |
| 377 | xwidget.o \ | 387 | xwidget.o \ |
| 378 | profiler.o \ | 388 | profiler.o \ |
| 379 | $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ | 389 | $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ |
| 380 | $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) | 390 | $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ) |
| 381 | obj = $(base_obj) $(NS_OBJC_OBJ) | 391 | obj = $(base_obj) $(NS_OBJC_OBJ) |
| 382 | 392 | ||
| 383 | xwidget.o: xwidget.c xwidget.h | 393 | xwidget.o: xwidget.c xwidget.h |
| @@ -432,7 +442,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \ | |||
| 432 | $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ | 442 | $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ |
| 433 | $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ | 443 | $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ |
| 434 | $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \ | 444 | $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \ |
| 435 | $(LIB_MATH) | 445 | $(GFILENOTIFY_LIBS) $(LIB_MATH) |
| 436 | 446 | ||
| 437 | all: emacs$(EXEEXT) $(OTHER_FILES) | 447 | all: emacs$(EXEEXT) $(OTHER_FILES) |
| 438 | .PHONY: all | 448 | .PHONY: all |
| @@ -560,6 +570,7 @@ mostlyclean: | |||
| 560 | rm -f bootstrap-emacs$(EXEEXT) emacs-$(version)$(EXEEXT) | 570 | rm -f bootstrap-emacs$(EXEEXT) emacs-$(version)$(EXEEXT) |
| 561 | rm -f buildobj.h | 571 | rm -f buildobj.h |
| 562 | rm -f globals.h gl-stamp | 572 | rm -f globals.h gl-stamp |
| 573 | rm -f *.res | ||
| 563 | clean: mostlyclean | 574 | clean: mostlyclean |
| 564 | rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT) | 575 | rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT) |
| 565 | -rm -rf $(DEPDIR) | 576 | -rm -rf $(DEPDIR) |
| @@ -590,13 +601,16 @@ extraclean: distclean | |||
| 590 | ## Arrange to make a tags table TAGS-LISP for ../lisp, | 601 | ## Arrange to make a tags table TAGS-LISP for ../lisp, |
| 591 | ## plus TAGS for the C files, which includes ../lisp/TAGS by reference. | 602 | ## plus TAGS for the C files, which includes ../lisp/TAGS by reference. |
| 592 | 603 | ||
| 593 | ctagsfiles1 = [xyzXYZ]*.[hcm] | 604 | ctagsfiles1 = [xyzXYZ]*.[hc] |
| 594 | ctagsfiles2 = [a-wA-W]*.[hcm] | 605 | ctagsfiles2 = [a-wA-W]*.[hc] |
| 606 | ctagsfiles3 = [a-zA-Z]*.m | ||
| 595 | 607 | ||
| 596 | TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(S_FILE) | 608 | TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(S_FILE) |
| 597 | ../lib-src/etags --include=TAGS-LISP --include=$(lwlibdir)/TAGS \ | 609 | ../lib-src/etags --include=TAGS-LISP --include=$(lwlibdir)/TAGS \ |
| 598 | --regex='/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ | 610 | --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ |
| 599 | $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(S_FILE) | 611 | $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(S_FILE) \ |
| 612 | --regex='{objc}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ | ||
| 613 | $(srcdir)/$(ctagsfiles3) | ||
| 600 | frc: | 614 | frc: |
| 601 | TAGS-LISP: frc | 615 | TAGS-LISP: frc |
| 602 | $(MAKE) -f $(lispdir)/Makefile TAGS-LISP ETAGS=../lib-src/etags | 616 | $(MAKE) -f $(lispdir)/Makefile TAGS-LISP ETAGS=../lib-src/etags |
diff --git a/src/alloc.c b/src/alloc.c index 7a56c78e2ba..cce0fff4fd4 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -5165,7 +5165,6 @@ returns nil, because real GC can't be done. | |||
| 5165 | See Info node `(elisp)Garbage Collection'. */) | 5165 | See Info node `(elisp)Garbage Collection'. */) |
| 5166 | (void) | 5166 | (void) |
| 5167 | { | 5167 | { |
| 5168 | struct specbinding *bind; | ||
| 5169 | struct buffer *nextb; | 5168 | struct buffer *nextb; |
| 5170 | char stack_top_variable; | 5169 | char stack_top_variable; |
| 5171 | ptrdiff_t i; | 5170 | ptrdiff_t i; |
| @@ -5174,7 +5173,6 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5174 | EMACS_TIME start; | 5173 | EMACS_TIME start; |
| 5175 | Lisp_Object retval = Qnil; | 5174 | Lisp_Object retval = Qnil; |
| 5176 | size_t tot_before = 0; | 5175 | size_t tot_before = 0; |
| 5177 | struct backtrace backtrace; | ||
| 5178 | 5176 | ||
| 5179 | if (abort_on_gc) | 5177 | if (abort_on_gc) |
| 5180 | emacs_abort (); | 5178 | emacs_abort (); |
| @@ -5185,12 +5183,7 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5185 | return Qnil; | 5183 | return Qnil; |
| 5186 | 5184 | ||
| 5187 | /* Record this function, so it appears on the profiler's backtraces. */ | 5185 | /* Record this function, so it appears on the profiler's backtraces. */ |
| 5188 | backtrace.next = backtrace_list; | 5186 | record_in_backtrace (Qautomatic_gc, &Qnil, 0); |
| 5189 | backtrace.function = Qautomatic_gc; | ||
| 5190 | backtrace.args = &Qnil; | ||
| 5191 | backtrace.nargs = 0; | ||
| 5192 | backtrace.debug_on_exit = 0; | ||
| 5193 | backtrace_list = &backtrace; | ||
| 5194 | 5187 | ||
| 5195 | check_cons_list (); | 5188 | check_cons_list (); |
| 5196 | 5189 | ||
| @@ -5257,11 +5250,7 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5257 | for (i = 0; i < staticidx; i++) | 5250 | for (i = 0; i < staticidx; i++) |
| 5258 | mark_object (*staticvec[i]); | 5251 | mark_object (*staticvec[i]); |
| 5259 | 5252 | ||
| 5260 | for (bind = specpdl; bind != specpdl_ptr; bind++) | 5253 | mark_specpdl (); |
| 5261 | { | ||
| 5262 | mark_object (bind->symbol); | ||
| 5263 | mark_object (bind->old_value); | ||
| 5264 | } | ||
| 5265 | mark_terminals (); | 5254 | mark_terminals (); |
| 5266 | mark_kboards (); | 5255 | mark_kboards (); |
| 5267 | 5256 | ||
| @@ -5295,7 +5284,6 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5295 | mark_object (handler->var); | 5284 | mark_object (handler->var); |
| 5296 | } | 5285 | } |
| 5297 | } | 5286 | } |
| 5298 | mark_backtrace (); | ||
| 5299 | #endif | 5287 | #endif |
| 5300 | 5288 | ||
| 5301 | #ifdef HAVE_WINDOW_SYSTEM | 5289 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -5486,7 +5474,6 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5486 | malloc_probe (swept); | 5474 | malloc_probe (swept); |
| 5487 | } | 5475 | } |
| 5488 | 5476 | ||
| 5489 | backtrace_list = backtrace.next; | ||
| 5490 | return retval; | 5477 | return retval; |
| 5491 | } | 5478 | } |
| 5492 | 5479 | ||
diff --git a/src/bidi.c b/src/bidi.c index c6bea62f67b..c31d208ecbc 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -927,6 +927,7 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte) | |||
| 927 | static int | 927 | static int |
| 928 | bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, | 928 | bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, |
| 929 | int *disp_prop, struct bidi_string_data *string, | 929 | int *disp_prop, struct bidi_string_data *string, |
| 930 | struct window *w, | ||
| 930 | bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars) | 931 | bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars) |
| 931 | { | 932 | { |
| 932 | int ch; | 933 | int ch; |
| @@ -940,7 +941,7 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, | |||
| 940 | if (charpos < endpos && charpos > *disp_pos) | 941 | if (charpos < endpos && charpos > *disp_pos) |
| 941 | { | 942 | { |
| 942 | SET_TEXT_POS (pos, charpos, bytepos); | 943 | SET_TEXT_POS (pos, charpos, bytepos); |
| 943 | *disp_pos = compute_display_string_pos (&pos, string, frame_window_p, | 944 | *disp_pos = compute_display_string_pos (&pos, string, w, frame_window_p, |
| 944 | disp_prop); | 945 | disp_prop); |
| 945 | } | 946 | } |
| 946 | 947 | ||
| @@ -1045,7 +1046,7 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, | |||
| 1045 | && *disp_prop) | 1046 | && *disp_prop) |
| 1046 | { | 1047 | { |
| 1047 | SET_TEXT_POS (pos, charpos + *nchars, bytepos + *ch_len); | 1048 | SET_TEXT_POS (pos, charpos + *nchars, bytepos + *ch_len); |
| 1048 | *disp_pos = compute_display_string_pos (&pos, string, frame_window_p, | 1049 | *disp_pos = compute_display_string_pos (&pos, string, w, frame_window_p, |
| 1049 | disp_prop); | 1050 | disp_prop); |
| 1050 | } | 1051 | } |
| 1051 | 1052 | ||
| @@ -1224,7 +1225,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p) | |||
| 1224 | if (!string_p) | 1225 | if (!string_p) |
| 1225 | pos = BYTE_TO_CHAR (bytepos); | 1226 | pos = BYTE_TO_CHAR (bytepos); |
| 1226 | ch = bidi_fetch_char (pos, bytepos, &disp_pos, &disp_prop, | 1227 | ch = bidi_fetch_char (pos, bytepos, &disp_pos, &disp_prop, |
| 1227 | &bidi_it->string, | 1228 | &bidi_it->string, bidi_it->w, |
| 1228 | bidi_it->frame_window_p, &ch_len, &nchars); | 1229 | bidi_it->frame_window_p, &ch_len, &nchars); |
| 1229 | type = bidi_get_type (ch, NEUTRAL_DIR); | 1230 | type = bidi_get_type (ch, NEUTRAL_DIR); |
| 1230 | 1231 | ||
| @@ -1252,7 +1253,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p) | |||
| 1252 | break; | 1253 | break; |
| 1253 | /* Fetch next character and advance to get past it. */ | 1254 | /* Fetch next character and advance to get past it. */ |
| 1254 | ch = bidi_fetch_char (pos, bytepos, &disp_pos, | 1255 | ch = bidi_fetch_char (pos, bytepos, &disp_pos, |
| 1255 | &disp_prop, &bidi_it->string, | 1256 | &disp_prop, &bidi_it->string, bidi_it->w, |
| 1256 | bidi_it->frame_window_p, &ch_len, &nchars); | 1257 | bidi_it->frame_window_p, &ch_len, &nchars); |
| 1257 | pos += nchars; | 1258 | pos += nchars; |
| 1258 | bytepos += ch_len; | 1259 | bytepos += ch_len; |
| @@ -1402,7 +1403,8 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it) | |||
| 1402 | a single character u+FFFC. */ | 1403 | a single character u+FFFC. */ |
| 1403 | curchar = bidi_fetch_char (bidi_it->charpos, bidi_it->bytepos, | 1404 | curchar = bidi_fetch_char (bidi_it->charpos, bidi_it->bytepos, |
| 1404 | &bidi_it->disp_pos, &bidi_it->disp_prop, | 1405 | &bidi_it->disp_pos, &bidi_it->disp_prop, |
| 1405 | &bidi_it->string, bidi_it->frame_window_p, | 1406 | &bidi_it->string, bidi_it->w, |
| 1407 | bidi_it->frame_window_p, | ||
| 1406 | &bidi_it->ch_len, &bidi_it->nchars); | 1408 | &bidi_it->ch_len, &bidi_it->nchars); |
| 1407 | } | 1409 | } |
| 1408 | bidi_it->ch = curchar; | 1410 | bidi_it->ch = curchar; |
| @@ -2194,7 +2196,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) | |||
| 2194 | emacs_abort (); | 2196 | emacs_abort (); |
| 2195 | do { | 2197 | do { |
| 2196 | ch = bidi_fetch_char (cpos += nc, bpos += clen, &disp_pos, &dpp, &bs, | 2198 | ch = bidi_fetch_char (cpos += nc, bpos += clen, &disp_pos, &dpp, &bs, |
| 2197 | fwp, &clen, &nc); | 2199 | bidi_it->w, fwp, &clen, &nc); |
| 2198 | if (ch == '\n' || ch == BIDI_EOB) | 2200 | if (ch == '\n' || ch == BIDI_EOB) |
| 2199 | chtype = NEUTRAL_B; | 2201 | chtype = NEUTRAL_B; |
| 2200 | else | 2202 | else |
diff --git a/src/data.c b/src/data.c index 6622088b648..9f756de014a 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -100,9 +100,9 @@ wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) | |||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | void | 102 | void |
| 103 | pure_write_error (void) | 103 | pure_write_error (Lisp_Object obj) |
| 104 | { | 104 | { |
| 105 | error ("Attempt to modify read-only object"); | 105 | xsignal2 (Qerror, build_string ("Attempt to modify read-only object"), obj); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | void | 108 | void |
| @@ -1069,40 +1069,6 @@ DEFUN ("set", Fset, Sset, 2, 2, 0, | |||
| 1069 | return newval; | 1069 | return newval; |
| 1070 | } | 1070 | } |
| 1071 | 1071 | ||
| 1072 | /* Return true if SYMBOL currently has a let-binding | ||
| 1073 | which was made in the buffer that is now current. */ | ||
| 1074 | |||
| 1075 | static bool | ||
| 1076 | let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol) | ||
| 1077 | { | ||
| 1078 | struct specbinding *p; | ||
| 1079 | |||
| 1080 | for (p = specpdl_ptr; p > specpdl; ) | ||
| 1081 | if ((--p)->func == NULL | ||
| 1082 | && CONSP (p->symbol)) | ||
| 1083 | { | ||
| 1084 | struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol)); | ||
| 1085 | eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS); | ||
| 1086 | if (symbol == let_bound_symbol | ||
| 1087 | && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer) | ||
| 1088 | return 1; | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | return 0; | ||
| 1092 | } | ||
| 1093 | |||
| 1094 | static bool | ||
| 1095 | let_shadows_global_binding_p (Lisp_Object symbol) | ||
| 1096 | { | ||
| 1097 | struct specbinding *p; | ||
| 1098 | |||
| 1099 | for (p = specpdl_ptr; p > specpdl; ) | ||
| 1100 | if ((--p)->func == NULL && EQ (p->symbol, symbol)) | ||
| 1101 | return 1; | ||
| 1102 | |||
| 1103 | return 0; | ||
| 1104 | } | ||
| 1105 | |||
| 1106 | /* Store the value NEWVAL into SYMBOL. | 1072 | /* Store the value NEWVAL into SYMBOL. |
| 1107 | If buffer/frame-locality is an issue, WHERE specifies which context to use. | 1073 | If buffer/frame-locality is an issue, WHERE specifies which context to use. |
| 1108 | (nil stands for the current buffer/frame). | 1074 | (nil stands for the current buffer/frame). |
| @@ -1841,17 +1807,18 @@ BUFFER defaults to the current buffer. */) | |||
| 1841 | XSETBUFFER (tmp, buf); | 1807 | XSETBUFFER (tmp, buf); |
| 1842 | XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ | 1808 | XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ |
| 1843 | 1809 | ||
| 1844 | for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) | 1810 | if (EQ (blv->where, tmp)) /* The binding is already loaded. */ |
| 1845 | { | 1811 | return blv_found (blv) ? Qt : Qnil; |
| 1846 | elt = XCAR (tail); | 1812 | else |
| 1847 | if (EQ (variable, XCAR (elt))) | 1813 | for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) |
| 1848 | { | 1814 | { |
| 1849 | eassert (!blv->frame_local); | 1815 | elt = XCAR (tail); |
| 1850 | eassert (blv_found (blv) || !EQ (blv->where, tmp)); | 1816 | if (EQ (variable, XCAR (elt))) |
| 1851 | return Qt; | 1817 | { |
| 1852 | } | 1818 | eassert (!blv->frame_local); |
| 1853 | } | 1819 | return Qt; |
| 1854 | eassert (!blv_found (blv) || !EQ (blv->where, tmp)); | 1820 | } |
| 1821 | } | ||
| 1855 | return Qnil; | 1822 | return Qnil; |
| 1856 | } | 1823 | } |
| 1857 | case SYMBOL_FORWARDED: | 1824 | case SYMBOL_FORWARDED: |
diff --git a/src/dispextern.h b/src/dispextern.h index 9536d204c43..a0303483803 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -1891,6 +1891,7 @@ struct bidi_it { | |||
| 1891 | stuff that is not part of the bidi iterator's state! */ | 1891 | stuff that is not part of the bidi iterator's state! */ |
| 1892 | struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */ | 1892 | struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */ |
| 1893 | struct bidi_string_data string; /* string to reorder */ | 1893 | struct bidi_string_data string; /* string to reorder */ |
| 1894 | struct window *w; /* the window being displayed */ | ||
| 1894 | bidi_dir_t paragraph_dir; /* current paragraph direction */ | 1895 | bidi_dir_t paragraph_dir; /* current paragraph direction */ |
| 1895 | ptrdiff_t separator_limit; /* where paragraph separator should end */ | 1896 | ptrdiff_t separator_limit; /* where paragraph separator should end */ |
| 1896 | unsigned prev_was_pdf : 1; /* if non-zero, previous char was PDF */ | 1897 | unsigned prev_was_pdf : 1; /* if non-zero, previous char was PDF */ |
| @@ -3105,7 +3106,7 @@ extern void reseat_at_previous_visible_line_start (struct it *); | |||
| 3105 | extern Lisp_Object lookup_glyphless_char_display (int, struct it *); | 3106 | extern Lisp_Object lookup_glyphless_char_display (int, struct it *); |
| 3106 | extern ptrdiff_t compute_display_string_pos (struct text_pos *, | 3107 | extern ptrdiff_t compute_display_string_pos (struct text_pos *, |
| 3107 | struct bidi_string_data *, | 3108 | struct bidi_string_data *, |
| 3108 | int, int *); | 3109 | struct window *, int, int *); |
| 3109 | extern ptrdiff_t compute_display_string_end (ptrdiff_t, | 3110 | extern ptrdiff_t compute_display_string_end (ptrdiff_t, |
| 3110 | struct bidi_string_data *); | 3111 | struct bidi_string_data *); |
| 3111 | extern void produce_stretch_glyph (struct it *); | 3112 | extern void produce_stretch_glyph (struct it *); |
| @@ -758,9 +758,7 @@ Otherwise, return a new string, without any text properties. */) | |||
| 758 | or a specified local map (which means search just that and the | 758 | or a specified local map (which means search just that and the |
| 759 | global map). If non-nil, it might come from Voverriding_local_map, | 759 | global map). If non-nil, it might come from Voverriding_local_map, |
| 760 | or from a \\<mapname> construct in STRING itself.. */ | 760 | or from a \\<mapname> construct in STRING itself.. */ |
| 761 | keymap = KVAR (current_kboard, Voverriding_terminal_local_map); | 761 | keymap = Voverriding_local_map; |
| 762 | if (NILP (keymap)) | ||
| 763 | keymap = Voverriding_local_map; | ||
| 764 | 762 | ||
| 765 | bsize = SBYTES (string); | 763 | bsize = SBYTES (string); |
| 766 | bufp = buf = xmalloc (bsize); | 764 | bufp = buf = xmalloc (bsize); |
diff --git a/src/emacs.c b/src/emacs.c index e2889f1adf5..45d679d1706 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1253,9 +1253,15 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1253 | tzset (); | 1253 | tzset (); |
| 1254 | #endif /* MSDOS */ | 1254 | #endif /* MSDOS */ |
| 1255 | 1255 | ||
| 1256 | #ifdef HAVE_GFILENOTIFY | ||
| 1257 | globals_of_gfilenotify (); | ||
| 1258 | #endif | ||
| 1259 | |||
| 1256 | #ifdef WINDOWSNT | 1260 | #ifdef WINDOWSNT |
| 1257 | globals_of_w32 (); | 1261 | globals_of_w32 (); |
| 1262 | #ifdef HAVE_W32NOTIFY | ||
| 1258 | globals_of_w32notify (); | 1263 | globals_of_w32notify (); |
| 1264 | #endif | ||
| 1259 | /* Initialize environment from registry settings. */ | 1265 | /* Initialize environment from registry settings. */ |
| 1260 | init_environment (argv); | 1266 | init_environment (argv); |
| 1261 | init_ntproc (dumping); /* must precede init_editfns. */ | 1267 | init_ntproc (dumping); /* must precede init_editfns. */ |
| @@ -1415,6 +1421,10 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1415 | syms_of_gnutls (); | 1421 | syms_of_gnutls (); |
| 1416 | #endif | 1422 | #endif |
| 1417 | 1423 | ||
| 1424 | #ifdef HAVE_GFILENOTIFY | ||
| 1425 | syms_of_gfilenotify (); | ||
| 1426 | #endif /* HAVE_GFILENOTIFY */ | ||
| 1427 | |||
| 1418 | #ifdef HAVE_INOTIFY | 1428 | #ifdef HAVE_INOTIFY |
| 1419 | syms_of_inotify (); | 1429 | syms_of_inotify (); |
| 1420 | #endif /* HAVE_INOTIFY */ | 1430 | #endif /* HAVE_INOTIFY */ |
| @@ -1425,7 +1435,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1425 | 1435 | ||
| 1426 | #ifdef WINDOWSNT | 1436 | #ifdef WINDOWSNT |
| 1427 | syms_of_ntterm (); | 1437 | syms_of_ntterm (); |
| 1438 | #ifdef HAVE_W32NOTIFY | ||
| 1428 | syms_of_w32notify (); | 1439 | syms_of_w32notify (); |
| 1440 | #endif /* HAVE_W32NOTIFY */ | ||
| 1429 | #endif /* WINDOWSNT */ | 1441 | #endif /* WINDOWSNT */ |
| 1430 | 1442 | ||
| 1431 | syms_of_profiler (); | 1443 | syms_of_profiler (); |
diff --git a/src/epaths.in b/src/epaths.in index 0cf8cc9ce5b..1f5701e5337 100644 --- a/src/epaths.in +++ b/src/epaths.in | |||
| @@ -30,10 +30,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | /* Like PATH_LOADSEARCH, but contains the non-standard pieces. | 32 | /* Like PATH_LOADSEARCH, but contains the non-standard pieces. |
| 33 | These are the site-lisp directories, typically something like | 33 | These are the site-lisp directories. Configure sets this to |
| 34 | ${locallisppath}, which typically defaults to something like: | ||
| 34 | <datadir>/emacs/VERSION/site-lisp:<datadir>/emacs/site-lisp | 35 | <datadir>/emacs/VERSION/site-lisp:<datadir>/emacs/site-lisp |
| 35 | Configure prepends any $locallisppath, as set by the | 36 | but can be overridden by the --enable-locallisppath argument. |
| 36 | --enable-locallisppath argument. | ||
| 37 | This is combined with PATH_LOADSEARCH to make the default load-path. | 37 | This is combined with PATH_LOADSEARCH to make the default load-path. |
| 38 | If the --no-site-lisp option is used, this piece is excluded. | 38 | If the --no-site-lisp option is used, this piece is excluded. |
| 39 | */ | 39 | */ |
diff --git a/src/eval.c b/src/eval.c index 69483a9b205..d1d074df777 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -32,8 +32,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 32 | #include "xterm.h" | 32 | #include "xterm.h" |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | struct backtrace *backtrace_list; | ||
| 36 | |||
| 37 | #if !BYTE_MARK_STACK | 35 | #if !BYTE_MARK_STACK |
| 38 | static | 36 | static |
| 39 | #endif | 37 | #endif |
| @@ -105,7 +103,7 @@ static EMACS_INT when_entered_debugger; | |||
| 105 | 103 | ||
| 106 | /* The function from which the last `signal' was called. Set in | 104 | /* The function from which the last `signal' was called. Set in |
| 107 | Fsignal. */ | 105 | Fsignal. */ |
| 108 | 106 | /* FIXME: We should probably get rid of this! */ | |
| 109 | Lisp_Object Vsignaling_function; | 107 | Lisp_Object Vsignaling_function; |
| 110 | 108 | ||
| 111 | /* If non-nil, Lisp code must not be run since some part of Emacs is | 109 | /* If non-nil, Lisp code must not be run since some part of Emacs is |
| @@ -117,20 +115,48 @@ Lisp_Object inhibit_lisp_code; | |||
| 117 | static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); | 115 | static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); |
| 118 | static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); | 116 | static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); |
| 119 | 117 | ||
| 120 | /* Functions to set Lisp_Object slots of struct specbinding. */ | 118 | /* Functions to modify slots of backtrace records. */ |
| 119 | |||
| 120 | static void | ||
| 121 | set_backtrace_args (struct specbinding *pdl, Lisp_Object *args) | ||
| 122 | { eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.args = args; } | ||
| 123 | |||
| 124 | static void | ||
| 125 | set_backtrace_nargs (struct specbinding *pdl, ptrdiff_t n) | ||
| 126 | { eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.nargs = n; } | ||
| 121 | 127 | ||
| 122 | static void | 128 | static void |
| 123 | set_specpdl_symbol (Lisp_Object symbol) | 129 | set_backtrace_debug_on_exit (struct specbinding *pdl, bool doe) |
| 130 | { eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.debug_on_exit = doe; } | ||
| 131 | |||
| 132 | /* Helper functions to scan the backtrace. */ | ||
| 133 | |||
| 134 | bool backtrace_p (struct specbinding *) EXTERNALLY_VISIBLE; | ||
| 135 | struct specbinding *backtrace_top (void) EXTERNALLY_VISIBLE; | ||
| 136 | struct specbinding *backtrace_next (struct specbinding *pdl) EXTERNALLY_VISIBLE; | ||
| 137 | |||
| 138 | bool backtrace_p (struct specbinding *pdl) | ||
| 139 | { return pdl >= specpdl; } | ||
| 140 | |||
| 141 | struct specbinding * | ||
| 142 | backtrace_top (void) | ||
| 124 | { | 143 | { |
| 125 | specpdl_ptr->symbol = symbol; | 144 | struct specbinding *pdl = specpdl_ptr - 1; |
| 145 | while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) | ||
| 146 | pdl--; | ||
| 147 | return pdl; | ||
| 126 | } | 148 | } |
| 127 | 149 | ||
| 128 | static void | 150 | struct specbinding * |
| 129 | set_specpdl_old_value (Lisp_Object oldval) | 151 | backtrace_next (struct specbinding *pdl) |
| 130 | { | 152 | { |
| 131 | specpdl_ptr->old_value = oldval; | 153 | pdl--; |
| 154 | while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) | ||
| 155 | pdl--; | ||
| 156 | return pdl; | ||
| 132 | } | 157 | } |
| 133 | 158 | ||
| 159 | |||
| 134 | void | 160 | void |
| 135 | init_eval_once (void) | 161 | init_eval_once (void) |
| 136 | { | 162 | { |
| @@ -151,7 +177,6 @@ init_eval (void) | |||
| 151 | specpdl_ptr = specpdl; | 177 | specpdl_ptr = specpdl; |
| 152 | catchlist = 0; | 178 | catchlist = 0; |
| 153 | handlerlist = 0; | 179 | handlerlist = 0; |
| 154 | backtrace_list = 0; | ||
| 155 | Vquit_flag = Qnil; | 180 | Vquit_flag = Qnil; |
| 156 | debug_on_next_call = 0; | 181 | debug_on_next_call = 0; |
| 157 | lisp_eval_depth = 0; | 182 | lisp_eval_depth = 0; |
| @@ -234,7 +259,7 @@ static void | |||
| 234 | do_debug_on_call (Lisp_Object code) | 259 | do_debug_on_call (Lisp_Object code) |
| 235 | { | 260 | { |
| 236 | debug_on_next_call = 0; | 261 | debug_on_next_call = 0; |
| 237 | backtrace_list->debug_on_exit = 1; | 262 | set_backtrace_debug_on_exit (specpdl_ptr - 1, true); |
| 238 | call_debugger (Fcons (code, Qnil)); | 263 | call_debugger (Fcons (code, Qnil)); |
| 239 | } | 264 | } |
| 240 | 265 | ||
| @@ -530,9 +555,8 @@ The return value is BASE-VARIABLE. */) | |||
| 530 | struct specbinding *p; | 555 | struct specbinding *p; |
| 531 | 556 | ||
| 532 | for (p = specpdl_ptr; p > specpdl; ) | 557 | for (p = specpdl_ptr; p > specpdl; ) |
| 533 | if ((--p)->func == NULL | 558 | if ((--p)->kind >= SPECPDL_LET |
| 534 | && (EQ (new_alias, | 559 | && (EQ (new_alias, specpdl_symbol (p)))) |
| 535 | CONSP (p->symbol) ? XCAR (p->symbol) : p->symbol))) | ||
| 536 | error ("Don't know how to make a let-bound variable an alias"); | 560 | error ("Don't know how to make a let-bound variable an alias"); |
| 537 | } | 561 | } |
| 538 | 562 | ||
| @@ -597,8 +621,9 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | |||
| 597 | struct specbinding *pdl = specpdl_ptr; | 621 | struct specbinding *pdl = specpdl_ptr; |
| 598 | while (pdl > specpdl) | 622 | while (pdl > specpdl) |
| 599 | { | 623 | { |
| 600 | if (EQ ((--pdl)->symbol, sym) && !pdl->func | 624 | if ((--pdl)->kind >= SPECPDL_LET |
| 601 | && EQ (pdl->old_value, Qunbound)) | 625 | && EQ (specpdl_symbol (pdl), sym) |
| 626 | && EQ (specpdl_old_value (pdl), Qunbound)) | ||
| 602 | { | 627 | { |
| 603 | message_with_string | 628 | message_with_string |
| 604 | ("Warning: defvar ignored because %s is let-bound", | 629 | ("Warning: defvar ignored because %s is let-bound", |
| @@ -937,7 +962,7 @@ usage: (catch TAG BODY...) */) | |||
| 937 | 962 | ||
| 938 | /* Set up a catch, then call C function FUNC on argument ARG. | 963 | /* Set up a catch, then call C function FUNC on argument ARG. |
| 939 | FUNC should return a Lisp_Object. | 964 | FUNC should return a Lisp_Object. |
| 940 | This is how catches are done from within C code. */ | 965 | This is how catches are done from within C code. */ |
| 941 | 966 | ||
| 942 | Lisp_Object | 967 | Lisp_Object |
| 943 | internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object arg) | 968 | internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object arg) |
| @@ -949,7 +974,6 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object | |||
| 949 | c.next = catchlist; | 974 | c.next = catchlist; |
| 950 | c.tag = tag; | 975 | c.tag = tag; |
| 951 | c.val = Qnil; | 976 | c.val = Qnil; |
| 952 | c.backlist = backtrace_list; | ||
| 953 | c.handlerlist = handlerlist; | 977 | c.handlerlist = handlerlist; |
| 954 | c.lisp_eval_depth = lisp_eval_depth; | 978 | c.lisp_eval_depth = lisp_eval_depth; |
| 955 | c.pdlcount = SPECPDL_INDEX (); | 979 | c.pdlcount = SPECPDL_INDEX (); |
| @@ -1014,7 +1038,6 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value) | |||
| 1014 | #ifdef DEBUG_GCPRO | 1038 | #ifdef DEBUG_GCPRO |
| 1015 | gcpro_level = gcprolist ? gcprolist->level + 1 : 0; | 1039 | gcpro_level = gcprolist ? gcprolist->level + 1 : 0; |
| 1016 | #endif | 1040 | #endif |
| 1017 | backtrace_list = catch->backlist; | ||
| 1018 | lisp_eval_depth = catch->lisp_eval_depth; | 1041 | lisp_eval_depth = catch->lisp_eval_depth; |
| 1019 | 1042 | ||
| 1020 | sys_longjmp (catch->jmp, 1); | 1043 | sys_longjmp (catch->jmp, 1); |
| @@ -1115,7 +1138,6 @@ internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform, | |||
| 1115 | 1138 | ||
| 1116 | c.tag = Qnil; | 1139 | c.tag = Qnil; |
| 1117 | c.val = Qnil; | 1140 | c.val = Qnil; |
| 1118 | c.backlist = backtrace_list; | ||
| 1119 | c.handlerlist = handlerlist; | 1141 | c.handlerlist = handlerlist; |
| 1120 | c.lisp_eval_depth = lisp_eval_depth; | 1142 | c.lisp_eval_depth = lisp_eval_depth; |
| 1121 | c.pdlcount = SPECPDL_INDEX (); | 1143 | c.pdlcount = SPECPDL_INDEX (); |
| @@ -1131,7 +1153,7 @@ internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform, | |||
| 1131 | 1153 | ||
| 1132 | /* Note that this just undoes the binding of h.var; whoever | 1154 | /* Note that this just undoes the binding of h.var; whoever |
| 1133 | longjumped to us unwound the stack to c.pdlcount before | 1155 | longjumped to us unwound the stack to c.pdlcount before |
| 1134 | throwing. */ | 1156 | throwing. */ |
| 1135 | unbind_to (c.pdlcount, Qnil); | 1157 | unbind_to (c.pdlcount, Qnil); |
| 1136 | return val; | 1158 | return val; |
| 1137 | } | 1159 | } |
| @@ -1170,7 +1192,6 @@ internal_condition_case (Lisp_Object (*bfun) (void), Lisp_Object handlers, | |||
| 1170 | 1192 | ||
| 1171 | c.tag = Qnil; | 1193 | c.tag = Qnil; |
| 1172 | c.val = Qnil; | 1194 | c.val = Qnil; |
| 1173 | c.backlist = backtrace_list; | ||
| 1174 | c.handlerlist = handlerlist; | 1195 | c.handlerlist = handlerlist; |
| 1175 | c.lisp_eval_depth = lisp_eval_depth; | 1196 | c.lisp_eval_depth = lisp_eval_depth; |
| 1176 | c.pdlcount = SPECPDL_INDEX (); | 1197 | c.pdlcount = SPECPDL_INDEX (); |
| @@ -1208,7 +1229,6 @@ internal_condition_case_1 (Lisp_Object (*bfun) (Lisp_Object), Lisp_Object arg, | |||
| 1208 | 1229 | ||
| 1209 | c.tag = Qnil; | 1230 | c.tag = Qnil; |
| 1210 | c.val = Qnil; | 1231 | c.val = Qnil; |
| 1211 | c.backlist = backtrace_list; | ||
| 1212 | c.handlerlist = handlerlist; | 1232 | c.handlerlist = handlerlist; |
| 1213 | c.lisp_eval_depth = lisp_eval_depth; | 1233 | c.lisp_eval_depth = lisp_eval_depth; |
| 1214 | c.pdlcount = SPECPDL_INDEX (); | 1234 | c.pdlcount = SPECPDL_INDEX (); |
| @@ -1250,7 +1270,6 @@ internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object), | |||
| 1250 | 1270 | ||
| 1251 | c.tag = Qnil; | 1271 | c.tag = Qnil; |
| 1252 | c.val = Qnil; | 1272 | c.val = Qnil; |
| 1253 | c.backlist = backtrace_list; | ||
| 1254 | c.handlerlist = handlerlist; | 1273 | c.handlerlist = handlerlist; |
| 1255 | c.lisp_eval_depth = lisp_eval_depth; | 1274 | c.lisp_eval_depth = lisp_eval_depth; |
| 1256 | c.pdlcount = SPECPDL_INDEX (); | 1275 | c.pdlcount = SPECPDL_INDEX (); |
| @@ -1294,7 +1313,6 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *), | |||
| 1294 | 1313 | ||
| 1295 | c.tag = Qnil; | 1314 | c.tag = Qnil; |
| 1296 | c.val = Qnil; | 1315 | c.val = Qnil; |
| 1297 | c.backlist = backtrace_list; | ||
| 1298 | c.handlerlist = handlerlist; | 1316 | c.handlerlist = handlerlist; |
| 1299 | c.lisp_eval_depth = lisp_eval_depth; | 1317 | c.lisp_eval_depth = lisp_eval_depth; |
| 1300 | c.pdlcount = SPECPDL_INDEX (); | 1318 | c.pdlcount = SPECPDL_INDEX (); |
| @@ -1362,7 +1380,6 @@ See also the function `condition-case'. */) | |||
| 1362 | = (NILP (error_symbol) ? Fcar (data) : error_symbol); | 1380 | = (NILP (error_symbol) ? Fcar (data) : error_symbol); |
| 1363 | register Lisp_Object clause = Qnil; | 1381 | register Lisp_Object clause = Qnil; |
| 1364 | struct handler *h; | 1382 | struct handler *h; |
| 1365 | struct backtrace *bp; | ||
| 1366 | 1383 | ||
| 1367 | immediate_quit = 0; | 1384 | immediate_quit = 0; |
| 1368 | abort_on_gc = 0; | 1385 | abort_on_gc = 0; |
| @@ -1398,13 +1415,13 @@ See also the function `condition-case'. */) | |||
| 1398 | too. Don't do this when ERROR_SYMBOL is nil, because that | 1415 | too. Don't do this when ERROR_SYMBOL is nil, because that |
| 1399 | is a memory-full error. */ | 1416 | is a memory-full error. */ |
| 1400 | Vsignaling_function = Qnil; | 1417 | Vsignaling_function = Qnil; |
| 1401 | if (backtrace_list && !NILP (error_symbol)) | 1418 | if (!NILP (error_symbol)) |
| 1402 | { | 1419 | { |
| 1403 | bp = backtrace_list->next; | 1420 | struct specbinding *pdl = backtrace_next (backtrace_top ()); |
| 1404 | if (bp && EQ (bp->function, Qerror)) | 1421 | if (backtrace_p (pdl) && EQ (backtrace_function (pdl), Qerror)) |
| 1405 | bp = bp->next; | 1422 | pdl = backtrace_next (pdl); |
| 1406 | if (bp) | 1423 | if (backtrace_p (pdl)) |
| 1407 | Vsignaling_function = bp->function; | 1424 | Vsignaling_function = backtrace_function (pdl); |
| 1408 | } | 1425 | } |
| 1409 | 1426 | ||
| 1410 | for (h = handlerlist; h; h = h->next) | 1427 | for (h = handlerlist; h; h = h->next) |
| @@ -1901,6 +1918,36 @@ If LEXICAL is t, evaluate using lexical scoping. */) | |||
| 1901 | return unbind_to (count, eval_sub (form)); | 1918 | return unbind_to (count, eval_sub (form)); |
| 1902 | } | 1919 | } |
| 1903 | 1920 | ||
| 1921 | static void | ||
| 1922 | grow_specpdl (void) | ||
| 1923 | { | ||
| 1924 | register ptrdiff_t count = SPECPDL_INDEX (); | ||
| 1925 | ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX); | ||
| 1926 | if (max_size <= specpdl_size) | ||
| 1927 | { | ||
| 1928 | if (max_specpdl_size < 400) | ||
| 1929 | max_size = max_specpdl_size = 400; | ||
| 1930 | if (max_size <= specpdl_size) | ||
| 1931 | signal_error ("Variable binding depth exceeds max-specpdl-size", Qnil); | ||
| 1932 | } | ||
| 1933 | specpdl = xpalloc (specpdl, &specpdl_size, 1, max_size, sizeof *specpdl); | ||
| 1934 | specpdl_ptr = specpdl + count; | ||
| 1935 | } | ||
| 1936 | |||
| 1937 | void | ||
| 1938 | record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs) | ||
| 1939 | { | ||
| 1940 | eassert (nargs >= UNEVALLED); | ||
| 1941 | if (specpdl_ptr == specpdl + specpdl_size) | ||
| 1942 | grow_specpdl (); | ||
| 1943 | specpdl_ptr->kind = SPECPDL_BACKTRACE; | ||
| 1944 | specpdl_ptr->v.bt.function = function; | ||
| 1945 | specpdl_ptr->v.bt.args = args; | ||
| 1946 | specpdl_ptr->v.bt.nargs = nargs; | ||
| 1947 | specpdl_ptr->v.bt.debug_on_exit = false; | ||
| 1948 | specpdl_ptr++; | ||
| 1949 | } | ||
| 1950 | |||
| 1904 | /* Eval a sub-expression of the current expression (i.e. in the same | 1951 | /* Eval a sub-expression of the current expression (i.e. in the same |
| 1905 | lexical scope). */ | 1952 | lexical scope). */ |
| 1906 | Lisp_Object | 1953 | Lisp_Object |
| @@ -1908,7 +1955,6 @@ eval_sub (Lisp_Object form) | |||
| 1908 | { | 1955 | { |
| 1909 | Lisp_Object fun, val, original_fun, original_args; | 1956 | Lisp_Object fun, val, original_fun, original_args; |
| 1910 | Lisp_Object funcar; | 1957 | Lisp_Object funcar; |
| 1911 | struct backtrace backtrace; | ||
| 1912 | struct gcpro gcpro1, gcpro2, gcpro3; | 1958 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 1913 | 1959 | ||
| 1914 | if (SYMBOLP (form)) | 1960 | if (SYMBOLP (form)) |
| @@ -1946,12 +1992,8 @@ eval_sub (Lisp_Object form) | |||
| 1946 | original_fun = XCAR (form); | 1992 | original_fun = XCAR (form); |
| 1947 | original_args = XCDR (form); | 1993 | original_args = XCDR (form); |
| 1948 | 1994 | ||
| 1949 | backtrace.next = backtrace_list; | 1995 | /* This also protects them from gc. */ |
| 1950 | backtrace.function = original_fun; /* This also protects them from gc. */ | 1996 | record_in_backtrace (original_fun, &original_args, UNEVALLED); |
| 1951 | backtrace.args = &original_args; | ||
| 1952 | backtrace.nargs = UNEVALLED; | ||
| 1953 | backtrace.debug_on_exit = 0; | ||
| 1954 | backtrace_list = &backtrace; | ||
| 1955 | 1997 | ||
| 1956 | if (debug_on_next_call) | 1998 | if (debug_on_next_call) |
| 1957 | do_debug_on_call (Qt); | 1999 | do_debug_on_call (Qt); |
| @@ -2005,8 +2047,8 @@ eval_sub (Lisp_Object form) | |||
| 2005 | gcpro3.nvars = argnum; | 2047 | gcpro3.nvars = argnum; |
| 2006 | } | 2048 | } |
| 2007 | 2049 | ||
| 2008 | backtrace.args = vals; | 2050 | set_backtrace_args (specpdl_ptr - 1, vals); |
| 2009 | backtrace.nargs = XINT (numargs); | 2051 | set_backtrace_nargs (specpdl_ptr - 1, XINT (numargs)); |
| 2010 | 2052 | ||
| 2011 | val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); | 2053 | val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); |
| 2012 | UNGCPRO; | 2054 | UNGCPRO; |
| @@ -2027,8 +2069,8 @@ eval_sub (Lisp_Object form) | |||
| 2027 | 2069 | ||
| 2028 | UNGCPRO; | 2070 | UNGCPRO; |
| 2029 | 2071 | ||
| 2030 | backtrace.args = argvals; | 2072 | set_backtrace_args (specpdl_ptr - 1, argvals); |
| 2031 | backtrace.nargs = XINT (numargs); | 2073 | set_backtrace_nargs (specpdl_ptr - 1, XINT (numargs)); |
| 2032 | 2074 | ||
| 2033 | switch (i) | 2075 | switch (i) |
| 2034 | { | 2076 | { |
| @@ -2118,9 +2160,9 @@ eval_sub (Lisp_Object form) | |||
| 2118 | check_cons_list (); | 2160 | check_cons_list (); |
| 2119 | 2161 | ||
| 2120 | lisp_eval_depth--; | 2162 | lisp_eval_depth--; |
| 2121 | if (backtrace.debug_on_exit) | 2163 | if (backtrace_debug_on_exit (specpdl_ptr - 1)) |
| 2122 | val = call_debugger (Fcons (Qexit, Fcons (val, Qnil))); | 2164 | val = call_debugger (Fcons (Qexit, Fcons (val, Qnil))); |
| 2123 | backtrace_list = backtrace.next; | 2165 | specpdl_ptr--; |
| 2124 | 2166 | ||
| 2125 | return val; | 2167 | return val; |
| 2126 | } | 2168 | } |
| @@ -2600,7 +2642,6 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2600 | ptrdiff_t numargs = nargs - 1; | 2642 | ptrdiff_t numargs = nargs - 1; |
| 2601 | Lisp_Object lisp_numargs; | 2643 | Lisp_Object lisp_numargs; |
| 2602 | Lisp_Object val; | 2644 | Lisp_Object val; |
| 2603 | struct backtrace backtrace; | ||
| 2604 | register Lisp_Object *internal_args; | 2645 | register Lisp_Object *internal_args; |
| 2605 | ptrdiff_t i; | 2646 | ptrdiff_t i; |
| 2606 | 2647 | ||
| @@ -2614,12 +2655,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2614 | error ("Lisp nesting exceeds `max-lisp-eval-depth'"); | 2655 | error ("Lisp nesting exceeds `max-lisp-eval-depth'"); |
| 2615 | } | 2656 | } |
| 2616 | 2657 | ||
| 2617 | backtrace.next = backtrace_list; | 2658 | /* This also GCPROs them. */ |
| 2618 | backtrace.function = args[0]; | 2659 | record_in_backtrace (args[0], &args[1], nargs - 1); |
| 2619 | backtrace.args = &args[1]; /* This also GCPROs them. */ | ||
| 2620 | backtrace.nargs = nargs - 1; | ||
| 2621 | backtrace.debug_on_exit = 0; | ||
| 2622 | backtrace_list = &backtrace; | ||
| 2623 | 2660 | ||
| 2624 | /* Call GC after setting up the backtrace, so the latter GCPROs the args. */ | 2661 | /* Call GC after setting up the backtrace, so the latter GCPROs the args. */ |
| 2625 | maybe_gc (); | 2662 | maybe_gc (); |
| @@ -2744,9 +2781,9 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2744 | } | 2781 | } |
| 2745 | check_cons_list (); | 2782 | check_cons_list (); |
| 2746 | lisp_eval_depth--; | 2783 | lisp_eval_depth--; |
| 2747 | if (backtrace.debug_on_exit) | 2784 | if (backtrace_debug_on_exit (specpdl_ptr - 1)) |
| 2748 | val = call_debugger (Fcons (Qexit, Fcons (val, Qnil))); | 2785 | val = call_debugger (Fcons (Qexit, Fcons (val, Qnil))); |
| 2749 | backtrace_list = backtrace.next; | 2786 | specpdl_ptr--; |
| 2750 | return val; | 2787 | return val; |
| 2751 | } | 2788 | } |
| 2752 | 2789 | ||
| @@ -2778,15 +2815,17 @@ apply_lambda (Lisp_Object fun, Lisp_Object args) | |||
| 2778 | 2815 | ||
| 2779 | UNGCPRO; | 2816 | UNGCPRO; |
| 2780 | 2817 | ||
| 2781 | backtrace_list->args = arg_vector; | 2818 | set_backtrace_args (specpdl_ptr - 1, arg_vector); |
| 2782 | backtrace_list->nargs = i; | 2819 | set_backtrace_nargs (specpdl_ptr - 1, i); |
| 2783 | tem = funcall_lambda (fun, numargs, arg_vector); | 2820 | tem = funcall_lambda (fun, numargs, arg_vector); |
| 2784 | 2821 | ||
| 2785 | /* Do the debug-on-exit now, while arg_vector still exists. */ | 2822 | /* Do the debug-on-exit now, while arg_vector still exists. */ |
| 2786 | if (backtrace_list->debug_on_exit) | 2823 | if (backtrace_debug_on_exit (specpdl_ptr - 1)) |
| 2787 | tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil))); | 2824 | { |
| 2788 | /* Don't do it again when we return to eval. */ | 2825 | /* Don't do it again when we return to eval. */ |
| 2789 | backtrace_list->debug_on_exit = 0; | 2826 | set_backtrace_debug_on_exit (specpdl_ptr - 1, false); |
| 2827 | tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil))); | ||
| 2828 | } | ||
| 2790 | SAFE_FREE (); | 2829 | SAFE_FREE (); |
| 2791 | return tem; | 2830 | return tem; |
| 2792 | } | 2831 | } |
| @@ -2936,20 +2975,38 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode, | |||
| 2936 | return object; | 2975 | return object; |
| 2937 | } | 2976 | } |
| 2938 | 2977 | ||
| 2939 | static void | 2978 | /* Return true if SYMBOL currently has a let-binding |
| 2940 | grow_specpdl (void) | 2979 | which was made in the buffer that is now current. */ |
| 2980 | |||
| 2981 | bool | ||
| 2982 | let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol) | ||
| 2941 | { | 2983 | { |
| 2942 | register ptrdiff_t count = SPECPDL_INDEX (); | 2984 | struct specbinding *p; |
| 2943 | ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX); | 2985 | Lisp_Object buf = Fcurrent_buffer (); |
| 2944 | if (max_size <= specpdl_size) | 2986 | |
| 2945 | { | 2987 | for (p = specpdl_ptr; p > specpdl; ) |
| 2946 | if (max_specpdl_size < 400) | 2988 | if ((--p)->kind > SPECPDL_LET) |
| 2947 | max_size = max_specpdl_size = 400; | 2989 | { |
| 2948 | if (max_size <= specpdl_size) | 2990 | struct Lisp_Symbol *let_bound_symbol = XSYMBOL (specpdl_symbol (p)); |
| 2949 | signal_error ("Variable binding depth exceeds max-specpdl-size", Qnil); | 2991 | eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS); |
| 2950 | } | 2992 | if (symbol == let_bound_symbol |
| 2951 | specpdl = xpalloc (specpdl, &specpdl_size, 1, max_size, sizeof *specpdl); | 2993 | && EQ (specpdl_where (p), buf)) |
| 2952 | specpdl_ptr = specpdl + count; | 2994 | return 1; |
| 2995 | } | ||
| 2996 | |||
| 2997 | return 0; | ||
| 2998 | } | ||
| 2999 | |||
| 3000 | bool | ||
| 3001 | let_shadows_global_binding_p (Lisp_Object symbol) | ||
| 3002 | { | ||
| 3003 | struct specbinding *p; | ||
| 3004 | |||
| 3005 | for (p = specpdl_ptr; p > specpdl; ) | ||
| 3006 | if ((--p)->kind >= SPECPDL_LET && EQ (specpdl_symbol (p), symbol)) | ||
| 3007 | return 1; | ||
| 3008 | |||
| 3009 | return 0; | ||
| 2953 | } | 3010 | } |
| 2954 | 3011 | ||
| 2955 | /* `specpdl_ptr->symbol' is a field which describes which variable is | 3012 | /* `specpdl_ptr->symbol' is a field which describes which variable is |
| @@ -2985,9 +3042,9 @@ specbind (Lisp_Object symbol, Lisp_Object value) | |||
| 2985 | case SYMBOL_PLAINVAL: | 3042 | case SYMBOL_PLAINVAL: |
| 2986 | /* The most common case is that of a non-constant symbol with a | 3043 | /* The most common case is that of a non-constant symbol with a |
| 2987 | trivial value. Make that as fast as we can. */ | 3044 | trivial value. Make that as fast as we can. */ |
| 2988 | set_specpdl_symbol (symbol); | 3045 | specpdl_ptr->kind = SPECPDL_LET; |
| 2989 | set_specpdl_old_value (SYMBOL_VAL (sym)); | 3046 | specpdl_ptr->v.let.symbol = symbol; |
| 2990 | specpdl_ptr->func = NULL; | 3047 | specpdl_ptr->v.let.old_value = SYMBOL_VAL (sym); |
| 2991 | ++specpdl_ptr; | 3048 | ++specpdl_ptr; |
| 2992 | if (!sym->constant) | 3049 | if (!sym->constant) |
| 2993 | SET_SYMBOL_VAL (sym, value); | 3050 | SET_SYMBOL_VAL (sym, value); |
| @@ -3000,59 +3057,36 @@ specbind (Lisp_Object symbol, Lisp_Object value) | |||
| 3000 | case SYMBOL_FORWARDED: | 3057 | case SYMBOL_FORWARDED: |
| 3001 | { | 3058 | { |
| 3002 | Lisp_Object ovalue = find_symbol_value (symbol); | 3059 | Lisp_Object ovalue = find_symbol_value (symbol); |
| 3003 | specpdl_ptr->func = 0; | 3060 | specpdl_ptr->kind = SPECPDL_LET_LOCAL; |
| 3004 | set_specpdl_old_value (ovalue); | 3061 | specpdl_ptr->v.let.symbol = symbol; |
| 3062 | specpdl_ptr->v.let.old_value = ovalue; | ||
| 3063 | specpdl_ptr->v.let.where = Fcurrent_buffer (); | ||
| 3005 | 3064 | ||
| 3006 | eassert (sym->redirect != SYMBOL_LOCALIZED | 3065 | eassert (sym->redirect != SYMBOL_LOCALIZED |
| 3007 | || (EQ (SYMBOL_BLV (sym)->where, | 3066 | || (EQ (SYMBOL_BLV (sym)->where, Fcurrent_buffer ()))); |
| 3008 | SYMBOL_BLV (sym)->frame_local ? | ||
| 3009 | Fselected_frame () : Fcurrent_buffer ()))); | ||
| 3010 | 3067 | ||
| 3011 | if (sym->redirect == SYMBOL_LOCALIZED | 3068 | if (sym->redirect == SYMBOL_LOCALIZED) |
| 3012 | || BUFFER_OBJFWDP (SYMBOL_FWD (sym))) | 3069 | { |
| 3070 | if (!blv_found (SYMBOL_BLV (sym))) | ||
| 3071 | specpdl_ptr->kind = SPECPDL_LET_DEFAULT; | ||
| 3072 | } | ||
| 3073 | else if (BUFFER_OBJFWDP (SYMBOL_FWD (sym))) | ||
| 3013 | { | 3074 | { |
| 3014 | Lisp_Object where, cur_buf = Fcurrent_buffer (); | ||
| 3015 | |||
| 3016 | /* For a local variable, record both the symbol and which | ||
| 3017 | buffer's or frame's value we are saving. */ | ||
| 3018 | if (!NILP (Flocal_variable_p (symbol, Qnil))) | ||
| 3019 | { | ||
| 3020 | eassert (sym->redirect != SYMBOL_LOCALIZED | ||
| 3021 | || (blv_found (SYMBOL_BLV (sym)) | ||
| 3022 | && EQ (cur_buf, SYMBOL_BLV (sym)->where))); | ||
| 3023 | where = cur_buf; | ||
| 3024 | } | ||
| 3025 | else if (sym->redirect == SYMBOL_LOCALIZED | ||
| 3026 | && blv_found (SYMBOL_BLV (sym))) | ||
| 3027 | where = SYMBOL_BLV (sym)->where; | ||
| 3028 | else | ||
| 3029 | where = Qnil; | ||
| 3030 | |||
| 3031 | /* We're not using the `unused' slot in the specbinding | ||
| 3032 | structure because this would mean we have to do more | ||
| 3033 | work for simple variables. */ | ||
| 3034 | /* FIXME: The third value `current_buffer' is only used in | ||
| 3035 | let_shadows_buffer_binding_p which is itself only used | ||
| 3036 | in set_internal for local_if_set. */ | ||
| 3037 | eassert (NILP (where) || EQ (where, cur_buf)); | ||
| 3038 | set_specpdl_symbol (Fcons (symbol, Fcons (where, cur_buf))); | ||
| 3039 | |||
| 3040 | /* If SYMBOL is a per-buffer variable which doesn't have a | 3075 | /* If SYMBOL is a per-buffer variable which doesn't have a |
| 3041 | buffer-local value here, make the `let' change the global | 3076 | buffer-local value here, make the `let' change the global |
| 3042 | value by changing the value of SYMBOL in all buffers not | 3077 | value by changing the value of SYMBOL in all buffers not |
| 3043 | having their own value. This is consistent with what | 3078 | having their own value. This is consistent with what |
| 3044 | happens with other buffer-local variables. */ | 3079 | happens with other buffer-local variables. */ |
| 3045 | if (NILP (where) | 3080 | if (NILP (Flocal_variable_p (symbol, Qnil))) |
| 3046 | && sym->redirect == SYMBOL_FORWARDED) | ||
| 3047 | { | 3081 | { |
| 3048 | eassert (BUFFER_OBJFWDP (SYMBOL_FWD (sym))); | 3082 | specpdl_ptr->kind = SPECPDL_LET_DEFAULT; |
| 3049 | ++specpdl_ptr; | 3083 | ++specpdl_ptr; |
| 3050 | Fset_default (symbol, value); | 3084 | Fset_default (symbol, value); |
| 3051 | return; | 3085 | return; |
| 3052 | } | 3086 | } |
| 3053 | } | 3087 | } |
| 3054 | else | 3088 | else |
| 3055 | set_specpdl_symbol (symbol); | 3089 | specpdl_ptr->kind = SPECPDL_LET; |
| 3056 | 3090 | ||
| 3057 | specpdl_ptr++; | 3091 | specpdl_ptr++; |
| 3058 | set_internal (symbol, value, Qnil, 1); | 3092 | set_internal (symbol, value, Qnil, 1); |
| @@ -3067,9 +3101,9 @@ record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg) | |||
| 3067 | { | 3101 | { |
| 3068 | if (specpdl_ptr == specpdl + specpdl_size) | 3102 | if (specpdl_ptr == specpdl + specpdl_size) |
| 3069 | grow_specpdl (); | 3103 | grow_specpdl (); |
| 3070 | specpdl_ptr->func = function; | 3104 | specpdl_ptr->kind = SPECPDL_UNWIND; |
| 3071 | set_specpdl_symbol (Qnil); | 3105 | specpdl_ptr->v.unwind.func = function; |
| 3072 | set_specpdl_old_value (arg); | 3106 | specpdl_ptr->v.unwind.arg = arg; |
| 3073 | specpdl_ptr++; | 3107 | specpdl_ptr++; |
| 3074 | } | 3108 | } |
| 3075 | 3109 | ||
| @@ -3093,41 +3127,50 @@ unbind_to (ptrdiff_t count, Lisp_Object value) | |||
| 3093 | struct specbinding this_binding; | 3127 | struct specbinding this_binding; |
| 3094 | this_binding = *--specpdl_ptr; | 3128 | this_binding = *--specpdl_ptr; |
| 3095 | 3129 | ||
| 3096 | if (this_binding.func != 0) | 3130 | switch (this_binding.kind) |
| 3097 | (*this_binding.func) (this_binding.old_value); | ||
| 3098 | /* If the symbol is a list, it is really (SYMBOL WHERE | ||
| 3099 | . CURRENT-BUFFER) where WHERE is either nil, a buffer, or a | ||
| 3100 | frame. If WHERE is a buffer or frame, this indicates we | ||
| 3101 | bound a variable that had a buffer-local or frame-local | ||
| 3102 | binding. WHERE nil means that the variable had the default | ||
| 3103 | value when it was bound. CURRENT-BUFFER is the buffer that | ||
| 3104 | was current when the variable was bound. */ | ||
| 3105 | else if (CONSP (this_binding.symbol)) | ||
| 3106 | { | 3131 | { |
| 3107 | Lisp_Object symbol, where; | 3132 | case SPECPDL_UNWIND: |
| 3108 | 3133 | (*specpdl_func (&this_binding)) (specpdl_arg (&this_binding)); | |
| 3109 | symbol = XCAR (this_binding.symbol); | 3134 | break; |
| 3110 | where = XCAR (XCDR (this_binding.symbol)); | 3135 | case SPECPDL_LET: |
| 3111 | 3136 | /* If variable has a trivial value (no forwarding), we can | |
| 3112 | if (NILP (where)) | 3137 | just set it. No need to check for constant symbols here, |
| 3113 | Fset_default (symbol, this_binding.old_value); | 3138 | since that was already done by specbind. */ |
| 3114 | /* If `where' is non-nil, reset the value in the appropriate | 3139 | if (XSYMBOL (specpdl_symbol (&this_binding))->redirect |
| 3115 | local binding, but only if that binding still exists. */ | 3140 | == SYMBOL_PLAINVAL) |
| 3116 | else if (BUFFERP (where) | 3141 | SET_SYMBOL_VAL (XSYMBOL (specpdl_symbol (&this_binding)), |
| 3117 | ? !NILP (Flocal_variable_p (symbol, where)) | 3142 | specpdl_old_value (&this_binding)); |
| 3118 | : !NILP (Fassq (symbol, XFRAME (where)->param_alist))) | 3143 | else |
| 3119 | set_internal (symbol, this_binding.old_value, where, 1); | 3144 | /* NOTE: we only ever come here if make_local_foo was used for |
| 3145 | the first time on this var within this let. */ | ||
| 3146 | Fset_default (specpdl_symbol (&this_binding), | ||
| 3147 | specpdl_old_value (&this_binding)); | ||
| 3148 | break; | ||
| 3149 | case SPECPDL_BACKTRACE: | ||
| 3150 | break; | ||
| 3151 | case SPECPDL_LET_LOCAL: | ||
| 3152 | case SPECPDL_LET_DEFAULT: | ||
| 3153 | { /* If the symbol is a list, it is really (SYMBOL WHERE | ||
| 3154 | . CURRENT-BUFFER) where WHERE is either nil, a buffer, or a | ||
| 3155 | frame. If WHERE is a buffer or frame, this indicates we | ||
| 3156 | bound a variable that had a buffer-local or frame-local | ||
| 3157 | binding. WHERE nil means that the variable had the default | ||
| 3158 | value when it was bound. CURRENT-BUFFER is the buffer that | ||
| 3159 | was current when the variable was bound. */ | ||
| 3160 | Lisp_Object symbol = specpdl_symbol (&this_binding); | ||
| 3161 | Lisp_Object where = specpdl_where (&this_binding); | ||
| 3162 | eassert (BUFFERP (where)); | ||
| 3163 | |||
| 3164 | if (this_binding.kind == SPECPDL_LET_DEFAULT) | ||
| 3165 | Fset_default (symbol, specpdl_old_value (&this_binding)); | ||
| 3166 | /* If this was a local binding, reset the value in the appropriate | ||
| 3167 | buffer, but only if that buffer's binding still exists. */ | ||
| 3168 | else if (!NILP (Flocal_variable_p (symbol, where))) | ||
| 3169 | set_internal (symbol, specpdl_old_value (&this_binding), | ||
| 3170 | where, 1); | ||
| 3171 | } | ||
| 3172 | break; | ||
| 3120 | } | 3173 | } |
| 3121 | /* If variable has a trivial value (no forwarding), we can | ||
| 3122 | just set it. No need to check for constant symbols here, | ||
| 3123 | since that was already done by specbind. */ | ||
| 3124 | else if (XSYMBOL (this_binding.symbol)->redirect == SYMBOL_PLAINVAL) | ||
| 3125 | SET_SYMBOL_VAL (XSYMBOL (this_binding.symbol), | ||
| 3126 | this_binding.old_value); | ||
| 3127 | else | ||
| 3128 | /* NOTE: we only ever come here if make_local_foo was used for | ||
| 3129 | the first time on this var within this let. */ | ||
| 3130 | Fset_default (this_binding.symbol, this_binding.old_value); | ||
| 3131 | } | 3174 | } |
| 3132 | 3175 | ||
| 3133 | if (NILP (Vquit_flag) && !NILP (quitf)) | 3176 | if (NILP (Vquit_flag) && !NILP (quitf)) |
| @@ -3153,18 +3196,16 @@ DEFUN ("backtrace-debug", Fbacktrace_debug, Sbacktrace_debug, 2, 2, 0, | |||
| 3153 | The debugger is entered when that frame exits, if the flag is non-nil. */) | 3196 | The debugger is entered when that frame exits, if the flag is non-nil. */) |
| 3154 | (Lisp_Object level, Lisp_Object flag) | 3197 | (Lisp_Object level, Lisp_Object flag) |
| 3155 | { | 3198 | { |
| 3156 | register struct backtrace *backlist = backtrace_list; | 3199 | struct specbinding *pdl = backtrace_top (); |
| 3157 | register EMACS_INT i; | 3200 | register EMACS_INT i; |
| 3158 | 3201 | ||
| 3159 | CHECK_NUMBER (level); | 3202 | CHECK_NUMBER (level); |
| 3160 | 3203 | ||
| 3161 | for (i = 0; backlist && i < XINT (level); i++) | 3204 | for (i = 0; backtrace_p (pdl) && i < XINT (level); i++) |
| 3162 | { | 3205 | pdl = backtrace_next (pdl); |
| 3163 | backlist = backlist->next; | ||
| 3164 | } | ||
| 3165 | 3206 | ||
| 3166 | if (backlist) | 3207 | if (backtrace_p (pdl)) |
| 3167 | backlist->debug_on_exit = !NILP (flag); | 3208 | set_backtrace_debug_on_exit (pdl, !NILP (flag)); |
| 3168 | 3209 | ||
| 3169 | return flag; | 3210 | return flag; |
| 3170 | } | 3211 | } |
| @@ -3174,58 +3215,41 @@ DEFUN ("backtrace", Fbacktrace, Sbacktrace, 0, 0, "", | |||
| 3174 | Output stream used is value of `standard-output'. */) | 3215 | Output stream used is value of `standard-output'. */) |
| 3175 | (void) | 3216 | (void) |
| 3176 | { | 3217 | { |
| 3177 | register struct backtrace *backlist = backtrace_list; | 3218 | struct specbinding *pdl = backtrace_top (); |
| 3178 | Lisp_Object tail; | ||
| 3179 | Lisp_Object tem; | 3219 | Lisp_Object tem; |
| 3180 | struct gcpro gcpro1; | ||
| 3181 | Lisp_Object old_print_level = Vprint_level; | 3220 | Lisp_Object old_print_level = Vprint_level; |
| 3182 | 3221 | ||
| 3183 | if (NILP (Vprint_level)) | 3222 | if (NILP (Vprint_level)) |
| 3184 | XSETFASTINT (Vprint_level, 8); | 3223 | XSETFASTINT (Vprint_level, 8); |
| 3185 | 3224 | ||
| 3186 | tail = Qnil; | 3225 | while (backtrace_p (pdl)) |
| 3187 | GCPRO1 (tail); | ||
| 3188 | |||
| 3189 | while (backlist) | ||
| 3190 | { | 3226 | { |
| 3191 | write_string (backlist->debug_on_exit ? "* " : " ", 2); | 3227 | write_string (backtrace_debug_on_exit (pdl) ? "* " : " ", 2); |
| 3192 | if (backlist->nargs == UNEVALLED) | 3228 | if (backtrace_nargs (pdl) == UNEVALLED) |
| 3193 | { | 3229 | { |
| 3194 | Fprin1 (Fcons (backlist->function, *backlist->args), Qnil); | 3230 | Fprin1 (Fcons (backtrace_function (pdl), *backtrace_args (pdl)), |
| 3231 | Qnil); | ||
| 3195 | write_string ("\n", -1); | 3232 | write_string ("\n", -1); |
| 3196 | } | 3233 | } |
| 3197 | else | 3234 | else |
| 3198 | { | 3235 | { |
| 3199 | tem = backlist->function; | 3236 | tem = backtrace_function (pdl); |
| 3200 | Fprin1 (tem, Qnil); /* This can QUIT. */ | 3237 | Fprin1 (tem, Qnil); /* This can QUIT. */ |
| 3201 | write_string ("(", -1); | 3238 | write_string ("(", -1); |
| 3202 | if (backlist->nargs == MANY) | 3239 | { |
| 3203 | { /* FIXME: Can this happen? */ | 3240 | ptrdiff_t i; |
| 3204 | bool later_arg = 0; | 3241 | for (i = 0; i < backtrace_nargs (pdl); i++) |
| 3205 | for (tail = *backlist->args; !NILP (tail); tail = Fcdr (tail)) | 3242 | { |
| 3206 | { | 3243 | if (i) write_string (" ", -1); |
| 3207 | if (later_arg) | 3244 | Fprin1 (backtrace_args (pdl)[i], Qnil); |
| 3208 | write_string (" ", -1); | 3245 | } |
| 3209 | Fprin1 (Fcar (tail), Qnil); | 3246 | } |
| 3210 | later_arg = 1; | ||
| 3211 | } | ||
| 3212 | } | ||
| 3213 | else | ||
| 3214 | { | ||
| 3215 | ptrdiff_t i; | ||
| 3216 | for (i = 0; i < backlist->nargs; i++) | ||
| 3217 | { | ||
| 3218 | if (i) write_string (" ", -1); | ||
| 3219 | Fprin1 (backlist->args[i], Qnil); | ||
| 3220 | } | ||
| 3221 | } | ||
| 3222 | write_string (")\n", -1); | 3247 | write_string (")\n", -1); |
| 3223 | } | 3248 | } |
| 3224 | backlist = backlist->next; | 3249 | pdl = backtrace_next (pdl); |
| 3225 | } | 3250 | } |
| 3226 | 3251 | ||
| 3227 | Vprint_level = old_print_level; | 3252 | Vprint_level = old_print_level; |
| 3228 | UNGCPRO; | ||
| 3229 | return Qnil; | 3253 | return Qnil; |
| 3230 | } | 3254 | } |
| 3231 | 3255 | ||
| @@ -3241,53 +3265,84 @@ or a lambda expression for macro calls. | |||
| 3241 | If NFRAMES is more than the number of frames, the value is nil. */) | 3265 | If NFRAMES is more than the number of frames, the value is nil. */) |
| 3242 | (Lisp_Object nframes) | 3266 | (Lisp_Object nframes) |
| 3243 | { | 3267 | { |
| 3244 | register struct backtrace *backlist = backtrace_list; | 3268 | struct specbinding *pdl = backtrace_top (); |
| 3245 | register EMACS_INT i; | 3269 | register EMACS_INT i; |
| 3246 | Lisp_Object tem; | ||
| 3247 | 3270 | ||
| 3248 | CHECK_NATNUM (nframes); | 3271 | CHECK_NATNUM (nframes); |
| 3249 | 3272 | ||
| 3250 | /* Find the frame requested. */ | 3273 | /* Find the frame requested. */ |
| 3251 | for (i = 0; backlist && i < XFASTINT (nframes); i++) | 3274 | for (i = 0; backtrace_p (pdl) && i < XFASTINT (nframes); i++) |
| 3252 | backlist = backlist->next; | 3275 | pdl = backtrace_next (pdl); |
| 3253 | 3276 | ||
| 3254 | if (!backlist) | 3277 | if (!backtrace_p (pdl)) |
| 3255 | return Qnil; | 3278 | return Qnil; |
| 3256 | if (backlist->nargs == UNEVALLED) | 3279 | if (backtrace_nargs (pdl) == UNEVALLED) |
| 3257 | return Fcons (Qnil, Fcons (backlist->function, *backlist->args)); | 3280 | return Fcons (Qnil, |
| 3281 | Fcons (backtrace_function (pdl), *backtrace_args (pdl))); | ||
| 3258 | else | 3282 | else |
| 3259 | { | 3283 | { |
| 3260 | if (backlist->nargs == MANY) /* FIXME: Can this happen? */ | 3284 | Lisp_Object tem = Flist (backtrace_nargs (pdl), backtrace_args (pdl)); |
| 3261 | tem = *backlist->args; | ||
| 3262 | else | ||
| 3263 | tem = Flist (backlist->nargs, backlist->args); | ||
| 3264 | 3285 | ||
| 3265 | return Fcons (Qt, Fcons (backlist->function, tem)); | 3286 | return Fcons (Qt, Fcons (backtrace_function (pdl), tem)); |
| 3266 | } | 3287 | } |
| 3267 | } | 3288 | } |
| 3268 | 3289 | ||
| 3269 | 3290 | ||
| 3270 | #if BYTE_MARK_STACK | ||
| 3271 | void | 3291 | void |
| 3272 | mark_backtrace (void) | 3292 | mark_specpdl (void) |
| 3273 | { | 3293 | { |
| 3274 | register struct backtrace *backlist; | 3294 | struct specbinding *pdl; |
| 3275 | ptrdiff_t i; | 3295 | for (pdl = specpdl; pdl != specpdl_ptr; pdl++) |
| 3276 | |||
| 3277 | for (backlist = backtrace_list; backlist; backlist = backlist->next) | ||
| 3278 | { | 3296 | { |
| 3279 | mark_object (backlist->function); | 3297 | switch (pdl->kind) |
| 3298 | { | ||
| 3299 | case SPECPDL_UNWIND: | ||
| 3300 | mark_object (specpdl_arg (pdl)); | ||
| 3301 | break; | ||
| 3302 | case SPECPDL_BACKTRACE: | ||
| 3303 | { | ||
| 3304 | ptrdiff_t nargs = backtrace_nargs (pdl); | ||
| 3305 | mark_object (backtrace_function (pdl)); | ||
| 3306 | if (nargs == UNEVALLED) | ||
| 3307 | nargs = 1; | ||
| 3308 | while (nargs--) | ||
| 3309 | mark_object (backtrace_args (pdl)[nargs]); | ||
| 3310 | } | ||
| 3311 | break; | ||
| 3312 | case SPECPDL_LET_DEFAULT: | ||
| 3313 | case SPECPDL_LET_LOCAL: | ||
| 3314 | mark_object (specpdl_where (pdl)); | ||
| 3315 | case SPECPDL_LET: | ||
| 3316 | mark_object (specpdl_symbol (pdl)); | ||
| 3317 | mark_object (specpdl_old_value (pdl)); | ||
| 3318 | } | ||
| 3319 | } | ||
| 3320 | } | ||
| 3321 | |||
| 3322 | void | ||
| 3323 | get_backtrace (Lisp_Object array) | ||
| 3324 | { | ||
| 3325 | struct specbinding *pdl = backtrace_next (backtrace_top ()); | ||
| 3326 | ptrdiff_t i = 0, asize = ASIZE (array); | ||
| 3280 | 3327 | ||
| 3281 | if (backlist->nargs == UNEVALLED | 3328 | /* Copy the backtrace contents into working memory. */ |
| 3282 | || backlist->nargs == MANY) /* FIXME: Can this happen? */ | 3329 | for (; i < asize; i++) |
| 3283 | i = 1; | 3330 | { |
| 3331 | if (backtrace_p (pdl)) | ||
| 3332 | { | ||
| 3333 | ASET (array, i, backtrace_function (pdl)); | ||
| 3334 | pdl = backtrace_next (pdl); | ||
| 3335 | } | ||
| 3284 | else | 3336 | else |
| 3285 | i = backlist->nargs; | 3337 | ASET (array, i, Qnil); |
| 3286 | while (i--) | ||
| 3287 | mark_object (backlist->args[i]); | ||
| 3288 | } | 3338 | } |
| 3289 | } | 3339 | } |
| 3290 | #endif | 3340 | |
| 3341 | Lisp_Object backtrace_top_function (void) | ||
| 3342 | { | ||
| 3343 | struct specbinding *pdl = backtrace_top (); | ||
| 3344 | return (backtrace_p (pdl) ? backtrace_function (pdl) : Qnil); | ||
| 3345 | } | ||
| 3291 | 3346 | ||
| 3292 | void | 3347 | void |
| 3293 | syms_of_eval (void) | 3348 | syms_of_eval (void) |
diff --git a/src/fileio.c b/src/fileio.c index e2b1007fb0b..ce5d4854fee 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -776,8 +776,9 @@ probably use `make-temp-file' instead, except in three circumstances: | |||
| 776 | DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0, | 776 | DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0, |
| 777 | doc: /* Convert filename NAME to absolute, and canonicalize it. | 777 | doc: /* Convert filename NAME to absolute, and canonicalize it. |
| 778 | Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative | 778 | Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative |
| 779 | \(does not start with slash or tilde); if DEFAULT-DIRECTORY is nil or missing, | 779 | \(does not start with slash or tilde); both the directory name and |
| 780 | the current buffer's value of `default-directory' is used. | 780 | a directory's file name are accepted. If DEFAULT-DIRECTORY is nil or |
| 781 | missing, the current buffer's value of `default-directory' is used. | ||
| 781 | NAME should be a string that is a valid file name for the underlying | 782 | NAME should be a string that is a valid file name for the underlying |
| 782 | filesystem. | 783 | filesystem. |
| 783 | File name components that are `.' are removed, and | 784 | File name components that are `.' are removed, and |
| @@ -3489,7 +3490,6 @@ by calling `format-decode', which see. */) | |||
| 3489 | EMACS_TIME mtime; | 3490 | EMACS_TIME mtime; |
| 3490 | int fd; | 3491 | int fd; |
| 3491 | ptrdiff_t inserted = 0; | 3492 | ptrdiff_t inserted = 0; |
| 3492 | bool nochange = 0; | ||
| 3493 | ptrdiff_t how_much; | 3493 | ptrdiff_t how_much; |
| 3494 | off_t beg_offset, end_offset; | 3494 | off_t beg_offset, end_offset; |
| 3495 | int unprocessed; | 3495 | int unprocessed; |
| @@ -4060,9 +4060,7 @@ by calling `format-decode', which see. */) | |||
| 4060 | if (bufpos == inserted) | 4060 | if (bufpos == inserted) |
| 4061 | { | 4061 | { |
| 4062 | /* Truncate the buffer to the size of the file. */ | 4062 | /* Truncate the buffer to the size of the file. */ |
| 4063 | if (same_at_start == same_at_end) | 4063 | if (same_at_start != same_at_end) |
| 4064 | nochange = 1; | ||
| 4065 | else | ||
| 4066 | del_range_byte (same_at_start, same_at_end, 0); | 4064 | del_range_byte (same_at_start, same_at_end, 0); |
| 4067 | inserted = 0; | 4065 | inserted = 0; |
| 4068 | 4066 | ||
diff --git a/src/frame.c b/src/frame.c index e88432b9802..a207ef690da 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -114,7 +114,7 @@ Lisp_Object Qface_set_after_frame_default; | |||
| 114 | 114 | ||
| 115 | static Lisp_Object Qdelete_frame_functions; | 115 | static Lisp_Object Qdelete_frame_functions; |
| 116 | 116 | ||
| 117 | Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource; | 117 | static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource; |
| 118 | 118 | ||
| 119 | #ifdef HAVE_WINDOW_SYSTEM | 119 | #ifdef HAVE_WINDOW_SYSTEM |
| 120 | static void x_report_frame_params (struct frame *, Lisp_Object *); | 120 | static void x_report_frame_params (struct frame *, Lisp_Object *); |
| @@ -167,7 +167,7 @@ struct frame * | |||
| 167 | decode_window_system_frame (Lisp_Object frame) | 167 | decode_window_system_frame (Lisp_Object frame) |
| 168 | { | 168 | { |
| 169 | struct frame *f = decode_live_frame (frame); | 169 | struct frame *f = decode_live_frame (frame); |
| 170 | 170 | ||
| 171 | if (!window_system_available (f)) | 171 | if (!window_system_available (f)) |
| 172 | error ("Window system frame should be used"); | 172 | error ("Window system frame should be used"); |
| 173 | return f; | 173 | return f; |
| @@ -4138,6 +4138,8 @@ selected frame. This is useful when `make-pointer-invisible' is set. */) | |||
| 4138 | 4138 | ||
| 4139 | #ifdef HAVE_WINDOW_SYSTEM | 4139 | #ifdef HAVE_WINDOW_SYSTEM |
| 4140 | 4140 | ||
| 4141 | # if (defined HAVE_NS \ | ||
| 4142 | || (!defined USE_GTK && (defined HAVE_XINERAMA || defined HAVE_XRANDR))) | ||
| 4141 | void | 4143 | void |
| 4142 | free_monitors (struct MonitorInfo *monitors, int n_monitors) | 4144 | free_monitors (struct MonitorInfo *monitors, int n_monitors) |
| 4143 | { | 4145 | { |
| @@ -4146,6 +4148,7 @@ free_monitors (struct MonitorInfo *monitors, int n_monitors) | |||
| 4146 | xfree (monitors[i].name); | 4148 | xfree (monitors[i].name); |
| 4147 | xfree (monitors); | 4149 | xfree (monitors); |
| 4148 | } | 4150 | } |
| 4151 | # endif | ||
| 4149 | 4152 | ||
| 4150 | Lisp_Object | 4153 | Lisp_Object |
| 4151 | make_monitor_attribute_list (struct MonitorInfo *monitors, | 4154 | make_monitor_attribute_list (struct MonitorInfo *monitors, |
diff --git a/src/frame.h b/src/frame.h index 12aa48b2d92..31d3e73c3c3 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -1198,8 +1198,6 @@ extern Lisp_Object Qdisplay; | |||
| 1198 | 1198 | ||
| 1199 | extern Lisp_Object Qrun_hook_with_args; | 1199 | extern Lisp_Object Qrun_hook_with_args; |
| 1200 | 1200 | ||
| 1201 | extern Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource; | ||
| 1202 | |||
| 1203 | #ifdef HAVE_WINDOW_SYSTEM | 1201 | #ifdef HAVE_WINDOW_SYSTEM |
| 1204 | 1202 | ||
| 1205 | /* The class of this X application. */ | 1203 | /* The class of this X application. */ |
diff --git a/src/gfilenotify.c b/src/gfilenotify.c new file mode 100644 index 00000000000..c8d12ce8fa0 --- /dev/null +++ b/src/gfilenotify.c | |||
| @@ -0,0 +1,283 @@ | |||
| 1 | /* Filesystem notifications support with glib API. | ||
| 2 | Copyright (C) 2013 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This file is part of GNU Emacs. | ||
| 5 | |||
| 6 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation, either version 3 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 18 | |||
| 19 | #include <config.h> | ||
| 20 | |||
| 21 | #ifdef HAVE_GFILENOTIFY | ||
| 22 | #include <stdio.h> | ||
| 23 | #include <gio/gio.h> | ||
| 24 | #include "lisp.h" | ||
| 25 | #include "coding.h" | ||
| 26 | #include "frame.h" | ||
| 27 | #include "termhooks.h" | ||
| 28 | #include "keyboard.h" | ||
| 29 | #include "process.h" | ||
| 30 | |||
| 31 | |||
| 32 | /* Subroutines. */ | ||
| 33 | static Lisp_Object Qgfile_add_watch; | ||
| 34 | static Lisp_Object Qgfile_rm_watch; | ||
| 35 | |||
| 36 | /* Filter objects. */ | ||
| 37 | static Lisp_Object Qwatch_mounts; /* G_FILE_MONITOR_WATCH_MOUNTS */ | ||
| 38 | static Lisp_Object Qsend_moved; /* G_FILE_MONITOR_SEND_MOVED */ | ||
| 39 | |||
| 40 | /* Event types. */ | ||
| 41 | static Lisp_Object Qchanged; /* G_FILE_MONITOR_EVENT_CHANGED */ | ||
| 42 | static Lisp_Object Qchanges_done_hint; /* G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT */ | ||
| 43 | static Lisp_Object Qdeleted; /* G_FILE_MONITOR_EVENT_DELETED */ | ||
| 44 | static Lisp_Object Qcreated; /* G_FILE_MONITOR_EVENT_CREATED */ | ||
| 45 | static Lisp_Object Qattribute_changed; /* G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED */ | ||
| 46 | static Lisp_Object Qpre_unmount; /* G_FILE_MONITOR_EVENT_PRE_UNMOUNT */ | ||
| 47 | static Lisp_Object Qunmounted; /* G_FILE_MONITOR_EVENT_UNMOUNTED */ | ||
| 48 | static Lisp_Object Qmoved; /* G_FILE_MONITOR_EVENT_MOVED */ | ||
| 49 | |||
| 50 | static Lisp_Object watch_list; | ||
| 51 | |||
| 52 | /* This is the callback function for arriving signals from | ||
| 53 | g_file_monitor. It shall create a Lisp event, and put it into | ||
| 54 | Emacs input queue. */ | ||
| 55 | static gboolean | ||
| 56 | dir_monitor_callback (GFileMonitor *monitor, | ||
| 57 | GFile *file, | ||
| 58 | GFile *other_file, | ||
| 59 | GFileMonitorEvent event_type, | ||
| 60 | gpointer user_data) | ||
| 61 | { | ||
| 62 | Lisp_Object symbol, monitor_object, watch_object; | ||
| 63 | char *name = g_file_get_parse_name (file); | ||
| 64 | char *oname = other_file ? g_file_get_parse_name (other_file) : NULL; | ||
| 65 | |||
| 66 | /* Determine event symbol. */ | ||
| 67 | switch (event_type) | ||
| 68 | { | ||
| 69 | case G_FILE_MONITOR_EVENT_CHANGED: | ||
| 70 | symbol = Qchanged; | ||
| 71 | break; | ||
| 72 | case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: | ||
| 73 | symbol = Qchanges_done_hint; | ||
| 74 | break; | ||
| 75 | case G_FILE_MONITOR_EVENT_DELETED: | ||
| 76 | symbol = Qdeleted; | ||
| 77 | break; | ||
| 78 | case G_FILE_MONITOR_EVENT_CREATED: | ||
| 79 | symbol = Qcreated; | ||
| 80 | break; | ||
| 81 | case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: | ||
| 82 | symbol = Qattribute_changed; | ||
| 83 | break; | ||
| 84 | case G_FILE_MONITOR_EVENT_PRE_UNMOUNT: | ||
| 85 | symbol = Qpre_unmount; | ||
| 86 | break; | ||
| 87 | case G_FILE_MONITOR_EVENT_UNMOUNTED: | ||
| 88 | symbol = Qunmounted; | ||
| 89 | break; | ||
| 90 | case G_FILE_MONITOR_EVENT_MOVED: | ||
| 91 | symbol = Qmoved; | ||
| 92 | break; | ||
| 93 | default: | ||
| 94 | goto cleanup; | ||
| 95 | } | ||
| 96 | |||
| 97 | /* Determine callback function. */ | ||
| 98 | monitor_object = XIL ((intptr_t) monitor); | ||
| 99 | eassert (INTEGERP (monitor_object)); | ||
| 100 | watch_object = assq_no_quit (monitor_object, watch_list); | ||
| 101 | |||
| 102 | if (CONSP (watch_object)) | ||
| 103 | { | ||
| 104 | /* Construct an event. */ | ||
| 105 | struct input_event event; | ||
| 106 | Lisp_Object otail = oname ? list1 (build_string (oname)) : Qnil; | ||
| 107 | EVENT_INIT (event); | ||
| 108 | event.kind = FILE_NOTIFY_EVENT; | ||
| 109 | event.frame_or_window = Qnil; | ||
| 110 | event.arg = list2 (Fcons (monitor_object, | ||
| 111 | Fcons (symbol, | ||
| 112 | Fcons (build_string (name), | ||
| 113 | otail))), | ||
| 114 | XCDR (watch_object)); | ||
| 115 | |||
| 116 | /* Store it into the input event queue. */ | ||
| 117 | kbd_buffer_store_event (&event); | ||
| 118 | } | ||
| 119 | |||
| 120 | /* Cleanup. */ | ||
| 121 | cleanup: | ||
| 122 | g_free (name); | ||
| 123 | g_free (oname); | ||
| 124 | |||
| 125 | return TRUE; | ||
| 126 | } | ||
| 127 | |||
| 128 | DEFUN ("gfile-add-watch", Fgfile_add_watch, Sgfile_add_watch, 3, 3, 0, | ||
| 129 | doc: /* Add a watch for filesystem events pertaining to FILE. | ||
| 130 | |||
| 131 | This arranges for filesystem events pertaining to FILE to be reported | ||
| 132 | to Emacs. Use `gfile-rm-watch' to cancel the watch. | ||
| 133 | |||
| 134 | Value is a descriptor for the added watch. If the file cannot be | ||
| 135 | watched for some reason, this function signals a `file-error' error. | ||
| 136 | |||
| 137 | FLAGS is a list of conditions to set what will be watched for. It can | ||
| 138 | include the following symbols: | ||
| 139 | |||
| 140 | 'watch-mounts' -- watch for mount events | ||
| 141 | 'send-moved' -- pair 'deleted' and 'created' events caused by file | ||
| 142 | renames (moves) and send a single 'event-moved' | ||
| 143 | event instead | ||
| 144 | |||
| 145 | When any event happens, Emacs will call the CALLBACK function passing | ||
| 146 | it a single argument EVENT, which is of the form | ||
| 147 | |||
| 148 | (DESCRIPTOR ACTION FILE [FILE1]) | ||
| 149 | |||
| 150 | DESCRIPTOR is the same object as the one returned by this function. | ||
| 151 | ACTION is the description of the event. It could be any one of the | ||
| 152 | following: | ||
| 153 | |||
| 154 | 'changed' -- FILE has changed | ||
| 155 | 'changes-done-hint' -- a hint that this was probably the last change | ||
| 156 | in a set of changes | ||
| 157 | 'deleted' -- FILE was deleted | ||
| 158 | 'created' -- FILE was created | ||
| 159 | 'attribute-changed' -- a FILE attribute was changed | ||
| 160 | 'pre-unmount' -- the FILE location will soon be unmounted | ||
| 161 | 'unmounted' -- the FILE location was unmounted | ||
| 162 | 'moved' -- FILE was moved to FILE1 | ||
| 163 | |||
| 164 | FILE is the name of the file whose event is being reported. FILE1 | ||
| 165 | will be reported only in case of the 'moved' event. */) | ||
| 166 | (Lisp_Object file, Lisp_Object flags, Lisp_Object callback) | ||
| 167 | { | ||
| 168 | Lisp_Object watch_descriptor, watch_object; | ||
| 169 | GFile *gfile; | ||
| 170 | GFileMonitor *monitor; | ||
| 171 | GFileMonitorFlags gflags = G_FILE_MONITOR_NONE; | ||
| 172 | |||
| 173 | /* Check parameters. */ | ||
| 174 | CHECK_STRING (file); | ||
| 175 | file = Fdirectory_file_name (Fexpand_file_name (file, Qnil)); | ||
| 176 | if (NILP (Ffile_exists_p (file))) | ||
| 177 | report_file_error ("File does not exists", Fcons (file, Qnil)); | ||
| 178 | |||
| 179 | CHECK_LIST (flags); | ||
| 180 | |||
| 181 | if (!FUNCTIONP (callback)) | ||
| 182 | wrong_type_argument (Qinvalid_function, callback); | ||
| 183 | |||
| 184 | /* Create GFile name. */ | ||
| 185 | gfile = g_file_new_for_path (SSDATA (ENCODE_FILE (file))); | ||
| 186 | |||
| 187 | /* Assemble flags. */ | ||
| 188 | if (!NILP (Fmember (Qwatch_mounts, flags))) | ||
| 189 | gflags |= G_FILE_MONITOR_WATCH_MOUNTS; | ||
| 190 | if (!NILP (Fmember (Qsend_moved, flags))) | ||
| 191 | gflags |= G_FILE_MONITOR_SEND_MOVED; | ||
| 192 | |||
| 193 | /* Enable watch. */ | ||
| 194 | monitor = g_file_monitor (gfile, gflags, NULL, NULL); | ||
| 195 | if (! monitor) | ||
| 196 | xsignal2 (Qfile_error, build_string ("Cannot watch file"), file); | ||
| 197 | |||
| 198 | /* On all known glib platforms, converting MONITOR directly to a | ||
| 199 | Lisp_Object value results is a Lisp integer, which is safe. This | ||
| 200 | assumption is dicey, though, so check it now. */ | ||
| 201 | watch_descriptor = XIL ((intptr_t) monitor); | ||
| 202 | if (! INTEGERP (watch_descriptor)) | ||
| 203 | { | ||
| 204 | g_object_unref (monitor); | ||
| 205 | xsignal2 (Qfile_error, build_string ("Unsupported file watcher"), file); | ||
| 206 | } | ||
| 207 | |||
| 208 | g_signal_connect (monitor, "changed", | ||
| 209 | (GCallback) dir_monitor_callback, NULL); | ||
| 210 | |||
| 211 | /* Store watch object in watch list. */ | ||
| 212 | watch_object = Fcons (watch_descriptor, callback); | ||
| 213 | watch_list = Fcons (watch_object, watch_list); | ||
| 214 | |||
| 215 | return watch_descriptor; | ||
| 216 | } | ||
| 217 | |||
| 218 | DEFUN ("gfile-rm-watch", Fgfile_rm_watch, Sgfile_rm_watch, 1, 1, 0, | ||
| 219 | doc: /* Remove an existing WATCH-DESCRIPTOR. | ||
| 220 | |||
| 221 | WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */) | ||
| 222 | (Lisp_Object watch_descriptor) | ||
| 223 | { | ||
| 224 | intptr_t int_monitor; | ||
| 225 | GFileMonitor *monitor; | ||
| 226 | Lisp_Object watch_object = assq_no_quit (watch_descriptor, watch_list); | ||
| 227 | |||
| 228 | if (! CONSP (watch_object)) | ||
| 229 | xsignal2 (Qfile_error, build_string ("Not a watch descriptor"), | ||
| 230 | watch_descriptor); | ||
| 231 | |||
| 232 | eassert (INTEGERP (watch_descriptor)); | ||
| 233 | int_monitor = XLI (watch_descriptor); | ||
| 234 | monitor = (GFileMonitor *) int_monitor; | ||
| 235 | if (!g_file_monitor_cancel (monitor)) | ||
| 236 | xsignal2 (Qfile_error, build_string ("Could not rm watch"), | ||
| 237 | watch_descriptor); | ||
| 238 | |||
| 239 | /* Remove watch descriptor from watch list. */ | ||
| 240 | watch_list = Fdelq (watch_object, watch_list); | ||
| 241 | |||
| 242 | /* Cleanup. */ | ||
| 243 | g_object_unref (monitor); | ||
| 244 | |||
| 245 | return Qt; | ||
| 246 | } | ||
| 247 | |||
| 248 | |||
| 249 | void | ||
| 250 | globals_of_gfilenotify (void) | ||
| 251 | { | ||
| 252 | g_type_init (); | ||
| 253 | watch_list = Qnil; | ||
| 254 | } | ||
| 255 | |||
| 256 | void | ||
| 257 | syms_of_gfilenotify (void) | ||
| 258 | { | ||
| 259 | |||
| 260 | DEFSYM (Qgfile_add_watch, "gfile-add-watch"); | ||
| 261 | defsubr (&Sgfile_add_watch); | ||
| 262 | |||
| 263 | DEFSYM (Qgfile_rm_watch, "gfile-rm-watch"); | ||
| 264 | defsubr (&Sgfile_rm_watch); | ||
| 265 | |||
| 266 | DEFSYM (Qwatch_mounts, "watch-mounts"); | ||
| 267 | DEFSYM (Qsend_moved, "send-moved"); | ||
| 268 | DEFSYM (Qchanged, "changed"); | ||
| 269 | DEFSYM (Qchanges_done_hint, "changes-done-hint"); | ||
| 270 | DEFSYM (Qdeleted, "deleted"); | ||
| 271 | DEFSYM (Qcreated, "created"); | ||
| 272 | DEFSYM (Qattribute_changed, "attribute-changed"); | ||
| 273 | DEFSYM (Qpre_unmount, "pre-unmount"); | ||
| 274 | DEFSYM (Qunmounted, "unmounted"); | ||
| 275 | DEFSYM (Qmoved, "moved"); | ||
| 276 | |||
| 277 | staticpro (&watch_list); | ||
| 278 | |||
| 279 | Fprovide (intern_c_string ("gfilenotify"), Qnil); | ||
| 280 | |||
| 281 | } | ||
| 282 | |||
| 283 | #endif /* HAVE_GFILENOTIFY */ | ||
diff --git a/src/keyboard.c b/src/keyboard.c index 7c3056079be..6129fdd26c8 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -308,9 +308,6 @@ static Lisp_Object Qfunction_key; | |||
| 308 | Lisp_Object Qmouse_click; | 308 | Lisp_Object Qmouse_click; |
| 309 | #ifdef HAVE_NTGUI | 309 | #ifdef HAVE_NTGUI |
| 310 | Lisp_Object Qlanguage_change; | 310 | Lisp_Object Qlanguage_change; |
| 311 | #ifdef WINDOWSNT | ||
| 312 | Lisp_Object Qfile_w32notify; | ||
| 313 | #endif | ||
| 314 | #endif | 311 | #endif |
| 315 | static Lisp_Object Qdrag_n_drop; | 312 | static Lisp_Object Qdrag_n_drop; |
| 316 | static Lisp_Object Qsave_session; | 313 | static Lisp_Object Qsave_session; |
| @@ -320,9 +317,9 @@ static Lisp_Object Qdbus_event; | |||
| 320 | #ifdef HAVE_XWIDGETS | 317 | #ifdef HAVE_XWIDGETS |
| 321 | Lisp_Object Qxwidget_event; | 318 | Lisp_Object Qxwidget_event; |
| 322 | #endif | 319 | #endif |
| 323 | #ifdef HAVE_INOTIFY | 320 | #ifdef USE_FILE_NOTIFY |
| 324 | static Lisp_Object Qfile_inotify; | 321 | static Lisp_Object Qfile_notify; |
| 325 | #endif /* HAVE_INOTIFY */ | 322 | #endif /* USE_FILE_NOTIFY */ |
| 326 | static Lisp_Object Qconfig_changed_event; | 323 | static Lisp_Object Qconfig_changed_event; |
| 327 | 324 | ||
| 328 | /* Lisp_Object Qmouse_movement; - also an event header */ | 325 | /* Lisp_Object Qmouse_movement; - also an event header */ |
| @@ -1888,7 +1885,7 @@ safe_run_hooks_error (Lisp_Object error_data) | |||
| 1888 | = CONSP (Vinhibit_quit) ? XCAR (Vinhibit_quit) : Vinhibit_quit; | 1885 | = CONSP (Vinhibit_quit) ? XCAR (Vinhibit_quit) : Vinhibit_quit; |
| 1889 | Lisp_Object fun = CONSP (Vinhibit_quit) ? XCDR (Vinhibit_quit) : Qnil; | 1886 | Lisp_Object fun = CONSP (Vinhibit_quit) ? XCDR (Vinhibit_quit) : Qnil; |
| 1890 | Lisp_Object args[4]; | 1887 | Lisp_Object args[4]; |
| 1891 | args[0] = build_string ("Error in %s (%s): %S"); | 1888 | args[0] = build_string ("Error in %s (%S): %S"); |
| 1892 | args[1] = hook; | 1889 | args[1] = hook; |
| 1893 | args[2] = fun; | 1890 | args[2] = fun; |
| 1894 | args[3] = error_data; | 1891 | args[3] = error_data; |
| @@ -4016,18 +4013,22 @@ kbd_buffer_get_event (KBOARD **kbp, | |||
| 4016 | kbd_fetch_ptr = event + 1; | 4013 | kbd_fetch_ptr = event + 1; |
| 4017 | } | 4014 | } |
| 4018 | #endif | 4015 | #endif |
| 4019 | #ifdef WINDOWSNT | 4016 | #ifdef USE_FILE_NOTIFY |
| 4020 | else if (event->kind == FILE_NOTIFY_EVENT) | 4017 | else if (event->kind == FILE_NOTIFY_EVENT) |
| 4021 | { | 4018 | { |
| 4019 | #ifdef HAVE_W32NOTIFY | ||
| 4022 | /* Make an event (file-notify (DESCRIPTOR ACTION FILE) CALLBACK). */ | 4020 | /* Make an event (file-notify (DESCRIPTOR ACTION FILE) CALLBACK). */ |
| 4023 | obj = Fcons (Qfile_w32notify, | 4021 | obj = Fcons (Qfile_notify, |
| 4024 | list2 (list3 (make_number (event->code), | 4022 | list2 (list3 (make_number (event->code), |
| 4025 | XCAR (event->arg), | 4023 | XCAR (event->arg), |
| 4026 | XCDR (event->arg)), | 4024 | XCDR (event->arg)), |
| 4027 | event->frame_or_window)); | 4025 | event->frame_or_window)); |
| 4026 | #else | ||
| 4027 | obj = make_lispy_event (event); | ||
| 4028 | #endif | ||
| 4028 | kbd_fetch_ptr = event + 1; | 4029 | kbd_fetch_ptr = event + 1; |
| 4029 | } | 4030 | } |
| 4030 | #endif | 4031 | #endif /* USE_FILE_NOTIFY */ |
| 4031 | else if (event->kind == SAVE_SESSION_EVENT) | 4032 | else if (event->kind == SAVE_SESSION_EVENT) |
| 4032 | { | 4033 | { |
| 4033 | obj = Fcons (Qsave_session, Fcons (event->arg, Qnil)); | 4034 | obj = Fcons (Qsave_session, Fcons (event->arg, Qnil)); |
| @@ -6010,12 +6011,12 @@ make_lispy_event (struct input_event *event) | |||
| 6010 | #endif /* HAVE_XWIDGETS */ | 6011 | #endif /* HAVE_XWIDGETS */ |
| 6011 | 6012 | ||
| 6012 | 6013 | ||
| 6013 | #ifdef HAVE_INOTIFY | 6014 | #if defined HAVE_GFILENOTIFY || defined HAVE_INOTIFY |
| 6014 | case FILE_NOTIFY_EVENT: | 6015 | case FILE_NOTIFY_EVENT: |
| 6015 | { | 6016 | { |
| 6016 | return Fcons (Qfile_inotify, event->arg); | 6017 | return Fcons (Qfile_notify, event->arg); |
| 6017 | } | 6018 | } |
| 6018 | #endif /* HAVE_INOTIFY */ | 6019 | #endif /* defined HAVE_GFILENOTIFY || defined HAVE_INOTIFY */ |
| 6019 | 6020 | ||
| 6020 | case CONFIG_CHANGED_EVENT: | 6021 | case CONFIG_CHANGED_EVENT: |
| 6021 | return Fcons (Qconfig_changed_event, | 6022 | return Fcons (Qconfig_changed_event, |
| @@ -7417,7 +7418,8 @@ menu_bar_items (Lisp_Object old) | |||
| 7417 | Lisp_Object *tmaps; | 7418 | Lisp_Object *tmaps; |
| 7418 | 7419 | ||
| 7419 | /* Should overriding-terminal-local-map and overriding-local-map apply? */ | 7420 | /* Should overriding-terminal-local-map and overriding-local-map apply? */ |
| 7420 | if (!NILP (Voverriding_local_map_menu_flag)) | 7421 | if (!NILP (Voverriding_local_map_menu_flag) |
| 7422 | && !NILP (Voverriding_local_map)) | ||
| 7421 | { | 7423 | { |
| 7422 | /* Yes, use them (if non-nil) as well as the global map. */ | 7424 | /* Yes, use them (if non-nil) as well as the global map. */ |
| 7423 | maps = alloca (3 * sizeof (maps[0])); | 7425 | maps = alloca (3 * sizeof (maps[0])); |
| @@ -7437,8 +7439,11 @@ menu_bar_items (Lisp_Object old) | |||
| 7437 | Lisp_Object tem; | 7439 | Lisp_Object tem; |
| 7438 | ptrdiff_t nminor; | 7440 | ptrdiff_t nminor; |
| 7439 | nminor = current_minor_maps (NULL, &tmaps); | 7441 | nminor = current_minor_maps (NULL, &tmaps); |
| 7440 | maps = alloca ((nminor + 3) * sizeof *maps); | 7442 | maps = alloca ((nminor + 4) * sizeof *maps); |
| 7441 | nmaps = 0; | 7443 | nmaps = 0; |
| 7444 | tem = KVAR (current_kboard, Voverriding_terminal_local_map); | ||
| 7445 | if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag)) | ||
| 7446 | maps[nmaps++] = tem; | ||
| 7442 | if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) | 7447 | if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) |
| 7443 | maps[nmaps++] = tem; | 7448 | maps[nmaps++] = tem; |
| 7444 | memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); | 7449 | memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); |
| @@ -7963,7 +7968,8 @@ tool_bar_items (Lisp_Object reuse, int *nitems) | |||
| 7963 | to process. */ | 7968 | to process. */ |
| 7964 | 7969 | ||
| 7965 | /* Should overriding-terminal-local-map and overriding-local-map apply? */ | 7970 | /* Should overriding-terminal-local-map and overriding-local-map apply? */ |
| 7966 | if (!NILP (Voverriding_local_map_menu_flag)) | 7971 | if (!NILP (Voverriding_local_map_menu_flag) |
| 7972 | && !NILP (Voverriding_local_map)) | ||
| 7967 | { | 7973 | { |
| 7968 | /* Yes, use them (if non-nil) as well as the global map. */ | 7974 | /* Yes, use them (if non-nil) as well as the global map. */ |
| 7969 | maps = alloca (3 * sizeof *maps); | 7975 | maps = alloca (3 * sizeof *maps); |
| @@ -7983,8 +7989,11 @@ tool_bar_items (Lisp_Object reuse, int *nitems) | |||
| 7983 | Lisp_Object tem; | 7989 | Lisp_Object tem; |
| 7984 | ptrdiff_t nminor; | 7990 | ptrdiff_t nminor; |
| 7985 | nminor = current_minor_maps (NULL, &tmaps); | 7991 | nminor = current_minor_maps (NULL, &tmaps); |
| 7986 | maps = alloca ((nminor + 3) * sizeof *maps); | 7992 | maps = alloca ((nminor + 4) * sizeof *maps); |
| 7987 | nmaps = 0; | 7993 | nmaps = 0; |
| 7994 | tem = KVAR (current_kboard, Voverriding_terminal_local_map); | ||
| 7995 | if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag)) | ||
| 7996 | maps[nmaps++] = tem; | ||
| 7988 | if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) | 7997 | if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) |
| 7989 | maps[nmaps++] = tem; | 7998 | maps[nmaps++] = tem; |
| 7990 | memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); | 7999 | memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); |
| @@ -8167,11 +8176,12 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) | |||
| 8167 | #if !defined (USE_GTK) && !defined (HAVE_NS) | 8176 | #if !defined (USE_GTK) && !defined (HAVE_NS) |
| 8168 | /* If we use build_desired_tool_bar_string to render the | 8177 | /* If we use build_desired_tool_bar_string to render the |
| 8169 | tool bar, the separator is rendered as an image. */ | 8178 | tool bar, the separator is rendered as an image. */ |
| 8170 | PROP (TOOL_BAR_ITEM_IMAGES) | 8179 | set_prop (TOOL_BAR_ITEM_IMAGES, |
| 8171 | = menu_item_eval_property (Vtool_bar_separator_image_expression); | 8180 | (menu_item_eval_property |
| 8172 | PROP (TOOL_BAR_ITEM_ENABLED_P) = Qnil; | 8181 | (Vtool_bar_separator_image_expression))); |
| 8173 | PROP (TOOL_BAR_ITEM_SELECTED_P) = Qnil; | 8182 | set_prop (TOOL_BAR_ITEM_ENABLED_P, Qnil); |
| 8174 | PROP (TOOL_BAR_ITEM_CAPTION) = Qnil; | 8183 | set_prop (TOOL_BAR_ITEM_SELECTED_P, Qnil); |
| 8184 | set_prop (TOOL_BAR_ITEM_CAPTION, Qnil); | ||
| 8175 | #endif | 8185 | #endif |
| 8176 | return 1; | 8186 | return 1; |
| 8177 | } | 8187 | } |
| @@ -11025,10 +11035,6 @@ syms_of_keyboard (void) | |||
| 11025 | DEFSYM (Qlanguage_change, "language-change"); | 11035 | DEFSYM (Qlanguage_change, "language-change"); |
| 11026 | #endif | 11036 | #endif |
| 11027 | 11037 | ||
| 11028 | #ifdef WINDOWSNT | ||
| 11029 | DEFSYM (Qfile_w32notify, "file-w32notify"); | ||
| 11030 | #endif | ||
| 11031 | |||
| 11032 | #ifdef HAVE_DBUS | 11038 | #ifdef HAVE_DBUS |
| 11033 | DEFSYM (Qdbus_event, "dbus-event"); | 11039 | DEFSYM (Qdbus_event, "dbus-event"); |
| 11034 | #endif | 11040 | #endif |
| @@ -11037,9 +11043,9 @@ syms_of_keyboard (void) | |||
| 11037 | Qxwidget_event = intern ("xwidget-event"); | 11043 | Qxwidget_event = intern ("xwidget-event"); |
| 11038 | staticpro (&Qxwidget_event); | 11044 | staticpro (&Qxwidget_event); |
| 11039 | #endif /* HAVE_XWIDGETS */ | 11045 | #endif /* HAVE_XWIDGETS */ |
| 11040 | #ifdef HAVE_INOTIFY | 11046 | #ifdef USE_FILE_NOTIFY |
| 11041 | DEFSYM (Qfile_inotify, "file-inotify"); | 11047 | DEFSYM (Qfile_notify, "file-notify"); |
| 11042 | #endif /* HAVE_INOTIFY */ | 11048 | #endif /* USE_FILE_NOTIFY */ |
| 11043 | 11049 | ||
| 11044 | DEFSYM (QCenable, ":enable"); | 11050 | DEFSYM (QCenable, ":enable"); |
| 11045 | DEFSYM (QCvisible, ":visible"); | 11051 | DEFSYM (QCvisible, ":visible"); |
| @@ -11476,10 +11482,7 @@ tool-bar separators natively. Otherwise it is unused (e.g. on GTK). */); | |||
| 11476 | 11482 | ||
| 11477 | DEFVAR_KBOARD ("overriding-terminal-local-map", | 11483 | DEFVAR_KBOARD ("overriding-terminal-local-map", |
| 11478 | Voverriding_terminal_local_map, | 11484 | Voverriding_terminal_local_map, |
| 11479 | doc: /* Per-terminal keymap that overrides all other local keymaps. | 11485 | doc: /* Per-terminal keymap that takes precedence over all other keymaps. |
| 11480 | If this variable is non-nil, it is used as a keymap instead of the | ||
| 11481 | buffer's local map, and the minor mode keymaps and text property keymaps. | ||
| 11482 | It also replaces `overriding-local-map'. | ||
| 11483 | 11486 | ||
| 11484 | This variable is intended to let commands such as `universal-argument' | 11487 | This variable is intended to let commands such as `universal-argument' |
| 11485 | set up a different keymap for reading the next command. | 11488 | set up a different keymap for reading the next command. |
| @@ -11489,7 +11492,7 @@ terminal device. | |||
| 11489 | See Info node `(elisp)Multiple Terminals'. */); | 11492 | See Info node `(elisp)Multiple Terminals'. */); |
| 11490 | 11493 | ||
| 11491 | DEFVAR_LISP ("overriding-local-map", Voverriding_local_map, | 11494 | DEFVAR_LISP ("overriding-local-map", Voverriding_local_map, |
| 11492 | doc: /* Keymap that overrides all other local keymaps. | 11495 | doc: /* Keymap that overrides almost all other local keymaps. |
| 11493 | If this variable is non-nil, it is used as a keymap--replacing the | 11496 | If this variable is non-nil, it is used as a keymap--replacing the |
| 11494 | buffer's local map, the minor mode keymaps, and char property keymaps. */); | 11497 | buffer's local map, the minor mode keymaps, and char property keymaps. */); |
| 11495 | Voverriding_local_map = Qnil; | 11498 | Voverriding_local_map = Qnil; |
| @@ -11785,20 +11788,18 @@ keys_of_keyboard (void) | |||
| 11785 | "dbus-handle-event"); | 11788 | "dbus-handle-event"); |
| 11786 | #endif | 11789 | #endif |
| 11787 | 11790 | ||
| 11788 | #ifdef HAVE_INOTIFY | 11791 | #ifdef USE_FILE_NOTIFY |
| 11789 | /* Define a special event which is raised for inotify callback | 11792 | /* Define a special event which is raised for notification callback |
| 11790 | functions. */ | 11793 | functions. */ |
| 11791 | initial_define_lispy_key (Vspecial_event_map, "file-inotify", | 11794 | initial_define_lispy_key (Vspecial_event_map, "file-notify", |
| 11792 | "inotify-handle-event"); | 11795 | "file-notify-handle-event"); |
| 11793 | #endif /* HAVE_INOTIFY */ | 11796 | #endif /* USE_FILE_NOTIFY */ |
| 11794 | 11797 | ||
| 11795 | initial_define_lispy_key (Vspecial_event_map, "config-changed-event", | 11798 | initial_define_lispy_key (Vspecial_event_map, "config-changed-event", |
| 11796 | "ignore"); | 11799 | "ignore"); |
| 11797 | #if defined (WINDOWSNT) | 11800 | #if defined (WINDOWSNT) |
| 11798 | initial_define_lispy_key (Vspecial_event_map, "language-change", | 11801 | initial_define_lispy_key (Vspecial_event_map, "language-change", |
| 11799 | "ignore"); | 11802 | "ignore"); |
| 11800 | initial_define_lispy_key (Vspecial_event_map, "file-w32notify", | ||
| 11801 | "w32notify-handle-event"); | ||
| 11802 | #endif | 11803 | #endif |
| 11803 | } | 11804 | } |
| 11804 | 11805 | ||
diff --git a/src/keymap.c b/src/keymap.c index c43d528b25b..536db77f59b 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -56,28 +56,28 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 56 | #include "keymap.h" | 56 | #include "keymap.h" |
| 57 | #include "window.h" | 57 | #include "window.h" |
| 58 | 58 | ||
| 59 | /* Actually allocate storage for these variables */ | 59 | /* Actually allocate storage for these variables. */ |
| 60 | 60 | ||
| 61 | Lisp_Object current_global_map; /* Current global keymap */ | 61 | Lisp_Object current_global_map; /* Current global keymap. */ |
| 62 | 62 | ||
| 63 | Lisp_Object global_map; /* default global key bindings */ | 63 | Lisp_Object global_map; /* Default global key bindings. */ |
| 64 | 64 | ||
| 65 | Lisp_Object meta_map; /* The keymap used for globally bound | 65 | Lisp_Object meta_map; /* The keymap used for globally bound |
| 66 | ESC-prefixed default commands */ | 66 | ESC-prefixed default commands. */ |
| 67 | 67 | ||
| 68 | Lisp_Object control_x_map; /* The keymap used for globally bound | 68 | Lisp_Object control_x_map; /* The keymap used for globally bound |
| 69 | C-x-prefixed default commands */ | 69 | C-x-prefixed default commands. */ |
| 70 | 70 | ||
| 71 | /* The keymap used by the minibuf for local | 71 | /* The keymap used by the minibuf for local |
| 72 | bindings when spaces are allowed in the | 72 | bindings when spaces are allowed in the |
| 73 | minibuf */ | 73 | minibuf. */ |
| 74 | 74 | ||
| 75 | /* The keymap used by the minibuf for local | 75 | /* The keymap used by the minibuf for local |
| 76 | bindings when spaces are not encouraged | 76 | bindings when spaces are not encouraged |
| 77 | in the minibuf */ | 77 | in the minibuf. */ |
| 78 | 78 | ||
| 79 | /* keymap used for minibuffers when doing completion */ | 79 | /* Keymap used for minibuffers when doing completion. */ |
| 80 | /* keymap used for minibuffers when doing completion and require a match */ | 80 | /* Keymap used for minibuffers when doing completion and require a match. */ |
| 81 | static Lisp_Object Qkeymapp, Qnon_ascii; | 81 | static Lisp_Object Qkeymapp, Qnon_ascii; |
| 82 | Lisp_Object Qkeymap, Qmenu_item, Qremap; | 82 | Lisp_Object Qkeymap, Qmenu_item, Qremap; |
| 83 | static Lisp_Object QCadvertised_binding; | 83 | static Lisp_Object QCadvertised_binding; |
| @@ -1571,17 +1571,14 @@ like in the respective argument of `key-binding'. */) | |||
| 1571 | } | 1571 | } |
| 1572 | } | 1572 | } |
| 1573 | 1573 | ||
| 1574 | if (!NILP (olp)) | 1574 | if (!NILP (olp) |
| 1575 | { | ||
| 1576 | if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) | ||
| 1577 | keymaps = Fcons (KVAR (current_kboard, Voverriding_terminal_local_map), | ||
| 1578 | keymaps); | ||
| 1579 | /* The doc said that overriding-terminal-local-map should | 1575 | /* The doc said that overriding-terminal-local-map should |
| 1580 | override overriding-local-map. The code used them both, | 1576 | override overriding-local-map. The code used them both, |
| 1581 | but it seems clearer to use just one. rms, jan 2005. */ | 1577 | but it seems clearer to use just one. rms, jan 2005. */ |
| 1582 | else if (!NILP (Voverriding_local_map)) | 1578 | && NILP (KVAR (current_kboard, Voverriding_terminal_local_map)) |
| 1583 | keymaps = Fcons (Voverriding_local_map, keymaps); | 1579 | && !NILP (Voverriding_local_map)) |
| 1584 | } | 1580 | keymaps = Fcons (Voverriding_local_map, keymaps); |
| 1581 | |||
| 1585 | if (NILP (XCDR (keymaps))) | 1582 | if (NILP (XCDR (keymaps))) |
| 1586 | { | 1583 | { |
| 1587 | Lisp_Object *maps; | 1584 | Lisp_Object *maps; |
| @@ -1592,6 +1589,7 @@ like in the respective argument of `key-binding'. */) | |||
| 1592 | Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map); | 1589 | Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map); |
| 1593 | /* This returns nil unless there is a `keymap' property. */ | 1590 | /* This returns nil unless there is a `keymap' property. */ |
| 1594 | Lisp_Object keymap = get_local_map (pt, current_buffer, Qkeymap); | 1591 | Lisp_Object keymap = get_local_map (pt, current_buffer, Qkeymap); |
| 1592 | Lisp_Object otlp = KVAR (current_kboard, Voverriding_terminal_local_map); | ||
| 1595 | 1593 | ||
| 1596 | if (CONSP (position)) | 1594 | if (CONSP (position)) |
| 1597 | { | 1595 | { |
| @@ -1656,6 +1654,9 @@ like in the respective argument of `key-binding'. */) | |||
| 1656 | 1654 | ||
| 1657 | if (!NILP (keymap)) | 1655 | if (!NILP (keymap)) |
| 1658 | keymaps = Fcons (keymap, keymaps); | 1656 | keymaps = Fcons (keymap, keymaps); |
| 1657 | |||
| 1658 | if (!NILP (olp) && !NILP (otlp)) | ||
| 1659 | keymaps = Fcons (otlp, keymaps); | ||
| 1659 | } | 1660 | } |
| 1660 | 1661 | ||
| 1661 | unbind_to (count, Qnil); | 1662 | unbind_to (count, Qnil); |
| @@ -2851,7 +2852,7 @@ You type Translation\n\ | |||
| 2851 | 2852 | ||
| 2852 | insert ("\n", 1); | 2853 | insert ("\n", 1); |
| 2853 | 2854 | ||
| 2854 | /* Insert calls signal_after_change which may GC. */ | 2855 | /* Insert calls signal_after_change which may GC. */ |
| 2855 | translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table)); | 2856 | translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table)); |
| 2856 | } | 2857 | } |
| 2857 | 2858 | ||
| @@ -2867,6 +2868,14 @@ You type Translation\n\ | |||
| 2867 | start1 = Qnil; | 2868 | start1 = Qnil; |
| 2868 | if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) | 2869 | if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) |
| 2869 | start1 = KVAR (current_kboard, Voverriding_terminal_local_map); | 2870 | start1 = KVAR (current_kboard, Voverriding_terminal_local_map); |
| 2871 | |||
| 2872 | if (!NILP (start1)) | ||
| 2873 | { | ||
| 2874 | describe_map_tree (start1, 1, shadow, prefix, | ||
| 2875 | "\f\nOverriding Bindings", nomenu, 0, 0, 0); | ||
| 2876 | shadow = Fcons (start1, shadow); | ||
| 2877 | start1 = Qnil; | ||
| 2878 | } | ||
| 2870 | else if (!NILP (Voverriding_local_map)) | 2879 | else if (!NILP (Voverriding_local_map)) |
| 2871 | start1 = Voverriding_local_map; | 2880 | start1 = Voverriding_local_map; |
| 2872 | 2881 | ||
diff --git a/src/lisp.h b/src/lisp.h index d5f614881e4..15eb0306251 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -73,6 +73,7 @@ enum | |||
| 73 | BITS_PER_SHORT = CHAR_BIT * sizeof (short), | 73 | BITS_PER_SHORT = CHAR_BIT * sizeof (short), |
| 74 | BITS_PER_INT = CHAR_BIT * sizeof (int), | 74 | BITS_PER_INT = CHAR_BIT * sizeof (int), |
| 75 | BITS_PER_LONG = CHAR_BIT * sizeof (long int), | 75 | BITS_PER_LONG = CHAR_BIT * sizeof (long int), |
| 76 | BITS_PER_PTRDIFF_T = CHAR_BIT * sizeof (ptrdiff_t), | ||
| 76 | BITS_PER_EMACS_INT = CHAR_BIT * sizeof (EMACS_INT) | 77 | BITS_PER_EMACS_INT = CHAR_BIT * sizeof (EMACS_INT) |
| 77 | }; | 78 | }; |
| 78 | 79 | ||
| @@ -2181,12 +2182,24 @@ typedef jmp_buf sys_jmp_buf; | |||
| 2181 | #endif | 2182 | #endif |
| 2182 | 2183 | ||
| 2183 | 2184 | ||
| 2185 | /* Elisp uses several stacks: | ||
| 2186 | - the C stack. | ||
| 2187 | - the bytecode stack: used internally by the bytecode interpreter. | ||
| 2188 | Allocated from the C stack. | ||
| 2189 | - The specpdl stack: keeps track of active unwind-protect and | ||
| 2190 | dynamic-let-bindings. Allocated from the `specpdl' array, a manually | ||
| 2191 | managed stack. | ||
| 2192 | - The catch stack: keeps track of active catch tags. | ||
| 2193 | Allocated on the C stack. This is where the setmp data is kept. | ||
| 2194 | - The handler stack: keeps track of active condition-case handlers. | ||
| 2195 | Allocated on the C stack. Every entry there also uses an entry in | ||
| 2196 | the catch stack. */ | ||
| 2197 | |||
| 2184 | /* Structure for recording Lisp call stack for backtrace purposes. */ | 2198 | /* Structure for recording Lisp call stack for backtrace purposes. */ |
| 2185 | 2199 | ||
| 2186 | /* The special binding stack holds the outer values of variables while | 2200 | /* The special binding stack holds the outer values of variables while |
| 2187 | they are bound by a function application or a let form, stores the | 2201 | they are bound by a function application or a let form, stores the |
| 2188 | code to be executed for Lisp unwind-protect forms, and stores the C | 2202 | code to be executed for unwind-protect forms. |
| 2189 | functions to be called for record_unwind_protect. | ||
| 2190 | 2203 | ||
| 2191 | If func is non-zero, undoing this binding applies func to old_value; | 2204 | If func is non-zero, undoing this binding applies func to old_value; |
| 2192 | This implements record_unwind_protect. | 2205 | This implements record_unwind_protect. |
| @@ -2199,35 +2212,77 @@ typedef jmp_buf sys_jmp_buf; | |||
| 2199 | which means having bound a local value while CURRENT-BUFFER was active. | 2212 | which means having bound a local value while CURRENT-BUFFER was active. |
| 2200 | If WHERE is nil this means we saw the default value when binding SYMBOL. | 2213 | If WHERE is nil this means we saw the default value when binding SYMBOL. |
| 2201 | WHERE being a buffer or frame means we saw a buffer-local or frame-local | 2214 | WHERE being a buffer or frame means we saw a buffer-local or frame-local |
| 2202 | value. Other values of WHERE mean an internal error. */ | 2215 | value. Other values of WHERE mean an internal error. |
| 2216 | |||
| 2217 | NOTE: The specbinding struct is defined here, because SPECPDL_INDEX is | ||
| 2218 | used all over the place, needs to be fast, and needs to know the size of | ||
| 2219 | struct specbinding. But only eval.c should access it. */ | ||
| 2203 | 2220 | ||
| 2204 | typedef Lisp_Object (*specbinding_func) (Lisp_Object); | 2221 | typedef Lisp_Object (*specbinding_func) (Lisp_Object); |
| 2205 | 2222 | ||
| 2223 | enum specbind_tag { | ||
| 2224 | SPECPDL_UNWIND, /* An unwind_protect function. */ | ||
| 2225 | SPECPDL_BACKTRACE, /* An element of the backtrace. */ | ||
| 2226 | SPECPDL_LET, /* A plain and simple dynamic let-binding. */ | ||
| 2227 | /* Tags greater than SPECPDL_LET must be "subkinds" of LET. */ | ||
| 2228 | SPECPDL_LET_LOCAL, /* A buffer-local let-binding. */ | ||
| 2229 | SPECPDL_LET_DEFAULT /* A global binding for a localized var. */ | ||
| 2230 | }; | ||
| 2231 | |||
| 2206 | struct specbinding | 2232 | struct specbinding |
| 2207 | { | 2233 | { |
| 2208 | Lisp_Object symbol, old_value; | 2234 | enum specbind_tag kind; |
| 2209 | specbinding_func func; | 2235 | union { |
| 2210 | Lisp_Object unused; /* Dividing by 16 is faster than by 12. */ | 2236 | struct { |
| 2237 | Lisp_Object arg; | ||
| 2238 | specbinding_func func; | ||
| 2239 | } unwind; | ||
| 2240 | struct { | ||
| 2241 | /* `where' is not used in the case of SPECPDL_LET. */ | ||
| 2242 | Lisp_Object symbol, old_value, where; | ||
| 2243 | } let; | ||
| 2244 | struct { | ||
| 2245 | Lisp_Object function; | ||
| 2246 | Lisp_Object *args; | ||
| 2247 | ptrdiff_t nargs : BITS_PER_PTRDIFF_T - 1; | ||
| 2248 | bool debug_on_exit : 1; | ||
| 2249 | } bt; | ||
| 2250 | } v; | ||
| 2211 | }; | 2251 | }; |
| 2212 | 2252 | ||
| 2253 | LISP_INLINE Lisp_Object specpdl_symbol (struct specbinding *pdl) | ||
| 2254 | { eassert (pdl->kind >= SPECPDL_LET); return pdl->v.let.symbol; } | ||
| 2255 | |||
| 2256 | LISP_INLINE Lisp_Object specpdl_old_value (struct specbinding *pdl) | ||
| 2257 | { eassert (pdl->kind >= SPECPDL_LET); return pdl->v.let.old_value; } | ||
| 2258 | |||
| 2259 | LISP_INLINE Lisp_Object specpdl_where (struct specbinding *pdl) | ||
| 2260 | { eassert (pdl->kind > SPECPDL_LET); return pdl->v.let.where; } | ||
| 2261 | |||
| 2262 | LISP_INLINE Lisp_Object specpdl_arg (struct specbinding *pdl) | ||
| 2263 | { eassert (pdl->kind == SPECPDL_UNWIND); return pdl->v.unwind.arg; } | ||
| 2264 | |||
| 2265 | LISP_INLINE specbinding_func specpdl_func (struct specbinding *pdl) | ||
| 2266 | { eassert (pdl->kind == SPECPDL_UNWIND); return pdl->v.unwind.func; } | ||
| 2267 | |||
| 2268 | LISP_INLINE Lisp_Object backtrace_function (struct specbinding *pdl) | ||
| 2269 | { eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.function; } | ||
| 2270 | |||
| 2271 | LISP_INLINE ptrdiff_t backtrace_nargs (struct specbinding *pdl) | ||
| 2272 | { eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.nargs; } | ||
| 2273 | |||
| 2274 | LISP_INLINE Lisp_Object *backtrace_args (struct specbinding *pdl) | ||
| 2275 | { eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.args; } | ||
| 2276 | |||
| 2277 | LISP_INLINE bool backtrace_debug_on_exit (struct specbinding *pdl) | ||
| 2278 | { eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.debug_on_exit; } | ||
| 2279 | |||
| 2213 | extern struct specbinding *specpdl; | 2280 | extern struct specbinding *specpdl; |
| 2214 | extern struct specbinding *specpdl_ptr; | 2281 | extern struct specbinding *specpdl_ptr; |
| 2215 | extern ptrdiff_t specpdl_size; | 2282 | extern ptrdiff_t specpdl_size; |
| 2216 | 2283 | ||
| 2217 | #define SPECPDL_INDEX() (specpdl_ptr - specpdl) | 2284 | #define SPECPDL_INDEX() (specpdl_ptr - specpdl) |
| 2218 | 2285 | ||
| 2219 | struct backtrace | ||
| 2220 | { | ||
| 2221 | struct backtrace *next; | ||
| 2222 | Lisp_Object function; | ||
| 2223 | Lisp_Object *args; /* Points to vector of args. */ | ||
| 2224 | ptrdiff_t nargs; /* Length of vector. */ | ||
| 2225 | /* Nonzero means call value of debugger when done with this operation. */ | ||
| 2226 | unsigned int debug_on_exit : 1; | ||
| 2227 | }; | ||
| 2228 | |||
| 2229 | extern struct backtrace *backtrace_list; | ||
| 2230 | |||
| 2231 | /* Everything needed to describe an active condition case. | 2286 | /* Everything needed to describe an active condition case. |
| 2232 | 2287 | ||
| 2233 | Members are volatile if their values need to survive _longjmp when | 2288 | Members are volatile if their values need to survive _longjmp when |
| @@ -2282,9 +2337,10 @@ struct catchtag | |||
| 2282 | Lisp_Object tag; | 2337 | Lisp_Object tag; |
| 2283 | Lisp_Object volatile val; | 2338 | Lisp_Object volatile val; |
| 2284 | struct catchtag *volatile next; | 2339 | struct catchtag *volatile next; |
| 2340 | #if 1 /* GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS, but they're defined later. */ | ||
| 2285 | struct gcpro *gcpro; | 2341 | struct gcpro *gcpro; |
| 2342 | #endif | ||
| 2286 | sys_jmp_buf jmp; | 2343 | sys_jmp_buf jmp; |
| 2287 | struct backtrace *backlist; | ||
| 2288 | struct handler *handlerlist; | 2344 | struct handler *handlerlist; |
| 2289 | EMACS_INT lisp_eval_depth; | 2345 | EMACS_INT lisp_eval_depth; |
| 2290 | ptrdiff_t volatile pdlcount; | 2346 | ptrdiff_t volatile pdlcount; |
| @@ -3342,10 +3398,15 @@ extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object, ...); | |||
| 3342 | extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); | 3398 | extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); |
| 3343 | extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); | 3399 | extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); |
| 3344 | extern void init_eval (void); | 3400 | extern void init_eval (void); |
| 3345 | #if BYTE_MARK_STACK | ||
| 3346 | extern void mark_backtrace (void); | ||
| 3347 | #endif | ||
| 3348 | extern void syms_of_eval (void); | 3401 | extern void syms_of_eval (void); |
| 3402 | extern void record_in_backtrace (Lisp_Object function, | ||
| 3403 | Lisp_Object *args, ptrdiff_t nargs); | ||
| 3404 | extern void mark_specpdl (void); | ||
| 3405 | extern void get_backtrace (Lisp_Object array); | ||
| 3406 | Lisp_Object backtrace_top_function (void); | ||
| 3407 | extern bool let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol); | ||
| 3408 | extern bool let_shadows_global_binding_p (Lisp_Object symbol); | ||
| 3409 | |||
| 3349 | 3410 | ||
| 3350 | /* Defined in editfns.c. */ | 3411 | /* Defined in editfns.c. */ |
| 3351 | extern Lisp_Object Qfield; | 3412 | extern Lisp_Object Qfield; |
| @@ -3728,9 +3789,10 @@ extern void syms_of_fontset (void); | |||
| 3728 | extern Lisp_Object Qfont_param; | 3789 | extern Lisp_Object Qfont_param; |
| 3729 | #endif | 3790 | #endif |
| 3730 | 3791 | ||
| 3731 | #ifdef WINDOWSNT | 3792 | /* Defined in gfilenotify.c */ |
| 3732 | /* Defined on w32notify.c. */ | 3793 | #ifdef HAVE_GFILENOTIFY |
| 3733 | extern void syms_of_w32notify (void); | 3794 | extern void globals_of_gfilenotify (void); |
| 3795 | extern void syms_of_gfilenotify (void); | ||
| 3734 | #endif | 3796 | #endif |
| 3735 | 3797 | ||
| 3736 | /* Defined in inotify.c */ | 3798 | /* Defined in inotify.c */ |
| @@ -3738,6 +3800,11 @@ extern void syms_of_w32notify (void); | |||
| 3738 | extern void syms_of_inotify (void); | 3800 | extern void syms_of_inotify (void); |
| 3739 | #endif | 3801 | #endif |
| 3740 | 3802 | ||
| 3803 | #ifdef HAVE_W32NOTIFY | ||
| 3804 | /* Defined on w32notify.c. */ | ||
| 3805 | extern void syms_of_w32notify (void); | ||
| 3806 | #endif | ||
| 3807 | |||
| 3741 | /* Defined in xfaces.c. */ | 3808 | /* Defined in xfaces.c. */ |
| 3742 | extern Lisp_Object Qdefault, Qtool_bar, Qfringe; | 3809 | extern Lisp_Object Qdefault, Qtool_bar, Qfringe; |
| 3743 | extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor; | 3810 | extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor; |
diff --git a/src/lisp.mk b/src/lisp.mk index 174e53ed561..edd81bcf493 100644 --- a/src/lisp.mk +++ b/src/lisp.mk | |||
| @@ -129,6 +129,7 @@ lisp = \ | |||
| 129 | $(lispsource)/textmodes/page.elc \ | 129 | $(lispsource)/textmodes/page.elc \ |
| 130 | $(lispsource)/register.elc \ | 130 | $(lispsource)/register.elc \ |
| 131 | $(lispsource)/textmodes/paragraphs.elc \ | 131 | $(lispsource)/textmodes/paragraphs.elc \ |
| 132 | $(lispsource)/progmodes/prog-mode.elc \ | ||
| 132 | $(lispsource)/emacs-lisp/lisp-mode.elc \ | 133 | $(lispsource)/emacs-lisp/lisp-mode.elc \ |
| 133 | $(lispsource)/textmodes/text-mode.elc \ | 134 | $(lispsource)/textmodes/text-mode.elc \ |
| 134 | $(lispsource)/textmodes/fill.elc \ | 135 | $(lispsource)/textmodes/fill.elc \ |
diff --git a/src/nsfns.m b/src/nsfns.m index 1170472573e..94339183159 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -287,7 +287,7 @@ static void | |||
| 287 | x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | 287 | x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) |
| 288 | { | 288 | { |
| 289 | NSColor *col; | 289 | NSColor *col; |
| 290 | CGFloat r, g, b, alpha; | 290 | EmacsCGFloat r, g, b, alpha; |
| 291 | 291 | ||
| 292 | if (ns_lisp_to_color (arg, &col)) | 292 | if (ns_lisp_to_color (arg, &col)) |
| 293 | { | 293 | { |
| @@ -319,7 +319,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 319 | struct face *face; | 319 | struct face *face; |
| 320 | NSColor *col; | 320 | NSColor *col; |
| 321 | NSView *view = FRAME_NS_VIEW (f); | 321 | NSView *view = FRAME_NS_VIEW (f); |
| 322 | CGFloat r, g, b, alpha; | 322 | EmacsCGFloat r, g, b, alpha; |
| 323 | 323 | ||
| 324 | if (ns_lisp_to_color (arg, &col)) | 324 | if (ns_lisp_to_color (arg, &col)) |
| 325 | { | 325 | { |
| @@ -344,7 +344,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 344 | { | 344 | { |
| 345 | [[view window] setBackgroundColor: col]; | 345 | [[view window] setBackgroundColor: col]; |
| 346 | 346 | ||
| 347 | if (alpha != 1.0) | 347 | if (alpha != (EmacsCGFloat) 1.0) |
| 348 | [[view window] setOpaque: NO]; | 348 | [[view window] setOpaque: NO]; |
| 349 | else | 349 | else |
| 350 | [[view window] setOpaque: YES]; | 350 | [[view window] setOpaque: YES]; |
| @@ -714,7 +714,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 714 | } | 714 | } |
| 715 | 715 | ||
| 716 | 716 | ||
| 717 | void | 717 | static void |
| 718 | ns_implicitly_set_icon_type (struct frame *f) | 718 | ns_implicitly_set_icon_type (struct frame *f) |
| 719 | { | 719 | { |
| 720 | Lisp_Object tem; | 720 | Lisp_Object tem; |
| @@ -859,7 +859,7 @@ ns_cursor_type_to_lisp (int arg) | |||
| 859 | } | 859 | } |
| 860 | 860 | ||
| 861 | /* This is the same as the xfns.c definition. */ | 861 | /* This is the same as the xfns.c definition. */ |
| 862 | void | 862 | static void |
| 863 | x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) | 863 | x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) |
| 864 | { | 864 | { |
| 865 | set_frame_cursor_types (f, arg); | 865 | set_frame_cursor_types (f, arg); |
| @@ -1082,7 +1082,6 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 1082 | struct ns_display_info *dpyinfo = NULL; | 1082 | struct ns_display_info *dpyinfo = NULL; |
| 1083 | Lisp_Object parent; | 1083 | Lisp_Object parent; |
| 1084 | struct kboard *kb; | 1084 | struct kboard *kb; |
| 1085 | Lisp_Object tfont, tfontsize; | ||
| 1086 | static int desc_ctr = 1; | 1085 | static int desc_ctr = 1; |
| 1087 | 1086 | ||
| 1088 | /* x_get_arg modifies parms. */ | 1087 | /* x_get_arg modifies parms. */ |
| @@ -1189,10 +1188,10 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 1189 | { | 1188 | { |
| 1190 | /* use for default font name */ | 1189 | /* use for default font name */ |
| 1191 | id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */ | 1190 | id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */ |
| 1192 | tfontsize = x_default_parameter (f, parms, Qfontsize, | 1191 | x_default_parameter (f, parms, Qfontsize, |
| 1193 | make_number (0 /*(int)[font pointSize]*/), | 1192 | make_number (0 /*(int)[font pointSize]*/), |
| 1194 | "fontSize", "FontSize", RES_TYPE_NUMBER); | 1193 | "fontSize", "FontSize", RES_TYPE_NUMBER); |
| 1195 | tfont = x_default_parameter (f, parms, Qfont, | 1194 | x_default_parameter (f, parms, Qfont, |
| 1196 | build_string ([[font fontName] UTF8String]), | 1195 | build_string ([[font fontName] UTF8String]), |
| 1197 | "font", "Font", RES_TYPE_STRING); | 1196 | "font", "Font", RES_TYPE_STRING); |
| 1198 | } | 1197 | } |
| @@ -1410,6 +1409,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */) | |||
| 1410 | { | 1409 | { |
| 1411 | static id fileDelegate = nil; | 1410 | static id fileDelegate = nil; |
| 1412 | BOOL ret; | 1411 | BOOL ret; |
| 1412 | BOOL isSave = NILP (mustmatch) && NILP (dir_only_p); | ||
| 1413 | id panel; | 1413 | id panel; |
| 1414 | Lisp_Object fname; | 1414 | Lisp_Object fname; |
| 1415 | 1415 | ||
| @@ -1431,7 +1431,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */) | |||
| 1431 | if ([dirS characterAtIndex: 0] == '~') | 1431 | if ([dirS characterAtIndex: 0] == '~') |
| 1432 | dirS = [dirS stringByExpandingTildeInPath]; | 1432 | dirS = [dirS stringByExpandingTildeInPath]; |
| 1433 | 1433 | ||
| 1434 | panel = NILP (mustmatch) && NILP (dir_only_p) ? | 1434 | panel = isSave ? |
| 1435 | (id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel]; | 1435 | (id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel]; |
| 1436 | 1436 | ||
| 1437 | [panel setTitle: promptS]; | 1437 | [panel setTitle: promptS]; |
| @@ -1446,7 +1446,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */) | |||
| 1446 | [panel setCanChooseDirectories: YES]; | 1446 | [panel setCanChooseDirectories: YES]; |
| 1447 | [panel setCanChooseFiles: NO]; | 1447 | [panel setCanChooseFiles: NO]; |
| 1448 | } | 1448 | } |
| 1449 | else | 1449 | else if (! isSave) |
| 1450 | { | 1450 | { |
| 1451 | /* This is not quite what the documentation says, but it is compatible | 1451 | /* This is not quite what the documentation says, but it is compatible |
| 1452 | with the Gtk+ code. Also, the menu entry says "Open File...". */ | 1452 | with the Gtk+ code. Also, the menu entry says "Open File...". */ |
| @@ -1481,8 +1481,8 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */) | |||
| 1481 | 1481 | ||
| 1482 | if (ret) | 1482 | if (ret) |
| 1483 | { | 1483 | { |
| 1484 | NSString *str = [panel getFilename]; | 1484 | NSString *str = ns_filename_from_panel (panel); |
| 1485 | if (! str) str = [panel getDirectory]; | 1485 | if (! str) str = ns_directory_from_panel (panel); |
| 1486 | if (! str) ret = NO; | 1486 | if (! str) ret = NO; |
| 1487 | else fname = build_string ([str UTF8String]); | 1487 | else fname = build_string ([str UTF8String]); |
| 1488 | } | 1488 | } |
| @@ -1909,7 +1909,9 @@ DEFUN ("ns-list-services", Fns_list_services, Sns_list_services, 0, 0, 0, | |||
| 1909 | #else | 1909 | #else |
| 1910 | Lisp_Object ret = Qnil; | 1910 | Lisp_Object ret = Qnil; |
| 1911 | NSMenu *svcs; | 1911 | NSMenu *svcs; |
| 1912 | #ifdef NS_IMPL_COCOA | ||
| 1912 | id delegate; | 1913 | id delegate; |
| 1914 | #endif | ||
| 1913 | 1915 | ||
| 1914 | check_window_system (NULL); | 1916 | check_window_system (NULL); |
| 1915 | svcs = [[NSMenu alloc] initWithTitle: @"Services"]; | 1917 | svcs = [[NSMenu alloc] initWithTitle: @"Services"]; |
| @@ -1992,15 +1994,9 @@ DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc, | |||
| 1992 | 1994 | ||
| 1993 | CHECK_STRING (str); | 1995 | CHECK_STRING (str); |
| 1994 | utfStr = [NSString stringWithUTF8String: SSDATA (str)]; | 1996 | utfStr = [NSString stringWithUTF8String: SSDATA (str)]; |
| 1995 | if (![utfStr respondsToSelector: | 1997 | #ifdef NS_IMPL_COCOA |
| 1996 | @selector (precomposedStringWithCanonicalMapping)]) | ||
| 1997 | { | ||
| 1998 | message1 | ||
| 1999 | ("Warning: ns-convert-utf8-nfd-to-nfc unsupported under GNUstep.\n"); | ||
| 2000 | return Qnil; | ||
| 2001 | } | ||
| 2002 | else | ||
| 2003 | utfStr = [utfStr precomposedStringWithCanonicalMapping]; | 1998 | utfStr = [utfStr precomposedStringWithCanonicalMapping]; |
| 1999 | #endif | ||
| 2004 | return build_string ([utfStr UTF8String]); | 2000 | return build_string ([utfStr UTF8String]); |
| 2005 | } | 2001 | } |
| 2006 | 2002 | ||
| @@ -2155,6 +2151,9 @@ x_set_scroll_bar_default_width (struct frame *f) | |||
| 2155 | } | 2151 | } |
| 2156 | 2152 | ||
| 2157 | 2153 | ||
| 2154 | extern const char *x_get_string_resource (XrmDatabase, char *, char *); | ||
| 2155 | |||
| 2156 | |||
| 2158 | /* terms impl this instead of x-get-resource directly */ | 2157 | /* terms impl this instead of x-get-resource directly */ |
| 2159 | const char * | 2158 | const char * |
| 2160 | x_get_string_resource (XrmDatabase rdb, char *name, char *class) | 2159 | x_get_string_resource (XrmDatabase rdb, char *name, char *class) |
| @@ -2203,13 +2202,6 @@ x_pixel_height (struct frame *f) | |||
| 2203 | } | 2202 | } |
| 2204 | 2203 | ||
| 2205 | 2204 | ||
| 2206 | int | ||
| 2207 | x_screen_planes (struct frame *f) | ||
| 2208 | { | ||
| 2209 | return FRAME_NS_DISPLAY_INFO (f)->n_planes; | ||
| 2210 | } | ||
| 2211 | |||
| 2212 | |||
| 2213 | void | 2205 | void |
| 2214 | x_sync (struct frame *f) | 2206 | x_sync (struct frame *f) |
| 2215 | { | 2207 | { |
| @@ -2242,7 +2234,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, | |||
| 2242 | (Lisp_Object color, Lisp_Object frame) | 2234 | (Lisp_Object color, Lisp_Object frame) |
| 2243 | { | 2235 | { |
| 2244 | NSColor * col; | 2236 | NSColor * col; |
| 2245 | CGFloat red, green, blue, alpha; | 2237 | EmacsCGFloat red, green, blue, alpha; |
| 2246 | 2238 | ||
| 2247 | check_window_system (NULL); | 2239 | check_window_system (NULL); |
| 2248 | CHECK_STRING (color); | 2240 | CHECK_STRING (color); |
| @@ -2434,11 +2426,10 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 2434 | struct MonitorInfo *m = &monitors[i]; | 2426 | struct MonitorInfo *m = &monitors[i]; |
| 2435 | NSRect fr = [s frame]; | 2427 | NSRect fr = [s frame]; |
| 2436 | NSRect vfr = [s visibleFrame]; | 2428 | NSRect vfr = [s visibleFrame]; |
| 2437 | NSDictionary *dict = [s deviceDescription]; | ||
| 2438 | NSValue *resval = [dict valueForKey:NSDeviceResolution]; | ||
| 2439 | short y, vy; | 2429 | short y, vy; |
| 2440 | 2430 | ||
| 2441 | #ifdef NS_IMPL_COCOA | 2431 | #ifdef NS_IMPL_COCOA |
| 2432 | NSDictionary *dict = [s deviceDescription]; | ||
| 2442 | NSNumber *nid = [dict objectForKey:@"NSScreenNumber"]; | 2433 | NSNumber *nid = [dict objectForKey:@"NSScreenNumber"]; |
| 2443 | CGDirectDisplayID did = [nid unsignedIntValue]; | 2434 | CGDirectDisplayID did = [nid unsignedIntValue]; |
| 2444 | #endif | 2435 | #endif |
| @@ -2776,14 +2767,6 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) | |||
| 2776 | [NSApp stop: self]; | 2767 | [NSApp stop: self]; |
| 2777 | } | 2768 | } |
| 2778 | #endif | 2769 | #endif |
| 2779 | - (NSString *) getFilename | ||
| 2780 | { | ||
| 2781 | return ns_filename_from_panel (self); | ||
| 2782 | } | ||
| 2783 | - (NSString *) getDirectory | ||
| 2784 | { | ||
| 2785 | return ns_directory_from_panel (self); | ||
| 2786 | } | ||
| 2787 | 2770 | ||
| 2788 | - (BOOL)performKeyEquivalent:(NSEvent *)theEvent | 2771 | - (BOOL)performKeyEquivalent:(NSEvent *)theEvent |
| 2789 | { | 2772 | { |
| @@ -2807,8 +2790,8 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) | |||
| 2807 | [super ok: sender]; | 2790 | [super ok: sender]; |
| 2808 | 2791 | ||
| 2809 | // If not choosing directories, and Open is pressed on a directory, return. | 2792 | // If not choosing directories, and Open is pressed on a directory, return. |
| 2810 | if (! [self canChooseDirectories] && [self getDirectory] && | 2793 | if (! [self canChooseDirectories] && ns_directory_from_panel (self) && |
| 2811 | ! [self getFilename]) | 2794 | ! ns_filename_from_panel (self)) |
| 2812 | return; | 2795 | return; |
| 2813 | 2796 | ||
| 2814 | panelOK = 1; | 2797 | panelOK = 1; |
| @@ -2821,14 +2804,6 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) | |||
| 2821 | } | 2804 | } |
| 2822 | 2805 | ||
| 2823 | #endif | 2806 | #endif |
| 2824 | - (NSString *) getFilename | ||
| 2825 | { | ||
| 2826 | return ns_filename_from_panel (self); | ||
| 2827 | } | ||
| 2828 | - (NSString *) getDirectory | ||
| 2829 | { | ||
| 2830 | return ns_directory_from_panel (self); | ||
| 2831 | } | ||
| 2832 | - (BOOL)performKeyEquivalent:(NSEvent *)theEvent | 2807 | - (BOOL)performKeyEquivalent:(NSEvent *)theEvent |
| 2833 | { | 2808 | { |
| 2834 | // NSOpenPanel inherits NSSavePanel, so passing self is OK. | 2809 | // NSOpenPanel inherits NSSavePanel, so passing self is OK. |
diff --git a/src/nsfont.m b/src/nsfont.m index 9ab369d1fcd..709f2cb0d86 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -119,7 +119,7 @@ ns_attribute_fvalue (NSFontDescriptor *fdesc, NSString *trait) | |||
| 119 | { | 119 | { |
| 120 | NSDictionary *tdict = [fdesc objectForKey: NSFontTraitsAttribute]; | 120 | NSDictionary *tdict = [fdesc objectForKey: NSFontTraitsAttribute]; |
| 121 | NSNumber *val = [tdict objectForKey: trait]; | 121 | NSNumber *val = [tdict objectForKey: trait]; |
| 122 | return val == nil ? 0.0 : [val floatValue]; | 122 | return val == nil ? 0.0F : [val floatValue]; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | 125 | ||
| @@ -138,15 +138,15 @@ ns_spec_to_descriptor (Lisp_Object font_spec) | |||
| 138 | /* add each attr in font_spec to fdAttrs.. */ | 138 | /* add each attr in font_spec to fdAttrs.. */ |
| 139 | n = min (FONT_WEIGHT_NUMERIC (font_spec), 200); | 139 | n = min (FONT_WEIGHT_NUMERIC (font_spec), 200); |
| 140 | if (n != -1 && n != STYLE_REF) | 140 | if (n != -1 && n != STYLE_REF) |
| 141 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0) / 100.0] | 141 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0F) / 100.0F] |
| 142 | forKey: NSFontWeightTrait]; | 142 | forKey: NSFontWeightTrait]; |
| 143 | n = min (FONT_SLANT_NUMERIC (font_spec), 200); | 143 | n = min (FONT_SLANT_NUMERIC (font_spec), 200); |
| 144 | if (n != -1 && n != STYLE_REF) | 144 | if (n != -1 && n != STYLE_REF) |
| 145 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0) / 100.0] | 145 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0F) / 100.0F] |
| 146 | forKey: NSFontSlantTrait]; | 146 | forKey: NSFontSlantTrait]; |
| 147 | n = min (FONT_WIDTH_NUMERIC (font_spec), 200); | 147 | n = min (FONT_WIDTH_NUMERIC (font_spec), 200); |
| 148 | if (n > -1 && (n > STYLE_REF + 10 || n < STYLE_REF - 10)) | 148 | if (n > -1 && (n > STYLE_REF + 10 || n < STYLE_REF - 10)) |
| 149 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0) / 100.0] | 149 | [tdict setObject: [NSNumber numberWithFloat: (n - 100.0F) / 100.0F] |
| 150 | forKey: NSFontWidthTrait]; | 150 | forKey: NSFontWidthTrait]; |
| 151 | if ([tdict count] > 0) | 151 | if ([tdict count] > 0) |
| 152 | [fdAttrs setObject: tdict forKey: NSFontTraitsAttribute]; | 152 | [fdAttrs setObject: tdict forKey: NSFontTraitsAttribute]; |
| @@ -240,10 +240,10 @@ ns_fallback_entity (void) | |||
| 240 | 240 | ||
| 241 | 241 | ||
| 242 | /* Utility: get width of a char c in screen font SFONT */ | 242 | /* Utility: get width of a char c in screen font SFONT */ |
| 243 | static float | 243 | static CGFloat |
| 244 | ns_char_width (NSFont *sfont, int c) | 244 | ns_char_width (NSFont *sfont, int c) |
| 245 | { | 245 | { |
| 246 | float w = -1.0; | 246 | CGFloat w = -1.0; |
| 247 | NSString *cstr = [NSString stringWithFormat: @"%c", c]; | 247 | NSString *cstr = [NSString stringWithFormat: @"%c", c]; |
| 248 | 248 | ||
| 249 | #ifdef NS_IMPL_COCOA | 249 | #ifdef NS_IMPL_COCOA |
| @@ -269,7 +269,7 @@ static NSString *ascii_printable; | |||
| 269 | static int | 269 | static int |
| 270 | ns_ascii_average_width (NSFont *sfont) | 270 | ns_ascii_average_width (NSFont *sfont) |
| 271 | { | 271 | { |
| 272 | float w = -1.0; | 272 | CGFloat w = -1.0; |
| 273 | 273 | ||
| 274 | if (!ascii_printable) | 274 | if (!ascii_printable) |
| 275 | { | 275 | { |
| @@ -288,14 +288,14 @@ ns_ascii_average_width (NSFont *sfont) | |||
| 288 | w = [sfont advancementForGlyph: glyph].width; | 288 | w = [sfont advancementForGlyph: glyph].width; |
| 289 | #endif | 289 | #endif |
| 290 | 290 | ||
| 291 | if (w < 0.0) | 291 | if (w < (CGFloat) 0.0) |
| 292 | { | 292 | { |
| 293 | NSDictionary *attrsDictionary = | 293 | NSDictionary *attrsDictionary = |
| 294 | [NSDictionary dictionaryWithObject: sfont forKey: NSFontAttributeName]; | 294 | [NSDictionary dictionaryWithObject: sfont forKey: NSFontAttributeName]; |
| 295 | w = [ascii_printable sizeWithAttributes: attrsDictionary].width; | 295 | w = [ascii_printable sizeWithAttributes: attrsDictionary].width; |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | return lrint (w / 95.0); | 298 | return lrint (w / (CGFloat) 95.0); |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | 301 | ||
| @@ -323,7 +323,7 @@ ns_charset_covers(NSCharacterSet *set1, NSCharacterSet *set2, float pct) | |||
| 323 | off++; | 323 | off++; |
| 324 | } | 324 | } |
| 325 | //fprintf(stderr, "off = %d\ttot = %d\n", off,tot); | 325 | //fprintf(stderr, "off = %d\ttot = %d\n", off,tot); |
| 326 | return (float)off / tot < 1.0 - pct; | 326 | return (float)off / tot < 1.0F - pct; |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | 329 | ||
| @@ -514,8 +514,8 @@ static NSSet | |||
| 514 | if (ns_charset_covers(fset, charset, pct)) | 514 | if (ns_charset_covers(fset, charset, pct)) |
| 515 | [families addObject: family]; | 515 | [families addObject: family]; |
| 516 | } | 516 | } |
| 517 | pct -= 0.2; | 517 | pct -= 0.2F; |
| 518 | if ([families count] > 0 || pct < 0.05) | 518 | if ([families count] > 0 || pct < 0.05F) |
| 519 | break; | 519 | break; |
| 520 | } | 520 | } |
| 521 | [charset release]; | 521 | [charset release]; |
| @@ -763,9 +763,9 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 763 | family = [[NSFont userFixedPitchFontOfSize: 0] familyName]; | 763 | family = [[NSFont userFixedPitchFontOfSize: 0] familyName]; |
| 764 | /* Should be > 0.23 as some font descriptors (e.g. Terminus) set to that | 764 | /* Should be > 0.23 as some font descriptors (e.g. Terminus) set to that |
| 765 | when setting family in ns_spec_to_descriptor(). */ | 765 | when setting family in ns_spec_to_descriptor(). */ |
| 766 | if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50) | 766 | if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50F) |
| 767 | traits |= NSBoldFontMask; | 767 | traits |= NSBoldFontMask; |
| 768 | if (fabs (ns_attribute_fvalue (fontDesc, NSFontSlantTrait) > 0.05)) | 768 | if (fabs (ns_attribute_fvalue (fontDesc, NSFontSlantTrait) > 0.05F)) |
| 769 | traits |= NSItalicFontMask; | 769 | traits |= NSItalicFontMask; |
| 770 | 770 | ||
| 771 | /* see http://cocoadev.com/forums/comments.php?DiscussionID=74 */ | 771 | /* see http://cocoadev.com/forums/comments.php?DiscussionID=74 */ |
| @@ -880,7 +880,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 880 | font_info->max_bounds.width = lrint (font_info->width); | 880 | font_info->max_bounds.width = lrint (font_info->width); |
| 881 | font_info->max_bounds.lbearing = lrint (brect.origin.x); | 881 | font_info->max_bounds.lbearing = lrint (brect.origin.x); |
| 882 | font_info->max_bounds.rbearing = | 882 | font_info->max_bounds.rbearing = |
| 883 | lrint (brect.size.width - font_info->width); | 883 | lrint (brect.size.width - (CGFloat) font_info->width); |
| 884 | 884 | ||
| 885 | #ifdef NS_IMPL_COCOA | 885 | #ifdef NS_IMPL_COCOA |
| 886 | /* set up synthItal and the CG font */ | 886 | /* set up synthItal and the CG font */ |
| @@ -1041,8 +1041,8 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1041 | /* NOTE: focus and clip must be set | 1041 | /* NOTE: focus and clip must be set |
| 1042 | also, currently assumed (true in nsterm.m call) from ==0, to ==nchars */ | 1042 | also, currently assumed (true in nsterm.m call) from ==0, to ==nchars */ |
| 1043 | { | 1043 | { |
| 1044 | static char cbuf[1024]; | 1044 | static unsigned char cbuf[1024]; |
| 1045 | char *c = cbuf; | 1045 | unsigned char *c = cbuf; |
| 1046 | #ifdef NS_IMPL_GNUSTEP | 1046 | #ifdef NS_IMPL_GNUSTEP |
| 1047 | static float advances[1024]; | 1047 | static float advances[1024]; |
| 1048 | float *adv = advances; | 1048 | float *adv = advances; |
| @@ -1209,7 +1209,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1209 | [bgCol set]; | 1209 | [bgCol set]; |
| 1210 | DPSmoveto (context, r.origin.x, r.origin.y); | 1210 | DPSmoveto (context, r.origin.x, r.origin.y); |
| 1211 | /*[context GSSetTextDrawingMode: GSTextFillStroke]; /// not implemented yet */ | 1211 | /*[context GSSetTextDrawingMode: GSTextFillStroke]; /// not implemented yet */ |
| 1212 | DPSxshow (context, cbuf, advances, len); | 1212 | DPSxshow (context, (const char *) cbuf, advances, len); |
| 1213 | DPSstroke (context); | 1213 | DPSstroke (context); |
| 1214 | [col set]; | 1214 | [col set]; |
| 1215 | /*[context GSSetTextDrawingMode: GSTextFill]; /// not implemented yet */ | 1215 | /*[context GSSetTextDrawingMode: GSTextFill]; /// not implemented yet */ |
| @@ -1219,7 +1219,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1219 | 1219 | ||
| 1220 | /* draw with DPSxshow () */ | 1220 | /* draw with DPSxshow () */ |
| 1221 | DPSmoveto (context, r.origin.x, r.origin.y); | 1221 | DPSmoveto (context, r.origin.x, r.origin.y); |
| 1222 | DPSxshow (context, cbuf, advances, len); | 1222 | DPSxshow (context, (const char *) cbuf, advances, len); |
| 1223 | DPSstroke (context); | 1223 | DPSstroke (context); |
| 1224 | 1224 | ||
| 1225 | DPSgrestore (context); | 1225 | DPSgrestore (context); |
| @@ -1407,7 +1407,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) | |||
| 1407 | metrics = font_info->metrics[block]; | 1407 | metrics = font_info->metrics[block]; |
| 1408 | for (g = block<<8, i =0; i<0x100 && g < numGlyphs; g++, i++, metrics++) | 1408 | for (g = block<<8, i =0; i<0x100 && g < numGlyphs; g++, i++, metrics++) |
| 1409 | { | 1409 | { |
| 1410 | float w, lb, rb; | 1410 | CGFloat w, lb, rb; |
| 1411 | NSRect r = [sfont boundingRectForGlyph: g]; | 1411 | NSRect r = [sfont boundingRectForGlyph: g]; |
| 1412 | 1412 | ||
| 1413 | w = max ([sfont advancementForGlyph: g].width, 2.0); | 1413 | w = max ([sfont advancementForGlyph: g].width, 2.0); |
| @@ -1419,7 +1419,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) | |||
| 1419 | if (lb < 0) | 1419 | if (lb < 0) |
| 1420 | metrics->lbearing = round (lb - LCD_SMOOTHING_MARGIN); | 1420 | metrics->lbearing = round (lb - LCD_SMOOTHING_MARGIN); |
| 1421 | if (font_info->ital) | 1421 | if (font_info->ital) |
| 1422 | rb += 0.22 * font_info->height; | 1422 | rb += (CGFloat) (0.22F * font_info->height); |
| 1423 | metrics->rbearing = lrint (w + rb + LCD_SMOOTHING_MARGIN); | 1423 | metrics->rbearing = lrint (w + rb + LCD_SMOOTHING_MARGIN); |
| 1424 | 1424 | ||
| 1425 | metrics->descent = r.origin.y < 0 ? -r.origin.y : 0; | 1425 | metrics->descent = r.origin.y < 0 ? -r.origin.y : 0; |
diff --git a/src/nsimage.m b/src/nsimage.m index 9d21ba8afca..a1703272ad2 100644 --- a/src/nsimage.m +++ b/src/nsimage.m | |||
| @@ -334,7 +334,7 @@ static EmacsImage *ImageList = nil; | |||
| 334 | { | 334 | { |
| 335 | NSSize s = [self size]; | 335 | NSSize s = [self size]; |
| 336 | unsigned char *planes[5]; | 336 | unsigned char *planes[5]; |
| 337 | CGFloat r, g, b, a; | 337 | EmacsCGFloat r, g, b, a; |
| 338 | NSColor *rgbColor; | 338 | NSColor *rgbColor; |
| 339 | 339 | ||
| 340 | if (bmRep == nil || color == nil) | 340 | if (bmRep == nil || color == nil) |
| @@ -437,7 +437,7 @@ static EmacsImage *ImageList = nil; | |||
| 437 | else | 437 | else |
| 438 | { | 438 | { |
| 439 | NSColor *color = [bmRep colorAtX: x y: y]; | 439 | NSColor *color = [bmRep colorAtX: x y: y]; |
| 440 | CGFloat r, g, b, a; | 440 | EmacsCGFloat r, g, b, a; |
| 441 | [color getRed: &r green: &g blue: &b alpha: &a]; | 441 | [color getRed: &r green: &g blue: &b alpha: &a]; |
| 442 | return ((int)(a * 255.0) << 24) | 442 | return ((int)(a * 255.0) << 24) |
| 443 | | ((int)(r * 255.0) << 16) | ((int)(g * 255.0) << 8) | 443 | | ((int)(r * 255.0) << 16) | ((int)(g * 255.0) << 8) |
diff --git a/src/nsmenu.m b/src/nsmenu.m index baa683941f8..1d3d111e9a1 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -45,8 +45,6 @@ Carbon version by Yamamoto Mitsuharu. */ | |||
| 45 | #include <sys/types.h> | 45 | #include <sys/types.h> |
| 46 | #endif | 46 | #endif |
| 47 | 47 | ||
| 48 | #define MenuStagger 10.0 | ||
| 49 | |||
| 50 | #if 0 | 48 | #if 0 |
| 51 | int menu_trace_num = 0; | 49 | int menu_trace_num = 0; |
| 52 | #define NSTRACE(x) fprintf (stderr, "%s:%d: [%d] " #x "\n", \ | 50 | #define NSTRACE(x) fprintf (stderr, "%s:%d: [%d] " #x "\n", \ |
| @@ -112,7 +110,7 @@ popup_activated (void) | |||
| 112 | 2) deep_p, submenu = nil: Recompute all submenus. | 110 | 2) deep_p, submenu = nil: Recompute all submenus. |
| 113 | 3) deep_p, submenu = non-nil: Update contents of a single submenu. | 111 | 3) deep_p, submenu = non-nil: Update contents of a single submenu. |
| 114 | -------------------------------------------------------------------------- */ | 112 | -------------------------------------------------------------------------- */ |
| 115 | void | 113 | static void |
| 116 | ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | 114 | ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) |
| 117 | { | 115 | { |
| 118 | NSAutoreleasePool *pool; | 116 | NSAutoreleasePool *pool; |
| @@ -505,6 +503,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p) | |||
| 505 | void | 503 | void |
| 506 | x_activate_menubar (struct frame *f) | 504 | x_activate_menubar (struct frame *f) |
| 507 | { | 505 | { |
| 506 | #ifdef NS_IMPL_COCOA | ||
| 508 | NSArray *a = [[NSApp mainMenu] itemArray]; | 507 | NSArray *a = [[NSApp mainMenu] itemArray]; |
| 509 | /* Update each submenu separately so ns_update_menubar doesn't reset | 508 | /* Update each submenu separately so ns_update_menubar doesn't reset |
| 510 | the delegate. */ | 509 | the delegate. */ |
| @@ -521,6 +520,7 @@ x_activate_menubar (struct frame *f) | |||
| 521 | ++i; | 520 | ++i; |
| 522 | } | 521 | } |
| 523 | ns_check_pending_open_menu (); | 522 | ns_check_pending_open_menu (); |
| 523 | #endif | ||
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | 526 | ||
| @@ -740,7 +740,7 @@ extern NSString *NSMenuDidBeginTrackingNotification; | |||
| 740 | [self setSubmenu: submenu forItem: item]; | 740 | [self setSubmenu: submenu forItem: item]; |
| 741 | [submenu fillWithWidgetValue: wv->contents]; | 741 | [submenu fillWithWidgetValue: wv->contents]; |
| 742 | [submenu release]; | 742 | [submenu release]; |
| 743 | [item setAction: nil]; | 743 | [item setAction: (SEL)nil]; |
| 744 | } | 744 | } |
| 745 | } | 745 | } |
| 746 | 746 | ||
| @@ -757,7 +757,7 @@ extern NSString *NSMenuDidBeginTrackingNotification; | |||
| 757 | { | 757 | { |
| 758 | NSString *titleStr = [NSString stringWithUTF8String: title]; | 758 | NSString *titleStr = [NSString stringWithUTF8String: title]; |
| 759 | NSMenuItem *item = [self addItemWithTitle: titleStr | 759 | NSMenuItem *item = [self addItemWithTitle: titleStr |
| 760 | action: nil /*@selector (menuDown:) */ | 760 | action: (SEL)nil /*@selector (menuDown:) */ |
| 761 | keyEquivalent: @""]; | 761 | keyEquivalent: @""]; |
| 762 | EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr frame: f]; | 762 | EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr frame: f]; |
| 763 | [self setSubmenu: submenu forItem: item]; | 763 | [self setSubmenu: submenu forItem: item]; |
| @@ -1045,13 +1045,18 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1045 | Update toolbar contents | 1045 | Update toolbar contents |
| 1046 | -------------------------------------------------------------------------- */ | 1046 | -------------------------------------------------------------------------- */ |
| 1047 | { | 1047 | { |
| 1048 | int i; | 1048 | int i, k = 0; |
| 1049 | EmacsView *view = FRAME_NS_VIEW (f); | 1049 | EmacsView *view = FRAME_NS_VIEW (f); |
| 1050 | NSWindow *window = [view window]; | 1050 | NSWindow *window = [view window]; |
| 1051 | EmacsToolbar *toolbar = [view toolbar]; | 1051 | EmacsToolbar *toolbar = [view toolbar]; |
| 1052 | 1052 | ||
| 1053 | block_input (); | 1053 | block_input (); |
| 1054 | |||
| 1055 | #ifdef NS_IMPL_COCOA | ||
| 1054 | [toolbar clearActive]; | 1056 | [toolbar clearActive]; |
| 1057 | #else | ||
| 1058 | [toolbar clearAll]; | ||
| 1059 | #endif | ||
| 1055 | 1060 | ||
| 1056 | /* update EmacsToolbar as in GtkUtils, build items list */ | 1061 | /* update EmacsToolbar as in GtkUtils, build items list */ |
| 1057 | for (i = 0; i < f->n_tool_bar_items; ++i) | 1062 | for (i = 0; i < f->n_tool_bar_items; ++i) |
| @@ -1067,6 +1072,15 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1067 | Lisp_Object helpObj; | 1072 | Lisp_Object helpObj; |
| 1068 | const char *helpText; | 1073 | const char *helpText; |
| 1069 | 1074 | ||
| 1075 | /* Check if this is a separator. */ | ||
| 1076 | if (EQ (TOOLPROP (TOOL_BAR_ITEM_TYPE), Qt)) | ||
| 1077 | { | ||
| 1078 | /* Skip separators. Newer OSX don't show them, and on GNUStep they | ||
| 1079 | are wide as a button, thus overflowing the toolbar most of | ||
| 1080 | the time. */ | ||
| 1081 | continue; | ||
| 1082 | } | ||
| 1083 | |||
| 1070 | /* If image is a vector, choose the image according to the | 1084 | /* If image is a vector, choose the image according to the |
| 1071 | button state. */ | 1085 | button state. */ |
| 1072 | image = TOOLPROP (TOOL_BAR_ITEM_IMAGES); | 1086 | image = TOOLPROP (TOOL_BAR_ITEM_IMAGES); |
| @@ -1103,7 +1117,10 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1103 | continue; | 1117 | continue; |
| 1104 | } | 1118 | } |
| 1105 | 1119 | ||
| 1106 | [toolbar addDisplayItemWithImage: img->pixmap idx: i helpText: helpText | 1120 | [toolbar addDisplayItemWithImage: img->pixmap |
| 1121 | idx: k++ | ||
| 1122 | tag: i | ||
| 1123 | helpText: helpText | ||
| 1107 | enabled: enabled_p]; | 1124 | enabled: enabled_p]; |
| 1108 | #undef TOOLPROP | 1125 | #undef TOOLPROP |
| 1109 | } | 1126 | } |
| @@ -1111,6 +1128,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1111 | if (![toolbar isVisible]) | 1128 | if (![toolbar isVisible]) |
| 1112 | [toolbar setVisible: YES]; | 1129 | [toolbar setVisible: YES]; |
| 1113 | 1130 | ||
| 1131 | #ifdef NS_IMPL_COCOA | ||
| 1114 | if ([toolbar changed]) | 1132 | if ([toolbar changed]) |
| 1115 | { | 1133 | { |
| 1116 | /* inform app that toolbar has changed */ | 1134 | /* inform app that toolbar has changed */ |
| @@ -1132,6 +1150,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1132 | [toolbar setConfigurationFromDictionary: newDict]; | 1150 | [toolbar setConfigurationFromDictionary: newDict]; |
| 1133 | [newDict release]; | 1151 | [newDict release]; |
| 1134 | } | 1152 | } |
| 1153 | #endif | ||
| 1135 | 1154 | ||
| 1136 | FRAME_TOOLBAR_HEIGHT (f) = | 1155 | FRAME_TOOLBAR_HEIGHT (f) = |
| 1137 | NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) | 1156 | NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) |
| @@ -1159,6 +1178,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1159 | [self setDelegate: self]; | 1178 | [self setDelegate: self]; |
| 1160 | identifierToItem = [[NSMutableDictionary alloc] initWithCapacity: 10]; | 1179 | identifierToItem = [[NSMutableDictionary alloc] initWithCapacity: 10]; |
| 1161 | activeIdentifiers = [[NSMutableArray alloc] initWithCapacity: 8]; | 1180 | activeIdentifiers = [[NSMutableArray alloc] initWithCapacity: 8]; |
| 1181 | prevIdentifiers = nil; | ||
| 1162 | prevEnablement = enablement = 0L; | 1182 | prevEnablement = enablement = 0L; |
| 1163 | return self; | 1183 | return self; |
| 1164 | } | 1184 | } |
| @@ -1180,18 +1200,29 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1180 | enablement = 0L; | 1200 | enablement = 0L; |
| 1181 | } | 1201 | } |
| 1182 | 1202 | ||
| 1203 | - (void) clearAll | ||
| 1204 | { | ||
| 1205 | [self clearActive]; | ||
| 1206 | while ([[self items] count] > 0) | ||
| 1207 | [self removeItemAtIndex: 0]; | ||
| 1208 | } | ||
| 1209 | |||
| 1183 | - (BOOL) changed | 1210 | - (BOOL) changed |
| 1184 | { | 1211 | { |
| 1185 | return [activeIdentifiers isEqualToArray: prevIdentifiers] && | 1212 | return [activeIdentifiers isEqualToArray: prevIdentifiers] && |
| 1186 | enablement == prevEnablement ? NO : YES; | 1213 | enablement == prevEnablement ? NO : YES; |
| 1187 | } | 1214 | } |
| 1188 | 1215 | ||
| 1189 | - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx | 1216 | - (void) addDisplayItemWithImage: (EmacsImage *)img |
| 1190 | helpText: (const char *)help enabled: (BOOL)enabled | 1217 | idx: (int)idx |
| 1218 | tag: (int)tag | ||
| 1219 | helpText: (const char *)help | ||
| 1220 | enabled: (BOOL)enabled | ||
| 1191 | { | 1221 | { |
| 1192 | /* 1) come up w/identifier */ | 1222 | /* 1) come up w/identifier */ |
| 1193 | NSString *identifier | 1223 | NSString *identifier |
| 1194 | = [NSString stringWithFormat: @"%u", [img hash]]; | 1224 | = [NSString stringWithFormat: @"%u", [img hash]]; |
| 1225 | [activeIdentifiers addObject: identifier]; | ||
| 1195 | 1226 | ||
| 1196 | /* 2) create / reuse item */ | 1227 | /* 2) create / reuse item */ |
| 1197 | NSToolbarItem *item = [identifierToItem objectForKey: identifier]; | 1228 | NSToolbarItem *item = [identifierToItem objectForKey: identifier]; |
| @@ -1203,20 +1234,25 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1203 | [item setToolTip: [NSString stringWithUTF8String: help]]; | 1234 | [item setToolTip: [NSString stringWithUTF8String: help]]; |
| 1204 | [item setTarget: emacsView]; | 1235 | [item setTarget: emacsView]; |
| 1205 | [item setAction: @selector (toolbarClicked:)]; | 1236 | [item setAction: @selector (toolbarClicked:)]; |
| 1237 | [identifierToItem setObject: item forKey: identifier]; | ||
| 1206 | } | 1238 | } |
| 1207 | 1239 | ||
| 1208 | [item setTag: idx]; | 1240 | #ifdef NS_IMPL_GNUSTEP |
| 1241 | [self insertItemWithItemIdentifier: identifier atIndex: idx]; | ||
| 1242 | #endif | ||
| 1243 | |||
| 1244 | [item setTag: tag]; | ||
| 1209 | [item setEnabled: enabled]; | 1245 | [item setEnabled: enabled]; |
| 1210 | 1246 | ||
| 1211 | /* 3) update state */ | 1247 | /* 3) update state */ |
| 1212 | [identifierToItem setObject: item forKey: identifier]; | ||
| 1213 | [activeIdentifiers addObject: identifier]; | ||
| 1214 | enablement = (enablement << 1) | (enabled == YES); | 1248 | enablement = (enablement << 1) | (enabled == YES); |
| 1215 | } | 1249 | } |
| 1216 | 1250 | ||
| 1217 | /* This overrides super's implementation, which automatically sets | 1251 | /* This overrides super's implementation, which automatically sets |
| 1218 | all items to enabled state (for some reason). */ | 1252 | all items to enabled state (for some reason). */ |
| 1219 | - (void)validateVisibleItems { } | 1253 | - (void)validateVisibleItems |
| 1254 | { | ||
| 1255 | } | ||
| 1220 | 1256 | ||
| 1221 | 1257 | ||
| 1222 | /* delegate methods */ | 1258 | /* delegate methods */ |
| @@ -1239,7 +1275,8 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1239 | - (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar | 1275 | - (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar |
| 1240 | { | 1276 | { |
| 1241 | /* return entire set... */ | 1277 | /* return entire set... */ |
| 1242 | return [identifierToItem allKeys]; | 1278 | return activeIdentifiers; |
| 1279 | //return [identifierToItem allKeys]; | ||
| 1243 | } | 1280 | } |
| 1244 | 1281 | ||
| 1245 | /* optional and unneeded */ | 1282 | /* optional and unneeded */ |
| @@ -1531,7 +1568,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1531 | [img autorelease]; | 1568 | [img autorelease]; |
| 1532 | [imgView autorelease]; | 1569 | [imgView autorelease]; |
| 1533 | 1570 | ||
| 1534 | aStyle = NSTitledWindowMask; | 1571 | aStyle = NSTitledWindowMask|NSClosableWindowMask|NSUtilityWindowMask; |
| 1535 | flag = YES; | 1572 | flag = YES; |
| 1536 | rows = 0; | 1573 | rows = 0; |
| 1537 | cols = 1; | 1574 | cols = 1; |
| @@ -1599,9 +1636,6 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1599 | [self setOneShot: YES]; | 1636 | [self setOneShot: YES]; |
| 1600 | [self setReleasedWhenClosed: YES]; | 1637 | [self setReleasedWhenClosed: YES]; |
| 1601 | [self setHidesOnDeactivate: YES]; | 1638 | [self setHidesOnDeactivate: YES]; |
| 1602 | [self setStyleMask: | ||
| 1603 | NSTitledWindowMask|NSClosableWindowMask|NSUtilityWindowMask]; | ||
| 1604 | |||
| 1605 | return self; | 1639 | return self; |
| 1606 | } | 1640 | } |
| 1607 | 1641 | ||
diff --git a/src/nsselect.m b/src/nsselect.m index bb9eacd23cd..6053ee9ceb2 100644 --- a/src/nsselect.m +++ b/src/nsselect.m | |||
| @@ -182,7 +182,7 @@ ns_get_local_selection (Lisp_Object selection_name, | |||
| 182 | Lisp_Object target_type) | 182 | Lisp_Object target_type) |
| 183 | { | 183 | { |
| 184 | Lisp_Object local_value; | 184 | Lisp_Object local_value; |
| 185 | Lisp_Object handler_fn, value, type, check; | 185 | Lisp_Object handler_fn, value, check; |
| 186 | ptrdiff_t count; | 186 | ptrdiff_t count; |
| 187 | 187 | ||
| 188 | local_value = assq_no_quit (selection_name, Vselection_alist); | 188 | local_value = assq_no_quit (selection_name, Vselection_alist); |
| @@ -203,7 +203,6 @@ ns_get_local_selection (Lisp_Object selection_name, | |||
| 203 | check = value; | 203 | check = value; |
| 204 | if (CONSP (value) && SYMBOLP (XCAR (value))) | 204 | if (CONSP (value) && SYMBOLP (XCAR (value))) |
| 205 | { | 205 | { |
| 206 | type = XCAR (value); | ||
| 207 | check = XCDR (value); | 206 | check = XCDR (value); |
| 208 | } | 207 | } |
| 209 | 208 | ||
diff --git a/src/nsterm.h b/src/nsterm.h index 07cfc2e022e..fd8c9baa3e4 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -51,6 +51,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 51 | 51 | ||
| 52 | #ifdef __OBJC__ | 52 | #ifdef __OBJC__ |
| 53 | 53 | ||
| 54 | /* CGFloat on GNUStep may be 4 or 8 byte, but functions expect float* for some | ||
| 55 | versions. | ||
| 56 | On Cocoa, functions expect CGFloat*. Make compatible type. */ | ||
| 57 | #if defined (NS_IMPL_COCOA) || GNUSTEP_GUI_MAJOR_VERSION > 0 || \ | ||
| 58 | GNUSTEP_GUI_MINOR_VERSION >= 22 | ||
| 59 | typedef CGFloat EmacsCGFloat; | ||
| 60 | #else | ||
| 61 | typedef float EmacsCGFloat; | ||
| 62 | #endif | ||
| 63 | |||
| 54 | /* ========================================================================== | 64 | /* ========================================================================== |
| 55 | 65 | ||
| 56 | The Emacs application | 66 | The Emacs application |
| @@ -60,6 +70,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 60 | /* We override sendEvent: as a means to stop/start the event loop */ | 70 | /* We override sendEvent: as a means to stop/start the event loop */ |
| 61 | @interface EmacsApp : NSApplication | 71 | @interface EmacsApp : NSApplication |
| 62 | { | 72 | { |
| 73 | #ifdef NS_IMPL_GNUSTEP | ||
| 74 | @public | ||
| 75 | int nextappdefined; | ||
| 76 | #endif | ||
| 63 | } | 77 | } |
| 64 | - (void)logNotification: (NSNotification *)notification; | 78 | - (void)logNotification: (NSNotification *)notification; |
| 65 | - (void)sendEvent: (NSEvent *)theEvent; | 79 | - (void)sendEvent: (NSEvent *)theEvent; |
| @@ -68,8 +82,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 68 | - (void)fd_handler: (id)unused; | 82 | - (void)fd_handler: (id)unused; |
| 69 | - (void)timeout_handler: (NSTimer *)timedEntry; | 83 | - (void)timeout_handler: (NSTimer *)timedEntry; |
| 70 | - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg; | 84 | - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg; |
| 85 | #ifdef NS_IMPL_GNUSTEP | ||
| 86 | - (void)sendFromMainThread:(id)unused; | ||
| 87 | #endif | ||
| 71 | @end | 88 | @end |
| 72 | 89 | ||
| 90 | #ifdef NS_IMPL_GNUSTEP | ||
| 91 | /* Dummy class to get rid of startup warnings. */ | ||
| 92 | @interface EmacsDocument : NSDocument | ||
| 93 | { | ||
| 94 | } | ||
| 95 | @end | ||
| 96 | #endif | ||
| 73 | 97 | ||
| 74 | /* ========================================================================== | 98 | /* ========================================================================== |
| 75 | 99 | ||
| @@ -128,8 +152,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 128 | #endif | 152 | #endif |
| 129 | 153 | ||
| 130 | #ifdef NS_IMPL_GNUSTEP | 154 | #ifdef NS_IMPL_GNUSTEP |
| 131 | /* Not declared, but useful. */ | 155 | - (void)windowDidMove: (id)sender; |
| 132 | - (void) unlockFocusNeedsFlush: (BOOL)needs; | ||
| 133 | #endif | 156 | #endif |
| 134 | @end | 157 | @end |
| 135 | 158 | ||
| @@ -199,10 +222,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 199 | } | 222 | } |
| 200 | - initForView: (EmacsView *)view withIdentifier: (NSString *)identifier; | 223 | - initForView: (EmacsView *)view withIdentifier: (NSString *)identifier; |
| 201 | - (void) clearActive; | 224 | - (void) clearActive; |
| 225 | - (void) clearAll; | ||
| 202 | - (BOOL) changed; | 226 | - (BOOL) changed; |
| 203 | - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx | 227 | - (void) addDisplayItemWithImage: (EmacsImage *)img |
| 228 | idx: (int)idx | ||
| 229 | tag: (int)tag | ||
| 204 | helpText: (const char *)help | 230 | helpText: (const char *)help |
| 205 | enabled: (BOOL)enabled; | 231 | enabled: (BOOL)enabled; |
| 232 | |||
| 206 | /* delegate methods */ | 233 | /* delegate methods */ |
| 207 | - (NSToolbarItem *)toolbar: (NSToolbar *)toolbar | 234 | - (NSToolbarItem *)toolbar: (NSToolbar *)toolbar |
| 208 | itemForItemIdentifier: (NSString *)itemIdentifier | 235 | itemForItemIdentifier: (NSString *)itemIdentifier |
| @@ -267,14 +294,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 267 | @interface EmacsSavePanel : NSSavePanel | 294 | @interface EmacsSavePanel : NSSavePanel |
| 268 | { | 295 | { |
| 269 | } | 296 | } |
| 270 | - (NSString *) getFilename; | ||
| 271 | - (NSString *) getDirectory; | ||
| 272 | @end | 297 | @end |
| 273 | @interface EmacsOpenPanel : NSOpenPanel | 298 | @interface EmacsOpenPanel : NSOpenPanel |
| 274 | { | 299 | { |
| 275 | } | 300 | } |
| 276 | - (NSString *) getFilename; | ||
| 277 | - (NSString *) getDirectory; | ||
| 278 | @end | 301 | @end |
| 279 | 302 | ||
| 280 | @interface EmacsFileDelegate : NSObject | 303 | @interface EmacsFileDelegate : NSObject |
| @@ -335,7 +358,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 335 | NSResponder *prevResponder; | 358 | NSResponder *prevResponder; |
| 336 | 359 | ||
| 337 | /* offset to the bottom of knob of last mouse down */ | 360 | /* offset to the bottom of knob of last mouse down */ |
| 338 | float last_mouse_offset; | 361 | CGFloat last_mouse_offset; |
| 339 | float min_portion; | 362 | float min_portion; |
| 340 | int pixel_height; | 363 | int pixel_height; |
| 341 | int last_hit_part; | 364 | int last_hit_part; |
| @@ -789,9 +812,9 @@ extern int ns_lisp_to_color (Lisp_Object color, NSColor **col); | |||
| 789 | extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f); | 812 | extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f); |
| 790 | extern unsigned long ns_index_color (NSColor *color, struct frame *f); | 813 | extern unsigned long ns_index_color (NSColor *color, struct frame *f); |
| 791 | extern void ns_free_indexed_color (unsigned long idx, struct frame *f); | 814 | extern void ns_free_indexed_color (unsigned long idx, struct frame *f); |
| 792 | extern const char *ns_get_pending_menu_title (); | 815 | extern const char *ns_get_pending_menu_title (void); |
| 793 | extern void ns_check_menu_open (NSMenu *menu); | 816 | extern void ns_check_menu_open (NSMenu *menu); |
| 794 | extern void ns_check_pending_open_menu (); | 817 | extern void ns_check_pending_open_menu (void); |
| 795 | #endif | 818 | #endif |
| 796 | 819 | ||
| 797 | /* C access to ObjC functionality */ | 820 | /* C access to ObjC functionality */ |
| @@ -840,6 +863,7 @@ extern int x_display_pixel_height (struct ns_display_info *); | |||
| 840 | extern int x_display_pixel_width (struct ns_display_info *); | 863 | extern int x_display_pixel_width (struct ns_display_info *); |
| 841 | 864 | ||
| 842 | /* This in nsterm.m */ | 865 | /* This in nsterm.m */ |
| 866 | extern void x_destroy_window (struct frame *f); | ||
| 843 | extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds, | 867 | extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds, |
| 844 | fd_set *exceptfds, EMACS_TIME *timeout, | 868 | fd_set *exceptfds, EMACS_TIME *timeout, |
| 845 | sigset_t *sigmask); | 869 | sigset_t *sigmask); |
diff --git a/src/nsterm.m b/src/nsterm.m index e882f00e977..93f693fe55e 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -60,6 +60,10 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 60 | #include "buffer.h" | 60 | #include "buffer.h" |
| 61 | #include "font.h" | 61 | #include "font.h" |
| 62 | 62 | ||
| 63 | #ifdef NS_IMPL_GNUSTEP | ||
| 64 | #include "process.h" | ||
| 65 | #endif | ||
| 66 | |||
| 63 | /* call tracing */ | 67 | /* call tracing */ |
| 64 | #if 0 | 68 | #if 0 |
| 65 | int term_trace_num = 0; | 69 | int term_trace_num = 0; |
| @@ -196,7 +200,9 @@ static BOOL gsaved = NO; | |||
| 196 | static BOOL ns_fake_keydown = NO; | 200 | static BOOL ns_fake_keydown = NO; |
| 197 | int ns_tmp_flags; /* FIXME */ | 201 | int ns_tmp_flags; /* FIXME */ |
| 198 | struct nsfont_info *ns_tmp_font; /* FIXME */ | 202 | struct nsfont_info *ns_tmp_font; /* FIXME */ |
| 203 | #ifdef NS_IMPL_COCOA | ||
| 199 | static BOOL ns_menu_bar_is_hidden = NO; | 204 | static BOOL ns_menu_bar_is_hidden = NO; |
| 205 | #endif | ||
| 200 | /*static int debug_lock = 0; */ | 206 | /*static int debug_lock = 0; */ |
| 201 | 207 | ||
| 202 | /* event loop */ | 208 | /* event loop */ |
| @@ -228,6 +234,7 @@ static struct { | |||
| 228 | NULL, 0, 0 | 234 | NULL, 0, 0 |
| 229 | }; | 235 | }; |
| 230 | 236 | ||
| 237 | #ifdef NS_IMPL_COCOA | ||
| 231 | /* | 238 | /* |
| 232 | * State for pending menu activation: | 239 | * State for pending menu activation: |
| 233 | * MENU_NONE Normal state | 240 | * MENU_NONE Normal state |
| @@ -246,6 +253,7 @@ static CGPoint menu_mouse_point; | |||
| 246 | 253 | ||
| 247 | /* Title for the menu to open. */ | 254 | /* Title for the menu to open. */ |
| 248 | static char *menu_pending_title = 0; | 255 | static char *menu_pending_title = 0; |
| 256 | #endif | ||
| 249 | 257 | ||
| 250 | /* Convert modifiers in a NeXTstep event to emacs style modifiers. */ | 258 | /* Convert modifiers in a NeXTstep event to emacs style modifiers. */ |
| 251 | #define NS_FUNCTION_KEY_MASK 0x800000 | 259 | #define NS_FUNCTION_KEY_MASK 0x800000 |
| @@ -317,8 +325,6 @@ static char *menu_pending_title = 0; | |||
| 317 | ns_send_appdefined (-1); \ | 325 | ns_send_appdefined (-1); \ |
| 318 | } | 326 | } |
| 319 | 327 | ||
| 320 | void x_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object); | ||
| 321 | |||
| 322 | /* TODO: get rid of need for these forward declarations */ | 328 | /* TODO: get rid of need for these forward declarations */ |
| 323 | static void ns_condemn_scroll_bars (struct frame *f); | 329 | static void ns_condemn_scroll_bars (struct frame *f); |
| 324 | static void ns_judge_scroll_bars (struct frame *f); | 330 | static void ns_judge_scroll_bars (struct frame *f); |
| @@ -670,8 +676,6 @@ ns_update_begin (struct frame *f) | |||
| 670 | -------------------------------------------------------------------------- */ | 676 | -------------------------------------------------------------------------- */ |
| 671 | { | 677 | { |
| 672 | NSView *view = FRAME_NS_VIEW (f); | 678 | NSView *view = FRAME_NS_VIEW (f); |
| 673 | NSRect r = [view frame]; | ||
| 674 | NSBezierPath *bp; | ||
| 675 | NSTRACE (ns_update_begin); | 679 | NSTRACE (ns_update_begin); |
| 676 | 680 | ||
| 677 | ns_update_auto_hide_menu_bar (); | 681 | ns_update_auto_hide_menu_bar (); |
| @@ -683,9 +687,15 @@ ns_update_begin (struct frame *f) | |||
| 683 | is for the minibuffer. But the display engine may draw more because | 687 | is for the minibuffer. But the display engine may draw more because |
| 684 | we have set the frame as garbaged. So reset clip path to the whole | 688 | we have set the frame as garbaged. So reset clip path to the whole |
| 685 | view. */ | 689 | view. */ |
| 690 | #ifdef NS_IMPL_COCOA | ||
| 691 | { | ||
| 692 | NSBezierPath *bp; | ||
| 693 | NSRect r = [view frame]; | ||
| 686 | bp = [[NSBezierPath bezierPathWithRect: r] retain]; | 694 | bp = [[NSBezierPath bezierPathWithRect: r] retain]; |
| 687 | [bp setClip]; | 695 | [bp setClip]; |
| 688 | [bp release]; | 696 | [bp release]; |
| 697 | } | ||
| 698 | #endif | ||
| 689 | 699 | ||
| 690 | #ifdef NS_IMPL_GNUSTEP | 700 | #ifdef NS_IMPL_GNUSTEP |
| 691 | uRect = NSMakeRect (0, 0, 0, 0); | 701 | uRect = NSMakeRect (0, 0, 0, 0); |
| @@ -772,20 +782,13 @@ ns_update_end (struct frame *f) | |||
| 772 | external (RIF) call; for whole frame, called after update_window_end | 782 | external (RIF) call; for whole frame, called after update_window_end |
| 773 | -------------------------------------------------------------------------- */ | 783 | -------------------------------------------------------------------------- */ |
| 774 | { | 784 | { |
| 775 | NSView *view = FRAME_NS_VIEW (f); | 785 | EmacsView *view = FRAME_NS_VIEW (f); |
| 776 | 786 | ||
| 777 | /* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ | 787 | /* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ |
| 778 | MOUSE_HL_INFO (f)->mouse_face_defer = 0; | 788 | MOUSE_HL_INFO (f)->mouse_face_defer = 0; |
| 779 | 789 | ||
| 780 | block_input (); | 790 | block_input (); |
| 781 | 791 | ||
| 782 | #ifdef NS_IMPL_GNUSTEP | ||
| 783 | /* trigger flush only in the rectangle we tracked as being drawn */ | ||
| 784 | [view unlockFocusNeedsFlush: NO]; | ||
| 785 | /*fprintf (stderr, " (%.0f, %.0f : %.0f x %.0f)", uRect.origin.x, uRect.origin.y, uRect.size.width, uRect.size.height); */ | ||
| 786 | [view lockFocusInRect: uRect]; | ||
| 787 | #endif | ||
| 788 | |||
| 789 | [view unlockFocus]; | 792 | [view unlockFocus]; |
| 790 | [[view window] flushWindow]; | 793 | [[view window] flushWindow]; |
| 791 | 794 | ||
| @@ -818,13 +821,6 @@ ns_focus (struct frame *f, NSRect *r, int n) | |||
| 818 | -------------------------------------------------------------------------- */ | 821 | -------------------------------------------------------------------------- */ |
| 819 | { | 822 | { |
| 820 | // NSTRACE (ns_focus); | 823 | // NSTRACE (ns_focus); |
| 821 | #ifdef NS_IMPL_GNUSTEP | ||
| 822 | NSRect u; | ||
| 823 | if (n == 2) | ||
| 824 | u = NSUnionRect (r[0], r[1]); | ||
| 825 | else if (r) | ||
| 826 | u = *r; | ||
| 827 | #endif | ||
| 828 | /* static int c =0; | 824 | /* static int c =0; |
| 829 | fprintf (stderr, "focus: %d", c++); | 825 | fprintf (stderr, "focus: %d", c++); |
| 830 | if (r) fprintf (stderr, " (%.0f, %.0f : %.0f x %.0f)", r->origin.x, r->origin.y, r->size.width, r->size.height); | 826 | if (r) fprintf (stderr, " (%.0f, %.0f : %.0f x %.0f)", r->origin.x, r->origin.y, r->size.width, r->size.height); |
| @@ -843,33 +839,11 @@ ns_focus (struct frame *f, NSRect *r, int n) | |||
| 843 | } | 839 | } |
| 844 | 840 | ||
| 845 | if (view) | 841 | if (view) |
| 846 | #ifdef NS_IMPL_GNUSTEP | ||
| 847 | r ? [view lockFocusInRect: u] : [view lockFocus]; | ||
| 848 | #else | ||
| 849 | [view lockFocus]; | 842 | [view lockFocus]; |
| 850 | #endif | ||
| 851 | focus_view = view; | 843 | focus_view = view; |
| 852 | /*if (view) debug_lock++; */ | 844 | /*if (view) debug_lock++; */ |
| 853 | } | 845 | } |
| 854 | #ifdef NS_IMPL_GNUSTEP | ||
| 855 | else | ||
| 856 | { | ||
| 857 | /* more than one rect being drawn into */ | ||
| 858 | if (view && r) | ||
| 859 | { | ||
| 860 | [view unlockFocus]; /* add prev rect to redraw list */ | ||
| 861 | [view lockFocusInRect: u]; /* focus for draw in new rect */ | ||
| 862 | } | ||
| 863 | } | ||
| 864 | #endif | ||
| 865 | } | 846 | } |
| 866 | #ifdef NS_IMPL_GNUSTEP | ||
| 867 | else | ||
| 868 | { | ||
| 869 | /* in batch mode, but in GNUstep must still track rectangles explicitly */ | ||
| 870 | uRect = (r ? NSUnionRect (uRect, u) : [FRAME_NS_VIEW (f) visibleRect]); | ||
| 871 | } | ||
| 872 | #endif | ||
| 873 | 847 | ||
| 874 | /* clipping */ | 848 | /* clipping */ |
| 875 | if (r) | 849 | if (r) |
| @@ -1317,12 +1291,17 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows) | |||
| 1317 | 1291 | ||
| 1318 | /* If we have a toolbar, take its height into account. */ | 1292 | /* If we have a toolbar, take its height into account. */ |
| 1319 | if (tb && ! [view isFullscreen]) | 1293 | if (tb && ! [view isFullscreen]) |
| 1294 | { | ||
| 1320 | /* NOTE: previously this would generate wrong result if toolbar not | 1295 | /* NOTE: previously this would generate wrong result if toolbar not |
| 1321 | yet displayed and fixing toolbar_height=32 helped, but | 1296 | yet displayed and fixing toolbar_height=32 helped, but |
| 1322 | now (200903) seems no longer needed */ | 1297 | now (200903) seems no longer needed */ |
| 1323 | FRAME_TOOLBAR_HEIGHT (f) = | 1298 | FRAME_TOOLBAR_HEIGHT (f) = |
| 1324 | NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) | 1299 | NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) |
| 1325 | - FRAME_NS_TITLEBAR_HEIGHT (f); | 1300 | - FRAME_NS_TITLEBAR_HEIGHT (f); |
| 1301 | #ifdef NS_IMPL_GNUSTEP | ||
| 1302 | FRAME_TOOLBAR_HEIGHT (f) -= 3; | ||
| 1303 | #endif | ||
| 1304 | } | ||
| 1326 | else | 1305 | else |
| 1327 | FRAME_TOOLBAR_HEIGHT (f) = 0; | 1306 | FRAME_TOOLBAR_HEIGHT (f) = 0; |
| 1328 | 1307 | ||
| @@ -1548,7 +1527,7 @@ ns_get_color (const char *name, NSColor **col) | |||
| 1548 | } | 1527 | } |
| 1549 | } | 1528 | } |
| 1550 | 1529 | ||
| 1551 | if (r >= 0.0) | 1530 | if (r >= 0.0F) |
| 1552 | { | 1531 | { |
| 1553 | *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0]; | 1532 | *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0]; |
| 1554 | unblock_input (); | 1533 | unblock_input (); |
| @@ -1609,7 +1588,7 @@ ns_color_to_lisp (NSColor *col) | |||
| 1609 | Convert a color to a lisp string with the RGB equivalent | 1588 | Convert a color to a lisp string with the RGB equivalent |
| 1610 | -------------------------------------------------------------------------- */ | 1589 | -------------------------------------------------------------------------- */ |
| 1611 | { | 1590 | { |
| 1612 | CGFloat red, green, blue, alpha, gray; | 1591 | EmacsCGFloat red, green, blue, alpha, gray; |
| 1613 | char buf[1024]; | 1592 | char buf[1024]; |
| 1614 | const char *str; | 1593 | const char *str; |
| 1615 | NSTRACE (ns_color_to_lisp); | 1594 | NSTRACE (ns_color_to_lisp); |
| @@ -1651,7 +1630,7 @@ ns_query_color(void *col, XColor *color_def, int setPixel) | |||
| 1651 | and set color_def pixel to the resulting index. | 1630 | and set color_def pixel to the resulting index. |
| 1652 | -------------------------------------------------------------------------- */ | 1631 | -------------------------------------------------------------------------- */ |
| 1653 | { | 1632 | { |
| 1654 | CGFloat r, g, b, a; | 1633 | EmacsCGFloat r, g, b, a; |
| 1655 | 1634 | ||
| 1656 | [((NSColor *)col) getRed: &r green: &g blue: &b alpha: &a]; | 1635 | [((NSColor *)col) getRed: &r green: &g blue: &b alpha: &a]; |
| 1657 | color_def->red = r * 65535; | 1636 | color_def->red = r * 65535; |
| @@ -1696,26 +1675,6 @@ ns_defined_color (struct frame *f, | |||
| 1696 | } | 1675 | } |
| 1697 | 1676 | ||
| 1698 | 1677 | ||
| 1699 | unsigned long | ||
| 1700 | ns_get_rgb_color (struct frame *f, float r, float g, float b, float a) | ||
| 1701 | /* -------------------------------------------------------------------------- | ||
| 1702 | return an autoreleased RGB color | ||
| 1703 | -------------------------------------------------------------------------- */ | ||
| 1704 | { | ||
| 1705 | /*static int c = 1; fprintf (stderr, "color request %d\n", c++); */ | ||
| 1706 | if (r < 0.0) r = 0.0; | ||
| 1707 | else if (r > 1.0) r = 1.0; | ||
| 1708 | if (g < 0.0) g = 0.0; | ||
| 1709 | else if (g > 1.0) g = 1.0; | ||
| 1710 | if (b < 0.0) b = 0.0; | ||
| 1711 | else if (b > 1.0) b = 1.0; | ||
| 1712 | if (a < 0.0) a = 0.0; | ||
| 1713 | else if (a > 1.0) a = 1.0; | ||
| 1714 | return (unsigned long) ns_index_color( | ||
| 1715 | [NSColor colorWithCalibratedRed: r green: g blue: b alpha: a], f); | ||
| 1716 | } | ||
| 1717 | |||
| 1718 | |||
| 1719 | void | 1678 | void |
| 1720 | x_set_frame_alpha (struct frame *f) | 1679 | x_set_frame_alpha (struct frame *f) |
| 1721 | /* -------------------------------------------------------------------------- | 1680 | /* -------------------------------------------------------------------------- |
| @@ -1723,7 +1682,6 @@ x_set_frame_alpha (struct frame *f) | |||
| 1723 | -------------------------------------------------------------------------- */ | 1682 | -------------------------------------------------------------------------- */ |
| 1724 | { | 1683 | { |
| 1725 | struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); | 1684 | struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); |
| 1726 | EmacsView *view = FRAME_NS_VIEW (f); | ||
| 1727 | double alpha = 1.0; | 1685 | double alpha = 1.0; |
| 1728 | double alpha_min = 1.0; | 1686 | double alpha_min = 1.0; |
| 1729 | 1687 | ||
| @@ -1745,7 +1703,10 @@ x_set_frame_alpha (struct frame *f) | |||
| 1745 | alpha = alpha_min; | 1703 | alpha = alpha_min; |
| 1746 | 1704 | ||
| 1747 | #ifdef NS_IMPL_COCOA | 1705 | #ifdef NS_IMPL_COCOA |
| 1706 | { | ||
| 1707 | EmacsView *view = FRAME_NS_VIEW (f); | ||
| 1748 | [[view window] setAlphaValue: alpha]; | 1708 | [[view window] setAlphaValue: alpha]; |
| 1709 | } | ||
| 1749 | #endif | 1710 | #endif |
| 1750 | } | 1711 | } |
| 1751 | 1712 | ||
| @@ -1798,7 +1759,7 @@ x_set_mouse_position (struct frame *f, int h, int v) | |||
| 1798 | 1759 | ||
| 1799 | 1760 | ||
| 1800 | static int | 1761 | static int |
| 1801 | note_mouse_movement (struct frame *frame, float x, float y) | 1762 | note_mouse_movement (struct frame *frame, CGFloat x, CGFloat y) |
| 1802 | /* ------------------------------------------------------------------------ | 1763 | /* ------------------------------------------------------------------------ |
| 1803 | Called by EmacsView on mouseMovement events. Passes on | 1764 | Called by EmacsView on mouseMovement events. Passes on |
| 1804 | to emacs mainstream code if we moved off of a rect of interest | 1765 | to emacs mainstream code if we moved off of a rect of interest |
| @@ -2257,7 +2218,6 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2257 | { | 2218 | { |
| 2258 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 2219 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 2259 | struct face *face = p->face; | 2220 | struct face *face = p->face; |
| 2260 | int rowY; | ||
| 2261 | static EmacsImage **bimgs = NULL; | 2221 | static EmacsImage **bimgs = NULL; |
| 2262 | static int nBimgs = 0; | 2222 | static int nBimgs = 0; |
| 2263 | 2223 | ||
| @@ -2271,7 +2231,6 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2271 | } | 2231 | } |
| 2272 | 2232 | ||
| 2273 | /* Must clip because of partially visible lines. */ | 2233 | /* Must clip because of partially visible lines. */ |
| 2274 | rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); | ||
| 2275 | ns_clip_to_row (w, row, -1, YES); | 2234 | ns_clip_to_row (w, row, -1, YES); |
| 2276 | 2235 | ||
| 2277 | if (!p->overlay_p) | 2236 | if (!p->overlay_p) |
| @@ -2359,7 +2318,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 2359 | [ns_lookup_indexed_color(face->background, f) set]; | 2318 | [ns_lookup_indexed_color(face->background, f) set]; |
| 2360 | NSRectFill (r); | 2319 | NSRectFill (r); |
| 2361 | [img setXBMColor: ns_lookup_indexed_color(face->foreground, f)]; | 2320 | [img setXBMColor: ns_lookup_indexed_color(face->foreground, f)]; |
| 2362 | #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 | 2321 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 |
| 2363 | [img drawInRect: r | 2322 | [img drawInRect: r |
| 2364 | fromRect: NSZeroRect | 2323 | fromRect: NSZeroRect |
| 2365 | operation: NSCompositeSourceOver | 2324 | operation: NSCompositeSourceOver |
| @@ -2391,7 +2350,6 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, | |||
| 2391 | int fx, fy, h, cursor_height; | 2350 | int fx, fy, h, cursor_height; |
| 2392 | struct frame *f = WINDOW_XFRAME (w); | 2351 | struct frame *f = WINDOW_XFRAME (w); |
| 2393 | struct glyph *phys_cursor_glyph; | 2352 | struct glyph *phys_cursor_glyph; |
| 2394 | int overspill; | ||
| 2395 | struct glyph *cursor_glyph; | 2353 | struct glyph *cursor_glyph; |
| 2396 | struct face *face; | 2354 | struct face *face; |
| 2397 | NSColor *hollow_color = FRAME_BACKGROUND_COLOR (f); | 2355 | NSColor *hollow_color = FRAME_BACKGROUND_COLOR (f); |
| @@ -2598,7 +2556,7 @@ ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr) | |||
| 2598 | --------------------------------------------------------------------- */ | 2556 | --------------------------------------------------------------------- */ |
| 2599 | 2557 | ||
| 2600 | static void | 2558 | static void |
| 2601 | ns_draw_underwave (struct glyph_string *s, CGFloat width, CGFloat x) | 2559 | ns_draw_underwave (struct glyph_string *s, EmacsCGFloat width, EmacsCGFloat x) |
| 2602 | { | 2560 | { |
| 2603 | int wave_height = 3, wave_length = 2; | 2561 | int wave_height = 3, wave_length = 2; |
| 2604 | int y, dx, dy, odd, xmax; | 2562 | int y, dx, dy, odd, xmax; |
| @@ -2616,7 +2574,7 @@ ns_draw_underwave (struct glyph_string *s, CGFloat width, CGFloat x) | |||
| 2616 | NSRectClip (waveClip); | 2574 | NSRectClip (waveClip); |
| 2617 | 2575 | ||
| 2618 | /* Draw the waves */ | 2576 | /* Draw the waves */ |
| 2619 | a.x = x - ((int)(x) % dx) + 0.5; | 2577 | a.x = x - ((int)(x) % dx) + (EmacsCGFloat) 0.5; |
| 2620 | b.x = a.x + dx; | 2578 | b.x = a.x + dx; |
| 2621 | odd = (int)(a.x/dx) % 2; | 2579 | odd = (int)(a.x/dx) % 2; |
| 2622 | a.y = b.y = y + 0.5; | 2580 | a.y = b.y = y + 0.5; |
| @@ -2756,7 +2714,8 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, | |||
| 2756 | } | 2714 | } |
| 2757 | 2715 | ||
| 2758 | static void | 2716 | static void |
| 2759 | ns_draw_box (NSRect r, float thickness, NSColor *col, char left_p, char right_p) | 2717 | ns_draw_box (NSRect r, CGFloat thickness, NSColor *col, |
| 2718 | char left_p, char right_p) | ||
| 2760 | /* -------------------------------------------------------------------------- | 2719 | /* -------------------------------------------------------------------------- |
| 2761 | Draw an unfilled rect inside r, optionally leaving left and/or right open. | 2720 | Draw an unfilled rect inside r, optionally leaving left and/or right open. |
| 2762 | Note we can't just use an NSDrawRect command, because of the possibility | 2721 | Note we can't just use an NSDrawRect command, because of the possibility |
| @@ -3033,7 +2992,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) | |||
| 3033 | /* Draw the image.. do we need to draw placeholder if img ==nil? */ | 2992 | /* Draw the image.. do we need to draw placeholder if img ==nil? */ |
| 3034 | if (img != nil) | 2993 | if (img != nil) |
| 3035 | { | 2994 | { |
| 3036 | #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 | 2995 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 |
| 3037 | NSRect dr = NSMakeRect (x, y, s->slice.width, s->slice.height); | 2996 | NSRect dr = NSMakeRect (x, y, s->slice.width, s->slice.height); |
| 3038 | NSRect ir = NSMakeRect (s->slice.x, s->slice.y, | 2997 | NSRect ir = NSMakeRect (s->slice.x, s->slice.y, |
| 3039 | s->slice.width, s->slice.height); | 2998 | s->slice.width, s->slice.height); |
| @@ -3358,6 +3317,19 @@ ns_send_appdefined (int value) | |||
| 3358 | { | 3317 | { |
| 3359 | /*NSTRACE (ns_send_appdefined); */ | 3318 | /*NSTRACE (ns_send_appdefined); */ |
| 3360 | 3319 | ||
| 3320 | #ifdef NS_IMPL_GNUSTEP | ||
| 3321 | // GNUStep needs postEvent to happen on the main thread. | ||
| 3322 | if (! [[NSThread currentThread] isMainThread]) | ||
| 3323 | { | ||
| 3324 | EmacsApp *app = (EmacsApp *)NSApp; | ||
| 3325 | app->nextappdefined = value; | ||
| 3326 | [app performSelectorOnMainThread:@selector (sendFromMainThread:) | ||
| 3327 | withObject:nil | ||
| 3328 | waitUntilDone:YES]; | ||
| 3329 | return; | ||
| 3330 | } | ||
| 3331 | #endif | ||
| 3332 | |||
| 3361 | /* Only post this event if we haven't already posted one. This will end | 3333 | /* Only post this event if we haven't already posted one. This will end |
| 3362 | the [NXApp run] main loop after having processed all events queued at | 3334 | the [NXApp run] main loop after having processed all events queued at |
| 3363 | this moment. */ | 3335 | this moment. */ |
| @@ -3417,6 +3389,9 @@ check_native_fs () | |||
| 3417 | } | 3389 | } |
| 3418 | #endif | 3390 | #endif |
| 3419 | 3391 | ||
| 3392 | /* GNUStep and OSX <= 10.4 does not have cancelTracking. */ | ||
| 3393 | #if defined (NS_IMPL_COCOA) && \ | ||
| 3394 | MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 | ||
| 3420 | const char * | 3395 | const char * |
| 3421 | ns_get_pending_menu_title () | 3396 | ns_get_pending_menu_title () |
| 3422 | { | 3397 | { |
| @@ -3427,10 +3402,6 @@ ns_get_pending_menu_title () | |||
| 3427 | void | 3402 | void |
| 3428 | ns_check_menu_open (NSMenu *menu) | 3403 | ns_check_menu_open (NSMenu *menu) |
| 3429 | { | 3404 | { |
| 3430 | /* GNUStep and OSX <= 10.4 does not have cancelTracking. */ | ||
| 3431 | #if defined(NS_IMPL_COCOA) && \ | ||
| 3432 | MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 | ||
| 3433 | |||
| 3434 | /* Click in menu bar? */ | 3405 | /* Click in menu bar? */ |
| 3435 | NSArray *a = [[NSApp mainMenu] itemArray]; | 3406 | NSArray *a = [[NSApp mainMenu] itemArray]; |
| 3436 | int i; | 3407 | int i; |
| @@ -3460,14 +3431,12 @@ ns_check_menu_open (NSMenu *menu) | |||
| 3460 | menu_will_open_state = MENU_NONE; | 3431 | menu_will_open_state = MENU_NONE; |
| 3461 | } | 3432 | } |
| 3462 | } | 3433 | } |
| 3463 | #endif | ||
| 3464 | } | 3434 | } |
| 3465 | 3435 | ||
| 3466 | /* Redo saved menu click if state is MENU_PENDING. */ | 3436 | /* Redo saved menu click if state is MENU_PENDING. */ |
| 3467 | void | 3437 | void |
| 3468 | ns_check_pending_open_menu () | 3438 | ns_check_pending_open_menu () |
| 3469 | { | 3439 | { |
| 3470 | #ifdef NS_IMPL_COCOA | ||
| 3471 | if (menu_will_open_state == MENU_PENDING) | 3440 | if (menu_will_open_state == MENU_PENDING) |
| 3472 | { | 3441 | { |
| 3473 | CGEventSourceRef source | 3442 | CGEventSourceRef source |
| @@ -3484,9 +3453,8 @@ ns_check_pending_open_menu () | |||
| 3484 | 3453 | ||
| 3485 | menu_will_open_state = MENU_OPENING; | 3454 | menu_will_open_state = MENU_OPENING; |
| 3486 | } | 3455 | } |
| 3487 | #endif | ||
| 3488 | } | 3456 | } |
| 3489 | 3457 | #endif /* NS_IMPL_COCOA) && >= MAC_OS_X_VERSION_10_5 */ | |
| 3490 | 3458 | ||
| 3491 | static int | 3459 | static int |
| 3492 | ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) | 3460 | ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) |
| @@ -4392,6 +4360,12 @@ ns_term_init (Lisp_Object display_name) | |||
| 4392 | 4360 | ||
| 4393 | [NSApp run]; | 4361 | [NSApp run]; |
| 4394 | ns_do_open_file = YES; | 4362 | ns_do_open_file = YES; |
| 4363 | |||
| 4364 | #ifdef NS_IMPL_GNUSTEP | ||
| 4365 | /* GNUstep steals SIGCHLD for use in NSTask, but we don't use NSTask. | ||
| 4366 | We must re-catch it so subprocess works. */ | ||
| 4367 | catch_child_signal (); | ||
| 4368 | #endif | ||
| 4395 | return dpyinfo; | 4369 | return dpyinfo; |
| 4396 | } | 4370 | } |
| 4397 | 4371 | ||
| @@ -4699,6 +4673,13 @@ not_in_argv (NSString *arg) | |||
| 4699 | ns_send_appdefined (-2); | 4673 | ns_send_appdefined (-2); |
| 4700 | } | 4674 | } |
| 4701 | 4675 | ||
| 4676 | #ifdef NS_IMPL_GNUSTEP | ||
| 4677 | - (void)sendFromMainThread:(id)unused | ||
| 4678 | { | ||
| 4679 | ns_send_appdefined (nextappdefined); | ||
| 4680 | } | ||
| 4681 | #endif | ||
| 4682 | |||
| 4702 | - (void)fd_handler:(id)unused | 4683 | - (void)fd_handler:(id)unused |
| 4703 | /* -------------------------------------------------------------------------- | 4684 | /* -------------------------------------------------------------------------- |
| 4704 | Check data waiting on file descriptors and terminate if so | 4685 | Check data waiting on file descriptors and terminate if so |
| @@ -4863,7 +4844,7 @@ not_in_argv (NSString *arg) | |||
| 4863 | NSEvent *e =[[self window] currentEvent]; | 4844 | NSEvent *e =[[self window] currentEvent]; |
| 4864 | struct face *face =FRAME_DEFAULT_FACE (emacsframe); | 4845 | struct face *face =FRAME_DEFAULT_FACE (emacsframe); |
| 4865 | id newFont; | 4846 | id newFont; |
| 4866 | float size; | 4847 | CGFloat size; |
| 4867 | 4848 | ||
| 4868 | NSTRACE (changeFont); | 4849 | NSTRACE (changeFont); |
| 4869 | if (!emacs_event) | 4850 | if (!emacs_event) |
| @@ -4982,7 +4963,16 @@ not_in_argv (NSString *arg) | |||
| 4982 | { | 4963 | { |
| 4983 | /* COUNTERHACK: map 'Delete' on upper-right main KB to 'Backspace', | 4964 | /* COUNTERHACK: map 'Delete' on upper-right main KB to 'Backspace', |
| 4984 | because Emacs treats Delete and KP-Delete same (in simple.el). */ | 4965 | because Emacs treats Delete and KP-Delete same (in simple.el). */ |
| 4985 | if (fnKeysym == 0xFFFF && [theEvent keyCode] == 0x33) | 4966 | if ((fnKeysym == 0xFFFF && [theEvent keyCode] == 0x33) |
| 4967 | #ifdef NS_IMPL_GNUSTEP | ||
| 4968 | /* GNUstep uses incompatible keycodes, even for those that are | ||
| 4969 | supposed to be hardware independent. Just check for delete. | ||
| 4970 | Keypad delete does not have keysym 0xFFFF. | ||
| 4971 | See http://savannah.gnu.org/bugs/?25395 | ||
| 4972 | */ | ||
| 4973 | || (fnKeysym == 0xFFFF && code == 127) | ||
| 4974 | #endif | ||
| 4975 | ) | ||
| 4986 | code = 0xFF08; /* backspace */ | 4976 | code = 0xFF08; /* backspace */ |
| 4987 | else | 4977 | else |
| 4988 | code = fnKeysym; | 4978 | code = fnKeysym; |
| @@ -5135,10 +5125,14 @@ not_in_argv (NSString *arg) | |||
| 5135 | 5125 | ||
| 5136 | #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | 5126 | #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 |
| 5137 | /* if we get here we should send the key for input manager processing */ | 5127 | /* if we get here we should send the key for input manager processing */ |
| 5128 | /* Disable warning, there is nothing a user can do about it anyway, and | ||
| 5129 | it does not seem to matter. */ | ||
| 5130 | #if 0 | ||
| 5138 | if (firstTime && [[NSInputManager currentInputManager] | 5131 | if (firstTime && [[NSInputManager currentInputManager] |
| 5139 | wantsToDelayTextChangeNotifications] == NO) | 5132 | wantsToDelayTextChangeNotifications] == NO) |
| 5140 | fprintf (stderr, | 5133 | fprintf (stderr, |
| 5141 | "Emacs: WARNING: TextInput mgr wants marked text to be permanent!\n"); | 5134 | "Emacs: WARNING: TextInput mgr wants marked text to be permanent!\n"); |
| 5135 | #endif | ||
| 5142 | firstTime = NO; | 5136 | firstTime = NO; |
| 5143 | #endif | 5137 | #endif |
| 5144 | if (NS_KEYLOG && !processingCompose) | 5138 | if (NS_KEYLOG && !processingCompose) |
| @@ -5346,7 +5340,12 @@ not_in_argv (NSString *arg) | |||
| 5346 | return NSMakeRange (NSNotFound, 0); | 5340 | return NSMakeRange (NSNotFound, 0); |
| 5347 | } | 5341 | } |
| 5348 | 5342 | ||
| 5343 | #if defined (NS_IMPL_COCOA) || GNUSTEP_GUI_MAJOR_VERSION > 0 || \ | ||
| 5344 | GNUSTEP_GUI_MINOR_VERSION > 22 | ||
| 5349 | - (NSUInteger)characterIndexForPoint: (NSPoint)thePoint | 5345 | - (NSUInteger)characterIndexForPoint: (NSPoint)thePoint |
| 5346 | #else | ||
| 5347 | - (unsigned int)characterIndexForPoint: (NSPoint)thePoint | ||
| 5348 | #endif | ||
| 5350 | { | 5349 | { |
| 5351 | if (NS_KEYLOG) | 5350 | if (NS_KEYLOG) |
| 5352 | NSLog (@"characterIndexForPoint request"); | 5351 | NSLog (@"characterIndexForPoint request"); |
| @@ -5385,7 +5384,7 @@ not_in_argv (NSString *arg) | |||
| 5385 | 5384 | ||
| 5386 | if ([theEvent type] == NSScrollWheel) | 5385 | if ([theEvent type] == NSScrollWheel) |
| 5387 | { | 5386 | { |
| 5388 | float delta = [theEvent deltaY]; | 5387 | CGFloat delta = [theEvent deltaY]; |
| 5389 | /* Mac notebooks send wheel events w/delta =0 when trackpad scrolling */ | 5388 | /* Mac notebooks send wheel events w/delta =0 when trackpad scrolling */ |
| 5390 | if (delta == 0) | 5389 | if (delta == 0) |
| 5391 | return; | 5390 | return; |
| @@ -5569,7 +5568,6 @@ not_in_argv (NSString *arg) | |||
| 5569 | 5568 | ||
| 5570 | if (oldr != rows || oldc != cols || neww != oldw || newh != oldh) | 5569 | if (oldr != rows || oldc != cols || neww != oldw || newh != oldh) |
| 5571 | { | 5570 | { |
| 5572 | struct frame *f = emacsframe; | ||
| 5573 | NSView *view = FRAME_NS_VIEW (emacsframe); | 5571 | NSView *view = FRAME_NS_VIEW (emacsframe); |
| 5574 | NSWindow *win = [view window]; | 5572 | NSWindow *win = [view window]; |
| 5575 | NSSize sz = [win resizeIncrements]; | 5573 | NSSize sz = [win resizeIncrements]; |
| @@ -5602,7 +5600,7 @@ not_in_argv (NSString *arg) | |||
| 5602 | #ifdef NS_IMPL_GNUSTEP | 5600 | #ifdef NS_IMPL_GNUSTEP |
| 5603 | gsextra = 3; | 5601 | gsextra = 3; |
| 5604 | #endif | 5602 | #endif |
| 5605 | 5603 | ||
| 5606 | NSTRACE (windowWillResize); | 5604 | NSTRACE (windowWillResize); |
| 5607 | /*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ | 5605 | /*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ |
| 5608 | 5606 | ||
| @@ -5668,7 +5666,7 @@ not_in_argv (NSString *arg) | |||
| 5668 | 5666 | ||
| 5669 | - (void)windowDidResize: (NSNotification *)notification | 5667 | - (void)windowDidResize: (NSNotification *)notification |
| 5670 | { | 5668 | { |
| 5671 | if (! [self fsIsNative]) | 5669 | if (! [self fsIsNative]) |
| 5672 | { | 5670 | { |
| 5673 | NSWindow *theWindow = [notification object]; | 5671 | NSWindow *theWindow = [notification object]; |
| 5674 | /* We can get notification on the non-FS window when in | 5672 | /* We can get notification on the non-FS window when in |
| @@ -5778,7 +5776,6 @@ not_in_argv (NSString *arg) | |||
| 5778 | NSRect r, wr; | 5776 | NSRect r, wr; |
| 5779 | Lisp_Object tem; | 5777 | Lisp_Object tem; |
| 5780 | NSWindow *win; | 5778 | NSWindow *win; |
| 5781 | NSButton *toggleButton; | ||
| 5782 | NSSize sz; | 5779 | NSSize sz; |
| 5783 | NSColor *col; | 5780 | NSColor *col; |
| 5784 | NSString *name; | 5781 | NSString *name; |
| @@ -5854,9 +5851,12 @@ not_in_argv (NSString *arg) | |||
| 5854 | [win setToolbar: toolbar]; | 5851 | [win setToolbar: toolbar]; |
| 5855 | [toolbar setVisible: NO]; | 5852 | [toolbar setVisible: NO]; |
| 5856 | #ifdef NS_IMPL_COCOA | 5853 | #ifdef NS_IMPL_COCOA |
| 5854 | { | ||
| 5855 | NSButton *toggleButton; | ||
| 5857 | toggleButton = [win standardWindowButton: NSWindowToolbarButton]; | 5856 | toggleButton = [win standardWindowButton: NSWindowToolbarButton]; |
| 5858 | [toggleButton setTarget: self]; | 5857 | [toggleButton setTarget: self]; |
| 5859 | [toggleButton setAction: @selector (toggleToolbar: )]; | 5858 | [toggleButton setAction: @selector (toggleToolbar: )]; |
| 5859 | } | ||
| 5860 | #endif | 5860 | #endif |
| 5861 | FRAME_TOOLBAR_HEIGHT (f) = 0; | 5861 | FRAME_TOOLBAR_HEIGHT (f) = 0; |
| 5862 | 5862 | ||
| @@ -5880,7 +5880,7 @@ not_in_argv (NSString *arg) | |||
| 5880 | col = ns_lookup_indexed_color (NS_FACE_BACKGROUND | 5880 | col = ns_lookup_indexed_color (NS_FACE_BACKGROUND |
| 5881 | (FRAME_DEFAULT_FACE (emacsframe)), emacsframe); | 5881 | (FRAME_DEFAULT_FACE (emacsframe)), emacsframe); |
| 5882 | [win setBackgroundColor: col]; | 5882 | [win setBackgroundColor: col]; |
| 5883 | if ([col alphaComponent] != 1.0) | 5883 | if ([col alphaComponent] != (EmacsCGFloat) 1.0) |
| 5884 | [win setOpaque: NO]; | 5884 | [win setOpaque: NO]; |
| 5885 | 5885 | ||
| 5886 | [self allocateGState]; | 5886 | [self allocateGState]; |
| @@ -5973,7 +5973,7 @@ not_in_argv (NSString *arg) | |||
| 5973 | result = ns_userRect.size.height ? ns_userRect : result; | 5973 | result = ns_userRect.size.height ? ns_userRect : result; |
| 5974 | ns_userRect = NSMakeRect (0, 0, 0, 0); | 5974 | ns_userRect = NSMakeRect (0, 0, 0, 0); |
| 5975 | [self setFSValue: FULLSCREEN_NONE]; | 5975 | [self setFSValue: FULLSCREEN_NONE]; |
| 5976 | maximized_width = maximized_width = -1; | 5976 | maximized_width = maximized_height = -1; |
| 5977 | } | 5977 | } |
| 5978 | 5978 | ||
| 5979 | if (fs_before_fs == -1) next_maximized = -1; | 5979 | if (fs_before_fs == -1) next_maximized = -1; |
| @@ -6066,7 +6066,9 @@ not_in_argv (NSString *arg) | |||
| 6066 | { | 6066 | { |
| 6067 | [self setFSValue: fs_before_fs]; | 6067 | [self setFSValue: fs_before_fs]; |
| 6068 | fs_before_fs = -1; | 6068 | fs_before_fs = -1; |
| 6069 | #ifdef NS_IMPL_COCOA | ||
| 6069 | [self updateCollectionBehaviour]; | 6070 | [self updateCollectionBehaviour]; |
| 6071 | #endif | ||
| 6070 | if (FRAME_EXTERNAL_TOOL_BAR (emacsframe)) | 6072 | if (FRAME_EXTERNAL_TOOL_BAR (emacsframe)) |
| 6071 | { | 6073 | { |
| 6072 | [toolbar setVisible:YES]; | 6074 | [toolbar setVisible:YES]; |
| @@ -6113,7 +6115,7 @@ not_in_argv (NSString *arg) | |||
| 6113 | } | 6115 | } |
| 6114 | } | 6116 | } |
| 6115 | #endif | 6117 | #endif |
| 6116 | 6118 | ||
| 6117 | - (void)toggleFullScreen: (id)sender | 6119 | - (void)toggleFullScreen: (id)sender |
| 6118 | { | 6120 | { |
| 6119 | NSWindow *w, *fw; | 6121 | NSWindow *w, *fw; |
| @@ -6125,7 +6127,9 @@ not_in_argv (NSString *arg) | |||
| 6125 | 6127 | ||
| 6126 | if (fs_is_native) | 6128 | if (fs_is_native) |
| 6127 | { | 6129 | { |
| 6130 | #ifdef NS_IMPL_COCOA | ||
| 6128 | [[self window] toggleFullScreen:sender]; | 6131 | [[self window] toggleFullScreen:sender]; |
| 6132 | #endif | ||
| 6129 | return; | 6133 | return; |
| 6130 | } | 6134 | } |
| 6131 | 6135 | ||
| @@ -6171,7 +6175,7 @@ not_in_argv (NSString *arg) | |||
| 6171 | [fw useOptimizedDrawing: YES]; | 6175 | [fw useOptimizedDrawing: YES]; |
| 6172 | [fw setResizeIncrements: sz]; | 6176 | [fw setResizeIncrements: sz]; |
| 6173 | [fw setBackgroundColor: col]; | 6177 | [fw setBackgroundColor: col]; |
| 6174 | if ([col alphaComponent] != 1.0) | 6178 | if ([col alphaComponent] != (EmacsCGFloat) 1.0) |
| 6175 | [fw setOpaque: NO]; | 6179 | [fw setOpaque: NO]; |
| 6176 | 6180 | ||
| 6177 | f->border_width = 0; | 6181 | f->border_width = 0; |
| @@ -6209,7 +6213,7 @@ not_in_argv (NSString *arg) | |||
| 6209 | [w setContentView:[fw contentView]]; | 6213 | [w setContentView:[fw contentView]]; |
| 6210 | [w setResizeIncrements: sz]; | 6214 | [w setResizeIncrements: sz]; |
| 6211 | [w setBackgroundColor: col]; | 6215 | [w setBackgroundColor: col]; |
| 6212 | if ([col alphaComponent] != 1.0) | 6216 | if ([col alphaComponent] != (EmacsCGFloat) 1.0) |
| 6213 | [w setOpaque: NO]; | 6217 | [w setOpaque: NO]; |
| 6214 | 6218 | ||
| 6215 | f->border_width = bwidth; | 6219 | f->border_width = bwidth; |
| @@ -6903,10 +6907,11 @@ not_in_argv (NSString *arg) | |||
| 6903 | } | 6907 | } |
| 6904 | else | 6908 | else |
| 6905 | { | 6909 | { |
| 6906 | float pos, por; | 6910 | float pos; |
| 6911 | CGFloat por; | ||
| 6907 | portion = max ((float)whole*min_portion/pixel_height, portion); | 6912 | portion = max ((float)whole*min_portion/pixel_height, portion); |
| 6908 | pos = (float)position / (whole - portion); | 6913 | pos = (float)position / (whole - portion); |
| 6909 | por = (float)portion/whole; | 6914 | por = (CGFloat)portion/whole; |
| 6910 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 | 6915 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 |
| 6911 | [self setKnobProportion: por]; | 6916 | [self setKnobProportion: por]; |
| 6912 | [self setDoubleValue: pos]; | 6917 | [self setDoubleValue: pos]; |
| @@ -6931,7 +6936,7 @@ not_in_argv (NSString *arg) | |||
| 6931 | *part = last_hit_part; | 6936 | *part = last_hit_part; |
| 6932 | *window = win; | 6937 | *window = win; |
| 6933 | XSETINT (*y, pixel_height); | 6938 | XSETINT (*y, pixel_height); |
| 6934 | if ([self floatValue] > 0.999) | 6939 | if ([self floatValue] > 0.999F) |
| 6935 | XSETINT (*x, pixel_height); | 6940 | XSETINT (*x, pixel_height); |
| 6936 | else | 6941 | else |
| 6937 | XSETINT (*x, pixel_height * [self floatValue]); | 6942 | XSETINT (*x, pixel_height * [self floatValue]); |
| @@ -7005,7 +7010,7 @@ not_in_argv (NSString *arg) | |||
| 7005 | NSRect sr, kr; | 7010 | NSRect sr, kr; |
| 7006 | /* hitPart is only updated AFTER event is passed on */ | 7011 | /* hitPart is only updated AFTER event is passed on */ |
| 7007 | NSScrollerPart part = [self testPart: [e locationInWindow]]; | 7012 | NSScrollerPart part = [self testPart: [e locationInWindow]]; |
| 7008 | double inc = 0.0, loc, kloc, pos; | 7013 | CGFloat inc = 0.0, loc, kloc, pos; |
| 7009 | int edge = 0; | 7014 | int edge = 0; |
| 7010 | 7015 | ||
| 7011 | NSTRACE (EmacsScroller_mouseDown); | 7016 | NSTRACE (EmacsScroller_mouseDown); |
| @@ -7104,7 +7109,6 @@ not_in_argv (NSString *arg) | |||
| 7104 | { | 7109 | { |
| 7105 | NSRect sr; | 7110 | NSRect sr; |
| 7106 | double loc, pos; | 7111 | double loc, pos; |
| 7107 | int edge = 0; | ||
| 7108 | 7112 | ||
| 7109 | NSTRACE (EmacsScroller_mouseDragged); | 7113 | NSTRACE (EmacsScroller_mouseDragged); |
| 7110 | 7114 | ||
| @@ -7115,15 +7119,13 @@ not_in_argv (NSString *arg) | |||
| 7115 | if (loc <= 0.0) | 7119 | if (loc <= 0.0) |
| 7116 | { | 7120 | { |
| 7117 | loc = 0.0; | 7121 | loc = 0.0; |
| 7118 | edge = -1; | ||
| 7119 | } | 7122 | } |
| 7120 | else if (loc >= NSHeight (sr) + last_mouse_offset) | 7123 | else if (loc >= NSHeight (sr) + last_mouse_offset) |
| 7121 | { | 7124 | { |
| 7122 | loc = NSHeight (sr) + last_mouse_offset; | 7125 | loc = NSHeight (sr) + last_mouse_offset; |
| 7123 | edge = 1; | ||
| 7124 | } | 7126 | } |
| 7125 | 7127 | ||
| 7126 | pos = /*(edge ? loc :*/ (loc - last_mouse_offset) / NSHeight (sr); | 7128 | pos = (loc - last_mouse_offset) / NSHeight (sr); |
| 7127 | [self sendScrollEventAtLoc: pos fromEvent: e]; | 7129 | [self sendScrollEventAtLoc: pos fromEvent: e]; |
| 7128 | } | 7130 | } |
| 7129 | 7131 | ||
| @@ -7150,6 +7152,12 @@ not_in_argv (NSString *arg) | |||
| 7150 | @end /* EmacsScroller */ | 7152 | @end /* EmacsScroller */ |
| 7151 | 7153 | ||
| 7152 | 7154 | ||
| 7155 | #ifdef NS_IMPL_GNUSTEP | ||
| 7156 | /* Dummy class to get rid of startup warnings. */ | ||
| 7157 | @implementation EmacsDocument | ||
| 7158 | |||
| 7159 | @end | ||
| 7160 | #endif | ||
| 7153 | 7161 | ||
| 7154 | 7162 | ||
| 7155 | /* ========================================================================== | 7163 | /* ========================================================================== |
diff --git a/src/process.c b/src/process.c index 46385fa096b..a873dd0cdb2 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -4528,10 +4528,10 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4528 | } | 4528 | } |
| 4529 | #endif | 4529 | #endif |
| 4530 | 4530 | ||
| 4531 | #if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) | 4531 | #if defined (HAVE_NS) |
| 4532 | nfds = xg_select | 4532 | nfds = ns_select |
| 4533 | #elif defined (HAVE_NS) | 4533 | #elif defined (HAVE_GLIB) |
| 4534 | nfds = ns_select | 4534 | nfds = xg_select |
| 4535 | #else | 4535 | #else |
| 4536 | nfds = pselect | 4536 | nfds = pselect |
| 4537 | #endif | 4537 | #endif |
| @@ -6100,6 +6100,12 @@ process has been transmitted to the serial port. */) | |||
| 6100 | might inadvertently reap a GTK-created process that happened to | 6100 | might inadvertently reap a GTK-created process that happened to |
| 6101 | have the same process ID. */ | 6101 | have the same process ID. */ |
| 6102 | 6102 | ||
| 6103 | /* LIB_CHILD_HANDLER is a SIGCHLD handler that Emacs calls while doing | ||
| 6104 | its own SIGCHLD handling. On POSIXish systems, glib needs this to | ||
| 6105 | keep track of its own children. The default handler does nothing. */ | ||
| 6106 | static void dummy_handler (int sig) {} | ||
| 6107 | static signal_handler_t volatile lib_child_handler = dummy_handler; | ||
| 6108 | |||
| 6103 | /* Handle a SIGCHLD signal by looking for known child processes of | 6109 | /* Handle a SIGCHLD signal by looking for known child processes of |
| 6104 | Emacs whose status have changed. For each one found, record its | 6110 | Emacs whose status have changed. For each one found, record its |
| 6105 | new status. | 6111 | new status. |
| @@ -6159,7 +6165,8 @@ handle_child_signal (int sig) | |||
| 6159 | struct Lisp_Process *p = XPROCESS (proc); | 6165 | struct Lisp_Process *p = XPROCESS (proc); |
| 6160 | int status; | 6166 | int status; |
| 6161 | 6167 | ||
| 6162 | if (p->alive && child_status_changed (p->pid, &status, WUNTRACED)) | 6168 | if (p->alive |
| 6169 | && child_status_changed (p->pid, &status, WUNTRACED | WCONTINUED)) | ||
| 6163 | { | 6170 | { |
| 6164 | /* Change the status of the process that was found. */ | 6171 | /* Change the status of the process that was found. */ |
| 6165 | p->tick = ++process_tick; | 6172 | p->tick = ++process_tick; |
| @@ -6183,6 +6190,8 @@ handle_child_signal (int sig) | |||
| 6183 | } | 6190 | } |
| 6184 | } | 6191 | } |
| 6185 | } | 6192 | } |
| 6193 | |||
| 6194 | lib_child_handler (sig); | ||
| 6186 | } | 6195 | } |
| 6187 | 6196 | ||
| 6188 | static void | 6197 | static void |
| @@ -7028,6 +7037,21 @@ integer or floating point values. | |||
| 7028 | return system_process_attributes (pid); | 7037 | return system_process_attributes (pid); |
| 7029 | } | 7038 | } |
| 7030 | 7039 | ||
| 7040 | #ifndef NS_IMPL_GNUSTEP | ||
| 7041 | static | ||
| 7042 | #endif | ||
| 7043 | void | ||
| 7044 | catch_child_signal (void) | ||
| 7045 | { | ||
| 7046 | struct sigaction action, old_action; | ||
| 7047 | emacs_sigaction_init (&action, deliver_child_signal); | ||
| 7048 | sigaction (SIGCHLD, &action, &old_action); | ||
| 7049 | eassert (! (old_action.sa_flags & SA_SIGINFO)); | ||
| 7050 | if (old_action.sa_handler != SIG_DFL && old_action.sa_handler != SIG_IGN | ||
| 7051 | && old_action.sa_handler != deliver_child_signal) | ||
| 7052 | lib_child_handler = old_action.sa_handler; | ||
| 7053 | } | ||
| 7054 | |||
| 7031 | 7055 | ||
| 7032 | /* This is not called "init_process" because that is the name of a | 7056 | /* This is not called "init_process" because that is the name of a |
| 7033 | Mach system call, so it would cause problems on Darwin systems. */ | 7057 | Mach system call, so it would cause problems on Darwin systems. */ |
| @@ -7043,9 +7067,13 @@ init_process_emacs (void) | |||
| 7043 | if (! noninteractive || initialized) | 7067 | if (! noninteractive || initialized) |
| 7044 | #endif | 7068 | #endif |
| 7045 | { | 7069 | { |
| 7046 | struct sigaction action; | 7070 | #if defined HAVE_GLIB && !defined WINDOWSNT |
| 7047 | emacs_sigaction_init (&action, deliver_child_signal); | 7071 | /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself; |
| 7048 | sigaction (SIGCHLD, &action, 0); | 7072 | this should always fail, but is enough to initialize glib's |
| 7073 | private SIGCHLD handler. */ | ||
| 7074 | g_source_unref (g_child_watch_source_new (getpid ())); | ||
| 7075 | #endif | ||
| 7076 | catch_child_signal (); | ||
| 7049 | } | 7077 | } |
| 7050 | 7078 | ||
| 7051 | FD_ZERO (&input_wait_mask); | 7079 | FD_ZERO (&input_wait_mask); |
diff --git a/src/process.h b/src/process.h index 765e5d82567..0c4e17e68cf 100644 --- a/src/process.h +++ b/src/process.h | |||
| @@ -217,5 +217,8 @@ extern void add_read_fd (int fd, fd_callback func, void *data); | |||
| 217 | extern void delete_read_fd (int fd); | 217 | extern void delete_read_fd (int fd); |
| 218 | extern void add_write_fd (int fd, fd_callback func, void *data); | 218 | extern void add_write_fd (int fd, fd_callback func, void *data); |
| 219 | extern void delete_write_fd (int fd); | 219 | extern void delete_write_fd (int fd); |
| 220 | #ifdef NS_IMPL_GNUSTEP | ||
| 221 | extern void catch_child_signal (void); | ||
| 222 | #endif | ||
| 220 | 223 | ||
| 221 | INLINE_HEADER_END | 224 | INLINE_HEADER_END |
diff --git a/src/profiler.c b/src/profiler.c index 0a0a4d0bc57..aba81344c68 100644 --- a/src/profiler.c +++ b/src/profiler.c | |||
| @@ -138,10 +138,8 @@ static void evict_lower_half (log_t *log) | |||
| 138 | static void | 138 | static void |
| 139 | record_backtrace (log_t *log, EMACS_INT count) | 139 | record_backtrace (log_t *log, EMACS_INT count) |
| 140 | { | 140 | { |
| 141 | struct backtrace *backlist = backtrace_list; | ||
| 142 | Lisp_Object backtrace; | 141 | Lisp_Object backtrace; |
| 143 | ptrdiff_t index, i = 0; | 142 | ptrdiff_t index; |
| 144 | ptrdiff_t asize; | ||
| 145 | 143 | ||
| 146 | if (!INTEGERP (log->next_free)) | 144 | if (!INTEGERP (log->next_free)) |
| 147 | /* FIXME: transfer the evicted counts to a special entry rather | 145 | /* FIXME: transfer the evicted counts to a special entry rather |
| @@ -151,16 +149,7 @@ record_backtrace (log_t *log, EMACS_INT count) | |||
| 151 | 149 | ||
| 152 | /* Get a "working memory" vector. */ | 150 | /* Get a "working memory" vector. */ |
| 153 | backtrace = HASH_KEY (log, index); | 151 | backtrace = HASH_KEY (log, index); |
| 154 | asize = ASIZE (backtrace); | 152 | get_backtrace (backtrace); |
| 155 | |||
| 156 | /* Copy the backtrace contents into working memory. */ | ||
| 157 | for (; i < asize && backlist; i++, backlist = backlist->next) | ||
| 158 | /* FIXME: For closures we should ignore the environment. */ | ||
| 159 | ASET (backtrace, i, backlist->function); | ||
| 160 | |||
| 161 | /* Make sure that unused space of working memory is filled with nil. */ | ||
| 162 | for (; i < asize; i++) | ||
| 163 | ASET (backtrace, i, Qnil); | ||
| 164 | 153 | ||
| 165 | { /* We basically do a `gethash+puthash' here, except that we have to be | 154 | { /* We basically do a `gethash+puthash' here, except that we have to be |
| 166 | careful to avoid memory allocation since we're in a signal | 155 | careful to avoid memory allocation since we're in a signal |
| @@ -232,7 +221,7 @@ static EMACS_INT current_sampling_interval; | |||
| 232 | static void | 221 | static void |
| 233 | handle_profiler_signal (int signal) | 222 | handle_profiler_signal (int signal) |
| 234 | { | 223 | { |
| 235 | if (backtrace_list && EQ (backtrace_list->function, Qautomatic_gc)) | 224 | if (EQ (backtrace_top_function (), Qautomatic_gc)) |
| 236 | /* Special case the time-count inside GC because the hash-table | 225 | /* Special case the time-count inside GC because the hash-table |
| 237 | code is not prepared to be used while the GC is running. | 226 | code is not prepared to be used while the GC is running. |
| 238 | More specifically it uses ASIZE at many places where it does | 227 | More specifically it uses ASIZE at many places where it does |
diff --git a/src/puresize.h b/src/puresize.h index 2f717571c7c..25a11aafbcc 100644 --- a/src/puresize.h +++ b/src/puresize.h | |||
| @@ -73,9 +73,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 73 | /* Signal an error if OBJ is pure. */ | 73 | /* Signal an error if OBJ is pure. */ |
| 74 | #define CHECK_IMPURE(obj) \ | 74 | #define CHECK_IMPURE(obj) \ |
| 75 | { if (PURE_P (obj)) \ | 75 | { if (PURE_P (obj)) \ |
| 76 | pure_write_error (); } | 76 | pure_write_error (obj); } |
| 77 | 77 | ||
| 78 | extern _Noreturn void pure_write_error (void); | 78 | extern _Noreturn void pure_write_error (Lisp_Object); |
| 79 | 79 | ||
| 80 | /* Define PURE_P. */ | 80 | /* Define PURE_P. */ |
| 81 | 81 | ||
diff --git a/src/syssignal.h b/src/syssignal.h index d7399c6cb8c..45ea8f1af3c 100644 --- a/src/syssignal.h +++ b/src/syssignal.h | |||
| @@ -50,6 +50,10 @@ char const *safe_strsignal (int) ATTRIBUTE_CONST; | |||
| 50 | # define NSIG NSIG_MINIMUM | 50 | # define NSIG NSIG_MINIMUM |
| 51 | #endif | 51 | #endif |
| 52 | 52 | ||
| 53 | #ifndef SA_SIGINFO | ||
| 54 | # define SA_SIGINFO 0 | ||
| 55 | #endif | ||
| 56 | |||
| 53 | #ifndef emacs_raise | 57 | #ifndef emacs_raise |
| 54 | # define emacs_raise(sig) raise (sig) | 58 | # define emacs_raise(sig) raise (sig) |
| 55 | #endif | 59 | #endif |
diff --git a/src/term.c b/src/term.c index 28b944c6436..0bcef55947a 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -3189,12 +3189,13 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ | |||
| 3189 | #ifdef WINDOWSNT | 3189 | #ifdef WINDOWSNT |
| 3190 | { | 3190 | { |
| 3191 | struct frame *f = XFRAME (selected_frame); | 3191 | struct frame *f = XFRAME (selected_frame); |
| 3192 | int height, width; | ||
| 3192 | 3193 | ||
| 3193 | initialize_w32_display (terminal); | 3194 | initialize_w32_display (terminal, &width, &height); |
| 3194 | 3195 | ||
| 3195 | FrameRows (tty) = FRAME_LINES (f); | 3196 | FrameRows (tty) = height; |
| 3196 | FrameCols (tty) = FRAME_COLS (f); | 3197 | FrameCols (tty) = width; |
| 3197 | tty->specified_window = FRAME_LINES (f); | 3198 | tty->specified_window = height; |
| 3198 | 3199 | ||
| 3199 | FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; | 3200 | FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; |
| 3200 | terminal->char_ins_del_ok = 1; | 3201 | terminal->char_ins_del_ok = 1; |
diff --git a/src/termhooks.h b/src/termhooks.h index cdb788cfb07..fdbeda076b7 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -215,7 +215,7 @@ enum event_kind | |||
| 215 | /* events generated by xwidgets*/ | 215 | /* events generated by xwidgets*/ |
| 216 | , XWIDGET_EVENT | 216 | , XWIDGET_EVENT |
| 217 | #endif | 217 | #endif |
| 218 | #if defined (HAVE_INOTIFY) || defined (HAVE_NTGUI) | 218 | #ifdef USE_FILE_NOTIFY |
| 219 | /* File or directory was changed. */ | 219 | /* File or directory was changed. */ |
| 220 | , FILE_NOTIFY_EVENT | 220 | , FILE_NOTIFY_EVENT |
| 221 | #endif | 221 | #endif |
| @@ -2452,7 +2452,7 @@ get_emacs_configuration_options (void) | |||
| 2452 | 2452 | ||
| 2453 | /* Emulate gettimeofday (Ulrich Leodolter, 1/11/95). */ | 2453 | /* Emulate gettimeofday (Ulrich Leodolter, 1/11/95). */ |
| 2454 | int | 2454 | int |
| 2455 | gettimeofday (struct timeval *restrict tv, struct timezone *restrict tz) | 2455 | gettimeofday (struct timeval *__restrict tv, struct timezone *__restrict tz) |
| 2456 | { | 2456 | { |
| 2457 | struct _timeb tb; | 2457 | struct _timeb tb; |
| 2458 | _ftime (&tb); | 2458 | _ftime (&tb); |
diff --git a/src/w32console.c b/src/w32console.c index 06b2c7aa24e..ee92a593301 100644 --- a/src/w32console.c +++ b/src/w32console.c | |||
| @@ -601,7 +601,7 @@ w32_face_attributes (struct frame *f, int face_id) | |||
| 601 | } | 601 | } |
| 602 | 602 | ||
| 603 | void | 603 | void |
| 604 | initialize_w32_display (struct terminal *term) | 604 | initialize_w32_display (struct terminal *term, int *width, int *height) |
| 605 | { | 605 | { |
| 606 | CONSOLE_SCREEN_BUFFER_INFO info; | 606 | CONSOLE_SCREEN_BUFFER_INFO info; |
| 607 | Mouse_HLInfo *hlinfo; | 607 | Mouse_HLInfo *hlinfo; |
| @@ -722,23 +722,21 @@ initialize_w32_display (struct terminal *term) | |||
| 722 | || info.srWindow.Right - info.srWindow.Left < 40 | 722 | || info.srWindow.Right - info.srWindow.Left < 40 |
| 723 | || info.srWindow.Right - info.srWindow.Left > 100))) | 723 | || info.srWindow.Right - info.srWindow.Left > 100))) |
| 724 | { | 724 | { |
| 725 | FRAME_LINES (SELECTED_FRAME ()) = 25; | 725 | *height = 25; |
| 726 | SET_FRAME_COLS (SELECTED_FRAME (), 80); | 726 | *width = 80; |
| 727 | } | 727 | } |
| 728 | 728 | ||
| 729 | else if (w32_use_full_screen_buffer) | 729 | else if (w32_use_full_screen_buffer) |
| 730 | { | 730 | { |
| 731 | FRAME_LINES (SELECTED_FRAME ()) = info.dwSize.Y; /* lines per page */ | 731 | *height = info.dwSize.Y; /* lines per page */ |
| 732 | SET_FRAME_COLS (SELECTED_FRAME (), info.dwSize.X); /* characters per line */ | 732 | *width = info.dwSize.X; /* characters per line */ |
| 733 | } | 733 | } |
| 734 | else | 734 | else |
| 735 | { | 735 | { |
| 736 | /* Lines per page. Use buffer coords instead of buffer size. */ | 736 | /* Lines per page. Use buffer coords instead of buffer size. */ |
| 737 | FRAME_LINES (SELECTED_FRAME ()) = 1 + info.srWindow.Bottom - | 737 | *height = 1 + info.srWindow.Bottom - info.srWindow.Top; |
| 738 | info.srWindow.Top; | ||
| 739 | /* Characters per line. Use buffer coords instead of buffer size. */ | 738 | /* Characters per line. Use buffer coords instead of buffer size. */ |
| 740 | SET_FRAME_COLS (SELECTED_FRAME (), 1 + info.srWindow.Right - | 739 | *width = 1 + info.srWindow.Right - info.srWindow.Left; |
| 741 | info.srWindow.Left); | ||
| 742 | } | 740 | } |
| 743 | 741 | ||
| 744 | if (os_subtype == OS_NT) | 742 | if (os_subtype == OS_NT) |
diff --git a/src/w32inevt.c b/src/w32inevt.c index 3c38cf806e8..88a3f9739cd 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c | |||
| @@ -577,6 +577,7 @@ maybe_generate_resize_event (void) | |||
| 577 | 0, 0, 0); | 577 | 0, 0, 0); |
| 578 | } | 578 | } |
| 579 | 579 | ||
| 580 | #if HAVE_W32NOTIFY | ||
| 580 | static int | 581 | static int |
| 581 | handle_file_notifications (struct input_event *hold_quit) | 582 | handle_file_notifications (struct input_event *hold_quit) |
| 582 | { | 583 | { |
| @@ -644,6 +645,13 @@ handle_file_notifications (struct input_event *hold_quit) | |||
| 644 | leave_crit (); | 645 | leave_crit (); |
| 645 | return nevents; | 646 | return nevents; |
| 646 | } | 647 | } |
| 648 | #else /* !HAVE_W32NOTIFY */ | ||
| 649 | static int | ||
| 650 | handle_file_notifications (struct input_event *hold_quit) | ||
| 651 | { | ||
| 652 | return 0; | ||
| 653 | } | ||
| 654 | #endif /* !HAVE_W32NOTIFY */ | ||
| 647 | 655 | ||
| 648 | /* Here's an overview of how Emacs input works in non-GUI sessions on | 656 | /* Here's an overview of how Emacs input works in non-GUI sessions on |
| 649 | MS-Windows. (For description of the GUI input, see the commentary | 657 | MS-Windows. (For description of the GUI input, see the commentary |
diff --git a/src/w32notify.c b/src/w32notify.c index 1bcaa794565..be03a6ce45f 100644 --- a/src/w32notify.c +++ b/src/w32notify.c | |||
| @@ -39,7 +39,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 39 | return, and watch_worker then issues another call to | 39 | return, and watch_worker then issues another call to |
| 40 | ReadDirectoryChangesW. (Except when it does not, see below.) | 40 | ReadDirectoryChangesW. (Except when it does not, see below.) |
| 41 | 41 | ||
| 42 | In a GUI session, The WM_EMACS_FILENOTIFY message, posted to the | 42 | In a GUI session, the WM_EMACS_FILENOTIFY message posted to the |
| 43 | message queue gets dispatched to the main Emacs window procedure, | 43 | message queue gets dispatched to the main Emacs window procedure, |
| 44 | which queues it for processing by w32_read_socket. When | 44 | which queues it for processing by w32_read_socket. When |
| 45 | w32_read_socket sees this message, it accesses the buffer with file | 45 | w32_read_socket sees this message, it accesses the buffer with file |
diff --git a/src/w32term.c b/src/w32term.c index 58b1d3ca308..617492e189f 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -3210,6 +3210,8 @@ construct_drag_n_drop (struct input_event *result, W32Msg *msg, struct frame *f) | |||
| 3210 | } | 3210 | } |
| 3211 | 3211 | ||
| 3212 | 3212 | ||
| 3213 | #if HAVE_W32NOTIFY | ||
| 3214 | |||
| 3213 | /* File event notifications (see w32notify.c). */ | 3215 | /* File event notifications (see w32notify.c). */ |
| 3214 | 3216 | ||
| 3215 | Lisp_Object | 3217 | Lisp_Object |
| @@ -3325,7 +3327,8 @@ queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f, | |||
| 3325 | /* We've stuffed all the events ourselves, so w32_read_socket shouldn't. */ | 3327 | /* We've stuffed all the events ourselves, so w32_read_socket shouldn't. */ |
| 3326 | event->kind = NO_EVENT; | 3328 | event->kind = NO_EVENT; |
| 3327 | } | 3329 | } |
| 3328 | #endif | 3330 | #endif /* WINDOWSNT */ |
| 3331 | #endif /* HAVE_W32NOTIFY */ | ||
| 3329 | 3332 | ||
| 3330 | 3333 | ||
| 3331 | /* Function to report a mouse movement to the mainstream Emacs code. | 3334 | /* Function to report a mouse movement to the mainstream Emacs code. |
| @@ -4968,7 +4971,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4968 | check_visibility = 1; | 4971 | check_visibility = 1; |
| 4969 | break; | 4972 | break; |
| 4970 | 4973 | ||
| 4971 | #ifdef WINDOWSNT | 4974 | #if HAVE_W32NOTIFY |
| 4972 | case WM_EMACS_FILENOTIFY: | 4975 | case WM_EMACS_FILENOTIFY: |
| 4973 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 4976 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
| 4974 | if (f) | 4977 | if (f) |
diff --git a/src/w32term.h b/src/w32term.h index 9c27c09d03d..be0b4a6f350 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -683,7 +683,7 @@ extern Lisp_Object w32_get_watch_object (void *); | |||
| 683 | extern Lisp_Object lispy_file_action (DWORD); | 683 | extern Lisp_Object lispy_file_action (DWORD); |
| 684 | 684 | ||
| 685 | extern void w32_initialize_display_info (Lisp_Object); | 685 | extern void w32_initialize_display_info (Lisp_Object); |
| 686 | extern void initialize_w32_display (struct terminal *); | 686 | extern void initialize_w32_display (struct terminal *, int *, int *); |
| 687 | 687 | ||
| 688 | /* Keypad command key support. W32 doesn't have virtual keys defined | 688 | /* Keypad command key support. W32 doesn't have virtual keys defined |
| 689 | for the function keys on the keypad (they are mapped to the standard | 689 | for the function keys on the keypad (they are mapped to the standard |
diff --git a/src/window.c b/src/window.c index ed2505a893f..68e4291272d 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1621,12 +1621,13 @@ specifies the position of the last visible glyph in WINDOW. POS | |||
| 1621 | defaults to point in WINDOW; WINDOW defaults to the selected window. | 1621 | defaults to point in WINDOW; WINDOW defaults to the selected window. |
| 1622 | 1622 | ||
| 1623 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, | 1623 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, |
| 1624 | return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), | 1624 | the return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), |
| 1625 | where X and Y are the pixel coordinates relative to the top left corner | 1625 | where X and Y are the pixel coordinates relative to the top left corner |
| 1626 | of the window. The remaining elements are omitted if the character after | 1626 | of the window. The remaining elements are omitted if the character after |
| 1627 | POS is fully visible; otherwise, RTOP and RBOT are the number of pixels | 1627 | POS is fully visible; otherwise, RTOP and RBOT are the number of pixels |
| 1628 | off-window at the top and bottom of the row, ROWH is the height of the | 1628 | off-window at the top and bottom of the screen line ("row") containing |
| 1629 | display row, and VPOS is the row number (0-based) containing POS. */) | 1629 | POS, ROWH is the visible height of that row, and VPOS is the row number |
| 1630 | \(zero-based). */) | ||
| 1630 | (Lisp_Object pos, Lisp_Object window, Lisp_Object partially) | 1631 | (Lisp_Object pos, Lisp_Object window, Lisp_Object partially) |
| 1631 | { | 1632 | { |
| 1632 | register struct window *w; | 1633 | register struct window *w; |
diff --git a/src/xdisp.c b/src/xdisp.c index d26f5b4e045..09fb3934cc9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2655,6 +2655,7 @@ init_iterator (struct it *it, struct window *w, | |||
| 2655 | it->bidi_it.string.lstring = Qnil; | 2655 | it->bidi_it.string.lstring = Qnil; |
| 2656 | it->bidi_it.string.s = NULL; | 2656 | it->bidi_it.string.s = NULL; |
| 2657 | it->bidi_it.string.bufpos = 0; | 2657 | it->bidi_it.string.bufpos = 0; |
| 2658 | it->bidi_it.w = w; | ||
| 2658 | 2659 | ||
| 2659 | /* The window in which we iterate over current_buffer: */ | 2660 | /* The window in which we iterate over current_buffer: */ |
| 2660 | XSETWINDOW (it->window, w); | 2661 | XSETWINDOW (it->window, w); |
| @@ -3129,6 +3130,7 @@ init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos) | |||
| 3129 | it->bidi_it.string.bufpos = it->overlay_strings_charpos; | 3130 | it->bidi_it.string.bufpos = it->overlay_strings_charpos; |
| 3130 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; | 3131 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; |
| 3131 | it->bidi_it.string.unibyte = !it->multibyte_p; | 3132 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 3133 | it->bidi_it.w = it->w; | ||
| 3132 | bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it), | 3134 | bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it), |
| 3133 | FRAME_WINDOW_P (it->f), &it->bidi_it); | 3135 | FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 3134 | 3136 | ||
| @@ -3495,11 +3497,11 @@ next_overlay_change (ptrdiff_t pos) | |||
| 3495 | ptrdiff_t | 3497 | ptrdiff_t |
| 3496 | compute_display_string_pos (struct text_pos *position, | 3498 | compute_display_string_pos (struct text_pos *position, |
| 3497 | struct bidi_string_data *string, | 3499 | struct bidi_string_data *string, |
| 3500 | struct window *w, | ||
| 3498 | int frame_window_p, int *disp_prop) | 3501 | int frame_window_p, int *disp_prop) |
| 3499 | { | 3502 | { |
| 3500 | /* OBJECT = nil means current buffer. */ | 3503 | /* OBJECT = nil means current buffer. */ |
| 3501 | Lisp_Object object = | 3504 | Lisp_Object object, object1; |
| 3502 | (string && STRINGP (string->lstring)) ? string->lstring : Qnil; | ||
| 3503 | Lisp_Object pos, spec, limpos; | 3505 | Lisp_Object pos, spec, limpos; |
| 3504 | int string_p = (string && (STRINGP (string->lstring) || string->s)); | 3506 | int string_p = (string && (STRINGP (string->lstring) || string->s)); |
| 3505 | ptrdiff_t eob = string_p ? string->schars : ZV; | 3507 | ptrdiff_t eob = string_p ? string->schars : ZV; |
| @@ -3510,6 +3512,16 @@ compute_display_string_pos (struct text_pos *position, | |||
| 3510 | struct text_pos tpos; | 3512 | struct text_pos tpos; |
| 3511 | int rv = 0; | 3513 | int rv = 0; |
| 3512 | 3514 | ||
| 3515 | if (string && STRINGP (string->lstring)) | ||
| 3516 | object1 = object = string->lstring; | ||
| 3517 | else if (w && !string_p) | ||
| 3518 | { | ||
| 3519 | XSETWINDOW (object, w); | ||
| 3520 | object1 = Qnil; | ||
| 3521 | } | ||
| 3522 | else | ||
| 3523 | object1 = object = Qnil; | ||
| 3524 | |||
| 3513 | *disp_prop = 1; | 3525 | *disp_prop = 1; |
| 3514 | 3526 | ||
| 3515 | if (charpos >= eob | 3527 | if (charpos >= eob |
| @@ -3548,7 +3560,7 @@ compute_display_string_pos (struct text_pos *position, | |||
| 3548 | that will replace the underlying text when displayed. */ | 3560 | that will replace the underlying text when displayed. */ |
| 3549 | limpos = make_number (lim); | 3561 | limpos = make_number (lim); |
| 3550 | do { | 3562 | do { |
| 3551 | pos = Fnext_single_char_property_change (pos, Qdisplay, object, limpos); | 3563 | pos = Fnext_single_char_property_change (pos, Qdisplay, object1, limpos); |
| 3552 | CHARPOS (tpos) = XFASTINT (pos); | 3564 | CHARPOS (tpos) = XFASTINT (pos); |
| 3553 | if (CHARPOS (tpos) >= lim) | 3565 | if (CHARPOS (tpos) >= lim) |
| 3554 | { | 3566 | { |
| @@ -5043,6 +5055,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 5043 | it->bidi_it.string.bufpos = bufpos; | 5055 | it->bidi_it.string.bufpos = bufpos; |
| 5044 | it->bidi_it.string.from_disp_str = 1; | 5056 | it->bidi_it.string.from_disp_str = 1; |
| 5045 | it->bidi_it.string.unibyte = !it->multibyte_p; | 5057 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 5058 | it->bidi_it.w = it->w; | ||
| 5046 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); | 5059 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 5047 | } | 5060 | } |
| 5048 | } | 5061 | } |
| @@ -5434,6 +5447,7 @@ next_overlay_string (struct it *it) | |||
| 5434 | it->bidi_it.string.bufpos = it->overlay_strings_charpos; | 5447 | it->bidi_it.string.bufpos = it->overlay_strings_charpos; |
| 5435 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; | 5448 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; |
| 5436 | it->bidi_it.string.unibyte = !it->multibyte_p; | 5449 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 5450 | it->bidi_it.w = it->w; | ||
| 5437 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); | 5451 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 5438 | } | 5452 | } |
| 5439 | } | 5453 | } |
| @@ -5737,6 +5751,7 @@ get_overlay_strings_1 (struct it *it, ptrdiff_t charpos, int compute_stop_p) | |||
| 5737 | it->bidi_it.string.bufpos = pos; | 5751 | it->bidi_it.string.bufpos = pos; |
| 5738 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; | 5752 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; |
| 5739 | it->bidi_it.string.unibyte = !it->multibyte_p; | 5753 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 5754 | it->bidi_it.w = it->w; | ||
| 5740 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); | 5755 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 5741 | } | 5756 | } |
| 5742 | return 1; | 5757 | return 1; |
| @@ -6379,6 +6394,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p) | |||
| 6379 | it->bidi_it.string.lstring = Qnil; | 6394 | it->bidi_it.string.lstring = Qnil; |
| 6380 | it->bidi_it.string.bufpos = 0; | 6395 | it->bidi_it.string.bufpos = 0; |
| 6381 | it->bidi_it.string.unibyte = 0; | 6396 | it->bidi_it.string.unibyte = 0; |
| 6397 | it->bidi_it.w = it->w; | ||
| 6382 | } | 6398 | } |
| 6383 | 6399 | ||
| 6384 | if (set_stop_p) | 6400 | if (set_stop_p) |
| @@ -6456,6 +6472,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, | |||
| 6456 | it->bidi_it.string.bufpos = 0; | 6472 | it->bidi_it.string.bufpos = 0; |
| 6457 | it->bidi_it.string.from_disp_str = 0; | 6473 | it->bidi_it.string.from_disp_str = 0; |
| 6458 | it->bidi_it.string.unibyte = !it->multibyte_p; | 6474 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 6475 | it->bidi_it.w = it->w; | ||
| 6459 | bidi_init_it (charpos, IT_STRING_BYTEPOS (*it), | 6476 | bidi_init_it (charpos, IT_STRING_BYTEPOS (*it), |
| 6460 | FRAME_WINDOW_P (it->f), &it->bidi_it); | 6477 | FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 6461 | } | 6478 | } |
| @@ -6487,6 +6504,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, | |||
| 6487 | it->bidi_it.string.bufpos = 0; | 6504 | it->bidi_it.string.bufpos = 0; |
| 6488 | it->bidi_it.string.from_disp_str = 0; | 6505 | it->bidi_it.string.from_disp_str = 0; |
| 6489 | it->bidi_it.string.unibyte = !it->multibyte_p; | 6506 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 6507 | it->bidi_it.w = it->w; | ||
| 6490 | bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), | 6508 | bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), |
| 6491 | &it->bidi_it); | 6509 | &it->bidi_it); |
| 6492 | } | 6510 | } |
| @@ -12186,12 +12204,27 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, | |||
| 12186 | int hpos, vpos, prop_idx; | 12204 | int hpos, vpos, prop_idx; |
| 12187 | struct glyph *glyph; | 12205 | struct glyph *glyph; |
| 12188 | Lisp_Object enabled_p; | 12206 | Lisp_Object enabled_p; |
| 12189 | 12207 | int ts; | |
| 12190 | /* If not on the highlighted tool-bar item, return. */ | 12208 | |
| 12209 | /* If not on the highlighted tool-bar item, and mouse-highlight is | ||
| 12210 | non-nil, return. This is so we generate the tool-bar button | ||
| 12211 | click only when the mouse button is released on the same item as | ||
| 12212 | where it was pressed. However, when mouse-highlight is disabled, | ||
| 12213 | generate the click when the button is released regardless of the | ||
| 12214 | highlight, since tool-bar items are not highlighted in that | ||
| 12215 | case. */ | ||
| 12191 | frame_to_window_pixel_xy (w, &x, &y); | 12216 | frame_to_window_pixel_xy (w, &x, &y); |
| 12192 | if (get_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0) | 12217 | ts = get_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx); |
| 12218 | if (ts == -1 | ||
| 12219 | || (ts != 0 && !NILP (Vmouse_highlight))) | ||
| 12193 | return; | 12220 | return; |
| 12194 | 12221 | ||
| 12222 | /* When mouse-highlight is off, generate the click for the item | ||
| 12223 | where the button was pressed, disregarding where it was | ||
| 12224 | released. */ | ||
| 12225 | if (NILP (Vmouse_highlight) && !down_p) | ||
| 12226 | prop_idx = last_tool_bar_item; | ||
| 12227 | |||
| 12195 | /* If item is disabled, do nothing. */ | 12228 | /* If item is disabled, do nothing. */ |
| 12196 | enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); | 12229 | enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); |
| 12197 | if (NILP (enabled_p)) | 12230 | if (NILP (enabled_p)) |
| @@ -12200,7 +12233,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, | |||
| 12200 | if (down_p) | 12233 | if (down_p) |
| 12201 | { | 12234 | { |
| 12202 | /* Show item in pressed state. */ | 12235 | /* Show item in pressed state. */ |
| 12203 | show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN); | 12236 | if (!NILP (Vmouse_highlight)) |
| 12237 | show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN); | ||
| 12204 | last_tool_bar_item = prop_idx; | 12238 | last_tool_bar_item = prop_idx; |
| 12205 | } | 12239 | } |
| 12206 | else | 12240 | else |
| @@ -12210,7 +12244,8 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, | |||
| 12210 | EVENT_INIT (event); | 12244 | EVENT_INIT (event); |
| 12211 | 12245 | ||
| 12212 | /* Show item in released state. */ | 12246 | /* Show item in released state. */ |
| 12213 | show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); | 12247 | if (!NILP (Vmouse_highlight)) |
| 12248 | show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); | ||
| 12214 | 12249 | ||
| 12215 | key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); | 12250 | key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); |
| 12216 | 12251 | ||
| @@ -12283,7 +12318,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) | |||
| 12283 | 12318 | ||
| 12284 | /* If tool-bar item is not enabled, don't highlight it. */ | 12319 | /* If tool-bar item is not enabled, don't highlight it. */ |
| 12285 | enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); | 12320 | enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); |
| 12286 | if (!NILP (enabled_p)) | 12321 | if (!NILP (enabled_p) && !NILP (Vmouse_highlight)) |
| 12287 | { | 12322 | { |
| 12288 | /* Compute the x-position of the glyph. In front and past the | 12323 | /* Compute the x-position of the glyph. In front and past the |
| 12289 | image is a space. We include this in the highlighted area. */ | 12324 | image is a space. We include this in the highlighted area. */ |
| @@ -12900,7 +12935,6 @@ redisplay_internal (void) | |||
| 12900 | struct frame *sf; | 12935 | struct frame *sf; |
| 12901 | int polling_stopped_here = 0; | 12936 | int polling_stopped_here = 0; |
| 12902 | Lisp_Object tail, frame; | 12937 | Lisp_Object tail, frame; |
| 12903 | struct backtrace backtrace; | ||
| 12904 | 12938 | ||
| 12905 | /* Non-zero means redisplay has to consider all windows on all | 12939 | /* Non-zero means redisplay has to consider all windows on all |
| 12906 | frames. Zero means, only selected_window is considered. */ | 12940 | frames. Zero means, only selected_window is considered. */ |
| @@ -12944,12 +12978,7 @@ redisplay_internal (void) | |||
| 12944 | specbind (Qinhibit_free_realized_faces, Qnil); | 12978 | specbind (Qinhibit_free_realized_faces, Qnil); |
| 12945 | 12979 | ||
| 12946 | /* Record this function, so it appears on the profiler's backtraces. */ | 12980 | /* Record this function, so it appears on the profiler's backtraces. */ |
| 12947 | backtrace.next = backtrace_list; | 12981 | record_in_backtrace (Qredisplay_internal, &Qnil, 0); |
| 12948 | backtrace.function = Qredisplay_internal; | ||
| 12949 | backtrace.args = &Qnil; | ||
| 12950 | backtrace.nargs = 0; | ||
| 12951 | backtrace.debug_on_exit = 0; | ||
| 12952 | backtrace_list = &backtrace; | ||
| 12953 | 12982 | ||
| 12954 | FOR_EACH_FRAME (tail, frame) | 12983 | FOR_EACH_FRAME (tail, frame) |
| 12955 | XFRAME (frame)->already_hscrolled_p = 0; | 12984 | XFRAME (frame)->already_hscrolled_p = 0; |
| @@ -13593,7 +13622,6 @@ redisplay_internal (void) | |||
| 13593 | #endif /* HAVE_WINDOW_SYSTEM */ | 13622 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 13594 | 13623 | ||
| 13595 | end_of_redisplay: | 13624 | end_of_redisplay: |
| 13596 | backtrace_list = backtrace.next; | ||
| 13597 | unbind_to (count, Qnil); | 13625 | unbind_to (count, Qnil); |
| 13598 | RESUME_POLLING; | 13626 | RESUME_POLLING; |
| 13599 | } | 13627 | } |
| @@ -19016,6 +19044,7 @@ push_prefix_prop (struct it *it, Lisp_Object prop) | |||
| 19016 | it->bidi_it.string.bufpos = IT_CHARPOS (*it); | 19044 | it->bidi_it.string.bufpos = IT_CHARPOS (*it); |
| 19017 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; | 19045 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; |
| 19018 | it->bidi_it.string.unibyte = !it->multibyte_p; | 19046 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 19047 | it->bidi_it.w = it->w; | ||
| 19019 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); | 19048 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 19020 | } | 19049 | } |
| 19021 | } | 19050 | } |
| @@ -19046,16 +19075,19 @@ push_prefix_prop (struct it *it, Lisp_Object prop) | |||
| 19046 | static Lisp_Object | 19075 | static Lisp_Object |
| 19047 | get_it_property (struct it *it, Lisp_Object prop) | 19076 | get_it_property (struct it *it, Lisp_Object prop) |
| 19048 | { | 19077 | { |
| 19049 | Lisp_Object position; | 19078 | Lisp_Object position, object = it->object; |
| 19050 | 19079 | ||
| 19051 | if (STRINGP (it->object)) | 19080 | if (STRINGP (object)) |
| 19052 | position = make_number (IT_STRING_CHARPOS (*it)); | 19081 | position = make_number (IT_STRING_CHARPOS (*it)); |
| 19053 | else if (BUFFERP (it->object)) | 19082 | else if (BUFFERP (object)) |
| 19054 | position = make_number (IT_CHARPOS (*it)); | 19083 | { |
| 19084 | position = make_number (IT_CHARPOS (*it)); | ||
| 19085 | object = it->window; | ||
| 19086 | } | ||
| 19055 | else | 19087 | else |
| 19056 | return Qnil; | 19088 | return Qnil; |
| 19057 | 19089 | ||
| 19058 | return Fget_char_property (position, prop, it->object); | 19090 | return Fget_char_property (position, prop, object); |
| 19059 | } | 19091 | } |
| 19060 | 19092 | ||
| 19061 | /* See if there's a line- or wrap-prefix, and if so, push it on IT. */ | 19093 | /* See if there's a line- or wrap-prefix, and if so, push it on IT. */ |
| @@ -20085,6 +20117,10 @@ See also `bidi-paragraph-direction'. */) | |||
| 20085 | itb.string.lstring = Qnil; | 20117 | itb.string.lstring = Qnil; |
| 20086 | itb.string.bufpos = 0; | 20118 | itb.string.bufpos = 0; |
| 20087 | itb.string.unibyte = 0; | 20119 | itb.string.unibyte = 0; |
| 20120 | /* We have no window to use here for ignoring window-specific | ||
| 20121 | overlays. Using NULL for window pointer will cause | ||
| 20122 | compute_display_string_pos to use the current buffer. */ | ||
| 20123 | itb.w = NULL; | ||
| 20088 | bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); | 20124 | bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); |
| 20089 | bidi_unshelve_cache (itb_data, 0); | 20125 | bidi_unshelve_cache (itb_data, 0); |
| 20090 | set_buffer_temp (old); | 20126 | set_buffer_temp (old); |
| @@ -27658,7 +27694,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 27658 | if (STRINGP (string)) | 27694 | if (STRINGP (string)) |
| 27659 | { | 27695 | { |
| 27660 | mouse_face = Fget_text_property (pos, Qmouse_face, string); | 27696 | mouse_face = Fget_text_property (pos, Qmouse_face, string); |
| 27661 | if (!NILP (mouse_face) | 27697 | if (!NILP (Vmouse_highlight) && !NILP (mouse_face) |
| 27662 | && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) | 27698 | && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) |
| 27663 | && glyph) | 27699 | && glyph) |
| 27664 | { | 27700 | { |
| @@ -27796,8 +27832,10 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 27796 | 27832 | ||
| 27797 | /* EXPORT: | 27833 | /* EXPORT: |
| 27798 | Take proper action when the mouse has moved to position X, Y on | 27834 | Take proper action when the mouse has moved to position X, Y on |
| 27799 | frame F as regards highlighting characters that have mouse-face | 27835 | frame F with regards to highlighting portions of display that have |
| 27800 | properties. Also de-highlighting chars where the mouse was before. | 27836 | mouse-face properties. Also de-highlight portions of display where |
| 27837 | the mouse was before, set the mouse pointer shape as appropriate | ||
| 27838 | for the mouse coordinates, and activate help echo (tooltips). | ||
| 27801 | X and Y can be negative or out of range. */ | 27839 | X and Y can be negative or out of range. */ |
| 27802 | 27840 | ||
| 27803 | void | 27841 | void |
| @@ -27817,8 +27855,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 27817 | return; | 27855 | return; |
| 27818 | #endif | 27856 | #endif |
| 27819 | 27857 | ||
| 27820 | if (NILP (Vmouse_highlight) | 27858 | if (!f->glyphs_initialized_p |
| 27821 | || !f->glyphs_initialized_p | ||
| 27822 | || f->pointer_invisible) | 27859 | || f->pointer_invisible) |
| 27823 | return; | 27860 | return; |
| 27824 | 27861 | ||
| @@ -28014,6 +28051,12 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 28014 | else | 28051 | else |
| 28015 | noverlays = 0; | 28052 | noverlays = 0; |
| 28016 | 28053 | ||
| 28054 | if (NILP (Vmouse_highlight)) | ||
| 28055 | { | ||
| 28056 | clear_mouse_face (hlinfo); | ||
| 28057 | goto check_help_echo; | ||
| 28058 | } | ||
| 28059 | |||
| 28017 | same_region = coords_in_mouse_face_p (w, hpos, vpos); | 28060 | same_region = coords_in_mouse_face_p (w, hpos, vpos); |
| 28018 | 28061 | ||
| 28019 | if (same_region) | 28062 | if (same_region) |
diff --git a/src/xgselect.c b/src/xgselect.c index 0b5ad6ae70d..4d90298a9d9 100644 --- a/src/xgselect.c +++ b/src/xgselect.c | |||
| @@ -21,11 +21,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | 21 | ||
| 22 | #include "xgselect.h" | 22 | #include "xgselect.h" |
| 23 | 23 | ||
| 24 | #if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) | 24 | #ifdef HAVE_GLIB |
| 25 | 25 | ||
| 26 | #include <glib.h> | 26 | #include <glib.h> |
| 27 | #include <errno.h> | 27 | #include <errno.h> |
| 28 | #include "xterm.h" | ||
| 29 | #include "frame.h" | 28 | #include "frame.h" |
| 30 | 29 | ||
| 31 | int | 30 | int |
| @@ -44,9 +43,13 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, | |||
| 44 | int i, nfds, tmo_in_millisec; | 43 | int i, nfds, tmo_in_millisec; |
| 45 | USE_SAFE_ALLOCA; | 44 | USE_SAFE_ALLOCA; |
| 46 | 45 | ||
| 47 | if (! (window_system_available (NULL) | 46 | /* Do not try to optimize with an initial check with g_main_context_pending |
| 48 | && g_main_context_pending (context = g_main_context_default ()))) | 47 | and a call to pselect if it returns false. If Gdk has a timeout for 0.01 |
| 49 | return pselect (fds_lim, rfds, wfds, efds, timeout, sigmask); | 48 | second, and Emacs has a timeout for 1 second, g_main_context_pending will |
| 49 | return false, but the timeout will be 1 second, thus missing the gdk | ||
| 50 | timeout with a lot. */ | ||
| 51 | |||
| 52 | context = g_main_context_default (); | ||
| 50 | 53 | ||
| 51 | if (rfds) all_rfds = *rfds; | 54 | if (rfds) all_rfds = *rfds; |
| 52 | else FD_ZERO (&all_rfds); | 55 | else FD_ZERO (&all_rfds); |
| @@ -140,4 +143,4 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, | |||
| 140 | 143 | ||
| 141 | return retval; | 144 | return retval; |
| 142 | } | 145 | } |
| 143 | #endif /* USE_GTK || HAVE_GCONF || HAVE_GSETTINGS */ | 146 | #endif /* HAVE_GLIB */ |