diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 371 | ||||
| -rw-r--r-- | src/buffer.c | 3 | ||||
| -rw-r--r-- | src/callint.c | 2 | ||||
| -rw-r--r-- | src/charset.h | 2 | ||||
| -rw-r--r-- | src/coding.c | 15 | ||||
| -rw-r--r-- | src/dispextern.h | 8 | ||||
| -rw-r--r-- | src/dispnew.c | 10 | ||||
| -rw-r--r-- | src/emacs.c | 19 | ||||
| -rw-r--r-- | src/fileio.c | 38 | ||||
| -rw-r--r-- | src/fns.c | 2 | ||||
| -rw-r--r-- | src/gtkutil.c | 34 | ||||
| -rw-r--r-- | src/image.c | 1 | ||||
| -rw-r--r-- | src/lisp.h | 6 | ||||
| -rw-r--r-- | src/lread.c | 119 | ||||
| -rw-r--r-- | src/mac.c | 180 | ||||
| -rw-r--r-- | src/macfns.c | 22 | ||||
| -rw-r--r-- | src/macgui.h | 7 | ||||
| -rw-r--r-- | src/macselect.c | 369 | ||||
| -rw-r--r-- | src/macterm.c | 374 | ||||
| -rw-r--r-- | src/macterm.h | 53 | ||||
| -rw-r--r-- | src/minibuf.c | 46 | ||||
| -rw-r--r-- | src/process.c | 84 | ||||
| -rw-r--r-- | src/search.c | 1 | ||||
| -rw-r--r-- | src/sound.c | 48 | ||||
| -rw-r--r-- | src/sysdep.c | 2 | ||||
| -rw-r--r-- | src/w32fns.c | 2 | ||||
| -rw-r--r-- | src/w32heap.c | 4 | ||||
| -rw-r--r-- | src/w32term.c | 240 | ||||
| -rw-r--r-- | src/window.c | 13 | ||||
| -rw-r--r-- | src/xdisp.c | 82 | ||||
| -rw-r--r-- | src/xfns.c | 4 | ||||
| -rw-r--r-- | src/xmenu.c | 117 | ||||
| -rw-r--r-- | src/xterm.c | 37 |
33 files changed, 1910 insertions, 405 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c2fdb389729..5154dc5012e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,355 @@ | |||
| 1 | 2006-06-03 Aidan Kehoe <kehoea@parhasard.net> | ||
| 2 | |||
| 3 | * lread.c (read_escape): Provide a Unicode character escape | ||
| 4 | syntax; \u followed by exactly four or \U followed by exactly | ||
| 5 | eight hex digits in a comment or string is read as a Unicode | ||
| 6 | character with that code point. | ||
| 7 | |||
| 8 | 2006-06-09 Eli Zaretskii <eliz@gnu.org> | ||
| 9 | |||
| 10 | * window.c (window_scroll_pixel_based): Signal "Beginning of | ||
| 11 | buffer" when scroll-down at the beginning of an empty buffer. | ||
| 12 | |||
| 13 | 2006-06-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 14 | |||
| 15 | * macterm.c [USE_MAC_TSM] (mac_handle_text_input_event): Exclude | ||
| 16 | 0x7f from ASCII range. | ||
| 17 | |||
| 18 | 2006-06-05 Jason Rumney <jasonr@gnu.org> | ||
| 19 | |||
| 20 | * w32term.c (w32_set_scroll_bar_thumb, x_scroll_bar_create) | ||
| 21 | (w32_set_vertical_scroll_bar, w32_scroll_bar_handle_click) | ||
| 22 | (x_scroll_bar_report_motion): Remove workarounds for | ||
| 23 | versions of Windows NT < 3.51. | ||
| 24 | [!SIF_ALL]: Remove. | ||
| 25 | (pfnSetScrollInfo, pfnGetScrollInfo): Remove. | ||
| 26 | (w32_initialize): Don't dynamically load Get/SetScrollInfo. | ||
| 27 | |||
| 28 | 2006-06-04 David Kastrup <dak@gnu.org> | ||
| 29 | |||
| 30 | * dispnew.c: Mention `redisplay-dont-pause' in doc string of | ||
| 31 | `sit-for'. | ||
| 32 | |||
| 33 | 2006-06-03 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 34 | |||
| 35 | * macfns.c (x_set_icon_name): Apply 2006-06-02 change for xfns.c. | ||
| 36 | |||
| 37 | * macgui.h (USE_MAC_TSM): Set default to 1 on Mac OS X. | ||
| 38 | |||
| 39 | * macterm.c (tsm_document_id) [USE_MAC_TSM]: New variable. | ||
| 40 | (Qtext_input, Qupdate_active_input_area, Qunicode_for_key_event) | ||
| 41 | [USE_MAC_TSM]: Likewise. | ||
| 42 | (syms_of_macterm) [USE_MAC_TSM]: Intern and staticpro them. | ||
| 43 | (Qbefore_string) [USE_MAC_TSM]: Add extern. | ||
| 44 | (do_app_resume, do_app_suspend) [USE_MAC_TSM]: Call | ||
| 45 | ActivateTSMDocument/DeactivateTSMDocument. | ||
| 46 | (mac_store_event_ref_as_apple_event): Call mac_post_mouse_moved_event. | ||
| 47 | (mac_handle_window_event) [USE_MAC_TSM]: Handle | ||
| 48 | kEventWindowFocusAcquired/kEventWindowFocusRelinquish. | ||
| 49 | (mac_handle_text_input_event) [USE_MAC_TSM]: New function. | ||
| 50 | (install_window_handler) [USE_MAC_TSM]: Install it. Register | ||
| 51 | kEventWindowFocusAcquired/kEventWindowFocusRelinquish. | ||
| 52 | (keycode_to_xkeysym_table): Add entry for f16. | ||
| 53 | (XTread_socket) [USE_MAC_TSM]: Set/reset read_socket_inev | ||
| 54 | before/after passing keystroke event to toolbox dispatcher. | ||
| 55 | (init_tsm) [USE_MAC_TSM]: New function. | ||
| 56 | (mac_initialize) [USE_MAC_TSM]: Call it. | ||
| 57 | (Vmac_ts_active_input_overlay) [USE_MAC_TSM]: New defvar. | ||
| 58 | |||
| 59 | * macterm.h (EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER): New enumerator. | ||
| 60 | |||
| 61 | 2006-06-02 John Paul Wallington <jpw@gnu.org> | ||
| 62 | |||
| 63 | * xfns.c (x_set_name_internal): Set icon to `text', derived from | ||
| 64 | name, when frame's icon_name isn't a string rather than only when | ||
| 65 | it is nil. | ||
| 66 | |||
| 67 | 2006-06-03 Eli Zaretskii <eliz@gnu.org> | ||
| 68 | |||
| 69 | * w32fns.c (x_set_icon_name): Don't use arg if it's not a string | ||
| 70 | and not nil. | ||
| 71 | |||
| 72 | 2006-06-02 Chong Yidong <cyd@stupidchicken.com> | ||
| 73 | |||
| 74 | * xfns.c (x_set_icon_name): No-op if arg is non-nil and not a | ||
| 75 | string. | ||
| 76 | |||
| 77 | 2006-06-02 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 78 | |||
| 79 | * xdisp.c (next_element_from_composition): Set it->object to | ||
| 80 | it->string if composition is coming from string. | ||
| 81 | (set_cursor_from_row): Don't return 0 unless row displays a | ||
| 82 | continued line. | ||
| 83 | (dump_glyph): Dump composite glyph. | ||
| 84 | |||
| 85 | 2006-06-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 86 | |||
| 87 | * gtkutil.c (menu_nav_ended): Check that menubar_widget is not NULL. | ||
| 88 | |||
| 89 | 2006-06-01 Richard Stallman <rms@gnu.org> | ||
| 90 | |||
| 91 | * window.c (Fsplit_window): Doc fix. | ||
| 92 | |||
| 93 | 2006-06-01 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> | ||
| 94 | |||
| 95 | * process.c (deleted_pid_list): New variable to store the pids | ||
| 96 | of deleted processes. Declare it only if SIGCHLD is defined. | ||
| 97 | (init_process): Initialize it. | ||
| 98 | (syms_of_process): Staticpro it. | ||
| 99 | (Fdelete_process): Add pid of the deleted process to it. Check after | ||
| 100 | the addition and before the kill if the process is already stopped, | ||
| 101 | in which case it is deleted from the list and not killed. | ||
| 102 | (sigchld_handler): Define it only if SIGCHLD is. Search the process | ||
| 103 | that signaled Emacs in `deleted_pid_list' before `Vprocess_alist'. | ||
| 104 | Original idea by Stefan Monnier. | ||
| 105 | |||
| 106 | 2006-06-01 Kim F. Storm <storm@cua.dk> | ||
| 107 | |||
| 108 | * dispnew.c (sit_for): Perform redisplay even if input is pending | ||
| 109 | when redisplay-dont-pause is non-nil. | ||
| 110 | |||
| 111 | 2006-06-01 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 112 | |||
| 113 | * macterm.c (mac_handle_visibility_change): Set buf.arg to Qnil. | ||
| 114 | (XTread_socket): Remove obsolete comment. | ||
| 115 | |||
| 116 | 2006-06-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 117 | |||
| 118 | * xmenu.c (syms_of_xmenu): Make accelerate-menu an alias for | ||
| 119 | menu-bar-open. | ||
| 120 | |||
| 121 | 2006-06-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 122 | |||
| 123 | * xmenu.c (Fmenu_bar_open, syms_of_xmenu): Change menu-bar-start to | ||
| 124 | menu-bar-open. | ||
| 125 | |||
| 126 | * gtkutil.c (menu_nav_ended): Change x-menu-bar-start to menu-bar-open. | ||
| 127 | |||
| 128 | 2006-05-31 Juri Linkov <juri@jurta.org> | ||
| 129 | |||
| 130 | * minibuf.c (Vhistory_add_new_input): New variable. | ||
| 131 | (read_minibuf): Use it. | ||
| 132 | (syms_of_minibuf) <history-add-new-input>: New Lisp variable. | ||
| 133 | (syms_of_minibuf) <history-delete-duplicates>: Doc fix. | ||
| 134 | |||
| 135 | 2006-05-31 Kim F. Storm <storm@cua.dk> | ||
| 136 | |||
| 137 | * process.c (select_wrapper): Add wrapper around select to work around | ||
| 138 | "incomplete backtrace" bug in gdb 5.3, when emacs is stopped inside | ||
| 139 | select called from wait_reading_process_output. | ||
| 140 | |||
| 141 | 2006-05-30 Andreas Schwab <schwab@suse.de> | ||
| 142 | |||
| 143 | * xmenu.c (Fmenu_bar_start): Return a value. | ||
| 144 | |||
| 145 | 2006-05-30 Richard Stallman <rms@gnu.org> | ||
| 146 | |||
| 147 | * coding.c (Ffind_operation_coding_system): Doc fix. | ||
| 148 | |||
| 149 | 2006-05-30 Eli Zaretskii <eliz@gnu.org> | ||
| 150 | |||
| 151 | * w32term.c (x_draw_hollow_cursor): Fix last change. | ||
| 152 | |||
| 153 | 2006-05-29 Kim F. Storm <storm@cua.dk> | ||
| 154 | |||
| 155 | * w32term.c (x_draw_stretch_glyph_string): Fix last change. | ||
| 156 | |||
| 157 | 2006-05-29 Eli Zaretskii <eliz@gnu.org> | ||
| 158 | |||
| 159 | * coding.c (Ffind_operation_coding_system): Doc fix. | ||
| 160 | |||
| 161 | 2006-05-29 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 162 | |||
| 163 | * macfns.c [USE_MAC_FONT_PANEL] (Fmac_set_font_panel_visibility): | ||
| 164 | Call mac_set_font_info_for_selection if font panel is made visible. | ||
| 165 | |||
| 166 | * macterm.c (font_panel_shown_p) [USE_MAC_FONT_PANEL]: New variable. | ||
| 167 | (mac_font_panel_visible_p, mac_show_hide_font_panel) | ||
| 168 | [USE_MAC_FONT_PANEL]: New functions. | ||
| 169 | [USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection): Return | ||
| 170 | immediately if font panel is not visible. | ||
| 171 | |||
| 172 | * macterm.h (mac_font_panel_visible_p, mac_show_hide_font_panel): | ||
| 173 | Add externs. | ||
| 174 | |||
| 175 | 2006-05-29 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 176 | |||
| 177 | * search.c (matcher_overflow): Mark as NO_RETURN. | ||
| 178 | |||
| 179 | * xterm.c (x_connection_closed): Likewise. | ||
| 180 | |||
| 181 | * sysdep.c (croak): Likewise. | ||
| 182 | |||
| 183 | * sound.c (sound_perror, alsa_sound_perror): Likewise. | ||
| 184 | |||
| 185 | * lisp.h (die, nsberror): Likewise. | ||
| 186 | |||
| 187 | 2006-05-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 188 | |||
| 189 | * sound.c (alsa_open, alsa_configure, alsa_write): Move | ||
| 190 | assignment to err out of if-statement. | ||
| 191 | |||
| 192 | * gtkutil.c (menu_nav_ended): New function. | ||
| 193 | (create_menus): Connect menu_nav_ended to "selection-done" to fix | ||
| 194 | grabs. | ||
| 195 | |||
| 196 | * xmenu.c (Fmenu_bar_start): New function for USE_GTK and USE_X_TOOLKIT. | ||
| 197 | |||
| 198 | 2006-05-28 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 199 | |||
| 200 | * charset.h (invalid_character): Mark as NO_RETURN. | ||
| 201 | |||
| 202 | 2006-05-29 Kenichi Handa <handa@m17n.org> | ||
| 203 | |||
| 204 | * coding.c (Ffind_operation_coding_system): Call a function by | ||
| 205 | safe_call1 instead of call1. | ||
| 206 | |||
| 207 | 2006-05-28 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 208 | |||
| 209 | * window.c (struct saved_window): Add `dedicated'. | ||
| 210 | (Fset_window_configuration, save_window_save): Save/restore the | ||
| 211 | `dedicated' flag. | ||
| 212 | |||
| 213 | 2006-05-28 Kim F. Storm <storm@cua.dk> | ||
| 214 | |||
| 215 | * xdisp.c (set_cursor_from_row): If cursor cannot be set in row, | ||
| 216 | don't update w->cursor and return 0. Return 1 on success. | ||
| 217 | (try_cursor_movement): Repeat set_cursor_from_row on successive rows | ||
| 218 | until it succeeds. | ||
| 219 | |||
| 220 | * dispextern.h (set_cursor_from_row): Update prototype. | ||
| 221 | |||
| 222 | 2006-05-28 Kim F. Storm <storm@cua.dk> | ||
| 223 | |||
| 224 | * xdisp.c (get_phys_cursor_geometry): Return computed x and y through | ||
| 225 | parameters. Adjust x and width in case cursor in on a partially | ||
| 226 | visible stretch glyph on the left edge. | ||
| 227 | (erase_phys_cursor): Don't erase into left fringe/margin in case | ||
| 228 | previous cursor glyph is a partially visible stretch glyph on left. | ||
| 229 | |||
| 230 | * dispextern.h (get_phys_cursor_geometry): Update prototype. | ||
| 231 | |||
| 232 | * xterm.c (x_draw_stretch_glyph_string): Fix problems with invisible | ||
| 233 | cursor and erasing cursor on partially visible stretch glyph on left. | ||
| 234 | (x_draw_hollow_cursor): Compute x via get_phys_cursor_geometry. | ||
| 235 | |||
| 236 | * macterm.c: Likewise. | ||
| 237 | |||
| 238 | * w32term.c: Likewise. | ||
| 239 | |||
| 240 | 2006-05-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 241 | |||
| 242 | * macselect.c (mac_handle_apple_event): | ||
| 243 | Return errAEEventNotHandled if key binding is not found. | ||
| 244 | |||
| 245 | 2006-05-26 Eli Zaretskii <eliz@gnu.org> | ||
| 246 | |||
| 247 | * emacs.c (main) [PROFILING]: Enable also for __MINGW32__. | ||
| 248 | [__MINGW32__]: MinGW-specific declaration of `etext'. | ||
| 249 | |||
| 250 | * w32heap.c (etext, edata): Remove unused definitions. | ||
| 251 | |||
| 252 | 2006-05-26 Chong Yidong <cyd@stupidchicken.com> | ||
| 253 | |||
| 254 | * fileio.c (Fcopy_file): Delete argument MUSTBENEW. | ||
| 255 | Incorporate the exclusive file-opening functionality into the behavior | ||
| 256 | when OK-IF-ALREADY-EXISTS is nil. | ||
| 257 | (Frename_file): Call Fcopy_file without MUSTBENEW argument. | ||
| 258 | |||
| 259 | 2006-05-26 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 260 | |||
| 261 | * sound.c (alsa_configure): Move get period/buffer_size after | ||
| 262 | setting hwparams. | ||
| 263 | |||
| 264 | 2006-05-26 Kenichi Handa <handa@m17n.org> | ||
| 265 | |||
| 266 | * coding.c (Ffind_operation_coding_system): Allow (FILENAME | ||
| 267 | . BUFFER) in TARGET. | ||
| 268 | |||
| 269 | 2006-05-25 Chong Yidong <cyd@stupidchicken.com> | ||
| 270 | |||
| 271 | * image.c (png_load): Don't call fclose on NULL. | ||
| 272 | |||
| 273 | 2006-05-25 Luc Teirlinck <teirllm@auburn.edu> | ||
| 274 | |||
| 275 | * fns.c (Fyes_or_no_p): | ||
| 276 | * callint.c (Fcall_interactively): Fread_from_minibuffer now takes | ||
| 277 | only seven args. | ||
| 278 | |||
| 279 | 2006-05-25 Juri Linkov <juri@jurta.org> | ||
| 280 | |||
| 281 | * lisp.h (Fread_from_minibuffer): Decrement number of args. | ||
| 282 | |||
| 283 | * minibuf.c (read_minibuf): Remove arg KEEP_ALL. Callers changed. | ||
| 284 | (Fread_from_minibuffer): Remove arg KEEP_ALL. Callers changed. | ||
| 285 | |||
| 286 | * buffer.c (mode-line-format): Fix docstring. | ||
| 287 | |||
| 288 | 2006-05-25 Richard Stallman <rms@gnu.org> | ||
| 289 | |||
| 290 | * emacs.c (main, Fdump_emacs): Don't test __linux or __linux__. | ||
| 291 | |||
| 292 | 2006-05-24 Luc Teirlinck <teirllm@auburn.edu> | ||
| 293 | |||
| 294 | * puresize.h (BASE_PURESIZE): Increase to 1210000. | ||
| 295 | |||
| 296 | 2006-05-24 Alan Mackenzie <acm@muc.de> | ||
| 297 | |||
| 298 | * lread.c (Vload_history): Enhance doc-string to say that the file | ||
| 299 | is the absolute truename of the loaded file. | ||
| 300 | |||
| 301 | * lread.c (Vafter_load_alist): doc-string: state that an element | ||
| 302 | now has a regexp to match file names, not a file name as such. | ||
| 303 | |||
| 304 | * lread.c (readevalloop): Call file-truename on the name for | ||
| 305 | load-history, except at preloading time. | ||
| 306 | |||
| 307 | * lread.c (Fload): At preloading time, preserve the extension of | ||
| 308 | the filename which goes into load-history. New var hist_file_name. | ||
| 309 | |||
| 310 | * lread.c (Fload): Do eval-after-load stuff by calling the lisp | ||
| 311 | function do-after-load-evaluation. | ||
| 312 | |||
| 313 | 2006-05-24 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 314 | |||
| 315 | * mac.c (ae_attr_table): New variable. | ||
| 316 | (syms_of_mac): Intern and staticpro its elements. | ||
| 317 | (mac_aelist_to_lisp): Also convert Apple event attributes. | ||
| 318 | (mac_ae_put_lisp): New function. | ||
| 319 | (create_apple_event_from_event_ref) [MAC_OSX]: Use typeUTF8Text. | ||
| 320 | |||
| 321 | * macfns.c (Fx_server_version): Use gestaltSystemVersionMajor etc. | ||
| 322 | |||
| 323 | * macselect.c (Qemacs_suspension_id): New variable. | ||
| 324 | (syms_of_macselect): Intern and staticpro it. | ||
| 325 | (struct suspended_ae_info): New struct. | ||
| 326 | (deferred_apple_events, defer_apple_events) | ||
| 327 | (Fmac_process_deferred_apple_events): Use it. | ||
| 328 | (suspended_apple_events): New variable. | ||
| 329 | (mac_handle_apple_event_1): New function. | ||
| 330 | (mac_handle_apple_event): Use it. Don't process previously | ||
| 331 | suspended events. | ||
| 332 | (cleanup_suspended_apple_events, get_suspension_id) | ||
| 333 | (cleanup_all_suspended_apple_events): New functions. | ||
| 334 | (init_apple_event_handler): Call cleanup_all_suspended_apple_events | ||
| 335 | at exit. | ||
| 336 | (Fmac_cleanup_expired_apple_events, Fmac_ae_set_reply_parameter) | ||
| 337 | (Fmac_resume_apple_event): New defuns. | ||
| 338 | (syms_of_macselect): Defsubr them. | ||
| 339 | |||
| 340 | * macterm.c (fn_keycode_to_keycode_table, XTread_socket) [MAC_OSX]: | ||
| 341 | Fix last change. Don't map `fn' modifier if pressed with F1 ... F12. | ||
| 342 | |||
| 343 | * macterm.h (TYPE_FILE_NAME): Change from macro to enumerator. | ||
| 344 | (KEY_EMACS_SUSPENSION_ID_ATTR): New enumerator. | ||
| 345 | (keyReplyRequestedAttr) [MAC_OS_X_VERSION_MAX_ALLOWED < 1030]: Likewise. | ||
| 346 | (gestaltSystemVersionMajor, gestaltSystemVersionMinor) | ||
| 347 | (gestaltSystemVersionBugFix) [MAC_OS_X_VERSION_MAX_ALLOWED < 1040]: | ||
| 348 | Likewise. | ||
| 349 | (typeUTF8Text, kEventParamWindowMouseLocation) | ||
| 350 | [MAC_OSX && MAC_OS_X_VERSION_MAX_ALLOWED < 1020]: Likewise. | ||
| 351 | (x_get_focus_frame, mac_ae_put_lisp): Add externs. | ||
| 352 | |||
| 1 | 2006-05-23 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 353 | 2006-05-23 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 2 | 354 | ||
| 3 | * macterm.c (fn_keycode_to_xkeysym_table, convert_fn_keycode): Remove. | 355 | * macterm.c (fn_keycode_to_xkeysym_table, convert_fn_keycode): Remove. |
| @@ -13,11 +365,14 @@ | |||
| 13 | * xterm.c: Remove declarations already in xterm.h | 365 | * xterm.c: Remove declarations already in xterm.h |
| 14 | 366 | ||
| 15 | * xterm.h: Add extern declarations for x_clear_errors, | 367 | * xterm.h: Add extern declarations for x_clear_errors, |
| 16 | x_fully_uncatch_errors, x_catching_errors and | 368 | x_fully_uncatch_errors, x_catching_errors and |
| 17 | x_alloc_lighter_color_for_widget. Remove duplicated declarations. | 369 | x_alloc_lighter_color_for_widget. Remove duplicated declarations. |
| 18 | 370 | ||
| 19 | 2006-05-21 Richard Stallman <rms@gnu.org> | 371 | 2006-05-21 Richard Stallman <rms@gnu.org> |
| 20 | 372 | ||
| 373 | * xfaces.c (best_matching_font): Abort for best == NULL | ||
| 374 | before we start to use it. | ||
| 375 | |||
| 21 | * buffer.c (syms_of_buffer, Fmake_overlay): Doc fixes. | 376 | * buffer.c (syms_of_buffer, Fmake_overlay): Doc fixes. |
| 22 | 377 | ||
| 23 | 2006-05-20 Kim F. Storm <storm@cua.dk> | 378 | 2006-05-20 Kim F. Storm <storm@cua.dk> |
| @@ -90,7 +445,7 @@ | |||
| 90 | 445 | ||
| 91 | * xfaces.c (better_font_p): Any font beats no font. | 446 | * xfaces.c (better_font_p): Any font beats no font. |
| 92 | (best_matching_font): Simplify based on above change. | 447 | (best_matching_font): Simplify based on above change. |
| 93 | 448 | ||
| 94 | * buffer.c (Fprevious_overlay_change, Fnext_overlay_change): Doc fixes. | 449 | * buffer.c (Fprevious_overlay_change, Fnext_overlay_change): Doc fixes. |
| 95 | 450 | ||
| 96 | 2006-05-16 Kim F. Storm <storm@cua.dk> | 451 | 2006-05-16 Kim F. Storm <storm@cua.dk> |
| @@ -585,7 +940,7 @@ | |||
| 585 | 940 | ||
| 586 | * puresize.h (BASE_PURESIZE): Increment to 1210000. | 941 | * puresize.h (BASE_PURESIZE): Increment to 1210000. |
| 587 | 942 | ||
| 588 | 2006-04-13 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> (tiny change) | 943 | 2006-04-13 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> |
| 589 | 944 | ||
| 590 | * print.c (Fprin1_to_string): Mention in the `doc' that the | 945 | * print.c (Fprin1_to_string): Mention in the `doc' that the |
| 591 | behavior is modified by `print-level' and `print-length'. | 946 | behavior is modified by `print-level' and `print-length'. |
| @@ -706,7 +1061,7 @@ | |||
| 706 | * xfaces.c (Finternal_merge_in_global_face, try_font_list): | 1061 | * xfaces.c (Finternal_merge_in_global_face, try_font_list): |
| 707 | Add explicit braces to avoid ambiguous `else'. | 1062 | Add explicit braces to avoid ambiguous `else'. |
| 708 | 1063 | ||
| 709 | 2006-04-11 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> (tiny change) | 1064 | 2006-04-11 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> |
| 710 | 1065 | ||
| 711 | * dispnew.c (init_display): Don't init X display if the user asked | 1066 | * dispnew.c (init_display): Don't init X display if the user asked |
| 712 | for a non-X display. | 1067 | for a non-X display. |
| @@ -8577,7 +8932,7 @@ | |||
| 8577 | 8932 | ||
| 8578 | * xfns.c (xic_create_xfontset): Initialize missing_list to NULL. | 8933 | * xfns.c (xic_create_xfontset): Initialize missing_list to NULL. |
| 8579 | 8934 | ||
| 8580 | 2004-10-21 K,Ba(Broly L,Bu(Brentey <lorentey@elte.hu> | 8935 | 2004-10-21 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu> |
| 8581 | 8936 | ||
| 8582 | * xterm.h (x_output): New member `xic_base_fontname'. | 8937 | * xterm.h (x_output): New member `xic_base_fontname'. |
| 8583 | (FRAME_XIC_BASE_FONTNAME): New macro. | 8938 | (FRAME_XIC_BASE_FONTNAME): New macro. |
| @@ -9521,7 +9876,7 @@ | |||
| 9521 | * fileio.c (Fvisited_file_modtime): Return a list of two integers, | 9876 | * fileio.c (Fvisited_file_modtime): Return a list of two integers, |
| 9522 | instead of a cons. | 9877 | instead of a cons. |
| 9523 | 9878 | ||
| 9524 | 2004-07-14 K,Ba(Broly L,Bu(Brentey <lorentey@elte.hu> | 9879 | 2004-07-14 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu> |
| 9525 | 9880 | ||
| 9526 | * keyboard.c (echo_dash): Do nothing if there already is a dash | 9881 | * keyboard.c (echo_dash): Do nothing if there already is a dash |
| 9527 | at the end of the echo string. | 9882 | at the end of the echo string. |
| @@ -9858,7 +10213,7 @@ | |||
| 9858 | * keyboard.c (cmd_error): Don't call any_kboard_state | 10213 | * keyboard.c (cmd_error): Don't call any_kboard_state |
| 9859 | if inside a recursive edit level. | 10214 | if inside a recursive edit level. |
| 9860 | 10215 | ||
| 9861 | 2004-06-13 K,Ba(Broly L,Bu(Brentey <lorentey@elte.hu> | 10216 | 2004-06-13 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu> |
| 9862 | 10217 | ||
| 9863 | * keyboard.c (command_loop): Call any_kboard_state before | 10218 | * keyboard.c (command_loop): Call any_kboard_state before |
| 9864 | command_loop_2 when at top level. | 10219 | command_loop_2 when at top level. |
| @@ -10171,7 +10526,7 @@ | |||
| 10171 | before actually accepting connection in case it has already been | 10526 | before actually accepting connection in case it has already been |
| 10172 | accepted due to recursion. | 10527 | accepted due to recursion. |
| 10173 | 10528 | ||
| 10174 | 2004-05-23 K,Ba(Broly L,Bu(Brentey <lorentey@elte.hu> | 10529 | 2004-05-23 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu> |
| 10175 | 10530 | ||
| 10176 | * coding.c (Fset_safe_terminal_coding_system_internal): | 10531 | * coding.c (Fset_safe_terminal_coding_system_internal): |
| 10177 | Set suppress_error in safe_terminal_coding, not terminal_coding. | 10532 | Set suppress_error in safe_terminal_coding, not terminal_coding. |
diff --git a/src/buffer.c b/src/buffer.c index 3dff44a6b86..73db9d21419 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -5470,10 +5470,11 @@ A string is printed verbatim in the mode line except for %-constructs: | |||
| 5470 | %p -- print percent of buffer above top of window, or Top, Bot or All. | 5470 | %p -- print percent of buffer above top of window, or Top, Bot or All. |
| 5471 | %P -- print percent of buffer above bottom of window, perhaps plus Top, | 5471 | %P -- print percent of buffer above bottom of window, perhaps plus Top, |
| 5472 | or print Bottom or All. | 5472 | or print Bottom or All. |
| 5473 | %m -- print the mode name. | ||
| 5474 | %n -- print Narrow if appropriate. | 5473 | %n -- print Narrow if appropriate. |
| 5474 | %t -- visited file is text or binary (if OS supports this distinction). | ||
| 5475 | %z -- print mnemonics of buffer, terminal, and keyboard coding systems. | 5475 | %z -- print mnemonics of buffer, terminal, and keyboard coding systems. |
| 5476 | %Z -- like %z, but including the end-of-line format. | 5476 | %Z -- like %z, but including the end-of-line format. |
| 5477 | %e -- print error message about full memory. | ||
| 5477 | %[ -- print one [ for each recursive editing level. %] similar. | 5478 | %[ -- print one [ for each recursive editing level. %] similar. |
| 5478 | %% -- print %. %- -- print infinitely many dashes. | 5479 | %% -- print %. %- -- print infinitely many dashes. |
| 5479 | Decimal digits after the % specify field width to which to pad. */); | 5480 | Decimal digits after the % specify field width to which to pad. */); |
diff --git a/src/callint.c b/src/callint.c index c54b03394c0..2411617917f 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -730,7 +730,7 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */) | |||
| 730 | 730 | ||
| 731 | tem = Fread_from_minibuffer (build_string (callint_message), | 731 | tem = Fread_from_minibuffer (build_string (callint_message), |
| 732 | Qnil, Qnil, Qnil, Qnil, Qnil, | 732 | Qnil, Qnil, Qnil, Qnil, Qnil, |
| 733 | Qnil, Qnil); | 733 | Qnil); |
| 734 | if (! STRINGP (tem) || SCHARS (tem) == 0) | 734 | if (! STRINGP (tem) || SCHARS (tem) == 0) |
| 735 | args[i] = Qnil; | 735 | args[i] = Qnil; |
| 736 | else | 736 | else |
diff --git a/src/charset.h b/src/charset.h index 0d61aa054c0..b7ab4cb8b53 100644 --- a/src/charset.h +++ b/src/charset.h | |||
| @@ -825,7 +825,7 @@ while (0) | |||
| 825 | /* This is the maximum byte length of multi-byte sequence. */ | 825 | /* This is the maximum byte length of multi-byte sequence. */ |
| 826 | #define MAX_MULTIBYTE_LENGTH 4 | 826 | #define MAX_MULTIBYTE_LENGTH 4 |
| 827 | 827 | ||
| 828 | extern void invalid_character P_ ((int)); | 828 | extern void invalid_character P_ ((int)) NO_RETURN; |
| 829 | 829 | ||
| 830 | extern int translate_char P_ ((Lisp_Object, int, int, int, int)); | 830 | extern int translate_char P_ ((Lisp_Object, int, int, int, int)); |
| 831 | extern int split_string P_ ((const unsigned char *, int, int *, | 831 | extern int split_string P_ ((const unsigned char *, int, int *, |
diff --git a/src/coding.c b/src/coding.c index 659b52b93fb..e35cb5ddc09 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -7465,7 +7465,7 @@ is selected as the TARGET. For example, if OPERATION does file I/O, | |||
| 7465 | whichever argument specifies the file name is TARGET. | 7465 | whichever argument specifies the file name is TARGET. |
| 7466 | 7466 | ||
| 7467 | TARGET has a meaning which depends on OPERATION: | 7467 | TARGET has a meaning which depends on OPERATION: |
| 7468 | For file I/O, TARGET is a file name. | 7468 | For file I/O, TARGET is a file name (except for the special case below). |
| 7469 | For process I/O, TARGET is a process name. | 7469 | For process I/O, TARGET is a process name. |
| 7470 | For network I/O, TARGET is a service name or a port number | 7470 | For network I/O, TARGET is a service name or a port number |
| 7471 | 7471 | ||
| @@ -7477,6 +7477,13 @@ or a function symbol to call. | |||
| 7477 | In the last case, we call the function with one argument, | 7477 | In the last case, we call the function with one argument, |
| 7478 | which is a list of all the arguments given to this function. | 7478 | which is a list of all the arguments given to this function. |
| 7479 | 7479 | ||
| 7480 | If OPERATION is `insert-file-contents', the argument corresponding to | ||
| 7481 | TARGET may be a cons (FILENAME . BUFFER). In that case, FILENAME is a | ||
| 7482 | file name to look up, and BUFFER is a buffer that contains the file's | ||
| 7483 | contents (not yet decoded). If `file-coding-system-alist' specifies a | ||
| 7484 | function to call for FILENAME, that function should examine the | ||
| 7485 | contents of BUFFER instead of reading the file. | ||
| 7486 | |||
| 7480 | usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) | 7487 | usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) |
| 7481 | (nargs, args) | 7488 | (nargs, args) |
| 7482 | int nargs; | 7489 | int nargs; |
| @@ -7503,8 +7510,12 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) | |||
| 7503 | target_idx = make_number (4); | 7510 | target_idx = make_number (4); |
| 7504 | target = args[XINT (target_idx) + 1]; | 7511 | target = args[XINT (target_idx) + 1]; |
| 7505 | if (!(STRINGP (target) | 7512 | if (!(STRINGP (target) |
| 7513 | || (EQ (operation, Qinsert_file_contents) && CONSP (target) | ||
| 7514 | && STRINGP (XCAR (target)) && BUFFERP (XCDR (target))) | ||
| 7506 | || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) | 7515 | || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) |
| 7507 | error ("Invalid argument %d", XINT (target_idx) + 1); | 7516 | error ("Invalid argument %d", XINT (target_idx) + 1); |
| 7517 | if (CONSP (target)) | ||
| 7518 | target = XCAR (target); | ||
| 7508 | 7519 | ||
| 7509 | chain = ((EQ (operation, Qinsert_file_contents) | 7520 | chain = ((EQ (operation, Qinsert_file_contents) |
| 7510 | || EQ (operation, Qwrite_region)) | 7521 | || EQ (operation, Qwrite_region)) |
| @@ -7537,7 +7548,7 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) | |||
| 7537 | return Fcons (val, val); | 7548 | return Fcons (val, val); |
| 7538 | if (! NILP (Ffboundp (val))) | 7549 | if (! NILP (Ffboundp (val))) |
| 7539 | { | 7550 | { |
| 7540 | val = call1 (val, Flist (nargs, args)); | 7551 | val = safe_call1 (val, Flist (nargs, args)); |
| 7541 | if (CONSP (val)) | 7552 | if (CONSP (val)) |
| 7542 | return val; | 7553 | return val; |
| 7543 | if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val))) | 7554 | if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val))) |
diff --git a/src/dispextern.h b/src/dispextern.h index c836bc751d0..ed91d2df76e 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2623,8 +2623,8 @@ void remember_mouse_glyph P_ ((struct frame *, int, int, NativeRectangle *)); | |||
| 2623 | 2623 | ||
| 2624 | void mark_window_display_accurate P_ ((Lisp_Object, int)); | 2624 | void mark_window_display_accurate P_ ((Lisp_Object, int)); |
| 2625 | void redisplay_preserve_echo_area P_ ((int)); | 2625 | void redisplay_preserve_echo_area P_ ((int)); |
| 2626 | void set_cursor_from_row P_ ((struct window *, struct glyph_row *, | 2626 | int set_cursor_from_row P_ ((struct window *, struct glyph_row *, |
| 2627 | struct glyph_matrix *, int, int, int, int)); | 2627 | struct glyph_matrix *, int, int, int, int)); |
| 2628 | void init_iterator P_ ((struct it *, struct window *, int, | 2628 | void init_iterator P_ ((struct it *, struct window *, int, |
| 2629 | int, struct glyph_row *, enum face_id)); | 2629 | int, struct glyph_row *, enum face_id)); |
| 2630 | void init_iterator_to_row_start P_ ((struct it *, struct window *, | 2630 | void init_iterator_to_row_start P_ ((struct it *, struct window *, |
| @@ -2682,8 +2682,8 @@ extern void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *, | |||
| 2682 | extern void draw_phys_cursor_glyph P_ ((struct window *, | 2682 | extern void draw_phys_cursor_glyph P_ ((struct window *, |
| 2683 | struct glyph_row *, | 2683 | struct glyph_row *, |
| 2684 | enum draw_glyphs_face)); | 2684 | enum draw_glyphs_face)); |
| 2685 | extern int get_phys_cursor_geometry P_ ((struct window *, struct glyph_row *, | 2685 | extern void get_phys_cursor_geometry P_ ((struct window *, struct glyph_row *, |
| 2686 | struct glyph *, int *)); | 2686 | struct glyph *, int *, int *, int *)); |
| 2687 | extern void erase_phys_cursor P_ ((struct window *)); | 2687 | extern void erase_phys_cursor P_ ((struct window *)); |
| 2688 | extern void display_and_set_cursor P_ ((struct window *, | 2688 | extern void display_and_set_cursor P_ ((struct window *, |
| 2689 | int, int, int, int, int)); | 2689 | int, int, int, int, int)); |
diff --git a/src/dispnew.c b/src/dispnew.c index a3ac89e05d5..c346e94a103 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -342,8 +342,7 @@ static unsigned history_tick; | |||
| 342 | 342 | ||
| 343 | static void add_frame_display_history P_ ((struct frame *, int)); | 343 | static void add_frame_display_history P_ ((struct frame *, int)); |
| 344 | static void add_window_display_history P_ ((struct window *, char *, int)); | 344 | static void add_window_display_history P_ ((struct window *, char *, int)); |
| 345 | 345 | ||
| 346 | |||
| 347 | /* Add to the redisplay history how window W has been displayed. | 346 | /* Add to the redisplay history how window W has been displayed. |
| 348 | MSG is a trace containing the information how W's glyph matrix | 347 | MSG is a trace containing the information how W's glyph matrix |
| 349 | has been constructed. PAUSED_P non-zero means that the update | 348 | has been constructed. PAUSED_P non-zero means that the update |
| @@ -6437,7 +6436,9 @@ sit_for (sec, usec, reading, display, initial_display) | |||
| 6437 | { | 6436 | { |
| 6438 | swallow_events (display); | 6437 | swallow_events (display); |
| 6439 | 6438 | ||
| 6440 | if (detect_input_pending_run_timers (display) || !NILP (Vexecuting_kbd_macro)) | 6439 | if ((detect_input_pending_run_timers (display) |
| 6440 | && !redisplay_dont_pause) | ||
| 6441 | || !NILP (Vexecuting_kbd_macro)) | ||
| 6441 | return Qnil; | 6442 | return Qnil; |
| 6442 | 6443 | ||
| 6443 | if (initial_display) | 6444 | if (initial_display) |
| @@ -6467,6 +6468,9 @@ Redisplay is preempted as always if input arrives, and does not happen | |||
| 6467 | if input is available before it starts. | 6468 | if input is available before it starts. |
| 6468 | Value is t if waited the full time with no input arriving. | 6469 | Value is t if waited the full time with no input arriving. |
| 6469 | 6470 | ||
| 6471 | Redisplay will occur even when input is available if you bind | ||
| 6472 | `redisplay-dont-pause' to a non-nil value. | ||
| 6473 | |||
| 6470 | An obsolete but still supported form is | 6474 | An obsolete but still supported form is |
| 6471 | \(sit-for SECONDS &optional MILLISECONDS NODISP) | 6475 | \(sit-for SECONDS &optional MILLISECONDS NODISP) |
| 6472 | Where the optional arg MILLISECONDS specifies an additional wait period, | 6476 | Where the optional arg MILLISECONDS specifies an additional wait period, |
diff --git a/src/emacs.c b/src/emacs.c index ac6bf57c2cd..530f008270c 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1753,16 +1753,21 @@ main (argc, argv | |||
| 1753 | #endif | 1753 | #endif |
| 1754 | } | 1754 | } |
| 1755 | 1755 | ||
| 1756 | /* Set up for profiling. This is known to work on FreeBSD and | 1756 | /* Set up for profiling. This is known to work on FreeBSD, |
| 1757 | GNU/Linux. It might work on some other systems too. Give it a | 1757 | GNU/Linux and MinGW. It might work on some other systems too. |
| 1758 | try and tell us if it works on your system. To compile for | 1758 | Give it a try and tell us if it works on your system. To compile |
| 1759 | profiling use something like `make CFLAGS="-pg -g -O -DPROFILING=1'. */ | 1759 | for profiling use something like: |
| 1760 | #if defined (__FreeBSD__) || defined (__linux) | 1760 | `make CFLAGS="-pg -g -O -DPROFILING=1'. */ |
| 1761 | #if defined (__FreeBSD__) || defined (GNU_LINUX) || defined(__MINGW32__) | ||
| 1761 | #ifdef PROFILING | 1762 | #ifdef PROFILING |
| 1762 | if (initialized) | 1763 | if (initialized) |
| 1763 | { | 1764 | { |
| 1764 | extern void _mcleanup (); | 1765 | extern void _mcleanup (); |
| 1766 | #ifdef __MINGW32__ | ||
| 1767 | extern unsigned char etext asm ("etext"); | ||
| 1768 | #else | ||
| 1765 | extern char etext; | 1769 | extern char etext; |
| 1770 | #endif | ||
| 1766 | extern void safe_bcopy (); | 1771 | extern void safe_bcopy (); |
| 1767 | extern void dump_opcode_frequencies (); | 1772 | extern void dump_opcode_frequencies (); |
| 1768 | 1773 | ||
| @@ -2235,7 +2240,7 @@ You must run Emacs in batch mode in order to dump it. */) | |||
| 2235 | if (! noninteractive) | 2240 | if (! noninteractive) |
| 2236 | error ("Dumping Emacs works only in batch mode"); | 2241 | error ("Dumping Emacs works only in batch mode"); |
| 2237 | 2242 | ||
| 2238 | #ifdef __linux__ | 2243 | #ifdef GNU_LINUX |
| 2239 | if (heap_bss_diff > MAX_HEAP_BSS_DIFF) | 2244 | if (heap_bss_diff > MAX_HEAP_BSS_DIFF) |
| 2240 | { | 2245 | { |
| 2241 | fprintf (stderr, "**************************************************\n"); | 2246 | fprintf (stderr, "**************************************************\n"); |
| @@ -2247,7 +2252,7 @@ You must run Emacs in batch mode in order to dump it. */) | |||
| 2247 | fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n"); | 2252 | fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n"); |
| 2248 | fprintf (stderr, "**************************************************\n"); | 2253 | fprintf (stderr, "**************************************************\n"); |
| 2249 | } | 2254 | } |
| 2250 | #endif /* __linux__ */ | 2255 | #endif /* GNU_LINUX */ |
| 2251 | 2256 | ||
| 2252 | /* Bind `command-line-processed' to nil before dumping, | 2257 | /* Bind `command-line-processed' to nil before dumping, |
| 2253 | so that the dumped Emacs will process its command line | 2258 | so that the dumped Emacs will process its command line |
diff --git a/src/fileio.c b/src/fileio.c index 842ca8f6b61..b2940d46e9e 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2406,32 +2406,31 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick) | |||
| 2406 | return; | 2406 | return; |
| 2407 | } | 2407 | } |
| 2408 | 2408 | ||
| 2409 | DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6, | 2409 | DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 5, |
| 2410 | "fCopy file: \nGCopy %s to file: \np\nP", | 2410 | "fCopy file: \nGCopy %s to file: \np\nP", |
| 2411 | doc: /* Copy FILE to NEWNAME. Both args must be strings. | 2411 | doc: /* Copy FILE to NEWNAME. Both args must be strings. |
| 2412 | If NEWNAME names a directory, copy FILE there. | 2412 | If NEWNAME names a directory, copy FILE there. |
| 2413 | Signals a `file-already-exists' error if file NEWNAME already exists, | 2413 | |
| 2414 | unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil. | 2414 | This function always sets the file modes of the output file to match |
| 2415 | A number as third arg means request confirmation if NEWNAME already exists. | 2415 | the input file. |
| 2416 | This is what happens in interactive use with M-x. | 2416 | |
| 2417 | Always sets the file modes of the output file to match the input file. | 2417 | The optional third argument OK-IF-ALREADY-EXISTS specifies what to do |
| 2418 | if file NEWNAME already exists. If OK-IF-ALREADY-EXISTS is nil, we | ||
| 2419 | signal a `file-already-exists' error without overwriting. If | ||
| 2420 | OK-IF-ALREADY-EXISTS is a number, we request confirmation from the user | ||
| 2421 | about overwriting; this is what happens in interactive use with M-x. | ||
| 2422 | Any other value for OK-IF-ALREADY-EXISTS means to overwrite the | ||
| 2423 | existing file. | ||
| 2418 | 2424 | ||
| 2419 | Fourth arg KEEP-TIME non-nil means give the output file the same | 2425 | Fourth arg KEEP-TIME non-nil means give the output file the same |
| 2420 | last-modified time as the old one. (This works on only some systems.) | 2426 | last-modified time as the old one. (This works on only some systems.) |
| 2421 | 2427 | ||
| 2422 | A prefix arg makes KEEP-TIME non-nil. | 2428 | A prefix arg makes KEEP-TIME non-nil. |
| 2423 | 2429 | ||
| 2424 | The optional fifth arg MUSTBENEW, if non-nil, insists on a check | ||
| 2425 | for an existing file with the same name. If MUSTBENEW is `excl', | ||
| 2426 | that means to get an error if the file already exists; never overwrite. | ||
| 2427 | If MUSTBENEW is neither nil nor `excl', that means ask for | ||
| 2428 | confirmation before overwriting, but do go ahead and overwrite the file | ||
| 2429 | if the user confirms. | ||
| 2430 | |||
| 2431 | If PRESERVE-UID-GID is non-nil, we try to transfer the | 2430 | If PRESERVE-UID-GID is non-nil, we try to transfer the |
| 2432 | uid and gid of FILE to NEWNAME. */) | 2431 | uid and gid of FILE to NEWNAME. */) |
| 2433 | (file, newname, ok_if_already_exists, keep_time, mustbenew, preserve_uid_gid) | 2432 | (file, newname, ok_if_already_exists, keep_time, preserve_uid_gid) |
| 2434 | Lisp_Object file, newname, ok_if_already_exists, keep_time, mustbenew; | 2433 | Lisp_Object file, newname, ok_if_already_exists, keep_time; |
| 2435 | Lisp_Object preserve_uid_gid; | 2434 | Lisp_Object preserve_uid_gid; |
| 2436 | { | 2435 | { |
| 2437 | int ifd, ofd, n; | 2436 | int ifd, ofd, n; |
| @@ -2448,9 +2447,6 @@ uid and gid of FILE to NEWNAME. */) | |||
| 2448 | CHECK_STRING (file); | 2447 | CHECK_STRING (file); |
| 2449 | CHECK_STRING (newname); | 2448 | CHECK_STRING (newname); |
| 2450 | 2449 | ||
| 2451 | if (!NILP (mustbenew) && !EQ (mustbenew, Qexcl)) | ||
| 2452 | barf_or_query_if_file_exists (newname, "overwrite", 1, 0, 1); | ||
| 2453 | |||
| 2454 | if (!NILP (Ffile_directory_p (newname))) | 2450 | if (!NILP (Ffile_directory_p (newname))) |
| 2455 | newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname); | 2451 | newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname); |
| 2456 | else | 2452 | else |
| @@ -2553,12 +2549,12 @@ uid and gid of FILE to NEWNAME. */) | |||
| 2553 | /* System's default file type was set to binary by _fmode in emacs.c. */ | 2549 | /* System's default file type was set to binary by _fmode in emacs.c. */ |
| 2554 | ofd = emacs_open (SDATA (encoded_newname), | 2550 | ofd = emacs_open (SDATA (encoded_newname), |
| 2555 | O_WRONLY | O_TRUNC | O_CREAT | 2551 | O_WRONLY | O_TRUNC | O_CREAT |
| 2556 | | (EQ (mustbenew, Qexcl) ? O_EXCL : 0), | 2552 | | (NILP (ok_if_already_exists) ? O_EXCL : 0), |
| 2557 | S_IREAD | S_IWRITE); | 2553 | S_IREAD | S_IWRITE); |
| 2558 | #else /* not MSDOS */ | 2554 | #else /* not MSDOS */ |
| 2559 | ofd = emacs_open (SDATA (encoded_newname), | 2555 | ofd = emacs_open (SDATA (encoded_newname), |
| 2560 | O_WRONLY | O_TRUNC | O_CREAT | 2556 | O_WRONLY | O_TRUNC | O_CREAT |
| 2561 | | (EQ (mustbenew, Qexcl) ? O_EXCL : 0), | 2557 | | (NILP (ok_if_already_exists) ? O_EXCL : 0), |
| 2562 | 0666); | 2558 | 0666); |
| 2563 | #endif /* not MSDOS */ | 2559 | #endif /* not MSDOS */ |
| 2564 | #endif /* VMS */ | 2560 | #endif /* VMS */ |
| @@ -2803,7 +2799,7 @@ This is what happens in interactive use with M-x. */) | |||
| 2803 | /* We have already prompted if it was an integer, | 2799 | /* We have already prompted if it was an integer, |
| 2804 | so don't have copy-file prompt again. */ | 2800 | so don't have copy-file prompt again. */ |
| 2805 | NILP (ok_if_already_exists) ? Qnil : Qt, | 2801 | NILP (ok_if_already_exists) ? Qnil : Qt, |
| 2806 | Qt, Qnil, Qt); | 2802 | Qt, Qt); |
| 2807 | 2803 | ||
| 2808 | Fdelete_file (file); | 2804 | Fdelete_file (file); |
| 2809 | } | 2805 | } |
| @@ -3433,7 +3433,7 @@ is nil, and `use-dialog-box' is non-nil. */) | |||
| 3433 | { | 3433 | { |
| 3434 | ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, | 3434 | ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, |
| 3435 | Qyes_or_no_p_history, Qnil, | 3435 | Qyes_or_no_p_history, Qnil, |
| 3436 | Qnil, Qnil)); | 3436 | Qnil)); |
| 3437 | if (SCHARS (ans) == 3 && !strcmp (SDATA (ans), "yes")) | 3437 | if (SCHARS (ans) == 3 && !strcmp (SDATA (ans), "yes")) |
| 3438 | { | 3438 | { |
| 3439 | UNGCPRO; | 3439 | UNGCPRO; |
diff --git a/src/gtkutil.c b/src/gtkutil.c index ec886b52faf..f4a2b4d3f52 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -1970,6 +1970,34 @@ xg_create_one_menuitem (item, f, select_cb, highlight_cb, cl_data, group) | |||
| 1970 | return w; | 1970 | return w; |
| 1971 | } | 1971 | } |
| 1972 | 1972 | ||
| 1973 | /* Callback called when keyboard traversal (started by menu-bar-open) ends. | ||
| 1974 | WMENU is the menu for which traversal has been done. DATA points to the | ||
| 1975 | frame for WMENU. We must release grabs, some bad interaction between GTK | ||
| 1976 | and Emacs makes the menus keep the grabs. */ | ||
| 1977 | |||
| 1978 | static void | ||
| 1979 | menu_nav_ended (wmenu, data) | ||
| 1980 | GtkMenuShell *wmenu; | ||
| 1981 | gpointer data; | ||
| 1982 | { | ||
| 1983 | FRAME_PTR f = (FRAME_PTR) data; | ||
| 1984 | |||
| 1985 | if (FRAME_X_OUTPUT (f)->menubar_widget) | ||
| 1986 | { | ||
| 1987 | GtkMenuShell *w = GTK_MENU_SHELL (FRAME_X_OUTPUT (f)->menubar_widget); | ||
| 1988 | Display *dpy = FRAME_X_DISPLAY (f); | ||
| 1989 | |||
| 1990 | BLOCK_INPUT; | ||
| 1991 | gtk_menu_shell_deactivate (w); | ||
| 1992 | gtk_menu_shell_deselect (w); | ||
| 1993 | |||
| 1994 | XUngrabKeyboard (dpy, CurrentTime); | ||
| 1995 | XUngrabPointer (dpy, CurrentTime); | ||
| 1996 | UNBLOCK_INPUT; | ||
| 1997 | } | ||
| 1998 | } | ||
| 1999 | |||
| 2000 | |||
| 1973 | static GtkWidget *create_menus P_ ((widget_value *, FRAME_PTR, GCallback, | 2001 | static GtkWidget *create_menus P_ ((widget_value *, FRAME_PTR, GCallback, |
| 1974 | GCallback, GCallback, int, int, int, | 2002 | GCallback, GCallback, int, int, int, |
| 1975 | GtkWidget *, xg_menu_cb_data *, char *)); | 2003 | GtkWidget *, xg_menu_cb_data *, char *)); |
| @@ -2024,6 +2052,12 @@ create_menus (data, f, select_cb, deactivate_cb, highlight_cb, | |||
| 2024 | } | 2052 | } |
| 2025 | else wmenu = gtk_menu_bar_new (); | 2053 | else wmenu = gtk_menu_bar_new (); |
| 2026 | 2054 | ||
| 2055 | /* Fix up grabs after keyboard traversal ends. */ | ||
| 2056 | g_signal_connect (G_OBJECT (wmenu), | ||
| 2057 | "selection-done", | ||
| 2058 | G_CALLBACK (menu_nav_ended), | ||
| 2059 | f); | ||
| 2060 | |||
| 2027 | /* Put cl_data on the top menu for easier access. */ | 2061 | /* Put cl_data on the top menu for easier access. */ |
| 2028 | cl_data = make_cl_data (cl_data, f, highlight_cb); | 2062 | cl_data = make_cl_data (cl_data, f, highlight_cb); |
| 2029 | g_object_set_data (G_OBJECT (wmenu), XG_FRAME_DATA, (gpointer)cl_data); | 2063 | g_object_set_data (G_OBJECT (wmenu), XG_FRAME_DATA, (gpointer)cl_data); |
diff --git a/src/image.c b/src/image.c index b8a640a9391..490ede60e35 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -6106,7 +6106,6 @@ png_load (f, img) | |||
| 6106 | { | 6106 | { |
| 6107 | image_error ("Cannot open image file `%s'", file, Qnil); | 6107 | image_error ("Cannot open image file `%s'", file, Qnil); |
| 6108 | UNGCPRO; | 6108 | UNGCPRO; |
| 6109 | fclose (fp); | ||
| 6110 | return 0; | 6109 | return 0; |
| 6111 | } | 6110 | } |
| 6112 | 6111 | ||
diff --git a/src/lisp.h b/src/lisp.h index 0df41a0d1f4..1a9e11b54dd 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -80,7 +80,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 80 | 80 | ||
| 81 | /* Extra internal type checking? */ | 81 | /* Extra internal type checking? */ |
| 82 | extern int suppress_checking; | 82 | extern int suppress_checking; |
| 83 | extern void die P_((const char *, const char *, int)); | 83 | extern void die P_((const char *, const char *, int)) NO_RETURN; |
| 84 | 84 | ||
| 85 | #ifdef ENABLE_CHECKING | 85 | #ifdef ENABLE_CHECKING |
| 86 | 86 | ||
| @@ -2780,7 +2780,7 @@ extern void set_time_zone_rule P_ ((char *)); | |||
| 2780 | 2780 | ||
| 2781 | /* defined in buffer.c */ | 2781 | /* defined in buffer.c */ |
| 2782 | extern int mouse_face_overlay_overlaps P_ ((Lisp_Object)); | 2782 | extern int mouse_face_overlay_overlaps P_ ((Lisp_Object)); |
| 2783 | extern void nsberror P_ ((Lisp_Object)); | 2783 | extern void nsberror P_ ((Lisp_Object)) NO_RETURN; |
| 2784 | extern char *no_switch_window P_ ((Lisp_Object window)); | 2784 | extern char *no_switch_window P_ ((Lisp_Object window)); |
| 2785 | EXFUN (Fset_buffer_multibyte, 1); | 2785 | EXFUN (Fset_buffer_multibyte, 1); |
| 2786 | EXFUN (Foverlay_start, 1); | 2786 | EXFUN (Foverlay_start, 1); |
| @@ -2899,7 +2899,7 @@ extern void syms_of_search P_ ((void)); | |||
| 2899 | extern Lisp_Object last_minibuf_string; | 2899 | extern Lisp_Object last_minibuf_string; |
| 2900 | extern void choose_minibuf_frame P_ ((void)); | 2900 | extern void choose_minibuf_frame P_ ((void)); |
| 2901 | EXFUN (Fcompleting_read, 8); | 2901 | EXFUN (Fcompleting_read, 8); |
| 2902 | EXFUN (Fread_from_minibuffer, 8); | 2902 | EXFUN (Fread_from_minibuffer, 7); |
| 2903 | EXFUN (Fread_variable, 2); | 2903 | EXFUN (Fread_variable, 2); |
| 2904 | EXFUN (Fread_buffer, 3); | 2904 | EXFUN (Fread_buffer, 3); |
| 2905 | EXFUN (Fread_minibuffer, 2); | 2905 | EXFUN (Fread_minibuffer, 2); |
diff --git a/src/lread.c b/src/lread.c index 8d0d6b098c0..797ae1078fb 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -89,6 +89,7 @@ Lisp_Object Qascii_character, Qload, Qload_file_name; | |||
| 89 | Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction; | 89 | Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction; |
| 90 | Lisp_Object Qinhibit_file_name_operation; | 90 | Lisp_Object Qinhibit_file_name_operation; |
| 91 | Lisp_Object Qeval_buffer_list, Veval_buffer_list; | 91 | Lisp_Object Qeval_buffer_list, Veval_buffer_list; |
| 92 | Lisp_Object Qfile_truename, Qdo_after_load_evaluation; /* ACM 2006/5/16 */ | ||
| 92 | 93 | ||
| 93 | extern Lisp_Object Qevent_symbol_element_mask; | 94 | extern Lisp_Object Qevent_symbol_element_mask; |
| 94 | extern Lisp_Object Qfile_exists_p; | 95 | extern Lisp_Object Qfile_exists_p; |
| @@ -720,8 +721,8 @@ Return t if the file exists and loads successfully. */) | |||
| 720 | register int fd = -1; | 721 | register int fd = -1; |
| 721 | int count = SPECPDL_INDEX (); | 722 | int count = SPECPDL_INDEX (); |
| 722 | Lisp_Object temp; | 723 | Lisp_Object temp; |
| 723 | struct gcpro gcpro1, gcpro2; | 724 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 724 | Lisp_Object found, efound; | 725 | Lisp_Object found, efound, hist_file_name; |
| 725 | /* 1 means we printed the ".el is newer" message. */ | 726 | /* 1 means we printed the ".el is newer" message. */ |
| 726 | int newer = 0; | 727 | int newer = 0; |
| 727 | /* 1 means we are loading a compiled file. */ | 728 | /* 1 means we are loading a compiled file. */ |
| @@ -729,6 +730,7 @@ Return t if the file exists and loads successfully. */) | |||
| 729 | Lisp_Object handler; | 730 | Lisp_Object handler; |
| 730 | int safe_p = 1; | 731 | int safe_p = 1; |
| 731 | char *fmode = "r"; | 732 | char *fmode = "r"; |
| 733 | Lisp_Object tmp[2]; | ||
| 732 | #ifdef DOS_NT | 734 | #ifdef DOS_NT |
| 733 | fmode = "rt"; | 735 | fmode = "rt"; |
| 734 | #endif /* DOS_NT */ | 736 | #endif /* DOS_NT */ |
| @@ -745,7 +747,7 @@ Return t if the file exists and loads successfully. */) | |||
| 745 | the need to gcpro noerror, nomessage and nosuffix. | 747 | the need to gcpro noerror, nomessage and nosuffix. |
| 746 | (Below here, we care only whether they are nil or not.) | 748 | (Below here, we care only whether they are nil or not.) |
| 747 | The presence of this call is the result of a historical accident: | 749 | The presence of this call is the result of a historical accident: |
| 748 | it used to be in every file-operations and when it got removed | 750 | it used to be in every file-operation and when it got removed |
| 749 | everywhere, it accidentally stayed here. Since then, enough people | 751 | everywhere, it accidentally stayed here. Since then, enough people |
| 750 | supposedly have things like (load "$PROJECT/foo.el") in their .emacs | 752 | supposedly have things like (load "$PROJECT/foo.el") in their .emacs |
| 751 | that it seemed risky to remove. */ | 753 | that it seemed risky to remove. */ |
| @@ -765,7 +767,6 @@ Return t if the file exists and loads successfully. */) | |||
| 765 | if (SCHARS (file) > 0) | 767 | if (SCHARS (file) > 0) |
| 766 | { | 768 | { |
| 767 | int size = SBYTES (file); | 769 | int size = SBYTES (file); |
| 768 | Lisp_Object tmp[2]; | ||
| 769 | 770 | ||
| 770 | found = Qnil; | 771 | found = Qnil; |
| 771 | GCPRO2 (file, found); | 772 | GCPRO2 (file, found); |
| @@ -849,6 +850,13 @@ Return t if the file exists and loads successfully. */) | |||
| 849 | Vloads_in_progress = Fcons (found, Vloads_in_progress); | 850 | Vloads_in_progress = Fcons (found, Vloads_in_progress); |
| 850 | } | 851 | } |
| 851 | 852 | ||
| 853 | /* Get the name for load-history. */ | ||
| 854 | hist_file_name = (! NILP (Vpurify_flag) | ||
| 855 | ? Fconcat (2, (tmp[0] = Ffile_name_directory (file), | ||
| 856 | tmp[1] = Ffile_name_nondirectory (found), | ||
| 857 | tmp)) | ||
| 858 | : found) ; | ||
| 859 | |||
| 852 | if (!bcmp (SDATA (found) + SBYTES (found) - 4, | 860 | if (!bcmp (SDATA (found) + SBYTES (found) - 4, |
| 853 | ".elc", 4)) | 861 | ".elc", 4)) |
| 854 | /* Load .elc files directly, but not when they are | 862 | /* Load .elc files directly, but not when they are |
| @@ -859,7 +867,7 @@ Return t if the file exists and loads successfully. */) | |||
| 859 | struct stat s1, s2; | 867 | struct stat s1, s2; |
| 860 | int result; | 868 | int result; |
| 861 | 869 | ||
| 862 | GCPRO2 (file, found); | 870 | GCPRO3 (file, found, hist_file_name); |
| 863 | 871 | ||
| 864 | if (!safe_to_load_p (fd)) | 872 | if (!safe_to_load_p (fd)) |
| 865 | { | 873 | { |
| @@ -913,14 +921,14 @@ Return t if the file exists and loads successfully. */) | |||
| 913 | 921 | ||
| 914 | if (fd >= 0) | 922 | if (fd >= 0) |
| 915 | emacs_close (fd); | 923 | emacs_close (fd); |
| 916 | val = call4 (Vload_source_file_function, found, file, | 924 | val = call4 (Vload_source_file_function, found, hist_file_name, |
| 917 | NILP (noerror) ? Qnil : Qt, | 925 | NILP (noerror) ? Qnil : Qt, |
| 918 | NILP (nomessage) ? Qnil : Qt); | 926 | NILP (nomessage) ? Qnil : Qt); |
| 919 | return unbind_to (count, val); | 927 | return unbind_to (count, val); |
| 920 | } | 928 | } |
| 921 | } | 929 | } |
| 922 | 930 | ||
| 923 | GCPRO2 (file, found); | 931 | GCPRO3 (file, found, hist_file_name); |
| 924 | 932 | ||
| 925 | #ifdef WINDOWSNT | 933 | #ifdef WINDOWSNT |
| 926 | emacs_close (fd); | 934 | emacs_close (fd); |
| @@ -959,14 +967,15 @@ Return t if the file exists and loads successfully. */) | |||
| 959 | load_descriptor_list | 967 | load_descriptor_list |
| 960 | = Fcons (make_number (fileno (stream)), load_descriptor_list); | 968 | = Fcons (make_number (fileno (stream)), load_descriptor_list); |
| 961 | load_in_progress++; | 969 | load_in_progress++; |
| 962 | readevalloop (Qget_file_char, stream, (! NILP (Vpurify_flag) ? file : found), | 970 | readevalloop (Qget_file_char, stream, hist_file_name, |
| 963 | Feval, 0, Qnil, Qnil, Qnil, Qnil); | 971 | Feval, 0, Qnil, Qnil, Qnil, Qnil); |
| 964 | unbind_to (count, Qnil); | 972 | unbind_to (count, Qnil); |
| 965 | 973 | ||
| 966 | /* Run any load-hooks for this file. */ | 974 | /* Run any eval-after-load forms for this file */ |
| 967 | temp = Fassoc (file, Vafter_load_alist); | 975 | if (NILP (Vpurify_flag) |
| 968 | if (!NILP (temp)) | 976 | && (!NILP (Ffboundp (Qdo_after_load_evaluation)))) |
| 969 | Fprogn (Fcdr (temp)); | 977 | call1 (Qdo_after_load_evaluation, hist_file_name) ; |
| 978 | |||
| 970 | UNGCPRO; | 979 | UNGCPRO; |
| 971 | 980 | ||
| 972 | if (saved_doc_string) | 981 | if (saved_doc_string) |
| @@ -1393,6 +1402,12 @@ readevalloop (readcharfun, stream, sourcename, evalfun, | |||
| 1393 | 1402 | ||
| 1394 | GCPRO4 (sourcename, readfun, start, end); | 1403 | GCPRO4 (sourcename, readfun, start, end); |
| 1395 | 1404 | ||
| 1405 | /* Try to ensure sourcename is a truename, except whilst preloading. */ | ||
| 1406 | if (NILP (Vpurify_flag) | ||
| 1407 | && !NILP (sourcename) && Ffile_name_absolute_p (sourcename) | ||
| 1408 | && (!NILP (Ffboundp (Qfile_truename)))) | ||
| 1409 | sourcename = call1 (Qfile_truename, sourcename) ; | ||
| 1410 | |||
| 1396 | LOADHIST_ATTACH (sourcename); | 1411 | LOADHIST_ATTACH (sourcename); |
| 1397 | 1412 | ||
| 1398 | continue_reading_p = 1; | 1413 | continue_reading_p = 1; |
| @@ -1751,6 +1766,9 @@ read_escape (readcharfun, stringp, byterep) | |||
| 1751 | int *byterep; | 1766 | int *byterep; |
| 1752 | { | 1767 | { |
| 1753 | register int c = READCHAR; | 1768 | register int c = READCHAR; |
| 1769 | /* \u allows up to four hex digits, \U up to eight. Default to the | ||
| 1770 | behaviour for \u, and change this value in the case that \U is seen. */ | ||
| 1771 | int unicode_hex_count = 4; | ||
| 1754 | 1772 | ||
| 1755 | *byterep = 0; | 1773 | *byterep = 0; |
| 1756 | 1774 | ||
| @@ -1915,6 +1933,52 @@ read_escape (readcharfun, stringp, byterep) | |||
| 1915 | return i; | 1933 | return i; |
| 1916 | } | 1934 | } |
| 1917 | 1935 | ||
| 1936 | case 'U': | ||
| 1937 | /* Post-Unicode-2.0: Up to eight hex chars. */ | ||
| 1938 | unicode_hex_count = 8; | ||
| 1939 | case 'u': | ||
| 1940 | |||
| 1941 | /* A Unicode escape. We only permit them in strings and characters, | ||
| 1942 | not arbitrarily in the source code, as in some other languages. */ | ||
| 1943 | { | ||
| 1944 | int i = 0; | ||
| 1945 | int count = 0; | ||
| 1946 | Lisp_Object lisp_char; | ||
| 1947 | struct gcpro gcpro1; | ||
| 1948 | |||
| 1949 | while (++count <= unicode_hex_count) | ||
| 1950 | { | ||
| 1951 | c = READCHAR; | ||
| 1952 | /* isdigit(), isalpha() may be locale-specific, which we don't | ||
| 1953 | want. */ | ||
| 1954 | if (c >= '0' && c <= '9') i = (i << 4) + (c - '0'); | ||
| 1955 | else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10; | ||
| 1956 | else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10; | ||
| 1957 | else | ||
| 1958 | { | ||
| 1959 | error ("Non-hex digit used for Unicode escape"); | ||
| 1960 | break; | ||
| 1961 | } | ||
| 1962 | } | ||
| 1963 | |||
| 1964 | GCPRO1 (readcharfun); | ||
| 1965 | lisp_char = call2(intern("decode-char"), intern("ucs"), | ||
| 1966 | make_number(i)); | ||
| 1967 | UNGCPRO; | ||
| 1968 | |||
| 1969 | if (EQ(Qnil, lisp_char)) | ||
| 1970 | { | ||
| 1971 | /* This is ugly and horrible and trashes the user's data. */ | ||
| 1972 | XSETFASTINT (i, MAKE_CHAR (charset_katakana_jisx0201, | ||
| 1973 | 34 + 128, 46 + 128)); | ||
| 1974 | return i; | ||
| 1975 | } | ||
| 1976 | else | ||
| 1977 | { | ||
| 1978 | return XFASTINT (lisp_char); | ||
| 1979 | } | ||
| 1980 | } | ||
| 1981 | |||
| 1918 | default: | 1982 | default: |
| 1919 | if (BASE_LEADING_CODE_P (c)) | 1983 | if (BASE_LEADING_CODE_P (c)) |
| 1920 | c = read_multibyte (c, readcharfun); | 1984 | c = read_multibyte (c, readcharfun); |
| @@ -3973,16 +4037,17 @@ customize `jka-compr-load-suffixes' rather than the present variable. */); | |||
| 3973 | 4037 | ||
| 3974 | DEFVAR_LISP ("after-load-alist", &Vafter_load_alist, | 4038 | DEFVAR_LISP ("after-load-alist", &Vafter_load_alist, |
| 3975 | doc: /* An alist of expressions to be evalled when particular files are loaded. | 4039 | doc: /* An alist of expressions to be evalled when particular files are loaded. |
| 3976 | Each element looks like (FILENAME FORMS...). | 4040 | Each element looks like (REGEXP-OR-FEATURE FORMS...). |
| 3977 | When `load' is run and the file-name argument is FILENAME, | 4041 | |
| 3978 | the FORMS in the corresponding element are executed at the end of loading. | 4042 | REGEXP-OR-FEATURE is either a regular expression to match file names, or |
| 3979 | 4043 | a symbol \(a feature name). | |
| 3980 | FILENAME must match exactly! Normally FILENAME is the name of a library, | 4044 | |
| 3981 | with no directory specified, since that is how `load' is normally called. | 4045 | When `load' is run and the file-name argument matches an element's |
| 3982 | An error in FORMS does not undo the load, | 4046 | REGEXP-OR-FEATURE, or when `provide' is run and provides the symbol |
| 3983 | but does prevent execution of the rest of the FORMS. | 4047 | REGEXP-OR-FEATURE, the FORMS in the element are executed. |
| 3984 | FILENAME can also be a symbol (a feature) and FORMS are then executed | 4048 | |
| 3985 | when the corresponding call to `provide' is made. */); | 4049 | An error in FORMS does not undo the load, but does prevent execution of |
| 4050 | the rest of the FORMS. */); | ||
| 3986 | Vafter_load_alist = Qnil; | 4051 | Vafter_load_alist = Qnil; |
| 3987 | 4052 | ||
| 3988 | DEFVAR_LISP ("load-history", &Vload_history, | 4053 | DEFVAR_LISP ("load-history", &Vload_history, |
| @@ -3990,6 +4055,10 @@ when the corresponding call to `provide' is made. */); | |||
| 3990 | Each alist element is a list that starts with a file name, | 4055 | Each alist element is a list that starts with a file name, |
| 3991 | except for one element (optional) that starts with nil and describes | 4056 | except for one element (optional) that starts with nil and describes |
| 3992 | definitions evaluated from buffers not visiting files. | 4057 | definitions evaluated from buffers not visiting files. |
| 4058 | |||
| 4059 | The file name is absolute and is the true file name (i.e. it doesn't | ||
| 4060 | contain symbolic links) of the loaded file. | ||
| 4061 | |||
| 3993 | The remaining elements of each list are symbols defined as variables | 4062 | The remaining elements of each list are symbols defined as variables |
| 3994 | and cons cells of the form `(provide . FEATURE)', `(require . FEATURE)', | 4063 | and cons cells of the form `(provide . FEATURE)', `(require . FEATURE)', |
| 3995 | `(defun . FUNCTION)', `(autoload . SYMBOL)', and `(t . SYMBOL)'. | 4064 | `(defun . FUNCTION)', `(autoload . SYMBOL)', and `(t . SYMBOL)'. |
| @@ -4120,6 +4189,12 @@ to load. See also `load-dangerous-libraries'. */); | |||
| 4120 | Qeval_buffer_list = intern ("eval-buffer-list"); | 4189 | Qeval_buffer_list = intern ("eval-buffer-list"); |
| 4121 | staticpro (&Qeval_buffer_list); | 4190 | staticpro (&Qeval_buffer_list); |
| 4122 | 4191 | ||
| 4192 | Qfile_truename = intern ("file-truename"); | ||
| 4193 | staticpro (&Qfile_truename) ; | ||
| 4194 | |||
| 4195 | Qdo_after_load_evaluation = intern ("do-after-load-evaluation"); | ||
| 4196 | staticpro (&Qdo_after_load_evaluation) ; | ||
| 4197 | |||
| 4123 | staticpro (&dump_path); | 4198 | staticpro (&dump_path); |
| 4124 | 4199 | ||
| 4125 | staticpro (&read_objects); | 4200 | staticpro (&read_objects); |
| @@ -270,6 +270,26 @@ posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen) | |||
| 270 | 270 | ||
| 271 | static Lisp_Object Qundecoded_file_name; | 271 | static Lisp_Object Qundecoded_file_name; |
| 272 | 272 | ||
| 273 | static struct { | ||
| 274 | AEKeyword keyword; | ||
| 275 | char *name; | ||
| 276 | Lisp_Object symbol; | ||
| 277 | } ae_attr_table [] = | ||
| 278 | {{keyTransactionIDAttr, "transaction-id"}, | ||
| 279 | {keyReturnIDAttr, "return-id"}, | ||
| 280 | {keyEventClassAttr, "event-class"}, | ||
| 281 | {keyEventIDAttr, "event-id"}, | ||
| 282 | {keyAddressAttr, "address"}, | ||
| 283 | {keyOptionalKeywordAttr, "optional-keyword"}, | ||
| 284 | {keyTimeoutAttr, "timeout"}, | ||
| 285 | {keyInteractLevelAttr, "interact-level"}, | ||
| 286 | {keyEventSourceAttr, "event-source"}, | ||
| 287 | /* {keyMissedKeywordAttr, "missed-keyword"}, */ | ||
| 288 | {keyOriginalAddressAttr, "original-address"}, | ||
| 289 | {keyReplyRequestedAttr, "reply-requested"}, | ||
| 290 | {KEY_EMACS_SUSPENSION_ID_ATTR, "emacs-suspension-id"} | ||
| 291 | }; | ||
| 292 | |||
| 273 | static Lisp_Object | 293 | static Lisp_Object |
| 274 | mac_aelist_to_lisp (desc_list) | 294 | mac_aelist_to_lisp (desc_list) |
| 275 | const AEDescList *desc_list; | 295 | const AEDescList *desc_list; |
| @@ -281,22 +301,36 @@ mac_aelist_to_lisp (desc_list) | |||
| 281 | Size size; | 301 | Size size; |
| 282 | AEKeyword keyword; | 302 | AEKeyword keyword; |
| 283 | AEDesc desc; | 303 | AEDesc desc; |
| 304 | int attribute_p = 0; | ||
| 284 | 305 | ||
| 285 | err = AECountItems (desc_list, &count); | 306 | err = AECountItems (desc_list, &count); |
| 286 | if (err != noErr) | 307 | if (err != noErr) |
| 287 | return Qnil; | 308 | return Qnil; |
| 288 | result = Qnil; | 309 | result = Qnil; |
| 310 | |||
| 311 | again: | ||
| 289 | while (count > 0) | 312 | while (count > 0) |
| 290 | { | 313 | { |
| 291 | err = AESizeOfNthItem (desc_list, count, &desc_type, &size); | 314 | if (attribute_p) |
| 315 | { | ||
| 316 | keyword = ae_attr_table[count - 1].keyword; | ||
| 317 | err = AESizeOfAttribute (desc_list, keyword, &desc_type, &size); | ||
| 318 | } | ||
| 319 | else | ||
| 320 | err = AESizeOfNthItem (desc_list, count, &desc_type, &size); | ||
| 321 | |||
| 292 | if (err == noErr) | 322 | if (err == noErr) |
| 293 | switch (desc_type) | 323 | switch (desc_type) |
| 294 | { | 324 | { |
| 295 | case typeAEList: | 325 | case typeAEList: |
| 296 | case typeAERecord: | 326 | case typeAERecord: |
| 297 | case typeAppleEvent: | 327 | case typeAppleEvent: |
| 298 | err = AEGetNthDesc (desc_list, count, typeWildCard, | 328 | if (attribute_p) |
| 299 | &keyword, &desc); | 329 | err = AEGetAttributeDesc (desc_list, keyword, typeWildCard, |
| 330 | &desc); | ||
| 331 | else | ||
| 332 | err = AEGetNthDesc (desc_list, count, typeWildCard, | ||
| 333 | &keyword, &desc); | ||
| 300 | if (err != noErr) | 334 | if (err != noErr) |
| 301 | break; | 335 | break; |
| 302 | elem = mac_aelist_to_lisp (&desc); | 336 | elem = mac_aelist_to_lisp (&desc); |
| @@ -309,8 +343,13 @@ mac_aelist_to_lisp (desc_list) | |||
| 309 | else | 343 | else |
| 310 | { | 344 | { |
| 311 | elem = make_uninit_string (size); | 345 | elem = make_uninit_string (size); |
| 312 | err = AEGetNthPtr (desc_list, count, typeWildCard, &keyword, | 346 | if (attribute_p) |
| 313 | &desc_type, SDATA (elem), size, &size); | 347 | err = AEGetAttributePtr (desc_list, keyword, typeWildCard, |
| 348 | &desc_type, SDATA (elem), | ||
| 349 | size, &size); | ||
| 350 | else | ||
| 351 | err = AEGetNthPtr (desc_list, count, typeWildCard, &keyword, | ||
| 352 | &desc_type, SDATA (elem), size, &size); | ||
| 314 | } | 353 | } |
| 315 | if (err != noErr) | 354 | if (err != noErr) |
| 316 | break; | 355 | break; |
| @@ -319,18 +358,35 @@ mac_aelist_to_lisp (desc_list) | |||
| 319 | break; | 358 | break; |
| 320 | } | 359 | } |
| 321 | 360 | ||
| 322 | if (err != noErr) | 361 | if (err == noErr || desc_list->descriptorType == typeAEList) |
| 323 | elem = Qnil; | ||
| 324 | else if (desc_list->descriptorType != typeAEList) | ||
| 325 | { | 362 | { |
| 326 | keyword = EndianU32_NtoB (keyword); | 363 | if (err != noErr) |
| 327 | elem = Fcons (make_unibyte_string ((char *) &keyword, 4), elem); | 364 | elem = Qnil; /* Don't skip elements in AEList. */ |
| 365 | else if (desc_list->descriptorType != typeAEList) | ||
| 366 | { | ||
| 367 | if (attribute_p) | ||
| 368 | elem = Fcons (ae_attr_table[count-1].symbol, elem); | ||
| 369 | else | ||
| 370 | { | ||
| 371 | keyword = EndianU32_NtoB (keyword); | ||
| 372 | elem = Fcons (make_unibyte_string ((char *) &keyword, 4), | ||
| 373 | elem); | ||
| 374 | } | ||
| 375 | } | ||
| 376 | |||
| 377 | result = Fcons (elem, result); | ||
| 328 | } | 378 | } |
| 329 | 379 | ||
| 330 | result = Fcons (elem, result); | ||
| 331 | count--; | 380 | count--; |
| 332 | } | 381 | } |
| 333 | 382 | ||
| 383 | if (desc_list->descriptorType == typeAppleEvent && !attribute_p) | ||
| 384 | { | ||
| 385 | attribute_p = 1; | ||
| 386 | count = sizeof (ae_attr_table) / sizeof (ae_attr_table[0]); | ||
| 387 | goto again; | ||
| 388 | } | ||
| 389 | |||
| 334 | desc_type = EndianU32_NtoB (desc_list->descriptorType); | 390 | desc_type = EndianU32_NtoB (desc_list->descriptorType); |
| 335 | return Fcons (make_unibyte_string ((char *) &desc_type, 4), result); | 391 | return Fcons (make_unibyte_string ((char *) &desc_type, 4), result); |
| 336 | } | 392 | } |
| @@ -403,6 +459,93 @@ mac_aedesc_to_lisp (desc) | |||
| 403 | return Fcons (make_unibyte_string ((char *) &desc_type, 4), result); | 459 | return Fcons (make_unibyte_string ((char *) &desc_type, 4), result); |
| 404 | } | 460 | } |
| 405 | 461 | ||
| 462 | OSErr | ||
| 463 | mac_ae_put_lisp (desc, keyword_or_index, obj) | ||
| 464 | AEDescList *desc; | ||
| 465 | UInt32 keyword_or_index; | ||
| 466 | Lisp_Object obj; | ||
| 467 | { | ||
| 468 | OSErr err; | ||
| 469 | |||
| 470 | if (!(desc->descriptorType == typeAppleEvent | ||
| 471 | || desc->descriptorType == typeAERecord | ||
| 472 | || desc->descriptorType == typeAEList)) | ||
| 473 | return errAEWrongDataType; | ||
| 474 | |||
| 475 | if (CONSP (obj) && STRINGP (XCAR (obj)) && SBYTES (XCAR (obj)) == 4) | ||
| 476 | { | ||
| 477 | DescType desc_type1 = EndianU32_BtoN (*((UInt32 *) SDATA (XCAR (obj)))); | ||
| 478 | Lisp_Object data = XCDR (obj), rest; | ||
| 479 | AEDesc desc1; | ||
| 480 | |||
| 481 | switch (desc_type1) | ||
| 482 | { | ||
| 483 | case typeNull: | ||
| 484 | case typeAppleEvent: | ||
| 485 | break; | ||
| 486 | |||
| 487 | case typeAEList: | ||
| 488 | case typeAERecord: | ||
| 489 | err = AECreateList (NULL, 0, desc_type1 == typeAERecord, &desc1); | ||
| 490 | if (err == noErr) | ||
| 491 | { | ||
| 492 | for (rest = data; CONSP (rest); rest = XCDR (rest)) | ||
| 493 | { | ||
| 494 | UInt32 keyword_or_index1 = 0; | ||
| 495 | Lisp_Object elem = XCAR (rest); | ||
| 496 | |||
| 497 | if (desc_type1 == typeAERecord) | ||
| 498 | { | ||
| 499 | if (CONSP (elem) && STRINGP (XCAR (elem)) | ||
| 500 | && SBYTES (XCAR (elem)) == 4) | ||
| 501 | { | ||
| 502 | keyword_or_index1 = | ||
| 503 | EndianU32_BtoN (*((UInt32 *) | ||
| 504 | SDATA (XCAR (elem)))); | ||
| 505 | elem = XCDR (elem); | ||
| 506 | } | ||
| 507 | else | ||
| 508 | continue; | ||
| 509 | } | ||
| 510 | |||
| 511 | err = mac_ae_put_lisp (&desc1, keyword_or_index1, elem); | ||
| 512 | if (err != noErr) | ||
| 513 | break; | ||
| 514 | } | ||
| 515 | |||
| 516 | if (err == noErr) | ||
| 517 | { | ||
| 518 | if (desc->descriptorType == typeAEList) | ||
| 519 | err = AEPutDesc (desc, keyword_or_index, &desc1); | ||
| 520 | else | ||
| 521 | err = AEPutParamDesc (desc, keyword_or_index, &desc1); | ||
| 522 | } | ||
| 523 | |||
| 524 | AEDisposeDesc (&desc1); | ||
| 525 | } | ||
| 526 | return err; | ||
| 527 | |||
| 528 | default: | ||
| 529 | if (!STRINGP (data)) | ||
| 530 | break; | ||
| 531 | if (desc->descriptorType == typeAEList) | ||
| 532 | err = AEPutPtr (desc, keyword_or_index, desc_type1, | ||
| 533 | SDATA (data), SBYTES (data)); | ||
| 534 | else | ||
| 535 | err = AEPutParamPtr (desc, keyword_or_index, desc_type1, | ||
| 536 | SDATA (data), SBYTES (data)); | ||
| 537 | return err; | ||
| 538 | } | ||
| 539 | } | ||
| 540 | |||
| 541 | if (desc->descriptorType == typeAEList) | ||
| 542 | err = AEPutPtr (desc, keyword_or_index, typeNull, NULL, 0); | ||
| 543 | else | ||
| 544 | err = AEPutParamPtr (desc, keyword_or_index, typeNull, NULL, 0); | ||
| 545 | |||
| 546 | return err; | ||
| 547 | } | ||
| 548 | |||
| 406 | static pascal OSErr | 549 | static pascal OSErr |
| 407 | mac_coerce_file_name_ptr (type_code, data_ptr, data_size, | 550 | mac_coerce_file_name_ptr (type_code, data_ptr, data_size, |
| 408 | to_type, handler_refcon, result) | 551 | to_type, handler_refcon, result) |
| @@ -722,8 +865,7 @@ create_apple_event_from_event_ref (event, num_params, names, types, result) | |||
| 722 | '?'); | 865 | '?'); |
| 723 | if (data == NULL) | 866 | if (data == NULL) |
| 724 | break; | 867 | break; |
| 725 | /* typeUTF8Text is not available on Mac OS X 10.1. */ | 868 | AEPutParamPtr (result, names[i], typeUTF8Text, |
| 726 | AEPutParamPtr (result, names[i], 'utf8', | ||
| 727 | CFDataGetBytePtr (data), CFDataGetLength (data)); | 869 | CFDataGetBytePtr (data), CFDataGetLength (data)); |
| 728 | CFRelease (data); | 870 | CFRelease (data); |
| 729 | break; | 871 | break; |
| @@ -4661,7 +4803,7 @@ cfstring_create_normalized (str, symbol) | |||
| 4661 | } | 4803 | } |
| 4662 | 4804 | ||
| 4663 | if (in_text) | 4805 | if (in_text) |
| 4664 | err = CreateUnicodeToTextInfo(&map, &uni); | 4806 | err = CreateUnicodeToTextInfo (&map, &uni); |
| 4665 | while (err == noErr) | 4807 | while (err == noErr) |
| 4666 | { | 4808 | { |
| 4667 | out_buf = xmalloc (out_size); | 4809 | out_buf = xmalloc (out_size); |
| @@ -5234,6 +5376,16 @@ syms_of_mac () | |||
| 5234 | QHFS_plus_C = intern ("HFS+C"); staticpro (&QHFS_plus_C); | 5376 | QHFS_plus_C = intern ("HFS+C"); staticpro (&QHFS_plus_C); |
| 5235 | #endif | 5377 | #endif |
| 5236 | 5378 | ||
| 5379 | { | ||
| 5380 | int i; | ||
| 5381 | |||
| 5382 | for (i = 0; i < sizeof (ae_attr_table) / sizeof (ae_attr_table[0]); i++) | ||
| 5383 | { | ||
| 5384 | ae_attr_table[i].symbol = intern (ae_attr_table[i].name); | ||
| 5385 | staticpro (&ae_attr_table[i].symbol); | ||
| 5386 | } | ||
| 5387 | } | ||
| 5388 | |||
| 5237 | defsubr (&Smac_coerce_ae_data); | 5389 | defsubr (&Smac_coerce_ae_data); |
| 5238 | #if TARGET_API_MAC_CARBON | 5390 | #if TARGET_API_MAC_CARBON |
| 5239 | defsubr (&Smac_get_preference); | 5391 | defsubr (&Smac_get_preference); |
diff --git a/src/macfns.c b/src/macfns.c index 577167e6fe3..4345cef2611 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -1592,7 +1592,7 @@ x_set_icon_name (f, arg, oldval) | |||
| 1592 | if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | 1592 | if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) |
| 1593 | return; | 1593 | return; |
| 1594 | } | 1594 | } |
| 1595 | else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | 1595 | else if (!NILP (arg) || NILP (oldval)) |
| 1596 | return; | 1596 | return; |
| 1597 | 1597 | ||
| 1598 | f->icon_name = arg; | 1598 | f->icon_name = arg; |
| @@ -3024,11 +3024,11 @@ If omitted or nil, that stands for the selected frame's display. */) | |||
| 3024 | { | 3024 | { |
| 3025 | if (response >= 0x00001040) | 3025 | if (response >= 0x00001040) |
| 3026 | { | 3026 | { |
| 3027 | err = Gestalt ('sys1', &major); /* gestaltSystemVersionMajor */ | 3027 | err = Gestalt (gestaltSystemVersionMajor, &major); |
| 3028 | if (err == noErr) | 3028 | if (err == noErr) |
| 3029 | err = Gestalt ('sys2', &minor); /* gestaltSystemVersionMinor */ | 3029 | err = Gestalt (gestaltSystemVersionMinor, &minor); |
| 3030 | if (err == noErr) | 3030 | if (err == noErr) |
| 3031 | err = Gestalt ('sys3', &bugfix); /* gestaltSystemVersionBugFix */ | 3031 | err = Gestalt (gestaltSystemVersionBugFix, &bugfix); |
| 3032 | } | 3032 | } |
| 3033 | else | 3033 | else |
| 3034 | { | 3034 | { |
| @@ -4514,8 +4514,18 @@ This is for internal use only. Use `mac-font-panel-mode' instead. */) | |||
| 4514 | check_mac (); | 4514 | check_mac (); |
| 4515 | 4515 | ||
| 4516 | BLOCK_INPUT; | 4516 | BLOCK_INPUT; |
| 4517 | if (NILP (visible) == (FPIsFontPanelVisible () == true)) | 4517 | if (NILP (visible) != !mac_font_panel_visible_p ()) |
| 4518 | err = FPShowHideFontPanel (); | 4518 | { |
| 4519 | err = mac_show_hide_font_panel (); | ||
| 4520 | if (err == noErr && !NILP (visible)) | ||
| 4521 | { | ||
| 4522 | Lisp_Object focus_frame = x_get_focus_frame (SELECTED_FRAME ()); | ||
| 4523 | struct frame *f = (NILP (focus_frame) ? SELECTED_FRAME () | ||
| 4524 | : XFRAME (focus_frame)); | ||
| 4525 | |||
| 4526 | mac_set_font_info_for_selection (f, DEFAULT_FACE_ID, 0); | ||
| 4527 | } | ||
| 4528 | } | ||
| 4519 | UNBLOCK_INPUT; | 4529 | UNBLOCK_INPUT; |
| 4520 | 4530 | ||
| 4521 | if (err != noErr) | 4531 | if (err != noErr) |
diff --git a/src/macgui.h b/src/macgui.h index f7005600d43..a93131e565e 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -110,6 +110,13 @@ typedef unsigned long Time; | |||
| 110 | #endif | 110 | #endif |
| 111 | #endif | 111 | #endif |
| 112 | 112 | ||
| 113 | /* Whether to use Text Services Manager. */ | ||
| 114 | #ifndef USE_MAC_TSM | ||
| 115 | #ifdef MAC_OSX | ||
| 116 | #define USE_MAC_TSM 1 | ||
| 117 | #endif | ||
| 118 | #endif | ||
| 119 | |||
| 113 | typedef WindowPtr Window; | 120 | typedef WindowPtr Window; |
| 114 | typedef GWorldPtr Pixmap; | 121 | typedef GWorldPtr Pixmap; |
| 115 | 122 | ||
diff --git a/src/macselect.c b/src/macselect.c index 1b6a1a46cc3..3afea1e9813 100644 --- a/src/macselect.c +++ b/src/macselect.c | |||
| @@ -909,14 +909,13 @@ and t is the same as `SECONDARY'. */) | |||
| 909 | } | 909 | } |
| 910 | 910 | ||
| 911 | 911 | ||
| 912 | /*********************************************************************** | ||
| 913 | Apple event support | ||
| 914 | ***********************************************************************/ | ||
| 912 | int mac_ready_for_apple_events = 0; | 915 | int mac_ready_for_apple_events = 0; |
| 913 | static Lisp_Object Vmac_apple_event_map; | 916 | static Lisp_Object Vmac_apple_event_map; |
| 914 | static Lisp_Object Qmac_apple_event_class, Qmac_apple_event_id; | 917 | static Lisp_Object Qmac_apple_event_class, Qmac_apple_event_id; |
| 915 | static struct | 918 | static Lisp_Object Qemacs_suspension_id; |
| 916 | { | ||
| 917 | AppleEvent *buf; | ||
| 918 | int size, count; | ||
| 919 | } deferred_apple_events; | ||
| 920 | extern Lisp_Object Qundefined; | 919 | extern Lisp_Object Qundefined; |
| 921 | extern void mac_store_apple_event P_ ((Lisp_Object, Lisp_Object, | 920 | extern void mac_store_apple_event P_ ((Lisp_Object, Lisp_Object, |
| 922 | const AEDesc *)); | 921 | const AEDesc *)); |
| @@ -927,6 +926,19 @@ struct apple_event_binding | |||
| 927 | Lisp_Object key, binding; | 926 | Lisp_Object key, binding; |
| 928 | }; | 927 | }; |
| 929 | 928 | ||
| 929 | struct suspended_ae_info | ||
| 930 | { | ||
| 931 | UInt32 expiration_tick, suspension_id; | ||
| 932 | AppleEvent apple_event, reply; | ||
| 933 | struct suspended_ae_info *next; | ||
| 934 | }; | ||
| 935 | |||
| 936 | /* List of deferred apple events at the startup time. */ | ||
| 937 | static struct suspended_ae_info *deferred_apple_events = NULL; | ||
| 938 | |||
| 939 | /* List of suspended apple events, in order of expiration_tick. */ | ||
| 940 | static struct suspended_ae_info *suspended_apple_events = NULL; | ||
| 941 | |||
| 930 | static void | 942 | static void |
| 931 | find_event_binding_fun (key, binding, args, data) | 943 | find_event_binding_fun (key, binding, args, data) |
| 932 | Lisp_Object key, binding, args; | 944 | Lisp_Object key, binding, args; |
| @@ -1003,6 +1015,12 @@ defer_apple_events (apple_event, reply) | |||
| 1003 | const AppleEvent *apple_event, *reply; | 1015 | const AppleEvent *apple_event, *reply; |
| 1004 | { | 1016 | { |
| 1005 | OSErr err; | 1017 | OSErr err; |
| 1018 | struct suspended_ae_info *new; | ||
| 1019 | |||
| 1020 | new = xmalloc (sizeof (struct suspended_ae_info)); | ||
| 1021 | bzero (new, sizeof (struct suspended_ae_info)); | ||
| 1022 | new->apple_event.descriptorType = typeNull; | ||
| 1023 | new->reply.descriptorType = typeNull; | ||
| 1006 | 1024 | ||
| 1007 | err = AESuspendTheCurrentEvent (apple_event); | 1025 | err = AESuspendTheCurrentEvent (apple_event); |
| 1008 | 1026 | ||
| @@ -1011,30 +1029,88 @@ defer_apple_events (apple_event, reply) | |||
| 1011 | manual says it doesn't. Anyway we create copies of them and save | 1029 | manual says it doesn't. Anyway we create copies of them and save |
| 1012 | them in `deferred_apple_events'. */ | 1030 | them in `deferred_apple_events'. */ |
| 1013 | if (err == noErr) | 1031 | if (err == noErr) |
| 1032 | err = AEDuplicateDesc (apple_event, &new->apple_event); | ||
| 1033 | if (err == noErr) | ||
| 1034 | err = AEDuplicateDesc (reply, &new->reply); | ||
| 1035 | if (err == noErr) | ||
| 1014 | { | 1036 | { |
| 1015 | if (deferred_apple_events.buf == NULL) | 1037 | new->next = deferred_apple_events; |
| 1016 | { | 1038 | deferred_apple_events = new; |
| 1017 | deferred_apple_events.size = 16; | 1039 | } |
| 1018 | deferred_apple_events.count = 0; | 1040 | else |
| 1019 | deferred_apple_events.buf = | 1041 | { |
| 1020 | xmalloc (sizeof (AppleEvent) * deferred_apple_events.size); | 1042 | AEDisposeDesc (&new->apple_event); |
| 1021 | } | 1043 | AEDisposeDesc (&new->reply); |
| 1022 | else if (deferred_apple_events.count == deferred_apple_events.size) | 1044 | xfree (new); |
| 1045 | } | ||
| 1046 | |||
| 1047 | return err; | ||
| 1048 | } | ||
| 1049 | |||
| 1050 | static OSErr | ||
| 1051 | mac_handle_apple_event_1 (class, id, apple_event, reply) | ||
| 1052 | Lisp_Object class, id; | ||
| 1053 | const AppleEvent *apple_event; | ||
| 1054 | AppleEvent *reply; | ||
| 1055 | { | ||
| 1056 | OSErr err; | ||
| 1057 | static UInt32 suspension_id = 0; | ||
| 1058 | struct suspended_ae_info *new; | ||
| 1059 | |||
| 1060 | new = xmalloc (sizeof (struct suspended_ae_info)); | ||
| 1061 | bzero (new, sizeof (struct suspended_ae_info)); | ||
| 1062 | new->apple_event.descriptorType = typeNull; | ||
| 1063 | new->reply.descriptorType = typeNull; | ||
| 1064 | |||
| 1065 | err = AESuspendTheCurrentEvent (apple_event); | ||
| 1066 | if (err == noErr) | ||
| 1067 | err = AEDuplicateDesc (apple_event, &new->apple_event); | ||
| 1068 | if (err == noErr) | ||
| 1069 | err = AEDuplicateDesc (reply, &new->reply); | ||
| 1070 | if (err == noErr) | ||
| 1071 | err = AEPutAttributePtr (&new->apple_event, KEY_EMACS_SUSPENSION_ID_ATTR, | ||
| 1072 | typeUInt32, &suspension_id, sizeof (UInt32)); | ||
| 1073 | if (err == noErr) | ||
| 1074 | { | ||
| 1075 | OSErr err1; | ||
| 1076 | SInt32 reply_requested; | ||
| 1077 | |||
| 1078 | err1 = AEGetAttributePtr (&new->apple_event, keyReplyRequestedAttr, | ||
| 1079 | typeSInt32, NULL, &reply_requested, | ||
| 1080 | sizeof (SInt32), NULL); | ||
| 1081 | if (err1 != noErr) | ||
| 1023 | { | 1082 | { |
| 1024 | deferred_apple_events.size *= 2; | 1083 | /* Emulate keyReplyRequestedAttr in older versions. */ |
| 1025 | deferred_apple_events.buf | 1084 | reply_requested = reply->descriptorType != typeNull; |
| 1026 | = xrealloc (deferred_apple_events.buf, | 1085 | err = AEPutAttributePtr (&new->apple_event, keyReplyRequestedAttr, |
| 1027 | sizeof (AppleEvent) * deferred_apple_events.size); | 1086 | typeSInt32, &reply_requested, |
| 1087 | sizeof (SInt32)); | ||
| 1028 | } | 1088 | } |
| 1029 | } | 1089 | } |
| 1030 | |||
| 1031 | if (err == noErr) | 1090 | if (err == noErr) |
| 1032 | { | 1091 | { |
| 1033 | int count = deferred_apple_events.count; | 1092 | SInt32 timeout = 0; |
| 1093 | struct suspended_ae_info **p; | ||
| 1094 | |||
| 1095 | new->suspension_id = suspension_id; | ||
| 1096 | suspension_id++; | ||
| 1097 | err = AEGetAttributePtr (apple_event, keyTimeoutAttr, typeSInt32, | ||
| 1098 | NULL, &timeout, sizeof (SInt32), NULL); | ||
| 1099 | new->expiration_tick = TickCount () + timeout; | ||
| 1100 | |||
| 1101 | for (p = &suspended_apple_events; *p; p = &(*p)->next) | ||
| 1102 | if ((*p)->expiration_tick >= new->expiration_tick) | ||
| 1103 | break; | ||
| 1104 | new->next = *p; | ||
| 1105 | *p = new; | ||
| 1034 | 1106 | ||
| 1035 | AEDuplicateDesc (apple_event, deferred_apple_events.buf + count); | 1107 | mac_store_apple_event (class, id, &new->apple_event); |
| 1036 | AEDuplicateDesc (reply, deferred_apple_events.buf + count + 1); | 1108 | } |
| 1037 | deferred_apple_events.count += 2; | 1109 | else |
| 1110 | { | ||
| 1111 | AEDisposeDesc (&new->reply); | ||
| 1112 | AEDisposeDesc (&new->apple_event); | ||
| 1113 | xfree (new); | ||
| 1038 | } | 1114 | } |
| 1039 | 1115 | ||
| 1040 | return err; | 1116 | return err; |
| @@ -1047,17 +1123,11 @@ mac_handle_apple_event (apple_event, reply, refcon) | |||
| 1047 | SInt32 refcon; | 1123 | SInt32 refcon; |
| 1048 | { | 1124 | { |
| 1049 | OSErr err; | 1125 | OSErr err; |
| 1126 | UInt32 suspension_id; | ||
| 1050 | AEEventClass event_class; | 1127 | AEEventClass event_class; |
| 1051 | AEEventID event_id; | 1128 | AEEventID event_id; |
| 1052 | Lisp_Object class_key, id_key, binding; | 1129 | Lisp_Object class_key, id_key, binding; |
| 1053 | 1130 | ||
| 1054 | /* We can't handle an Apple event that requests a reply, but this | ||
| 1055 | seems to be too restrictive. */ | ||
| 1056 | #if 0 | ||
| 1057 | if (reply->descriptorType != typeNull) | ||
| 1058 | return errAEEventNotHandled; | ||
| 1059 | #endif | ||
| 1060 | |||
| 1061 | if (!mac_ready_for_apple_events) | 1131 | if (!mac_ready_for_apple_events) |
| 1062 | { | 1132 | { |
| 1063 | err = defer_apple_events (apple_event, reply); | 1133 | err = defer_apple_events (apple_event, reply); |
| @@ -1066,6 +1136,13 @@ mac_handle_apple_event (apple_event, reply, refcon) | |||
| 1066 | return noErr; | 1136 | return noErr; |
| 1067 | } | 1137 | } |
| 1068 | 1138 | ||
| 1139 | err = AEGetAttributePtr (apple_event, KEY_EMACS_SUSPENSION_ID_ATTR, | ||
| 1140 | typeUInt32, NULL, | ||
| 1141 | &suspension_id, sizeof (UInt32), NULL); | ||
| 1142 | if (err == noErr) | ||
| 1143 | /* Previously suspended event. Pass it to the next handler. */ | ||
| 1144 | return errAEEventNotHandled; | ||
| 1145 | |||
| 1069 | err = AEGetAttributePtr (apple_event, keyEventClassAttr, typeType, NULL, | 1146 | err = AEGetAttributePtr (apple_event, keyEventClassAttr, typeType, NULL, |
| 1070 | &event_class, sizeof (AEEventClass), NULL); | 1147 | &event_class, sizeof (AEEventClass), NULL); |
| 1071 | if (err == noErr) | 1148 | if (err == noErr) |
| @@ -1079,11 +1156,49 @@ mac_handle_apple_event (apple_event, reply, refcon) | |||
| 1079 | { | 1156 | { |
| 1080 | if (INTEGERP (binding)) | 1157 | if (INTEGERP (binding)) |
| 1081 | return XINT (binding); | 1158 | return XINT (binding); |
| 1082 | mac_store_apple_event (class_key, id_key, apple_event); | 1159 | err = mac_handle_apple_event_1 (class_key, id_key, |
| 1083 | return noErr; | 1160 | apple_event, reply); |
| 1084 | } | 1161 | } |
| 1162 | else | ||
| 1163 | err = errAEEventNotHandled; | ||
| 1164 | } | ||
| 1165 | if (err == noErr) | ||
| 1166 | return noErr; | ||
| 1167 | else | ||
| 1168 | return errAEEventNotHandled; | ||
| 1169 | } | ||
| 1170 | |||
| 1171 | static int | ||
| 1172 | cleanup_suspended_apple_events (head, all_p) | ||
| 1173 | struct suspended_ae_info **head; | ||
| 1174 | int all_p; | ||
| 1175 | { | ||
| 1176 | UInt32 current_tick = TickCount (), nresumed = 0; | ||
| 1177 | struct suspended_ae_info *p, *next; | ||
| 1178 | |||
| 1179 | for (p = *head; p; p = next) | ||
| 1180 | { | ||
| 1181 | if (!all_p && p->expiration_tick > current_tick) | ||
| 1182 | break; | ||
| 1183 | AESetTheCurrentEvent (&p->apple_event); | ||
| 1184 | AEResumeTheCurrentEvent (&p->apple_event, &p->reply, | ||
| 1185 | (AEEventHandlerUPP) kAENoDispatch, 0); | ||
| 1186 | AEDisposeDesc (&p->reply); | ||
| 1187 | AEDisposeDesc (&p->apple_event); | ||
| 1188 | nresumed++; | ||
| 1189 | next = p->next; | ||
| 1190 | xfree (p); | ||
| 1085 | } | 1191 | } |
| 1086 | return errAEEventNotHandled; | 1192 | *head = p; |
| 1193 | |||
| 1194 | return nresumed; | ||
| 1195 | } | ||
| 1196 | |||
| 1197 | static void | ||
| 1198 | cleanup_all_suspended_apple_events () | ||
| 1199 | { | ||
| 1200 | cleanup_suspended_apple_events (&deferred_apple_events, 1); | ||
| 1201 | cleanup_suspended_apple_events (&suspended_apple_events, 1); | ||
| 1087 | } | 1202 | } |
| 1088 | 1203 | ||
| 1089 | void | 1204 | void |
| @@ -1109,34 +1224,190 @@ init_apple_event_handler () | |||
| 1109 | 0L, false); | 1224 | 0L, false); |
| 1110 | if (err != noErr) | 1225 | if (err != noErr) |
| 1111 | abort (); | 1226 | abort (); |
| 1227 | |||
| 1228 | atexit (cleanup_all_suspended_apple_events); | ||
| 1112 | } | 1229 | } |
| 1113 | 1230 | ||
| 1231 | static UInt32 | ||
| 1232 | get_suspension_id (apple_event) | ||
| 1233 | Lisp_Object apple_event; | ||
| 1234 | { | ||
| 1235 | Lisp_Object tem; | ||
| 1236 | |||
| 1237 | CHECK_CONS (apple_event); | ||
| 1238 | CHECK_STRING_CAR (apple_event); | ||
| 1239 | if (SBYTES (XCAR (apple_event)) != 4 | ||
| 1240 | || strcmp (SDATA (XCAR (apple_event)), "aevt") != 0) | ||
| 1241 | error ("Not an apple event"); | ||
| 1242 | |||
| 1243 | tem = assq_no_quit (Qemacs_suspension_id, XCDR (apple_event)); | ||
| 1244 | if (NILP (tem)) | ||
| 1245 | error ("Suspension ID not available"); | ||
| 1246 | |||
| 1247 | tem = XCDR (tem); | ||
| 1248 | if (!(CONSP (tem) | ||
| 1249 | && STRINGP (XCAR (tem)) && SBYTES (XCAR (tem)) == 4 | ||
| 1250 | && strcmp (SDATA (XCAR (tem)), "magn") == 0 | ||
| 1251 | && STRINGP (XCDR (tem)) && SBYTES (XCDR (tem)) == 4)) | ||
| 1252 | error ("Bad suspension ID format"); | ||
| 1253 | |||
| 1254 | return *((UInt32 *) SDATA (XCDR (tem))); | ||
| 1255 | } | ||
| 1256 | |||
| 1257 | |||
| 1114 | DEFUN ("mac-process-deferred-apple-events", Fmac_process_deferred_apple_events, Smac_process_deferred_apple_events, 0, 0, 0, | 1258 | DEFUN ("mac-process-deferred-apple-events", Fmac_process_deferred_apple_events, Smac_process_deferred_apple_events, 0, 0, 0, |
| 1115 | doc: /* Process Apple events that are deferred at the startup time. */) | 1259 | doc: /* Process Apple events that are deferred at the startup time. */) |
| 1116 | () | 1260 | () |
| 1117 | { | 1261 | { |
| 1118 | Lisp_Object result = Qnil; | ||
| 1119 | long i; | ||
| 1120 | |||
| 1121 | if (mac_ready_for_apple_events) | 1262 | if (mac_ready_for_apple_events) |
| 1122 | return Qnil; | 1263 | return Qnil; |
| 1123 | 1264 | ||
| 1124 | BLOCK_INPUT; | 1265 | BLOCK_INPUT; |
| 1125 | mac_ready_for_apple_events = 1; | 1266 | mac_ready_for_apple_events = 1; |
| 1126 | if (deferred_apple_events.buf) | 1267 | if (deferred_apple_events) |
| 1127 | { | 1268 | { |
| 1128 | for (i = 0; i < deferred_apple_events.count; i += 2) | 1269 | struct suspended_ae_info *prev, *tail, *next; |
| 1270 | |||
| 1271 | /* `nreverse' deferred_apple_events. */ | ||
| 1272 | prev = NULL; | ||
| 1273 | for (tail = deferred_apple_events; tail; tail = next) | ||
| 1129 | { | 1274 | { |
| 1130 | AEResumeTheCurrentEvent (deferred_apple_events.buf + i, | 1275 | next = tail->next; |
| 1131 | deferred_apple_events.buf + i + 1, | 1276 | tail->next = prev; |
| 1277 | prev = tail; | ||
| 1278 | } | ||
| 1279 | |||
| 1280 | /* Now `prev' points to the first cell. */ | ||
| 1281 | for (tail = prev; tail; tail = next) | ||
| 1282 | { | ||
| 1283 | next = tail->next; | ||
| 1284 | AEResumeTheCurrentEvent (&tail->apple_event, &tail->reply, | ||
| 1132 | ((AEEventHandlerUPP) | 1285 | ((AEEventHandlerUPP) |
| 1133 | kAEUseStandardDispatch), 0); | 1286 | kAEUseStandardDispatch), 0); |
| 1134 | AEDisposeDesc (deferred_apple_events.buf + i); | 1287 | AEDisposeDesc (&tail->reply); |
| 1135 | AEDisposeDesc (deferred_apple_events.buf + i + 1); | 1288 | AEDisposeDesc (&tail->apple_event); |
| 1289 | xfree (tail); | ||
| 1136 | } | 1290 | } |
| 1137 | xfree (deferred_apple_events.buf); | ||
| 1138 | bzero (&deferred_apple_events, sizeof (deferred_apple_events)); | ||
| 1139 | 1291 | ||
| 1292 | deferred_apple_events = NULL; | ||
| 1293 | } | ||
| 1294 | UNBLOCK_INPUT; | ||
| 1295 | |||
| 1296 | return Qt; | ||
| 1297 | } | ||
| 1298 | |||
| 1299 | DEFUN ("mac-cleanup-expired-apple-events", Fmac_cleanup_expired_apple_events, Smac_cleanup_expired_apple_events, 0, 0, 0, | ||
| 1300 | doc: /* Clean up expired Apple events. | ||
| 1301 | Return the number of expired events. */) | ||
| 1302 | () | ||
| 1303 | { | ||
| 1304 | int nexpired; | ||
| 1305 | |||
| 1306 | BLOCK_INPUT; | ||
| 1307 | nexpired = cleanup_suspended_apple_events (&suspended_apple_events, 0); | ||
| 1308 | UNBLOCK_INPUT; | ||
| 1309 | |||
| 1310 | return make_number (nexpired); | ||
| 1311 | } | ||
| 1312 | |||
| 1313 | DEFUN ("mac-ae-set-reply-parameter", Fmac_ae_set_reply_parameter, Smac_ae_set_reply_parameter, 3, 3, 0, | ||
| 1314 | doc: /* Set parameter KEYWORD to DESCRIPTOR on reply of APPLE-EVENT. | ||
| 1315 | KEYWORD is a 4-byte string. DESCRIPTOR is a Lisp representation of an | ||
| 1316 | Apple event descriptor. It has the form of (TYPE . DATA), where TYPE | ||
| 1317 | is a 4-byte string. Valid format of DATA is as follows: | ||
| 1318 | |||
| 1319 | * If TYPE is "null", then DATA is nil. | ||
| 1320 | * If TYPE is "list", then DATA is a list (DESCRIPTOR1 ... DESCRIPTORn). | ||
| 1321 | * If TYPE is "reco", then DATA is a list ((KEYWORD1 . DESCRIPTOR1) | ||
| 1322 | ... (KEYWORDn . DESCRIPTORn)). | ||
| 1323 | * If TYPE is "aevt", then DATA is ignored and the descriptor is | ||
| 1324 | treated as null. | ||
| 1325 | * Otherwise, DATA is a string. | ||
| 1326 | |||
| 1327 | If a (sub-)descriptor is in an invalid format, it is silently treated | ||
| 1328 | as null. | ||
| 1329 | |||
| 1330 | Return t if the parameter is successfully set. Otherwise return nil. */) | ||
| 1331 | (apple_event, keyword, descriptor) | ||
| 1332 | Lisp_Object apple_event, keyword, descriptor; | ||
| 1333 | { | ||
| 1334 | Lisp_Object result = Qnil; | ||
| 1335 | UInt32 suspension_id; | ||
| 1336 | struct suspended_ae_info *p; | ||
| 1337 | |||
| 1338 | suspension_id = get_suspension_id (apple_event); | ||
| 1339 | |||
| 1340 | CHECK_STRING (keyword); | ||
| 1341 | if (SBYTES (keyword) != 4) | ||
| 1342 | error ("Apple event keyword must be a 4-byte string: %s", | ||
| 1343 | SDATA (keyword)); | ||
| 1344 | |||
| 1345 | BLOCK_INPUT; | ||
| 1346 | for (p = suspended_apple_events; p; p = p->next) | ||
| 1347 | if (p->suspension_id == suspension_id) | ||
| 1348 | break; | ||
| 1349 | if (p && p->reply.descriptorType != typeNull) | ||
| 1350 | { | ||
| 1351 | OSErr err; | ||
| 1352 | |||
| 1353 | err = mac_ae_put_lisp (&p->reply, | ||
| 1354 | EndianU32_BtoN (*((UInt32 *) SDATA (keyword))), | ||
| 1355 | descriptor); | ||
| 1356 | if (err == noErr) | ||
| 1357 | result = Qt; | ||
| 1358 | } | ||
| 1359 | UNBLOCK_INPUT; | ||
| 1360 | |||
| 1361 | return result; | ||
| 1362 | } | ||
| 1363 | |||
| 1364 | DEFUN ("mac-resume-apple-event", Fmac_resume_apple_event, Smac_resume_apple_event, 1, 2, 0, | ||
| 1365 | doc: /* Resume handling of APPLE-EVENT. | ||
| 1366 | Every Apple event handled by the Lisp interpreter is suspended first. | ||
| 1367 | This function resumes such a suspended event either to complete Apple | ||
| 1368 | event handling to give a reply, or to redispatch it to other handlers. | ||
| 1369 | |||
| 1370 | If optional ERROR-CODE is an integer, it specifies the error number | ||
| 1371 | that is set in the reply. If ERROR-CODE is t, the resumed event is | ||
| 1372 | handled with the standard dispatching mechanism, but it is not handled | ||
| 1373 | by Emacs again, thus it is redispatched to other handlers. | ||
| 1374 | |||
| 1375 | Return t if APPLE-EVENT is successfully resumed. Otherwise return | ||
| 1376 | nil, which means the event is already resumed or expired. */) | ||
| 1377 | (apple_event, error_code) | ||
| 1378 | Lisp_Object apple_event, error_code; | ||
| 1379 | { | ||
| 1380 | Lisp_Object result = Qnil; | ||
| 1381 | UInt32 suspension_id; | ||
| 1382 | struct suspended_ae_info **p, *ae; | ||
| 1383 | |||
| 1384 | suspension_id = get_suspension_id (apple_event); | ||
| 1385 | |||
| 1386 | BLOCK_INPUT; | ||
| 1387 | for (p = &suspended_apple_events; *p; p = &(*p)->next) | ||
| 1388 | if ((*p)->suspension_id == suspension_id) | ||
| 1389 | break; | ||
| 1390 | if (*p) | ||
| 1391 | { | ||
| 1392 | ae = *p; | ||
| 1393 | *p = (*p)->next; | ||
| 1394 | if (INTEGERP (error_code) | ||
| 1395 | && ae->apple_event.descriptorType != typeNull) | ||
| 1396 | { | ||
| 1397 | SInt32 errn = XINT (error_code); | ||
| 1398 | |||
| 1399 | AEPutParamPtr (&ae->reply, keyErrorNumber, typeSInt32, | ||
| 1400 | &errn, sizeof (SInt32)); | ||
| 1401 | } | ||
| 1402 | AESetTheCurrentEvent (&ae->apple_event); | ||
| 1403 | AEResumeTheCurrentEvent (&ae->apple_event, &ae->reply, | ||
| 1404 | ((AEEventHandlerUPP) | ||
| 1405 | (EQ (error_code, Qt) ? | ||
| 1406 | kAEUseStandardDispatch : kAENoDispatch)), | ||
| 1407 | 0); | ||
| 1408 | AEDisposeDesc (&ae->reply); | ||
| 1409 | AEDisposeDesc (&ae->apple_event); | ||
| 1410 | xfree (ae); | ||
| 1140 | result = Qt; | 1411 | result = Qt; |
| 1141 | } | 1412 | } |
| 1142 | UNBLOCK_INPUT; | 1413 | UNBLOCK_INPUT; |
| @@ -1145,6 +1416,9 @@ DEFUN ("mac-process-deferred-apple-events", Fmac_process_deferred_apple_events, | |||
| 1145 | } | 1416 | } |
| 1146 | 1417 | ||
| 1147 | 1418 | ||
| 1419 | /*********************************************************************** | ||
| 1420 | Drag and drop support | ||
| 1421 | ***********************************************************************/ | ||
| 1148 | #if TARGET_API_MAC_CARBON | 1422 | #if TARGET_API_MAC_CARBON |
| 1149 | static Lisp_Object Vmac_dnd_known_types; | 1423 | static Lisp_Object Vmac_dnd_known_types; |
| 1150 | static pascal OSErr mac_do_track_drag P_ ((DragTrackingMessage, WindowRef, | 1424 | static pascal OSErr mac_do_track_drag P_ ((DragTrackingMessage, WindowRef, |
| @@ -1337,6 +1611,9 @@ remove_drag_handler (window) | |||
| 1337 | } | 1611 | } |
| 1338 | 1612 | ||
| 1339 | 1613 | ||
| 1614 | /*********************************************************************** | ||
| 1615 | Services menu support | ||
| 1616 | ***********************************************************************/ | ||
| 1340 | #ifdef MAC_OSX | 1617 | #ifdef MAC_OSX |
| 1341 | void | 1618 | void |
| 1342 | init_service_handler () | 1619 | init_service_handler () |
| @@ -1554,6 +1831,9 @@ syms_of_macselect () | |||
| 1554 | defsubr (&Sx_selection_owner_p); | 1831 | defsubr (&Sx_selection_owner_p); |
| 1555 | defsubr (&Sx_selection_exists_p); | 1832 | defsubr (&Sx_selection_exists_p); |
| 1556 | defsubr (&Smac_process_deferred_apple_events); | 1833 | defsubr (&Smac_process_deferred_apple_events); |
| 1834 | defsubr (&Smac_cleanup_expired_apple_events); | ||
| 1835 | defsubr (&Smac_resume_apple_event); | ||
| 1836 | defsubr (&Smac_ae_set_reply_parameter); | ||
| 1557 | 1837 | ||
| 1558 | Vselection_alist = Qnil; | 1838 | Vselection_alist = Qnil; |
| 1559 | staticpro (&Vselection_alist); | 1839 | staticpro (&Vselection_alist); |
| @@ -1635,6 +1915,9 @@ The types are chosen in the order they appear in the list. */); | |||
| 1635 | 1915 | ||
| 1636 | Qmac_apple_event_id = intern ("mac-apple-event-id"); | 1916 | Qmac_apple_event_id = intern ("mac-apple-event-id"); |
| 1637 | staticpro (&Qmac_apple_event_id); | 1917 | staticpro (&Qmac_apple_event_id); |
| 1918 | |||
| 1919 | Qemacs_suspension_id = intern ("emacs-suspension-id"); | ||
| 1920 | staticpro (&Qemacs_suspension_id); | ||
| 1638 | } | 1921 | } |
| 1639 | 1922 | ||
| 1640 | /* arch-tag: f3c91ad8-99e0-4bd6-9eef-251b2f848732 | 1923 | /* arch-tag: f3c91ad8-99e0-4bd6-9eef-251b2f848732 |
diff --git a/src/macterm.c b/src/macterm.c index e793e5d04f0..b0765069277 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -3529,19 +3529,28 @@ x_draw_stretch_glyph_string (s) | |||
| 3529 | { | 3529 | { |
| 3530 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor | 3530 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor |
| 3531 | as wide as the stretch glyph. */ | 3531 | as wide as the stretch glyph. */ |
| 3532 | int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width); | 3532 | int width, background_width = s->background_width; |
| 3533 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | ||
| 3534 | |||
| 3535 | if (x < left_x) | ||
| 3536 | { | ||
| 3537 | background_width -= left_x - x; | ||
| 3538 | x = left_x; | ||
| 3539 | } | ||
| 3540 | width = min (FRAME_COLUMN_WIDTH (s->f), background_width); | ||
| 3533 | 3541 | ||
| 3534 | /* Draw cursor. */ | 3542 | /* Draw cursor. */ |
| 3535 | x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); | 3543 | x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); |
| 3536 | 3544 | ||
| 3537 | /* Clear rest using the GC of the original non-cursor face. */ | 3545 | /* Clear rest using the GC of the original non-cursor face. */ |
| 3538 | if (width < s->background_width) | 3546 | if (width < background_width) |
| 3539 | { | 3547 | { |
| 3540 | int x = s->x + width, y = s->y; | 3548 | int y = s->y; |
| 3541 | int w = s->background_width - width, h = s->height; | 3549 | int w = background_width - width, h = s->height; |
| 3542 | Rect r; | 3550 | Rect r; |
| 3543 | GC gc; | 3551 | GC gc; |
| 3544 | 3552 | ||
| 3553 | x += width; | ||
| 3545 | if (s->row->mouse_face_p | 3554 | if (s->row->mouse_face_p |
| 3546 | && cursor_in_mouse_face_p (s->w)) | 3555 | && cursor_in_mouse_face_p (s->w)) |
| 3547 | { | 3556 | { |
| @@ -3568,8 +3577,18 @@ x_draw_stretch_glyph_string (s) | |||
| 3568 | } | 3577 | } |
| 3569 | } | 3578 | } |
| 3570 | else if (!s->background_filled_p) | 3579 | else if (!s->background_filled_p) |
| 3571 | x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, | 3580 | { |
| 3572 | s->height); | 3581 | int background_width = s->background_width; |
| 3582 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | ||
| 3583 | |||
| 3584 | if (x < left_x) | ||
| 3585 | { | ||
| 3586 | background_width -= left_x - x; | ||
| 3587 | x = left_x; | ||
| 3588 | } | ||
| 3589 | if (background_width > 0) | ||
| 3590 | x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); | ||
| 3591 | } | ||
| 3573 | 3592 | ||
| 3574 | s->background_filled_p = 1; | 3593 | s->background_filled_p = 1; |
| 3575 | } | 3594 | } |
| @@ -5396,8 +5415,7 @@ x_draw_hollow_cursor (w, row) | |||
| 5396 | return; | 5415 | return; |
| 5397 | 5416 | ||
| 5398 | /* Compute frame-relative coordinates for phys cursor. */ | 5417 | /* Compute frame-relative coordinates for phys cursor. */ |
| 5399 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 5418 | get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h); |
| 5400 | y = get_phys_cursor_geometry (w, row, cursor_glyph, &h); | ||
| 5401 | wd = w->phys_cursor_width; | 5419 | wd = w->phys_cursor_width; |
| 5402 | 5420 | ||
| 5403 | /* The foreground of cursor_gc is typically the same as the normal | 5421 | /* The foreground of cursor_gc is typically the same as the normal |
| @@ -6116,6 +6134,7 @@ mac_handle_visibility_change (f) | |||
| 6116 | EVENT_INIT (buf); | 6134 | EVENT_INIT (buf); |
| 6117 | buf.kind = DEICONIFY_EVENT; | 6135 | buf.kind = DEICONIFY_EVENT; |
| 6118 | XSETFRAME (buf.frame_or_window, f); | 6136 | XSETFRAME (buf.frame_or_window, f); |
| 6137 | buf.arg = Qnil; | ||
| 6119 | kbd_buffer_store_event (&buf); | 6138 | kbd_buffer_store_event (&buf); |
| 6120 | } | 6139 | } |
| 6121 | else if (! NILP (Vframe_list) && ! NILP (XCDR (Vframe_list))) | 6140 | else if (! NILP (Vframe_list) && ! NILP (XCDR (Vframe_list))) |
| @@ -6129,6 +6148,7 @@ mac_handle_visibility_change (f) | |||
| 6129 | EVENT_INIT (buf); | 6148 | EVENT_INIT (buf); |
| 6130 | buf.kind = ICONIFY_EVENT; | 6149 | buf.kind = ICONIFY_EVENT; |
| 6131 | XSETFRAME (buf.frame_or_window, f); | 6150 | XSETFRAME (buf.frame_or_window, f); |
| 6151 | buf.arg = Qnil; | ||
| 6132 | kbd_buffer_store_event (&buf); | 6152 | kbd_buffer_store_event (&buf); |
| 6133 | } | 6153 | } |
| 6134 | 6154 | ||
| @@ -8320,6 +8340,26 @@ x_find_ccl_program (fontp) | |||
| 8320 | } | 8340 | } |
| 8321 | 8341 | ||
| 8322 | #if USE_MAC_FONT_PANEL | 8342 | #if USE_MAC_FONT_PANEL |
| 8343 | /* Whether Font Panel has been shown before. The first call to font | ||
| 8344 | panel functions (FPIsFontPanelVisible, SetFontInfoForSelection) is | ||
| 8345 | slow. This variable is used for deferring such a call as much as | ||
| 8346 | possible. */ | ||
| 8347 | static int font_panel_shown_p = 0; | ||
| 8348 | |||
| 8349 | int | ||
| 8350 | mac_font_panel_visible_p () | ||
| 8351 | { | ||
| 8352 | return font_panel_shown_p && FPIsFontPanelVisible (); | ||
| 8353 | } | ||
| 8354 | |||
| 8355 | OSStatus | ||
| 8356 | mac_show_hide_font_panel () | ||
| 8357 | { | ||
| 8358 | font_panel_shown_p = 1; | ||
| 8359 | |||
| 8360 | return FPShowHideFontPanel (); | ||
| 8361 | } | ||
| 8362 | |||
| 8323 | OSStatus | 8363 | OSStatus |
| 8324 | mac_set_font_info_for_selection (f, face_id, c) | 8364 | mac_set_font_info_for_selection (f, face_id, c) |
| 8325 | struct frame *f; | 8365 | struct frame *f; |
| @@ -8329,6 +8369,9 @@ mac_set_font_info_for_selection (f, face_id, c) | |||
| 8329 | EventTargetRef target = NULL; | 8369 | EventTargetRef target = NULL; |
| 8330 | XFontStruct *font = NULL; | 8370 | XFontStruct *font = NULL; |
| 8331 | 8371 | ||
| 8372 | if (!mac_font_panel_visible_p ()) | ||
| 8373 | return noErr; | ||
| 8374 | |||
| 8332 | if (f) | 8375 | if (f) |
| 8333 | { | 8376 | { |
| 8334 | target = GetWindowEventTarget (FRAME_MAC_WINDOW (f)); | 8377 | target = GetWindowEventTarget (FRAME_MAC_WINDOW (f)); |
| @@ -8463,6 +8506,13 @@ static Lisp_Object Qtoolbar_switch_mode; | |||
| 8463 | extern Lisp_Object Qfont; | 8506 | extern Lisp_Object Qfont; |
| 8464 | static Lisp_Object Qpanel_closed, Qselection; | 8507 | static Lisp_Object Qpanel_closed, Qselection; |
| 8465 | #endif | 8508 | #endif |
| 8509 | #if USE_MAC_TSM | ||
| 8510 | static TSMDocumentID tsm_document_id; | ||
| 8511 | static Lisp_Object Qtext_input; | ||
| 8512 | static Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event; | ||
| 8513 | static Lisp_Object Vmac_ts_active_input_overlay; | ||
| 8514 | extern Lisp_Object Qbefore_string; | ||
| 8515 | #endif | ||
| 8466 | #endif | 8516 | #endif |
| 8467 | extern int mac_ready_for_apple_events; | 8517 | extern int mac_ready_for_apple_events; |
| 8468 | extern Lisp_Object Qundefined; | 8518 | extern Lisp_Object Qundefined; |
| @@ -8814,13 +8864,17 @@ is_emacs_window (WindowPtr win) | |||
| 8814 | static void | 8864 | static void |
| 8815 | do_app_resume () | 8865 | do_app_resume () |
| 8816 | { | 8866 | { |
| 8817 | /* Window-activate events will do the job. */ | 8867 | #if USE_MAC_TSM |
| 8868 | ActivateTSMDocument (tsm_document_id); | ||
| 8869 | #endif | ||
| 8818 | } | 8870 | } |
| 8819 | 8871 | ||
| 8820 | static void | 8872 | static void |
| 8821 | do_app_suspend () | 8873 | do_app_suspend () |
| 8822 | { | 8874 | { |
| 8823 | /* Window-deactivate events will do the job. */ | 8875 | #if USE_MAC_TSM |
| 8876 | DeactivateTSMDocument (tsm_document_id); | ||
| 8877 | #endif | ||
| 8824 | } | 8878 | } |
| 8825 | 8879 | ||
| 8826 | 8880 | ||
| @@ -9080,6 +9134,9 @@ mac_store_event_ref_as_apple_event (class, id, class_key, id_key, | |||
| 9080 | { | 9134 | { |
| 9081 | mac_store_apple_event (class_key, id_key, &apple_event); | 9135 | mac_store_apple_event (class_key, id_key, &apple_event); |
| 9082 | AEDisposeDesc (&apple_event); | 9136 | AEDisposeDesc (&apple_event); |
| 9137 | /* Post a harmless event so as to wake up from | ||
| 9138 | ReceiveNextEvent. */ | ||
| 9139 | mac_post_mouse_moved_event (); | ||
| 9083 | } | 9140 | } |
| 9084 | } | 9141 | } |
| 9085 | } | 9142 | } |
| @@ -9269,6 +9326,18 @@ mac_handle_window_event (next_handler, event, data) | |||
| 9269 | } | 9326 | } |
| 9270 | return err == noErr ? noErr : result; | 9327 | return err == noErr ? noErr : result; |
| 9271 | #endif | 9328 | #endif |
| 9329 | |||
| 9330 | #if USE_MAC_TSM | ||
| 9331 | case kEventWindowFocusAcquired: | ||
| 9332 | result = CallNextEventHandler (next_handler, event); | ||
| 9333 | err = ActivateTSMDocument (tsm_document_id); | ||
| 9334 | return err == noErr ? noErr : result; | ||
| 9335 | |||
| 9336 | case kEventWindowFocusRelinquish: | ||
| 9337 | result = CallNextEventHandler (next_handler, event); | ||
| 9338 | err = DeactivateTSMDocument (tsm_document_id); | ||
| 9339 | return err == noErr ? noErr : result; | ||
| 9340 | #endif | ||
| 9272 | } | 9341 | } |
| 9273 | 9342 | ||
| 9274 | return eventNotHandledErr; | 9343 | return eventNotHandledErr; |
| @@ -9395,6 +9464,183 @@ mac_handle_font_event (next_handler, event, data) | |||
| 9395 | } | 9464 | } |
| 9396 | #endif | 9465 | #endif |
| 9397 | 9466 | ||
| 9467 | #if USE_MAC_TSM | ||
| 9468 | static pascal OSStatus | ||
| 9469 | mac_handle_text_input_event (next_handler, event, data) | ||
| 9470 | EventHandlerCallRef next_handler; | ||
| 9471 | EventRef event; | ||
| 9472 | void *data; | ||
| 9473 | { | ||
| 9474 | OSStatus result, err = noErr; | ||
| 9475 | Lisp_Object id_key = Qnil; | ||
| 9476 | int num_params; | ||
| 9477 | EventParamName *names; | ||
| 9478 | EventParamType *types; | ||
| 9479 | static UInt32 seqno_uaia = 0; | ||
| 9480 | static EventParamName names_uaia[] = | ||
| 9481 | {kEventParamTextInputSendComponentInstance, | ||
| 9482 | kEventParamTextInputSendRefCon, | ||
| 9483 | kEventParamTextInputSendSLRec, | ||
| 9484 | kEventParamTextInputSendFixLen, | ||
| 9485 | kEventParamTextInputSendText, | ||
| 9486 | kEventParamTextInputSendUpdateRng, | ||
| 9487 | kEventParamTextInputSendHiliteRng, | ||
| 9488 | kEventParamTextInputSendClauseRng, | ||
| 9489 | kEventParamTextInputSendPinRng, | ||
| 9490 | kEventParamTextInputSendTextServiceEncoding, | ||
| 9491 | kEventParamTextInputSendTextServiceMacEncoding, | ||
| 9492 | EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER}; | ||
| 9493 | static EventParamType types_uaia[] = | ||
| 9494 | {typeComponentInstance, | ||
| 9495 | typeLongInteger, | ||
| 9496 | typeIntlWritingCode, | ||
| 9497 | typeLongInteger, | ||
| 9498 | typeUnicodeText, | ||
| 9499 | typeTextRangeArray, | ||
| 9500 | typeTextRangeArray, | ||
| 9501 | typeOffsetArray, | ||
| 9502 | typeTextRange, | ||
| 9503 | typeUInt32, | ||
| 9504 | typeUInt32, | ||
| 9505 | typeUInt32}; | ||
| 9506 | static EventParamName names_ufke[] = | ||
| 9507 | {kEventParamTextInputSendComponentInstance, | ||
| 9508 | kEventParamTextInputSendRefCon, | ||
| 9509 | kEventParamTextInputSendSLRec, | ||
| 9510 | kEventParamTextInputSendText}; | ||
| 9511 | static EventParamType types_ufke[] = | ||
| 9512 | {typeComponentInstance, | ||
| 9513 | typeLongInteger, | ||
| 9514 | typeIntlWritingCode, | ||
| 9515 | typeUnicodeText}; | ||
| 9516 | |||
| 9517 | result = CallNextEventHandler (next_handler, event); | ||
| 9518 | |||
| 9519 | switch (GetEventKind (event)) | ||
| 9520 | { | ||
| 9521 | case kEventTextInputUpdateActiveInputArea: | ||
| 9522 | id_key = Qupdate_active_input_area; | ||
| 9523 | num_params = sizeof (names_uaia) / sizeof (names_uaia[0]); | ||
| 9524 | names = names_uaia; | ||
| 9525 | types = types_uaia; | ||
| 9526 | SetEventParameter (event, EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER, | ||
| 9527 | typeUInt32, sizeof (UInt32), &seqno_uaia); | ||
| 9528 | seqno_uaia++; | ||
| 9529 | break; | ||
| 9530 | |||
| 9531 | case kEventTextInputUnicodeForKeyEvent: | ||
| 9532 | { | ||
| 9533 | EventRef kbd_event; | ||
| 9534 | UInt32 actual_size, modifiers, mapped_modifiers; | ||
| 9535 | UniChar code; | ||
| 9536 | |||
| 9537 | err = GetEventParameter (event, kEventParamTextInputSendKeyboardEvent, | ||
| 9538 | typeEventRef, NULL, sizeof (EventRef), NULL, | ||
| 9539 | &kbd_event); | ||
| 9540 | if (err == noErr) | ||
| 9541 | err = GetEventParameter (kbd_event, kEventParamKeyModifiers, | ||
| 9542 | typeUInt32, NULL, | ||
| 9543 | sizeof (UInt32), NULL, &modifiers); | ||
| 9544 | if (err == noErr) | ||
| 9545 | { | ||
| 9546 | mapped_modifiers = | ||
| 9547 | (NILP (Vmac_control_modifier) ? 0 : controlKey) | ||
| 9548 | | (NILP (Vmac_option_modifier) ? 0 : optionKey) | ||
| 9549 | | (NILP (Vmac_command_modifier) ? 0 : cmdKey); | ||
| 9550 | #ifdef MAC_OSX | ||
| 9551 | mapped_modifiers |= | ||
| 9552 | (NILP (Vmac_function_modifier) ? 0 : kEventKeyModifierFnMask); | ||
| 9553 | #endif | ||
| 9554 | if (modifiers & mapped_modifiers) | ||
| 9555 | /* There're mapped modifier keys. Process it in | ||
| 9556 | XTread_socket. */ | ||
| 9557 | return eventNotHandledErr; | ||
| 9558 | } | ||
| 9559 | if (err == noErr) | ||
| 9560 | err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, | ||
| 9561 | typeUnicodeText, NULL, 0, &actual_size, | ||
| 9562 | NULL); | ||
| 9563 | if (err == noErr) | ||
| 9564 | { | ||
| 9565 | if (actual_size == sizeof (UniChar)) | ||
| 9566 | err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, | ||
| 9567 | typeUnicodeText, NULL, | ||
| 9568 | sizeof (UniChar), NULL, &code); | ||
| 9569 | if (err == noErr && code < 0x80) | ||
| 9570 | { | ||
| 9571 | /* ASCII character. Process it in XTread_socket. */ | ||
| 9572 | if (read_socket_inev && code >= 0x20 && code <= 0x7e) | ||
| 9573 | { | ||
| 9574 | struct frame *f = mac_focus_frame (&one_mac_display_info); | ||
| 9575 | |||
| 9576 | read_socket_inev->kind = ASCII_KEYSTROKE_EVENT; | ||
| 9577 | read_socket_inev->code = code; | ||
| 9578 | read_socket_inev->modifiers = | ||
| 9579 | (extra_keyboard_modifiers | ||
| 9580 | & (meta_modifier | alt_modifier | ||
| 9581 | | hyper_modifier | super_modifier)); | ||
| 9582 | XSETFRAME (read_socket_inev->frame_or_window, f); | ||
| 9583 | } | ||
| 9584 | return eventNotHandledErr; | ||
| 9585 | } | ||
| 9586 | } | ||
| 9587 | } | ||
| 9588 | /* Non-ASCII keystrokes without mapped modifiers are processed | ||
| 9589 | at the Lisp level. */ | ||
| 9590 | id_key = Qunicode_for_key_event; | ||
| 9591 | num_params = sizeof (names_ufke) / sizeof (names_ufke[0]); | ||
| 9592 | names = names_ufke; | ||
| 9593 | types = types_ufke; | ||
| 9594 | break; | ||
| 9595 | |||
| 9596 | case kEventTextInputOffsetToPos: | ||
| 9597 | { | ||
| 9598 | struct frame *f; | ||
| 9599 | struct window *w; | ||
| 9600 | Point p; | ||
| 9601 | |||
| 9602 | if (!OVERLAYP (Vmac_ts_active_input_overlay)) | ||
| 9603 | return eventNotHandledErr; | ||
| 9604 | |||
| 9605 | /* Strictly speaking, this is not always correct because | ||
| 9606 | previous events may change some states about display. */ | ||
| 9607 | if (NILP (Foverlay_get (Vmac_ts_active_input_overlay, Qbefore_string))) | ||
| 9608 | { | ||
| 9609 | /* Active input area is displayed in the echo area. */ | ||
| 9610 | w = XWINDOW (echo_area_window); | ||
| 9611 | f = WINDOW_XFRAME (w); | ||
| 9612 | } | ||
| 9613 | else | ||
| 9614 | { | ||
| 9615 | /* Active input area is displayed around the current point. */ | ||
| 9616 | f = SELECTED_FRAME (); | ||
| 9617 | w = XWINDOW (f->selected_window); | ||
| 9618 | } | ||
| 9619 | |||
| 9620 | p.h = (WINDOW_TO_FRAME_PIXEL_X (w, w->cursor.x) | ||
| 9621 | + WINDOW_LEFT_FRINGE_WIDTH (w)); | ||
| 9622 | p.v = (WINDOW_TO_FRAME_PIXEL_Y (w, w->cursor.y) | ||
| 9623 | + FONT_BASE (FRAME_FONT (f))); | ||
| 9624 | SetPortWindowPort (FRAME_MAC_WINDOW (f)); | ||
| 9625 | LocalToGlobal (&p); | ||
| 9626 | err = SetEventParameter (event, kEventParamTextInputReplyPoint, | ||
| 9627 | typeQDPoint, sizeof (typeQDPoint), &p); | ||
| 9628 | } | ||
| 9629 | break; | ||
| 9630 | |||
| 9631 | default: | ||
| 9632 | abort (); | ||
| 9633 | } | ||
| 9634 | |||
| 9635 | if (!NILP (id_key)) | ||
| 9636 | err = mac_store_event_ref_as_apple_event (0, 0, Qtext_input, id_key, | ||
| 9637 | event, num_params, | ||
| 9638 | names, types); | ||
| 9639 | |||
| 9640 | return err == noErr ? noErr : result; | ||
| 9641 | } | ||
| 9642 | #endif | ||
| 9643 | |||
| 9398 | #ifdef MAC_OSX | 9644 | #ifdef MAC_OSX |
| 9399 | OSStatus | 9645 | OSStatus |
| 9400 | mac_store_service_event (event) | 9646 | mac_store_service_event (event) |
| @@ -9456,6 +9702,10 @@ install_window_handler (window) | |||
| 9456 | #ifdef MAC_OSX | 9702 | #ifdef MAC_OSX |
| 9457 | {kEventClassWindow, kEventWindowToolbarSwitchMode}, | 9703 | {kEventClassWindow, kEventWindowToolbarSwitchMode}, |
| 9458 | #endif | 9704 | #endif |
| 9705 | #if USE_MAC_TSM | ||
| 9706 | {kEventClassWindow, kEventWindowFocusAcquired}, | ||
| 9707 | {kEventClassWindow, kEventWindowFocusRelinquish}, | ||
| 9708 | #endif | ||
| 9459 | }; | 9709 | }; |
| 9460 | EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; | 9710 | EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; |
| 9461 | static EventHandlerUPP handle_window_eventUPP = NULL; | 9711 | static EventHandlerUPP handle_window_eventUPP = NULL; |
| @@ -9465,6 +9715,13 @@ install_window_handler (window) | |||
| 9465 | {kEventClassFont, kEventFontSelection}}; | 9715 | {kEventClassFont, kEventFontSelection}}; |
| 9466 | static EventHandlerUPP handle_font_eventUPP = NULL; | 9716 | static EventHandlerUPP handle_font_eventUPP = NULL; |
| 9467 | #endif | 9717 | #endif |
| 9718 | #if USE_MAC_TSM | ||
| 9719 | EventTypeSpec specs_text_input[] = | ||
| 9720 | {{kEventClassTextInput, kEventTextInputUpdateActiveInputArea}, | ||
| 9721 | {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent}, | ||
| 9722 | {kEventClassTextInput, kEventTextInputOffsetToPos}}; | ||
| 9723 | static EventHandlerUPP handle_text_input_eventUPP = NULL; | ||
| 9724 | #endif | ||
| 9468 | 9725 | ||
| 9469 | if (handle_window_eventUPP == NULL) | 9726 | if (handle_window_eventUPP == NULL) |
| 9470 | handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event); | 9727 | handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event); |
| @@ -9474,6 +9731,11 @@ install_window_handler (window) | |||
| 9474 | if (handle_font_eventUPP == NULL) | 9731 | if (handle_font_eventUPP == NULL) |
| 9475 | handle_font_eventUPP = NewEventHandlerUPP (mac_handle_font_event); | 9732 | handle_font_eventUPP = NewEventHandlerUPP (mac_handle_font_event); |
| 9476 | #endif | 9733 | #endif |
| 9734 | #if USE_MAC_TSM | ||
| 9735 | if (handle_text_input_eventUPP == NULL) | ||
| 9736 | handle_text_input_eventUPP = | ||
| 9737 | NewEventHandlerUPP (mac_handle_text_input_event); | ||
| 9738 | #endif | ||
| 9477 | err = InstallWindowEventHandler (window, handle_window_eventUPP, | 9739 | err = InstallWindowEventHandler (window, handle_window_eventUPP, |
| 9478 | GetEventTypeCount (specs_window), | 9740 | GetEventTypeCount (specs_window), |
| 9479 | specs_window, NULL, NULL); | 9741 | specs_window, NULL, NULL); |
| @@ -9487,6 +9749,12 @@ install_window_handler (window) | |||
| 9487 | GetEventTypeCount (specs_font), | 9749 | GetEventTypeCount (specs_font), |
| 9488 | specs_font, NULL, NULL); | 9750 | specs_font, NULL, NULL); |
| 9489 | #endif | 9751 | #endif |
| 9752 | #if USE_MAC_TSM | ||
| 9753 | if (err == noErr) | ||
| 9754 | err = InstallWindowEventHandler (window, handle_text_input_eventUPP, | ||
| 9755 | GetEventTypeCount (specs_text_input), | ||
| 9756 | specs_text_input, window, NULL); | ||
| 9757 | #endif | ||
| 9490 | #endif | 9758 | #endif |
| 9491 | if (err == noErr) | 9759 | if (err == noErr) |
| 9492 | err = install_drag_handler (window); | 9760 | err = install_drag_handler (window); |
| @@ -9612,7 +9880,7 @@ static unsigned char keycode_to_xkeysym_table[] = { | |||
| 9612 | 9880 | ||
| 9613 | /*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/, | 9881 | /*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/, |
| 9614 | /*0x64*/ 0xc5 /*f8*/, 0xc6 /*f9*/, 0, 0xc8 /*f11*/, | 9882 | /*0x64*/ 0xc5 /*f8*/, 0xc6 /*f9*/, 0, 0xc8 /*f11*/, |
| 9615 | /*0x68*/ 0, 0xca /*f13*/, 0, 0xcb /*f14*/, | 9883 | /*0x68*/ 0, 0xca /*f13*/, 0xcd /*f16*/, 0xcb /*f14*/, |
| 9616 | /*0x6C*/ 0, 0xc7 /*f10*/, 0x0a /*fn+enter on laptops*/, 0xc9 /*f12*/, | 9884 | /*0x6C*/ 0, 0xc7 /*f10*/, 0x0a /*fn+enter on laptops*/, 0xc9 /*f12*/, |
| 9617 | 9885 | ||
| 9618 | /*0x70*/ 0, 0xcc /*f15*/, 0x6a /*help*/, 0x50 /*home*/, | 9886 | /*0x70*/ 0, 0xcc /*f15*/, 0x6a /*help*/, 0x50 /*home*/, |
| @@ -9632,8 +9900,9 @@ keycode_to_xkeysym (int keyCode, int *xKeySym) | |||
| 9632 | #ifdef MAC_OSX | 9900 | #ifdef MAC_OSX |
| 9633 | /* Table for translating Mac keycode with the laptop `fn' key to that | 9901 | /* Table for translating Mac keycode with the laptop `fn' key to that |
| 9634 | without it. Destination symbols in comments are keys on US | 9902 | without it. Destination symbols in comments are keys on US |
| 9635 | keyboard, and they may not be the same on other types of | 9903 | keyboard, and they may not be the same on other types of keyboards. |
| 9636 | keyboards. */ | 9904 | If the destination is identical to the source (f1 ... f12), it |
| 9905 | doesn't map `fn' key to a modifier. */ | ||
| 9637 | static unsigned char fn_keycode_to_keycode_table[] = { | 9906 | static unsigned char fn_keycode_to_keycode_table[] = { |
| 9638 | /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 9907 | /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 9639 | /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 9908 | /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| @@ -9654,14 +9923,14 @@ static unsigned char fn_keycode_to_keycode_table[] = { | |||
| 9654 | /*0x58*/ 0x1f /*kp-6 -> 'o'*/, 0x1a /*kp-7 -> '7'*/, 0, 0x1c /*kp-8 -> '8'*/, | 9923 | /*0x58*/ 0x1f /*kp-6 -> 'o'*/, 0x1a /*kp-7 -> '7'*/, 0, 0x1c /*kp-8 -> '8'*/, |
| 9655 | /*0x5C*/ 0x19 /*kp-9 -> '9'*/, 0, 0, 0, | 9924 | /*0x5C*/ 0x19 /*kp-9 -> '9'*/, 0, 0, 0, |
| 9656 | 9925 | ||
| 9657 | /*0x60*/ 0, 0, 0, 0, | 9926 | /*0x60*/ 0x60 /*f5 = f5*/, 0x61 /*f6 = f6*/, 0x62 /*f7 = f7*/, 0x63 /*f3 = f3*/, |
| 9658 | /*0x64*/ 0, 0, 0, 0, | 9927 | /*0x64*/ 0x64 /*f8 = f8*/, 0x65 /*f9 = f9*/, 0, 0x67 /*f11 = f11*/, |
| 9659 | /*0x68*/ 0, 0, 0, 0, | 9928 | /*0x68*/ 0, 0, 0, 0, |
| 9660 | /*0x6C*/ 0, 0, 0, 0, | 9929 | /*0x6C*/ 0, 0x6d /*f10 = f10*/, 0, 0x6f /*f12 = f12*/, |
| 9661 | 9930 | ||
| 9662 | /*0x70*/ 0, 0, 0, 0x7b /*home -> left*/, | 9931 | /*0x70*/ 0, 0, 0, 0x7b /*home -> left*/, |
| 9663 | /*0x74*/ 0x7e /*pgup -> up*/, 0x33 /*delete -> backspace*/, 0, 0x7c /*end -> right*/, | 9932 | /*0x74*/ 0x7e /*pgup -> up*/, 0x33 /*delete -> backspace*/, 0x76 /*f4 = f4*/, 0x7c /*end -> right*/, |
| 9664 | /*0x78*/ 0, 0x7d /*pgdown -> down*/, 0, 0, | 9933 | /*0x78*/ 0x78 /*f2 = f2*/, 0x7d /*pgdown -> down*/, 0x7a /*f1 = f1*/, 0, |
| 9665 | /*0x7C*/ 0, 0, 0, 0 | 9934 | /*0x7C*/ 0, 0, 0, 0 |
| 9666 | }; | 9935 | }; |
| 9667 | #endif /* MAC_OSX */ | 9936 | #endif /* MAC_OSX */ |
| @@ -9825,10 +10094,6 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9825 | struct frame *f; | 10094 | struct frame *f; |
| 9826 | unsigned long timestamp; | 10095 | unsigned long timestamp; |
| 9827 | 10096 | ||
| 9828 | /* It is necessary to set this (additional) argument slot of an | ||
| 9829 | event to nil because keyboard.c protects incompletely | ||
| 9830 | processed event from being garbage collected by placing them | ||
| 9831 | in the kbd_buffer_gcpro vector. */ | ||
| 9832 | EVENT_INIT (inev); | 10097 | EVENT_INIT (inev); |
| 9833 | inev.kind = NO_EVENT; | 10098 | inev.kind = NO_EVENT; |
| 9834 | inev.arg = Qnil; | 10099 | inev.arg = Qnil; |
| @@ -10311,19 +10576,27 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10311 | GetEventParameter (eventRef, kEventParamKeyModifiers, | 10576 | GetEventParameter (eventRef, kEventParamKeyModifiers, |
| 10312 | typeUInt32, NULL, | 10577 | typeUInt32, NULL, |
| 10313 | sizeof (UInt32), NULL, &modifiers); | 10578 | sizeof (UInt32), NULL, &modifiers); |
| 10579 | #endif | ||
| 10580 | mapped_modifiers &= modifiers; | ||
| 10314 | 10581 | ||
| 10582 | #if USE_CARBON_EVENTS && defined (MAC_OSX) | ||
| 10315 | /* When using Carbon Events, we need to pass raw keyboard | 10583 | /* When using Carbon Events, we need to pass raw keyboard |
| 10316 | events to the TSM ourselves. If TSM handles it, it | 10584 | events to the TSM ourselves. If TSM handles it, it |
| 10317 | will pass back noErr, otherwise it will pass back | 10585 | will pass back noErr, otherwise it will pass back |
| 10318 | "eventNotHandledErr" and we can process it | 10586 | "eventNotHandledErr" and we can process it |
| 10319 | normally. */ | 10587 | normally. */ |
| 10320 | if (!(modifiers | 10588 | if (!(mapped_modifiers |
| 10321 | & mapped_modifiers | ||
| 10322 | & ~(mac_pass_command_to_system ? cmdKey : 0) | 10589 | & ~(mac_pass_command_to_system ? cmdKey : 0) |
| 10323 | & ~(mac_pass_control_to_system ? controlKey : 0))) | 10590 | & ~(mac_pass_control_to_system ? controlKey : 0))) |
| 10324 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) | 10591 | { |
| 10325 | != eventNotHandledErr) | 10592 | OSStatus err; |
| 10593 | |||
| 10594 | read_socket_inev = &inev; | ||
| 10595 | err = SendEventToEventTarget (eventRef, toolbox_dispatcher); | ||
| 10596 | read_socket_inev = NULL; | ||
| 10597 | if (err != eventNotHandledErr) | ||
| 10326 | break; | 10598 | break; |
| 10599 | } | ||
| 10327 | #endif | 10600 | #endif |
| 10328 | if (er.what == keyUp) | 10601 | if (er.what == keyUp) |
| 10329 | break; | 10602 | break; |
| @@ -10354,8 +10627,13 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10354 | last_key_script = current_key_script; | 10627 | last_key_script = current_key_script; |
| 10355 | } | 10628 | } |
| 10356 | 10629 | ||
| 10630 | #if USE_MAC_TSM | ||
| 10631 | if (inev.kind != NO_EVENT) | ||
| 10632 | break; | ||
| 10633 | #endif | ||
| 10634 | |||
| 10357 | #ifdef MAC_OSX | 10635 | #ifdef MAC_OSX |
| 10358 | if (modifiers & kEventKeyModifierFnMask | 10636 | if (mapped_modifiers & kEventKeyModifierFnMask |
| 10359 | && keycode <= 0x7f | 10637 | && keycode <= 0x7f |
| 10360 | && fn_keycode_to_keycode_table[keycode]) | 10638 | && fn_keycode_to_keycode_table[keycode]) |
| 10361 | keycode = fn_keycode_to_keycode_table[keycode]; | 10639 | keycode = fn_keycode_to_keycode_table[keycode]; |
| @@ -10364,8 +10642,14 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10364 | { | 10642 | { |
| 10365 | inev.kind = NON_ASCII_KEYSTROKE_EVENT; | 10643 | inev.kind = NON_ASCII_KEYSTROKE_EVENT; |
| 10366 | inev.code = 0xff00 | xkeysym; | 10644 | inev.code = 0xff00 | xkeysym; |
| 10645 | #ifdef MAC_OSX | ||
| 10646 | if (modifiers & kEventKeyModifierFnMask | ||
| 10647 | && keycode <= 0x7f | ||
| 10648 | && fn_keycode_to_keycode_table[keycode] == keycode) | ||
| 10649 | modifiers &= ~kEventKeyModifierFnMask; | ||
| 10650 | #endif | ||
| 10367 | } | 10651 | } |
| 10368 | else if (modifiers & mapped_modifiers) | 10652 | else if (mapped_modifiers) |
| 10369 | { | 10653 | { |
| 10370 | /* translate the keycode back to determine the | 10654 | /* translate the keycode back to determine the |
| 10371 | original key */ | 10655 | original key */ |
| @@ -10444,11 +10728,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10444 | inev.code = er.message & charCodeMask; | 10728 | inev.code = er.message & charCodeMask; |
| 10445 | } | 10729 | } |
| 10446 | 10730 | ||
| 10447 | #if USE_CARBON_EVENTS | 10731 | inev.modifiers = mac_to_emacs_modifiers (modifiers); |
| 10448 | inev.modifiers = mac_event_to_emacs_modifiers (eventRef); | ||
| 10449 | #else | ||
| 10450 | inev.modifiers = mac_to_emacs_modifiers (er.modifiers); | ||
| 10451 | #endif | ||
| 10452 | inev.modifiers |= (extra_keyboard_modifiers | 10732 | inev.modifiers |= (extra_keyboard_modifiers |
| 10453 | & (meta_modifier | alt_modifier | 10733 | & (meta_modifier | alt_modifier |
| 10454 | | hyper_modifier | super_modifier)); | 10734 | | hyper_modifier | super_modifier)); |
| @@ -10960,6 +11240,16 @@ init_menu_bar () | |||
| 10960 | #endif | 11240 | #endif |
| 10961 | } | 11241 | } |
| 10962 | 11242 | ||
| 11243 | #if USE_MAC_TSM | ||
| 11244 | static void | ||
| 11245 | init_tsm () | ||
| 11246 | { | ||
| 11247 | static InterfaceTypeList types = {kUnicodeDocument}; | ||
| 11248 | |||
| 11249 | NewTSMDocument (sizeof (types) / sizeof (types[0]), types, | ||
| 11250 | &tsm_document_id, 0); | ||
| 11251 | } | ||
| 11252 | #endif | ||
| 10963 | 11253 | ||
| 10964 | /* Set up use of X before we make the first connection. */ | 11254 | /* Set up use of X before we make the first connection. */ |
| 10965 | 11255 | ||
| @@ -11055,6 +11345,10 @@ mac_initialize () | |||
| 11055 | init_command_handler (); | 11345 | init_command_handler (); |
| 11056 | 11346 | ||
| 11057 | init_menu_bar (); | 11347 | init_menu_bar (); |
| 11348 | |||
| 11349 | #if USE_MAC_TSM | ||
| 11350 | init_tsm (); | ||
| 11351 | #endif | ||
| 11058 | #endif /* USE_CARBON_EVENTS */ | 11352 | #endif /* USE_CARBON_EVENTS */ |
| 11059 | 11353 | ||
| 11060 | #ifdef MAC_OSX | 11354 | #ifdef MAC_OSX |
| @@ -11111,6 +11405,13 @@ syms_of_macterm () | |||
| 11111 | Qpaste = intern ("paste"); staticpro (&Qpaste); | 11405 | Qpaste = intern ("paste"); staticpro (&Qpaste); |
| 11112 | Qperform = intern ("perform"); staticpro (&Qperform); | 11406 | Qperform = intern ("perform"); staticpro (&Qperform); |
| 11113 | #endif | 11407 | #endif |
| 11408 | #if USE_MAC_TSM | ||
| 11409 | Qtext_input = intern ("text-input"); staticpro (&Qtext_input); | ||
| 11410 | Qupdate_active_input_area = intern ("update-active-input-area"); | ||
| 11411 | staticpro (&Qupdate_active_input_area); | ||
| 11412 | Qunicode_for_key_event = intern ("unicode-for-key-event"); | ||
| 11413 | staticpro (&Qunicode_for_key_event); | ||
| 11414 | #endif | ||
| 11114 | #endif | 11415 | #endif |
| 11115 | 11416 | ||
| 11116 | #ifdef MAC_OSX | 11417 | #ifdef MAC_OSX |
| @@ -11253,6 +11554,11 @@ order. */); | |||
| 11253 | make_float (DEFAULT_REHASH_THRESHOLD), | 11554 | make_float (DEFAULT_REHASH_THRESHOLD), |
| 11254 | Qnil, Qnil, Qnil); | 11555 | Qnil, Qnil, Qnil); |
| 11255 | #endif | 11556 | #endif |
| 11557 | #if USE_MAC_TSM | ||
| 11558 | DEFVAR_LISP ("mac-ts-active-input-overlay", &Vmac_ts_active_input_overlay, | ||
| 11559 | doc: /* Overlay used to display Mac TSM active input area. */); | ||
| 11560 | Vmac_ts_active_input_overlay = Qnil; | ||
| 11561 | #endif | ||
| 11256 | } | 11562 | } |
| 11257 | 11563 | ||
| 11258 | /* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b | 11564 | /* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b |
diff --git a/src/macterm.h b/src/macterm.h index abdce7a799e..fd71e36d28d 100644 --- a/src/macterm.h +++ b/src/macterm.h | |||
| @@ -536,6 +536,53 @@ struct scroll_bar { | |||
| 536 | #define HOURGLASS_WIDTH 16 | 536 | #define HOURGLASS_WIDTH 16 |
| 537 | #define HOURGLASS_HEIGHT 16 | 537 | #define HOURGLASS_HEIGHT 16 |
| 538 | 538 | ||
| 539 | /* Some constants that are used locally. */ | ||
| 540 | /* Apple event descriptor types */ | ||
| 541 | enum { | ||
| 542 | TYPE_FILE_NAME = 'fNam' | ||
| 543 | }; | ||
| 544 | |||
| 545 | /* Keywords for Apple event attributes */ | ||
| 546 | enum { | ||
| 547 | KEY_EMACS_SUSPENSION_ID_ATTR = 'esId' /* typeUInt32 */ | ||
| 548 | }; | ||
| 549 | |||
| 550 | /* Carbon event parameter names. */ | ||
| 551 | enum { | ||
| 552 | EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER = 'tsSn' /* typeUInt32 */ | ||
| 553 | }; | ||
| 554 | |||
| 555 | /* Some constants that are not defined in older versions. */ | ||
| 556 | #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 | ||
| 557 | /* Keywords for Apple event attributes */ | ||
| 558 | enum { | ||
| 559 | keyReplyRequestedAttr = 'repq' | ||
| 560 | }; | ||
| 561 | #endif | ||
| 562 | |||
| 563 | #if MAC_OS_X_VERSION_MAX_ALLOWED < 1040 | ||
| 564 | /* Gestalt selectors */ | ||
| 565 | enum { | ||
| 566 | gestaltSystemVersionMajor = 'sys1', | ||
| 567 | gestaltSystemVersionMinor = 'sys2', | ||
| 568 | gestaltSystemVersionBugFix = 'sys3' | ||
| 569 | }; | ||
| 570 | #endif | ||
| 571 | |||
| 572 | #ifdef MAC_OSX | ||
| 573 | #if MAC_OS_X_VERSION_MAX_ALLOWED < 1020 | ||
| 574 | /* Apple event descriptor types */ | ||
| 575 | enum { | ||
| 576 | typeUTF8Text = 'utf8' | ||
| 577 | }; | ||
| 578 | |||
| 579 | /* Carbon event parameter names */ | ||
| 580 | enum { | ||
| 581 | kEventParamWindowMouseLocation = 'wmou' | ||
| 582 | }; | ||
| 583 | #endif | ||
| 584 | #endif | ||
| 585 | |||
| 539 | struct frame; | 586 | struct frame; |
| 540 | struct face; | 587 | struct face; |
| 541 | struct image; | 588 | struct image; |
| @@ -581,6 +628,8 @@ extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int, | |||
| 581 | extern void mac_clear_area P_ ((struct frame *, int, int, | 628 | extern void mac_clear_area P_ ((struct frame *, int, int, |
| 582 | unsigned int, unsigned int)); | 629 | unsigned int, unsigned int)); |
| 583 | extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *)); | 630 | extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *)); |
| 631 | extern int mac_font_panel_visible_p P_ ((void)); | ||
| 632 | extern OSStatus mac_show_hide_font_panel P_ ((void)); | ||
| 584 | extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int)); | 633 | extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int)); |
| 585 | extern OSErr install_window_handler P_ ((WindowPtr)); | 634 | extern OSErr install_window_handler P_ ((WindowPtr)); |
| 586 | extern void remove_window_handler P_ ((WindowPtr)); | 635 | extern void remove_window_handler P_ ((WindowPtr)); |
| @@ -593,8 +642,6 @@ extern void mac_prepare_for_quickdraw P_ ((struct frame *)); | |||
| 593 | #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0 | 642 | #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0 |
| 594 | #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0 | 643 | #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0 |
| 595 | 644 | ||
| 596 | #define TYPE_FILE_NAME 'fNam' | ||
| 597 | |||
| 598 | /* Defined in macselect.c */ | 645 | /* Defined in macselect.c */ |
| 599 | 646 | ||
| 600 | extern void x_clear_frame_selections P_ ((struct frame *)); | 647 | extern void x_clear_frame_selections P_ ((struct frame *)); |
| @@ -612,6 +659,7 @@ extern int x_char_height P_ ((struct frame *)); | |||
| 612 | extern void x_sync P_ ((struct frame *)); | 659 | extern void x_sync P_ ((struct frame *)); |
| 613 | extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 660 | extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 614 | extern void mac_update_title_bar P_ ((struct frame *, int)); | 661 | extern void mac_update_title_bar P_ ((struct frame *, int)); |
| 662 | extern Lisp_Object x_get_focus_frame P_ ((struct frame *)); | ||
| 615 | 663 | ||
| 616 | /* Defined in macmenu.c */ | 664 | /* Defined in macmenu.c */ |
| 617 | 665 | ||
| @@ -622,6 +670,7 @@ extern void free_frame_menubar P_ ((struct frame *)); | |||
| 622 | 670 | ||
| 623 | extern void mac_clear_font_name_table P_ ((void)); | 671 | extern void mac_clear_font_name_table P_ ((void)); |
| 624 | extern Lisp_Object mac_aedesc_to_lisp P_ ((const AEDesc *)); | 672 | extern Lisp_Object mac_aedesc_to_lisp P_ ((const AEDesc *)); |
| 673 | extern OSErr mac_ae_put_lisp P_ ((AEDescList *, UInt32, Lisp_Object)); | ||
| 625 | #if TARGET_API_MAC_CARBON | 674 | #if TARGET_API_MAC_CARBON |
| 626 | extern OSErr create_apple_event_from_event_ref P_ ((EventRef, UInt32, | 675 | extern OSErr create_apple_event_from_event_ref P_ ((EventRef, UInt32, |
| 627 | EventParamName *, | 676 | EventParamName *, |
diff --git a/src/minibuf.c b/src/minibuf.c index dc920287304..9a1a3636e97 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -67,6 +67,10 @@ Lisp_Object Qhistory_length, Vhistory_length; | |||
| 67 | 67 | ||
| 68 | int history_delete_duplicates; | 68 | int history_delete_duplicates; |
| 69 | 69 | ||
| 70 | /* Non-nil means add new input to history. */ | ||
| 71 | |||
| 72 | Lisp_Object Vhistory_add_new_input; | ||
| 73 | |||
| 70 | /* Fread_minibuffer leaves the input here as a string. */ | 74 | /* Fread_minibuffer leaves the input here as a string. */ |
| 71 | 75 | ||
| 72 | Lisp_Object last_minibuf_string; | 76 | Lisp_Object last_minibuf_string; |
| @@ -220,7 +224,7 @@ static Lisp_Object read_minibuf P_ ((Lisp_Object, Lisp_Object, | |||
| 220 | Lisp_Object, Lisp_Object, | 224 | Lisp_Object, Lisp_Object, |
| 221 | int, Lisp_Object, | 225 | int, Lisp_Object, |
| 222 | Lisp_Object, Lisp_Object, | 226 | Lisp_Object, Lisp_Object, |
| 223 | int, int, int)); | 227 | int, int)); |
| 224 | static Lisp_Object read_minibuf_noninteractive P_ ((Lisp_Object, Lisp_Object, | 228 | static Lisp_Object read_minibuf_noninteractive P_ ((Lisp_Object, Lisp_Object, |
| 225 | Lisp_Object, Lisp_Object, | 229 | Lisp_Object, Lisp_Object, |
| 226 | int, Lisp_Object, | 230 | int, Lisp_Object, |
| @@ -441,8 +445,7 @@ The current buffer must be a minibuffer. */) | |||
| 441 | 445 | ||
| 442 | static Lisp_Object | 446 | static Lisp_Object |
| 443 | read_minibuf (map, initial, prompt, backup_n, expflag, | 447 | read_minibuf (map, initial, prompt, backup_n, expflag, |
| 444 | histvar, histpos, defalt, allow_props, inherit_input_method, | 448 | histvar, histpos, defalt, allow_props, inherit_input_method) |
| 445 | keep_all) | ||
| 446 | Lisp_Object map; | 449 | Lisp_Object map; |
| 447 | Lisp_Object initial; | 450 | Lisp_Object initial; |
| 448 | Lisp_Object prompt; | 451 | Lisp_Object prompt; |
| @@ -453,7 +456,6 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 453 | Lisp_Object defalt; | 456 | Lisp_Object defalt; |
| 454 | int allow_props; | 457 | int allow_props; |
| 455 | int inherit_input_method; | 458 | int inherit_input_method; |
| 456 | int keep_all; | ||
| 457 | { | 459 | { |
| 458 | Lisp_Object val; | 460 | Lisp_Object val; |
| 459 | int count = SPECPDL_INDEX (); | 461 | int count = SPECPDL_INDEX (); |
| @@ -753,7 +755,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 753 | last_minibuf_string = val; | 755 | last_minibuf_string = val; |
| 754 | 756 | ||
| 755 | /* Choose the string to add to the history. */ | 757 | /* Choose the string to add to the history. */ |
| 756 | if (SCHARS (val) != 0 || keep_all) | 758 | if (SCHARS (val) != 0) |
| 757 | histstring = val; | 759 | histstring = val; |
| 758 | else if (STRINGP (defalt)) | 760 | else if (STRINGP (defalt)) |
| 759 | histstring = defalt; | 761 | histstring = defalt; |
| @@ -761,7 +763,8 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 761 | histstring = Qnil; | 763 | histstring = Qnil; |
| 762 | 764 | ||
| 763 | /* Add the value to the appropriate history list, if any. */ | 765 | /* Add the value to the appropriate history list, if any. */ |
| 764 | if (SYMBOLP (Vminibuffer_history_variable) | 766 | if (!NILP (Vhistory_add_new_input) |
| 767 | && SYMBOLP (Vminibuffer_history_variable) | ||
| 765 | && !NILP (histstring)) | 768 | && !NILP (histstring)) |
| 766 | { | 769 | { |
| 767 | /* If the caller wanted to save the value read on a history list, | 770 | /* If the caller wanted to save the value read on a history list, |
| @@ -780,8 +783,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 780 | if (NILP (histval) | 783 | if (NILP (histval) |
| 781 | || (CONSP (histval) | 784 | || (CONSP (histval) |
| 782 | /* Don't duplicate the most recent entry in the history. */ | 785 | /* Don't duplicate the most recent entry in the history. */ |
| 783 | && (keep_all | 786 | && (NILP (Fequal (histstring, Fcar (histval)))))) |
| 784 | || NILP (Fequal (histstring, Fcar (histval)))))) | ||
| 785 | { | 787 | { |
| 786 | Lisp_Object length; | 788 | Lisp_Object length; |
| 787 | 789 | ||
| @@ -943,7 +945,7 @@ read_minibuf_unwind (data) | |||
| 943 | } | 945 | } |
| 944 | 946 | ||
| 945 | 947 | ||
| 946 | DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 8, 0, | 948 | DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 7, 0, |
| 947 | doc: /* Read a string from the minibuffer, prompting with string PROMPT. | 949 | doc: /* Read a string from the minibuffer, prompting with string PROMPT. |
| 948 | The optional second arg INITIAL-CONTENTS is an obsolete alternative to | 950 | The optional second arg INITIAL-CONTENTS is an obsolete alternative to |
| 949 | DEFAULT-VALUE. It normally should be nil in new code, except when | 951 | DEFAULT-VALUE. It normally should be nil in new code, except when |
| @@ -967,8 +969,6 @@ Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is available | |||
| 967 | the empty string. | 969 | the empty string. |
| 968 | Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits | 970 | Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits |
| 969 | the current input method and the setting of `enable-multibyte-characters'. | 971 | the current input method and the setting of `enable-multibyte-characters'. |
| 970 | Eight arg KEEP-ALL, if non-nil, says to put all inputs in the history list, | ||
| 971 | even empty or duplicate inputs. | ||
| 972 | If the variable `minibuffer-allow-text-properties' is non-nil, | 972 | If the variable `minibuffer-allow-text-properties' is non-nil, |
| 973 | then the string which is returned includes whatever text properties | 973 | then the string which is returned includes whatever text properties |
| 974 | were present in the minibuffer. Otherwise the value has no text properties. | 974 | were present in the minibuffer. Otherwise the value has no text properties. |
| @@ -984,9 +984,9 @@ POSITION in the minibuffer. Any integer value less than or equal to | |||
| 984 | one puts point at the beginning of the string. *Note* that this | 984 | one puts point at the beginning of the string. *Note* that this |
| 985 | behavior differs from the way such arguments are used in `completing-read' | 985 | behavior differs from the way such arguments are used in `completing-read' |
| 986 | and some related functions, which use zero-indexing for POSITION. */) | 986 | and some related functions, which use zero-indexing for POSITION. */) |
| 987 | (prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method, keep_all) | 987 | (prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method) |
| 988 | Lisp_Object prompt, initial_contents, keymap, read, hist, default_value; | 988 | Lisp_Object prompt, initial_contents, keymap, read, hist, default_value; |
| 989 | Lisp_Object inherit_input_method, keep_all; | 989 | Lisp_Object inherit_input_method; |
| 990 | { | 990 | { |
| 991 | Lisp_Object histvar, histpos, val; | 991 | Lisp_Object histvar, histpos, val; |
| 992 | struct gcpro gcpro1; | 992 | struct gcpro gcpro1; |
| @@ -1017,8 +1017,7 @@ and some related functions, which use zero-indexing for POSITION. */) | |||
| 1017 | Qnil, !NILP (read), | 1017 | Qnil, !NILP (read), |
| 1018 | histvar, histpos, default_value, | 1018 | histvar, histpos, default_value, |
| 1019 | minibuffer_allow_text_properties, | 1019 | minibuffer_allow_text_properties, |
| 1020 | !NILP (inherit_input_method), | 1020 | !NILP (inherit_input_method)); |
| 1021 | !NILP (keep_all)); | ||
| 1022 | UNGCPRO; | 1021 | UNGCPRO; |
| 1023 | return val; | 1022 | return val; |
| 1024 | } | 1023 | } |
| @@ -1035,7 +1034,7 @@ arguments are used as in `read-from-minibuffer') */) | |||
| 1035 | CHECK_STRING (prompt); | 1034 | CHECK_STRING (prompt); |
| 1036 | return read_minibuf (Vminibuffer_local_map, initial_contents, | 1035 | return read_minibuf (Vminibuffer_local_map, initial_contents, |
| 1037 | prompt, Qnil, 1, Qminibuffer_history, | 1036 | prompt, Qnil, 1, Qminibuffer_history, |
| 1038 | make_number (0), Qnil, 0, 0, 0); | 1037 | make_number (0), Qnil, 0, 0); |
| 1039 | } | 1038 | } |
| 1040 | 1039 | ||
| 1041 | DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0, | 1040 | DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0, |
| @@ -1073,7 +1072,7 @@ Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits | |||
| 1073 | Lisp_Object val; | 1072 | Lisp_Object val; |
| 1074 | val = Fread_from_minibuffer (prompt, initial_input, Qnil, | 1073 | val = Fread_from_minibuffer (prompt, initial_input, Qnil, |
| 1075 | Qnil, history, default_value, | 1074 | Qnil, history, default_value, |
| 1076 | inherit_input_method, Qnil); | 1075 | inherit_input_method); |
| 1077 | if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value)) | 1076 | if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value)) |
| 1078 | val = default_value; | 1077 | val = default_value; |
| 1079 | return val; | 1078 | return val; |
| @@ -1095,7 +1094,7 @@ the current input method and the setting of`enable-multibyte-characters'. */) | |||
| 1095 | CHECK_STRING (prompt); | 1094 | CHECK_STRING (prompt); |
| 1096 | return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, Qnil, | 1095 | return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, Qnil, |
| 1097 | 0, Qminibuffer_history, make_number (0), Qnil, 0, | 1096 | 0, Qminibuffer_history, make_number (0), Qnil, 0, |
| 1098 | !NILP (inherit_input_method), 0); | 1097 | !NILP (inherit_input_method)); |
| 1099 | } | 1098 | } |
| 1100 | 1099 | ||
| 1101 | DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0, | 1100 | DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0, |
| @@ -1784,7 +1783,7 @@ Completion ignores case if the ambient value of | |||
| 1784 | : Vminibuffer_local_must_match_filename_map), | 1783 | : Vminibuffer_local_must_match_filename_map), |
| 1785 | init, prompt, make_number (pos), 0, | 1784 | init, prompt, make_number (pos), 0, |
| 1786 | histvar, histpos, def, 0, | 1785 | histvar, histpos, def, 0, |
| 1787 | !NILP (inherit_input_method), 0); | 1786 | !NILP (inherit_input_method)); |
| 1788 | 1787 | ||
| 1789 | if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def)) | 1788 | if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def)) |
| 1790 | val = def; | 1789 | val = def; |
| @@ -2812,9 +2811,16 @@ property of a history variable overrides this default. */); | |||
| 2812 | DEFVAR_BOOL ("history-delete-duplicates", &history_delete_duplicates, | 2811 | DEFVAR_BOOL ("history-delete-duplicates", &history_delete_duplicates, |
| 2813 | doc: /* *Non-nil means to delete duplicates in history. | 2812 | doc: /* *Non-nil means to delete duplicates in history. |
| 2814 | If set to t when adding a new history element, all previous identical | 2813 | If set to t when adding a new history element, all previous identical |
| 2815 | elements are deleted. */); | 2814 | elements are deleted from the history list. */); |
| 2816 | history_delete_duplicates = 0; | 2815 | history_delete_duplicates = 0; |
| 2817 | 2816 | ||
| 2817 | DEFVAR_LISP ("history-add-new-input", &Vhistory_add_new_input, | ||
| 2818 | doc: /* *Non-nil means to add new elements in history. | ||
| 2819 | If set to nil, minibuffer reading functions don't add new elements to the | ||
| 2820 | history list, so it is possible to do this afterwards by calling | ||
| 2821 | `add-to-history' explicitly. */); | ||
| 2822 | Vhistory_add_new_input = Qt; | ||
| 2823 | |||
| 2818 | DEFVAR_LISP ("completion-auto-help", &Vcompletion_auto_help, | 2824 | DEFVAR_LISP ("completion-auto-help", &Vcompletion_auto_help, |
| 2819 | doc: /* *Non-nil means automatically provide help for invalid completion input. | 2825 | doc: /* *Non-nil means automatically provide help for invalid completion input. |
| 2820 | Under Partial Completion mode, a non-nil, non-t value has a special meaning; | 2826 | Under Partial Completion mode, a non-nil, non-t value has a special meaning; |
diff --git a/src/process.c b/src/process.c index de4dbd4a3ff..965b33c52c3 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -778,6 +778,16 @@ get_process (name) | |||
| 778 | return proc; | 778 | return proc; |
| 779 | } | 779 | } |
| 780 | 780 | ||
| 781 | |||
| 782 | #ifdef SIGCHLD | ||
| 783 | /* Fdelete_process promises to immediately forget about the process, but in | ||
| 784 | reality, Emacs needs to remember those processes until they have been | ||
| 785 | treated by sigchld_handler; otherwise this handler would consider the | ||
| 786 | process as being synchronous and say that the synchronous process is | ||
| 787 | dead. */ | ||
| 788 | static Lisp_Object deleted_pid_list; | ||
| 789 | #endif | ||
| 790 | |||
| 781 | DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, | 791 | DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, |
| 782 | doc: /* Delete PROCESS: kill it and forget about it immediately. | 792 | doc: /* Delete PROCESS: kill it and forget about it immediately. |
| 783 | PROCESS may be a process, a buffer, the name of a process or buffer, or | 793 | PROCESS may be a process, a buffer, the name of a process or buffer, or |
| @@ -799,12 +809,31 @@ nil, indicating the current buffer's process. */) | |||
| 799 | } | 809 | } |
| 800 | else if (XINT (p->infd) >= 0) | 810 | else if (XINT (p->infd) >= 0) |
| 801 | { | 811 | { |
| 802 | Fkill_process (process, Qnil); | 812 | #ifdef SIGCHLD |
| 803 | /* Do this now, since remove_process will make sigchld_handler do nothing. */ | 813 | Lisp_Object symbol; |
| 804 | p->status | 814 | |
| 805 | = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); | 815 | /* No problem storing the pid here, as it is still in Vprocess_alist. */ |
| 806 | XSETINT (p->tick, ++process_tick); | 816 | deleted_pid_list = Fcons (make_fixnum_or_float (p->pid), |
| 807 | status_notify (p); | 817 | /* GC treated elements set to nil. */ |
| 818 | Fdelq (Qnil, deleted_pid_list)); | ||
| 819 | /* If the process has already signaled, remove it from the list. */ | ||
| 820 | if (p->raw_status_new) | ||
| 821 | update_status (p); | ||
| 822 | symbol = p->status; | ||
| 823 | if (CONSP (p->status)) | ||
| 824 | symbol = XCAR (p->status); | ||
| 825 | if (EQ (symbol, Qsignal) || EQ (symbol, Qexit)) | ||
| 826 | Fdelete (make_fixnum_or_float (p->pid), deleted_pid_list); | ||
| 827 | else | ||
| 828 | #endif | ||
| 829 | { | ||
| 830 | Fkill_process (process, Qnil); | ||
| 831 | /* Do this now, since remove_process will make sigchld_handler do nothing. */ | ||
| 832 | p->status | ||
| 833 | = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); | ||
| 834 | XSETINT (p->tick, ++process_tick); | ||
| 835 | status_notify (p); | ||
| 836 | } | ||
| 808 | } | 837 | } |
| 809 | remove_process (process); | 838 | remove_process (process); |
| 810 | return Qnil; | 839 | return Qnil; |
| @@ -4140,6 +4169,25 @@ wait_reading_process_output_1 () | |||
| 4140 | { | 4169 | { |
| 4141 | } | 4170 | } |
| 4142 | 4171 | ||
| 4172 | /* Use a wrapper around select to work around a bug in gdb 5.3. | ||
| 4173 | Normally, the wrapper is optimzed away by inlining. | ||
| 4174 | |||
| 4175 | If emacs is stopped inside select, the gdb backtrace doesn't | ||
| 4176 | show the function which called select, so it is practically | ||
| 4177 | impossible to step through wait_reading_process_output. */ | ||
| 4178 | |||
| 4179 | #ifndef select | ||
| 4180 | static INLINE int | ||
| 4181 | select_wrapper (n, rfd, wfd, xfd, tmo) | ||
| 4182 | int n; | ||
| 4183 | SELECT_TYPE *rfd, *wfd, *xfd; | ||
| 4184 | EMACS_TIME *tmo; | ||
| 4185 | { | ||
| 4186 | return select (n, rfd, wfd, xfd, tmo); | ||
| 4187 | } | ||
| 4188 | #define select select_wrapper | ||
| 4189 | #endif | ||
| 4190 | |||
| 4143 | /* Read and dispose of subprocess output while waiting for timeout to | 4191 | /* Read and dispose of subprocess output while waiting for timeout to |
| 4144 | elapse and/or keyboard input to be available. | 4192 | elapse and/or keyboard input to be available. |
| 4145 | 4193 | ||
| @@ -6321,6 +6369,7 @@ kill_buffer_processes (buffer) | |||
| 6321 | ** Malloc WARNING: This should never call malloc either directly or | 6369 | ** Malloc WARNING: This should never call malloc either directly or |
| 6322 | indirectly; if it does, that is a bug */ | 6370 | indirectly; if it does, that is a bug */ |
| 6323 | 6371 | ||
| 6372 | #ifdef SIGCHLD | ||
| 6324 | SIGTYPE | 6373 | SIGTYPE |
| 6325 | sigchld_handler (signo) | 6374 | sigchld_handler (signo) |
| 6326 | int signo; | 6375 | int signo; |
| @@ -6378,6 +6427,15 @@ sigchld_handler (signo) | |||
| 6378 | 6427 | ||
| 6379 | /* Find the process that signaled us, and record its status. */ | 6428 | /* Find the process that signaled us, and record its status. */ |
| 6380 | 6429 | ||
| 6430 | /* The process can have been deleted by Fdelete_process. */ | ||
| 6431 | tail = Fmember (make_fixnum_or_float (pid), deleted_pid_list); | ||
| 6432 | if (!NILP (tail)) | ||
| 6433 | { | ||
| 6434 | Fsetcar (tail, Qnil); | ||
| 6435 | goto sigchld_end_of_loop; | ||
| 6436 | } | ||
| 6437 | |||
| 6438 | /* Otherwise, if it is asynchronous, it is in Vprocess_alist. */ | ||
| 6381 | p = 0; | 6439 | p = 0; |
| 6382 | for (tail = Vprocess_alist; GC_CONSP (tail); tail = XCDR (tail)) | 6440 | for (tail = Vprocess_alist; GC_CONSP (tail); tail = XCDR (tail)) |
| 6383 | { | 6441 | { |
| @@ -6429,8 +6487,8 @@ sigchld_handler (signo) | |||
| 6429 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | 6487 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); |
| 6430 | } | 6488 | } |
| 6431 | 6489 | ||
| 6432 | /* There was no asynchronous process found for that id. Check | 6490 | /* There was no asynchronous process found for that pid: we have |
| 6433 | if we have a synchronous process. */ | 6491 | a synchronous process. */ |
| 6434 | else | 6492 | else |
| 6435 | { | 6493 | { |
| 6436 | synch_process_alive = 0; | 6494 | synch_process_alive = 0; |
| @@ -6447,6 +6505,9 @@ sigchld_handler (signo) | |||
| 6447 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | 6505 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); |
| 6448 | } | 6506 | } |
| 6449 | 6507 | ||
| 6508 | sigchld_end_of_loop: | ||
| 6509 | ; | ||
| 6510 | |||
| 6450 | /* On some systems, we must return right away. | 6511 | /* On some systems, we must return right away. |
| 6451 | If any more processes want to signal us, we will | 6512 | If any more processes want to signal us, we will |
| 6452 | get another signal. | 6513 | get another signal. |
| @@ -6463,6 +6524,7 @@ sigchld_handler (signo) | |||
| 6463 | #endif /* USG, but not HPUX with WNOHANG */ | 6524 | #endif /* USG, but not HPUX with WNOHANG */ |
| 6464 | } | 6525 | } |
| 6465 | } | 6526 | } |
| 6527 | #endif /* SIGCHLD */ | ||
| 6466 | 6528 | ||
| 6467 | 6529 | ||
| 6468 | static Lisp_Object | 6530 | static Lisp_Object |
| @@ -6845,6 +6907,9 @@ init_process () | |||
| 6845 | #endif | 6907 | #endif |
| 6846 | 6908 | ||
| 6847 | Vprocess_alist = Qnil; | 6909 | Vprocess_alist = Qnil; |
| 6910 | #ifdef SIGCHLD | ||
| 6911 | deleted_pid_list = Qnil; | ||
| 6912 | #endif | ||
| 6848 | for (i = 0; i < MAXDESC; i++) | 6913 | for (i = 0; i < MAXDESC; i++) |
| 6849 | { | 6914 | { |
| 6850 | chan_process[i] = Qnil; | 6915 | chan_process[i] = Qnil; |
| @@ -6983,6 +7048,9 @@ syms_of_process () | |||
| 6983 | staticpro (&Qlast_nonmenu_event); | 7048 | staticpro (&Qlast_nonmenu_event); |
| 6984 | 7049 | ||
| 6985 | staticpro (&Vprocess_alist); | 7050 | staticpro (&Vprocess_alist); |
| 7051 | #ifdef SIGCHLD | ||
| 7052 | staticpro (&deleted_pid_list); | ||
| 7053 | #endif | ||
| 6986 | 7054 | ||
| 6987 | DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, | 7055 | DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, |
| 6988 | doc: /* *Non-nil means delete processes immediately when they exit. | 7056 | doc: /* *Non-nil means delete processes immediately when they exit. |
diff --git a/src/search.c b/src/search.c index dfbf66fc7ed..99db7f184fc 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -90,6 +90,7 @@ static void save_search_regs (); | |||
| 90 | static int simple_search (); | 90 | static int simple_search (); |
| 91 | static int boyer_moore (); | 91 | static int boyer_moore (); |
| 92 | static int search_buffer (); | 92 | static int search_buffer (); |
| 93 | static void matcher_overflow () NO_RETURN; | ||
| 93 | 94 | ||
| 94 | static void | 95 | static void |
| 95 | matcher_overflow () | 96 | matcher_overflow () |
diff --git a/src/sound.c b/src/sound.c index 2ceefd3bce3..af2369040cc 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -113,7 +113,8 @@ enum sound_attr | |||
| 113 | SOUND_ATTR_SENTINEL | 113 | SOUND_ATTR_SENTINEL |
| 114 | }; | 114 | }; |
| 115 | 115 | ||
| 116 | static void sound_perror P_ ((char *)); | 116 | static void alsa_sound_perror P_ ((char *, int)) NO_RETURN; |
| 117 | static void sound_perror P_ ((char *)) NO_RETURN; | ||
| 117 | static void sound_warning P_ ((char *)); | 118 | static void sound_warning P_ ((char *)); |
| 118 | static int parse_sound P_ ((Lisp_Object, Lisp_Object *)); | 119 | static int parse_sound P_ ((Lisp_Object, Lisp_Object *)); |
| 119 | 120 | ||
| @@ -971,7 +972,8 @@ alsa_open (sd) | |||
| 971 | sd->data = p; | 972 | sd->data = p; |
| 972 | 973 | ||
| 973 | 974 | ||
| 974 | if ((err = snd_pcm_open (&p->handle, file, SND_PCM_STREAM_PLAYBACK, 0)) < 0) | 975 | err = snd_pcm_open (&p->handle, file, SND_PCM_STREAM_PLAYBACK, 0); |
| 976 | if (err < 0) | ||
| 975 | alsa_sound_perror (file, err); | 977 | alsa_sound_perror (file, err); |
| 976 | } | 978 | } |
| 977 | 979 | ||
| @@ -993,32 +995,42 @@ alsa_configure (sd) | |||
| 993 | 995 | ||
| 994 | xassert (p->handle != 0); | 996 | xassert (p->handle != 0); |
| 995 | 997 | ||
| 996 | if ((err = snd_pcm_hw_params_malloc (&p->hwparams)) < 0) | 998 | err = snd_pcm_hw_params_malloc (&p->hwparams); |
| 999 | if (err < 0) | ||
| 997 | alsa_sound_perror ("Could not allocate hardware parameter structure", err); | 1000 | alsa_sound_perror ("Could not allocate hardware parameter structure", err); |
| 998 | 1001 | ||
| 999 | if ((err = snd_pcm_sw_params_malloc (&p->swparams)) < 0) | 1002 | err = snd_pcm_sw_params_malloc (&p->swparams); |
| 1003 | if (err < 0) | ||
| 1000 | alsa_sound_perror ("Could not allocate software parameter structure", err); | 1004 | alsa_sound_perror ("Could not allocate software parameter structure", err); |
| 1001 | 1005 | ||
| 1002 | if ((err = snd_pcm_hw_params_any (p->handle, p->hwparams)) < 0) | 1006 | err = snd_pcm_hw_params_any (p->handle, p->hwparams); |
| 1007 | if (err < 0) | ||
| 1003 | alsa_sound_perror ("Could not initialize hardware parameter structure", err); | 1008 | alsa_sound_perror ("Could not initialize hardware parameter structure", err); |
| 1004 | 1009 | ||
| 1005 | if ((err = snd_pcm_hw_params_set_access (p->handle, p->hwparams, | 1010 | err = snd_pcm_hw_params_set_access (p->handle, p->hwparams, |
| 1006 | SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) | 1011 | SND_PCM_ACCESS_RW_INTERLEAVED); |
| 1012 | if (err < 0) | ||
| 1007 | alsa_sound_perror ("Could not set access type", err); | 1013 | alsa_sound_perror ("Could not set access type", err); |
| 1008 | 1014 | ||
| 1009 | val = sd->format; | 1015 | val = sd->format; |
| 1010 | if ((err = snd_pcm_hw_params_set_format (p->handle, p->hwparams, val)) < 0) | 1016 | err = snd_pcm_hw_params_set_format (p->handle, p->hwparams, val); |
| 1017 | if (err < 0) | ||
| 1011 | alsa_sound_perror ("Could not set sound format", err); | 1018 | alsa_sound_perror ("Could not set sound format", err); |
| 1012 | 1019 | ||
| 1013 | val = sd->sample_rate; | 1020 | val = sd->sample_rate; |
| 1014 | if ((err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &val, 0)) | 1021 | err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &val, 0); |
| 1015 | < 0) | 1022 | if (err < 0) |
| 1016 | alsa_sound_perror ("Could not set sample rate", err); | 1023 | alsa_sound_perror ("Could not set sample rate", err); |
| 1017 | 1024 | ||
| 1018 | val = sd->channels; | 1025 | val = sd->channels; |
| 1019 | if ((err = snd_pcm_hw_params_set_channels (p->handle, p->hwparams, val)) < 0) | 1026 | err = snd_pcm_hw_params_set_channels (p->handle, p->hwparams, val); |
| 1027 | if (err < 0) | ||
| 1020 | alsa_sound_perror ("Could not set channel count", err); | 1028 | alsa_sound_perror ("Could not set channel count", err); |
| 1021 | 1029 | ||
| 1030 | err = snd_pcm_hw_params (p->handle, p->hwparams); | ||
| 1031 | if (err < 0) | ||
| 1032 | alsa_sound_perror ("Could not set parameters", err); | ||
| 1033 | |||
| 1022 | 1034 | ||
| 1023 | err = snd_pcm_hw_params_get_period_size (p->hwparams, &p->period_size, &dir); | 1035 | err = snd_pcm_hw_params_get_period_size (p->hwparams, &p->period_size, &dir); |
| 1024 | if (err < 0) | 1036 | if (err < 0) |
| @@ -1028,9 +1040,6 @@ alsa_configure (sd) | |||
| 1028 | if (err < 0) | 1040 | if (err < 0) |
| 1029 | alsa_sound_perror("Unable to get buffer size for playback", err); | 1041 | alsa_sound_perror("Unable to get buffer size for playback", err); |
| 1030 | 1042 | ||
| 1031 | if ((err = snd_pcm_hw_params (p->handle, p->hwparams)) < 0) | ||
| 1032 | alsa_sound_perror ("Could not set parameters", err); | ||
| 1033 | |||
| 1034 | err = snd_pcm_sw_params_current (p->handle, p->swparams); | 1043 | err = snd_pcm_sw_params_current (p->handle, p->swparams); |
| 1035 | if (err < 0) | 1044 | if (err < 0) |
| 1036 | alsa_sound_perror ("Unable to determine current swparams for playback", | 1045 | alsa_sound_perror ("Unable to determine current swparams for playback", |
| @@ -1063,7 +1072,8 @@ alsa_configure (sd) | |||
| 1063 | snd_pcm_sw_params_free (p->swparams); | 1072 | snd_pcm_sw_params_free (p->swparams); |
| 1064 | p->swparams = NULL; | 1073 | p->swparams = NULL; |
| 1065 | 1074 | ||
| 1066 | if ((err = snd_pcm_prepare (p->handle)) < 0) | 1075 | err = snd_pcm_prepare (p->handle); |
| 1076 | if (err < 0) | ||
| 1067 | alsa_sound_perror ("Could not prepare audio interface for use", err); | 1077 | alsa_sound_perror ("Could not prepare audio interface for use", err); |
| 1068 | 1078 | ||
| 1069 | if (sd->volume > 0) | 1079 | if (sd->volume > 0) |
| @@ -1194,11 +1204,11 @@ alsa_write (sd, buffer, nbytes) | |||
| 1194 | 1204 | ||
| 1195 | while (nwritten < nbytes) | 1205 | while (nwritten < nbytes) |
| 1196 | { | 1206 | { |
| 1197 | if ((err = snd_pcm_writei (p->handle, | 1207 | err = snd_pcm_writei (p->handle, |
| 1198 | buffer + nwritten, | 1208 | buffer + nwritten, |
| 1199 | (nbytes - nwritten)/fact)) < 0) | 1209 | (nbytes - nwritten)/fact); |
| 1210 | if (err < 0) | ||
| 1200 | { | 1211 | { |
| 1201 | fprintf(stderr, "Err %d/%s\n", err, snd_strerror(err)); | ||
| 1202 | if (err == -EPIPE) | 1212 | if (err == -EPIPE) |
| 1203 | { /* under-run */ | 1213 | { /* under-run */ |
| 1204 | err = snd_pcm_prepare (p->handle); | 1214 | err = snd_pcm_prepare (p->handle); |
diff --git a/src/sysdep.c b/src/sysdep.c index 6e09748bca9..6d630c4832f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -242,7 +242,7 @@ static int baud_convert[] = | |||
| 242 | 242 | ||
| 243 | int emacs_ospeed; | 243 | int emacs_ospeed; |
| 244 | 244 | ||
| 245 | void croak P_ ((char *)); | 245 | void croak P_ ((char *)) NO_RETURN; |
| 246 | 246 | ||
| 247 | #ifdef AIXHFT | 247 | #ifdef AIXHFT |
| 248 | void hft_init P_ ((struct tty_display_info *)); | 248 | void hft_init P_ ((struct tty_display_info *)); |
diff --git a/src/w32fns.c b/src/w32fns.c index 609a88debbd..25aa22f0683 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -1683,7 +1683,7 @@ x_set_icon_name (f, arg, oldval) | |||
| 1683 | if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | 1683 | if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) |
| 1684 | return; | 1684 | return; |
| 1685 | } | 1685 | } |
| 1686 | else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | 1686 | else if (!NILP (arg) || NILP (oldval)) |
| 1687 | return; | 1687 | return; |
| 1688 | 1688 | ||
| 1689 | f->icon_name = arg; | 1689 | f->icon_name = arg; |
diff --git a/src/w32heap.c b/src/w32heap.c index f1fa196abe7..e1bdd867721 100644 --- a/src/w32heap.c +++ b/src/w32heap.c | |||
| @@ -42,10 +42,6 @@ OSVERSIONINFO osinfo_cache; | |||
| 42 | 42 | ||
| 43 | unsigned long syspage_mask = 0; | 43 | unsigned long syspage_mask = 0; |
| 44 | 44 | ||
| 45 | /* These are defined to get Emacs to compile, but are not used. */ | ||
| 46 | int edata; | ||
| 47 | int etext; | ||
| 48 | |||
| 49 | /* The major and minor versions of NT. */ | 45 | /* The major and minor versions of NT. */ |
| 50 | int w32_major_version; | 46 | int w32_major_version; |
| 51 | int w32_minor_version; | 47 | int w32_minor_version; |
diff --git a/src/w32term.c b/src/w32term.c index 05fd303f4d1..f85a5334022 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -146,32 +146,6 @@ HANDLE hWindowsThread = NULL; | |||
| 146 | DWORD dwMainThreadId = 0; | 146 | DWORD dwMainThreadId = 0; |
| 147 | HANDLE hMainThread = NULL; | 147 | HANDLE hMainThread = NULL; |
| 148 | 148 | ||
| 149 | #ifndef SIF_ALL | ||
| 150 | /* These definitions are new with Windows 95. */ | ||
| 151 | #define SIF_RANGE 0x0001 | ||
| 152 | #define SIF_PAGE 0x0002 | ||
| 153 | #define SIF_POS 0x0004 | ||
| 154 | #define SIF_DISABLENOSCROLL 0x0008 | ||
| 155 | #define SIF_TRACKPOS 0x0010 | ||
| 156 | #define SIF_ALL (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS) | ||
| 157 | |||
| 158 | typedef struct tagSCROLLINFO | ||
| 159 | { | ||
| 160 | UINT cbSize; | ||
| 161 | UINT fMask; | ||
| 162 | int nMin; | ||
| 163 | int nMax; | ||
| 164 | UINT nPage; | ||
| 165 | int nPos; | ||
| 166 | int nTrackPos; | ||
| 167 | } SCROLLINFO, FAR *LPSCROLLINFO; | ||
| 168 | typedef SCROLLINFO CONST FAR *LPCSCROLLINFO; | ||
| 169 | #endif /* SIF_ALL */ | ||
| 170 | |||
| 171 | /* Dynamic linking to new proportional scroll bar functions. */ | ||
| 172 | int (PASCAL *pfnSetScrollInfo) (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw); | ||
| 173 | BOOL (PASCAL *pfnGetScrollInfo) (HWND hwnd, int fnBar, LPSCROLLINFO lpsi); | ||
| 174 | |||
| 175 | int vertical_scroll_bar_min_handle; | 149 | int vertical_scroll_bar_min_handle; |
| 176 | int vertical_scroll_bar_top_border; | 150 | int vertical_scroll_bar_top_border; |
| 177 | int vertical_scroll_bar_bottom_border; | 151 | int vertical_scroll_bar_bottom_border; |
| @@ -2389,20 +2363,29 @@ x_draw_stretch_glyph_string (s) | |||
| 2389 | { | 2363 | { |
| 2390 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor | 2364 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor |
| 2391 | as wide as the stretch glyph. */ | 2365 | as wide as the stretch glyph. */ |
| 2392 | int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width); | 2366 | int width, background_width = s->background_width; |
| 2367 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | ||
| 2368 | |||
| 2369 | if (x < left_x) | ||
| 2370 | { | ||
| 2371 | background_width -= left_x - x; | ||
| 2372 | x = left_x; | ||
| 2373 | } | ||
| 2374 | width = min (FRAME_COLUMN_WIDTH (s->f), background_width); | ||
| 2393 | 2375 | ||
| 2394 | /* Draw cursor. */ | 2376 | /* Draw cursor. */ |
| 2395 | x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); | 2377 | x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); |
| 2396 | 2378 | ||
| 2397 | /* Clear rest using the GC of the original non-cursor face. */ | 2379 | /* Clear rest using the GC of the original non-cursor face. */ |
| 2398 | if (width < s->background_width) | 2380 | if (width < background_width) |
| 2399 | { | 2381 | { |
| 2400 | XGCValues *gc = s->face->gc; | 2382 | XGCValues *gc = s->face->gc; |
| 2401 | int x = s->x + width, y = s->y; | 2383 | int y = s->y; |
| 2402 | int w = s->background_width - width, h = s->height; | 2384 | int w = background_width - width, h = s->height; |
| 2403 | RECT r; | 2385 | RECT r; |
| 2404 | HDC hdc = s->hdc; | 2386 | HDC hdc = s->hdc; |
| 2405 | 2387 | ||
| 2388 | x += width; | ||
| 2406 | if (s->row->mouse_face_p | 2389 | if (s->row->mouse_face_p |
| 2407 | && cursor_in_mouse_face_p (s->w)) | 2390 | && cursor_in_mouse_face_p (s->w)) |
| 2408 | { | 2391 | { |
| @@ -2431,8 +2414,18 @@ x_draw_stretch_glyph_string (s) | |||
| 2431 | } | 2414 | } |
| 2432 | } | 2415 | } |
| 2433 | else if (!s->background_filled_p) | 2416 | else if (!s->background_filled_p) |
| 2434 | x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, | 2417 | { |
| 2435 | s->height); | 2418 | int background_width = s->background_width; |
| 2419 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | ||
| 2420 | |||
| 2421 | if (x < left_x) | ||
| 2422 | { | ||
| 2423 | background_width -= left_x - x; | ||
| 2424 | x = left_x; | ||
| 2425 | } | ||
| 2426 | if (background_width > 0) | ||
| 2427 | x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); | ||
| 2428 | } | ||
| 2436 | 2429 | ||
| 2437 | s->background_filled_p = 1; | 2430 | s->background_filled_p = 1; |
| 2438 | } | 2431 | } |
| @@ -3468,6 +3461,7 @@ w32_set_scroll_bar_thumb (bar, portion, position, whole) | |||
| 3468 | double range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 3461 | double range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); |
| 3469 | int sb_page, sb_pos; | 3462 | int sb_page, sb_pos; |
| 3470 | BOOL draggingp = !NILP (bar->dragging) ? TRUE : FALSE; | 3463 | BOOL draggingp = !NILP (bar->dragging) ? TRUE : FALSE; |
| 3464 | SCROLLINFO si; | ||
| 3471 | 3465 | ||
| 3472 | if (whole) | 3466 | if (whole) |
| 3473 | { | 3467 | { |
| @@ -3492,24 +3486,17 @@ w32_set_scroll_bar_thumb (bar, portion, position, whole) | |||
| 3492 | 3486 | ||
| 3493 | BLOCK_INPUT; | 3487 | BLOCK_INPUT; |
| 3494 | 3488 | ||
| 3495 | if (pfnSetScrollInfo) | 3489 | si.cbSize = sizeof (si); |
| 3496 | { | 3490 | /* Only update page size if currently dragging, to reduce |
| 3497 | SCROLLINFO si; | 3491 | flicker effects. */ |
| 3498 | 3492 | if (draggingp) | |
| 3499 | si.cbSize = sizeof (si); | 3493 | si.fMask = SIF_PAGE; |
| 3500 | /* Only update page size if currently dragging, to reduce | ||
| 3501 | flicker effects. */ | ||
| 3502 | if (draggingp) | ||
| 3503 | si.fMask = SIF_PAGE; | ||
| 3504 | else | ||
| 3505 | si.fMask = SIF_PAGE | SIF_POS; | ||
| 3506 | si.nPage = sb_page; | ||
| 3507 | si.nPos = sb_pos; | ||
| 3508 | |||
| 3509 | pfnSetScrollInfo (w, SB_CTL, &si, !draggingp); | ||
| 3510 | } | ||
| 3511 | else | 3494 | else |
| 3512 | SetScrollPos (w, SB_CTL, sb_pos, !draggingp); | 3495 | si.fMask = SIF_PAGE | SIF_POS; |
| 3496 | si.nPage = sb_page; | ||
| 3497 | si.nPos = sb_pos; | ||
| 3498 | |||
| 3499 | SetScrollInfo (w, SB_CTL, &si, !draggingp); | ||
| 3513 | 3500 | ||
| 3514 | UNBLOCK_INPUT; | 3501 | UNBLOCK_INPUT; |
| 3515 | } | 3502 | } |
| @@ -3598,6 +3585,7 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 3598 | { | 3585 | { |
| 3599 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 3586 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 3600 | HWND hwnd; | 3587 | HWND hwnd; |
| 3588 | SCROLLINFO si; | ||
| 3601 | struct scroll_bar *bar | 3589 | struct scroll_bar *bar |
| 3602 | = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); | 3590 | = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); |
| 3603 | 3591 | ||
| @@ -3616,26 +3604,15 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 3616 | 3604 | ||
| 3617 | hwnd = my_create_scrollbar (f, bar); | 3605 | hwnd = my_create_scrollbar (f, bar); |
| 3618 | 3606 | ||
| 3619 | if (pfnSetScrollInfo) | 3607 | si.cbSize = sizeof (si); |
| 3620 | { | 3608 | si.fMask = SIF_ALL; |
| 3621 | SCROLLINFO si; | 3609 | si.nMin = 0; |
| 3622 | 3610 | si.nMax = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height) | |
| 3623 | si.cbSize = sizeof (si); | 3611 | + VERTICAL_SCROLL_BAR_MIN_HANDLE; |
| 3624 | si.fMask = SIF_ALL; | 3612 | si.nPage = si.nMax; |
| 3625 | si.nMin = 0; | 3613 | si.nPos = 0; |
| 3626 | si.nMax = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height) | ||
| 3627 | + VERTICAL_SCROLL_BAR_MIN_HANDLE; | ||
| 3628 | si.nPage = si.nMax; | ||
| 3629 | si.nPos = 0; | ||
| 3630 | 3614 | ||
| 3631 | pfnSetScrollInfo (hwnd, SB_CTL, &si, FALSE); | 3615 | SetScrollInfo (hwnd, SB_CTL, &si, FALSE); |
| 3632 | } | ||
| 3633 | else | ||
| 3634 | { | ||
| 3635 | SetScrollRange (hwnd, SB_CTL, 0, | ||
| 3636 | VERTICAL_SCROLL_BAR_TOP_RANGE (f, height), FALSE); | ||
| 3637 | SetScrollPos (hwnd, SB_CTL, 0, FALSE); | ||
| 3638 | } | ||
| 3639 | 3616 | ||
| 3640 | SET_SCROLL_BAR_W32_WINDOW (bar, hwnd); | 3617 | SET_SCROLL_BAR_W32_WINDOW (bar, hwnd); |
| 3641 | 3618 | ||
| @@ -3744,6 +3721,8 @@ w32_set_vertical_scroll_bar (w, portion, whole, position) | |||
| 3744 | else | 3721 | else |
| 3745 | { | 3722 | { |
| 3746 | HDC hdc; | 3723 | HDC hdc; |
| 3724 | SCROLLINFO si; | ||
| 3725 | |||
| 3747 | BLOCK_INPUT; | 3726 | BLOCK_INPUT; |
| 3748 | if (width && height) | 3727 | if (width && height) |
| 3749 | { | 3728 | { |
| @@ -3763,21 +3742,15 @@ w32_set_vertical_scroll_bar (w, portion, whole, position) | |||
| 3763 | MoveWindow (hwnd, sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, | 3742 | MoveWindow (hwnd, sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, |
| 3764 | top, sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, | 3743 | top, sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, |
| 3765 | max (height, 1), TRUE); | 3744 | max (height, 1), TRUE); |
| 3766 | if (pfnSetScrollInfo) | ||
| 3767 | { | ||
| 3768 | SCROLLINFO si; | ||
| 3769 | 3745 | ||
| 3770 | si.cbSize = sizeof (si); | 3746 | si.cbSize = sizeof (si); |
| 3771 | si.fMask = SIF_RANGE; | 3747 | si.fMask = SIF_RANGE; |
| 3772 | si.nMin = 0; | 3748 | si.nMin = 0; |
| 3773 | si.nMax = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height) | 3749 | si.nMax = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height) |
| 3774 | + VERTICAL_SCROLL_BAR_MIN_HANDLE; | 3750 | + VERTICAL_SCROLL_BAR_MIN_HANDLE; |
| 3751 | |||
| 3752 | SetScrollInfo (hwnd, SB_CTL, &si, FALSE); | ||
| 3775 | 3753 | ||
| 3776 | pfnSetScrollInfo (hwnd, SB_CTL, &si, FALSE); | ||
| 3777 | } | ||
| 3778 | else | ||
| 3779 | SetScrollRange (hwnd, SB_CTL, 0, | ||
| 3780 | VERTICAL_SCROLL_BAR_TOP_RANGE (f, height), FALSE); | ||
| 3781 | my_show_window (f, hwnd, SW_NORMAL); | 3754 | my_show_window (f, hwnd, SW_NORMAL); |
| 3782 | /* InvalidateRect (w, NULL, FALSE); */ | 3755 | /* InvalidateRect (w, NULL, FALSE); */ |
| 3783 | 3756 | ||
| @@ -3929,19 +3902,13 @@ w32_scroll_bar_handle_click (bar, msg, emacs_event) | |||
| 3929 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 3902 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); |
| 3930 | int y; | 3903 | int y; |
| 3931 | int dragging = !NILP (bar->dragging); | 3904 | int dragging = !NILP (bar->dragging); |
| 3905 | SCROLLINFO si; | ||
| 3932 | 3906 | ||
| 3933 | if (pfnGetScrollInfo) | 3907 | si.cbSize = sizeof (si); |
| 3934 | { | 3908 | si.fMask = SIF_POS; |
| 3935 | SCROLLINFO si; | ||
| 3936 | |||
| 3937 | si.cbSize = sizeof (si); | ||
| 3938 | si.fMask = SIF_POS; | ||
| 3939 | 3909 | ||
| 3940 | pfnGetScrollInfo ((HWND) msg->msg.lParam, SB_CTL, &si); | 3910 | GetScrollInfo ((HWND) msg->msg.lParam, SB_CTL, &si); |
| 3941 | y = si.nPos; | 3911 | y = si.nPos; |
| 3942 | } | ||
| 3943 | else | ||
| 3944 | y = GetScrollPos ((HWND) msg->msg.lParam, SB_CTL); | ||
| 3945 | 3912 | ||
| 3946 | bar->dragging = Qnil; | 3913 | bar->dragging = Qnil; |
| 3947 | 3914 | ||
| @@ -3978,21 +3945,18 @@ w32_scroll_bar_handle_click (bar, msg, emacs_event) | |||
| 3978 | emacs_event->part = scroll_bar_handle; | 3945 | emacs_event->part = scroll_bar_handle; |
| 3979 | 3946 | ||
| 3980 | /* "Silently" update current position. */ | 3947 | /* "Silently" update current position. */ |
| 3981 | if (pfnSetScrollInfo) | 3948 | { |
| 3982 | { | 3949 | SCROLLINFO si; |
| 3983 | SCROLLINFO si; | ||
| 3984 | 3950 | ||
| 3985 | si.cbSize = sizeof (si); | 3951 | si.cbSize = sizeof (si); |
| 3986 | si.fMask = SIF_POS; | 3952 | si.fMask = SIF_POS; |
| 3987 | si.nPos = y; | 3953 | si.nPos = y; |
| 3988 | /* Remember apparent position (we actually lag behind the real | 3954 | /* Remember apparent position (we actually lag behind the real |
| 3989 | position, so don't set that directly. */ | 3955 | position, so don't set that directly. */ |
| 3990 | last_scroll_bar_drag_pos = y; | 3956 | last_scroll_bar_drag_pos = y; |
| 3991 | 3957 | ||
| 3992 | pfnSetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, FALSE); | 3958 | SetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, FALSE); |
| 3993 | } | 3959 | } |
| 3994 | else | ||
| 3995 | SetScrollPos (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, y, FALSE); | ||
| 3996 | break; | 3960 | break; |
| 3997 | case SB_ENDSCROLL: | 3961 | case SB_ENDSCROLL: |
| 3998 | /* If this is the end of a drag sequence, then reset the scroll | 3962 | /* If this is the end of a drag sequence, then reset the scroll |
| @@ -4000,20 +3964,15 @@ w32_scroll_bar_handle_click (bar, msg, emacs_event) | |||
| 4000 | nothing. */ | 3964 | nothing. */ |
| 4001 | if (dragging) | 3965 | if (dragging) |
| 4002 | { | 3966 | { |
| 4003 | if (pfnSetScrollInfo) | 3967 | SCROLLINFO si; |
| 4004 | { | 3968 | int start = XINT (bar->start); |
| 4005 | SCROLLINFO si; | 3969 | int end = XINT (bar->end); |
| 4006 | int start = XINT (bar->start); | 3970 | |
| 4007 | int end = XINT (bar->end); | 3971 | si.cbSize = sizeof (si); |
| 4008 | 3972 | si.fMask = SIF_PAGE | SIF_POS; | |
| 4009 | si.cbSize = sizeof (si); | 3973 | si.nPage = end - start + VERTICAL_SCROLL_BAR_MIN_HANDLE; |
| 4010 | si.fMask = SIF_PAGE | SIF_POS; | 3974 | si.nPos = last_scroll_bar_drag_pos; |
| 4011 | si.nPage = end - start + VERTICAL_SCROLL_BAR_MIN_HANDLE; | 3975 | SetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, TRUE); |
| 4012 | si.nPos = last_scroll_bar_drag_pos; | ||
| 4013 | pfnSetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, TRUE); | ||
| 4014 | } | ||
| 4015 | else | ||
| 4016 | SetScrollPos (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, y, TRUE); | ||
| 4017 | } | 3976 | } |
| 4018 | /* fall through */ | 3977 | /* fall through */ |
| 4019 | default: | 3978 | default: |
| @@ -4044,25 +4003,19 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | |||
| 4044 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 4003 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 4045 | int pos; | 4004 | int pos; |
| 4046 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 4005 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); |
| 4006 | SCROLLINFO si; | ||
| 4047 | 4007 | ||
| 4048 | BLOCK_INPUT; | 4008 | BLOCK_INPUT; |
| 4049 | 4009 | ||
| 4050 | *fp = f; | 4010 | *fp = f; |
| 4051 | *bar_window = bar->window; | 4011 | *bar_window = bar->window; |
| 4052 | 4012 | ||
| 4053 | if (pfnGetScrollInfo) | 4013 | si.cbSize = sizeof (si); |
| 4054 | { | 4014 | si.fMask = SIF_POS | SIF_PAGE | SIF_RANGE; |
| 4055 | SCROLLINFO si; | ||
| 4056 | |||
| 4057 | si.cbSize = sizeof (si); | ||
| 4058 | si.fMask = SIF_POS | SIF_PAGE | SIF_RANGE; | ||
| 4059 | 4015 | ||
| 4060 | pfnGetScrollInfo (w, SB_CTL, &si); | 4016 | GetScrollInfo (w, SB_CTL, &si); |
| 4061 | pos = si.nPos; | 4017 | pos = si.nPos; |
| 4062 | top_range = si.nMax - si.nPage + 1; | 4018 | top_range = si.nMax - si.nPage + 1; |
| 4063 | } | ||
| 4064 | else | ||
| 4065 | pos = GetScrollPos (w, SB_CTL); | ||
| 4066 | 4019 | ||
| 4067 | switch (LOWORD (last_mouse_scroll_bar_pos)) | 4020 | switch (LOWORD (last_mouse_scroll_bar_pos)) |
| 4068 | { | 4021 | { |
| @@ -4931,7 +4884,7 @@ x_draw_hollow_cursor (w, row) | |||
| 4931 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 4884 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 4932 | HDC hdc; | 4885 | HDC hdc; |
| 4933 | RECT rect; | 4886 | RECT rect; |
| 4934 | int h; | 4887 | int left, top, h; |
| 4935 | struct glyph *cursor_glyph; | 4888 | struct glyph *cursor_glyph; |
| 4936 | HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel); | 4889 | HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel); |
| 4937 | 4890 | ||
| @@ -4942,8 +4895,9 @@ x_draw_hollow_cursor (w, row) | |||
| 4942 | return; | 4895 | return; |
| 4943 | 4896 | ||
| 4944 | /* Compute frame-relative coordinates for phys cursor. */ | 4897 | /* Compute frame-relative coordinates for phys cursor. */ |
| 4945 | rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 4898 | get_phys_cursor_geometry (w, row, cursor_glyph, &left, &top, &h); |
| 4946 | rect.top = get_phys_cursor_geometry (w, row, cursor_glyph, &h); | 4899 | rect.left = left; |
| 4900 | rect.top = top; | ||
| 4947 | rect.bottom = rect.top + h; | 4901 | rect.bottom = rect.top + h; |
| 4948 | rect.right = rect.left + w->phys_cursor_width; | 4902 | rect.right = rect.left + w->phys_cursor_width; |
| 4949 | 4903 | ||
| @@ -6390,26 +6344,14 @@ w32_initialize () | |||
| 6390 | AttachThreadInput (dwMainThreadId, dwWindowsThreadId, TRUE); | 6344 | AttachThreadInput (dwMainThreadId, dwWindowsThreadId, TRUE); |
| 6391 | #endif | 6345 | #endif |
| 6392 | 6346 | ||
| 6393 | /* Dynamically link to optional system components. */ | 6347 | /* Load system settings. */ |
| 6394 | { | 6348 | { |
| 6395 | HANDLE user_lib = LoadLibrary ("user32.dll"); | ||
| 6396 | UINT smoothing_type; | 6349 | UINT smoothing_type; |
| 6397 | BOOL smoothing_enabled; | 6350 | BOOL smoothing_enabled; |
| 6398 | 6351 | ||
| 6399 | #define LOAD_PROC(fn) pfn##fn = (void *) GetProcAddress (user_lib, #fn) | ||
| 6400 | |||
| 6401 | /* New proportional scroll bar functions. */ | ||
| 6402 | LOAD_PROC (SetScrollInfo); | ||
| 6403 | LOAD_PROC (GetScrollInfo); | ||
| 6404 | |||
| 6405 | #undef LOAD_PROC | ||
| 6406 | |||
| 6407 | FreeLibrary (user_lib); | ||
| 6408 | |||
| 6409 | /* If using proportional scroll bars, ensure handle is at least 5 pixels; | 6352 | /* If using proportional scroll bars, ensure handle is at least 5 pixels; |
| 6410 | otherwise use the fixed height. */ | 6353 | otherwise use the fixed height. */ |
| 6411 | vertical_scroll_bar_min_handle = (pfnSetScrollInfo != NULL) ? 5 : | 6354 | vertical_scroll_bar_min_handle = 5; |
| 6412 | GetSystemMetrics (SM_CYVTHUMB); | ||
| 6413 | 6355 | ||
| 6414 | /* For either kind of scroll bar, take account of the arrows; these | 6356 | /* For either kind of scroll bar, take account of the arrows; these |
| 6415 | effectively form the border of the main scroll bar range. */ | 6357 | effectively form the border of the main scroll bar range. */ |
diff --git a/src/window.c b/src/window.c index 5dced198811..e7f2ed93fd3 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3780,7 +3780,9 @@ SIZE includes that window's scroll bar, or the divider column to its right. | |||
| 3780 | Interactively, all arguments are nil. | 3780 | Interactively, all arguments are nil. |
| 3781 | 3781 | ||
| 3782 | Returns the newly created window (which is the lower or rightmost one). | 3782 | Returns the newly created window (which is the lower or rightmost one). |
| 3783 | The upper or leftmost window is the original one and remains selected. | 3783 | The upper or leftmost window is the original one, and remains selected |
| 3784 | if it was selected before. | ||
| 3785 | |||
| 3784 | See Info node `(elisp)Splitting Windows' for more details and examples.*/) | 3786 | See Info node `(elisp)Splitting Windows' for more details and examples.*/) |
| 3785 | (window, size, horflag) | 3787 | (window, size, horflag) |
| 3786 | Lisp_Object window, size, horflag; | 3788 | Lisp_Object window, size, horflag; |
| @@ -4895,6 +4897,8 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4895 | } | 4897 | } |
| 4896 | else if (noerror) | 4898 | else if (noerror) |
| 4897 | return; | 4899 | return; |
| 4900 | else if (n < 0) /* could happen with empty buffers */ | ||
| 4901 | Fsignal (Qbeginning_of_buffer, Qnil); | ||
| 4898 | else | 4902 | else |
| 4899 | Fsignal (Qend_of_buffer, Qnil); | 4903 | Fsignal (Qend_of_buffer, Qnil); |
| 4900 | } | 4904 | } |
| @@ -5796,6 +5800,7 @@ struct saved_window | |||
| 5796 | Lisp_Object left_margin_cols, right_margin_cols; | 5800 | Lisp_Object left_margin_cols, right_margin_cols; |
| 5797 | Lisp_Object left_fringe_width, right_fringe_width, fringes_outside_margins; | 5801 | Lisp_Object left_fringe_width, right_fringe_width, fringes_outside_margins; |
| 5798 | Lisp_Object scroll_bar_width, vertical_scroll_bar_type; | 5802 | Lisp_Object scroll_bar_width, vertical_scroll_bar_type; |
| 5803 | Lisp_Object dedicated; | ||
| 5799 | }; | 5804 | }; |
| 5800 | 5805 | ||
| 5801 | #define SAVED_WINDOW_N(swv,n) \ | 5806 | #define SAVED_WINDOW_N(swv,n) \ |
| @@ -5806,9 +5811,7 @@ DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_ | |||
| 5806 | (object) | 5811 | (object) |
| 5807 | Lisp_Object object; | 5812 | Lisp_Object object; |
| 5808 | { | 5813 | { |
| 5809 | if (WINDOW_CONFIGURATIONP (object)) | 5814 | return WINDOW_CONFIGURATIONP (object) ? Qt : Qnil; |
| 5810 | return Qt; | ||
| 5811 | return Qnil; | ||
| 5812 | } | 5815 | } |
| 5813 | 5816 | ||
| 5814 | DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_configuration_frame, 1, 1, 0, | 5817 | DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_configuration_frame, 1, 1, 0, |
| @@ -6030,6 +6033,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6030 | w->fringes_outside_margins = p->fringes_outside_margins; | 6033 | w->fringes_outside_margins = p->fringes_outside_margins; |
| 6031 | w->scroll_bar_width = p->scroll_bar_width; | 6034 | w->scroll_bar_width = p->scroll_bar_width; |
| 6032 | w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; | 6035 | w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; |
| 6036 | w->dedicated = p->dedicated; | ||
| 6033 | XSETFASTINT (w->last_modified, 0); | 6037 | XSETFASTINT (w->last_modified, 0); |
| 6034 | XSETFASTINT (w->last_overlay_modified, 0); | 6038 | XSETFASTINT (w->last_overlay_modified, 0); |
| 6035 | 6039 | ||
| @@ -6299,6 +6303,7 @@ save_window_save (window, vector, i) | |||
| 6299 | p->fringes_outside_margins = w->fringes_outside_margins; | 6303 | p->fringes_outside_margins = w->fringes_outside_margins; |
| 6300 | p->scroll_bar_width = w->scroll_bar_width; | 6304 | p->scroll_bar_width = w->scroll_bar_width; |
| 6301 | p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; | 6305 | p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; |
| 6306 | p->dedicated = w->dedicated; | ||
| 6302 | if (!NILP (w->buffer)) | 6307 | if (!NILP (w->buffer)) |
| 6303 | { | 6308 | { |
| 6304 | /* Save w's value of point in the window configuration. | 6309 | /* Save w's value of point in the window configuration. |
diff --git a/src/xdisp.c b/src/xdisp.c index 32255f92da7..f87f38dc50e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1973,15 +1973,15 @@ get_glyph_string_clip_rect (s, nr) | |||
| 1973 | Set w->phys_cursor_width to width of phys cursor. | 1973 | Set w->phys_cursor_width to width of phys cursor. |
| 1974 | */ | 1974 | */ |
| 1975 | 1975 | ||
| 1976 | int | 1976 | void |
| 1977 | get_phys_cursor_geometry (w, row, glyph, heightp) | 1977 | get_phys_cursor_geometry (w, row, glyph, xp, yp, heightp) |
| 1978 | struct window *w; | 1978 | struct window *w; |
| 1979 | struct glyph_row *row; | 1979 | struct glyph_row *row; |
| 1980 | struct glyph *glyph; | 1980 | struct glyph *glyph; |
| 1981 | int *heightp; | 1981 | int *xp, *yp, *heightp; |
| 1982 | { | 1982 | { |
| 1983 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 1983 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 1984 | int y, wd, h, h0, y0; | 1984 | int x, y, wd, h, h0, y0; |
| 1985 | 1985 | ||
| 1986 | /* Compute the width of the rectangle to draw. If on a stretch | 1986 | /* Compute the width of the rectangle to draw. If on a stretch |
| 1987 | glyph, and `x-stretch-block-cursor' is nil, don't draw a | 1987 | glyph, and `x-stretch-block-cursor' is nil, don't draw a |
| @@ -1991,6 +1991,14 @@ get_phys_cursor_geometry (w, row, glyph, heightp) | |||
| 1991 | #ifdef HAVE_NTGUI | 1991 | #ifdef HAVE_NTGUI |
| 1992 | wd++; /* Why? */ | 1992 | wd++; /* Why? */ |
| 1993 | #endif | 1993 | #endif |
| 1994 | |||
| 1995 | x = w->phys_cursor.x; | ||
| 1996 | if (x < 0) | ||
| 1997 | { | ||
| 1998 | wd += x; | ||
| 1999 | x = 0; | ||
| 2000 | } | ||
| 2001 | |||
| 1994 | if (glyph->type == STRETCH_GLYPH | 2002 | if (glyph->type == STRETCH_GLYPH |
| 1995 | && !x_stretch_cursor_p) | 2003 | && !x_stretch_cursor_p) |
| 1996 | wd = min (FRAME_COLUMN_WIDTH (f), wd); | 2004 | wd = min (FRAME_COLUMN_WIDTH (f), wd); |
| @@ -2020,8 +2028,9 @@ get_phys_cursor_geometry (w, row, glyph, heightp) | |||
| 2020 | } | 2028 | } |
| 2021 | } | 2029 | } |
| 2022 | 2030 | ||
| 2031 | *xp = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, x); | ||
| 2032 | *yp = WINDOW_TO_FRAME_PIXEL_Y (w, y); | ||
| 2023 | *heightp = h; | 2033 | *heightp = h; |
| 2024 | return WINDOW_TO_FRAME_PIXEL_Y (w, y); | ||
| 2025 | } | 2034 | } |
| 2026 | 2035 | ||
| 2027 | /* | 2036 | /* |
| @@ -6215,6 +6224,8 @@ next_element_from_composition (it) | |||
| 6215 | it->position = (STRINGP (it->string) | 6224 | it->position = (STRINGP (it->string) |
| 6216 | ? it->current.string_pos | 6225 | ? it->current.string_pos |
| 6217 | : it->current.pos); | 6226 | : it->current.pos); |
| 6227 | if (STRINGP (it->string)) | ||
| 6228 | it->object = it->string; | ||
| 6218 | return 1; | 6229 | return 1; |
| 6219 | } | 6230 | } |
| 6220 | 6231 | ||
| @@ -11617,9 +11628,11 @@ redisplay_window_1 (window) | |||
| 11617 | 11628 | ||
| 11618 | /* Set cursor position of W. PT is assumed to be displayed in ROW. | 11629 | /* Set cursor position of W. PT is assumed to be displayed in ROW. |
| 11619 | DELTA is the number of bytes by which positions recorded in ROW | 11630 | DELTA is the number of bytes by which positions recorded in ROW |
| 11620 | differ from current buffer positions. */ | 11631 | differ from current buffer positions. |
| 11621 | 11632 | ||
| 11622 | void | 11633 | Return 0 if cursor is not on this row. 1 otherwise. */ |
| 11634 | |||
| 11635 | int | ||
| 11623 | set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | 11636 | set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) |
| 11624 | struct window *w; | 11637 | struct window *w; |
| 11625 | struct glyph_row *row; | 11638 | struct glyph_row *row; |
| @@ -11769,6 +11782,11 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 11769 | SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); | 11782 | SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); |
| 11770 | } | 11783 | } |
| 11771 | } | 11784 | } |
| 11785 | |||
| 11786 | /* If we reached the end of the line, and end was from a string, | ||
| 11787 | cursor is not on this line. */ | ||
| 11788 | if (glyph == end && row->continued_p) | ||
| 11789 | return 0; | ||
| 11772 | } | 11790 | } |
| 11773 | 11791 | ||
| 11774 | w->cursor.hpos = glyph - row->glyphs[TEXT_AREA]; | 11792 | w->cursor.hpos = glyph - row->glyphs[TEXT_AREA]; |
| @@ -11802,6 +11820,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 11802 | else | 11820 | else |
| 11803 | CHARPOS (this_line_start_pos) = 0; | 11821 | CHARPOS (this_line_start_pos) = 0; |
| 11804 | } | 11822 | } |
| 11823 | |||
| 11824 | return 1; | ||
| 11805 | } | 11825 | } |
| 11806 | 11826 | ||
| 11807 | 11827 | ||
| @@ -12485,8 +12505,18 @@ try_cursor_movement (window, startp, scroll_step) | |||
| 12485 | rc = CURSOR_MOVEMENT_MUST_SCROLL; | 12505 | rc = CURSOR_MOVEMENT_MUST_SCROLL; |
| 12486 | else | 12506 | else |
| 12487 | { | 12507 | { |
| 12488 | set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); | 12508 | do |
| 12489 | rc = CURSOR_MOVEMENT_SUCCESS; | 12509 | { |
| 12510 | if (set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0)) | ||
| 12511 | { | ||
| 12512 | rc = CURSOR_MOVEMENT_SUCCESS; | ||
| 12513 | break; | ||
| 12514 | } | ||
| 12515 | ++row; | ||
| 12516 | } | ||
| 12517 | while (MATRIX_ROW_BOTTOM_Y (row) < last_y | ||
| 12518 | && MATRIX_ROW_START_CHARPOS (row) == PT | ||
| 12519 | && cursor_row_p (w, row)); | ||
| 12490 | } | 12520 | } |
| 12491 | } | 12521 | } |
| 12492 | } | 12522 | } |
| @@ -14944,6 +14974,25 @@ dump_glyph (row, glyph, area) | |||
| 14944 | glyph->left_box_line_p, | 14974 | glyph->left_box_line_p, |
| 14945 | glyph->right_box_line_p); | 14975 | glyph->right_box_line_p); |
| 14946 | } | 14976 | } |
| 14977 | else if (glyph->type == COMPOSITE_GLYPH) | ||
| 14978 | { | ||
| 14979 | fprintf (stderr, | ||
| 14980 | " %5d %4c %6d %c %3d 0x%05x %c %4d %1.1d%1.1d\n", | ||
| 14981 | glyph - row->glyphs[TEXT_AREA], | ||
| 14982 | '+', | ||
| 14983 | glyph->charpos, | ||
| 14984 | (BUFFERP (glyph->object) | ||
| 14985 | ? 'B' | ||
| 14986 | : (STRINGP (glyph->object) | ||
| 14987 | ? 'S' | ||
| 14988 | : '-')), | ||
| 14989 | glyph->pixel_width, | ||
| 14990 | glyph->u.cmp_id, | ||
| 14991 | '.', | ||
| 14992 | glyph->face_id, | ||
| 14993 | glyph->left_box_line_p, | ||
| 14994 | glyph->right_box_line_p); | ||
| 14995 | } | ||
| 14947 | } | 14996 | } |
| 14948 | 14997 | ||
| 14949 | 14998 | ||
| @@ -21333,7 +21382,7 @@ erase_phys_cursor (w) | |||
| 21333 | /* Maybe clear the display under the cursor. */ | 21382 | /* Maybe clear the display under the cursor. */ |
| 21334 | if (w->phys_cursor_type == HOLLOW_BOX_CURSOR) | 21383 | if (w->phys_cursor_type == HOLLOW_BOX_CURSOR) |
| 21335 | { | 21384 | { |
| 21336 | int x, y; | 21385 | int x, y, left_x; |
| 21337 | int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); | 21386 | int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); |
| 21338 | int width; | 21387 | int width; |
| 21339 | 21388 | ||
| @@ -21341,12 +21390,17 @@ erase_phys_cursor (w) | |||
| 21341 | if (cursor_glyph == NULL) | 21390 | if (cursor_glyph == NULL) |
| 21342 | goto mark_cursor_off; | 21391 | goto mark_cursor_off; |
| 21343 | 21392 | ||
| 21344 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 21393 | width = cursor_glyph->pixel_width; |
| 21394 | left_x = window_box_left_offset (w, TEXT_AREA); | ||
| 21395 | x = w->phys_cursor.x; | ||
| 21396 | if (x < left_x) | ||
| 21397 | width -= left_x - x; | ||
| 21398 | width = min (width, window_box_width (w, TEXT_AREA) - x); | ||
| 21345 | y = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, cursor_row->y)); | 21399 | y = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, cursor_row->y)); |
| 21346 | width = min (cursor_glyph->pixel_width, | 21400 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, max (x, left_x)); |
| 21347 | window_box_width (w, TEXT_AREA) - w->phys_cursor.x); | ||
| 21348 | 21401 | ||
| 21349 | FRAME_RIF (f)->clear_frame_area (f, x, y, width, cursor_row->visible_height); | 21402 | if (width > 0) |
| 21403 | FRAME_RIF (f)->clear_frame_area (f, x, y, width, cursor_row->visible_height); | ||
| 21350 | } | 21404 | } |
| 21351 | 21405 | ||
| 21352 | /* Erase the cursor by redrawing the character underneath it. */ | 21406 | /* Erase the cursor by redrawing the character underneath it. */ |
diff --git a/src/xfns.c b/src/xfns.c index acbf22b600c..11552a5a9f7 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -1260,7 +1260,7 @@ x_set_icon_name (f, arg, oldval) | |||
| 1260 | if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | 1260 | if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) |
| 1261 | return; | 1261 | return; |
| 1262 | } | 1262 | } |
| 1263 | else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | 1263 | else if (!NILP (arg) || NILP (oldval)) |
| 1264 | return; | 1264 | return; |
| 1265 | 1265 | ||
| 1266 | f->icon_name = arg; | 1266 | f->icon_name = arg; |
| @@ -1635,7 +1635,7 @@ x_set_name_internal (f, name) | |||
| 1635 | text.format = 8; | 1635 | text.format = 8; |
| 1636 | text.nitems = bytes; | 1636 | text.nitems = bytes; |
| 1637 | 1637 | ||
| 1638 | if (NILP (f->icon_name)) | 1638 | if (!STRINGP (f->icon_name)) |
| 1639 | { | 1639 | { |
| 1640 | icon = text; | 1640 | icon = text; |
| 1641 | } | 1641 | } |
diff --git a/src/xmenu.c b/src/xmenu.c index 794a6f22898..48320479ad8 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -1310,9 +1310,119 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers) | |||
| 1310 | } | 1310 | } |
| 1311 | } | 1311 | } |
| 1312 | 1312 | ||
| 1313 | DEFUN ("menu-bar-open", Fmenu_bar_open, Smenu_bar_open, 0, 1, "i", | ||
| 1314 | doc: /* Start key navigation of the menu bar in FRAME. | ||
| 1315 | This initially opens the first menu bar item and you can then navigate with the | ||
| 1316 | arrow keys, select a menu entry with the return key or cancel with the | ||
| 1317 | escape key. If FRAME has no menu bar this function does nothing. | ||
| 1318 | |||
| 1319 | If FRAME is nil or not given, use the selected frame. */) | ||
| 1320 | (frame) | ||
| 1321 | Lisp_Object frame; | ||
| 1322 | { | ||
| 1323 | XEvent ev; | ||
| 1324 | FRAME_PTR f = check_x_frame (frame); | ||
| 1325 | Widget menubar; | ||
| 1326 | BLOCK_INPUT; | ||
| 1327 | |||
| 1328 | if (FRAME_EXTERNAL_MENU_BAR (f)) | ||
| 1329 | set_frame_menubar (f, 0, 1); | ||
| 1330 | |||
| 1331 | menubar = FRAME_X_OUTPUT (f)->menubar_widget; | ||
| 1332 | if (menubar) | ||
| 1333 | { | ||
| 1334 | Window child; | ||
| 1335 | int error_p = 0; | ||
| 1336 | |||
| 1337 | x_catch_errors (FRAME_X_DISPLAY (f)); | ||
| 1338 | memset (&ev, 0, sizeof ev); | ||
| 1339 | ev.xbutton.display = FRAME_X_DISPLAY (f); | ||
| 1340 | ev.xbutton.window = XtWindow (menubar); | ||
| 1341 | ev.xbutton.root = FRAME_X_DISPLAY_INFO (f)->root_window; | ||
| 1342 | ev.xbutton.time = XtLastTimestampProcessed (FRAME_X_DISPLAY (f)); | ||
| 1343 | ev.xbutton.button = Button1; | ||
| 1344 | ev.xbutton.x = ev.xbutton.y = FRAME_MENUBAR_HEIGHT (f) / 2; | ||
| 1345 | ev.xbutton.same_screen = True; | ||
| 1346 | |||
| 1347 | #ifdef USE_MOTIF | ||
| 1348 | { | ||
| 1349 | Arg al[2]; | ||
| 1350 | WidgetList list; | ||
| 1351 | Cardinal nr; | ||
| 1352 | XtSetArg (al[0], XtNchildren, &list); | ||
| 1353 | XtSetArg (al[1], XtNnumChildren, &nr); | ||
| 1354 | XtGetValues (menubar, al, 2); | ||
| 1355 | ev.xbutton.window = XtWindow (list[0]); | ||
| 1356 | } | ||
| 1357 | #endif | ||
| 1358 | |||
| 1359 | XTranslateCoordinates (FRAME_X_DISPLAY (f), | ||
| 1360 | /* From-window, to-window. */ | ||
| 1361 | ev.xbutton.window, ev.xbutton.root, | ||
| 1362 | |||
| 1363 | /* From-position, to-position. */ | ||
| 1364 | ev.xbutton.x, ev.xbutton.y, | ||
| 1365 | &ev.xbutton.x_root, &ev.xbutton.y_root, | ||
| 1366 | |||
| 1367 | /* Child of win. */ | ||
| 1368 | &child); | ||
| 1369 | error_p = x_had_errors_p (FRAME_X_DISPLAY (f)); | ||
| 1370 | x_uncatch_errors (); | ||
| 1371 | |||
| 1372 | if (! error_p) | ||
| 1373 | { | ||
| 1374 | ev.type = ButtonPress; | ||
| 1375 | ev.xbutton.state = 0; | ||
| 1376 | |||
| 1377 | XtDispatchEvent (&ev); | ||
| 1378 | ev.xbutton.type = ButtonRelease; | ||
| 1379 | ev.xbutton.state = Button1Mask; | ||
| 1380 | XtDispatchEvent (&ev); | ||
| 1381 | } | ||
| 1382 | } | ||
| 1383 | |||
| 1384 | UNBLOCK_INPUT; | ||
| 1385 | |||
| 1386 | return Qnil; | ||
| 1387 | } | ||
| 1313 | #endif /* USE_X_TOOLKIT */ | 1388 | #endif /* USE_X_TOOLKIT */ |
| 1314 | 1389 | ||
| 1390 | |||
| 1315 | #ifdef USE_GTK | 1391 | #ifdef USE_GTK |
| 1392 | DEFUN ("menu-bar-open", Fmenu_bar_open, Smenu_bar_open, 0, 1, "i", | ||
| 1393 | doc: /* Start key navigation of the menu bar in FRAME. | ||
| 1394 | This initially opens the first menu bar item and you can then navigate with the | ||
| 1395 | arrow keys, select a menu entry with the return key or cancel with the | ||
| 1396 | escape key. If FRAME has no menu bar this function does nothing. | ||
| 1397 | |||
| 1398 | If FRAME is nil or not given, use the selected frame. */) | ||
| 1399 | (frame) | ||
| 1400 | Lisp_Object frame; | ||
| 1401 | { | ||
| 1402 | GtkWidget *menubar; | ||
| 1403 | BLOCK_INPUT; | ||
| 1404 | FRAME_PTR f = check_x_frame (frame); | ||
| 1405 | |||
| 1406 | if (FRAME_EXTERNAL_MENU_BAR (f)) | ||
| 1407 | set_frame_menubar (f, 0, 1); | ||
| 1408 | |||
| 1409 | menubar = FRAME_X_OUTPUT (f)->menubar_widget; | ||
| 1410 | if (menubar) | ||
| 1411 | { | ||
| 1412 | /* Activate the first menu. */ | ||
| 1413 | GList *children = gtk_container_get_children (GTK_CONTAINER (menubar)); | ||
| 1414 | |||
| 1415 | gtk_menu_shell_select_item (GTK_MENU_SHELL (menubar), | ||
| 1416 | GTK_WIDGET (children->data)); | ||
| 1417 | |||
| 1418 | popup_activated_flag = 1; | ||
| 1419 | g_list_free (children); | ||
| 1420 | } | ||
| 1421 | UNBLOCK_INPUT; | ||
| 1422 | |||
| 1423 | return Qnil; | ||
| 1424 | } | ||
| 1425 | |||
| 1316 | /* Loop util popup_activated_flag is set to zero in a callback. | 1426 | /* Loop util popup_activated_flag is set to zero in a callback. |
| 1317 | Used for popup menus and dialogs. */ | 1427 | Used for popup menus and dialogs. */ |
| 1318 | 1428 | ||
| @@ -3704,6 +3814,13 @@ The enable predicate for a menu command should check this variable. */); | |||
| 3704 | #endif | 3814 | #endif |
| 3705 | 3815 | ||
| 3706 | defsubr (&Sx_popup_menu); | 3816 | defsubr (&Sx_popup_menu); |
| 3817 | |||
| 3818 | #if defined (USE_GTK) || defined (USE_X_TOOLKIT) | ||
| 3819 | defsubr (&Smenu_bar_open); | ||
| 3820 | Fdefalias (intern ("accelerate-menu"), intern (Smenu_bar_open.symbol_name), | ||
| 3821 | Qnil); | ||
| 3822 | #endif | ||
| 3823 | |||
| 3707 | #ifdef HAVE_MENUS | 3824 | #ifdef HAVE_MENUS |
| 3708 | defsubr (&Sx_popup_dialog); | 3825 | defsubr (&Sx_popup_dialog); |
| 3709 | #endif | 3826 | #endif |
diff --git a/src/xterm.c b/src/xterm.c index cc06c48df33..2bfb8a15bb8 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -362,6 +362,7 @@ static void x_check_fullscreen P_ ((struct frame *)); | |||
| 362 | static void x_check_expected_move P_ ((struct frame *)); | 362 | static void x_check_expected_move P_ ((struct frame *)); |
| 363 | static int handle_one_xevent P_ ((struct x_display_info *, XEvent *, | 363 | static int handle_one_xevent P_ ((struct x_display_info *, XEvent *, |
| 364 | int *, struct input_event *)); | 364 | int *, struct input_event *)); |
| 365 | static SIGTYPE x_connection_closed P_ ((Display *, char *)); | ||
| 365 | 366 | ||
| 366 | 367 | ||
| 367 | /* Flush display of frame F, or of all frames if F is null. */ | 368 | /* Flush display of frame F, or of all frames if F is null. */ |
| @@ -2543,19 +2544,28 @@ x_draw_stretch_glyph_string (s) | |||
| 2543 | { | 2544 | { |
| 2544 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor | 2545 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor |
| 2545 | as wide as the stretch glyph. */ | 2546 | as wide as the stretch glyph. */ |
| 2546 | int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width); | 2547 | int width, background_width = s->background_width; |
| 2548 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | ||
| 2549 | |||
| 2550 | if (x < left_x) | ||
| 2551 | { | ||
| 2552 | background_width -= left_x - x; | ||
| 2553 | x = left_x; | ||
| 2554 | } | ||
| 2555 | width = min (FRAME_COLUMN_WIDTH (s->f), background_width); | ||
| 2547 | 2556 | ||
| 2548 | /* Draw cursor. */ | 2557 | /* Draw cursor. */ |
| 2549 | x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); | 2558 | x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); |
| 2550 | 2559 | ||
| 2551 | /* Clear rest using the GC of the original non-cursor face. */ | 2560 | /* Clear rest using the GC of the original non-cursor face. */ |
| 2552 | if (width < s->background_width) | 2561 | if (width < background_width) |
| 2553 | { | 2562 | { |
| 2554 | int x = s->x + width, y = s->y; | 2563 | int y = s->y; |
| 2555 | int w = s->background_width - width, h = s->height; | 2564 | int w = background_width - width, h = s->height; |
| 2556 | XRectangle r; | 2565 | XRectangle r; |
| 2557 | GC gc; | 2566 | GC gc; |
| 2558 | 2567 | ||
| 2568 | x += width; | ||
| 2559 | if (s->row->mouse_face_p | 2569 | if (s->row->mouse_face_p |
| 2560 | && cursor_in_mouse_face_p (s->w)) | 2570 | && cursor_in_mouse_face_p (s->w)) |
| 2561 | { | 2571 | { |
| @@ -2586,8 +2596,18 @@ x_draw_stretch_glyph_string (s) | |||
| 2586 | } | 2596 | } |
| 2587 | } | 2597 | } |
| 2588 | else if (!s->background_filled_p) | 2598 | else if (!s->background_filled_p) |
| 2589 | x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, | 2599 | { |
| 2590 | s->height); | 2600 | int background_width = s->background_width; |
| 2601 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | ||
| 2602 | |||
| 2603 | if (x < left_x) | ||
| 2604 | { | ||
| 2605 | background_width -= left_x - x; | ||
| 2606 | x = left_x; | ||
| 2607 | } | ||
| 2608 | if (background_width > 0) | ||
| 2609 | x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); | ||
| 2610 | } | ||
| 2591 | 2611 | ||
| 2592 | s->background_filled_p = 1; | 2612 | s->background_filled_p = 1; |
| 2593 | } | 2613 | } |
| @@ -7172,8 +7192,7 @@ x_draw_hollow_cursor (w, row) | |||
| 7172 | return; | 7192 | return; |
| 7173 | 7193 | ||
| 7174 | /* Compute frame-relative coordinates for phys cursor. */ | 7194 | /* Compute frame-relative coordinates for phys cursor. */ |
| 7175 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 7195 | get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h); |
| 7176 | y = get_phys_cursor_geometry (w, row, cursor_glyph, &h); | ||
| 7177 | wd = w->phys_cursor_width; | 7196 | wd = w->phys_cursor_width; |
| 7178 | 7197 | ||
| 7179 | /* The foreground of cursor_gc is typically the same as the normal | 7198 | /* The foreground of cursor_gc is typically the same as the normal |