diff options
| author | Miles Bader | 2006-06-07 18:05:10 +0000 |
|---|---|---|
| committer | Miles Bader | 2006-06-07 18:05:10 +0000 |
| commit | b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb (patch) | |
| tree | de3804210a8cd955e0d3b9abc15679480930bc82 /src | |
| parent | 885b7d0991bd4b4b8f4bd1d3cd21c18a697bbce2 (diff) | |
| parent | 26c9afc3239e18b03537faaea33e3e82e28099e6 (diff) | |
| download | emacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.tar.gz emacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.zip | |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 285-296)
- Update from CVS
- Merge from gnus--rel--5.10
- Update from CVS: admin/FOR-RELEASE: Update refcard section.
* gnus--rel--5.10 (patch 102-104)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-64
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 455 | ||||
| -rw-r--r-- | src/Makefile.in | 3 | ||||
| -rw-r--r-- | src/buffer.c | 21 | ||||
| -rw-r--r-- | src/callint.c | 2 | ||||
| -rw-r--r-- | src/coding.c | 11 | ||||
| -rw-r--r-- | src/config.in | 6 | ||||
| -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/frame.c | 2 | ||||
| -rw-r--r-- | src/gtkutil.c | 34 | ||||
| -rw-r--r-- | src/image.c | 13 | ||||
| -rw-r--r-- | src/intervals.c | 4 | ||||
| -rw-r--r-- | src/lisp.h | 6 | ||||
| -rw-r--r-- | src/lread.c | 73 | ||||
| -rw-r--r-- | src/mac.c | 180 | ||||
| -rw-r--r-- | src/macfns.c | 46 | ||||
| -rw-r--r-- | src/macgui.h | 7 | ||||
| -rw-r--r-- | src/macselect.c | 369 | ||||
| -rw-r--r-- | src/macterm.c | 735 | ||||
| -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/puresize.h | 2 | ||||
| -rw-r--r-- | src/search.c | 1 | ||||
| -rw-r--r-- | src/sound.c | 413 | ||||
| -rw-r--r-- | src/sysdep.c | 2 | ||||
| -rw-r--r-- | src/w32.c | 38 | ||||
| -rw-r--r-- | src/w32fns.c | 2 | ||||
| -rw-r--r-- | src/w32heap.c | 4 | ||||
| -rw-r--r-- | src/w32term.c | 224 | ||||
| -rw-r--r-- | src/window.c | 15 | ||||
| -rw-r--r-- | src/xdisp.c | 100 | ||||
| -rw-r--r-- | src/xfaces.c | 75 | ||||
| -rw-r--r-- | src/xfns.c | 4 | ||||
| -rw-r--r-- | src/xmenu.c | 117 | ||||
| -rw-r--r-- | src/xterm.c | 51 | ||||
| -rw-r--r-- | src/xterm.h | 10 |
40 files changed, 2636 insertions, 649 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 61fca56c357..d0ad63de10d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,441 @@ | |||
| 1 | 2006-06-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * macterm.c [USE_MAC_TSM] (mac_handle_text_input_event): Exclude | ||
| 4 | 0x7f from ASCII range. | ||
| 5 | |||
| 6 | 2006-06-05 Jason Rumney <jasonr@gnu.org> | ||
| 7 | |||
| 8 | * w32term.c (w32_set_scroll_bar_thumb, x_scroll_bar_create) | ||
| 9 | (w32_set_vertical_scroll_bar, w32_scroll_bar_handle_click) | ||
| 10 | (x_scroll_bar_report_motion): Remove workarounds for | ||
| 11 | versions of Windows NT < 3.51. | ||
| 12 | [!SIF_ALL]: Remove. | ||
| 13 | (pfnSetScrollInfo, pfnGetScrollInfo): Remove. | ||
| 14 | (w32_initialize): Don't dynamically load Get/SetScrollInfo. | ||
| 15 | |||
| 16 | 2006-06-04 David Kastrup <dak@gnu.org> | ||
| 17 | |||
| 18 | * dispnew.c: Mention `redisplay-dont-pause' in doc string of | ||
| 19 | `sit-for'. | ||
| 20 | |||
| 21 | 2006-06-03 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 22 | |||
| 23 | * macfns.c (x_set_icon_name): Apply 2006-06-02 change for xfns.c. | ||
| 24 | |||
| 25 | * macgui.h (USE_MAC_TSM): Set default to 1 on Mac OS X. | ||
| 26 | |||
| 27 | * macterm.c (tsm_document_id) [USE_MAC_TSM]: New variable. | ||
| 28 | (Qtext_input, Qupdate_active_input_area, Qunicode_for_key_event) | ||
| 29 | [USE_MAC_TSM]: Likewise. | ||
| 30 | (syms_of_macterm) [USE_MAC_TSM]: Intern and staticpro them. | ||
| 31 | (Qbefore_string) [USE_MAC_TSM]: Add extern. | ||
| 32 | (do_app_resume, do_app_suspend) [USE_MAC_TSM]: Call | ||
| 33 | ActivateTSMDocument/DeactivateTSMDocument. | ||
| 34 | (mac_store_event_ref_as_apple_event): Call mac_post_mouse_moved_event. | ||
| 35 | (mac_handle_window_event) [USE_MAC_TSM]: Handle | ||
| 36 | kEventWindowFocusAcquired/kEventWindowFocusRelinquish. | ||
| 37 | (mac_handle_text_input_event) [USE_MAC_TSM]: New function. | ||
| 38 | (install_window_handler) [USE_MAC_TSM]: Install it. Register | ||
| 39 | kEventWindowFocusAcquired/kEventWindowFocusRelinquish. | ||
| 40 | (keycode_to_xkeysym_table): Add entry for f16. | ||
| 41 | (XTread_socket) [USE_MAC_TSM]: Set/reset read_socket_inev | ||
| 42 | before/after passing keystroke event to toolbox dispatcher. | ||
| 43 | (init_tsm) [USE_MAC_TSM]: New function. | ||
| 44 | (mac_initialize) [USE_MAC_TSM]: Call it. | ||
| 45 | (Vmac_ts_active_input_overlay) [USE_MAC_TSM]: New defvar. | ||
| 46 | |||
| 47 | * macterm.h (EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER): New enumerator. | ||
| 48 | |||
| 49 | 2006-06-02 John Paul Wallington <jpw@gnu.org> | ||
| 50 | |||
| 51 | * xfns.c (x_set_name_internal): Set icon to `text', derived from | ||
| 52 | name, when frame's icon_name isn't a string rather than only when | ||
| 53 | it is nil. | ||
| 54 | |||
| 55 | 2006-06-03 Eli Zaretskii <eliz@gnu.org> | ||
| 56 | |||
| 57 | * w32fns.c (x_set_icon_name): Don't use arg if it's not a string | ||
| 58 | and not nil. | ||
| 59 | |||
| 60 | 2006-06-02 Chong Yidong <cyd@stupidchicken.com> | ||
| 61 | |||
| 62 | * xfns.c (x_set_icon_name): No-op if arg is non-nil and not a | ||
| 63 | string. | ||
| 64 | |||
| 65 | 2006-06-02 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 66 | |||
| 67 | * xdisp.c (next_element_from_composition): Set it->object to | ||
| 68 | it->string if composition is coming from string. | ||
| 69 | (set_cursor_from_row): Don't return 0 unless row displays a | ||
| 70 | continued line. | ||
| 71 | (dump_glyph): Dump composite glyph. | ||
| 72 | |||
| 73 | 2006-06-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 74 | |||
| 75 | * gtkutil.c (menu_nav_ended): Check that menubar_widget is not NULL. | ||
| 76 | |||
| 77 | 2006-06-01 Richard Stallman <rms@gnu.org> | ||
| 78 | |||
| 79 | * window.c (Fsplit_window): Doc fix. | ||
| 80 | |||
| 81 | 2006-06-01 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> | ||
| 82 | |||
| 83 | * process.c (deleted_pid_list): New variable to store the pids | ||
| 84 | of deleted processes. Declare it only if SIGCHLD is defined. | ||
| 85 | (init_process): Initialize it. | ||
| 86 | (syms_of_process): Staticpro it. | ||
| 87 | (Fdelete_process): Add pid of the deleted process to it. Check after | ||
| 88 | the addition and before the kill if the process is already stopped, | ||
| 89 | in which case it is deleted from the list and not killed. | ||
| 90 | (sigchld_handler): Define it only if SIGCHLD is. Search the process | ||
| 91 | that signaled Emacs in `deleted_pid_list' before `Vprocess_alist'. | ||
| 92 | Original idea by Stefan Monnier. | ||
| 93 | |||
| 94 | 2006-06-01 Kim F. Storm <storm@cua.dk> | ||
| 95 | |||
| 96 | * dispnew.c (sit_for): Perform redisplay even if input is pending | ||
| 97 | when redisplay-dont-pause is non-nil. | ||
| 98 | |||
| 99 | 2006-06-01 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 100 | |||
| 101 | * macterm.c (mac_handle_visibility_change): Set buf.arg to Qnil. | ||
| 102 | (XTread_socket): Remove obsolete comment. | ||
| 103 | |||
| 104 | 2006-06-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 105 | |||
| 106 | * xmenu.c (syms_of_xmenu): Make accelerate-menu an alias for | ||
| 107 | menu-bar-open. | ||
| 108 | |||
| 109 | 2006-06-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 110 | |||
| 111 | * xmenu.c (Fmenu_bar_open, syms_of_xmenu): Change menu-bar-start to | ||
| 112 | menu-bar-open. | ||
| 113 | |||
| 114 | * gtkutil.c (menu_nav_ended): Change x-menu-bar-start to menu-bar-open. | ||
| 115 | |||
| 116 | 2006-05-31 Juri Linkov <juri@jurta.org> | ||
| 117 | |||
| 118 | * minibuf.c (Vhistory_add_new_input): New variable. | ||
| 119 | (read_minibuf): Use it. | ||
| 120 | (syms_of_minibuf) <history-add-new-input>: New Lisp variable. | ||
| 121 | (syms_of_minibuf) <history-delete-duplicates>: Doc fix. | ||
| 122 | |||
| 123 | 2006-05-31 Kim F. Storm <storm@cua.dk> | ||
| 124 | |||
| 125 | * process.c (select_wrapper): Add wrapper around select to work around | ||
| 126 | "incomplete backtrace" bug in gdb 5.3, when emacs is stopped inside | ||
| 127 | select called from wait_reading_process_output. | ||
| 128 | |||
| 129 | 2006-05-30 Andreas Schwab <schwab@suse.de> | ||
| 130 | |||
| 131 | * xmenu.c (Fmenu_bar_start): Return a value. | ||
| 132 | |||
| 133 | 2006-05-30 Richard Stallman <rms@gnu.org> | ||
| 134 | |||
| 135 | * coding.c (Ffind_operation_coding_system): Doc fix. | ||
| 136 | |||
| 137 | 2006-05-30 Eli Zaretskii <eliz@gnu.org> | ||
| 138 | |||
| 139 | * w32term.c (x_draw_hollow_cursor): Fix last change. | ||
| 140 | |||
| 141 | 2006-05-29 Kim F. Storm <storm@cua.dk> | ||
| 142 | |||
| 143 | * w32term.c (x_draw_stretch_glyph_string): Fix last change. | ||
| 144 | |||
| 145 | 2006-05-29 Eli Zaretskii <eliz@gnu.org> | ||
| 146 | |||
| 147 | * coding.c (Ffind_operation_coding_system): Doc fix. | ||
| 148 | |||
| 149 | 2006-05-29 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 150 | |||
| 151 | * macfns.c [USE_MAC_FONT_PANEL] (Fmac_set_font_panel_visibility): | ||
| 152 | Call mac_set_font_info_for_selection if font panel is made visible. | ||
| 153 | |||
| 154 | * macterm.c (font_panel_shown_p) [USE_MAC_FONT_PANEL]: New variable. | ||
| 155 | (mac_font_panel_visible_p, mac_show_hide_font_panel) | ||
| 156 | [USE_MAC_FONT_PANEL]: New functions. | ||
| 157 | [USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection): Return | ||
| 158 | immediately if font panel is not visible. | ||
| 159 | |||
| 160 | * macterm.h (mac_font_panel_visible_p, mac_show_hide_font_panel): | ||
| 161 | Add externs. | ||
| 162 | |||
| 163 | 2006-05-29 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 164 | |||
| 165 | * search.c (matcher_overflow): Mark as NO_RETURN. | ||
| 166 | |||
| 167 | * xterm.c (x_connection_closed): Likewise. | ||
| 168 | |||
| 169 | * sysdep.c (croak): Likewise. | ||
| 170 | |||
| 171 | * sound.c (sound_perror, alsa_sound_perror): Likewise. | ||
| 172 | |||
| 173 | * lisp.h (die, nsberror): Likewise. | ||
| 174 | |||
| 175 | 2006-05-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 176 | |||
| 177 | * sound.c (alsa_open, alsa_configure, alsa_write): Move | ||
| 178 | assignment to err out of if-statement. | ||
| 179 | |||
| 180 | * gtkutil.c (menu_nav_ended): New function. | ||
| 181 | (create_menus): Connect menu_nav_ended to "selection-done" to fix | ||
| 182 | grabs. | ||
| 183 | |||
| 184 | * xmenu.c (Fmenu_bar_start): New function for USE_GTK and USE_X_TOOLKIT. | ||
| 185 | |||
| 186 | 2006-05-28 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 187 | |||
| 188 | * charset.h (invalid_character): Mark as NO_RETURN. | ||
| 189 | |||
| 190 | 2006-05-29 Kenichi Handa <handa@m17n.org> | ||
| 191 | |||
| 192 | * coding.c (Ffind_operation_coding_system): Call a function by | ||
| 193 | safe_call1 instead of call1. | ||
| 194 | |||
| 195 | 2006-05-28 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 196 | |||
| 197 | * window.c (struct saved_window): Add `dedicated'. | ||
| 198 | (Fset_window_configuration, save_window_save): Save/restore the | ||
| 199 | `dedicated' flag. | ||
| 200 | |||
| 201 | 2006-05-28 Kim F. Storm <storm@cua.dk> | ||
| 202 | |||
| 203 | * xdisp.c (set_cursor_from_row): If cursor cannot be set in row, | ||
| 204 | don't update w->cursor and return 0. Return 1 on success. | ||
| 205 | (try_cursor_movement): Repeat set_cursor_from_row on successive rows | ||
| 206 | until it succeeds. | ||
| 207 | |||
| 208 | * dispextern.h (set_cursor_from_row): Update prototype. | ||
| 209 | |||
| 210 | 2006-05-28 Kim F. Storm <storm@cua.dk> | ||
| 211 | |||
| 212 | * xdisp.c (get_phys_cursor_geometry): Return computed x and y through | ||
| 213 | parameters. Adjust x and width in case cursor in on a partially | ||
| 214 | visible stretch glyph on the left edge. | ||
| 215 | (erase_phys_cursor): Don't erase into left fringe/margin in case | ||
| 216 | previous cursor glyph is a partially visible stretch glyph on left. | ||
| 217 | |||
| 218 | * dispextern.h (get_phys_cursor_geometry): Update prototype. | ||
| 219 | |||
| 220 | * xterm.c (x_draw_stretch_glyph_string): Fix problems with invisible | ||
| 221 | cursor and erasing cursor on partially visible stretch glyph on left. | ||
| 222 | (x_draw_hollow_cursor): Compute x via get_phys_cursor_geometry. | ||
| 223 | |||
| 224 | * macterm.c: Likewise. | ||
| 225 | |||
| 226 | * w32term.c: Likewise. | ||
| 227 | |||
| 228 | 2006-05-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 229 | |||
| 230 | * macselect.c (mac_handle_apple_event): | ||
| 231 | Return errAEEventNotHandled if key binding is not found. | ||
| 232 | |||
| 233 | 2006-05-26 Eli Zaretskii <eliz@gnu.org> | ||
| 234 | |||
| 235 | * emacs.c (main) [PROFILING]: Enable also for __MINGW32__. | ||
| 236 | [__MINGW32__]: MinGW-specific declaration of `etext'. | ||
| 237 | |||
| 238 | * w32heap.c (etext, edata): Remove unused definitions. | ||
| 239 | |||
| 240 | 2006-05-26 Chong Yidong <cyd@stupidchicken.com> | ||
| 241 | |||
| 242 | * fileio.c (Fcopy_file): Delete argument MUSTBENEW. | ||
| 243 | Incorporate the exclusive file-opening functionality into the behavior | ||
| 244 | when OK-IF-ALREADY-EXISTS is nil. | ||
| 245 | (Frename_file): Call Fcopy_file without MUSTBENEW argument. | ||
| 246 | |||
| 247 | 2006-05-26 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 248 | |||
| 249 | * sound.c (alsa_configure): Move get period/buffer_size after | ||
| 250 | setting hwparams. | ||
| 251 | |||
| 252 | 2006-05-26 Kenichi Handa <handa@m17n.org> | ||
| 253 | |||
| 254 | * coding.c (Ffind_operation_coding_system): Allow (FILENAME | ||
| 255 | . BUFFER) in TARGET. | ||
| 256 | |||
| 257 | 2006-05-25 Chong Yidong <cyd@stupidchicken.com> | ||
| 258 | |||
| 259 | * image.c (png_load): Don't call fclose on NULL. | ||
| 260 | |||
| 261 | 2006-05-25 Luc Teirlinck <teirllm@auburn.edu> | ||
| 262 | |||
| 263 | * fns.c (Fyes_or_no_p): | ||
| 264 | * callint.c (Fcall_interactively): Fread_from_minibuffer now takes | ||
| 265 | only seven args. | ||
| 266 | |||
| 267 | 2006-05-25 Juri Linkov <juri@jurta.org> | ||
| 268 | |||
| 269 | * lisp.h (Fread_from_minibuffer): Decrement number of args. | ||
| 270 | |||
| 271 | * minibuf.c (read_minibuf): Remove arg KEEP_ALL. Callers changed. | ||
| 272 | (Fread_from_minibuffer): Remove arg KEEP_ALL. Callers changed. | ||
| 273 | |||
| 274 | * buffer.c (mode-line-format): Fix docstring. | ||
| 275 | |||
| 276 | 2006-05-25 Richard Stallman <rms@gnu.org> | ||
| 277 | |||
| 278 | * emacs.c (main, Fdump_emacs): Don't test __linux or __linux__. | ||
| 279 | |||
| 280 | 2006-05-24 Luc Teirlinck <teirllm@auburn.edu> | ||
| 281 | |||
| 282 | * puresize.h (BASE_PURESIZE): Increase to 1210000. | ||
| 283 | |||
| 284 | 2006-05-24 Alan Mackenzie <acm@muc.de> | ||
| 285 | |||
| 286 | * lread.c (Vload_history): Enhance doc-string to say that the file | ||
| 287 | is the absolute truename of the loaded file. | ||
| 288 | |||
| 289 | * lread.c (Vafter_load_alist): doc-string: state that an element | ||
| 290 | now has a regexp to match file names, not a file name as such. | ||
| 291 | |||
| 292 | * lread.c (readevalloop): Call file-truename on the name for | ||
| 293 | load-history, except at preloading time. | ||
| 294 | |||
| 295 | * lread.c (Fload): At preloading time, preserve the extension of | ||
| 296 | the filename which goes into load-history. New var hist_file_name. | ||
| 297 | |||
| 298 | * lread.c (Fload): Do eval-after-load stuff by calling the lisp | ||
| 299 | function do-after-load-evaluation. | ||
| 300 | |||
| 301 | 2006-05-24 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 302 | |||
| 303 | * mac.c (ae_attr_table): New variable. | ||
| 304 | (syms_of_mac): Intern and staticpro its elements. | ||
| 305 | (mac_aelist_to_lisp): Also convert Apple event attributes. | ||
| 306 | (mac_ae_put_lisp): New function. | ||
| 307 | (create_apple_event_from_event_ref) [MAC_OSX]: Use typeUTF8Text. | ||
| 308 | |||
| 309 | * macfns.c (Fx_server_version): Use gestaltSystemVersionMajor etc. | ||
| 310 | |||
| 311 | * macselect.c (Qemacs_suspension_id): New variable. | ||
| 312 | (syms_of_macselect): Intern and staticpro it. | ||
| 313 | (struct suspended_ae_info): New struct. | ||
| 314 | (deferred_apple_events, defer_apple_events) | ||
| 315 | (Fmac_process_deferred_apple_events): Use it. | ||
| 316 | (suspended_apple_events): New variable. | ||
| 317 | (mac_handle_apple_event_1): New function. | ||
| 318 | (mac_handle_apple_event): Use it. Don't process previously | ||
| 319 | suspended events. | ||
| 320 | (cleanup_suspended_apple_events, get_suspension_id) | ||
| 321 | (cleanup_all_suspended_apple_events): New functions. | ||
| 322 | (init_apple_event_handler): Call cleanup_all_suspended_apple_events | ||
| 323 | at exit. | ||
| 324 | (Fmac_cleanup_expired_apple_events, Fmac_ae_set_reply_parameter) | ||
| 325 | (Fmac_resume_apple_event): New defuns. | ||
| 326 | (syms_of_macselect): Defsubr them. | ||
| 327 | |||
| 328 | * macterm.c (fn_keycode_to_keycode_table, XTread_socket) [MAC_OSX]: | ||
| 329 | Fix last change. Don't map `fn' modifier if pressed with F1 ... F12. | ||
| 330 | |||
| 331 | * macterm.h (TYPE_FILE_NAME): Change from macro to enumerator. | ||
| 332 | (KEY_EMACS_SUSPENSION_ID_ATTR): New enumerator. | ||
| 333 | (keyReplyRequestedAttr) [MAC_OS_X_VERSION_MAX_ALLOWED < 1030]: Likewise. | ||
| 334 | (gestaltSystemVersionMajor, gestaltSystemVersionMinor) | ||
| 335 | (gestaltSystemVersionBugFix) [MAC_OS_X_VERSION_MAX_ALLOWED < 1040]: | ||
| 336 | Likewise. | ||
| 337 | (typeUTF8Text, kEventParamWindowMouseLocation) | ||
| 338 | [MAC_OSX && MAC_OS_X_VERSION_MAX_ALLOWED < 1020]: Likewise. | ||
| 339 | (x_get_focus_frame, mac_ae_put_lisp): Add externs. | ||
| 340 | |||
| 341 | 2006-05-23 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 342 | |||
| 343 | * macterm.c (fn_keycode_to_xkeysym_table, convert_fn_keycode): Remove. | ||
| 344 | (fn_keycode_to_keycode_table) [MAC_OSX]: New variable. | ||
| 345 | (mac_set_unicode_keystroke_event) [TARGET_API_MAC_CARBON]: New function. | ||
| 346 | (XTread_socket) [TARGET_API_MAC_CARBON]: Use it. | ||
| 347 | (XTread_socket) [MAC_OSX]: Try 'uchr' Unicode keyboard-layout | ||
| 348 | resource to backtranslate key with modifiers. | ||
| 349 | (XTread_socket): Don't set read_socket_inev around AEProcessAppleEvent. | ||
| 350 | |||
| 351 | 2006-05-23 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 352 | |||
| 353 | * xterm.c: Remove declarations already in xterm.h | ||
| 354 | |||
| 355 | * xterm.h: Add extern declarations for x_clear_errors, | ||
| 356 | x_fully_uncatch_errors, x_catching_errors and | ||
| 357 | x_alloc_lighter_color_for_widget. Remove duplicated declarations. | ||
| 358 | |||
| 359 | 2006-05-21 Richard Stallman <rms@gnu.org> | ||
| 360 | |||
| 361 | * xfaces.c (best_matching_font): Abort for best == NULL | ||
| 362 | before we start to use it. | ||
| 363 | |||
| 364 | * buffer.c (syms_of_buffer, Fmake_overlay): Doc fixes. | ||
| 365 | |||
| 366 | 2006-05-20 Kim F. Storm <storm@cua.dk> | ||
| 367 | |||
| 368 | * xfaces.c (best_matching_font): Fix crash in 2006-05-17 change. | ||
| 369 | |||
| 370 | 2006-05-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 371 | |||
| 372 | * macterm.c (convert_fn_keycode): Fix last change. | ||
| 373 | |||
| 374 | 2006-05-19 Eli Zaretskii <eliz@gnu.org> | ||
| 375 | |||
| 376 | * w32.c (init_environment): Perform the processing of environment | ||
| 377 | variables on a copy of default variables and their values, not on | ||
| 378 | the original. Simplify code that calls ExpandEnvironmentStrings | ||
| 379 | and make buf1[] and buf2[] more visible for easier debugging. | ||
| 380 | |||
| 381 | 2006-05-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 382 | |||
| 383 | * frame.c (x_set_border_width): Remove #ifndef MAC_OS. | ||
| 384 | |||
| 385 | * image.c [MAC_OS] (gif_load): Allocate Lisp string first. | ||
| 386 | |||
| 387 | * macfns.c (Fx_focus_frame): Don't check dpyinfo->x_focus_frame. | ||
| 388 | |||
| 389 | * macterm.c (XTread_socket) [TARGET_API_MAC_CARBON && MAC_OSX]: | ||
| 390 | Forward keyUp events to toolbox_dispatcher. | ||
| 391 | |||
| 392 | * window.c (foreach_window): Check WINDOWP (FRAME_ROOT_WINDOW (f)). | ||
| 393 | |||
| 394 | 2006-05-18 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 395 | |||
| 396 | * config.in: Regenerated (HAVE_ALSA). | ||
| 397 | |||
| 398 | * sound.c (alsa_sound_perror, alsa_open, alsa_period_size) | ||
| 399 | (alsa_configure, alsa_close, alsa_choose_format, alsa_write) | ||
| 400 | (snd_error_quiet, alsa_init): New functions. | ||
| 401 | (vox_init): Return 0 if unable to open device. | ||
| 402 | (Fplay_sound_internal): Test for alsa first and use vox (oss) as | ||
| 403 | a fallback. | ||
| 404 | (struct sound_device): Add period_size. | ||
| 405 | (wav_play, au_play): Use period_size if set. | ||
| 406 | |||
| 407 | * Makefile.in (CFLAGS_SOUND): New flags for ALSA | ||
| 408 | (ALL_CFLAGS): Add CFLAGS_SOUND | ||
| 409 | |||
| 410 | 2006-05-18 Kenichi Handa <handa@m17n.org> | ||
| 411 | |||
| 412 | * callproc.c (Fcall_process): Reject encoding arguments by | ||
| 413 | ascii-incompatible coding systems (e.g. utf-16). | ||
| 414 | |||
| 415 | * coding.c (Qascii_incompatible): New variable. | ||
| 416 | (syms_of_coding): Setup Qascii_incompatible. | ||
| 417 | (setup_coding_system): Be sure to initialize coding->common_flags. | ||
| 418 | Check `ascii-incompatible' property of the coding system. | ||
| 419 | |||
| 420 | * coding.h (CODING_ASCII_INCOMPATIBLE_MASK): New macro. | ||
| 421 | |||
| 422 | 2006-05-18 Kim F. Storm <storm@cua.dk> | ||
| 423 | |||
| 424 | * xdisp.c (display_tool_bar_line): Restore entire tool-bar geometry when | ||
| 425 | backtracking in case last image doesn't fit on line. | ||
| 426 | |||
| 427 | 2006-05-18 MIYOSHI Masanori <miyoshi@meadowy.org> (tiny change) | ||
| 428 | |||
| 429 | * xdisp.c (display_tool_bar_line): Don't adjust tool-bar height by more than | ||
| 430 | height of one frame default line. | ||
| 431 | |||
| 432 | 2006-05-17 Richard Stallman <rms@gnu.org> | ||
| 433 | |||
| 434 | * xfaces.c (better_font_p): Any font beats no font. | ||
| 435 | (best_matching_font): Simplify based on above change. | ||
| 436 | |||
| 437 | * buffer.c (Fprevious_overlay_change, Fnext_overlay_change): Doc fixes. | ||
| 438 | |||
| 1 | 2006-05-16 Kim F. Storm <storm@cua.dk> | 439 | 2006-05-16 Kim F. Storm <storm@cua.dk> |
| 2 | 440 | ||
| 3 | * xterm.c (handle_one_xevent): Check that f is not NULL before | 441 | * xterm.c (handle_one_xevent): Check that f is not NULL before |
| @@ -62,7 +500,7 @@ | |||
| 62 | [MAC_OS] (gif_load): Emulate Graphic Control Extension block. | 500 | [MAC_OS] (gif_load): Emulate Graphic Control Extension block. |
| 63 | 501 | ||
| 64 | * macfns.c (x_to_mac_color): Fix shift amount change. | 502 | * macfns.c (x_to_mac_color): Fix shift amount change. |
| 65 | [USE_MAC_FONT_PANEL] (mac_set_font): Use x_get_focus_frame. | 503 | (mac_set_font) [USE_MAC_FONT_PANEL]: Use x_get_focus_frame. |
| 66 | [USE_MAC_FONT_PANEL] (Fmac_set_font_panel_visibility): Doc fix. | 504 | [USE_MAC_FONT_PANEL] (Fmac_set_font_panel_visibility): Doc fix. |
| 67 | 505 | ||
| 68 | * macselect.c (Vmac_service_selection) [MAC_OSX]: Rename from | 506 | * macselect.c (Vmac_service_selection) [MAC_OSX]: Rename from |
| @@ -490,7 +928,7 @@ | |||
| 490 | 928 | ||
| 491 | * puresize.h (BASE_PURESIZE): Increment to 1210000. | 929 | * puresize.h (BASE_PURESIZE): Increment to 1210000. |
| 492 | 930 | ||
| 493 | 2006-04-13 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> (tiny change) | 931 | 2006-04-13 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> |
| 494 | 932 | ||
| 495 | * print.c (Fprin1_to_string): Mention in the `doc' that the | 933 | * print.c (Fprin1_to_string): Mention in the `doc' that the |
| 496 | behavior is modified by `print-level' and `print-length'. | 934 | behavior is modified by `print-level' and `print-length'. |
| @@ -611,7 +1049,7 @@ | |||
| 611 | * xfaces.c (Finternal_merge_in_global_face, try_font_list): | 1049 | * xfaces.c (Finternal_merge_in_global_face, try_font_list): |
| 612 | Add explicit braces to avoid ambiguous `else'. | 1050 | Add explicit braces to avoid ambiguous `else'. |
| 613 | 1051 | ||
| 614 | 2006-04-11 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> (tiny change) | 1052 | 2006-04-11 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> |
| 615 | 1053 | ||
| 616 | * dispnew.c (init_display): Don't init X display if the user asked | 1054 | * dispnew.c (init_display): Don't init X display if the user asked |
| 617 | for a non-X display. | 1055 | for a non-X display. |
| @@ -8477,7 +8915,7 @@ | |||
| 8477 | 8915 | ||
| 8478 | * xfns.c (xic_create_xfontset): Initialize missing_list to NULL. | 8916 | * xfns.c (xic_create_xfontset): Initialize missing_list to NULL. |
| 8479 | 8917 | ||
| 8480 | 2004-10-21 K,Ba(Broly L,Bu(Brentey <lorentey@elte.hu> | 8918 | 2004-10-21 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu> |
| 8481 | 8919 | ||
| 8482 | * xterm.h (x_output): New member `xic_base_fontname'. | 8920 | * xterm.h (x_output): New member `xic_base_fontname'. |
| 8483 | (FRAME_XIC_BASE_FONTNAME): New macro. | 8921 | (FRAME_XIC_BASE_FONTNAME): New macro. |
| @@ -9421,7 +9859,7 @@ | |||
| 9421 | * fileio.c (Fvisited_file_modtime): Return a list of two integers, | 9859 | * fileio.c (Fvisited_file_modtime): Return a list of two integers, |
| 9422 | instead of a cons. | 9860 | instead of a cons. |
| 9423 | 9861 | ||
| 9424 | 2004-07-14 K,Ba(Broly L,Bu(Brentey <lorentey@elte.hu> | 9862 | 2004-07-14 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu> |
| 9425 | 9863 | ||
| 9426 | * keyboard.c (echo_dash): Do nothing if there already is a dash | 9864 | * keyboard.c (echo_dash): Do nothing if there already is a dash |
| 9427 | at the end of the echo string. | 9865 | at the end of the echo string. |
| @@ -9758,7 +10196,7 @@ | |||
| 9758 | * keyboard.c (cmd_error): Don't call any_kboard_state | 10196 | * keyboard.c (cmd_error): Don't call any_kboard_state |
| 9759 | if inside a recursive edit level. | 10197 | if inside a recursive edit level. |
| 9760 | 10198 | ||
| 9761 | 2004-06-13 K,Ba(Broly L,Bu(Brentey <lorentey@elte.hu> | 10199 | 2004-06-13 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu> |
| 9762 | 10200 | ||
| 9763 | * keyboard.c (command_loop): Call any_kboard_state before | 10201 | * keyboard.c (command_loop): Call any_kboard_state before |
| 9764 | command_loop_2 when at top level. | 10202 | command_loop_2 when at top level. |
| @@ -10071,7 +10509,7 @@ | |||
| 10071 | before actually accepting connection in case it has already been | 10509 | before actually accepting connection in case it has already been |
| 10072 | accepted due to recursion. | 10510 | accepted due to recursion. |
| 10073 | 10511 | ||
| 10074 | 2004-05-23 K,Ba(Broly L,Bu(Brentey <lorentey@elte.hu> | 10512 | 2004-05-23 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu> |
| 10075 | 10513 | ||
| 10076 | * coding.c (Fset_safe_terminal_coding_system_internal): | 10514 | * coding.c (Fset_safe_terminal_coding_system_internal): |
| 10077 | Set suppress_error in safe_terminal_coding, not terminal_coding. | 10515 | Set suppress_error in safe_terminal_coding, not terminal_coding. |
| @@ -17007,8 +17445,7 @@ | |||
| 17007 | (Fapropos_internal): Initialize them and clear them out. | 17445 | (Fapropos_internal): Initialize them and clear them out. |
| 17008 | Don't GCPRO them. | 17446 | Don't GCPRO them. |
| 17009 | 17447 | ||
| 17010 | * buffer.c (syms_of_buffer) <scroll-up-aggressively, scroll-down-aggressively>: | 17448 | * buffer.c (syms_of_buffer) <scroll-up|down-aggressively>: Doc fixes. |
| 17011 | Doc fixes. | ||
| 17012 | 17449 | ||
| 17013 | * lisp.h: New misc type Lisp_Save_Value. | 17450 | * lisp.h: New misc type Lisp_Save_Value. |
| 17014 | (enum Lisp_Misc_Type): Add Lisp_Misc_Save_Value. | 17451 | (enum Lisp_Misc_Type): Add Lisp_Misc_Save_Value. |
diff --git a/src/Makefile.in b/src/Makefile.in index 049a4c5bc17..342540df7be 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -281,7 +281,7 @@ TOOLKIT_DEFINES = | |||
| 281 | 281 | ||
| 282 | /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM | 282 | /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM |
| 283 | since it may have -I options that should override those two. */ | 283 | since it may have -I options that should override those two. */ |
| 284 | ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ | 284 | ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ |
| 285 | .c.o: | 285 | .c.o: |
| 286 | $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< | 286 | $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< |
| 287 | 287 | ||
| @@ -459,6 +459,7 @@ LIBX= $(LIBXMENU) LD_SWITCH_X_SITE -lX10 LIBX10_MACHINE LIBX10_SYSTEM | |||
| 459 | #endif /* not HAVE_X_WINDOWS */ | 459 | #endif /* not HAVE_X_WINDOWS */ |
| 460 | 460 | ||
| 461 | LIBSOUND= @LIBSOUND@ | 461 | LIBSOUND= @LIBSOUND@ |
| 462 | CFLAGS_SOUND= @CFLAGS_SOUND@ | ||
| 462 | 463 | ||
| 463 | #ifndef ORDINARY_LINK | 464 | #ifndef ORDINARY_LINK |
| 464 | /* Fix linking if compiled with GCC. */ | 465 | /* Fix linking if compiled with GCC. */ |
diff --git a/src/buffer.c b/src/buffer.c index e4d846c8093..5bdfe737767 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2481,10 +2481,10 @@ swap_out_buffer_local_variables (b) | |||
| 2481 | Return the number found, and store them in a vector in *VEC_PTR. | 2481 | Return the number found, and store them in a vector in *VEC_PTR. |
| 2482 | Store in *LEN_PTR the size allocated for the vector. | 2482 | Store in *LEN_PTR the size allocated for the vector. |
| 2483 | Store in *NEXT_PTR the next position after POS where an overlay starts, | 2483 | Store in *NEXT_PTR the next position after POS where an overlay starts, |
| 2484 | or ZV if there are no more overlays. | 2484 | or ZV if there are no more overlays between POS and ZV. |
| 2485 | Store in *PREV_PTR the previous position before POS where an overlay ends, | 2485 | Store in *PREV_PTR the previous position before POS where an overlay ends, |
| 2486 | or where an overlay starts which ends at or after POS; | 2486 | or where an overlay starts which ends at or after POS; |
| 2487 | or BEGV if there are no such overlays. | 2487 | or BEGV if there are no such overlays from BEGV to POS. |
| 2488 | NEXT_PTR and/or PREV_PTR may be 0, meaning don't store that info. | 2488 | NEXT_PTR and/or PREV_PTR may be 0, meaning don't store that info. |
| 2489 | 2489 | ||
| 2490 | *VEC_PTR and *LEN_PTR should contain a valid vector and size | 2490 | *VEC_PTR and *LEN_PTR should contain a valid vector and size |
| @@ -3570,10 +3570,10 @@ If omitted, BUFFER defaults to the current buffer. | |||
| 3570 | BEG and END may be integers or markers. | 3570 | BEG and END may be integers or markers. |
| 3571 | The fourth arg FRONT-ADVANCE, if non-nil, makes the marker | 3571 | The fourth arg FRONT-ADVANCE, if non-nil, makes the marker |
| 3572 | for the front of the overlay advance when text is inserted there | 3572 | for the front of the overlay advance when text is inserted there |
| 3573 | (which means the text *is not* included in the overlay). | 3573 | \(which means the text *is not* included in the overlay). |
| 3574 | The fifth arg REAR-ADVANCE, if non-nil, makes the marker | 3574 | The fifth arg REAR-ADVANCE, if non-nil, makes the marker |
| 3575 | for the rear of the overlay advance when text is inserted there | 3575 | for the rear of the overlay advance when text is inserted there |
| 3576 | (which means the text *is* included in the overlay). */) | 3576 | \(which means the text *is* included in the overlay). */) |
| 3577 | (beg, end, buffer, front_advance, rear_advance) | 3577 | (beg, end, buffer, front_advance, rear_advance) |
| 3578 | Lisp_Object beg, end, buffer; | 3578 | Lisp_Object beg, end, buffer; |
| 3579 | Lisp_Object front_advance, rear_advance; | 3579 | Lisp_Object front_advance, rear_advance; |
| @@ -3955,7 +3955,8 @@ or between BEG and END. */) | |||
| 3955 | DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, | 3955 | DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, |
| 3956 | 1, 1, 0, | 3956 | 1, 1, 0, |
| 3957 | doc: /* Return the next position after POS where an overlay starts or ends. | 3957 | doc: /* Return the next position after POS where an overlay starts or ends. |
| 3958 | If there are no more overlay boundaries after POS, return (point-max). */) | 3958 | If there are no overlay boundaries from POS to (point-max), |
| 3959 | the value is (point-max). */) | ||
| 3959 | (pos) | 3960 | (pos) |
| 3960 | Lisp_Object pos; | 3961 | Lisp_Object pos; |
| 3961 | { | 3962 | { |
| @@ -3996,7 +3997,8 @@ If there are no more overlay boundaries after POS, return (point-max). */) | |||
| 3996 | DEFUN ("previous-overlay-change", Fprevious_overlay_change, | 3997 | DEFUN ("previous-overlay-change", Fprevious_overlay_change, |
| 3997 | Sprevious_overlay_change, 1, 1, 0, | 3998 | Sprevious_overlay_change, 1, 1, 0, |
| 3998 | doc: /* Return the previous position before POS where an overlay starts or ends. | 3999 | doc: /* Return the previous position before POS where an overlay starts or ends. |
| 3999 | If there are no more overlay boundaries before POS, return (point-min). */) | 4000 | If there are no overlay boundaries from (point-min) to POS, |
| 4001 | the value is (point-min). */) | ||
| 4000 | (pos) | 4002 | (pos) |
| 4001 | Lisp_Object pos; | 4003 | Lisp_Object pos; |
| 4002 | { | 4004 | { |
| @@ -5454,10 +5456,11 @@ A string is printed verbatim in the mode line except for %-constructs: | |||
| 5454 | %p -- print percent of buffer above top of window, or Top, Bot or All. | 5456 | %p -- print percent of buffer above top of window, or Top, Bot or All. |
| 5455 | %P -- print percent of buffer above bottom of window, perhaps plus Top, | 5457 | %P -- print percent of buffer above bottom of window, perhaps plus Top, |
| 5456 | or print Bottom or All. | 5458 | or print Bottom or All. |
| 5457 | %m -- print the mode name. | ||
| 5458 | %n -- print Narrow if appropriate. | 5459 | %n -- print Narrow if appropriate. |
| 5460 | %t -- visited file is text or binary (if OS supports this distinction). | ||
| 5459 | %z -- print mnemonics of buffer, terminal, and keyboard coding systems. | 5461 | %z -- print mnemonics of buffer, terminal, and keyboard coding systems. |
| 5460 | %Z -- like %z, but including the end-of-line format. | 5462 | %Z -- like %z, but including the end-of-line format. |
| 5463 | %e -- print error message about full memory. | ||
| 5461 | %[ -- print one [ for each recursive editing level. %] similar. | 5464 | %[ -- print one [ for each recursive editing level. %] similar. |
| 5462 | %% -- print %. %- -- print infinitely many dashes. | 5465 | %% -- print %. %- -- print infinitely many dashes. |
| 5463 | Decimal digits after the % specify field width to which to pad. */); | 5466 | Decimal digits after the % specify field width to which to pad. */); |
| @@ -5753,7 +5756,7 @@ the actual bitmap shown in the left or right fringe for the logical | |||
| 5753 | indicator. LEFT and RIGHT are the bitmaps shown in the left and/or | 5756 | indicator. LEFT and RIGHT are the bitmaps shown in the left and/or |
| 5754 | right fringe for the specific indicator. The LEFT1 or RIGHT1 bitmaps | 5757 | right fringe for the specific indicator. The LEFT1 or RIGHT1 bitmaps |
| 5755 | are used only for the `bottom' and `one-line' indicators when the last | 5758 | are used only for the `bottom' and `one-line' indicators when the last |
| 5756 | (only) line in has no final newline. BITMAPS may also be a single | 5759 | \(only) line in has no final newline. BITMAPS may also be a single |
| 5757 | symbol which is used in both left and right fringes. */); | 5760 | symbol which is used in both left and right fringes. */); |
| 5758 | 5761 | ||
| 5759 | DEFVAR_PER_BUFFER ("fringe-cursor-alist", | 5762 | DEFVAR_PER_BUFFER ("fringe-cursor-alist", |
| @@ -6000,7 +6003,7 @@ this variable has no effect; the cursor appears as a hollow box. */); | |||
| 6000 | doc: /* Additional space to put between lines when displaying a buffer. | 6003 | doc: /* Additional space to put between lines when displaying a buffer. |
| 6001 | The space is measured in pixels, and put below lines on window systems. | 6004 | The space is measured in pixels, and put below lines on window systems. |
| 6002 | If value is a floating point number, it specifies the spacing relative | 6005 | If value is a floating point number, it specifies the spacing relative |
| 6003 | to the default frame line height. */); | 6006 | to the default frame line height. nil means add no extra space. */); |
| 6004 | 6007 | ||
| 6005 | DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", | 6008 | DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", |
| 6006 | ¤t_buffer->cursor_in_non_selected_windows, Qnil, | 6009 | ¤t_buffer->cursor_in_non_selected_windows, Qnil, |
diff --git a/src/callint.c b/src/callint.c index 4789fb5582d..ae10e64e1de 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/coding.c b/src/coding.c index debb2f27ffc..9f95c2c6777 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -8315,7 +8315,7 @@ is selected as the TARGET. For example, if OPERATION does file I/O, | |||
| 8315 | whichever argument specifies the file name is TARGET. | 8315 | whichever argument specifies the file name is TARGET. |
| 8316 | 8316 | ||
| 8317 | TARGET has a meaning which depends on OPERATION: | 8317 | TARGET has a meaning which depends on OPERATION: |
| 8318 | For file I/O, TARGET is a file name. | 8318 | For file I/O, TARGET is a file name (except for the special case below). |
| 8319 | For process I/O, TARGET is a process name. | 8319 | For process I/O, TARGET is a process name. |
| 8320 | For network I/O, TARGET is a service name or a port number | 8320 | For network I/O, TARGET is a service name or a port number |
| 8321 | 8321 | ||
| @@ -8327,6 +8327,13 @@ or a function symbol to call. | |||
| 8327 | In the last case, we call the function with one argument, | 8327 | In the last case, we call the function with one argument, |
| 8328 | which is a list of all the arguments given to this function. | 8328 | which is a list of all the arguments given to this function. |
| 8329 | 8329 | ||
| 8330 | If OPERATION is `insert-file-contents', the argument corresponding to | ||
| 8331 | TARGET may be a cons (FILENAME . BUFFER). In that case, FILENAME is a | ||
| 8332 | file name to look up, and BUFFER is a buffer that contains the file's | ||
| 8333 | contents (not yet decoded). If `file-coding-system-alist' specifies a | ||
| 8334 | function to call for FILENAME, that function should examine the | ||
| 8335 | contents of BUFFER instead of reading the file. | ||
| 8336 | |||
| 8330 | usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) | 8337 | usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) |
| 8331 | (nargs, args) | 8338 | (nargs, args) |
| 8332 | int nargs; | 8339 | int nargs; |
| @@ -8380,7 +8387,7 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) | |||
| 8380 | return Fcons (val, val); | 8387 | return Fcons (val, val); |
| 8381 | if (! NILP (Ffboundp (val))) | 8388 | if (! NILP (Ffboundp (val))) |
| 8382 | { | 8389 | { |
| 8383 | val = call1 (val, Flist (nargs, args)); | 8390 | val = safe_call1 (val, Flist (nargs, args)); |
| 8384 | if (CONSP (val)) | 8391 | if (CONSP (val)) |
| 8385 | return val; | 8392 | return val; |
| 8386 | if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val))) | 8393 | if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val))) |
diff --git a/src/config.in b/src/config.in index 9c1abadd283..106aeea920c 100644 --- a/src/config.in +++ b/src/config.in | |||
| @@ -87,6 +87,9 @@ Boston, MA 02110-1301, USA. */ | |||
| 87 | */ | 87 | */ |
| 88 | #undef HAVE_ALLOCA_H | 88 | #undef HAVE_ALLOCA_H |
| 89 | 89 | ||
| 90 | /* Define to 1 if ALSA is available. */ | ||
| 91 | #undef HAVE_ALSA | ||
| 92 | |||
| 90 | /* Define to 1 if you have the `bcmp' function. */ | 93 | /* Define to 1 if you have the `bcmp' function. */ |
| 91 | #undef HAVE_BCMP | 94 | #undef HAVE_BCMP |
| 92 | 95 | ||
| @@ -955,6 +958,9 @@ Boston, MA 02110-1301, USA. */ | |||
| 955 | #ifdef HAVE_SOUNDCARD_H | 958 | #ifdef HAVE_SOUNDCARD_H |
| 956 | #define HAVE_SOUND 1 | 959 | #define HAVE_SOUND 1 |
| 957 | #endif | 960 | #endif |
| 961 | #ifdef HAVE_ALSA | ||
| 962 | #define HAVE_SOUND 1 | ||
| 963 | #endif | ||
| 958 | #endif /* __FreeBSD__ || __NetBSD__ || __linux__ */ | 964 | #endif /* __FreeBSD__ || __NetBSD__ || __linux__ */ |
| 959 | 965 | ||
| 960 | /* If using GNU, then support inline function declarations. */ | 966 | /* If using GNU, then support inline function declarations. */ |
diff --git a/src/dispextern.h b/src/dispextern.h index 0aac78f9557..92005e6b149 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2642,8 +2642,8 @@ void remember_mouse_glyph P_ ((struct frame *, int, int, NativeRectangle *)); | |||
| 2642 | 2642 | ||
| 2643 | void mark_window_display_accurate P_ ((Lisp_Object, int)); | 2643 | void mark_window_display_accurate P_ ((Lisp_Object, int)); |
| 2644 | void redisplay_preserve_echo_area P_ ((int)); | 2644 | void redisplay_preserve_echo_area P_ ((int)); |
| 2645 | void set_cursor_from_row P_ ((struct window *, struct glyph_row *, | 2645 | int set_cursor_from_row P_ ((struct window *, struct glyph_row *, |
| 2646 | struct glyph_matrix *, int, int, int, int)); | 2646 | struct glyph_matrix *, int, int, int, int)); |
| 2647 | void init_iterator P_ ((struct it *, struct window *, int, | 2647 | void init_iterator P_ ((struct it *, struct window *, int, |
| 2648 | int, struct glyph_row *, enum face_id)); | 2648 | int, struct glyph_row *, enum face_id)); |
| 2649 | void init_iterator_to_row_start P_ ((struct it *, struct window *, | 2649 | void init_iterator_to_row_start P_ ((struct it *, struct window *, |
| @@ -2703,8 +2703,8 @@ extern void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *, | |||
| 2703 | extern void draw_phys_cursor_glyph P_ ((struct window *, | 2703 | extern void draw_phys_cursor_glyph P_ ((struct window *, |
| 2704 | struct glyph_row *, | 2704 | struct glyph_row *, |
| 2705 | enum draw_glyphs_face)); | 2705 | enum draw_glyphs_face)); |
| 2706 | extern int get_phys_cursor_geometry P_ ((struct window *, struct glyph_row *, | 2706 | extern void get_phys_cursor_geometry P_ ((struct window *, struct glyph_row *, |
| 2707 | struct glyph *, int *)); | 2707 | struct glyph *, int *, int *, int *)); |
| 2708 | extern void erase_phys_cursor P_ ((struct window *)); | 2708 | extern void erase_phys_cursor P_ ((struct window *)); |
| 2709 | extern void display_and_set_cursor P_ ((struct window *, | 2709 | extern void display_and_set_cursor P_ ((struct window *, |
| 2710 | int, int, int, int, int)); | 2710 | int, int, int, int, int)); |
diff --git a/src/dispnew.c b/src/dispnew.c index e8833376701..f239d6969f4 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -355,8 +355,7 @@ static unsigned history_tick; | |||
| 355 | 355 | ||
| 356 | static void add_frame_display_history P_ ((struct frame *, int)); | 356 | static void add_frame_display_history P_ ((struct frame *, int)); |
| 357 | static void add_window_display_history P_ ((struct window *, char *, int)); | 357 | static void add_window_display_history P_ ((struct window *, char *, int)); |
| 358 | 358 | ||
| 359 | |||
| 360 | /* Add to the redisplay history how window W has been displayed. | 359 | /* Add to the redisplay history how window W has been displayed. |
| 361 | MSG is a trace containing the information how W's glyph matrix | 360 | MSG is a trace containing the information how W's glyph matrix |
| 362 | has been constructed. PAUSED_P non-zero means that the update | 361 | has been constructed. PAUSED_P non-zero means that the update |
| @@ -6391,7 +6390,9 @@ sit_for (sec, usec, reading, display, initial_display) | |||
| 6391 | { | 6390 | { |
| 6392 | swallow_events (display); | 6391 | swallow_events (display); |
| 6393 | 6392 | ||
| 6394 | if (detect_input_pending_run_timers (display) || !NILP (Vexecuting_kbd_macro)) | 6393 | if ((detect_input_pending_run_timers (display) |
| 6394 | && !redisplay_dont_pause) | ||
| 6395 | || !NILP (Vexecuting_kbd_macro)) | ||
| 6395 | return Qnil; | 6396 | return Qnil; |
| 6396 | 6397 | ||
| 6397 | if (initial_display) | 6398 | if (initial_display) |
| @@ -6421,6 +6422,9 @@ Redisplay is preempted as always if input arrives, and does not happen | |||
| 6421 | if input is available before it starts. | 6422 | if input is available before it starts. |
| 6422 | Value is t if waited the full time with no input arriving. | 6423 | Value is t if waited the full time with no input arriving. |
| 6423 | 6424 | ||
| 6425 | Redisplay will occur even when input is available if you bind | ||
| 6426 | `redisplay-dont-pause' to a non-nil value. | ||
| 6427 | |||
| 6424 | An obsolete but still supported form is | 6428 | An obsolete but still supported form is |
| 6425 | \(sit-for SECONDS &optional MILLISECONDS NODISP) | 6429 | \(sit-for SECONDS &optional MILLISECONDS NODISP) |
| 6426 | Where the optional arg MILLISECONDS specifies an additional wait period, | 6430 | Where the optional arg MILLISECONDS specifies an additional wait period, |
diff --git a/src/emacs.c b/src/emacs.c index 27e349c637f..4bbbf84ebab 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1770,16 +1770,21 @@ main (argc, argv | |||
| 1770 | #endif | 1770 | #endif |
| 1771 | } | 1771 | } |
| 1772 | 1772 | ||
| 1773 | /* Set up for profiling. This is known to work on FreeBSD and | 1773 | /* Set up for profiling. This is known to work on FreeBSD, |
| 1774 | GNU/Linux. It might work on some other systems too. Give it a | 1774 | GNU/Linux and MinGW. It might work on some other systems too. |
| 1775 | try and tell us if it works on your system. To compile for | 1775 | Give it a try and tell us if it works on your system. To compile |
| 1776 | profiling use something like `make CFLAGS="-pg -g -O -DPROFILING=1'. */ | 1776 | for profiling use something like: |
| 1777 | #if defined (__FreeBSD__) || defined (__linux) | 1777 | `make CFLAGS="-pg -g -O -DPROFILING=1'. */ |
| 1778 | #if defined (__FreeBSD__) || defined (GNU_LINUX) || defined(__MINGW32__) | ||
| 1778 | #ifdef PROFILING | 1779 | #ifdef PROFILING |
| 1779 | if (initialized) | 1780 | if (initialized) |
| 1780 | { | 1781 | { |
| 1781 | extern void _mcleanup (); | 1782 | extern void _mcleanup (); |
| 1783 | #ifdef __MINGW32__ | ||
| 1784 | extern unsigned char etext asm ("etext"); | ||
| 1785 | #else | ||
| 1782 | extern char etext; | 1786 | extern char etext; |
| 1787 | #endif | ||
| 1783 | extern void safe_bcopy (); | 1788 | extern void safe_bcopy (); |
| 1784 | extern void dump_opcode_frequencies (); | 1789 | extern void dump_opcode_frequencies (); |
| 1785 | 1790 | ||
| @@ -2253,7 +2258,7 @@ You must run Emacs in batch mode in order to dump it. */) | |||
| 2253 | if (! noninteractive) | 2258 | if (! noninteractive) |
| 2254 | error ("Dumping Emacs works only in batch mode"); | 2259 | error ("Dumping Emacs works only in batch mode"); |
| 2255 | 2260 | ||
| 2256 | #ifdef __linux__ | 2261 | #ifdef GNU_LINUX |
| 2257 | if (heap_bss_diff > MAX_HEAP_BSS_DIFF) | 2262 | if (heap_bss_diff > MAX_HEAP_BSS_DIFF) |
| 2258 | { | 2263 | { |
| 2259 | fprintf (stderr, "**************************************************\n"); | 2264 | fprintf (stderr, "**************************************************\n"); |
| @@ -2265,7 +2270,7 @@ You must run Emacs in batch mode in order to dump it. */) | |||
| 2265 | fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n"); | 2270 | fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n"); |
| 2266 | fprintf (stderr, "**************************************************\n"); | 2271 | fprintf (stderr, "**************************************************\n"); |
| 2267 | } | 2272 | } |
| 2268 | #endif /* __linux__ */ | 2273 | #endif /* GNU_LINUX */ |
| 2269 | 2274 | ||
| 2270 | /* Bind `command-line-processed' to nil before dumping, | 2275 | /* Bind `command-line-processed' to nil before dumping, |
| 2271 | so that the dumped Emacs will process its command line | 2276 | so that the dumped Emacs will process its command line |
diff --git a/src/fileio.c b/src/fileio.c index 84b32f8dda9..8ce89ba23f3 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2409,32 +2409,31 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick) | |||
| 2409 | return; | 2409 | return; |
| 2410 | } | 2410 | } |
| 2411 | 2411 | ||
| 2412 | DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6, | 2412 | DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 5, |
| 2413 | "fCopy file: \nGCopy %s to file: \np\nP", | 2413 | "fCopy file: \nGCopy %s to file: \np\nP", |
| 2414 | doc: /* Copy FILE to NEWNAME. Both args must be strings. | 2414 | doc: /* Copy FILE to NEWNAME. Both args must be strings. |
| 2415 | If NEWNAME names a directory, copy FILE there. | 2415 | If NEWNAME names a directory, copy FILE there. |
| 2416 | Signals a `file-already-exists' error if file NEWNAME already exists, | 2416 | |
| 2417 | unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil. | 2417 | This function always sets the file modes of the output file to match |
| 2418 | A number as third arg means request confirmation if NEWNAME already exists. | 2418 | the input file. |
| 2419 | This is what happens in interactive use with M-x. | 2419 | |
| 2420 | Always sets the file modes of the output file to match the input file. | 2420 | The optional third argument OK-IF-ALREADY-EXISTS specifies what to do |
| 2421 | if file NEWNAME already exists. If OK-IF-ALREADY-EXISTS is nil, we | ||
| 2422 | signal a `file-already-exists' error without overwriting. If | ||
| 2423 | OK-IF-ALREADY-EXISTS is a number, we request confirmation from the user | ||
| 2424 | about overwriting; this is what happens in interactive use with M-x. | ||
| 2425 | Any other value for OK-IF-ALREADY-EXISTS means to overwrite the | ||
| 2426 | existing file. | ||
| 2421 | 2427 | ||
| 2422 | Fourth arg KEEP-TIME non-nil means give the output file the same | 2428 | Fourth arg KEEP-TIME non-nil means give the output file the same |
| 2423 | last-modified time as the old one. (This works on only some systems.) | 2429 | last-modified time as the old one. (This works on only some systems.) |
| 2424 | 2430 | ||
| 2425 | A prefix arg makes KEEP-TIME non-nil. | 2431 | A prefix arg makes KEEP-TIME non-nil. |
| 2426 | 2432 | ||
| 2427 | The optional fifth arg MUSTBENEW, if non-nil, insists on a check | ||
| 2428 | for an existing file with the same name. If MUSTBENEW is `excl', | ||
| 2429 | that means to get an error if the file already exists; never overwrite. | ||
| 2430 | If MUSTBENEW is neither nil nor `excl', that means ask for | ||
| 2431 | confirmation before overwriting, but do go ahead and overwrite the file | ||
| 2432 | if the user confirms. | ||
| 2433 | |||
| 2434 | If PRESERVE-UID-GID is non-nil, we try to transfer the | 2433 | If PRESERVE-UID-GID is non-nil, we try to transfer the |
| 2435 | uid and gid of FILE to NEWNAME. */) | 2434 | uid and gid of FILE to NEWNAME. */) |
| 2436 | (file, newname, ok_if_already_exists, keep_time, mustbenew, preserve_uid_gid) | 2435 | (file, newname, ok_if_already_exists, keep_time, preserve_uid_gid) |
| 2437 | Lisp_Object file, newname, ok_if_already_exists, keep_time, mustbenew; | 2436 | Lisp_Object file, newname, ok_if_already_exists, keep_time; |
| 2438 | Lisp_Object preserve_uid_gid; | 2437 | Lisp_Object preserve_uid_gid; |
| 2439 | { | 2438 | { |
| 2440 | int ifd, ofd, n; | 2439 | int ifd, ofd, n; |
| @@ -2451,9 +2450,6 @@ uid and gid of FILE to NEWNAME. */) | |||
| 2451 | CHECK_STRING (file); | 2450 | CHECK_STRING (file); |
| 2452 | CHECK_STRING (newname); | 2451 | CHECK_STRING (newname); |
| 2453 | 2452 | ||
| 2454 | if (!NILP (mustbenew) && !EQ (mustbenew, Qexcl)) | ||
| 2455 | barf_or_query_if_file_exists (newname, "overwrite", 1, 0, 1); | ||
| 2456 | |||
| 2457 | if (!NILP (Ffile_directory_p (newname))) | 2453 | if (!NILP (Ffile_directory_p (newname))) |
| 2458 | newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname); | 2454 | newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname); |
| 2459 | else | 2455 | else |
| @@ -2556,12 +2552,12 @@ uid and gid of FILE to NEWNAME. */) | |||
| 2556 | /* System's default file type was set to binary by _fmode in emacs.c. */ | 2552 | /* System's default file type was set to binary by _fmode in emacs.c. */ |
| 2557 | ofd = emacs_open (SDATA (encoded_newname), | 2553 | ofd = emacs_open (SDATA (encoded_newname), |
| 2558 | O_WRONLY | O_TRUNC | O_CREAT | 2554 | O_WRONLY | O_TRUNC | O_CREAT |
| 2559 | | (EQ (mustbenew, Qexcl) ? O_EXCL : 0), | 2555 | | (NILP (ok_if_already_exists) ? O_EXCL : 0), |
| 2560 | S_IREAD | S_IWRITE); | 2556 | S_IREAD | S_IWRITE); |
| 2561 | #else /* not MSDOS */ | 2557 | #else /* not MSDOS */ |
| 2562 | ofd = emacs_open (SDATA (encoded_newname), | 2558 | ofd = emacs_open (SDATA (encoded_newname), |
| 2563 | O_WRONLY | O_TRUNC | O_CREAT | 2559 | O_WRONLY | O_TRUNC | O_CREAT |
| 2564 | | (EQ (mustbenew, Qexcl) ? O_EXCL : 0), | 2560 | | (NILP (ok_if_already_exists) ? O_EXCL : 0), |
| 2565 | 0666); | 2561 | 0666); |
| 2566 | #endif /* not MSDOS */ | 2562 | #endif /* not MSDOS */ |
| 2567 | #endif /* VMS */ | 2563 | #endif /* VMS */ |
| @@ -2806,7 +2802,7 @@ This is what happens in interactive use with M-x. */) | |||
| 2806 | /* We have already prompted if it was an integer, | 2802 | /* We have already prompted if it was an integer, |
| 2807 | so don't have copy-file prompt again. */ | 2803 | so don't have copy-file prompt again. */ |
| 2808 | NILP (ok_if_already_exists) ? Qnil : Qt, | 2804 | NILP (ok_if_already_exists) ? Qnil : Qt, |
| 2809 | Qt, Qnil, Qt); | 2805 | Qt, Qt); |
| 2810 | 2806 | ||
| 2811 | Fdelete_file (file); | 2807 | Fdelete_file (file); |
| 2812 | } | 2808 | } |
| @@ -2798,7 +2798,7 @@ is nil, and `use-dialog-box' is non-nil. */) | |||
| 2798 | { | 2798 | { |
| 2799 | ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, | 2799 | ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, |
| 2800 | Qyes_or_no_p_history, Qnil, | 2800 | Qyes_or_no_p_history, Qnil, |
| 2801 | Qnil, Qnil)); | 2801 | Qnil)); |
| 2802 | if (SCHARS (ans) == 3 && !strcmp (SDATA (ans), "yes")) | 2802 | if (SCHARS (ans) == 3 && !strcmp (SDATA (ans), "yes")) |
| 2803 | { | 2803 | { |
| 2804 | UNGCPRO; | 2804 | UNGCPRO; |
diff --git a/src/frame.c b/src/frame.c index 1606f195f90..cafa9b655d4 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -3156,10 +3156,8 @@ x_set_border_width (f, arg, oldval) | |||
| 3156 | if (XINT (arg) == f->border_width) | 3156 | if (XINT (arg) == f->border_width) |
| 3157 | return; | 3157 | return; |
| 3158 | 3158 | ||
| 3159 | #ifndef MAC_OS | ||
| 3160 | if (FRAME_X_WINDOW (f) != 0) | 3159 | if (FRAME_X_WINDOW (f) != 0) |
| 3161 | error ("Cannot change the border width of a frame"); | 3160 | error ("Cannot change the border width of a frame"); |
| 3162 | #endif /* MAC_TODO */ | ||
| 3163 | 3161 | ||
| 3164 | f->border_width = XINT (arg); | 3162 | f->border_width = XINT (arg); |
| 3165 | } | 3163 | } |
diff --git a/src/gtkutil.c b/src/gtkutil.c index b8d37df2214..2a6ed9d1524 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 f309a401139..70ffabc1937 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -6104,7 +6104,6 @@ png_load (f, img) | |||
| 6104 | { | 6104 | { |
| 6105 | image_error ("Cannot open image file `%s'", file, Qnil); | 6105 | image_error ("Cannot open image file `%s'", file, Qnil); |
| 6106 | UNGCPRO; | 6106 | UNGCPRO; |
| 6107 | fclose (fp); | ||
| 6108 | return 0; | 6107 | return 0; |
| 6109 | } | 6108 | } |
| 6110 | 6109 | ||
| @@ -8067,18 +8066,18 @@ gif_load (f, img) | |||
| 8067 | /* Save GIF image extension data for `image-extension-data'. | 8066 | /* Save GIF image extension data for `image-extension-data'. |
| 8068 | Format is (count IMAGES 0xf9 GRAPHIC_CONTROL_EXTENSION_BLOCK). */ | 8067 | Format is (count IMAGES 0xf9 GRAPHIC_CONTROL_EXTENSION_BLOCK). */ |
| 8069 | { | 8068 | { |
| 8070 | unsigned char gce[4]; | 8069 | Lisp_Object gce = make_uninit_string (4); |
| 8071 | int centisec = ((float)duration / time_scale) * 100.0f + 0.5f; | 8070 | int centisec = ((float)duration / time_scale) * 100.0f + 0.5f; |
| 8072 | 8071 | ||
| 8073 | /* Fill the delay time field. */ | 8072 | /* Fill the delay time field. */ |
| 8074 | gce[1] = centisec & 0xff; | 8073 | SSET (gce, 1, centisec & 0xff); |
| 8075 | gce[2] = (centisec >> 8) & 0xff; | 8074 | SSET (gce, 2, (centisec >> 8) & 0xff); |
| 8076 | /* We don't know about other fields. */ | 8075 | /* We don't know about other fields. */ |
| 8077 | gce[0] = gce[3] = 0; | 8076 | SSET (gce, 0, 0); |
| 8077 | SSET (gce, 3, 0); | ||
| 8078 | 8078 | ||
| 8079 | img->data.lisp_val = list4 (Qcount, make_number (nsamples), | 8079 | img->data.lisp_val = list4 (Qcount, make_number (nsamples), |
| 8080 | make_number (0xf9), | 8080 | make_number (0xf9), gce); |
| 8081 | make_unibyte_string (gce, 4)); | ||
| 8082 | } | 8081 | } |
| 8083 | 8082 | ||
| 8084 | /* Maybe fill in the background field while we have ximg handy. */ | 8083 | /* Maybe fill in the background field while we have ximg handy. */ |
diff --git a/src/intervals.c b/src/intervals.c index 21e60c96d3f..fecd1d181dc 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -2016,6 +2016,10 @@ set_point_both (buffer, charpos, bytepos) | |||
| 2016 | register INTERVAL to, from, toprev, fromprev; | 2016 | register INTERVAL to, from, toprev, fromprev; |
| 2017 | int buffer_point; | 2017 | int buffer_point; |
| 2018 | int old_position = BUF_PT (buffer); | 2018 | int old_position = BUF_PT (buffer); |
| 2019 | /* This ensures that we move forward past intangible text when the | ||
| 2020 | initial position is the same as the destination, in the rare | ||
| 2021 | instances where this is important, e.g. in line-move-finish | ||
| 2022 | (simple.el). */ | ||
| 2019 | int backwards = (charpos < old_position ? 1 : 0); | 2023 | int backwards = (charpos < old_position ? 1 : 0); |
| 2020 | int have_overlays; | 2024 | int have_overlays; |
| 2021 | int original_position; | 2025 | int original_position; |
diff --git a/src/lisp.h b/src/lisp.h index bf2426e25a7..af7fae52eaf 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 | ||
| @@ -2816,7 +2816,7 @@ extern void set_time_zone_rule P_ ((char *)); | |||
| 2816 | 2816 | ||
| 2817 | /* defined in buffer.c */ | 2817 | /* defined in buffer.c */ |
| 2818 | extern int mouse_face_overlay_overlaps P_ ((Lisp_Object)); | 2818 | extern int mouse_face_overlay_overlaps P_ ((Lisp_Object)); |
| 2819 | extern void nsberror P_ ((Lisp_Object)); | 2819 | extern void nsberror P_ ((Lisp_Object)) NO_RETURN; |
| 2820 | extern char *no_switch_window P_ ((Lisp_Object window)); | 2820 | extern char *no_switch_window P_ ((Lisp_Object window)); |
| 2821 | EXFUN (Fset_buffer_multibyte, 1); | 2821 | EXFUN (Fset_buffer_multibyte, 1); |
| 2822 | EXFUN (Foverlay_start, 1); | 2822 | EXFUN (Foverlay_start, 1); |
| @@ -2936,7 +2936,7 @@ extern void syms_of_search P_ ((void)); | |||
| 2936 | extern Lisp_Object last_minibuf_string; | 2936 | extern Lisp_Object last_minibuf_string; |
| 2937 | extern void choose_minibuf_frame P_ ((void)); | 2937 | extern void choose_minibuf_frame P_ ((void)); |
| 2938 | EXFUN (Fcompleting_read, 8); | 2938 | EXFUN (Fcompleting_read, 8); |
| 2939 | EXFUN (Fread_from_minibuffer, 8); | 2939 | EXFUN (Fread_from_minibuffer, 7); |
| 2940 | EXFUN (Fread_variable, 2); | 2940 | EXFUN (Fread_variable, 2); |
| 2941 | EXFUN (Fread_buffer, 3); | 2941 | EXFUN (Fread_buffer, 3); |
| 2942 | EXFUN (Fread_minibuffer, 2); | 2942 | EXFUN (Fread_minibuffer, 2); |
diff --git a/src/lread.c b/src/lread.c index b6161ebedaa..d8abde1c458 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 | /* Used instead of Qget_file_char while loading *.elc files compiled | 94 | /* Used instead of Qget_file_char while loading *.elc files compiled |
| 94 | by Emacs 21 or older. */ | 95 | by Emacs 21 or older. */ |
| @@ -897,8 +898,8 @@ Return t if the file exists and loads successfully. */) | |||
| 897 | register int fd = -1; | 898 | register int fd = -1; |
| 898 | int count = SPECPDL_INDEX (); | 899 | int count = SPECPDL_INDEX (); |
| 899 | Lisp_Object temp; | 900 | Lisp_Object temp; |
| 900 | struct gcpro gcpro1, gcpro2; | 901 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 901 | Lisp_Object found, efound; | 902 | Lisp_Object found, efound, hist_file_name; |
| 902 | /* 1 means we printed the ".el is newer" message. */ | 903 | /* 1 means we printed the ".el is newer" message. */ |
| 903 | int newer = 0; | 904 | int newer = 0; |
| 904 | /* 1 means we are loading a compiled file. */ | 905 | /* 1 means we are loading a compiled file. */ |
| @@ -906,6 +907,7 @@ Return t if the file exists and loads successfully. */) | |||
| 906 | Lisp_Object handler; | 907 | Lisp_Object handler; |
| 907 | int safe_p = 1; | 908 | int safe_p = 1; |
| 908 | char *fmode = "r"; | 909 | char *fmode = "r"; |
| 910 | Lisp_Object tmp[2]; | ||
| 909 | int version; | 911 | int version; |
| 910 | 912 | ||
| 911 | #ifdef DOS_NT | 913 | #ifdef DOS_NT |
| @@ -924,7 +926,7 @@ Return t if the file exists and loads successfully. */) | |||
| 924 | the need to gcpro noerror, nomessage and nosuffix. | 926 | the need to gcpro noerror, nomessage and nosuffix. |
| 925 | (Below here, we care only whether they are nil or not.) | 927 | (Below here, we care only whether they are nil or not.) |
| 926 | The presence of this call is the result of a historical accident: | 928 | The presence of this call is the result of a historical accident: |
| 927 | it used to be in every file-operations and when it got removed | 929 | it used to be in every file-operation and when it got removed |
| 928 | everywhere, it accidentally stayed here. Since then, enough people | 930 | everywhere, it accidentally stayed here. Since then, enough people |
| 929 | supposedly have things like (load "$PROJECT/foo.el") in their .emacs | 931 | supposedly have things like (load "$PROJECT/foo.el") in their .emacs |
| 930 | that it seemed risky to remove. */ | 932 | that it seemed risky to remove. */ |
| @@ -944,7 +946,6 @@ Return t if the file exists and loads successfully. */) | |||
| 944 | if (SCHARS (file) > 0) | 946 | if (SCHARS (file) > 0) |
| 945 | { | 947 | { |
| 946 | int size = SBYTES (file); | 948 | int size = SBYTES (file); |
| 947 | Lisp_Object tmp[2]; | ||
| 948 | 949 | ||
| 949 | found = Qnil; | 950 | found = Qnil; |
| 950 | GCPRO2 (file, found); | 951 | GCPRO2 (file, found); |
| @@ -1028,6 +1029,13 @@ Return t if the file exists and loads successfully. */) | |||
| 1028 | Vloads_in_progress = Fcons (found, Vloads_in_progress); | 1029 | Vloads_in_progress = Fcons (found, Vloads_in_progress); |
| 1029 | } | 1030 | } |
| 1030 | 1031 | ||
| 1032 | /* Get the name for load-history. */ | ||
| 1033 | hist_file_name = (! NILP (Vpurify_flag) | ||
| 1034 | ? Fconcat (2, (tmp[0] = Ffile_name_directory (file), | ||
| 1035 | tmp[1] = Ffile_name_nondirectory (found), | ||
| 1036 | tmp)) | ||
| 1037 | : found) ; | ||
| 1038 | |||
| 1031 | version = -1; | 1039 | version = -1; |
| 1032 | if (!bcmp (SDATA (found) + SBYTES (found) - 4, | 1040 | if (!bcmp (SDATA (found) + SBYTES (found) - 4, |
| 1033 | ".elc", 4) | 1041 | ".elc", 4) |
| @@ -1040,7 +1048,7 @@ Return t if the file exists and loads successfully. */) | |||
| 1040 | struct stat s1, s2; | 1048 | struct stat s1, s2; |
| 1041 | int result; | 1049 | int result; |
| 1042 | 1050 | ||
| 1043 | GCPRO2 (file, found); | 1051 | GCPRO3 (file, found, hist_file_name); |
| 1044 | 1052 | ||
| 1045 | if (version < 0 | 1053 | if (version < 0 |
| 1046 | && ! (version = safe_to_load_p (fd))) | 1054 | && ! (version = safe_to_load_p (fd))) |
| @@ -1095,14 +1103,14 @@ Return t if the file exists and loads successfully. */) | |||
| 1095 | 1103 | ||
| 1096 | if (fd >= 0) | 1104 | if (fd >= 0) |
| 1097 | emacs_close (fd); | 1105 | emacs_close (fd); |
| 1098 | val = call4 (Vload_source_file_function, found, file, | 1106 | val = call4 (Vload_source_file_function, found, hist_file_name, |
| 1099 | NILP (noerror) ? Qnil : Qt, | 1107 | NILP (noerror) ? Qnil : Qt, |
| 1100 | NILP (nomessage) ? Qnil : Qt); | 1108 | NILP (nomessage) ? Qnil : Qt); |
| 1101 | return unbind_to (count, val); | 1109 | return unbind_to (count, val); |
| 1102 | } | 1110 | } |
| 1103 | } | 1111 | } |
| 1104 | 1112 | ||
| 1105 | GCPRO2 (file, found); | 1113 | GCPRO3 (file, found, hist_file_name); |
| 1106 | 1114 | ||
| 1107 | #ifdef WINDOWSNT | 1115 | #ifdef WINDOWSNT |
| 1108 | emacs_close (fd); | 1116 | emacs_close (fd); |
| @@ -1142,23 +1150,23 @@ Return t if the file exists and loads successfully. */) | |||
| 1142 | = Fcons (make_number (fileno (stream)), load_descriptor_list); | 1150 | = Fcons (make_number (fileno (stream)), load_descriptor_list); |
| 1143 | load_in_progress++; | 1151 | load_in_progress++; |
| 1144 | if (! version || version >= 22) | 1152 | if (! version || version >= 22) |
| 1145 | readevalloop (Qget_file_char, stream, | 1153 | readevalloop (Qget_file_char, stream, hist_file_name, |
| 1146 | (! NILP (Vpurify_flag) ? file : found), | ||
| 1147 | Feval, 0, Qnil, Qnil, Qnil, Qnil); | 1154 | Feval, 0, Qnil, Qnil, Qnil, Qnil); |
| 1148 | else | 1155 | else |
| 1149 | { | 1156 | { |
| 1150 | /* We can't handle a file which was compiled with | 1157 | /* We can't handle a file which was compiled with |
| 1151 | byte-compile-dynamic by older version of Emacs. */ | 1158 | byte-compile-dynamic by older version of Emacs. */ |
| 1152 | specbind (Qload_force_doc_strings, Qt); | 1159 | specbind (Qload_force_doc_strings, Qt); |
| 1153 | readevalloop (Qget_emacs_mule_file_char, stream, file, Feval, | 1160 | readevalloop (Qget_emacs_mule_file_char, stream, hist_file_name, Feval, |
| 1154 | 0, Qnil, Qnil, Qnil, Qnil); | 1161 | 0, Qnil, Qnil, Qnil, Qnil); |
| 1155 | } | 1162 | } |
| 1156 | unbind_to (count, Qnil); | 1163 | unbind_to (count, Qnil); |
| 1157 | 1164 | ||
| 1158 | /* Run any load-hooks for this file. */ | 1165 | /* Run any eval-after-load forms for this file */ |
| 1159 | temp = Fassoc (file, Vafter_load_alist); | 1166 | if (NILP (Vpurify_flag) |
| 1160 | if (!NILP (temp)) | 1167 | && (!NILP (Ffboundp (Qdo_after_load_evaluation)))) |
| 1161 | Fprogn (Fcdr (temp)); | 1168 | call1 (Qdo_after_load_evaluation, hist_file_name) ; |
| 1169 | |||
| 1162 | UNGCPRO; | 1170 | UNGCPRO; |
| 1163 | 1171 | ||
| 1164 | if (saved_doc_string) | 1172 | if (saved_doc_string) |
| @@ -1583,6 +1591,12 @@ readevalloop (readcharfun, stream, sourcename, evalfun, | |||
| 1583 | 1591 | ||
| 1584 | GCPRO4 (sourcename, readfun, start, end); | 1592 | GCPRO4 (sourcename, readfun, start, end); |
| 1585 | 1593 | ||
| 1594 | /* Try to ensure sourcename is a truename, except whilst preloading. */ | ||
| 1595 | if (NILP (Vpurify_flag) | ||
| 1596 | && !NILP (sourcename) && Ffile_name_absolute_p (sourcename) | ||
| 1597 | && (!NILP (Ffboundp (Qfile_truename)))) | ||
| 1598 | sourcename = call1 (Qfile_truename, sourcename) ; | ||
| 1599 | |||
| 1586 | LOADHIST_ATTACH (sourcename); | 1600 | LOADHIST_ATTACH (sourcename); |
| 1587 | 1601 | ||
| 1588 | continue_reading_p = 1; | 1602 | continue_reading_p = 1; |
| @@ -4110,16 +4124,17 @@ customize `jka-compr-load-suffixes' rather than the present variable. */); | |||
| 4110 | 4124 | ||
| 4111 | DEFVAR_LISP ("after-load-alist", &Vafter_load_alist, | 4125 | DEFVAR_LISP ("after-load-alist", &Vafter_load_alist, |
| 4112 | doc: /* An alist of expressions to be evalled when particular files are loaded. | 4126 | doc: /* An alist of expressions to be evalled when particular files are loaded. |
| 4113 | Each element looks like (FILENAME FORMS...). | 4127 | Each element looks like (REGEXP-OR-FEATURE FORMS...). |
| 4114 | When `load' is run and the file-name argument is FILENAME, | 4128 | |
| 4115 | the FORMS in the corresponding element are executed at the end of loading. | 4129 | REGEXP-OR-FEATURE is either a regular expression to match file names, or |
| 4116 | 4130 | a symbol \(a feature name). | |
| 4117 | FILENAME must match exactly! Normally FILENAME is the name of a library, | 4131 | |
| 4118 | with no directory specified, since that is how `load' is normally called. | 4132 | When `load' is run and the file-name argument matches an element's |
| 4119 | An error in FORMS does not undo the load, | 4133 | REGEXP-OR-FEATURE, or when `provide' is run and provides the symbol |
| 4120 | but does prevent execution of the rest of the FORMS. | 4134 | REGEXP-OR-FEATURE, the FORMS in the element are executed. |
| 4121 | FILENAME can also be a symbol (a feature) and FORMS are then executed | 4135 | |
| 4122 | when the corresponding call to `provide' is made. */); | 4136 | An error in FORMS does not undo the load, but does prevent execution of |
| 4137 | the rest of the FORMS. */); | ||
| 4123 | Vafter_load_alist = Qnil; | 4138 | Vafter_load_alist = Qnil; |
| 4124 | 4139 | ||
| 4125 | DEFVAR_LISP ("load-history", &Vload_history, | 4140 | DEFVAR_LISP ("load-history", &Vload_history, |
| @@ -4127,6 +4142,10 @@ when the corresponding call to `provide' is made. */); | |||
| 4127 | Each alist element is a list that starts with a file name, | 4142 | Each alist element is a list that starts with a file name, |
| 4128 | except for one element (optional) that starts with nil and describes | 4143 | except for one element (optional) that starts with nil and describes |
| 4129 | definitions evaluated from buffers not visiting files. | 4144 | definitions evaluated from buffers not visiting files. |
| 4145 | |||
| 4146 | The file name is absolute and is the true file name (i.e. it doesn't | ||
| 4147 | contain symbolic links) of the loaded file. | ||
| 4148 | |||
| 4130 | The remaining elements of each list are symbols defined as variables | 4149 | The remaining elements of each list are symbols defined as variables |
| 4131 | and cons cells of the form `(provide . FEATURE)', `(require . FEATURE)', | 4150 | and cons cells of the form `(provide . FEATURE)', `(require . FEATURE)', |
| 4132 | `(defun . FUNCTION)', `(autoload . SYMBOL)', and `(t . SYMBOL)'. | 4151 | `(defun . FUNCTION)', `(autoload . SYMBOL)', and `(t . SYMBOL)'. |
| @@ -4263,6 +4282,12 @@ to load. See also `load-dangerous-libraries'. */); | |||
| 4263 | Qeval_buffer_list = intern ("eval-buffer-list"); | 4282 | Qeval_buffer_list = intern ("eval-buffer-list"); |
| 4264 | staticpro (&Qeval_buffer_list); | 4283 | staticpro (&Qeval_buffer_list); |
| 4265 | 4284 | ||
| 4285 | Qfile_truename = intern ("file-truename"); | ||
| 4286 | staticpro (&Qfile_truename) ; | ||
| 4287 | |||
| 4288 | Qdo_after_load_evaluation = intern ("do-after-load-evaluation"); | ||
| 4289 | staticpro (&Qdo_after_load_evaluation) ; | ||
| 4290 | |||
| 4266 | staticpro (&dump_path); | 4291 | staticpro (&dump_path); |
| 4267 | 4292 | ||
| 4268 | staticpro (&read_objects); | 4293 | 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 8e0d5153034..1c774f8ade2 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; |
| @@ -2829,26 +2829,22 @@ FRAME nil means use the selected frame. */) | |||
| 2829 | Lisp_Object frame; | 2829 | Lisp_Object frame; |
| 2830 | { | 2830 | { |
| 2831 | struct frame *f = check_x_frame (frame); | 2831 | struct frame *f = check_x_frame (frame); |
| 2832 | struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | ||
| 2833 | 2832 | ||
| 2834 | if (dpyinfo->x_focus_frame != f) | 2833 | BLOCK_INPUT; |
| 2835 | { | ||
| 2836 | BLOCK_INPUT; | ||
| 2837 | #ifdef MAC_OSX | 2834 | #ifdef MAC_OSX |
| 2838 | ActivateWindow (ActiveNonFloatingWindow (), false); | 2835 | ActivateWindow (ActiveNonFloatingWindow (), false); |
| 2839 | ActivateWindow (FRAME_MAC_WINDOW (f), true); | 2836 | ActivateWindow (FRAME_MAC_WINDOW (f), true); |
| 2840 | #else | 2837 | #else |
| 2841 | #if !TARGET_API_MAC_CARBON | 2838 | #if !TARGET_API_MAC_CARBON |
| 2842 | /* SelectWindow (Non-Carbon) does not issue deactivate events if | 2839 | /* SelectWindow (Non-Carbon) does not issue deactivate events if the |
| 2843 | the possibly inactive window that is to be selected is | 2840 | possibly inactive window that is to be selected is already the |
| 2844 | already the frontmost one. */ | 2841 | frontmost one. */ |
| 2845 | SendBehind (FRAME_MAC_WINDOW (f), NULL); | 2842 | SendBehind (FRAME_MAC_WINDOW (f), NULL); |
| 2846 | #endif | 2843 | #endif |
| 2847 | /* This brings the window to the front. */ | 2844 | /* This brings the window to the front. */ |
| 2848 | SelectWindow (FRAME_MAC_WINDOW (f)); | 2845 | SelectWindow (FRAME_MAC_WINDOW (f)); |
| 2849 | #endif | 2846 | #endif |
| 2850 | UNBLOCK_INPUT; | 2847 | UNBLOCK_INPUT; |
| 2851 | } | ||
| 2852 | 2848 | ||
| 2853 | return Qnil; | 2849 | return Qnil; |
| 2854 | } | 2850 | } |
| @@ -3028,11 +3024,11 @@ If omitted or nil, that stands for the selected frame's display. */) | |||
| 3028 | { | 3024 | { |
| 3029 | if (response >= 0x00001040) | 3025 | if (response >= 0x00001040) |
| 3030 | { | 3026 | { |
| 3031 | err = Gestalt ('sys1', &major); /* gestaltSystemVersionMajor */ | 3027 | err = Gestalt (gestaltSystemVersionMajor, &major); |
| 3032 | if (err == noErr) | 3028 | if (err == noErr) |
| 3033 | err = Gestalt ('sys2', &minor); /* gestaltSystemVersionMinor */ | 3029 | err = Gestalt (gestaltSystemVersionMinor, &minor); |
| 3034 | if (err == noErr) | 3030 | if (err == noErr) |
| 3035 | err = Gestalt ('sys3', &bugfix); /* gestaltSystemVersionBugFix */ | 3031 | err = Gestalt (gestaltSystemVersionBugFix, &bugfix); |
| 3036 | } | 3032 | } |
| 3037 | else | 3033 | else |
| 3038 | { | 3034 | { |
| @@ -4518,8 +4514,18 @@ This is for internal use only. Use `mac-font-panel-mode' instead. */) | |||
| 4518 | check_mac (); | 4514 | check_mac (); |
| 4519 | 4515 | ||
| 4520 | BLOCK_INPUT; | 4516 | BLOCK_INPUT; |
| 4521 | if (NILP (visible) == (FPIsFontPanelVisible () == true)) | 4517 | if (NILP (visible) != !mac_font_panel_visible_p ()) |
| 4522 | 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 | } | ||
| 4523 | UNBLOCK_INPUT; | 4529 | UNBLOCK_INPUT; |
| 4524 | 4530 | ||
| 4525 | if (err != noErr) | 4531 | if (err != noErr) |
diff --git a/src/macgui.h b/src/macgui.h index 690840c6c33..90688e5703e 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -112,6 +112,13 @@ typedef unsigned long Time; | |||
| 112 | #endif | 112 | #endif |
| 113 | #endif | 113 | #endif |
| 114 | 114 | ||
| 115 | /* Whether to use Text Services Manager. */ | ||
| 116 | #ifndef USE_MAC_TSM | ||
| 117 | #ifdef MAC_OSX | ||
| 118 | #define USE_MAC_TSM 1 | ||
| 119 | #endif | ||
| 120 | #endif | ||
| 121 | |||
| 115 | typedef WindowPtr Window; | 122 | typedef WindowPtr Window; |
| 116 | typedef GWorldPtr Pixmap; | 123 | typedef GWorldPtr Pixmap; |
| 117 | 124 | ||
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 e3b8b3b5881..549e1e7977b 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -3531,19 +3531,28 @@ x_draw_stretch_glyph_string (s) | |||
| 3531 | { | 3531 | { |
| 3532 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor | 3532 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor |
| 3533 | as wide as the stretch glyph. */ | 3533 | as wide as the stretch glyph. */ |
| 3534 | int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width); | 3534 | int width, background_width = s->background_width; |
| 3535 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | ||
| 3536 | |||
| 3537 | if (x < left_x) | ||
| 3538 | { | ||
| 3539 | background_width -= left_x - x; | ||
| 3540 | x = left_x; | ||
| 3541 | } | ||
| 3542 | width = min (FRAME_COLUMN_WIDTH (s->f), background_width); | ||
| 3535 | 3543 | ||
| 3536 | /* Draw cursor. */ | 3544 | /* Draw cursor. */ |
| 3537 | x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); | 3545 | x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); |
| 3538 | 3546 | ||
| 3539 | /* Clear rest using the GC of the original non-cursor face. */ | 3547 | /* Clear rest using the GC of the original non-cursor face. */ |
| 3540 | if (width < s->background_width) | 3548 | if (width < background_width) |
| 3541 | { | 3549 | { |
| 3542 | int x = s->x + width, y = s->y; | 3550 | int y = s->y; |
| 3543 | int w = s->background_width - width, h = s->height; | 3551 | int w = background_width - width, h = s->height; |
| 3544 | Rect r; | 3552 | Rect r; |
| 3545 | GC gc; | 3553 | GC gc; |
| 3546 | 3554 | ||
| 3555 | x += width; | ||
| 3547 | if (s->row->mouse_face_p | 3556 | if (s->row->mouse_face_p |
| 3548 | && cursor_in_mouse_face_p (s->w)) | 3557 | && cursor_in_mouse_face_p (s->w)) |
| 3549 | { | 3558 | { |
| @@ -3570,8 +3579,18 @@ x_draw_stretch_glyph_string (s) | |||
| 3570 | } | 3579 | } |
| 3571 | } | 3580 | } |
| 3572 | else if (!s->background_filled_p) | 3581 | else if (!s->background_filled_p) |
| 3573 | x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, | 3582 | { |
| 3574 | s->height); | 3583 | int background_width = s->background_width; |
| 3584 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | ||
| 3585 | |||
| 3586 | if (x < left_x) | ||
| 3587 | { | ||
| 3588 | background_width -= left_x - x; | ||
| 3589 | x = left_x; | ||
| 3590 | } | ||
| 3591 | if (background_width > 0) | ||
| 3592 | x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); | ||
| 3593 | } | ||
| 3575 | 3594 | ||
| 3576 | s->background_filled_p = 1; | 3595 | s->background_filled_p = 1; |
| 3577 | } | 3596 | } |
| @@ -5398,8 +5417,7 @@ x_draw_hollow_cursor (w, row) | |||
| 5398 | return; | 5417 | return; |
| 5399 | 5418 | ||
| 5400 | /* Compute frame-relative coordinates for phys cursor. */ | 5419 | /* Compute frame-relative coordinates for phys cursor. */ |
| 5401 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 5420 | get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h); |
| 5402 | y = get_phys_cursor_geometry (w, row, cursor_glyph, &h); | ||
| 5403 | wd = w->phys_cursor_width; | 5421 | wd = w->phys_cursor_width; |
| 5404 | 5422 | ||
| 5405 | /* The foreground of cursor_gc is typically the same as the normal | 5423 | /* The foreground of cursor_gc is typically the same as the normal |
| @@ -6135,6 +6153,7 @@ mac_handle_visibility_change (f) | |||
| 6135 | EVENT_INIT (buf); | 6153 | EVENT_INIT (buf); |
| 6136 | buf.kind = DEICONIFY_EVENT; | 6154 | buf.kind = DEICONIFY_EVENT; |
| 6137 | XSETFRAME (buf.frame_or_window, f); | 6155 | XSETFRAME (buf.frame_or_window, f); |
| 6156 | buf.arg = Qnil; | ||
| 6138 | kbd_buffer_store_event (&buf); | 6157 | kbd_buffer_store_event (&buf); |
| 6139 | } | 6158 | } |
| 6140 | else if (! NILP (Vframe_list) && ! NILP (XCDR (Vframe_list))) | 6159 | else if (! NILP (Vframe_list) && ! NILP (XCDR (Vframe_list))) |
| @@ -6148,6 +6167,7 @@ mac_handle_visibility_change (f) | |||
| 6148 | EVENT_INIT (buf); | 6167 | EVENT_INIT (buf); |
| 6149 | buf.kind = ICONIFY_EVENT; | 6168 | buf.kind = ICONIFY_EVENT; |
| 6150 | XSETFRAME (buf.frame_or_window, f); | 6169 | XSETFRAME (buf.frame_or_window, f); |
| 6170 | buf.arg = Qnil; | ||
| 6151 | kbd_buffer_store_event (&buf); | 6171 | kbd_buffer_store_event (&buf); |
| 6152 | } | 6172 | } |
| 6153 | 6173 | ||
| @@ -8341,6 +8361,26 @@ x_find_ccl_program (fontp) | |||
| 8341 | } | 8361 | } |
| 8342 | 8362 | ||
| 8343 | #if USE_MAC_FONT_PANEL | 8363 | #if USE_MAC_FONT_PANEL |
| 8364 | /* Whether Font Panel has been shown before. The first call to font | ||
| 8365 | panel functions (FPIsFontPanelVisible, SetFontInfoForSelection) is | ||
| 8366 | slow. This variable is used for deferring such a call as much as | ||
| 8367 | possible. */ | ||
| 8368 | static int font_panel_shown_p = 0; | ||
| 8369 | |||
| 8370 | int | ||
| 8371 | mac_font_panel_visible_p () | ||
| 8372 | { | ||
| 8373 | return font_panel_shown_p && FPIsFontPanelVisible (); | ||
| 8374 | } | ||
| 8375 | |||
| 8376 | OSStatus | ||
| 8377 | mac_show_hide_font_panel () | ||
| 8378 | { | ||
| 8379 | font_panel_shown_p = 1; | ||
| 8380 | |||
| 8381 | return FPShowHideFontPanel (); | ||
| 8382 | } | ||
| 8383 | |||
| 8344 | OSStatus | 8384 | OSStatus |
| 8345 | mac_set_font_info_for_selection (f, face_id, c) | 8385 | mac_set_font_info_for_selection (f, face_id, c) |
| 8346 | struct frame *f; | 8386 | struct frame *f; |
| @@ -8350,6 +8390,9 @@ mac_set_font_info_for_selection (f, face_id, c) | |||
| 8350 | EventTargetRef target = NULL; | 8390 | EventTargetRef target = NULL; |
| 8351 | XFontStruct *font = NULL; | 8391 | XFontStruct *font = NULL; |
| 8352 | 8392 | ||
| 8393 | if (!mac_font_panel_visible_p ()) | ||
| 8394 | return noErr; | ||
| 8395 | |||
| 8353 | if (f) | 8396 | if (f) |
| 8354 | { | 8397 | { |
| 8355 | target = GetWindowEventTarget (FRAME_MAC_WINDOW (f)); | 8398 | target = GetWindowEventTarget (FRAME_MAC_WINDOW (f)); |
| @@ -8484,6 +8527,13 @@ static Lisp_Object Qtoolbar_switch_mode; | |||
| 8484 | extern Lisp_Object Qfont; | 8527 | extern Lisp_Object Qfont; |
| 8485 | static Lisp_Object Qpanel_closed, Qselection; | 8528 | static Lisp_Object Qpanel_closed, Qselection; |
| 8486 | #endif | 8529 | #endif |
| 8530 | #if USE_MAC_TSM | ||
| 8531 | static TSMDocumentID tsm_document_id; | ||
| 8532 | static Lisp_Object Qtext_input; | ||
| 8533 | static Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event; | ||
| 8534 | static Lisp_Object Vmac_ts_active_input_overlay; | ||
| 8535 | extern Lisp_Object Qbefore_string; | ||
| 8536 | #endif | ||
| 8487 | #endif | 8537 | #endif |
| 8488 | extern int mac_ready_for_apple_events; | 8538 | extern int mac_ready_for_apple_events; |
| 8489 | extern Lisp_Object Qundefined; | 8539 | extern Lisp_Object Qundefined; |
| @@ -8835,13 +8885,17 @@ is_emacs_window (WindowPtr win) | |||
| 8835 | static void | 8885 | static void |
| 8836 | do_app_resume () | 8886 | do_app_resume () |
| 8837 | { | 8887 | { |
| 8838 | /* Window-activate events will do the job. */ | 8888 | #if USE_MAC_TSM |
| 8889 | ActivateTSMDocument (tsm_document_id); | ||
| 8890 | #endif | ||
| 8839 | } | 8891 | } |
| 8840 | 8892 | ||
| 8841 | static void | 8893 | static void |
| 8842 | do_app_suspend () | 8894 | do_app_suspend () |
| 8843 | { | 8895 | { |
| 8844 | /* Window-deactivate events will do the job. */ | 8896 | #if USE_MAC_TSM |
| 8897 | DeactivateTSMDocument (tsm_document_id); | ||
| 8898 | #endif | ||
| 8845 | } | 8899 | } |
| 8846 | 8900 | ||
| 8847 | 8901 | ||
| @@ -9101,6 +9155,9 @@ mac_store_event_ref_as_apple_event (class, id, class_key, id_key, | |||
| 9101 | { | 9155 | { |
| 9102 | mac_store_apple_event (class_key, id_key, &apple_event); | 9156 | mac_store_apple_event (class_key, id_key, &apple_event); |
| 9103 | AEDisposeDesc (&apple_event); | 9157 | AEDisposeDesc (&apple_event); |
| 9158 | /* Post a harmless event so as to wake up from | ||
| 9159 | ReceiveNextEvent. */ | ||
| 9160 | mac_post_mouse_moved_event (); | ||
| 9104 | } | 9161 | } |
| 9105 | } | 9162 | } |
| 9106 | } | 9163 | } |
| @@ -9290,6 +9347,18 @@ mac_handle_window_event (next_handler, event, data) | |||
| 9290 | } | 9347 | } |
| 9291 | return err == noErr ? noErr : result; | 9348 | return err == noErr ? noErr : result; |
| 9292 | #endif | 9349 | #endif |
| 9350 | |||
| 9351 | #if USE_MAC_TSM | ||
| 9352 | case kEventWindowFocusAcquired: | ||
| 9353 | result = CallNextEventHandler (next_handler, event); | ||
| 9354 | err = ActivateTSMDocument (tsm_document_id); | ||
| 9355 | return err == noErr ? noErr : result; | ||
| 9356 | |||
| 9357 | case kEventWindowFocusRelinquish: | ||
| 9358 | result = CallNextEventHandler (next_handler, event); | ||
| 9359 | err = DeactivateTSMDocument (tsm_document_id); | ||
| 9360 | return err == noErr ? noErr : result; | ||
| 9361 | #endif | ||
| 9293 | } | 9362 | } |
| 9294 | 9363 | ||
| 9295 | return eventNotHandledErr; | 9364 | return eventNotHandledErr; |
| @@ -9416,6 +9485,183 @@ mac_handle_font_event (next_handler, event, data) | |||
| 9416 | } | 9485 | } |
| 9417 | #endif | 9486 | #endif |
| 9418 | 9487 | ||
| 9488 | #if USE_MAC_TSM | ||
| 9489 | static pascal OSStatus | ||
| 9490 | mac_handle_text_input_event (next_handler, event, data) | ||
| 9491 | EventHandlerCallRef next_handler; | ||
| 9492 | EventRef event; | ||
| 9493 | void *data; | ||
| 9494 | { | ||
| 9495 | OSStatus result, err = noErr; | ||
| 9496 | Lisp_Object id_key = Qnil; | ||
| 9497 | int num_params; | ||
| 9498 | EventParamName *names; | ||
| 9499 | EventParamType *types; | ||
| 9500 | static UInt32 seqno_uaia = 0; | ||
| 9501 | static EventParamName names_uaia[] = | ||
| 9502 | {kEventParamTextInputSendComponentInstance, | ||
| 9503 | kEventParamTextInputSendRefCon, | ||
| 9504 | kEventParamTextInputSendSLRec, | ||
| 9505 | kEventParamTextInputSendFixLen, | ||
| 9506 | kEventParamTextInputSendText, | ||
| 9507 | kEventParamTextInputSendUpdateRng, | ||
| 9508 | kEventParamTextInputSendHiliteRng, | ||
| 9509 | kEventParamTextInputSendClauseRng, | ||
| 9510 | kEventParamTextInputSendPinRng, | ||
| 9511 | kEventParamTextInputSendTextServiceEncoding, | ||
| 9512 | kEventParamTextInputSendTextServiceMacEncoding, | ||
| 9513 | EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER}; | ||
| 9514 | static EventParamType types_uaia[] = | ||
| 9515 | {typeComponentInstance, | ||
| 9516 | typeLongInteger, | ||
| 9517 | typeIntlWritingCode, | ||
| 9518 | typeLongInteger, | ||
| 9519 | typeUnicodeText, | ||
| 9520 | typeTextRangeArray, | ||
| 9521 | typeTextRangeArray, | ||
| 9522 | typeOffsetArray, | ||
| 9523 | typeTextRange, | ||
| 9524 | typeUInt32, | ||
| 9525 | typeUInt32, | ||
| 9526 | typeUInt32}; | ||
| 9527 | static EventParamName names_ufke[] = | ||
| 9528 | {kEventParamTextInputSendComponentInstance, | ||
| 9529 | kEventParamTextInputSendRefCon, | ||
| 9530 | kEventParamTextInputSendSLRec, | ||
| 9531 | kEventParamTextInputSendText}; | ||
| 9532 | static EventParamType types_ufke[] = | ||
| 9533 | {typeComponentInstance, | ||
| 9534 | typeLongInteger, | ||
| 9535 | typeIntlWritingCode, | ||
| 9536 | typeUnicodeText}; | ||
| 9537 | |||
| 9538 | result = CallNextEventHandler (next_handler, event); | ||
| 9539 | |||
| 9540 | switch (GetEventKind (event)) | ||
| 9541 | { | ||
| 9542 | case kEventTextInputUpdateActiveInputArea: | ||
| 9543 | id_key = Qupdate_active_input_area; | ||
| 9544 | num_params = sizeof (names_uaia) / sizeof (names_uaia[0]); | ||
| 9545 | names = names_uaia; | ||
| 9546 | types = types_uaia; | ||
| 9547 | SetEventParameter (event, EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER, | ||
| 9548 | typeUInt32, sizeof (UInt32), &seqno_uaia); | ||
| 9549 | seqno_uaia++; | ||
| 9550 | break; | ||
| 9551 | |||
| 9552 | case kEventTextInputUnicodeForKeyEvent: | ||
| 9553 | { | ||
| 9554 | EventRef kbd_event; | ||
| 9555 | UInt32 actual_size, modifiers, mapped_modifiers; | ||
| 9556 | UniChar code; | ||
| 9557 | |||
| 9558 | err = GetEventParameter (event, kEventParamTextInputSendKeyboardEvent, | ||
| 9559 | typeEventRef, NULL, sizeof (EventRef), NULL, | ||
| 9560 | &kbd_event); | ||
| 9561 | if (err == noErr) | ||
| 9562 | err = GetEventParameter (kbd_event, kEventParamKeyModifiers, | ||
| 9563 | typeUInt32, NULL, | ||
| 9564 | sizeof (UInt32), NULL, &modifiers); | ||
| 9565 | if (err == noErr) | ||
| 9566 | { | ||
| 9567 | mapped_modifiers = | ||
| 9568 | (NILP (Vmac_control_modifier) ? 0 : controlKey) | ||
| 9569 | | (NILP (Vmac_option_modifier) ? 0 : optionKey) | ||
| 9570 | | (NILP (Vmac_command_modifier) ? 0 : cmdKey); | ||
| 9571 | #ifdef MAC_OSX | ||
| 9572 | mapped_modifiers |= | ||
| 9573 | (NILP (Vmac_function_modifier) ? 0 : kEventKeyModifierFnMask); | ||
| 9574 | #endif | ||
| 9575 | if (modifiers & mapped_modifiers) | ||
| 9576 | /* There're mapped modifier keys. Process it in | ||
| 9577 | XTread_socket. */ | ||
| 9578 | return eventNotHandledErr; | ||
| 9579 | } | ||
| 9580 | if (err == noErr) | ||
| 9581 | err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, | ||
| 9582 | typeUnicodeText, NULL, 0, &actual_size, | ||
| 9583 | NULL); | ||
| 9584 | if (err == noErr) | ||
| 9585 | { | ||
| 9586 | if (actual_size == sizeof (UniChar)) | ||
| 9587 | err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, | ||
| 9588 | typeUnicodeText, NULL, | ||
| 9589 | sizeof (UniChar), NULL, &code); | ||
| 9590 | if (err == noErr && code < 0x80) | ||
| 9591 | { | ||
| 9592 | /* ASCII character. Process it in XTread_socket. */ | ||
| 9593 | if (read_socket_inev && code >= 0x20 && code <= 0x7e) | ||
| 9594 | { | ||
| 9595 | struct frame *f = mac_focus_frame (&one_mac_display_info); | ||
| 9596 | |||
| 9597 | read_socket_inev->kind = ASCII_KEYSTROKE_EVENT; | ||
| 9598 | read_socket_inev->code = code; | ||
| 9599 | read_socket_inev->modifiers = | ||
| 9600 | (extra_keyboard_modifiers | ||
| 9601 | & (meta_modifier | alt_modifier | ||
| 9602 | | hyper_modifier | super_modifier)); | ||
| 9603 | XSETFRAME (read_socket_inev->frame_or_window, f); | ||
| 9604 | } | ||
| 9605 | return eventNotHandledErr; | ||
| 9606 | } | ||
| 9607 | } | ||
| 9608 | } | ||
| 9609 | /* Non-ASCII keystrokes without mapped modifiers are processed | ||
| 9610 | at the Lisp level. */ | ||
| 9611 | id_key = Qunicode_for_key_event; | ||
| 9612 | num_params = sizeof (names_ufke) / sizeof (names_ufke[0]); | ||
| 9613 | names = names_ufke; | ||
| 9614 | types = types_ufke; | ||
| 9615 | break; | ||
| 9616 | |||
| 9617 | case kEventTextInputOffsetToPos: | ||
| 9618 | { | ||
| 9619 | struct frame *f; | ||
| 9620 | struct window *w; | ||
| 9621 | Point p; | ||
| 9622 | |||
| 9623 | if (!OVERLAYP (Vmac_ts_active_input_overlay)) | ||
| 9624 | return eventNotHandledErr; | ||
| 9625 | |||
| 9626 | /* Strictly speaking, this is not always correct because | ||
| 9627 | previous events may change some states about display. */ | ||
| 9628 | if (NILP (Foverlay_get (Vmac_ts_active_input_overlay, Qbefore_string))) | ||
| 9629 | { | ||
| 9630 | /* Active input area is displayed in the echo area. */ | ||
| 9631 | w = XWINDOW (echo_area_window); | ||
| 9632 | f = WINDOW_XFRAME (w); | ||
| 9633 | } | ||
| 9634 | else | ||
| 9635 | { | ||
| 9636 | /* Active input area is displayed around the current point. */ | ||
| 9637 | f = SELECTED_FRAME (); | ||
| 9638 | w = XWINDOW (f->selected_window); | ||
| 9639 | } | ||
| 9640 | |||
| 9641 | p.h = (WINDOW_TO_FRAME_PIXEL_X (w, w->cursor.x) | ||
| 9642 | + WINDOW_LEFT_FRINGE_WIDTH (w)); | ||
| 9643 | p.v = (WINDOW_TO_FRAME_PIXEL_Y (w, w->cursor.y) | ||
| 9644 | + FONT_BASE (FRAME_FONT (f))); | ||
| 9645 | SetPortWindowPort (FRAME_MAC_WINDOW (f)); | ||
| 9646 | LocalToGlobal (&p); | ||
| 9647 | err = SetEventParameter (event, kEventParamTextInputReplyPoint, | ||
| 9648 | typeQDPoint, sizeof (typeQDPoint), &p); | ||
| 9649 | } | ||
| 9650 | break; | ||
| 9651 | |||
| 9652 | default: | ||
| 9653 | abort (); | ||
| 9654 | } | ||
| 9655 | |||
| 9656 | if (!NILP (id_key)) | ||
| 9657 | err = mac_store_event_ref_as_apple_event (0, 0, Qtext_input, id_key, | ||
| 9658 | event, num_params, | ||
| 9659 | names, types); | ||
| 9660 | |||
| 9661 | return err == noErr ? noErr : result; | ||
| 9662 | } | ||
| 9663 | #endif | ||
| 9664 | |||
| 9419 | #ifdef MAC_OSX | 9665 | #ifdef MAC_OSX |
| 9420 | OSStatus | 9666 | OSStatus |
| 9421 | mac_store_service_event (event) | 9667 | mac_store_service_event (event) |
| @@ -9477,6 +9723,10 @@ install_window_handler (window) | |||
| 9477 | #ifdef MAC_OSX | 9723 | #ifdef MAC_OSX |
| 9478 | {kEventClassWindow, kEventWindowToolbarSwitchMode}, | 9724 | {kEventClassWindow, kEventWindowToolbarSwitchMode}, |
| 9479 | #endif | 9725 | #endif |
| 9726 | #if USE_MAC_TSM | ||
| 9727 | {kEventClassWindow, kEventWindowFocusAcquired}, | ||
| 9728 | {kEventClassWindow, kEventWindowFocusRelinquish}, | ||
| 9729 | #endif | ||
| 9480 | }; | 9730 | }; |
| 9481 | EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; | 9731 | EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; |
| 9482 | static EventHandlerUPP handle_window_eventUPP = NULL; | 9732 | static EventHandlerUPP handle_window_eventUPP = NULL; |
| @@ -9486,6 +9736,13 @@ install_window_handler (window) | |||
| 9486 | {kEventClassFont, kEventFontSelection}}; | 9736 | {kEventClassFont, kEventFontSelection}}; |
| 9487 | static EventHandlerUPP handle_font_eventUPP = NULL; | 9737 | static EventHandlerUPP handle_font_eventUPP = NULL; |
| 9488 | #endif | 9738 | #endif |
| 9739 | #if USE_MAC_TSM | ||
| 9740 | EventTypeSpec specs_text_input[] = | ||
| 9741 | {{kEventClassTextInput, kEventTextInputUpdateActiveInputArea}, | ||
| 9742 | {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent}, | ||
| 9743 | {kEventClassTextInput, kEventTextInputOffsetToPos}}; | ||
| 9744 | static EventHandlerUPP handle_text_input_eventUPP = NULL; | ||
| 9745 | #endif | ||
| 9489 | 9746 | ||
| 9490 | if (handle_window_eventUPP == NULL) | 9747 | if (handle_window_eventUPP == NULL) |
| 9491 | handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event); | 9748 | handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event); |
| @@ -9495,6 +9752,11 @@ install_window_handler (window) | |||
| 9495 | if (handle_font_eventUPP == NULL) | 9752 | if (handle_font_eventUPP == NULL) |
| 9496 | handle_font_eventUPP = NewEventHandlerUPP (mac_handle_font_event); | 9753 | handle_font_eventUPP = NewEventHandlerUPP (mac_handle_font_event); |
| 9497 | #endif | 9754 | #endif |
| 9755 | #if USE_MAC_TSM | ||
| 9756 | if (handle_text_input_eventUPP == NULL) | ||
| 9757 | handle_text_input_eventUPP = | ||
| 9758 | NewEventHandlerUPP (mac_handle_text_input_event); | ||
| 9759 | #endif | ||
| 9498 | err = InstallWindowEventHandler (window, handle_window_eventUPP, | 9760 | err = InstallWindowEventHandler (window, handle_window_eventUPP, |
| 9499 | GetEventTypeCount (specs_window), | 9761 | GetEventTypeCount (specs_window), |
| 9500 | specs_window, NULL, NULL); | 9762 | specs_window, NULL, NULL); |
| @@ -9508,6 +9770,12 @@ install_window_handler (window) | |||
| 9508 | GetEventTypeCount (specs_font), | 9770 | GetEventTypeCount (specs_font), |
| 9509 | specs_font, NULL, NULL); | 9771 | specs_font, NULL, NULL); |
| 9510 | #endif | 9772 | #endif |
| 9773 | #if USE_MAC_TSM | ||
| 9774 | if (err == noErr) | ||
| 9775 | err = InstallWindowEventHandler (window, handle_text_input_eventUPP, | ||
| 9776 | GetEventTypeCount (specs_text_input), | ||
| 9777 | specs_text_input, window, NULL); | ||
| 9778 | #endif | ||
| 9511 | #endif | 9779 | #endif |
| 9512 | if (err == noErr) | 9780 | if (err == noErr) |
| 9513 | err = install_drag_handler (window); | 9781 | err = install_drag_handler (window); |
| @@ -9633,7 +9901,7 @@ static unsigned char keycode_to_xkeysym_table[] = { | |||
| 9633 | 9901 | ||
| 9634 | /*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/, | 9902 | /*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/, |
| 9635 | /*0x64*/ 0xc5 /*f8*/, 0xc6 /*f9*/, 0, 0xc8 /*f11*/, | 9903 | /*0x64*/ 0xc5 /*f8*/, 0xc6 /*f9*/, 0, 0xc8 /*f11*/, |
| 9636 | /*0x68*/ 0, 0xca /*f13*/, 0, 0xcb /*f14*/, | 9904 | /*0x68*/ 0, 0xca /*f13*/, 0xcd /*f16*/, 0xcb /*f14*/, |
| 9637 | /*0x6C*/ 0, 0xc7 /*f10*/, 0x0a /*fn+enter on laptops*/, 0xc9 /*f12*/, | 9905 | /*0x6C*/ 0, 0xc7 /*f10*/, 0x0a /*fn+enter on laptops*/, 0xc9 /*f12*/, |
| 9638 | 9906 | ||
| 9639 | /*0x70*/ 0, 0xcc /*f15*/, 0x6a /*help*/, 0x50 /*home*/, | 9907 | /*0x70*/ 0, 0xcc /*f15*/, 0x6a /*help*/, 0x50 /*home*/, |
| @@ -9650,7 +9918,13 @@ keycode_to_xkeysym (int keyCode, int *xKeySym) | |||
| 9650 | return *xKeySym != 0; | 9918 | return *xKeySym != 0; |
| 9651 | } | 9919 | } |
| 9652 | 9920 | ||
| 9653 | static unsigned char fn_keycode_to_xkeysym_table[] = { | 9921 | #ifdef MAC_OSX |
| 9922 | /* Table for translating Mac keycode with the laptop `fn' key to that | ||
| 9923 | without it. Destination symbols in comments are keys on US | ||
| 9924 | keyboard, and they may not be the same on other types of keyboards. | ||
| 9925 | If the destination is identical to the source (f1 ... f12), it | ||
| 9926 | doesn't map `fn' key to a modifier. */ | ||
| 9927 | static unsigned char fn_keycode_to_keycode_table[] = { | ||
| 9654 | /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 9928 | /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 9655 | /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 9929 | /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 9656 | /*0x20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 9930 | /*0x20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| @@ -9660,113 +9934,27 @@ static unsigned char fn_keycode_to_xkeysym_table[] = { | |||
| 9660 | /*0x38*/ 0, 0, 0, 0, | 9934 | /*0x38*/ 0, 0, 0, 0, |
| 9661 | /*0x3C*/ 0, 0, 0, 0, | 9935 | /*0x3C*/ 0, 0, 0, 0, |
| 9662 | 9936 | ||
| 9663 | /*0x40*/ 0, 0x2e /*kp-. = .*/, 0, 0x50 /*kp-* = 'p'*/, | 9937 | /*0x40*/ 0, 0x2f /*kp-. -> '.'*/, 0, 0x23 /*kp-* -> 'p'*/, |
| 9664 | /*0x44*/ 0, '/' /*kp-+*/, 0, 0, | 9938 | /*0x44*/ 0, 0x2c /*kp-+ -> '/'*/, 0, 0x16 /*clear -> '6'*/, |
| 9665 | /*0x48*/ 0, 0, 0, 0x30 /*kp-/ = '0'*/, | 9939 | /*0x48*/ 0, 0, 0, 0x1d /*kp-/ -> '0'*/, |
| 9666 | /*0x4C*/ 0, 0, 0x3b /*kp-- = ';'*/, 0, | 9940 | /*0x4C*/ 0x24 /*kp-enter -> return*/, 0, 0x29 /*kp-- -> ';'*/, 0, |
| 9667 | 9941 | ||
| 9668 | /*0x50*/ 0, 0x2d /*kp-= = '-'*/, 0x6d /*kp-0 = 'm'*/, 0x6a /*kp-1 = 'j'*/, | 9942 | /*0x50*/ 0, 0x1b /*kp-= -> '-'*/, 0x2e /*kp-0 -> 'm'*/, 0x26 /*kp-1 -> 'j'*/, |
| 9669 | /*0x54*/ 0x6b /*kp-2 = 'k'*/, 0x6c /*kp-3 = 'l'*/, 'u' /*kp-4*/, 'i' /*kp-5*/, | 9943 | /*0x54*/ 0x28 /*kp-2 -> 'k'*/, 0x25 /*kp-3 -> 'l'*/, 0x20 /*kp-4 -> 'u'*/, 0x22 /*kp-5 ->'i'*/, |
| 9670 | /*0x58*/ 'o' /*kp-6*/, '7' /*kp-7*/, 0, '8' /*kp-8*/, | 9944 | /*0x58*/ 0x1f /*kp-6 -> 'o'*/, 0x1a /*kp-7 -> '7'*/, 0, 0x1c /*kp-8 -> '8'*/, |
| 9671 | /*0x5C*/ '9' /*kp-9*/, 0, 0, 0, | 9945 | /*0x5C*/ 0x19 /*kp-9 -> '9'*/, 0, 0, 0, |
| 9672 | 9946 | ||
| 9673 | /*0x60*/ 0, 0, 0, 0, | 9947 | /*0x60*/ 0x60 /*f5 = f5*/, 0x61 /*f6 = f6*/, 0x62 /*f7 = f7*/, 0x63 /*f3 = f3*/, |
| 9674 | /*0x64*/ 0, 0, 0, 0, | 9948 | /*0x64*/ 0x64 /*f8 = f8*/, 0x65 /*f9 = f9*/, 0, 0x67 /*f11 = f11*/, |
| 9675 | /*0x68*/ 0, 0, 0, 0, | 9949 | /*0x68*/ 0, 0, 0, 0, |
| 9676 | /*0x6C*/ 0, 0, 0, 0, | 9950 | /*0x6C*/ 0, 0x6d /*f10 = f10*/, 0, 0x6f /*f12 = f12*/, |
| 9677 | 9951 | ||
| 9678 | /*0x70*/ 0, 0, 0, 0, | 9952 | /*0x70*/ 0, 0, 0, 0x7b /*home -> left*/, |
| 9679 | /*0x74*/ 0, 0, 0, 0, | 9953 | /*0x74*/ 0x7e /*pgup -> up*/, 0x33 /*delete -> backspace*/, 0x76 /*f4 = f4*/, 0x7c /*end -> right*/, |
| 9680 | /*0x78*/ 0, 0, 0, 0, | 9954 | /*0x78*/ 0x78 /*f2 = f2*/, 0x7d /*pgdown -> down*/, 0x7a /*f1 = f1*/, 0, |
| 9681 | /*0x7C*/ 0, 0, 0, 0 | 9955 | /*0x7C*/ 0, 0, 0, 0 |
| 9682 | }; | 9956 | }; |
| 9683 | static int | 9957 | #endif /* MAC_OSX */ |
| 9684 | convert_fn_keycode (EventRef eventRef, int keyCode, int *newCode) | ||
| 9685 | { | ||
| 9686 | #ifdef MAC_OSX | ||
| 9687 | /* Use the special map to translate keys when function modifier is | ||
| 9688 | to be caught. KeyTranslate can't be used in that case. | ||
| 9689 | We can't detect the function key using the input_event.modifiers, | ||
| 9690 | because this uses the high word of an UInt32. Therefore, | ||
| 9691 | we'll just read it out of the original eventRef. | ||
| 9692 | */ | ||
| 9693 | |||
| 9694 | |||
| 9695 | /* TODO / known issues | ||
| 9696 | |||
| 9697 | - Fn-Shift-j is regonized as Fn-j and not Fn-J. | ||
| 9698 | The above table always translates to lower characters. We need to use | ||
| 9699 | the KCHR keyboard resource (KeyTranslate() ) to map k->K and 8->*. | ||
| 9700 | |||
| 9701 | - The table is meant for English language keyboards, and it will work | ||
| 9702 | for many others with the exception of key combinations like Fn-ö on | ||
| 9703 | a German keyboard, which is currently mapped to Fn-;. | ||
| 9704 | How to solve this without keeping separate tables for all keyboards | ||
| 9705 | around? KeyTranslate isn't of much help here, as it only takes a 16-bit | ||
| 9706 | value for keycode with the modifiers in he high byte, i.e. no room for the | ||
| 9707 | Fn modifier. That's why we need the table. | ||
| 9708 | |||
| 9709 | */ | ||
| 9710 | OSStatus err; | ||
| 9711 | UInt32 mods = 0; | ||
| 9712 | if (!NILP(Vmac_function_modifier)) | ||
| 9713 | { | ||
| 9714 | err = GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, | ||
| 9715 | NULL, sizeof (UInt32), NULL, &mods); | ||
| 9716 | if (err != noErr && mods & kEventKeyModifierFnMask) | ||
| 9717 | { *newCode = fn_keycode_to_xkeysym_table [keyCode & 0x7f]; | ||
| 9718 | |||
| 9719 | return (*newCode != 0); | ||
| 9720 | } | ||
| 9721 | } | ||
| 9722 | #endif | ||
| 9723 | return false; | ||
| 9724 | } | ||
| 9725 | |||
| 9726 | static int | ||
| 9727 | backtranslate_modified_keycode(int mods, int keycode, int def) | ||
| 9728 | { | ||
| 9729 | EventModifiers mapped_modifiers = | ||
| 9730 | (NILP (Vmac_control_modifier) ? 0 : controlKey) | ||
| 9731 | | (NILP (Vmac_option_modifier) ? 0 : optionKey) | ||
| 9732 | | (NILP (Vmac_command_modifier) ? 0 : cmdKey); | ||
| 9733 | |||
| 9734 | if (mods & mapped_modifiers) | ||
| 9735 | { | ||
| 9736 | /* This code comes from Keyboard Resource, | ||
| 9737 | Appendix C of IM - Text. This is necessary | ||
| 9738 | since shift is ignored in KCHR table | ||
| 9739 | translation when option or command is pressed. | ||
| 9740 | It also does not translate correctly | ||
| 9741 | control-shift chars like C-% so mask off shift | ||
| 9742 | here also. | ||
| 9743 | |||
| 9744 | Not done for combinations with the option key (alt) | ||
| 9745 | unless it is to be caught by Emacs: this is | ||
| 9746 | to preserve key combinations translated by the OS | ||
| 9747 | such as Alt-3. | ||
| 9748 | */ | ||
| 9749 | /* Mask off modifier keys that are mapped to some Emacs | ||
| 9750 | modifiers. */ | ||
| 9751 | int new_modifiers = mods & ~mapped_modifiers; | ||
| 9752 | /* set high byte of keycode to modifier high byte*/ | ||
| 9753 | int new_keycode = keycode | new_modifiers; | ||
| 9754 | Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache); | ||
| 9755 | unsigned long some_state = 0; | ||
| 9756 | return (int) KeyTranslate (kchr_ptr, new_keycode, | ||
| 9757 | &some_state) & 0xff; | ||
| 9758 | /* TO DO: Recognize two separate resulting characters, "for | ||
| 9759 | example, when the user presses Option-E followed by N, you | ||
| 9760 | can map this through the KeyTranslate function using the | ||
| 9761 | U.S. 'KCHR' resource to produce ´n, which KeyTranslate | ||
| 9762 | returns as two characters in the bytes labeled Character code | ||
| 9763 | 1 and Character code 2." (from Carbon API doc) */ | ||
| 9764 | |||
| 9765 | } | ||
| 9766 | else | ||
| 9767 | return def; | ||
| 9768 | } | ||
| 9769 | |||
| 9770 | 9958 | ||
| 9771 | #if !USE_CARBON_EVENTS | 9959 | #if !USE_CARBON_EVENTS |
| 9772 | static RgnHandle mouse_region = NULL; | 9960 | static RgnHandle mouse_region = NULL; |
| @@ -9840,6 +10028,44 @@ mac_post_mouse_moved_event () | |||
| 9840 | 10028 | ||
| 9841 | return err; | 10029 | return err; |
| 9842 | } | 10030 | } |
| 10031 | |||
| 10032 | static void | ||
| 10033 | mac_set_unicode_keystroke_event (code, buf) | ||
| 10034 | UniChar code; | ||
| 10035 | struct input_event *buf; | ||
| 10036 | { | ||
| 10037 | int charset_id, c1, c2; | ||
| 10038 | |||
| 10039 | if (code < 0x80) | ||
| 10040 | { | ||
| 10041 | buf->kind = ASCII_KEYSTROKE_EVENT; | ||
| 10042 | buf->code = code; | ||
| 10043 | } | ||
| 10044 | else if (code < 0x100) | ||
| 10045 | { | ||
| 10046 | if (code < 0xA0) | ||
| 10047 | charset_id = CHARSET_8_BIT_CONTROL; | ||
| 10048 | else | ||
| 10049 | charset_id = charset_latin_iso8859_1; | ||
| 10050 | buf->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT; | ||
| 10051 | buf->code = MAKE_CHAR (charset_id, code, 0); | ||
| 10052 | } | ||
| 10053 | else | ||
| 10054 | { | ||
| 10055 | if (code < 0x2500) | ||
| 10056 | charset_id = charset_mule_unicode_0100_24ff, | ||
| 10057 | code -= 0x100; | ||
| 10058 | else if (code < 0x33FF) | ||
| 10059 | charset_id = charset_mule_unicode_2500_33ff, | ||
| 10060 | code -= 0x2500; | ||
| 10061 | else if (code >= 0xE000) | ||
| 10062 | charset_id = charset_mule_unicode_e000_ffff, | ||
| 10063 | code -= 0xE000; | ||
| 10064 | c1 = (code / 96) + 32, c2 = (code % 96) + 32; | ||
| 10065 | buf->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT; | ||
| 10066 | buf->code = MAKE_CHAR (charset_id, c1, c2); | ||
| 10067 | } | ||
| 10068 | } | ||
| 9843 | #endif | 10069 | #endif |
| 9844 | 10070 | ||
| 9845 | /* Emacs calls this whenever it wants to read an input event from the | 10071 | /* Emacs calls this whenever it wants to read an input event from the |
| @@ -9889,10 +10115,6 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9889 | struct frame *f; | 10115 | struct frame *f; |
| 9890 | unsigned long timestamp; | 10116 | unsigned long timestamp; |
| 9891 | 10117 | ||
| 9892 | /* It is necessary to set this (additional) argument slot of an | ||
| 9893 | event to nil because keyboard.c protects incompletely | ||
| 9894 | processed event from being garbage collected by placing them | ||
| 9895 | in the kbd_buffer_gcpro vector. */ | ||
| 9896 | EVENT_INIT (inev); | 10118 | EVENT_INIT (inev); |
| 9897 | inev.kind = NO_EVENT; | 10119 | inev.kind = NO_EVENT; |
| 9898 | inev.arg = Qnil; | 10120 | inev.arg = Qnil; |
| @@ -10354,10 +10576,29 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10354 | break; | 10576 | break; |
| 10355 | 10577 | ||
| 10356 | case keyDown: | 10578 | case keyDown: |
| 10579 | case keyUp: | ||
| 10357 | case autoKey: | 10580 | case autoKey: |
| 10358 | { | 10581 | { |
| 10359 | int keycode = (er.message & keyCodeMask) >> 8; | 10582 | int keycode = (er.message & keyCodeMask) >> 8; |
| 10360 | int xkeysym; | 10583 | int xkeysym; |
| 10584 | static SInt16 last_key_script = -1; | ||
| 10585 | SInt16 current_key_script; | ||
| 10586 | UInt32 modifiers = er.modifiers, mapped_modifiers; | ||
| 10587 | |||
| 10588 | mapped_modifiers = | ||
| 10589 | (NILP (Vmac_control_modifier) ? 0 : controlKey) | ||
| 10590 | | (NILP (Vmac_option_modifier) ? 0 : optionKey) | ||
| 10591 | | (NILP (Vmac_command_modifier) ? 0 : cmdKey); | ||
| 10592 | |||
| 10593 | #if USE_CARBON_EVENTS && defined (MAC_OSX) | ||
| 10594 | mapped_modifiers |= | ||
| 10595 | (NILP (Vmac_function_modifier) ? 0 : kEventKeyModifierFnMask); | ||
| 10596 | |||
| 10597 | GetEventParameter (eventRef, kEventParamKeyModifiers, | ||
| 10598 | typeUInt32, NULL, | ||
| 10599 | sizeof (UInt32), NULL, &modifiers); | ||
| 10600 | #endif | ||
| 10601 | mapped_modifiers &= modifiers; | ||
| 10361 | 10602 | ||
| 10362 | #if USE_CARBON_EVENTS && defined (MAC_OSX) | 10603 | #if USE_CARBON_EVENTS && defined (MAC_OSX) |
| 10363 | /* When using Carbon Events, we need to pass raw keyboard | 10604 | /* When using Carbon Events, we need to pass raw keyboard |
| @@ -10365,45 +10606,21 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10365 | will pass back noErr, otherwise it will pass back | 10606 | will pass back noErr, otherwise it will pass back |
| 10366 | "eventNotHandledErr" and we can process it | 10607 | "eventNotHandledErr" and we can process it |
| 10367 | normally. */ | 10608 | normally. */ |
| 10368 | if ((mac_pass_command_to_system | 10609 | if (!(mapped_modifiers |
| 10369 | || !(er.modifiers & cmdKey)) | 10610 | & ~(mac_pass_command_to_system ? cmdKey : 0) |
| 10370 | && (mac_pass_control_to_system | 10611 | & ~(mac_pass_control_to_system ? controlKey : 0))) |
| 10371 | || !(er.modifiers & controlKey)) | ||
| 10372 | && (NILP (Vmac_option_modifier) | ||
| 10373 | || !(er.modifiers & optionKey))) | ||
| 10374 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) | ||
| 10375 | != eventNotHandledErr) | ||
| 10376 | break; | ||
| 10377 | #endif | ||
| 10378 | |||
| 10379 | #if 0 | ||
| 10380 | if (dpyinfo->x_focus_frame == NULL) | ||
| 10381 | { | 10612 | { |
| 10382 | /* Beep if keyboard input occurs when all the frames | 10613 | OSStatus err; |
| 10383 | are invisible. */ | 10614 | |
| 10384 | SysBeep (1); | 10615 | read_socket_inev = &inev; |
| 10385 | break; | 10616 | err = SendEventToEventTarget (eventRef, toolbox_dispatcher); |
| 10617 | read_socket_inev = NULL; | ||
| 10618 | if (err != eventNotHandledErr) | ||
| 10619 | break; | ||
| 10386 | } | 10620 | } |
| 10387 | #endif | 10621 | #endif |
| 10388 | 10622 | if (er.what == keyUp) | |
| 10389 | { | 10623 | break; |
| 10390 | static SInt16 last_key_script = -1; | ||
| 10391 | SInt16 current_key_script = GetScriptManagerVariable (smKeyScript); | ||
| 10392 | |||
| 10393 | if (last_key_script != current_key_script) | ||
| 10394 | { | ||
| 10395 | struct input_event event; | ||
| 10396 | |||
| 10397 | EVENT_INIT (event); | ||
| 10398 | event.kind = LANGUAGE_CHANGE_EVENT; | ||
| 10399 | event.arg = Qnil; | ||
| 10400 | event.code = current_key_script; | ||
| 10401 | event.timestamp = timestamp; | ||
| 10402 | kbd_buffer_store_event (&event); | ||
| 10403 | count++; | ||
| 10404 | } | ||
| 10405 | last_key_script = current_key_script; | ||
| 10406 | } | ||
| 10407 | 10624 | ||
| 10408 | ObscureCursor (); | 10625 | ObscureCursor (); |
| 10409 | 10626 | ||
| @@ -10416,51 +10633,163 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10416 | dpyinfo->mouse_face_hidden = 1; | 10633 | dpyinfo->mouse_face_hidden = 1; |
| 10417 | } | 10634 | } |
| 10418 | 10635 | ||
| 10419 | /* translate the keycode back to determine the original key */ | 10636 | current_key_script = GetScriptManagerVariable (smKeyScript); |
| 10420 | /* Convert key code if function key is pressed. | 10637 | if (last_key_script != current_key_script) |
| 10421 | Otherwise, if non-ASCII-event, take care of that | ||
| 10422 | without re-translating the key code. */ | ||
| 10423 | #if USE_CARBON_EVENTS | ||
| 10424 | if (convert_fn_keycode (eventRef, keycode, &xkeysym)) | ||
| 10425 | { | 10638 | { |
| 10426 | inev.code = xkeysym; | 10639 | struct input_event event; |
| 10427 | /* this doesn't work - tried to add shift modifiers */ | 10640 | |
| 10428 | inev.code = | 10641 | EVENT_INIT (event); |
| 10429 | backtranslate_modified_keycode(er.modifiers & (~0x2200), | 10642 | event.kind = LANGUAGE_CHANGE_EVENT; |
| 10430 | xkeysym | 0x80, xkeysym); | 10643 | event.arg = Qnil; |
| 10431 | inev.kind = ASCII_KEYSTROKE_EVENT; | 10644 | event.code = current_key_script; |
| 10645 | event.timestamp = timestamp; | ||
| 10646 | kbd_buffer_store_event (&event); | ||
| 10647 | count++; | ||
| 10648 | last_key_script = current_key_script; | ||
| 10432 | } | 10649 | } |
| 10433 | else | 10650 | |
| 10651 | #if USE_MAC_TSM | ||
| 10652 | if (inev.kind != NO_EVENT) | ||
| 10653 | break; | ||
| 10434 | #endif | 10654 | #endif |
| 10435 | if (keycode_to_xkeysym (keycode, &xkeysym)) | ||
| 10436 | { | ||
| 10437 | inev.code = 0xff00 | xkeysym; | ||
| 10438 | inev.kind = NON_ASCII_KEYSTROKE_EVENT; | ||
| 10439 | } | ||
| 10440 | else | ||
| 10441 | { | ||
| 10442 | inev.code = | ||
| 10443 | backtranslate_modified_keycode(er.modifiers, keycode, | ||
| 10444 | er.message & charCodeMask); | ||
| 10445 | inev.kind = ASCII_KEYSTROKE_EVENT; | ||
| 10446 | } | ||
| 10447 | } | ||
| 10448 | 10655 | ||
| 10449 | #if USE_CARBON_EVENTS | 10656 | #ifdef MAC_OSX |
| 10450 | inev.modifiers = mac_event_to_emacs_modifiers (eventRef); | 10657 | if (mapped_modifiers & kEventKeyModifierFnMask |
| 10451 | #else | 10658 | && keycode <= 0x7f |
| 10452 | inev.modifiers = mac_to_emacs_modifiers (er.modifiers); | 10659 | && fn_keycode_to_keycode_table[keycode]) |
| 10660 | keycode = fn_keycode_to_keycode_table[keycode]; | ||
| 10453 | #endif | 10661 | #endif |
| 10454 | inev.modifiers |= (extra_keyboard_modifiers | 10662 | if (keycode_to_xkeysym (keycode, &xkeysym)) |
| 10455 | & (meta_modifier | alt_modifier | 10663 | { |
| 10456 | | hyper_modifier | super_modifier)); | 10664 | inev.kind = NON_ASCII_KEYSTROKE_EVENT; |
| 10457 | XSETFRAME (inev.frame_or_window, f); | 10665 | inev.code = 0xff00 | xkeysym; |
| 10666 | #ifdef MAC_OSX | ||
| 10667 | if (modifiers & kEventKeyModifierFnMask | ||
| 10668 | && keycode <= 0x7f | ||
| 10669 | && fn_keycode_to_keycode_table[keycode] == keycode) | ||
| 10670 | modifiers &= ~kEventKeyModifierFnMask; | ||
| 10671 | #endif | ||
| 10672 | } | ||
| 10673 | else if (mapped_modifiers) | ||
| 10674 | { | ||
| 10675 | /* translate the keycode back to determine the | ||
| 10676 | original key */ | ||
| 10677 | #ifdef MAC_OSX | ||
| 10678 | static SInt16 last_key_layout_id = 0; | ||
| 10679 | static Handle uchr_handle = (Handle)-1; | ||
| 10680 | SInt16 current_key_layout_id = | ||
| 10681 | GetScriptVariable (current_key_script, smScriptKeys); | ||
| 10682 | |||
| 10683 | if (uchr_handle == (Handle)-1 | ||
| 10684 | || last_key_layout_id != current_key_layout_id) | ||
| 10685 | { | ||
| 10686 | uchr_handle = GetResource ('uchr', current_key_layout_id); | ||
| 10687 | last_key_layout_id = current_key_layout_id; | ||
| 10688 | } | ||
| 10689 | |||
| 10690 | if (uchr_handle) | ||
| 10691 | { | ||
| 10692 | OSStatus status; | ||
| 10693 | UInt16 key_action = er.what - keyDown; | ||
| 10694 | UInt32 modifier_key_state = | ||
| 10695 | (modifiers & ~mapped_modifiers) >> 8; | ||
| 10696 | UInt32 keyboard_type = LMGetKbdType (); | ||
| 10697 | SInt32 dead_key_state = 0; | ||
| 10698 | UniChar code; | ||
| 10699 | UniCharCount actual_length; | ||
| 10700 | |||
| 10701 | status = UCKeyTranslate ((UCKeyboardLayout *)*uchr_handle, | ||
| 10702 | keycode, key_action, | ||
| 10703 | modifier_key_state, | ||
| 10704 | keyboard_type, | ||
| 10705 | kUCKeyTranslateNoDeadKeysMask, | ||
| 10706 | &dead_key_state, | ||
| 10707 | 1, &actual_length, &code); | ||
| 10708 | if (status == noErr && actual_length == 1) | ||
| 10709 | mac_set_unicode_keystroke_event (code, &inev); | ||
| 10710 | } | ||
| 10711 | #endif /* MAC_OSX */ | ||
| 10712 | |||
| 10713 | if (inev.kind == NO_EVENT) | ||
| 10714 | { | ||
| 10715 | /* This code comes from Keyboard Resource, | ||
| 10716 | Appendix C of IM - Text. This is necessary | ||
| 10717 | since shift is ignored in KCHR table | ||
| 10718 | translation when option or command is pressed. | ||
| 10719 | It also does not translate correctly | ||
| 10720 | control-shift chars like C-% so mask off shift | ||
| 10721 | here also. */ | ||
| 10722 | /* Mask off modifier keys that are mapped to some | ||
| 10723 | Emacs modifiers. */ | ||
| 10724 | int new_modifiers = er.modifiers & ~mapped_modifiers; | ||
| 10725 | /* set high byte of keycode to modifier high byte*/ | ||
| 10726 | int new_keycode = keycode | new_modifiers; | ||
| 10727 | Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache); | ||
| 10728 | unsigned long some_state = 0; | ||
| 10729 | UInt32 new_char_code; | ||
| 10730 | |||
| 10731 | new_char_code = KeyTranslate (kchr_ptr, new_keycode, | ||
| 10732 | &some_state); | ||
| 10733 | if (new_char_code == 0) | ||
| 10734 | /* Seems like a dead key. Append up-stroke. */ | ||
| 10735 | new_char_code = KeyTranslate (kchr_ptr, | ||
| 10736 | new_keycode | 0x80, | ||
| 10737 | &some_state); | ||
| 10738 | if (new_char_code) | ||
| 10739 | { | ||
| 10740 | inev.kind = ASCII_KEYSTROKE_EVENT; | ||
| 10741 | inev.code = new_char_code & 0xff; | ||
| 10742 | } | ||
| 10743 | } | ||
| 10744 | } | ||
| 10745 | |||
| 10746 | if (inev.kind == NO_EVENT) | ||
| 10747 | { | ||
| 10748 | inev.kind = ASCII_KEYSTROKE_EVENT; | ||
| 10749 | inev.code = er.message & charCodeMask; | ||
| 10750 | } | ||
| 10751 | |||
| 10752 | inev.modifiers = mac_to_emacs_modifiers (modifiers); | ||
| 10753 | inev.modifiers |= (extra_keyboard_modifiers | ||
| 10754 | & (meta_modifier | alt_modifier | ||
| 10755 | | hyper_modifier | super_modifier)); | ||
| 10756 | XSETFRAME (inev.frame_or_window, f); | ||
| 10757 | |||
| 10758 | #if TARGET_API_MAC_CARBON | ||
| 10759 | if (inev.kind == ASCII_KEYSTROKE_EVENT | ||
| 10760 | && inev.code >= 0x80 && inev.modifiers) | ||
| 10761 | { | ||
| 10762 | OSStatus err; | ||
| 10763 | TextEncoding encoding = kTextEncodingMacRoman; | ||
| 10764 | TextToUnicodeInfo ttu_info; | ||
| 10765 | |||
| 10766 | UpgradeScriptInfoToTextEncoding (current_key_script, | ||
| 10767 | kTextLanguageDontCare, | ||
| 10768 | kTextRegionDontCare, | ||
| 10769 | NULL, &encoding); | ||
| 10770 | err = CreateTextToUnicodeInfoByEncoding (encoding, &ttu_info); | ||
| 10771 | if (err == noErr) | ||
| 10772 | { | ||
| 10773 | UniChar code; | ||
| 10774 | Str255 pstr; | ||
| 10775 | ByteCount unicode_len; | ||
| 10776 | |||
| 10777 | pstr[0] = 1; | ||
| 10778 | pstr[1] = inev.code; | ||
| 10779 | err = ConvertFromPStringToUnicode (ttu_info, pstr, | ||
| 10780 | sizeof (UniChar), | ||
| 10781 | &unicode_len, &code); | ||
| 10782 | if (err == noErr && unicode_len == sizeof (UniChar)) | ||
| 10783 | mac_set_unicode_keystroke_event (code, &inev); | ||
| 10784 | DisposeTextToUnicodeInfo (&ttu_info); | ||
| 10785 | } | ||
| 10786 | } | ||
| 10787 | #endif | ||
| 10788 | } | ||
| 10458 | break; | 10789 | break; |
| 10459 | 10790 | ||
| 10460 | case kHighLevelEvent: | 10791 | case kHighLevelEvent: |
| 10461 | read_socket_inev = &inev; | ||
| 10462 | AEProcessAppleEvent (&er); | 10792 | AEProcessAppleEvent (&er); |
| 10463 | read_socket_inev = NULL; | ||
| 10464 | break; | 10793 | break; |
| 10465 | 10794 | ||
| 10466 | default: | 10795 | default: |
| @@ -10932,6 +11261,16 @@ init_menu_bar () | |||
| 10932 | #endif | 11261 | #endif |
| 10933 | } | 11262 | } |
| 10934 | 11263 | ||
| 11264 | #if USE_MAC_TSM | ||
| 11265 | static void | ||
| 11266 | init_tsm () | ||
| 11267 | { | ||
| 11268 | static InterfaceTypeList types = {kUnicodeDocument}; | ||
| 11269 | |||
| 11270 | NewTSMDocument (sizeof (types) / sizeof (types[0]), types, | ||
| 11271 | &tsm_document_id, 0); | ||
| 11272 | } | ||
| 11273 | #endif | ||
| 10935 | 11274 | ||
| 10936 | /* Set up use of X before we make the first connection. */ | 11275 | /* Set up use of X before we make the first connection. */ |
| 10937 | 11276 | ||
| @@ -11026,6 +11365,10 @@ mac_initialize () | |||
| 11026 | init_command_handler (); | 11365 | init_command_handler (); |
| 11027 | 11366 | ||
| 11028 | init_menu_bar (); | 11367 | init_menu_bar (); |
| 11368 | |||
| 11369 | #if USE_MAC_TSM | ||
| 11370 | init_tsm (); | ||
| 11371 | #endif | ||
| 11029 | #endif /* USE_CARBON_EVENTS */ | 11372 | #endif /* USE_CARBON_EVENTS */ |
| 11030 | 11373 | ||
| 11031 | #ifdef MAC_OSX | 11374 | #ifdef MAC_OSX |
| @@ -11082,6 +11425,13 @@ syms_of_macterm () | |||
| 11082 | Qpaste = intern ("paste"); staticpro (&Qpaste); | 11425 | Qpaste = intern ("paste"); staticpro (&Qpaste); |
| 11083 | Qperform = intern ("perform"); staticpro (&Qperform); | 11426 | Qperform = intern ("perform"); staticpro (&Qperform); |
| 11084 | #endif | 11427 | #endif |
| 11428 | #if USE_MAC_TSM | ||
| 11429 | Qtext_input = intern ("text-input"); staticpro (&Qtext_input); | ||
| 11430 | Qupdate_active_input_area = intern ("update-active-input-area"); | ||
| 11431 | staticpro (&Qupdate_active_input_area); | ||
| 11432 | Qunicode_for_key_event = intern ("unicode-for-key-event"); | ||
| 11433 | staticpro (&Qunicode_for_key_event); | ||
| 11434 | #endif | ||
| 11085 | #endif | 11435 | #endif |
| 11086 | 11436 | ||
| 11087 | #ifdef MAC_OSX | 11437 | #ifdef MAC_OSX |
| @@ -11224,6 +11574,11 @@ order. */); | |||
| 11224 | make_float (DEFAULT_REHASH_THRESHOLD), | 11574 | make_float (DEFAULT_REHASH_THRESHOLD), |
| 11225 | Qnil, Qnil, Qnil); | 11575 | Qnil, Qnil, Qnil); |
| 11226 | #endif | 11576 | #endif |
| 11577 | #if USE_MAC_TSM | ||
| 11578 | DEFVAR_LISP ("mac-ts-active-input-overlay", &Vmac_ts_active_input_overlay, | ||
| 11579 | doc: /* Overlay used to display Mac TSM active input area. */); | ||
| 11580 | Vmac_ts_active_input_overlay = Qnil; | ||
| 11581 | #endif | ||
| 11227 | } | 11582 | } |
| 11228 | 11583 | ||
| 11229 | /* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b | 11584 | /* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b |
diff --git a/src/macterm.h b/src/macterm.h index 8b45777e546..55bf583c214 100644 --- a/src/macterm.h +++ b/src/macterm.h | |||
| @@ -539,6 +539,53 @@ struct scroll_bar { | |||
| 539 | #define HOURGLASS_WIDTH 16 | 539 | #define HOURGLASS_WIDTH 16 |
| 540 | #define HOURGLASS_HEIGHT 16 | 540 | #define HOURGLASS_HEIGHT 16 |
| 541 | 541 | ||
| 542 | /* Some constants that are used locally. */ | ||
| 543 | /* Apple event descriptor types */ | ||
| 544 | enum { | ||
| 545 | TYPE_FILE_NAME = 'fNam' | ||
| 546 | }; | ||
| 547 | |||
| 548 | /* Keywords for Apple event attributes */ | ||
| 549 | enum { | ||
| 550 | KEY_EMACS_SUSPENSION_ID_ATTR = 'esId' /* typeUInt32 */ | ||
| 551 | }; | ||
| 552 | |||
| 553 | /* Carbon event parameter names. */ | ||
| 554 | enum { | ||
| 555 | EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER = 'tsSn' /* typeUInt32 */ | ||
| 556 | }; | ||
| 557 | |||
| 558 | /* Some constants that are not defined in older versions. */ | ||
| 559 | #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 | ||
| 560 | /* Keywords for Apple event attributes */ | ||
| 561 | enum { | ||
| 562 | keyReplyRequestedAttr = 'repq' | ||
| 563 | }; | ||
| 564 | #endif | ||
| 565 | |||
| 566 | #if MAC_OS_X_VERSION_MAX_ALLOWED < 1040 | ||
| 567 | /* Gestalt selectors */ | ||
| 568 | enum { | ||
| 569 | gestaltSystemVersionMajor = 'sys1', | ||
| 570 | gestaltSystemVersionMinor = 'sys2', | ||
| 571 | gestaltSystemVersionBugFix = 'sys3' | ||
| 572 | }; | ||
| 573 | #endif | ||
| 574 | |||
| 575 | #ifdef MAC_OSX | ||
| 576 | #if MAC_OS_X_VERSION_MAX_ALLOWED < 1020 | ||
| 577 | /* Apple event descriptor types */ | ||
| 578 | enum { | ||
| 579 | typeUTF8Text = 'utf8' | ||
| 580 | }; | ||
| 581 | |||
| 582 | /* Carbon event parameter names */ | ||
| 583 | enum { | ||
| 584 | kEventParamWindowMouseLocation = 'wmou' | ||
| 585 | }; | ||
| 586 | #endif | ||
| 587 | #endif | ||
| 588 | |||
| 542 | struct frame; | 589 | struct frame; |
| 543 | struct face; | 590 | struct face; |
| 544 | struct image; | 591 | struct image; |
| @@ -584,6 +631,8 @@ extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int, | |||
| 584 | extern void mac_clear_area P_ ((struct frame *, int, int, | 631 | extern void mac_clear_area P_ ((struct frame *, int, int, |
| 585 | unsigned int, unsigned int)); | 632 | unsigned int, unsigned int)); |
| 586 | extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *)); | 633 | extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *)); |
| 634 | extern int mac_font_panel_visible_p P_ ((void)); | ||
| 635 | extern OSStatus mac_show_hide_font_panel P_ ((void)); | ||
| 587 | extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int)); | 636 | extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int)); |
| 588 | extern OSErr install_window_handler P_ ((WindowPtr)); | 637 | extern OSErr install_window_handler P_ ((WindowPtr)); |
| 589 | extern void remove_window_handler P_ ((WindowPtr)); | 638 | extern void remove_window_handler P_ ((WindowPtr)); |
| @@ -596,8 +645,6 @@ extern void mac_prepare_for_quickdraw P_ ((struct frame *)); | |||
| 596 | #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0 | 645 | #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0 |
| 597 | #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0 | 646 | #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0 |
| 598 | 647 | ||
| 599 | #define TYPE_FILE_NAME 'fNam' | ||
| 600 | |||
| 601 | /* Defined in macselect.c */ | 648 | /* Defined in macselect.c */ |
| 602 | 649 | ||
| 603 | extern void x_clear_frame_selections P_ ((struct frame *)); | 650 | extern void x_clear_frame_selections P_ ((struct frame *)); |
| @@ -615,6 +662,7 @@ extern int x_char_height P_ ((struct frame *)); | |||
| 615 | extern void x_sync P_ ((struct frame *)); | 662 | extern void x_sync P_ ((struct frame *)); |
| 616 | extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 663 | extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
| 617 | extern void mac_update_title_bar P_ ((struct frame *, int)); | 664 | extern void mac_update_title_bar P_ ((struct frame *, int)); |
| 665 | extern Lisp_Object x_get_focus_frame P_ ((struct frame *)); | ||
| 618 | 666 | ||
| 619 | /* Defined in macmenu.c */ | 667 | /* Defined in macmenu.c */ |
| 620 | 668 | ||
| @@ -625,6 +673,7 @@ extern void free_frame_menubar P_ ((struct frame *)); | |||
| 625 | 673 | ||
| 626 | extern void mac_clear_font_name_table P_ ((void)); | 674 | extern void mac_clear_font_name_table P_ ((void)); |
| 627 | extern Lisp_Object mac_aedesc_to_lisp P_ ((const AEDesc *)); | 675 | extern Lisp_Object mac_aedesc_to_lisp P_ ((const AEDesc *)); |
| 676 | extern OSErr mac_ae_put_lisp P_ ((AEDescList *, UInt32, Lisp_Object)); | ||
| 628 | #if TARGET_API_MAC_CARBON | 677 | #if TARGET_API_MAC_CARBON |
| 629 | extern OSErr create_apple_event_from_event_ref P_ ((EventRef, UInt32, | 678 | extern OSErr create_apple_event_from_event_ref P_ ((EventRef, UInt32, |
| 630 | EventParamName *, | 679 | EventParamName *, |
diff --git a/src/minibuf.c b/src/minibuf.c index d37f82c9dcd..c5910b1771f 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -66,6 +66,10 @@ Lisp_Object Qhistory_length, Vhistory_length; | |||
| 66 | 66 | ||
| 67 | int history_delete_duplicates; | 67 | int history_delete_duplicates; |
| 68 | 68 | ||
| 69 | /* Non-nil means add new input to history. */ | ||
| 70 | |||
| 71 | Lisp_Object Vhistory_add_new_input; | ||
| 72 | |||
| 69 | /* Fread_minibuffer leaves the input here as a string. */ | 73 | /* Fread_minibuffer leaves the input here as a string. */ |
| 70 | 74 | ||
| 71 | Lisp_Object last_minibuf_string; | 75 | Lisp_Object last_minibuf_string; |
| @@ -219,7 +223,7 @@ static Lisp_Object read_minibuf P_ ((Lisp_Object, Lisp_Object, | |||
| 219 | Lisp_Object, Lisp_Object, | 223 | Lisp_Object, Lisp_Object, |
| 220 | int, Lisp_Object, | 224 | int, Lisp_Object, |
| 221 | Lisp_Object, Lisp_Object, | 225 | Lisp_Object, Lisp_Object, |
| 222 | int, int, int)); | 226 | int, int)); |
| 223 | static Lisp_Object read_minibuf_noninteractive P_ ((Lisp_Object, Lisp_Object, | 227 | static Lisp_Object read_minibuf_noninteractive P_ ((Lisp_Object, Lisp_Object, |
| 224 | Lisp_Object, Lisp_Object, | 228 | Lisp_Object, Lisp_Object, |
| 225 | int, Lisp_Object, | 229 | int, Lisp_Object, |
| @@ -440,8 +444,7 @@ The current buffer must be a minibuffer. */) | |||
| 440 | 444 | ||
| 441 | static Lisp_Object | 445 | static Lisp_Object |
| 442 | read_minibuf (map, initial, prompt, backup_n, expflag, | 446 | read_minibuf (map, initial, prompt, backup_n, expflag, |
| 443 | histvar, histpos, defalt, allow_props, inherit_input_method, | 447 | histvar, histpos, defalt, allow_props, inherit_input_method) |
| 444 | keep_all) | ||
| 445 | Lisp_Object map; | 448 | Lisp_Object map; |
| 446 | Lisp_Object initial; | 449 | Lisp_Object initial; |
| 447 | Lisp_Object prompt; | 450 | Lisp_Object prompt; |
| @@ -452,7 +455,6 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 452 | Lisp_Object defalt; | 455 | Lisp_Object defalt; |
| 453 | int allow_props; | 456 | int allow_props; |
| 454 | int inherit_input_method; | 457 | int inherit_input_method; |
| 455 | int keep_all; | ||
| 456 | { | 458 | { |
| 457 | Lisp_Object val; | 459 | Lisp_Object val; |
| 458 | int count = SPECPDL_INDEX (); | 460 | int count = SPECPDL_INDEX (); |
| @@ -747,7 +749,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 747 | last_minibuf_string = val; | 749 | last_minibuf_string = val; |
| 748 | 750 | ||
| 749 | /* Choose the string to add to the history. */ | 751 | /* Choose the string to add to the history. */ |
| 750 | if (SCHARS (val) != 0 || keep_all) | 752 | if (SCHARS (val) != 0) |
| 751 | histstring = val; | 753 | histstring = val; |
| 752 | else if (STRINGP (defalt)) | 754 | else if (STRINGP (defalt)) |
| 753 | histstring = defalt; | 755 | histstring = defalt; |
| @@ -755,7 +757,8 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 755 | histstring = Qnil; | 757 | histstring = Qnil; |
| 756 | 758 | ||
| 757 | /* Add the value to the appropriate history list, if any. */ | 759 | /* Add the value to the appropriate history list, if any. */ |
| 758 | if (SYMBOLP (Vminibuffer_history_variable) | 760 | if (!NILP (Vhistory_add_new_input) |
| 761 | && SYMBOLP (Vminibuffer_history_variable) | ||
| 759 | && !NILP (histstring)) | 762 | && !NILP (histstring)) |
| 760 | { | 763 | { |
| 761 | /* If the caller wanted to save the value read on a history list, | 764 | /* If the caller wanted to save the value read on a history list, |
| @@ -774,8 +777,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 774 | if (NILP (histval) | 777 | if (NILP (histval) |
| 775 | || (CONSP (histval) | 778 | || (CONSP (histval) |
| 776 | /* Don't duplicate the most recent entry in the history. */ | 779 | /* Don't duplicate the most recent entry in the history. */ |
| 777 | && (keep_all | 780 | && (NILP (Fequal (histstring, Fcar (histval)))))) |
| 778 | || NILP (Fequal (histstring, Fcar (histval)))))) | ||
| 779 | { | 781 | { |
| 780 | Lisp_Object length; | 782 | Lisp_Object length; |
| 781 | 783 | ||
| @@ -937,7 +939,7 @@ read_minibuf_unwind (data) | |||
| 937 | } | 939 | } |
| 938 | 940 | ||
| 939 | 941 | ||
| 940 | DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 8, 0, | 942 | DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 7, 0, |
| 941 | doc: /* Read a string from the minibuffer, prompting with string PROMPT. | 943 | doc: /* Read a string from the minibuffer, prompting with string PROMPT. |
| 942 | The optional second arg INITIAL-CONTENTS is an obsolete alternative to | 944 | The optional second arg INITIAL-CONTENTS is an obsolete alternative to |
| 943 | DEFAULT-VALUE. It normally should be nil in new code, except when | 945 | DEFAULT-VALUE. It normally should be nil in new code, except when |
| @@ -961,8 +963,6 @@ Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is available | |||
| 961 | the empty string. | 963 | the empty string. |
| 962 | Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits | 964 | Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits |
| 963 | the current input method and the setting of `enable-multibyte-characters'. | 965 | the current input method and the setting of `enable-multibyte-characters'. |
| 964 | Eight arg KEEP-ALL, if non-nil, says to put all inputs in the history list, | ||
| 965 | even empty or duplicate inputs. | ||
| 966 | If the variable `minibuffer-allow-text-properties' is non-nil, | 966 | If the variable `minibuffer-allow-text-properties' is non-nil, |
| 967 | then the string which is returned includes whatever text properties | 967 | then the string which is returned includes whatever text properties |
| 968 | were present in the minibuffer. Otherwise the value has no text properties. | 968 | were present in the minibuffer. Otherwise the value has no text properties. |
| @@ -978,9 +978,9 @@ POSITION in the minibuffer. Any integer value less than or equal to | |||
| 978 | one puts point at the beginning of the string. *Note* that this | 978 | one puts point at the beginning of the string. *Note* that this |
| 979 | behavior differs from the way such arguments are used in `completing-read' | 979 | behavior differs from the way such arguments are used in `completing-read' |
| 980 | and some related functions, which use zero-indexing for POSITION. */) | 980 | and some related functions, which use zero-indexing for POSITION. */) |
| 981 | (prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method, keep_all) | 981 | (prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method) |
| 982 | Lisp_Object prompt, initial_contents, keymap, read, hist, default_value; | 982 | Lisp_Object prompt, initial_contents, keymap, read, hist, default_value; |
| 983 | Lisp_Object inherit_input_method, keep_all; | 983 | Lisp_Object inherit_input_method; |
| 984 | { | 984 | { |
| 985 | Lisp_Object histvar, histpos, val; | 985 | Lisp_Object histvar, histpos, val; |
| 986 | struct gcpro gcpro1; | 986 | struct gcpro gcpro1; |
| @@ -1011,8 +1011,7 @@ and some related functions, which use zero-indexing for POSITION. */) | |||
| 1011 | Qnil, !NILP (read), | 1011 | Qnil, !NILP (read), |
| 1012 | histvar, histpos, default_value, | 1012 | histvar, histpos, default_value, |
| 1013 | minibuffer_allow_text_properties, | 1013 | minibuffer_allow_text_properties, |
| 1014 | !NILP (inherit_input_method), | 1014 | !NILP (inherit_input_method)); |
| 1015 | !NILP (keep_all)); | ||
| 1016 | UNGCPRO; | 1015 | UNGCPRO; |
| 1017 | return val; | 1016 | return val; |
| 1018 | } | 1017 | } |
| @@ -1029,7 +1028,7 @@ arguments are used as in `read-from-minibuffer') */) | |||
| 1029 | CHECK_STRING (prompt); | 1028 | CHECK_STRING (prompt); |
| 1030 | return read_minibuf (Vminibuffer_local_map, initial_contents, | 1029 | return read_minibuf (Vminibuffer_local_map, initial_contents, |
| 1031 | prompt, Qnil, 1, Qminibuffer_history, | 1030 | prompt, Qnil, 1, Qminibuffer_history, |
| 1032 | make_number (0), Qnil, 0, 0, 0); | 1031 | make_number (0), Qnil, 0, 0); |
| 1033 | } | 1032 | } |
| 1034 | 1033 | ||
| 1035 | DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0, | 1034 | DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0, |
| @@ -1067,7 +1066,7 @@ Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits | |||
| 1067 | Lisp_Object val; | 1066 | Lisp_Object val; |
| 1068 | val = Fread_from_minibuffer (prompt, initial_input, Qnil, | 1067 | val = Fread_from_minibuffer (prompt, initial_input, Qnil, |
| 1069 | Qnil, history, default_value, | 1068 | Qnil, history, default_value, |
| 1070 | inherit_input_method, Qnil); | 1069 | inherit_input_method); |
| 1071 | if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value)) | 1070 | if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value)) |
| 1072 | val = default_value; | 1071 | val = default_value; |
| 1073 | return val; | 1072 | return val; |
| @@ -1089,7 +1088,7 @@ the current input method and the setting of`enable-multibyte-characters'. */) | |||
| 1089 | CHECK_STRING (prompt); | 1088 | CHECK_STRING (prompt); |
| 1090 | return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, Qnil, | 1089 | return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, Qnil, |
| 1091 | 0, Qminibuffer_history, make_number (0), Qnil, 0, | 1090 | 0, Qminibuffer_history, make_number (0), Qnil, 0, |
| 1092 | !NILP (inherit_input_method), 0); | 1091 | !NILP (inherit_input_method)); |
| 1093 | } | 1092 | } |
| 1094 | 1093 | ||
| 1095 | DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0, | 1094 | DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0, |
| @@ -1778,7 +1777,7 @@ Completion ignores case if the ambient value of | |||
| 1778 | : Vminibuffer_local_must_match_filename_map), | 1777 | : Vminibuffer_local_must_match_filename_map), |
| 1779 | init, prompt, make_number (pos), 0, | 1778 | init, prompt, make_number (pos), 0, |
| 1780 | histvar, histpos, def, 0, | 1779 | histvar, histpos, def, 0, |
| 1781 | !NILP (inherit_input_method), 0); | 1780 | !NILP (inherit_input_method)); |
| 1782 | 1781 | ||
| 1783 | if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def)) | 1782 | if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def)) |
| 1784 | val = def; | 1783 | val = def; |
| @@ -2797,9 +2796,16 @@ property of a history variable overrides this default. */); | |||
| 2797 | DEFVAR_BOOL ("history-delete-duplicates", &history_delete_duplicates, | 2796 | DEFVAR_BOOL ("history-delete-duplicates", &history_delete_duplicates, |
| 2798 | doc: /* *Non-nil means to delete duplicates in history. | 2797 | doc: /* *Non-nil means to delete duplicates in history. |
| 2799 | If set to t when adding a new history element, all previous identical | 2798 | If set to t when adding a new history element, all previous identical |
| 2800 | elements are deleted. */); | 2799 | elements are deleted from the history list. */); |
| 2801 | history_delete_duplicates = 0; | 2800 | history_delete_duplicates = 0; |
| 2802 | 2801 | ||
| 2802 | DEFVAR_LISP ("history-add-new-input", &Vhistory_add_new_input, | ||
| 2803 | doc: /* *Non-nil means to add new elements in history. | ||
| 2804 | If set to nil, minibuffer reading functions don't add new elements to the | ||
| 2805 | history list, so it is possible to do this afterwards by calling | ||
| 2806 | `add-to-history' explicitly. */); | ||
| 2807 | Vhistory_add_new_input = Qt; | ||
| 2808 | |||
| 2803 | DEFVAR_LISP ("completion-auto-help", &Vcompletion_auto_help, | 2809 | DEFVAR_LISP ("completion-auto-help", &Vcompletion_auto_help, |
| 2804 | doc: /* *Non-nil means automatically provide help for invalid completion input. | 2810 | doc: /* *Non-nil means automatically provide help for invalid completion input. |
| 2805 | Under Partial Completion mode, a non-nil, non-t value has a special meaning; | 2811 | 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 1960e6a914c..2281f1ce3f6 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -777,6 +777,16 @@ get_process (name) | |||
| 777 | return proc; | 777 | return proc; |
| 778 | } | 778 | } |
| 779 | 779 | ||
| 780 | |||
| 781 | #ifdef SIGCHLD | ||
| 782 | /* Fdelete_process promises to immediately forget about the process, but in | ||
| 783 | reality, Emacs needs to remember those processes until they have been | ||
| 784 | treated by sigchld_handler; otherwise this handler would consider the | ||
| 785 | process as being synchronous and say that the synchronous process is | ||
| 786 | dead. */ | ||
| 787 | static Lisp_Object deleted_pid_list; | ||
| 788 | #endif | ||
| 789 | |||
| 780 | DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, | 790 | DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, |
| 781 | doc: /* Delete PROCESS: kill it and forget about it immediately. | 791 | doc: /* Delete PROCESS: kill it and forget about it immediately. |
| 782 | PROCESS may be a process, a buffer, the name of a process or buffer, or | 792 | PROCESS may be a process, a buffer, the name of a process or buffer, or |
| @@ -798,12 +808,31 @@ nil, indicating the current buffer's process. */) | |||
| 798 | } | 808 | } |
| 799 | else if (XINT (p->infd) >= 0) | 809 | else if (XINT (p->infd) >= 0) |
| 800 | { | 810 | { |
| 801 | Fkill_process (process, Qnil); | 811 | #ifdef SIGCHLD |
| 802 | /* Do this now, since remove_process will make sigchld_handler do nothing. */ | 812 | Lisp_Object symbol; |
| 803 | p->status | 813 | |
| 804 | = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); | 814 | /* No problem storing the pid here, as it is still in Vprocess_alist. */ |
| 805 | XSETINT (p->tick, ++process_tick); | 815 | deleted_pid_list = Fcons (make_fixnum_or_float (p->pid), |
| 806 | status_notify (p); | 816 | /* GC treated elements set to nil. */ |
| 817 | Fdelq (Qnil, deleted_pid_list)); | ||
| 818 | /* If the process has already signaled, remove it from the list. */ | ||
| 819 | if (p->raw_status_new) | ||
| 820 | update_status (p); | ||
| 821 | symbol = p->status; | ||
| 822 | if (CONSP (p->status)) | ||
| 823 | symbol = XCAR (p->status); | ||
| 824 | if (EQ (symbol, Qsignal) || EQ (symbol, Qexit)) | ||
| 825 | Fdelete (make_fixnum_or_float (p->pid), deleted_pid_list); | ||
| 826 | else | ||
| 827 | #endif | ||
| 828 | { | ||
| 829 | Fkill_process (process, Qnil); | ||
| 830 | /* Do this now, since remove_process will make sigchld_handler do nothing. */ | ||
| 831 | p->status | ||
| 832 | = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); | ||
| 833 | XSETINT (p->tick, ++process_tick); | ||
| 834 | status_notify (p); | ||
| 835 | } | ||
| 807 | } | 836 | } |
| 808 | remove_process (process); | 837 | remove_process (process); |
| 809 | return Qnil; | 838 | return Qnil; |
| @@ -4134,6 +4163,25 @@ wait_reading_process_output_1 () | |||
| 4134 | { | 4163 | { |
| 4135 | } | 4164 | } |
| 4136 | 4165 | ||
| 4166 | /* Use a wrapper around select to work around a bug in gdb 5.3. | ||
| 4167 | Normally, the wrapper is optimzed away by inlining. | ||
| 4168 | |||
| 4169 | If emacs is stopped inside select, the gdb backtrace doesn't | ||
| 4170 | show the function which called select, so it is practically | ||
| 4171 | impossible to step through wait_reading_process_output. */ | ||
| 4172 | |||
| 4173 | #ifndef select | ||
| 4174 | static INLINE int | ||
| 4175 | select_wrapper (n, rfd, wfd, xfd, tmo) | ||
| 4176 | int n; | ||
| 4177 | SELECT_TYPE *rfd, *wfd, *xfd; | ||
| 4178 | EMACS_TIME *tmo; | ||
| 4179 | { | ||
| 4180 | return select (n, rfd, wfd, xfd, tmo); | ||
| 4181 | } | ||
| 4182 | #define select select_wrapper | ||
| 4183 | #endif | ||
| 4184 | |||
| 4137 | /* Read and dispose of subprocess output while waiting for timeout to | 4185 | /* Read and dispose of subprocess output while waiting for timeout to |
| 4138 | elapse and/or keyboard input to be available. | 4186 | elapse and/or keyboard input to be available. |
| 4139 | 4187 | ||
| @@ -6304,6 +6352,7 @@ kill_buffer_processes (buffer) | |||
| 6304 | ** Malloc WARNING: This should never call malloc either directly or | 6352 | ** Malloc WARNING: This should never call malloc either directly or |
| 6305 | indirectly; if it does, that is a bug */ | 6353 | indirectly; if it does, that is a bug */ |
| 6306 | 6354 | ||
| 6355 | #ifdef SIGCHLD | ||
| 6307 | SIGTYPE | 6356 | SIGTYPE |
| 6308 | sigchld_handler (signo) | 6357 | sigchld_handler (signo) |
| 6309 | int signo; | 6358 | int signo; |
| @@ -6361,6 +6410,15 @@ sigchld_handler (signo) | |||
| 6361 | 6410 | ||
| 6362 | /* Find the process that signaled us, and record its status. */ | 6411 | /* Find the process that signaled us, and record its status. */ |
| 6363 | 6412 | ||
| 6413 | /* The process can have been deleted by Fdelete_process. */ | ||
| 6414 | tail = Fmember (make_fixnum_or_float (pid), deleted_pid_list); | ||
| 6415 | if (!NILP (tail)) | ||
| 6416 | { | ||
| 6417 | Fsetcar (tail, Qnil); | ||
| 6418 | goto sigchld_end_of_loop; | ||
| 6419 | } | ||
| 6420 | |||
| 6421 | /* Otherwise, if it is asynchronous, it is in Vprocess_alist. */ | ||
| 6364 | p = 0; | 6422 | p = 0; |
| 6365 | for (tail = Vprocess_alist; GC_CONSP (tail); tail = XCDR (tail)) | 6423 | for (tail = Vprocess_alist; GC_CONSP (tail); tail = XCDR (tail)) |
| 6366 | { | 6424 | { |
| @@ -6412,8 +6470,8 @@ sigchld_handler (signo) | |||
| 6412 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | 6470 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); |
| 6413 | } | 6471 | } |
| 6414 | 6472 | ||
| 6415 | /* There was no asynchronous process found for that id. Check | 6473 | /* There was no asynchronous process found for that pid: we have |
| 6416 | if we have a synchronous process. */ | 6474 | a synchronous process. */ |
| 6417 | else | 6475 | else |
| 6418 | { | 6476 | { |
| 6419 | synch_process_alive = 0; | 6477 | synch_process_alive = 0; |
| @@ -6430,6 +6488,9 @@ sigchld_handler (signo) | |||
| 6430 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | 6488 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); |
| 6431 | } | 6489 | } |
| 6432 | 6490 | ||
| 6491 | sigchld_end_of_loop: | ||
| 6492 | ; | ||
| 6493 | |||
| 6433 | /* On some systems, we must return right away. | 6494 | /* On some systems, we must return right away. |
| 6434 | If any more processes want to signal us, we will | 6495 | If any more processes want to signal us, we will |
| 6435 | get another signal. | 6496 | get another signal. |
| @@ -6446,6 +6507,7 @@ sigchld_handler (signo) | |||
| 6446 | #endif /* USG, but not HPUX with WNOHANG */ | 6507 | #endif /* USG, but not HPUX with WNOHANG */ |
| 6447 | } | 6508 | } |
| 6448 | } | 6509 | } |
| 6510 | #endif /* SIGCHLD */ | ||
| 6449 | 6511 | ||
| 6450 | 6512 | ||
| 6451 | static Lisp_Object | 6513 | static Lisp_Object |
| @@ -6831,6 +6893,9 @@ init_process () | |||
| 6831 | FD_SET (0, &input_wait_mask); | 6893 | FD_SET (0, &input_wait_mask); |
| 6832 | 6894 | ||
| 6833 | Vprocess_alist = Qnil; | 6895 | Vprocess_alist = Qnil; |
| 6896 | #ifdef SIGCHLD | ||
| 6897 | deleted_pid_list = Qnil; | ||
| 6898 | #endif | ||
| 6834 | for (i = 0; i < MAXDESC; i++) | 6899 | for (i = 0; i < MAXDESC; i++) |
| 6835 | { | 6900 | { |
| 6836 | chan_process[i] = Qnil; | 6901 | chan_process[i] = Qnil; |
| @@ -6969,6 +7034,9 @@ syms_of_process () | |||
| 6969 | staticpro (&Qlast_nonmenu_event); | 7034 | staticpro (&Qlast_nonmenu_event); |
| 6970 | 7035 | ||
| 6971 | staticpro (&Vprocess_alist); | 7036 | staticpro (&Vprocess_alist); |
| 7037 | #ifdef SIGCHLD | ||
| 7038 | staticpro (&deleted_pid_list); | ||
| 7039 | #endif | ||
| 6972 | 7040 | ||
| 6973 | DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, | 7041 | DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, |
| 6974 | doc: /* *Non-nil means delete processes immediately when they exit. | 7042 | doc: /* *Non-nil means delete processes immediately when they exit. |
diff --git a/src/puresize.h b/src/puresize.h index 1288feff151..67e758ae799 100644 --- a/src/puresize.h +++ b/src/puresize.h | |||
| @@ -43,7 +43,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 43 | #endif | 43 | #endif |
| 44 | 44 | ||
| 45 | #ifndef BASE_PURESIZE | 45 | #ifndef BASE_PURESIZE |
| 46 | #define BASE_PURESIZE (1205000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) | 46 | #define BASE_PURESIZE (1210000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) |
| 47 | #endif | 47 | #endif |
| 48 | 48 | ||
| 49 | /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ | 49 | /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ |
diff --git a/src/search.c b/src/search.c index f613630eaf9..15cc51cb511 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 0fbeceb4b9e..af2369040cc 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -73,6 +73,10 @@ Boston, MA 02110-1301, USA. */ | |||
| 73 | #ifdef HAVE_SOUNDCARD_H | 73 | #ifdef HAVE_SOUNDCARD_H |
| 74 | #include <soundcard.h> | 74 | #include <soundcard.h> |
| 75 | #endif | 75 | #endif |
| 76 | #ifdef HAVE_ALSA | ||
| 77 | #include <asoundlib.h> | ||
| 78 | #endif | ||
| 79 | |||
| 76 | /* END: Non Windows Includes */ | 80 | /* END: Non Windows Includes */ |
| 77 | 81 | ||
| 78 | #else /* WINDOWSNT */ | 82 | #else /* WINDOWSNT */ |
| @@ -109,7 +113,8 @@ enum sound_attr | |||
| 109 | SOUND_ATTR_SENTINEL | 113 | SOUND_ATTR_SENTINEL |
| 110 | }; | 114 | }; |
| 111 | 115 | ||
| 112 | 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; | ||
| 113 | static void sound_warning P_ ((char *)); | 118 | static void sound_warning P_ ((char *)); |
| 114 | static int parse_sound P_ ((Lisp_Object, Lisp_Object *)); | 119 | static int parse_sound P_ ((Lisp_Object, Lisp_Object *)); |
| 115 | 120 | ||
| @@ -121,6 +126,9 @@ static int parse_sound P_ ((Lisp_Object, Lisp_Object *)); | |||
| 121 | #ifndef DEFAULT_SOUND_DEVICE | 126 | #ifndef DEFAULT_SOUND_DEVICE |
| 122 | #define DEFAULT_SOUND_DEVICE "/dev/dsp" | 127 | #define DEFAULT_SOUND_DEVICE "/dev/dsp" |
| 123 | #endif | 128 | #endif |
| 129 | #ifndef DEFAULT_ALSA_SOUND_DEVICE | ||
| 130 | #define DEFAULT_ALSA_SOUND_DEVICE "default" | ||
| 131 | #endif | ||
| 124 | 132 | ||
| 125 | 133 | ||
| 126 | /* Structure forward declarations. */ | 134 | /* Structure forward declarations. */ |
| @@ -227,6 +235,10 @@ struct sound_device | |||
| 227 | void (* choose_format) P_ ((struct sound_device *sd, | 235 | void (* choose_format) P_ ((struct sound_device *sd, |
| 228 | struct sound *s)); | 236 | struct sound *s)); |
| 229 | 237 | ||
| 238 | /* Return a preferred data size in bytes to be sent to write (below) | ||
| 239 | each time. 2048 is used if this is NULL. */ | ||
| 240 | int (* period_size) P_ ((struct sound_device *sd)); | ||
| 241 | |||
| 230 | /* Write NYBTES bytes from BUFFER to device SD. */ | 242 | /* Write NYBTES bytes from BUFFER to device SD. */ |
| 231 | void (* write) P_ ((struct sound_device *sd, const char *buffer, | 243 | void (* write) P_ ((struct sound_device *sd, const char *buffer, |
| 232 | int nbytes)); | 244 | int nbytes)); |
| @@ -280,7 +292,7 @@ static void vox_open P_ ((struct sound_device *)); | |||
| 280 | static void vox_configure P_ ((struct sound_device *)); | 292 | static void vox_configure P_ ((struct sound_device *)); |
| 281 | static void vox_close P_ ((struct sound_device *sd)); | 293 | static void vox_close P_ ((struct sound_device *sd)); |
| 282 | static void vox_choose_format P_ ((struct sound_device *, struct sound *)); | 294 | static void vox_choose_format P_ ((struct sound_device *, struct sound *)); |
| 283 | static void vox_init P_ ((struct sound_device *)); | 295 | static int vox_init P_ ((struct sound_device *)); |
| 284 | static void vox_write P_ ((struct sound_device *, const char *, int)); | 296 | static void vox_write P_ ((struct sound_device *, const char *, int)); |
| 285 | static void find_sound_type P_ ((struct sound *)); | 297 | static void find_sound_type P_ ((struct sound *)); |
| 286 | static u_int32_t le2hl P_ ((u_int32_t)); | 298 | static u_int32_t le2hl P_ ((u_int32_t)); |
| @@ -604,7 +616,7 @@ wav_play (s, sd) | |||
| 604 | { | 616 | { |
| 605 | char *buffer; | 617 | char *buffer; |
| 606 | int nbytes; | 618 | int nbytes; |
| 607 | int blksize = 2048; | 619 | int blksize = sd->period_size ? sd->period_size (sd) : 2048; |
| 608 | 620 | ||
| 609 | buffer = (char *) alloca (blksize); | 621 | buffer = (char *) alloca (blksize); |
| 610 | lseek (s->fd, sizeof *header, SEEK_SET); | 622 | lseek (s->fd, sizeof *header, SEEK_SET); |
| @@ -633,7 +645,8 @@ enum au_encoding | |||
| 633 | AU_ENCODING_32, | 645 | AU_ENCODING_32, |
| 634 | AU_ENCODING_IEEE32, | 646 | AU_ENCODING_IEEE32, |
| 635 | AU_ENCODING_IEEE64, | 647 | AU_ENCODING_IEEE64, |
| 636 | AU_COMPRESSED = 23 | 648 | AU_COMPRESSED = 23, |
| 649 | AU_ENCODING_ALAW_8 = 27 | ||
| 637 | }; | 650 | }; |
| 638 | 651 | ||
| 639 | 652 | ||
| @@ -689,7 +702,7 @@ au_play (s, sd) | |||
| 689 | SBYTES (s->data) - header->data_offset); | 702 | SBYTES (s->data) - header->data_offset); |
| 690 | else | 703 | else |
| 691 | { | 704 | { |
| 692 | int blksize = 2048; | 705 | int blksize = sd->period_size ? sd->period_size (sd) : 2048; |
| 693 | char *buffer; | 706 | char *buffer; |
| 694 | int nbytes; | 707 | int nbytes; |
| 695 | 708 | ||
| @@ -868,16 +881,33 @@ vox_choose_format (sd, s) | |||
| 868 | /* Initialize device SD. Set up the interface functions in the device | 881 | /* Initialize device SD. Set up the interface functions in the device |
| 869 | structure. */ | 882 | structure. */ |
| 870 | 883 | ||
| 871 | static void | 884 | static int |
| 872 | vox_init (sd) | 885 | vox_init (sd) |
| 873 | struct sound_device *sd; | 886 | struct sound_device *sd; |
| 874 | { | 887 | { |
| 888 | char *file; | ||
| 889 | int fd; | ||
| 890 | |||
| 891 | /* Open the sound device. Default is /dev/dsp. */ | ||
| 892 | if (sd->file) | ||
| 893 | file = sd->file; | ||
| 894 | else | ||
| 895 | file = DEFAULT_SOUND_DEVICE; | ||
| 896 | fd = emacs_open (file, O_WRONLY, 0); | ||
| 897 | if (fd >= 0) | ||
| 898 | emacs_close (fd); | ||
| 899 | else | ||
| 900 | return 0; | ||
| 901 | |||
| 875 | sd->fd = -1; | 902 | sd->fd = -1; |
| 876 | sd->open = vox_open; | 903 | sd->open = vox_open; |
| 877 | sd->close = vox_close; | 904 | sd->close = vox_close; |
| 878 | sd->configure = vox_configure; | 905 | sd->configure = vox_configure; |
| 879 | sd->choose_format = vox_choose_format; | 906 | sd->choose_format = vox_choose_format; |
| 880 | sd->write = vox_write; | 907 | sd->write = vox_write; |
| 908 | sd->period_size = NULL; | ||
| 909 | |||
| 910 | return 1; | ||
| 881 | } | 911 | } |
| 882 | 912 | ||
| 883 | /* Write NBYTES bytes from BUFFER to device SD. */ | 913 | /* Write NBYTES bytes from BUFFER to device SD. */ |
| @@ -893,6 +923,368 @@ vox_write (sd, buffer, nbytes) | |||
| 893 | sound_perror ("Error writing to sound device"); | 923 | sound_perror ("Error writing to sound device"); |
| 894 | } | 924 | } |
| 895 | 925 | ||
| 926 | #ifdef HAVE_ALSA | ||
| 927 | /*********************************************************************** | ||
| 928 | ALSA Driver Interface | ||
| 929 | ***********************************************************************/ | ||
| 930 | |||
| 931 | /* This driver is available on GNU/Linux. */ | ||
| 932 | |||
| 933 | static void | ||
| 934 | alsa_sound_perror (msg, err) | ||
| 935 | char *msg; | ||
| 936 | int err; | ||
| 937 | { | ||
| 938 | error ("%s: %s", msg, snd_strerror (err)); | ||
| 939 | } | ||
| 940 | |||
| 941 | struct alsa_params | ||
| 942 | { | ||
| 943 | snd_pcm_t *handle; | ||
| 944 | snd_pcm_hw_params_t *hwparams; | ||
| 945 | snd_pcm_sw_params_t *swparams; | ||
| 946 | snd_pcm_uframes_t period_size; | ||
| 947 | }; | ||
| 948 | |||
| 949 | /* Open device SD. If SD->file is non-null, open that device, | ||
| 950 | otherwise use a default device name. */ | ||
| 951 | |||
| 952 | static void | ||
| 953 | alsa_open (sd) | ||
| 954 | struct sound_device *sd; | ||
| 955 | { | ||
| 956 | char *file; | ||
| 957 | struct alsa_params *p; | ||
| 958 | int err; | ||
| 959 | |||
| 960 | /* Open the sound device. Default is "default". */ | ||
| 961 | if (sd->file) | ||
| 962 | file = sd->file; | ||
| 963 | else | ||
| 964 | file = DEFAULT_ALSA_SOUND_DEVICE; | ||
| 965 | |||
| 966 | p = xmalloc (sizeof (*p)); | ||
| 967 | p->handle = NULL; | ||
| 968 | p->hwparams = NULL; | ||
| 969 | p->swparams = NULL; | ||
| 970 | |||
| 971 | sd->fd = -1; | ||
| 972 | sd->data = p; | ||
| 973 | |||
| 974 | |||
| 975 | err = snd_pcm_open (&p->handle, file, SND_PCM_STREAM_PLAYBACK, 0); | ||
| 976 | if (err < 0) | ||
| 977 | alsa_sound_perror (file, err); | ||
| 978 | } | ||
| 979 | |||
| 980 | static int | ||
| 981 | alsa_period_size (sd) | ||
| 982 | struct sound_device *sd; | ||
| 983 | { | ||
| 984 | struct alsa_params *p = (struct alsa_params *) sd->data; | ||
| 985 | return p->period_size; | ||
| 986 | } | ||
| 987 | |||
| 988 | static void | ||
| 989 | alsa_configure (sd) | ||
| 990 | struct sound_device *sd; | ||
| 991 | { | ||
| 992 | int val, err, dir; | ||
| 993 | struct alsa_params *p = (struct alsa_params *) sd->data; | ||
| 994 | snd_pcm_uframes_t buffer_size; | ||
| 995 | |||
| 996 | xassert (p->handle != 0); | ||
| 997 | |||
| 998 | err = snd_pcm_hw_params_malloc (&p->hwparams); | ||
| 999 | if (err < 0) | ||
| 1000 | alsa_sound_perror ("Could not allocate hardware parameter structure", err); | ||
| 1001 | |||
| 1002 | err = snd_pcm_sw_params_malloc (&p->swparams); | ||
| 1003 | if (err < 0) | ||
| 1004 | alsa_sound_perror ("Could not allocate software parameter structure", err); | ||
| 1005 | |||
| 1006 | err = snd_pcm_hw_params_any (p->handle, p->hwparams); | ||
| 1007 | if (err < 0) | ||
| 1008 | alsa_sound_perror ("Could not initialize hardware parameter structure", err); | ||
| 1009 | |||
| 1010 | err = snd_pcm_hw_params_set_access (p->handle, p->hwparams, | ||
| 1011 | SND_PCM_ACCESS_RW_INTERLEAVED); | ||
| 1012 | if (err < 0) | ||
| 1013 | alsa_sound_perror ("Could not set access type", err); | ||
| 1014 | |||
| 1015 | val = sd->format; | ||
| 1016 | err = snd_pcm_hw_params_set_format (p->handle, p->hwparams, val); | ||
| 1017 | if (err < 0) | ||
| 1018 | alsa_sound_perror ("Could not set sound format", err); | ||
| 1019 | |||
| 1020 | val = sd->sample_rate; | ||
| 1021 | err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &val, 0); | ||
| 1022 | if (err < 0) | ||
| 1023 | alsa_sound_perror ("Could not set sample rate", err); | ||
| 1024 | |||
| 1025 | val = sd->channels; | ||
| 1026 | err = snd_pcm_hw_params_set_channels (p->handle, p->hwparams, val); | ||
| 1027 | if (err < 0) | ||
| 1028 | alsa_sound_perror ("Could not set channel count", err); | ||
| 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 | |||
| 1034 | |||
| 1035 | err = snd_pcm_hw_params_get_period_size (p->hwparams, &p->period_size, &dir); | ||
| 1036 | if (err < 0) | ||
| 1037 | alsa_sound_perror ("Unable to get period size for playback", err); | ||
| 1038 | |||
| 1039 | err = snd_pcm_hw_params_get_buffer_size (p->hwparams, &buffer_size); | ||
| 1040 | if (err < 0) | ||
| 1041 | alsa_sound_perror("Unable to get buffer size for playback", err); | ||
| 1042 | |||
| 1043 | err = snd_pcm_sw_params_current (p->handle, p->swparams); | ||
| 1044 | if (err < 0) | ||
| 1045 | alsa_sound_perror ("Unable to determine current swparams for playback", | ||
| 1046 | err); | ||
| 1047 | |||
| 1048 | /* Start the transfer when the buffer is almost full */ | ||
| 1049 | err = snd_pcm_sw_params_set_start_threshold (p->handle, p->swparams, | ||
| 1050 | (buffer_size / p->period_size) | ||
| 1051 | * p->period_size); | ||
| 1052 | if (err < 0) | ||
| 1053 | alsa_sound_perror ("Unable to set start threshold mode for playback", err); | ||
| 1054 | |||
| 1055 | /* Allow the transfer when at least period_size samples can be processed */ | ||
| 1056 | err = snd_pcm_sw_params_set_avail_min (p->handle, p->swparams, p->period_size); | ||
| 1057 | if (err < 0) | ||
| 1058 | alsa_sound_perror ("Unable to set avail min for playback", err); | ||
| 1059 | |||
| 1060 | /* Align all transfers to 1 period */ | ||
| 1061 | err = snd_pcm_sw_params_set_xfer_align (p->handle, p->swparams, | ||
| 1062 | p->period_size); | ||
| 1063 | if (err < 0) | ||
| 1064 | alsa_sound_perror ("Unable to set transfer align for playback", err); | ||
| 1065 | |||
| 1066 | err = snd_pcm_sw_params (p->handle, p->swparams); | ||
| 1067 | if (err < 0) | ||
| 1068 | alsa_sound_perror ("Unable to set sw params for playback\n", err); | ||
| 1069 | |||
| 1070 | snd_pcm_hw_params_free (p->hwparams); | ||
| 1071 | p->hwparams = NULL; | ||
| 1072 | snd_pcm_sw_params_free (p->swparams); | ||
| 1073 | p->swparams = NULL; | ||
| 1074 | |||
| 1075 | err = snd_pcm_prepare (p->handle); | ||
| 1076 | if (err < 0) | ||
| 1077 | alsa_sound_perror ("Could not prepare audio interface for use", err); | ||
| 1078 | |||
| 1079 | if (sd->volume > 0) | ||
| 1080 | { | ||
| 1081 | int chn; | ||
| 1082 | snd_mixer_t *handle; | ||
| 1083 | snd_mixer_elem_t *e; | ||
| 1084 | char *file = sd->file ? sd->file : DEFAULT_ALSA_SOUND_DEVICE; | ||
| 1085 | |||
| 1086 | if (snd_mixer_open (&handle, 0) >= 0) | ||
| 1087 | { | ||
| 1088 | if (snd_mixer_attach (handle, file) >= 0 | ||
| 1089 | && snd_mixer_load (handle) >= 0 | ||
| 1090 | && snd_mixer_selem_register (handle, NULL, NULL) >= 0) | ||
| 1091 | for (e = snd_mixer_first_elem (handle); | ||
| 1092 | e; | ||
| 1093 | e = snd_mixer_elem_next (e)) | ||
| 1094 | { | ||
| 1095 | if (snd_mixer_selem_has_playback_volume (e)) | ||
| 1096 | { | ||
| 1097 | long pmin, pmax; | ||
| 1098 | snd_mixer_selem_get_playback_volume_range (e, &pmin, &pmax); | ||
| 1099 | long vol = pmin + (sd->volume * (pmax - pmin)) / 100; | ||
| 1100 | |||
| 1101 | for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++) | ||
| 1102 | snd_mixer_selem_set_playback_volume (e, chn, vol); | ||
| 1103 | } | ||
| 1104 | } | ||
| 1105 | snd_mixer_close(handle); | ||
| 1106 | } | ||
| 1107 | } | ||
| 1108 | } | ||
| 1109 | |||
| 1110 | |||
| 1111 | /* Close device SD if it is open. */ | ||
| 1112 | |||
| 1113 | static void | ||
| 1114 | alsa_close (sd) | ||
| 1115 | struct sound_device *sd; | ||
| 1116 | { | ||
| 1117 | struct alsa_params *p = (struct alsa_params *) sd->data; | ||
| 1118 | if (p) | ||
| 1119 | { | ||
| 1120 | if (p->hwparams) | ||
| 1121 | snd_pcm_hw_params_free (p->hwparams); | ||
| 1122 | if (p->swparams) | ||
| 1123 | snd_pcm_sw_params_free (p->swparams); | ||
| 1124 | if (p->handle) | ||
| 1125 | { | ||
| 1126 | snd_pcm_drain(p->handle); | ||
| 1127 | snd_pcm_close (p->handle); | ||
| 1128 | } | ||
| 1129 | free (p); | ||
| 1130 | } | ||
| 1131 | } | ||
| 1132 | |||
| 1133 | /* Choose device-dependent format for device SD from sound file S. */ | ||
| 1134 | |||
| 1135 | static void | ||
| 1136 | alsa_choose_format (sd, s) | ||
| 1137 | struct sound_device *sd; | ||
| 1138 | struct sound *s; | ||
| 1139 | { | ||
| 1140 | struct alsa_params *p = (struct alsa_params *) sd->data; | ||
| 1141 | if (s->type == RIFF) | ||
| 1142 | { | ||
| 1143 | struct wav_header *h = (struct wav_header *) s->header; | ||
| 1144 | if (h->precision == 8) | ||
| 1145 | sd->format = SND_PCM_FORMAT_U8; | ||
| 1146 | else if (h->precision == 16) | ||
| 1147 | sd->format = SND_PCM_FORMAT_S16_LE; | ||
| 1148 | else | ||
| 1149 | error ("Unsupported WAV file format"); | ||
| 1150 | } | ||
| 1151 | else if (s->type == SUN_AUDIO) | ||
| 1152 | { | ||
| 1153 | struct au_header *header = (struct au_header *) s->header; | ||
| 1154 | switch (header->encoding) | ||
| 1155 | { | ||
| 1156 | case AU_ENCODING_ULAW_8: | ||
| 1157 | sd->format = SND_PCM_FORMAT_MU_LAW; | ||
| 1158 | break; | ||
| 1159 | case AU_ENCODING_ALAW_8: | ||
| 1160 | sd->format = SND_PCM_FORMAT_A_LAW; | ||
| 1161 | break; | ||
| 1162 | case AU_ENCODING_IEEE32: | ||
| 1163 | sd->format = SND_PCM_FORMAT_FLOAT_BE; | ||
| 1164 | break; | ||
| 1165 | case AU_ENCODING_IEEE64: | ||
| 1166 | sd->format = SND_PCM_FORMAT_FLOAT64_BE; | ||
| 1167 | break; | ||
| 1168 | case AU_ENCODING_8: | ||
| 1169 | sd->format = SND_PCM_FORMAT_S8; | ||
| 1170 | break; | ||
| 1171 | case AU_ENCODING_16: | ||
| 1172 | sd->format = SND_PCM_FORMAT_S16_BE; | ||
| 1173 | break; | ||
| 1174 | case AU_ENCODING_24: | ||
| 1175 | sd->format = SND_PCM_FORMAT_S24_BE; | ||
| 1176 | break; | ||
| 1177 | case AU_ENCODING_32: | ||
| 1178 | sd->format = SND_PCM_FORMAT_S32_BE; | ||
| 1179 | break; | ||
| 1180 | |||
| 1181 | default: | ||
| 1182 | error ("Unsupported AU file format"); | ||
| 1183 | } | ||
| 1184 | } | ||
| 1185 | else | ||
| 1186 | abort (); | ||
| 1187 | } | ||
| 1188 | |||
| 1189 | |||
| 1190 | /* Write NBYTES bytes from BUFFER to device SD. */ | ||
| 1191 | |||
| 1192 | static void | ||
| 1193 | alsa_write (sd, buffer, nbytes) | ||
| 1194 | struct sound_device *sd; | ||
| 1195 | const char *buffer; | ||
| 1196 | int nbytes; | ||
| 1197 | { | ||
| 1198 | struct alsa_params *p = (struct alsa_params *) sd->data; | ||
| 1199 | |||
| 1200 | /* The the third parameter to snd_pcm_writei is frames, not bytes. */ | ||
| 1201 | int fact = snd_pcm_format_size (sd->format, 1) * sd->channels; | ||
| 1202 | int nwritten = 0; | ||
| 1203 | int err; | ||
| 1204 | |||
| 1205 | while (nwritten < nbytes) | ||
| 1206 | { | ||
| 1207 | err = snd_pcm_writei (p->handle, | ||
| 1208 | buffer + nwritten, | ||
| 1209 | (nbytes - nwritten)/fact); | ||
| 1210 | if (err < 0) | ||
| 1211 | { | ||
| 1212 | if (err == -EPIPE) | ||
| 1213 | { /* under-run */ | ||
| 1214 | err = snd_pcm_prepare (p->handle); | ||
| 1215 | if (err < 0) | ||
| 1216 | alsa_sound_perror ("Can't recover from underrun, prepare failed", | ||
| 1217 | err); | ||
| 1218 | } | ||
| 1219 | else if (err == -ESTRPIPE) | ||
| 1220 | { | ||
| 1221 | while ((err = snd_pcm_resume (p->handle)) == -EAGAIN) | ||
| 1222 | sleep(1); /* wait until the suspend flag is released */ | ||
| 1223 | if (err < 0) | ||
| 1224 | { | ||
| 1225 | err = snd_pcm_prepare (p->handle); | ||
| 1226 | if (err < 0) | ||
| 1227 | alsa_sound_perror ("Can't recover from suspend, " | ||
| 1228 | "prepare failed", | ||
| 1229 | err); | ||
| 1230 | } | ||
| 1231 | } | ||
| 1232 | else | ||
| 1233 | alsa_sound_perror ("Error writing to sound device", err); | ||
| 1234 | |||
| 1235 | } | ||
| 1236 | else | ||
| 1237 | nwritten += err * fact; | ||
| 1238 | } | ||
| 1239 | } | ||
| 1240 | |||
| 1241 | static void | ||
| 1242 | snd_error_quiet (file, line, function, err, fmt) | ||
| 1243 | const char *file; | ||
| 1244 | int line; | ||
| 1245 | const char *function; | ||
| 1246 | int err; | ||
| 1247 | const char *fmt; | ||
| 1248 | { | ||
| 1249 | } | ||
| 1250 | |||
| 1251 | /* Initialize device SD. Set up the interface functions in the device | ||
| 1252 | structure. */ | ||
| 1253 | |||
| 1254 | static int | ||
| 1255 | alsa_init (sd) | ||
| 1256 | struct sound_device *sd; | ||
| 1257 | { | ||
| 1258 | char *file; | ||
| 1259 | snd_pcm_t *handle; | ||
| 1260 | int err; | ||
| 1261 | |||
| 1262 | /* Open the sound device. Default is "default". */ | ||
| 1263 | if (sd->file) | ||
| 1264 | file = sd->file; | ||
| 1265 | else | ||
| 1266 | file = DEFAULT_ALSA_SOUND_DEVICE; | ||
| 1267 | |||
| 1268 | snd_lib_error_set_handler ((snd_lib_error_handler_t) snd_error_quiet); | ||
| 1269 | err = snd_pcm_open (&handle, file, SND_PCM_STREAM_PLAYBACK, 0); | ||
| 1270 | snd_lib_error_set_handler (NULL); | ||
| 1271 | if (err < 0) | ||
| 1272 | return 0; | ||
| 1273 | |||
| 1274 | sd->fd = -1; | ||
| 1275 | sd->open = alsa_open; | ||
| 1276 | sd->close = alsa_close; | ||
| 1277 | sd->configure = alsa_configure; | ||
| 1278 | sd->choose_format = alsa_choose_format; | ||
| 1279 | sd->write = alsa_write; | ||
| 1280 | sd->period_size = alsa_period_size; | ||
| 1281 | |||
| 1282 | return 1; | ||
| 1283 | } | ||
| 1284 | |||
| 1285 | #endif /* HAVE_ALSA */ | ||
| 1286 | |||
| 1287 | |||
| 896 | /* END: Non Windows functions */ | 1288 | /* END: Non Windows functions */ |
| 897 | #else /* WINDOWSNT */ | 1289 | #else /* WINDOWSNT */ |
| 898 | 1290 | ||
| @@ -1056,10 +1448,11 @@ Internal use only, use `play-sound' instead.\n */) | |||
| 1056 | args[1] = sound; | 1448 | args[1] = sound; |
| 1057 | Frun_hook_with_args (2, args); | 1449 | Frun_hook_with_args (2, args); |
| 1058 | 1450 | ||
| 1059 | /* There is only one type of device we currently support, the VOX | 1451 | #ifdef HAVE_ALSA |
| 1060 | sound driver. Set up the device interface functions for that | 1452 | if (!alsa_init (current_sound_device)) |
| 1061 | device. */ | 1453 | #endif |
| 1062 | vox_init (current_sound_device); | 1454 | if (!vox_init (current_sound_device)) |
| 1455 | error ("No usable sound device driver found"); | ||
| 1063 | 1456 | ||
| 1064 | /* Open the device. */ | 1457 | /* Open the device. */ |
| 1065 | current_sound_device->open (current_sound_device); | 1458 | current_sound_device->open (current_sound_device); |
diff --git a/src/sysdep.c b/src/sysdep.c index 3e06170e721..307f69290d6 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -244,7 +244,7 @@ int emacs_ospeed; | |||
| 244 | under VMS, we place the input channel number here. */ | 244 | under VMS, we place the input channel number here. */ |
| 245 | int input_fd; | 245 | int input_fd; |
| 246 | 246 | ||
| 247 | void croak P_ ((char *)); | 247 | void croak P_ ((char *)) NO_RETURN; |
| 248 | 248 | ||
| 249 | #ifdef AIXHFT | 249 | #ifdef AIXHFT |
| 250 | void hft_init (); | 250 | void hft_init (); |
| @@ -950,11 +950,11 @@ init_environment (char ** argv) | |||
| 950 | struct stat ignored; | 950 | struct stat ignored; |
| 951 | char default_home[MAX_PATH]; | 951 | char default_home[MAX_PATH]; |
| 952 | 952 | ||
| 953 | static struct env_entry | 953 | static const struct env_entry |
| 954 | { | 954 | { |
| 955 | char * name; | 955 | char * name; |
| 956 | char * def_value; | 956 | char * def_value; |
| 957 | } env_vars[] = | 957 | } dflt_envvars[] = |
| 958 | { | 958 | { |
| 959 | {"HOME", "C:/"}, | 959 | {"HOME", "C:/"}, |
| 960 | {"PRELOAD_WINSOCK", NULL}, | 960 | {"PRELOAD_WINSOCK", NULL}, |
| @@ -971,6 +971,17 @@ init_environment (char ** argv) | |||
| 971 | {"LANG", NULL}, | 971 | {"LANG", NULL}, |
| 972 | }; | 972 | }; |
| 973 | 973 | ||
| 974 | #define N_ENV_VARS sizeof(dflt_envvars)/sizeof(dflt_envvars[0]) | ||
| 975 | |||
| 976 | /* We need to copy dflt_envvars[] and work on the copy because we | ||
| 977 | don't want the dumped Emacs to inherit the values of | ||
| 978 | environment variables we saw during dumping (which could be on | ||
| 979 | a different system). The defaults above must be left intact. */ | ||
| 980 | struct env_entry env_vars[N_ENV_VARS]; | ||
| 981 | |||
| 982 | for (i = 0; i < N_ENV_VARS; i++) | ||
| 983 | env_vars[i] = dflt_envvars[i]; | ||
| 984 | |||
| 974 | /* For backwards compatibility, check if a .emacs file exists in C:/ | 985 | /* For backwards compatibility, check if a .emacs file exists in C:/ |
| 975 | If not, then we can try to default to the appdata directory under the | 986 | If not, then we can try to default to the appdata directory under the |
| 976 | user's profile, which is more likely to be writable. */ | 987 | user's profile, which is more likely to be writable. */ |
| @@ -1005,7 +1016,7 @@ init_environment (char ** argv) | |||
| 1005 | LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP, | 1016 | LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP, |
| 1006 | locale_name, sizeof (locale_name))) | 1017 | locale_name, sizeof (locale_name))) |
| 1007 | { | 1018 | { |
| 1008 | for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++) | 1019 | for (i = 0; i < N_ENV_VARS; i++) |
| 1009 | { | 1020 | { |
| 1010 | if (strcmp (env_vars[i].name, "LANG") == 0) | 1021 | if (strcmp (env_vars[i].name, "LANG") == 0) |
| 1011 | { | 1022 | { |
| @@ -1069,7 +1080,7 @@ init_environment (char ** argv) | |||
| 1069 | } | 1080 | } |
| 1070 | } | 1081 | } |
| 1071 | 1082 | ||
| 1072 | for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++) | 1083 | for (i = 0; i < N_ENV_VARS; i++) |
| 1073 | { | 1084 | { |
| 1074 | if (!getenv (env_vars[i].name)) | 1085 | if (!getenv (env_vars[i].name)) |
| 1075 | { | 1086 | { |
| @@ -1084,20 +1095,17 @@ init_environment (char ** argv) | |||
| 1084 | 1095 | ||
| 1085 | if (lpval) | 1096 | if (lpval) |
| 1086 | { | 1097 | { |
| 1087 | if (dwType == REG_EXPAND_SZ) | 1098 | char buf1[SET_ENV_BUF_SIZE], buf2[SET_ENV_BUF_SIZE]; |
| 1088 | { | ||
| 1089 | char buf1[SET_ENV_BUF_SIZE], buf2[SET_ENV_BUF_SIZE]; | ||
| 1090 | 1099 | ||
| 1091 | ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof(buf1)); | 1100 | if (dwType == REG_EXPAND_SZ) |
| 1092 | _snprintf (buf2, sizeof(buf2)-1, "%s=%s", env_vars[i].name, buf1); | 1101 | ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof(buf1)); |
| 1093 | _putenv (strdup (buf2)); | ||
| 1094 | } | ||
| 1095 | else if (dwType == REG_SZ) | 1102 | else if (dwType == REG_SZ) |
| 1103 | strcpy (buf1, lpval); | ||
| 1104 | if (dwType == REG_EXPAND_SZ || dwType == REG_SZ) | ||
| 1096 | { | 1105 | { |
| 1097 | char buf[SET_ENV_BUF_SIZE]; | 1106 | _snprintf (buf2, sizeof(buf2)-1, "%s=%s", env_vars[i].name, |
| 1098 | 1107 | buf1); | |
| 1099 | _snprintf (buf, sizeof(buf)-1, "%s=%s", env_vars[i].name, lpval); | 1108 | _putenv (strdup (buf2)); |
| 1100 | _putenv (strdup (buf)); | ||
| 1101 | } | 1109 | } |
| 1102 | 1110 | ||
| 1103 | if (!dont_free) | 1111 | if (!dont_free) |
diff --git a/src/w32fns.c b/src/w32fns.c index 4da5271c870..aa83e006194 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -1684,7 +1684,7 @@ x_set_icon_name (f, arg, oldval) | |||
| 1684 | if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | 1684 | if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) |
| 1685 | return; | 1685 | return; |
| 1686 | } | 1686 | } |
| 1687 | else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | 1687 | else if (!NILP (arg) || NILP (oldval)) |
| 1688 | return; | 1688 | return; |
| 1689 | 1689 | ||
| 1690 | f->icon_name = arg; | 1690 | 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 305527946fb..0a7007cc8f4 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -173,32 +173,6 @@ HANDLE hWindowsThread = NULL; | |||
| 173 | DWORD dwMainThreadId = 0; | 173 | DWORD dwMainThreadId = 0; |
| 174 | HANDLE hMainThread = NULL; | 174 | HANDLE hMainThread = NULL; |
| 175 | 175 | ||
| 176 | #ifndef SIF_ALL | ||
| 177 | /* These definitions are new with Windows 95. */ | ||
| 178 | #define SIF_RANGE 0x0001 | ||
| 179 | #define SIF_PAGE 0x0002 | ||
| 180 | #define SIF_POS 0x0004 | ||
| 181 | #define SIF_DISABLENOSCROLL 0x0008 | ||
| 182 | #define SIF_TRACKPOS 0x0010 | ||
| 183 | #define SIF_ALL (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS) | ||
| 184 | |||
| 185 | typedef struct tagSCROLLINFO | ||
| 186 | { | ||
| 187 | UINT cbSize; | ||
| 188 | UINT fMask; | ||
| 189 | int nMin; | ||
| 190 | int nMax; | ||
| 191 | UINT nPage; | ||
| 192 | int nPos; | ||
| 193 | int nTrackPos; | ||
| 194 | } SCROLLINFO, FAR *LPSCROLLINFO; | ||
| 195 | typedef SCROLLINFO CONST FAR *LPCSCROLLINFO; | ||
| 196 | #endif /* SIF_ALL */ | ||
| 197 | |||
| 198 | /* Dynamic linking to new proportional scroll bar functions. */ | ||
| 199 | int (PASCAL *pfnSetScrollInfo) (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw); | ||
| 200 | BOOL (PASCAL *pfnGetScrollInfo) (HWND hwnd, int fnBar, LPSCROLLINFO lpsi); | ||
| 201 | |||
| 202 | int vertical_scroll_bar_min_handle; | 176 | int vertical_scroll_bar_min_handle; |
| 203 | int vertical_scroll_bar_top_border; | 177 | int vertical_scroll_bar_top_border; |
| 204 | int vertical_scroll_bar_bottom_border; | 178 | int vertical_scroll_bar_bottom_border; |
| @@ -2540,20 +2514,29 @@ x_draw_stretch_glyph_string (s) | |||
| 2540 | { | 2514 | { |
| 2541 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor | 2515 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor |
| 2542 | as wide as the stretch glyph. */ | 2516 | as wide as the stretch glyph. */ |
| 2543 | int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width); | 2517 | int width, background_width = s->background_width; |
| 2518 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | ||
| 2519 | |||
| 2520 | if (x < left_x) | ||
| 2521 | { | ||
| 2522 | background_width -= left_x - x; | ||
| 2523 | x = left_x; | ||
| 2524 | } | ||
| 2525 | width = min (FRAME_COLUMN_WIDTH (s->f), background_width); | ||
| 2544 | 2526 | ||
| 2545 | /* Draw cursor. */ | 2527 | /* Draw cursor. */ |
| 2546 | x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); | 2528 | x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); |
| 2547 | 2529 | ||
| 2548 | /* Clear rest using the GC of the original non-cursor face. */ | 2530 | /* Clear rest using the GC of the original non-cursor face. */ |
| 2549 | if (width < s->background_width) | 2531 | if (width < background_width) |
| 2550 | { | 2532 | { |
| 2551 | XGCValues *gc = s->face->gc; | 2533 | XGCValues *gc = s->face->gc; |
| 2552 | int x = s->x + width, y = s->y; | 2534 | int y = s->y; |
| 2553 | int w = s->background_width - width, h = s->height; | 2535 | int w = background_width - width, h = s->height; |
| 2554 | RECT r; | 2536 | RECT r; |
| 2555 | HDC hdc = s->hdc; | 2537 | HDC hdc = s->hdc; |
| 2556 | 2538 | ||
| 2539 | x += width; | ||
| 2557 | if (s->row->mouse_face_p | 2540 | if (s->row->mouse_face_p |
| 2558 | && cursor_in_mouse_face_p (s->w)) | 2541 | && cursor_in_mouse_face_p (s->w)) |
| 2559 | { | 2542 | { |
| @@ -2582,8 +2565,18 @@ x_draw_stretch_glyph_string (s) | |||
| 2582 | } | 2565 | } |
| 2583 | } | 2566 | } |
| 2584 | else if (!s->background_filled_p) | 2567 | else if (!s->background_filled_p) |
| 2585 | x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, | 2568 | { |
| 2586 | s->height); | 2569 | int background_width = s->background_width; |
| 2570 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | ||
| 2571 | |||
| 2572 | if (x < left_x) | ||
| 2573 | { | ||
| 2574 | background_width -= left_x - x; | ||
| 2575 | x = left_x; | ||
| 2576 | } | ||
| 2577 | if (background_width > 0) | ||
| 2578 | x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); | ||
| 2579 | } | ||
| 2587 | 2580 | ||
| 2588 | s->background_filled_p = 1; | 2581 | s->background_filled_p = 1; |
| 2589 | } | 2582 | } |
| @@ -3619,6 +3612,7 @@ w32_set_scroll_bar_thumb (bar, portion, position, whole) | |||
| 3619 | double range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 3612 | double range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); |
| 3620 | int sb_page, sb_pos; | 3613 | int sb_page, sb_pos; |
| 3621 | BOOL draggingp = !NILP (bar->dragging) ? TRUE : FALSE; | 3614 | BOOL draggingp = !NILP (bar->dragging) ? TRUE : FALSE; |
| 3615 | SCROLLINFO si; | ||
| 3622 | 3616 | ||
| 3623 | if (whole) | 3617 | if (whole) |
| 3624 | { | 3618 | { |
| @@ -3643,24 +3637,17 @@ w32_set_scroll_bar_thumb (bar, portion, position, whole) | |||
| 3643 | 3637 | ||
| 3644 | BLOCK_INPUT; | 3638 | BLOCK_INPUT; |
| 3645 | 3639 | ||
| 3646 | if (pfnSetScrollInfo) | 3640 | si.cbSize = sizeof (si); |
| 3647 | { | 3641 | /* Only update page size if currently dragging, to reduce |
| 3648 | SCROLLINFO si; | 3642 | flicker effects. */ |
| 3649 | 3643 | if (draggingp) | |
| 3650 | si.cbSize = sizeof (si); | 3644 | si.fMask = SIF_PAGE; |
| 3651 | /* Only update page size if currently dragging, to reduce | ||
| 3652 | flicker effects. */ | ||
| 3653 | if (draggingp) | ||
| 3654 | si.fMask = SIF_PAGE; | ||
| 3655 | else | ||
| 3656 | si.fMask = SIF_PAGE | SIF_POS; | ||
| 3657 | si.nPage = sb_page; | ||
| 3658 | si.nPos = sb_pos; | ||
| 3659 | |||
| 3660 | pfnSetScrollInfo (w, SB_CTL, &si, !draggingp); | ||
| 3661 | } | ||
| 3662 | else | 3645 | else |
| 3663 | SetScrollPos (w, SB_CTL, sb_pos, !draggingp); | 3646 | si.fMask = SIF_PAGE | SIF_POS; |
| 3647 | si.nPage = sb_page; | ||
| 3648 | si.nPos = sb_pos; | ||
| 3649 | |||
| 3650 | SetScrollInfo (w, SB_CTL, &si, !draggingp); | ||
| 3664 | 3651 | ||
| 3665 | UNBLOCK_INPUT; | 3652 | UNBLOCK_INPUT; |
| 3666 | } | 3653 | } |
| @@ -3749,6 +3736,7 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 3749 | { | 3736 | { |
| 3750 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 3737 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 3751 | HWND hwnd; | 3738 | HWND hwnd; |
| 3739 | SCROLLINFO si; | ||
| 3752 | struct scroll_bar *bar | 3740 | struct scroll_bar *bar |
| 3753 | = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); | 3741 | = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); |
| 3754 | 3742 | ||
| @@ -3767,26 +3755,15 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 3767 | 3755 | ||
| 3768 | hwnd = my_create_scrollbar (f, bar); | 3756 | hwnd = my_create_scrollbar (f, bar); |
| 3769 | 3757 | ||
| 3770 | if (pfnSetScrollInfo) | 3758 | si.cbSize = sizeof (si); |
| 3771 | { | 3759 | si.fMask = SIF_ALL; |
| 3772 | SCROLLINFO si; | 3760 | si.nMin = 0; |
| 3761 | si.nMax = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height) | ||
| 3762 | + VERTICAL_SCROLL_BAR_MIN_HANDLE; | ||
| 3763 | si.nPage = si.nMax; | ||
| 3764 | si.nPos = 0; | ||
| 3773 | 3765 | ||
| 3774 | si.cbSize = sizeof (si); | 3766 | SetScrollInfo (hwnd, SB_CTL, &si, FALSE); |
| 3775 | si.fMask = SIF_ALL; | ||
| 3776 | si.nMin = 0; | ||
| 3777 | si.nMax = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height) | ||
| 3778 | + VERTICAL_SCROLL_BAR_MIN_HANDLE; | ||
| 3779 | si.nPage = si.nMax; | ||
| 3780 | si.nPos = 0; | ||
| 3781 | |||
| 3782 | pfnSetScrollInfo (hwnd, SB_CTL, &si, FALSE); | ||
| 3783 | } | ||
| 3784 | else | ||
| 3785 | { | ||
| 3786 | SetScrollRange (hwnd, SB_CTL, 0, | ||
| 3787 | VERTICAL_SCROLL_BAR_TOP_RANGE (f, height), FALSE); | ||
| 3788 | SetScrollPos (hwnd, SB_CTL, 0, FALSE); | ||
| 3789 | } | ||
| 3790 | 3767 | ||
| 3791 | SET_SCROLL_BAR_W32_WINDOW (bar, hwnd); | 3768 | SET_SCROLL_BAR_W32_WINDOW (bar, hwnd); |
| 3792 | 3769 | ||
| @@ -3895,6 +3872,8 @@ w32_set_vertical_scroll_bar (w, portion, whole, position) | |||
| 3895 | else | 3872 | else |
| 3896 | { | 3873 | { |
| 3897 | HDC hdc; | 3874 | HDC hdc; |
| 3875 | SCROLLINFO si; | ||
| 3876 | |||
| 3898 | BLOCK_INPUT; | 3877 | BLOCK_INPUT; |
| 3899 | if (width && height) | 3878 | if (width && height) |
| 3900 | { | 3879 | { |
| @@ -3914,21 +3893,15 @@ w32_set_vertical_scroll_bar (w, portion, whole, position) | |||
| 3914 | MoveWindow (hwnd, sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, | 3893 | MoveWindow (hwnd, sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, |
| 3915 | top, sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, | 3894 | top, sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, |
| 3916 | max (height, 1), TRUE); | 3895 | max (height, 1), TRUE); |
| 3917 | if (pfnSetScrollInfo) | ||
| 3918 | { | ||
| 3919 | SCROLLINFO si; | ||
| 3920 | 3896 | ||
| 3921 | si.cbSize = sizeof (si); | 3897 | si.cbSize = sizeof (si); |
| 3922 | si.fMask = SIF_RANGE; | 3898 | si.fMask = SIF_RANGE; |
| 3923 | si.nMin = 0; | 3899 | si.nMin = 0; |
| 3924 | si.nMax = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height) | 3900 | si.nMax = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height) |
| 3925 | + VERTICAL_SCROLL_BAR_MIN_HANDLE; | 3901 | + VERTICAL_SCROLL_BAR_MIN_HANDLE; |
| 3902 | |||
| 3903 | SetScrollInfo (hwnd, SB_CTL, &si, FALSE); | ||
| 3926 | 3904 | ||
| 3927 | pfnSetScrollInfo (hwnd, SB_CTL, &si, FALSE); | ||
| 3928 | } | ||
| 3929 | else | ||
| 3930 | SetScrollRange (hwnd, SB_CTL, 0, | ||
| 3931 | VERTICAL_SCROLL_BAR_TOP_RANGE (f, height), FALSE); | ||
| 3932 | my_show_window (f, hwnd, SW_NORMAL); | 3905 | my_show_window (f, hwnd, SW_NORMAL); |
| 3933 | /* InvalidateRect (w, NULL, FALSE); */ | 3906 | /* InvalidateRect (w, NULL, FALSE); */ |
| 3934 | 3907 | ||
| @@ -4080,19 +4053,13 @@ w32_scroll_bar_handle_click (bar, msg, emacs_event) | |||
| 4080 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 4053 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); |
| 4081 | int y; | 4054 | int y; |
| 4082 | int dragging = !NILP (bar->dragging); | 4055 | int dragging = !NILP (bar->dragging); |
| 4056 | SCROLLINFO si; | ||
| 4083 | 4057 | ||
| 4084 | if (pfnGetScrollInfo) | 4058 | si.cbSize = sizeof (si); |
| 4085 | { | 4059 | si.fMask = SIF_POS; |
| 4086 | SCROLLINFO si; | ||
| 4087 | |||
| 4088 | si.cbSize = sizeof (si); | ||
| 4089 | si.fMask = SIF_POS; | ||
| 4090 | 4060 | ||
| 4091 | pfnGetScrollInfo ((HWND) msg->msg.lParam, SB_CTL, &si); | 4061 | GetScrollInfo ((HWND) msg->msg.lParam, SB_CTL, &si); |
| 4092 | y = si.nPos; | 4062 | y = si.nPos; |
| 4093 | } | ||
| 4094 | else | ||
| 4095 | y = GetScrollPos ((HWND) msg->msg.lParam, SB_CTL); | ||
| 4096 | 4063 | ||
| 4097 | bar->dragging = Qnil; | 4064 | bar->dragging = Qnil; |
| 4098 | 4065 | ||
| @@ -4129,21 +4096,18 @@ w32_scroll_bar_handle_click (bar, msg, emacs_event) | |||
| 4129 | emacs_event->part = scroll_bar_handle; | 4096 | emacs_event->part = scroll_bar_handle; |
| 4130 | 4097 | ||
| 4131 | /* "Silently" update current position. */ | 4098 | /* "Silently" update current position. */ |
| 4132 | if (pfnSetScrollInfo) | 4099 | { |
| 4133 | { | 4100 | SCROLLINFO si; |
| 4134 | SCROLLINFO si; | ||
| 4135 | 4101 | ||
| 4136 | si.cbSize = sizeof (si); | 4102 | si.cbSize = sizeof (si); |
| 4137 | si.fMask = SIF_POS; | 4103 | si.fMask = SIF_POS; |
| 4138 | si.nPos = y; | 4104 | si.nPos = y; |
| 4139 | /* Remember apparent position (we actually lag behind the real | 4105 | /* Remember apparent position (we actually lag behind the real |
| 4140 | position, so don't set that directly. */ | 4106 | position, so don't set that directly. */ |
| 4141 | last_scroll_bar_drag_pos = y; | 4107 | last_scroll_bar_drag_pos = y; |
| 4142 | 4108 | ||
| 4143 | pfnSetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, FALSE); | 4109 | SetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, FALSE); |
| 4144 | } | 4110 | } |
| 4145 | else | ||
| 4146 | SetScrollPos (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, y, FALSE); | ||
| 4147 | break; | 4111 | break; |
| 4148 | case SB_ENDSCROLL: | 4112 | case SB_ENDSCROLL: |
| 4149 | /* If this is the end of a drag sequence, then reset the scroll | 4113 | /* If this is the end of a drag sequence, then reset the scroll |
| @@ -4151,20 +4115,15 @@ w32_scroll_bar_handle_click (bar, msg, emacs_event) | |||
| 4151 | nothing. */ | 4115 | nothing. */ |
| 4152 | if (dragging) | 4116 | if (dragging) |
| 4153 | { | 4117 | { |
| 4154 | if (pfnSetScrollInfo) | 4118 | SCROLLINFO si; |
| 4155 | { | 4119 | int start = XINT (bar->start); |
| 4156 | SCROLLINFO si; | 4120 | int end = XINT (bar->end); |
| 4157 | int start = XINT (bar->start); | 4121 | |
| 4158 | int end = XINT (bar->end); | 4122 | si.cbSize = sizeof (si); |
| 4159 | 4123 | si.fMask = SIF_PAGE | SIF_POS; | |
| 4160 | si.cbSize = sizeof (si); | 4124 | si.nPage = end - start + VERTICAL_SCROLL_BAR_MIN_HANDLE; |
| 4161 | si.fMask = SIF_PAGE | SIF_POS; | 4125 | si.nPos = last_scroll_bar_drag_pos; |
| 4162 | si.nPage = end - start + VERTICAL_SCROLL_BAR_MIN_HANDLE; | 4126 | SetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, TRUE); |
| 4163 | si.nPos = last_scroll_bar_drag_pos; | ||
| 4164 | pfnSetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, TRUE); | ||
| 4165 | } | ||
| 4166 | else | ||
| 4167 | SetScrollPos (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, y, TRUE); | ||
| 4168 | } | 4127 | } |
| 4169 | /* fall through */ | 4128 | /* fall through */ |
| 4170 | default: | 4129 | default: |
| @@ -4195,25 +4154,19 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | |||
| 4195 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 4154 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 4196 | int pos; | 4155 | int pos; |
| 4197 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 4156 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); |
| 4157 | SCROLLINFO si; | ||
| 4198 | 4158 | ||
| 4199 | BLOCK_INPUT; | 4159 | BLOCK_INPUT; |
| 4200 | 4160 | ||
| 4201 | *fp = f; | 4161 | *fp = f; |
| 4202 | *bar_window = bar->window; | 4162 | *bar_window = bar->window; |
| 4203 | 4163 | ||
| 4204 | if (pfnGetScrollInfo) | 4164 | si.cbSize = sizeof (si); |
| 4205 | { | 4165 | si.fMask = SIF_POS | SIF_PAGE | SIF_RANGE; |
| 4206 | SCROLLINFO si; | ||
| 4207 | |||
| 4208 | si.cbSize = sizeof (si); | ||
| 4209 | si.fMask = SIF_POS | SIF_PAGE | SIF_RANGE; | ||
| 4210 | 4166 | ||
| 4211 | pfnGetScrollInfo (w, SB_CTL, &si); | 4167 | GetScrollInfo (w, SB_CTL, &si); |
| 4212 | pos = si.nPos; | 4168 | pos = si.nPos; |
| 4213 | top_range = si.nMax - si.nPage + 1; | 4169 | top_range = si.nMax - si.nPage + 1; |
| 4214 | } | ||
| 4215 | else | ||
| 4216 | pos = GetScrollPos (w, SB_CTL); | ||
| 4217 | 4170 | ||
| 4218 | switch (LOWORD (last_mouse_scroll_bar_pos)) | 4171 | switch (LOWORD (last_mouse_scroll_bar_pos)) |
| 4219 | { | 4172 | { |
| @@ -5082,7 +5035,7 @@ x_draw_hollow_cursor (w, row) | |||
| 5082 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 5035 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 5083 | HDC hdc; | 5036 | HDC hdc; |
| 5084 | RECT rect; | 5037 | RECT rect; |
| 5085 | int h; | 5038 | int left, top, h; |
| 5086 | struct glyph *cursor_glyph; | 5039 | struct glyph *cursor_glyph; |
| 5087 | HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel); | 5040 | HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel); |
| 5088 | 5041 | ||
| @@ -5093,8 +5046,9 @@ x_draw_hollow_cursor (w, row) | |||
| 5093 | return; | 5046 | return; |
| 5094 | 5047 | ||
| 5095 | /* Compute frame-relative coordinates for phys cursor. */ | 5048 | /* Compute frame-relative coordinates for phys cursor. */ |
| 5096 | rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 5049 | get_phys_cursor_geometry (w, row, cursor_glyph, &left, &top, &h); |
| 5097 | rect.top = get_phys_cursor_geometry (w, row, cursor_glyph, &h); | 5050 | rect.left = left; |
| 5051 | rect.top = top; | ||
| 5098 | rect.bottom = rect.top + h; | 5052 | rect.bottom = rect.top + h; |
| 5099 | rect.right = rect.left + w->phys_cursor_width; | 5053 | rect.right = rect.left + w->phys_cursor_width; |
| 5100 | 5054 | ||
diff --git a/src/window.c b/src/window.c index 1abeec92367..59c223b4a8f 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3778,7 +3778,9 @@ SIZE includes that window's scroll bar, or the divider column to its right. | |||
| 3778 | Interactively, all arguments are nil. | 3778 | Interactively, all arguments are nil. |
| 3779 | 3779 | ||
| 3780 | Returns the newly created window (which is the lower or rightmost one). | 3780 | Returns the newly created window (which is the lower or rightmost one). |
| 3781 | The upper or leftmost window is the original one and remains selected. | 3781 | The upper or leftmost window is the original one, and remains selected |
| 3782 | if it was selected before. | ||
| 3783 | |||
| 3782 | See Info node `(elisp)Splitting Windows' for more details and examples.*/) | 3784 | See Info node `(elisp)Splitting Windows' for more details and examples.*/) |
| 3783 | (window, size, horflag) | 3785 | (window, size, horflag) |
| 3784 | Lisp_Object window, size, horflag; | 3786 | Lisp_Object window, size, horflag; |
| @@ -5794,6 +5796,7 @@ struct saved_window | |||
| 5794 | Lisp_Object left_margin_cols, right_margin_cols; | 5796 | Lisp_Object left_margin_cols, right_margin_cols; |
| 5795 | Lisp_Object left_fringe_width, right_fringe_width, fringes_outside_margins; | 5797 | Lisp_Object left_fringe_width, right_fringe_width, fringes_outside_margins; |
| 5796 | Lisp_Object scroll_bar_width, vertical_scroll_bar_type; | 5798 | Lisp_Object scroll_bar_width, vertical_scroll_bar_type; |
| 5799 | Lisp_Object dedicated; | ||
| 5797 | }; | 5800 | }; |
| 5798 | 5801 | ||
| 5799 | #define SAVED_WINDOW_N(swv,n) \ | 5802 | #define SAVED_WINDOW_N(swv,n) \ |
| @@ -5804,9 +5807,7 @@ DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_ | |||
| 5804 | (object) | 5807 | (object) |
| 5805 | Lisp_Object object; | 5808 | Lisp_Object object; |
| 5806 | { | 5809 | { |
| 5807 | if (WINDOW_CONFIGURATIONP (object)) | 5810 | return WINDOW_CONFIGURATIONP (object) ? Qt : Qnil; |
| 5808 | return Qt; | ||
| 5809 | return Qnil; | ||
| 5810 | } | 5811 | } |
| 5811 | 5812 | ||
| 5812 | DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_configuration_frame, 1, 1, 0, | 5813 | DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_configuration_frame, 1, 1, 0, |
| @@ -6028,6 +6029,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6028 | w->fringes_outside_margins = p->fringes_outside_margins; | 6029 | w->fringes_outside_margins = p->fringes_outside_margins; |
| 6029 | w->scroll_bar_width = p->scroll_bar_width; | 6030 | w->scroll_bar_width = p->scroll_bar_width; |
| 6030 | w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; | 6031 | w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; |
| 6032 | w->dedicated = p->dedicated; | ||
| 6031 | XSETFASTINT (w->last_modified, 0); | 6033 | XSETFASTINT (w->last_modified, 0); |
| 6032 | XSETFASTINT (w->last_overlay_modified, 0); | 6034 | XSETFASTINT (w->last_overlay_modified, 0); |
| 6033 | 6035 | ||
| @@ -6297,6 +6299,7 @@ save_window_save (window, vector, i) | |||
| 6297 | p->fringes_outside_margins = w->fringes_outside_margins; | 6299 | p->fringes_outside_margins = w->fringes_outside_margins; |
| 6298 | p->scroll_bar_width = w->scroll_bar_width; | 6300 | p->scroll_bar_width = w->scroll_bar_width; |
| 6299 | p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; | 6301 | p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; |
| 6302 | p->dedicated = w->dedicated; | ||
| 6300 | if (!NILP (w->buffer)) | 6303 | if (!NILP (w->buffer)) |
| 6301 | { | 6304 | { |
| 6302 | /* Save w's value of point in the window configuration. | 6305 | /* Save w's value of point in the window configuration. |
| @@ -6796,7 +6799,9 @@ foreach_window (f, fn, user_data) | |||
| 6796 | int (* fn) P_ ((struct window *, void *)); | 6799 | int (* fn) P_ ((struct window *, void *)); |
| 6797 | void *user_data; | 6800 | void *user_data; |
| 6798 | { | 6801 | { |
| 6799 | foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, user_data); | 6802 | /* Fdelete_frame may set FRAME_ROOT_WINDOW (f) to Qnil. */ |
| 6803 | if (WINDOWP (FRAME_ROOT_WINDOW (f))) | ||
| 6804 | foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, user_data); | ||
| 6800 | } | 6805 | } |
| 6801 | 6806 | ||
| 6802 | 6807 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 9b5b913938b..0cb34a2fef8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1995,15 +1995,15 @@ get_glyph_string_clip_rect (s, nr) | |||
| 1995 | Set w->phys_cursor_width to width of phys cursor. | 1995 | Set w->phys_cursor_width to width of phys cursor. |
| 1996 | */ | 1996 | */ |
| 1997 | 1997 | ||
| 1998 | int | 1998 | void |
| 1999 | get_phys_cursor_geometry (w, row, glyph, heightp) | 1999 | get_phys_cursor_geometry (w, row, glyph, xp, yp, heightp) |
| 2000 | struct window *w; | 2000 | struct window *w; |
| 2001 | struct glyph_row *row; | 2001 | struct glyph_row *row; |
| 2002 | struct glyph *glyph; | 2002 | struct glyph *glyph; |
| 2003 | int *heightp; | 2003 | int *xp, *yp, *heightp; |
| 2004 | { | 2004 | { |
| 2005 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 2005 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 2006 | int y, wd, h, h0, y0; | 2006 | int x, y, wd, h, h0, y0; |
| 2007 | 2007 | ||
| 2008 | /* Compute the width of the rectangle to draw. If on a stretch | 2008 | /* Compute the width of the rectangle to draw. If on a stretch |
| 2009 | glyph, and `x-stretch-block-cursor' is nil, don't draw a | 2009 | glyph, and `x-stretch-block-cursor' is nil, don't draw a |
| @@ -2013,6 +2013,14 @@ get_phys_cursor_geometry (w, row, glyph, heightp) | |||
| 2013 | #ifdef HAVE_NTGUI | 2013 | #ifdef HAVE_NTGUI |
| 2014 | wd++; /* Why? */ | 2014 | wd++; /* Why? */ |
| 2015 | #endif | 2015 | #endif |
| 2016 | |||
| 2017 | x = w->phys_cursor.x; | ||
| 2018 | if (x < 0) | ||
| 2019 | { | ||
| 2020 | wd += x; | ||
| 2021 | x = 0; | ||
| 2022 | } | ||
| 2023 | |||
| 2016 | if (glyph->type == STRETCH_GLYPH | 2024 | if (glyph->type == STRETCH_GLYPH |
| 2017 | && !x_stretch_cursor_p) | 2025 | && !x_stretch_cursor_p) |
| 2018 | wd = min (FRAME_COLUMN_WIDTH (f), wd); | 2026 | wd = min (FRAME_COLUMN_WIDTH (f), wd); |
| @@ -2042,8 +2050,9 @@ get_phys_cursor_geometry (w, row, glyph, heightp) | |||
| 2042 | } | 2050 | } |
| 2043 | } | 2051 | } |
| 2044 | 2052 | ||
| 2053 | *xp = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, x); | ||
| 2054 | *yp = WINDOW_TO_FRAME_PIXEL_Y (w, y); | ||
| 2045 | *heightp = h; | 2055 | *heightp = h; |
| 2046 | return WINDOW_TO_FRAME_PIXEL_Y (w, y); | ||
| 2047 | } | 2056 | } |
| 2048 | 2057 | ||
| 2049 | /* | 2058 | /* |
| @@ -6334,6 +6343,8 @@ next_element_from_composition (it) | |||
| 6334 | it->position = (STRINGP (it->string) | 6343 | it->position = (STRINGP (it->string) |
| 6335 | ? it->current.string_pos | 6344 | ? it->current.string_pos |
| 6336 | : it->current.pos); | 6345 | : it->current.pos); |
| 6346 | if (STRINGP (it->string)) | ||
| 6347 | it->object = it->string; | ||
| 6337 | return 1; | 6348 | return 1; |
| 6338 | } | 6349 | } |
| 6339 | 6350 | ||
| @@ -9608,7 +9619,8 @@ display_tool_bar_line (it, height) | |||
| 9608 | 9619 | ||
| 9609 | while (it->current_x < max_x) | 9620 | while (it->current_x < max_x) |
| 9610 | { | 9621 | { |
| 9611 | int x_before, x, n_glyphs_before, i, nglyphs; | 9622 | int x, n_glyphs_before, i, nglyphs; |
| 9623 | struct it it_before; | ||
| 9612 | 9624 | ||
| 9613 | /* Get the next display element. */ | 9625 | /* Get the next display element. */ |
| 9614 | if (!get_next_display_element (it)) | 9626 | if (!get_next_display_element (it)) |
| @@ -9620,22 +9632,23 @@ display_tool_bar_line (it, height) | |||
| 9620 | } | 9632 | } |
| 9621 | 9633 | ||
| 9622 | /* Produce glyphs. */ | 9634 | /* Produce glyphs. */ |
| 9623 | x_before = it->current_x; | 9635 | n_glyphs_before = row->used[TEXT_AREA]; |
| 9624 | n_glyphs_before = it->glyph_row->used[TEXT_AREA]; | 9636 | it_before = *it; |
| 9637 | |||
| 9625 | PRODUCE_GLYPHS (it); | 9638 | PRODUCE_GLYPHS (it); |
| 9626 | 9639 | ||
| 9627 | nglyphs = it->glyph_row->used[TEXT_AREA] - n_glyphs_before; | 9640 | nglyphs = row->used[TEXT_AREA] - n_glyphs_before; |
| 9628 | i = 0; | 9641 | i = 0; |
| 9629 | x = x_before; | 9642 | x = it_before.current_x; |
| 9630 | while (i < nglyphs) | 9643 | while (i < nglyphs) |
| 9631 | { | 9644 | { |
| 9632 | struct glyph *glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i; | 9645 | struct glyph *glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i; |
| 9633 | 9646 | ||
| 9634 | if (x + glyph->pixel_width > max_x) | 9647 | if (x + glyph->pixel_width > max_x) |
| 9635 | { | 9648 | { |
| 9636 | /* Glyph doesn't fit on line. */ | 9649 | /* Glyph doesn't fit on line. Backtrack. */ |
| 9637 | it->glyph_row->used[TEXT_AREA] = n_glyphs_before + i; | 9650 | row->used[TEXT_AREA] = n_glyphs_before; |
| 9638 | it->current_x = x; | 9651 | *it = it_before; |
| 9639 | goto out; | 9652 | goto out; |
| 9640 | } | 9653 | } |
| 9641 | 9654 | ||
| @@ -9666,6 +9679,8 @@ display_tool_bar_line (it, height) | |||
| 9666 | /* Make line the desired height and center it vertically. */ | 9679 | /* Make line the desired height and center it vertically. */ |
| 9667 | if ((height -= it->max_ascent + it->max_descent) > 0) | 9680 | if ((height -= it->max_ascent + it->max_descent) > 0) |
| 9668 | { | 9681 | { |
| 9682 | /* Don't add more than one line height. */ | ||
| 9683 | height %= FRAME_LINE_HEIGHT (it->f); | ||
| 9669 | it->max_ascent += height / 2; | 9684 | it->max_ascent += height / 2; |
| 9670 | it->max_descent += (height + 1) / 2; | 9685 | it->max_descent += (height + 1) / 2; |
| 9671 | } | 9686 | } |
| @@ -11713,9 +11728,11 @@ redisplay_window_1 (window) | |||
| 11713 | 11728 | ||
| 11714 | /* Set cursor position of W. PT is assumed to be displayed in ROW. | 11729 | /* Set cursor position of W. PT is assumed to be displayed in ROW. |
| 11715 | DELTA is the number of bytes by which positions recorded in ROW | 11730 | DELTA is the number of bytes by which positions recorded in ROW |
| 11716 | differ from current buffer positions. */ | 11731 | differ from current buffer positions. |
| 11717 | 11732 | ||
| 11718 | void | 11733 | Return 0 if cursor is not on this row. 1 otherwise. */ |
| 11734 | |||
| 11735 | int | ||
| 11719 | set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | 11736 | set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) |
| 11720 | struct window *w; | 11737 | struct window *w; |
| 11721 | struct glyph_row *row; | 11738 | struct glyph_row *row; |
| @@ -11865,6 +11882,11 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 11865 | SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); | 11882 | SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); |
| 11866 | } | 11883 | } |
| 11867 | } | 11884 | } |
| 11885 | |||
| 11886 | /* If we reached the end of the line, and end was from a string, | ||
| 11887 | cursor is not on this line. */ | ||
| 11888 | if (glyph == end && row->continued_p) | ||
| 11889 | return 0; | ||
| 11868 | } | 11890 | } |
| 11869 | 11891 | ||
| 11870 | w->cursor.hpos = glyph - row->glyphs[TEXT_AREA]; | 11892 | w->cursor.hpos = glyph - row->glyphs[TEXT_AREA]; |
| @@ -11898,6 +11920,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 11898 | else | 11920 | else |
| 11899 | CHARPOS (this_line_start_pos) = 0; | 11921 | CHARPOS (this_line_start_pos) = 0; |
| 11900 | } | 11922 | } |
| 11923 | |||
| 11924 | return 1; | ||
| 11901 | } | 11925 | } |
| 11902 | 11926 | ||
| 11903 | 11927 | ||
| @@ -12581,8 +12605,18 @@ try_cursor_movement (window, startp, scroll_step) | |||
| 12581 | rc = CURSOR_MOVEMENT_MUST_SCROLL; | 12605 | rc = CURSOR_MOVEMENT_MUST_SCROLL; |
| 12582 | else | 12606 | else |
| 12583 | { | 12607 | { |
| 12584 | set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); | 12608 | do |
| 12585 | rc = CURSOR_MOVEMENT_SUCCESS; | 12609 | { |
| 12610 | if (set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0)) | ||
| 12611 | { | ||
| 12612 | rc = CURSOR_MOVEMENT_SUCCESS; | ||
| 12613 | break; | ||
| 12614 | } | ||
| 12615 | ++row; | ||
| 12616 | } | ||
| 12617 | while (MATRIX_ROW_BOTTOM_Y (row) < last_y | ||
| 12618 | && MATRIX_ROW_START_CHARPOS (row) == PT | ||
| 12619 | && cursor_row_p (w, row)); | ||
| 12586 | } | 12620 | } |
| 12587 | } | 12621 | } |
| 12588 | } | 12622 | } |
| @@ -15035,6 +15069,25 @@ dump_glyph (row, glyph, area) | |||
| 15035 | glyph->left_box_line_p, | 15069 | glyph->left_box_line_p, |
| 15036 | glyph->right_box_line_p); | 15070 | glyph->right_box_line_p); |
| 15037 | } | 15071 | } |
| 15072 | else if (glyph->type == COMPOSITE_GLYPH) | ||
| 15073 | { | ||
| 15074 | fprintf (stderr, | ||
| 15075 | " %5d %4c %6d %c %3d 0x%05x %c %4d %1.1d%1.1d\n", | ||
| 15076 | glyph - row->glyphs[TEXT_AREA], | ||
| 15077 | '+', | ||
| 15078 | glyph->charpos, | ||
| 15079 | (BUFFERP (glyph->object) | ||
| 15080 | ? 'B' | ||
| 15081 | : (STRINGP (glyph->object) | ||
| 15082 | ? 'S' | ||
| 15083 | : '-')), | ||
| 15084 | glyph->pixel_width, | ||
| 15085 | glyph->u.cmp_id, | ||
| 15086 | '.', | ||
| 15087 | glyph->face_id, | ||
| 15088 | glyph->left_box_line_p, | ||
| 15089 | glyph->right_box_line_p); | ||
| 15090 | } | ||
| 15038 | } | 15091 | } |
| 15039 | 15092 | ||
| 15040 | 15093 | ||
| @@ -21603,7 +21656,7 @@ erase_phys_cursor (w) | |||
| 21603 | /* Maybe clear the display under the cursor. */ | 21656 | /* Maybe clear the display under the cursor. */ |
| 21604 | if (w->phys_cursor_type == HOLLOW_BOX_CURSOR) | 21657 | if (w->phys_cursor_type == HOLLOW_BOX_CURSOR) |
| 21605 | { | 21658 | { |
| 21606 | int x, y; | 21659 | int x, y, left_x; |
| 21607 | int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); | 21660 | int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); |
| 21608 | int width; | 21661 | int width; |
| 21609 | 21662 | ||
| @@ -21611,11 +21664,16 @@ erase_phys_cursor (w) | |||
| 21611 | if (cursor_glyph == NULL) | 21664 | if (cursor_glyph == NULL) |
| 21612 | goto mark_cursor_off; | 21665 | goto mark_cursor_off; |
| 21613 | 21666 | ||
| 21614 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 21667 | width = cursor_glyph->pixel_width; |
| 21668 | left_x = window_box_left_offset (w, TEXT_AREA); | ||
| 21669 | x = w->phys_cursor.x; | ||
| 21670 | if (x < left_x) | ||
| 21671 | width -= left_x - x; | ||
| 21672 | width = min (width, window_box_width (w, TEXT_AREA) - x); | ||
| 21615 | y = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, cursor_row->y)); | 21673 | y = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, cursor_row->y)); |
| 21616 | width = min (cursor_glyph->pixel_width, | 21674 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, max (x, left_x)); |
| 21617 | window_box_width (w, TEXT_AREA) - w->phys_cursor.x); | ||
| 21618 | 21675 | ||
| 21676 | if (width > 0) | ||
| 21619 | rif->clear_frame_area (f, x, y, width, cursor_row->visible_height); | 21677 | rif->clear_frame_area (f, x, y, width, cursor_row->visible_height); |
| 21620 | } | 21678 | } |
| 21621 | 21679 | ||
diff --git a/src/xfaces.c b/src/xfaces.c index 2b2f1620133..9adc9218f6d 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -6762,6 +6762,12 @@ better_font_p (values, font1, font2, compare_pt_p, avgwidth) | |||
| 6762 | { | 6762 | { |
| 6763 | int i; | 6763 | int i; |
| 6764 | 6764 | ||
| 6765 | /* Any font is better than no font. */ | ||
| 6766 | if (! font1) | ||
| 6767 | return 0; | ||
| 6768 | if (! font2) | ||
| 6769 | return 1; | ||
| 6770 | |||
| 6765 | for (i = 0; i < DIM (font_sort_order); ++i) | 6771 | for (i = 0; i < DIM (font_sort_order); ++i) |
| 6766 | { | 6772 | { |
| 6767 | int xlfd_idx = font_sort_order[i]; | 6773 | int xlfd_idx = font_sort_order[i]; |
| @@ -7012,29 +7018,19 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike) | |||
| 7012 | if (needs_overstrike) | 7018 | if (needs_overstrike) |
| 7013 | *needs_overstrike = 0; | 7019 | *needs_overstrike = 0; |
| 7014 | 7020 | ||
| 7015 | /* Start with the first non-scalable font in the list. */ | 7021 | best = NULL; |
| 7016 | for (i = 0; i < nfonts; ++i) | ||
| 7017 | if (!font_scalable_p (fonts + i)) | ||
| 7018 | break; | ||
| 7019 | 7022 | ||
| 7020 | /* Find the best match among the non-scalable fonts. */ | 7023 | /* Find the best match among the non-scalable fonts. */ |
| 7021 | if (i < nfonts) | 7024 | for (i = 0; i < nfonts; ++i) |
| 7022 | { | 7025 | if (!font_scalable_p (fonts + i) |
| 7023 | best = fonts + i; | 7026 | && better_font_p (specified, fonts + i, best, 1, avgwidth)) |
| 7024 | 7027 | { | |
| 7025 | for (i = 1; i < nfonts; ++i) | 7028 | best = fonts + i; |
| 7026 | if (!font_scalable_p (fonts + i) | ||
| 7027 | && better_font_p (specified, fonts + i, best, 1, avgwidth)) | ||
| 7028 | { | ||
| 7029 | best = fonts + i; | ||
| 7030 | 7029 | ||
| 7031 | exact_p = exact_face_match_p (specified, best, avgwidth); | 7030 | exact_p = exact_face_match_p (specified, best, avgwidth); |
| 7032 | if (exact_p) | 7031 | if (exact_p) |
| 7033 | break; | 7032 | break; |
| 7034 | } | 7033 | } |
| 7035 | } | ||
| 7036 | else | ||
| 7037 | best = NULL; | ||
| 7038 | 7034 | ||
| 7039 | /* Unless we found an exact match among non-scalable fonts, see if | 7035 | /* Unless we found an exact match among non-scalable fonts, see if |
| 7040 | we can find a better match among scalable fonts. */ | 7036 | we can find a better match among scalable fonts. */ |
| @@ -7058,8 +7054,7 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike) | |||
| 7058 | for (i = 0; i < nfonts; ++i) | 7054 | for (i = 0; i < nfonts; ++i) |
| 7059 | if (font_scalable_p (fonts + i)) | 7055 | if (font_scalable_p (fonts + i)) |
| 7060 | { | 7056 | { |
| 7061 | if (best == NULL | 7057 | if (better_font_p (specified, fonts + i, best, 0, 0) |
| 7062 | || better_font_p (specified, fonts + i, best, 0, 0) | ||
| 7063 | || (!non_scalable_has_exact_height_p | 7058 | || (!non_scalable_has_exact_height_p |
| 7064 | && !better_font_p (specified, best, fonts + i, 0, 0))) | 7059 | && !better_font_p (specified, best, fonts + i, 0, 0))) |
| 7065 | { | 7060 | { |
| @@ -7067,23 +7062,27 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike) | |||
| 7067 | best = fonts + i; | 7062 | best = fonts + i; |
| 7068 | } | 7063 | } |
| 7069 | } | 7064 | } |
| 7065 | } | ||
| 7070 | 7066 | ||
| 7071 | if (needs_overstrike) | 7067 | /* We should have found SOME font. */ |
| 7072 | { | 7068 | if (best == NULL) |
| 7073 | enum xlfd_weight want_weight = specified[XLFD_WEIGHT]; | 7069 | abort (); |
| 7074 | enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT]; | ||
| 7075 | 7070 | ||
| 7076 | if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight) | 7071 | if (! exact_p && needs_overstrike) |
| 7077 | { | 7072 | { |
| 7078 | /* We want a bold font, but didn't get one; try to use | 7073 | enum xlfd_weight want_weight = specified[XLFD_WEIGHT]; |
| 7079 | overstriking instead to simulate bold-face. However, | 7074 | enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT]; |
| 7080 | don't overstrike an already-bold fontn unless the | 7075 | |
| 7081 | desired weight grossly exceeds the available weight. */ | 7076 | if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight) |
| 7082 | if (got_weight > XLFD_WEIGHT_MEDIUM) | 7077 | { |
| 7083 | *needs_overstrike = (got_weight - want_weight) > 2; | 7078 | /* We want a bold font, but didn't get one; try to use |
| 7084 | else | 7079 | overstriking instead to simulate bold-face. However, |
| 7085 | *needs_overstrike = 1; | 7080 | don't overstrike an already-bold fontn unless the |
| 7086 | } | 7081 | desired weight grossly exceeds the available weight. */ |
| 7082 | if (got_weight > XLFD_WEIGHT_MEDIUM) | ||
| 7083 | *needs_overstrike = (got_weight - want_weight) > 2; | ||
| 7084 | else | ||
| 7085 | *needs_overstrike = 1; | ||
| 7087 | } | 7086 | } |
| 7088 | } | 7087 | } |
| 7089 | 7088 | ||
| @@ -7488,7 +7487,7 @@ realize_default_face (f) | |||
| 7488 | face = realize_face (c, attrs, DEFAULT_FACE_ID); | 7487 | face = realize_face (c, attrs, DEFAULT_FACE_ID); |
| 7489 | 7488 | ||
| 7490 | #ifdef HAVE_WINDOW_SYSTEM | 7489 | #ifdef HAVE_WINDOW_SYSTEM |
| 7491 | #ifdef HAVE_X_WINDOWS | 7490 | #ifdef HAVE_X_WINDOWS |
| 7492 | if (face->font != FRAME_FONT (f)) | 7491 | if (face->font != FRAME_FONT (f)) |
| 7493 | /* As the font specified for the frame was not acceptable as a | 7492 | /* As the font specified for the frame was not acceptable as a |
| 7494 | font for the default face (perhaps because auto-scaled fonts | 7493 | font for the default face (perhaps because auto-scaled fonts |
diff --git a/src/xfns.c b/src/xfns.c index ed6d00d0325..b4d16615fb0 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -1256,7 +1256,7 @@ x_set_icon_name (f, arg, oldval) | |||
| 1256 | if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | 1256 | if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) |
| 1257 | return; | 1257 | return; |
| 1258 | } | 1258 | } |
| 1259 | else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | 1259 | else if (!NILP (arg) || NILP (oldval)) |
| 1260 | return; | 1260 | return; |
| 1261 | 1261 | ||
| 1262 | f->icon_name = arg; | 1262 | f->icon_name = arg; |
| @@ -1612,7 +1612,7 @@ x_set_name_internal (f, name) | |||
| 1612 | text.format = 8; | 1612 | text.format = 8; |
| 1613 | text.nitems = bytes; | 1613 | text.nitems = bytes; |
| 1614 | 1614 | ||
| 1615 | if (NILP (f->icon_name)) | 1615 | if (!STRINGP (f->icon_name)) |
| 1616 | { | 1616 | { |
| 1617 | icon = text; | 1617 | icon = text; |
| 1618 | } | 1618 | } |
diff --git a/src/xmenu.c b/src/xmenu.c index 2abf0a48319..8e994ac5efb 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -1301,9 +1301,119 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers) | |||
| 1301 | } | 1301 | } |
| 1302 | } | 1302 | } |
| 1303 | 1303 | ||
| 1304 | DEFUN ("menu-bar-open", Fmenu_bar_open, Smenu_bar_open, 0, 1, "i", | ||
| 1305 | doc: /* Start key navigation of the menu bar in FRAME. | ||
| 1306 | This initially opens the first menu bar item and you can then navigate with the | ||
| 1307 | arrow keys, select a menu entry with the return key or cancel with the | ||
| 1308 | escape key. If FRAME has no menu bar this function does nothing. | ||
| 1309 | |||
| 1310 | If FRAME is nil or not given, use the selected frame. */) | ||
| 1311 | (frame) | ||
| 1312 | Lisp_Object frame; | ||
| 1313 | { | ||
| 1314 | XEvent ev; | ||
| 1315 | FRAME_PTR f = check_x_frame (frame); | ||
| 1316 | Widget menubar; | ||
| 1317 | BLOCK_INPUT; | ||
| 1318 | |||
| 1319 | if (FRAME_EXTERNAL_MENU_BAR (f)) | ||
| 1320 | set_frame_menubar (f, 0, 1); | ||
| 1321 | |||
| 1322 | menubar = FRAME_X_OUTPUT (f)->menubar_widget; | ||
| 1323 | if (menubar) | ||
| 1324 | { | ||
| 1325 | Window child; | ||
| 1326 | int error_p = 0; | ||
| 1327 | |||
| 1328 | x_catch_errors (FRAME_X_DISPLAY (f)); | ||
| 1329 | memset (&ev, 0, sizeof ev); | ||
| 1330 | ev.xbutton.display = FRAME_X_DISPLAY (f); | ||
| 1331 | ev.xbutton.window = XtWindow (menubar); | ||
| 1332 | ev.xbutton.root = FRAME_X_DISPLAY_INFO (f)->root_window; | ||
| 1333 | ev.xbutton.time = XtLastTimestampProcessed (FRAME_X_DISPLAY (f)); | ||
| 1334 | ev.xbutton.button = Button1; | ||
| 1335 | ev.xbutton.x = ev.xbutton.y = FRAME_MENUBAR_HEIGHT (f) / 2; | ||
| 1336 | ev.xbutton.same_screen = True; | ||
| 1337 | |||
| 1338 | #ifdef USE_MOTIF | ||
| 1339 | { | ||
| 1340 | Arg al[2]; | ||
| 1341 | WidgetList list; | ||
| 1342 | Cardinal nr; | ||
| 1343 | XtSetArg (al[0], XtNchildren, &list); | ||
| 1344 | XtSetArg (al[1], XtNnumChildren, &nr); | ||
| 1345 | XtGetValues (menubar, al, 2); | ||
| 1346 | ev.xbutton.window = XtWindow (list[0]); | ||
| 1347 | } | ||
| 1348 | #endif | ||
| 1349 | |||
| 1350 | XTranslateCoordinates (FRAME_X_DISPLAY (f), | ||
| 1351 | /* From-window, to-window. */ | ||
| 1352 | ev.xbutton.window, ev.xbutton.root, | ||
| 1353 | |||
| 1354 | /* From-position, to-position. */ | ||
| 1355 | ev.xbutton.x, ev.xbutton.y, | ||
| 1356 | &ev.xbutton.x_root, &ev.xbutton.y_root, | ||
| 1357 | |||
| 1358 | /* Child of win. */ | ||
| 1359 | &child); | ||
| 1360 | error_p = x_had_errors_p (FRAME_X_DISPLAY (f)); | ||
| 1361 | x_uncatch_errors (); | ||
| 1362 | |||
| 1363 | if (! error_p) | ||
| 1364 | { | ||
| 1365 | ev.type = ButtonPress; | ||
| 1366 | ev.xbutton.state = 0; | ||
| 1367 | |||
| 1368 | XtDispatchEvent (&ev); | ||
| 1369 | ev.xbutton.type = ButtonRelease; | ||
| 1370 | ev.xbutton.state = Button1Mask; | ||
| 1371 | XtDispatchEvent (&ev); | ||
| 1372 | } | ||
| 1373 | } | ||
| 1374 | |||
| 1375 | UNBLOCK_INPUT; | ||
| 1376 | |||
| 1377 | return Qnil; | ||
| 1378 | } | ||
| 1304 | #endif /* USE_X_TOOLKIT */ | 1379 | #endif /* USE_X_TOOLKIT */ |
| 1305 | 1380 | ||
| 1381 | |||
| 1306 | #ifdef USE_GTK | 1382 | #ifdef USE_GTK |
| 1383 | DEFUN ("menu-bar-open", Fmenu_bar_open, Smenu_bar_open, 0, 1, "i", | ||
| 1384 | doc: /* Start key navigation of the menu bar in FRAME. | ||
| 1385 | This initially opens the first menu bar item and you can then navigate with the | ||
| 1386 | arrow keys, select a menu entry with the return key or cancel with the | ||
| 1387 | escape key. If FRAME has no menu bar this function does nothing. | ||
| 1388 | |||
| 1389 | If FRAME is nil or not given, use the selected frame. */) | ||
| 1390 | (frame) | ||
| 1391 | Lisp_Object frame; | ||
| 1392 | { | ||
| 1393 | GtkWidget *menubar; | ||
| 1394 | BLOCK_INPUT; | ||
| 1395 | FRAME_PTR f = check_x_frame (frame); | ||
| 1396 | |||
| 1397 | if (FRAME_EXTERNAL_MENU_BAR (f)) | ||
| 1398 | set_frame_menubar (f, 0, 1); | ||
| 1399 | |||
| 1400 | menubar = FRAME_X_OUTPUT (f)->menubar_widget; | ||
| 1401 | if (menubar) | ||
| 1402 | { | ||
| 1403 | /* Activate the first menu. */ | ||
| 1404 | GList *children = gtk_container_get_children (GTK_CONTAINER (menubar)); | ||
| 1405 | |||
| 1406 | gtk_menu_shell_select_item (GTK_MENU_SHELL (menubar), | ||
| 1407 | GTK_WIDGET (children->data)); | ||
| 1408 | |||
| 1409 | popup_activated_flag = 1; | ||
| 1410 | g_list_free (children); | ||
| 1411 | } | ||
| 1412 | UNBLOCK_INPUT; | ||
| 1413 | |||
| 1414 | return Qnil; | ||
| 1415 | } | ||
| 1416 | |||
| 1307 | /* Loop util popup_activated_flag is set to zero in a callback. | 1417 | /* Loop util popup_activated_flag is set to zero in a callback. |
| 1308 | Used for popup menus and dialogs. */ | 1418 | Used for popup menus and dialogs. */ |
| 1309 | 1419 | ||
| @@ -3659,6 +3769,13 @@ The enable predicate for a menu command should check this variable. */); | |||
| 3659 | #endif | 3769 | #endif |
| 3660 | 3770 | ||
| 3661 | defsubr (&Sx_popup_menu); | 3771 | defsubr (&Sx_popup_menu); |
| 3772 | |||
| 3773 | #if defined (USE_GTK) || defined (USE_X_TOOLKIT) | ||
| 3774 | defsubr (&Smenu_bar_open); | ||
| 3775 | Fdefalias (intern ("accelerate-menu"), intern (Smenu_bar_open.symbol_name), | ||
| 3776 | Qnil); | ||
| 3777 | #endif | ||
| 3778 | |||
| 3662 | #ifdef HAVE_MENUS | 3779 | #ifdef HAVE_MENUS |
| 3663 | defsubr (&Sx_popup_dialog); | 3780 | defsubr (&Sx_popup_dialog); |
| 3664 | #endif | 3781 | #endif |
diff --git a/src/xterm.c b/src/xterm.c index c25f23cc573..7407585ebf0 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -326,20 +326,8 @@ static int x_alloc_nearest_color_1 P_ ((Display *, Colormap, XColor *)); | |||
| 326 | static void x_set_window_size_1 P_ ((struct frame *, int, int, int)); | 326 | static void x_set_window_size_1 P_ ((struct frame *, int, int, int)); |
| 327 | static const XColor *x_color_cells P_ ((Display *, int *)); | 327 | static const XColor *x_color_cells P_ ((Display *, int *)); |
| 328 | static void x_update_window_end P_ ((struct window *, int, int)); | 328 | static void x_update_window_end P_ ((struct window *, int, int)); |
| 329 | void x_delete_display P_ ((struct x_display_info *)); | ||
| 330 | 329 | ||
| 331 | static int x_io_error_quitter P_ ((Display *)); | 330 | static int x_io_error_quitter P_ ((Display *)); |
| 332 | void x_catch_errors P_ ((Display *)); | ||
| 333 | void x_uncatch_errors P_ ((void)); | ||
| 334 | void x_lower_frame P_ ((struct frame *)); | ||
| 335 | void x_scroll_bar_clear P_ ((struct frame *)); | ||
| 336 | int x_had_errors_p P_ ((Display *)); | ||
| 337 | void x_wm_set_size_hint P_ ((struct frame *, long, int)); | ||
| 338 | void x_raise_frame P_ ((struct frame *)); | ||
| 339 | void x_set_window_size P_ ((struct frame *, int, int, int)); | ||
| 340 | void x_wm_set_window_state P_ ((struct frame *, int)); | ||
| 341 | void x_wm_set_icon_pixmap P_ ((struct frame *, int)); | ||
| 342 | void x_initialize P_ ((void)); | ||
| 343 | static void x_font_min_bounds P_ ((XFontStruct *, int *, int *)); | 331 | static void x_font_min_bounds P_ ((XFontStruct *, int *, int *)); |
| 344 | static int x_compute_min_glyph_bounds P_ ((struct frame *)); | 332 | static int x_compute_min_glyph_bounds P_ ((struct frame *)); |
| 345 | static void x_update_end P_ ((struct frame *)); | 333 | static void x_update_end P_ ((struct frame *)); |
| @@ -374,6 +362,7 @@ static void x_check_fullscreen P_ ((struct frame *)); | |||
| 374 | static void x_check_expected_move P_ ((struct frame *)); | 362 | static void x_check_expected_move P_ ((struct frame *)); |
| 375 | static int handle_one_xevent P_ ((struct x_display_info *, XEvent *, | 363 | static int handle_one_xevent P_ ((struct x_display_info *, XEvent *, |
| 376 | int *, struct input_event *)); | 364 | int *, struct input_event *)); |
| 365 | static SIGTYPE x_connection_closed P_ ((Display *, char *)); | ||
| 377 | 366 | ||
| 378 | 367 | ||
| 379 | /* 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. */ |
| @@ -2694,19 +2683,28 @@ x_draw_stretch_glyph_string (s) | |||
| 2694 | { | 2683 | { |
| 2695 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor | 2684 | /* If `x-stretch-block-cursor' is nil, don't draw a block cursor |
| 2696 | as wide as the stretch glyph. */ | 2685 | as wide as the stretch glyph. */ |
| 2697 | int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width); | 2686 | int width, background_width = s->background_width; |
| 2687 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | ||
| 2688 | |||
| 2689 | if (x < left_x) | ||
| 2690 | { | ||
| 2691 | background_width -= left_x - x; | ||
| 2692 | x = left_x; | ||
| 2693 | } | ||
| 2694 | width = min (FRAME_COLUMN_WIDTH (s->f), background_width); | ||
| 2698 | 2695 | ||
| 2699 | /* Draw cursor. */ | 2696 | /* Draw cursor. */ |
| 2700 | x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); | 2697 | x_draw_glyph_string_bg_rect (s, x, s->y, width, s->height); |
| 2701 | 2698 | ||
| 2702 | /* Clear rest using the GC of the original non-cursor face. */ | 2699 | /* Clear rest using the GC of the original non-cursor face. */ |
| 2703 | if (width < s->background_width) | 2700 | if (width < background_width) |
| 2704 | { | 2701 | { |
| 2705 | int x = s->x + width, y = s->y; | 2702 | int y = s->y; |
| 2706 | int w = s->background_width - width, h = s->height; | 2703 | int w = background_width - width, h = s->height; |
| 2707 | XRectangle r; | 2704 | XRectangle r; |
| 2708 | GC gc; | 2705 | GC gc; |
| 2709 | 2706 | ||
| 2707 | x += width; | ||
| 2710 | if (s->row->mouse_face_p | 2708 | if (s->row->mouse_face_p |
| 2711 | && cursor_in_mouse_face_p (s->w)) | 2709 | && cursor_in_mouse_face_p (s->w)) |
| 2712 | { | 2710 | { |
| @@ -2737,8 +2735,18 @@ x_draw_stretch_glyph_string (s) | |||
| 2737 | } | 2735 | } |
| 2738 | } | 2736 | } |
| 2739 | else if (!s->background_filled_p) | 2737 | else if (!s->background_filled_p) |
| 2740 | x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, | 2738 | { |
| 2741 | s->height); | 2739 | int background_width = s->background_width; |
| 2740 | int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); | ||
| 2741 | |||
| 2742 | if (x < left_x) | ||
| 2743 | { | ||
| 2744 | background_width -= left_x - x; | ||
| 2745 | x = left_x; | ||
| 2746 | } | ||
| 2747 | if (background_width > 0) | ||
| 2748 | x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); | ||
| 2749 | } | ||
| 2742 | 2750 | ||
| 2743 | s->background_filled_p = 1; | 2751 | s->background_filled_p = 1; |
| 2744 | } | 2752 | } |
| @@ -6320,6 +6328,8 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) | |||
| 6320 | 6328 | ||
| 6321 | f = x_any_window_to_frame (dpyinfo, event.xkey.window); | 6329 | f = x_any_window_to_frame (dpyinfo, event.xkey.window); |
| 6322 | 6330 | ||
| 6331 | /* If mouse-highlight is an integer, input clears out | ||
| 6332 | mouse highlighting. */ | ||
| 6323 | if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) | 6333 | if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) |
| 6324 | && (f == 0 | 6334 | && (f == 0 |
| 6325 | || !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))) | 6335 | || !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))) |
| @@ -7375,8 +7385,7 @@ x_draw_hollow_cursor (w, row) | |||
| 7375 | return; | 7385 | return; |
| 7376 | 7386 | ||
| 7377 | /* Compute frame-relative coordinates for phys cursor. */ | 7387 | /* Compute frame-relative coordinates for phys cursor. */ |
| 7378 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 7388 | get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h); |
| 7379 | y = get_phys_cursor_geometry (w, row, cursor_glyph, &h); | ||
| 7380 | wd = w->phys_cursor_width; | 7389 | wd = w->phys_cursor_width; |
| 7381 | 7390 | ||
| 7382 | /* The foreground of cursor_gc is typically the same as the normal | 7391 | /* The foreground of cursor_gc is typically the same as the normal |
diff --git a/src/xterm.h b/src/xterm.h index 8e1e06097a8..1d1319fca31 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -962,10 +962,6 @@ void x_delete_display P_ ((struct x_display_info *)); | |||
| 962 | void x_make_frame_visible P_ ((struct frame *)); | 962 | void x_make_frame_visible P_ ((struct frame *)); |
| 963 | void x_iconify_frame P_ ((struct frame *)); | 963 | void x_iconify_frame P_ ((struct frame *)); |
| 964 | void x_wm_set_size_hint P_ ((struct frame *, long, int)); | 964 | void x_wm_set_size_hint P_ ((struct frame *, long, int)); |
| 965 | void x_catch_errors P_ ((Display *)); | ||
| 966 | int x_had_errors_p P_ ((Display *)); | ||
| 967 | void x_uncatch_errors P_ ((void)); | ||
| 968 | void x_check_errors P_ ((Display *, char *)); | ||
| 969 | int x_text_icon P_ ((struct frame *, char *)); | 965 | int x_text_icon P_ ((struct frame *, char *)); |
| 970 | int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); | 966 | int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); |
| 971 | void x_set_window_size P_ ((struct frame *, int, int, int)); | 967 | void x_set_window_size P_ ((struct frame *, int, int, int)); |
| @@ -981,7 +977,10 @@ extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); | |||
| 981 | extern void x_catch_errors P_ ((Display *)); | 977 | extern void x_catch_errors P_ ((Display *)); |
| 982 | extern void x_check_errors P_ ((Display *, char *)); | 978 | extern void x_check_errors P_ ((Display *, char *)); |
| 983 | extern int x_had_errors_p P_ ((Display *)); | 979 | extern int x_had_errors_p P_ ((Display *)); |
| 980 | extern int x_catching_errors P_ ((void)); | ||
| 984 | extern void x_uncatch_errors P_ ((void)); | 981 | extern void x_uncatch_errors P_ ((void)); |
| 982 | extern void x_clear_errors P_ ((Display *)); | ||
| 983 | extern void x_fully_uncatch_errors P_ ((void)); | ||
| 985 | extern void x_set_window_size P_ ((struct frame *, int, int, int)); | 984 | extern void x_set_window_size P_ ((struct frame *, int, int, int)); |
| 986 | extern void x_set_mouse_position P_ ((struct frame *, int, int)); | 985 | extern void x_set_mouse_position P_ ((struct frame *, int, int)); |
| 987 | extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int)); | 986 | extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int)); |
| @@ -1000,6 +999,9 @@ extern void x_initialize P_ ((void)); | |||
| 1000 | extern unsigned long x_copy_color P_ ((struct frame *, unsigned long)); | 999 | extern unsigned long x_copy_color P_ ((struct frame *, unsigned long)); |
| 1001 | #ifdef USE_X_TOOLKIT | 1000 | #ifdef USE_X_TOOLKIT |
| 1002 | extern XtAppContext Xt_app_con; | 1001 | extern XtAppContext Xt_app_con; |
| 1002 | extern int x_alloc_lighter_color_for_widget __P ((Widget, Display*, Colormap, | ||
| 1003 | unsigned long *, | ||
| 1004 | double, int)); | ||
| 1003 | #endif | 1005 | #endif |
| 1004 | extern void x_query_colors P_ ((struct frame *f, XColor *, int)); | 1006 | extern void x_query_colors P_ ((struct frame *f, XColor *, int)); |
| 1005 | extern void x_query_color P_ ((struct frame *f, XColor *)); | 1007 | extern void x_query_color P_ ((struct frame *f, XColor *)); |